Commit Graph

23 Commits

  • docs(coding-agent): improve extensions.md, add missing examples
    - Add cross-links to session.md, keybindings.md, themes.md
    - Document truncateLine, highlightCode, getLanguageFromPath utilities
    - Add examples for previously undocumented APIs:
      - message-renderer.ts: registerMessageRenderer with Box styling
      - session-name.ts: setSessionName/getSessionName
      - event-bus.ts: pi.events for inter-extension communication
      - bookmark.ts: setLabel for entry bookmarking
    - Update examples table in extensions.md and README.md
  • refactor: rename custom provider examples
    - custom-provider -> custom-provider-anthropic
    - gitlab-duo -> custom-provider-gitlab-duo
    - Update READMEs with custom provider section
  • remove chalk-logger example (breaks TUI by using console.log directly)
    The with-deps example demonstrates npm dependency resolution properly.
  • feat(extensions): add antigravity-image-gen example for image generation (#893)
    Adds a new extension that generates images via Google Antigravity's
    image models (gemini-3-pro-image, imagen-3). Features:
    
    - Returns images as tool result attachments for inline terminal rendering
    - Configurable save modes: none, project, global, custom
    - Supports env vars (PI_IMAGE_SAVE_MODE, PI_IMAGE_SAVE_DIR) and config files
    - Configurable aspect ratios (1:1, 16:9, etc.)
    
    Requires OAuth login via /login for google-antigravity provider.
  • feat(extensions): add inline-bash example for expanding !{command} in prompts (#881)
    * feat(extensions): add inline-bash example for expanding !{command} in prompts
    
    Adds an example extension that expands inline bash commands within user
    prompts before sending to the agent. Uses the `input` event to transform
    patterns like `!{pwd}` or `!{git status}` into their output.
    
    Preserves existing `!command` whole-line bash behavior.
    
    * docs(extensions): add inline-bash to README
    
    * chore: fix stupid bug
  • feat(coding-agent): Add widget placement option (#850)
    * Add widget placement for extension widgets
    
    * Remove changelog entry for widget placement
    
    * Keep no-op widget signature
    
    * Move widget render before attach
  • docs: update extension examples READMEs and fix plan-mode references
    - Add missing extensions to examples/extensions/README.md:
      questionnaire.ts, truncated-tool.ts, model-status.ts, rainbow-editor.ts,
      custom-footer.ts, custom-header.ts, overlay-test.ts, shutdown-command.ts,
      interactive-shell.ts, claude-rules.ts, mac-system-theme.ts
    - Update plan-mode.ts -> plan-mode/ (now a directory)
    - Add new System Integration section
    - Update docs/extensions.md plan-mode.ts -> plan-mode/index.ts (17 refs)
    - Add questionnaire.ts to registerTool and ctx.ui.select() examples
    - Expand examples/README.md description
  • coding-agent: example extension to summarize conversation (#684)
    * feat: add summarize extension example
    
    Demonstrates custom UI with markdown rendering and external model
    integration for conversation summarization.
    
    * chore: update examples/extensions/README.md with summarize.ts
  • feat(tui): overlay positioning API with CSS-like values
    Add OverlayOptions for configurable positioning (anchor, margins, offsets,
    percentages). Add OverlayHandle for programmatic visibility control with
    hide/setHidden/isHidden. Add visible callback for responsive overlays.
    
    Extension API: ctx.ui.custom() now accepts overlayOptions and onHandle callback.
    
    Examples: overlay-qa-tests.ts (10 test commands), doom-overlay (DOOM at 35 FPS).
  • feat(extensions): add sandbox extension for OS-level bash sandboxing (#673)
    Uses @anthropic-ai/sandbox-runtime to enforce filesystem and network
    restrictions on bash commands (sandbox-exec on macOS, bubblewrap on Linux).
    
    Features:
    - Per-project config via .pi/sandbox.json
    - Global config via ~/.pi/agent/sandbox.json
    - Enabled by default with sensible defaults
    - --no-sandbox flag to disable
    - /sandbox command to view current config
  • Rename /branch command to /fork
    - RPC: branch -> fork, get_branch_messages -> get_fork_messages
    - SDK: branch() -> fork(), getBranchMessages() -> getForkMessages()
    - AgentSession: branch() -> fork(), getUserMessagesForBranching() -> getUserMessagesForForking()
    - Extension events: session_before_branch -> session_before_fork, session_branch -> session_fork
    - Settings: doubleEscapeAction 'branch' -> 'fork'
    
    fixes #641
  • feat(coding-agent): add pluggable operations for remote tool execution
    Adds optional operations parameter to create*Tool functions enabling
    delegation to remote systems (SSH, containers, etc.):
    
    - ReadOperations: readFile, access, detectImageMimeType
    - WriteOperations: writeFile, mkdir
    - EditOperations: readFile, writeFile, access
    - BashOperations: exec (with streaming, signal, timeout)
    
    Add ssh.ts example demonstrating --ssh flag for remote execution.
    Built-in renderers used automatically for overrides without custom renderers.
    
    fixes #564
  • feat(coding-agent): add tool override support via extensions
    - Add setActiveTools() to ExtensionAPI for dynamic tool management
    - Extensions can now override, wrap, or disable built-in tools
    - Add tool-override.ts example demonstrating the pattern
    - Update documentation for tool override capabilities
  • feat(coding-agent): add ctx.ui.setEditorComponent() extension API
    - Add setEditorComponent() to ctx.ui for custom editor components
    - Add CustomEditor base class for extensions (handles app keybindings)
    - Add keybindings parameter to ctx.ui.custom() factory (breaking change)
    - Add modal-editor.ts example (vim-like modes)
    - Add rainbow-editor.ts example (animated text highlighting)
    - Update docs: extensions.md, tui.md Pattern 7
    - Clean up terminal on TUI render errors
  • Add ExtensionAPI methods, preset example, and TUI documentation improvements
    - ExtensionAPI: setModel(), getThinkingLevel(), setThinkingLevel() methods
    - New preset.ts example with plan/implement presets for model/thinking/tools switching
    - Export all UI components from pi-coding-agent for extension use
    - docs/tui.md: Common Patterns section with copy-paste code for SelectList, BorderedLoader, SettingsList, setStatus, setWidget, setFooter
    - docs/tui.md: Key Rules section for extension UI development
    - docs/extensions.md: Exhaustive example links for all ExtensionAPI methods and events
    - System prompt now references docs/tui.md for TUI development
    
    Fixes #509, relates to #347
  • Extensions: add pi.sendUserMessage() for sending user messages
    Adds sendUserMessage() to the extension API, allowing extensions to send
    actual user messages (role: user) rather than custom messages. Unlike
    sendMessage(), this always triggers a turn and behaves as if the user
    typed the message.
    
    - Add SendUserMessageHandler type and sendUserMessage() to ExtensionAPI
    - Wire handler through loader, runner, and all modes
    - Implement via prompt() with expandPromptTemplates: false
    - Add send-user-message.ts example with /ask, /steer, /followup commands
    - Document in extensions.md
    
    fixes #483
  • Merge hooks and custom-tools into unified extensions system (#454)
    Breaking changes:
    - Settings: 'hooks' and 'customTools' arrays replaced with 'extensions'
    - CLI: '--hook' and '--tool' flags replaced with '--extension' / '-e'
    - API: HookMessage renamed to CustomMessage, role 'hookMessage' to 'custom'
    - API: FileSlashCommand renamed to PromptTemplate
    - API: discoverSlashCommands() renamed to discoverPromptTemplates()
    - Directories: commands/ renamed to prompts/ for prompt templates
    
    Migration:
    - Session version bumped to 3 (auto-migrates v2 sessions)
    - Old 'hookMessage' role entries converted to 'custom'
    
    Structural changes:
    - src/core/hooks/ and src/core/custom-tools/ merged into src/core/extensions/
    - src/core/slash-commands.ts renamed to src/core/prompt-templates.ts
    - examples/hooks/ and examples/custom-tools/ merged into examples/extensions/
    - docs/hooks.md and docs/custom-tools.md merged into docs/extensions.md
    
    New test coverage:
    - test/extensions-runner.test.ts (10 tests)
    - test/extensions-discovery.test.ts (26 tests)
    - test/prompt-templates.test.ts