picoclaw/pkg/commands
Administrator 777230dcd1 feat(agent): implement /subagents command and fix sub-turn observability
- Added `/subagents` platform command to visualize the active task tree.
- Implemented GetAllActiveTurns and FormatTree in AgentLoop to support cross-session observability.
- Fixed a bug where sub-turns spawned via tools were not registered in the global `activeTurnStates` map, making them invisible to system queries.
- Enhanced tree rendering logic to identify and display "orphaned" subagents (children that outlive their parent turns).
- Registered the new command in `builtin.go` and injected the turn state provider into the commands runtime.

Modified Files:
- pkg/agent/turn_state.go: Added TurnInfo snapshotting and recursive tree formatting.
- pkg/agent/loop.go: Injected GetActiveTurn hook and implemented multi-root forest rendering.
- pkg/agent/subturn.go: Added child turn registration into activeTurnStates.
- pkg/commands/cmd_subagents.go: New command implementation.
- pkg/commands/builtin.go: Command registration.
2026-03-18 14:46:20 +08:00
..
builtin.go feat(agent): implement /subagents command and fix sub-turn observability 2026-03-18 14:46:20 +08:00
builtin_test.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
cmd_check.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
cmd_clear.go feat: add /clear command to clear chat history (#1266) 2026-03-09 16:39:33 +08:00
cmd_help.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
cmd_list.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
cmd_show.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
cmd_start.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
cmd_subagents.go feat(agent): implement /subagents command and fix sub-turn observability 2026-03-18 14:46:20 +08:00
cmd_switch.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
cmd_switch_test.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
definition.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
definition_test.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
executor.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
executor_test.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
handler_agents.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
registry.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
registry_test.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
request.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
request_test.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00
runtime.go feat(agent): implement /subagents command and fix sub-turn observability 2026-03-18 14:46:20 +08:00
show_list_handlers_test.go feat(commands): centralized command registry with sub-command routing (#959) 2026-03-06 17:31:40 +08:00