picoclaw/pkg/commands
Guoguo 6ca7311273
feat(agent): add context usage ring indicator and /context command (#2537)
Add a context window usage indicator to the web chat UI and a /context
slash command that works across all channels.

Backend:
- Add computeContextUsage() estimating history + system + tool tokens
- Attach ContextUsage to outbound messages via the pico WebSocket protocol
- Add /context command showing context stats as formatted text
- Add EstimateSystemTokens() on ContextBuilder for system prompt estimation

Frontend:
- Add ContextUsageRing component (SVG ring + hover/tap popover)
- Show usage percentage, token counts, and compression threshold
- Hover on desktop (150ms leave delay), tap on mobile
- "View Details" sends /context with 1s cooldown
- i18n support (en/zh) for popover labels

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-21 16:30:02 +08:00
..
builtin.go feat(agent): add context usage ring indicator and /context command (#2537) 2026-04-21 16:30:02 +08:00
builtin_test.go feat(agent): support btw side questions (#2532) 2026-04-16 10:53:09 +08:00
cmd_btw.go feat(agent): support btw side questions (#2532) 2026-04-16 10:53:09 +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_context.go feat(agent): add context usage ring indicator and /context command (#2537) 2026-04-21 16:30:02 +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(skills): add channel commands to list and force installed skills 2026-03-22 15:33:25 +01:00
cmd_reload.go feat: add /reload to gateway api and command (#1725) 2026-03-19 13:42:36 +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
cmd_use.go feat(skills): add channel commands to list and force installed skills 2026-03-22 15:33:25 +01: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(skills): add channel commands to list and force installed skills 2026-03-22 15:33:25 +01: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): add context usage ring indicator and /context command (#2537) 2026-04-21 16:30:02 +08:00
show_list_handlers_test.go feat(skills): add channel commands to list and force installed skills 2026-03-22 15:33:25 +01:00