@@ -451,7 +451,6 @@ func (a *Mysis) SendMessageFrom(content string, source store.MemorySource, sende
451451
452452 // Execute each tool call
453453 for _, tc := range response.ToolCalls {
454- a.updateActivityFromToolCall(tc.Name)
455454 // Signal MCP activity
456455 a.bus.Publish(Event{
457456 Type: EventNetworkMCP,
@@ -461,7 +460,7 @@ func (a *Mysis) SendMessageFrom(content string, source store.MemorySource, sende
461460 })
462461
463462 result, execErr := a.executeToolCall(ctx, mcpProxy, tc)
464- a.updateActivityFromToolResult(tc.Name, result, execErr)
463+ a.updateActivityFromToolResult(result, execErr)
465464
466465 // Store the tool result
467466 resultContent := a.formatToolResult(tc.ID, tc.Name, result, execErr)
@@ -767,7 +766,7 @@ func (a *Mysis) compactSnapshots(memories []*store.Memory) []*store.Memory {
767766 }
768767
769768 // If this is a snapshot tool, track its position
770- if constants.SnapshotTools[toolName] {
769+ if a.isSnapshotTool(toolName) {
771770 latestSnapshot[toolName] = i
772771 }
773772 }
@@ -789,7 +788,7 @@ func (a *Mysis) compactSnapshots(memories []*store.Memory) []*store.Memory {
789788 }
790789
791790 // If this is a snapshot tool, only keep if it's the latest
792- if constants.SnapshotTools[toolName] {
791+ if a.isSnapshotTool(toolName) {
793792 if latestSnapshot[toolName] == i {
794793 result = append(result, m)
795794 }
@@ -835,6 +834,21 @@ func (a *Mysis) toolCallNameIndex(memories []*store.Memory) map[string]string {
835834 return index
836835 }
837836
837+func (a *Mysis) isSnapshotTool(toolName string) bool {
838+ if toolName == "" {
839+ return false
840+ }
841+ if strings.HasPrefix(toolName, "get_") {
842+ return true
843+ }
844+ switch toolName {
845+ case "zoea_swarm_status", "zoea_list_myses":
846+ return true
847+ default:
848+ return false
849+ }
850+}
851+
838852 // run is the mysis main processing loop.
839853 func (a *Mysis) run(ctx context.Context) {
840854 // Ticker to nudge the mysis if it's idle
@@ -950,24 +964,8 @@ func (a *Mysis) shouldNudge(now time.Time) bool {
950964 return true
951965 }
952966
953-func (a *Mysis) updateActivityFromToolCall(toolName string) {
954- switch toolName {
955- case "travel":
956- a.setActivity(ActivityStateTraveling, time.Now().Add(constants.WaitStateNudgeInterval))
957- case "mine":
958- a.setActivity(ActivityStateMining, time.Time{})
959- case "attack", "attack_base":
960- a.setActivity(ActivityStateInCombat, time.Time{})
961- }
962-}
963-
964-func (a *Mysis) updateActivityFromToolResult(toolName string, result *mcp.ToolResult, err error) {
967+func (a *Mysis) updateActivityFromToolResult(result *mcp.ToolResult, err error) {
965968 if err != nil || result == nil || result.IsError {
966- a.clearActivityIf(ActivityStateMining)
967- a.clearActivityIf(ActivityStateInCombat)
968- if toolName == "travel" {
969- a.setActivity(ActivityStateIdle, time.Time{})
970- }
971969 return
972970 }
973971
@@ -982,31 +980,34 @@ func (a *Mysis) updateActivityFromToolResult(toolName string, result *mcp.ToolRe
982980 }
983981 }
984982
985- if toolName == "travel" {
986- arrivalTick, found := findIntField(payload, "arrival_tick")
987- if found {
988- if currentTickOK && arrivalTick <= currentTick {
989- a.setActivity(ActivityStateIdle, time.Time{})
990- return
991- }
992- until := a.estimateTravelUntil(now, arrivalTick, currentTick, currentTickOK)
993- a.setActivity(ActivityStateTraveling, until)
983+ arrivalTick, found := findIntField(payload, "arrival_tick", "travel_arrival_tick")
984+ if found {
985+ if currentTickOK && arrivalTick <= currentTick {
986+ a.setActivity(ActivityStateIdle, time.Time{})
987+ return
994988 }
989+ until := a.estimateTravelUntil(now, arrivalTick, currentTick, currentTickOK)
990+ a.setActivity(ActivityStateTraveling, until)
995991 return
996992 }
997993
994+ if progress, ok := findFloatField(payload, "travel_progress"); ok {
995+ if progress >= 1 {
996+ a.setActivity(ActivityStateIdle, time.Time{})
997+ return
998+ }
999+ if progress > 0 {
1000+ a.setActivity(ActivityStateTraveling, now.Add(constants.WaitStateNudgeInterval))
1001+ return
1002+ }
1003+ }
1004+
9981005 if cooldownTicks, found := findIntField(payload, "cooldown_ticks", "cooldown_remaining"); found && cooldownTicks > 0 {
9991006 until := a.estimateCooldownUntil(now, cooldownTicks)
10001007 a.setActivity(ActivityStateCooldown, until)
10011008 return
10021009 }
10031010
1004- switch toolName {
1005- case "mine":
1006- a.clearActivityIf(ActivityStateMining)
1007- case "attack", "attack_base":
1008- a.clearActivityIf(ActivityStateInCombat)
1009- }
10101011 }
10111012
10121013 func (a *Mysis) setActivity(state ActivityState, until time.Time) {
@@ -1133,6 +1134,39 @@ func findIntField(payload interface{}, keys ...string) (int64, bool) {
11331134 return 0, false
11341135 }
11351136
1137+func findFloatField(payload interface{}, keys ...string) (float64, bool) {
1138+ queue := []interface{}{payload}
1139+
1140+ for len(queue) > 0 {
1141+ current := queue[0]
1142+ queue = queue[1:]
1143+
1144+ switch value := current.(type) {
1145+ case map[string]interface{}:
1146+ for _, key := range keys {
1147+ if raw, ok := value[key]; ok {
1148+ if number, ok := normalizeFloat(raw); ok {
1149+ return number, true
1150+ }
1151+ }
1152+ }
1153+
1154+ childKeys := make([]string, 0, len(value))
1155+ for key := range value {
1156+ childKeys = append(childKeys, key)
1157+ }
1158+ sort.Strings(childKeys)
1159+ for _, key := range childKeys {
1160+ queue = append(queue, value[key])
1161+ }
1162+ case []interface{}:
1163+ queue = append(queue, value...)
1164+ }
1165+ }
1166+
1167+ return 0, false
1168+}
1169+
11361170 func findCurrentTick(payload interface{}) (int64, bool) {
11371171 if number, ok := findIntFieldAtKeys(payload, "current_tick"); ok {
11381172 return number, true
@@ -1217,6 +1251,31 @@ func normalizeInt(value interface{}) (int64, bool) {
12171251 }
12181252 }
12191253
1254+func normalizeFloat(value interface{}) (float64, bool) {
1255+ switch v := value.(type) {
1256+ case int:
1257+ return float64(v), true
1258+ case int64:
1259+ return float64(v), true
1260+ case float64:
1261+ return v, true
1262+ case json.Number:
1263+ number, err := v.Float64()
1264+ if err != nil {
1265+ return 0, false
1266+ }
1267+ return number, true
1268+ case string:
1269+ number, err := strconv.ParseFloat(v, 64)
1270+ if err != nil {
1271+ return 0, false
1272+ }
1273+ return number, true
1274+ default:
1275+ return 0, false
1276+ }
1277+}
1278+
12201279 func (a *Mysis) emitStateChange(oldState, newState MysisState) {
12211280 a.publishCriticalEvent(Event{
12221281 Type: EventMysisStateChanged,