BorderedLoader receives theme as a parameter but was creating
DynamicBorder() without passing it, causing DynamicBorder to
fall back to the global theme variable which is undefined when
loaded via jiti (separate module cache).
Added doc comment to DynamicBorder explaining the jiti issue.
Move line count from header to footer to avoid changing the first line
during streaming, which was triggering full screen re-renders in the
TUI's differential rendering logic.
Transfers context to a new focused session instead of compacting.
User provides a goal, hook generates a prompt with relevant context,
creates a new session with parent tracking, and loads the prompt
as a draft in the editor for review.
Inspired by Amp's handoff feature.
CustomToolContext now has:
- isIdle() - check if agent is streaming
- hasQueuedMessages() - check if user has queued messages
- abort() - abort current operation (fire-and-forget)
Changed abort() signature from Promise<void> to void in both
HookContext and CustomToolContext. The abort is fire-and-forget:
it calls session.abort() without awaiting, so the abort signal
is set immediately while waitForIdle() runs in the background.
Fixes#388
HookContext (all events):
- isIdle() - read-only state check
- hasQueuedMessages() - read-only state check
- abort() - fire-and-forget, does not wait
HookCommandContext (slash commands only):
- waitForIdle() - waits for agent to finish
- newSession(options?) - create new session
- branch(entryId) - branch from entry
- navigateTree(targetId, options?) - navigate session tree
Session control methods moved from HookAPI (pi.*) to HookCommandContext (ctx.*)
because they can deadlock when called from event handlers that run inside
the agent loop (tool_call, tool_result, context events).
HookAPI additions:
- pi.newSession(options?) - create new session with optional setup callback
- pi.branch(entryId) - branch from a specific entry
- pi.navigateTree(targetId, options?) - navigate the session tree
HookContext additions:
- ctx.isIdle() - check if agent is streaming
- ctx.waitForIdle() - wait for agent to finish
- ctx.abort() - abort current operation
- ctx.hasQueuedMessages() - check for queued user messages
These enable hooks to programmatically manage sessions (handoff, templates)
and check agent state before showing interactive UI.
Fixes#388
- Remove session_before_new and session_new hook events
- Add reason: 'new' | 'resume' to session_before_switch and session_switch events
- Remove 'new' reason from custom tool onSession (use 'switch' for both /new and /resume)
- Rename reset() to newSession(options?) in AgentSession
- Add NewSessionOptions with optional parentSession for lineage tracking
- Rename branchedFrom to parentSession in SessionHeader
- Rename RPC reset command to new_session with optional parentSession
- Update example hooks to use new event structure
- Update documentation and changelog
Based on discussion in #293
- Add optional 'export' section to theme JSON with pageBg, cardBg, infoBg
- If not specified, colors are auto-derived from userMessageBg
- Add export colors to dark.json and light.json
- Update theme-schema.json and TypeBox schema
- Add documentation to docs/theme.md
- Add margin-top back to tool-output for spacing between header and content
- Add theme property to HookUIContext interface
- Implement in interactive, RPC, and no-op contexts
- Add status-line.ts example hook
- Document styling with theme colors in hooks.md
The white-space: pre-wrap on .tool-output was preserving template
literal whitespace (newlines and indentation). The pre elements
inside still have pre-wrap for actual code content.
* Add ctx.ui.setStatus(key, text) API for hooks to display status in footer
- Add setStatus to HookUIContext interface
- Implement in interactive mode (FooterComponent)
- Implement in RPC mode (fire-and-forget)
- Add no-op implementations for headless contexts
- Multiple statuses displayed on single line, sorted by key
- Supports ANSI styling (hooks handle their own colors)
* Remove setStatus from changelog for now
* Fix hook status API to follow TUI rules
- Sanitize status text: replace newlines, tabs, carriage returns with spaces
- Truncate combined status line to terminal width using truncateToWidth
- Update JSDoc to document sanitization and truncation behavior
- Remove unused createHookUIContext method
- Add missing setStatus to test mock
* Add setStatus to changelog
* Use dim ellipsis for hook status truncation for consistency with footer style
---------
Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
- Use BorderedLoader for /share command so Escape cancels gist creation
- Add CHANGELOG entries for /share command and HTML export improvements
- Add todo.md with remaining export-html issues
- Split template into separate files: template.html, template.css, template.js
- Add tree visualization sidebar for session navigation
- Fix HTML sanitization to prevent <style> tags breaking DOM
- Add DOM node caching for faster re-renders
- Fix tree indentation to match tree-selector.ts
- Add /share command to upload session as GitHub gist
- Support shittycodingagent.ai/session?{gistId} URLs
Closes#375, closes#380
- Extract diff computation from edit.ts into shared edit-diff.ts
- ToolExecutionComponent computes and caches diff when args are complete
- Diff is visible while permission hooks block, before tool executes
- Show tool results in default filter (not hidden)
- Branch summary shows summary text inline
- Custom message support in tree with customType label
- Remove extra padding from tree nodes (use line-height)
- Remove border styling from active/in-path nodes
- Consistent 18px line-height for tree entries
- Fix entry type names: branch_summary, custom_message (snake_case)
- Fix toolResult role (was 'tool')
- Count all entry types: user, assistant, tool results, custom, compactions, branch summaries
- Use global stats for tokens/cost (all entries), not just current branch
- Make help bar more prominent (12px, full opacity)
- Remove Esc shortcut from help bar
- Header h1 font size now 12px (matches body)
- Token/cost stats now computed for all entries, not just current branch
- Token display matches footer format: ↑input ↓output Rcache Wcache
- Cost display uses 3 decimal places like footer
- Scroll to target uses requestAnimationFrame for DOM readiness
- Initial load and Escape scroll to bottom, tree clicks scroll to target
- Add --line-height CSS variable (18px = 12px font * 1.5)
- Convert all padding/margin to use var(--line-height)
- Remove fractional values for terminal-like consistency
- Fix gap between consecutive tool executions
- Remove extra padding from error-text and model-change
- Fix thinking toggle to show 'Thinking ...' when collapsed
- Remove top padding after timestamps in assistant messages
- Remove bottom padding from assistant-text
- Fix UTF-8 decoding with TextDecoder for base64 session data
- Use toolOutput color for expand hints (not borderAccent)
- Remove '- click to expand' text to match TUI
- Ctrl+O toggles expanded state (not visibility) on tool outputs
- Edit diffs always visible (not affected by Ctrl+O)
- Remove Ctrl+F override to allow browser search
- Replace tabs with 3 spaces in all tool outputs
- Fix syntax highlighting default color to use --text
- Add more hljs token selectors (property, punctuation, operator)
- Compaction uses customMessageBg/Label/Text colors
- Model change uses dim color without background
- Scroll to end on initial load
- Pointer cursor on expandable elements
- Display images from read tool results (base64 encoded)
- Add ellipsis for truncated tree entries
- Make mobile hamburger button more subtle
- Add X close button in sidebar header on mobile
- Hide hamburger when sidebar is open
- Add deriveExportColors() to compute page/card/info backgrounds from userMessageBg
- Use luminance detection to adapt colors for light/dark themes
- Use info-bg for model-change, compaction, system-prompt sections
- Use selectedBg for hover states and summary backgrounds
- Add scroll-to-message with highlight when clicking tree nodes
- Fix mobile overlay to close sidebar on click
- Wider sidebar (400px) with search and filter controls
- Add tree sidebar with search and filter (Default/All/Labels)
- Client-side markdown/syntax highlighting via vendored marked.js + highlight.js
- Base64 encode session data to avoid escaping issues
- Reuse theme.ts color tokens via getResolvedThemeColors()
- Sticky sidebar, responsive mobile layout with overlay
- Click tree node to scroll to message
- Keyboard shortcuts: Esc to reset, Ctrl/Cmd+F to search
Added glob pattern support (e.g., github-copilot/*, *sonnet*) to --models
and enabledModels. Patterns are matched against both provider/modelId and
just modelId, so *sonnet* works without requiring anthropic/*sonnet*.
The existing fuzzy substring matching for non-glob patterns is preserved.
fixes#337
- Add configurable thinkingText color for thinking blocks (defaults to muted)
- Make 'Thinking...' label italic when collapsed
- Fix Ctrl+T during streaming hiding the current message
- Track streamingMessage to properly re-render on toggle
Based on #366 by @paulbettner