Commit Graph

1461 Commits

Author SHA1 Message Date
Armin Ronacher
dacb7eaa90 fix(coding-agent): detect renamed npm self updates 2026-05-07 20:59:49 +02:00
Mario Zechner
551385e409 chore: migrate packages to earendil works scope 2026-05-07 17:13:48 +02:00
Armin Ronacher
5e1e4c3c88 feat(coding-agent): support renamed self-update package 2026-05-07 16:11:18 +02:00
Mario Zechner
3e5ad67e0f chore: migrate pi packages to earendil works scope 2026-05-07 15:59:42 +02:00
Pooya Parsa
50993d743d chore(coding-agent): switch back from fork to upstream jiti 2.7 (#4244) 2026-05-07 01:04:51 +02:00
Aliou Diallo
88619669e2 fix(coding-agent): strip skill wrapper XML from HTML export user messages (#4234)
Skill slash commands store a structural <skill>...</skill> wrapper in raw
user messages. The TUI uses parseSkillBlock() to split this into separate
SkillInvocationMessageComponent and UserMessageComponent siblings, but the
HTML export renderer passed the full raw text through markdown, causing
broken/dangling XML tags to appear in exported HTML.

Add parseSkillBlock() to the export template and render skill-invocation
and user-message as separate sibling blocks:
- Sidebar tree shows skill name + user prompt separately
- Content area shows a clickable skill-invocation block (collapsed by
  default, markdown content on expand) followed by the user message
- Copy-link button preserved on the wrapper element
- Toggle tools (O key) expands/collapses skill invocations alongside
  compaction and tool output blocks
2026-05-06 18:06:37 +02:00
Mario Zechner
060c10b8ff fix(coding-agent): skip X11-only native addon for /copy on Linux
The @mariozechner/clipboard native addon uses clipboard-rs, which is
X11-only and does not retain selection ownership after set_text resolves.
On Wayland-only compositors (Hyprland, Niri, ...) /copy reported success
without populating the clipboard. Skip the native addon on Linux and let
wl-copy/xclip/xsel handle text writes; they properly daemonize.

closes #4177
2026-05-05 14:47:51 +02:00
Mario Zechner
755da309dd fix(coding-agent): keep pending tool renders after thinking toggle
closes #4167
2026-05-05 13:18:04 +02:00
Armin Ronacher
b5755fd27d feat(oauth): support interactive login selection (#4190) 2026-05-05 13:16:56 +02:00
Julien Chaumond
bb25a3944c feat(coding-agent): allow comments and trailing commas in models.json (#4162)
* feat(coding-agent): allow comments and trailing commas in models.json

Run user-supplied models.json through a small `stripJsonComments` helper
before JSON.parse so users can annotate their config and leave trailing
commas without breaking the loader.

Co-Authored-By: julien-agent <Agents+cyolo@huggingface.co>

* fix(coding-agent): strip comments before trailing commas in models.json

The single-pass regex couldn't see a trailing comma when a `//` comment sat
between the comma and its closer. Split into two passes: strip comments
first, then strip trailing commas on the cleaned input.

Co-Authored-By: julien-agent <Agents+cyolo@huggingface.co>

---------

Co-authored-by: julien-agent <Agents+cyolo@huggingface.co>
2026-05-04 22:44:35 +02:00
Mario Zechner
bac2df36b9 fix(coding-agent): handle frontmatter prompts in print mode
closes #4163
2026-05-04 22:37:38 +02:00
Armin Ronacher
6b18cdbac1 fix(coding-agent): stream bash output incrementally (#4165)
fixes #4145
2026-05-04 19:06:07 +02:00
Armin Ronacher
756b774935 fix(coding-agent): exit on lost terminal
Fixes #4144.
2026-05-04 12:07:16 +02:00
Armin Ronacher
e355696d8a fix(coding-agent): show compact read line ranges 2026-05-04 09:39:12 +02:00
Mario Zechner
324aa1d647 fix(coding-agent): render compact read calls directly
Render compact read classifications in the call row and leave the collapsed result row empty. The previous implementation used shared renderer state to let renderResult hide renderCall, which leaked an internal ReadRenderState type through the tool definition and coupled two render phases unnecessarily. The call renderer has all context needed to choose the compact presentation itself.
2026-05-04 00:52:56 +02:00
Mario Zechner
23420012ab fix(coding-agent): decouple codex session cleanup 2026-05-04 00:45:56 +02:00
Armin Ronacher
5fa277b320 fix(coding-agent): close codex websocket sessions
Fixes #4103
2026-05-03 23:25:56 +02:00
Armin Ronacher
370fdae6fa fix(ai): fall back from codex websocket to sse (#4133) 2026-05-03 22:51:42 +02:00
Jake Jia
693888ac47 feat(ai): switch xiaomi default to api billing, add per-region token plan providers (#4112)
Built-in `xiaomi` provider now targets the API billing endpoint (https://api.xiaomimimo.com/anthropic) — a single stable URL for keys issued at platform.xiaomimimo.com. The Token Plan endpoints are exposed as three sibling providers, each with its own env var:

- xiaomi-token-plan-cn: XIAOMI_TOKEN_PLAN_CN_API_KEY
- xiaomi-token-plan-ams: XIAOMI_TOKEN_PLAN_AMS_API_KEY
- xiaomi-token-plan-sgp: XIAOMI_TOKEN_PLAN_SGP_API_KEY

BREAKING CHANGE: users who previously set XIAOMI_API_KEY against the Token Plan AMS endpoint must move to xiaomi-token-plan-ams and set XIAOMI_TOKEN_PLAN_AMS_API_KEY. This also resolves the 401 reported by on #4005, where a platform.xiaomimimo.com key fails against the Token Plan endpoint.

closes #4082
2026-05-03 12:57:11 +02:00
Armin Ronacher
588639fa97 feat(read): compact resource read rendering 2026-05-02 21:20:26 +02:00
Mario Zechner
b8bb2411ff fix(ai): honor codex transport option
closes #4083
2026-05-02 14:14:22 +02:00
Mario Zechner
c0e046990e fix(ai): use Xiaomi Token Plan Anthropic endpoint
closes #3912
2026-05-02 01:36:34 +02:00
Mario Zechner
80f06d3636 feat: add model thinking level metadata
closes #3208
2026-05-02 01:21:06 +02:00
Jake Jia
a44622670f feat(ai): add Xiaomi MiMo provider (#4005)
* fix(ai): include minimax-cn in cross-provider-handoff matrix

* feat(ai): add Xiaomi MiMo provider

Adds Xiaomi MiMo as an openai-completions-compatible provider.

- packages/ai: register provider in types/KnownProvider, env-api-keys (XIAOMI_API_KEY), generate-models, models.generated.ts, overflow util, README, CHANGELOG
- packages/ai/test: extend stream, tokens, abort, empty, context-overflow, overflow, image-tool-result, tool-call-without-result, total-tokens, unicode-surrogate, cross-provider-handoff matrices with Xiaomi
- packages/coding-agent: default model (mimo-v2.5-pro), display name (Xiaomi MiMo), CLI env var docs, README, docs/providers.md

closes #3912

---------

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-05-02 00:46:05 +02:00
Mario Zechner
ddb8ed0c73 fix(coding-agent): honor registered model base urls
closes #4063
2026-05-01 22:19:06 +02:00
Armin Ronacher
c3282e4a7d refactor(coding-agent): inline npm command parsing 2026-05-01 18:52:54 +02:00
Armin Ronacher
ade08de14c fix(coding-agent): repair self-update detection
Fixes #3942
Fixes #3980
Fixes #3922
2026-05-01 18:08:02 +02:00
Mario Zechner
4745a95898 feat(ai): add cached codex websocket transport 2026-05-01 13:07:40 +02:00
Mario Zechner
a45577bd00 fix(ai): finalize cloudflare gateway provider support 2026-05-01 00:56:05 +02:00
MC
24fb6b833b feat(ai): add Cloudflare AI Gateway as a provider (#3856)
* feat(ai): add Cloudflare AI Gateway as a provider

Routes through Cloudflare's Unified API (`/compat`) for Workers AI and
Anthropic models, and through the provider-specific `/openai` subpath
for OpenAI models so reasoning models (gpt-5.x, o-series) can hit
`/v1/responses` natively. Once `/compat` adds Responses-API support,
the OpenAI subpath can be folded back in.

Catalog layout:
  workers-ai/@cf/...  -> openai-completions, gateway/.../compat
  anthropic/...       -> openai-completions, gateway/.../compat
  <native-id>         -> openai-responses,   gateway/.../openai
                         (gpt-5.1, claude-... no, sorry: gpt-5.x and o-series only;
                          prefix stripped because the OpenAI SDK posts native ids)

Touches:
  packages/ai/src/types.ts                       add cloudflare-ai-gateway to KnownProvider
  packages/ai/src/env-api-keys.ts                map to CLOUDFLARE_API_KEY
  packages/ai/src/providers/cloudflare.ts        add CLOUDFLARE_AI_GATEWAY_COMPAT_BASE_URL
                                                 and CLOUDFLARE_AI_GATEWAY_OPENAI_BASE_URL
  packages/ai/src/providers/openai-responses.ts  one-line dispatch through resolveCloudflareBaseUrl
                                                 (matches what openai-completions.ts already does)
  packages/ai/scripts/generate-models.ts         branch openai/* vs workers-ai/anthropic/*
  packages/ai/src/models.generated.ts            spliced 34 entries
  packages/ai/test/stream.test.ts                3 e2e blocks (one per upstream)
  packages/coding-agent/*                        defaultModelPerProvider, login, env docs,
                                                 README, providers.md

Verified end-to-end against a real Cloudflare account with unified
billing: 9/9 e2e tests pass across all three upstreams (Workers AI
Kimi K2.6, OpenAI gpt-5.1 reasoning, Anthropic claude-sonnet-4-5).

* refactor(ai): move AI Gateway User-Agent and per-route session-affinity flag to catalog

Mirrors the same per-model metadata refactor done for Workers AI in the
parent branch. All cloudflare-ai-gateway entries get the User-Agent
header. Only workers-ai/* gateway entries set
`compat.sendSessionAffinityHeaders: true` because the gateway
forwards that header to the underlying Workers AI runtime; anthropic/*
upstream and openai/* (openai-responses) don't use it.

  packages/ai/scripts/generate-models.ts: emit headers (always) and
  per-upstream compat (workers-ai only) on each cloudflare-ai-gateway
  entry.
  packages/ai/src/models.generated.ts: re-spliced 35 entries with
  headers + conditional compat.

Behavior unchanged - 9/9 e2e tests pass across all three upstream
families.

* fix(ai): align AI Gateway with telemetry-aware UA helper

Adapts to badlogic/pi-mono#3851's follow-up fix ("honor telemetry for
Cloudflare attribution headers", fbb5eed) which moved the
'User-Agent: pi-coding-agent' header out of per-model catalog metadata
and into a centralized telemetry-honoring helper
(coding-agent/src/core/sdk.ts:getAttributionHeaders).

- packages/coding-agent/src/core/sdk.ts: extend the cloudflare branch of
  getAttributionHeaders to also match cloudflare-ai-gateway and
  gateway.ai.cloudflare.com.

- packages/ai/scripts/generate-models.ts and src/models.generated.ts:
  drop 'headers' from the 35 cloudflare-ai-gateway entries (constant
  CLOUDFLARE_STATIC_HEADERS no longer exists). Per-route
  compat.sendSessionAffinityHeaders is unchanged.

End-to-end behavior unchanged: 9/9 tests still pass across all three
upstream families (Workers AI, Anthropic, OpenAI Responses).

---------

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-04-30 23:29:37 +02:00
Mario Zechner
0b8452c32f fix(coding-agent): fix WSL clipboard image paste
closes #2469
2026-04-30 23:08:51 +02:00
Mario Zechner
3ffc2b4306 fix(coding-agent): avoid duplicate blocked edit output
closes #3830
2026-04-30 22:50:40 +02:00
Mario Zechner
95ae590279 fix(coding-agent): refresh thinking border from extensions
closes #3888
2026-04-30 22:50:00 +02:00
Mario Zechner
8191d59c17 feat(coding-agent): support session dir env
closes #4027
2026-04-30 21:37:53 +02:00
Mario Zechner
3d43d2e175 fix(coding-agent): stop tool argument injection
closes #4018
2026-04-30 21:31:43 +02:00
Mario Zechner
fe66edd943 remove gemini cli and antigravity support 2026-04-30 21:24:36 +02:00
Mario Zechner
40c6eabb8f feat(coding-agent): allow message_end replacements
closes #3982
2026-04-30 21:24:36 +02:00
pica
24dec9fcd5 fix(coding-agent): remove detached: true on Windows to fix pwsh.exe stdio (#4013)
On Windows, spawn(..., { detached: true }) prevents pwsh.exe (PowerShell) from
producing any stdout/stderr through pipe streams. This is because detached creates
a new process group which breaks pwsh's console host communication.

bash.exe and other cygwin/msys2 shells are unaffected by detached: true, but
they don't need it either -- on Windows, killProcessTree() already uses
taskkill /F /T /PID which kills the process tree by PID regardless of
whether the process was spawned detached.

The detached flag only matters on Unix, where kill(-pid, SIGKILL) requires a
process group that is only created via detached: true.

Fixes #4012
2026-04-30 20:59:02 +02:00
Armin Ronacher
7dc1bed478 feat(ai): add Moonshot AI provider model support 2026-04-30 17:21:03 +02:00
Mario Zechner
ebdf3cf451 Adjusts #3955, better error message 2026-04-30 12:33:02 +02:00
Ramiz Wachtler
43ee9b77ed fix(coding-agent): report edit access failures correctly (#3955)
* fix(coding-agent): report edit access failures correctly closes #3894

- classify edit and edit-preview access errors by errno
- add regressions for missing, permission, and fallback cases
- document the fix in the coding-agent changelog

* chore: get rid of CHANGELOG.md entry

* refactor(coding-agent): apply review suggestions - use single error msg

* refactor(coding-agent): clean up test cases
2026-04-30 12:31:29 +02:00
George Hilliard
0dd11898ad fix(coding-agent): redo Bun package manager node_modules handling (#3998)
* Revert "fix(coding-agent): use alternate logic to find Bun's node_modules (#3861)"

This reverts commit c241c6d6d0.  The logic
is faulty: the original strategy of looking for node_modules by asking
the package manager is not incorrect even on bun. Instead, it should
learn a different method of asking the package manager for node_modules
when the *package manager* is bun, not the *runtime*.

* feat(coding-agent): detect bun as package manager and use alternate root query

When `"npmCommand": ["bun"]` is configured in settings.json, pi fails to
start because it invokes `bun root -g`, which doesn't exist:

    error: Failed to run bun root -g: error: Script not found "root"

Add a (simple) check for Bun being used as package manager, and instead
build the relative path starting from Bun's bin directory.
2026-04-30 12:27:50 +02:00
Mario Zechner
cf5ec23240 feat(coding-agent): add provider display names
closes #3956
2026-04-30 00:10:38 +02:00
Mario Zechner
b79e7f8058 fix(coding-agent): support uppercase context files closes #3949 2026-04-29 23:47:04 +02:00
Mario Zechner
d698647b12 feat(coding-agent): add composable editor factory access
closes #3935
2026-04-29 23:26:25 +02:00
Mario Zechner
39146f3296 fix(coding-agent): clear idle follow-up submissions
closes #3926
2026-04-29 23:16:09 +02:00
Armin Ronacher
3edb8b5cb7 fix(agent): support fdfind as fd fallback 2026-04-28 17:52:14 +02:00
Armin Ronacher
c745efc0d0 feat: Update check against pi.dev (#3877) 2026-04-28 12:48:27 +02:00
Justin Barnett
57787b6557 fix(coding-agent): escape exported session metadata (#3883) 2026-04-28 11:46:42 +02:00
Armin Ronacher
9848b3145a fix(coding-agent): fix Windows self-update
Fixes #3857
2026-04-28 10:03:00 +02:00