The presence of `process.argv[1]` in the current invocation does not
imply that the current `pi` process is being invoked as a script.
Specifically, in the case of a bun compiled binary, `process.argv[1]`
will be the virtual path `/$bunfs/root/pi`, which is not a real file on
the filesystem. This causes the subagent extension to inject this path
into the child `pi` invocation, which is interpreted as part of the
prompt, which confuses the subagent.
This change uses the script only if it is not a bunfs virtual script
Co-authored-by: nathyong <nathyong@noreply.github.com>
* fix(coding-agent): surface models.json load errors on stderr in --list-models
When models.json has validation errors, --list-models silently
discarded custom models and overrides without any user-visible
feedback. Now prints the error to stderr via chalk.yellow warning
before listing available models.
* fix(coding-agent): allow custom models for built-in providers in models.json
Built-in providers (openrouter, anthropic, etc.) already have api and
baseUrl on every model, and auth comes from env vars / auth storage.
Relax validation so custom models under built-in providers don't need
redundant baseUrl, apiKey, or api fields. Inherit them from the first
built-in model for that provider.
fixes#2921
---------
Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
Previously, getLatestNpmVersion() hardcoded a fetch to
registry.npmjs.org, which 404s for packages on alternate
registries (private, Verdaccio, GitHub Packages, etc.).
The error was silently swallowed, so users never saw update
notifications for these packages.
Replace the direct fetch with
via the existing runCommandCapture helper. This uses the same
registry resolution as npm install (reads .npmrc config chain),
respects the npmCommand setting, and runs with this.cwd for
correct .npmrc lookup.
Mutate persisted tool-call blocks in place on function_call completion,
remove partialJson, and emit the same reference on toolcall_end.
Add regression coverage for persisted block cleanup and event identity.
fixes#3078
Messages sent during branch summarization are added to the compaction
queue but never flushed when summarization ends. The user sees the
message in the steering queue and has to manually dequeue and resend it.
The fix is to flush the compaction queue after successful tree
navigation, matching the existing behavior of auto-compaction and
`/compact`. If the user jumps to a user message, the queued message is
sent as a prompt, and the jumped-to text is placed in the editor.
Tests assumed renders complete synchronously after requestRender() +
nextTick + flush(), but commit 6f5f37f8 changed requestRender() to
schedule via setTimeout with a 16ms minimum interval. Tests reading
viewport state before doRender() runs saw stale data.
Add VirtualTerminal.waitForRender() helper that waits for the throttled
render to settle (nextTick + 20ms + xterm flush), and replace all
terminal.flush() calls after render-triggering actions with it.
Fixes 8 failing tests across overlay-short-content, tui-render, and
markdown test suites.
The OpenRouterRouting interface only had only and order, but the runtime
passes the entire object as-is to the OpenRouter API's provider field.
This means all other fields worked at runtime but had no TypeScript
type-checking, no autocomplete, and no config validation.
This adds all fields from the OpenRouter provider selection API
(https://openrouter.ai/docs/guides/routing/provider-selection):
allow_fallbacks, require_parameters, data_collection, zdr,
enforce_distillable_text, ignore, quantizations, sort, max_price,
preferred_min_throughput, preferred_max_latency.
Also fixes the models.md documentation which had an invalid fallbacks
field in the example (not part of the OpenRouter API), replaces it with
a comprehensive example showing all available fields, and clarifies that
openRouterRouting is sent as-is in the provider field.
The 2.5-flash-lite model was incorrectly matching the 2.5-flash
case, setting minimal budget to 128. Per Google's docs, flash-lite's
minimum thinking budget is 512, not 128. This caused the error:
The thinking budget 128 is invalid. Please choose a value between
512 and 24576.
Add a dedicated 2.5-flash-lite case before the 2.5-flash case so
the more specific match takes priority.
Fixes#2838
Co-authored-by: JasonOA888 <JasonOA888@users.noreply.github.com>
The current sandbox extension instructions state the glob configuration file must exist at `~/.pi/agent/sandbox.json` whereas it actually must exist at `~/.pi/agent/extensions/sandbox.json` to be picked up.