Skip to content

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

chore(markdown): resolve documentation conflicts with current main

yuxinod89025a82b7d
diff --cc docs/project/unreleased.md
index 7a7a2a8cf,12f7e73bd..430f3a7cb
--- a/docs/project/unreleased.md
+++ b/docs/project/unreleased.md
@@@ -1,8 -1,14 +1,17 @@@
# Unreleased changes
+- Copy individual Markdown tables, download them as CSV, or expand them for
+ reading without leaving the conversation.
+
+ - A stored hosted web-search record that cannot be replayed no longer fails every
+ later request in that conversation: the message continues without search replay,
+ so histories written before the contract change stay usable.
+
+ - Hosted web search now has a complete replay and estimation contract, including
+ tool/Task continuation and restart recovery. Context rebuilding preserves
+ system-prefix semantics, and structured local preparation failures no longer
+ masquerade as retryable provider failures. Existing search histories need no migration.
+
- The Composer reasoning slider now moves smoothly to clicked or
keyboard-selected levels, follows dragging immediately, and respects
reduced-motion settings. Rapid clicks redirect the animation; failed saves
diff --cc docs/spec/06-delivery/04-e2e-test-plan.md
index fe49670dc,90b298a14..3ada321e0
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@@ -14480,23 -14517,34 +14517,55 @@@ the latest destination. These assertion
- **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.
+### E2E-MARKDOWN-table-actions
+
+- **Setup**: Render a conversation containing two Markdown tables, including
+ aligned columns, formatted text, Chinese text, commas, quotes, and `<br>` cells.
+- **Steps**: Copy the first table; download its CSV; expand it; use copy inside
+ the modal; close with Escape and with Close. Append a streamed row while the
+ preview is open. Repeat the preview at a narrow width in light/dark themes
+ and English/Chinese. Deny clipboard writes at the browser boundary.
+- **Expected**: Actions operate only on their own table. Markdown retains inline
+ syntax and alignment. CSV decodes as UTF-8 and preserves fields and line breaks.
+ The modal fits the viewport, traps focus, updates streamed rows, blocks native
+ work-panel surfaces, and returns focus on dismissal. Narrow previews keep short
+ headers on one line and scroll horizontally; sticky headers fully cover the
+ rows behind them. Failed copies report an
+ error, not success. Existing table wrapping remains intact.
+- **Automated coverage**: `node --test apps/desktop/test/markdown-table.test.mjs`
+ and `node scripts/test-markdown-table.mjs` after building the desktop. The
+ latter mounts the production Markdown component in an isolated Electron
+ window and exercises real clipboard/download boundaries. It does not call a
+ model or use the user's app profile.
++
+ ## 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.md
index d65bc3181,67407c32f..76ef2bc22
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@@ -8633,23 -8651,26 +8651,47 @@@ the latest destination. These assertion
- **自动化**:`node --experimental-strip-types scripts/e2e-scheduled-paths.mjs`
使用隔离的真实 Host 与 SQLite 配置,不向真实提供商发送推理请求。
+### E2E-MARKDOWN-table-actions
+
+- **Setup**: Render a conversation containing two Markdown tables, including
+ aligned columns, formatted text, Chinese text, commas, quotes, and `<br>` cells.
+- **Steps**: Copy the first table; download its CSV; expand it; use copy inside
+ the modal; close with Escape and with Close. Append a streamed row while the
+ preview is open. Repeat the preview at a narrow width in light/dark themes
+ and English/Chinese. Deny clipboard writes at the browser boundary.
+- **Expected**: Actions operate only on their own table. Markdown retains inline
+ syntax and alignment. CSV decodes as UTF-8 and preserves fields and line breaks.
+ The modal fits the viewport, traps focus, updates streamed rows, blocks native
+ work-panel surfaces, and returns focus on dismissal. Narrow previews keep short
+ headers on one line and scroll horizontally; sticky headers fully cover the
+ rows behind them. Failed copies report an
+ error, not success. Existing table wrapping remains intact.
+- **Automated coverage**: `node --test apps/desktop/test/markdown-table.test.mjs`
+ and `node scripts/test-markdown-table.mjs` after building the desktop. The
+ latter mounts the production Markdown component in an isolated Electron
+ window and exercises real clipboard/download boundaries. It does not call a
+ model or use the user's app profile.
++
+ ## 原生搜索续跑契约(离线 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。