Commit Graph

2746 Commits

  • Fix markdown code block syntax highlighting
    Marked v15 removed the highlight option from setOptions.
    Use marked.use() with a custom renderer instead.
  • Fix tool-output spacing by removing pre-wrap from container
    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.
  • Hooks can render custom status (#385)
    * 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>
  • Fix export HTML styling issues
    - Match help-bar font size (11px) with header-info
    - Add newline after 'Available Tools' header
    - Remove excessive margin-top from tool-output
  • Make /share cancellable with Escape, add CHANGELOG entries
    - 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
  • Refactor export-html and add /share command
    - 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
  • Show edit diff before tool execution (fixes #393)
    - 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
  • Fix export-html tree sidebar to match TUI tree-selector
    - 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 export-html message stats and help bar
    - 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
  • Fix export-html header stats and UX
    - 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
  • Fix export-html spacing to use line-height based system
    - 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 export-html styling and behavior
    - 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
  • Add image support and mobile UX improvements to export-html
    - 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
  • Polish export-html tree styling
    - Add subtle border between sidebar and content
    - Use selectedBg for tree node hover state
    - Add left border accent for active and in-path nodes
  • Improve export-html styling with derived export colors
    - 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
  • WIP: Rewrite export-html with tree sidebar, client-side rendering
    - 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
  • Fix characters (#372)
    * Fix cat command
    
    * Fix text rendering crash from undefined code points in bash output
    
    * Revert unintentional model parameter changes from fix cat command commit
  • fix: enabledModels now supports glob patterns for OAuth providers
    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
  • Footer shows full session stats after compaction
    FooterComponent now iterates over all session entries for cumulative
    token usage and cost, not just post-compaction messages.
    
    fixes #322
  • Coalesce sequential status messages
    Rapidly changing settings no longer spams the chat log with multiple status lines.
    
    fixes #365
  • Add thinkingText theme token, fix streaming toggle bug
    - 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
  • Add setEditorText/getEditorText to hook UI context, improve custom() API
    - Add setEditorText() and getEditorText() to HookUIContext for prompt generator pattern
    - custom() now accepts async factories for fire-and-forget work
    - Add CancellableLoader component to tui package
    - Add BorderedLoader component for hooks with cancel UI
    - Export HookAPI, HookContext, HookFactory from main package
    - Update all examples to import from packages instead of relative paths
    - Update hooks.md and custom-tools.md documentation
    
    fixes #350
  • Fix hook tool_result event not emitted for tool errors
    Tools are supposed to throw on error. What needs fixing is that we need to report tool_result for erroneous tool executions as well.
    
    Fixes #374
  • fix(coding-agent): save initial model and thinking level to session
    When creating a new session, initial model and thinking level were set
    on the agent but never saved to session file. This caused --resume to
    default thinking level to 'off'.
    
    fixes #342
  • Update README.md compaction and branching sections
    - Simplify compaction section, link to docs/compaction.md for details
    - Clarify that branch summaries are optional (user is prompted)
    - Change /branch to /tree in compaction note
  • Restructure README.md
    - Add session tree intro to Sessions section
    - Move Themes, Custom Slash Commands, Skills, Hooks, Custom Tools to new Extensions top-level section
    - Keep Settings File under Configuration
  • Expand theme changes section in CHANGELOG.md
    - Mark as breaking for custom themes
    - Explain that custom themes must add new tokens or fail to load
    - Note total color count increased from 46 to 50
    - Reference theme.md and built-in themes
  • Expand pi.sendMessage and registerMessageRenderer docs in hooks.md
    - sendMessage: document storage timing, LLM context, TUI display
    - registerMessageRenderer: document renderer signature, return null for default
  • Document SessionManager and ModelRegistry in CHANGELOG.md
    - SessionManager: method renames, new tree/append/branch methods
    - ModelRegistry: new class for model discovery and API key resolution
  • Document Attachment type removal in CHANGELOG.md
    - SDK: Attachment removed, use ImageContent from @mariozechner/pi-ai
    - RPC: prompt command attachments field replaced with images field
  • Clarify tree events are new in CHANGELOG.md
    - session_before_tree/session_tree are new events, not renamed
    - reason: tree and shutdown are new reasons for custom tools
  • Update README.md for new APIs
    - Add /tree to slash commands table
    - Expand Branching section with /tree in-place navigation
    - Update hooks example: pi.send() -> pi.sendMessage(), session -> session_start
    - Remove hookTimeout from settings (no longer exists)
  • Rewrite CHANGELOG.md with migration guides
    - Session Tree: brief description, reference session.md
    - Hooks Migration: type renames, event changes, API changes
    - Custom Tools Migration: type renames, execute signature, context object
    - SDK Migration: type changes, branching API, exports
    - RPC Migration: entryId, AgentMessage, compaction events
    - Structured Compaction: output format, file tracking
    - Interactive Mode: /tree, labels, themes, settings
    - Keep Fixed section with external contributions
  • Update rpc.md to match actual implementation
    - AppMessage -> AgentMessage
    - compact response shows full CompactionResult fields
    - auto_compaction_start includes reason field
    - auto_compaction_end includes willRetry field
    - Fix source file references
  • Fix sdk.md and rpc.md to match actual API
    - Remove incorrect prompt(AppMessage) overload
    - Change AppMessage to AgentMessage
    - Change null to undefined for optional returns
    - sendHookMessage returns Promise<void>
    - Update rpc.md for entryId change
  • Change branch() to use entryId instead of entryIndex
    - AgentSession.branch(entryId: string) now takes entry ID
    - SessionBeforeBranchEvent.entryId replaces entryIndex
    - getUserMessagesForBranching() returns entryId
    - Update RPC types and client
    - Update UserMessageSelectorComponent
    - Update hook examples and tests
    - Update docs (hooks.md, sdk.md)
  • Update custom-compaction example to use serializeConversation
    Also fix docs to show convertToLlm is needed first.
  • Export serializeConversation and document in compaction.md
    Shows how to convert messages to text for custom summarization.
  • Add creation hints to docs and update system prompt
    - System prompt now instructs to read docs AND examples, follow cross-refs
    - Each doc starts with 'pi can create X. Ask it to build one.'