Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

chore(deps): sync Pi runtime to 1.4.0

vastsab460e75806f4
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index d1b695511..8975aaba0 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -36,8 +36,8 @@
"electron-updater": "^6.8.9"
},
"devDependencies": {
- "@earendil-works/pi-ai": "1.3.0",
- "@earendil-works/pi-mcp": "1.3.0",
+ "@earendil-works/pi-ai": "1.4.0",
+ "@earendil-works/pi-mcp": "1.4.0",
"@pi-desktop/agent-host": "workspace:*",
"@pi-desktop/agent-runtime": "workspace:*",
"@pi-desktop/host-runtime": "workspace:*",
diff --git a/apps/desktop/test/anthropic-oauth-retry.test.mjs b/apps/desktop/test/anthropic-oauth-retry.test.mjs
index 08dad0af6..fa1eb55e7 100644
--- a/apps/desktop/test/anthropic-oauth-retry.test.mjs
+++ b/apps/desktop/test/anthropic-oauth-retry.test.mjs
@@ -144,7 +144,7 @@ test("token requests identify the client instead of inheriting a browser User-Ag
assert.equal((await signIn()).kind, "done");
await oauth.resolveAuth(seed());
assert.deepEqual(requests.map(req => req.body.grant_type), ["authorization_code", "refresh_token"]);
- for (const req of requests) assert.match(req.headers["user-agent"], /^pi \(/);
+ for (const req of requests) assert.match(req.headers["user-agent"], /^pi\/1\.4\.0 \(/);
});
});
diff --git a/docs/project/pi-140-adoption.md b/docs/project/pi-140-adoption.md
new file mode 100644
index 000000000..506821532
--- /dev/null
+++ b/docs/project/pi-140-adoption.md
@@ -0,0 +1,74 @@
+# Pi 1.4.0 adoption
+
+## Scope
+
+Upgrade Agent Runtime's `pi-agent-core`, `pi-ai`, and `pi-coding-agent`, plus
+Desktop's `pi-ai` and `pi-mcp`, to exactly 1.4.0. Keep the Pi release group
+aligned through the lockfile and exact release-age exclusions. No Host protocol,
+database schema, persisted provider endpoint, permission policy, extension
+`VERSION` marker, or storage ownership changes.
+
+Official release notes: [Pi 1.4.0](https://github.com/earendil-works/pi/releases/tag/v1.4.0),
+[pi-ai changelog](https://github.com/earendil-works/pi/blob/v1.4.0/packages/ai/CHANGELOG.md),
+[pi-agent-core changelog](https://github.com/earendil-works/pi/blob/v1.4.0/packages/agent/CHANGELOG.md),
+and [pi-coding-agent changelog](https://github.com/earendil-works/pi/blob/v1.4.0/packages/coding-agent/CHANGELOG.md).
+
+## Compatibility work
+
+- Rebase the three pnpm patches onto the published 1.4.0 package layouts.
+ Preserve hosted-search streaming, replay and estimation; bounded Anthropic
+ OAuth handling; DeepSeek reasoning replay and endpoint-scoped capability;
+ local request errors; and model-aware native session context estimation and
+ image degradation.
+- Adopt the new pi-ai client identity API at the agent boundary. Agent Runtime
+ and subagents explicitly set `attribution: null`, which suppresses the new
+ pi-agent-core default attribution headers while retaining pi-ai's detailed,
+ versioned `User-Agent`.
+- Keep Desktop's native-session and trusted-extension use of `pi-coding-agent`
+ behind their existing compatibility seams. Do not expand the extension shim
+ or change its legacy `VERSION` marker.
+- Native Pi sessions continue to use pi-coding-agent's telemetry preference
+ for its SDK-managed attribution headers. The Desktop-owned main and delegated
+ agent requests explicitly suppress Pi attribution.
+- Keep Desktop-owned endpoint projection, provider retry policy, MCP ownership,
+ context projection, compaction, and session persistence unchanged.
+
+## Explicitly unchanged
+
+- Existing user data needs no migration. No persisted format, RPC, Plugin SDK,
+ or permission contract changes.
+- The Pi 1.4.0 release's model catalog and provider adapter improvements are
+ available through the pinned upstream package. Desktop continues to own its
+ model catalog overlays and endpoint projection.
+- `pi-coding-agent` remains transitional; it is not the normal Desktop agent
+ loop, compaction engine, or durable session store.
+- The Desktop main and delegated agent identity is fixed at runtime and is not
+ persisted with provider/model configuration. Native sessions use the
+ pi-coding-agent SDK's install-telemetry setting for its attribution headers.
+
+## Validation
+
+Validation was run from the dedicated request worktree based on
+`c014b32060ca2dc7ace4c83f181685a6e0140c78` (`origin/main`, 2026-10-28).
+
+- `pnpm build:js`, Desktop typecheck, lint, and `pnpm docs:check` passed.
+- All 111 Agent Runtime test files passed (1,556 tests). The focused 1.4
+ identity/contract/runtime/subagent set passed (426 tests).
+- Pi dependency and patch gates passed; all 7 patch-hash fixture tests passed.
+- Hosted-search E2E passed 10/10 scenarios. Trusted-extension E2E passed 57/57
+ using the existing primary-checkout Electron and debug Host binaries with
+ isolated fixture state. No real provider or live service was used.
+- `pnpm -r --workspace-concurrency=1 --if-present test` completed with 4,550
+ Desktop tests passed, 3 skipped, and one failure. The OAuth assertion passes
+ in the complete run. The unchanged `composer-deep-file-search-user-path`
+ Electron fixture also fails on a detached `origin/main` diagnostic worktree;
+ both runs return no rows, with different final assertions. The test and its
+ renderer search sources are unchanged by this task.
+- Rust checks were not run because no Rust source, persistence, or Host contract
+ changed. The trusted-extension E2E reused the existing debug Host binary.
+
+## Rollback
+
+Roll back the direct manifests, lockfile, exact release-age exclusions, three
+patch files, version gates, identity wiring, tests, and synchronized specs
+together. Never mix a patched 1.3.0 package with the 1.4.0 release group.
diff --git a/docs/spec/02-architecture/02-tech-stack.md b/docs/spec/02-architecture/02-tech-stack.md
index e9c4e2490..e52fd04cd 100644
--- a/docs/spec/02-architecture/02-tech-stack.md
+++ b/docs/spec/02-architecture/02-tech-stack.md
@@ -12,9 +12,9 @@
| Host backend | **Rust** | stable Rust toolchain | tools/plugins/permissions/persistence adapters |
| Rust async | tokio | stable | host services |
| Host RPC | stdio JSON-RPC (NDJSON) | frozen (D001) | Electron main ↔ Rust host |
-| Agent engine | `@earendil-works/pi-agent-core` | 1.3.0 | agent loop |
-| Model API | `@earendil-works/pi-ai` | 1.3.0 | provider adapters, OAuth, and stream handling |
-| Model catalog | models.dev + Pi Providers/Models | bundled models.dev + pinned Pi 1.3.0 | models.dev chat metadata; Pi account IDs, wire capabilities, and typed operations |
+| Agent engine | `@earendil-works/pi-agent-core` | 1.4.0 | agent loop |
+| Model API | `@earendil-works/pi-ai` | 1.4.0 | provider adapters, OAuth, and stream handling |
+| Model catalog | models.dev + Pi Providers/Models | bundled models.dev + pinned Pi 1.4.0 | models.dev chat metadata; Pi account IDs, wire capabilities, and typed operations |
> models.dev owns published chat metadata; pi-ai owns transports and auth.
> Host persists Desktop account rows, credentials, and explicit binding overrides.
diff --git a/docs/spec/02-architecture/06-pi-runtime-dependency-boundary.md b/docs/spec/02-architecture/06-pi-runtime-dependency-boundary.md
index 26645a2f7..5dd1ace7c 100644
--- a/docs/spec/02-architecture/06-pi-runtime-dependency-boundary.md
+++ b/docs/spec/02-architecture/06-pi-runtime-dependency-boundary.md
@@ -9,10 +9,10 @@ boundaries must keep that split clear as upstream packages evolve.
## 2. Current ownership
The sidecar pins `@earendil-works/pi-agent-core`, `pi-ai`, and
-`pi-coding-agent` together at exactly `1.3.0`; Desktop's `pi-ai` and `pi-mcp`
+`pi-coding-agent` together at exactly `1.4.0`; Desktop's `pi-ai` and `pi-mcp`
development dependencies use the same release. Target-release package patches
remain narrow compatibility deltas and are listed with their audited behavior
-in `docs/project/pi-130-adoption.md`.
+in `docs/project/pi-140-adoption.md`.
- `@earendil-works/pi-agent-core` supplies the agent loop and its stable agent,
event, and tool types. Agent Runtime owns desktop-specific compaction,
@@ -20,6 +20,10 @@ in `docs/project/pi-130-adoption.md`.
- `@earendil-works/pi-ai` supplies provider transports, auth, message types,
request retries, and token estimation. Hosted-search request and estimation
behavior remains covered by PI-Desktop's pi-ai patch and contract tests.
+- Agent Runtime and subagents pass an explicit client identity: pi-ai keeps its
+ detailed versioned `User-Agent`, while `attribution: null` suppresses
+ pi-agent-core's default Pi attribution headers for OpenRouter, NVIDIA, and
+ OpenCode requests.
- Rust `host-core` remains the sole owner of SQLite and authoritative durable
session state. The Node sidecar asks it to persist checkpoints and tool
outcomes through the existing RPC contract.
@@ -30,8 +34,11 @@ in `docs/project/pi-130-adoption.md`.
shim from `extensions/loader.ts`. The normal Desktop agent runtime,
host-core checkpoint-compaction path, and durable session store do not use
the package's AgentSession.
+- Native Pi sessions use pi-coding-agent's SDK-managed identity, whose
+ attribution follows that SDK's install-telemetry setting. The Desktop-owned
+ main and delegated Agent paths use the explicit identity above.
-The extension shim is a versioned compatibility subset, not the full 1.3.0
+The extension shim is a versioned compatibility subset, not the full 1.4.0
coding-agent API. Its legacy `VERSION` marker remains sourced from
`TRUSTED_EXTENSION_KERNEL_VERSION` and intentionally identifies the modeled
0.87.1 extension surface.
@@ -96,8 +103,8 @@ Do not move removed `pi-agent-core` APIs there as a shortcut.
persists through host-core.
- Cancellation, provider retry, hosted-search validation, tool ordering, and
extension discovery retain their current behavior.
-- Pi 1.3 drops prior-model thinking from provider replay instead of converting
- it to visible text; same-model DeepSeek reasoning remains intact. Malformed
+- Provider replay drops prior-model thinking instead of converting it to
+ visible text; same-model DeepSeek reasoning remains intact. Malformed
final tool JSON fails validation before Host execution, with raw arguments
returned to the model for correction.
- The removed experimental assistant-frame codec is not restored. Desktop
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 0dc8b9df9..651ef0d22 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -79,6 +79,32 @@
- **Milestone:** Maintenance.
- **Status:** Candidate validation recorded in `docs/project/pi-130-adoption.md`.
+### E2E-PI-140-kernel-upgrade
+
+- **Preconditions:** Exact Pi 1.4.0 release-group pins and migrated package
+ patches in a dedicated worktree, isolated fixture state, and no real provider
+ credentials.
+- **Steps:** Submit a Desktop prompt through the runtime with a local model
+ fixture and capture the provider request identity. Repeat through a delegated
+ subagent. Exercise OpenRouter, NVIDIA, and OpenCode identity-header mapping
+ with pure request fixtures. Run the existing hosted-search, native Pi session,
+ and trusted-extension offline suites against the installed 1.4.0 packages.
+- **Expected:** Parent and delegated requests retain pi-ai's detailed,
+ versioned `User-Agent` while suppressing pi-agent-core's default Pi
+ attribution headers. Existing hosted-search replay and validation, provider
+ request errors, native-session context estimates, tool validation, extension
+ compatibility, retry and cancellation behavior remain intact. No provider
+ credentials or live services are used.
+- **Coverage:** `pi-upstream-1.4-identity.test.ts`,
+ `pi-upstream-1.4-contract.test.ts`, `pi-1.4-adapter-features.test.ts`,
+ `runtime.test.ts`, `subagent.test.ts`, plus the existing
+ `test:e2e:hosted-search` and `test:e2e:trusted-extensions` commands.
+- **Specs:** [Pi dependency boundary](../02-architecture/06-pi-runtime-dependency-boundary.md),
+ [trusted extensions](../07-plugins/16-trusted-extensions.md).
+- **Acceptance:** Offline runtime/contract and isolated process validation.
+- **Milestone:** Maintenance.
+- **Status:** Candidate validation recorded in `docs/project/pi-140-adoption.md`.
+
### E2E-QUEUE-send-now-wakes-subagents
- **Preconditions:** Dedicated request worktree with built workspace packages,
@@ -10654,6 +10680,7 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.
| Quality (project ordering) | E2E-253 |
| Quality (work-panel tab close visibility) | E2E-WORK-PANEL-active-tab-close-visibility |
| C / E / G / Quality — Pi kernel upgrade | E2E-PI-130-kernel-upgrade |
+| C / E / G / Quality — Pi kernel upgrade | E2E-PI-140-kernel-upgrade |
| C — Conversation & stream (IME slash alias) | E2E-255 |
| E — Tools & permissions (Skill residency) | E2E-254 |
| Quality (Skill residency and IME slash alias) | E2E-254, E2E-255 |
diff --git a/docs/zh-CN/spec/02-architecture/02-tech-stack.md b/docs/zh-CN/spec/02-architecture/02-tech-stack.md
index 388f0ff2a..7dc6e7af8 100644
--- a/docs/zh-CN/spec/02-architecture/02-tech-stack.md
+++ b/docs/zh-CN/spec/02-architecture/02-tech-stack.md
@@ -15,9 +15,9 @@
| 主机后端 | **Rust** | 稳定的 Rust 工具链 | tools/plugins/permissions/persistence 适配器 |
| Rust 异步 | 东京 | 稳定 | 主机服务 |
| 主机 RPC | stdio JSON-RPC (NDJSON) | 冷冻(D001) | Electron 主 ↔ Rust 主机 |
-| Agent engine | `@earendil-works/pi-agent-core` | 1.3.0 | agent loop |
-| Model API | `@earendil-works/pi-ai` | 1.3.0 | provider adapters, OAuth, and stream handling |
-| Model catalog | models.dev + Pi Providers/Models | bundled models.dev + pinned Pi 1.3.0 | models.dev chat metadata; Pi account IDs, wire capabilities, and typed operations |
+| Agent engine | `@earendil-works/pi-agent-core` | 1.4.0 | agent loop |
+| Model API | `@earendil-works/pi-ai` | 1.4.0 | provider adapters, OAuth, and stream handling |
+| Model catalog | models.dev + Pi Providers/Models | bundled models.dev + pinned Pi 1.4.0 | models.dev chat metadata; Pi account IDs, wire capabilities, and typed operations |
> models.dev owns published chat metadata; pi-ai owns transports and auth.
> Host 持有 Desktop 账户行、凭据和显式绑定覆盖。
diff --git a/docs/zh-CN/spec/02-architecture/06-pi-runtime-dependency-boundary.md b/docs/zh-CN/spec/02-architecture/06-pi-runtime-dependency-boundary.md
index 006c7af22..072b30f31 100644
--- a/docs/zh-CN/spec/02-architecture/06-pi-runtime-dependency-boundary.md
+++ b/docs/zh-CN/spec/02-architecture/06-pi-runtime-dependency-boundary.md
@@ -9,16 +9,24 @@ JavaScript 包。上游包演进时,必须保持这一职责划分清晰。
## 2. 当前职责
+Sidecar 将 `@earendil-works/pi-agent-core`、`pi-ai` 与 `pi-coding-agent` 精确固定在
+`1.4.0`;Desktop 的 `pi-ai` 和 `pi-mcp` 开发依赖也使用同一版本。补丁行为与迁移
+记录见 `docs/project/pi-140-adoption.md`。
+
- `@earendil-works/pi-agent-core` 提供 Agent 循环,以及稳定的 agent、event、tool
类型。Agent Runtime 自行维护桌面专用的上下文投影、压缩和 prompt 模板展开。
- `@earendil-works/pi-ai` 提供提供商传输、认证、消息类型、请求重试和 token 估算。
Hosted search 请求与估算行为继续由 PI-Desktop 的 pi-ai 补丁和契约测试覆盖。
+- Agent Runtime 和 subagent 显式传入客户端身份:保留 pi-ai 的详细版本化
+ `User-Agent`,并以 `attribution: null` 关闭 pi-agent-core 默认的 Pi 归属请求头。
- Rust `host-core` 仍然是 SQLite 和权威持久会话状态的唯一所有者。Node sidecar
通过现有 RPC 契约请求持久化检查点和工具结果。
- `@earendil-works/pi-coding-agent` 是过渡期依赖。生产代码仅在原生 Pi 会话续接及
其 session-file manager 中使用;该路径仍使用包内 `AgentSession` 和原生会话行为。
可信扩展由 `extensions/loader.ts` 提供小型兼容 shim。Desktop 常规 Agent 运行时、
host-core 检查点压缩路径和持久会话存储不使用其 `AgentSession`。
+- 原生 Pi 会话使用 pi-coding-agent 的 SDK 身份,其归属请求头遵循该 SDK 的安装遥测设置。
+ Desktop 自有的主 Agent 和委派 Agent 使用上文的显式身份。
不要重新引入已移除的 pi-agent-core harness、session、compaction 或 prompt-template
API。桌面行为留在 `agent-runtime` 边界内;提供商操作使用 pi-ai 的公开 API。
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 073025276..55aaf7d5a 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -22,6 +22,21 @@
authoritative. See the English source and `docs/project/pi-130-adoption.md`
for exact coverage and candidate validation.
+### E2E-PI-140-kernel-upgrade
+
+- **前提:** 在专属 worktree 中精确固定 Pi 1.4.0 release group 并迁移包补丁,使用隔离
+ fixture 状态,不提供真实 Provider 凭据。
+- **步骤:** 通过本地模型 fixture 发起 Desktop prompt 并捕获 Provider 请求身份;再通过
+ subagent 重复。用纯请求 fixture 覆盖 OpenRouter、NVIDIA 和 OpenCode 身份请求头映射。
+ 在已安装的 1.4.0 包上运行现有 hosted-search、原生 Pi 会话和可信扩展离线套件。
+- **预期:** 主 Agent 和 subagent 请求保留 pi-ai 详细版本化的 `User-Agent`,并关闭
+ pi-agent-core 默认 Pi 归属请求头。Hosted-search 重放与校验、Provider 请求错误、原生会话
+ 上下文估算、工具校验、扩展兼容、重试和取消行为保持不变。不使用 Provider 凭据或线上服务。
+- **覆盖:** `pi-upstream-1.4-identity.test.ts`、`pi-upstream-1.4-contract.test.ts`、
+ `pi-1.4-adapter-features.test.ts`、`runtime.test.ts`、`subagent.test.ts`,以及现有
+ `test:e2e:hosted-search` 和 `test:e2e:trusted-extensions` 命令。具体范围与候选验证记录见英文源及
+ `docs/project/pi-140-adoption.md`。
+
### E2E-LEGACY-DICTATION-idle-model-release
- **前提:** 通过 `VoiceService` 接口测试保留的本地 Dictation 服务,使用确定性的
@@ -5946,6 +5961,7 @@ eleven-tool-round desktop paths are verified by
| 品质(项目排序) | E2E-253 |
| 品质(工作面板标签关闭按钮可见性) | E2E-WORK-PANEL-active-tab-close-visibility |
| C / E / G / Quality — Pi kernel upgrade | E2E-PI-130-kernel-upgrade |
+| C / E / G / Quality — Pi kernel upgrade | E2E-PI-140-kernel-upgrade |
| C — 对话和直播(输入法斜杠别名) | E2E-255 |
| E——工具和权限(Skill 常驻) | E2E-254 |
| 品质(Skill 常驻与输入法斜杠别名) | E2E-254、E2E-255 |
diff --git a/packages/agent-runtime/package.json b/packages/agent-runtime/package.json
index ad8d90422..cd7bbdc6e 100644
--- a/packages/agent-runtime/package.json
+++ b/packages/agent-runtime/package.json
@@ -31,9 +31,9 @@
"clean": "node -e \"fs.rmSync('dist',{recursive:true,force:true});fs.rmSync('dist-bundle',{recursive:true,force:true})\""
},
"dependencies": {
- "@earendil-works/pi-agent-core": "1.3.0",
- "@earendil-works/pi-ai": "1.3.0",
- "@earendil-works/pi-coding-agent": "1.3.0",
+ "@earendil-works/pi-agent-core": "1.4.0",
+ "@earendil-works/pi-ai": "1.4.0",
+ "@earendil-works/pi-coding-agent": "1.4.0",
"@pi-desktop/shared": "workspace:*",
"jiti": "2.7.0",
"typebox": "1.3.27",
diff --git a/packages/agent-runtime/src/agent-identity.ts b/packages/agent-runtime/src/agent-identity.ts
new file mode 100644
index 000000000..f4ea5ba89
--- /dev/null
+++ b/packages/agent-runtime/src/agent-identity.ts
@@ -0,0 +1,4 @@
+import type { ClientIdentity } from "@earendil-works/pi-ai";
+
+/** Preserve pi-ai's detailed User-Agent without opting requests into pi attribution headers. */
+export const DESKTOP_AGENT_IDENTITY: ClientIdentity = { attribution: null };
diff --git a/packages/agent-runtime/src/native-pi-session.test.ts b/packages/agent-runtime/src/native-pi-session.test.ts
index d8e0add27..91425cfff 100644
--- a/packages/agent-runtime/src/native-pi-session.test.ts
+++ b/packages/agent-runtime/src/native-pi-session.test.ts
@@ -3,7 +3,7 @@ import { tmpdir } from "node:os";
import { basename, join } from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { AgentSession, ModelRuntime, SessionManager, SettingsManager } from "@earendil-works/pi-coding-agent";
-import { createAssistantMessageEventStream, Type, type AssistantMessage } from "@earendil-works/pi-ai";
+import { createAssistantMessageEventStream, PI_ATTRIBUTION, Type, type AssistantMessage } from "@earendil-works/pi-ai";
import { NativePiSessionService } from "./native-pi-session.js";
import {
acquireNativePiSessionLease,
@@ -504,6 +504,33 @@ function fauxModelRuntime() {
}
describe("native continuation review regressions", () => {
+ it.each([true, false])("uses the native SDK telemetry preference for 1.4 attribution (%s)", async (enabled) => {
+ const f = await configuredFixture();
+ const settingsPath = join(f.agentDir, "settings.json");
+ const settings = JSON.parse(readFileSync(settingsPath, "utf8")) as Record<string, unknown>;
+ writeFileSync(settingsPath, JSON.stringify({ ...settings, enableInstallTelemetry: enabled }));
+ const identities: unknown[] = [];
+ vi.spyOn(ModelRuntime.prototype, "streamSimple").mockImplementation((_model, _context, options) => {
+ identities.push(options?.identity);
+ return fauxStream();
+ });
+ const service = new NativePiSessionService(f);
+ try {
+ const [summary] = await service.list();
+ expect(summary.capabilities?.canPrompt).toBe(true);
+ await service.prompt(summary.id, "check native client identity", () => {});
+ await expect.poll(() => identities).toHaveLength(1);
+ expect(identities).toHaveLength(1);
+ expect(identities[0]).toMatchObject({
+ userAgent: "detailed",
+ version: "1.4.0",
+ attribution: enabled ? PI_ATTRIBUTION : null,
+ });
+ } finally {
+ service.disposeAll();
+ }
+ });
+
it("uses the real offline credential/catalog and reports missing exact auth/model", async () => {
const f = await configuredFixture();
const service = new NativePiSessionService({ agentDir: f.agentDir, sessionRoot: f.sessionRoot });
diff --git a/packages/agent-runtime/src/pi-1.3-adapter-features.test.ts b/packages/agent-runtime/src/pi-1.4-adapter-features.test.ts
similarity index 99%
rename from packages/agent-runtime/src/pi-1.3-adapter-features.test.ts
rename to packages/agent-runtime/src/pi-1.4-adapter-features.test.ts
index e72d96237..54771f1da 100644
--- a/packages/agent-runtime/src/pi-1.3-adapter-features.test.ts
+++ b/packages/agent-runtime/src/pi-1.4-adapter-features.test.ts
@@ -50,7 +50,7 @@ const usage: AssistantMessage["usage"] = {
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
};
-describe("Pi 1.3 adapters through Desktop provider binding", () => {
+describe("Pi 1.4 adapters through Desktop provider binding", () => {
it.each(["claude-haiku-5-5", "claude-opus-5"] as const)("disables thinking without effort markers while preserving hosted search: %s", async (id) => {
const payload = await anthropicRequest(anthropic(id), [{ role: "user", content: "Hello", timestamp: 1 }]);
expect(payload.thinking).toEqual({ type: "disabled" });
diff --git a/packages/agent-runtime/src/pi-upstream-1.3-contract.test.ts b/packages/agent-runtime/src/pi-upstream-1.4-contract.test.ts
similarity index 96%
rename from packages/agent-runtime/src/pi-upstream-1.3-contract.test.ts
rename to packages/agent-runtime/src/pi-upstream-1.4-contract.test.ts
index 60d59f1c4..8e7594c8d 100644
--- a/packages/agent-runtime/src/pi-upstream-1.3-contract.test.ts
+++ b/packages/agent-runtime/src/pi-upstream-1.4-contract.test.ts
@@ -26,7 +26,7 @@ function fixture() {
const executions: unknown[] = [];
const requests: Request[] = [];
const runtime = new DesktopAgentRuntime({
- sessionId: "pi-1.3-fixture", mode: "agent", thinkingLevel: "off",
+ sessionId: "pi-1.4-fixture", mode: "agent", thinkingLevel: "off",
commandShell: { id: "bash", label: "Bash", dialect: "posix", available: true, isDefault: true },
provider: {
id: "fixture", name: "Fixture", modelId: "fixture", apiKey: "fixture",
@@ -57,7 +57,7 @@ function fixture() {
return { runtime, executions, requests, respond, agent };
}
-describe("Pi 1.3 tool-call contracts through Desktop", () => {
+describe("Pi 1.4 tool-call contracts through Desktop", () => {
it("rejects malformed final JSON before Host execution and accepts a corrected call", async () => {
const { runtime, executions, requests, respond, agent } = fixture();
const malformed = '{"path":"wrong.txt","content":"partial",';
diff --git a/packages/agent-runtime/src/pi-upstream-1.4-identity.test.ts b/packages/agent-runtime/src/pi-upstream-1.4-identity.test.ts
new file mode 100644
index 000000000..4e334116a
--- /dev/null
+++ b/packages/agent-runtime/src/pi-upstream-1.4-identity.test.ts
@@ -0,0 +1,29 @@
+import {
+ formatUserAgent,
+ getIdentityHeaders,
+ mergeClientIdentity,
+ PI_ATTRIBUTION,
+} from "@earendil-works/pi-ai";
+import { describe, expect, it } from "vitest";
+import { DESKTOP_AGENT_IDENTITY } from "./agent-identity.js";
+
+describe("Pi 1.4 client identity", () => {
+ it("clears agent-core attribution while retaining pi-ai's detailed User-Agent", () => {
+ const identity = mergeClientIdentity(
+ { attribution: PI_ATTRIBUTION },
+ DESKTOP_AGENT_IDENTITY,
+ );
+
+ expect(identity?.attribution).toBeNull();
+ expect(formatUserAgent(identity)).toMatch(/^pi\/1\.4\.0 \(/);
+ for (const target of [
+ { provider: "openrouter", baseUrl: "https://openrouter.ai/api/v1" },
+ { provider: "nvidia", baseUrl: "https://integrate.api.nvidia.com/v1" },
+ { provider: "opencode", baseUrl: "https://opencode.ai/zen/v1" },
+ ]) {
+ expect(getIdentityHeaders(target, identity)).toEqual({
+ "User-Agent": formatUserAgent(identity),
+ });
+ }
+ });
+});
diff --git a/packages/agent-runtime/src/runtime.test.ts b/packages/agent-runtime/src/runtime.test.ts
index 9913c6f14..1142fdc78 100644
--- a/packages/agent-runtime/src/runtime.test.ts
+++ b/packages/agent-runtime/src/runtime.test.ts
@@ -40,6 +40,7 @@ import {
import { getGlobalDispatcher } from "undici";
import { describeProviderFetchFailure } from "./provider-transport-recovery.js";
import { resolveBatchExecutionMode } from "./tool-execution-policy.js";
+import { DESKTOP_AGENT_IDENTITY } from "./agent-identity.js";
/**
* The delegate loop itself is covered in `subagent.test.ts`; here only the
* `Task` wiring around it is under test, so `SubagentRun` is replaced by a
@@ -232,6 +233,42 @@ function runtimeTool(runtime: DesktopAgentRuntime, name: string): AgentTool {
return tool;
}
+describe("Pi 1.4 client identity", () => {
+ it("forwards the desktop identity through a user prompt to the provider adapter", async () => {
+ const runtime = createRuntime();
+ const internal = runtime as unknown as {
+ models: {
+ streamSimple: (
+ model: unknown,
+ context: { messages: AgentMessage[] },
+ options?: { identity?: unknown },
+ ) => ReturnType<typeof createAssistantMessageEventStream>;
+ };
+ };
+ const identities: unknown[] = [];
+ internal.models = {
+ streamSimple: (_model, _context, options) => {
+ identities.push(options?.identity);
+ const message = assistantMessage({ content: [{ type: "text", text: "Ready." }] }) as AssistantMessage;
+ const stream = createAssistantMessageEventStream();
+ queueMicrotask(() => {
+ stream.push({ type: "start", partial: message });
+ stream.push({ type: "done", reason: "stop", message });
+ stream.end(message);
+ });
+ return stream;
+ },
+ };
+
+ try {
+ await runtime.prompt("Say ready.", "identity-user", "identity-turn");
+ expect(identities).toEqual([DESKTOP_AGENT_IDENTITY]);
+ } finally {
+ await runtime.dispose();
+ }
+ });
+});
+
describe("ordered read preparation", () => {
it.each([
["Bash", false], ["Write", false], ["Edit", false], ["Bash", true],
diff --git a/packages/agent-runtime/src/runtime.ts b/packages/agent-runtime/src/runtime.ts
index 7b3963337..ae09668be 100644
--- a/packages/agent-runtime/src/runtime.ts
+++ b/packages/agent-runtime/src/runtime.ts
@@ -3,6 +3,7 @@ import {
RECOVERABLE_MUTATION_ERROR_CODES, mutationFailureKey, isPatchCommand,
mutationTerminationAdvice, mutationTerminationMessage,
} from "./mutation-recovery.js";
+import { DESKTOP_AGENT_IDENTITY } from "./agent-identity.js";
import { resolveMcpToolSelection } from "./mcp-tool-selection.js";
import { toolExecutionMode, withDynamicTaskExecutionMode } from "./tool-execution-policy.js";
import { AsyncLocalStorage } from "node:async_hooks";
@@ -2205,6 +2206,7 @@ Do not invent objections or turn speculative risks into blockers. Stop when the
this.restoreDeferredToolsFromContext();
const tools = this.declaredTools();
this.agent = new Agent({
+ identity: DESKTOP_AGENT_IDENTITY,
streamFn: (m, context, options) => {
this.setAgentActivity({ phase: "waiting-model", since: Date.now() });
this.providerResponseStatus = undefined;
diff --git a/packages/agent-runtime/src/subagent.test.ts b/packages/agent-runtime/src/subagent.test.ts
index 1f414d152..e5bca748a 100644
--- a/packages/agent-runtime/src/subagent.test.ts
+++ b/packages/agent-runtime/src/subagent.test.ts
@@ -15,6 +15,7 @@ import {
} from "./subagent.js";
import type { RuntimeProviderConfig } from "./provider-binding.js";
import { classifyAgentError } from "./agent-errors.js";
+import { DESKTOP_AGENT_IDENTITY } from "./agent-identity.js";
import {
PROVIDER_RATE_LIMIT_MAX_RETRIES,
PROVIDER_TRANSIENT_MAX_RETRIES,
@@ -29,6 +30,11 @@ const RUN_STATUSES: SubagentRunStatus[] = [
];
describe("delegate execution policy", () => {
+ it("keeps the upstream pi attribution disabled for delegated model requests", () => {
+ const { run } = createRun();
+ expect(run.agent.identity).toEqual(DESKTOP_AGENT_IDENTITY);
+ });
+
it("preserves sequential policy for a same-name dynamic Read", () => {
const { run } = createRun({ tools: [{
name: "Read", label: "extension", description: "dynamic", parameters: Type.Object({}),
diff --git a/packages/agent-runtime/src/subagent.ts b/packages/agent-runtime/src/subagent.ts
index 32e308706..ea13c27ae 100644
--- a/packages/agent-runtime/src/subagent.ts
+++ b/packages/agent-runtime/src/subagent.ts
@@ -23,6 +23,7 @@ import { mkdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { randomUUID } from "node:crypto";
import { toolExecutionMode, withDynamicTaskExecutionMode } from "./tool-execution-policy.js";
+import { DESKTOP_AGENT_IDENTITY } from "./agent-identity.js";
import { initialSystemTranscript, replaceSystemPrompt } from "./system-transcript.js";
import {
Agent,
@@ -290,6 +291,7 @@ export class SubagentRun {
this.attemptedModels.add(`${opts.provider.id}/${opts.provider.modelId}`);
const binding = this.modelBinding();
this.agent = new Agent({
+ identity: DESKTOP_AGENT_IDENTITY,
streamFn: binding.streamFn,
getApiKey: binding.getApiKey,
convertToLlm: (messages) =>
diff --git a/patches/@[email protected] b/patches/@[email protected]
similarity index 85%
rename from patches/@[email protected]
rename to patches/@[email protected]
index 9bd2bd925..4461dc256 100644
--- a/patches/@[email protected]
+++ b/patches/@[email protected]
@@ -1,8 +1,8 @@
diff --git a/dist/agent-loop.js b/dist/agent-loop.js
-index 77af96018..b2faa02b9 100644
+index 48f56a252dacdc19f55df9d97bc034932dce21a4..c833c36ffa4f43a48c41ee13277680af44bcd9b6 100644
--- a/dist/agent-loop.js
+++ b/dist/agent-loop.js
-@@ -294,6 +294,12 @@ async function streamAssistantResponse(context, config, signal, emit, streamFunc
+@@ -300,6 +300,12 @@ async function streamAssistantResponse(context, config, signal, emit, streamFunc
case "toolcall_start":
case "toolcall_delta":
case "toolcall_end":
@@ -16,7 +16,7 @@ index 77af96018..b2faa02b9 100644
partialMessage = event.partial;
context.messages[context.messages.length - 1] = partialMessage;
diff --git a/dist/agent.js b/dist/agent.js
-index a8ccfc0bd..0f98e4736 100644
+index e34d91afe7aa539ffff9f886352b02f23a1a51ea..ca4de6b800ea7f1b69a20f72ac852bffbdb32600 100644
--- a/dist/agent.js
+++ b/dist/agent.js
@@ -1,3 +1,4 @@
@@ -24,7 +24,7 @@ index a8ccfc0bd..0f98e4736 100644
import { createInitialSystemMessage, getCurrentSystemMessage, getCurrentSystemPrompt, toToolDeclaration, } from "@earendil-works/pi-ai";
import { runAgentLoop, runAgentLoopContinue } from "./agent-loop.js";
import { getDefaultStreamFn } from "./stream-fn.js";
-@@ -362,6 +363,7 @@ export class Agent {
+@@ -366,6 +367,7 @@ export class Agent {
}
}
async handleRunFailure(error, aborted) {
@@ -32,7 +32,7 @@ index a8ccfc0bd..0f98e4736 100644
const failureMessage = {
role: "assistant",
content: [{ type: "text", text: "" }],
-@@ -370,7 +372,8 @@ export class Agent {
+@@ -374,7 +376,8 @@ export class Agent {
model: this._state.model.id,
usage: EMPTY_USAGE,
stopReason: aborted ? "aborted" : "error",
diff --git a/patches/@[email protected] b/patches/@[email protected]
similarity index 93%
rename from patches/@[email protected]
rename to patches/@[email protected]
index a0c855cde..a809c7937 100644
--- a/patches/@[email protected]
+++ b/patches/@[email protected]
@@ -1,5 +1,5 @@
diff --git a/dist/api/anthropic-messages.js b/dist/api/anthropic-messages.js
-index befb18b2e..ae082a9bb 100644
+index 841da8964d2b403c45a18d4d1735c1fabc441a9a..02f20bdcd2c1d294754ca05579f5627094f309a3 100644
--- a/dist/api/anthropic-messages.js
+++ b/dist/api/anthropic-messages.js
@@ -1,3 +1,6 @@
@@ -9,7 +9,7 @@ index befb18b2e..ae082a9bb 100644
import Anthropic, {} from "@anthropic-ai/sdk";
import { ANTHROPIC_FEDERATION_RULE_ID_ENV, ANTHROPIC_IDENTITY_TOKEN_FILE_ENV, ANTHROPIC_ORGANIZATION_ID_ENV, ANTHROPIC_SERVICE_ACCOUNT_ID_ENV, ANTHROPIC_WORKSPACE_ID_ENV, } from "../env-api-keys.js";
import { calculateCost } from "../models.js";
-@@ -378,8 +381,6 @@ async function* iterateAnthropicEvents(response, signal) {
+@@ -375,8 +378,6 @@ async function* iterateAnthropicEvents(response, signal) {
}
export const stream = (model, context, options) => {
const stream = new AssistantMessageEventStream();
@@ -18,7 +18,7 @@ index befb18b2e..ae082a9bb 100644
(async () => {
const output = {
role: "assistant",
-@@ -398,7 +399,11 @@ export const stream = (model, context, options) => {
+@@ -395,7 +396,11 @@ export const stream = (model, context, options) => {
stopReason: "pending",
timestamp: Date.now(),
};
@@ -30,7 +30,7 @@ index befb18b2e..ae082a9bb 100644
let client;
let isOAuth;
let usageModel = model;
-@@ -434,6 +439,7 @@ export const stream = (model, context, options) => {
+@@ -431,6 +436,7 @@ export const stream = (model, context, options) => {
let disablePreferredStrictTools = false;
let response;
for (;;) {
@@ -38,7 +38,7 @@ index befb18b2e..ae082a9bb 100644
options?.signal?.throwIfAborted();
const built = buildParams(model, normalizedContext, isOAuth, options, disablePreferredStrictTools);
if (built.providerThinkingLevel)
-@@ -443,6 +449,8 @@ export const stream = (model, context, options) => {
+@@ -440,6 +446,8 @@ export const stream = (model, context, options) => {
if (nextParams !== undefined) {
params = { ...nextParams, stream: true };
}
@@ -47,7 +47,7 @@ index befb18b2e..ae082a9bb 100644
try {
response = await retryProviderRequest(() => client.beta.messages.create(params, requestOptions).asResponse(), {
maxRetries: options?.maxRetries,
-@@ -555,17 +563,50 @@ export const stream = (model, context, options) => {
+@@ -552,17 +560,50 @@ export const stream = (model, context, options) => {
output.content.push(block);
stream.push({ type: "toolcall_start", contentIndex: output.content.length - 1, partial: output });
}
@@ -100,7 +100,7 @@ index befb18b2e..ae082a9bb 100644
partial: output,
});
}
-@@ -574,11 +615,11 @@ export const stream = (model, context, options) => {
+@@ -571,11 +612,11 @@ export const stream = (model, context, options) => {
const index = blocks.findIndex((b) => b.index === event.index);
const block = blocks[index];
if (block && block.type === "thinking") {
@@ -114,7 +114,7 @@ index befb18b2e..ae082a9bb 100644
partial: output,
});
}
-@@ -587,12 +628,24 @@ export const stream = (model, context, options) => {
+@@ -584,12 +625,24 @@ export const stream = (model, context, options) => {
const index = blocks.findIndex((b) => b.index === event.index);
const block = blocks[index];
if (block && block.type === "toolCall") {
@@ -141,7 +141,7 @@ index befb18b2e..ae082a9bb 100644
partial: output,
});
}
-@@ -602,7 +655,19 @@ export const stream = (model, context, options) => {
+@@ -599,7 +652,19 @@ export const stream = (model, context, options) => {
const block = blocks[index];
if (block && block.type === "thinking") {
block.thinkingSignature = block.thinkingSignature || "";
@@ -162,7 +162,7 @@ index befb18b2e..ae082a9bb 100644
}
}
}
-@@ -639,6 +704,12 @@ export const stream = (model, context, options) => {
+@@ -636,6 +701,12 @@ export const stream = (model, context, options) => {
partial: output,
});
}
@@ -175,7 +175,7 @@ index befb18b2e..ae082a9bb 100644
}
}
else if (event.type === "message_delta") {
-@@ -711,13 +782,18 @@ export const stream = (model, context, options) => {
+@@ -708,13 +779,18 @@ export const stream = (model, context, options) => {
stream.end();
}
catch (error) {
@@ -195,7 +195,7 @@ index befb18b2e..ae082a9bb 100644
stream.push({ type: "error", reason: output.stopReason, error: output });
stream.end();
}
-@@ -745,7 +821,7 @@ function mapThinkingLevelToEffort(model, level) {
+@@ -742,7 +818,7 @@ function mapThinkingLevelToEffort(model, level) {
return "high";
}
}
@@ -204,7 +204,7 @@ index befb18b2e..ae082a9bb 100644
if (!getAnthropicFederation(model, options?.apiKey, options?.headers, options?.env)) {
assertRequestAuth(model.provider, options?.apiKey, options?.headers);
}
-@@ -779,7 +855,7 @@ export const streamSimple = (model, context, options) => {
+@@ -776,7 +852,7 @@ export const streamSimple = (model, context, options) => {
thinkingEnabled: true,
thinkingBudgetTokens: Math.min(adjusted.thinkingBudget, Math.max(0, maxTokens - 1024)),
});
@@ -213,7 +213,7 @@ index befb18b2e..ae082a9bb 100644
function isOAuthToken(apiKey) {
return apiKey.includes("sk-ant-oat");
}
-@@ -975,6 +1051,15 @@ function buildParams(model, context, isOAuthToken, options, disablePreferredStri
+@@ -972,6 +1048,15 @@ function buildParams(model, context, isOAuthToken, options, disablePreferredStri
params.tools = convertToolDefinitions(tools, toolCacheControl);
}
}
@@ -229,7 +229,7 @@ index befb18b2e..ae082a9bb 100644
if (thinkingDisabled) {
// No effort is sent, so the model default applies. Anthropic rejects `block_binding`
// with disabled thinking.
-@@ -1176,6 +1261,15 @@ convertToolDefinitions) {
+@@ -1173,6 +1258,15 @@ convertToolDefinitions) {
input: block.arguments ?? {},
});
}
@@ -246,7 +246,7 @@ index befb18b2e..ae082a9bb 100644
if (blocks.length === 0)
continue;
diff --git a/dist/api/azure-openai-responses.js b/dist/api/azure-openai-responses.js
-index 4615b1e50..66929eeaf 100644
+index c88f27ee93a6f267f6abf9f69b13d0ad2303c8b2..e557d917026f8c315f56a95ce03bd1975c2e18a9 100644
--- a/dist/api/azure-openai-responses.js
+++ b/dist/api/azure-openai-responses.js
@@ -1,3 +1,5 @@
@@ -322,9 +322,9 @@ index 4615b1e50..66929eeaf 100644
-};
+});
function createClient(model, apiKey, options) {
- const headers = { "User-Agent": getPiUserAgent(), ...model.headers };
+ const headers = { ...getIdentityHeaders(model, options?.identity), ...model.headers };
if (options?.headers) {
-@@ -163,6 +173,10 @@ function buildParams(model, context, options, deploymentName, grammarToolInputPr
+@@ -167,6 +177,10 @@ function buildParams(model, context, options, deploymentName, grammarToolInputPr
supportsOpenAIGrammarTools: model.compat?.supportsOpenAIGrammarTools ?? false,
});
}
@@ -335,7 +335,7 @@ index 4615b1e50..66929eeaf 100644
if (options?.toolChoice !== undefined) {
params.tool_choice = options.toolChoice;
}
-@@ -184,6 +198,10 @@ function buildParams(model, context, options, deploymentName, grammarToolInputPr
+@@ -188,6 +202,10 @@ function buildParams(model, context, options, deploymentName, grammarToolInputPr
};
}
}
@@ -347,7 +347,7 @@ index 4615b1e50..66929eeaf 100644
const samplingParams = resolveSamplingParams(model, reasoningEffort ?? "off", options?.samplingParams);
if (samplingParams) {
diff --git a/dist/api/mistral-conversations.js b/dist/api/mistral-conversations.js
-index 9038a1c49..afbc300a2 100644
+index 193e8e42a40402a33d208e1f9c18e7cff893ce47..53af5c2911b253144c3b9391e95c324d4fb47404 100644
--- a/dist/api/mistral-conversations.js
+++ b/dist/api/mistral-conversations.js
@@ -674,6 +674,9 @@ function toChatMessages(messages, supportsImages) {
@@ -361,10 +361,10 @@ index 9038a1c49..afbc300a2 100644
id: block.id,
type: "function",
diff --git a/dist/api/openai-codex-responses.js b/dist/api/openai-codex-responses.js
-index 42aac9d5f..6001ce47a 100644
+index 45bcd08b85b478f0f96006881d489820f1264d2c..24d06138833cd9cad81bb519ce5dc58481be7fda 100644
--- a/dist/api/openai-codex-responses.js
+++ b/dist/api/openai-codex-responses.js
-@@ -412,6 +412,12 @@ function buildRequestBody(model, context, options, cacheSessionId, grammarToolIn
+@@ -418,6 +418,12 @@ function buildRequestBody(model, context, options, cacheSessionId, grammarToolIn
supportsOpenAIGrammarTools,
});
}
@@ -378,10 +378,10 @@ index 42aac9d5f..6001ce47a 100644
const effort = options.reasoningEffort === "none"
? model.thinkingLevelMap?.off === undefined
diff --git a/dist/api/openai-completions.js b/dist/api/openai-completions.js
-index 0eeaffa96..a67f425af 100644
+index 793ed0a6060e5d2e61b09e2d93514610527873df..78c6a829151d8bb57357d9a379997da4a5f03fbd 100644
--- a/dist/api/openai-completions.js
+++ b/dist/api/openai-completions.js
-@@ -1046,21 +1046,27 @@ export function convertMessages(model, context, compat, options) {
+@@ -1052,21 +1052,27 @@ export function convertMessages(model, context, compat, options) {
if (preservedReasoningDetails) {
assistantMsg.reasoning_details = preservedReasoningDetails;
}
@@ -415,7 +415,7 @@ index 0eeaffa96..a67f425af 100644
}
params.push(assistantMsg);
}
-@@ -1128,6 +1134,49 @@ export function convertMessages(model, context, compat, options) {
+@@ -1134,6 +1140,49 @@ export function convertMessages(model, context, compat, options) {
}
lastRole = msg.role;
}
@@ -465,7 +465,7 @@ index 0eeaffa96..a67f425af 100644
return params;
}
function convertTools(tools, compat) {
-@@ -1272,6 +1321,9 @@ function detectCompat(model) {
+@@ -1278,6 +1327,9 @@ function detectCompat(model) {
requiresAssistantAfterToolResult: false,
requiresThinkingAsText: false,
requiresReasoningContentOnAssistantMessages: isDeepSeek,
@@ -475,7 +475,7 @@ index 0eeaffa96..a67f425af 100644
thinkingFormat: isDeepSeek
? "deepseek"
: isZai
-@@ -1325,6 +1377,8 @@ function getCompat(model) {
+@@ -1331,6 +1383,8 @@ function getCompat(model) {
requiresThinkingAsText: model.compat.requiresThinkingAsText ?? detected.requiresThinkingAsText,
requiresReasoningContentOnAssistantMessages: model.compat.requiresReasoningContentOnAssistantMessages ??
detected.requiresReasoningContentOnAssistantMessages,
@@ -485,7 +485,7 @@ index 0eeaffa96..a67f425af 100644
openRouterRouting: model.compat.openRouterRouting ?? {},
vercelGatewayRouting: model.compat.vercelGatewayRouting ?? detected.vercelGatewayRouting,
diff --git a/dist/api/openai-responses-shared.js b/dist/api/openai-responses-shared.js
-index af5f04228..634579049 100644
+index b7b27ca98c8f4069a806a01913632a2d9200379c..da6ba8ba9abc8e897c9a72383038448ff0ca7f37 100644
--- a/dist/api/openai-responses-shared.js
+++ b/dist/api/openai-responses-shared.js
@@ -1,3 +1,4 @@
@@ -493,15 +493,15 @@ index af5f04228..634579049 100644
import { calculateCost } from "../models.js";
import { shortHash } from "../utils/hash.js";
import { parseStreamingJson, parseToolCallArguments } from "../utils/json-parse.js";
-@@ -62,6 +63,7 @@ function convertToolResultOutput(model, content) {
- // =============================================================================
+@@ -90,6 +91,7 @@ function renderToolRemovalNotice(names) {
+ }
export function convertResponsesMessages(model, context, allowedToolCallProviders, options) {
const normalizedContext = resolveTranscript(context, options?.supportsMidConvoSystemMessages);
+ validateHostedSearchMessages(normalizedContext.messages);
const messages = [];
const normalizeIdPart = (part) => {
const sanitized = part.replace(/[^a-zA-Z0-9_-]/g, "_");
-@@ -208,6 +210,13 @@ export function convertResponsesMessages(model, context, allowedToolCallProvider
+@@ -260,6 +262,13 @@ export function convertResponsesMessages(model, context, allowedToolCallProvider
phase: parsedSignature?.phase,
});
}
@@ -515,7 +515,7 @@ index af5f04228..634579049 100644
else if (block.type === "toolCall") {
const toolCall = block;
const [callId, itemIdRaw] = toolCall.id.split("|");
-@@ -419,6 +428,28 @@ export async function processResponsesStream(openaiStream, output, stream, model
+@@ -471,6 +480,28 @@ export async function processResponsesStream(openaiStream, output, stream, model
stream.push({ type: "toolcall_start", contentIndex: slot.contentIndex, partial: output });
return slot;
}
@@ -544,7 +544,7 @@ index af5f04228..634579049 100644
return undefined;
};
const getOrCreateSlot = (outputIndex, item) => {
-@@ -500,11 +531,11 @@ export async function processResponsesStream(openaiStream, output, stream, model
+@@ -552,11 +583,11 @@ export async function processResponsesStream(openaiStream, output, stream, model
const slot = getSlot(event.output_index, "thinking");
if (!slot)
continue;
@@ -558,7 +558,7 @@ index af5f04228..634579049 100644
partial: output,
});
}
-@@ -524,11 +555,11 @@ export async function processResponsesStream(openaiStream, output, stream, model
+@@ -576,11 +607,11 @@ export async function processResponsesStream(openaiStream, output, stream, model
const slot = getSlot(event.output_index, "thinking");
if (!slot)
continue;
@@ -572,7 +572,7 @@ index af5f04228..634579049 100644
partial: output,
});
}
-@@ -536,23 +567,44 @@ export async function processResponsesStream(openaiStream, output, stream, model
+@@ -588,23 +619,44 @@ export async function processResponsesStream(openaiStream, output, stream, model
const slot = getSlot(event.output_index, "text");
if (!slot)
continue;
@@ -621,7 +621,7 @@ index af5f04228..634579049 100644
partial: output,
});
}
-@@ -560,9 +612,9 @@ export async function processResponsesStream(openaiStream, output, stream, model
+@@ -612,9 +664,9 @@ export async function processResponsesStream(openaiStream, output, stream, model
const slot = getSlot(event.output_index, "toolCall");
if (!slot || slot.block.partialJson === undefined)
continue;
@@ -633,7 +633,7 @@ index af5f04228..634579049 100644
}
else if (event.type === "response.function_call_arguments.done") {
const slot = getSlot(event.output_index, "toolCall");
-@@ -648,9 +700,25 @@ export async function processResponsesStream(openaiStream, output, stream, model
+@@ -700,9 +752,25 @@ export async function processResponsesStream(openaiStream, output, stream, model
});
outputSlots.delete(event.output_index);
}
@@ -660,7 +660,7 @@ index af5f04228..634579049 100644
else if (event.type === "error") {
throw new Error(`Error Code ${event.code}: ${event.message}` || "Unknown error");
diff --git a/dist/api/openai-responses.js b/dist/api/openai-responses.js
-index 2ab985c7d..c48a104d7 100644
+index b418bfb7ca4e378b5b5c3115b79a6bcc7af17775..17cb84b3ba3f42ae602030680112edf84f3fdf5e 100644
--- a/dist/api/openai-responses.js
+++ b/dist/api/openai-responses.js
@@ -1,3 +1,5 @@
@@ -669,7 +669,7 @@ index 2ab985c7d..c48a104d7 100644
import OpenAI from "openai";
import { clampThinkingLevel } from "../models.js";
import { formatProviderError, normalizeProviderError } from "../utils/error-body.js";
-@@ -105,7 +107,6 @@ function getPromptCacheOptions(compat, cacheRetention) {
+@@ -106,7 +108,6 @@ function getPromptCacheOptions(compat, cacheRetention) {
*/
export const stream = (model, context, options) => {
const stream = new AssistantMessageEventStream();
@@ -677,7 +677,7 @@ index 2ab985c7d..c48a104d7 100644
// Start async processing
(async () => {
const compat = getCompat(model);
-@@ -128,7 +129,9 @@ export const stream = (model, context, options) => {
+@@ -129,7 +130,9 @@ export const stream = (model, context, options) => {
stopReason: "pending",
timestamp: Date.now(),
};
@@ -687,7 +687,7 @@ index 2ab985c7d..c48a104d7 100644
// Create OpenAI client
const apiKey = getClientApiKey(model.provider, options?.apiKey, options?.headers);
const cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);
-@@ -145,6 +148,9 @@ export const stream = (model, context, options) => {
+@@ -146,6 +149,9 @@ export const stream = (model, context, options) => {
...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),
maxRetries: 0,
};
@@ -697,7 +697,7 @@ index 2ab985c7d..c48a104d7 100644
const { data: openaiStream, response } = await retryProviderRequest(() => client.responses.create(params, requestOptions).withResponse(), {
maxRetries: options?.maxRetries,
maxRetryDelayMs: options?.maxRetryDelayMs,
-@@ -171,6 +177,11 @@ export const stream = (model, context, options) => {
+@@ -172,6 +178,11 @@ export const stream = (model, context, options) => {
stream.end();
}
catch (error) {
@@ -709,16 +709,16 @@ index 2ab985c7d..c48a104d7 100644
for (const block of output.content) {
delete block.index;
// Streaming scratch buffers are only used during parsing; never persist them.
-@@ -178,7 +189,7 @@ export const stream = (model, context, options) => {
+@@ -179,7 +190,7 @@ export const stream = (model, context, options) => {
delete block.customInput;
}
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
- const errorMessage = formatProviderError(normalizeProviderError(error), `${model.provider === "openai" ? "OpenAI" : model.provider} API error`);
+ const errorMessage = errorDetails?.message ?? formatProviderError(normalizeProviderError(error), `${model.provider === "openai" ? "OpenAI" : model.provider} API error`);
// Sign in with ChatGPT shares the subscription's usage limit with other apps.
- output.errorMessage = errorMessage.includes("subscription_sharing_usage_limit_exceeded")
- ? `${errorMessage}\nCheck your ChatGPT usage: ${CHATGPT_USAGE_URL}`
-@@ -189,7 +200,7 @@ export const stream = (model, context, options) => {
+ // On ChatGPT Business plans, the workspace admin also sets a per-user limit.
+ if (errorMessage.includes("subscription_sharing_usage_limit_exceeded")) {
+@@ -197,7 +208,7 @@ export const stream = (model, context, options) => {
})();
return stream;
};
@@ -727,16 +727,16 @@ index 2ab985c7d..c48a104d7 100644
getClientApiKey(model.provider, options?.apiKey, options?.headers);
const base = {
...buildBaseOptions(model, context, options, options?.apiKey),
-@@ -201,7 +212,7 @@ export const streamSimple = (model, context, options) => {
+@@ -209,7 +220,7 @@ export const streamSimple = (model, context, options) => {
...base,
reasoningEffort,
});
-};
+});
- function createClient(model, context, apiKey, optionsHeaders, fetch, sessionId) {
+ function createClient(model, context, apiKey, optionsHeaders, identity, fetch, sessionId) {
const compat = getCompat(model);
- const headers = { "User-Agent": getPiUserAgent(), ...model.headers };
-@@ -276,6 +287,12 @@ function buildParams(model, context, options, compat, grammarToolInputProperties
+ const headers = { ...getIdentityHeaders(model, identity), ...model.headers };
+@@ -284,6 +295,12 @@ function buildParams(model, context, options, compat, grammarToolInputProperties
supportsOpenAIGrammarTools: compat.supportsOpenAIGrammarTools,
});
}
@@ -749,7 +749,7 @@ index 2ab985c7d..c48a104d7 100644
if (options?.toolChoice !== undefined) {
params.tool_choice = options.toolChoice;
}
-@@ -300,6 +317,10 @@ function buildParams(model, context, options, compat, grammarToolInputProperties
+@@ -308,6 +325,10 @@ function buildParams(model, context, options, compat, grammarToolInputProperties
if (model.provider === "xai")
params.include = ["reasoning.encrypted_content"];
}
@@ -761,7 +761,7 @@ index 2ab985c7d..c48a104d7 100644
const samplingParams = resolveSamplingParams(model, reasoningEffort ?? "off", options?.samplingParams);
if (samplingParams) {
diff --git a/dist/api/simple-options.js b/dist/api/simple-options.js
-index 4e36f350e..c817c2e4a 100644
+index ed753df7ea29238c5ef2f1543c3568173be00df7..f3dfe613937fb901ee4b06673d45aa516cd650c9 100644
--- a/dist/api/simple-options.js
+++ b/dist/api/simple-options.js
@@ -5,7 +5,7 @@ const MIN_MAX_TOKENS = 1;
@@ -774,14 +774,14 @@ index 4e36f350e..c817c2e4a 100644
}
export function resolveSamplingParams(model, thinkingLevel, requestParams) {
diff --git a/dist/auth/oauth/anthropic.js b/dist/auth/oauth/anthropic.js
-index 0823512eb..713d38af6 100644
+index 0823512eb83d74167335cde72ae21ea32384572e..43d4cae89da499e481ee671c8fc2cccfcdde3dd4 100644
--- a/dist/auth/oauth/anthropic.js
+++ b/dist/auth/oauth/anthropic.js
@@ -4,6 +4,7 @@
* NOTE: This module uses Node.js http.createServer for the OAuth callback server.
* It is only intended for CLI use, not browser environments.
*/
-+import { getPiUserAgent } from "../../utils/pi-user-agent.js";
++import { formatUserAgent } from "../../utils/identity.js";
import { getProviderEnvValue } from "../../utils/provider-env.js";
import { startOAuthCallbackServer, waitForCallbackOrManualInput } from "./callback-server.js";
import { generatePKCE } from "./pkce.js";
@@ -863,7 +863,7 @@ index 0823512eb..713d38af6 100644
+ // (net.fetch) otherwise sends Chromium's browser User-Agent,
+ // and the token endpoint answers browser or claude-code/ UAs
+ // with a permanent 429 rate_limit_error (issue #1337).
-+ "User-Agent": getPiUserAgent(),
++ "User-Agent": formatUserAgent(),
+ },
+ body: serialized,
+ signal: requestSignal,
@@ -931,32 +931,32 @@ index 0823512eb..713d38af6 100644
return {
type: "oauth",
diff --git a/dist/index.d.ts b/dist/index.d.ts
-index 8024d0a7c..79a531852 100644
+index 226fa3e6578dacc5744ce5c9271dd20d4a3b5b23..90cda08400b4a49fda02989b3c4a2f9b75494713 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
-@@ -32,4 +32,7 @@ export * from "./utils/transcript.ts";
+@@ -33,5 +33,8 @@ export * from "./utils/transcript.ts";
export * from "./utils/typebox-helpers.ts";
export { uuidv7 } from "./utils/uuid.ts";
export * from "./utils/validation.ts";
+export { LocalRequestError, localRequestErrorDetails } from "./utils/local-request-error.ts";
+export type { LocalRequestErrorDetails, LocalRequestErrorPhase } from "./utils/local-request-error.ts";
+export * from "./utils/hosted-search.ts";
+ export { PI_AI_VERSION } from "./utils/version.ts";
//# sourceMappingURL=index.d.ts.map
-\ No newline at end of file
diff --git a/dist/index.js b/dist/index.js
-index b0a6bcd5d..35e5b22f2 100644
+index d8d81e85328ff551562c9da1d645339a2ddf9f93..d508f96f3af3798fb166e6d7ff294b6c527551bd 100644
--- a/dist/index.js
+++ b/dist/index.js
-@@ -19,4 +19,6 @@ export * from "./utils/transcript.js";
+@@ -20,5 +20,7 @@ export * from "./utils/transcript.js";
export * from "./utils/typebox-helpers.js";
export { uuidv7 } from "./utils/uuid.js";
export * from "./utils/validation.js";
+export { LocalRequestError, localRequestErrorDetails } from "./utils/local-request-error.js";
+export * from "./utils/hosted-search.js";
+ export { PI_AI_VERSION } from "./utils/version.js";
//# sourceMappingURL=index.js.map
-\ No newline at end of file
diff --git a/dist/providers/compat-schema.d.ts b/dist/providers/compat-schema.d.ts
-index e57ec0f22..33ea5269e 100644
+index 681c7d626372d485351672fc7e4c11e3ed2351ee..5d160ed3cf657852ee22416a98653b5fe178443f 100644
--- a/dist/providers/compat-schema.d.ts
+++ b/dist/providers/compat-schema.d.ts
@@ -71,6 +71,7 @@ export declare const OpenAICompletionsCompatSchema: Type.TObject<{
@@ -968,7 +968,7 @@ index e57ec0f22..33ea5269e 100644
chatTemplateKwargs: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TNumber, Type.TBoolean, Type.TNull, Type.TObject<{
$var: Type.TUnion<[Type.TLiteral<"thinking.enabled">, Type.TLiteral<"thinking.effort">, Type.TLiteral<"thinking.budget">]>;
diff --git a/dist/providers/compat-schema.js b/dist/providers/compat-schema.js
-index 2d8e6c7a2..dea51142c 100644
+index 33d82ac41790de38f7affdbcc2635d6e746c490a..35304bdd315cdfac4592b2ce9649f4c961e8a1af 100644
--- a/dist/providers/compat-schema.js
+++ b/dist/providers/compat-schema.js
@@ -106,6 +106,9 @@ function optionalSessionAffinityFormat(options) {
@@ -982,17 +982,17 @@ index 2d8e6c7a2..dea51142c 100644
description: "Whether the provider supports the store field. Default: auto-detected from URL.",
})),
diff --git a/dist/providers/data/deepseek.json b/dist/providers/data/deepseek.json
-index 1443bb592..5fc062577 100644
+index 1443bb592b2913ba09579f3f555a2b09456e63cf..5fc0625778014863aa267ac5186db2cdf356d789 100644
--- a/dist/providers/data/deepseek.json
+++ b/dist/providers/data/deepseek.json
@@ -1 +1 @@
-{"openai-completions":{"chat:deepseek-flash":{"id":"deepseek-flash","name":"DeepSeek V4.1 Flash","api":"openai-completions","baseUrl":"https://api.deepseek.com","provider":"deepseek","reasoning":true,"thinkingLevelMap":{"minimal":null,"low":"low","medium":null,"high":"high","max":"max"},"input":["text","image"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.006,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"maxTokensField":"max_tokens","requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"deepseek","supportsStrictMode":true},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:deepseek-v4-pro":{"id":"deepseek-v4-pro","name":"DeepSeek V4 Pro","api":"openai-completions","baseUrl":"https://api.deepseek.com","provider":"deepseek","reasoning":true,"input":["text"],"cost":{"input":1.32,"output":3.96,"cacheRead":0.044,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"maxTokensField":"max_tokens","requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"deepseek","supportsStrictMode":true,"supportsMidConvoSystemMessages":true},"thinkingLevelMap":{"minimal":null,"low":null,"medium":null,"high":"high","max":"max"},"type":"chat"}}}
+{"openai-completions":{"chat:deepseek-flash":{"id":"deepseek-flash","name":"DeepSeek V4.1 Flash","api":"openai-completions","baseUrl":"https://api.deepseek.com","provider":"deepseek","reasoning":true,"thinkingLevelMap":{"minimal":null,"low":"low","medium":null,"high":"high","max":"max"},"input":["text","image"],"cost":{"input":0.3,"output":1.2,"cacheRead":0.006,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"maxTokensField":"max_tokens","requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"deepseek","supportsStrictMode":true,"supportsMidConvoSystemMessages":true},"inputLimits":{"images":{"resize":{"maxWidth":2000,"maxHeight":2000,"maxBytes":4718592,"jpegQuality":80}}},"type":"chat"},"chat:deepseek-v4-pro":{"id":"deepseek-v4-pro","name":"DeepSeek V4 Pro","api":"openai-completions","baseUrl":"https://api.deepseek.com","provider":"deepseek","reasoning":true,"input":["text"],"cost":{"input":1.32,"output":3.96,"cacheRead":0.044,"cacheWrite":0},"contextWindow":1000000,"maxTokens":384000,"compat":{"supportsStore":false,"supportsDeveloperRole":false,"maxTokensField":"max_tokens","requiresReasoningContentOnAssistantMessages":true,"thinkingFormat":"deepseek","supportsStrictMode":true,"supportsMidConvoSystemMessages":true},"thinkingLevelMap":{"minimal":null,"low":null,"medium":null,"high":"high","max":"max"},"type":"chat"}}}
diff --git a/dist/types.d.ts b/dist/types.d.ts
-index 022faa196..efed3b8b0 100644
+index e92eefd0889876a84929584675ef2ec441051a2b..a1246539ac6c3b6354f069657c83454345693b7d 100644
--- a/dist/types.d.ts
+++ b/dist/types.d.ts
-@@ -276,6 +276,30 @@ export interface ToolCall {
+@@ -282,6 +282,30 @@ export interface ToolCall {
*/
argumentsError?: string;
}
@@ -1023,7 +1023,7 @@ index 022faa196..efed3b8b0 100644
export interface Usage {
input: number;
output: number;
-@@ -361,7 +385,7 @@ export interface UserMessage {
+@@ -367,7 +391,7 @@ export interface UserMessage {
}
export interface AssistantMessage {
role: "assistant";
@@ -1032,7 +1032,7 @@ index 022faa196..efed3b8b0 100644
api: Api;
provider: ProviderId;
model: string;
-@@ -376,6 +400,8 @@ export interface AssistantMessage {
+@@ -382,6 +406,8 @@ export interface AssistantMessage {
stopReason: StopReason;
deferred?: DeferredHandle;
errorMessage?: string;
@@ -1041,7 +1041,7 @@ index 022faa196..efed3b8b0 100644
rawStopReason?: string;
/**
* Provider indication of whether the model explicitly ended its turn.
-@@ -611,6 +637,10 @@ export type AssistantMessageEvent = {
+@@ -617,6 +643,10 @@ export type AssistantMessageEvent = {
contentIndex: number;
toolCall: ToolCall;
partial: AssistantMessage;
@@ -1052,7 +1052,7 @@ index 022faa196..efed3b8b0 100644
} | {
type: "done";
reason: Extract<StopReason, "stop" | "length" | "toolUse" | "deferred">;
-@@ -642,6 +672,8 @@ export interface Model<TApi extends Api> extends BaseModel<TApi> {
+@@ -648,6 +678,8 @@ export interface Model<TApi extends Api> extends BaseModel<TApi> {
*/
type?: "chat";
reasoning: boolean;
@@ -1062,7 +1062,7 @@ index 022faa196..efed3b8b0 100644
* Maps pi thinking levels to provider/model-specific values.
* Missing keys use provider defaults. null marks a level as unsupported.
diff --git a/dist/utils/estimate.d.ts b/dist/utils/estimate.d.ts
-index 6dcca6eff..5ccaaf235 100644
+index 6dcca6eff16b95b83e047a6e27b65d9d7694bf2c..5ccaaf2358a0afeea3ce354e5799255ae8508f3d 100644
--- a/dist/utils/estimate.d.ts
+++ b/dist/utils/estimate.d.ts
@@ -1,4 +1,4 @@
@@ -1083,7 +1083,7 @@ index 6dcca6eff..5ccaaf235 100644
//# sourceMappingURL=estimate.d.ts.map
\ No newline at end of file
diff --git a/dist/utils/estimate.js b/dist/utils/estimate.js
-index 45be26d82..59a980b63 100644
+index 45be26d820bb38ab85340e7afb8cb4682db2e6b7..59a980b63c5a27e595ee0e81e5134a2b6c705bbd 100644
--- a/dist/utils/estimate.js
+++ b/dist/utils/estimate.js
@@ -1,95 +1,114 @@
diff --git a/patches/@[email protected] b/patches/@[email protected]
similarity index 94%
rename from patches/@[email protected]
rename to patches/@[email protected]
index 17b7a4c19..daa0f46f1 100644
--- a/patches/@[email protected]
+++ b/patches/@[email protected]
@@ -1,5 +1,5 @@
diff --git a/dist/core/agent-session.js b/dist/core/agent-session.js
-index 11ab140cd..cb2617f5f 100644
+index 8728a3e0d31f478f28d707cbf313225da4035aca..51f3c5bf0de0c5fedd3144e8d24957cdc5a16738 100644
--- a/dist/core/agent-session.js
+++ b/dist/core/agent-session.js
@@ -69,10 +69,10 @@ function withoutDeletedHeaders(headers) {
@@ -15,7 +15,7 @@ index 11ab140cd..cb2617f5f 100644
}
return tokens;
}
-@@ -419,7 +419,7 @@ export class AgentSession {
+@@ -418,7 +418,7 @@ export class AgentSession {
_exceedsCompactionThreshold(model, projection) {
if (model.contextWindow <= 0)
return false;
@@ -24,7 +24,7 @@ index 11ab140cd..cb2617f5f 100644
}
async _compactBeforeNextAssistantResponse(context) {
const projection = this.sessionManager.buildSessionProjection();
-@@ -591,7 +591,7 @@ export class AgentSession {
+@@ -590,7 +590,7 @@ export class AgentSession {
entryId = manager.appendContextEdit(draft.targetId, draft.replacement);
break;
case "compaction": {
@@ -33,7 +33,7 @@ index 11ab140cd..cb2617f5f 100644
entryId = manager.appendCompaction(draft.summary, draft.firstKeptEntryId, tokensBefore, draft.details, true, draft.usage);
break;
}
-@@ -2211,7 +2211,7 @@ export class AgentSession {
+@@ -2240,7 +2240,7 @@ export class AgentSession {
}
const settings = this.settingsManager.getCompactionSettings(model);
const pathEntries = this.sessionManager.getBranch();
@@ -42,7 +42,7 @@ index 11ab140cd..cb2617f5f 100644
if (!preparation) {
// Check why we can't compact
const lastEntry = pathEntries[pathEntries.length - 1];
-@@ -2268,7 +2268,7 @@ export class AgentSession {
+@@ -2297,7 +2297,7 @@ export class AgentSession {
this.sessionManager.appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromExtension, usage);
const newEntries = this.sessionManager.getEntries();
this._refreshFinalizedContext();
@@ -51,7 +51,7 @@ index 11ab140cd..cb2617f5f 100644
// Get the saved compaction entry for the extension event
const savedCompactionEntry = newEntries.find((e) => e.type === "compaction" && e.summary === summary);
if (this._extensionRunner && savedCompactionEntry) {
-@@ -2451,11 +2451,11 @@ export class AgentSession {
+@@ -2480,11 +2480,11 @@ export class AgentSession {
const hasContextEdits = projection.entries.some((entry) => entry.sourceEntry.type === "context_edit");
const directContextTokens = assistantMessage.usage ? calculateContextTokens(assistantMessage.usage) : 0;
if (hasContextEdits) {
@@ -65,7 +65,7 @@ index 11ab140cd..cb2617f5f 100644
// Without provider usage, estimate.tokens is the pure message-size estimate.
// Only usage-backed estimates need the stale pre-compaction check.
if (estimate.lastUsageIndex !== null) {
-@@ -2501,7 +2501,7 @@ export class AgentSession {
+@@ -2530,7 +2530,7 @@ export class AgentSession {
return false;
}
const pathEntries = this.sessionManager.getBranch();
@@ -74,7 +74,7 @@ index 11ab140cd..cb2617f5f 100644
if (!preparation) {
return false;
}
-@@ -2557,7 +2557,7 @@ export class AgentSession {
+@@ -2586,7 +2586,7 @@ export class AgentSession {
this.sessionManager.appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromExtension, usage);
const newEntries = this.sessionManager.getEntries();
this._refreshFinalizedContext();
@@ -83,7 +83,7 @@ index 11ab140cd..cb2617f5f 100644
// Get the saved compaction entry for the extension event
const savedCompactionEntry = newEntries.find((e) => e.type === "compaction" && e.summary === summary);
if (this._extensionRunner && savedCompactionEntry) {
-@@ -3495,7 +3495,7 @@ export class AgentSession {
+@@ -3524,7 +3524,7 @@ export class AgentSession {
if (!hasPostCompactionUsage)
return { tokens: null, contextWindow, percent: null };
}
@@ -93,7 +93,7 @@ index 11ab140cd..cb2617f5f 100644
return {
tokens: estimate.tokens,
diff --git a/dist/core/bug-report.js b/dist/core/bug-report.js
-index bc4af31b5..24a4f8e28 100644
+index bc4af31b57f4a8696a68d4f2a529a26669955382..24a4f8e28624523112cac6c73464e93fb650f03a 100644
--- a/dist/core/bug-report.js
+++ b/dist/core/bug-report.js
@@ -232,12 +232,12 @@ Numbered list, as specific as the transcript allows.
@@ -121,7 +121,7 @@ index bc4af31b5..24a4f8e28 100644
const prompt = [
messages.length < options.messages.length
diff --git a/dist/core/compaction/branch-summarization.d.ts b/dist/core/compaction/branch-summarization.d.ts
-index 12cb88ef5..6ff73567b 100644
+index 12cb88ef5398b2365d5823597b7ccf063af567d6..6ff73567bbd5289b8b3f2fb82f923a5b5dc7860e 100644
--- a/dist/core/compaction/branch-summarization.d.ts
+++ b/dist/core/compaction/branch-summarization.d.ts
@@ -6,7 +6,7 @@
@@ -143,7 +143,7 @@ index 12cb88ef5..6ff73567b 100644
* Generate a summary of abandoned branch entries.
*
diff --git a/dist/core/compaction/branch-summarization.js b/dist/core/compaction/branch-summarization.js
-index 3f98859dd..b68f7adb1 100644
+index dba3462974d41ae6201ccf12a775c75ec6c7de5e..3c02d5cb0ae96362130b3c87967e55bb948028b2 100644
--- a/dist/core/compaction/branch-summarization.js
+++ b/dist/core/compaction/branch-summarization.js
@@ -95,7 +95,7 @@ function getMessageFromEntry(entry) {
@@ -174,7 +174,7 @@ index 3f98859dd..b68f7adb1 100644
return { summary: "No content to summarize" };
}
diff --git a/dist/core/compaction/compaction.d.ts b/dist/core/compaction/compaction.d.ts
-index 04416da43..fdf79d9f2 100644
+index 4c2a2703b8573db5ea1975276fef5bdea5a4990a..ba84715c1565bb2145d7ee9b7616080310a76530 100644
--- a/dist/core/compaction/compaction.d.ts
+++ b/dist/core/compaction/compaction.d.ts
@@ -6,7 +6,7 @@
@@ -229,7 +229,7 @@ index 04416da43..fdf79d9f2 100644
* Generate summaries for compaction using prepared data.
* Returns CompactionResult - SessionManager adds uuid/parentUuid when saving.
diff --git a/dist/core/compaction/compaction.js b/dist/core/compaction/compaction.js
-index e4992e8d2..0797ad50e 100644
+index 9b1a409d96b39413d8598c79f14fee72f4cd533c..95f9b8fb0f6e64f23e6923a7b87b02a518e7b1f9 100644
--- a/dist/core/compaction/compaction.js
+++ b/dist/core/compaction/compaction.js
@@ -4,8 +4,10 @@
@@ -385,7 +385,7 @@ index e4992e8d2..0797ad50e 100644
if (messageTokens === 0)
continue;
accumulatedTokens += messageTokens;
-@@ -549,7 +518,7 @@ function findProjectedTurnStartIndex(entries, entryIndex, startIndex) {
+@@ -552,7 +521,7 @@ function findProjectedTurnStartIndex(entries, entryIndex, startIndex) {
}
return -1;
}
@@ -394,7 +394,7 @@ index e4992e8d2..0797ad50e 100644
const cutPoints = [];
for (let i = startIndex; i < endIndex; i++) {
const entry = entries[i];
-@@ -563,7 +532,7 @@ function findProjectedCutPoint(entries, startIndex, endIndex, keepRecentTokens)
+@@ -566,7 +535,7 @@ function findProjectedCutPoint(entries, startIndex, endIndex, keepRecentTokens)
let exceededBudget = false;
let cutIndex = cutPoints[0];
for (let i = endIndex - 1; i >= startIndex; i--) {
@@ -403,7 +403,7 @@ index e4992e8d2..0797ad50e 100644
if (messageTokens === 0)
continue;
accumulatedTokens += messageTokens;
-@@ -603,7 +572,7 @@ function findProjectedCutPoint(entries, startIndex, endIndex, keepRecentTokens)
+@@ -606,7 +575,7 @@ function findProjectedCutPoint(entries, startIndex, endIndex, keepRecentTokens)
isSplitTurn: !startsTurn && turnStartIndex !== -1,
};
}
@@ -412,7 +412,7 @@ index e4992e8d2..0797ad50e 100644
if (pathEntries.length > 0 && pathEntries[pathEntries.length - 1].type === "compaction") {
return undefined;
}
-@@ -621,8 +590,8 @@ export function prepareCompaction(pathEntries, settings) {
+@@ -624,8 +593,8 @@ export function prepareCompaction(pathEntries, settings) {
boundaryStart = prevCompactionIndex + 1;
}
const boundaryEnd = projectedEntries.length;
@@ -424,7 +424,7 @@ index e4992e8d2..0797ad50e 100644
if (!firstKeptEntry?.id)
return undefined;
diff --git a/dist/core/compaction/utils.js b/dist/core/compaction/utils.js
-index ff5292a31..7f190eed0 100644
+index ff5292a31ab6a81a34c58c2eba0c49c5197f28fc..7f190eed0fe7df13fefec09ced8ab2fc5233b064 100644
--- a/dist/core/compaction/utils.js
+++ b/dist/core/compaction/utils.js
@@ -2,6 +2,7 @@
@@ -468,7 +468,7 @@ index ff5292a31..7f190eed0 100644
else if (msg.role === "toolResult") {
const content = contentText(msg.content, "");
diff --git a/dist/utils/tool-result-images.js b/dist/utils/tool-result-images.js
-index 37d8a2474..b194f69e3 100644
+index 37d8a2474d425e6ac8648745c02d1a247244cbd3..b194f69e3d5073a4c5177a0dfb2b67104eec5814 100644
--- a/dist/utils/tool-result-images.js
+++ b/dist/utils/tool-result-images.js
@@ -27,10 +27,9 @@ export async function normalizeToolResultImages(content, options) {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1ecfcf568..be4f35dbb 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -205,9 +205,9 @@ overrides:
vite@5: '>=6.4.3 <7'
patchedDependencies:
- '@earendil-works/[email protected]': afe17754a8c323f4010e051c96a66314ce96c1745a235c3efb5970cfea91a9b0
- '@earendil-works/[email protected]': fd558db9c2c721be64b04b9257f2e2f034a95df5257801a56caa578f9f634f98
- '@earendil-works/[email protected]': 5cb7070ec8e1695932e9968afa6828b36beb1face77418739d5cd01b2a07c371
+ '@earendil-works/[email protected]': f7df81a6d069cd0287276085d46d531684234acb7243dc032b1a1d73b17019da
+ '@earendil-works/[email protected]': 37f387538dbd7fb43eac5bf228691391c91481c08a36566be55a35a01c87b4e8
+ '@earendil-works/[email protected]': 1f1a1efed2ccd6fccef2608bf0cd304cd6af4c91824839189c73ab88953e5635
importers:
@@ -233,11 +233,11 @@ importers:
version: 0.2.2
devDependencies:
'@earendil-works/pi-ai':
- specifier: 1.3.0
- version: 1.3.0(patch_hash=fd558db9c2c721be64b04b9257f2e2f034a95df5257801a56caa578f9f634f98)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
+ specifier: 1.4.0
+ version: 1.4.0(patch_hash=37f387538dbd7fb43eac5bf228691391c91481c08a36566be55a35a01c87b4e8)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
'@earendil-works/pi-mcp':
- specifier: 1.3.0
- version: 1.3.0
+ specifier: 1.4.0
+ version: 1.4.0
'@pi-desktop/agent-host':
specifier: workspace:*
version: link:../../packages/agent-host
@@ -428,14 +428,14 @@ importers:
packages/agent-runtime:
dependencies:
'@earendil-works/pi-agent-core':
- specifier: 1.3.0
- version: 1.3.0(patch_hash=afe17754a8c323f4010e051c96a66314ce96c1745a235c3efb5970cfea91a9b0)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
+ specifier: 1.4.0
+ version: 1.4.0(patch_hash=f7df81a6d069cd0287276085d46d531684234acb7243dc032b1a1d73b17019da)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
'@earendil-works/pi-ai':
- specifier: 1.3.0
- version: 1.3.0(patch_hash=fd558db9c2c721be64b04b9257f2e2f034a95df5257801a56caa578f9f634f98)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
+ specifier: 1.4.0
+ version: 1.4.0(patch_hash=37f387538dbd7fb43eac5bf228691391c91481c08a36566be55a35a01c87b4e8)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
'@earendil-works/pi-coding-agent':
- specifier: 1.3.0
- version: 1.3.0(patch_hash=5cb7070ec8e1695932e9968afa6828b36beb1face77418739d5cd01b2a07c371)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])
+ specifier: 1.4.0
+ version: 1.4.0(patch_hash=1f1a1efed2ccd6fccef2608bf0cd304cd6af4c91824839189c73ab88953e5635)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])
'@pi-desktop/shared':
specifier: workspace:*
version: link:../shared
@@ -947,34 +947,34 @@ packages:
search-insights:
optional: true
- '@earendil-works/[email protected]':
- resolution: {integrity: sha512-2jvpxZs47PFD5mSQb/yK0pGHJ5yO7Nu22u9mFjHbSLRgu62vZ9rupimDSIp4arnqOadyv0AWvYHtCSpFoJV7ag==}
+ '@earendil-works/[email protected]':
+ resolution: {integrity: sha512-PoKY84SKUwnt7S5QBZaGUqfNO1kjP3KHpHUA9QpFTj4cOjaVWMYIcBPJ6FDRCdE8Zen9OSECQUd0uUfVgtSmgA==}
engines: {node: '>=22.19.0'}
- '@earendil-works/[email protected]':
- resolution: {integrity: sha512-KaBI8x7q7sPoFUXICNGD9efHzDG+oRNwVvkA9jdIsSQWH1RjFssOlEGsbLtewUPPgCrvmz0l2KTgSLXTyj3acw==}
+ '@earendil-works/[email protected]':
+ resolution: {integrity: sha512-hQM/C4+1w8rHYACzDDf+0vQMnEnpzIop1tptIERVgR3ZeT/hHSzBNG8PaWPgxWQjqSeKCyBZSyp8uTT6eKK1pQ==}
engines: {node: '>=22.19.0'}
hasBin: true
- '@earendil-works/[email protected]':
- resolution: {integrity: sha512-2G9tmbsPhgzwfz7cmzJpbLSLqOx3eu22Gbzm+Wc3HqeZMjLQS4F3KfAabozVhv7uEjq3k2O1dZTHmhhWr2xbfQ==}
+ '@earendil-works/[email protected]':
+ resolution: {integrity: sha512-23CNAXpS9DuLzPMyYuvrXVVio46x4YhffCgCqaWmF7F5H8PooqjrQvX4ucF6M0BhUd+x2tV6r1J0dv8cCME4Cg==}
engines: {node: '>=22.19.0'}
- '@earendil-works/[email protected]':
- resolution: {integrity: sha512-V/WoCjA2hQSe3QLWIUB24cTRdtEdeLiIzkDqU5RMXV6VWuD+KGZnzVBMhglwdnQTySkehZsjt8a3g6Jd2g4nnw==}
+ '@earendil-works/[email protected]':
+ resolution: {integrity: sha512-Z41LpZ3yYHSC/UUps6Mr39UMFPwH8elhJBG9DY1P7kuzsE5qSK/6eMj2EHzO5evJRQWLbKSqUMw+4nCNtIyiQg==}
engines: {node: '>=22.19.0'}
hasBin: true
- '@earendil-works/[email protected]':
- resolution: {integrity: sha512-lbktLplmdGamM2t460Q0ziNEfpUEHDTVNf79g/AialJ3XZ+SHgNqa/OJXRR+fU+GV/l+gBhRPcyP8XkQlv8Avw==}
+ '@earendil-works/[email protected]':
+ resolution: {integrity: sha512-92aZmmGsUpHHknYuKXZHRINQfahntw5hU9If0I0ZM49GojOaFHpkl5/GF3/aatqpt7v7GjZbBfpfSygGKW+pnw==}
engines: {node: '>=22.19.0'}
- '@earendil-works/[email protected]':
- resolution: {integrity: sha512-ERGZr+aXjNJzoUbB7ZzHVH3g5otzMHjHLs2Fyizm12By5X+gBEhod9cJXFOk13S7M8a29Am+Mq21zm73mRJFLg==}
+ '@earendil-works/[email protected]':
+ resolution: {integrity: sha512-MLIfowwUYIY65jSjMX82paZOrX/NTvLk6D08h+3Jq42a99RzUOewzuCR0zOlPul3D6UBfddat76VT6LvsHEs1w==}
engines: {node: '>=22.19.0'}
- '@earendil-works/[email protected]':
- resolution: {integrity: sha512-AlKvEwEWyVtnuw7SVb4N/mUhlfIohyFslUNWarZVdLHHSdt3ca5EhMLwTzblBpDpaofSz+f+tAHie6CfxVrWKA==}
+ '@earendil-works/[email protected]':
+ resolution: {integrity: sha512-4obPOjgOD7g4mGSlngIvxyujC1UPdmyI9zdVthbr8GufacFEX+Ce0+scPgHg++k2xj5+QjESM2d5TxvIuzCVmg==}
engines: {node: '>=22.19.0'}
'@electron-internal/[email protected]':
@@ -3422,6 +3422,12 @@ packages:
resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==}
+ resolution: {integrity: sha512-GUj8HjiEbur9yhgUo52FBgKizggF1QtT6gVdrYdWW6ZB4lVVjgS3EyyXPyfyRD0V4ghGRPlO7MO80rgSWbm0eA==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ marked: '>=15.0.0'
+
resolution: {integrity: sha512-TI3V8YYWvkVf3KJe1dRkpnjs68JUPyEa5vjKrp1XEEJUAOaQc+Qj+L1qWbPd0SJuAdQkFU0h73sXXqwDYxsiDA==}
engines: {node: '>= 20'}
@@ -5067,9 +5073,9 @@ snapshots:
transitivePeerDependencies:
- '@algolia/client-search'
- '@earendil-works/[email protected](patch_hash=afe17754a8c323f4010e051c96a66314ce96c1745a235c3efb5970cfea91a9b0)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':
+ '@earendil-works/[email protected](patch_hash=f7df81a6d069cd0287276085d46d531684234acb7243dc032b1a1d73b17019da)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':
dependencies:
- '@earendil-works/pi-ai': 1.3.0(patch_hash=fd558db9c2c721be64b04b9257f2e2f034a95df5257801a56caa578f9f634f98)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
+ '@earendil-works/pi-ai': 1.4.0(patch_hash=37f387538dbd7fb43eac5bf228691391c91481c08a36566be55a35a01c87b4e8)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
typebox: 1.3.27
transitivePeerDependencies:
- '@aws-sdk/credential-provider-node'
@@ -5084,11 +5090,11 @@ snapshots:
- ws
- zod
- '@earendil-works/[email protected](patch_hash=fd558db9c2c721be64b04b9257f2e2f034a95df5257801a56caa578f9f634f98)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':
+ '@earendil-works/[email protected](patch_hash=37f387538dbd7fb43eac5bf228691391c91481c08a36566be55a35a01c87b4e8)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':
dependencies:
'@anthropic-ai/sdk': 0.129.0([email protected])
'@aws-sdk/client-bedrock-runtime': 3.1127.0
- '@earendil-works/pi-telemetry': 1.3.0
+ '@earendil-works/pi-telemetry': 1.4.0
'@google/genai': 2.21.0([email protected])
'@smithy/node-http-handler': 4.12.1
http-proxy-agent: 9.1.0([email protected])
@@ -5109,11 +5115,11 @@ snapshots:
- ws
- zod
- '@earendil-works/[email protected](patch_hash=fd558db9c2c721be64b04b9257f2e2f034a95df5257801a56caa578f9f634f98)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':
+ '@earendil-works/[email protected](patch_hash=37f387538dbd7fb43eac5bf228691391c91481c08a36566be55a35a01c87b4e8)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':
dependencies:
'@anthropic-ai/sdk': 0.129.0([email protected])
'@aws-sdk/client-bedrock-runtime': 3.1127.0
- '@earendil-works/pi-telemetry': 1.3.0
+ '@earendil-works/pi-telemetry': 1.4.0
'@google/genai': 2.21.0([email protected])
'@smithy/node-http-handler': 4.12.1
http-proxy-agent: 9.1.0([email protected])
@@ -5134,17 +5140,17 @@ snapshots:
- ws
- zod
- '@earendil-works/[email protected]':
+ '@earendil-works/[email protected]':
dependencies:
quickjs-wasi: 3.6.2
- '@earendil-works/[email protected](patch_hash=5cb7070ec8e1695932e9968afa6828b36beb1face77418739d5cd01b2a07c371)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])':
+ '@earendil-works/[email protected](patch_hash=1f1a1efed2ccd6fccef2608bf0cd304cd6af4c91824839189c73ab88953e5635)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])':
dependencies:
- '@earendil-works/pi-agent-core': 1.3.0(patch_hash=afe17754a8c323f4010e051c96a66314ce96c1745a235c3efb5970cfea91a9b0)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
- '@earendil-works/pi-ai': 1.3.0(patch_hash=fd558db9c2c721be64b04b9257f2e2f034a95df5257801a56caa578f9f634f98)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
- '@earendil-works/pi-codemode': 1.3.0
- '@earendil-works/pi-mcp': 1.3.0
- '@earendil-works/pi-tui': 1.3.0
+ '@earendil-works/pi-agent-core': 1.4.0(patch_hash=f7df81a6d069cd0287276085d46d531684234acb7243dc032b1a1d73b17019da)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
+ '@earendil-works/pi-ai': 1.4.0(patch_hash=37f387538dbd7fb43eac5bf228691391c91481c08a36566be55a35a01c87b4e8)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
+ '@earendil-works/pi-codemode': 1.4.0
+ '@earendil-works/pi-mcp': 1.4.0
+ '@earendil-works/pi-tui': 1.4.0
'@silvia-odwyer/photon-node': 0.3.4
brace-expansion: 5.0.12
chalk: 6.0.0
@@ -5174,16 +5180,17 @@ snapshots:
- ws
- zod
- '@earendil-works/[email protected]':
+ '@earendil-works/[email protected]':
dependencies:
cross-spawn: 7.0.6
- '@earendil-works/[email protected]': {}
+ '@earendil-works/[email protected]': {}
- '@earendil-works/[email protected]':
+ '@earendil-works/[email protected]':
dependencies:
get-east-asian-width: 1.6.0
marked: 18.0.11
+ marked-cjk-friendly: 0.1.2([email protected])
'@electron-internal/[email protected]': {}
@@ -7714,6 +7721,10 @@ snapshots:
+ dependencies:
+ marked: 18.0.11
+
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 350312d4e..34650a974 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -13,16 +13,16 @@ allowBuilds:
# binary; its from-source install script was never approved and is not needed.
koffi: false
# pnpm records exact-version exclusions for the current, explicitly requested
-# Pi 1.3.0 release while it is inside the minimum release age window. Keep these
+# Pi 1.4.0 release while it is inside the minimum release age window. Keep these
# entries exact; do not widen them to package names or ranges.
minimumReleaseAgeExclude:
- - '@earendil-works/[email protected]'
- - '@earendil-works/[email protected]'
- - '@earendil-works/[email protected]'
- - '@earendil-works/[email protected]'
- - '@earendil-works/[email protected]'
- - '@earendil-works/[email protected]'
- - '@earendil-works/[email protected]'
+ - '@earendil-works/[email protected]'
+ - '@earendil-works/[email protected]'
+ - '@earendil-works/[email protected]'
+ - '@earendil-works/[email protected]'
+ - '@earendil-works/[email protected]'
+ - '@earendil-works/[email protected]'
+ - '@earendil-works/[email protected]'
# Advisory fixes for transitives whose parents still resolve the vulnerable
# version. Drop each one once its parent ships a release that resolves the
# patched version on its own.
@@ -58,9 +58,9 @@ overrides:
# every range to its floor — silently downgrading dependencies instead of
# refreshing them. Pin the intent: `pnpm update` means "newest within range".
patchedDependencies:
- '@earendil-works/[email protected]': patches/@[email protected]
- '@earendil-works/[email protected]': patches/@[email protected]
- '@earendil-works/[email protected]': patches/@[email protected]
+ '@earendil-works/[email protected]': patches/@[email protected]
+ '@earendil-works/[email protected]': patches/@[email protected]
+ '@earendil-works/[email protected]': patches/@[email protected]
resolutionMode: highest
# shamefully-hoist also lives in .npmrc, but pnpm 12 applies it only from
# here; without it public hoisting is empty and examples/ plugins cannot
diff --git a/scripts/check-pi-dependencies.mjs b/scripts/check-pi-dependencies.mjs
index 16fcf50f8..1b8fe57e3 100644
--- a/scripts/check-pi-dependencies.mjs
+++ b/scripts/check-pi-dependencies.mjs
@@ -25,7 +25,7 @@ function parseArgs(argv) {
}
const root = parseArgs(process.argv.slice(2));
-const targetVersion = "1.3.0";
+const targetVersion = "1.4.0";
function readJson(path) {
return JSON.parse(readFileSync(join(root, path), "utf8"));
@@ -69,7 +69,7 @@ for (const packageName of ["@earendil-works/pi-ai", "@earendil-works/pi-mcp"]) {
const lockfile = readFileSync(join(root, "pnpm-lock.yaml"), "utf8");
for (const packageName of ["pi-agent-core", "pi-ai", "pi-coding-agent", "pi-mcp"]) {
- if (new RegExp(`@earendil-works/${packageName}@1\\.(?:0|1|2)\\.\\d+(?:[(:]|$)`).test(lockfile)) {
+ if (new RegExp(`@earendil-works/${packageName}@1\\.[0-3]\\.\\d+(?:[(:]|$)`).test(lockfile)) {
throw new Error(`pnpm-lock.yaml still contains an outdated @earendil-works/${packageName}`);
}
}
@@ -81,16 +81,16 @@ const actualReleaseAgeExclusions = [...releaseAgeExclusions.matchAll(/^[ \t]+-[
.map((match) => match[1])
.sort();
const expectedReleaseAgeExclusions = [
- "@earendil-works/[email protected]",
- "@earendil-works/[email protected]",
- "@earendil-works/[email protected]",
- "@earendil-works/[email protected]",
- "@earendil-works/[email protected]",
- "@earendil-works/[email protected]",
- "@earendil-works/[email protected]",
+ "@earendil-works/[email protected]",
+ "@earendil-works/[email protected]",
+ "@earendil-works/[email protected]",
+ "@earendil-works/[email protected]",
+ "@earendil-works/[email protected]",
+ "@earendil-works/[email protected]",
+ "@earendil-works/[email protected]",
].sort();
if (JSON.stringify(actualReleaseAgeExclusions) !== JSON.stringify(expectedReleaseAgeExclusions)) {
- throw new Error("Pi minimumReleaseAgeExclude entries must match only the exact 1.3.0 release packages");
+ throw new Error("Pi minimumReleaseAgeExclude entries must match only the exact 1.4.0 release packages");
}
process.stdout.write(`Pi direct pins and installed package instances are aligned at ${targetVersion}.\n`);
diff --git a/scripts/check-pi-patches.mjs b/scripts/check-pi-patches.mjs
index a8fd733e7..0bbaa077b 100644
--- a/scripts/check-pi-patches.mjs
+++ b/scripts/check-pi-patches.mjs
@@ -25,7 +25,7 @@ function parseArgs(argv) {
}
const root = parseArgs(process.argv.slice(2));
-const targetVersion = "1.3.0";
+const targetVersion = "1.4.0";
const entries = [
{
name: "@earendil-works/pi-agent-core",
diff --git a/scripts/pi-patch-hash.test.mjs b/scripts/pi-patch-hash.test.mjs
index 13a4ce677..465b65e0f 100644
--- a/scripts/pi-patch-hash.test.mjs
+++ b/scripts/pi-patch-hash.test.mjs
@@ -11,7 +11,7 @@ const here = dirname(fileURLToPath(import.meta.url));
const patchDependencyCheck = join(here, "check-pi-dependencies.mjs");
const patchCheck = join(here, "check-pi-patches.mjs");
-const TARGET = "1.3.0";
+const TARGET = "1.4.0";
const PATCHED = [
{
name: "@earendil-works/pi-agent-core",
@@ -222,4 +222,4 @@ test("check-pi-patches rejects a package that is not installed as a patched inst
} finally {
rmSync(dir, { recursive: true, force: true });
}
-});
\ No newline at end of file
+});