* tui: migrate from Ink to OpenTUI for improved input performance
Replace Ink with OpenTUI (@opentui/core, @opentui/react) to fix input lag
issues that were noticeable in long conversations.
Key changes:
- Add ink-shim.tsx compatibility layer to minimize component rewrites
- Replace manual chalk/marked markdown rendering with native <Markdown>
- Use TreeSitter-based syntax highlighting via OpenTUI
- Add ScrollBox with sticky scroll for better chat UX
- Refactor text-input to use segment-based rendering with attributes
- Update renderer initialization to use OpenTUI's createCliRenderer
The shim layer preserves Ink's API surface (Box, Text, useInput, useApp)
while using OpenTUI's renderer underneath. This enables incremental
migration to native OpenTUI patterns in follow-up work.
Removed dependencies: ink, ink-spinner, ink-text-input, cli-highlight
Added dependencies: @opentui/core, @opentui/react
* tui: align layout rows and centralize primary color
* tui: keep tool output readable in narrow terminals
* tui: align assistant text and show copy feedback
* tui: refine input shortcuts and mouse filtering
* tui: chunk stream output by line
* web: format avatar and dropdown menu components
* db: format migration metadata
* tui: use OpenTUI diff and code previews
* tui: refine clipboard toast styling
* fix: fetch models via web api
* feat: surface model context limits
* tui: improve interruption and question flow readability
* fix tui auto-submit after abort
* tui: keep input visible on typing
* chore: add ci script for core checks
* docs: note ci script in agent guide
* fix: use authenticated gateway models
* fix: enrich gateway models with context limits
* update lock
* update agents md
* Add token usage reporting for subagents
Display input tokens inline in task views next to tool count and duration.
Shows tokens while streaming and final count on completion.
Changes:
- Add messageMetadata callback to task tool to attach usage data
- Add token display to TUI and web task-group-view components
- Add tokens to task-renderer completion views
- Refactor web task-renderer to use proper types instead of casts
- Switch tool-call.tsx to narrow on part.type instead of derived string
- Add SubagentUIMessage type for proper typing of subagent output
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Consolidate formatTokens and improve type safety
- Move formatTokens to shared package to eliminate duplication across 4 files
- Add getToolSummary helper with proper type narrowing (replaces unsafe cast)
- Simplify IIFE patterns to ternary expressions in task renderers
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix tool-write and tool-edit summaries in task renderers
The getToolSummary function was missing cases for tool-write and tool-edit,
causing file paths to not display for executor subagent operations. Updated
SubagentUIMessage to be a union of both explorer and executor types so
TypeScript recognizes these tool types.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Refactor token usage metadata to track last step and total usage separately
Changes metadata from { usage } to { lastStepUsage, totalMessageUsage } to
distinguish between context window utilization (last step) and cumulative
token usage across all steps in a message.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix type safety in CLI task renderer
Replace loose typing and unsafe casts with proper SubagentMessagePart
type derived from SubagentUIMessage. Add getToolSummary function that
uses discriminated union narrowing for type-safe tool input access.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Remove .js extensions from all imports across the monorepo
Aligns import style by removing .js extensions from all packages,
not just those consumed by the web app. Updates AGENTS.md to reflect
the consistent rule and marks the tech debt item as completed.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix formatting
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>