Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
merge(main): refresh PR review candidate
vastsaacf2c2e926fb
diff --cc docs/spec/06-delivery/04-e2e-test-plan.mdindex e9842ba79,fd9539868..a01b7aece--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@@ -16361,78 -16411,24 +16411,97 @@@ renderer's durable transcript reads. Nseparate release qualification. No MCP, Codemode or virtual-router migrationis 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.++++ #### E2E-262: Transcript path:line opens and scrolls the host file viewer++ - **Preconditions:** Isolated Electron/Chromium, an active workspace and session,+ the bundled file-manager view available, and deterministic filesystem IPC+ fixtures.+ - **Steps:** Render a real transcript `path:line:column` reference followed by+ sentence punctuation; click its verified file chip and wait for the host file+ viewer to load.+ - **Expected:** Despite the bundled file-manager view being available, the+ positioned reference opens in the host's read-only file tab. The file request+ retains its line and column, and the viewer scrolls the requested line into+ the visible center area. The path and file contents remain the same as the+ reference target.+ - **Specs:** `04-ux/08` §11.8; ADR 0262.+ - **Status:** `node scripts/e2e-file-ref-line-scroll.mjs` mounts production+ `LinkifiedText` and `FilesTab` in isolated Electron with filesystem IPC+ fixtures; no real project files or provider are used.+### Imported-extension GUI executable discovery regression (#1173)Start dependency installation with a GUI-like PATH that cannot resolve Node/npmdiff --cc docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex 415a90320,0831bdb1f..51006ac2b--- 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,39 -9290,14 +9290,47 @@@ 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.++ #### E2E-262:聊天 path:line 引用打开文件并滚动到目标行++ - **前提:** 隔离 Electron/Chromium、活动工作区和会话、可用的随应用打包文件管理器视图,以及确定性的文件系统 IPC fixture。+ - **步骤:** 渲染真实聊天中的 `path:line:column` 引用并在末尾加句末标点;点击已验证的文件芯片,等待宿主文件查看器加载。+ - **预期:** 即使文件管理器视图可用,带位置的引用仍打开宿主只读文件选项卡。文件请求保留行列号,查看器滚动到视口中间的目标行;打开路径和文件内容与引用目标一致。+ - **规格:** `04-ux/08` §11.8;ADR 0262。+ - **状态:** `node scripts/e2e-file-ref-line-scroll.mjs` 在隔离 Electron 中挂载生产 `LinkifiedText` 与 `FilesTab`,并通过文件系统 IPC fixture 提供文件内容;不访问真实项目文件或模型服务。+### 导入扩展时发现 GUI 环境下的可执行文件回归(#1173)使用无法解析 Node/npm 的 GUI 风格 `PATH` 启动依赖安装,并在 `~/.local/bin` 准备可信 fixture 安装。