Commit Graph

34 Commits

  • test(ai): Add image input test for Anthropic Haiku 3.5
    - Added image handling test for Claude 3.5 Haiku
    - Ensures vision capabilities are properly tested
  • fix(ai): Fix OpenAI Responses provider multi-turn conversation support
    - Added contentSignature tracking for assistant messages
    - Fixed message format in convertToResponsesFormat (output_text instead of input_text)
    - Properly preserve message IDs for multi-turn conversations
    - Added proper ResponseOutputMessage type satisfaction
    - Updated tests to cover more providers and multi-turn scenarios
  • chore: Mark AI package implementation task as complete
    - Moved completed AI package implementation task to done folder
    - Task successfully implemented the unified AI API (@mariozechner/pi-ai)
    - Package renamed, documentation improved, and published as v0.5.12
  • docs(ai): Fix model names in README examples
    - Changed gpt-4o-mini to gpt-5-mini in examples to match actual model names
    - Minor formatting fixes
  • docs(ai): Improve README with model discovery and capabilities documentation
    - Added note that library only includes tool-calling capable models
    - Added Model Discovery section showing how to enumerate models
    - Added examples for finding models with specific capabilities
    - Added cache read/write costs to model capabilities display
    - Clarified that models are auto-fetched from APIs at build time
  • feat(ai): Rename package to @mariozechner/pi-ai and improve documentation
    - Changed package name from @mariozechner/ai to @mariozechner/pi-ai
    - Fixed generate-models.ts to fetch from models.dev API instead of local file
    - Completely rewrote README with practical examples:
      - Image input with base64 encoding
      - Proper tool calling with context management
      - Streaming with completion indicators
      - Abort signal usage
      - Provider-specific options (reasoning/thinking)
      - Custom model definitions for local/self-hosted LLMs
      - Environment variables explanation
    - Bumped version to 0.5.9 and published
  • fix: Remove unused imports and add biome-ignore for false positive
    - Remove unused SlashCommand import from tui-renderer.ts
    - Add biome-ignore comment for previousRenderCommands which is actually used
  • feat(agent): Add /tokens command for cumulative token usage tracking
    Added /tokens slash command to TUI that displays session-wide token statistics.
    Key changes:
    - Fixed SessionManager to accumulate token usage instead of storing only last event
    - Added cumulative token tracking to TUI renderer alongside per-request totals
    - Implemented slash command infrastructure with /tokens autocomplete support
    - Fixed file autocompletion that was missing from Tab key handling
    - Clean minimal display format showing input/output/reasoning/cache/tool counts
    
    The /tokens command shows:
    Total usage
       input: 1,234
       output: 567
       reasoning: 89
       cache read: 100
       cache write: 50
       tool calls: 2
  • fix(tui): Fix garbled output when content exceeds viewport
    - Implemented new renderLineBased method that properly handles scrollback boundaries
    - Fixed ANSI code preservation in MarkdownComponent line wrapping
    - Added comprehensive test to reproduce and verify the fix
    - Root cause: PARTIAL rendering strategy couldn't position cursor in scrollback
    - Solution: Component-agnostic line comparison with proper viewport boundary handling
  • 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
  • feat(tui): Add instructional header and welcome message to chat demo
    - Add header with slash command and file autocomplete instructions
    - Add initial welcome message with detailed feature descriptions
    - Import TextComponent for the header
    - Make it clearer how to use all the demo features
  • fix(tui): Trigger initial render when start() is called
    The demos were not showing any output until user input because:
    - Components were added before ui.start() was called
    - addChild calls requestRender() but it returns early if \!isStarted
    - So no initial render happened until user input triggered one
    
    Now ui.start() triggers an initial render if components exist.
  • 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
  • tui: Implement surgical differential rendering for minimal redraws
    - New renderDifferentialSurgical method with three strategies:
      - SURGICAL: Only update specific changed lines (1-2 lines per render)
      - PARTIAL: Clear and re-render from first change when line counts change
      - FULL: Clear scrollback and re-render all when changes above viewport
    - Preserves all content in scrollback buffer correctly
    - Reduces redraws from ~14 lines to ~1.3 lines for common updates
    - All 24 tests pass including scrollback preservation tests
    - Massive performance improvement: 90% reduction in unnecessary redraws
  • tui: Fix differential rendering to preserve scrollback buffer
    - renderDifferential now correctly handles content that exceeds viewport
    - When changes are above viewport, do full re-render with scrollback clear
    - When changes are in viewport, do partial re-render from change point
    - All tests pass, correctly preserves 100 items in scrollback
    - Issue: Still re-renders too much (entire tail from first change)
  • tui-double-buffer: Implement smart differential rendering with terminal abstraction
    - Create Terminal interface abstracting stdin/stdout operations for dependency injection
    - Implement ProcessTerminal for production use with process.stdin/stdout
    - Implement VirtualTerminal using @xterm/headless for accurate terminal emulation in tests
    - Fix TypeScript imports for @xterm/headless module
    - Move all component files to src/components/ directory for better organization
    - Add comprehensive test suite with async/await patterns for proper render timing
    - Fix critical TUI differential rendering bug when components grow in height
      - Issue: Old content wasn't properly cleared when component line count increased
      - Solution: Clear each old line individually before redrawing, ensure cursor at line start
    - Add test verifying terminal content preservation and text editor growth behavior
    - Update tsconfig.json to include test files in type checking
    - Add benchmark test comparing single vs double buffer performance
    
    The implementation successfully reduces flicker by only updating changed lines
    rather than clearing entire sections. Both TUI implementations maintain the
    same interface for backward compatibility.
  • Fix process.cwd() error when running from deleted directory
    - Defer process.cwd() call in logger to avoid initialization errors
    - Resolve log file path only when actually writing logs
    - Bump version to 0.5.2
  • Fix pi-agent CLI execution issue when installed globally
    - Remove isMainModule check that was preventing execution via npm symlink
    - CLI now runs main function directly when executed
    - Bump version to 0.5.1
  • Fix npm publishing warnings and clean up package.json files
    - Fixed repository URLs to use git+https:// format
    - Removed tsconfig.tsbuildinfo from clean scripts
    - Updated README with clearer build instructions and dependency order
    - Fixed bin paths to reference dist/cli.js correctly
    - Ready for npm publishing with no warnings
  • 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