Skip to content

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

merge(main): sync review candidate with main

vastsaef02f0d1e3da
diff --cc docs/spec/06-delivery/04-e2e-test-plan.md
index e7e8d853a,5aadef689..e9842ba79
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@@ -16361,74 -16361,12 +16361,84 @@@ renderer's durable transcript reads. N
separate release qualification. No MCP, Codemode or virtual-router migration
is included. See `docs/project/pi-0991-adoption.md` for candidate evidence.
+### E2E-SYSTEM-TRANSCRIPT: Ordered model state survives restart and compaction
+
+- Fixture: isolated Host data directory, production AgentSidecar transport and
+ separate Node runtime/Pi process, local SSE provider; no real provider
+ credentials or user's Desktop process. The harness persists completed
+ messages; it does not exercise Electron's UI or persistence outbox.
+- Send a prompt, activate BrowserPreview through ToolSearch, and verify the next
+ request includes the schema. Confirm the baseline and delta are acknowledged
+ by Host and survive stopping/restarting both processes without duplicate rows.
+- Resume the session, update a skill catalog on the same runtime, and confirm the
+ next request uses the new catalog while keeping a second unchanged entry.
+ Runtime/adapter tests verify the native delta contains only the modified entry,
+ and fallback models receive the complete current catalog with removals applied.
+ Invoke Skill through the actual sidecar
+ bridge with a fixture body supplied by the embedding host. Compact, restart
+ the sidecar, and verify current skills and active tools survive without
+ replaying old tool results. Remove the final skill and verify its catalog and
+ executable schema disappear without recreating the runtime.
+- Automated: `node scripts/e2e-system-transcript.mjs` with
+ `PI_DESKTOP_HOST_BIN` pointing to the candidate Host binary. Requires built
+ shared/host-runtime/agent-runtime packages. Renderer projection tests ensure
+ model-state records stay hidden while ordinary system notices remain visible.
+- Adapter contract tests cover exact model/API/endpoint capability binding,
+ partial support, unverified relay fallback, removals/redefinitions and model
+ switching without canonical-history mutation. Real cache-hit improvement is
+ a separately authorized provider experiment, not an offline-test claim.
+
+- Flash regression: load the pinned Pi `deepseek-flash` model, serialize its
+ Desktop projection, and pass skill updates/removals through the real adapter.
+ The official binding preserves the earlier wire prefix; changed bindings
+ retain the folded fallback. Covered by `flash-transcript.test.ts`.
+- Authorized live Flash acceptance: use isolated development sessions with
+ short and long contexts. Alternate unchanged turns and single-skill updates,
+ confirm current Skill bodies execute, and compare actual outgoing prefixes
+ plus reported usage. After restart, verify no duplicate system updates and
+ same-model assistant reasoning remains separate from visible content. Adapter
+ regressions also cover legacy identities and genuine account/model changes. Cache
+ percentages are observations, not deterministic pass thresholds.
+
+### E2E-FIXED-TOOL-DECLARATIONS: Stable Flash schemas with independent activation
+
+- Fixture: production AgentSidecar and isolated Host, official Pi Flash binding,
+ and a child-process fetch boundary redirected to local HTTP/SSE. Credentials
+ are dummy values and synthetic tools have no external side effects.
+- Prompt, search Alpha, execute Alpha, search Beta and execute Beta. HTTP payload
+ tests assert identical ordered `tools` and unchanged prior message prefixes.
+ Directly calling a declared but inactive tool must fail before the Host.
+- Restart both processes, then compact and restart again: Alpha stays activated,
+ Beta remains inactive despite its declaration. Activate Beta, then remove it
+ from the catalog and verify it cannot execute. New schema/route epochs must
+ not restore old grants. Host rejection and Plan guards remain effective.
+- Runtime contracts additionally cover legacy migration, interrupted activation,
+ malformed metadata, temporary prompt replacement, deterministic catalog order,
+ the 128-tool boundary and insufficient-context fallback.
+- Automated: `node scripts/e2e-fixed-tool-declarations.mjs` with built
+ shared/host-runtime/agent-runtime and `PI_DESKTOP_HOST_BIN` set to the candidate
+ Host binary; `fixed-tool-runtime.test.ts` and `fixed-tool-declarations.test.ts`
+ cover HTTP payload and policy contracts. Electron UI/outbox is outside this
+ fixture's scope.
+- Separately authorized official Flash experiments compare several independent
+ on-demand/fixed sessions with the same synthetic catalog and call sequence.
+ Record cold requests, both activations, follow-up cache hits/misses and
+ cumulative input cost. Report the larger first request and possible short-chat
+ cost increase, alongside any longer-conversation benefit. Offline test success
+ alone is not evidence of provider cache behavior.
+
+- Overflow/system-update integration: recover a provider context overflow with
+ a system delta after the failed assistant message. Keep that delta, remove the
+ failed assistant before compaction, and reuse one visible assistant message
+ through successful recovery. Terminal failure and Stop retain their existing
+ closure behavior. Covered by the parameterized runtime overflow user-path test.
++
+ ### Imported-extension GUI executable discovery regression (#1173)
+
+ Start dependency installation with a GUI-like PATH that cannot resolve Node/npm
+ and a trusted fixture installation in `~/.local/bin`. Validation and both npm
+ stages must use that installation, preserve the application PATH, and avoid shell
+ startup probing. Explicit selections keep their bin directory first. Missing
+ installations still return `npm-unavailable` and retain native picker recovery.
+ The executable integration fixture uses real isolated child processes and checks
+ registry-only installation and credential isolation.
diff --cc docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 056d9d57f,ca7583835..415a90320
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@@ -9260,35 -9260,9 +9260,42 @@@ the latest destination. These assertion
- **里程碑:** M6+
- **状态:** 单测和源码契约覆盖(`update-cache.test.mjs`、`auto-update.test.mjs`);仍需 Windows 安装器/E2E 验证。
+### E2E-FIXED-TOOL-DECLARATIONS: Stable Flash schemas with independent activation
+
+- Fixture: production AgentSidecar and isolated Host, official Pi Flash binding,
+ and a child-process fetch boundary redirected to local HTTP/SSE. Credentials
+ are dummy values and synthetic tools have no external side effects.
+- Prompt, search Alpha, execute Alpha, search Beta and execute Beta. HTTP payload
+ tests assert identical ordered `tools` and unchanged prior message prefixes.
+ Directly calling a declared but inactive tool must fail before the Host.
+- Restart both processes, then compact and restart again: Alpha stays activated,
+ Beta remains inactive despite its declaration. Activate Beta, then remove it
+ from the catalog and verify it cannot execute. New schema/route epochs must
+ not restore old grants. Host rejection and Plan guards remain effective.
+- Runtime contracts additionally cover legacy migration, interrupted activation,
+ malformed metadata, temporary prompt replacement, deterministic catalog order,
+ the 128-tool boundary and insufficient-context fallback.
+- Automated: `node scripts/e2e-fixed-tool-declarations.mjs` with built
+ shared/host-runtime/agent-runtime and `PI_DESKTOP_HOST_BIN` set to the candidate
+ Host binary; `fixed-tool-runtime.test.ts` and `fixed-tool-declarations.test.ts`
+ cover HTTP payload and policy contracts. Electron UI/outbox is outside this
+ fixture's scope.
+- Separately authorized official Flash experiments compare several independent
+ on-demand/fixed sessions with the same synthetic catalog and call sequence.
+ Record cold requests, both activations, follow-up cache hits/misses and
+ cumulative input cost. Report the larger first request and possible short-chat
+ cost increase, alongside any longer-conversation benefit. Offline test success
+ alone is not evidence of provider cache behavior.
+
+- Overflow/system-update integration: recover a provider context overflow with
+ a system delta after the failed assistant message. Keep that delta, remove the
+ failed assistant before compaction, and reuse one visible assistant message
+ through successful recovery. Terminal failure and Stop retain their existing
+ closure behavior. Covered by the parameterized runtime overflow user-path test.
++
+ ### 导入扩展时发现 GUI 环境下的可执行文件回归(#1173)
+
+ 使用无法解析 Node/npm 的 GUI 风格 `PATH` 启动依赖安装,并在 `~/.local/bin` 准备可信 fixture 安装。
+ 校验和 npm 两个安装阶段都必须使用该安装,同时保留应用自身的 `PATH`,且不探测 shell 启动文件。
+ 显式选择的 npm 仍优先使用其所在目录。缺少安装时仍返回 `npm-unavailable` 并保留原生选择器恢复路径。
+ 可执行集成 fixture 使用真实隔离子进程,并检查仅注册表安装和凭据隔离。