Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
chore(deps): upgrade Pi kernel packages from 1.1.0 to 1.3.0
vastsa16802b225e81
diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex 6e8b3b341..50ea9aaeb 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.1.0",- "@earendil-works/pi-mcp": "1.1.0",+ "@earendil-works/pi-ai": "1.3.0",+ "@earendil-works/pi-mcp": "1.3.0","@pi-desktop/agent-host": "workspace:*","@pi-desktop/agent-runtime": "workspace:*","@pi-desktop/host-runtime": "workspace:*",diff --git a/docs/project/pi-130-adoption.md b/docs/project/pi-130-adoption.mdnew file mode 100644index 000000000..aad06beee--- /dev/null+++ b/docs/project/pi-130-adoption.md@@ -0,0 +1,117 @@+# Pi 1.3.0 adoption++## Scope++Upgrade all five direct Pi dependencies from 1.1.0 to exactly 1.3.0:+Agent Runtime's `pi-agent-core`, `pi-ai`, and `pi-coding-agent`, and Desktop's+`pi-ai` and `pi-mcp`. Internal release-group dependencies stay aligned through+the lockfile. No Host protocol, database schema, persisted provider endpoint,+permission policy, extension VERSION marker, or storage ownership changes.++Official release notes: [1.2.0](https://github.com/earendil-works/pi/releases/tag/v1.2.0)+and [1.3.0](https://github.com/earendil-works/pi/releases/tag/v1.3.0).++## Compatibility work++- Rebase all three pnpm patches against the published 1.3.0 tarballs. Preserve+ hosted-search streaming/replay/estimation, bounded Anthropic OAuth handling,+ DeepSeek reasoning replay and endpoint-scoped system-message capability,+ local request errors, and native session context estimation/image degradation.+- Preserve upstream Anthropic strict-tool fallback and thinking-off handling.+ Re-enter local request preparation on each fallback attempt so callback and+ serialization failures remain classified and do not expose raw payloads.+- Move `requiresNonEmptyReasoningReplay` to the new provider compat schema,+ keeping runtime validation and TypeScript declarations aligned.+- Remove the patch for the deleted experimental assistant-frame codec and its+ codec-only tests. Keep the real stream-decoder, hosted-search consumer, and+ final-message regression coverage; no production consumer used that codec.+- Adopt upstream foreign-model thinking omission. Same-model DeepSeek reasoning+ remains replayable; visible transcript history is not rewritten.+- Verify malformed final tool JSON never reaches Host execution and the next+ model request receives the raw input error. Corrected calls still succeed,+ and literal invalid Unicode escapes no longer lose subsequent input fields.+- Add `messageType: "user"` to the Desktop extension shim's startup event.+ Its legacy supported subset and unsupported custom-message runs are unchanged;+ native Pi sessions continue using the real SDK's lifecycle.++## Explicitly unchanged++Desktop still owns its model/endpoint projection, retry policy, MCP ownership,+and compaction implementation. Pi 1.3.0 ships capabilities that Desktop does not+project; each is deliberate, and each pre-dates this upgrade unless noted:++- `ToolCall.argumentsError`, new in 1.3.0, is not consumed. Desktop's own+ adapter guard classifies malformed tool-argument JSON before Host execution+ and returns the raw error to the next request, so the SDK field would only+ duplicate an existing local path.+- Transport capabilities stay limited to the five keys in+ `packages/agent-runtime/src/transcript-compat.ts`; provider-native effort+ replay on `AssistantMessage` is not projected.+- `samplingParams`, `samplingParamsByThinkingLevel`, `promptCache`, and+ `inputLimits` are carried on `ModelConfig` but not forwarded into the+ streaming `Model` built at `packages/agent-runtime/src/provider-binding.ts:462`.+- The Kimi For Coding preset still requests Anthropic Messages+ (`packages/shared/src/provider-presets.ts:232-238`), and the live vendor probe+ still reports `anthropic-messages` at `https://api.kimi.com/coding`+ (`apps/desktop/electron/main/vendor-live-models.ts:32,41`), although upstream+ 1.3.0 moved `kimi-coding` to Chat Completions at `/coding/v1`. Both Desktop+ paths keep targeting `/v1/messages` and are unchanged; rewriting saved rows+ would change transport for existing users.+- OpenRouter keeps the models.dev catalogue route+ (`apps/desktop/electron/main/vendor-live-models.ts:44`) instead of per-key+ personalization, and OpenCode Go keeps its `/zen` catalogue route+ (`packages/agent-runtime/src/provider-binding.ts:236-261`).++Native SDK summarization now omits thinking; Desktop's own summary serializer+retains its current behavior. Chat metadata remains owned by models.dev, not Pi+sibling defaults.++## Fresh-release policy and patch identity++The seven Pi 1.3.0 release-group packages have exact-version release-age+exclusions. Removed `chord` is no longer excluded or installed. Do not widen+these entries to package names or ranges. The lockfile records the canonical+patch hashes; `check:pi-dependencies`, `check:pi-patches`, and their fixture tests+verify exact pins, mappings, installed instances, and audited declarations.++## Validation++Task candidate: this change on task base+`de57f05aa65b05c93a4113bf5d4db9723884b080` (`origin/main`).++- Runtime regression: 102 files / 1,412 tests passed.+- Extension discriminator regression: failed before the shim fix, then passed.+- Anthropic fallback local-error regressions: both failed before preparation-state+ reset, then passed in the full runtime suite.+- `pnpm build:js`, Desktop typecheck, lint, architecture, documentation checks,+ dependency/patch gates, and all 7 patch-gate fixture tests passed.+- `pnpm -r --workspace-concurrency=1 --if-present test` passed across all+ packages, including Desktop's 4,134 passed / 3 skipped and pi-host's 61+ passed / 1 platform skip. The parallel run exceeded packaging-test timeouts;+ the unchanged tests pass when run alone and in the serial workspace run.+- Protocol smoke passed 23 checks; 2 real-model checks were skipped without+ credentials. Hosted-search bundle E2E passed all 8 scenarios; isolated+ Electron trusted-extension E2E passed 57/57 checks.+- Additional `test:e2e:provider-api-style` UI probing did not pass: two runs+ stopped at the no-auth save and StepFun selection steps respectively. Its+ fixture, renderer, shared, and i18n source are unchanged from `origin/main`.+ This separate UI harness failure is recorded, not counted as a pass or fixed+ by expanding this kernel-upgrade change.+- Environment: macOS arm64, Node 24.14.0, pnpm 12.8.1, existing Electron and+ release Host binary reused. Pi 1.3 requires a worktree-local dependency+ install because the primary checkout's 1.1.0 packages are incompatible; the+ existing pnpm store was reused. Hosted-search E2E runs via the pnpm script+ entry to avoid bootstrapping Corepack under its isolated, network-disabled HOME.+- Hosted-search artifact SHA-256:+ `bbadf71cb71c451af469084ac1ae18091fd53788d2c9abaa7488af2890280f75`.+- Rust checks were not rerun: no Rust source, Cargo dependency, or Host contract+ changed. Real Host RPC coverage used the existing release binary.+- No real-provider, paid API, installed-app, or user-data tests are authorized.+- PR integration validation is recorded on the pull request; see the delivery+ report for the CI gate results.++## Rollback++Roll back direct manifests, lockfile, exact release-age exclusions, patch files,+version gates, and compatibility adaptations together. Never mix a patched+1.1.0 package with the 1.3.0 release group. Existing user data needs no migration.diff --git a/docs/project/unreleased.md b/docs/project/unreleased.mdindex 367d66664..da447d18c 100644--- a/docs/project/unreleased.md+++ b/docs/project/unreleased.md@@ -1 +1,6 @@# Unreleased changes++- Upgrade the Pi agent, model adapters, native-session SDK, and MCP client from+ 1.1.0 to 1.3.0. Preserve Desktop compatibility patches, omit foreign-model+ thinking from replay, reject malformed final tool JSON before execution, and+ expose the user-run discriminator to trusted extension startup handlers.diff --git a/docs/spec/02-architecture/02-tech-stack.md b/docs/spec/02-architecture/02-tech-stack.mdindex 12ccdd193..e9c4e2490 100644--- a/docs/spec/02-architecture/02-tech-stack.md+++ b/docs/spec/02-architecture/02-tech-stack.md@@ -12,11 +12,11 @@| 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.1.0 | agent loop |-| Model API | `@earendil-works/pi-ai` | 1.1.0 | provider adapters, OAuth, and stream handling |-| Model catalog | pi-ai Providers/Models | pinned 1.1.0 + explicit provider refresh | account-scoped metadata and typed operations |+| 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 |-> pi-ai owns published metadata, native thinking support, transports and auth.+> models.dev owns published chat metadata; pi-ai owns transports and auth.> Host persists Desktop account rows, credentials, and explicit binding overrides.> Agent Runtime owns desktop context projection and checkpoint compaction. The> transitional pi-coding-agent dependency is confined to native Pi sessiondiff --git a/docs/spec/02-architecture/06-pi-runtime-dependency-boundary.md b/docs/spec/02-architecture/06-pi-runtime-dependency-boundary.mdindex f91008399..26645a2f7 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 ownershipThe sidecar pins `@earendil-works/pi-agent-core`, `pi-ai`, and-`pi-coding-agent` together at exactly `1.1.0`; Desktop's `pi-ai` and `pi-mcp`+`pi-coding-agent` together at exactly `1.3.0`; Desktop's `pi-ai` and `pi-mcp`development dependencies use the same release. Target-release package patchesremain narrow compatibility deltas and are listed with their audited behavior-in `docs/project/pi-110-adoption.md`.+in `docs/project/pi-130-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,@@ -31,7 +31,7 @@ in `docs/project/pi-110-adoption.md`.host-core checkpoint-compaction path, and durable session store do not usethe package's AgentSession.-The extension shim is a versioned compatibility subset, not the full 1.1.0+The extension shim is a versioned compatibility subset, not the full 1.3.0coding-agent API. Its legacy `VERSION` marker remains sourced from`TRUSTED_EXTENSION_KERNEL_VERSION` and intentionally identifies the modeled0.87.1 extension surface.@@ -96,6 +96,14 @@ Do not move removed `pi-agent-core` APIs there as a shortcut.persists through host-core.- Cancellation, provider retry, hosted-search validation, tool ordering, andextension 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+ 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+ continues consuming assistant stream events and final messages.+- The shim marks user `before_agent_start` events with `messageType: "user"`;+ custom-message runs remain unsupported by that shim.- Any future switch to `pi-durable` is independently reviewed because itchanges the runtime/session lifecycle and cannot be inferred from a packageversion update.diff --git a/docs/spec/04-ux/04-builtin-commands.md b/docs/spec/04-ux/04-builtin-commands.mdindex 3b00e5779..2617e5fc2 100644--- a/docs/spec/04-ux/04-builtin-commands.md+++ b/docs/spec/04-ux/04-builtin-commands.md@@ -98,6 +98,11 @@ the composer draft. Former builtin aliases are no longer resolved and arehandled as ordinary unknown slash text unless supplied by another commandsource.+Prompt-template arguments preserve explicitly quoted empty strings (`""` or+`''`) as positional arguments. An empty first argument can activate a template+default without shifting later `$2` / slice substitutions. Ordinary quoting,+literal argument content, and the stored original slash command are unchanged.+When a command completes, it clears only the submitted draft if that draft hasnot been edited since submission. Any newer edit remains—even if the userchanges the text or attachments back to exactly the submitted values—includingdiff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 73b1fa67d..5b00986fa 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -8,6 +8,41 @@## 1. Goals+### E2E-PI-130-kernel-upgrade++- **Preconditions:** Exact Pi 1.3.0 pins and migrated patches in a dedicated+ worktree, isolated fixture state, and no real provider credentials.+- **Steps:** Submit a Desktop turn that receives malformed final tool JSON,+ then a corrected Write call and a final answer. Repeat with a literal invalid+ Unicode escape in the tool input. Resume DeepSeek history using the same and+ a different provider/model identity. Run two turns with extensions that guard+ `before_agent_start` by `messageType === "user"`. Exercise hosted search,+ native Pi continuation, and MCP with existing offline suites.+ Expand a slash template with an empty quoted argument followed by two values;+ exercise strict-tool downgrade, thinking-off, error images, mixed reasoning/text+ stream chunks, and native tool restoration under `noTools: "all"`.+- **Expected:** Malformed calls never reach Host execution; raw input reaches+ the next model request as a tool error, and only the corrected call executes.+ Unicode escapes retain all fields. Same-model thinking replays as reasoning;+ foreign thinking is omitted without altering visible history. Prompt additions+ remain ordered and do not accumulate. Host permissions, persistence, native+ tool restrictions, search replay, and cancellation remain unchanged.+ Empty quoted template arguments retain their positions and activate defaults;+ strict `require` remains strict, hosted search survives downgrade, and native+ historical tool activation cannot bypass Desktop's explicit no-tools setting.+- **Coverage:** `pi-upstream-1.3-contract.test.ts`, `flash-transcript.test.ts`,+ `hosted-search-consumers.test.ts`, `provider-stream-frame-fields.test.ts`,+ `extensions/prompt-chain.test.ts`, `native-pi-session.test.ts`,+ `pi-anthropic-strict-fallback.test.ts`, `pi-1.3-adapter-features.test.ts`,+ `prompt-templates.test.ts`, and the+ existing `test:e2e`, `test:e2e:hosted-search`, `test:e2e:provider-api-style`,+ 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-130-adoption.md`.+### E2E-QUEUE-send-now-wakes-subagents- **Preconditions:** Dedicated request worktree with built workspace packages,@@ -10163,6 +10198,7 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.| Quality (sidebar menu placement) | E2E-021c || 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 — 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/spec/07-plugins/16-trusted-extensions.md b/docs/spec/07-plugins/16-trusted-extensions.mdindex 1250af2c6..cdf0648f1 100644--- a/docs/spec/07-plugins/16-trusted-extensions.md+++ b/docs/spec/07-plugins/16-trusted-extensions.md@@ -348,6 +348,10 @@ additions. Returning a different string, including an empty string, deliberatelyreplaces the current prompt. Missing or non-string prompt fields, exceptions,timeouts, and unreturned input mutations retain the last accepted prompt.Cancelled dispatches return no result; late completions cannot change it.+The user-run payload also carries `messageType: "user"` and `prompt`, matching+the Pi 1.3 discriminator. This is additive to the legacy shim surface; it does+not enable `sendMessage` or custom-message runs. Native Pi sessions continue+using the upstream SDK event union and lifecycle.Each turn starts this chain from its freshly composed base prompt, so additionsdo not accumulate across turns. The same ordered handlers, base, and returneddiff --git a/docs/zh-CN/spec/02-architecture/02-tech-stack.md b/docs/zh-CN/spec/02-architecture/02-tech-stack.mdindex f140bf20f..388f0ff2a 100644--- a/docs/zh-CN/spec/02-architecture/02-tech-stack.md+++ b/docs/zh-CN/spec/02-architecture/02-tech-stack.md@@ -15,11 +15,11 @@| 主机后端 | **Rust** | 稳定的 Rust 工具链 | tools/plugins/permissions/persistence 适配器 || Rust 异步 | 东京 | 稳定 | 主机服务 || 主机 RPC | stdio JSON-RPC (NDJSON) | 冷冻(D001) | Electron 主 ↔ Rust 主机 |-| Agent 引擎 | `@earendil-works/pi-agent-core` | 1.1.0 | Agent 循环及稳定的 agent/event/tool 类型 |-| 模型 API | `@earendil-works/pi-ai` | 1.1.0 | 提供商 |-| Model catalog | pi-ai Providers/Models | pinned 1.1.0 + explicit provider refresh | account-scoped metadata and typed operations |+| 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 |-> pi-ai 提供已发布的模型元数据、原生思考能力、传输和认证。+> models.dev owns published chat metadata; pi-ai owns transports and auth.> Host 持有 Desktop 账户行、凭据和显式绑定覆盖。> Agent Runtime 自行维护桌面上下文投影和检查点压缩。过渡期内,> pi-coding-agent 仅用于原生 Pi 会话续接和可信扩展兼容 shim;它不负责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.mdindex c816acc7c..1bf5205a0 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@@ -9,6 +9,19 @@---+### E2E-PI-130-kernel-upgrade++- **Preconditions:** Pi 1.3.0 with migrated patches, isolated fixture state, and+ no real credentials. Submit malformed tool JSON followed by a corrected call,+ test literal Unicode escapes, resume same/foreign-model thinking, and run two+ turns with extensions that guard `messageType === "user"`.+- **Expected:** No malformed call reaches Host execution; raw errors reach the+ model, corrected calls succeed, foreign thinking is omitted, same-model+ reasoning survives, and prompt additions remain ordered without accumulating.+ Existing hosted-search, native-session, MCP, and cancellation suites remain+ authoritative. See the English source and `docs/project/pi-130-adoption.md`+ for exact coverage and candidate validation.+### E2E-LEGACY-DICTATION-idle-model-release- **前提:** 通过 `VoiceService` 接口测试保留的本地 Dictation 服务,使用确定性的@@ -5781,6 +5794,7 @@ eleven-tool-round desktop paths are verified by| 品质(侧边栏菜单定位) | E2E-021c || 品质(项目排序) | E2E-253 || 品质(工作面板标签关闭按钮可见性) | E2E-WORK-PANEL-active-tab-close-visibility |+| C / E / G / Quality — Pi kernel upgrade | E2E-PI-130-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.jsonindex ffb5f4724..92d4b2a90 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.1.0",- "@earendil-works/pi-ai": "1.1.0",- "@earendil-works/pi-coding-agent": "1.1.0",+ "@earendil-works/pi-agent-core": "1.3.0",+ "@earendil-works/pi-ai": "1.3.0",+ "@earendil-works/pi-coding-agent": "1.3.0","@pi-desktop/shared": "workspace:*","jiti": "2.7.0","typebox": "1.3.27",diff --git a/packages/agent-runtime/src/extensions/prompt-chain.test.ts b/packages/agent-runtime/src/extensions/prompt-chain.test.tsindex fa212b0c4..711a95059 100644--- a/packages/agent-runtime/src/extensions/prompt-chain.test.ts+++ b/packages/agent-runtime/src/extensions/prompt-chain.test.ts@@ -31,9 +31,11 @@ it.each([const extensions = names.map((name) => {const entry = join(root, `${name}.ts`);writeFileSync(entry, `export default function (pi) {- pi.on("before_agent_start", (event) => ({- systemPrompt: event.systemPrompt + "\\n\\nMARKER-${name}"- }));+ pi.on("before_agent_start", (event) => {+ if (event.messageType !== "user") return;+ if (!event.prompt) throw new Error("Missing user prompt");+ return { systemPrompt: event.systemPrompt + "\\n\\nMARKER-${name}" };+ });}`);return { id: name, entry, label: name, root, source: "plugin" as const };});diff --git a/packages/agent-runtime/src/extensions/runner.ts b/packages/agent-runtime/src/extensions/runner.tsindex 0a04921fc..c13544cd4 100644--- a/packages/agent-runtime/src/extensions/runner.ts+++ b/packages/agent-runtime/src/extensions/runner.ts@@ -552,7 +552,7 @@ export class TrustedExtensionRunner {/** Chain prompt replacements within this turn while keeping handler inputs isolated. */async emitBeforeAgentStart(prompt: string, systemPrompt: string): Promise<string | undefined> {- const payload = { type: "before_agent_start", prompt, systemPrompt, systemPromptOptions: {} };+ const payload = { type: "before_agent_start", messageType: "user", prompt, systemPrompt, systemPromptOptions: {} };const result = await this.emit<{ systemPrompt?: string }>("before_agent_start",payload,diff --git a/packages/agent-runtime/src/flash-transcript.test.ts b/packages/agent-runtime/src/flash-transcript.test.tsindex a423319cf..fda87be7f 100644--- a/packages/agent-runtime/src/flash-transcript.test.ts+++ b/packages/agent-runtime/src/flash-transcript.test.ts@@ -136,8 +136,8 @@ describe("Flash reasoning after Desktop session restoration", () => {if (sameModel) {expect(assistant).toMatchObject({ content: "answer", reasoning_content: "private plan" });} else {- expect(assistant?.content).toContain("private plan");- expect(assistant).not.toMatchObject({ reasoning_content: "private plan" });+ expect(assistant?.content).toBe("answer");+ expect(JSON.stringify(captured)).not.toContain("private plan");}} finally { await runtime.dispose(); }});diff --git a/packages/agent-runtime/src/hosted-search-consumers.test.ts b/packages/agent-runtime/src/hosted-search-consumers.test.tsindex 863e6e2ca..ebbe0d414 100644--- a/packages/agent-runtime/src/hosted-search-consumers.test.ts+++ b/packages/agent-runtime/src/hosted-search-consumers.test.ts@@ -1,14 +1,10 @@import { describe, expect, it } from "vitest";import {- AssistantMessageFrameEncoder,LocalRequestError,normalizeContext,- reduceAssistantMessageFrames,} from "@earendil-works/pi-ai";import type {AssistantMessage,- AssistantMessageEvent,- AssistantMessageFrame,HostedSearchContent,Message,Model,@@ -55,13 +51,6 @@ async function mistralRequest(content: AssistantMessage["content"]) {expect(fetches).toBe(1);return body!;}-function encode(events: AssistantMessageEvent[]): AssistantMessageFrame[] {- const encoder = new AssistantMessageFrameEncoder();- return events.flatMap(event => {- const frame = encoder.encode(event);- return frame ? [frame] : [];- });-}describe("hosted-search consumers", () => {describe("Mistral model switches", () => {@@ -86,113 +75,11 @@ describe("hosted-search consumers", () => {expect(message?.tool_calls).toEqual([expect.objectContaining({ id: expect.any(String), type: "function", function: { name: "read", arguments: '{"path":"file"}' } }),]);- expect(JSON.stringify(message?.content)).toContain("retained reasoning");+ expect(JSON.stringify(message)).not.toContain("retained reasoning");expect(mixed.messages.filter(item => item.role === "tool")).toHaveLength(1);});});- describe("in-process assistant frames", () => {- for (const block of searches()) {- it(`round-trips ${block.phase} and the following text index`, () => {- const output = assistant([block, { type: "text", text: "answer" }]);- const frames = encode([- { type: "start", partial: output },- { type: "hosted_search_update", contentIndex: 0, partial: output },- { type: "text_start", contentIndex: 1, partial: output },- { type: "text_end", contentIndex: 1, content: "answer", partial: output },- ]);- expect(frames.map(frame => frame.type)).toEqual(["start", "hosted_search_update", "text_start", "text_end"]);- expect(reduceAssistantMessageFrames(frames)?.content).toEqual(output.content);- });- }- it("replaces snapshots without duplicating blocks and detaches nested wire data", () => {- const block = searches()[2]!;- const output = assistant([block]);- const encoder = new AssistantMessageFrameEncoder();- const start = encoder.encode({ type: "start", partial: output })!;- const first = encoder.encode({ type: "hosted_search_update", contentIndex: 0, partial: output })!;- expect(first).toBeDefined();- if (block.phase !== "web_search_call") throw new Error("unexpected fixture");- block.status = "completed";- block.wire!.status = "completed";- (block.wire!.action as { query: string }).query = "updated query";- const last = encoder.encode({ type: "hosted_search_update", contentIndex: 0, partial: output })!;- expect(reduceAssistantMessageFrames([start, first])?.content[0]).toMatchObject({ status: "in_progress", wire: { action: { query: "local query" } } });- const frames = [start, first, last, last];- const reduced = reduceAssistantMessageFrames(frames)!;- expect(reduced.content).toEqual([block]);- (reduced.content[0] as typeof block).wire!.status = "mutated";- expect(reduceAssistantMessageFrames(frames)?.content).toEqual([block]);- });- it("preserves multiple search rounds, pair IDs, and ordinary block deltas", () => {- const output = assistant([...searches(), { type: "text", text: "" }]);- const encoder = new AssistantMessageFrameEncoder();- const events: AssistantMessageEvent[] = [- { type: "start", partial: output },- ...[0, 1, 2].map(contentIndex => ({ type: "hosted_search_update" as const, contentIndex, partial: output })),- { type: "text_start", contentIndex: 3, partial: output },- { type: "text_delta", contentIndex: 3, delta: "answer", partial: output },- { type: "text_end", contentIndex: 3, content: "answer", partial: output },- ];- const frames = events.map(event => encoder.encode(event)).filter((frame): frame is AssistantMessageFrame => frame !== undefined);- expect(reduceAssistantMessageFrames(frames)?.content).toEqual([...searches(), { type: "text", text: "answer" }]);- });- it("rejects wrong block types, identities, and gaps instead of corrupting content", () => {- const output = assistant([searches()[2]!]);- const start = { type: "start" as const, partial: assistant([]) };- const frame: AssistantMessageFrame = { type: "hosted_search_update", contentIndex: 0, content: searches()[2]! };- expect(() => reduceAssistantMessageFrames([start, { ...frame, contentIndex: 1 } as AssistantMessageFrame])).toThrow(/gap/);- expect(() => reduceAssistantMessageFrames([start, { type: "text_start", contentIndex: 0, content: { type: "text", text: "safe" } }, frame])).toThrow();- expect(() => reduceAssistantMessageFrames([start, frame, { ...frame, content: { ...searches()[2]!, blockId: "other" } } as AssistantMessageFrame])).toThrow();- const encoder = new AssistantMessageFrameEncoder();- encoder.encode({ type: "start", partial: output });- encoder.encode({ type: "hosted_search_update", contentIndex: 0, partial: output });- output.content[0] = { ...searches()[2]!, blockId: "other" };- expect(() => encoder.encode({ type: "hosted_search_update", contentIndex: 0, partial: output })).toThrow();- output.content[0] = { type: "text", text: "safe" };- expect(() => encoder.encode({ type: "hosted_search_update", contentIndex: 0, partial: output })).toThrow();- });- it("does not persist parser scratch buffers or fabricate tool fields", () => {- const streamingBlock = { ...searches()[0]!, index: 0, inputJson: "scratch", partialJson: "scratch" };- const output = assistant([streamingBlock]);- const frames = encode([{ type: "start", partial: output }, { type: "hosted_search_update", contentIndex: 0, partial: output }]);- const reduced = reduceAssistantMessageFrames(frames)!;- expect(reduced.content[0]).toEqual(searches()[0]);- expect(reduced.content[0]).not.toHaveProperty("arguments");- });- it("preserves error-result wire and legacy fallback semantics", () => {- const blocks: HostedSearchContent[] = [- { type: "hostedSearch", phase: "web_search_tool_result", blockId: "s", isError: true, wire: { type: "web_search_tool_result_error", tool_use_id: "s", content: "unavailable" } },- { type: "hostedSearch", phase: "web_search_call", blockId: "legacy" },- ];- const output = assistant(blocks);- const frames = encode([- { type: "start", partial: output },- { type: "hosted_search_update", contentIndex: 0, partial: output },- { type: "hosted_search_update", contentIndex: 1, partial: output },- ]);- expect(reduceAssistantMessageFrames(frames)?.content).toEqual(blocks);- });- it("retains thinking and tool frame behavior after a search block", () => {- const search = searches()[2]!;- const thinking = { type: "thinking" as const, thinking: "", thinkingSignature: "sig" };- const toolCall = { type: "toolCall" as const, id: "tool", name: "read", arguments: {} };- const output = assistant([search, thinking, toolCall]);- const frames = encode([- { type: "start", partial: output },- { type: "hosted_search_update", contentIndex: 0, partial: output },- { type: "thinking_start", contentIndex: 1, partial: output },- { type: "thinking_delta", contentIndex: 1, delta: "reason", partial: output },- { type: "thinking_end", contentIndex: 1, content: "reason", partial: output },- { type: "toolcall_start", contentIndex: 2, partial: output },- { type: "toolcall_delta", contentIndex: 2, delta: '{"path":"file"}', partial: output },- { type: "toolcall_end", contentIndex: 2, toolCall: { ...toolCall, arguments: { path: "file" } }, partial: output },- ]);- expect(reduceAssistantMessageFrames(frames)?.content).toEqual([- search, { ...thinking, thinking: "reason" }, { ...toolCall, arguments: { path: "file" } },- ]);- });- });describe("usage anchors", () => {const response = assistant([{ type: "text", text: "answer" }], 10, 100);diff --git a/packages/agent-runtime/src/native-pi-session.test.ts b/packages/agent-runtime/src/native-pi-session.test.tsindex 4c3dd9395..8b5269984 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 AssistantMessage } from "@earendil-works/pi-ai";+import { createAssistantMessageEventStream, Type, type AssistantMessage } from "@earendil-works/pi-ai";import { NativePiSessionService } from "./native-pi-session.js";import {acquireNativePiSessionLease,@@ -1280,8 +1280,14 @@ describe("independent native ownership, identity and tool regressions", () => {} finally { service.disposeAll(); }});- it("sends zero native tools to the model", async () => {+ it.each([false, true])("sends zero native tools even with restored active tools: %s", async (restoreTools) => {const f = await configuredFixture();+ if (restoreTools) {+ SessionManager.open(f.file).appendMessage({+ role: "system", content: "Previously active tools", timestamp: Date.now(),+ toolsAdded: [{ name: "bash", description: "Native shell", parameters: Type.Object({ command: Type.String() }) }],+ });+ }const requests: unknown[] = [];vi.spyOn(ModelRuntime.prototype, "streamSimple").mockImplementation((_model, context) => { requests.push(context.tools ?? []); return fauxStream(); });const service = new NativePiSessionService(f);diff --git a/packages/agent-runtime/src/pi-1.3-adapter-features.test.ts b/packages/agent-runtime/src/pi-1.3-adapter-features.test.tsnew file mode 100644index 000000000..e72d96237--- /dev/null+++ b/packages/agent-runtime/src/pi-1.3-adapter-features.test.ts@@ -0,0 +1,126 @@+import { describe, expect, it } from "vitest";+import { normalizeContext, type AssistantMessage, type Message } from "@earendil-works/pi-ai";+import { getBuiltinModel } from "@earendil-works/pi-ai/providers/all";+import { buildProviderModel, createProviderModels, type RuntimeProviderConfig } from "./provider-binding.js";+import { modelConfigFromPi } from "./model-capabilities.js";+import { classifyProviderError, isTransientProviderRetryCode } from "./provider-retry.js";++function anthropic(id: "claude-haiku-5-5" | "claude-opus-5" = "claude-haiku-5-5"): RuntimeProviderConfig {+ const builtin = getBuiltinModel("anthropic", id);+ if (!builtin) throw new Error(`Missing fixture model: ${id}`);+ return {+ id: "desktop-account", name: "Fixture", vendorKey: "anthropic", modelId: id,+ baseUrl: builtin.baseUrl, apiStyle: "anthropic_messages", apiKey: "fixture",+ supportsReasoning: true, supportedThinkingLevels: ["off", "high"],+ modelConfig: { ...modelConfigFromPi(builtin), webSearch: true },+ };+}++function anthropicResponse(): Response {+ const events = [+ { type: "message_start", message: { id: "reply", type: "message", role: "assistant", content: [], usage: { input_tokens: 1, output_tokens: 0 } } },+ { type: "message_delta", delta: { stop_reason: "end_turn" }, usage: { output_tokens: 0 } },+ { type: "message_stop" },+ ];+ return new Response(events.map((event) => `event: ${event.type}\ndata: ${JSON.stringify(event)}\n\n`).join(""), {+ headers: { "content-type": "text/event-stream" },+ });+}++type Block = { type: string; name?: string; content?: string | Block[]; thinking?: string; source?: { data: string } };+type Payload = { thinking?: { type: string }; output_config?: unknown; tools: Block[]; messages: Array<{ role: string; content: string | Block[]; output_config?: unknown }> };++async function anthropicRequest(provider: RuntimeProviderConfig, messages: Message[], thinking: "off" | "high" = "off"): Promise<Payload> {+ let payload: Payload | undefined;+ const model = buildProviderModel(provider);+ const result = await createProviderModels(provider, model).streamSimple(model, { messages }, {+ reasoning: thinking === "off" ? undefined : thinking, maxRetries: 0,+ fetch: async (_url, init) => {+ payload = JSON.parse(String(init?.body));+ return anthropicResponse();+ },+ }).result();+ expect(result.stopReason).toBe("stop");+ if (!payload) throw new Error("No fixture request");+ return payload;+}++const usage: AssistantMessage["usage"] = {+ input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0,+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },+};++describe("Pi 1.3 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" });+ expect(payload.output_config).toBeUndefined();+ expect(payload.messages.every((message) => message.output_config === undefined)).toBe(true);+ expect(payload.tools).toContainEqual({ type: "web_search_20250305", name: "web_search" });+ });++ it("keeps all tool results before images removed from error tool results", async () => {+ const provider = anthropic();+ const model = buildProviderModel(provider);+ const image = { type: "image" as const, mimeType: "image/png", data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIHWP4z8DwHwAFgAI/ScLbtAAAAABJRU5ErkJggg==" };+ const messages: Message[] = [+ { role: "user", content: "Check images", timestamp: 1 },+ { role: "assistant", api: model.api, provider: model.provider, model: model.id,+ content: [+ { type: "toolCall", id: "failed", name: "Read", arguments: { path: "failed.png" } },+ { type: "toolCall", id: "success", name: "Read", arguments: { path: "success.png" } },+ ], usage, stopReason: "toolUse", timestamp: 2 },+ { role: "toolResult", toolCallId: "failed", toolName: "Read", isError: true, content: [{ type: "text", text: "Image error" }, image], timestamp: 3 },+ { role: "toolResult", toolCallId: "success", toolName: "Read", isError: false, content: [{ type: "text", text: "Image ready" }, image], timestamp: 4 },+ ];+ const payload = await anthropicRequest(provider, messages);+ const turn = payload.messages.find((message) => Array.isArray(message.content) && message.content.some((block) => block.type === "tool_result"));+ const content = turn?.content;+ if (!Array.isArray(content)) throw new Error("Missing tool-result turn");+ expect(content.slice(0, 2).map((block) => block.type)).toEqual(["tool_result", "tool_result"]);+ expect(typeof content[0]?.content).toBe("string");+ expect(content[0]?.content).toContain("Image error");+ const successContent = content[1]?.content;+ if (!Array.isArray(successContent)) throw new Error("Missing successful image content");+ expect(successContent.map((block) => block.type)).toEqual(["text", "image"]);+ expect(content.at(-1)).toMatchObject({ type: "image", source: { data: image.data } });+ expect(messages[2]?.content).toHaveLength(2);+ });++ it("delivers thinking before text when a proxy combines both in one stream chunk", async () => {+ const provider: RuntimeProviderConfig = {+ id: "proxy-account", name: "Fixture", modelId: "fixture", apiKey: "fixture",+ baseUrl: "https://fixture.invalid/v1", supportsReasoning: true, supportedThinkingLevels: ["off", "high"],+ };+ const model = buildProviderModel(provider);+ const response = createProviderModels(provider, model).streamSimple(model, normalizeContext({+ messages: [{ role: "user", content: "Hello", timestamp: 1 }],+ }), {+ reasoning: "high", maxRetries: 0,+ fetch: async () => new Response('data: {"choices":[{"index":0,"delta":{"reasoning_content":"Plan","content":"Answer"},"finish_reason":"stop"}]}\n\ndata: [DONE]\n\n', {+ headers: { "content-type": "text/event-stream" },+ }),+ });+ const starts: string[] = [];+ for await (const event of response) {+ if (event.type === "thinking_start" || event.type === "text_start") starts.push(event.type);+ }+ const final = await response.result();+ expect(final.stopReason).toBe("stop");+ expect(starts).toEqual(["thinking_start", "text_start"]);+ expect(final.content.map((block) => block.type)).toEqual(["thinking", "text"]);+ });++ it.each([+ "Unable to forward upstream stream",+ "The service is temporarily unavailable",+ "The upstream provider returned an error",+ ])("classifies the newly recognized transient failure for Desktop retries: %s", (errorMessage) => {+ const error = classifyProviderError({+ role: "assistant", api: "openai-completions", provider: "fixture", model: "fixture",+ content: [], usage, timestamp: 1, stopReason: "error", errorMessage,+ });+ expect(error.retriable).toBe(true);+ expect(isTransientProviderRetryCode(error.code)).toBe(true);+ });+});diff --git a/packages/agent-runtime/src/pi-anthropic-strict-fallback.test.ts b/packages/agent-runtime/src/pi-anthropic-strict-fallback.test.tsnew file mode 100644index 000000000..26e478439--- /dev/null+++ b/packages/agent-runtime/src/pi-anthropic-strict-fallback.test.ts@@ -0,0 +1,109 @@+import { normalizeContext, Type, type Message, type Model } from "@earendil-works/pi-ai";+import { stream } from "@earendil-works/pi-ai/api/anthropic-messages";+import { describe, expect, it } from "vitest";++const model: Model<"anthropic-messages"> = {+ id: "claude-fixture", name: "Fixture", api: "anthropic-messages", provider: "anthropic",+ baseUrl: "https://fixture.invalid", reasoning: false, input: ["text"],+ contextWindow: 100_000, maxTokens: 1000,+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },+ compat: { supportsStrictTools: true },+ webSearch: true,+};+const messages: Message[] = [+ { role: "system", content: "Fixture", timestamp: 1, toolsAdded: [+ { name: "preferred", description: "Preferred", parameters: Type.Object({ path: Type.String() }), constrainedSampling: { type: "json_schema", strict: "prefer" } },+ { name: "required", description: "Required", parameters: Type.Object({ path: Type.String() }), constrainedSampling: { type: "json_schema", strict: "require" } },+ ] },+ { role: "user", content: "Continue", timestamp: 2 },+];++function completedResponse(): Response {+ const events = [+ { type: "message_start", message: { id: "reply", type: "message", role: "assistant", model: model.id, content: [], usage: { input_tokens: 1, output_tokens: 0 } } },+ { type: "content_block_start", index: 0, content_block: { type: "text", text: "" } },+ { type: "content_block_delta", index: 0, delta: { type: "text_delta", text: "Done" } },+ { type: "content_block_stop", index: 0 },+ { type: "message_delta", delta: { stop_reason: "end_turn" }, usage: { output_tokens: 1 } },+ { type: "message_stop" },+ ];+ return new Response(events.map((event) => `event: ${event.type}\ndata: ${JSON.stringify(event)}\n\n`).join(""), {+ headers: { "content-type": "text/event-stream" },+ });+}++function strictError(message: string): Response {+ return new Response(JSON.stringify({ type: "error", error: { type: "invalid_request_error", message } }), {+ status: 400, headers: { "content-type": "application/json" },+ });+}++describe("Anthropic strict fallback with Desktop patches", () => {+ it.each(["callback", "serialization"])("classifies second-attempt %s failures as local preparation errors", async (failure) => {+ let payloads = 0;+ let fetches = 0;+ const response = await stream(model, normalizeContext({ messages }), {+ apiKey: "fixture", maxRetries: 0,+ onPayload: (payload) => {+ payloads += 1;+ if (payloads === 1) return undefined;+ if (failure === "callback") throw new TypeError("private fixture payload");+ const circular: Record<string, unknown> = {};+ circular.self = circular;+ return circular;+ },+ fetch: async (_url, init) => {+ fetches += 1;+ const body = JSON.parse(String(init?.body)) as { tools: Array<{ name: string; strict?: boolean }> };+ expect(body.tools).toEqual(expect.arrayContaining([+ expect.objectContaining({ name: "preferred", strict: true }),+ expect.objectContaining({ name: "required", strict: true }),+ expect.objectContaining({ name: "web_search" }),+ ]));+ return new Response(JSON.stringify({ type: "error", error: {+ type: "invalid_request_error", message: "The compiled grammar is too large",+ } }), { status: 400, headers: { "content-type": "application/json" } });+ },+ }).result();+ expect(payloads).toBe(2);+ expect(fetches).toBe(1);+ expect(response.stopReason).toBe("error");+ expect(response.errorDetails).toMatchObject({ code: "LOCAL_REQUEST_ERROR", phase: "request-preparation" });+ expect(response.errorMessage).not.toContain("private fixture");+ });++ it.each([+ "The compiled grammar is too large",+ "Too many strict tools (20)",+ "Schemas contains too many parameters with union types (20)",+ ])("downgrades only preferred tools after %s and preserves hosted search", async (message) => {+ const payloads: Array<{ tools: Array<{ name: string; strict?: boolean }> }> = [];+ const response = await stream(model, normalizeContext({ messages }), {+ apiKey: "fixture", maxRetries: 0,+ fetch: async (_url, init) => {+ payloads.push(JSON.parse(String(init?.body)));+ return payloads.length === 1 ? strictError(message) : completedResponse();+ },+ }).result();+ expect(response.stopReason).toBe("stop");+ expect(payloads).toHaveLength(2);+ expect(payloads[0]?.tools.find((tool) => tool.name === "preferred")?.strict).toBe(true);+ expect(payloads[1]?.tools.find((tool) => tool.name === "preferred")).not.toHaveProperty("strict");+ expect(payloads[1]?.tools.find((tool) => tool.name === "required")?.strict).toBe(true);+ expect(payloads[1]?.tools).toContainEqual({ type: "web_search_20250305", name: "web_search" });+ });++ it.each([+ { message: "The compiled grammar is too large", attempts: 2 },+ { message: "Invalid authentication setting", attempts: 1 },+ ])("bounds fallback and does not retry unrelated failures: $message", async ({ message, attempts }) => {+ let fetches = 0;+ const response = await stream(model, normalizeContext({ messages }), {+ apiKey: "fixture", maxRetries: 0,+ fetch: async () => { fetches += 1; return strictError(message); },+ }).result();+ expect(response.stopReason).toBe("error");+ expect(response.errorDetails).toBeUndefined();+ expect(fetches).toBe(attempts);+ });+});diff --git a/packages/agent-runtime/src/pi-upstream-1.3-contract.test.ts b/packages/agent-runtime/src/pi-upstream-1.3-contract.test.tsnew file mode 100644index 000000000..60d59f1c4--- /dev/null+++ b/packages/agent-runtime/src/pi-upstream-1.3-contract.test.ts@@ -0,0 +1,96 @@+import type { Agent } from "@earendil-works/pi-agent-core";+import type { Model } from "@earendil-works/pi-ai";+import { stream } from "@earendil-works/pi-ai/api/openai-completions";+import { describe, expect, it } from "vitest";+import { DesktopAgentRuntime } from "./runtime.js";++type Request = {+ messages: Array<{ role: string; content?: unknown; tool_call_id?: string }>;+};++function toolReply(id: string, args: string): Response {+ return new Response(`data: ${JSON.stringify({ choices: [{ index: 0, delta: {+ tool_calls: [{ index: 0, id, type: "function", function: { name: "Write", arguments: args } }],+ }, finish_reason: "tool_calls" }] })}\n\ndata: [DONE]\n\n`, {+ headers: { "content-type": "text/event-stream" },+ });+}++function finalReply(): Response {+ return new Response('data: {"choices":[{"index":0,"delta":{"content":"Saved."},"finish_reason":"stop"}]}\n\ndata: [DONE]\n\n', {+ headers: { "content-type": "text/event-stream" },+ });+}++function fixture() {+ const executions: unknown[] = [];+ const requests: Request[] = [];+ const runtime = new DesktopAgentRuntime({+ sessionId: "pi-1.3-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",+ baseUrl: "http://localhost/v1", supportsReasoning: false, supportedThinkingLevels: ["off"],+ },+ host: {+ call: async <T>(method: string, params?: unknown): Promise<T> => {+ if (method === "tools.execute") {+ executions.push(params);+ return { ok: true, content: { path: "saved.txt", bytes: 6 } } as T;+ }+ return undefined as T;+ },+ },+ onEvent: () => {},+ });+ const agent = (runtime as unknown as { agent: Agent }).agent;+ const respond = (reply: (round: number) => Response) => {+ agent.streamFunction = (model, context) => stream(model as Model<"openai-completions">, context, {+ apiKey: "fixture", maxRetries: 0,+ fetch: async (_url, init) => {+ requests.push(JSON.parse(String(init?.body)));+ if (requests.length > 3) throw new Error("Unexpected extra model request");+ return reply(requests.length);+ },+ });+ };+ return { runtime, executions, requests, respond, agent };+}++describe("Pi 1.3 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",';+ respond((round) => round === 1 ? toolReply("bad-call", malformed)+ : round === 2 ? toolReply("good-call", '{"path":"saved.txt","content":"ready"}')+ : finalReply());+ try {+ await runtime.prompt("Save the file.", "user", "turn");+ expect(executions).toEqual([expect.objectContaining({+ toolName: "Write", args: { path: "saved.txt", content: "ready" },+ })]);+ const rejected = requests[1]?.messages.find((message) => message.role === "tool" && message.tool_call_id === "bad-call");+ expect(rejected?.content).toContain(malformed);+ expect(agent.state.messages.at(-1)).toMatchObject({+ role: "assistant", stopReason: "stop", content: [{ type: "text", text: "Saved." }],+ });+ } finally {+ await runtime.dispose();+ }+ });++ it("keeps all fields when a tool string contains a literal invalid Unicode escape", async () => {+ const { runtime, executions, respond } = fixture();+ respond((round) => round === 1+ ? toolReply("latex-call", String.raw`{"content":"\usepackage{amsmath}","path":"saved.txt"}`)+ : finalReply());+ try {+ await runtime.prompt("Save the LaTeX file.", "user", "turn");+ expect(executions).toEqual([expect.objectContaining({+ toolName: "Write", args: { path: "saved.txt", content: String.raw`\usepackage{amsmath}` },+ })]);+ } finally {+ await runtime.dispose();+ }+ });+});diff --git a/packages/agent-runtime/src/prompt-templates.test.ts b/packages/agent-runtime/src/prompt-templates.test.tsindex fd36a9dff..a14c917b2 100644--- a/packages/agent-runtime/src/prompt-templates.test.ts+++ b/packages/agent-runtime/src/prompt-templates.test.ts@@ -35,6 +35,16 @@ describe("expandSlashInvocation", () => {);});+ it.each(['""', "''"])("keeps an empty quoted argument %s without shifting later positions", (empty) => {+ const template = { name: "defaults", content: "first=${1:-fallback}; second=$2; tail=${@:2}" };+ const command = `/defaults ${empty} next last`;+ expect(expandSlashInvocation(command, [template])).toEqual({+ expanded: "first=fallback; second=next; tail=next last", command,+ });+ expect(expandSlashInvocation(`/defaults first ${empty}`, [template])?.expanded)+ .toBe("first=first; second=; tail=");+ });+it("preserves pi's default placeholders without recursively expanding arguments", () => {const template = {name: "defaults",diff --git a/packages/agent-runtime/src/prompt-templates.ts b/packages/agent-runtime/src/prompt-templates.tsindex 7c4466439..7bad1b54e 100644--- a/packages/agent-runtime/src/prompt-templates.ts+++ b/packages/agent-runtime/src/prompt-templates.ts@@ -298,6 +298,7 @@ export type SlashExpansion = {export function parseCommandArgs(argsString: string): string[] {const args: string[] = [];let current = "";+ let hasToken = false;let inQuote: "'" | '"' | null = null;for (const char of argsString) {if (inQuote) {@@ -305,16 +306,19 @@ export function parseCommandArgs(argsString: string): string[] {else current += char;} else if (char === '"' || char === "'") {inQuote = char;+ hasToken = true;} else if (char === " " || char === "\t") {- if (current) {+ if (hasToken) {args.push(current);current = "";+ hasToken = false;}} else {current += char;+ hasToken = true;}}- if (current) args.push(current);+ if (hasToken) args.push(current);return args;}diff --git a/packages/agent-runtime/src/provider-stream-frame-fields.test.ts b/packages/agent-runtime/src/provider-stream-frame-fields.test.tsindex a8317f415..e83365f37 100644--- a/packages/agent-runtime/src/provider-stream-frame-fields.test.ts+++ b/packages/agent-runtime/src/provider-stream-frame-fields.test.ts@@ -1,24 +1,17 @@import { describe, expect, it } from "vitest";import {- AssistantMessageFrameEncoder,+ type AssistantMessage,+ type AssistantMessageEvent,type AssistantMessageEventStream,- type AssistantMessageFrame,type Model,} from "@earendil-works/pi-ai";import { stream as streamAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";import { stream as streamOpenAIResponses } from "@earendil-works/pi-ai/api/openai-responses";-// A gateway that re-serializes provider events with `omitempty` (Go) or drops-// `undefined` (JS) sends a delta event whose string field is simply absent-// instead of `""`. Issue #883: the assistant message frame encoder read-// `.length` off that missing field, threw a bare TypeError, and the runtime-// reported it as a retriable provider failure that then reproduced on every-// later turn of the session — a fork inherited it and a new session was clean.-//-// These tests drive the real stream decoders with a stubbed transport and feed-// every event through the real frame encoder, because that pair is where the-// failure lived. They guard `patches/@[email protected]`; if-// the patch is dropped, they fail again.+// Exercise real provider stream decoders with omitted empty string fields.+// Pi 1.3 removed the experimental frame codec; Desktop consumes the stream+// events and final message directly. Keep the decoder regression coverage+// without recreating the removed codec or depending on its private behavior.const context = {messages: [@@ -70,25 +63,29 @@ function fetchReturning(body: string): typeof fetch {type Outcome = {error: Error | undefined;eventTypes: string[];- frames: AssistantMessageFrame[];+ frames: AssistantMessageEvent[];+ message?: AssistantMessage;};-/** Decode the stub body and run every decoder event through the frame encoder. */+/** Decode the fixture and capture the stream events and final message. */async function drive(stream: AssistantMessageEventStream): Promise<Outcome> {- const encoder = new AssistantMessageFrameEncoder();const eventTypes: string[] = [];- const frames: AssistantMessageFrame[] = [];+ const frames: AssistantMessageEvent[] = [];try {for await (const event of stream) {+ if (event.type === "text_delta" || event.type === "thinking_delta" || event.type === "toolcall_delta") {+ expect(typeof event.delta).toBe("string");+ }eventTypes.push(event.type);- const frame = encoder.encode(event);- if (frame !== undefined) frames.push(frame);+ frames.push(structuredClone(event));}- await stream.result();+ const message = await stream.result();+ expect(message.stopReason).not.toBe("error");+ expect(JSON.stringify(message.content)).not.toContain("undefined");+ return { error: undefined, eventTypes, frames, message };} catch (error) {return { error: error as Error, eventTypes, frames };}- return { error: undefined, eventTypes, frames };}const anthropic = <T extends { type: string }>(events: readonly T[]) =>@@ -107,18 +104,18 @@ const responses = <T extends { type: string }>(events: readonly T[]) =>}),);-/** Every delta a persisted frame claims, in order. */-function frameDeltas(frames: AssistantMessageFrame[]): string[] {+/** Nonempty decoder deltas, in delivery order. */+function frameDeltas(frames: AssistantMessageEvent[]): string[] {return frames.flatMap((frame) =>frame.type === "text_delta" ||frame.type === "thinking_delta" ||frame.type === "toolcall_delta"- ? [frame.delta]+ ? typeof frame.delta === "string" && frame.delta.length > 0 ? [frame.delta] : []: [],);}-function settledText(frames: AssistantMessageFrame[]): string | undefined {+function settledText(frames: AssistantMessageEvent[]): string | undefined {for (const frame of frames) {if (frame.type === "text_end") return frame.content;}@@ -211,8 +208,7 @@ describe("provider stream frames with an omitted empty string field (issue #883)]);expect(outcome.error).toBeUndefined();- // The decoder still emitted the delta event; the encoder skipped it rather- // than reading `.length` off `undefined`.+ // An omitted provider field must not corrupt the final message.expect(outcome.eventTypes).toContain("text_delta");expect(frameDeltas(outcome.frames)).toEqual([]);// The dropped field can only have been the empty string, so the settleddiff --git a/packages/agent-runtime/src/reasoning-replay.ts b/packages/agent-runtime/src/reasoning-replay.tsindex 4d8e614db..97fa73d3f 100644--- a/packages/agent-runtime/src/reasoning-replay.ts+++ b/packages/agent-runtime/src/reasoning-replay.ts@@ -9,8 +9,8 @@* reintroducing tool-call pairs or multiple user prompts (ADR 0136 / D275).** Replayed assistants must carry the live request's api/provider/model: pi-ai- * `transformMessages` converts thinking to plain text when the assistant is from- * a different model, which would drop reasoning_* on the wire.+ * drops thinking from a different model, which would remove reasoning_* from+ * the wire instead of retaining same-model replay.*/import type { AgentMessage } from "@earendil-works/pi-agent-core";diff --git a/patches/@[email protected] b/patches/@[email protected]similarity index 97%rename from patches/@[email protected]rename to patches/@[email protected]index 9036edeea..9bd2bd925 100644--- a/patches/@[email protected]+++ b/patches/@[email protected]@@ -1,5 +1,5 @@diff --git a/dist/agent-loop.js b/dist/agent-loop.js-index 77af960..b2faa02 100644+index 77af96018..b2faa02b9 100644--- a/dist/agent-loop.js+++ b/dist/agent-loop.js@@ -294,6 +294,12 @@ async function streamAssistantResponse(context, config, signal, emit, streamFunc@@ -16,7 +16,7 @@ index 77af960..b2faa02 100644partialMessage = event.partial;context.messages[context.messages.length - 1] = partialMessage;diff --git a/dist/agent.js b/dist/agent.js-index a8ccfc0..0f98e47 100644+index a8ccfc0bd..0f98e4736 100644--- a/dist/agent.js+++ b/dist/agent.js@@ -1,3 +1,4 @@diff --git a/patches/@[email protected] b/patches/@[email protected]similarity index 82%rename from patches/@[email protected]rename to patches/@[email protected]index 4ab80d45d..1e34fd3db 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 38571b3..27867e8 100644+index befb18b2e..ae082a9bb 100644--- a/dist/api/anthropic-messages.js+++ b/dist/api/anthropic-messages.js@@ -1,3 +1,6 @@@@ -9,16 +9,16 @@ index 38571b3..27867e8 100644import 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";-@@ -375,8 +378,6 @@ async function* iterateAnthropicEvents(response, signal) {+@@ -378,8 +381,6 @@ async function* iterateAnthropicEvents(response, signal) {}export const stream = (model, context, options) => {const stream = new AssistantMessageEventStream();- const normalizedContext = resolveTranscript(context, getAnthropicCompat(model).supportsMidConvoSystemMessages);- const currentTools = getCurrentTools(normalizedContext.messages);(async () => {- const providerThinkingLevel = model.compat?.supportsMidConvoEffort ? (options?.effort ?? "high") : undefined;const output = {-@@ -397,7 +398,11 @@ export const stream = (model, context, options) => {+ role: "assistant",+@@ -398,7 +399,11 @@ export const stream = (model, context, options) => {stopReason: "pending",timestamp: Date.now(),};@@ -30,16 +30,24 @@ index 38571b3..27867e8 100644let client;let isOAuth;let usageModel = model;-@@ -435,6 +440,8 @@ export const stream = (model, context, options) => {- ...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),- maxRetries: 0,- };-+ JSON.stringify(params);-+ preparingRequest = false;- const response = await retryProviderRequest(() => client.beta.messages.create(params, requestOptions).asResponse(), {- maxRetries: options?.maxRetries,- maxRetryDelayMs: options?.maxRetryDelayMs,-@@ -520,17 +527,50 @@ export const stream = (model, context, options) => {+@@ -434,6 +439,7 @@ export const stream = (model, context, options) => {+ let disablePreferredStrictTools = false;+ let response;+ for (;;) {++ preparingRequest = true;+ options?.signal?.throwIfAborted();+ const built = buildParams(model, normalizedContext, isOAuth, options, disablePreferredStrictTools);+ if (built.providerThinkingLevel)+@@ -443,6 +449,8 @@ export const stream = (model, context, options) => {+ if (nextParams !== undefined) {+ params = { ...nextParams, stream: true };+ }++ JSON.stringify(params);++ preparingRequest = false;+ try {+ response = await retryProviderRequest(() => client.beta.messages.create(params, requestOptions).asResponse(), {+ maxRetries: options?.maxRetries,+@@ -555,17 +563,50 @@ export const stream = (model, context, options) => {output.content.push(block);stream.push({ type: "toolcall_start", contentIndex: output.content.length - 1, partial: output });}@@ -92,7 +100,7 @@ index 38571b3..27867e8 100644partial: output,});}-@@ -539,11 +579,11 @@ export const stream = (model, context, options) => {+@@ -574,11 +615,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") {@@ -106,7 +114,7 @@ index 38571b3..27867e8 100644partial: output,});}-@@ -552,12 +592,24 @@ export const stream = (model, context, options) => {+@@ -587,12 +628,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") {@@ -133,7 +141,7 @@ index 38571b3..27867e8 100644partial: output,});}-@@ -567,7 +619,19 @@ export const stream = (model, context, options) => {+@@ -602,7 +655,19 @@ export const stream = (model, context, options) => {const block = blocks[index];if (block && block.type === "thinking") {block.thinkingSignature = block.thinkingSignature || "";@@ -154,7 +162,7 @@ index 38571b3..27867e8 100644}}}-@@ -604,6 +668,12 @@ export const stream = (model, context, options) => {+@@ -639,6 +704,12 @@ export const stream = (model, context, options) => {partial: output,});}@@ -167,7 +175,7 @@ index 38571b3..27867e8 100644}}else if (event.type === "message_delta") {-@@ -676,13 +746,18 @@ export const stream = (model, context, options) => {+@@ -711,13 +782,18 @@ export const stream = (model, context, options) => {stream.end();}catch (error) {@@ -187,7 +195,7 @@ index 38571b3..27867e8 100644stream.push({ type: "error", reason: output.stopReason, error: output });stream.end();}-@@ -710,7 +785,7 @@ function mapThinkingLevelToEffort(model, level) {+@@ -745,7 +821,7 @@ function mapThinkingLevelToEffort(model, level) {return "high";}}@@ -196,7 +204,7 @@ index 38571b3..27867e8 100644if (!getAnthropicFederation(model, options?.apiKey, options?.headers, options?.env)) {assertRequestAuth(model.provider, options?.apiKey, options?.headers);}-@@ -744,7 +819,7 @@ export const streamSimple = (model, context, options) => {+@@ -779,7 +855,7 @@ export const streamSimple = (model, context, options) => {thinkingEnabled: true,thinkingBudgetTokens: Math.min(adjusted.thinkingBudget, Math.max(0, maxTokens - 1024)),});@@ -205,8 +213,8 @@ index 38571b3..27867e8 100644function isOAuthToken(apiKey) {return apiKey.includes("sk-ant-oat");}-@@ -933,6 +1008,15 @@ function buildParams(model, context, isOAuthToken, options) {- params.tools = convertTools(tools, isOAuthToken, compat.supportsEagerToolInputStreaming, compat.supportsStrictTools, toolCacheControl);+@@ -975,6 +1051,15 @@ function buildParams(model, context, isOAuthToken, options, disablePreferredStri+ params.tools = convertToolDefinitions(tools, toolCacheControl);}}+ // Hosted web search (PI-Desktop): attach the server-side tool when the@@ -218,10 +226,10 @@ index 38571b3..27867e8 100644+ { type: "web_search_20250305", name: "web_search" },+ ];+ }- // Managed effort models always use adaptive thinking so prefix mismatches can- // be dropped instead of surfacing as persistent 400 responses.- if (model.compat?.supportsMidConvoEffort === true) {-@@ -1141,6 +1225,15 @@ convertToolDefinitions) {+ if (thinkingDisabled) {+ // No effort is sent, so the model default applies. Anthropic rejects `block_binding`+ // with disabled thinking.+@@ -1176,6 +1261,15 @@ convertToolDefinitions) {input: block.arguments ?? {},});}@@ -238,7 +246,7 @@ index 38571b3..27867e8 100644if (blocks.length === 0)continue;diff --git a/dist/api/azure-openai-responses.js b/dist/api/azure-openai-responses.js-index 4615b1e..66929ee 100644+index 4615b1e50..66929eeaf 100644--- a/dist/api/azure-openai-responses.js+++ b/dist/api/azure-openai-responses.js@@ -1,3 +1,5 @@@@ -339,10 +347,10 @@ index 4615b1e..66929ee 100644const samplingParams = resolveSamplingParams(model, reasoningEffort ?? "off", options?.samplingParams);if (samplingParams) {diff --git a/dist/api/mistral-conversations.js b/dist/api/mistral-conversations.js-index 2fc3ad3..b2bd5e6 100644+index 9038a1c49..afbc300a2 100644--- a/dist/api/mistral-conversations.js+++ b/dist/api/mistral-conversations.js-@@ -658,6 +658,9 @@ function toChatMessages(messages, supportsImages) {+@@ -674,6 +674,9 @@ function toChatMessages(messages, supportsImages) {}continue;}@@ -353,10 +361,10 @@ index 2fc3ad3..b2bd5e6 100644id: block.id,type: "function",diff --git a/dist/api/openai-codex-responses.js b/dist/api/openai-codex-responses.js-index 6ee63ec..d8f572c 100644+index 42aac9d5f..6001ce47a 100644--- a/dist/api/openai-codex-responses.js+++ b/dist/api/openai-codex-responses.js-@@ -411,6 +411,12 @@ function buildRequestBody(model, context, options, cacheSessionId, grammarToolIn+@@ -412,6 +412,12 @@ function buildRequestBody(model, context, options, cacheSessionId, grammarToolInsupportsOpenAIGrammarTools,});}@@ -370,10 +378,10 @@ index 6ee63ec..d8f572c 100644const effort = options.reasoningEffort === "none"? model.thinkingLevelMap?.off === undefineddiff --git a/dist/api/openai-completions.js b/dist/api/openai-completions.js-index a60f393..f03916c 100644+index 0eeaffa96..50ceb5fdd 100644--- a/dist/api/openai-completions.js+++ b/dist/api/openai-completions.js-@@ -1044,21 +1044,27 @@ export function convertMessages(model, context, compat, options) {+@@ -1046,21 +1046,27 @@ export function convertMessages(model, context, compat, options) {if (preservedReasoningDetails) {assistantMsg.reasoning_details = preservedReasoningDetails;}@@ -407,7 +415,7 @@ index a60f393..f03916c 100644}params.push(assistantMsg);}-@@ -1126,6 +1132,41 @@ export function convertMessages(model, context, compat, options) {+@@ -1128,6 +1134,41 @@ export function convertMessages(model, context, compat, options) {}lastRole = msg.role;}@@ -449,7 +457,7 @@ index a60f393..f03916c 100644return params;}function convertTools(tools, compat) {-@@ -1270,6 +1311,9 @@ function detectCompat(model) {+@@ -1272,6 +1313,9 @@ function detectCompat(model) {requiresAssistantAfterToolResult: false,requiresThinkingAsText: false,requiresReasoningContentOnAssistantMessages: isDeepSeek,@@ -459,7 +467,7 @@ index a60f393..f03916c 100644thinkingFormat: isDeepSeek? "deepseek": isZai-@@ -1323,6 +1367,8 @@ function getCompat(model) {+@@ -1325,6 +1369,8 @@ function getCompat(model) {requiresThinkingAsText: model.compat.requiresThinkingAsText ?? detected.requiresThinkingAsText,requiresReasoningContentOnAssistantMessages: model.compat.requiresReasoningContentOnAssistantMessages ??detected.requiresReasoningContentOnAssistantMessages,@@ -469,14 +477,14 @@ index a60f393..f03916c 100644openRouterRouting: 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 f413fe5..af7832b 100644+index af5f04228..634579049 100644--- a/dist/api/openai-responses-shared.js+++ b/dist/api/openai-responses-shared.js@@ -1,3 +1,4 @@+import { hostedSearchReplayProjection, validateHostedSearchMessages } from "../utils/hosted-search.js";import { calculateCost } from "../models.js";import { shortHash } from "../utils/hash.js";- import { parseStreamingJson } from "../utils/json-parse.js";+ import { parseStreamingJson, parseToolCallArguments } from "../utils/json-parse.js";@@ -62,6 +63,7 @@ function convertToolResultOutput(model, content) {// =============================================================================export function convertResponsesMessages(model, context, allowedToolCallProviders, options) {@@ -485,7 +493,7 @@ index f413fe5..af7832b 100644const messages = [];const normalizeIdPart = (part) => {const sanitized = part.replace(/[^a-zA-Z0-9_-]/g, "_");-@@ -202,6 +204,13 @@ export function convertResponsesMessages(model, context, allowedToolCallProvider+@@ -208,6 +210,13 @@ export function convertResponsesMessages(model, context, allowedToolCallProviderphase: parsedSignature?.phase,});}@@ -499,7 +507,7 @@ index f413fe5..af7832b 100644else if (block.type === "toolCall") {const toolCall = block;const [callId, itemIdRaw] = toolCall.id.split("|");-@@ -406,6 +415,28 @@ export async function processResponsesStream(openaiStream, output, stream, model+@@ -419,6 +428,28 @@ export async function processResponsesStream(openaiStream, output, stream, modelstream.push({ type: "toolcall_start", contentIndex: slot.contentIndex, partial: output });return slot;}@@ -528,7 +536,7 @@ index f413fe5..af7832b 100644return undefined;};const getOrCreateSlot = (outputIndex, item) => {-@@ -487,11 +518,11 @@ export async function processResponsesStream(openaiStream, output, stream, model+@@ -500,11 +531,11 @@ export async function processResponsesStream(openaiStream, output, stream, modelconst slot = getSlot(event.output_index, "thinking");if (!slot)continue;@@ -542,7 +550,7 @@ index f413fe5..af7832b 100644partial: output,});}-@@ -511,11 +542,11 @@ export async function processResponsesStream(openaiStream, output, stream, model+@@ -524,11 +555,11 @@ export async function processResponsesStream(openaiStream, output, stream, modelconst slot = getSlot(event.output_index, "thinking");if (!slot)continue;@@ -556,7 +564,7 @@ index f413fe5..af7832b 100644partial: output,});}-@@ -523,23 +554,44 @@ export async function processResponsesStream(openaiStream, output, stream, model+@@ -536,23 +567,44 @@ export async function processResponsesStream(openaiStream, output, stream, modelconst slot = getSlot(event.output_index, "text");if (!slot)continue;@@ -605,7 +613,7 @@ index f413fe5..af7832b 100644partial: output,});}-@@ -547,9 +599,9 @@ export async function processResponsesStream(openaiStream, output, stream, model+@@ -560,9 +612,9 @@ export async function processResponsesStream(openaiStream, output, stream, modelconst slot = getSlot(event.output_index, "toolCall");if (!slot || slot.block.partialJson === undefined)continue;@@ -617,7 +625,7 @@ index f413fe5..af7832b 100644}else if (event.type === "response.function_call_arguments.done") {const slot = getSlot(event.output_index, "toolCall");-@@ -635,9 +687,25 @@ export async function processResponsesStream(openaiStream, output, stream, model+@@ -648,9 +700,25 @@ export async function processResponsesStream(openaiStream, output, stream, model});outputSlots.delete(event.output_index);}@@ -644,7 +652,7 @@ index f413fe5..af7832b 100644else 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 2a6b4e4..9e44070 100644+index 2ab985c7d..c48a104d7 100644--- a/dist/api/openai-responses.js+++ b/dist/api/openai-responses.js@@ -1,3 +1,5 @@@@ -653,15 +661,15 @@ index 2a6b4e4..9e44070 100644import OpenAI from "openai";import { clampThinkingLevel } from "../models.js";import { formatProviderError, normalizeProviderError } from "../utils/error-body.js";-@@ -92,7 +94,6 @@ function getPromptCacheOptions(compat, cacheRetention) {+@@ -105,7 +107,6 @@ function getPromptCacheOptions(compat, cacheRetention) {*/export const stream = (model, context, options) => {const stream = new AssistantMessageEventStream();- const normalizedContext = resolveTranscript(context, getCompat(model).supportsMidConvoSystemMessages);// Start async processing(async () => {- const output = {-@@ -112,7 +113,9 @@ export const stream = (model, context, options) => {+ const compat = getCompat(model);+@@ -128,7 +129,9 @@ export const stream = (model, context, options) => {stopReason: "pending",timestamp: Date.now(),};@@ -671,7 +679,7 @@ index 2a6b4e4..9e44070 100644// Create OpenAI clientconst apiKey = getClientApiKey(model.provider, options?.apiKey, options?.headers);const cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);-@@ -130,6 +133,9 @@ export const stream = (model, context, options) => {+@@ -145,6 +148,9 @@ export const stream = (model, context, options) => {...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),maxRetries: 0,};@@ -681,7 +689,7 @@ index 2a6b4e4..9e44070 100644const { data: openaiStream, response } = await retryProviderRequest(() => client.responses.create(params, requestOptions).withResponse(), {maxRetries: options?.maxRetries,maxRetryDelayMs: options?.maxRetryDelayMs,-@@ -156,6 +162,11 @@ export const stream = (model, context, options) => {+@@ -171,6 +177,11 @@ export const stream = (model, context, options) => {stream.end();}catch (error) {@@ -693,7 +701,7 @@ index 2a6b4e4..9e44070 100644for (const block of output.content) {delete block.index;// Streaming scratch buffers are only used during parsing; never persist them.-@@ -163,7 +174,7 @@ export const stream = (model, context, options) => {+@@ -178,7 +189,7 @@ export const stream = (model, context, options) => {delete block.customInput;}output.stopReason = options?.signal?.aborted ? "aborted" : "error";@@ -702,7 +710,7 @@ index 2a6b4e4..9e44070 100644// 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}`-@@ -174,7 +185,7 @@ export const stream = (model, context, options) => {+@@ -189,7 +200,7 @@ export const stream = (model, context, options) => {})();return stream;};@@ -711,7 +719,7 @@ index 2a6b4e4..9e44070 100644getClientApiKey(model.provider, options?.apiKey, options?.headers);const base = {...buildBaseOptions(model, context, options, options?.apiKey),-@@ -186,7 +197,7 @@ export const streamSimple = (model, context, options) => {+@@ -201,7 +212,7 @@ export const streamSimple = (model, context, options) => {...base,reasoningEffort,});@@ -720,7 +728,7 @@ index 2a6b4e4..9e44070 100644function createClient(model, context, apiKey, optionsHeaders, fetch, sessionId) {const compat = getCompat(model);const headers = { "User-Agent": getPiUserAgent(), ...model.headers };-@@ -260,6 +271,12 @@ function buildParams(model, context, options, compat = getCompat(model), grammar+@@ -276,6 +287,12 @@ function buildParams(model, context, options, compat, grammarToolInputPropertiessupportsOpenAIGrammarTools: compat.supportsOpenAIGrammarTools,});}@@ -733,7 +741,7 @@ index 2a6b4e4..9e44070 100644if (options?.toolChoice !== undefined) {params.tool_choice = options.toolChoice;}-@@ -283,6 +300,10 @@ function buildParams(model, context, options, compat = getCompat(model), grammar+@@ -300,6 +317,10 @@ function buildParams(model, context, options, compat, grammarToolInputPropertiesif (model.provider === "xai")params.include = ["reasoning.encrypted_content"];}@@ -745,7 +753,7 @@ index 2a6b4e4..9e44070 100644const samplingParams = resolveSamplingParams(model, reasoningEffort ?? "off", options?.samplingParams);if (samplingParams) {diff --git a/dist/api/simple-options.js b/dist/api/simple-options.js-index 4e36f35..c817c2e 100644+index 4e36f350e..c817c2e4a 100644--- a/dist/api/simple-options.js+++ b/dist/api/simple-options.js@@ -5,7 +5,7 @@ const MIN_MAX_TOKENS = 1;@@ -758,7 +766,7 @@ index 4e36f35..c817c2e 100644}export function resolveSamplingParams(model, thinkingLevel, requestParams) {diff --git a/dist/auth/oauth/anthropic.js b/dist/auth/oauth/anthropic.js-index 0823512..713d38a 100644+index 0823512eb..713d38af6 100644--- a/dist/auth/oauth/anthropic.js+++ b/dist/auth/oauth/anthropic.js@@ -4,6 +4,7 @@@@ -915,10 +923,10 @@ index 0823512..713d38a 100644return {type: "oauth",diff --git a/dist/index.d.ts b/dist/index.d.ts-index 75c0d7b..b0bf697 100644+index 8024d0a7c..79a531852 100644--- a/dist/index.d.ts+++ b/dist/index.d.ts-@@ -33,4 +33,7 @@ export * from "./utils/transcript.ts";+@@ -32,4 +32,7 @@ export * from "./utils/transcript.ts";export * from "./utils/typebox-helpers.ts";export { uuidv7 } from "./utils/uuid.ts";export * from "./utils/validation.ts";@@ -928,10 +936,10 @@ index 75c0d7b..b0bf697 100644//# sourceMappingURL=index.d.ts.map\ No newline at end of filediff --git a/dist/index.js b/dist/index.js-index 4fafdda..2e4ed41 100644+index b0a6bcd5d..35e5b22f2 100644--- a/dist/index.js+++ b/dist/index.js-@@ -20,4 +20,6 @@ export * from "./utils/transcript.js";+@@ -19,4 +19,6 @@ export * from "./utils/transcript.js";export * from "./utils/typebox-helpers.js";export { uuidv7 } from "./utils/uuid.js";export * from "./utils/validation.js";@@ -939,20 +947,46 @@ index 4fafdda..2e4ed41 100644+export * from "./utils/hosted-search.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+--- a/dist/providers/compat-schema.d.ts++++ b/dist/providers/compat-schema.d.ts+@@ -71,6 +71,7 @@ export declare const OpenAICompletionsCompatSchema: Type.TObject<{+ requiresAssistantAfterToolResult: Type.TOptional<Type.TBoolean>;+ requiresThinkingAsText: Type.TOptional<Type.TBoolean>;+ requiresReasoningContentOnAssistantMessages: Type.TOptional<Type.TBoolean>;++ requiresNonEmptyReasoningReplay: Type.TOptional<Type.TBoolean>;+ thinkingFormat: Type.TOptional<Type.TUnion<[Type.TLiteral<"openai">, Type.TLiteral<"openrouter">, Type.TLiteral<"deepseek">, Type.TLiteral<"together">, Type.TLiteral<"baseten">, Type.TLiteral<"zai">, Type.TLiteral<"qwen">, Type.TLiteral<"chat-template">, Type.TLiteral<"qwen-chat-template">, Type.TLiteral<"string-thinking">, Type.TLiteral<"ant-ling">]>>;+ 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+--- a/dist/providers/compat-schema.js++++ b/dist/providers/compat-schema.js+@@ -106,6 +106,9 @@ function optionalSessionAffinityFormat(options) {+ return Type.Optional(sessionAffinityFormat(options));+ }+ export const OpenAICompletionsCompatSchema = Type.Object({++ requiresNonEmptyReasoningReplay: Type.Optional(Type.Boolean({++ description: "Whether assistant replay without reasoning requires a non-empty placeholder. Explicit endpoint opt-in only.",++ })),+ supportsStore: Type.Optional(Type.Boolean({+ 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 1443bb5..5fc0625 100644+index 1443bb592..5fc062577 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 b01603b..39a6d0a 100644+index 022faa196..efed3b8b0 100644--- a/dist/types.d.ts+++ b/dist/types.d.ts-@@ -288,6 +288,30 @@ export interface ToolCall {- /** OpenAI Responses namespace for calls to dynamically loaded or namespaced tools. */- namespace?: string;+@@ -276,6 +276,30 @@ export interface ToolCall {+ */+ argumentsError?: string;}+export interface HostedSearchCitation {+ url: string;@@ -981,7 +1015,7 @@ index b01603b..39a6d0a 100644export interface Usage {input: number;output: number;-@@ -373,7 +397,7 @@ export interface UserMessage {+@@ -361,7 +385,7 @@ export interface UserMessage {}export interface AssistantMessage {role: "assistant";@@ -990,7 +1024,7 @@ index b01603b..39a6d0a 100644api: Api;provider: ProviderId;model: string;-@@ -388,6 +412,8 @@ export interface AssistantMessage {+@@ -376,6 +400,8 @@ export interface AssistantMessage {stopReason: StopReason;deferred?: DeferredHandle;errorMessage?: string;@@ -999,7 +1033,7 @@ index b01603b..39a6d0a 100644rawStopReason?: string;/*** Provider indication of whether the model explicitly ended its turn.-@@ -623,6 +649,10 @@ export type AssistantMessageEvent = {+@@ -611,6 +637,10 @@ export type AssistantMessageEvent = {contentIndex: number;toolCall: ToolCall;partial: AssistantMessage;@@ -1010,20 +1044,7 @@ index b01603b..39a6d0a 100644} | {type: "done";reason: Extract<StopReason, "stop" | "length" | "toolUse" | "deferred">;-@@ -657,6 +687,12 @@ export interface OpenAICompletionsCompat {- requiresThinkingAsText?: boolean;- /** Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL. */- requiresReasoningContentOnAssistantMessages?: boolean;-+ /**-+ * Whether a replayed assistant message that carries no reasoning must send a documented-+ * non-empty placeholder instead of an empty string. Some relays reject the empty echo.-+ * Default: false; only an explicit model.compat opt-in enables it.-+ */-+ requiresNonEmptyReasoningReplay?: boolean;- /** Format for reasoning/thinking parameter. "openai" uses reasoning_effort, "openrouter" uses reasoning: { effort }, "deepseek" uses thinking: { type } plus reasoning_effort when supported, "together" uses reasoning: { enabled } plus reasoning_effort when supported, "baseten" uses configurable chat_template_args plus reasoning_effort when supported, "zai" uses thinking: { type }, "qwen" uses top-level enable_thinking: boolean, "qwen-chat-template" uses chat_template_kwargs.enable_thinking and preserve_thinking, "chat-template" uses configurable chat_template_kwargs, "string-thinking" uses top-level thinking: string, and "ant-ling" uses reasoning: { effort } only when the mapped effort is non-null. Default: "openai". */- thinkingFormat?: "openai" | "openrouter" | "deepseek" | "together" | "baseten" | "zai" | "qwen" | "chat-template" | "qwen-chat-template" | "string-thinking" | "ant-ling";- /** Kwargs to send as `chat_template_kwargs` when `thinkingFormat` is `chat-template`. Use `{ "$var": "thinking.enabled" }`, `{ "$var": "thinking.effort" }`, or `{ "$var": "thinking.budget" }` for pi-controlled thinking values. */-@@ -935,6 +971,8 @@ export interface Model<TApi extends Api> extends BaseModel<TApi> {+@@ -642,6 +672,8 @@ export interface Model<TApi extends Api> extends BaseModel<TApi> {*/type?: "chat";reasoning: boolean;@@ -1032,185 +1053,8 @@ index b01603b..39a6d0a 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/assistant-message-frame.d.ts b/dist/utils/assistant-message-frame.d.ts-index 0820719..0584f68 100644---- a/dist/utils/assistant-message-frame.d.ts-+++ b/dist/utils/assistant-message-frame.d.ts-@@ -1,4 +1,4 @@--import type { AssistantMessage, AssistantMessageEvent, TextContent, ThinkingContent, ToolCall } from "../types.ts";-+import type { AssistantMessage, AssistantMessageEvent, HostedSearchContent, TextContent, ThinkingContent, ToolCall } from "../types.ts";- /**- * Compact, replayable assistant-message progress. Terminal settlement is- * intentionally excluded and must be persisted separately.-@@ -53,6 +53,11 @@ export type AssistantMessageFrame = {- arguments: ToolCall["arguments"];- thoughtSignature?: string;- namespace?: string;-+} | {-+ type: "hosted_search_update";-+ contentIndex: number;-+ /** Complete detached snapshot, replacing the same search block on later updates. */-+ content: HostedSearchContent;- };- /**- * Encodes one assistant stream. `partial` remains a shared live accumulator;-diff --git a/dist/utils/assistant-message-frame.js b/dist/utils/assistant-message-frame.js-index c0e0019..a86f593 100644---- a/dist/utils/assistant-message-frame.js-+++ b/dist/utils/assistant-message-frame.js-@@ -1,15 +1,30 @@-+import { normalizeHostedSearchContent } from "./hosted-search.js";- import { parseStreamingJson } from "./json-parse.js";-+-+// A gateway that re-serializes provider events with `omitempty` (Go) or drops-+// `undefined` (JS) hands a text / thinking / tool-call delta over with the-+// string field missing. The frame protocol requires a string there, and the only-+// value that can be dropped that way is the empty one, so a non-string payload-+// reads as "". Reading `.length` off it used to throw a bare TypeError that the-+// runtime surfaced as a retriable provider failure and then reproduced on every-+// later turn of the session.-+function textValue(value) {-+ return typeof value === "string" ? value : "";-+}-+function textLength(value) {-+ return typeof value === "string" ? value.length : 0;-+}- function cloneTextContent(content) {- return {- type: "text",-- text: content.text,-+ text: textValue(content.text),- ...(content.textSignature === undefined ? {} : { textSignature: content.textSignature }),- };- }- function cloneThinkingContent(content) {- return {- type: "thinking",-- thinking: content.thinking,-+ thinking: textValue(content.thinking),- ...(content.thinkingSignature === undefined ? {} : { thinkingSignature: content.thinkingSignature }),- ...(content.redacted === undefined ? {} : { redacted: content.redacted }),- };-@@ -24,6 +39,24 @@ function cloneToolCall(toolCall) {- ...(toolCall.namespace === undefined ? {} : { namespace: toolCall.namespace }),- };- }-+function cloneHostedSearchContent(content) {-+ const block = normalizeHostedSearchContent(content);-+ const base = { type: "hostedSearch", phase: block.phase, blockId: block.blockId };-+ // Deep-copy declared wire/input fields so mutable partials and parser buffers cannot alter old frames.-+ if (block.phase === "server_tool_use")-+ return { ...base, name: block.name, input: structuredClone(block.input) };-+ if (block.phase === "web_search_tool_result")-+ return { ...base, ...(content.isError === undefined ? {} : { isError: block.isError }), wire: structuredClone(block.wire) };-+ return {-+ ...base,-+ ...(block.status === undefined ? {} : { status: block.status }),-+ ...(block.wire == null ? {} : { wire: structuredClone(block.wire) }),-+ };-+}-+function assertSameHostedSearch(previous, current) {-+ if (previous.phase !== current.phase || previous.blockId !== current.blockId)-+ throw new Error("Hosted search update changes block identity");-+}- function cloneStartMessage(message) {- return {- role: "assistant",-@@ -105,6 +138,19 @@ export class AssistantMessageFrameEncoder {- if (!this.started)- throw new Error(`Assistant message ${event.type} event appears before start`);- switch (event.type) {-+ case "hosted_search_update": {-+ const content = cloneHostedSearchContent(eventBlock(event));-+ const state = this.blocks.get(event.contentIndex);-+ if (state === undefined) {-+ this.startBlock(event.contentIndex, { kind: "hostedSearch", phase: content.phase, blockId: content.blockId });-+ }-+ else {-+ this.block(event.contentIndex, "hostedSearch");-+ assertSameHostedSearch(state, content);-+ }-+ // Search events are snapshots: completed wire data can arrive later without a synthetic end state.-+ return { type: "hosted_search_update", contentIndex: event.contentIndex, content };-+ }- case "text_start": {- const content = eventBlock(event);- if (content.type !== "text") {-@@ -112,7 +158,7 @@ export class AssistantMessageFrameEncoder {- }- this.startBlock(event.contentIndex, {- kind: "text",-- coveredChars: content.text.length,-+ coveredChars: textLength(content.text),- deltaChars: 0,- });- return { type: "text_start", contentIndex: event.contentIndex, content: cloneTextContent(content) };-@@ -139,7 +185,7 @@ export class AssistantMessageFrameEncoder {- }- this.startBlock(event.contentIndex, {- kind: "thinking",-- coveredChars: content.thinking.length,-+ coveredChars: textLength(content.thinking),- deltaChars: 0,- });- return {-@@ -183,12 +229,13 @@ export class AssistantMessageFrameEncoder {- const state = this.block(event.contentIndex, "toolCall");- if (state.kind !== "toolCall")- throw new Error("Unreachable tool-call encoder state");-+ const delta = textValue(event.delta);- if (state.caughtUp) {-- return event.delta.length === 0-+ return delta.length === 0- ? undefined-- : { type: "toolcall_delta", contentIndex: event.contentIndex, delta: event.delta };-+ : { type: "toolcall_delta", contentIndex: event.contentIndex, delta };- }-- state.catchupJson += event.delta;-+ state.catchupJson += delta;- const argumentsValue = parseStreamingJson(state.catchupJson);- if (serializedArguments(argumentsValue) !== state.snapshotArguments) {- // Legacy grammar calls include the initial input in toolcall_start, but their-@@ -254,12 +301,13 @@ export class AssistantMessageFrameEncoder {- const state = this.block(contentIndex, kind);- if (state.kind === "toolCall")- throw new Error("Unreachable text encoder state");-+ const text = textValue(delta);- const deltaStart = state.deltaChars;-- state.deltaChars += delta.length;-+ state.deltaChars += text.length;- const covered = Math.max(0, state.coveredChars - deltaStart);-- if (covered >= delta.length)-+ if (covered >= text.length)- return undefined;-- const uncovered = covered === 0 ? delta : delta.slice(covered);-+ const uncovered = covered === 0 ? text : text.slice(covered);- return kind === "text"- ? { type: "text_delta", contentIndex, delta: uncovered }- : { type: "thinking_delta", contentIndex, delta: uncovered };-@@ -311,6 +359,20 @@ export function reduceAssistantMessageFrames(frames) {- continue;- }- switch (frame.type) {-+ case "hosted_search_update": {-+ const content = cloneHostedSearchContent(frame.content);-+ assertContentIndex(frame.contentIndex);-+ if (frame.contentIndex >= message.content.length) {-+ // Preserve the original content index; appendBlock still rejects actual gaps.-+ appendBlock(message, states, frame.contentIndex, content, { kind: "hostedSearch", ended: false });-+ }-+ else {-+ const { block } = activeBlock(message, states, frame.contentIndex, "hostedSearch", frame.type);-+ assertSameHostedSearch(block, content);-+ message.content[frame.contentIndex] = content;-+ }-+ break;-+ }- case "text_start":- if (frame.content.type !== "text") {- throw new Error(`text_start frame contains ${frame.content.type} content`);diff --git a/dist/utils/estimate.d.ts b/dist/utils/estimate.d.ts-index 6dcca6e..5ccaaf2 100644+index 6dcca6eff..5ccaaf235 100644--- a/dist/utils/estimate.d.ts+++ b/dist/utils/estimate.d.ts@@ -1,4 +1,4 @@@@ -1231,7 +1075,7 @@ index 6dcca6e..5ccaaf2 100644//# sourceMappingURL=estimate.d.ts.map\ No newline at end of filediff --git a/dist/utils/estimate.js b/dist/utils/estimate.js-index 45be26d..59a980b 100644+index 45be26d82..59a980b63 100644--- a/dist/utils/estimate.js+++ b/dist/utils/estimate.js@@ -1,95 +1,114 @@@@ -1406,7 +1250,7 @@ index 45be26d..59a980b 100644\ No newline at end of filediff --git a/dist/utils/hosted-search.d.ts b/dist/utils/hosted-search.d.tsnew file mode 100644-index 0000000..a76ae52+index 000000000..a76ae5269--- /dev/null+++ b/dist/utils/hosted-search.d.ts@@ -0,0 +1,10 @@@@ -1422,7 +1266,7 @@ index 0000000..a76ae52+export declare function validateHostedSearchMessages(messages: readonly Message[]): void;diff --git a/dist/utils/hosted-search.js b/dist/utils/hosted-search.jsnew file mode 100644-index 0000000..b98cb8d+index 000000000..b98cb8d12--- /dev/null+++ b/dist/utils/hosted-search.js@@ -0,0 +1,97 @@@@ -1525,7 +1369,7 @@ index 0000000..b98cb8d+}diff --git a/dist/utils/local-request-error.d.ts b/dist/utils/local-request-error.d.tsnew file mode 100644-index 0000000..a72f65b+index 000000000..a72f65b33--- /dev/null+++ b/dist/utils/local-request-error.d.ts@@ -0,0 +1,15 @@@@ -1546,7 +1390,7 @@ index 0000000..a72f65b+export declare function prepareLocalRequest<T>(phase: LocalRequestErrorPhase, prepare: () => T): T;diff --git a/dist/utils/local-request-error.js b/dist/utils/local-request-error.jsnew file mode 100644-index 0000000..4d276dd+index 000000000..4d276ddc8--- /dev/null+++ b/dist/utils/local-request-error.js@@ -0,0 +1,38 @@@@ -1590,7 +1434,7 @@ index 0000000..4d276dd+}diff --git a/dist/utils/local-request-stream.d.ts b/dist/utils/local-request-stream.d.tsnew file mode 100644-index 0000000..879b78c+index 000000000..879b78cbe--- /dev/null+++ b/dist/utils/local-request-stream.d.ts@@ -0,0 +1,3 @@@@ -1599,7 +1443,7 @@ index 0000000..879b78c+export declare function withLocalRequestErrors(model: Model<Api>, options: { signal?: AbortSignal } | undefined, prepare: () => AssistantMessageEventStream): AssistantMessageEventStream;diff --git a/dist/utils/local-request-stream.js b/dist/utils/local-request-stream.jsnew file mode 100644-index 0000000..5c63b88+index 000000000..5c63b882a--- /dev/null+++ b/dist/utils/local-request-stream.js@@ -0,0 +1,24 @@diff --git a/patches/@[email protected] b/patches/@[email protected]similarity index 94%rename from patches/@[email protected]rename to patches/@[email protected]index 49e27f5d9..17b7a4c19 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 c5ad71905832cac59341cff04729260936dfba77..63f78d1464e21638ba569b0c24fd1723c56d3b54 100644+index 11ab140cd..cb2617f5f 100644--- a/dist/core/agent-session.js+++ b/dist/core/agent-session.js@@ -69,10 +69,10 @@ function withoutDeletedHeaders(headers) {@@ -33,7 +33,7 @@ index c5ad71905832cac59341cff04729260936dfba77..63f78d1464e21638ba569b0c24fd1723entryId = manager.appendCompaction(draft.summary, draft.firstKeptEntryId, tokensBefore, draft.details, true, draft.usage);break;}-@@ -2178,7 +2178,7 @@ export class AgentSession {+@@ -2211,7 +2211,7 @@ export class AgentSession {}const settings = this.settingsManager.getCompactionSettings(model);const pathEntries = this.sessionManager.getBranch();@@ -42,7 +42,7 @@ index c5ad71905832cac59341cff04729260936dfba77..63f78d1464e21638ba569b0c24fd1723if (!preparation) {// Check why we can't compactconst lastEntry = pathEntries[pathEntries.length - 1];-@@ -2235,7 +2235,7 @@ export class AgentSession {+@@ -2268,7 +2268,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 c5ad71905832cac59341cff04729260936dfba77..63f78d1464e21638ba569b0c24fd1723// Get the saved compaction entry for the extension eventconst savedCompactionEntry = newEntries.find((e) => e.type === "compaction" && e.summary === summary);if (this._extensionRunner && savedCompactionEntry) {-@@ -2418,11 +2418,11 @@ export class AgentSession {+@@ -2451,11 +2451,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 c5ad71905832cac59341cff04729260936dfba77..63f78d1464e21638ba569b0c24fd1723// 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) {-@@ -2468,7 +2468,7 @@ export class AgentSession {+@@ -2501,7 +2501,7 @@ export class AgentSession {return false;}const pathEntries = this.sessionManager.getBranch();@@ -74,7 +74,7 @@ index c5ad71905832cac59341cff04729260936dfba77..63f78d1464e21638ba569b0c24fd1723if (!preparation) {return false;}-@@ -2524,7 +2524,7 @@ export class AgentSession {+@@ -2557,7 +2557,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 c5ad71905832cac59341cff04729260936dfba77..63f78d1464e21638ba569b0c24fd1723// Get the saved compaction entry for the extension eventconst savedCompactionEntry = newEntries.find((e) => e.type === "compaction" && e.summary === summary);if (this._extensionRunner && savedCompactionEntry) {-@@ -3462,7 +3462,7 @@ export class AgentSession {+@@ -3495,7 +3495,7 @@ export class AgentSession {if (!hasPostCompactionUsage)return { tokens: null, contextWindow, percent: null };}@@ -93,7 +93,7 @@ index c5ad71905832cac59341cff04729260936dfba77..63f78d1464e21638ba569b0c24fd1723return {tokens: estimate.tokens,diff --git a/dist/core/bug-report.js b/dist/core/bug-report.js-index bc4af31b57f4a8696a68d4f2a529a26669955382..24a4f8e28624523112cac6c73464e93fb650f03a 100644+index bc4af31b5..24a4f8e28 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 bc4af31b57f4a8696a68d4f2a529a26669955382..24a4f8e28624523112cac6c73464e93fconst prompt = [messages.length < options.messages.lengthdiff --git a/dist/core/compaction/branch-summarization.d.ts b/dist/core/compaction/branch-summarization.d.ts-index 12cb88ef5398b2365d5823597b7ccf063af567d6..6ff73567bbd5289b8b3f2fb82f923a5b5dc7860e 100644+index 12cb88ef5..6ff73567b 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 12cb88ef5398b2365d5823597b7ccf063af567d6..6ff73567bbd5289b8b3f2fb82f923a5b* Generate a summary of abandoned branch entries.*diff --git a/dist/core/compaction/branch-summarization.js b/dist/core/compaction/branch-summarization.js-index 3f98859ddbc6de3b6075c08557fe396a61d1814e..b68f7adb1fd2145a6a0d1e74af05065d25c7925b 100644+index 3f98859dd..b68f7adb1 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 3f98859ddbc6de3b6075c08557fe396a61d1814e..b68f7adb1fd2145a6a0d1e74af05065dreturn { summary: "No content to summarize" };}diff --git a/dist/core/compaction/compaction.d.ts b/dist/core/compaction/compaction.d.ts-index 04416da43184fce4dc2fc33afeb920e2edddedc9..fdf79d9f200e78178aa46020341c7295024734a5 100644+index 04416da43..fdf79d9f2 100644--- a/dist/core/compaction/compaction.d.ts+++ b/dist/core/compaction/compaction.d.ts@@ -6,7 +6,7 @@@@ -229,7 +229,7 @@ index 04416da43184fce4dc2fc33afeb920e2edddedc9..fdf79d9f200e78178aa46020341c7295* 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 e4992e8d2bff8aa6d2a4b044c9cf571d9e7f2fa2..0797ad50e267863a32adf27cbc2d7037e07dcb21 100644+index e4992e8d2..0797ad50e 100644--- a/dist/core/compaction/compaction.js+++ b/dist/core/compaction/compaction.js@@ -4,8 +4,10 @@@@ -424,7 +424,7 @@ index e4992e8d2bff8aa6d2a4b044c9cf571d9e7f2fa2..0797ad50e267863a32adf27cbc2d7037if (!firstKeptEntry?.id)return undefined;diff --git a/dist/core/compaction/utils.js b/dist/core/compaction/utils.js-index 92ee18e6a99c46dd5fc6b249a6cf670938f5f963..ef4df7671fc2a2b778ede9e485eb03fc49ebc3a8 100644+index ff5292a31..7f190eed0 100644--- a/dist/core/compaction/utils.js+++ b/dist/core/compaction/utils.js@@ -2,6 +2,7 @@@@ -435,15 +435,15 @@ index 92ee18e6a99c46dd5fc6b249a6cf670938f5f963..ef4df7671fc2a2b778ede9e485eb03fcexport function createFileOps() {return {read: new Set(),-@@ -109,6 +110,7 @@ export function serializeConversation(messages) {+@@ -114,6 +115,7 @@ export function serializeConversation(messages) {+ }else if (msg.role === "assistant") {- const thinkingParts = [];const toolCalls = [];+ const hostedSearchParts = [];for (const block of msg.content) {- if (block.type === "thinking") {- thinkingParts.push(block.thinking);-@@ -120,6 +122,13 @@ export function serializeConversation(messages) {+ if (block.type === "toolCall") {+ const args = block.arguments;+@@ -122,6 +124,13 @@ export function serializeConversation(messages) {.join(", ");toolCalls.push(`${block.name}(${argsStr})`);}@@ -455,9 +455,9 @@ index 92ee18e6a99c46dd5fc6b249a6cf670938f5f963..ef4df7671fc2a2b778ede9e485eb03fc+ }+ }}- if (thinkingParts.length > 0) {- parts.push(`[Assistant thinking]: ${thinkingParts.join("\n")}`);-@@ -130,6 +139,9 @@ export function serializeConversation(messages) {+ if (msg.content.some((block) => block.type === "text")) {+ parts.push(`[Assistant]: ${contentText(msg.content)}`);+@@ -129,6 +138,9 @@ export function serializeConversation(messages) {if (toolCalls.length > 0) {parts.push(`[Assistant tool calls]: ${toolCalls.join("; ")}`);}@@ -468,7 +468,7 @@ index 92ee18e6a99c46dd5fc6b249a6cf670938f5f963..ef4df7671fc2a2b778ede9e485eb03fcelse 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 37d8a2474d425e6ac8648745c02d1a247244cbd3..b194f69e3d5073a4c5177a0dfb2b67104eec5814 100644+index 37d8a2474..b194f69e3 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.yamlindex 1ac3e20d5..d777c5d91 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]': a2c96619d0f9a1d643a6c6a555ba6a7fb533147336c181f7d3b7f847be33a6eb- '@earendil-works/[email protected]': 2aa7a30fca930a08ebdff65f82d2fc47aeb1cd941d34aae2e50e13b309ef2705- '@earendil-works/[email protected]': 73b8776451352deeaa307306b1aaa3a22e2c2cfd6e06c802fcd390409912f60a+ '@earendil-works/[email protected]': afe17754a8c323f4010e051c96a66314ce96c1745a235c3efb5970cfea91a9b0+ '@earendil-works/[email protected]': 14ebd53075a2fbd0e5f101c88253e555d9e79a21c1e399f7c0e7b652c498dd12+ '@earendil-works/[email protected]': 5cb7070ec8e1695932e9968afa6828b36beb1face77418739d5cd01b2a07c371importers:@@ -233,11 +233,11 @@ importers:version: 0.2.2devDependencies:'@earendil-works/pi-ai':- specifier: 1.1.0- version: 1.1.0(patch_hash=2aa7a30fca930a08ebdff65f82d2fc47aeb1cd941d34aae2e50e13b309ef2705)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])+ specifier: 1.3.0+ version: 1.3.0(patch_hash=14ebd53075a2fbd0e5f101c88253e555d9e79a21c1e399f7c0e7b652c498dd12)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])'@earendil-works/pi-mcp':- specifier: 1.1.0- version: 1.1.0+ specifier: 1.3.0+ version: 1.3.0'@pi-desktop/agent-host':specifier: workspace:*version: link:../../packages/agent-host@@ -425,14 +425,14 @@ importers:packages/agent-runtime:dependencies:'@earendil-works/pi-agent-core':- specifier: 1.1.0- version: 1.1.0(patch_hash=a2c96619d0f9a1d643a6c6a555ba6a7fb533147336c181f7d3b7f847be33a6eb)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])+ 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])'@earendil-works/pi-ai':- specifier: 1.1.0- version: 1.1.0(patch_hash=2aa7a30fca930a08ebdff65f82d2fc47aeb1cd941d34aae2e50e13b309ef2705)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])+ specifier: 1.3.0+ version: 1.3.0(patch_hash=14ebd53075a2fbd0e5f101c88253e555d9e79a21c1e399f7c0e7b652c498dd12)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])'@earendil-works/pi-coding-agent':- specifier: 1.1.0- version: 1.1.0(patch_hash=73b8776451352deeaa307306b1aaa3a22e2c2cfd6e06c802fcd390409912f60a)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])+ specifier: 1.3.0+ version: 1.3.0(patch_hash=5cb7070ec8e1695932e9968afa6828b36beb1face77418739d5cd01b2a07c371)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])'@pi-desktop/shared':specifier: workspace:*version: link:../shared@@ -944,38 +944,34 @@ packages:search-insights:optional: true- '@earendil-works/[email protected]':- resolution: {integrity: sha512-gsHzKfyQ3t0ZIQ3cLBjJ5Vqy1TYnFyruHIV3g3BwmulCDYe5BW4yT9vaJk9QzN6YANILIO75uzuq+Gdxtzz1og==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-2jvpxZs47PFD5mSQb/yK0pGHJ5yO7Nu22u9mFjHbSLRgu62vZ9rupimDSIp4arnqOadyv0AWvYHtCSpFoJV7ag==}engines: {node: '>=22.19.0'}- '@earendil-works/[email protected]':- resolution: {integrity: sha512-aX1KZomNCPmwYnXa3OivF3VYLJ+WPUkIJlEIZTgwdOZdY/+oToWTQ334WYpQeOz9POpiYFNMJLPwIhXQ4e48kg==}- engines: {node: '>=22.19.0'}-- '@earendil-works/[email protected]':- resolution: {integrity: sha512-1T7LAkc/5Bvc0v6w4vAGVdCrli0o/E0pEmYKTnixu95vSFArBjvbhS/G4ZwI0RUePgf0Imcu0VyqlM4EcXxqfw==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-KaBI8x7q7sPoFUXICNGD9efHzDG+oRNwVvkA9jdIsSQWH1RjFssOlEGsbLtewUPPgCrvmz0l2KTgSLXTyj3acw==}engines: {node: '>=22.19.0'}hasBin: true- '@earendil-works/[email protected]':- resolution: {integrity: sha512-8Asc2AzhoNaXS1snmRFa96OhcWIlFM5k1Kuiz6p2DvIYgi5QHQccRAmDVY9oO92TzWrizpvQpconZGQ7JhlI7Q==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-2G9tmbsPhgzwfz7cmzJpbLSLqOx3eu22Gbzm+Wc3HqeZMjLQS4F3KfAabozVhv7uEjq3k2O1dZTHmhhWr2xbfQ==}engines: {node: '>=22.19.0'}- '@earendil-works/[email protected]':- resolution: {integrity: sha512-SeEi/4hdcHNgA9UWlefZl7ZZpm3dzi2OoxNjDHsBJ9o298LNOtbL4DGKgitlEj6uCTccvtw6f2hlCkTPVJ2RXg==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-V/WoCjA2hQSe3QLWIUB24cTRdtEdeLiIzkDqU5RMXV6VWuD+KGZnzVBMhglwdnQTySkehZsjt8a3g6Jd2g4nnw==}engines: {node: '>=22.19.0'}hasBin: true- '@earendil-works/[email protected]':- resolution: {integrity: sha512-xGKwvu3SvVTeoIx8Z7UGoJprB4VK20wKORMhufcWGx61fIauhu3J+UqfB5eeoF1oE/geYBA598K6nh1SdABQkg==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-lbktLplmdGamM2t460Q0ziNEfpUEHDTVNf79g/AialJ3XZ+SHgNqa/OJXRR+fU+GV/l+gBhRPcyP8XkQlv8Avw==}engines: {node: '>=22.19.0'}- '@earendil-works/[email protected]':- resolution: {integrity: sha512-8gAK05/2pPozZZz6hCLOi8x2vsqzvsmO9gG92kbvuvTPm0qMHaFlaXX98ndXsrOi5pmzha7vNLguuG4+0Rgxjw==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-ERGZr+aXjNJzoUbB7ZzHVH3g5otzMHjHLs2Fyizm12By5X+gBEhod9cJXFOk13S7M8a29Am+Mq21zm73mRJFLg==}engines: {node: '>=22.19.0'}- '@earendil-works/[email protected]':- resolution: {integrity: sha512-v7wkS0y2ErZvZkSfemqd9RrBZJ5x6p8Ujsv7NdJj01IXJyFM0kNL6rMdcKcvTe7EVTd6ugvDB9VPZSoaBF9QxQ==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-AlKvEwEWyVtnuw7SVb4N/mUhlfIohyFslUNWarZVdLHHSdt3ca5EhMLwTzblBpDpaofSz+f+tAHie6CfxVrWKA==}engines: {node: '>=22.19.0'}'@electron-internal/[email protected]':@@ -1034,12 +1030,6 @@ packages:cpu: [ppc64]os: [aix]- '@esbuild/[email protected]':- resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==}- engines: {node: '>=18'}- cpu: [ppc64]- os: [aix]-'@esbuild/[email protected]':resolution: {integrity: sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==}engines: {node: '>=18'}@@ -1052,12 +1042,6 @@ packages:cpu: [arm64]os: [android]- '@esbuild/[email protected]':- resolution: {integrity: sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==}- engines: {node: '>=18'}- cpu: [arm64]- os: [android]-'@esbuild/[email protected]':resolution: {integrity: sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==}engines: {node: '>=18'}@@ -1070,12 +1054,6 @@ packages:cpu: [arm]os: [android]- '@esbuild/[email protected]':- resolution: {integrity: sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==}- engines: {node: '>=18'}- cpu: [arm]- os: [android]-'@esbuild/[email protected]':resolution: {integrity: sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==}engines: {node: '>=18'}@@ -1088,12 +1066,6 @@ packages:cpu: [x64]os: [android]- '@esbuild/[email protected]':- resolution: {integrity: sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==}- engines: {node: '>=18'}- cpu: [x64]- os: [android]-'@esbuild/[email protected]':resolution: {integrity: sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==}engines: {node: '>=18'}@@ -1106,12 +1078,6 @@ packages:cpu: [arm64]os: [darwin]- '@esbuild/[email protected]':- resolution: {integrity: sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==}- engines: {node: '>=18'}- cpu: [arm64]- os: [darwin]-'@esbuild/[email protected]':resolution: {integrity: sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==}engines: {node: '>=18'}@@ -1124,12 +1090,6 @@ packages:cpu: [x64]os: [darwin]- '@esbuild/[email protected]':- resolution: {integrity: sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==}- engines: {node: '>=18'}- cpu: [x64]- os: [darwin]-'@esbuild/[email protected]':resolution: {integrity: sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==}engines: {node: '>=18'}@@ -1142,12 +1102,6 @@ packages:cpu: [arm64]os: [freebsd]- '@esbuild/[email protected]':- resolution: {integrity: sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==}- engines: {node: '>=18'}- cpu: [arm64]- os: [freebsd]-'@esbuild/[email protected]':resolution: {integrity: sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==}engines: {node: '>=18'}@@ -1160,12 +1114,6 @@ packages:cpu: [x64]os: [freebsd]- '@esbuild/[email protected]':- resolution: {integrity: sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==}- engines: {node: '>=18'}- cpu: [x64]- os: [freebsd]-'@esbuild/[email protected]':resolution: {integrity: sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==}engines: {node: '>=18'}@@ -1178,12 +1126,6 @@ packages:cpu: [arm64]os: [linux]- '@esbuild/[email protected]':- resolution: {integrity: sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==}- engines: {node: '>=18'}- cpu: [arm64]- os: [linux]-'@esbuild/[email protected]':resolution: {integrity: sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==}engines: {node: '>=18'}@@ -1196,12 +1138,6 @@ packages:cpu: [arm]os: [linux]- '@esbuild/[email protected]':- resolution: {integrity: sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==}- engines: {node: '>=18'}- cpu: [arm]- os: [linux]-'@esbuild/[email protected]':resolution: {integrity: sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==}engines: {node: '>=18'}@@ -1214,12 +1150,6 @@ packages:cpu: [ia32]os: [linux]- '@esbuild/[email protected]':- resolution: {integrity: sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==}- engines: {node: '>=18'}- cpu: [ia32]- os: [linux]-'@esbuild/[email protected]':resolution: {integrity: sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==}engines: {node: '>=18'}@@ -1232,12 +1162,6 @@ packages:cpu: [loong64]os: [linux]- '@esbuild/[email protected]':- resolution: {integrity: sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==}- engines: {node: '>=18'}- cpu: [loong64]- os: [linux]-'@esbuild/[email protected]':resolution: {integrity: sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==}engines: {node: '>=18'}@@ -1250,12 +1174,6 @@ packages:cpu: [mips64el]os: [linux]- '@esbuild/[email protected]':- resolution: {integrity: sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==}- engines: {node: '>=18'}- cpu: [mips64el]- os: [linux]-'@esbuild/[email protected]':resolution: {integrity: sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==}engines: {node: '>=18'}@@ -1268,12 +1186,6 @@ packages:cpu: [ppc64]os: [linux]- '@esbuild/[email protected]':- resolution: {integrity: sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==}- engines: {node: '>=18'}- cpu: [ppc64]- os: [linux]-'@esbuild/[email protected]':resolution: {integrity: sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==}engines: {node: '>=18'}@@ -1286,12 +1198,6 @@ packages:cpu: [riscv64]os: [linux]- '@esbuild/[email protected]':- resolution: {integrity: sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==}- engines: {node: '>=18'}- cpu: [riscv64]- os: [linux]-'@esbuild/[email protected]':resolution: {integrity: sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==}engines: {node: '>=18'}@@ -1304,12 +1210,6 @@ packages:cpu: [s390x]os: [linux]- '@esbuild/[email protected]':- resolution: {integrity: sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==}- engines: {node: '>=18'}- cpu: [s390x]- os: [linux]-'@esbuild/[email protected]':resolution: {integrity: sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==}engines: {node: '>=18'}@@ -1322,12 +1222,6 @@ packages:cpu: [x64]os: [linux]- '@esbuild/[email protected]':- resolution: {integrity: sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==}- engines: {node: '>=18'}- cpu: [x64]- os: [linux]-'@esbuild/[email protected]':resolution: {integrity: sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==}engines: {node: '>=18'}@@ -1340,12 +1234,6 @@ packages:cpu: [arm64]os: [netbsd]- '@esbuild/[email protected]':- resolution: {integrity: sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==}- engines: {node: '>=18'}- cpu: [arm64]- os: [netbsd]-'@esbuild/[email protected]':resolution: {integrity: sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==}engines: {node: '>=18'}@@ -1358,12 +1246,6 @@ packages:cpu: [x64]os: [netbsd]- '@esbuild/[email protected]':- resolution: {integrity: sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==}- engines: {node: '>=18'}- cpu: [x64]- os: [netbsd]-'@esbuild/[email protected]':resolution: {integrity: sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==}engines: {node: '>=18'}@@ -1376,12 +1258,6 @@ packages:cpu: [arm64]os: [openbsd]- '@esbuild/[email protected]':- resolution: {integrity: sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==}- engines: {node: '>=18'}- cpu: [arm64]- os: [openbsd]-'@esbuild/[email protected]':resolution: {integrity: sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==}engines: {node: '>=18'}@@ -1394,12 +1270,6 @@ packages:cpu: [x64]os: [openbsd]- '@esbuild/[email protected]':- resolution: {integrity: sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==}- engines: {node: '>=18'}- cpu: [x64]- os: [openbsd]-'@esbuild/[email protected]':resolution: {integrity: sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==}engines: {node: '>=18'}@@ -1412,12 +1282,6 @@ packages:cpu: [arm64]os: [openharmony]- '@esbuild/[email protected]':- resolution: {integrity: sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==}- engines: {node: '>=18'}- cpu: [arm64]- os: [openharmony]-'@esbuild/[email protected]':resolution: {integrity: sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==}engines: {node: '>=18'}@@ -1430,12 +1294,6 @@ packages:cpu: [x64]os: [sunos]- '@esbuild/[email protected]':- resolution: {integrity: sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==}- engines: {node: '>=18'}- cpu: [x64]- os: [sunos]-'@esbuild/[email protected]':resolution: {integrity: sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==}engines: {node: '>=18'}@@ -1448,12 +1306,6 @@ packages:cpu: [arm64]os: [win32]- '@esbuild/[email protected]':- resolution: {integrity: sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==}- engines: {node: '>=18'}- cpu: [arm64]- os: [win32]-'@esbuild/[email protected]':resolution: {integrity: sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==}engines: {node: '>=18'}@@ -1466,12 +1318,6 @@ packages:cpu: [ia32]os: [win32]- '@esbuild/[email protected]':- resolution: {integrity: sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==}- engines: {node: '>=18'}- cpu: [ia32]- os: [win32]-'@esbuild/[email protected]':resolution: {integrity: sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==}engines: {node: '>=18'}@@ -1484,12 +1330,6 @@ packages:cpu: [x64]os: [win32]- '@esbuild/[email protected]':- resolution: {integrity: sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==}- engines: {node: '>=18'}- cpu: [x64]- os: [win32]-'@google/[email protected]':resolution: {integrity: sha512-+PDtco2/Z0ONdzCGekCoCT+O1VJS9xJQNN4XzQpXG/t3El/SWWMkCWlFRO1KmivOHPa4Q0VjUYu1HBKCZ/v33Q==}engines: {node: '>=20.0.0'}@@ -3017,11 +2857,6 @@ packages:engines: {node: '>=18'}hasBin: true- resolution: {integrity: sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==}- engines: {node: '>=18'}- hasBin: true-resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}engines: {node: '>=6'}@@ -5229,13 +5064,9 @@ snapshots:transitivePeerDependencies:- '@algolia/client-search'- '@earendil-works/[email protected]':- dependencies:- esbuild: 0.28.2-- '@earendil-works/[email protected](patch_hash=a2c96619d0f9a1d643a6c6a555ba6a7fb533147336c181f7d3b7f847be33a6eb)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':+ '@earendil-works/[email protected](patch_hash=afe17754a8c323f4010e051c96a66314ce96c1745a235c3efb5970cfea91a9b0)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':dependencies:- '@earendil-works/pi-ai': 1.1.0(patch_hash=2aa7a30fca930a08ebdff65f82d2fc47aeb1cd941d34aae2e50e13b309ef2705)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])+ '@earendil-works/pi-ai': 1.3.0(patch_hash=14ebd53075a2fbd0e5f101c88253e555d9e79a21c1e399f7c0e7b652c498dd12)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])typebox: 1.3.27transitivePeerDependencies:- '@aws-sdk/credential-provider-node'@@ -5250,11 +5081,11 @@ snapshots:- ws- zod- '@earendil-works/[email protected](patch_hash=2aa7a30fca930a08ebdff65f82d2fc47aeb1cd941d34aae2e50e13b309ef2705)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':+ '@earendil-works/[email protected](patch_hash=14ebd53075a2fbd0e5f101c88253e555d9e79a21c1e399f7c0e7b652c498dd12)(@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.1.0+ '@earendil-works/pi-telemetry': 1.3.0'@google/genai': 2.21.0([email protected])'@smithy/node-http-handler': 4.12.1http-proxy-agent: 9.1.0([email protected])@@ -5275,11 +5106,11 @@ snapshots:- ws- zod- '@earendil-works/[email protected](patch_hash=2aa7a30fca930a08ebdff65f82d2fc47aeb1cd941d34aae2e50e13b309ef2705)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':+ '@earendil-works/[email protected](patch_hash=14ebd53075a2fbd0e5f101c88253e555d9e79a21c1e399f7c0e7b652c498dd12)(@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.1.0+ '@earendil-works/pi-telemetry': 1.3.0'@google/genai': 2.21.0([email protected])'@smithy/node-http-handler': 4.12.1http-proxy-agent: 9.1.0([email protected])@@ -5300,18 +5131,17 @@ snapshots:- ws- zod- '@earendil-works/[email protected]':+ '@earendil-works/[email protected]':dependencies:quickjs-wasi: 3.6.2- '@earendil-works/[email protected](patch_hash=73b8776451352deeaa307306b1aaa3a22e2c2cfd6e06c802fcd390409912f60a)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])':+ '@earendil-works/[email protected](patch_hash=5cb7070ec8e1695932e9968afa6828b36beb1face77418739d5cd01b2a07c371)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])':dependencies:- '@earendil-works/chord': 1.1.0- '@earendil-works/pi-agent-core': 1.1.0(patch_hash=a2c96619d0f9a1d643a6c6a555ba6a7fb533147336c181f7d3b7f847be33a6eb)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])- '@earendil-works/pi-ai': 1.1.0(patch_hash=2aa7a30fca930a08ebdff65f82d2fc47aeb1cd941d34aae2e50e13b309ef2705)(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])- '@earendil-works/pi-codemode': 1.1.0- '@earendil-works/pi-mcp': 1.1.0- '@earendil-works/pi-tui': 1.1.0+ '@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=14ebd53075a2fbd0e5f101c88253e555d9e79a21c1e399f7c0e7b652c498dd12)(@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'@silvia-odwyer/photon-node': 0.3.4brace-expansion: 5.0.12chalk: 6.0.0@@ -5341,13 +5171,13 @@ 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.0marked: 18.0.11@@ -5452,234 +5282,156 @@ snapshots:'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@esbuild/[email protected]':optional: true'@esbuild/[email protected]':optional: true- '@esbuild/[email protected]':- optional: true-'@google/[email protected]([email protected])':dependencies:google-auth-library: 10.9.0([email protected])@@ -7317,35 +7069,6 @@ snapshots:'@esbuild/win32-ia32': 0.28.1'@esbuild/win32-x64': 0.28.1- optionalDependencies:- '@esbuild/aix-ppc64': 0.28.2- '@esbuild/android-arm': 0.28.2- '@esbuild/android-arm64': 0.28.2- '@esbuild/android-x64': 0.28.2- '@esbuild/darwin-arm64': 0.28.2- '@esbuild/darwin-x64': 0.28.2- '@esbuild/freebsd-arm64': 0.28.2- '@esbuild/freebsd-x64': 0.28.2- '@esbuild/linux-arm': 0.28.2- '@esbuild/linux-arm64': 0.28.2- '@esbuild/linux-ia32': 0.28.2- '@esbuild/linux-loong64': 0.28.2- '@esbuild/linux-mips64el': 0.28.2- '@esbuild/linux-ppc64': 0.28.2- '@esbuild/linux-riscv64': 0.28.2- '@esbuild/linux-s390x': 0.28.2- '@esbuild/linux-x64': 0.28.2- '@esbuild/netbsd-arm64': 0.28.2- '@esbuild/netbsd-x64': 0.28.2- '@esbuild/openbsd-arm64': 0.28.2- '@esbuild/openbsd-x64': 0.28.2- '@esbuild/openharmony-arm64': 0.28.2- '@esbuild/sunos-x64': 0.28.2- '@esbuild/win32-arm64': 0.28.2- '@esbuild/win32-ia32': 0.28.2- '@esbuild/win32-x64': 0.28.2-diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex 6c4711ece..350312d4e 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -13,17 +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.1.0 release while it is inside the minimum release age window. Keep these+# Pi 1.3.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]'+ - '@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.@@ -59,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 cannotdiff --git a/scripts/check-pi-dependencies.mjs b/scripts/check-pi-dependencies.mjsindex 623c68599..16fcf50f8 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.1.0";+const targetVersion = "1.3.0";function readJson(path) {return JSON.parse(readFileSync(join(root, path), "utf8"));@@ -69,8 +69,8 @@ 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(?:[(:]|$)`).test(lockfile)) {- throw new Error(`pnpm-lock.yaml still contains @earendil-works/${packageName}@1.0.1`);+ if (new RegExp(`@earendil-works/${packageName}@1\\.(?:0|1|2)\\.\\d+(?:[(:]|$)`).test(lockfile)) {+ throw new Error(`pnpm-lock.yaml still contains an outdated @earendil-works/${packageName}`);}}const workspace = readFileSync(join(root, "pnpm-workspace.yaml"), "utf8");@@ -81,17 +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]",+ "@earendil-works/[email protected]",].sort();if (JSON.stringify(actualReleaseAgeExclusions) !== JSON.stringify(expectedReleaseAgeExclusions)) {- throw new Error("Pi minimumReleaseAgeExclude entries must match only the exact 1.1.0 release packages");+ throw new Error("Pi minimumReleaseAgeExclude entries must match only the exact 1.3.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.mjsindex 94072c554..a8fd733e7 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.1.0";+const targetVersion = "1.3.0";const entries = [{name: "@earendil-works/pi-agent-core",@@ -95,7 +95,7 @@ if (for (const declarationPath of ["dist/index.d.ts","dist/types.d.ts",- "dist/utils/assistant-message-frame.d.ts",+ "dist/providers/compat-schema.d.ts","dist/utils/estimate.d.ts","dist/utils/hosted-search.d.ts","dist/utils/local-request-error.d.ts",diff --git a/scripts/pi-patch-hash.test.mjs b/scripts/pi-patch-hash.test.mjsindex 507791b28..13a4ce677 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.1.0";+const TARGET = "1.3.0";const PATCHED = [{name: "@earendil-works/pi-agent-core",@@ -25,7 +25,7 @@ const PATCHED = ['+{"openai-completions":{"chat:deepseek-flash":{"baseUrl":"https://api.deepseek.com","compat":{"supportsMidConvoSystemMessages":true}}}}',"diff --git a/dist/index.d.ts b/dist/index.d.ts","diff --git a/dist/types.d.ts b/dist/types.d.ts",- "diff --git a/dist/utils/assistant-message-frame.d.ts b/dist/utils/assistant-message-frame.d.ts",+ "diff --git a/dist/providers/compat-schema.d.ts b/dist/providers/compat-schema.d.ts","diff --git a/dist/utils/estimate.d.ts b/dist/utils/estimate.d.ts","diff --git a/dist/utils/hosted-search.d.ts b/dist/utils/hosted-search.d.ts","diff --git a/dist/utils/local-request-error.d.ts b/dist/utils/local-request-error.d.ts",@@ -39,7 +39,6 @@ const PATCHED = [},];const RELEASE_AGE_EXCLUDE = [- "chord","pi-agent-core","pi-ai","pi-codemode",