diff --git a/pkg/commands/deps.go b/pkg/commands/deps.go new file mode 100644 index 000000000..10bee236a --- /dev/null +++ b/pkg/commands/deps.go @@ -0,0 +1,14 @@ +package commands + +import "github.com/sipeed/picoclaw/pkg/config" + +// Deps provides runtime data to command handlers without importing +// agent or channel packages. Function fields are called at handler +// invocation time, not at construction time, so late-bound values +// (e.g. channelManager set after NewAgentLoop) are visible. +type Deps struct { + Config *config.Config + GetModelInfo func() (name, provider string) + ListAgentIDs func() []string + GetEnabledChannels func() []string +} diff --git a/pkg/commands/dispatcher.go b/pkg/commands/dispatcher.go index e6596a15c..576735763 100644 --- a/pkg/commands/dispatcher.go +++ b/pkg/commands/dispatcher.go @@ -57,15 +57,14 @@ func trimCommandPrefix(token string) (string, bool) { return "", false } +func secondToken(input string) string { + parts := strings.Fields(strings.TrimSpace(input)) + if len(parts) < 2 { + return "" + } + return parts[1] +} + func normalizeCommandName(name string) string { return strings.ToLower(strings.TrimSpace(name)) } - -func contains(items []string, target string) bool { - for _, item := range items { - if item == target { - return true - } - } - return false -}