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 upstream main into hosted-search repair
ZeroY529706612ce9
diff --cc docs/spec/06-delivery/04-e2e-test-plan.mdindex 94ae0d176,39a771835..21029244e--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@@ -14394,34 -14454,28 +14454,60 @@@ the latest destination. These assertioncover ownership, deletion, repeated/bounded forks, retained checkpoint paths,expired inputs, rollback, and symlink rejection.+ ### E2E-SCHEDULED-dispatch++ - **Scenario:** Independent task dispatch.+ - **Expected:** The Electron runner admits independent due tasks without awaiting another task's prompt setup. Local in-flight ownership is keyed by task ID and Host instance until setup settles; Host remains authoritative for enabled, due and overlap checks. A replaced Host's completion cannot clear its successor's local ownership. Stop prevents new polls; admitted work keeps the existing execution/failure lifecycle. Failures remain observable and the 90-second late policy is unchanged.+ - **Automation:** `node --experimental-strip-types scripts/e2e-scheduled-dispatch.mjs` uses an isolated real Host and SQLite profile. Inference is not sent to a live provider.+ ### E2E-SCHEDULED-project-removal++ - **Scenario:** Project removal and automations.+ - **Expected:** Removing a project pauses its bound scheduled tasks without deleting their definitions, schedule, workspace binding or run history. Session references in history may become null when the project's conversations are removed. Already admitted task runs block removal even before a conversation turn starts. Tasks belonging to other projects and unbound legacy tasks are unaffected. Explicit resume or Run now may recreate a project from the preserved path; automatic polling cannot do so while paused.+ - **Automation:** `node --experimental-strip-types scripts/e2e-scheduled-project-removal.mjs` uses an isolated real Host and SQLite profile. Inference is not sent to a live provider.+ ### E2E-SCHEDULED-legacy-pause++ - **Scenario:** Legacy task maintenance.+ - **Expected:** Agent tools allow title, prompt and pause updates on legacy automatic tasks without a schedule, including an echoed unchanged cadence. These edits do not arm the task or capture the foreground workspace. Explicit enabling, a cadence change or a supplied schedule still follows schedule validation. Resume requires an explicit valid schedule; Manual-to-Hourly retains its existing default interval behavior.+ - **Automation:** `node --experimental-strip-types scripts/e2e-scheduled-legacy-maintenance.mjs` uses an isolated real Host and SQLite profile. Inference is not sent to a live provider.+ ### E2E-SCHEDULED-calendar-intent++ - **Scenario:** Calendar intent.+ - **Expected:** The optional config_json.calendarConfigured boolean distinguishes an explicitly configured Daily/Weekly calendar from Hourly's internal schedule placeholder. Without the key, legacy Daily/Weekly schedules are treated as configured; legacy Hourly schedules retain their values but require an explicit schedule when converting to Daily/Weekly. Known calendar intent survives Hourly and restart, including midnight. Clearing or replacing the calendar with a different non-calendar placeholder clears intent. This additive extension needs no table/schema migration; older versions ignore it and cannot enforce the new conversion guard. Metadata-only edits and Manual-to-Hourly remain unchanged.+ - **Automation:** `node --experimental-strip-types scripts/e2e-scheduled-calendar-intent.mjs` uses an isolated real Host and SQLite profile. Inference is not sent to a live provider.+ ### E2E-SCHEDULED-paths++ - **Scenario:** Workspace identity.+ - **Expected:** Stored workspace bindings use the existing project canonicalization contract on both write and read. On Windows, slash direction, case, trailing separators and extended path prefixes do not hide a task from its own project's conversation. The distinction between missing legacy bindings and explicit null remains unchanged. Foreign-project tools cannot list or mutate bound tasks.+ - **Automation:** `node --experimental-strip-types scripts/e2e-scheduled-paths.mjs` uses an isolated real Host and SQLite profile. Inference is not sent to a live provider.+++## Hosted-search continuation contract (offline sidecar)++**Scope:** ADR 0297; provider-hosted search content, estimation, local tools,+Task delegation, and saved-history recovery. No real model or search service.++**Entry:** `pnpm test:e2e:hosted-search`, which rebuilds the shared+package and `@pi-desktop/agent-runtime` sidecar bundle. The test starts that+bundle over its ordinary stdio RPC interface, with an isolated data root,+a synthetic Host and a loopback-only Responses endpoint. Source-only mocks+or an already installed desktop application do not satisfy this test.++| Case | Required observation |+| --- | --- |+| Search then new user prompt | Valid search item is replayed and the second turn completes. |+| Search then ordinary local tool | A real tool round completes and the next provider request is prepared without type/estimation failure. |+| Search then Task | Actual delegation orchestration runs against a synthetic provider; parent continuation finishes without repeated local errors. |+| Saved search history restored | A fresh runtime preserves search replay without adding fake tool fields or rewriting the original record. |+| Usage invalidated by a real prefix change | The isolated sidecar changes instructions during a real Read round; the prior nonzero usage no longer covers that prefix, and continuation succeeds. |+| Invalid saved replay container | Restore returns safe INTERNAL/context-validation, sends no provider request or persistence Host RPC, and keeps the process healthy. In-memory immutability is checked by the replay unit tests. |+| Unknown saved search phase | The same explicit rejection is observed without silently discarding the search record. |++**Companion gates:** Responses/Azure/Anthropic adapter contracts; typed search+phases; zero/valid/stale usage; changed/unchanged system prefix and tool ledger;+search content growth and CJK output budgets; structured local preparation+failures without retry/fetch, ordinary transport retry and cancellation. Dependency upgrades must run+these gates against the locked dependency version and record the tested bundle.++**Evidence:** record build and test exit codes, baseline SHA, dependency versions,+artifact identity and independent review in+`docs/project/hosted-search-contract-verification.md`. Never record private+conversation content or credentials. A skipped test remains NOT RUN, not PASS.diff --cc docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex b112f80c0,3015ed50a..94ca49076--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@@ -8551,26 -8582,53 +8582,77 @@@ the latest destination. These assertion覆盖附件归属、删除、重复与截断分支、保留的压缩检查点引用、过期输入、失败回滚及符号链接拒绝。+ ### E2E-011f 补充:入队确认前的操作锁定++ - **前提**:会话正在回复,可控制 Host 入队请求的完成时刻。+ - **步骤**:发送一条后续消息,暂停入队;尝试编辑或删除;释放入队后再次编辑或删除,+ 然后刷新队列。用带文件引用的草稿重复;让本地 Host 入队请求超过现有 RPC 超时后重试。+ - **预期**:未确认时五个行操作都禁用且提示正在保存,立即发送按钮也显示正在保存,+ 条目不消失,也不回填第二份草稿;+ 确认后删除能移除持久化条目,编辑完整回填草稿及文件引用,刷新不会恢复已移除条目。+ 本地 Host 超时后移除未确认行、显示错误并恢复被拒绝的草稿,重试可正常入队。+ - **规格**:`04-ux/08-component-spec.md`、`04-ux/09-interaction-patterns.md`。+ - **验收 / 里程碑**:C、Quality / M6+。+ - **状态**:组件与状态层用户路径由 `queue-pending-actions.test.mjs` 覆盖。++ ### E2E-SCHEDULED-dispatch++ - **场景**:独立分发到期任务。+ - **预期**:Electron runner 无需等待其他任务的提示词准备即可准入彼此独立的+ 到期任务;本地所有权按任务 ID 和 Host 实例保留,Host 继续负责 enabled、+ due 和重叠检查。停止只阻止新轮询,错误仍可观察,迟到 90 秒的规则不变。+ - **自动化**:`node --experimental-strip-types scripts/e2e-scheduled-dispatch.mjs`+ ### E2E-SCHEDULED-project-removal++ - **场景**:删除项目与自动任务。+ - **预期**:删除项目会暂停其绑定任务,并保留任务定义、schedule、工作区绑定和+ 运行历史;已准入的任务会阻止删除。其他项目和未绑定旧任务不受影响。用户显式+ 恢复或 Run now 可以重新创建项目,暂停状态下的自动轮询不会这样做。+ - **自动化**:`node --experimental-strip-types scripts/e2e-scheduled-project-removal.mjs`+ ### E2E-SCHEDULED-legacy-pause++ - **场景**:旧任务维护。+ - **预期**:Agent 工具可对缺少 schedule 的旧版自动任务修改标题、提示词或暂停,+ 包括回传未变化的 cadence;维护不会启用任务或捕获前台工作区。显式启用、改变+ cadence 或提供 schedule 时仍执行校验,Manual 转 Hourly 的默认间隔行为不变。+ - **自动化**:`node --experimental-strip-types scripts/e2e-scheduled-legacy-maintenance.mjs`+ ### E2E-SCHEDULED-calendar-intent++ - **场景**:日历配置意图。+ - **预期**:可选的 `config_json.calendarConfigured` 区分明确设置的每日/每周+ 日历时间与 Hourly 内部占位 schedule。旧版 Daily/Weekly 保留日历语义;+ 旧版 Hourly 转换时必须明确提供 schedule。已知配置可跨 Hourly 与重启保留,+ 包括午夜;仅修改元数据以及 Manual 转 Hourly 的行为不变。+ - **自动化**:`node --experimental-strip-types scripts/e2e-scheduled-calendar-intent.mjs`+ ### E2E-SCHEDULED-paths++ - **场景**:工作区身份。+ - **预期**:保存和读取工作区绑定时统一使用现有项目路径规范化规则。Windows+ 路径的斜杠方向、大小写、末尾分隔符和扩展路径前缀差异不影响同项目会话;+ 缺失的旧版绑定与显式 null 保持不同语义,其他项目不能查询或修改绑定任务。+ - **自动化**:`node --experimental-strip-types scripts/e2e-scheduled-paths.mjs`+ 使用隔离的真实 Host 与 SQLite 配置,不向真实提供商发送推理请求。+++## 原生搜索续跑契约(离线 sidecar)++**范围:** ADR 0297;供应商原生搜索内容、估算、本地工具、Task 委派及历史恢复。不调用真实模型或搜索服务。++**入口:** `pnpm test:e2e:hosted-search` 自行重建 shared 与 agent-runtime sidecar。+通过普通 stdio RPC 驱动该产物,使用隔离数据目录、合成 Host 与仅回环地址的 Responses 服务。+只测源码或使用已有桌面安装包不满足本测试。++| 场景 | 必须观察到的结果 |+| --- | --- |+| 搜索后新用户消息 | 合法搜索项被回放,第二轮正常结束。 |+| 搜索后普通本地工具 | 真实工具轮完成,下一模型请求准备无类型或估算错误。 |+| 搜索后 Task | 实际委派流程使用合成模型,父代理继续且不重复报告本地错误。 |+| 保存搜索历史后恢复 | 新运行时保留搜索回放,不添加假工具字段或改写原记录。 |+| 真实前缀变化使 usage 失效 | 隔离 sidecar 在真实 Read 轮中更新指令;此前非零 usage 不再覆盖该前缀,续跑正常结束。 |+| 非法历史回放容器 | 恢复返回安全的 INTERNAL/context-validation;不发送模型请求或持久化 Host RPC,进程仍健康。内存中输入不变性由回放单元测试验证。 |+| 未知历史搜索阶段 | 明确拒绝该记录,而不是静默丢弃搜索内容;其余断言同上。 |++**配套检查:** Responses/Azure/Anthropic 请求契约、搜索阶段类型、有效/零/失效 usage、+真实与无变化的系统前缀及工具增删、搜索数据增长、中文输出预算;结构化本地准备失败不重试、不 fetch,普通传输重试与取消保持正确。依赖升级必须对锁定版本运行这些检查,记录测试的 bundle。++**证据:** 记录构建和测试退出码、基线 SHA、依赖版本、产物标识及独立评审,报告位于+`docs/project/hosted-search-contract-verification.md`。不得记录真实会话或凭据。未执行明确标为 NOT RUN,不得标为 PASS。