mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
777230dcd1
- 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.
19 lines
768 B
Go
19 lines
768 B
Go
package commands
|
|
|
|
import "github.com/sipeed/picoclaw/pkg/config"
|
|
|
|
// Runtime provides runtime dependencies to command handlers. It is constructed
|
|
// per-request by the agent loop so that per-request state (like session scope)
|
|
// can coexist with long-lived callbacks (like GetModelInfo).
|
|
type Runtime struct {
|
|
Config *config.Config
|
|
GetModelInfo func() (name, provider string)
|
|
ListAgentIDs func() []string
|
|
ListDefinitions func() []Definition
|
|
GetEnabledChannels func() []string
|
|
GetActiveTurn func() interface{} // Returning interface{} to avoid circular dependency with agent package
|
|
SwitchModel func(value string) (oldModel string, err error)
|
|
SwitchChannel func(value string) error
|
|
ClearHistory func() error
|
|
}
|