Commit graph

1451 commits

Author SHA1 Message Date
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
mom
308c0e0ec0 docs(coding-agent): fix attribution format for PR #418 2026-01-03 13:15:20 +00:00
mom
463cc0713b docs(coding-agent): add CHANGELOG entry for PR #418 2026-01-03 13:10:51 +00:00
Evgeniy Skuridin
8917a1f853
feat(coding-agent): add $ARGUMENTS syntax for slash commands (#418)
* feat(coding-agent): add $ARGUMENTS syntax for slash commands

* test(coding-agent): add tests for slash command argument substitution
2026-01-03 14:08:39 +01:00
cursive
9e3b1408f3
Copy OAuth login URL to clipboard for mobile SSH users (#415) 2026-01-03 09:43:25 +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
Anton Kuzmenko
3b61d83d29 Fix google-vertex build 2026-01-03 01:11:03 +01:00
Anton Kuzmenko
6467e70995 fix: update cost values for input, output, and cacheRead in model configs 2026-01-03 01:11:03 +01:00
Anton Kuzmenko
214e7dae15 Add Vertex AI provider with ADC support
- Implement google-vertex provider in packages/ai
- Support ADC (Application Default Credentials) via @google/generative-ai
- Add Gemini model catalog for Vertex AI
- Update packages/coding-agent to handle google-vertex provider
2026-01-03 01:11:03 +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
Yevhen Bobrov
243104fa18
Allow models.json to override built-in providers (#406)
* Allow models.json to override built-in providers

When a provider is defined in models.json with the same name as a
built-in provider (e.g., 'anthropic', 'google'), the built-in models
for that provider are completely replaced by the custom definition.

This enables users to:
- Use custom base URLs (proxies, self-hosted endpoints)
- Define a subset of models they want available
- Customize model configurations for built-in providers

Example usage in ~/.pi/agent/models.json:
{
  "providers": {
    "anthropic": {
      "baseUrl": "https://my-proxy.example.com/v1",
      "apiKey": "ANTHROPIC_API_KEY",
      "api": "anthropic-messages",
      "models": [...]
    }
  }
}

* Refactor model-registry for readability

- Extract CustomModelsResult type and emptyCustomModelsResult helper
- Extract loadBuiltInModels method with clear skip logic
- Simplify loadModels with destructuring and ternary
- Reduce repetition in error handling paths

* Refactor model-registry tests for readability

- Extract providerConfig() helper to hide irrelevant model fields
- Extract writeModelsJson() helper for file writing
- Extract getModelsForProvider() helper for filtering
- Move modelsJsonPath to beforeEach

Reduces test file from 262 to 130 lines while maintaining same coverage.
2026-01-03 00:59:59 +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
e82af9da47
Merge pull request #402 from mitsuhiko/image-resize
Added automatic image resizing
2026-01-03 00:39:26 +01:00
Mario Zechner
ce637f3ea4 Remove obsolete DEVELOPMENT.md 2026-01-03 00:39:15 +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
3506ac81f2
Merge pull request #411 from nathyong/feature/shift-backspace
tui: fix shift+space/backspace/delete on kitty-protocol terminals
2026-01-03 00:28:58 +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
Armin Ronacher
345fa975f1
Handle ctrlc like escape in selectors (#400)
Cheers @nicokosi
2026-01-02 22:43:39 +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
Kao Félix
5c3c8e6f7e
Add terminal title support to TUI framework (#407)
Add setTitle() method to Terminal interface for setting window title.
Uses standard OSC escape sequence \x1b]0;...\x07 for broad terminal
compatibility (macOS Terminal, iTerm2, Kitty, WezTerm, Ghostty, etc.).

Changes:
- Add setTitle(title: string) to Terminal interface
- Implement in ProcessTerminal using OSC sequence
- Implement no-op in VirtualTerminal for testing
- Use in interactive mode to set title as "pi - <dirname>"
2026-01-02 22:00:34 +01:00
nathyong
c9b08d7643 tui: fix shift+space/backspace/delete on kitty-protocol terminals
Kitty and other smart terminals send a specific CSI u control code for
these shifted special keys, which are interpreted as a no-op by the
editor component. These should send the underlying key instead, matching
the behaviour of other TUI programs (e.g. readline, vim insert mode).

On less smart terminals, these key combinations are the same as the
non-shifted versions, and so already work with the existing code.
2026-01-03 06:58:56 +11:00
Armin Ronacher
4a32af2532 Added automatic image resizing 2026-01-02 12:01:56 +01:00