Commit graph

140 commits

Author SHA1 Message Date
Petr Houška
c8ec752cf9 fix(coding-agent): skip fd/rg downloads on unsupported architectures
Only x64 and arm64 map to prebuilt release archives. ARM32 and ia32 previously
fell back to x86-64 binaries; now pi warns and recommends the system package manager.

fixes #11209
2026-10-23 19:48:59 +02:00
Petr Houška
27cc6bfc0c fix(coding-agent): stop macOS shell groups before killing them
Reduce the race where killing a foreground child wakes its shell before the shell is signalled. Keep Linux and Windows termination unchanged and preserve kill fallbacks when stopping fails.

closes #11252
2026-10-22 20:22:20 +02:00
Armin Ronacher
adc5fa9f80 feat(ai,agent,coding-agent): move client identity and provider attribution into pi-ai
pi-ai gets a ClientIdentity request option and createModels() default that choose the User-Agent (detailed with version, short, or custom) and provider attribution headers for OpenRouter, NVIDIA NIM, and OpenCode. Attribution is off by default in pi-ai and on by default in pi-agent-core and pi-durable (HarnessOptions.identity). pi-coding-agent sets its identity from the telemetry setting instead of adding headers itself.
2026-10-21 11:17:02 +00:00
Mario Zechner
f8ab362cca fix(coding-agent): keep clipboard helpers out of pi's process group so Ctrl+Z does not stop them
closes #11179
2026-10-20 20:49:48 +02:00
Petr Houška
61060ddf8c fix(coding-agent): resolve Windows shells from installation directories
Use installation environment variables for PowerShell discovery and legacy WSL launcher detection.
2026-10-19 21:55:12 +02:00
Petr Houška
28bea006be fix(coding-agent): accept Windows Store shell aliases
Node's existsSync() can reject runnable Store aliases because its extra
Windows-only stat check fails with EACCES (nodejs/node#36790). Use
access(F_OK) for shell validation on all platforms instead, matching the
check harness-v2's async refactor settled on (617d8b317, now pathExists
in packages/durable/src/env/node.ts). On Unix this is a no-op: existsSync
is already access(F_OK) there, so shell search order and behavior stay
unchanged; on Windows runnable aliases now pass validation.
2026-10-19 21:24:10 +02:00
David Brailovsky
3e477eab5f feat(coding-agent): add PI_CLIPBOARD_OSC52 to force OSC 52 copies
Sends copied text to the terminal with OSC 52 after the local clipboard
write, as over SSH, for remote clients without SSH variables such as
multiplexer attaches and remote IDE daemons.

closes #10826, closes #10835, closes #10114
2026-10-12 18:07:27 +02:00
David Brailovsky
27c7b6ff48 fix(coding-agent): strip ANSI sequences split across user bash output chunks
closes #10504
2026-10-07 15:02:59 +02:00
David Brailovsky
592fb57b70 fix(coding-agent): read Termux clipboard on Android platform
Termux reports process.platform as android, so the Linux-only branch skipped
termux-clipboard-get and Ctrl+V pasted nothing. Also show the Termux:API hint
when a Termux copy fails.

fixes #10391
2026-10-07 14:35:48 +02:00
David Brailovsky
b30a6dd779 fix(coding-agent): ignore Node's own worker messages in image resize
Under `node --watch`, Node 24.19+ and 26.x post `{ "watch:require": [...] }`
on the worker message channel (nodejs/node#65044). The image resize code
treated the first message as the worker's reply, resolved it to `null`, and
dropped the image as "could not be resized below the inline image size limit".

Worker replies now carry a `type` marker, and the main thread ignores any
message without it. The reply type is now either a result or an error.

fixes #10527
2026-10-07 12:26:43 +02:00
Ramiz Wachtler
b9ab918c62
fix(coding-agent): keep syntax colors on multiline tokens (#10356)
* fix(coding-agent): keep syntax colors on multiline tokens

- format each line of a highlighted span separately
- add regression test for python docstrings
- fixes #10143

* fix(coding-agent): use text color for string interpolations

- map highlight.js `subst` scope to text color
2026-10-05 10:35:43 +02:00
Armin Ronacher
d677d0ee71 feat(coding-agent): save codemode image() output to temp files
image() output is also written to a temp file and the result names the
path before each image, so later turns can reference generated images.
Output files are now created through one helper (still tmpdir()) and
are readable only by the user.

closes #10310
2026-10-04 23:32:43 +02:00
Armin Ronacher
a276dabe57 fix(tui,coding-agent): convert non-PNG images for Kitty in Image
Kitty-protocol terminals only accept PNG. pi-tui now exposes
setImageTranscoder(); Image converts JPEG/GIF/WebP through it and shows
the text fallback without one. coding-agent registers a photon-based
transcoder, so images from extensions and all ToolExecutionComponent
hosts render.

closes #10292
2026-10-03 00:14:52 +02:00
Armin Ronacher
4259686d92
refactor(coding-agent): resolve built-in extensions as builtin:<name> paths (#10159)
Built-in extensions (mcp, llama.cpp, codemode, tool-search) are now extension resources like files: the package manager resolves them as builtin:<name>, the extensions setting disables them with -builtin:<name> (per project too), pi config lists them, and --no-extensions turns them off unless loaded with -e builtin:<name>. They load after project trust is resolved and after file and package extensions.

Built-in extensions and tools are named builtin:<name> in errors, diagnostics, RPC source info, and bug reports.
2026-09-29 10:51:01 +02:00
Armin Ronacher
8562bcf66a feat(coding-agent): codemode and MCP
This adds codemode and MCP support to pi. Codemode (packages/codemode) runs
model-written JavaScript in a QuickJS wasm VM inside a worker. From there the
script calls pi's tools as async functions, uses a per-session store, and can
read the model catalog and run classifiers. The codemode tool in coding-agent
is compatible with Codex's exec tool, and codemode.mode works like Codex's
tool modes (on or only). Large results are written to a JSON temp file. MCP
(packages/mcp) is a standalone client for stdio and streamable HTTP servers,
with OAuth.

The core only gets general mechanisms; codemode, tool_search and MCP are
built-in extensions that use them. Other extensions can replace these
built-ins. Tools declare an exposure: direct, model-only, codemode, deferred
or hidden. prepareLoadout() lets an orchestrating tool change which tool
declarations the model sees. ctx.executeTool() runs nested calls through
validation and the tool_call/tool_result hooks. Those calls emit events with
parentToolCallId and are recorded as bounded nestedCalls on the parent
result, which compaction and HTML export use. Tools can also return
structuredContent with an outputSchema, and can report errors with isError
instead of throwing. MCP servers come from mcp.json (global, or per project
after the project is trusted) or from pi.registerMcpServer(). They are
managed with /mcp and pi mcp list|login|logout, and their runtimes load on
first use.

Closes #10040
2026-09-29 09:12:50 +02:00
Armin Ronacher
b485fa3128 fix(tui,coding-agent): reduce render cost of theme changes and streaming
Theme previews re-render the whole transcript, and streaming re-renders
every frame, so per-line and per-session work dominated in long sessions.

- visibleWidth: fast path for ANSI-styled ASCII, allocation-free escape scanning
- Box: compare unpadded child lines and skip a second width measurement
- Markdown: reuse parsed tokens across invalidation
- footer: cache usage totals and context usage per session state
- bash results: cache the collapsed preview including the expand hint
- sanitizeBinaryOutput: single regex replace
2026-09-29 08:23:46 +02:00
Christian Klotz
fd889a2741
fix(coding-agent,tui): paste Finder file paths instead of icons (#10136)
Read Finder file URLs before icon image data on macOS. Quote paths in
bash mode and reject terminal control characters before rendering.

Fixes #9999

Co-authored-by: 1dustycy <onedustycy@gmail.com>
2026-09-28 20:59:29 +01:00
Armin Ronacher
8676a0dcd8 fix(coding-agent): require advertised X11 clipboard images
closes #9786
2026-09-24 09:15:58 +02:00
David Brailovsky
47a18e37b1 fix: require complete GIF image signatures
Require GIF87a or GIF89a headers to avoid classifying text files beginning with GIF as images.

Fixes #9755
2026-09-21 10:30:42 +02:00
Armin Ronacher
f5c946480c feat(ai,coding-agent): add image input limits (closes #9631) 2026-09-20 22:59:16 +02:00
Armin Ronacher
6dff740fab fix(coding-agent): restore OSC 52 clipboard fallback for headless sessions
3349e1db1 (#9618) limited OSC 52 to SSH/mosh so a desktop terminal that ignores
it no longer reports a false success. That also disabled the only clipboard
route for containers and WSL without WSLg, which have no display to gate on.

Emit OSC 52 again on display-less Linux. On WSL, write the Windows clipboard
through PowerShell (verified, no OSC 52 size cap), preferring OSC 52 in
Windows Terminal where it is known to work. Desktop sessions with a display
still report the failure.

closes #9688
2026-09-20 12:42:15 +02:00
Armin Ronacher
3c75b27479 feat(coding-agent): add bug reporting 2026-09-19 17:55:49 +02:00
Armin Ronacher
60e7e76bd7 fix(coding-agent): surface clipboard backend failures
closes #9618
2026-09-16 01:29:52 +02:00
Armin Ronacher
3349e1db18 fix(coding-agent): reject unverified local clipboard writes
fixes #9618
2026-09-16 00:08:02 +02:00
Armin Ronacher
caf6dfe731
feat(tui): Simplify clipboard handling (#9163)
Replace the external clipboard dependency with small macOS, Windows,
and X11 helpers and integrate them into coding-agent.

Run native clipboard operations on worker threads and make command
fallbacks asynchronous. Preserve incremental X11 transfers, legacy text
encodings, native image formats, and existing Wayland and platform tools.

Include native prebuilds with ARM64 page alignment, packaging updates,
and regression coverage.
2026-09-05 23:52:32 +02:00
Stickman Charles
6aedd1066e
fix(coding-agent): download statically linked musl builds of fd and ripgrep on Linux (#9070) 2026-09-04 00:17:51 +02:00
wutongyuonce
c6b00676b8
fix(coding-agent): scan past non-EXIF APP1 segments (#8616) 2026-09-03 11:02:39 +02:00
Terminator666666
57e53b0d79
fix(coding-agent): resolve fd/rg release versions without the GitHub API (#8708)
The fd/ripgrep auto-download resolved the latest version through
api.github.com, which shares the anonymous API quota (60 requests/hour
per IP). Behind shared egress IPs (corporate proxies, CI runners, NAT)
that quota is permanently exhausted by unrelated traffic, so the
download failed with 'GitHub API error: 403' on every launch while the
actual release download endpoint would have worked fine.

Resolve the version from the /releases/latest web redirect instead: it
carries the tag in the Location header, is not subject to the API
quota, and lives on the same origin as the binary download itself. The
redirect body is discarded so the connection can be reused, and the
pinned fd version on darwin/x64 now skips the lookup entirely.

Also improve download failure diagnostics: status messages include the
error cause chain so transport errors surface their actionable detail
instead of a bare 'fetch failed', and HTTP download errors include the
failing URL.

Fixes #8594

Co-authored-by: Terminator666666 <Terminator666666@users.noreply.github.com>
2026-09-03 10:59:04 +02:00
Vegard Stikbakke
7af2d27dce fix(coding-agent): prevent Windows taskkill spawn crashes
closes #6596
2026-08-26 10:33:45 +02:00
Armin Ronacher
80e62761f7
feat(coding-agent): add optional PowerShell tool (#8512) 2026-08-24 12:27:03 +02:00
Armin Ronacher
faecac2ca8 feat(coding-agent): reduce bundled startup work 2026-08-23 00:03:19 +02:00
Armin Ronacher
cec3a91c02 feat(coding-agent): defer uncommon syntax grammars 2026-08-22 22:50:12 +02:00
Armin Ronacher
1355cd36e0 fix(coding-agent): normalize UTF-8 BOMs in text inputs
closes #8337
2026-08-19 14:11:02 +02:00
Armin Ronacher
df018b6020 fix(coding-agent): retry hung model catalog requests
closes #8198
2026-08-17 12:55:56 +02:00
Vegard Stikbakke
6f707eb360 fix(coding-agent): show managed-tool startup status in TUI 2026-08-13 15:54:34 +02:00
Armin Ronacher
9524d3a580 fix(coding-agent): normalize Windows shell drive paths
Refs #7547
2026-08-05 20:42:05 +02:00
Armin Ronacher
7cf90c1d18 fix(coding-agent): avoid model store read lock contention 2026-08-05 11:30:43 +02:00
Cristina Poncela Cubeiro
845bb970f3
fix: build error on request info (#7645) 2026-08-05 09:56:43 +02:00
Petr Houška
46b53b995b
fix: retry transient management HTTP requests (#7632)
Retry idempotent coding-agent management requests for transient transport and HTTP failures while keeping one overall timeout budget across attempts.

Keep install telemetry single-shot because retrying it has no user-facing impact and could duplicate a side-effecting report.
2026-08-05 09:38:28 +02:00
Mario Zechner
fed6009cc9 fix(coding-agent): make model refresh cancellation caller-owned
Add generation-safe catalog publication, cancellable auth and storage operations, locally consistent credential mutations, and cache-first interactive model flows.
2026-08-04 00:03:52 +02:00
Jeremy Gayed
b0e05b4423
fix(coding-agent): resize images returned by tools (#7330)
Images produced by tools (extensions, MCP bridges, screenshot tools) went into
session history at full resolution because processImage was only wired to the
read tool and @file CLI attachments. Providers validate every image in the
request, so one oversized image poisons the whole conversation: Anthropic drops
its per-image cap from 8000px to 2000px once a request carries many images, and
every later turn re-sends the same payload. Switching models does not help.

Normalize tool result images in AgentSession.afterToolCall, after the extension
tool_result hook so extension-injected images are covered too. Honors
images.autoResize, and keeps the original block when processing fails so an
unavailable image backend does not delete tool output.

Refs #5369

Assisted-By: devx/86bf3b09-9aba-4d03-8154-50fca3ffc9b5
2026-08-03 14:02:03 +02:00
Christian Klotz
bfc679d5e4
fix(coding-agent): read clipboard text on Wayland
Prefer wl-paste on Wayland while preserving the native clipboard fallback when the command is unavailable.

Fixes #7248

Co-authored-by: Ston Jia <ston.jia@outlook.com>
2026-07-31 18:10:28 +03:00
Shakti
2d3f555429
fix: await wl-copy exit code and fall through to xclip on failure (#7009)
The /copy command always set copied=true after spawning wl-copy without
awaiting its exit code. When wl-copy fails (e.g. in a sandboxed
environment that inherits WAYLAND_DISPLAY but not the socket), the
xclip/OSC 52 fallbacks never ran because copied was already true.

Fix: await the wl-copy spawn exit code and only claim success on exit
code 0. On failure, fall through to the x11 clipboard fallback.

Fixes #6872.
2026-07-24 06:58:37 +02:00
Armin Ronacher
ecb9410c5c fix(coding-agent): let manual updates bypass skip check
closes #6977
2026-07-22 20:53:35 +02:00
Armin Ronacher
d7a48d30a0 fix(coding-agent): fall back to text clipboard paste 2026-07-10 21:46:15 +02:00
David Brailovsky
62f45badae
Fix native clipboard in bun release (#6418)
* copy native clipboard .node files to the clipboard package

under the bun binary packaging, require("@mariozechner/clipboard-linux-x64-gnu")
doesn't work so instead we rely on require("./clipboard.linux-x64-gnu.node")
for that we need to copy the .node files to the clipboard package dir

* fallback to xclip if native clipboard fails on x11
2026-07-08 11:20:24 +02:00
Armin Ronacher
4cc339f58d fix(coding-agent): process BMP images from disk
closes #6047
2026-06-25 12:52:21 +02:00
Vegard Stikbakke
1287b69fe0 fix(coding-agent): run legacy WSL bash commands via stdin
closes #5893
2026-06-19 15:08:25 +02:00
Joseph Mearman
3fa4095629
fix: drain stdout before resolving when a child holds the pipe past exit (#5753) 2026-06-15 09:55:45 +02:00
Armin Ronacher
c48f656f88 fix(coding-agent): handle npm package semver ranges
closes #5695
2026-06-14 01:38:51 +02:00