Commit Graph

24 Commits

  • feat(tui): add character jump navigation (Ctrl+], Ctrl+Alt+]) (#1074)
    Add Bash/Readline-style character search:
    
    - Ctrl+] enters forward jump mode, awaits next character, jumps to it
    - Ctrl+Alt+] does the same but searches backward
    - Multi-line search
    - Case-sensitive matching
    - Pressing the hotkey again cancels; control chars cancel and fall
      through
  • fix(tui): fix scrollback overwrite when appending lines past viewport
    Appended lines were not committed to terminal scrollback because the
    renderer used cursor movement (CSI B) and carriage return without
    linefeed. This caused earlier content to be overwritten when the
    viewport filled up.
    
    Changes:
    - For appended lines, emit \r\n to create real scrollback lines
    - When target row is below viewport, scroll with \r\n before positioning
    - Add PI_TUI_WRITE_LOG env var for debugging raw ANSI output
    - Add fullRedraws readonly property to TUI class
    - Add viewport-overwrite-repro.ts test script
    
    fixes #954
  • docs: document Focusable interface propagation pattern for IME support
    Container components with embedded Input/Editor children must implement
    Focusable and propagate focus state to enable correct IME candidate
    window positioning.
    
    Related to #827
  • fix(tui): add vertical scrolling to Editor when content exceeds terminal height
    The Editor component now accepts TUI as the first constructor parameter,
    enabling it to query terminal dimensions. When content exceeds available
    height, the editor scrolls vertically keeping the cursor visible.
    
    Features:
    - Max editor height is 30% of terminal rows (minimum 5 lines)
    - Page Up/Down keys scroll by page size
    - Scroll indicators show lines above/below: ─── ↑ 5 more ───
    
    Breaking change: Editor constructor signature changed from
      new Editor(theme)
    to
      new Editor(tui, theme)
    
    fixes #732
  • feat(tui): add OverlayOptions API and fix width overflow crash
    Adds positioning/sizing options for overlays and fixes crash when compositing
    lines with complex ANSI sequences exceed terminal width.
  • 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
  • Export wrapTextWithAnsi utility and add handleInput docs
    - Export wrapTextWithAnsi from tui package
    - Add 'Handling Input' section to README with key detection example
    - Document wrapTextWithAnsi in utilities section
  • Expand tui README: Component interface docs and custom component guide
    - Document render/handleInput/invalidate methods in Component interface
    - Add 'Creating Custom Components' section with:
      - Width constraint warning (lines must not exceed width)
      - Examples using truncateToWidth and visibleWidth
      - ANSI code handling explanation
      - Caching pattern for performance
  • Update tui CHANGELOG and README
    - Add changelog entries for new key detection functions and TUI.onDebug
    - Completely rewrite README with accurate documentation:
      - All components documented (added TruncatedText, SettingsList)
      - All theme interfaces documented (EditorTheme, MarkdownTheme, SelectListTheme, SettingsListTheme, ImageTheme)
      - Fixed incorrect constructor signatures
      - Added key detection utilities section
      - Added utilities section
  • Custom tools with session lifecycle, examples for hooks and tools
    - Custom tools: TypeScript modules that extend pi with new tools
      - Custom TUI rendering via renderCall/renderResult
      - User interaction via pi.ui (select, confirm, input, notify)
      - Session lifecycle via onSession callback for state reconstruction
      - Examples: todo.ts, question.ts, hello.ts
    
    - Hook examples: permission-gate, git-checkpoint, protected-paths
    
    - Session lifecycle centralized in AgentSession
      - Works across all modes (interactive, print, RPC)
      - Unified session event for hooks (replaces session_start/session_switch)
    
    - Box component added to pi-tui
    
    - Examples bundled in npm and binary releases
    
    Fixes #190
  • Update docs for inline images, remove PI_NO_IMAGES env var
    - Add CHANGELOG entry for inline image rendering feature
    - Add /show-images to slash commands table in README
    - Expand Image Support section with inline rendering info
    - Add terminal.showImages to settings documentation
    - Remove PI_NO_IMAGES environment variable feature
  • Implement fuzzy search for model/session selector and improve Input multi-key sequence handling (#122)
    * implement fuzzy search and filtering for tui selectors
    
    * update changelog and readme
    
    * add correct pr to changelog
  • Clean up TUI package and refactor component structure
    - Remove old TUI implementation and components (LoadingAnimation, MarkdownComponent, TextComponent, TextEditor, WhitespaceComponent)
    - Rename components-new to components with new API (Loader, Markdown, Text, Editor, Spacer)
    - Move Text and Input components to separate files in src/components/
    - Add render caching to Text component (similar to Markdown)
    - Add proper ANSI code handling in Text component using stripVTControlCharacters
    - Update coding-agent to use new TUI API (requires ProcessTerminal, uses custom Editor subclass for key handling)
    - Remove old test files, keep only chat-simple.ts and virtual-terminal.ts
    - Update README.md with new minimal API documentation
    - Switch from tsc to tsgo for type checking
    - Update package dependencies across monorepo
  • fix(tui): Container change detection for proper differential rendering
    Fixed rendering artifact where duplicate bottom borders appeared when components
    dynamically shifted positions (e.g., Ctrl+C in agent clearing status container).
    
    Root cause: Container wasn't reporting as "changed" when cleared (0 children),
    causing differential renderer to skip re-rendering that area.
    
    Solution: Container now tracks previousChildCount and reports changed when
    child count changes, ensuring proper re-rendering when containers are cleared.
    
    - Added comprehensive test reproducing the layout shift artifact
    - Fixed Container to track and report child count changes
    - All tests pass including new layout shift artifact test
  • refactor(tui): Move examples from README to test directory
    - Move chat application example to test/chat-app.ts
    - Move multi-component layout example to test/multi-layout.ts
    - Update README to reference example files instead of inline code
    - Add proper exit handlers (Ctrl+C) to all examples
    - Simplify README by reducing inline code examples
  • docs(tui): Update README with surgical differential rendering documentation
    - Add surgical differential rendering as the main feature
    - Document the three rendering strategies (surgical, partial, full)
    - Add performance metrics documentation
    - Simplify component examples to be more concise
    - Add comprehensive testing section with VirtualTerminal API
    - Include testing best practices and performance testing guidance
    - Remove duplicate TextEditor documentation section
  • Initial monorepo setup with npm workspaces and dual TypeScript configuration
    - Set up npm workspaces for three packages: pi-tui, pi-agent, and pi (pods)
    - Implemented dual TypeScript configuration:
      - Root tsconfig.json with path mappings for development and type checking
      - Package-specific tsconfig.build.json for clean production builds
    - Configured lockstep versioning with sync script for inter-package dependencies
    - Added comprehensive documentation for development and publishing workflows
    - All packages at version 0.5.0 ready for npm publishing