Commit graph

2220 commits

Author SHA1 Message Date
Mario Zechner
0f3a0f78bc fix(ai): prevent orphaned tool results after errored assistant messages
When an assistant message has stopReason 'error', its tool calls are now
excluded from pending tool tracking. This prevents synthetic tool results
from being generated for calls that will be dropped by provider-specific
converters (e.g., Codex drops tool calls from errored messages).

Previously, this mismatch caused OpenAI to reject requests with 'No tool
call found for function call output with call_id ...' errors.

fixes #812
2026-01-17 20:20:39 +01:00
Mario Zechner
57fe00ced4 docs(coding-agent): document ctx.compact and ctx.getContextUsage 2026-01-17 11:51:39 +01:00
Mario Zechner
05ee8e3334 fix(coding-agent): show compaction UI for extensions 2026-01-17 11:48:54 +01:00
Mario Zechner
9d3f8117a4 feat(coding-agent): add extension compaction helpers 2026-01-17 11:40:39 +01:00
Mario Zechner
673916f63c fix(tui): always position cursor for IME
# Conflicts:
#	packages/coding-agent/CHANGELOG.md
2026-01-17 11:40:39 +01:00
Pablo Tovar
cd43b8a9ca
fix: ensure max_tokens > thinking.budget_tokens for bedrock claude (#797)
Bedrock Claude models require max_tokens to exceed thinking.budget_tokens.
This constraint was handled for anthropic-messages API but missing for
bedrock-converse-stream, causing compaction failures.

Extracted adjustMaxTokensForThinking() helper that:
- Adds thinking budget on top of desired output tokens
- Reduces thinking budget if insufficient room (min 1024 output tokens)
- Applied to both anthropic-messages and bedrock-converse-stream APIs
2026-01-17 10:55:30 +01:00
Jian Zhang
fc538f6ca1
feat(coding-agent): export VERSION and update custom-header example (#798)
Co-authored-by: Jian Zhang <jzhang@yanhuangdata.com>
2026-01-17 10:54:00 +01:00
Danila Poyarkov
58eec55154
feat(coding-agent): export keyHint utilities for extensions (#802) 2026-01-17 10:51:03 +01:00
Mario Zechner
7f9cf543d5 Add [Unreleased] section for next cycle 2026-01-17 00:32:57 +01:00
Mario Zechner
91be338e39 Release v0.48.0 2026-01-17 00:32:07 +01:00
Mario Zechner
760414b288 docs: add missing changelog entries for v0.48.0 2026-01-17 00:31:03 +01:00
Mario Zechner
f371069342 docs(coding-agent): add Windows Terminal Shift+Enter config 2026-01-17 00:15:49 +01:00
Mario Zechner
5c938e08d0 docs: document EditorOptions paddingX and editorPaddingX setting 2026-01-16 23:57:35 +01:00
Mario Zechner
fe52ff00d2 feat: add editorPaddingX setting for input editor horizontal padding 2026-01-16 23:50:00 +01:00
Mario Zechner
5d3e7d5aaa fix(ai): preserve unsigned tool call context for Gemini 3 with anti-mimicry note
Instead of skipping unsigned tool calls entirely (which lobotomizes context),
convert them to text with an explicit note telling the model this is historical
context from a different model and not a format to mimic.

This preserves tool call/result context when switching from providers without
thought signatures (e.g. Claude via Antigravity) to Gemini 3.
2026-01-16 23:42:39 +01:00
Mario Zechner
1405e30492 revert: remove editor paddingX from coding-agent 2026-01-16 23:19:58 +01:00
ferologics
48ea444bc4 fix: align input editor with message content padding
Adds paddingX option to Editor component and hardcodes paddingX: 1 in
coding-agent editors so the cursor/text aligns with chat message content.
2026-01-16 23:15:06 +01:00
Mario Zechner
20f5fcc79d fix(coding-agent): handle auto-compaction failures gracefully
When auto-compaction fails (e.g., quota exceeded), emit the error via
the auto_compaction_end event instead of throwing. The UI now displays
the error message, allowing users to take action (switch models, wait
for quota reset, etc.) instead of crashing.

fixes #792
2026-01-16 23:13:26 +01:00
Mario Zechner
5c59caee4e docs: add critical git rules for parallel agent work
Multiple agents may work on different files in the same worktree.
Added rules to prevent agents from accidentally committing or
destroying each other's work.
2026-01-16 22:41:29 +01:00
Mario Zechner
fbb74bb29e fix(ai): filter empty error assistant messages in transformMessages
When 429/500 errors occur during tool execution, empty assistant messages
with stopReason='error' get persisted. These break the tool_use -> tool_result
chain for Claude/Gemini APIs.

Added centralized filtering in transformMessages to skip assistant messages
with empty content and no tool calls. Provider-level filters remain for
defense-in-depth.
2026-01-16 22:35:50 +01:00
Rafał Krzyważnia
d2f9ab110c
feat(coding-agent): add startup.quiet setting to silence startup output (#777)
* feat(coding-agent): add startup.quiet setting to silence startup output

* feat(coding-agent): add startup.quiet setting to silence startup output

Adds a new setting `startup.quiet` that when set to `true` hides:
- Version and keybinding hints header
- Loaded context/skills/templates/extensions discovery info
- Model scope line

Changelog notifications are still shown so users know about updates.

Usage in ~/.pi/agent/settings.json:
{
  "startup": {
    "quiet": true
  }
}

* refactor: flatten startup.quiet to quietStartup on Settings
2026-01-16 22:03:29 +01:00
Mario Zechner
3326b8f521 Fix --no-extensions flag not preventing extension discovery
When --no-extensions was used, extensionsResult.extensions was an empty
array. The condition in buildSessionOptions() checked .length > 0,
so preloadedExtensions was not set. This caused createAgentSession()
to fall through to extension discovery.

Remove the .length > 0 condition so the empty result is passed through,
signaling that extension loading was already handled.

Fixes #776
2026-01-16 22:01:23 +01:00
Mario Zechner
81f5a12e81 Merge PR #787: Improve navigateTree API
Adds replaceInstructions and label options to navigateTree() for custom summarization prompts and branch labeling.

closes #787
2026-01-16 21:49:29 +01:00
Mario Zechner
572ec64dbd Fix navigateTree API: add missing type updates, handler passthrough, and docs
- Update ExtensionCommandContext.navigateTree type signature
- Pass new options through in print-mode and rpc-mode handlers
- Update docs/extensions.md, docs/sdk.md, docs/tree.md
- Add changelog entry
2026-01-16 21:47:01 +01:00
Armin Ronacher
6b6707f30c Improve navigateTree API 2026-01-16 21:37:25 +01:00
Mario Zechner
ffdc8d686b docs: add OpenCode Zen to provider lists in coding-agent README 2026-01-16 21:20:52 +01:00
Mario Zechner
75628e0cfd fix(coding-agent): use lazy-loaded photon wrapper for Node.js compatibility
Previous commit broke Node.js/tsx by using the ESM entry point which
doesn't work with Node. This creates a wrapper module that:
- Uses require() for lazy loading (works in both Node and Bun)
- Gracefully handles load failures (returns original image)
- Works in Node.js, tsx, and Bun compiled binaries
2026-01-16 21:18:13 +01:00
Mario Zechner
5aa0689828 fix(coding-agent): fix standalone binary WASM loading on Linux, fixes #784
- Import photon-node from ESM entry point (photon_rs_bg.js) instead of CJS
  entry, allowing Bun to embed WASM in compiled binaries
- Add photon.d.ts for TypeScript support of ESM entry
- Add scripts/build-binaries.sh for local binary builds
- Simplify GitHub workflow to use the build script
- Add binaries/ to gitignore
2026-01-16 21:11:01 +01:00
Mario Zechner
0c33e0dee5 chore: audit changelog entries for v0.47.0, add cl.md prompt template
- Add missing changelog entries for commits since v0.47.0
- Cross-duplicate ai/tui fixes to coding-agent changelog
- Change PI_NO_HARDWARE_CURSOR to PI_HARDWARE_CURSOR (opt-in)
- Fix typo in PI_CODING_AGENT_DIR changelog entry
- Add .pi/prompts/cl.md for pre-release changelog audits
2026-01-16 21:11:01 +01:00
Rafał Krzyważnia
48b4324155
fix(session): improve session ID resolution with global search and fork support (#785)
When using `--session <UUID>`, the session lookup now:

1. Searches locally first (current project's session directory)
2. Falls back to global search across all projects
3. If found in different project, prompts user to fork the session
4. If not found anywhere, shows clear error instead of silently creating
   a broken session with malformed path

Adds `SessionManager.forkFrom()` to create a forked session from another
project, preserving full conversation history with updated cwd.
2026-01-16 20:18:10 +01:00
Danila Poyarkov
923b9cb9ee
fix(ai): coerce string numbers in tool argument validation (#786)
* fix(ai): coerce string numbers in tool argument validation

* fix(ai): clone tool arguments before AJV validation for type coercion
2026-01-16 20:16:13 +01:00
Aliou Diallo
09d9107d7f
fix(coding-agent): expand tilde in PI_CODING_AGENT_DIR env var (#778) 2026-01-16 17:53:58 +01:00
Sarat Chandra
12ab69fbad
fix(tui): decode Kitty CSI-u shifted symbols (#779) 2026-01-16 17:53:15 +01:00
Pablo Tovar
ba8059a502
fix: sanitize bedrock tool call ids (#781) 2026-01-16 17:51:48 +01:00
Danila Poyarkov
c45ea27de5
feat(coding-agent): display timeout in bash tool UI (#780) 2026-01-16 17:49:33 +01:00
mom
fc3ca545df docs(coding-agent): fix ctx.branch -> ctx.fork in extensions docs 2026-01-16 13:47:28 +00:00
Mario Zechner
4dbf094b65 Add PI_NO_HARDWARE_CURSOR env var for terminals with limited escape sequence support
Fixes cursor visibility issues in JetBrains IDE terminals (IntelliJ, PyCharm) where
the hardware cursor either blinks or becomes invisible depending on settings.

Fixes #771
2026-01-16 12:51:09 +01:00
Mario Zechner
3a475fe165 feat(coding-agent): extension command argument autocomplete (#775) 2026-01-16 12:47:40 +01:00
Rafał Krzyważnia
35e48ca018 feat(coding-agent): extension command argument autocomplete 2026-01-16 12:47:29 +01:00
Mario Zechner
f900eb591d Fix provider feature detection to use model.provider, not just URL
Previously, OpenAI-compatible provider settings (like developer role support)
were detected only from the baseUrl. When using custom URLs (e.g., proxies),
detection failed. Now checks model.provider first, then falls back to URL.

Fixes #774
2026-01-16 12:41:23 +01:00
Mario Zechner
0b625b66b7 fix(coding-agent): prevent duplicate rendering of extension messages on startup, closes #765 2026-01-16 12:16:57 +01:00
Mario Zechner
0438decd26 docs: add changelog entry for #765 2026-01-16 12:16:49 +01:00
Danila Poyarkov
898a1a50ea fix(coding-agent): prevent duplicate rendering of extension messages on startup 2026-01-16 12:16:36 +01:00
Mario Zechner
05d78ea2de Fix session picker 'No sessions found' overflow 2026-01-16 12:11:01 +01:00
Mario Zechner
3f4a6857a5 feat: add bash-style array slicing for $@ in prompt templates
Implements support for ${@:N} and ${@:N:L} syntax to slice argument arrays
in prompt templates, following bash conventions.

Closes #769

Co-authored-by: Zeno Jiricek <airtonix@users.noreply.github.com>
2026-01-16 12:09:45 +01:00
Mario Zechner
43c4a80e2e docs: document prompt template slicing 2026-01-16 12:08:57 +01:00
Zeno Jiricek
f869cc4ae5 feat: add bash-style array slicing for $@ in prompt templates
Implements support for ${@:N} and ${@:N:L} syntax to slice argument arrays
in prompt templates, following bash conventions.

Syntax:
- ${@:N} - All arguments from Nth position onwards (1-indexed)
- ${@:N:L} - L arguments starting from Nth position

Features:
- Bash-style slicing familiar to shell users
- 1-indexed for consistency with $1, $2, etc.
- Processes before simple $@ to avoid conflicts
- No recursive substitution of patterns in arguments
- Comprehensive edge case handling

Examples:
- ${@:2} with ["a", "b", "c"] -> "b c"
- ${@:2:1} with ["a", "b", "c"] -> "b"
- ${@:99} with ["a", "b"] -> "" (empty, out of range)

Test coverage: 24 new tests, all passing (73 total)

Closes #769
2026-01-16 12:05:53 +01:00
Mario Zechner
2836d97735 Fix session picker empty state overflow 2026-01-16 12:04:55 +01:00
Mario Zechner
588399594c Fix session picker hint overflow (closes #764) 2026-01-16 12:01:50 +01:00
Danila Poyarkov
c5cf74e032
feat(coding-agent): export getShellConfig for extensions (#766) 2026-01-16 12:01:46 +01:00