From 4ebd3e9bddea880e34e2ac7873267eceb1b6aaf6 Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Sat, 17 Oct 2026 02:12:44 +0800 Subject: [PATCH] chore: adapt sidebar to DSH 0.2.1-alpha.5 --- .github/workflows/ci.yml | 34 +- AGENTS.md | 11 +- CHANGELOG.md | 9 + CHANGELOG_EN.md | 9 + README.md | 22 +- README_ZH.md | 22 +- docs/external-plugin-guide.md | 5 +- docs/host-contracts.md | 13 +- ...2026-10-16-dsh-0.2.1-alpha.5-adaptation.md | 62 + dsh.plugin.json | 4 +- package.json | 100 +- pnpm-lock.yaml | 1192 +++++++++-------- pnpm-workspace.yaml | 1 - scripts/e2e-common.sh | 13 +- scripts/install.ps1 | 4 +- scripts/install.sh | 4 +- scripts/package-registry.mjs | 1 - src/active-worktree.ts | 58 +- src/client/SideChatView.tsx | 1 + src/client/block-labels.ts | 2 + src/client/locales-ar.ts | 1 + src/client/locales-de.ts | 1 + src/client/locales-fr.ts | 1 + src/client/locales-hi.ts | 1 + src/client/locales-id.ts | 1 + src/client/locales-it.ts | 1 + src/client/locales-ja.ts | 1 + src/client/locales-ko.ts | 1 + src/client/locales-nl.ts | 1 + src/client/locales-pl.ts | 1 + src/client/locales-pt.ts | 1 + src/client/locales-ru.ts | 1 + src/client/locales-sv.ts | 1 + src/client/locales-th.ts | 1 + src/client/locales-tr.ts | 1 + src/client/locales-vi.ts | 1 + src/client/locales-zh-HK.ts | 1 + src/client/locales-zh-MO.ts | 1 + src/client/locales-zh-TW.ts | 1 + src/client/locales.ts | 2 + src/client/service.ts | 2 +- src/context-types.ts | 68 +- src/index.ts | 61 +- src/invariant.ts | 32 - src/sidechat-routes.ts | 19 +- src/trust-fence.ts | 126 -- tests/active-worktree.spec.ts | 40 +- tests/archive.spec.ts | 2 +- tests/block-labels.spec.ts | 16 + tests/changes-tab.spec.tsx | 5 +- tests/dsh-baseline.spec.ts | 51 + tests/e2e/blank-session-dock-entry.e2e.ts | 27 +- tests/e2e/git-graph.e2e.ts | 7 +- tests/e2e/git-layout.e2e.ts | 7 +- tests/e2e/host.ts | 35 + tests/e2e/mount.e2e.ts | 42 +- tests/e2e/native-reload.e2e.ts | 29 +- tests/e2e/perf.e2e.ts | 30 +- tests/e2e/tree-scroll.e2e.ts | 27 +- tests/e2e/zz-expand-refresh.e2e.ts | 20 +- tests/file-stream-route.spec.ts | 4 +- tests/fs-create-file.spec.ts | 4 +- tests/fs-read-page.spec.ts | 4 +- tests/fs-write-route.spec.ts | 4 +- tests/git-remote-actions.spec.ts | 2 +- tests/git-suggest-route.spec.ts | 2 +- tests/market-manifest.spec.ts | 2 +- tests/plugin-shape.spec.ts | 2 +- tests/sidechat-compaction-seed.spec.ts | 83 +- tests/sidechat-routes.spec.ts | 77 +- tests/smoke.spec.ts | 173 ++- tests/trusted-hosts.spec.ts | 509 ++----- tsdown.config.ts | 5 +- 73 files changed, 1512 insertions(+), 1593 deletions(-) create mode 100644 docs/plans/2026-10-16-dsh-0.2.1-alpha.5-adaptation.md delete mode 100644 src/invariant.ts delete mode 100644 src/trust-fence.ts create mode 100644 tests/block-labels.spec.ts create mode 100644 tests/dsh-baseline.spec.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f42046a1..ae44c32f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,38 +171,14 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile - # Pin the DSH CLI the lane mounts into; the profile's bundle stack - # (dsh-base / dsh-web-app) resolves from this installation. Keep in - # step with the plugin's @deepseek-ai/* peer range when bumping. - # Write an EXACT version, never a dist-tag: when 0.1.7-rc.1 shipped, the - # npm `alpha` tag still meant 0.1.7-alpha.2, rc.1 went out on `next`, and - # `latest` was still the 0.1.5 line — `@alpha` would mount a host this - # plugin no longer supports. The 0.2.0 line repeats the pattern: its - # first candidate is `next` while `latest` is still 0.1.7-rc.2. - # The lanes speak the slash-only RPC dialect - # (tests/e2e/host-protocol.ts). - # - # The larger heap is the fix for one of the two ways this step used to - # die (runs 34490912649 and 34363627184 on the alpha line): the pinned - # version's TRANSITIVES are declared as floating `^` ranges, so while - # upstream publishes a prerelease in stages (0.1.5-rc.2 went out - # 14:43-14:57 on 2026-09-10) npm resolved a mixed peer graph — - # 3062 ERESOLVE lines, then "Ineffective mark-compacts near heap limit" - # (exit 134). The other failure mode was a hard ETARGET on a sibling - # package that appeared minutes later; pinning a version that is fully - # published (not mid-flight) is the fix for that one. - # - # Peer resolution stays ON: `--legacy-peer-deps` was tried in the first - # cut of this fix and made the install broken rather than robust — it - # skips exactly the peers a global install has to supply, and - # @deepseek-ai/dsh-app-boot requires `@deepseek-ai/cordis-plugin-group` - # (a peer, not a dependency) at boot, so the CLI died with - # ERR_MODULE_NOT_FOUND before the smoke could even start. Verified - # locally that the plain install resolves it. + # Pin the exact 0.2.1-alpha.5 host CLI; never use a dist-tag. + # Keep peer resolution ON: do not add --legacy-peer-deps; it skips boot peers. + # The lanes speak the slash-only RPC dialect (tests/e2e/host-protocol.ts). + # NODE_OPTIONS below preserves the heap budget needed for prerelease peer resolution. - name: Install dsh CLI (pinned) env: NODE_OPTIONS: --max-old-space-size=4096 - run: npm install -g @deepseek-ai/dsh@0.2.0-rc.2 + run: npm install -g @deepseek-ai/dsh@0.2.1-alpha.5 # lib/ is gitignored; the tarball is produced from this build. - name: Build and pack the npm tarball diff --git a/AGENTS.md b/AGENTS.md index 22e9e8f2..d0032584 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -31,7 +31,7 @@ 本地:`pnpm build && pnpm pack && pnpm exec playwright install chromium && pnpm test:mount`。 -- **钉版写精确版本号,绝不写 dist-tag**(`alpha` / `latest` / `next` 的指向与候选版经常不一致);默认与 CI 同为 `@deepseek-ai/dsh@0.2.0-rc.2`。 +- **钉版写精确版本号,绝不写 dist-tag**(`alpha` / `latest` / `next` 的指向与候选版经常不一致);默认与 CI 同为 `@deepseek-ai/dsh@0.2.1-alpha.5`。 - 该步骤需要 `NODE_OPTIONS=--max-old-space-size=4096`(浮动的传递依赖会组出混合 peer 图 → ERESOLVE 后 OOM);**不要加 `--legacy-peer-deps`**(会跳掉 boot 必需的 peer,CLI 直接 `ERR_MODULE_NOT_FOUND`)。 - 本机 npm registry 是 npmmirror、对新预发布滞后:装不到时 `pnpm install --registry https://registry.npmjs.org`。 - Windows lane 跑 `pnpm test:windows`(`--maxWorkers=1`),`vitest.config.ts` 的 `testTimeout: 30_000` 与它配套。e2e spec 命名 `*.e2e.ts` + vitest `exclude` 双保险;**改 `exclude` 必须保留默认排除项**。 @@ -40,11 +40,12 @@ ## 3. DSH 版本适配 -- **当前基线 DSH 0.2.0-rc.2(v0.25.0 起)**。14 条 `@deepseek-ai/dsh-*` peer 一律写 `^<基线>` 浮动 caret 范围、**绝不钉精确版本**(只有 devDependencies 精确钉);精确版本、或没有预发布子句的范围会被宿主启动预检整行静默禁用。`tests/market-manifest.spec.ts` 钉住这条形状。 -- **caret 跨不过 minor**:`^0.1.7-rc.1` 对 `0.2.0-rc.1` 判定为 false → 整行 `disabled`、插件静默不加载。**抬基线必须同批抬 peer 下限。** -- 支持线(用户侧):0.2.0-rc.1 及更早(含 0.1.7 线)固定 v0.24.1;0.1.7 线的最后支持版是 **v0.22.1**(v0.23.0 从未发布到 npm)。按本仓库先例**不写运行时兼容层**。 -- **抬基线动作清单**:① `pnpm peers check`,把失配的传递 peer 提升进 devDependencies;② 扫宿主包产物的**裸 import 差集**(`pnpm peers check` 看不到这类失败,0.1.7 线是 `zustand` / `immer`);③ 对消费的宿主包做类型面 diff(重点 `ui-primitives` / `dsh-session` / `sidebar-right`),确认导出只增不减;④ 复查会话格式版本、`SUBAGENT_DESCRIPTOR_VERSION`、web profile 的 inject 列表;⑤ 同批同步 CI 钉版、`scripts/e2e-common.sh`、**`scripts/install.sh`(随包发布、会直接给用户 npx 命令)** 与 README / 指南的版本行。 +- **当前基线 DSH 0.2.1-alpha.5(v0.28.0-alpha.0 起)**。13 条 `@deepseek-ai/dsh-*` peer 一律写 `^<基线>` 浮动 caret 范围、**绝不钉精确版本**(只有 devDependencies 精确钉);本包不声明 `package.json#engines.dsh`,因此走 peer 兼容性检查;alpha.5 对声明了该字段的包优先且仅按它判定,不读 peer。`dsh.plugin.json#engines.dsh` 不参与这一规则。`tests/market-manifest.spec.ts` 钉住这条形状。 +- **0.x caret 不跨 minor,但可跨 patch**:`^0.1.7-rc.1` 对 `0.2.0-rc.1` 判定为 false → 整行 `disabled`、插件静默不加载。**抬基线必须同批抬 peer 下限。** +- 支持线(用户侧):0.2.0-rc.2 用户固定 npm 已发布的 **v0.26.1**(v0.27.0 尚未发布);0.2.0-rc.1 用户固定 v0.24.1;0.1.7 线的最后支持版是 **v0.22.1**(v0.23.0 从未发布到 npm)。按本仓库先例**不写运行时兼容层**。 +- **抬基线动作清单**:① `pnpm peers check`,把失配的传递 peer 提升进 devDependencies;② 扫宿主包产物的**裸 import 差集**(`pnpm peers check` 看不到这类失败,0.1.7 线是 `zustand` / `immer`);③ 对消费的宿主包做类型面 diff(重点 `ui-primitives` / `dsh-session` / `sidebar-right`),确认导出只增不减;④ 复查会话格式版本、`SUBAGENT_DESCRIPTOR_VERSION`、web profile 的 inject 列表;⑤ 同批同步 CI 钉版、`scripts/e2e-common.sh`、**`scripts/install.sh` / `scripts/install.ps1`(随包发布、会直接给用户 npx 命令)** 与 README / 指南的版本行。 - **用户 profile 自己的 `overrides: '@deepseek-ai/dsh-*'` 要同批抬**,否则旧包遮蔽 bundle → 预检禁用 `config-editor` → `settings` 行永久 `pending`;先看宿主日志的 `disabling profile plugin row` 与 `pending (waiting for service: …)`。 +- **alpha.5 删除契约**:不再依赖 `@deepseek-ai/dsh-invariants`、`ctx.invariants` 或上游 `/invariant` 子路径,也不发布本插件的 invariant companion;HTTP/WS 准入统一调用 `ctx.connection.requestRejection(req)`,仅 `undefined` 放行,不恢复 `webRuntime` / 自建信任例外。 - 动设置面 / sidechat / 原生 tab 之前,先读 [docs/host-contracts.md](docs/host-contracts.md)(原 §3.4 的 1–12 条按原编号都在那里)。 --- diff --git a/CHANGELOG.md b/CHANGELOG.md index a99e0824..34d9bcff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ > 本文档收录 dsh-better-sidebar 的完整发布历史(最新版摘要见 [README](README_ZH.md);同步发布于 [GitHub Releases](https://github.com/omdsh-dev/DSH-better-sidebar/releases))。 +### v0.28.0-alpha.0(本地验证完成,未发布) + +- **支持线前移到 DSH 0.2.1-alpha.5+**:13 条 DSH peer 使用 `^0.2.1-alpha.5`,开发依赖与 CI / 安装脚本钉精确基线。0.2.0-rc.2 用户请固定 npm 已发布的 **v0.26.1**(v0.27.0 尚未发布);本 alpha 使用 `dsh-better-sidebar@0.28.0-alpha.0`,不是 `latest`。 +- **宿主 Connection 准入**:HTTP/WS 路由统一调用 `ctx.connection.requestRejection(req)`,不再依赖已删除的 `webRuntime` 或插件自建信任例外。 +- **移除 runtime invariants 接入**:上游删除 `@deepseek-ai/dsh-invariants` 与 `/invariant` 子路径,本插件同步移除 companion、类型与发布入口;压缩种子测试继续使用公开的 surface fold 和 seed validator。 +- **当前执行目录接入**:文件 / Git / 终端与新建 sidechat 跟随会话 `working_directory`;live 读 workingDirectory,cold 用 sessionQuery all projections 并释放 lease,linked worktree 保持 base-keyed,新 sidechat seed 尾部盖章当前 cwd。 +- **宿主伴随 API / 依赖**:补齐 `TerminalBlockLabels.commandLine(line)` 与 21 份词典;同步 Cordis `4.0.5`、schemastery `~3.18.5-alpha.2`、group `1.0.5-alpha.2` 与 include `1.0.10`,不直接钉 loader 或设置 override。alpha.5 优先用 package 的 `engines.dsh` 判断兼容性,本插件不新增该字段,继续用 13 条 DSH peers。 +- **本地适配验证完成(未发布)**:真实 alpha.5 挂载 **13/13 通过**(2.6 min),aggregate 通过且无重复路由;typecheck、lint、build、consumer types、pack 新鲜通过,浏览器 consumer 不泄漏 Node 类型。默认 CI 入口与单 worker 全量重跑均为 **219 文件 / 2634 用例通过,17 跳过**;排查期间的并发 watch / GC 失败已不再构成阻塞,详见 [适配记录](docs/plans/2026-10-16-dsh-0.2.1-alpha.5-adaptation.md)。rg 引擎检查通过,fd 缺失与 Windows 原生验证未执行;peer 仅剩可选 better-locale 的 4 条旧 DSH 警告。 + ### v0.27.0 - 🌿 **Git 页面重做:VS Code Source Control 结构 + 只读提交图(同一页签)**([#941](https://github.com/omdsh-dev/DSH-better-sidebar/issues/941),贡献者 PR [#944](https://github.com/omdsh-dev/DSH-better-sidebar/pull/944) @hairyf + [#969](https://github.com/omdsh-dev/DSH-better-sidebar/pull/969) @vlln):「文件变动 > Git」的内容区改为 Source Control 结构——可折叠的 Changes(多行 Message + 仅填草稿的 Generate、Merge / Staged / Changes 三组各自独立折叠与计数、整行 hover)与 Graph 区、常驻底栏(可点击分支 + `*`/`+`/`!` 标记、upstream 的 `↓`/`↑` 与安全 Pull-then-Push);Push/Pull 与 worktree·子仓库选择移入 More Actions;提交只消费已暂存项,冲突 / 空消息 / 无暂存时禁止,草稿按会话·仓库·worktree 隔离。Graph 区由 **#969 的有界只读引擎**渲染(专用 `git.graph` 路由:子先于父的拓扑序、分支筛选、游标失效显式返回 `graph-stale`、每页 200 / 偏移 10000 / 分支 1000 / 进程 10 s / 输出 8 MiB 上限,超限报错不静默截断;泳道连线与引用徽章用主题状态色,hover 卡片与提交详情卡;**纯读取**——不 checkout / fetch / 改任何 ref)。底部预览面板改为固定三签 `提交详情 / 内容 / 差异`(有内容才有差异,读操作落在内容签)。**设计取舍与实施偏差见 [docs/plans/2026-10-16-git-page-vscode-scm-merge.md](docs/plans/2026-10-16-git-page-vscode-scm-merge.md)**(贡献者 PR [#939](https://github.com/omdsh-dev/DSH-better-sidebar/pull/939) @hairyf 的官方下划线 Tabs 镜片切换保留;第三个「提交图」镜头刻意未上线)。 diff --git a/CHANGELOG_EN.md b/CHANGELOG_EN.md index 2343f933..68ec8167 100644 --- a/CHANGELOG_EN.md +++ b/CHANGELOG_EN.md @@ -4,6 +4,15 @@ > > 📝 The Chinese [CHANGELOG](./CHANGELOG.md) is the authoritative, item-by-item record; this file carries the English summaries and has historically lagged behind it. Where the two disagree, the Chinese one is current. +### v0.28.0-alpha.0 (locally validated; unpublished) + +- **Support moves to DSH 0.2.1-alpha.5+**: 13 DSH peers use `^0.2.1-alpha.5`; development dependencies, CI and installers pin the exact baseline. DSH 0.2.0-rc.2 users should pin npm-published **v0.26.1** (v0.27.0 has not been published). Install this alpha explicitly as `dsh-better-sidebar@0.28.0-alpha.0`, not `latest`. +- **Native Connection admission**: HTTP/WS routes delegate to `ctx.connection.requestRejection(req)`, without the removed `webRuntime` service or plugin-owned trust exceptions. +- **Runtime invariants integration removed**: upstream removed `@deepseek-ai/dsh-invariants` and `/invariant` subpaths; the plugin removes its companion, types and package entry. Compaction seed coverage retains the public surface fold and seed validator. +- **Current working directory**: files, Git, terminals and new side chats follow session `working_directory`; live reads use workingDirectory, cold reads use sessionQuery all projections with lease disposal. Linked worktrees stay base-keyed; each new sidechat seed ends with a current-cwd stamp. +- **Companion API / dependencies**: supply `TerminalBlockLabels.commandLine(line)` in both consumers and synchronize all 21 dictionaries; update Cordis `4.0.5`, schemastery `~3.18.5-alpha.2`, group `1.0.5-alpha.2` and include `1.0.10`, without a direct loader pin or overrides. Alpha.5 prefers package `engines.dsh` for compatibility; this plugin leaves it absent and retains its 13 DSH peers. +- **Locally validated (unpublished)**: real alpha.5 mount **13/13 passed** (2.6 min), aggregate passed without duplicate routes; fresh typecheck, lint, build, consumer types and pack passed, without leaking Node types into the browser consumer. Both the default CI entry and single-worker full runs passed **219 files / 2634 tests, with 17 skipped**; earlier watch / GC failures under concurrency are resolved investigation history, retained in the [adaptation record](docs/plans/2026-10-16-dsh-0.2.1-alpha.5-adaptation.md). The rg engine check passed; fd was unavailable and native Windows verification was not run. Only four optional better-locale legacy DSH peer warnings remain. + ### v0.27.0 - **One Git page with Source Control and a read-only commit graph**: collapsible Changes and Graph sections, independent Merge / Staged / Changes groups, commit-message drafts, and a persistent branch/sync footer. The bounded graph reader supports branch filtering, lane connections, reference badges, hover details and commit inspection without checking out branches or changing refs. The shared preview keeps three tabs: Commit details / Content / Diff. Based on [#944](https://github.com/omdsh-dev/DSH-better-sidebar/pull/944) by @hairyf and [#969](https://github.com/omdsh-dev/DSH-better-sidebar/pull/969) by @vlln; the official lens tabs from [#939](https://github.com/omdsh-dev/DSH-better-sidebar/pull/939) by @hairyf remain, with no third graph lens. diff --git a/README.md b/README.md index 086dc0b8..b033ed81 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ CI GitHub stars License: MIT - Supported DSH versions: 0.2.0-rc.2+ + Supported DSH versions: 0.2.1-alpha.5+
@@ -35,17 +35,19 @@ Switch to **Git Graph** at the top of the Git panel for commit nodes, forks and ## 🚀 Installation ```sh -dsh plugin --profile web add dsh-better-sidebar@latest +dsh plugin --profile web add dsh-better-sidebar@0.28.0-alpha.0 ``` -Then **hard-refresh the browser** (Cmd/Ctrl+Shift+R). Requires DSH **0.2.0-rc.2+**. +Then **hard-refresh the browser** (Cmd/Ctrl+Shift+R). Requires DSH **0.2.1-alpha.5+**.
Pick the plugin version for your DSH version | Your DSH version | Install command | | --- | --- | -| **0.2.0-rc.2+** (incl. later stable) | `dsh plugin --profile web add dsh-better-sidebar@latest` | +| **0.2.1-alpha.5+** (this alpha support line) | `dsh plugin --profile web add dsh-better-sidebar@0.28.0-alpha.0` | +| **0.2.0-rc.2** | `dsh plugin --profile web add dsh-better-sidebar@0.26.1` | +| **0.2.0-rc.1** | `dsh plugin --profile web add dsh-better-sidebar@0.24.1` | | **0.1.7-rc.1 ~ 0.1.7 stable** | `dsh plugin --profile web add dsh-better-sidebar@0.22.1` | | 0.1.7-alpha.x | No compatible release — upgrade DSH to rc.1 first | | 0.1.6 and earlier (incl. the 0.1.5 line) | `dsh plugin --profile web add dsh-better-sidebar@0.19.1` | @@ -61,12 +63,12 @@ Always pin **exact versions** for older releases (`latest` moves forward with ea ```text Install the dsh-better-sidebar plugin (a sidebar workbench for DSH): -1. Run dsh plugin --profile web add dsh-better-sidebar@latest (latest = current stable) +1. Run dsh plugin --profile web add dsh-better-sidebar@0.28.0-alpha.0 (this alpha, not latest) 2. Remind me to hard-refresh the browser (Cmd/Ctrl+Shift+R) afterwards If something fails, check the FAQ table in https://github.com/omdsh-dev/DSH-better-sidebar README first. ``` -**One-line script** — clone this repo and run `bash scripts/install.sh` (macOS / Linux / Windows Git Bash; `install.ps1` for native Windows). It handles installation + bundle registration. +**One-line script** — clone this repo and run `bash scripts/install.sh 0.28.0-alpha.0` (macOS / Linux / Windows Git Bash; `./scripts/install.ps1 -Version 0.28.0-alpha.0` for native Windows). It handles installation + bundle registration. **Updating**: just re-run the install command, then hard-refresh the browser. @@ -83,12 +85,18 @@ If something fails, check the FAQ table in https://github.com/omdsh-dev/DSH-bett | **Two sidebars** on the page | Double mounting. Remove the legacy manual mount line (`- insert: ... better-sidebar ...`) from `~/.dsh/profiles/web/cordis.patch.yml`; aggregate packages mounting this package under a different id are auto-yielded, no action needed. | | Settings values gone after upgrade | Since DSH 0.1.7, preferences live on this plugin's mount row in the profile (default entry id `better-sidebar`). The plugin migrates your old `settings.yaml` values once on first start and never overwrites newer values. | | Terminal unavailable | Terminals are provided by **DSH itself** (this plugin ships no PTY) — see DSH docs; "host provides no terminal capability" in the bottom terminal means this deployment has no terminal controller mounted. | -| `dsh: command not found` | Install DSH first; or use `npx -y --package @deepseek-ai/dsh dsh plugin --profile web add dsh-better-sidebar@latest`. | +| `dsh: command not found` | Install DSH first; or use `npx -y --package @deepseek-ai/dsh@0.2.1-alpha.5 dsh plugin --profile web add dsh-better-sidebar@0.28.0-alpha.0`. |
## 🆕 Recent Updates +**v0.28.0-alpha.0 (locally validated; unpublished)** + +- Adapt to DSH **0.2.1-alpha.5+**: use native Connection admission for HTTP/WS and remove the retired invariant companion and dependency +- Files, Git, terminals and newly created side chats follow the session’s current working directory +- **DSH 0.2.0-rc.2 users stay on npm-published v0.26.1**; v0.27.0 has not been published. Use the explicit alpha version above, not `latest` + **v0.27.0** - full release history at [Releases](https://github.com/omdsh-dev/DSH-better-sidebar/releases) · [CHANGELOG](./CHANGELOG_EN.md) - **Git page rebuilt**: Source Control groups, a read-only commit graph with branch filtering, and a shared Commit details / Content / Diff pane diff --git a/README_ZH.md b/README_ZH.md index 98224840..e793c215 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -7,7 +7,7 @@ CI GitHub stars License: MIT - 支持的 DSH 版本:0.2.0-rc.2+ + 支持的 DSH 版本:0.2.1-alpha.5+
@@ -35,17 +35,19 @@ ## 🚀 安装 ```sh -dsh plugin --profile web add dsh-better-sidebar@latest +dsh plugin --profile web add dsh-better-sidebar@0.28.0-alpha.0 ``` -装完**硬刷新浏览器**(Cmd/Ctrl+Shift+R)即可。要求 DSH **0.2.0-rc.2+**。 +装完**硬刷新浏览器**(Cmd/Ctrl+Shift+R)即可。要求 DSH **0.2.1-alpha.5+**。
按 DSH 版本选插件版本 | 你的 DSH 版本 | 安装命令 | | --- | --- | -| **0.2.0-rc.2+**(含之后的正式版) | `dsh plugin --profile web add dsh-better-sidebar@latest` | +| **0.2.1-alpha.5+**(本 alpha 支持线) | `dsh plugin --profile web add dsh-better-sidebar@0.28.0-alpha.0` | +| **0.2.0-rc.2** | `dsh plugin --profile web add dsh-better-sidebar@0.26.1` | +| **0.2.0-rc.1** | `dsh plugin --profile web add dsh-better-sidebar@0.24.1` | | **0.1.7-rc.1 ~ 0.1.7 正式版** | `dsh plugin --profile web add dsh-better-sidebar@0.22.1` | | 0.1.7-alpha.x | 没有可装版本——先升级 DSH 到 rc.1 | | 0.1.6 及更早(含 0.1.5 线) | `dsh plugin --profile web add dsh-better-sidebar@0.19.1` | @@ -61,12 +63,12 @@ dsh plugin --profile web add dsh-better-sidebar@latest ```text 帮我安装 dsh-better-sidebar 插件(DSH 侧边栏工作台),步骤: -1. 执行 dsh plugin --profile web add dsh-better-sidebar@latest(latest 即当前正式版) +1. 执行 dsh plugin --profile web add dsh-better-sidebar@0.28.0-alpha.0(本次 alpha,非 latest) 2. 完成后提醒我硬刷新浏览器(Cmd/Ctrl+Shift+R) 遇到报错先查 https://github.com/omdsh-dev/DSH-better-sidebar README 的常见问题表。 ``` -**一键脚本**——克隆本仓库后执行 `bash scripts/install.sh`(macOS / Linux / Windows Git Bash;Windows 原生用 `install.ps1`),自动完成安装 + bundle 注册。 +**一键脚本**——克隆本仓库后执行 `bash scripts/install.sh 0.28.0-alpha.0`(macOS / Linux / Windows Git Bash;Windows 原生用 `./scripts/install.ps1 -Version 0.28.0-alpha.0`),自动完成安装 + bundle 注册。 **更新**:重跑一次安装命令即可,然后硬刷新浏览器。 @@ -83,12 +85,18 @@ dsh plugin --profile web add dsh-better-sidebar@latest | 页面出现**两个侧边栏** | 双挂载。删掉 `~/.dsh/profiles/web/cordis.patch.yml` 里旧的手动挂载行(`- insert: ... better-sidebar ...`);聚合包以不同 id 挂载本包时会自动退让,无需处理。 | | 升级后设置页的值去哪了 | DSH 0.1.7 起偏好写在 profile 里本插件的挂载行上(默认 entry id `better-sidebar`),插件首次启动会把旧 `settings.yaml` 里的配置一次性回迁,不会覆盖新设的值。 | | 终端无法使用 | 终端由 **DSH 自身**提供(本插件不自带 PTY),请查 DSH 侧文档;底部终端显示「宿主未提供终端能力」= 这个部署没挂终端控制器。 | -| 提示 `dsh: command not found` | 先安装 DSH;或用 `npx -y --package @deepseek-ai/dsh dsh plugin --profile web add dsh-better-sidebar@latest`。 | +| 提示 `dsh: command not found` | 先安装 DSH;或用 `npx -y --package @deepseek-ai/dsh@0.2.1-alpha.5 dsh plugin --profile web add dsh-better-sidebar@0.28.0-alpha.0`。 |
## 🆕 最近更新 +**v0.28.0-alpha.0(本地适配验证完成,未发布)** + +- 适配 DSH **0.2.1-alpha.5+**:HTTP/WS 改用宿主 Connection admission,移除已废弃的 invariant companion 与依赖 +- 会话执行目录变化时,文件 / Git / 终端与新建侧边对话跟随当前目录 +- **0.2.0-rc.2 用户留在 npm 已发布的 v0.26.1**;v0.27.0 尚未发布,alpha 请用上方精确版本命令,不要用 `latest` + **v0.27.0** - 完整发布历史见 [Releases](https://github.com/omdsh-dev/DSH-better-sidebar/releases) · [CHANGELOG](./CHANGELOG.md) - **Git 页面重做**:Source Control 分组、支持分支筛选的只读提交图,以及共用的「提交详情 / 内容 / 差异」预览区 diff --git a/docs/external-plugin-guide.md b/docs/external-plugin-guide.md index bf1fda6e..c7ee81e4 100644 --- a/docs/external-plugin-guide.md +++ b/docs/external-plugin-guide.md @@ -2,8 +2,11 @@ > 面向 **消费插件开发者**:如何让你的插件向 better-sidebar 注册新的侧边栏页面(tab)和文件类型预览器。 > -> 适用版本:**v0.4.0+**(`ctx.betterSidebar` 服务);声明式设置 **v0.4.1+**;text/number 设置行 **v0.11.0+**;badge/生命周期/定向打开/插件设置/版本探测 **v0.12.0+**;select 设置行(`settingSelect`)与外链认领(`urlTarget`)**v0.13.0+**;统一 `@deepseek-ai/cordis` 类型基底 **v0.15.2+**;路由前缀安全解析(`hostRouteUrl`)**v0.25.0+**。当前版本 **v0.27.0**(peer 下限 `^0.2.0-rc.2`,仅支持 DSH **0.2.0-rc.2+**;0.2.0-rc.1 请用 v0.24.1,0.1.7 线请用 v0.22.1——caret 范围跨 minor 不成立,`^0.1.7-rc.1` 会被 0.2.0 宿主的启动预检静默禁用)。**v0.19.0 移除了自绘右侧面板与自由窗口**(见 §0、§11);**自 v0.20.0 开发线起**(**注意:0.20.0 从未发布到 npm,这些变更全部落在 v0.21.1**)插件**移除了自带的终端**(宿主 0.1.6 的 `ui-sidebar-terminal` 取代,见 §4.4)、**移除了终端固定(pin)**,并在 0.1.7 上**把浏览器视图与只读文件预览整体让给宿主**(`ui-sidebar-browser` / `ui-sidebar-documentpreview`,见 §4.4、§5.4)、**收敛了外链接管**(见 §4.1)、**重写了设置接入面**(`SettingsForms`,见 §8.2)、**给文件树加了实时刷新**(见 §10);同时**删除了轮尾产物行接管**(DSH 0.1.6 把 `conversation.chat.turnTail` 从 chain 改成只能追加的 list,替换语义不复存在)。 +> 适用版本:**v0.4.0+**(`ctx.betterSidebar` 服务);声明式设置 **v0.4.1+**;text/number 设置行 **v0.11.0+**;badge/生命周期/定向打开/插件设置/版本探测 **v0.12.0+**;select 设置行(`settingSelect`)与外链认领(`urlTarget`)**v0.13.0+**;统一 `@deepseek-ai/cordis` 类型基底 **v0.15.2+**;路由前缀安全解析(`hostRouteUrl`)**v0.25.0+**。当前版本 **v0.28.0-alpha.0**(13 条 DSH peer 下限 `^0.2.1-alpha.5`,仅支持 DSH **0.2.1-alpha.5+**;0.2.0-rc.2 请用 npm 已发布的 v0.26.1(v0.27.0 尚未发布),0.2.0-rc.1 请用 v0.24.1,0.1.7 线请用 v0.22.1——caret 范围跨 minor 不成立,`^0.1.7-rc.1` 会被 0.2.0 宿主的启动预检静默禁用)。**v0.19.0 移除了自绘右侧面板与自由窗口**(见 §0、§11);**自 v0.20.0 开发线起**(**注意:0.20.0 从未发布到 npm,这些变更全部落在 v0.21.1**)插件**移除了自带的终端**(宿主 0.1.6 的 `ui-sidebar-terminal` 取代,见 §4.4)、**移除了终端固定(pin)**,并在 0.1.7 上**把浏览器视图与只读文件预览整体让给宿主**(`ui-sidebar-browser` / `ui-sidebar-documentpreview`,见 §4.4、§5.4)、**收敛了外链接管**(见 §4.1)、**重写了设置接入面**(`SettingsForms`,见 §8.2)、**给文件树加了实时刷新**(见 §10);同时**删除了轮尾产物行接管**(DSH 0.1.6 把 `conversation.chat.turnTail` 从 chain 改成只能追加的 list,替换语义不复存在)。 > 权威代码:`src/client/service.ts`(服务实现)、`src/client/builtins/`(内置 6 tab + 3 viewer 参考实现)、`lib/types/client/service.d.ts`(类型声明)。 +> alpha.5 已删除 `@deepseek-ai/dsh-invariants` 与上游 `/invariant` 子路径;本插件同步移除 invariant companion,不提供替代注册服务。HTTP/WS 准入遵循宿主 Connection(见 §6.2)。 +> 当前目录语义:文件 / Git / 终端与新建 sidechat 跟随会话 `working_directory`。live 读 `ctx.workingDirectory.get(session)`;cold 通过 `ctx.sessionQuery.observeSession` 的 all projections 读取并在 `finally` 释放 lease。linked worktree 仍按 base 目录记账;新 sidechat seed 尾部盖章当前 cwd,防止继承历史目录覆盖它。 +> alpha.5 的 `TerminalBlockLabels` 要求 `commandLine(line)`;两个渲染消费者与全部 21 份词典同步。宿主兼容性优先读 `package.json#engines.dsh`,缺席才读 DSH peers;本插件没有该字段,仍用 13 条 peers(第三方 `dsh.plugin.json` 不参与)。 > 仓库开发规则(硬约束 / CI / 发版)见 [AGENTS.md](../AGENTS.md)。 --- diff --git a/docs/host-contracts.md b/docs/host-contracts.md index a0317ea2..cf915852 100644 --- a/docs/host-contracts.md +++ b/docs/host-contracts.md @@ -2,7 +2,9 @@ > 从 `AGENTS.md` §3 移出的深度参考(原 §3.4 第 1–12 条与 0.1.5–0.1.7 历史线中仍然生效的部分)。 > **编号保持不变**:代码、测试与文档里写的「AGENTS.md §3.4 第 N 条」就是本文第 N 条。 -> 历史版本已不在支持线内(当前基线 DSH 0.2.0-rc.2,见 [AGENTS.md](../AGENTS.md) §3);逐条适配过程见 [docs/plans/](plans/) 与 [CHANGELOG.md](../CHANGELOG.md)。 +> 历史版本已不在支持线内(当前基线 DSH 0.2.1-alpha.5,见 [AGENTS.md](../AGENTS.md) §3);逐条适配过程见 [docs/plans/](plans/) 与 [CHANGELOG.md](../CHANGELOG.md)。 + +当前适配约束:HTTP/WS 均由 `ctx.connection.requestRejection(req)` 裁决 Host/Origin 与浏览器认证,只有 `undefined` 放行,不读取已删除的 `webRuntime`。alpha.5 同时移除了 `@deepseek-ai/dsh-invariants`、`ctx.invariants` 和上游 `/invariant` 子路径;本插件不再发布 invariant companion。 ## A. 0.1.5–0.1.7 引入、至今仍是现行约束的行为 @@ -18,6 +20,9 @@ - **会话格式 v4 的两处形状**:`source.kind === 'plugin'` 被硬拒,插件侧一律用 `plugin:dsh-better-sidebar`(与 DSH 自己 v3→v4 迁移产出的 kind 逐字一致,历史 sidechat 会话不丢);tool 结果消息是 `role: 'tool'` + **顶层** `content` / `isError` / `toolCallId`,转录解析器**必须同时接受新旧形状**——旧分支不能删(历史日志里就是旧形状),只认新形状会静默返回空串。 - **客户端会话快照与宿主客户端服务**:子代理目录读 `SessionListState.projectionsBySession[sid]?.values.subagentCatalog`(`mode` 有 `'unknown'` 新值);后台任务页直接读宿主**客户端** `ctx.jobs` 服务(`src/client/jobs-client.ts`:`getSnapshot()/subscribe()` 整份快照、`watchRows(sessionId)` 按会话引用计数、`observe(...)` 非消费输出流、`kill(sessionId, jobId)`)——**不要自建 `jobs.*` 路由,也不要用事件回放去读模型已读的输出**(那会动模型的 `job_output` 游标)。 +- **会话当前执行目录**:文件 / Git / 终端及新建 sidechat 跟随 `working_directory`,不把 session header cwd 当成当前值。live 读 `ctx.workingDirectory.get(session)`;cold 经 `ctx.sessionQuery.observeSession(..., { projectionMode: 'all' })` 读取,lease 在 `finally` 中释放。同一 base 的 live 目录增量通过 epoch 失效缓存;cold 外进程同 base 变化仍沿用既有 15 s TTL。linked worktree 选择仍按 base 目录记账,不把选中的 worktree 反写为 base。sidechat 继承 seed 尾部盖章当前 cwd,避免旧 seed 的目录事件覆盖新线程的初始目录。 +- **终端 label**:alpha.5 的 `TerminalBlockLabels` 新增必填 `commandLine(line)`,两个消费者都要提供,21 份词典同步对应 key。 + ## B. 宿主契约(原 AGENTS.md §3.4 第 1–12 条) 1. **一次性 token 鉴权**:就绪行 `dsh web: http://127.0.0.1:/?token=<43字符>`(导航换签名 cookie,干净 URL 401)。`e2e-mount.sh` 的 URL grep 必须延伸到空白(`[^ ]*`,否则在 `/` 截断丢 token);e2e 统一走 `tests/e2e/host.ts`(`parseLaunchUrl` 对裸 origin 直接抛错),带 stamps 导航走 `gotoPage()`(先 addCookies 再直达——token 换 cookie 的 303 会丢弃同 URL 其它 query 参数)。插件 `/sidebar/*` 路由不受影响,同源 fetch 照旧。 @@ -27,7 +32,7 @@ 5. **`dsh-subagent` 的 `SUBAGENT_DESCRIPTOR_VERSION` 仍是 3**:sidechat 种子的 `subagent/descriptor` 版本由宿主包盖章,插件不硬编码;测试断言跟随常量(`tests/sidechat-routes.spec.ts`),勿钉字面量。 6. **`@deepseek-ai/dsh-client-runtime` 包已消亡**(继任 seed 是裸名 `dsh-client-store`,无 `/client` 子路径):peerDependencies、devDependencies、`dsh.client.inject`、chunk externals 白名单(`src/client/chunk-loader.ts` / `tsdown.config.ts` 各有一处说明它已移除的注释)**无活引用**。 7. **e2e scratch profile 的 `minimumReleaseAgeExclude` 含 `'@deepseek-ai/*'`**(字面配置在 `scripts/e2e-common.sh` 的 `e2e_write_profile` heredoc,`e2e-mount.sh` / `e2e-aggregate-mount.sh` 都调它;与仓库根 `pnpm-workspace.yaml` 同策):alpha 版本常在发布后 24h 内跑 lane,pnpm 11 的 `minimumReleaseAge` 默认会拒装新鲜包。 -8. **插件开发树的 dsh-* 传递 peer 需提升为 devDependencies**:npm 上的宿主包把姊妹包(`dsh-attachment` / `scope` / `session-projection` / `system-prompt` / `user-approval` / `util-time` 等)声明为 peerDependencies(由宿主 bundle 树统一提供,插件仓库没有),插件若只直接依赖其中一部分,其余 peer 在 pnpm 下会解析到树上残留的旧版——测试加载即崩。因此 devDependencies 需涵盖 dev 树实际触达的全部 peer,与直接依赖同款精确钉版;**一律以 `pnpm peers check` 的实际输出为准,不要预加**(`dsh-workspace` / `dsh-agent-preset-registry` 只是 `dsh-subagent` 的 optional peer 且从不被 import)。`@deepseek-ai/cordis` peer 现要求 `^4.0.4`;`cordis-plugin-group` / `-include` 是 `dsh-app-boot` / `dsh-config-editor` 的**传递 peer**,只改 `dependencies` 不够(pnpm 会继续沿用 lockfile 里的旧副本),要**显式钉进 devDependencies** 才收敛。例外已消除:`dsh-client-locale` 与 DSH 同 tuple,不再允许落后。 +8. **插件开发树的 dsh-* 传递 peer 需提升为 devDependencies**:npm 上的宿主包把姊妹包(`dsh-attachment` / `scope` / `session-projection` / `system-prompt` / `user-approval` / `util-time` 等)声明为 peerDependencies(由宿主 bundle 树统一提供,插件仓库没有),插件若只直接依赖其中一部分,其余 peer 在 pnpm 下会解析到树上残留的旧版——测试加载即崩。因此 devDependencies 需涵盖 dev 树实际触达的全部 peer,与直接依赖同款精确钉版;**一律以 `pnpm peers check` 的实际输出为准,不要预加**(`dsh-workspace` / `dsh-agent-preset-registry` 只是 `dsh-subagent` 的 optional peer 且从不被 import)。当前伴随依赖为 Cordis `4.0.5`、schemastery `~3.18.5-alpha.2`、group `1.0.5-alpha.2` 与 include `1.0.10`;不直接钉 loader、不设 override,稳定 Cordis 同时满足宿主 alpha 与稳定传递 loader 的范围;`cordis-plugin-group` / `-include` 是 `dsh-app-boot` / `dsh-config-editor` 的**传递 peer**,只改 `dependencies` 不够(pnpm 会继续沿用 lockfile 里的旧副本),要**显式钉进 devDependencies** 才收敛。例外已消除:`dsh-client-locale` 与 DSH 同 tuple,不再允许落后。 9. **右侧栏是 DSH 原生栏,插件只提供 tab 类型**(**编号提示**:旧文与代码注释里把它引用作 `§3.10` / `§3 第 10 条`——`tests/native-surface-cross-session.spec.ts` 的 `§3.10` 与指南 §10 表格里的「第 10 条」都指本条):聊天里一切文件打开(工具行 / 产物行 / 正文提及 / 行内代码路径)统一走 `ctx.sidebarRight.openResource(fileAddressFor(sessionId, cwd, path))`,其中文件地址语法为「一律 session 作用域、绝对路径保留前导 `/`」,`parseFileAddress` 前缀解析并去 `?`/`#`。插件的每个 `TabDescriptor` 注册成原生 tab 类型(`kind = descriptor.id`,`extension` 带)+ 原生 tab 体(`sidebar.right.pane.tab` keyed 槽,key = `dsh-better-sidebar:`);`editor` 类型同时认领 `dsh-resource://file/**`(**但按本文 A 节的清单让出一部分**),并接管内置 `files` 页面 kind(`openTab('files')` 打开插件文件树,注销即复位)。`ctx.sidebarRight.openTab/openResource/close` 只对**在屏会话**写入,跨会话用具体类上的 `openTabIn/openResourceIn/closeIn`;原生 tab 的插件侧状态在 `src/client/native/tab-adapter.tsx`。几条硬事实: - **注册必须等服务、不能等槽声明**:原生栏先声明 `sidebar.right.pane.tab` 再 `provide('sidebarRightTabs')`,真机 profile 上槽声明回调里 `ctx.get('sidebarRightTabs')` 仍是 undefined(实测 3 秒后才出现),按槽触发注册会静默什么都不注册且永不重试——用 `ctx.inject(['sidebarRightTabs'], cb)` 驱动类型注册(`tests/native-surface.spec.ts` 以「槽先触发、服务后到达」的顺序守护)。 - `SidebarRightGuideEntry.id` **必填且同 provider 内唯一**(缺它会静默清空整个承载面);同 provider 的 guide 条目是**追加**关系(`chain` 那种「替换宿主条目」的语义只存在于 `conversation.chat.turnTail` 且已被上游改成 `list`)。**指南只描述 ≤4 条条目**(`GuideBody.tsx` 的 `MAX_DESCRIBED_ENTRIES`):更长是整列丢弃而不是截断——插件默认贡献 4 个 guide 条目(文件 / Git / 任务管理 / 侧边对话),加上宿主终端条目后可能超限;插件**不恢复**旧的 `nativeGuideDesc` 通用兜底句。 @@ -35,6 +40,6 @@ - **原生注册账本的两条不变量**(`tests/native-registration.spec.ts` 守护):① `live` 里同时装着描述符类型(键 = descriptor id)与 `files` 接管(键 = `FILES_KIND`,**永远不在 `wanted` 里**),清理循环必须**跳过 `FILES_KIND`**——它只由编辑器类型的 `wantsFiles/hasFiles` 开关分支与 seat disposer 管理;否则每次通知都会把它拆掉再重建,而 teardown 期间的那次重建会把 id 孤儿化:`tabs.register` 建在**宿主** ctx 上(宿主 ctx 此时仍活着)所以照样成功,紧随的 `ctx.slots.inject` 建在**插件** ctx 上却抛 `cannot create effect on inactive context`,`live.set` 永不执行 → 该 id 在整页生命周期内不可再注册(真机表现:`native register files error: … already registered` 刷屏 + 文件树落到宿主空态,只有刷新页面才恢复;实证见 [docs/plans/2026-09-28-native-files-takeover-reload-leak.md](plans/2026-09-28-native-files-takeover-reload-leak.md))。② 因此「注册成功一半」是**可达状态**:任何在宿主取走 id **之后**失败的注册(槽位注册抛错等)必须**回滚释放该 type** 并释放已经建好的槽位,插件侧只留一个下次通知可以重试的失败,绝不留下无处释放的 id。相关断言必须写在注册表的**事件日志**上而不是「活着的 id 集合」上:孤儿 id 会让键集合看起来完全正常,键集合断言在未修复代码上同样通过。 - **原生 tab 的状态保留(已采纳 `keepMounted: true`)**:宿主因此把访问过的 body 挂住,同会话切 tab 不再卸载,组件态(树滚动、未保存草稿、chip 重命名)随之免费保留,**不需要**任何 module-level 记忆。三条必须同时成立的配套事实:(a) **记录不能随卸载删除**(只由 `surface.close` 与「会话消失」回收),而「切回会话清零」那一路(真机日志里 `DISPOSE type …:files` → `register`、同键 `drop`+`mint`)已由上面的 `FILES_KIND` 守卫挡掉(真机 e2e 现断言跨会话 `scrollTop` 复原);(b) 原生 tab id **每会话各自计数**(`tab1`…)且多会话同号并存,记录与写面一律按 `sessionId::tabId` 记账,`Surface.update/has/activate` 的 `sessionId` 缺省按 `sidebarRight.mounted` 解析,多会话同名时**拒绝而不是猜**;(c) **展开集的权威在插件 store 的会话状态里**(`attachStore` + `syncExpanded` + `getSessionStates().expanded`,由 `native/index.ts` 绑定),记录只负责**身份**与投影——两套持久化会互相打架,插件不自持「每记录的展开集」。设计过程与实测见 [docs/plans/2026-09-25-native-tab-state-retention-keepmounted.md](plans/2026-09-25-native-tab-state-retention-keepmounted.md)。 10. **自定义种子必须带 fork 标记对(`meta.isSeeded: true` + `inheritedEventCount`),且 create 后必须 `inbox.clear()`、冷恢复必须按 id 精确清扫——标记对必要但不充分**:dsh-session 契约规定「只给 seed 不标 isSeeded,种子算重放历史而非继承前缀」——缺标记时 `Session.ownEvents()` 含整个种子,子会话的 inbox 折重放种子里的 `agent/inbox/spliced`,**继承父会话切割时刻未领取的 inbox 输入**。**但运行时 inbox 不走 `ownEvents()`**:`ReactLoopInbox.current()` → `ctx.sessionProjections.stateOf()` → `SessionProjectionRegistry.cellFor` 折的是 `snapshotEvents()` **全量日志(含继承种子前缀)**,且标准 inbox 投影的 `init` 忽略 `inheritedEventCount`、注册表 `session/created` 急切初始化跳过一切种子会话(seq ≠ 0)——种子里的 `agent/inbox/spliced` 会原样重放进子会话 live inbox。因此 sidechat 宿主 `agents.create` 成功后、任何 inject/followup 之前必须 `handle.agent.inbox.clear()`(durable 补偿 splice 是 own 事件,冷恢复折存储日志同样归零)。**幽灵的来源比「父会话排队」更宽**:父会话 mid-turn 且工具有未返回调用时,种子被截断在 `turn/start` 之前,而 inbox 的「领取」splice 发生在 `turn/start` **之后** → **父会话本轮开头已领取的输入**在种子折叠里仍是 pending;`clear()` 是唯一能一次清干净的硬围栏(create 时本线程自己不可能有排队输入)。**冷恢复不能沿用 `clear()`**(会误杀「用户在线程里排队、宿主重启后尚未领取」的合法输入):改为 `dropInheritedGhosts`——`inheritedPendingIds(log, inheritedEventCount)` 只折继承前缀得到幽灵 id 集合,再逐个 `agent.inbox.remove(id)`,精确且幂等(`src/sidechat-core.ts` 纯函数,`tests/sidechat-core.spec.ts` / `tests/sidechat-routes.spec.ts` 守护)。宿主 `session.fork`(api-session-controller)的调用即规范形态(注意:宿主自己的 `fork` **没有**这一步补偿,同窗口有同样的暴露面);回归由 `tests/sidechat-seed-validation.spec.ts`(真实 `Session.create` + 对 `ownEvents()` 跑 inbox 折 + **真实 `SessionProjectionRegistry`** 折全量日志钉住上游洞与 clear 补偿)守护。**模型选择同为 agent 作用域**:`sidechat.model` 必须同时落 `session.append('model/selection', …)`(宿主 `selectForNextRequest` 的同一形状)与 `installModelSelection(agent.ctx, ref)`(`@deepseek-ai/dsh-agent` 公开导出),否则控制器缓存的 per-agent selection 永不回读投影;resume 后也要按日志里的有效选择重装(`src/sidechat-routes.ts` 的 `ensureModelSelection`)。**上游 0.2.0 新增的 `buildForkSeed` 与本插件手工的 `buildSidechatInheritance` 职责重叠,但收益不明确**(插件另有 dangling-tool-call 退回结构化快照的自有需求),暂不替换。 -11. **`dsh.plugin.json` 从来不是 DSH 契约**(全树 grep 0 命中):DSH 真正读的是 `package.json` 的 `dsh.bundle.patch` + `dsh.client`(`platform`/`inject`/`immediately`/`external`)+ `exports["./client"]`。`dsh.plugin.json` 与 `lib/client-registry.js` 只服务第三方 registry(社区市场)通道,`tests/manifest-consistency.spec.ts` 守护的是这条通道的形状,不是 DSH 契约。**`dsh.manifestVersion` 与 `engines.dsh` 仍是「只声明、零读」**(DSH 自己的 package-manifest README 写明 installers / loaders 不强制它们)。`dsh.bundle.patch` 有形状校验(非法值会 `throw`,引导期跳过该 bundle),本插件是合法的单字符串。 +11. **`dsh.plugin.json` 从来不是 DSH 契约**(全树 grep 0 命中):DSH 真正读的是 `package.json` 的 `dsh.bundle.patch` + `dsh.client`(`platform`/`inject`/`immediately`/`external`)+ `exports["./client"]`。`dsh.plugin.json` 与 `lib/client-registry.js` 只服务第三方 registry(社区市场)通道,`tests/manifest-consistency.spec.ts` 守护的是这条通道的形状,不是 DSH 契约。**不要混淆两个 manifest 的 `engines.dsh`**:alpha.5 的兼容性检查优先读取 `package.json#engines.dsh`,存在时由它独立裁决;本插件未声明此字段,仍由 13 条 DSH peer 决定兼容性。`dsh.plugin.json#engines.dsh` 只是第三方 registry 元数据,不能替代 package 字段;`dsh.manifestVersion` 也不是版本兼容性开关。`dsh.bundle.patch` 有形状校验(非法值会 `throw`,引导期跳过该 bundle),本插件是合法的单字符串。 **插件展示元数据**(Plugins 页与 `plugin_manager` 列表,v0.21.1 起已采纳)三条硬规则:`package.json#icon` 必须是**包内相对路径**且写进 `files`(36×36、纯填充无描边、**双色渐变**——与 DSH 自带 `PluginArtwork*` 同风格,单色版在 30px 行内尺寸下会读成一块纯色板);`locale/en.json` 是发现基线(缺它整个目录都不读,`meta.title` / `description` 在这里);`exports` 必须暴露 `./locale/*.json` 与 `./package.json`。**所有失败都是静默的**——元数据有问题只会退化成一行纯文字,没有任何报错;`tests/plugin-meta.spec.ts` 守护「声明了就必须发布出去」。plugin-manager 侧另有**多 registry 回退**(配置源 → `fallbackRegistries`,默认含 `registry.npmmirror.com`;`network`/`timeout`/`not-found`/`no-matching-version` 会自动问下一个源;`registry` 入参只存在于 Web 对话框与 `plugin_manager` 工具,**CLI 没有 registry flag**)。 -12. **peer 声明是启动期硬约束(最容易静默失效的一处)**:`packages/boot/app-boot/src/plugin-compatibility.ts` 只做一件事——遍历 profile 行的 `peerDependencies`,对**名字为 `@deepseek-ai/dsh` 或以 `@deepseek-ai/dsh-` 开头**的条目跑 `semver.satisfies(宿主版本, range, { includePrerelease: true })`,不满足就把整行 `row.disabled = true`(group 行连 `group` 一起关掉),只在 stderr 留一行 `disabling profile plugin