Commit Graph
100 Commits
Author SHA1 Message Date
Mario Zechner c8cfef7225 Add note about npm dependencies in extensions 2026-01-05 02:48:18 +01:00
Mario Zechner f4a3724b7e Improve extension discovery docs with multi-entry package.json example 2026-01-05 02:47:52 +01:00
Mario Zechner 91cca23d23 Add migration for commands->prompts, warn about deprecated hooks/tools dirs
- Auto-migrate commands/ to prompts/ on startup
- Warn if hooks/ or tools/ directories contain custom extensions
- Show deprecation warnings in interactive mode with keypress to continue
- Update CHANGELOG and docs with full migration guide
2026-01-05 02:41:08 +01:00
Mario Zechner cf1c4c31f4 Flatten hello/ and question/ extension examples to single files 2026-01-05 01:45:10 +01:00
Mario Zechner c6fc084534 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
2026-01-05 01:43:35 +01:00
Mario Zechner 9794868b38 Implement extension discovery with package.json manifest support
Discovery rules:
1. extensions/*.ts or *.js - direct files
2. extensions/*/index.ts or index.js - subdirectory with index
3. extensions/*/package.json with pi field - load declared paths

No recursion beyond one level. Complex packages use package.json manifest.

Added PiManifest type for future theme/skill bundling support.

17 tests covering all discovery scenarios.

refs #454
2026-01-04 23:24:24 +01:00
Mario Zechner 2846c7d190 Add unified extensions system (not wired up yet)
New src/core/extensions/ directory with:
- types.ts: merged types from hooks and custom-tools
- loader.ts: single loader for extensions
- runner.ts: ExtensionRunner for event emission
- wrapper.ts: tool wrapping utilities
- index.ts: exports

Key changes from old system:
- Single ExtensionAPI with registerTool() for LLM-callable tools
- Tools use ExtensionContext (has UI access)
- No onSession callback on tools (use pi.on events instead)

refs #454
2026-01-04 22:51:11 +01:00
Mario Zechner be330fdd9c Fix event bus async error handling, clear pending messages on session switch, improve SDK docs
- event-bus.ts: await async handlers to catch errors properly
- agent-session.ts: clear _pendingNextTurnMessages on newSession/switchSession/branch
- sdk.ts: make eventBus first (required) param for discoverHooks/discoverCustomTools
- docs/sdk.md: document eventBus sharing pattern for hook/tool communication
2026-01-04 22:04:50 +01:00
Mario Zechner 024ec33bf2 docs(coding-agent): fix event bus docs - handlers persist, remove redundant note 2026-01-04 21:39:13 +01:00
Mario Zechner 99a539baa4 docs(coding-agent): update event bus docs - async errors now caught automatically 2026-01-04 21:37:16 +01:00
Mario Zechner 12805f61bd Add [Unreleased] section for next cycle 2026-01-04 21:06:48 +01:00
Mario Zechner 71c978e2f9 Release v0.34.2 2026-01-04 21:06:08 +01:00
Mario Zechner a4d6f22f55 fix: move hook API changelog entries from 0.32.2 to 0.34.0
The Hook API features (registerFlag, registerShortcut, setWidget, getActiveTools,
plan-mode.ts) were incorrectly listed under 0.32.2 but actually shipped in 0.34.0.
2026-01-04 21:05:18 +01:00
Mario Zechner 2a47b1114d Add [Unreleased] section for next cycle 2026-01-04 20:57:34 +01:00
Mario Zechner de92eeda1f Release v0.34.1 2026-01-04 20:56:51 +01:00
Mario Zechner affa618b43 docs: add note about macOS Finder image copy behavior 2026-01-04 20:52:51 +01:00
Mario Zechner 2a332f7064 docs: add changelog entries for symbol key support (#450) 2026-01-04 20:38:27 +01:00
Mario Zechner 61cadc226c Add [Unreleased] section for next cycle 2026-01-04 20:30:34 +01:00
Mario Zechner dc2f5d43cc Release v0.34.0 2026-01-04 20:29:50 +01:00
Mario Zechner 00fa8b71c8 revert: remove unnecessary themeOverride params from theme functions
The optional theme parameter was added as a workaround for tsx dev mode,
but that's a dev-only issue. Users running the built package don't need it.
2026-01-04 20:27:46 +01:00
Mario Zechner 7302fe5063 docs: remove dev-only changelog entry 2026-01-04 20:26:29 +01:00
Mario Zechner 5318b42bd2 docs: update CHANGELOG and hooks.md with missing items
- tools.ts example hook
- Multiple messages from before_agent_start
- getSettingsListTheme/getSelectListTheme optional theme param
- Hook error stack traces
2026-01-04 19:01:35 +01:00
Mario Zechner b06bd1d24c fix(tools.ts): sync with active tools when no saved state
Hook was showing all tools as enabled even though only 4 were active.
Now initializes from pi.getActiveTools() to match actual state.
2026-01-04 18:50:45 +01:00
Mario Zechner 31438fdf2a fix(tools): wrap ALL registry tools with hooks, not just active ones
wrappedToolRegistry was only containing activeToolsArray (4 tools).
Now wraps all tools from the registry so hooks can enable any tool.
2026-01-04 18:47:57 +01:00
Mario Zechner 2849623afc fix(tools): tool registry now contains ALL built-in tools
- createAllTools() populates registry with all 7 built-in tools
- --tools flag only sets initially active tools (default: read/bash/edit/write)
- Hooks can enable any tool from registry via setActiveTools()
- System prompt rebuilds with correct tool guidelines when tools change
- Document tsx module resolution workaround in README
2026-01-04 18:44:41 +01:00
Mario Zechner c447e62662 fix(theme): add optional themeOverride param to getSettingsListTheme/getSelectListTheme
When hooks are loaded via jiti, they get a separate module instance from
the main app. This means the global 'theme' variable in the hook's module
is never initialized. Adding an optional theme parameter allows hooks to
pass the theme from ctx.ui.custom() callback.

Usage in hooks:
  getSettingsListTheme(theme)  // theme from ctx.ui.custom callback
2026-01-04 18:39:00 +01:00
Mario Zechner 6390ff87ef fix(hooks): add stack traces to hook errors, fix tools.ts theme bug
- HookError now includes optional stack field
- Hook error display shows stack trace in dim color below error message
- tools.ts: create SettingsListTheme using the theme passed to ctx.ui.custom()
  instead of using getSettingsListTheme() which depends on global theme
2026-01-04 18:33:28 +01:00
Mario Zechner 91fae8b2f0 Merge feature/plan-mode into main 2026-01-04 18:27:38 +01:00
Mario Zechner e4dd21a3b2 feat(hooks): add systemPromptAppend to before_agent_start, full tool registry
- before_agent_start handlers can return systemPromptAppend to dynamically
  append text to the system prompt for that turn
- Multiple hooks' systemPromptAppend strings are concatenated
- Multiple hooks' messages are now all injected (not just first)
- Tool registry now contains ALL built-in tools (read, bash, edit, write,
  grep, find, ls) regardless of --tools flag
- --tools only sets initially active tools, hooks can enable any via
  setActiveTools()
- System prompt automatically rebuilds when tools change, updating tool
  descriptions and guidelines
- Add pirate.ts example hook demonstrating systemPromptAppend
- Update hooks.md with systemPromptAppend documentation
2026-01-04 18:21:26 +01:00
Mario Zechner 892acedb6b feat(hooks): add tools.ts example hook for interactive tool enable/disable
- /tools command opens SettingsList-based selector for all loaded tools
- Space/Enter toggles individual tools between enabled/disabled
- Changes apply immediately on toggle (like /settings)
- Tool selection persisted to session via appendEntry()
- State restored from current branch on session_start, session_tree, session_branch
- Uses getBranch() to respect branch-specific tool configuration
- Export getSettingsListTheme and getSelectListTheme for hooks to use
2026-01-04 18:13:30 +01:00
Mario Zechner ddf8bfceee fix(hooks): deep copy messages in context event before passing to hooks
The context event handler documentation promised a deep copy but the
implementation passed the original array reference. This could cause
hooks to accidentally mutate session messages.

Uses structuredClone() for fast native deep copying.
2026-01-04 18:13:30 +01:00
Mario Zechner 8b6bc30301 fix(hooks): deep copy messages in context event before passing to hooks
The context event handler documentation promised a deep copy but the
implementation passed the original array reference. This could cause
hooks to accidentally mutate session messages.

Uses structuredClone() for fast native deep copying.
2026-01-04 17:16:49 +01:00
Mario Zechner 7e2a99b485 Add [Unreleased] section for next cycle 2026-01-04 01:08:11 +01:00
Mario Zechner faa10b9a7e Release v0.33.0 2026-01-04 01:07:24 +01:00
Mario Zechner 5c5084481b feat(coding-agent): clipboard image paste support via Ctrl+V (fixes #419) 2026-01-04 01:05:22 +01:00
Mario Zechner 97bb411988 Add Vim-style keybindings example to README 2026-01-03 23:44:40 +01:00
Mario Zechner 6af7c97154 Update tui README.md: replace isXxx() with matchesKey() and Key helper 2026-01-03 23:11:11 +01:00
Mario Zechner 22abf50d85 Update tui.md docs: replace isXxx() with matchesKey() and Key helper 2026-01-03 23:10:22 +01:00
Mario Zechner f49d2aac12 Use same header color for Available Tools as System Prompt 2026-01-03 23:05:32 +01:00
Mario Zechner f9838bb5d4 Show first 10 lines of system prompt with click to expand for full content 2026-01-03 23:04:23 +01:00
Mario Zechner f5e38c4007 Add click-to-expand for system prompt in HTML export 2026-01-03 23:02:30 +01:00
Mario Zechner f090ec214a Fix missing spacer between text and tool calls in HTML export 2026-01-03 23:00:35 +01:00
Mario Zechner e98524f1fc Fix missing spacer between text and tool calls in HTML export 2026-01-03 22:56:36 +01:00
Mario Zechner 9549ac4695 Remove DEVELOPMENT.md reference from README 2026-01-03 22:53:33 +01:00
Mario Zechner 1079cd404e Add breaking change note for key detection functions (#405) 2026-01-03 22:52:38 +01:00
Mario Zechner 242291e290 Add changelog entries for PRs #426 and #427 2026-01-03 22:51:44 +01:00
Mario Zechner f2b89d5ec5 Merge branch 'feat/ctrl-n-external-editor' - configurable keybindings (#405) 2026-01-03 22:51:12 +01:00
Mario Zechner b8814372af Add changelog and README docs for keybindings feature (#405) 2026-01-03 22:49:58 +01:00
Mario Zechner 1153a50c56 Update package-lock.json after npm upgrade 2026-01-03 17:23:44 +01:00
Mario Zechner 7aba5883f2 Add [Unreleased] section for next cycle 2026-01-03 17:09:58 +01:00
Mario Zechner db829e73f9 Release v0.32.3 2026-01-03 17:09:22 +01:00
Mario Zechner c9a85342ea Fix google-vertex models showing without auth configured 2026-01-03 17:09:02 +01:00
Mario Zechner 2348a485cb Add changelog entries for PRs #423 and #424 2026-01-03 17:00:16 +01:00
Mario Zechner 79c56475e0 Fix non-PNG images not displaying in Kitty protocol terminals
JPEG/GIF/WebP images were not rendering in terminals using the Kitty
graphics protocol (Kitty, Ghostty, WezTerm) because it requires PNG
format (f=100). Non-PNG images are now converted to PNG using sharp
before being sent to the terminal.
2026-01-03 16:58:57 +01:00
Mario Zechner 9ea483e813 Fix test: update expected error message for concurrent prompt 2026-01-03 16:41:01 +01:00
Mario Zechner 1e1912654f Remove Discord note from main README 2026-01-03 16:39:07 +01:00
Mario Zechner d39769192a Remove redundant pi header and Discord note from coding-agent README 2026-01-03 16:38:39 +01:00
Mario Zechner 1ce1f91f26 Add centered logo and badges to READMEs 2026-01-03 16:37:44 +01:00
Mario Zechner a8ff115184 Add Discord and build badges to READMEs 2026-01-03 16:31:11 +01:00
Mario Zechner aea2ced2b8 Add [Unreleased] section for next cycle 2026-01-03 16:08:48 +01:00
Mario Zechner 113713d380 Release v0.32.2 2026-01-03 16:08:14 +01:00
Mario Zechner 69a8ecd5b3 fix: slash command autocomplete triggers for . - _ prefixes
fixes #422
2026-01-03 15:44:36 +01:00
Mario Zechner e9cf3c1835 Fix slash commands and hook commands during streaming
- Hook commands now execute immediately during streaming (they manage their own LLM interaction via pi.sendMessage())
- File-based slash commands are expanded and queued via steer/followUp during streaming
- prompt() accepts new streamingBehavior option ('steer' or 'followUp') for explicit queueing during streaming
- steer() and followUp() now expand file-based slash commands and error on hook commands
- RPC prompt command accepts optional streamingBehavior field
- Updated docs: rpc.md, sdk.md, CHANGELOG.md

fixes #420
2026-01-03 15:36:54 +01:00
Mario Zechner 5f91baa29e Add [Unreleased] section for next cycle 2026-01-03 04:26:33 +01:00
Mario Zechner b783a3f50f Release v0.32.1 2026-01-03 04:25:57 +01:00
Mario Zechner a4653d48c8 Add changelog entry for edit tool diff fix 2026-01-03 04:24:57 +01:00
Mario Zechner 0f81b09625 Fix edit tool diff not showing in TUI
The async diff preview computation could race with tool execution,
causing editDiffPreview to contain an error (file already modified)
while the actual tool result had the correct diff in details.diff.

Fix: prioritize result.details.diff over editDiffPreview when the
tool has executed successfully. The preview is only used before
tool execution completes.
2026-01-03 04:23:59 +01:00
Mario Zechner 746ec9eb01 Add shell commands without context contribution (!! prefix)
Use !!command to execute bash commands that are shown in the TUI and
saved to session history but excluded from LLM context, compaction
summaries, and branch summaries.

- Add excludeFromContext field to BashExecutionMessage
- Filter excluded messages in convertToLlm()
- Parse !! prefix in interactive mode
- Use dim border color for excluded commands

fixes #414
2026-01-03 04:14:35 +01:00
Mario Zechner bc52509a42 Add [Unreleased] section for next cycle 2026-01-03 02:49:00 +01:00
Mario Zechner 42a19ea81d Release v0.32.0 2026-01-03 02:48:23 +01:00
Mario Zechner 8df22faedf fix(ai): ensure maxTokens > thinkingBudget for Claude thinking models
Claude requires max_tokens > thinking.budget_tokens. When caller specifies
a small maxTokens (e.g. compaction with ~13k tokens) and reasoning is enabled
with high budget (16k tokens), the constraint was violated.

Fix: In mapOptionsForApi, add thinkingBudget on top of caller's maxTokens
(capped at model.maxTokens). If still not enough room, reduce thinkingBudget
to leave space for output.

Applied to both anthropic-messages and google-gemini-cli APIs.

Also adds test utilities for OAuth credential resolution and tests for
compaction with thinking models.

fixes #413
2026-01-03 02:45:30 +01:00
Mario Zechner 97af788344 Show 'In-memory' instead of 'File: undefined' for --no-session mode 2026-01-03 02:01:30 +01:00
Mario Zechner 42b1e06ad1 feat(coding-agent): configurable double-escape action (tree vs branch)
Add doubleEscapeAction setting to choose whether double-escape with an
empty editor opens /tree (default) or /branch.

- Add setting to Settings interface and SettingsManager
- Add to /settings UI for easy toggling
- Update interactive-mode to respect the setting
- Document in README.md settings table

fixes #404
2026-01-03 01:59:08 +01:00
Mario Zechner 17b3a14bfa Fix slow /model selector by deferring OAuth token refresh
getAvailable() now uses hasAuth() which checks if auth is configured
without triggering OAuth token refresh. Refresh happens later when
the model is actually used.
2026-01-03 01:20:11 +01:00
Mario Zechner 1007dca564 Fix changelog entries for Vertex AI provider 2026-01-03 01:12:16 +01:00
Mario Zechner d747ec6e23 Enhance provider override to support baseUrl-only mode
Builds on #406 to support simpler proxy use case:
- Override just baseUrl to route built-in provider through proxy
- All built-in models preserved, no need to redefine them
- Full replacement still works when models array is provided
2026-01-03 01:06:08 +01:00
Mario Zechner 6186e497c5 Add word wrapping changelog entry to coding-agent 2026-01-03 00:49:46 +01:00
Mario Zechner 2b054cdb7c Merge PR #382: word wrapping in Editor component 2026-01-03 00:48:28 +01:00
Mario Zechner e1b0b37ba4 tui: wrap settings descriptions instead of truncating 2026-01-03 00:45:28 +01:00
Mario Zechner 28fb502719 Add image auto-resize toggle to settings, changelog for #402 2026-01-03 00:42:02 +01:00
Mario Zechner ce637f3ea4 Remove obsolete DEVELOPMENT.md 2026-01-03 00:39:15 +01:00
Mario Zechner c6f496441c AGENTS.md: read full Unreleased section before adding changelog entries 2026-01-03 00:38:39 +01:00
Mario Zechner 3b2d3baed2 Add changelog entries for #411 2026-01-03 00:31:03 +01:00
Mario Zechner eb3d70c749 Add changelog entries for #411 2026-01-03 00:29:24 +01:00
Mario Zechner 93498737c0 feat: split queue API into steer() and followUp() (#403) 2026-01-03 00:25:07 +01:00
Mario Zechner 9f2e6ac5eb docs: update README.md, hooks.md, and CHANGELOG for steer()/followUp() API
- Fix settings-selector descriptions to explain one-at-a-time vs all
- Update README.md message queuing section, settings example, and table
- Update hooks.md: hasPendingMessages, sendMessage options, triggerTurn example
- Add Theme/ThemeColor export and hasPendingMessages rename to CHANGELOG
2026-01-03 00:19:07 +01:00
Mario Zechner 8c227052d3 fix(coding-agent): export Theme and ThemeColor for hooks to use proper types 2026-01-03 00:13:26 +01:00
Mario Zechner 65d3081d80 fix(coding-agent): fix Theme type cast in todo hook example 2026-01-03 00:13:26 +01:00
Mario Zechner 9d8230dfc6 feat(coding-agent): expose deliverAs option in hook sendMessage() API
- pi.sendMessage(msg, options?) now accepts { triggerTurn?, deliverAs? }
- deliverAs: 'steer' (default) or 'followUp' controls delivery timing
- Update all mode handlers to pass options through
- Update file-trigger example to use new API
- Update CHANGELOG
2026-01-03 00:13:26 +01:00
Mario Zechner d404f8fcfa docs: update CHANGELOGs for steer()/followUp() API changes
Refs #403
2026-01-03 00:13:26 +01:00
Mario Zechner 3ae02a6849 feat(coding-agent): complete steer()/followUp() migration
- Update settings-manager with steeringMode/followUpMode (migrates old queueMode)
- Update sdk.ts to use new mode options
- Update settings-selector UI to show both modes
- Add Alt+Enter keybind for follow-up messages
- Update RPC API: steer/follow_up commands, set_steering_mode/set_follow_up_mode
- Update rpc-client with new methods
- Delete dead code: queue-mode-selector.ts
- Update tests for new API
- Update mom/context.ts stubs
- Update web-ui example
2026-01-03 00:13:25 +01:00
Mario Zechner 58c423ba36 feat(coding-agent): update AgentSession for steer()/followUp() API
- Rename queueMessage to steer(), add followUp()
- Split _pendingMessages into _steeringMessages and _followUpMessages
- Update sendHookMessage to accept deliverAs option
- Rename hasQueuedMessages to hasPendingMessages
- Rename queuedMessageCount to pendingMessageCount
- Update clearQueue() return type to { steering, followUp }
- Update UI to show steering vs follow-up messages differently

WIP: settings-manager, sdk, interactive-mode, rpc-mode still need updates
2026-01-03 00:13:25 +01:00
Mario Zechner a980998464 Revert /todos to custom TUI component 2026-01-03 00:13:25 +01:00
Mario Zechner cc7823eb45 Change /todos to open in external editor instead of custom TUI 2026-01-03 00:13:25 +01:00
Mario Zechner 74dc5e7c49 Add todo hook companion to todo custom tool
- /todos command displays all todos on current branch with custom UI
- Update hooks.md to clarify components must not be wrapped in Box/Container
- Cross-reference tool and hook in example READMEs
2026-01-03 00:13:25 +01:00
Mario Zechner a3772d2fd7 test(agent): update tests for steer()/followUp() API, update AGENTS.md 2026-01-03 00:13:25 +01:00
Mario Zechner 1625d127c7 Add CHANGELOG entry for #400 2026-01-03 00:13:25 +01:00
Mario Zechner d0a4c37028 feat(agent): split queue into steer() and followUp() APIs
Breaking change: replaces queueMessage() with two separate methods:
- steer(msg): interrupt mid-run, delivered after current tool execution
- followUp(msg): wait until agent finishes before delivery

Also renames:
- queueMode -> steeringMode/followUpMode
- getQueuedMessages -> getSteeringMessages/getFollowUpMessages

Refs #403
2026-01-03 00:13:25 +01:00
Mario Zechner 1e7d991a25 Add changelog entry for terminal title feature (#407) 2026-01-02 22:02:24 +01:00
Mario Zechner 5ef3cc90d1 Add guard against concurrent prompt() calls
Agent.prompt() and Agent.continue() now throw if called while already
streaming, preventing race conditions and corrupted state. Use
queueMessage() to queue messages during streaming, or await the
previous call.

AgentSession.prompt() has the same guard with a message directing
users to queueMessage().

Ref #403
2026-01-02 22:02:24 +01:00