picoclaw/web/frontend/src/hooks
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
..
use-chat-models.ts feat(web): refine model availability states and preserve API key preview placeholder (#2226) 2026-03-31 22:52:04 +08:00
use-credentials-page.ts feat(web): migrate launcher to modular web frontend/backend and improve management UX (#1275) 2026-03-09 19:42:03 +08:00
use-gateway-logs.ts feat: add web gateway hot reload and polling state sync (#1684) 2026-03-17 18:46:00 +08:00
use-gateway.ts fix(web): restore chat composer disabled-state messaging and clean up code (#2526) 2026-04-15 11:24:27 +08:00
use-highlight-theme.ts refactor(web): improve theme style element management in useHighlightTheme hook 2026-04-15 18:30:43 +08:00
use-log-wrap-columns.ts fix(web): render ansi logs with wrapped lines (#1425) 2026-03-12 19:12:19 +08:00
use-mobile.ts feat(web): migrate launcher to modular web frontend/backend and improve management UX (#1275) 2026-03-09 19:42:03 +08:00
use-pico-chat.ts feat(agent): add context usage ring indicator and /context command (#2537) 2026-04-21 16:30:02 +08:00
use-session-history.ts feat(web): support image messages in pico chat (#2299) 2026-04-03 14:15:20 +08:00
use-sidebar-channels.ts Merge pull request #1955 from alexhoshina/refactor/wecom 2026-03-24 23:37:35 +08:00
use-theme.ts feat(web): migrate launcher to modular web frontend/backend and improve management UX (#1275) 2026-03-09 19:42:03 +08:00