Commit Graph

39 Commits

  • feat: enhance model cycling with thinking level support
    - Add exact match support with '/' prefix (/gpt-5.1-codex or /provider/model)
    - Prefer exact ID matches over partial matches in fuzzy search
    - Parse thinking levels from --models flag (pattern:level format)
    - Use first scoped model as initial model with its thinking level
    - Auto-apply thinking when cycling with Ctrl+P
    - Track manual thinking changes to disable auto-switching
    - Clear model scope when using /model command
    - Support mixed configs: --models sonnet:high,haiku,opus:low
    - Silently ignore thinking for models that don't support it
    - Only allow Ctrl+P cycling when --models is explicitly provided
    - Update help text with examples
    - Improve code organization by resolving scope early
  • WIP: Add theming system with /theme command
    - Consolidated theme system into single src/theme/ directory
    - Created Theme class with fg(), bg(), bold(), italic(), underline()
    - Added dark and light built-in themes with 36 color tokens
    - Support for custom themes in ~/.pi/agent/themes/*.json
    - JSON schema for theme validation
    - Theme selector UI with /theme command
    - Save theme preference to settings
    - Uses chalk for text formatting to preserve colors
    
    TODO:
    - Replace hardcoded colors throughout TUI components
    - Apply markdown theming to Markdown components
    - Add theme support to all TUI elements
  • Release v0.7.29
    - Show offset/limit in read tool display (e.g., read src/main.ts:100-200)
    - Fix PI_CODING_AGENT_DIR env var name in help and code
    - Add all API key env vars to help text
  • Release v0.7.28
    - Add message queuing with configurable modes (one-at-a-time/all) (#15)
    - Add /queue command to select queue mode
    - Add TruncatedText component for proper viewport-aware text truncation
    - Queue mode setting persists in ~/.pi/agent/settings.json
    - Visual feedback for queued messages with proper ANSI handling
    - Press Escape to abort and restore queued messages to editor
  • Add --models parameter for quick model cycling with Ctrl+P
    - Add --models CLI arg accepting comma-separated patterns
    - Implement smart matching: prefers aliases over dated versions
    - Add Ctrl+P to cycle through scoped models (or all if no scope)
    - Show model scope hint at startup
    - Update help text with examples
    
    Co-authored-by: Tino Ehrich <tino.ehrich@hey.com>
  • feat(coding-agent): add OAuth authentication for Claude Pro/Max
    - Add /login and /logout commands for OAuth flow
    - OAuth tokens stored in ~/.pi/agent/oauth.json with 0600 permissions
    - Auto-refresh tokens when expired (5min buffer)
    - Priority: OAuth > ANTHROPIC_OAUTH_TOKEN env > ANTHROPIC_API_KEY env
    - Fix model selector async loading and re-render
    - Add bracketed paste support to Input component for long codes
    - Update README.md with OAuth documentation
    - Add implementation docs and testing checklist
  • v0.7.12: Custom models/providers support via models.json
    - Add ~/.pi/agent/models.json config for custom providers (Ollama, vLLM, etc.)
    - Support all 4 API types (openai-completions, openai-responses, anthropic-messages, google-generative-ai)
    - Live reload models.json on /model selector open
    - Smart model defaults per provider (claude-sonnet-4-5, gpt-5.1-codex, etc.)
    - Graceful session fallback when saved model missing or no API key
    - Validation errors show precise file/field info in CLI and TUI
    - Agent knows its own README.md path for self-documentation
    - Added gpt-5.1-codex (400k context, 128k output, reasoning)
    
    Fixes #21
  • Fix AGENTS.md support, changelog viewer, and session model storage
    - BREAKING: Renamed AGENT.md to AGENTS.md for project context files
    - Added automatic changelog viewer on startup for new sessions
    - Added settings manager to track last shown changelog version
    - BREAKING: Store provider and modelId separately in session files (fixes #4)
    - Fixed markdown list rendering when items contain inline code with cyan formatting
    - Added dynamic border component for TUI
    - Updated changelog with entries for #4 and #5
  • feat: support file paths for --system-prompt option
    - Check if --system-prompt argument is a valid file path
    - Load file contents if it exists, otherwise use as literal text
    - Works in both interactive and single-shot modes
    - Project context and datetime still appended automatically
    - Document in README with examples
  • refactor: move context files to system prompt instead of user messages
    - Context files now appended to system prompt
    - Added current date/time to system prompt
    - Added current working directory to system prompt
    - Date/time and cwd placed at end of system prompt
    - Updated README to reflect system prompt integration
  • feat: hierarchical context file loading for monorepos
    - Walk up parent directories to load all AGENT.md/CLAUDE.md files
    - Load global context from ~/.pi/agent/AGENT.md or CLAUDE.md
    - Load order: global → top-most parent → ... → cwd
    - Prefer AGENT.md over CLAUDE.md in each directory
    - Each context file injected as separate message
    - Updated README with detailed documentation
  • feat: defer session creation until first user+assistant message exchange
    - Sessions are no longer created immediately on startup
    - Session files only created after at least 1 user message and 1 assistant response
    - Prevents empty session files when agent is launched and immediately quit
    - Messages are queued until session is initialized
    - Continue/resume modes properly mark sessions as already initialized
  • Remove event logging from session files - only save messages and state changes
    Session reconstruction only needs:
    - type: 'session' - session metadata
    - type: 'message' - conversation history
    - type: 'thinking_level_change' - thinking level changes
    - type: 'model_change' - model changes
    
    Events like agent_start/end, tool_execution_start/end are not needed for
    session reconstruction and only added bloat. This reduces session file size
    significantly and speeds up writes.
  • Add --mode flag for CLI output control (text/json/rpc)
    - text mode: only outputs final assistant message text (default)
    - json mode: streams all events as JSON (same as session manager writes)
    - rpc mode: JSON output + listens for JSON input on stdin for headless operation
    - Suppress informational messages in json/rpc modes
  • Improve edit tool diff display with context-aware rendering
    - Add generateDiffString() function in edit tool to create unified diffs with line numbers and 4 lines of context
    - Store only the formatted diff string in tool result details instead of full file contents
    - Update tool-execution renderer to parse and colorize the diff string
    - Filter out message_update events from session saving to prevent verbose session files
    - Add markdown nested list and table rendering tests
  • Redesign session selector with multi-line layout
    - Custom SessionList component with 2 lines per item
    - First line: message text (bold when selected)
    - Second line: metadata (time · message count) in dim
    - Blue › cursor for selected item
    - Added "Resume Session" header
    - Handle Ctrl+C (‹x03›) in SelectList for consistency
    - Improved date formatting (38 minutes ago, 8 hours ago, etc.)
  • Fix session selector: handle Ctrl+C and viewport width
    - Add SIGINT handler to allow Ctrl+C to exit during session selection
    - Remove hardcoded 60-char truncation, let SelectList handle dynamic truncation
    - Simplify date format (5m, 2h, 3d instead of "5m ago")
    - Make metadata more compact (5msg instead of "5 msgs")
  • Add --resume flag with session selector
    - New SessionSelectorComponent to browse and select sessions
    - Lists sessions sorted by last modified date
    - Shows first message, created/modified dates, message count
    - Automatically truncates long messages and formats dates
    - Adds --resume/-r flag to CLI
    - Session selector integrates with main flow
  • Add custom session events for thinking level and model changes
    Session manager changes:
    - Add ThinkingLevelChangeEntry and ModelChangeEntry types
    - Add saveThinkingLevelChange() and saveModelChange() methods
    - Update loadThinkingLevel() to also check for thinking_level_change events
      (not just session headers)
    
    TUI changes:
    - Pass SessionManager to TuiRenderer constructor
    - Call saveThinkingLevelChange() when user changes thinking level via /thinking
    - Store session manager as instance variable for future use
    
    This ensures thinking level changes during a session are persisted
    and correctly restored on --continue.
  • Fix SelectList crash on narrow terminal and thinking level restoration
    SelectList fixes:
    - Use hardcoded visual width for arrow prefix instead of string length
      which includes ANSI codes
    - Truncate scroll indicator text to prevent exceeding terminal width
    - Fixes crash when terminal is resized narrow and arrow keys are pressed
    
    Thinking level fix:
    - Restore thinking level even if it's "off" (removed !== "off" check)
    - This ensures the thinking level selector shows the correct state on continue
  • Add thinking level persistence and fix UI issues
    - Save and restore thinking level when continuing sessions
    - Fix thinking level confirmation message spacing and styling
    - Fix thinking text wrapping to preserve ANSI formatting across lines
  • Refactor TUI components into separate files
    - Move TUI components into src/tui/ folder
    - Split out CustomEditor, StreamingMessageComponent, ToolExecutionComponent, FooterComponent
    - Trim assistant message text content
    - Add newline after per-message token/cost stats
    - Improve code organization and maintainability
  • Add /thinking command and improve TUI UX
    - Add /thinking slash command with autocomplete for setting reasoning levels (off, minimal, low, medium, high)
    - Fix Ctrl+C behavior: remove hardcoded exit in TUI, let focused component handle it
    - Add empty lines before and after tool execution components for better visual separation
    - Fix stats rendering: display stats AFTER tool executions complete (matches web-ui behavior)
    - Remove "Press Ctrl+C again to exit" message, show "(esc to interrupt)" in loader instead
    - Add bash tool abort signal support with immediate SIGKILL on interrupt
    - Make Text and Markdown components return empty arrays when no actual text content
    - Add setCustomBgRgb() method to Markdown for dynamic background colors
  • Fix markdown streaming duplication by splitting newlines first
    - Added string-width library for proper terminal column width calculation
    - Fixed wrapLine() to split by newlines before wrapping (like Text component)
    - Fixed Loader interval leak by stopping before container removal
    - Changed loader message from 'Loading...' to 'Working...'