diff --git a/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.i18n.yaml b/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.i18n.yaml
index ad8ffb6167..04fa599e6f 100644
--- a/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.i18n.yaml
+++ b/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.md
-2026-08-31-released-session-format-migrations.md: 273b51ac7ce9c507c2322499788dc2084b857415
-2026-08-31-released-session-format-migrations.zh.md: 69132ec1763ad12b51480e150c3968aa1dcacf61
+2026-08-31-released-session-format-migrations.md: e21793e0ea3d0c5376cbb3949c5d6ef599b9afb1
+2026-08-31-released-session-format-migrations.zh.md: 637d8fcf0206661df9a6f1b3b470ad8a55746720
diff --git a/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.md b/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.md
index 273b51ac7c..e21793e0ea 100644
--- a/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.md
+++ b/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.md
@@ -131,7 +131,7 @@ Existing write handles retain the process-local claim and kernel-backed cross-pr
### Parent catalog prerequisites
-V3→V4 completes parent child discovery from retained direct-child headers and own descriptors. Storage supplies compact descriptor evidence to the catalog assembly, which binds it into the V3→V4 stage factory; the Stage waits for the parent's final inherited cut before validating catalog payloads and deriving available own discovery facts. Nested seed markers discard inherited catalog candidates without interpreting their payloads. An existing catalog entry survives an unavailable descriptor, including a child that failed before its first step. Descriptor v1 denotes continuable mode; v2/v3 explicitly record mode. Available unambiguous discovery fields must agree with the parent; absent entries require one supported descriptor. Missing, unsupported, or multiple descriptors preserve the logs without backfilling that child, as recorded in [incomplete child evidence](../bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.md). JSONL rechecks related membership and source revisions when preparing, reusing, and publishing. An unsupported generation or unreadable header elsewhere in that scan refuses migration because it cannot prove unrelatedness. Source drift invalidates preparation; read open retries once automatically, while write open refuses publication. Diagnostics retain the offending child path and distinguish unsupported migration evidence from malformed child data. The storage decoder classifies physical JSON and compression failures before the collector adds child context; filesystem reads and cancellation keep their original errors. The V0–V3-only catalog avoids recursive child migration. Current V4 reads skip that scan but apply the same own-catalog field, uniqueness, and current delivery ownership checks as strict restoration. See the [format specification](../../../../packages/session/session-format-v3-to-v4/README.md).
+Runtime child-failure handling in this paragraph is partially superseded by [session-local catalog preparation](../bug-fix/2026-09-19-session-local-subagent-migration.md): opening the parent still completes its catalog from direct-child reads, but unreadable children do not block healthy parent history. V3→V4 completes parent child discovery from retained direct-child headers and own descriptors. Storage supplies compact descriptor evidence to the catalog assembly, which binds it into the V3→V4 stage factory; the Stage waits for the parent's final inherited cut before validating catalog payloads and deriving available own discovery facts. Nested seed markers discard inherited catalog candidates without interpreting their payloads. An existing catalog entry survives an unavailable descriptor, including a child that failed before its first step. Descriptor v1 denotes continuable mode; v2/v3 explicitly record mode. Available unambiguous discovery fields must agree with the parent; new complete entries require one supported descriptor. Missing, unsupported, or multiple descriptors preserve the logs and retain unknown-mode membership without inventing discovery fields, as recorded in [incomplete child evidence](../bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.md). JSONL rechecks related membership and source revisions when preparing, reusing, and publishing. Unreadable or unsupported headers are excluded from discovery; failures reading a recognized child preserve its header identity as unknown-mode membership. Source drift invalidates preparation; read open retries once automatically, while write open refuses publication. Diagnostics retain the offending child path and distinguish unsupported migration evidence from malformed child data. The collector reports child decoding and descriptor failures as warnings with the child path; cancellation and source-consistency checks still stop preparation. The V0–V3-only catalog avoids recursive child migration. Current V4 reads skip that scan but apply the same own-catalog field, uniqueness, and current delivery ownership checks as strict restoration. See the [format specification](../../../../packages/session/session-format-v3-to-v4/README.md).
Raw parent/child migration tests retain 24 historical creation-time conflicts as rejection evidence. Detached controls align only the child creation time and prove event-preserving restoration, including a published child without a descriptor. Headless/ACP and SDK snapshot adapters validate live parent/child clocks before normalization and preserve their equality during refresh; committed predecessor generations remain unchanged.
diff --git a/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.zh.md b/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.zh.md
index 69132ec176..637d8fcf02 100644
--- a/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.zh.md
+++ b/.agents/notes/implemented/architecture/2026-08-31-released-session-format-migrations.zh.md
@@ -131,7 +131,7 @@ POSIX publication 使用 hard-link creation 加目录 sync;Windows 使用 no-o
### 父目录前置事实
-V3→V4 使用保留的直属子 Session header 和自身 descriptor 补齐父 Session 的子代理发现记录。存储将紧凑的 descriptor 证据提供给 catalog 组装处,由其绑定到 V3→V4 stage 工厂;Stage 等待父 Session 的最终继承截点确定后,才校验目录 payload 并导出可获得的自身发现事实。嵌套的 seed 标记丢弃继承目录候选,不解释其 payload。已有目录记录允许 descriptor 不可用,包括在首次 step 之前失败的子 Session。Descriptor v1 表示 continuable 模式;v2/v3 显式记录模式。可获得且明确的发现字段必须与父目录一致;缺失记录要求一个受支持的 descriptor。Descriptor 缺失、版本不受支持或存在多个时,保留日志但不补填对应子 Session,理由见[不完整子目录证据](../bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.zh.md)。JSONL 在准备、复用和发布时重新检查关联成员与来源修订。扫描中其他任何不支持代际或不可读 header 都会拒绝迁移,因为无法证明它与父 Session 无关。来源变化使准备缓存失效;只读打开自动重试一次,写打开则拒绝发布。诊断保留出错子日志的路径,并区分不支持的迁移证据与畸形子数据。存储解码器先将物理 JSON 与压缩错误归类,再由收集器补充子日志信息;文件系统读取与取消保留原始错误。仅支持 V0–V3 的目录避免递归迁移子 Session。当前 V4 读取跳过该扫描,但会执行与严格恢复相同的自身目录字段、唯一性及当前投递归属检查。见[格式规范](../../../../packages/session/session-format-v3-to-v4/README.zh.md)。
+本段的运行时子会话错误处理部分由[逐会话目录准备](../bug-fix/2026-09-19-session-local-subagent-migration.zh.md)取代:打开父会话仍通过读取直属子会话补齐目录,但不可读子会话不再阻断健康父历史。V3→V4 使用保留的直属子 Session header 和自身 descriptor 补齐父 Session 的子代理发现记录。存储将紧凑的 descriptor 证据提供给 catalog 组装处,由其绑定到 V3→V4 stage 工厂;Stage 等待父 Session 的最终继承截点确定后,才校验目录 payload 并导出可获得的自身发现事实。嵌套的 seed 标记丢弃继承目录候选,不解释其 payload。已有目录记录允许 descriptor 不可用,包括在首次 step 之前失败的子 Session。Descriptor v1 表示 continuable 模式;v2/v3 显式记录模式。可获得且明确的发现字段必须与父目录一致;新增完整记录要求一个受支持的 descriptor。Descriptor 缺失、版本不受支持或存在多个时,保留日志与未知模式成员关系,不编造发现字段,理由见[不完整子目录证据](../bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.zh.md)。JSONL 在准备、复用和发布时重新检查关联成员与来源修订。不可读或不支持的 header 不参与发现;读取已识别子会话失败时,其 header 身份保留为未知模式成员关系。来源变化使准备缓存失效;只读打开自动重试一次,写打开则拒绝发布。诊断保留出错子日志的路径,并区分不支持的迁移证据与畸形子数据。收集器将子解码和 descriptor 失败报告为带子路径的警告;取消与来源一致性检查仍中止准备。仅支持 V0–V3 的目录避免递归迁移子 Session。当前 V4 读取跳过该扫描,但会执行与严格恢复相同的自身目录字段、唯一性及当前投递归属检查。见[格式规范](../../../../packages/session/session-format-v3-to-v4/README.zh.md)。
原始父子迁移测试保留 24 个历史创建时间冲突作为拒绝证据。独立的内存对照只对齐子创建时间,证明恢复保留事件,包括已发布但没有 descriptor 的子 Session。Headless/ACP 与 SDK 快照适配器在规范化之前校验实时父子时钟,并在刷新时保持两者相等;已提交的前代文件保持不变。
diff --git a/.agents/notes/implemented/bug-fix/2026-09-19-session-local-subagent-migration.i18n.yaml b/.agents/notes/implemented/bug-fix/2026-09-19-session-local-subagent-migration.i18n.yaml
new file mode 100644
index 0000000000..e2f0f66dda
--- /dev/null
+++ b/.agents/notes/implemented/bug-fix/2026-09-19-session-local-subagent-migration.i18n.yaml
@@ -0,0 +1,6 @@
+# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
+# side as of the last confirmed-consistent state. Both languages carry equal authority;
+# after editing either side, bring the other along and re-record with:
+# pnpm run verify-translation-pairing --write .agents/notes/implemented/bug-fix/2026-09-19-session-local-subagent-migration.md
+2026-09-19-session-local-subagent-migration.md: 26911ea6e2cb31126d13e4c8c6488ff3b45563e6
+2026-09-19-session-local-subagent-migration.zh.md: 673040a3dc73d3665e42013a4704ef2d5911b23d
diff --git a/.agents/notes/implemented/bug-fix/2026-09-19-session-local-subagent-migration.md b/.agents/notes/implemented/bug-fix/2026-09-19-session-local-subagent-migration.md
new file mode 100644
index 0000000000..26911ea6e2
--- /dev/null
+++ b/.agents/notes/implemented/bug-fix/2026-09-19-session-local-subagent-migration.md
@@ -0,0 +1,33 @@
+# Agent Note: Complete parent catalogs without migrating child catalogs
+
+Status: implemented
+
+English | [中文](2026-09-19-session-local-subagent-migration.zh.md)
+
+## Problem
+
+Opening a historical parent requires discovery facts from its direct children. A child's corrupt body or invalid descriptor, or an unreadable header elsewhere in the root, could reject the parent's V4 preparation and hide otherwise readable history.
+
+## Decision
+
+Opening A discovers candidate B Sessions through headers, reads their own descriptors, and completes A's catalog. Historical child reads use the V0–V3 catalog; current child reads use native validation. These reads neither prepare B's own catalog nor publish B's successor. Opening B separately performs B's migration and catalog preparation. Frontend discovery retains its parent-catalog source. Unknown-mode rows remain browsable; `list_agents` continues to select only known continuable children.
+
+JSONL omits unreadable or unsupported headers from discovery. A child-body or descriptor-field failure produces a warning with the child path and retains the child's header identity. If the parent lacks a complete entry, migration appends `subagent/catalog`, projected as `mode: 'unknown'` alongside healthy siblings. Existing complete entries remain authoritative. Cancellation and source-consistency failures still stop the operation. Inspected child revisions, including failed decodes, are rechecked before reuse and publication so repairs cannot silently reuse stale evidence. Released predecessors remain byte-identical.
+
+This partially supersedes child-failure propagation in [released migrations](../architecture/2026-08-31-released-session-format-migrations.md) and [incomplete child evidence](2026-09-19-v3-incomplete-child-catalog-evidence.md). Their format conversion, descriptor cardinality, conflict validation, and immutable publication rules remain active.
+
+## Alternatives considered
+
+**Skip catalog completion and discover children in each consumer.** This introduces incomplete tool results and additional UI states despite the parent's readable child descriptors. The parent catalog already serves these consumers.
+
+**Drop unreadable children from the catalog.** Published parents would lose their navigation entries. Header identity is sufficient to retain membership without inventing a mode or label.
+
+**Recursively prepare child catalogs.** A only needs B's own descriptor. Preparing B's descendants adds unrelated work and failure dependencies.
+
+**Refuse A when one child cannot be read.** The child's discovery metadata does not justify withholding the parent's healthy history. Warnings retain the child location without inventing mode or label fields.
+
+## Consequences
+
+Initial parent preparation still scans headers and reads direct-child bodies one at a time. It does not claim to eliminate this I/O. Published V4 parents use their catalog without rescanning children. Unknown entries are not automatically rewritten after publication. Opening a child retries its log and determines browsing capabilities from its actual descriptor, or reports the child-local error. Catalog payload v0 retains its two known modes; v1 also supports `unknown`. Readers support both versions; healthy creation and complete historical facts retain v0, while unknown migration facts use v1. The V4 Session header is unchanged, and older readers reject the new payload version.
+
+Raw and compressed tests cover catalog completion, child-local errors, source changes and repairs, unchanged child generations, and deferred child-catalog preparation. The shipped Web migration snapshot checks the parent catalog with a corrupt sibling, then opens the child independently. Its additional historical child raises the corpus budget from ten to eleven roles; the guard rejects a twelfth role.
diff --git a/.agents/notes/implemented/bug-fix/2026-09-19-session-local-subagent-migration.zh.md b/.agents/notes/implemented/bug-fix/2026-09-19-session-local-subagent-migration.zh.md
new file mode 100644
index 0000000000..673040a3dc
--- /dev/null
+++ b/.agents/notes/implemented/bug-fix/2026-09-19-session-local-subagent-migration.zh.md
@@ -0,0 +1,33 @@
+# Agent Note:补齐父目录而不迁移子目录
+
+Status: implemented
+
+[English](2026-09-19-session-local-subagent-migration.md) | 中文
+
+## 问题
+
+打开历史父会话需要直属子会话的发现事实。子日志正文损坏、descriptor 无效,或根目录其他位置的 header 不可读,都可能拒绝父会话的 V4 准备,使原本可读的历史无法打开。
+
+## 决策
+
+打开 A 时通过 header 发现候选 B Session,读取其自身 descriptor,并补齐 A 的 catalog。历史子日志使用 V0–V3 catalog 读取,当前子日志使用原生校验。这些读取不准备 B 自己的 catalog,也不发布 B 的后继。单独打开 B 时才执行 B 的迁移与目录准备。前端发现继续读取父 catalog。模式未知的条目仍可浏览;`list_agents` 继续只选择已知可继续的子会话。
+
+JSONL 在发现时跳过不可读或不支持的 header。子正文或 descriptor 字段失败会产生带子路径的警告,并保留该子的 header 身份。父目录没有完整条目时,迁移追加 `subagent/catalog`,与健康兄弟项一同投影为目录条目,其模式为 `mode: 'unknown'`。已有完整条目仍具有权威性。取消与来源一致性失败仍中止操作。复用和发布前会重新检查已检查子日志的修订,包括解码失败的日志,使修复不能静默复用旧证据。已发布前驱保持逐字节不变。
+
+本决策部分取代[已发布迁移](../architecture/2026-08-31-released-session-format-migrations.zh.md)和[不完整子证据](2026-09-19-v3-incomplete-child-catalog-evidence.zh.md)中的子错误传播规则。其格式转换、descriptor 数量、冲突校验和不可变发布规则仍有效。
+
+## 考虑过的替代方案
+
+**跳过目录补齐,让每个消费者发现子项。** 父会话明明有可读的子 descriptor,却会因此产生不完整工具结果和额外 UI 状态。父 catalog 已经服务这些消费者。
+
+**从目录删除不可读子会话。** 已发布父会话会丢失相应导航入口。Header 身份足以保留成员关系,无须编造模式或标签。
+
+**递归准备子目录。** A 只需要 B 自身的 descriptor。准备 B 的后代会增加无关工作与失败依赖。
+
+**一个子会话不可读就拒绝 A。** 子会话的发现元数据不足以成为阻断健康父历史的理由。警告保留子位置,不虚构 mode 或 label 字段。
+
+## 后果
+
+首次父准备仍扫描 header 并逐个读取直属子正文,不宣称消除此 I/O。已发布 V4 父会话使用其 catalog,不重新扫描子日志。发布后不自动重写未知条目。打开子会话会重试其日志,根据实际 descriptor 确定浏览能力,或报告该子会话的错误。Catalog 载荷 v0 保留两种已知模式,v1 另支持 `unknown`。读取器支持两版;正常创建及完整历史事实继续使用 v0,未知迁移事实使用 v1。V4 Session header 不变,旧读取器拒绝新载荷版本。
+
+原始和压缩测试覆盖目录补齐、子会话错误隔离、来源变化与修复、子代际不变和延后的子目录准备。随产品 Web 迁移快照在损坏兄弟存在时检查父目录,再独立打开子会话。额外的历史子角色使语料预算由十个增加到十一个;守卫拒绝第十二个角色。
diff --git a/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.i18n.yaml b/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.i18n.yaml
index 4ede5bd457..bf6d6c2fd0 100644
--- a/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.i18n.yaml
+++ b/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.md
-2026-09-19-v3-incomplete-child-catalog-evidence.md: 22ca91502425257ed30aa4962f5a38497b8a8a92
-2026-09-19-v3-incomplete-child-catalog-evidence.zh.md: c11e6de2c27b9892a72c28f327b6d06834d84038
+2026-09-19-v3-incomplete-child-catalog-evidence.md: 400a84f376a7babc0a95492ca33a3bcd0761cd79
+2026-09-19-v3-incomplete-child-catalog-evidence.zh.md: 535951630bc600647724d50107e74e83ab626739
diff --git a/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.md b/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.md
index 22ca915024..400a84f376 100644
--- a/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.md
+++ b/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.md
@@ -10,9 +10,9 @@ A valid V3 child log can have no own descriptor, an unsupported descriptor versi
## Decision
-The V3→V4 migration appends a missing parent catalog entry only when exactly one supported own child descriptor supplies its discovery fields. Other descriptor counts and unsupported versions contribute no new catalog fact. Existing parent entries and child events remain intact. This replaces only the missing-evidence refusal in the [adjacent migration decision](../architecture/2026-08-31-released-session-format-migrations.md).
+The V3→V4 migration appends a complete missing parent catalog entry only when exactly one supported own child descriptor supplies its discovery fields. Other descriptor counts and unsupported versions retain unknown-mode membership through [session-local catalog preparation](2026-09-19-session-local-subagent-migration.md). Existing parent entries and child events remain intact. This replaces only the missing-evidence refusal in the [adjacent migration decision](../architecture/2026-08-31-released-session-format-migrations.md).
-Known child creation times must still match existing parent entries. Mode/label and descriptor fields are checked only for exactly one supported own descriptor. Invalid fields in that descriptor, corrupt logs, unreadable membership, unsupported selected generations, and changed source revisions retain their existing failures.
+The JSONL failure-propagation rules below are partially superseded by [session-local catalog preparation](2026-09-19-session-local-subagent-migration.md); the converter still validates supplied facts and conflicts. Known child creation times must still match existing parent entries. Mode/label and descriptor fields are checked only for exactly one supported own descriptor. JSONL isolates invalid descriptor fields and corrupt child bodies while retaining known header identity; unreadable or unsupported headers are excluded from discovery. Changed source revisions still refuse publication.
## Alternatives considered
@@ -24,6 +24,6 @@ Known child creation times must still match existing parent entries. Mode/label
## Consequences
-A historical child without a usable descriptor remains readable by id but may be absent from its parent's direct-child catalog. Existing catalog entries remain visible. Once a V4 successor is published, opening it does not rescan historical children; automatic later catalog repair is outside this migration. Preparation still rechecks child revisions before publication, so newly available evidence cannot silently bypass source consistency checks.
+A historical child with a readable header but no usable descriptor retains unknown-mode membership in its parent's direct-child catalog. Existing catalog entries remain visible. Once a V4 successor is published, opening it does not rescan historical children; automatic later mode backfill is outside this migration. Preparation still rechecks child revisions before publication, so newly available evidence cannot silently bypass source consistency checks.
Unit, JSONL read/write, and Preview packing tests cover unavailable evidence, unchanged source bytes, retained entries, identity conflicts, and evidence changes before publication.
diff --git a/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.zh.md b/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.zh.md
index c11e6de2c2..535951630b 100644
--- a/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.zh.md
+++ b/.agents/notes/implemented/bug-fix/2026-09-19-v3-incomplete-child-catalog-evidence.zh.md
@@ -10,9 +10,9 @@ Status: implemented
## Decision
-V3→V4 迁移只在恰好一个受支持的自身子 descriptor 提供发现字段时,追加缺失的父目录项。其他 descriptor 数量及不受支持的版本不贡献新的目录事实。已有父目录项和子事件保持完整。这只替代[相邻迁移决策](../architecture/2026-08-31-released-session-format-migrations.zh.md)中的证据缺失拒绝规则。
+V3→V4 迁移仅在恰好一个受支持的自身子 descriptor 提供发现字段时,追加完整的缺失父目录项。其他 descriptor 数量和不支持的版本通过[逐会话目录准备](2026-09-19-session-local-subagent-migration.zh.md)保留模式未知的成员关系。已有父目录项和子事件保持不变。这取代[相邻迁移决策](../architecture/2026-08-31-released-session-format-migrations.zh.md)中对缺失证据的拒绝。
-已知子创建时间仍必须与已有父目录项一致。只有恰好一个受支持的自身 descriptor 时,才校验其字段并比较 mode/label。该 descriptor 字段无效、日志损坏、成员关系不可读、所选代际不受支持以及源修订变化仍保留原有失败行为。
+JSONL 错误传播规则由[逐会话目录准备](2026-09-19-session-local-subagent-migration.zh.md)部分取代;转换器仍校验已提供事实及冲突。已知子创建时间必须匹配已有父目录项。只有恰好一个受支持的自身 descriptor 时才检查 mode/label 和 descriptor 字段。JSONL 隔离无效 descriptor 字段和损坏子正文,并保留已知 header 身份;不可读或不支持的 header 不参与发现。来源修订变化仍拒绝发布。
## Alternatives considered
@@ -24,6 +24,6 @@ V3→V4 迁移只在恰好一个受支持的自身子 descriptor 提供发现字
## Consequences
-没有可用 descriptor 的历史子 Session 仍可按 id 读取,但可能不出现在其父级的直属子目录中。已有目录项仍可见。V4 后继发布后,打开它不会重新扫描历史子日志;后续自动修复目录不属于本迁移。准备过程仍会在发布前复查子修订,因此新出现的证据无法悄悄绕过源一致性检查。
+历史子会话具有可读 header 但没有可用 descriptor 时,在父直属子目录中保留未知模式成员关系。已有目录项仍可见。V4 后继发布后,打开它不重新扫描历史子日志;自动补齐后续模式不属于本迁移。准备过程仍在发布前重新检查子修订,因此新出现的证据不能静默绕过来源一致性检查。
单元、JSONL 读写和 Preview 打包测试覆盖不可用证据、源字节不变、条目保留、身份冲突以及发布前的证据变化。
diff --git a/.agents/notes/implemented/process/2026-09-11-persistence-type-history.i18n.yaml b/.agents/notes/implemented/process/2026-09-11-persistence-type-history.i18n.yaml
index 94e92c9bac..969ab3fd9e 100644
--- a/.agents/notes/implemented/process/2026-09-11-persistence-type-history.i18n.yaml
+++ b/.agents/notes/implemented/process/2026-09-11-persistence-type-history.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/process/2026-09-11-persistence-type-history.md
-2026-09-11-persistence-type-history.md: c7cddea5ecc479a64ad5f24f5447e869779b7f9e
-2026-09-11-persistence-type-history.zh.md: 001ce197c4cd12dc64a5e2bd710e39cb2b61f23a
+2026-09-11-persistence-type-history.md: 87e87041dd44c4f671409a75c1b374312736342a
+2026-09-11-persistence-type-history.zh.md: cfe5c4f7bd1998d4329dc422607cfe33273d1a5a
diff --git a/.agents/notes/implemented/process/2026-09-11-persistence-type-history.md b/.agents/notes/implemented/process/2026-09-11-persistence-type-history.md
index c7cddea5ec..87e87041dd 100644
--- a/.agents/notes/implemented/process/2026-09-11-persistence-type-history.md
+++ b/.agents/notes/implemented/process/2026-09-11-persistence-type-history.md
@@ -14,7 +14,7 @@ One normalized type model supplies the readable persistence catalog, the complet
The dedicated [persistence-change records](../../../../docs/persistence-changes/README.md) bind acknowledgement to the after digest of each affected root. A generated companion stores complete after schemas. The initial record covers all roots; later records name each root's predecessor. A predecessor's after schema supplies the next before schema. Verification rejects ambiguous history and requires current source to match the terminal recorded state without consulting Git history or remote services.
-Automatic classification permits optional body additions, required-to-optional body changes, and ordinary event additions within one version. The scoped [source-attribution policy](2026-09-17-persistence-schema-review.md) also permits qualified new producer kinds when both saved schemas opt in. Other structural changes require a version-bump decision that includes an increasing header version in that record. The [format-version procedure](../../../../docs/cookbook/adding-a-session-format-version.md) continues to own adjacent migration work. Every structural difference requires an explicit record, including additions allowed within the same version.
+Automatic classification permits optional body additions, required-to-optional body changes, and ordinary event additions within one version. The scoped [source-attribution policy](2026-09-17-persistence-schema-review.md) also permits qualified new producer kinds when both saved schemas opt in. The [event-payload version rule](../../../../docs/persistence-changes/README.md#compatibility-rules) admits higher numeric payload versions when every old alternative remains unchanged and records the older-reader limitation. Other structural changes require a version-bump decision that includes an increasing header version in that record. The [format-version procedure](../../../../docs/cookbook/adding-a-session-format-version.md) continues to own adjacent migration work. Every structural difference requires an explicit record, including additions allowed within the same version.
The new document kind preserves the compatibility reasoning and evidence for a historical type transition. Agent Notes retain mechanism-level decisions; they do not become a growing inventory of individual acknowledgements. Machine declarations remain identical across the bilingual pair and are parsed once.
diff --git a/.agents/notes/implemented/process/2026-09-11-persistence-type-history.zh.md b/.agents/notes/implemented/process/2026-09-11-persistence-type-history.zh.md
index 001ce197c4..cfe5c4f7bd 100644
--- a/.agents/notes/implemented/process/2026-09-11-persistence-type-history.zh.md
+++ b/.agents/notes/implemented/process/2026-09-11-persistence-type-history.zh.md
@@ -14,7 +14,7 @@ Status: implemented
专用的[持久化变更记录](../../../../docs/persistence-changes/README.zh.md)将确认绑定到每个受影响根的变更后摘要。生成的伴随文件保存完整的变更后 schema。初始记录覆盖所有根;后续记录为每个根指定前驱。前驱的变更后 schema 提供下一次的变更前 schema。验证拒绝有歧义的历史,并要求当前源码匹配最终记录状态,无需查询 Git 历史或远端服务。
-自动分类允许可选事件体新增、事件体属性从必选改为可选,以及普通事件新增保持同一版本。当双方保存的 schema 均声明支持时,受限的[消息源归属策略](2026-09-17-persistence-schema-review.zh.md)也允许添加符合条件的生产者 kind。其他结构变更需要升版本决策,并在该记录中包含递增的头部版本。[格式版本流程](../../../../docs/cookbook/adding-a-session-format-version.zh.md)继续负责相邻迁移工作。每个结构差异都需要显式记录,包括允许保持同一版本的新增。
+自动分类允许可选事件体新增、事件体属性从必选改为可选,以及普通事件新增保持同一版本。当双方保存的 schema 均声明支持时,受限的[消息源归属策略](2026-09-17-persistence-schema-review.zh.md)也允许添加符合条件的生产者 kind。[事件载荷版本规则](../../../../docs/persistence-changes/README.zh.md#compatibility-rules) 允许在原样保留所有旧分支时增加更高的数字载荷版本,并记录旧读取器限制。其他结构变更需要升版本决策,并在该记录中包含递增的头部版本。[格式版本流程](../../../../docs/cookbook/adding-a-session-format-version.zh.md)继续负责相邻迁移工作。每个结构差异都需要显式记录,包括允许保持同一版本的新增。
新文档类型保留历史类型转换的兼容性说明和证据。Agent Note 保留机制层面的决策,不积累单次确认清单。双语对中的机器声明保持相同,且只解析一次。
diff --git a/AGENTS.md b/AGENTS.md
index 7a128b6167..aa83ae8c08 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -101,6 +101,8 @@ pnpm run test:docs # quick documentation checks (no build; doc-quick aggreg
pnpm run website:build # VitePress build (doubles as dead-link check)
pnpm dsh --profile headless "task" # run one task from source (needs DEEPSEEK_API_KEY)
pnpm run demo:ptc -- "task" # headless PTC mode run (needs key)
+pnpm run dev:web | dev:desktop # build, then launch; Web also rebuilds client bundles on edits. start:web | start:desktop skip the build
+make web|dev-web|desktop|dev-desktop|build # the same commands; ARGS='--no-open' forwards options
```
### Host sandbox failures
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..4b95df6766
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,31 @@
+# Short names for the Web and Desktop application commands. The package.json
+# scripts they call stay the source of truth; docs/development.md documents both.
+.DEFAULT_GOAL := help
+.PHONY: help build web desktop dev-web dev-desktop
+
+PNPM ?= pnpm
+ARGS ?=
+
+help:
+ @echo "make build pnpm run build complete repository build"
+ @echo "make web pnpm run start:web serve the built Web artifacts from source"
+ @echo "make desktop pnpm run start:desktop launch the built Desktop artifacts"
+ @echo "make dev-web pnpm run dev:web build, serve, and rebuild Web on source edits"
+ @echo "make dev-desktop pnpm run dev:desktop build, then launch Desktop"
+ @echo "ARGS='--no-open --port 3081' forwards options to the launched application;"
+ @echo "the Web commands accept dsh web flags, the Desktop launcher accepts none."
+
+build:
+ $(PNPM) run build
+
+web:
+ $(PNPM) run start:web $(ARGS)
+
+desktop:
+ $(PNPM) run start:desktop $(ARGS)
+
+dev-web:
+ $(PNPM) run dev:web $(ARGS)
+
+dev-desktop:
+ $(PNPM) run dev:desktop $(ARGS)
diff --git a/README.i18n.yaml b/README.i18n.yaml
index 904c7928d2..ce6f75b18d 100644
--- a/README.i18n.yaml
+++ b/README.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write README.md
-README.md: 36adfe913902e75ce0673adc2cb5cb692151a291
-README.zh.md: f6861b4c9490741b5e5f2d825a370766178dd9f6
+README.md: 423bccd7d9352dbc48f1705f37d35642e74f5b41
+README.zh.md: c760f87e4ac3b7dbb7bb55d733e31db5ab379836
diff --git a/README.md b/README.md
index 36adfe9139..423bccd7d9 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
Start with the [development guide](docs/development.md) and [architecture documentation](docs/architecture.md).
+`pnpm run dev:web` builds, serves, and rebuilds client bundles on source edits in one terminal, and `make help` lists the matching Make targets for Web and Desktop; the guide's application commands section owns the full table.
+
For agents, follow [AGENTS.md](AGENTS.md).
## Citation
diff --git a/README.zh.md b/README.zh.md
index f6861b4c94..c760f87e4a 100644
--- a/README.zh.md
+++ b/README.zh.md
@@ -75,6 +75,8 @@ pnpm dsh web
请先阅读[开发指南](docs/development.zh.md)与[架构文档](docs/architecture.zh.md)。
+`pnpm run dev:web` 会在一个终端里完成构建、启动,并在源码修改时重建 client bundle;`make help` 列出 Web 与 Desktop 对应的 Make target。完整表格见开发指南的「应用命令」一节。
+
面向 agent:请遵循 [AGENTS.md](AGENTS.md)。
## 引用
diff --git a/apps/cli/reference/README.i18n.yaml b/apps/cli/reference/README.i18n.yaml
index 0cff0e5cdb..cb0eddf183 100644
--- a/apps/cli/reference/README.i18n.yaml
+++ b/apps/cli/reference/README.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write apps/cli/reference/README.md
-README.md: cf0e1400f2dc8cd29cc59cefbdda379df2e0b899
-README.zh.md: a01818f59ccf54f3f826c68505bfb830a9316664
+README.md: 33465e8c96df9cbfbecc038616caf297146ec971
+README.zh.md: d25d27851ca789a3db358157368b97c3669ed79d
diff --git a/apps/cli/reference/README.md b/apps/cli/reference/README.md
index cf0e1400f2..33465e8c96 100644
--- a/apps/cli/reference/README.md
+++ b/apps/cli/reference/README.md
@@ -85,7 +85,7 @@ Git-hosted plugins that ship sources build during install through their `prepare
## Web profile
-`dsh web` uses the profile shorthand. Launcher flags are parsed first; the remaining flags belong to the web app, whose ordinary bundle provider parses them. `--host` and `--port` override the composed values of the rows that carry them, repeatable `--trusted-host` contributes invocation authorities through `ctx.webRuntime.trustedHosts` (a deployment expression concatenates its own authorities), and `--no-open` disables the default-browser handoff for this invocation. The client-plugin HMR receiver is always mounted and stays idle until a separate `pnpm run dev:web` watcher rebuilds client bundles.
+`dsh web` uses the profile shorthand. Launcher flags are parsed first; the remaining flags belong to the web app, whose ordinary bundle provider parses them. `--host` and `--port` override the composed values of the rows that carry them, repeatable `--trusted-host` contributes invocation authorities through `ctx.webRuntime.trustedHosts` (a deployment expression concatenates its own authorities), and `--no-open` disables the default-browser handoff for this invocation. The client-plugin HMR receiver is always mounted and stays idle until `pnpm run dev:web` rebuilds client bundles; that command builds once, starts this same launcher, and keeps client bundles rebuilt, or with `--no-serve` runs only the watchers beside a `dsh web` started elsewhere.
```sh
dsh web
diff --git a/apps/cli/reference/README.zh.md b/apps/cli/reference/README.zh.md
index a01818f59c..d25d27851c 100644
--- a/apps/cli/reference/README.zh.md
+++ b/apps/cli/reference/README.zh.md
@@ -87,7 +87,7 @@ dsh --profile tui
## Web Profile
-`dsh web` 使用 profile 简写。启动器先解析自身的 flag,其余 flag 属于 web 应用,由组合包中的普通提供方解析。`--host` 和 `--port` 覆盖承载它们的那些行的组合取值,可重复的 `--trusted-host` 通过 `ctx.webRuntime.trustedHosts` 提供本次调用的 authority(部署表达式会拼接自己的 authority),`--no-open` 则只对本次调用关闭默认浏览器交接。客户端插件 HMR(热模块替换)接收器始终挂载,在单独运行的 `pnpm run dev:web` watcher 重建客户端 bundle 之前保持空闲。
+`dsh web` 使用 profile 简写。启动器先解析自身的 flag,其余 flag 属于 web 应用,由组合包中的普通提供方解析。`--host` 和 `--port` 覆盖承载它们的那些行的组合取值,可重复的 `--trusted-host` 通过 `ctx.webRuntime.trustedHosts` 提供本次调用的 authority(部署表达式会拼接自己的 authority),`--no-open` 则只对本次调用关闭默认浏览器交接。客户端插件 HMR(热模块替换)接收器始终挂载,在 `pnpm run dev:web` 重建客户端 bundle 之前保持空闲;该命令先构建一次,再启动这同一个启动器并持续重建客户端 bundle,加 `--no-serve` 则只运行 watcher、配合别处启动的 `dsh web`。
```sh
dsh web
diff --git a/apps/cli/tests/profiles/web/tests/web-default-isolation.expected.e2e.ts b/apps/cli/tests/profiles/web/tests/web-default-isolation.expected.e2e.ts
index 0e58af42f3..ecf19a7253 100644
--- a/apps/cli/tests/profiles/web/tests/web-default-isolation.expected.e2e.ts
+++ b/apps/cli/tests/profiles/web/tests/web-default-isolation.expected.e2e.ts
@@ -8,7 +8,7 @@ import { withDefaultWeb, webGet } from './default-web-process.ts'
const experimentalName = '@deepseek-ai/dsh-experimental-client-ui-agent-team'
-it('boots the default Web profile without experimental Host modules, mounted plugins, or Client entries', async (test) => {
+it('boots default Web without experimental modules or an active built-in Browser', async (test) => {
await withDefaultWeb(test, async ({ url, request }) => {
const auth = await webGet(url, test.signal)
const cookie = auth.headers['set-cookie']?.[0]?.split(';', 1)[0]
@@ -29,6 +29,11 @@ it('boots the default Web profile without experimental Host modules, mounted plu
expect(roster.plugins.length).toBeGreaterThan(roster.entries.length)
expect(roster.modules.some(url => modulePackage(url) === '@deepseek-ai/dsh')).toBe(true)
expect(roster.client.entries.length).toBeGreaterThan(0)
+ const browserName = '@deepseek-ai/dsh-client-ui-sidebar-browser'
+ const browserEntry = roster.entries.find(entry => entry.name === browserName)
+ expect(browserEntry).toBeDefined()
+ expect(browserEntry!.state).toBeUndefined()
+ expect(delivered.entries.some(entry => entry.id === browserName)).toBe(false)
expect(experimentalRuntimeReferences(roster)).toEqual([])
const contaminated = await request('mount-experimental')
diff --git a/apps/desktop/README.i18n.yaml b/apps/desktop/README.i18n.yaml
index 473b7d2968..ad60f636ee 100644
--- a/apps/desktop/README.i18n.yaml
+++ b/apps/desktop/README.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write apps/desktop/README.md
-README.md: d70f8895c54623812b175ec2f6b316915fe29514
-README.zh.md: 78f132baa394020376ad43a1c8ac54482a65c476
+README.md: aa2d9163067ea48b398e200b644fbeda6ea370a9
+README.zh.md: a27b551b4fc2ea37d5a2da45edbcf4b2901e5dde
diff --git a/apps/desktop/README.md b/apps/desktop/README.md
index d70f8895c5..aa2d916306 100644
--- a/apps/desktop/README.md
+++ b/apps/desktop/README.md
@@ -93,7 +93,7 @@ After an explicit build, `start:desktop` reconstructs the disposable project and
pnpm run start:desktop
```
-Workspace development runs the current CLI and private Desktop Host packages under Electron RunAsNode. Plugin management and recovery use `$DSH_HOME/profiles/desktop`, separate from the disposable workspace runtime. The Host uses runtime module resolution in both development and packaged builds without creating official-package fallback links; developer-installed packages, including links, retain native priority. Use an unpacked application to exercise Electron RunAsNode, bundled pnpm, bundled dsh resources, plugin installation and repair paths.
+The Web counterparts are `pnpm run dev:web` and `pnpm run start:web`, documented in the [development guide](../../docs/development.md). Workspace development runs the current CLI and private Desktop Host packages under Electron RunAsNode. Plugin management and recovery use `$DSH_HOME/profiles/desktop`, separate from the disposable workspace runtime. The Host uses runtime module resolution in both development and packaged builds without creating official-package fallback links; developer-installed packages, including links, retain native priority. Use an unpacked application to exercise Electron RunAsNode, bundled pnpm, bundled dsh resources, plugin installation and repair paths.
## Package
diff --git a/apps/desktop/README.zh.md b/apps/desktop/README.zh.md
index 78f132baa3..a27b551b4f 100644
--- a/apps/desktop/README.zh.md
+++ b/apps/desktop/README.zh.md
@@ -93,7 +93,7 @@ pnpm run dev:desktop
pnpm run start:desktop
```
-Workspace 开发使用 Electron RunAsNode 运行当前 CLI 与私有 Desktop Host 包,插件管理和恢复使用 `$DSH_HOME/profiles/desktop`,与一次性工作区运行时分离。Host 在开发与打包构建中都使用 runtime 模块解析,不创建官方包的 fallback 链接;开发者安装的包(包括链接)保留原生优先级。需要验证 Electron RunAsNode、内置 pnpm、内置 dsh 资源、插件安装和修复时,应运行未封装安装器的应用目录。
+Web 侧的对应命令是 `pnpm run dev:web` 与 `pnpm run start:web`,见[开发指南](../../docs/development.zh.md)。Workspace 开发使用 Electron RunAsNode 运行当前 CLI 与私有 Desktop Host 包,插件管理和恢复使用 `$DSH_HOME/profiles/desktop`,与一次性工作区运行时分离。Host 在开发与打包构建中都使用 runtime 模块解析,不创建官方包的 fallback 链接;开发者安装的包(包括链接)保留原生优先级。需要验证 Electron RunAsNode、内置 pnpm、内置 dsh 资源、插件安装和修复时,应运行未封装安装器的应用目录。
## 打包
diff --git a/apps/web/tests/clickable-links-gallery.e2e.ts b/apps/web/tests/clickable-links-gallery.e2e.ts
index 21e4f78bae..2cf02b02eb 100644
--- a/apps/web/tests/clickable-links-gallery.e2e.ts
+++ b/apps/web/tests/clickable-links-gallery.e2e.ts
@@ -318,7 +318,7 @@ describe('web e2e: clickable links gallery', () => {
await seedSession(scaffold, galleryFixture(imageUrl), SEED_ID, undefined, { createdAt: GALLERY_TIME })
browser = await chromium.launch()
page = await newEnglishPage(browser)
- await page.route(/https?:\/\/docs\.example\.test\/.*/u, async route => route.fulfill({
+ await page.context().route(/https?:\/\/docs\.example\.test\/.*/u, async route => route.fulfill({
contentType: 'text/html',
body: `
${new URL(route.request().url()).pathname}
`,
}))
@@ -454,5 +454,31 @@ describe('web e2e: clickable links gallery', () => {
await expect.poll(() => browserAddress.inputValue()).toBe(GUIDE_URL)
await markdown.locator(`a[href="${HTTP_URL}"]`).click()
await expect.poll(() => browserAddress.inputValue()).toBe(HTTP_URL)
+
+ await page.getByRole('button', { name: 'Settings', exact: true }).click()
+ await page.getByRole('button', { name: 'Built-in browser', exact: true }).click()
+ await page.getByRole('menuitem', { name: 'New browser tab', exact: true }).click()
+ await expect.poll(() => scaffold.ctx.settings.get('ui-chat')).toMatchObject({ linkOpening: 'new-tab' })
+ await page.keyboard.press('Escape')
+ const popupPromise = page.waitForEvent('popup')
+ await guideLink.click()
+ const popup = await popupPromise
+ try {
+ await popup.waitForURL(GUIDE_URL)
+ expect(await popup.evaluate(() => window.opener === null)).toBe(true)
+ expect(await browserAddress.inputValue()).toBe(HTTP_URL)
+ } finally {
+ await popup.close()
+ }
+
+ await page.reload()
+ await page.getByRole('button', { name: 'Settings', exact: true }).click()
+ await page.getByRole('button', { name: 'New browser tab', exact: true }).click()
+ await page.getByRole('menuitem', { name: 'Built-in browser', exact: true }).click()
+ await expect.poll(() => scaffold.ctx.settings.get('ui-chat')).toMatchObject({ linkOpening: 'sidebar' })
+ await page.keyboard.press('Escape')
+ await guideLink.click()
+ await expect.poll(() => browserAddress.inputValue()).toBe(GUIDE_URL)
+ expect(tripwire.pageErrors).toEqual([])
}, 90_000)
})
diff --git a/apps/web/tests/clickable-links-gallery.overlay.yml b/apps/web/tests/clickable-links-gallery.overlay.yml
index d8adc80e3b..ad0114d151 100644
--- a/apps/web/tests/clickable-links-gallery.overlay.yml
+++ b/apps/web/tests/clickable-links-gallery.overlay.yml
@@ -7,3 +7,5 @@
- id: settings-controller
config:
nativeOpen: true
+- id: ui-sidebar-browser
+ disabled: false
diff --git a/apps/web/tests/expected/plugin-manager/icons.expected.md b/apps/web/tests/expected/plugin-manager/icons.expected.md
new file mode 100644
index 0000000000..fb9df5edb1
--- /dev/null
+++ b/apps/web/tests/expected/plugin-manager/icons.expected.md
@@ -0,0 +1,5 @@
+Third-party bundle card: image, 36×36, decoded
+Disabled Agent Teams card: image, 36×36, decoded
+Agent Teams detail: image, 36×36, decoded
+Third-party bundle detail: image, 36×36, decoded
+Independent search row: image, 30×30, decoded
diff --git a/apps/web/tests/expected/settings-chrome/dialog-no-browser.expected.md b/apps/web/tests/expected/settings-chrome/dialog-no-browser.expected.md
new file mode 100644
index 0000000000..41d6462e11
--- /dev/null
+++ b/apps/web/tests/expected/settings-chrome/dialog-no-browser.expected.md
@@ -0,0 +1,28 @@
+- dialog "Settings":
+ - navigation:
+ - text: Settings
+ - button "General"
+ - button "Models"
+ - button "Built-in plugins"
+ - button "Agent presets"
+ - button "Open configuration file"
+ - button "Close"
+ - text: Permission Choose the default permission mode for new sessions
+ - button "Workspace Write"
+ - text: Language
+ - button "English"
+ - text: Appearance
+ - button "Light"
+ - button "Dark"
+ - button "System" [pressed]
+ - text: Font size Only affects conversation content 14
+ - button "Increase font size"
+ - button "Decrease font size"
+ - text: px Conversation display Controls process content in completed turns
+ - button "Compact"
+ - text: Performance & usage Choose how much performance and usage information to show
+ - button "Detailed"
+ - text: Developer tools Show tools and information for debugging and troubleshooting
+ - switch "Developer tools"
+ - text: Send behavior while busy What Enter and the Send button do while the agent is running; Cmd/Ctrl+Enter uses the other behavior
+ - button "Queue"
diff --git a/apps/web/tests/fixtures/plugins/fixture-bundle/icon.svg b/apps/web/tests/fixtures/plugins/fixture-bundle/icon.svg
new file mode 100644
index 0000000000..ad85688706
--- /dev/null
+++ b/apps/web/tests/fixtures/plugins/fixture-bundle/icon.svg
@@ -0,0 +1 @@
+
diff --git a/apps/web/tests/fixtures/plugins/fixture-bundle/package.json b/apps/web/tests/fixtures/plugins/fixture-bundle/package.json
index 3224dfa296..71aa6bbd5f 100644
--- a/apps/web/tests/fixtures/plugins/fixture-bundle/package.json
+++ b/apps/web/tests/fixtures/plugins/fixture-bundle/package.json
@@ -1,6 +1,7 @@
{
"name": "@fixture/bundle",
"version": "0.0.1",
+ "icon": "./icon.svg",
"private": true,
"description": "Registry description for the fixture bundle.",
"type": "module",
diff --git a/apps/web/tests/fixtures/plugins/fixture-bundle/search.package.json b/apps/web/tests/fixtures/plugins/fixture-bundle/search.package.json
index 52a0c0f420..79083aafff 100644
--- a/apps/web/tests/fixtures/plugins/fixture-bundle/search.package.json
+++ b/apps/web/tests/fixtures/plugins/fixture-bundle/search.package.json
@@ -1,4 +1,5 @@
{
"name": "Search plugin",
+ "icon": "./icon.svg",
"description": "Search package introduction."
}
diff --git a/apps/web/tests/hmr-live.e2e.ts b/apps/web/tests/hmr-live.e2e.ts
index 716176a176..87adea12cc 100644
--- a/apps/web/tests/hmr-live.e2e.ts
+++ b/apps/web/tests/hmr-live.e2e.ts
@@ -1,4 +1,4 @@
-/** Published dsh web + pnpm dev:web → browser HMR, with no page reload. */
+/** Built dsh web + the `pnpm run dev:web --no-serve` watchers → browser HMR, with no page reload. */
import { existsSync, globSync, statSync } from 'node:fs'
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
@@ -108,12 +108,14 @@ it('hot-reloads a real client-plugin source edit without refreshing the page', a
const failures: unknown[] = []
try {
subprocessFiber = await subprocessCtx.plugin(LocalSubprocessRuntime)
+ // Watchers only: the built `dsh web` below is the server under test, and the
+ // built tree is this lane's precondition rather than something to rebuild.
watcher = subprocessCtx.subprocess.spawn(spawnSpec(
- ['pnpm', 'run', 'dev:web'],
+ ['pnpm', 'run', 'dev:web', '--skip-build', '--no-serve'],
REPO_ROOT,
{ ...clientBuildEnvironment },
))
- await waitForOutput(watcher, /dev-web: watching/, 'pnpm run dev:web')
+ await waitForOutput(watcher, /dev-web: watching/, 'pnpm run dev:web --skip-build --no-serve')
host = subprocessCtx.subprocess.spawn(spawnSpec(
[process.execPath, binPath, 'web', '--no-open', '--port', '0'],
world,
diff --git a/apps/web/tests/markdown-inline-code-links.e2e.ts b/apps/web/tests/markdown-inline-code-links.e2e.ts
index 8fb8b5942c..fc7392c433 100644
--- a/apps/web/tests/markdown-inline-code-links.e2e.ts
+++ b/apps/web/tests/markdown-inline-code-links.e2e.ts
@@ -92,7 +92,9 @@ describe('web e2e: Markdown inline-code links', () => {
let tripwire: ReturnType
beforeAll(async () => {
- scaffold = await launchWebScaffold({})
+ scaffold = await launchWebScaffold({
+ extraOverlayPath: fileURLToPath(new URL('./sidebar-browser.overlay.yml', import.meta.url)),
+ })
await seedSession(scaffold, markdownFixture(LINK_URL), SEED_ID)
browser = await chromium.launch()
page = await newEnglishPage(browser)
diff --git a/apps/web/tests/no-sidebar-browser.overlay.yml b/apps/web/tests/no-sidebar-browser.overlay.yml
new file mode 100644
index 0000000000..2af93975a4
--- /dev/null
+++ b/apps/web/tests/no-sidebar-browser.overlay.yml
@@ -0,0 +1,3 @@
+# Exercise the settings surface without a built-in browser provider.
+- id: ui-sidebar-browser
+ disabled: true
diff --git a/apps/web/tests/plugin-manager.e2e.ts b/apps/web/tests/plugin-manager.e2e.ts
index 373b0ba459..8ce5950d4c 100644
--- a/apps/web/tests/plugin-manager.e2e.ts
+++ b/apps/web/tests/plugin-manager.e2e.ts
@@ -140,6 +140,50 @@ describe('web e2e: plugin manager', () => {
expect(tripwire.pageErrors).toEqual([])
}, 60_000)
+ it('decodes manifest icons for disabled bundles and independent plugin rows', async () => {
+ const panel = await openPluginsPanel()
+ const fixtureIcon = `data:image/svg+xml;base64,${(await readFile(join(FIXTURE_PLUGINS, 'fixture-bundle/icon.svg'))).toString('base64')}`
+ const teamIcon = `data:image/svg+xml;base64,${(await readFile(fileURLToPath(new URL('../../../packages/experimental/agent-team-profile/icon.svg', import.meta.url)))).toString('base64')}`
+ const images: string[] = []
+ const checkImage = async (selector: string, source: string, label: string) => {
+ const image = panel.locator(`${selector} img`).first()
+ await image.waitFor()
+ expect(await image.getAttribute('src')).toBe(source)
+ await image.evaluate(async (node: HTMLImageElement) => { await node.decode() })
+ const size = await image.evaluate((node: HTMLImageElement) => ({
+ width: node.width, height: node.height, naturalWidth: node.naturalWidth,
+ }))
+ expect(size.naturalWidth).toBeGreaterThan(0)
+ images.push(`${label}: image, ${size.width}×${size.height}, decoded`)
+ }
+ await checkImage('[data-plugin-package="@fixture/bundle"]', fixtureIcon, 'Third-party bundle card')
+ const team = panel.locator('[data-plugin-package="@deepseek-ai/dsh-experimental-agent-team-profile"]')
+ expect(await team.getByRole('switch').getAttribute('aria-checked')).toBe('false')
+ await checkImage('[data-plugin-package="@deepseek-ai/dsh-experimental-agent-team-profile"]', teamIcon, 'Disabled Agent Teams card')
+ try {
+ for (const colorScheme of ['light', 'dark'] as const) {
+ await page.emulateMedia({ colorScheme })
+ expect(await team.locator('img').evaluate((node: HTMLImageElement) => node.naturalWidth)).toBe(36)
+ if (MODE === 'refresh') {
+ const path = fileURLToPath(new URL(`../../../.artifacts/plugin-icons-${process.pid}-${colorScheme}.png`, import.meta.url))
+ await page.screenshot({ path })
+ console.log(`Plugin icon screenshot: ${path}`)
+ }
+ }
+ } finally {
+ await page.emulateMedia({ colorScheme: null })
+ }
+ await panel.getByRole('button', { name: '查看 智能体团队', exact: true }).click()
+ await checkImage('[data-plugin-detail]', teamIcon, 'Agent Teams detail')
+ await panel.getByRole('button', { name: '返回插件列表' }).click()
+ await panel.getByRole('button', { name: '查看 @fixture/bundle', exact: true }).click()
+ await checkImage('[data-plugin-detail]', fixtureIcon, 'Third-party bundle detail')
+ await checkImage('[data-plugin-row="fixture-search"]', fixtureIcon, 'Independent search row')
+ await compareOrRefreshGolden(join(SNAPSHOT_DIR, 'icons.expected.md'), images.join('\n'), MODE)
+ await panel.getByRole('button', { name: '返回插件列表' }).click()
+ expect(tripwire.pageErrors).toEqual([])
+ })
+
it('localizes independent exports and falls back per field without activating the plugins', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-plugin-manager-exports'))
const panel = await openPluginsPanel()
@@ -331,7 +375,7 @@ describe('web e2e: plugin manager', () => {
it.skipIf(MODE === 'record')('keeps the fixture inventory closed', async () => {
expect(tripwire.warnings).toEqual([])
await assertFixtureInventory(SNAPSHOT_DIR, [
- 'manager.expected.md', 'live-enabled.expected.md', 'missing-bundle.expected.md', 'exports.expected.md', 'exports-en.expected.md',
+ 'manager.expected.md', 'live-enabled.expected.md', 'missing-bundle.expected.md', 'exports.expected.md', 'exports-en.expected.md', 'icons.expected.md',
])
})
})
diff --git a/apps/web/tests/preset-migration.snapshot.ts b/apps/web/tests/preset-migration.snapshot.ts
index d8fccb3271..37fdd06073 100644
--- a/apps/web/tests/preset-migration.snapshot.ts
+++ b/apps/web/tests/preset-migration.snapshot.ts
@@ -13,6 +13,7 @@ import type {} from '@deepseek-ai/dsh-api-session-controller'
import { normalizeSessionSnapshots } from '@deepseek-ai/dsh-session-snapshot'
import { launchWebScaffold, webSnapshotMode } from './scaffold.ts'
+const childFixturePath = fileURLToPath(new URL('../../../snapshots/web/preset-migration/session.1.v2.jsonl', import.meta.url))
const fixturePath = fileURLToPath(new URL('../../../snapshots/web/preset-migration/session.v2.jsonl', import.meta.url))
describe.skipIf(webSnapshotMode() === 'record')('historical preset restoration through the Web Host', () => {
@@ -32,6 +33,33 @@ describe.skipIf(webSnapshotMode() === 'record')('historical preset restoration t
await mkdir(dirname(predecessor), { recursive: true })
await writeFile(predecessor, source)
+ const childId = SessionId('preset-migration-child')
+ const brokenId = SessionId('preset-migration-broken-child')
+ const childFixture = (await readFile(childFixturePath, 'utf8')).trimEnd().split('\n')
+ .map((line): Record => JSON.parse(line) as Record)
+ const childRows: Record[] = childFixture.slice(1).map((row, seq) => ({ ...row, seq, time: seq + 3 }))
+ const childHeader = { ...childFixture[0], id: childId, parentSession: id, cwd: scaffold.workspaceCwd }
+ const childSource = Buffer.concat([childHeader, ...childRows].map(row => zstdCompressSync(Buffer.from(JSON.stringify(row) + '\n'))))
+ const childPath = generationLogPath(scaffold.persistenceRoot, scaffold.workspaceCwd, childId, 2, 'zstd')
+ const brokenPath = generationLogPath(scaffold.persistenceRoot, scaffold.workspaceCwd, brokenId, 2, 'zstd')
+ await mkdir(dirname(childPath), { recursive: true })
+ await mkdir(dirname(brokenPath), { recursive: true })
+ await writeFile(childPath, childSource)
+ await writeFile(brokenPath, Buffer.concat([
+ zstdCompressSync(Buffer.from(JSON.stringify({ ...childHeader, id: brokenId }) + '\n')),
+ zstdCompressSync(Buffer.from('{broken\n' + JSON.stringify({ type: 'turn/end', seq: 1, time: 2,
+ data: { turn: 1, reason: { kind: 'completed' } } }) + '\n')),
+ ]))
+ const brokenSource = await readFile(brokenPath)
+ const corruptHeaderId = SessionId('preset-migration-corrupt-header')
+ const corruptHeaderPath = generationLogPath(scaffold.persistenceRoot, scaffold.workspaceCwd, corruptHeaderId, 2, 'zstd')
+ const corruptHeaderSource = Buffer.from('invalid Zstandard header frame')
+ await mkdir(dirname(corruptHeaderPath), { recursive: true })
+ await writeFile(corruptHeaderPath, corruptHeaderSource)
+ const listed = await scaffold.ctx.sessionController.list({}, new AbortController().signal)
+ expect(listed.items.map(item => item.sessionId)).toEqual(expect.arrayContaining([id, childId, brokenId]))
+ expect(listed.items.map(item => item.sessionId)).not.toContain(corruptHeaderId)
+
const reader = await scaffold.ctx.sessionPersistence.open(id, 'read')
try {
expect(reader.header.agentPreset).toBe('ptc')
@@ -48,7 +76,35 @@ describe.skipIf(webSnapshotMode() === 'record')('historical preset restoration t
expect(resolved.agent.session.snapshotEvents()
.filter(event => event.type === 'agent-preset/selected')
.map(event => event.data.agentPreset)).toEqual(withSelections ? ['ptc', 'standard', 'ptc'] : [])
+ expect(await scaffold.ctx.subagents.listChildren(id)).toEqual([
+ { id: brokenId, createdAt: childFixture[0]?.['createdAt'], mode: 'unknown' },
+ { id: childId, createdAt: childFixture[0]?.['createdAt'], mode: 'one-shot', label: 'historical child' },
+ ])
+ const childSuccessor = generationLogPath(scaffold.persistenceRoot, scaffold.workspaceCwd, childId, SESSION_FORMAT_VERSION, 'zstd')
+ await expect(readFile(childSuccessor)).rejects.toMatchObject({ code: 'ENOENT' })
+ const signal = new AbortController().signal
+ const address = { kind: 'subagent', parentSessionId: id, childSessionId: childId, mode: 'one-shot' } as const
+ const childPage = await scaffold.ctx.sessionController.page({ address, throughSeq: childRows.length - 1 }, signal)
+ expect(childPage.records.map(record => record.event.type)).toEqual(childRows.map(row => row['type']))
+ await expect(scaffold.ctx.sessionController.page({ address: { ...address, childSessionId: brokenId, mode: 'unknown' }, throughSeq: 1 }, signal))
+ .rejects.toThrow()
+ await expect(scaffold.ctx.sessionController.page({ address: { kind: 'session', sessionId: id }, throughSeq: rows.length - 1 }, signal))
+ .resolves.toMatchObject({ hasMore: false })
+ const childWriter = await scaffold.ctx.sessionPersistence.open(childId, 'write')
+ await childWriter.close()
+ const childPublished = await readFile(childSuccessor)
+ const childText = Buffer.concat(scanZstdFrames(childPublished).frames
+ .map(({ start, end }) => zstdDecompressSync(childPublished.subarray(start, end)))).toString('utf8')
+ expect(childText.trimEnd().split('\n').map((line): unknown => JSON.parse(line))).toEqual([
+ { ...childHeader, version: SESSION_FORMAT_VERSION, agentPreset: 'ptc' }, ...childRows,
+ ])
+ expect(await readFile(childPath)).toEqual(childSource)
+ expect(await readFile(brokenPath)).toEqual(brokenSource)
+ await expect(readFile(generationLogPath(scaffold.persistenceRoot, scaffold.workspaceCwd, brokenId, SESSION_FORMAT_VERSION, 'zstd')))
+ .rejects.toMatchObject({ code: 'ENOENT' })
+
+ await scaffold.ctx.sessions.flush(resolved.agent.session)
const publishedBytes = await readFile(successor)
const published = Buffer.concat(scanZstdFrames(publishedBytes).frames
.map(({ start, end }) => zstdDecompressSync(publishedBytes.subarray(start, end)))).toString('utf8')
@@ -58,12 +114,23 @@ describe.skipIf(webSnapshotMode() === 'record')('historical preset restoration t
&& (row['data'] as { agentPreset: string }).agentPreset === 'code'
? { ...row, data: { agentPreset: 'ptc' } }
: row),
+ { type: 'subagent/catalog', seq: rows.length, time: rows.at(-1)?.['time'], data: {
+ version: 1, childId: brokenId, childCreatedAt: childFixture[0]?.['createdAt'], mode: 'unknown',
+ } },
+ { type: 'subagent/catalog', seq: rows.length + 1, time: rows.at(-1)?.['time'], data: {
+ version: 0, childId, childCreatedAt: childFixture[0]?.['createdAt'], mode: 'one-shot', label: 'historical child',
+ } },
// Agent activation closes its restored prefix with a fresh seed marker.
- { type: 'session/end-seed', seq: rows.length, time: 0, data: {} },
+ { type: 'session/end-seed', seq: rows.length + 2, time: 0, data: {} },
+ { type: 'permission/preset', seq: rows.length + 3, time: 0, data: { preset: 'workspace-write' } },
+ { type: 'sandbox/mode', seq: rows.length + 4, time: 0, data: { mode: 'workspace-write' } },
+ { type: 'approval/policy', seq: rows.length + 5, time: 0, data: { policy: 'ask' } },
].map(row => JSON.stringify(row)).join('\n') + '\n'
const context = { sessionIds: [id], cwd: scaffold.workspaceCwd }
expect(normalizeSessionSnapshots([published], context)).toEqual(normalizeSessionSnapshots([expected], context))
expect(await readFile(predecessor)).toEqual(source)
+ await expect(scaffold.ctx.sessionPersistence.open(corruptHeaderId, 'read')).rejects.toThrow(/invalid frame magic/)
+ expect(await readFile(corruptHeaderPath)).toEqual(corruptHeaderSource)
expect((await readdir(dirname(predecessor))).filter(name => name.endsWith('.jsonl.zstd')).sort())
.toEqual(['session.v2.jsonl.zstd', `session.v${SESSION_FORMAT_VERSION}.jsonl.zstd`])
} finally {
diff --git a/apps/web/tests/settings-chrome.e2e.ts b/apps/web/tests/settings-chrome.e2e.ts
index d84614d33c..53ccc552d4 100644
--- a/apps/web/tests/settings-chrome.e2e.ts
+++ b/apps/web/tests/settings-chrome.e2e.ts
@@ -722,10 +722,31 @@ describe('web e2e: settings modal and General preferences', () => {
}
}, 90_000)
+ it('hides link-opening settings when the built-in browser is disabled', async () => {
+ const fresh = await launchWebScaffold({
+ developerTools: false,
+ extraOverlayPath: fileURLToPath(new URL('./no-sidebar-browser.overlay.yml', import.meta.url)),
+ })
+ onTestFinished(() => fresh.close())
+ const withoutBrowser = await browser.newPage({ viewport: { width: 1680, height: 1000 }, locale: 'en-US' })
+ onTestFinished(() => withoutBrowser.close())
+ const browserConsole = watchConsole(withoutBrowser)
+ await withoutBrowser.goto(fresh.authenticatedUrl, { waitUntil: 'load' })
+ await withoutBrowser.getByRole('button', { name: 'Settings', exact: true }).click()
+ const dialog = withoutBrowser.getByRole('dialog', { name: 'Settings' })
+ await dialog.getByRole('button', { name: 'Detailed', exact: true }).waitFor()
+ expect(await dialog.getByText('Open chat links in', { exact: true }).count()).toBe(0)
+ const snapshot = await captureStableAria(withoutBrowser, '[role="dialog"]', fresh.workspaceCwd)
+ await compareOrRefreshGolden(join(SNAPSHOT_DIR, 'dialog-no-browser.expected.md'), snapshot, MODE)
+ expect(browserConsole.pageErrors).toEqual([])
+ expect(browserConsole.warnings).toEqual([])
+ })
+
it.skipIf(MODE === 'record')('keeps the fixture inventory closed', async () => {
expect(tripwire.warnings).toEqual([])
await assertFixtureInventory(SNAPSHOT_DIR, [
'dialog-en.expected.md',
+ 'dialog-no-browser.expected.md',
'dialog.expected.md',
'plugin-instances.expected.md',
'plugins.expected.md',
diff --git a/apps/web/tests/sidebar-browser.e2e.ts b/apps/web/tests/sidebar-browser.e2e.ts
index 7a3334bb1b..ca26a11a4c 100644
--- a/apps/web/tests/sidebar-browser.e2e.ts
+++ b/apps/web/tests/sidebar-browser.e2e.ts
@@ -29,7 +29,11 @@ describe.skipIf(MODE === 'record')('web e2e: Sidebar Browser', () => {
let tripwire: ReturnType
beforeAll(async () => {
- scaffold = await launchWebScaffold({ replayFixture: FIXTURE, compareReplaySession: false })
+ scaffold = await launchWebScaffold({
+ replayFixture: FIXTURE,
+ compareReplaySession: false,
+ extraOverlayPath: fileURLToPath(new URL('./sidebar-browser.overlay.yml', import.meta.url)),
+ })
browser = await chromium.launch()
page = await newEnglishPage(browser)
await page.route('https://browser.test/**', async (route) => {
diff --git a/apps/web/tests/sidebar-browser.overlay.yml b/apps/web/tests/sidebar-browser.overlay.yml
new file mode 100644
index 0000000000..66012abfce
--- /dev/null
+++ b/apps/web/tests/sidebar-browser.overlay.yml
@@ -0,0 +1,3 @@
+# Opt in to Browser for its integration scenarios.
+- id: ui-sidebar-browser
+ disabled: false
diff --git a/apps/web/tests/sidebar-right.e2e.ts b/apps/web/tests/sidebar-right.e2e.ts
index 49be02de85..90571db3f4 100644
--- a/apps/web/tests/sidebar-right.e2e.ts
+++ b/apps/web/tests/sidebar-right.e2e.ts
@@ -409,7 +409,8 @@ describe('web e2e: shipped right Sidebar', () => {
}
await expect.poll(async () => await tabTitles(column)).toEqual(['Start'])
- await expect.poll(async () => await column.locator('[data-sidebar-right-guide-entry]').count()).toBe(3)
+ await expect.poll(async () => await column.locator('[data-sidebar-right-guide-entry]').count()).toBe(2)
+ expect(await column.locator('[data-sidebar-right-guide-entry="browser"]').count()).toBe(0)
await column.locator('[data-sidebar-right-guide-entry="files"]').click()
// A manual guide is closable beside Files and suppresses another add
diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts
index ddf3683c59..9984bf38de 100644
--- a/apps/web/vite.config.ts
+++ b/apps/web/vite.config.ts
@@ -10,7 +10,7 @@ import { productWebBundleIsolation } from './product-isolation.ts'
const src = (rel: string): string => fileURLToPath(new URL(rel, import.meta.url))
const STANDALONE_ERROR = 'apps/web is not a standalone application: bare Vite cannot inject window.__DSH_BOOT__. '
+ 'From a repository checkout, run `pnpm dsh web`; an installed package uses `dsh web`. '
- + 'For client-plugin HMR, run `pnpm dsh web` together with `pnpm run dev:web`.'
+ + 'For client-plugin HMR, run `pnpm run dev:web`, which starts `dsh web` and the rebuild watchers together.'
const DEFAULT_CLIENT_TITLE = 'DSH Local Build'
/** Escape build-time text before placing it in the HTML title element. */
diff --git a/docs/api-gateway.i18n.yaml b/docs/api-gateway.i18n.yaml
index fa62039df7..673807013b 100644
--- a/docs/api-gateway.i18n.yaml
+++ b/docs/api-gateway.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/api-gateway.md
-api-gateway.md: 2cf7b2f345991fd20639e1294662cc64fc02093d
-api-gateway.zh.md: 5b80db08de49591b27751e187aa6278384a7444e
+api-gateway.md: aa8339219a563901d5d132f4f401325ca30a3d53
+api-gateway.zh.md: 99b2d9866d38e520880e5d13115c2e6370fca474
diff --git a/docs/api-gateway.md b/docs/api-gateway.md
index 2cf7b2f345..aa8339219a 100644
--- a/docs/api-gateway.md
+++ b/docs/api-gateway.md
@@ -138,14 +138,13 @@ SRC solves only dispatch for a Host process running from source. The Client does
## Development mode
-Web development prepares current Host, Client, and Web artifacts with `pnpm run build`, then runs the source Host and the Client plugin watcher in separate terminals:
+Web development runs one command, which builds current Host, Client, and Web artifacts, starts the source Host, and keeps Client bundles rebuilt:
```sh
-pnpm dsh web
pnpm run dev:web
```
-`dsh` starts the Host source through tsx, so the Host can use the SRC fallback; `dev:web` watches only Client plugins with a `dsh.client` declaration and rewrites their `lib/client.js`. It does not analyze Host decorators or generate Remote Client DTS.
+`dsh` starts the Host source through tsx, so the Host can use the SRC fallback; the `dev:web` watchers rebuild the client-face type emit, Client plugin and library bundles, and the Web shell on source edits. They do not analyze Host decorators or generate Remote Client DTS; only the complete build that `dev:web` runs first (or `pnpm run build`) does.
Changing only a Remote method's implementation body without changing its contract does not require regenerating the Typert files. After adding or removing a decorator or changing an export name, namespace, parameter, return value, lookup, Context, or cancellation signature, rerun the ordered lib build so the Host generates the strict contract before the Client compiles and bundles the new contribution:
diff --git a/docs/api-gateway.zh.md b/docs/api-gateway.zh.md
index 5b80db08de..99b2d9866d 100644
--- a/docs/api-gateway.zh.md
+++ b/docs/api-gateway.zh.md
@@ -138,14 +138,13 @@ SRC 只解决 Host 源码进程的分发问题。Client 不会从运行中的 Ho
## 开发模式
-Web 开发先使用 `pnpm run build` 准备当前 Host、Client 与 Web 产物,然后在两个终端中分别运行源码 Host 和 Client plugin watcher:
+Web 开发只需一条命令:它先构建当前 Host、Client 与 Web 产物,再启动源码 Host,并持续重建 Client bundle:
```sh
-pnpm dsh web
pnpm run dev:web
```
-`dsh` 通过 tsx 启动 Host 源码,所以 Host 可以使用 SRC 回退;`dev:web` 只监听带 `dsh.client` 声明的 Client 插件并重写其 `lib/client.js`,它不会分析 Host decorator,也不会生成 Remote Client DTS。
+`dsh` 通过 tsx 启动 Host 源码,所以 Host 可以使用 SRC 回退;`dev:web` 的 watcher 会在源码修改时重建 client 侧类型输出、Client 插件与库 bundle 以及 Web 壳层。它们不会分析 Host decorator,也不会生成 Remote Client DTS;只有 `dev:web` 首先执行的完整构建(或 `pnpm run build`)才会。
只修改 Remote 方法实现体而不改变约定时,无需重新生成 Typert 文件。新增或删除 decorator、修改导出名、namespace、参数、返回值、lookup、Context 或取消签名时,重新执行有序 lib 构建,让 Host 先生成严格约定,再让 Client 编译并打包新的贡献:
diff --git a/docs/architecture.i18n.yaml b/docs/architecture.i18n.yaml
index 3d9fba9385..66b457c8fa 100644
--- a/docs/architecture.i18n.yaml
+++ b/docs/architecture.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/architecture.md
-architecture.md: 0bbf5ef7f4c0444635178ba0ba85fbb9527d76ec
-architecture.zh.md: 0d28dc349fd9c655529bcc43deabc47055e0d394
+architecture.md: 5e0bb09770e013349bcc1326bea1eab9cdc3e595
+architecture.zh.md: a146c93c14ef0f563babf98f7311f1e5686895cc
diff --git a/docs/architecture.md b/docs/architecture.md
index 0bbf5ef7f4..5e0bb09770 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -44,7 +44,7 @@ Composition mechanics are in [app-boot](../packages/boot/app-boot/README.md#prof
Supported Node applications launch through named `dsh` profiles. The shipped profiles are `web`, `headless`, `sdk`, `sdk-minimal`, and `acp`, selected with `dsh --profile ` or `dsh `. `plugin` names the management command; a profile with that name requires `--profile plugin`. The TypeScript SDK resolves its same-version `dsh` dependency and selects `sdk`; custom plugin composition remains a profile plus ordered patch files, not another executable or inline application tree. `sdk-minimal` is a repository-owned standalone bundle behind the same launcher, not a caller-supplied Cordis tree.
-Vendored CLIs, build-only and test-only executables, direct in-process plugin mounting, and the private browser WebWorker preview are not Harness application launchers. [`verify-application-entrypoints`](../scripts/verify-application-entrypoints.ts) keeps every package bin, executable source, and root demo in an explicit class and rejects a Node application path that bypasses `dsh`.
+Vendored CLIs, build-only and test-only executables, direct in-process plugin mounting, and the private browser WebWorker preview are not Harness application launchers. [`verify-application-entrypoints`](../scripts/verify-application-entrypoints.ts) keeps every package bin, executable source, root demo, and the root `start:web` and `dev:web` scripts in an explicit class and rejects a Node application path that bypasses `dsh`.
The Python SDK follows the same application architecture. Its runtime wheel packages the normal `dsh` CLI as `deepseek-harness-sdk-runtime--`, and the client launches `dsh --profile sdk` with an explicit Harness home by default. The minimal example selects the shipped `sdk-minimal` profile. Python exposes profile selection and ordered patch files rather than a complete Cordis tree; persistent external plugins are installed through `dsh plugin`. The removed private direct-config carrier has no compatibility bin or fallback parser.
diff --git a/docs/architecture.zh.md b/docs/architecture.zh.md
index 0d28dc349f..a146c93c14 100644
--- a/docs/architecture.zh.md
+++ b/docs/architecture.zh.md
@@ -44,7 +44,7 @@ dsh --profile web --dump-config
受支持的 Node 应用通过具名 `dsh` profile 启动。随附 profile 为 `web`、`headless`、`sdk`、`sdk-minimal` 和 `acp`,可通过 `dsh --profile ` 或 `dsh ` 选择。`plugin` 表示管理命令;同名 profile 必须用 `--profile plugin` 选择。TypeScript SDK 会解析其同版本 `dsh` 依赖并选择 `sdk`;自定义插件组合继续由 profile 与有序 patch 文件表达,而不是另一个可执行文件或内联应用树。`sdk-minimal` 是位于同一 launcher 后的仓库自有独立组合包,而不是由调用方提供的 Cordis 配置树。
-Vendored CLI、仅用于构建和测试的可执行文件、进程内直接挂载插件以及私有浏览器 WebWorker 预览都不属于 Harness 应用启动器。[`verify-application-entrypoints`](../scripts/verify-application-entrypoints.ts)将每个包 bin、可执行源码与根 demo 归入显式类别,并拒绝任何绕过 `dsh` 的 Node 应用路径。
+Vendored CLI、仅用于构建和测试的可执行文件、进程内直接挂载插件以及私有浏览器 WebWorker 预览都不属于 Harness 应用启动器。[`verify-application-entrypoints`](../scripts/verify-application-entrypoints.ts)将每个包 bin、可执行源码、根 demo 以及根脚本 `start:web` 与 `dev:web` 归入显式类别,并拒绝任何绕过 `dsh` 的 Node 应用路径。
Python SDK 遵循相同的应用架构。其运行时 wheel 把普通 `dsh` CLI 打包为 `deepseek-harness-sdk-runtime--`,客户端默认以显式 Harness home 启动 `dsh --profile sdk`。极简示例选择随附的 `sdk-minimal` profile。Python 暴露 profile 选择与有序 patch 文件,而不是完整 Cordis 树;持久外部插件通过 `dsh plugin` 安装。已删除的私有直读配置载体没有兼容 bin 或回退 parser。
diff --git a/docs/cookbook/adding-a-package.i18n.yaml b/docs/cookbook/adding-a-package.i18n.yaml
index b2b0467564..8c94de4306 100644
--- a/docs/cookbook/adding-a-package.i18n.yaml
+++ b/docs/cookbook/adding-a-package.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/cookbook/adding-a-package.md
-adding-a-package.md: 8c818bc371b4fcd646878ec440dd713f8c116083
-adding-a-package.zh.md: f6a09b411e246c50fcf3f44117c05433b12cbd4c
+adding-a-package.md: 60b5d6e047da5f9cdfab3ab504104a0f29b208f7
+adding-a-package.zh.md: 44a613bcf002009c4c58a34c0f68cab85ef097f3
diff --git a/docs/cookbook/adding-a-package.md b/docs/cookbook/adding-a-package.md
index 8c818bc371..60b5d6e047 100644
--- a/docs/cookbook/adding-a-package.md
+++ b/docs/cookbook/adding-a-package.md
@@ -143,7 +143,9 @@ Fields fall back independently before view-specific name formatting, using the e
- Title: locale `meta.title` → `package.json.name` → complete Cordis plugin name.
- Description: locale `meta.description` → `package.json.description` → no description.
-Export `/locale/en.json` for locale lookup; expose `/package.json` when package-field fallback is needed.
+Export `/locale/en.json` for locale lookup; expose `/package.json` for package-field fallback or an icon declaration.
+
+For an image on bundle cards, details, and component rows, set top-level `"icon": "./icon.svg"` in that exported manifest and include the image in `files`. The path is relative to the declaring manifest's directory, including for independently exported plugin manifests. SVG, PNG, JPEG (`.jpg`/`.jpeg`), and WebP files are supported up to 256 KiB. Absolute paths, URLs, paths outside that directory, and symlinks resolving outside it are rejected. Images need no separate export and must be self-contained; SVG is rendered as an image, not inline HTML. The Host returns a data URL without activating the plugin. Invalid declarations or unreadable files produce a metadata diagnostic while retaining valid text; missing or undecodable images use the panel's default artwork.
Installed bundle cards and details, component lists and configuration details, and Settings' plugin inventory display this metadata, including disabled and preset plugins. Reads do not activate plugins.
diff --git a/docs/cookbook/adding-a-package.zh.md b/docs/cookbook/adding-a-package.zh.md
index f6a09b411e..44a613bcf0 100644
--- a/docs/cookbook/adding-a-package.zh.md
+++ b/docs/cookbook/adding-a-package.zh.md
@@ -143,7 +143,9 @@ Append-only, prefix-stable, replacing, or independent behavior, including the ex
- 标题:locale `meta.title` → `package.json.name` → 完整 Cordis 插件名。
- 描述:locale `meta.description` → `package.json.description` → 不显示描述。
-导出 `<包名>/locale/en.json` 供 locale 查询;需要包字段回退时,再开放 `<包名>/package.json`。
+导出 `<包名>/locale/en.json` 供 locale 查询;需要包字段回退或声明图标时,开放 `<包名>/package.json`。
+
+要在组合包卡片、详情和组件行显示图片,在该导出清单顶层设置 `"icon": "./icon.svg"`,并将图片加入 `files`。路径相对于声明清单所在目录,独立导出的插件清单也遵循此规则。支持不超过 256 KiB 的 SVG、PNG、JPEG(`.jpg`/`.jpeg`)和 WebP 文件。绝对路径、URL、目录外路径,以及解析到目录外的符号链接均被拒绝。图片不需要单独导出,且必须自包含;SVG 作为图片渲染,不作为内联 HTML。Host 返回 data URL,不激活插件。声明无效或文件不可读时,显示元信息诊断并保留有效文本;图片缺失或无法解码时使用面板的默认插画。
已安装 bundle 的卡片和详情、组件列表与配置详情、设置中的插件清单都展示这些元信息,包括禁用插件和预设内插件。读取时不激活插件。
diff --git a/docs/development.i18n.yaml b/docs/development.i18n.yaml
index 8959b05a1d..fd6198a8ca 100644
--- a/docs/development.i18n.yaml
+++ b/docs/development.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/development.md
-development.md: ce8f1e7746562e696c96e6359ec9fcfde596d6e2
-development.zh.md: 85e95946dfd7210201f0807880d5ed1a92859356
+development.md: 7e8d0ded70ca880ce986cb3879d959fbe2a04304
+development.zh.md: 84d0d76d8c76f829c0ed928d28336df3e58ed7f0
diff --git a/docs/development.md b/docs/development.md
index ce8f1e7746..7e8d0ded70 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -83,7 +83,7 @@ Both tsdown passes use the same complete workspace match. They neither scan buil
Typert runs only during Host tsdown, seeded by `tsconfig.host.json`. It analyzes Host types and generates both Host reflection artifacts and the Host-for-Client Remote projection; Client tsdown does not start Typert. Consequently, `pnpm run typecheck` runs the complete Host lib phase before Client tsc, while `pnpm run build` continues through Client tsdown and the Web build.
-`pnpm run build` embeds the root package version, the seven-character source commit, and a dirty marker when Git reports local changes; it also inherits other caller-supplied `DSH_CLIENT_*` values. `pnpm run build:official` is the cross-platform local equivalent of the CI and release artifact build and omits the local dirty marker. Each successful complete build writes a gitignored record that binds the exact public values to the Vite output and dynamic client bundles; release packing and built Web tests reject a missing record or artifacts changed by a later partial build. `pnpm run dev:web` still requires the artifact tree from a prior complete build, but it samples the current version and Git state once at startup and shares that environment across every watcher stage for the session; it does not validate the complete-build record because the watcher stages rewrite its recorded artifacts.
+`pnpm run build` embeds the root package version, the seven-character source commit, and a dirty marker when Git reports local changes; it also inherits other caller-supplied `DSH_CLIENT_*` values. `pnpm run build:official` is the cross-platform local equivalent of the CI and release artifact build and omits the local dirty marker. Each successful complete build writes a gitignored record that binds the exact public values to the Vite output and dynamic client bundles; release packing and built Web tests reject a missing record or artifacts changed by a later partial build. `pnpm run dev:web` runs that complete build first (`--skip-build` reuses an existing artifact tree instead), then samples the current version and Git state once and shares that environment across every watcher stage for the session; it does not validate the complete-build record because the watcher stages rewrite its recorded artifacts.
Static analysis and tests resolve workspace imports through the base `paths` map to `src` and must pass on a clean tree; gates that consume built `lib/` output declare that dependency explicitly. Generated Host-for-Client Remote declarations are the deliberate exception: the public `typecheck`, `lint`, and `doc-typecheck` commands generate them first, while internal `*:contracts-ready` scripts assume that an invoking public command or scheduler gate already depends on the Typert contract-generation pass or the complete build. See the [ts-build-config note](../.agents/notes/implemented/process/2026-06-17-ts-build-config.md) for tsc-first emit ownership and the [Typert Remote note](../.agents/notes/implemented/architecture/2026-08-02-typert-remote-method-calls.md) for the gate-preparation contract.
@@ -156,6 +156,19 @@ The PTC mode demo runs the same headless profile with code presentation enabled:
pnpm run demo:ptc -- "summarize this workspace"
```
+### Application commands
+
+Web and Desktop share one command pair. `start:*` launches the artifacts of a prior `pnpm run build`; `dev:*` runs that build first and then launches. Web additionally keeps client bundles rebuilt on source edits, because its Host runs from source while the browser loads built bundles:
+
+```sh
+pnpm run start:web # serve built Web artifacts through the source launcher (the same launch as pnpm dsh web)
+pnpm run dev:web # build, serve, and rebuild Web client bundles on source edits
+pnpm run start:desktop # launch built Desktop artifacts
+pnpm run dev:desktop # build, then launch Desktop
+```
+
+Arguments after a Web command reach `dsh web`, for example `pnpm run dev:web --no-open --port 3081`; `dev:web` also accepts `--skip-build` to reuse the existing artifact tree and `--no-serve` to run only the rebuild watchers beside a server started elsewhere. Both Web commands use the normal Harness home, while the Desktop commands use the isolated development home described in the [Desktop README](../apps/desktop/README.md). The root `Makefile` names the same commands as `make web`, `make dev-web`, `make desktop`, `make dev-desktop`, and `make build`; `ARGS='--no-open'` forwards options.
+
### TODO markers
Use one of three comment tags to flag known issues in the code, ordered by urgency:
diff --git a/docs/development.zh.md b/docs/development.zh.md
index 85e95946df..84d0d76d8c 100644
--- a/docs/development.zh.md
+++ b/docs/development.zh.md
@@ -87,7 +87,7 @@ pnpm run build:web
Typert 只在 Host tsdown 中以 `tsconfig.host.json` 为种子运行。它分析 Host 类型并生成 Host 反射产物及 Host-for-Client Remote 投影;Client tsdown 不启动 Typert。`pnpm run typecheck` 因此先执行完整 Host lib 阶段,再运行 Client tsc;`pnpm run build` 继续执行 Client tsdown 和 Web 构建。
-`pnpm run build` 会内联根包版本、七位源码 commit,并在 Git 报告本地变化时内联 dirty 标记;调用方提供的其他 `DSH_CLIENT_*` 值也会被继承。`pnpm run build:official` 是与 CI 和 release 产物构建等价的跨平台本地命令,并省略本地 dirty 标记。每次完整构建成功后都会写入一份被 gitignore 的记录,把精确公开值与 Vite 输出及动态 client bundle 绑定;release 打包和 built Web 测试会拒绝缺少记录或被后续局部构建改动的产物。`pnpm run dev:web` 仍需要先执行完整构建来准备产物树,但会在启动时读取一次当前版本和 Git 状态,并在本次会话的所有 watcher stage 之间共享该环境;它不会校验完整构建记录,因为 watcher stage 会重写记录覆盖的产物。
+`pnpm run build` 会内联根包版本、七位源码 commit,并在 Git 报告本地变化时内联 dirty 标记;调用方提供的其他 `DSH_CLIENT_*` 值也会被继承。`pnpm run build:official` 是与 CI 和 release 产物构建等价的跨平台本地命令,并省略本地 dirty 标记。每次完整构建成功后都会写入一份被 gitignore 的记录,把精确公开值与 Vite 输出及动态 client bundle 绑定;release 打包和 built Web 测试会拒绝缺少记录或被后续局部构建改动的产物。`pnpm run dev:web` 会先执行这次完整构建(`--skip-build` 则复用现有产物树),再读取一次当前版本和 Git 状态,并在本次会话的所有 watcher stage 之间共享该环境;它不会校验完整构建记录,因为 watcher stage 会重写记录覆盖的产物。
静态分析和测试通过 base 的 `paths` 映射把工作区 import 解析到 `src`,且必须在干净树上通过;消费构建产物 `lib/` 的门禁显式声明该依赖。生成的 Host-for-Client Remote 声明是有意设置的例外:公共 `typecheck`、`lint` 和 `doc-typecheck` 命令会先生成这些声明,而内部 `*:contracts-ready` 脚本假定调用它的公共命令或调度器门禁已经依赖 Typert 约定生成阶段或完整构建。tsc-first 发射职责见 [ts-build-config Note](../.agents/notes/implemented/process/2026-06-17-ts-build-config.zh.md),门禁准备约定见 [Typert Remote Agent Note](../.agents/notes/implemented/architecture/2026-08-02-typert-remote-method-calls.zh.md)。
@@ -160,6 +160,19 @@ PTC mode 演示启用代码式工具展示,并运行同一个 headless profile
pnpm run demo:ptc -- "summarize this workspace"
```
+### 应用命令
+
+Web 与 Desktop 共用同一对命令。`start:*` 启动上一次 `pnpm run build` 的产物;`dev:*` 先执行该构建再启动。Web 还会在源码修改时持续重建 client bundle,因为它的 Host 从源码运行,而浏览器加载的是构建产物:
+
+```sh
+pnpm run start:web # serve built Web artifacts through the source launcher (the same launch as pnpm dsh web)
+pnpm run dev:web # build, serve, and rebuild Web client bundles on source edits
+pnpm run start:desktop # launch built Desktop artifacts
+pnpm run dev:desktop # build, then launch Desktop
+```
+
+Web 命令后面的参数会传给 `dsh web`,例如 `pnpm run dev:web --no-open --port 3081`;`dev:web` 还接受 `--skip-build` 复用现有产物树,以及 `--no-serve` 只运行重建 watcher、配合别处启动的服务器。两个 Web 命令使用正常的 Harness home,而 Desktop 命令使用 [Desktop README](../apps/desktop/README.zh.md) 描述的隔离开发 home。根目录 `Makefile` 以 `make web`、`make dev-web`、`make desktop`、`make dev-desktop` 和 `make build` 命名同一套命令;`ARGS='--no-open'` 用于转发参数。
+
### TODO 标记
请使用以下三种注释标签之一标记代码中的已知问题,按紧急程度排序:
diff --git a/docs/persistence-catalog.i18n.yaml b/docs/persistence-catalog.i18n.yaml
index 251a673f01..5f847038ca 100644
--- a/docs/persistence-catalog.i18n.yaml
+++ b/docs/persistence-catalog.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/persistence-catalog.md
-persistence-catalog.md: 4e62b69e07daf5809d6070bcc182b71305e70151
-persistence-catalog.zh.md: c001f06e98ac3b7e331044510639b73ec640eb85
+persistence-catalog.md: 11cea4328db6e69c1ee08994a6d36fe26e308a7c
+persistence-catalog.zh.md: 6207dc17023e566f73cb1e0c7cba40533a4a96ff
diff --git a/docs/persistence-catalog.md b/docs/persistence-catalog.md
index 4e62b69e07..11cea4328d 100644
--- a/docs/persistence-catalog.md
+++ b/docs/persistence-catalog.md
@@ -57,7 +57,7 @@ The [format references](persistence-changes/historical-formats/README.md) cover
| `event:session/title-llm-request` | event | `fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d` | [`{ type: "session/title-llm-request" }`](#persistence-type-sha256-fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d) |
| `event:step/end` | event | `e0a787e6ec76c7c94fecbc501b489164ab0293db05bc947914077ad01e674f05` | [`{ type: "step/end" }`](#persistence-type-sha256-e0a787e6ec76c7c94fecbc501b489164ab0293db05bc947914077ad01e674f05) |
| `event:step/start` | event | `4513e088d43e6c68425be30451b9f961cc264fe7318ca62681c41d4d78615986` | [`{ type: "step/start" }`](#persistence-type-sha256-4513e088d43e6c68425be30451b9f961cc264fe7318ca62681c41d4d78615986) |
-| `event:subagent/catalog` | event | `ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871` | [`{ type: "subagent/catalog" }`](#persistence-type-sha256-ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871) |
+| `event:subagent/catalog` | event | `3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604` | [`{ type: "subagent/catalog" }`](#persistence-type-sha256-3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604) |
| `event:subagent/descriptor` | event | `b79ada42962cad0190a9d465805260567621fa3a4abd757eb31e6016b52d5ab5` | [`{ type: "subagent/descriptor" }`](#persistence-type-sha256-b79ada42962cad0190a9d465805260567621fa3a4abd757eb31e6016b52d5ab5) |
| `event:subagent/model-selection-policy` | event | `a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc` | [`{ type: "subagent/model-selection-policy" }`](#persistence-type-sha256-a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc) |
| `event:system/message` | event | `69081694be231d56fd9580ba14645fd5e35373202605d5c5c841a9435b5fa3b1` | [`{ type: "system/message" }`](#persistence-type-sha256-69081694be231d56fd9580ba14645fd5e35373202605d5c5c841a9435b5fa3b1) |
@@ -894,13 +894,13 @@ Source: [`packages/core/session/src/types.ts:299`](../packages/core/session/src/
```ts persistence-catalog
/**
- * A direct child's complete discovery fact.
+ * A direct child's identity and available discovery fields.
* @param data - versioned parent-owned catalog entry.
*/
'subagent/catalog': SubagentCatalogEvent
```
-Source: [`packages/subagent/subagent/src/catalog.ts:40`](../packages/subagent/subagent/src/catalog.ts)
+Source: [`packages/subagent/subagent/src/catalog.ts:43`](../packages/subagent/subagent/src/catalog.ts)
@@ -2787,6 +2787,14 @@ SHA-256: `2c4c21f19f426a58f2dac914e34313aa43f8408972de857a486d1f086d5adb6c`
`"unavailable"`
+
+
+### `"unknown"`
+
+SHA-256: `05a2796621b1ee6c03ef7abe560b25116bb4da4d592312117242a78415a32b04`
+
+`"unknown"`
+
### `"usage"`
@@ -4547,7 +4555,7 @@ One of:
- [`{ type: "finish" }`](#persistence-type-sha256-a2b49331716ba0a7078b026d145306a70eae64b7313c3e6204bd931e75ec3bb1)
- [`{ type: "usage" }`](#persistence-type-sha256-f1a96afe7503ac1817de769cd0ba13d9b80111c7034c50106b3344ecc14cc515)
-
+
@@ -4555,14 +4563,17 @@ One of:
### `SubagentCatalogEvent`
-SHA-256: `3ac1196f59d5e9e0e9345122c8c403b102478b526404a2e591a38f613483321e`
+SHA-256: `1de64ea9a0849ce631b7e4e1255ae773fabd94a4a7c8d27e716f8012302e12c0`
-Sources: [`packages/subagent/subagent/src/catalog.ts:24`](../packages/subagent/subagent/src/catalog.ts)
+Sources: [`packages/subagent/subagent/src/catalog.ts:28`](../packages/subagent/subagent/src/catalog.ts)
One of:
- [`{ childCreatedAt, childId, label, mode, … }`](#persistence-type-sha256-0e10d7c096b47e61defe372a5fc8bd37d835199410eac44367f95c45082498bd)
+- [`{ childCreatedAt, childId, label, mode, … }`](#persistence-type-sha256-e2ad8f5bcd813f268ffef1b10a12d7ddd2b8ced8b9b6d0275b3f6b7ed094a187)
- [`{ childCreatedAt, childId, label?, mode, … }`](#persistence-type-sha256-5d542ac7bdf13310c46e1a884dec9fb18ad8c6e153cff207e639cd7bf9d7e694)
+- [`{ childCreatedAt, childId, label?, mode, … }`](#persistence-type-sha256-b6896938660a1dfe4ddd100fb3164d9f8fa57feeabfe37441a80106c9942697a)
+- [`{ childCreatedAt, childId, label?, mode, … }`](#persistence-type-sha256-a0f25b5aeeebf2bf1542ce67726b095e3b139a39c71861d57e827f12dea1f499)
@@ -5612,6 +5623,20 @@ SHA-256: `0e10d7c096b47e61defe372a5fc8bd37d835199410eac44367f95c45082498bd`
| `mode` | required | `"continuable"` |
| `version` | required | `0` |
+
+
+### `{ childCreatedAt, childId, label, mode, … }`
+
+SHA-256: `e2ad8f5bcd813f268ffef1b10a12d7ddd2b8ced8b9b6d0275b3f6b7ed094a187`
+
+| Property | Presence | Type |
+|---|---|---|
+| `childCreatedAt` | required | `number` |
+| `childId` | required | `string` |
+| `label` | required | `string` |
+| `mode` | required | `"continuable"` |
+| `version` | required | `1` |
+
### `{ childCreatedAt, childId, label?, mode, … }`
@@ -5626,6 +5651,34 @@ SHA-256: `5d542ac7bdf13310c46e1a884dec9fb18ad8c6e153cff207e639cd7bf9d7e694`
| `mode` | required | `"one-shot"` |
| `version` | required | `0` |
+
+
+### `{ childCreatedAt, childId, label?, mode, … }`
+
+SHA-256: `a0f25b5aeeebf2bf1542ce67726b095e3b139a39c71861d57e827f12dea1f499`
+
+| Property | Presence | Type |
+|---|---|---|
+| `childCreatedAt` | required | `number` |
+| `childId` | required | `string` |
+| `label` | optional | `string` |
+| `mode` | required | `"unknown"` |
+| `version` | required | `1` |
+
+
+
+### `{ childCreatedAt, childId, label?, mode, … }`
+
+SHA-256: `b6896938660a1dfe4ddd100fb3164d9f8fa57feeabfe37441a80106c9942697a`
+
+| Property | Presence | Type |
+|---|---|---|
+| `childCreatedAt` | required | `number` |
+| `childId` | required | `string` |
+| `label` | optional | `string` |
+| `mode` | required | `"one-shot"` |
+| `version` | required | `1` |
+
### `{ code, name, reason? }`
@@ -8221,17 +8274,17 @@ SHA-256: `4513e088d43e6c68425be30451b9f961cc264fe7318ca62681c41d4d78615986`
| `time` | required | `number` |
| `type` | required | `"step/start"` |
-
+
### `{ type: "subagent/catalog" }`
-SHA-256: `ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871`
+SHA-256: `3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604`
| Property | Presence | Type |
|---|---|---|
-| `data` | required | [`SubagentCatalogEvent`](#persistence-type-sha256-3ac1196f59d5e9e0e9345122c8c403b102478b526404a2e591a38f613483321e) |
+| `data` | required | [`SubagentCatalogEvent`](#persistence-type-sha256-1de64ea9a0849ce631b7e4e1255ae773fabd94a4a7c8d27e716f8012302e12c0) |
| `ignorable` | optional | `true` |
| `seq` | required | `number` |
| `time` | required | `number` |
diff --git a/docs/persistence-catalog.zh.md b/docs/persistence-catalog.zh.md
index c001f06e98..6207dc1702 100644
--- a/docs/persistence-catalog.zh.md
+++ b/docs/persistence-catalog.zh.md
@@ -59,7 +59,7 @@
| `event:session/title-llm-request` | event | `fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d` | [`{ type: "session/title-llm-request" }`](#persistence-type-sha256-fa8f7d3ebf08a76c7f7a8b0781873c4d819b964da5dbb52cd3cdfa5da34f452d) |
| `event:step/end` | event | `e0a787e6ec76c7c94fecbc501b489164ab0293db05bc947914077ad01e674f05` | [`{ type: "step/end" }`](#persistence-type-sha256-e0a787e6ec76c7c94fecbc501b489164ab0293db05bc947914077ad01e674f05) |
| `event:step/start` | event | `4513e088d43e6c68425be30451b9f961cc264fe7318ca62681c41d4d78615986` | [`{ type: "step/start" }`](#persistence-type-sha256-4513e088d43e6c68425be30451b9f961cc264fe7318ca62681c41d4d78615986) |
-| `event:subagent/catalog` | event | `ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871` | [`{ type: "subagent/catalog" }`](#persistence-type-sha256-ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871) |
+| `event:subagent/catalog` | event | `3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604` | [`{ type: "subagent/catalog" }`](#persistence-type-sha256-3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604) |
| `event:subagent/descriptor` | event | `b79ada42962cad0190a9d465805260567621fa3a4abd757eb31e6016b52d5ab5` | [`{ type: "subagent/descriptor" }`](#persistence-type-sha256-b79ada42962cad0190a9d465805260567621fa3a4abd757eb31e6016b52d5ab5) |
| `event:subagent/model-selection-policy` | event | `a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc` | [`{ type: "subagent/model-selection-policy" }`](#persistence-type-sha256-a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc) |
| `event:system/message` | event | `69081694be231d56fd9580ba14645fd5e35373202605d5c5c841a9435b5fa3b1` | [`{ type: "system/message" }`](#persistence-type-sha256-69081694be231d56fd9580ba14645fd5e35373202605d5c5c841a9435b5fa3b1) |
@@ -896,13 +896,13 @@ export type SessionEvent = {
```ts persistence-catalog
/**
- * A direct child's complete discovery fact.
+ * A direct child's identity and available discovery fields.
* @param data - versioned parent-owned catalog entry.
*/
'subagent/catalog': SubagentCatalogEvent
```
-来源:[`packages/subagent/subagent/src/catalog.ts:40`](../packages/subagent/subagent/src/catalog.ts)
+来源:[`packages/subagent/subagent/src/catalog.ts:43`](../packages/subagent/subagent/src/catalog.ts)
@@ -2789,6 +2789,14 @@ SHA-256: `2c4c21f19f426a58f2dac914e34313aa43f8408972de857a486d1f086d5adb6c`
`"unavailable"`
+
+
+### `"unknown"`
+
+SHA-256: `05a2796621b1ee6c03ef7abe560b25116bb4da4d592312117242a78415a32b04`
+
+`"unknown"`
+
### `"usage"`
@@ -4549,7 +4557,7 @@ SHA-256: `47e9095591ae36e7c39ee62553097772f2bfa16304536a72dbbc3f691f605180`
- [`{ type: "finish" }`](#persistence-type-sha256-a2b49331716ba0a7078b026d145306a70eae64b7313c3e6204bd931e75ec3bb1)
- [`{ type: "usage" }`](#persistence-type-sha256-f1a96afe7503ac1817de769cd0ba13d9b80111c7034c50106b3344ecc14cc515)
-
+
@@ -4557,14 +4565,17 @@ SHA-256: `47e9095591ae36e7c39ee62553097772f2bfa16304536a72dbbc3f691f605180`
### `SubagentCatalogEvent`
-SHA-256: `3ac1196f59d5e9e0e9345122c8c403b102478b526404a2e591a38f613483321e`
+SHA-256: `1de64ea9a0849ce631b7e4e1255ae773fabd94a4a7c8d27e716f8012302e12c0`
-来源:[`packages/subagent/subagent/src/catalog.ts:24`](../packages/subagent/subagent/src/catalog.ts)
+来源:[`packages/subagent/subagent/src/catalog.ts:28`](../packages/subagent/subagent/src/catalog.ts)
以下类型之一:
- [`{ childCreatedAt, childId, label, mode, … }`](#persistence-type-sha256-0e10d7c096b47e61defe372a5fc8bd37d835199410eac44367f95c45082498bd)
+- [`{ childCreatedAt, childId, label, mode, … }`](#persistence-type-sha256-e2ad8f5bcd813f268ffef1b10a12d7ddd2b8ced8b9b6d0275b3f6b7ed094a187)
- [`{ childCreatedAt, childId, label?, mode, … }`](#persistence-type-sha256-5d542ac7bdf13310c46e1a884dec9fb18ad8c6e153cff207e639cd7bf9d7e694)
+- [`{ childCreatedAt, childId, label?, mode, … }`](#persistence-type-sha256-b6896938660a1dfe4ddd100fb3164d9f8fa57feeabfe37441a80106c9942697a)
+- [`{ childCreatedAt, childId, label?, mode, … }`](#persistence-type-sha256-a0f25b5aeeebf2bf1542ce67726b095e3b139a39c71861d57e827f12dea1f499)
@@ -5614,6 +5625,20 @@ SHA-256: `0e10d7c096b47e61defe372a5fc8bd37d835199410eac44367f95c45082498bd`
| `mode` | 必需 | `"continuable"` |
| `version` | 必需 | `0` |
+
+
+### `{ childCreatedAt, childId, label, mode, … }`
+
+SHA-256: `e2ad8f5bcd813f268ffef1b10a12d7ddd2b8ced8b9b6d0275b3f6b7ed094a187`
+
+| 属性 | 存在性 | 类型 |
+|---|---|---|
+| `childCreatedAt` | 必需 | `number` |
+| `childId` | 必需 | `string` |
+| `label` | 必需 | `string` |
+| `mode` | 必需 | `"continuable"` |
+| `version` | 必需 | `1` |
+
### `{ childCreatedAt, childId, label?, mode, … }`
@@ -5628,6 +5653,34 @@ SHA-256: `5d542ac7bdf13310c46e1a884dec9fb18ad8c6e153cff207e639cd7bf9d7e694`
| `mode` | 必需 | `"one-shot"` |
| `version` | 必需 | `0` |
+
+
+### `{ childCreatedAt, childId, label?, mode, … }`
+
+SHA-256: `a0f25b5aeeebf2bf1542ce67726b095e3b139a39c71861d57e827f12dea1f499`
+
+| 属性 | 存在性 | 类型 |
+|---|---|---|
+| `childCreatedAt` | 必需 | `number` |
+| `childId` | 必需 | `string` |
+| `label` | 可选 | `string` |
+| `mode` | 必需 | `"unknown"` |
+| `version` | 必需 | `1` |
+
+
+
+### `{ childCreatedAt, childId, label?, mode, … }`
+
+SHA-256: `b6896938660a1dfe4ddd100fb3164d9f8fa57feeabfe37441a80106c9942697a`
+
+| 属性 | 存在性 | 类型 |
+|---|---|---|
+| `childCreatedAt` | 必需 | `number` |
+| `childId` | 必需 | `string` |
+| `label` | 可选 | `string` |
+| `mode` | 必需 | `"one-shot"` |
+| `version` | 必需 | `1` |
+
### `{ code, name, reason? }`
@@ -8223,17 +8276,17 @@ SHA-256: `4513e088d43e6c68425be30451b9f961cc264fe7318ca62681c41d4d78615986`
| `time` | 必需 | `number` |
| `type` | 必需 | `"step/start"` |
-
+
### `{ type: "subagent/catalog" }`
-SHA-256: `ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871`
+SHA-256: `3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604`
| 属性 | 存在性 | 类型 |
|---|---|---|
-| `data` | 必需 | [`SubagentCatalogEvent`](#persistence-type-sha256-3ac1196f59d5e9e0e9345122c8c403b102478b526404a2e591a38f613483321e) |
+| `data` | 必需 | [`SubagentCatalogEvent`](#persistence-type-sha256-1de64ea9a0849ce631b7e4e1255ae773fabd94a4a7c8d27e716f8012302e12c0) |
| `ignorable` | 可选 | `true` |
| `seq` | 必需 | `number` |
| `time` | 必需 | `number` |
diff --git a/docs/persistence-changes/2026-09-20-unknown-child-catalog.i18n.yaml b/docs/persistence-changes/2026-09-20-unknown-child-catalog.i18n.yaml
new file mode 100644
index 0000000000..60ad1d8f73
--- /dev/null
+++ b/docs/persistence-changes/2026-09-20-unknown-child-catalog.i18n.yaml
@@ -0,0 +1,6 @@
+# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
+# side as of the last confirmed-consistent state. Both languages carry equal authority;
+# after editing either side, bring the other along and re-record with:
+# pnpm run verify-translation-pairing --write docs/persistence-changes/2026-09-20-unknown-child-catalog.md
+2026-09-20-unknown-child-catalog.md: ba729661d60856ff948854641a1520339ab30210
+2026-09-20-unknown-child-catalog.zh.md: 468b4c9a3d3afab56ec8a9b03359016c9c0307e0
diff --git a/docs/persistence-changes/2026-09-20-unknown-child-catalog.md b/docs/persistence-changes/2026-09-20-unknown-child-catalog.md
new file mode 100644
index 0000000000..ba729661d6
--- /dev/null
+++ b/docs/persistence-changes/2026-09-20-unknown-child-catalog.md
@@ -0,0 +1,48 @@
+---
+description: "Records a persistence type transition and its compatibility acknowledgement."
+kind: persistence-change
+---
+
+# 2026-09-20-unknown-child-catalog
+
+English | [中文](2026-09-20-unknown-child-catalog.zh.md)
+
+## Summary
+
+Retain unreadable historical children in subagent/catalog with unknown mode.
+
+## Table of Contents
+
+- [Declaration](#declaration)
+- [Compatibility](#compatibility)
+- [Verification](#verification)
+- [Dev Note](#dev-note)
+
+
+## Declaration
+
+```yaml persistence-change
+schemaVersion: 1
+id: 2026-09-20-unknown-child-catalog
+baseline: false
+changes:
+ - root: "event:subagent/catalog"
+ previous: "2026-09-11-initial"
+ after: "3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604"
+ decision: same-version
+```
+
+
+## Compatibility
+
+Catalog payload v0 remains unchanged. Payload v1 adds unknown mode, and current readers accept v0 and v1. Complete facts still use v0; migration emits v1 for unknown children. Existing logs need no rewrite, and the Session header remains V4. Older readers reject v1. The classifier allows higher event payload versions only when all old payload alternatives remain unchanged; same-version widening and removal of old readers stay breaking.
+
+
+## Verification
+
+Migration, restoration, projection, and Web regressions retain unknown membership and child-local errors. Classifier tests accept higher payload versions with preserved predecessors and reject same-version additions, invalid versions, changed or removed old alternatives, and header/surface changes.
+
+
+## Dev Note
+
+None.
diff --git a/docs/persistence-changes/2026-09-20-unknown-child-catalog.schema.json b/docs/persistence-changes/2026-09-20-unknown-child-catalog.schema.json
new file mode 100644
index 0000000000..14c4b254ad
--- /dev/null
+++ b/docs/persistence-changes/2026-09-20-unknown-child-catalog.schema.json
@@ -0,0 +1,250 @@
+{
+ "formatVersion": 2,
+ "roots": [
+ {
+ "key": "event:subagent/catalog",
+ "kind": "event",
+ "event": "subagent/catalog",
+ "surface": false,
+ "digest": "3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604",
+ "schema": {
+ "root": 0,
+ "nodes": [
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "data",
+ "type": 1,
+ "optional": false
+ },
+ {
+ "name": "ignorable",
+ "type": 14,
+ "optional": true
+ },
+ {
+ "name": "seq",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "time",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "type",
+ "type": 15,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "union",
+ "types": [
+ 2,
+ 7,
+ 9,
+ 11,
+ 12
+ ]
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "mode",
+ "type": 5,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 6,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "primitive",
+ "type": "number"
+ },
+ {
+ "kind": "primitive",
+ "type": "string"
+ },
+ {
+ "kind": "literal",
+ "value": "continuable"
+ },
+ {
+ "kind": "literal",
+ "value": 0
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "mode",
+ "type": 5,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 8,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "literal",
+ "value": 1
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 4,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 10,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 6,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "literal",
+ "value": "one-shot"
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 4,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 10,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 8,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 4,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 13,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 8,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "literal",
+ "value": "unknown"
+ },
+ {
+ "kind": "literal",
+ "value": true
+ },
+ {
+ "kind": "literal",
+ "value": "subagent/catalog"
+ }
+ ]
+ }
+ }
+ ],
+ "types": []
+}
diff --git a/docs/persistence-changes/2026-09-20-unknown-child-catalog.zh.md b/docs/persistence-changes/2026-09-20-unknown-child-catalog.zh.md
new file mode 100644
index 0000000000..468b4c9a3d
--- /dev/null
+++ b/docs/persistence-changes/2026-09-20-unknown-child-catalog.zh.md
@@ -0,0 +1,48 @@
+---
+description: "记录持久化类型更改及其兼容性确认。"
+kind: persistence-change
+---
+
+# 2026-09-20-unknown-child-catalog
+
+[English](2026-09-20-unknown-child-catalog.md) | 中文
+
+## 概述
+
+在 subagent/catalog 中使用 unknown 模式保留不可读的历史子会话。
+
+## 目录
+
+- [声明](#declaration)
+- [兼容性](#compatibility)
+- [验证](#verification)
+- [开发备注](#dev-note)
+
+
+## 声明
+
+```yaml persistence-change
+schemaVersion: 1
+id: 2026-09-20-unknown-child-catalog
+baseline: false
+changes:
+ - root: "event:subagent/catalog"
+ previous: "2026-09-11-initial"
+ after: "3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604"
+ decision: same-version
+```
+
+
+## 兼容性
+
+Catalog 载荷 v0 保持不变。载荷 v1 增加 unknown 模式,当前读取器支持 v0 和 v1。完整事实继续使用 v0;迁移为未知子会话写入 v1。已有日志无需改写,Session header 保持 V4。旧读取器拒绝 v1。分类器仅在所有旧载荷分支保持不变时允许增加更高的事件载荷版本;同版本扩展和移除旧版读取支持仍属于破坏性变更。
+
+
+## 验证
+
+迁移、恢复、投影和 Web 回归覆盖未知成员保留与子会话局部报错。分类器测试接受保留前代的更高载荷版本,并拒绝同版本新增、无效版本、旧分支修改或删除,以及 header/model-surface 变更。
+
+
+## 开发备注
+
+无。
diff --git a/docs/persistence-changes/README.i18n.yaml b/docs/persistence-changes/README.i18n.yaml
index 830e77b05e..c2d80f8829 100644
--- a/docs/persistence-changes/README.i18n.yaml
+++ b/docs/persistence-changes/README.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/persistence-changes/README.md
-README.md: 3fd95e48548fdb9c1d04330c2925096d072850d1
-README.zh.md: f4ab3b3d22b1aa2f7f5923e84fd4effc339874db
+README.md: 2f3d2dd50adee751d9dce9ab250649ae13e45521
+README.zh.md: d2cec933b2210cc5652a7aa6c725517e1baff948
diff --git a/docs/persistence-changes/README.md b/docs/persistence-changes/README.md
index 3fd95e4854..2f3d2dd50a 100644
--- a/docs/persistence-changes/README.md
+++ b/docs/persistence-changes/README.md
@@ -53,15 +53,18 @@ Every detected structural change requires an acknowledgement. Record creation an
| Add an optional event-body property, including its complete subtree | `same-version` |
| Make a required event-body property optional | `same-version` |
| Add an ordinary event type | `same-version` |
+| Add a higher numeric `data.version` to an ordinary event while retaining every old payload alternative unchanged | `same-version` |
| Add an explicitly qualified attribution kind to a user/developer source slot whose before and after schemas carry the same supported policy | `same-version` |
| Make an optional property required, add a required property, change an existing type, or remove/rename a property or event | `version-bump` |
| Change the Session header or event envelope | `version-bump` |
A finalized checkpoint protects the accepted baseline without replacing these compatibility rules. At V4, optional additions, ordinary events, and qualified attribution additions can receive new same-version records. Breaking differences require a higher writer version and an acknowledgement containing its own header increase. The accepted V4 record cannot be updated to reuse its original 3→4 transition.
+An ordinary event may add payload alternatives with a required, nonnegative integer `data.version` greater than every existing payload version, provided all existing alternatives remain structurally unchanged. The reader must retain support for the old payloads; adding variants at an existing version, dropping old versions, and changing the Session header or envelope remain breaking. Older readers may reject the new payload version. The [catalog acknowledgement](2026-09-20-unknown-child-catalog.md) records one such transition.
+
The extractor accepts an explicit `@persistenceSource` binding for a core-owned source property on a literal user or developer role; it does not infer a binding from an unannotated type. A producer qualifies its `MessageSourceMap` entry with `@persistenceAttribution`. Qualification promises that an unknown kind and its JSON metadata survive reading without the producer, and that the kind imposes no validation, replay, or authority requirement. A producer may inspect its own kind to resume duplicate suppression; other readers must preserve and derive the recorded messages without that projection. The recorded schema retains the binding, policy version, literal `kind` discriminator, preservation promise, and qualified kind set. Inventory format 2 stores those promises; extraction without a bound policy retains format 1. Session format versions are independent. Both compared snapshots must carry compatible policy state. Existing kind groups still receive ordinary structural comparison; removals, unmarked additions, policy changes, and unrelated breaking changes remain strict. Multiple context-form alternatives with the same wire kind form one group.
-A same-version explanation states why old records can omit the addition and why older readers can ignore it without changing replay. For required-to-optional changes, it explains how readers handle an absent value. The checker validates the type classification; reviewers assess the explanation. A version-bump record includes the increasing header version in the same transition and follows the [Session-format procedure](../cookbook/adding-a-session-format-version.md).
+A same-version explanation states how old records remain readable and how older readers handle new records. Optional additions explain why older readers can ignore them without changing replay; a new payload version records the older-reader rejection. For required-to-optional changes, it explains how readers handle an absent value. The checker validates the type classification; reviewers assess the explanation. A version-bump record includes the increasing header version in the same transition and follows the [Session-format procedure](../cookbook/adding-a-session-format-version.md).
When a reader rejects a JSON property by name, declare the property as optional `never` and mark it with argument-free `@persistenceReserved`. The extractor retains the forbidden field, so allowing a JSON value later requires an existing-field type change. Required or JSON-valued properties cannot carry this marker. Unmarked optional `never` and `undefined` properties retain their existing omission behavior.
diff --git a/docs/persistence-changes/README.zh.md b/docs/persistence-changes/README.zh.md
index f4ab3b3d22..d2cec933b2 100644
--- a/docs/persistence-changes/README.zh.md
+++ b/docs/persistence-changes/README.zh.md
@@ -53,15 +53,18 @@ description: "审阅和维护已记录的会话持久化类型变更、对应 sc
| 添加可选事件体属性,包括其完整子树 | `same-version` |
| 将必选事件体属性改为可选 | `same-version` |
| 添加普通事件类型 | `same-version` |
+| 为普通事件增加更高的数字 `data.version`,并原样保留所有旧载荷分支 | `same-version` |
| 在前后 schema 均带有相同受支持策略的 user/developer 消息源字段中,添加显式声明为归属信息的 kind | `same-version` |
| 将可选属性改为必选、添加必选属性、更改已有类型,或删除/重命名属性或事件 | `version-bump` |
| 更改会话头或事件封装 | `version-bump` |
定稿检查点保护已接受基线,不替换这些兼容性规则。在 V4 中,可选新增、普通事件及符合条件的归属 kind 新增可以使用新的同版本记录。破坏性差异要求更高的写入器版本,以及包含自身头版本递增的确认记录。不能更新已接受 V4 记录以复用其原有 3→4 转换。
+普通事件可增加具有必选、非负整数 `data.version` 的载荷分支,新版本必须高于所有已有载荷版本,且所有已有分支结构保持不变。读取器必须保留旧载荷支持;在已有版本中增加分支、移除旧版本,以及修改 Session header 或事件封装仍属于破坏性变更。旧读取器可能拒绝新载荷版本。[Catalog 确认记录](2026-09-20-unknown-child-catalog.zh.md) 记录了此类演进。
+
提取器接受核心拥有的 source 属性上针对 user 或 developer 字面量角色的显式 `@persistenceSource` 绑定,不会从未标记类型中推断绑定。生产者用 `@persistenceAttribution` 标记其 `MessageSourceMap` 成员。该标记承诺:读取器无需生产者即可保留未知 kind 及其 JSON 元数据,且该 kind 不引入校验、回放或权限要求。生产者可以检查自身 kind 来恢复去重状态;其他读取器必须无需该投影也能保留并派生已记录的消息。记录的 schema 保存绑定、策略版本、字面量 `kind` 判别字段、保留承诺及符合条件的 kind 集合。Inventory format 2 保存这些承诺;没有绑定策略的提取仍使用 format 1。Session 格式版本独立于此。比较双方的快照必须带有兼容的策略状态。已有 kind 分组仍进行常规结构比较;删除、未标记的添加、策略更改及无关破坏性变更继续采用严格规则。同一 wire kind 的多个上下文形式分支归为一组。
-同版本说明须解释旧记录为何可以缺少新增内容,以及旧读取器为何可以忽略它而不改变回放。对于必选改可选的变更,说明须解释读取器如何处理缺失值。检查器验证类型分类;审阅者判断说明是否成立。升版本记录在同一转换中包含递增的头部版本,并遵循[会话格式流程](../cookbook/adding-a-session-format-version.zh.md)。
+同版本说明须解释旧记录如何保持可读,以及旧读取器如何处理新记录。可选新增须说明旧读取器为何可以忽略它而不改变回放;新增载荷版本须记录旧读取器的拒绝行为。对于必选改可选的变更,说明须解释读取器如何处理缺失值。检查器验证类型分类;审阅者判断说明是否成立。升版本记录在同一转换中包含递增的头部版本,并遵循[会话格式流程](../cookbook/adding-a-session-format-version.zh.md)。
当读取器按属性名拒绝 JSON 字段时,将该属性声明为可选 `never`,并添加无参数的 `@persistenceReserved` 标记。提取器保留这一禁止字段,因此后续允许 JSON 值属于已有字段类型变更。必选属性或允许 JSON 值的属性不能携带该标记。未标记的可选 `never` 和 `undefined` 属性保留现有省略行为。
diff --git a/docs/persistence-changes/historical-formats/README.i18n.yaml b/docs/persistence-changes/historical-formats/README.i18n.yaml
index 15481ef915..1f6bfd547a 100644
--- a/docs/persistence-changes/historical-formats/README.i18n.yaml
+++ b/docs/persistence-changes/historical-formats/README.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/persistence-changes/historical-formats/README.md
-README.md: 9bcfaa1246a03446d4d4fc95dd19f9ca60196301
-README.zh.md: 1f17367beb484feaeb289a42b3e5de50d3139be5
+README.md: a1064e815879d709fe466441bb4e8441c10b3aae
+README.zh.md: 87c9d32fa6ca5248886dad663a926afc6983406f
diff --git a/docs/persistence-changes/historical-formats/README.md b/docs/persistence-changes/historical-formats/README.md
index 9bcfaa1246..a1064e8158 100644
--- a/docs/persistence-changes/historical-formats/README.md
+++ b/docs/persistence-changes/historical-formats/README.md
@@ -32,7 +32,7 @@ The index is generated from validated snapshots and the current writer constant.
| 1 | PR #3349 | [V1](v1.md) | [JSON](v1.schema.json) | 54 / 415 |
| 2 | `dsh-v0.1.3-alpha.2` | [V2](v2.md) | [JSON](v2.schema.json) | 56 / 435 |
| 3 | PR #4320 | [V3](v3.md) | [JSON](v3.schema.json) | 60 / 467 |
-| 4 | Current checkout | [Current catalog](../../persistence-catalog.md) | [JSON](../../persistence-schema.json) | 62 / 583 |
+| 4 | Current checkout | [Current catalog](../../persistence-catalog.md) | [JSON](../../persistence-schema.json) | 62 / 587 |
diff --git a/docs/persistence-changes/historical-formats/README.zh.md b/docs/persistence-changes/historical-formats/README.zh.md
index 1f17367beb..87c9d32fa6 100644
--- a/docs/persistence-changes/historical-formats/README.zh.md
+++ b/docs/persistence-changes/historical-formats/README.zh.md
@@ -32,7 +32,7 @@ description: "查找从 V0 到工作区写入器版本的每个 Session 格式
| 1 | PR #3349 | [V1](v1.zh.md) | [JSON](v1.schema.json) | 54 / 415 |
| 2 | `dsh-v0.1.3-alpha.2` | [V2](v2.zh.md) | [JSON](v2.schema.json) | 56 / 435 |
| 3 | PR #4320 | [V3](v3.zh.md) | [JSON](v3.schema.json) | 60 / 467 |
-| 4 | 当前工作树 | [当前目录](../../persistence-catalog.zh.md) | [JSON](../../persistence-schema.json) | 62 / 583 |
+| 4 | 当前工作树 | [当前目录](../../persistence-catalog.zh.md) | [JSON](../../persistence-schema.json) | 62 / 587 |
diff --git a/docs/persistence-schema.json b/docs/persistence-schema.json
index db1c54ff38..59b8a86b4a 100644
--- a/docs/persistence-schema.json
+++ b/docs/persistence-schema.json
@@ -14850,7 +14850,7 @@
"kind": "event",
"event": "subagent/catalog",
"surface": false,
- "digest": "ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871",
+ "digest": "3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604",
"schema": {
"root": 0,
"nodes": [
@@ -14864,7 +14864,7 @@
},
{
"name": "ignorable",
- "type": 9,
+ "type": 14,
"optional": true
},
{
@@ -14879,7 +14879,7 @@
},
{
"name": "type",
- "type": 10,
+ "type": 15,
"optional": false
}
],
@@ -14889,7 +14889,10 @@
"kind": "union",
"types": [
2,
- 7
+ 7,
+ 9,
+ 11,
+ 12
]
},
{
@@ -14939,6 +14942,41 @@
"kind": "literal",
"value": 0
},
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "mode",
+ "type": 5,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 8,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "literal",
+ "value": 1
+ },
{
"kind": "object",
"properties": [
@@ -14959,7 +14997,7 @@
},
{
"name": "mode",
- "type": 8,
+ "type": 10,
"optional": false
},
{
@@ -14974,6 +15012,72 @@
"kind": "literal",
"value": "one-shot"
},
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 4,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 10,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 8,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 4,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 13,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 8,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "literal",
+ "value": "unknown"
+ },
{
"kind": "literal",
"value": true
@@ -21691,6 +21795,20 @@
"names": [],
"sources": []
},
+ {
+ "digest": "05a2796621b1ee6c03ef7abe560b25116bb4da4d592312117242a78415a32b04",
+ "schema": {
+ "root": 0,
+ "nodes": [
+ {
+ "kind": "literal",
+ "value": "unknown"
+ }
+ ]
+ },
+ "names": [],
+ "sources": []
+ },
{
"digest": "05d2ae1e0c7f8770f83f9a09047afb39a335d8ac986df3193659aa1e581472cf",
"schema": {
@@ -30929,6 +31047,213 @@
"names": [],
"sources": []
},
+ {
+ "digest": "1de64ea9a0849ce631b7e4e1255ae773fabd94a4a7c8d27e716f8012302e12c0",
+ "schema": {
+ "root": 0,
+ "nodes": [
+ {
+ "kind": "union",
+ "types": [
+ 1,
+ 6,
+ 8,
+ 10,
+ 11
+ ]
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 2,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "mode",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 5,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "primitive",
+ "type": "number"
+ },
+ {
+ "kind": "primitive",
+ "type": "string"
+ },
+ {
+ "kind": "literal",
+ "value": "continuable"
+ },
+ {
+ "kind": "literal",
+ "value": 0
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 2,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "mode",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 7,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "literal",
+ "value": 1
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 2,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 3,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 9,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 5,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "literal",
+ "value": "one-shot"
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 2,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 3,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 9,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 7,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 2,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 3,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 12,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 7,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "literal",
+ "value": "unknown"
+ }
+ ]
+ },
+ "names": [
+ "packages/subagent/subagent/src/catalog.ts#SubagentCatalogEvent"
+ ],
+ "sources": [
+ "packages/subagent/subagent/src/catalog.ts:28"
+ ]
+ },
{
"digest": "1df34a6c086866ffdc2dd9e8e5c581c3751a010cdf6b8538a7327f7a3237f0b4",
"schema": {
@@ -35234,15 +35559,49 @@
]
},
{
- "digest": "3ac1196f59d5e9e0e9345122c8c403b102478b526404a2e591a38f613483321e",
+ "digest": "3abae7324356f155cb42450c00b806d134ec93bd6439d2063b8d724162d58604",
"schema": {
"root": 0,
"nodes": [
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "data",
+ "type": 1,
+ "optional": false
+ },
+ {
+ "name": "ignorable",
+ "type": 14,
+ "optional": true
+ },
+ {
+ "name": "seq",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "time",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "type",
+ "type": 15,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
{
"kind": "union",
"types": [
- 1,
- 6
+ 2,
+ 7,
+ 9,
+ 11,
+ 12
]
},
{
@@ -35250,28 +35609,28 @@
"properties": [
{
"name": "childCreatedAt",
- "type": 2,
+ "type": 3,
"optional": false
},
{
"name": "childId",
- "type": 3,
- "optional": false
- },
- {
- "name": "label",
- "type": 3,
- "optional": false
- },
- {
- "name": "mode",
"type": 4,
"optional": false
},
{
- "name": "version",
+ "name": "label",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "mode",
"type": 5,
"optional": false
+ },
+ {
+ "name": "version",
+ "type": 6,
+ "optional": false
}
],
"indices": []
@@ -35297,27 +35656,62 @@
"properties": [
{
"name": "childCreatedAt",
- "type": 2,
+ "type": 3,
"optional": false
},
{
"name": "childId",
- "type": 3,
+ "type": 4,
"optional": false
},
{
"name": "label",
- "type": 3,
- "optional": true
+ "type": 4,
+ "optional": false
},
{
"name": "mode",
- "type": 7,
+ "type": 5,
"optional": false
},
{
"name": "version",
- "type": 5,
+ "type": 8,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "literal",
+ "value": 1
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 4,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 10,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 6,
"optional": false
}
],
@@ -35326,15 +35720,85 @@
{
"kind": "literal",
"value": "one-shot"
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 4,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 10,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 8,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 4,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 4,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 13,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 8,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "literal",
+ "value": "unknown"
+ },
+ {
+ "kind": "literal",
+ "value": true
+ },
+ {
+ "kind": "literal",
+ "value": "subagent/catalog"
}
]
},
- "names": [
- "packages/subagent/subagent/src/catalog.ts#SubagentCatalogEvent"
- ],
- "sources": [
- "packages/subagent/subagent/src/catalog.ts:24"
- ]
+ "names": [],
+ "sources": []
},
{
"digest": "3b04790e08b35241ffa0d38f6d7e4f8788aa921341f6c0d7574a329397c59408",
@@ -68069,6 +68533,63 @@
"names": [],
"sources": []
},
+ {
+ "digest": "a0f25b5aeeebf2bf1542ce67726b095e3b139a39c71861d57e827f12dea1f499",
+ "schema": {
+ "root": 0,
+ "nodes": [
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 1,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 2,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 2,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 4,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "primitive",
+ "type": "number"
+ },
+ {
+ "kind": "primitive",
+ "type": "string"
+ },
+ {
+ "kind": "literal",
+ "value": "unknown"
+ },
+ {
+ "kind": "literal",
+ "value": 1
+ }
+ ]
+ },
+ "names": [],
+ "sources": []
+ },
{
"digest": "a0f906856fc06f1c6f2083eb970e5a657a82b1a84c06c095445e5d6d161cda80",
"schema": {
@@ -70165,144 +70686,6 @@
"names": [],
"sources": []
},
- {
- "digest": "ae1f7110feeec697b8cab42b68f7709aa7b3279764099dfb53c25890d2e5c871",
- "schema": {
- "root": 0,
- "nodes": [
- {
- "kind": "object",
- "properties": [
- {
- "name": "data",
- "type": 1,
- "optional": false
- },
- {
- "name": "ignorable",
- "type": 9,
- "optional": true
- },
- {
- "name": "seq",
- "type": 3,
- "optional": false
- },
- {
- "name": "time",
- "type": 3,
- "optional": false
- },
- {
- "name": "type",
- "type": 10,
- "optional": false
- }
- ],
- "indices": []
- },
- {
- "kind": "union",
- "types": [
- 2,
- 7
- ]
- },
- {
- "kind": "object",
- "properties": [
- {
- "name": "childCreatedAt",
- "type": 3,
- "optional": false
- },
- {
- "name": "childId",
- "type": 4,
- "optional": false
- },
- {
- "name": "label",
- "type": 4,
- "optional": false
- },
- {
- "name": "mode",
- "type": 5,
- "optional": false
- },
- {
- "name": "version",
- "type": 6,
- "optional": false
- }
- ],
- "indices": []
- },
- {
- "kind": "primitive",
- "type": "number"
- },
- {
- "kind": "primitive",
- "type": "string"
- },
- {
- "kind": "literal",
- "value": "continuable"
- },
- {
- "kind": "literal",
- "value": 0
- },
- {
- "kind": "object",
- "properties": [
- {
- "name": "childCreatedAt",
- "type": 3,
- "optional": false
- },
- {
- "name": "childId",
- "type": 4,
- "optional": false
- },
- {
- "name": "label",
- "type": 4,
- "optional": true
- },
- {
- "name": "mode",
- "type": 8,
- "optional": false
- },
- {
- "name": "version",
- "type": 6,
- "optional": false
- }
- ],
- "indices": []
- },
- {
- "kind": "literal",
- "value": "one-shot"
- },
- {
- "kind": "literal",
- "value": true
- },
- {
- "kind": "literal",
- "value": "subagent/catalog"
- }
- ]
- },
- "names": [],
- "sources": []
- },
{
"digest": "ae63d9d1080ed8945031594d93f8d96651d7101b848719cc3e1475875cd3d649",
"schema": {
@@ -71795,6 +72178,63 @@
"names": [],
"sources": []
},
+ {
+ "digest": "b6896938660a1dfe4ddd100fb3164d9f8fa57feeabfe37441a80106c9942697a",
+ "schema": {
+ "root": 0,
+ "nodes": [
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 1,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 2,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 2,
+ "optional": true
+ },
+ {
+ "name": "mode",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 4,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "primitive",
+ "type": "number"
+ },
+ {
+ "kind": "primitive",
+ "type": "string"
+ },
+ {
+ "kind": "literal",
+ "value": "one-shot"
+ },
+ {
+ "kind": "literal",
+ "value": 1
+ }
+ ]
+ },
+ "names": [],
+ "sources": []
+ },
{
"digest": "b6ef9c6210be8350cd465f485cf520031fffa6bf3809c61a1e713e834c5982d0",
"schema": {
@@ -81359,6 +81799,63 @@
"packages/schedule/schedule/src/types.ts:105"
]
},
+ {
+ "digest": "e2ad8f5bcd813f268ffef1b10a12d7ddd2b8ced8b9b6d0275b3f6b7ed094a187",
+ "schema": {
+ "root": 0,
+ "nodes": [
+ {
+ "kind": "object",
+ "properties": [
+ {
+ "name": "childCreatedAt",
+ "type": 1,
+ "optional": false
+ },
+ {
+ "name": "childId",
+ "type": 2,
+ "optional": false
+ },
+ {
+ "name": "label",
+ "type": 2,
+ "optional": false
+ },
+ {
+ "name": "mode",
+ "type": 3,
+ "optional": false
+ },
+ {
+ "name": "version",
+ "type": 4,
+ "optional": false
+ }
+ ],
+ "indices": []
+ },
+ {
+ "kind": "primitive",
+ "type": "number"
+ },
+ {
+ "kind": "primitive",
+ "type": "string"
+ },
+ {
+ "kind": "literal",
+ "value": "continuable"
+ },
+ {
+ "kind": "literal",
+ "value": 1
+ }
+ ]
+ },
+ "names": [],
+ "sources": []
+ },
{
"digest": "e2d0367e5716bc188435e51718ebff8ce873190625fa93b1c5331102d98758fa",
"schema": {
diff --git a/docs/subsystems/sidebar-right.i18n.yaml b/docs/subsystems/sidebar-right.i18n.yaml
index a1164e5891..30b50d6a0a 100644
--- a/docs/subsystems/sidebar-right.i18n.yaml
+++ b/docs/subsystems/sidebar-right.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/sidebar-right.md
-sidebar-right.md: 9ad6bd63ed63c5c59dbe29cd1229a6412ad22de2
-sidebar-right.zh.md: d0a967f400ea80ab696e24e1b4f46d7d8664eff8
+sidebar-right.md: 27e5219aec8997cf0d168ac9ea2665baaf943906
+sidebar-right.zh.md: 63f2c1081009778e191789038ffd1923312fc55b
diff --git a/docs/subsystems/sidebar-right.md b/docs/subsystems/sidebar-right.md
index 9ad6bd63ed..27e5219aec 100644
--- a/docs/subsystems/sidebar-right.md
+++ b/docs/subsystems/sidebar-right.md
@@ -136,7 +136,7 @@ The Host `ctx.workspaceFiles` service and generated `workspaceFiles` Remote name
- **`guide`** — `builtin`, opened as `openTab('guide')`. A muted compass sits above one capsule per contributed `guide` entry, in `order`; short lists show registered descriptions, and every missing icon uses the shipped placeholder. Picking a capsule opens the contributing type as a page in the guide tab's place. A pane holds at most one guide tab, and the strip's add control appears only while its pane has none. A new pane receives the registered default page: the sole guide entry directly, or the guide when the entry count is not one ([guide](../../packages/client/ui-sidebar-right/README.md#the-guide)).
- **`text`** — `fallback`, `dsh-resource://file/**`, claiming Session addresses only. Document Preview observes metadata through `useResource<'file'>`, loads content through Remote callbacks, and owns renderer selection, the toolbar, per-tab refresh, scroll, and source navigation; unknown extensions render as plain text ([README](../../packages/client/ui-sidebar-documentpreview/README.md)).
- **`files`** — `builtin`, opened as `openTab('files')`. The workspace directory tree, listed lazily through `list` and watched by expanded directory, opening a file with `tab.actions.openResource(fileAddressFor(sessionId, root, path))` into its own pane ([README](../../packages/client/ui-sidebar-files/README.md)).
-- **`browser`** — multi-instance `builtin`, opened as `openTab('browser', { params: { url? } })`. Assistant Markdown delegates HTTP(S) links to this page type. It accepts public and loopback HTTP(S) targets under the default sandbox, rejects local files in favor of Document Preview, and uses application-known iframe history ([README](../../packages/client/ui-sidebar-browser/README.md)).
+- **`browser`** — multi-instance `builtin`, opened as `openTab('browser', { params: { url? } })`. Chat's [link preference](../../packages/client/ui-chat/README.md) controls whether Assistant Markdown opens HTTP(S) links here. It accepts public and loopback HTTP(S) targets under the default sandbox, rejects local files in favor of Document Preview, and uses application-known iframe history ([README](../../packages/client/ui-sidebar-browser/README.md)).
- **`subagentchat`** — `builtin`, `dsh-resource://subagentchat/session/?parent=&mode=`. An explicitly addressed subagent Conversation retained by the resource provider and rendered through the shared Conversation Factory ([README](../../packages/client/ui-subagent/README.md)).
diff --git a/docs/subsystems/sidebar-right.zh.md b/docs/subsystems/sidebar-right.zh.md
index d0a967f400..63f2c10810 100644
--- a/docs/subsystems/sidebar-right.zh.md
+++ b/docs/subsystems/sidebar-right.zh.md
@@ -136,7 +136,7 @@ Host 的 `ctx.workspaceFiles` 服务与生成的 `workspaceFiles` Remote 命名
- **`guide`**——`builtin`,以 `openTab('guide')` 打开。一枚弱化的罗盘位于各类型按 `order` 贡献的入口胶囊上方;入口较少时显示已注册的描述,未提供图标的入口统一使用内置占位符。点选胶囊即在引导 tab 的位置把贡献它的类型作为页面打开。每个 pane 最多一个引导 tab,tab 条的新增控件只在本 pane 没有引导时出现。新 pane 使用已注册的默认页:只有一个引导入口时直接使用该入口,否则使用引导页([引导](../../packages/client/ui-sidebar-right/README.zh.md#the-guide))。
- **`text`**——`fallback`,`dsh-resource://file/**`,只认领 Session 地址。Document Preview 通过 `useResource<'file'>` 观察元数据,经 Remote 回调加载内容,并拥有渲染器选择、工具栏、逐 tab 刷新、滚动与源码定位;未知扩展名按纯文本渲染([README](../../packages/client/ui-sidebar-documentpreview/README.zh.md))。
- **`files`**——`builtin`,以 `openTab('files')` 打开。工作区目录树,经 `list` 懒加载,按展开目录建立监听,用 `tab.actions.openResource(fileAddressFor(sessionId, root, path))` 在自己所在 pane 打开文件([README](../../packages/client/ui-sidebar-files/README.zh.md))。
-- **`browser`**——可多开的 `builtin`,以 `openTab('browser', { params: { url? } })` 打开。Assistant Markdown 会把 HTTP(S) 链接委托给该页面类型。它在默认 sandbox 下接受公共与 loopback HTTP(S) 目标,本地文件改用 Document Preview,并使用应用已知的 iframe history([README](../../packages/client/ui-sidebar-browser/README.zh.md))。
+- **`browser`**——可多开的 `builtin`,以 `openTab('browser', { params: { url? } })` 打开。Chat 的[链接偏好](../../packages/client/ui-chat/README.zh.md)决定 Assistant Markdown 是否在此打开 HTTP(S) 链接。它在默认 sandbox 下接受公共与 loopback HTTP(S) 目标,本地文件改用 Document Preview,并使用应用已知的 iframe history([README](../../packages/client/ui-sidebar-browser/README.zh.md))。
- **`subagentchat`**——`builtin`,`dsh-resource://subagentchat/session/?parent=&mode=`。资源提供方保留一个显式寻址的 subagent Conversation,并通过共享 Conversation Factory 渲染([README](../../packages/client/ui-subagent/README.zh.md))。
diff --git a/docs/subsystems/subagent.i18n.yaml b/docs/subsystems/subagent.i18n.yaml
index 034d835426..805d66f003 100644
--- a/docs/subsystems/subagent.i18n.yaml
+++ b/docs/subsystems/subagent.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/subagent.md
-subagent.md: d642fe1658926b17cb29f280803f12e61228be60
-subagent.zh.md: ff153c7861b4ac46bb058efd00a2f5a50181b6f2
+subagent.md: 67f9bc31b46617ea2f7b1ec81bf8c52fd62720cb
+subagent.zh.md: a69e032ed96a24a980badaf9e14d924311e1d175
diff --git a/docs/subsystems/subagent.md b/docs/subsystems/subagent.md
index d642fe1658..67f9bc31b4 100644
--- a/docs/subsystems/subagent.md
+++ b/docs/subsystems/subagent.md
@@ -8,7 +8,7 @@ Service Definition: [dsh-subagent](../../packages/subagent/subagent) (`ctx.subag
Sources: [`packages/subagent/subagent/src/types.ts`](../../packages/subagent/subagent/src/types.ts), [`packages/subagent/subagent/src/index.ts`](../../packages/subagent/subagent/src/index.ts), and [`packages/subagent/subagent/src/continuation.ts`](../../packages/subagent/subagent/src/continuation.ts)
-The `subagentCatalog` projection exposes `SubagentCatalogEntry[]` in parent event order through Session observations and client snapshots. Each entry contains the child id, creation time, mode, and mode-dependent label; fork-inherited catalog facts are excluded. [The subagent package](../../packages/subagent/subagent/README.md) owns catalog creation and persistence semantics.
+The `subagentCatalog` projection exposes `SubagentCatalogEntry[]` in parent event order through Session observations and client snapshots. Each entry contains the child id, creation time, mode, and mode-dependent label; fork-inherited catalog facts are excluded. [The subagent package](../../packages/subagent/subagent/README.md) owns catalog creation and persistence semantics. Historical children with unavailable descriptors have `mode: 'unknown'`; their header identity remains discoverable without granting continuation capabilities.
## Two kinds of capability, discovered two ways
@@ -465,7 +465,7 @@ The spawn and fork backends create an ordinary one-shot agent through `parent.ct
- **Delegation depth** is durable `SessionHeader.delegationDepth` plus the merge-extensible runtime field `AgentOptions.subagentDepth`; absence means top-level depth zero, and the greater present value is authoritative. The seam owns both fields — the loop neither sets nor reads them — so an in-process child persists parent depth + 1, cold resume cannot lower it, and every start rejects a derived depth outside the safe-integer domain or above a defined absolute `request.maxDepth` cap.
- **Fork seeding** uses [`CreateAgentOptions.seed`](core.md#creation-and-ownership) (a `SessionEvent[]` prefix threaded through `AgentLoop.createAgent` → `ctx.sessions.prepare({ seed })`, the same primitive `ctx.agents.resume()` uses). The fork backend passes a *balanced completed-turn prefix* of the parent's log — the parent's events up to and including its last `turn/end` — so the seed is contiguous-from-0 and the [invariants](../../packages/runtime-diagnostics/invariants) replay accepts it (the in-flight, unbalanced turn is excluded).
-`SubagentCatalogEntry` describes one successful direct-child creation fact; `SubagentCatalogState` is the host-only projection state. `listChildren()` owns a live-preferred parent observation without opening child logs. Browser consumers read `subagentCatalog` through the shared Session projection store and combine membership with Session-list activity. `SubagentCatalogRow` belongs to complete-descendant listing. [The parent-catalog decision](../../.agents/notes/implemented/architecture/2026-09-01-parent-owned-subagent-catalog.md) owns the persistent facts and read semantics.
+`SubagentCatalogEntry` describes a direct child with complete or unknown-mode discovery information; `SubagentCatalogState` is the host-only projection state. `listChildren()` owns a live-preferred parent observation without opening child logs. Browser consumers read `subagentCatalog` through the shared Session projection store and combine membership with Session-list activity. `SubagentCatalogRow` belongs to complete-descendant listing. [The parent-catalog decision](../../.agents/notes/implemented/architecture/2026-09-01-parent-owned-subagent-catalog.md) owns the persistent facts and read semantics.
diff --git a/docs/subsystems/subagent.zh.md b/docs/subsystems/subagent.zh.md
index ff153c7861..a69e032ed9 100644
--- a/docs/subsystems/subagent.zh.md
+++ b/docs/subsystems/subagent.zh.md
@@ -8,7 +8,7 @@ Service Definition:[dsh-subagent](../../packages/subagent/subagent)(`ctx.sub
源码:[`packages/subagent/subagent/src/types.ts`](../../packages/subagent/subagent/src/types.ts)、[`packages/subagent/subagent/src/index.ts`](../../packages/subagent/subagent/src/index.ts)和 [`packages/subagent/subagent/src/continuation.ts`](../../packages/subagent/subagent/src/continuation.ts)
-`subagentCatalog` projection 通过 Session 观察和客户端快照暴露按父会话事件排序的 `SubagentCatalogEntry[]`。每个条目包含子级 id、创建时间、模式和依模式确定的标签;fork 继承的目录事实不在其中。[subagent 包](../../packages/subagent/subagent/README.zh.md) 定义目录创建和持久化语义。
+`subagentCatalog` projection 通过 Session 观察和客户端快照暴露按父会话事件排序的 `SubagentCatalogEntry[]`。每个条目包含子级 id、创建时间、模式和依模式确定的标签;fork 继承的目录事实不在其中。[subagent 包](../../packages/subagent/subagent/README.zh.md) 定义目录创建和持久化语义。历史子会话的 descriptor 不可用时使用 `mode: 'unknown'`,保留 header 身份供发现,但不授予继续执行能力。
## 两类能力,两种发现方式
@@ -469,7 +469,7 @@ spawn 和 fork 后端通过 `parent.ctx` 创建一个普通的单次 agent,将
- **委派深度**由持久 `SessionHeader.delegationDepth` 与可合并扩展的运行时字段 `AgentOptions.subagentDepth` 共同表示;缺失表示顶层深度为零,存在的较大值具有权威性。两个字段都归该 seam 所有——循环既不设置也不读取它们——因此进程内子 agent 会持久保存 parent 深度 + 1,冷恢复无法降低深度,而且每次 start 都会拒绝超出安全整数域、或高于已定义绝对 `request.maxDepth` 上限的派生深度。
- **Fork 种子注入**使用 [`CreateAgentOptions.seed`](core.zh.md#creation-and-ownership)(一个 `SessionEvent[]` 前缀,经由 `AgentLoop.createAgent` → `ctx.sessions.prepare({ seed })` 传递,与 `ctx.agents.resume()` 使用的原语相同)。fork 后端传入父级日志的一段*平衡的已完成轮次前缀*——父级事件直到并包括其最后一个 `turn/end`——因此种子从 0 连续,[invariants](../../packages/runtime-diagnostics/invariants) 回放可以接受它(进行中的、未平衡的轮次被排除在外)。
-`SubagentCatalogEntry` 描述一条成功创建直接子级的事实;`SubagentCatalogState` 是仅 host 使用的 projection state。`listChildren()` 拥有一次 live-preferred 父 Session observation,不打开子级日志。浏览器消费者通过共享 Session projection store 读取 `subagentCatalog`,并将成员关系与 Session 列表活动状态组合。`SubagentCatalogRow` 属于完整后代列表。[父目录决策](../../.agents/notes/implemented/architecture/2026-09-01-parent-owned-subagent-catalog.zh.md) 规定持久事实与读取语义。
+`SubagentCatalogEntry` 描述一条完整或未知模式的直接子级目录记录;`SubagentCatalogState` 是仅 host 使用的 projection state。`listChildren()` 拥有一次 live-preferred 父 Session observation,不打开子级日志。浏览器消费者通过共享 Session projection store 读取 `subagentCatalog`,并将成员关系与 Session 列表活动状态组合。`SubagentCatalogRow` 属于完整后代列表。[父目录决策](../../.agents/notes/implemented/architecture/2026-09-01-parent-owned-subagent-catalog.zh.md) 规定持久事实与读取语义。
diff --git a/package.json b/package.json
index 4d36479376..eb4b2b92c9 100644
--- a/package.json
+++ b/package.json
@@ -196,6 +196,7 @@
"demo:ptc": "node scripts/demo-ptc.mjs",
"demo:inspector": "node --import tsx/esm apps/cli/src/bin.ts web --patch ./packages/experimental/inspector/cordis.source.patch.yml",
"mock:llm": "node --import tsx packages/test-support/llm-mock-server/src/bin.ts",
+ "start:web": "node --import tsx/esm apps/cli/src/bin.ts web",
"dev:web": "tsx scripts/dev-web.ts --poll",
"postinstall": "node scripts/install-lefthook.mjs"
},
diff --git a/packages/api/session-controller/README.i18n.yaml b/packages/api/session-controller/README.i18n.yaml
index 32ffc5e1cd..e63c0b2a46 100644
--- a/packages/api/session-controller/README.i18n.yaml
+++ b/packages/api/session-controller/README.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/api/session-controller/README.md
-README.md: 56d0f17b815a4616707d33bfd84b77446125f742
-README.zh.md: 9d754a5a61da548e1fd6dd10d1332582bdd3d126
+README.md: 49f38e5af8f0939dd8f1ccafcd7928b10954ca33
+README.zh.md: 57112fc5ce88567ecfe415ed7ee4dd5ac9d34224
diff --git a/packages/api/session-controller/README.md b/packages/api/session-controller/README.md
index 56d0f17b81..49f38e5af8 100644
--- a/packages/api/session-controller/README.md
+++ b/packages/api/session-controller/README.md
@@ -63,7 +63,7 @@ Attachment authorization reads declared content fields of built-in Session event
`sessions.retain(target, { source, signal? })` immediately acquires one exact Client generation and starts its shared initial history opening. The target is a known Session id or a durable direct-parent subagent address; the Host validates an explicit address when history opens. The returned reference supports idempotent `release()` and `Symbol.dispose`; its `ready` Promise follows the shared `Session.open()` result and resolves to the exact binding when that attempt settles, including when a Remote failure is represented by `openState: 'error'`. It rejects when `Session.open()` rejects, its waiter is cancelled, or the reference is released early. Cancelling one waiter does not cancel another owner's opening. `sessions.using(target, options, operation)` waits for that settlement, holds its reference until the callback settles, and propagates rejected readiness and callback failures.
-References keep local Session data, scoped Contexts, and history streams alive, not Host Agents. Ordinary Session retention never adds a catalog row. Retained subagents with a known direct-parent address keep a fallback row and notify list readers even before the parent catalog arrives; these rows do not join Host-list membership. Fork-title assignment sends rename directly and applies the returned title projection without retaining the child or opening its history. Final release withdraws the generation before teardown; later acquisition can create a new generation with the same id. `binding(id)` and `scope(id)` only borrow an existing generation. `retainInfo(id)` observes stable read-only source counts independently of catalog membership and performs no history I/O. Consumer source keys are declaration-merge extensible; navigation and completion acknowledgement belong to UI consumers, not this Controller. See [Client Session references](../../../.agents/notes/implemented/architecture/2026-09-15-client-session-references.md) for ownership and teardown rules.
+References keep local Session data, scoped Contexts, and history streams alive, not Host Agents. Ordinary Session retention never adds a catalog row. Retained subagents with a known direct-parent address keep a fallback row and notify list readers even before the parent catalog arrives; these rows do not join Host-list membership. Fork-title assignment sends rename directly and applies the returned title projection without retaining the child or opening its history. Final release withdraws the generation before teardown; later acquisition can create a new generation with the same id. `binding(id)` and `scope(id)` only borrow an existing generation. `retainInfo(id)` observes stable read-only source counts independently of catalog membership and performs no history I/O. Consumer source keys are declaration-merge extensible; navigation and completion acknowledgement belong to UI consumers, not this Controller. See [Client Session references](../../../.agents/notes/implemented/architecture/2026-09-15-client-session-references.md) for ownership and teardown rules. An unknown-mode subagent address permits history reads with direct-parent validation. Successful descriptor restoration determines the displayed mode; failures remain local to the child, and control requests still require a confirmed continuable identity.
## Session media references
diff --git a/packages/api/session-controller/README.zh.md b/packages/api/session-controller/README.zh.md
index 9d754a5a61..57112fc5ce 100644
--- a/packages/api/session-controller/README.zh.md
+++ b/packages/api/session-controller/README.zh.md
@@ -63,7 +63,7 @@ Fork 复制 `atSeq` 所选的精确事件前缀,包含切点事件,允许在
`sessions.retain(target, { source, signal? })` 立即获取一个精确 Client generation 的引用,并启动其共享的首次历史打开。目标是已知 Session id 或持久的直接父子 subagent 地址;Host 在打开历史时校验显式地址。返回引用支持幂等的 `release()` 和 `Symbol.dispose`;其 `ready` Promise 跟随共享的 `Session.open()` 结果,并在该次尝试结算时解析为确切 binding,包括 Remote failure 以 `openState: 'error'` 表示的情况。仅当 `Session.open()` 拒绝、等待方取消或引用提前释放时,`ready` 才拒绝。取消一个等待方不会取消其他 owner 的打开。`sessions.using(target, options, operation)` 等待该次结算,持有引用直到回调结束,并传播被拒绝的就绪与回调失败。
-引用保活本地会话数据、作用域 Context 和历史流,不保活 Host Agent。普通 Session 不因保留引用而添加目录行。已保留且具有明确直接父子地址的 subagent 即使尚未收到父目录,也会保留兜底行并通知列表读取方;这些行不加入 Host 列表成员集合。Fork 标题设置直接发送 rename 并应用返回的标题投影,不 retain 子会话,也不打开其历史。最后一个引用释放时,generation 先退出可访问映射,再执行清理;后续获取可以为同一 id 创建新 generation。`binding(id)` 和 `scope(id)` 只借用已有 generation。`retainInfo(id)` 独立于目录成员关系观察稳定的只读来源计数,不执行历史 I/O。消费方来源键可通过声明合并扩展;导航和完成确认属于 UI 消费方,不属于本控制器。所有权与清理规则见 [Client 会话引用](../../../.agents/notes/implemented/architecture/2026-09-15-client-session-references.zh.md)。
+引用保活本地会话数据、作用域 Context 和历史流,不保活 Host Agent。普通 Session 不因保留引用而添加目录行。已保留且具有明确直接父子地址的 subagent 即使尚未收到父目录,也会保留兜底行并通知列表读取方;这些行不加入 Host 列表成员集合。Fork 标题设置直接发送 rename 并应用返回的标题投影,不 retain 子会话,也不打开其历史。最后一个引用释放时,generation 先退出可访问映射,再执行清理;后续获取可以为同一 id 创建新 generation。`binding(id)` 和 `scope(id)` 只借用已有 generation。`retainInfo(id)` 独立于目录成员关系观察稳定的只读来源计数,不执行历史 I/O。消费方来源键可通过声明合并扩展;导航和完成确认属于 UI 消费方,不属于本控制器。所有权与清理规则见 [Client 会话引用](../../../.agents/notes/implemented/architecture/2026-09-15-client-session-references.zh.md)。 模式未知的子代理地址允许读取历史,但仍校验直接父级。成功恢复 descriptor 后确定展示模式;失败只影响该子会话,控制请求仍要求已确认的 continuable 身份。
## 会话媒体引用
diff --git a/packages/api/session-controller/src/client/sessions/session.ts b/packages/api/session-controller/src/client/sessions/session.ts
index 08d935233c..ec880192f0 100644
--- a/packages/api/session-controller/src/client/sessions/session.ts
+++ b/packages/api/session-controller/src/client/sessions/session.ts
@@ -805,6 +805,7 @@ export class Session implements SessionFace {
}
private buildSnapshot(): SessionSnapshot {
+ const identity = this.projections.values().subagent
return {
sessionId: this.sessionId,
pendingSubmissions: this.pendingSubmissions,
@@ -812,7 +813,9 @@ export class Session implements SessionFace {
subagent: this.address === undefined
? null
: {
- address: this.address,
+ address: this.address.mode === 'unknown' && identity != null
+ ? { ...this.address, mode: identity.mode }
+ : this.address,
...(this.parentAvailable === undefined ? {} : { parentAvailable: this.parentAvailable }),
},
removed: this.removed,
diff --git a/packages/api/session-controller/src/history.ts b/packages/api/session-controller/src/history.ts
index a22badc1f1..069ee3bf32 100644
--- a/packages/api/session-controller/src/history.ts
+++ b/packages/api/session-controller/src/history.ts
@@ -364,7 +364,7 @@ function validateAddress(
reason: 'unsupported',
})
}
- if (identity.mode !== address.mode) {
+ if (address.mode !== 'unknown' && identity.mode !== address.mode) {
throw new RemoteError('subagent/unauthorized', 'subagent mode does not match the supplied address', {
childSessionId: address.childSessionId,
})
diff --git a/packages/api/session-controller/src/types.ts b/packages/api/session-controller/src/types.ts
index 37294a6dbb..728df9e55b 100644
--- a/packages/api/session-controller/src/types.ts
+++ b/packages/api/session-controller/src/types.ts
@@ -407,7 +407,7 @@ export type SessionAddress =
readonly kind: 'subagent'
readonly parentSessionId: SessionId
readonly childSessionId: SessionId
- readonly mode: 'one-shot' | 'continuable'
+ readonly mode: 'one-shot' | 'continuable' | 'unknown'
}
/** One non-activating Session projection read. */
diff --git a/packages/api/session-controller/tests/manager.client.spec.ts b/packages/api/session-controller/tests/manager.client.spec.ts
index aed5009fdd..55d182110a 100644
--- a/packages/api/session-controller/tests/manager.client.spec.ts
+++ b/packages/api/session-controller/tests/manager.client.spec.ts
@@ -817,6 +817,25 @@ describe('subagent catalogs', () => {
})
})
+ it('resolves an unknown browsing mode from the child projection without changing parent membership', async ({ mock, start }) => {
+ mock.load(sessionWorld)
+ const client = await start()
+ const manager = new SessionManager(client.ctx.remote)
+ const entries = [{ id: S2, createdAt: 1, mode: 'unknown' as const }]
+ manager.handleControlFrame({ type: 'projection', sessionId: S1, key: 'subagentCatalog', seq: 0, value: entries })
+ const address = manager.subagentAddress(S2)!
+ expect(address).toEqual({ parentSessionId: S1, childSessionId: S2, mode: 'unknown' })
+ manager.resolveTarget(address)
+ const child = manager.get(S2)
+ expect(child.getSnapshot().subagent?.address.mode).toBe('unknown')
+ manager.handleControlFrame({ type: 'projection', sessionId: S2, key: 'subagent', seq: 0,
+ value: { seq: SessionSeq(0), mode: 'continuable', label: 'repaired child' } })
+ await child.open()
+ expect(child.getSnapshot().subagent?.address).toEqual({ ...address, mode: 'continuable' })
+ expect(manager.getListSnapshot().projectionsBySession[S1]?.values.subagentCatalog).toEqual(entries)
+ await manager.dispose()
+ })
+
it('publishes pushed membership without a catalog request or an instantiated parent', ({ mock, remote }) => {
const manager = makeManager(mock, remote)
manager.handleSessionAdded(summary(S2, { origin: 'subagent', parentSessionId: S1, running: true }))
diff --git a/packages/api/session-controller/tests/transport.host.spec.ts b/packages/api/session-controller/tests/transport.host.spec.ts
index 04b43972e9..341aaf4e86 100644
--- a/packages/api/session-controller/tests/transport.host.spec.ts
+++ b/packages/api/session-controller/tests/transport.host.spec.ts
@@ -451,6 +451,16 @@ describe('SessionHistoryController', () => {
}, signal)).resolves.toMatchObject({
records: [{ type: 'event', event: { type: 'subagent/descriptor' } }],
})
+ await expect(transport.page({
+ address: { kind: 'subagent', parentSessionId, childSessionId, mode: 'unknown' },
+ throughSeq: 0,
+ }, signal)).resolves.toMatchObject({
+ records: [{ type: 'event', event: { type: 'subagent/descriptor' } }],
+ })
+ await expect(transport.page({
+ address: { kind: 'subagent', parentSessionId: SessionId('other-parent'), childSessionId, mode: 'unknown' },
+ throughSeq: 0,
+ }, signal)).rejects.toMatchObject({ code: 'subagent/unauthorized' })
await expect(transport.page({
address: {
kind: 'subagent',
diff --git a/packages/boot/app-boot/README.i18n.yaml b/packages/boot/app-boot/README.i18n.yaml
index aed223888a..98b11724ed 100644
--- a/packages/boot/app-boot/README.i18n.yaml
+++ b/packages/boot/app-boot/README.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/boot/app-boot/README.md
-README.md: 8439fb9ec1173ba24f9775ac476e64d23534a594
-README.zh.md: 0bb8c9819dacabed01905f6b7aff8c770ea3caae
+README.md: 6f24c46485abe3761994ef7aacbea90840e01bfb
+README.zh.md: b3a8aaa2746848bcc347291dad27f015e8a004e3
diff --git a/packages/boot/app-boot/README.md b/packages/boot/app-boot/README.md
index 8439fb9ec1..6f24c46485 100644
--- a/packages/boot/app-boot/README.md
+++ b/packages/boot/app-boot/README.md
@@ -68,7 +68,7 @@ Before you boot, you can print the exact configuration the app will mount: the d
### Reading plugin display metadata
-Use `readPluginMeta(specifier, parentURL)` or `ctx.pluginPackages.metaOf(specifier, parentURL)` to read installed package display text without importing or activating the plugin. Lookup uses the complete package specifier and the caller's resolution base, respecting Node exports. File paths and file URLs return no metadata without resolving resources. Missing locale fields fall back to the accessible `package.json` at that address; malformed metadata returns an `error` diagnostic. Results retain translations for Client-side language selection. See [Plugin display metadata](../../../docs/cookbook/adding-a-package.md#plugin-display-metadata) for the author format.
+Use `readPluginMeta(specifier, parentURL)` or `ctx.pluginPackages.metaOf(specifier, parentURL)` to read installed package display text without importing or activating the plugin. Lookup uses the complete package specifier and the caller's resolution base, respecting Node exports. File paths and file URLs return no metadata without resolving resources. Missing locale fields fall back to the accessible `package.json` at that address; malformed metadata returns an `error` diagnostic. Results retain translations for Client-side language selection. The reader also loads `package.json.icon` as an image data URL, even when locale text is complete; an icon error preserves valid text alongside the diagnostic. See [Plugin display metadata](../../../docs/cookbook/adding-a-package.md#plugin-display-metadata) for the author format.
### Startup and reload failures
diff --git a/packages/boot/app-boot/README.zh.md b/packages/boot/app-boot/README.zh.md
index 0bb8c9819d..b3a8aaa274 100644
--- a/packages/boot/app-boot/README.zh.md
+++ b/packages/boot/app-boot/README.zh.md
@@ -68,7 +68,7 @@ profile 是同一套 dsh 安装提供不同应用界面的方式:`web`、`head
### 读取插件展示元信息
-使用 `readPluginMeta(specifier, parentURL)` 或 `ctx.pluginPackages.metaOf(specifier, parentURL)` 读取已安装包的展示文本,无需导入或激活插件。查询使用完整包标识与调用方的解析基准,并遵循 Node exports。文件路径与文件 URL 不解析资源,直接返回无元信息。缺失的 locale 字段回退到该地址下可访问的 `package.json`;格式错误的元信息返回 `error` 诊断。结果保留翻译,由 Client 选择语言。作者格式见[插件展示元信息](../../../docs/cookbook/adding-a-package.zh.md#plugin-display-metadata)。
+使用 `readPluginMeta(specifier, parentURL)` 或 `ctx.pluginPackages.metaOf(specifier, parentURL)` 读取已安装包的展示文本,无需导入或激活插件。查询使用完整包标识与调用方的解析基准,并遵循 Node exports。文件路径与文件 URL 不解析资源,直接返回无元信息。缺失的 locale 字段回退到该地址下可访问的 `package.json`;格式错误的元信息返回 `error` 诊断。结果保留翻译,由 Client 选择语言。即使 locale 文本完整,读取器也会将 `package.json.icon` 加载为图片 data URL;图标出错时,保留有效文本并附上诊断。作者格式见[插件展示元信息](../../../docs/cookbook/adding-a-package.zh.md#plugin-display-metadata)。
### 启动与重载失败
diff --git a/packages/boot/app-boot/src/package-meta.ts b/packages/boot/app-boot/src/package-meta.ts
index 434b233d1e..131082ce8a 100644
--- a/packages/boot/app-boot/src/package-meta.ts
+++ b/packages/boot/app-boot/src/package-meta.ts
@@ -1,7 +1,7 @@
-/** Read plugin display metadata through exported locale resources without evaluating plugin code. */
+/** Read plugin display text and icons through exported resources without evaluating plugin code. */
-import { readdirSync, readFileSync } from 'node:fs'
-import { dirname } from 'node:path'
+import { readdirSync, readFileSync, realpathSync, statSync } from 'node:fs'
+import { dirname, extname, isAbsolute, relative, resolve, sep, win32 } from 'node:path'
import { fileURLToPath } from 'node:url'
import { ModuleLoader } from '@deepseek-ai/cordis-plugin-loader'
import type { LocalizedText, PluginLocalizedMeta } from '@deepseek-ai/dsh-package-manifest'
@@ -11,6 +11,35 @@ const LANGUAGE_ID = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/u
type DisplayFields = Record<'title' | 'description', string | undefined>
+/** Maximum raw icon bytes admitted to plugin metadata. */
+const MAX_ICON_BYTES = 256 * 1024
+const ICON_MEDIA_TYPES = new Map([
+ ['.svg', 'image/svg+xml'], ['.png', 'image/png'], ['.jpg', 'image/jpeg'],
+ ['.jpeg', 'image/jpeg'], ['.webp', 'image/webp'],
+])
+
+function iconOf(value: unknown, manifestPath: string): string | undefined {
+ const icon = textOf(value, `${manifestPath}: icon`)
+ if (icon === undefined) return undefined
+ if (isAbsolute(icon) || win32.isAbsolute(icon) || /^[A-Za-z][A-Za-z\d+.-]*:/u.test(icon)) {
+ throw new Error(`${manifestPath}: icon must be a relative file path`)
+ }
+ const mediaType = ICON_MEDIA_TYPES.get(extname(icon).toLowerCase())
+ if (mediaType === undefined) throw new Error(`${manifestPath}: icon must be SVG, PNG, JPEG, or WebP`)
+ const directory = realpathSync(dirname(manifestPath))
+ const file = realpathSync(resolve(directory, icon))
+ const local = relative(directory, file)
+ if (local === '..' || local.startsWith(`..${sep}`) || isAbsolute(local)) {
+ throw new Error(`${manifestPath}: icon must remain inside its manifest directory`)
+ }
+ const stat = statSync(file)
+ if (!stat.isFile()) throw new Error(`${manifestPath}: icon must be a regular file`)
+ if (stat.size > MAX_ICON_BYTES) throw new Error(`${manifestPath}: icon exceeds 256 KiB`)
+ const bytes = readFileSync(file)
+ if (bytes.length > MAX_ICON_BYTES) throw new Error(`${manifestPath}: icon exceeds 256 KiB`)
+ return `data:${mediaType};base64,${bytes.toString('base64')}`
+}
+
/**
* Resolve a plugin resource through the active Node ESM resolver without evaluating it.
* @param specifier - complete resource module specifier, including its locale filename.
@@ -104,7 +133,9 @@ function localizedText(
}
/**
- * Read meta.title and meta.description from a plugin's exported locale JSON files.
+ * Read localized display text and the icon declared in a plugin's exported package.json.
+ * Icons are manifest-relative SVG, PNG, JPEG, or WebP files of at most 256 KiB,
+ * contained in the manifest directory after realpath resolution. Icon failures retain display text.
* Non-package specifiers are skipped without invoking the resource resolver.
* Language files share the directory containing the resolved English resource;
* each file is resolved through the complete plugin specifier before reading.
@@ -112,25 +143,29 @@ function localizedText(
* maps retain an English fallback, ultimately the full module specifier for titles and empty for descriptions.
* @param specifier - configured plugin module name, including any package subpath.
* @param parentURL - owning Loader tree's module-resolution base.
- * @returns translated or fallback fields, a diagnostic, or undefined for non-package specifiers or absent display text.
+ * @returns display fields and any icon diagnostic, or undefined for non-package specifiers or absent metadata.
*/
export function readPluginMeta(specifier: string, parentURL: string): PluginLocalizedMeta | undefined {
if (barePackageName(specifier) === undefined) return undefined
try {
const englishPath = optionalResourcePath(`${specifier}/locale/en.json`, parentURL)
const dictionaries = englishPath === undefined ? new Map() : dictionariesOf(englishPath, specifier, parentURL)
- const english = dictionaries.get('en')
- const manifestPath = english?.title === undefined || english.description === undefined
- ? optionalResourcePath(`${specifier}/package.json`, parentURL)
- : undefined
+ const manifestPath = optionalResourcePath(`${specifier}/package.json`, parentURL)
const manifest = manifestPath === undefined ? undefined : readObject(manifestPath)
const title = localizedText('title', dictionaries, fallbackText(manifest?.name), specifier)
const description = localizedText('description', dictionaries, fallbackText(manifest?.description), '')
- if (title === undefined && description === undefined) return undefined
- return {
+ const text = {
...title === undefined ? {} : { title },
...description === undefined ? {} : { description },
}
+ let icon: string | undefined
+ try {
+ icon = manifestPath === undefined ? undefined : iconOf(manifest?.icon, manifestPath)
+ } catch (error) {
+ return { ...text, error: `Plugin metadata for ${specifier}: ${String(error)}` }
+ }
+ if (title === undefined && description === undefined && icon === undefined) return undefined
+ return { ...text, ...icon === undefined ? {} : { icon } }
} catch (error) {
return { error: `Plugin metadata for ${specifier}: ${String(error)}` }
}
diff --git a/packages/boot/app-boot/tests/package-meta.spec.ts b/packages/boot/app-boot/tests/package-meta.spec.ts
index 07b9af374b..73484f7db9 100644
--- a/packages/boot/app-boot/tests/package-meta.spec.ts
+++ b/packages/boot/app-boot/tests/package-meta.spec.ts
@@ -1,6 +1,6 @@
/** Plugin locale resources resolve independently of entry execution and package display fields. */
-import fs, { mkdirSync, mkdtempSync, readdirSync, rmSync, writeFileSync } from 'node:fs'
+import fs, { mkdirSync, mkdtempSync, readdirSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from 'node:fs'
import { syncBuiltinESMExports } from 'node:module'
import { tmpdir } from 'node:os'
import { dirname, join } from 'node:path'
@@ -161,15 +161,122 @@ describe('plugin locale display metadata', () => {
expect(readPluginMeta('localized', parentURL)?.error).toContain('meta.title must be a non-empty string')
})
- it('does not inspect package fallback when both English fields are supplied', () => {
- manifest({ './locale/*.json': './locale/*.json', './package.json': './fallback.json' })
- file(join(dir, 'fallback.json'), '{')
+ it('reads the manifest icon even when both English fields are supplied', () => {
+ manifest({ './locale/*.json': './locale/*.json', './package.json': './package.json' }, { icon: './art/team.svg' })
+ file(join(dir, 'art', 'team.svg'), '')
dictionary('en', { meta: { title: 'Plugin', description: 'Locale introduction' } })
expect(readPluginMeta('localized', parentURL)).toEqual({
title: { en: 'Plugin' }, description: { en: 'Locale introduction' },
+ icon: `data:image/svg+xml;base64,${Buffer.from('').toString('base64')}`,
})
})
+ it.each([
+ ['svg', 'image/svg+xml'], ['png', 'image/png'], ['jpg', 'image/jpeg'],
+ ['jpeg', 'image/jpeg'], ['webp', 'image/webp'], ['SVG', 'image/svg+xml'],
+ ])('encodes a package-local %s icon without executing the plugin', (extension, mediaType) => {
+ manifest({ '.': './index.js', './package.json': './package.json' }, { icon: `./icon.${extension}` })
+ const bytes = Buffer.from([0, 1, 127, 128, 255])
+ writeFileSync(join(dir, `icon.${extension}`), bytes)
+ expect(readPluginMeta('localized', parentURL)).toEqual({
+ title: 'localized', icon: `data:${mediaType};base64,${bytes.toString('base64')}`,
+ })
+ })
+
+ it('reads an icon-only subexport relative to its own manifest without inheriting the package icon', () => {
+ manifest({ './package.json': './package.json', './search/package.json': './search/manifest.json' }, { icon: './root.png' })
+ file(join(dir, 'root.png'), 'root')
+ file(join(dir, 'search', 'manifest.json'), JSON.stringify({ icon: './icon.webp' }))
+ file(join(dir, 'search', 'icon.webp'), 'search')
+ expect(readPluginMeta('localized/search', parentURL)).toEqual({
+ icon: `data:image/webp;base64,${Buffer.from('search').toString('base64')}`,
+ })
+ expect(readPluginMeta('localized/review', parentURL)).toBeUndefined()
+ })
+
+ it.each([null, false, 1, {}, [], '', ' '])('retains localized text while rejecting malformed icon %j', (icon) => {
+ manifest({ './locale/*.json': './locale/*.json', './package.json': './package.json' }, { icon })
+ dictionary('en', { meta: { title: 'Plugin', description: 'Introduction' } })
+ dictionary('zh', { meta: { title: '插件' } })
+ const { error, ...meta } = readPluginMeta('localized', parentURL)!
+ expect(meta).toEqual({ title: { en: 'Plugin', zh: '插件' }, description: { en: 'Introduction' } })
+ expect(error).toContain('icon must be a non-empty string')
+ })
+
+ it.each(['/tmp/icon.svg', 'C:\\icon.png', 'C:icon.png', '\\\\server\\share\\icon.png', 'https://example.test/icon.svg', 'data:image/svg+xml,'])('rejects non-relative icon %s', (icon) => {
+ manifest({ './package.json': './package.json' }, { icon, description: 'Introduction' })
+ const { error, ...meta } = readPluginMeta('localized', parentURL)!
+ expect(meta).toEqual({ title: 'localized', description: 'Introduction' })
+ expect(error).toContain('icon must be a relative file path')
+ })
+
+ it.each(['icon.gif', 'icon.html', 'icon', 'icon.svg?query'])('rejects unsupported icon file %s', (icon) => {
+ manifest({ './package.json': './package.json' }, { icon })
+ expect(readPluginMeta('localized', parentURL)?.error).toContain('icon must be SVG, PNG, JPEG, or WebP')
+ })
+
+ it('reports missing files, directories, and paths outside the manifest directory', () => {
+ manifest({ './package.json': './package.json' }, { icon: './missing.svg' })
+ expect(readPluginMeta('localized', parentURL)?.error).toContain('missing.svg')
+ mkdirSync(join(dir, 'missing.svg'))
+ expect(readPluginMeta('localized', parentURL)?.error).toContain('icon must be a regular file')
+ manifest({ './package.json': './package.json' }, { icon: '../localized-other/icon.svg' })
+ file(join(root, 'node_modules', 'localized-other', 'icon.svg'), 'outside')
+ expect(readPluginMeta('localized', parentURL)?.error).toContain('icon must remain inside its manifest directory')
+ })
+
+ it('accepts an icon at the byte limit and rejects one byte more', () => {
+ manifest({ './package.json': './package.json' }, { icon: './icon.png' })
+ const bytes = Buffer.alloc(256 * 1024)
+ writeFileSync(join(dir, 'icon.png'), bytes)
+ expect(readPluginMeta('localized', parentURL)?.icon).toBe(`data:image/png;base64,${bytes.toString('base64')}`)
+ writeFileSync(join(dir, 'icon.png'), Buffer.alloc(bytes.length + 1))
+ expect(readPluginMeta('localized', parentURL)?.error).toContain('icon exceeds 256 KiB')
+ })
+
+ it('rejects an icon that grows beyond the limit after its size check', () => {
+ manifest({ './package.json': './package.json' }, { icon: './icon.png' })
+ const icon = join(dir, 'icon.png')
+ file(icon, 'small')
+ const original = fs.statSync
+ const stat = vi.spyOn(fs, 'statSync')
+ try {
+ stat.mockImplementation(new Proxy(original, {
+ apply(target, receiver: unknown, args: unknown[]): unknown {
+ const result: unknown = Reflect.apply(target, receiver, args)
+ if (String(args[0]).endsWith(join('localized', 'icon.png'))) writeFileSync(icon, Buffer.alloc(256 * 1024 + 1))
+ return result
+ },
+ }))
+ syncBuiltinESMExports()
+ expect(readPluginMeta('localized', parentURL)?.error).toContain('icon exceeds 256 KiB')
+ } finally {
+ stat.mockRestore()
+ syncBuiltinESMExports()
+ }
+ })
+
+ it('rejects icons reached through an external directory link and accepts internal links', () => {
+ manifest({ './package.json': './package.json' }, { icon: './art/icon.svg' })
+ const outside = join(root, 'outside')
+ file(join(outside, 'icon.svg'), 'outside')
+ const link = join(dir, 'art')
+ symlinkSync(outside, link, 'junction')
+ try {
+ expect(readPluginMeta('localized', parentURL)?.error).toContain('icon must remain inside its manifest directory')
+ } finally {
+ unlinkSync(link)
+ }
+ const inside = join(dir, 'images')
+ file(join(inside, 'icon.svg'), 'inside')
+ symlinkSync(inside, link, 'junction')
+ try {
+ expect(readPluginMeta('localized', parentURL)?.icon).toBe(`data:image/svg+xml;base64,${Buffer.from('inside').toString('base64')}`)
+ } finally {
+ unlinkSync(link)
+ }
+ })
+
it('keeps separate plugin exports independent even when their JavaScript entries share a directory', () => {
manifest({
'./search': './lib/search.js', './review': './lib/review.js',
@@ -285,8 +392,9 @@ describe('plugin locale display metadata', () => {
})
const specifier = 'localized/locale/en.json'
expect(resolveSync.mock.calls).toEqual(version === 'v1'
- ? [[specifier, parentURL, {}], [specifier, parentURL, {}]]
- : [[parentURL, { specifier, attributes: {} }], [parentURL, { specifier, attributes: {} }]])
+ ? [[specifier, parentURL, {}], [specifier, parentURL, {}], ['localized/package.json', parentURL, {}]]
+ : [[parentURL, { specifier, attributes: {} }], [parentURL, { specifier, attributes: {} }],
+ [parentURL, { specifier: 'localized/package.json', attributes: {} }]])
})
it('rejects case-equivalent language names in a directory listing', () => {
diff --git a/packages/bundle/web-app/cordis.patch.yml b/packages/bundle/web-app/cordis.patch.yml
index 1f4d203152..72f81ef676 100644
--- a/packages/bundle/web-app/cordis.patch.yml
+++ b/packages/bundle/web-app/cordis.patch.yml
@@ -233,9 +233,10 @@
- id: ui-sidebar-documentpreview
name: '@deepseek-ai/dsh-client-ui-sidebar-documentpreview'
- # Sandboxed HTTP(S) Browser tabs, including loopback targets.
+ # Web profiles opt in; Desktop retains sandboxed HTTP(S) Browser tabs.
- id: ui-sidebar-browser
name: '@deepseek-ai/dsh-client-ui-sidebar-browser'
+ disabled: !!js "ctx.get('profileContext')?.name !== 'desktop'"
- id: ui-sidebar-terminal
name: '@deepseek-ai/dsh-client-ui-sidebar-terminal'
diff --git a/packages/bundle/web-app/tests/browser-defaults.spec.ts b/packages/bundle/web-app/tests/browser-defaults.spec.ts
new file mode 100644
index 0000000000..73ee9b1a82
--- /dev/null
+++ b/packages/bundle/web-app/tests/browser-defaults.spec.ts
@@ -0,0 +1,41 @@
+/** Profile defaults and explicit overrides for the shipped Browser entry. */
+import { fileURLToPath } from 'node:url'
+import { Context } from '@deepseek-ai/cordis'
+import Loader from '@deepseek-ai/cordis-plugin-loader'
+import { applyEntryPatches } from '@deepseek-ai/cordis-plugin-include'
+import { loadOverlayPatches } from '@deepseek-ai/dsh-app-boot'
+import * as Browser from '@deepseek-ai/dsh-client-ui-sidebar-browser'
+import { expect, it, onTestFinished } from 'vitest'
+
+it.each([
+ { profile: 'web', override: undefined, disabled: true },
+ { profile: 'custom-web', override: undefined, disabled: true },
+ { profile: undefined, override: undefined, disabled: true },
+ { profile: 'desktop', override: undefined, disabled: false },
+ { profile: 'web', override: false, disabled: false },
+ { profile: 'desktop', override: true, disabled: true },
+])('applies Browser availability for $profile with override $override', async ({ profile, override, disabled }) => {
+ const rows = loadOverlayPatches('browser-defaults', fileURLToPath(new URL('../cordis.patch.yml', import.meta.url)))
+ .flatMap(patch => patch.insert ?? []).filter(row => row.id === 'ui-sidebar-browser')
+ expect(rows).toHaveLength(1)
+ expect(rows[0]!.name).toBe('@deepseek-ai/dsh-client-ui-sidebar-browser')
+ const configured = applyEntryPatches(rows, override === undefined ? [] : [{ id: 'ui-sidebar-browser', disabled: override }],
+ (message) => { throw new Error(message) })
+ const ctx = new Context()
+ onTestFinished(() => ctx.fiber.dispose())
+ if (profile !== undefined) {
+ ctx.provide('profileContext', {
+ name: profile, dir: '/profile', patchPath: '/profile/cordis.patch.yml', installAnchor: '/profile/package.json',
+ cwd: '/workspace', home: '/home', startedBundles: [], overlays: [], telemetryDisabledEnv: undefined,
+ })
+ }
+ ctx.baseUrl = 'file:///'
+ await ctx.plugin(Loader).await()
+ // Keep the real companion in the source-plane loader without native package resolution.
+ ctx.loader.builtins.browser = Browser
+ await ctx.loader.root.update([{ ...configured[0]!, name: 'cordis:browser' }])
+ await ctx.loader.await()
+ const entry = ctx.loader.resolve('ui-sidebar-browser')
+ expect(entry.disabled).toBe(disabled)
+ expect(entry.fiber !== undefined).toBe(!disabled)
+})
diff --git a/packages/client/hmr/README.i18n.yaml b/packages/client/hmr/README.i18n.yaml
index 07ad3d545d..f6861208ea 100644
--- a/packages/client/hmr/README.i18n.yaml
+++ b/packages/client/hmr/README.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/hmr/README.md
-README.md: e459da10332ffdb3af422b75f639ce25df512487
-README.zh.md: 54e2f3af63472dedbfc75c5b4400b5d93e14f311
+README.md: 5dae1463ceed315c3409bf97de80649f10e83fa8
+README.zh.md: a77befcf63cd78be66b7e5b636d86367af6fdcdf
diff --git a/packages/client/hmr/README.md b/packages/client/hmr/README.md
index e459da1033..5dae1463ce 100644
--- a/packages/client/hmr/README.md
+++ b/packages/client/hmr/README.md
@@ -29,7 +29,7 @@ The shipped Web composition mounts this transport for live plugin changes. Durin
### Starting the reload chain
-Run `pnpm run dev:web` (or a watch process using the shared Client tsdown preset) against the same host; rebuilt plugins are then swapped into the running browser automatically, one at a time. The preset stamps `lib/client.js` after all package-local chunks are written, so a chunk-only rebuild also advances the package revision without Host-side chunk scanning.
+Run `pnpm run dev:web`, which starts the host and the rebuild watchers together (`--no-serve` attaches only the watchers to a host started elsewhere, as does any watch process using the shared Client tsdown preset); rebuilt plugins are then swapped into the running browser automatically, one at a time. The preset stamps `lib/client.js` after all package-local chunks are written, so a chunk-only rebuild also advances the package revision without Host-side chunk scanning.
### What a reload does
diff --git a/packages/client/hmr/README.zh.md b/packages/client/hmr/README.zh.md
index 54e2f3af63..a77befcf63 100644
--- a/packages/client/hmr/README.zh.md
+++ b/packages/client/hmr/README.zh.md
@@ -29,7 +29,7 @@ kind: "package-reference"
### 启动重载链路
-对同一个宿主运行 `pnpm run dev:web`(或使用共享 Client tsdown 预设的 watch 进程);重建后的插件随后会被自动逐个替换进运行中的浏览器。该预设会在所有包内 chunk 写完后标记 `lib/client.js`,因此仅 chunk 发生重建也会推进包 revision,无需 Host 扫描 chunk。
+运行 `pnpm run dev:web`,它会同时启动宿主与重建 watcher(`--no-serve` 则只把 watcher 接到别处启动的宿主上,使用共享 Client tsdown 预设的任何 watch 进程亦然);重建后的插件随后会被自动逐个替换进运行中的浏览器。该预设会在所有包内 chunk 写完后标记 `lib/client.js`,因此仅 chunk 发生重建也会推进包 revision,无需 Host 扫描 chunk。
### 一次重载做什么
diff --git a/packages/client/ui-chat/README.i18n.yaml b/packages/client/ui-chat/README.i18n.yaml
index c42928d650..7d9e60da65 100644
--- a/packages/client/ui-chat/README.i18n.yaml
+++ b/packages/client/ui-chat/README.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/ui-chat/README.md
-README.md: b916802917bfdd406fb333174371507d466b8e19
-README.zh.md: 01de4d633cb1501a03200aa96f72e89622d0a7d8
+README.md: eea8eeda01c3d0bd30669cdf3743c64be0d76fbe
+README.zh.md: 58fef8e8c47ae5f67c8ecbf614a36bbfbf2e20b3
diff --git a/packages/client/ui-chat/README.md b/packages/client/ui-chat/README.md
index b916802917..eea8eeda01 100644
--- a/packages/client/ui-chat/README.md
+++ b/packages/client/ui-chat/README.md
@@ -32,7 +32,7 @@ File-mention providers receive the viewed Session ID with the closing-turn owner
Chat supplies file and HTTP(S) navigation through one `MarkdownDelegateProvider` around its node list. Assistant Markdown file links open in the right Sidebar after the message settles, including references to unmodified files. Relative paths resolve in the viewed Session's workspace; absolute paths retain the same Session's filesystem access. `#L24` and `#L24-L30` navigate to the first specified line and reuse an existing file tab. Missing files show the preview's error state.
-HTTP(S) links in Assistant Markdown open a new right-Sidebar Browser tab on ordinary clicks when that type is registered, or the system browser otherwise; modified clicks retain the native external-link behavior. Sent file references and skills confirmed by the message’s logged invocation also open in the right Sidebar. File paths use the viewed Session; skill names resolve through its current input-trigger source. Both use the prose file-link dotted underline on hover or focus. Sessions, directories, and command labels remain non-navigating references.
+Settings → General → Open chat links in selects the destination for ordinary clicks on Chat HTTP(S) links: Built-in browser (default) opens a new right-Sidebar Browser tab, while New browser tab opens an external tab. The setting is shown only while the built-in browser is available. If the Sidebar Browser is not registered, both choices use the external browser; modified clicks retain native behavior. The `ui-chat.linkOpening` preference persists on loopback browsers and stays process-local when settings cannot persist writes. Sent file references and skills confirmed by the message’s logged invocation also open in the right Sidebar. File paths use the viewed Session; skill names resolve through its current input-trigger source. Both use the prose file-link dotted underline on hover or focus. Sessions, directories, and command labels remain non-navigating references.
## System prompt row
diff --git a/packages/client/ui-chat/README.zh.md b/packages/client/ui-chat/README.zh.md
index 01de4d633c..58fef8e8c4 100644
--- a/packages/client/ui-chat/README.zh.md
+++ b/packages/client/ui-chat/README.zh.md
@@ -32,7 +32,7 @@ kind: "package-reference"
Chat 在节点列表外通过一个 `MarkdownDelegateProvider` 提供文件及 HTTP(S) 导航。Assistant Markdown 文件链接在消息落定后可于右侧栏打开,包括未修改文件的引用。相对路径基于当前查看的 Session 工作区解析;绝对路径仍使用同一 Session 的文件系统访问。`#L24` 和 `#L24-L30` 定位到指定起始行,并复用现有文件标签。文件缺失时显示预览错误状态。
-Assistant Markdown 中的 HTTP(S) 链接在普通点击时会在该类型已注册时打开新的右侧 Sidebar Browser tab,否则改用系统浏览器;带修饰键的点击保留原生外部链接行为。已发送的文件引用及消息日志确认调用的 skill 也可在右侧栏打开预览。文件路径使用当前查看的 Session;skill 名称由该 Session 当前的输入触发源解析。两者悬停或聚焦时均使用正文文件链接的虚线下划线。会话、目录和命令标签仍只作为引用展示。
+设置 → 通用设置 → 聊天链接打开方式控制普通点击 Chat HTTP(S) 链接时的目标:「内置浏览器」(默认)打开新的右侧 Sidebar Browser tab,「浏览器新标签页」打开外部标签页。该设置项仅在内置浏览器可用时显示。若 Sidebar Browser 未注册,两种选择均使用外部浏览器;带修饰键的点击保留原生行为。`ui-chat.linkOpening` 偏好在回环地址浏览器中持久化,设置无法持久化写入时仅在当前进程内生效。已发送的文件引用及消息日志确认调用的 skill 也可在右侧栏打开预览。文件路径使用当前查看的 Session;skill 名称由该 Session 当前的输入触发源解析。两者悬停或聚焦时均使用正文文件链接的虚线下划线。会话、目录和命令标签仍只作为引用展示。
## 系统提示词行
diff --git a/packages/client/ui-chat/src/chat-settings.ts b/packages/client/ui-chat/src/chat-settings.ts
index dbf9014320..021a2b0616 100644
--- a/packages/client/ui-chat/src/chat-settings.ts
+++ b/packages/client/ui-chat/src/chat-settings.ts
@@ -26,16 +26,25 @@ export type PerformanceUsageMode = typeof PERFORMANCE_USAGE_MODES[number]
/** Preserve detailed accounting for users without an explicit preference. */
export const DEFAULT_PERFORMANCE_USAGE: PerformanceUsageMode = 'detailed'
+/** Destinations for ordinary clicks on Chat HTTP(S) links. */
+export type LinkOpening = 'sidebar' | 'new-tab'
+
+/** Preserve the built-in browser for users without an explicit preference. */
+export const DEFAULT_LINK_OPENING: LinkOpening = 'sidebar'
+
/** Durable Chat section shared by the Host schema and browser scope. */
export interface ChatSettings {
/** Presentation mode for completed Turn process content. */
transcriptView: TranscriptViewMode
/** Detail level for composer statistics and completed-Turn usage. */
performanceUsage: PerformanceUsageMode
+ /** Default destination for Chat HTTP(S) links. */
+ linkOpening: LinkOpening
}
/** Durable Chat schema; also the wire envelope the browser scope validates against. */
export const ChatSettingsSchema: z = z.object({
+ linkOpening: z.union(['sidebar', 'new-tab']).default(DEFAULT_LINK_OPENING),
performanceUsage: z.union([...PERFORMANCE_USAGE_MODES]).default(DEFAULT_PERFORMANCE_USAGE),
[TRANSCRIPT_VIEW_FIELD]: z.union([...TRANSCRIPT_VIEW_MODES]).default(DEFAULT_TRANSCRIPT_VIEW_MODE),
})
diff --git a/packages/client/ui-chat/src/client/apply.ts b/packages/client/ui-chat/src/client/apply.ts
index 21a63ab782..079a5e2512 100644
--- a/packages/client/ui-chat/src/client/apply.ts
+++ b/packages/client/ui-chat/src/client/apply.ts
@@ -3,7 +3,7 @@ import type { Context } from '@deepseek-ai/cordis'
import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment'
import type {} from '@deepseek-ai/dsh-api-remotes/client'
import type { SessionBinding } from '@deepseek-ai/dsh-api-session-controller/client'
-import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
+import { createSnapshotStore, type ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
import type { SessionId } from '@deepseek-ai/dsh-session/types'
import type {} from '@deepseek-ai/dsh-client-ui-sidebar-right/client'
import type {} from '@deepseek-ai/dsh-client-ui-sidebar-browser/client'
@@ -34,7 +34,8 @@ import { en, NS, zh } from './locale.ts'
import { TranscriptViewRow, type TranscriptViewRowInjected } from './settings/TranscriptViewRow.tsx'
import { createChatStore } from './stores.ts'
import { TranscriptViewPolicy } from './transcript-view.ts'
-import { CHAT_SETTINGS_NAMESPACE, type ChatSettings } from '../chat-settings.ts'
+import { CHAT_SETTINGS_NAMESPACE, DEFAULT_LINK_OPENING, type ChatSettings } from '../chat-settings.ts'
+import { LinkOpeningRow, type LinkOpeningRowInjected } from './settings/LinkOpeningRow.tsx'
import { PerformanceUsageRow, type PerformanceUsageRowInjected } from './settings/PerformanceUsageRow.tsx'
import { PerformanceUsagePolicy } from './performance-usage.ts'
import { useTurnDataValue } from './chat/use-turn-data.ts'
@@ -82,6 +83,33 @@ export function apply(ctx: Context): void {
const chatStore = createChatStore()
const chatScrollPositions = new Map()
const chatSettings = ctx.settingsScope.bind({ namespace: CHAT_SETTINGS_NAMESPACE })
+ const linkOpening = createSnapshotStore(chatSettings.getSnapshot().value?.linkOpening ?? DEFAULT_LINK_OPENING)
+ ctx.effect(() => chatSettings.subscribe(() => {
+ const accepted = chatSettings.getSnapshot().value?.linkOpening
+ if (accepted !== undefined) linkOpening.set(accepted)
+ }))
+ ctx.inject(['sidebarRightTabs'], (scope) => {
+ const tabs = scope.sidebarRightTabs
+ const browserAvailable: ObservableSnapshot = {
+ getSnapshot: () => tabs.get('browser') !== undefined,
+ subscribe: listener => tabs.subscribe(listener),
+ }
+ scope.slots.inject('settings.general.item', () => scope.slots.register({
+ name: 'settings.general.item',
+ id: 'link-opening',
+ order: 14,
+ locale: NS,
+ inject: (): LinkOpeningRowInjected => ({
+ hooks: { linkOpening, browserAvailable },
+ setLinkOpening: (destination) => {
+ linkOpening.set(destination)
+ void chatSettings.set('linkOpening', destination).catch((_error: unknown) => {
+ // The local choice remains usable when persistence is unavailable.
+ })
+ },
+ }),
+ }, LinkOpeningRow))
+ })
const transcriptView = new TranscriptViewPolicy(chatSettings)
const performancePolicy = new PerformanceUsagePolicy(chatSettings)
const performanceUsage = performancePolicy.mode
@@ -158,7 +186,7 @@ export function apply(ctx: Context): void {
ctx.get('inputTriggers')?.sessionOf(scope).openReference('skill', { ref: `/${name}` })
},
openExternalLink: (url) => {
- if (ctx.get('sidebarRightTabs')?.get('browser') !== undefined) {
+ if (linkOpening.getSnapshot() === 'sidebar' && ctx.get('sidebarRightTabs')?.get('browser') !== undefined) {
ctx.sidebarRight.openTab('browser', { params: { url } })
} else {
window.open(url, '_blank', 'noopener,noreferrer')
diff --git a/packages/client/ui-chat/src/client/contract/slots.ts b/packages/client/ui-chat/src/client/contract/slots.ts
index d5b007b7cf..5e811b7963 100644
--- a/packages/client/ui-chat/src/client/contract/slots.ts
+++ b/packages/client/ui-chat/src/client/contract/slots.ts
@@ -150,7 +150,7 @@ export interface ChatViewInjected {
}
/** Open the current source file of a skill referenced by a sent message. */
openSkill: (name: string) => void
- /** Open one HTTP(S) message link in a Sidebar Browser tab. */
+ /** Open one HTTP(S) message link at the selected destination, using an external tab if Sidebar Browser is unavailable. */
openExternalLink: (url: string) => void
openFile: (path: string, options?: OpenFileOptions) => Promise
loadOlder: () => void
diff --git a/packages/client/ui-chat/src/client/locale.ts b/packages/client/ui-chat/src/client/locale.ts
index 344fef13d0..51d3adca00 100644
--- a/packages/client/ui-chat/src/client/locale.ts
+++ b/packages/client/ui-chat/src/client/locale.ts
@@ -31,6 +31,10 @@ export const zh = {
'settings.performance.description': '选择性能与用量信息展示的详细程度',
'settings.performance.compact': '简洁',
'settings.performance.detailed': '详细',
+ 'settings.links.title': '聊天链接打开方式',
+ 'settings.links.description': '选择聊天中 HTTP(S) 链接的打开位置',
+ 'settings.links.sidebar': '内置浏览器',
+ 'settings.links.newTab': '浏览器新标签页',
'settings.transcript.title': '对话显示',
'settings.transcript.description': '控制已完成轮次的过程内容',
'settings.transcript.normal': '标准',
@@ -141,6 +145,10 @@ export const en = {
'settings.performance.description': 'Choose how much performance and usage information to show',
'settings.performance.compact': 'Compact',
'settings.performance.detailed': 'Detailed',
+ 'settings.links.title': 'Open chat links in',
+ 'settings.links.description': 'Choose where HTTP(S) links in chat open',
+ 'settings.links.sidebar': 'Built-in browser',
+ 'settings.links.newTab': 'New browser tab',
'settings.transcript.title': 'Conversation display',
'settings.transcript.description': 'Controls process content in completed turns',
'settings.transcript.normal': 'Normal',
diff --git a/packages/client/ui-chat/src/client/settings/LinkOpeningRow.tsx b/packages/client/ui-chat/src/client/settings/LinkOpeningRow.tsx
new file mode 100644
index 0000000000..b17a3e4929
--- /dev/null
+++ b/packages/client/ui-chat/src/client/settings/LinkOpeningRow.tsx
@@ -0,0 +1,47 @@
+/** General Settings row for Chat HTTP(S) link destinations. */
+import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
+import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
+import type { LinkOpening } from '../../chat-settings.ts'
+import { PreferenceRow } from './PreferenceRow.tsx'
+
+/** Registration-side link-opening preference. */
+export interface LinkOpeningRowInjected {
+ hooks: {
+ /** Current destination, bound as useLinkOpening. */
+ linkOpening: ObservableSnapshot
+ /** Whether the built-in browser is registered, bound as useBrowserAvailable. */
+ browserAvailable: ObservableSnapshot
+ }
+ /** Change the default destination for Chat HTTP(S) links. */
+ setLinkOpening: (destination: LinkOpening) => void
+}
+
+/** Full Settings-row props. */
+export type LinkOpeningRowProps =
+ PropsRuntime<'settings.general.item'>
+ & PropsLocale<'chat'>
+ & InjectFace
+
+/**
+ * Render the link-opening destination selector.
+ * @param props - Composed Settings slot props.
+ * @returns The preference row.
+ */
+export function LinkOpeningRow({ useLinkOpening, useBrowserAvailable, setLinkOpening, t }: LinkOpeningRowProps) {
+ const destination = useLinkOpening(value => value)
+ const browserAvailable = useBrowserAvailable(value => value)
+ if (!browserAvailable) return null
+ return (
+ { setLinkOpening(value as LinkOpening) }}
+ />
+ )
+}
diff --git a/packages/client/ui-chat/tests/apply-inject.client.spec.tsx b/packages/client/ui-chat/tests/apply-inject.client.spec.tsx
index 7977740640..dff3bbe376 100644
--- a/packages/client/ui-chat/tests/apply-inject.client.spec.tsx
+++ b/packages/client/ui-chat/tests/apply-inject.client.spec.tsx
@@ -19,6 +19,8 @@ import {
import { SessionSeq, type SessionId } from '@deepseek-ai/dsh-session/types'
import type { WorkspaceId } from '@deepseek-ai/dsh-workspace/types'
import { createChatStore } from '../src/client/stores.ts'
+import { CHAT_SETTINGS_NAMESPACE, type ChatSettings } from '../src/chat-settings.ts'
+import type { LinkOpeningRowInjected } from '../src/client/settings/LinkOpeningRow.tsx'
usePinnedBrowserLanguages('zh-CN')
@@ -47,9 +49,16 @@ function sessionFakeFor() {
} satisfies SessionBehaviorOverrides
}
-async function bench() {
+async function bench(initialSettings?: ChatSettings, withBrowserRegistry = true) {
const runtime = await SlotTestRuntime.create()
- runtime.ctx.provide('settingsScope', { developerTools: { enabled: createSnapshotStore(true) }, bind: () => stubSettingsScope().scope } as never)
+ const chatSettings = stubSettingsScope()
+ if (initialSettings !== undefined) chatSettings.publish({ value: initialSettings })
+ runtime.ctx.provide('settingsScope', {
+ developerTools: { enabled: createSnapshotStore(true) },
+ bind: ({ namespace }: { namespace: string }) => namespace === CHAT_SETTINGS_NAMESPACE
+ ? chatSettings.scope
+ : stubSettingsScope().scope,
+ } as never)
const layout = { closeRightbar: vi.fn(), openRightbar: vi.fn() }
runtime.ctx.provide('layout', layout as never)
const sidebarRight = {
@@ -57,11 +66,13 @@ async function bench() {
openTab: vi.fn<(kind: string, options?: unknown) => void>(),
}
runtime.ctx.provide('sidebarRight', sidebarRight as never)
+ const browserAvailable = createSnapshotStore(true)
const sidebarRightTabs = {
- get: vi.fn<(kind: string) => object | undefined>(() => ({})),
+ get: vi.fn<(kind: string) => object | undefined>(() => browserAvailable.getSnapshot() ? {} : undefined),
+ subscribe: (listener: () => void) => browserAvailable.subscribe(listener),
register: vi.fn(() => () => {}),
}
- runtime.ctx.provide('sidebarRightTabs', sidebarRightTabs as never)
+ if (withBrowserRegistry) runtime.ctx.provide('sidebarRightTabs', sidebarRightTabs as never)
runtime.ctx.provide('resources', { register: vi.fn(() => () => {}) } as never)
const openWorkspacePath = vi.fn(
() => Promise.resolve({ ok: true, value: { opened: true } }),
@@ -88,9 +99,10 @@ async function bench() {
runtime.slots.installLocale(locale)
await runtime.root.declare({
'main': { kind: 'keyed', scope: 'root' },
+ 'settings.general.item': { kind: 'list', scope: 'root' },
}, (_props: { renderSlot?: unknown }) => null)
await runtime.mount({ inject: [...injectConversation], apply: applyConversation })
- await runtime.mount({ inject: [...injectChat], apply: applyChat })
+ const chat = await runtime.mount({ inject: [...injectChat], apply: applyChat })
runtime.renderRoot()
const chatViewApi = (reference: SessionReference) => {
@@ -104,7 +116,13 @@ async function bench() {
return { instance, injected }
}
return {
- runtime, layout, openWorkspacePath, sidebarRight, sidebarRightTabs, session, chatViewApi, rootReference, openSession,
+ get linkPreference() {
+ const row = runtime.slots.entries('settings.general.item').find(entry => entry.options.id === 'link-opening')!
+ const preference: object = row.inject!()
+ return preference as LinkOpeningRowInjected
+ },
+ runtime, chat, chatSettings, browserAvailable,
+ layout, openWorkspacePath, sidebarRight, sidebarRightTabs, session, chatViewApi, rootReference, openSession,
}
}
@@ -184,6 +202,106 @@ describe('Chat inject API', () => {
}
})
+ it('applies restored and live link destinations without remounting the Chat view', async () => {
+ const settings: ChatSettings = { transcriptView: 'compact', performanceUsage: 'detailed', linkOpening: 'new-tab' }
+ const b = await bench(settings)
+ const open = vi.spyOn(window, 'open').mockImplementation(() => null)
+ try {
+ const { injected } = b.chatViewApi(b.rootReference)
+ const source = b.linkPreference.hooks.linkOpening
+ expect(source.getSnapshot()).toBe('new-tab')
+ injected.openExternalLink('https://example.test/restored')
+ expect(open).toHaveBeenLastCalledWith('https://example.test/restored', '_blank', 'noopener,noreferrer')
+ expect(b.sidebarRight.openTab).not.toHaveBeenCalled()
+
+ b.chatSettings.publish({ value: { ...settings, linkOpening: 'sidebar' } })
+ expect(source.getSnapshot()).toBe('sidebar')
+ injected.openExternalLink('http://example.test/live')
+ expect(b.sidebarRight.openTab).toHaveBeenLastCalledWith('browser', { params: { url: 'http://example.test/live' } })
+
+ b.linkPreference.setLinkOpening('new-tab')
+ expect(b.chatSettings.set).toHaveBeenCalledWith('linkOpening', 'new-tab')
+ injected.openExternalLink('http://example.test/selected')
+ expect(open).toHaveBeenLastCalledWith('http://example.test/selected', '_blank', 'noopener,noreferrer')
+
+ await b.chat.dispose()
+ expect(b.runtime.slots.entries('settings.general.item').some(row => row.options.id === 'link-opening')).toBe(false)
+ b.chatSettings.publish({ value: { ...settings, linkOpening: 'sidebar' } })
+ expect(source.getSnapshot()).toBe('new-tab')
+ } finally {
+ open.mockRestore()
+ await b.runtime.dispose()
+ }
+ })
+
+ it('follows browser registration and routes absent browsers externally', async () => {
+ const b = await bench()
+ const open = vi.spyOn(window, 'open').mockImplementation(() => null)
+ const available = b.linkPreference.hooks.browserAvailable
+ const changed = vi.fn()
+ const unsubscribe = available.subscribe(changed)
+ try {
+ const { injected } = b.chatViewApi(b.rootReference)
+ expect(available.getSnapshot()).toBe(true)
+ b.browserAvailable.set(false)
+ expect(available.getSnapshot()).toBe(false)
+ expect(changed).toHaveBeenCalledOnce()
+ injected.openExternalLink('https://example.test/disabled')
+ expect(open).toHaveBeenCalledWith('https://example.test/disabled', '_blank', 'noopener,noreferrer')
+ b.browserAvailable.set(true)
+ injected.openExternalLink('https://example.test/enabled')
+ expect(b.sidebarRight.openTab).toHaveBeenCalledWith('browser', { params: { url: 'https://example.test/enabled' } })
+ expect(b.linkPreference.hooks.linkOpening.getSnapshot()).toBe('sidebar')
+ } finally {
+ unsubscribe()
+ open.mockRestore()
+ await b.runtime.dispose()
+ }
+ })
+
+ it('keeps Chat available while the optional tab registry appears and leaves', async () => {
+ const b = await bench(undefined, false)
+ try {
+ expect(b.runtime.slots.entries('conversation.view')).toHaveLength(1)
+ expect(b.runtime.slots.entries('settings.general.item').some(row => row.options.id === 'link-opening')).toBe(false)
+ const registry = await b.runtime.mount({
+ apply(ctx) { ctx.provide('sidebarRightTabs', b.sidebarRightTabs as never) },
+ })
+ await vi.waitFor(() => {
+ expect(b.runtime.slots.entries('settings.general.item').some(row => row.options.id === 'link-opening')).toBe(true)
+ })
+ await registry.dispose()
+ expect(b.runtime.slots.entries('settings.general.item').some(row => row.options.id === 'link-opening')).toBe(false)
+ expect(b.runtime.slots.entries('conversation.view')).toHaveLength(1)
+ } finally {
+ await b.runtime.dispose()
+ }
+ })
+
+ it('keeps local link choices usable when settings cannot persist', async () => {
+ const b = await bench()
+ const open = vi.spyOn(window, 'open').mockImplementation(() => null)
+ try {
+ const { injected } = b.chatViewApi(b.rootReference)
+ b.chatSettings.publish({ mode: 'memory', status: 'unavailable' })
+ b.chatSettings.set.mockResolvedValueOnce(false)
+ b.linkPreference.setLinkOpening('new-tab')
+ b.chatSettings.publish({ value: undefined })
+ injected.openExternalLink('https://example.test/local')
+ expect(open).toHaveBeenCalledWith('https://example.test/local', '_blank', 'noopener,noreferrer')
+ expect(b.sidebarRight.openTab).not.toHaveBeenCalled()
+
+ b.chatSettings.set.mockRejectedValueOnce(new Error('settings unavailable'))
+ b.linkPreference.setLinkOpening('sidebar')
+ await Promise.resolve()
+ injected.openExternalLink('https://example.test/local-sidebar')
+ expect(b.sidebarRight.openTab).toHaveBeenCalledWith('browser', { params: { url: 'https://example.test/local-sidebar' } })
+ } finally {
+ open.mockRestore()
+ await b.runtime.dispose()
+ }
+ })
+
it('routes sent skill previews through the viewed Session source and tolerates an absent provider', async () => {
const b = await bench()
const { injected } = b.chatViewApi(b.rootReference)
diff --git a/packages/client/ui-chat/tests/chat-apply.client.spec.tsx b/packages/client/ui-chat/tests/chat-apply.client.spec.tsx
index 028752d24c..e085bba34e 100644
--- a/packages/client/ui-chat/tests/chat-apply.client.spec.tsx
+++ b/packages/client/ui-chat/tests/chat-apply.client.spec.tsx
@@ -47,7 +47,11 @@ async function bench() {
} as never)
runtime.ctx.provide('layout', { openRightbar: vi.fn(), closeRightbar: vi.fn() } as never)
runtime.ctx.provide('sidebarRight', { openResource: vi.fn(), openTab: vi.fn() } as never)
- runtime.ctx.provide('sidebarRightTabs', { register: vi.fn(() => () => {}) } as never)
+ runtime.ctx.provide('sidebarRightTabs', {
+ register: vi.fn(() => () => {}),
+ get: vi.fn(() => ({})),
+ subscribe: vi.fn(() => () => {}),
+ } as never)
runtime.ctx.provide('resources', { register: vi.fn(() => () => {}) } as never)
const openSession = vi.fn<(id: SessionId) => void>()
runtime.ctx.provide('uiWorkspace', {
@@ -94,7 +98,7 @@ describe('Chat apply wiring', () => {
expect(b.runtime.slots.entries('conversation.composer.dock').map(row => row.options.id))
.toEqual(['stats'])
expect(b.runtime.slots.entries('settings.general.item').map(row => row.options.id))
- .toEqual(['transcript-view', 'performance-usage', 'composer-enter'])
+ .toEqual(['transcript-view', 'performance-usage', 'link-opening', 'composer-enter'])
await b.runtime.dispose()
})
@@ -110,7 +114,7 @@ describe('Chat apply wiring', () => {
expect(b.chatSettings.set).toHaveBeenCalledWith('transcriptView', 'normal')
b.chatSettings.publish({
- status: 'ready', value: { transcriptView: 'compact', performanceUsage: 'detailed' }, revision: 1, writable: true,
+ status: 'ready', value: { linkOpening: 'sidebar', transcriptView: 'compact', performanceUsage: 'detailed' }, revision: 1, writable: true,
})
expect(face.hooks.transcriptView.getSnapshot()).toBe('compact')
await b.runtime.dispose()
@@ -123,7 +127,7 @@ describe('Chat apply wiring', () => {
expect(face.hooks.performanceUsage.getSnapshot()).toBe('detailed')
face.setPerformanceUsage('compact')
expect(b.chatSettings.set).toHaveBeenCalledWith('performanceUsage', 'compact')
- b.chatSettings.publish({ value: { transcriptView: 'compact', performanceUsage: 'compact' } })
+ b.chatSettings.publish({ value: { linkOpening: 'sidebar', transcriptView: 'compact', performanceUsage: 'compact' } })
expect(face.hooks.performanceUsage.getSnapshot()).toBe('compact')
for (const entry of [
b.runtime.slots.entries('conversation.composer.dock').find(entry => entry.options.id === 'stats')!,
diff --git a/packages/client/ui-chat/tests/chat-settings.client.spec.ts b/packages/client/ui-chat/tests/chat-settings.client.spec.ts
index ad5ae6ab89..d2c146c40d 100644
--- a/packages/client/ui-chat/tests/chat-settings.client.spec.ts
+++ b/packages/client/ui-chat/tests/chat-settings.client.spec.ts
@@ -21,14 +21,20 @@ describe('ui-chat Host settings', () => {
await fiber.await()
const ns = CHAT_SETTINGS_NAMESPACE
- expect(ctx.settings.get(ns)).toEqual({ transcriptView: DEFAULT_TRANSCRIPT_VIEW_MODE, performanceUsage: 'detailed' })
+ expect(ctx.settings.get(ns)).toEqual({ transcriptView: DEFAULT_TRANSCRIPT_VIEW_MODE, performanceUsage: 'detailed', linkOpening: 'sidebar' })
await ctx.settings.update(ns, { transcriptView: 'normal' })
- expect(ctx.settings.get(ns)).toEqual({ transcriptView: 'normal', performanceUsage: 'detailed' })
+ expect(ctx.settings.get(ns)).toEqual({ transcriptView: 'normal', performanceUsage: 'detailed', linkOpening: 'sidebar' })
await expect(ctx.settings.update(ns, { transcriptView: 'dense' })).rejects.toThrow()
await ctx.settings.update(ns, { performanceUsage: 'compact' })
expect(ctx.settings.get(ns)).toMatchObject({ performanceUsage: 'compact' })
await expect(ctx.settings.update(ns, { performanceUsage: 'hidden' })).rejects.toThrow()
+ await ctx.settings.update(ns, { linkOpening: 'new-tab' })
+ expect(ctx.settings.get(ns)).toMatchObject({ linkOpening: 'new-tab' })
+ await ctx.settings.update(ns, { linkOpening: 'sidebar' })
+ expect(ctx.settings.get(ns)).toMatchObject({ linkOpening: 'sidebar' })
+ await expect(ctx.settings.update(ns, { linkOpening: 'popup' })).rejects.toThrow()
+
await fiber.dispose()
expect(ctx.settings.describe().map(row => row.ns)).not.toContain(ns)
})
diff --git a/packages/client/ui-chat/tests/performance-usage.client.spec.ts b/packages/client/ui-chat/tests/performance-usage.client.spec.ts
index 00e862cfe6..54ddfdd1de 100644
--- a/packages/client/ui-chat/tests/performance-usage.client.spec.ts
+++ b/packages/client/ui-chat/tests/performance-usage.client.spec.ts
@@ -21,10 +21,10 @@ describe('PerformanceUsagePolicy', () => {
it('adopts accepted Host settings at construction and after updates', () => {
const host = stubSettingsScope()
- host.publish({ value: { transcriptView: 'normal', performanceUsage: 'compact' } })
+ host.publish({ value: { linkOpening: 'sidebar', transcriptView: 'normal', performanceUsage: 'compact' } })
const policy = new PerformanceUsagePolicy(host.scope)
expect(policy.mode.getSnapshot()).toBe('compact')
- host.publish({ value: { transcriptView: 'normal', performanceUsage: 'detailed' } })
+ host.publish({ value: { linkOpening: 'sidebar', transcriptView: 'normal', performanceUsage: 'detailed' } })
expect(policy.mode.getSnapshot()).toBe('detailed')
})
})
diff --git a/packages/client/ui-chat/tests/transcript-view-policy.client.spec.ts b/packages/client/ui-chat/tests/transcript-view-policy.client.spec.ts
index 84717bb5c0..ec8595496a 100644
--- a/packages/client/ui-chat/tests/transcript-view-policy.client.spec.ts
+++ b/packages/client/ui-chat/tests/transcript-view-policy.client.spec.ts
@@ -30,18 +30,18 @@ describe('TranscriptViewPolicy', () => {
const host = stubSettingsScope()
const policy = new TranscriptViewPolicy(host.scope)
- host.publish({ status: 'ready', value: { transcriptView: 'normal', performanceUsage: 'detailed' }, revision: 1, writable: true })
+ host.publish({ status: 'ready', value: { linkOpening: 'sidebar', transcriptView: 'normal', performanceUsage: 'detailed' }, revision: 1, writable: true })
expect(policy.mode.getSnapshot()).toBe('normal')
policy.setMode('normal')
expect(host.set).not.toHaveBeenCalled()
- host.publish({ value: { transcriptView: 'compact', performanceUsage: 'detailed' }, revision: 2 })
+ host.publish({ value: { linkOpening: 'sidebar', transcriptView: 'compact', performanceUsage: 'detailed' }, revision: 2 })
expect(policy.mode.getSnapshot()).toBe('compact')
})
it('adopts an accepted section standing at construction', () => {
const host = stubSettingsScope()
- host.publish({ status: 'ready', value: { transcriptView: 'normal', performanceUsage: 'detailed' }, revision: 1, writable: true })
+ host.publish({ status: 'ready', value: { linkOpening: 'sidebar', transcriptView: 'normal', performanceUsage: 'detailed' }, revision: 1, writable: true })
expect(new TranscriptViewPolicy(host.scope).mode.getSnapshot()).toBe('normal')
})
})
diff --git a/packages/client/ui-chat/tests/transcript-view-row.client.spec.tsx b/packages/client/ui-chat/tests/transcript-view-row.client.spec.tsx
index ca5aeb1e00..82c928ac97 100644
--- a/packages/client/ui-chat/tests/transcript-view-row.client.spec.tsx
+++ b/packages/client/ui-chat/tests/transcript-view-row.client.spec.tsx
@@ -1,6 +1,6 @@
// @vitest-environment jsdom
import { afterEach, describe, expect, it, vi } from 'vitest'
-import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
import type { SessionListState } from '@deepseek-ai/dsh-api-session-controller/client'
import type { WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client'
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
@@ -9,7 +9,8 @@ import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
import { bindSnapshotSelector, makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
import { TranscriptViewRow, type TranscriptViewRowProps } from '../src/client/settings/TranscriptViewRow.tsx'
import { PerformanceUsageRow } from '../src/client/settings/PerformanceUsageRow.tsx'
-import type { PerformanceUsageMode } from '../src/chat-settings.ts'
+import type { LinkOpening, PerformanceUsageMode } from '../src/chat-settings.ts'
+import { LinkOpeningRow } from '../src/client/settings/LinkOpeningRow.tsx'
import { en, zh } from '../src/client/locale.ts'
afterEach(cleanup)
@@ -80,6 +81,50 @@ describe('TranscriptViewRow', () => {
})
+describe('LinkOpeningRow', () => {
+ it('follows browser availability without clearing the saved destination', () => {
+ const b = mount()
+ const browserAvailable = createSnapshotStore(false)
+ const source = createSnapshotStore('new-tab')
+ render()
+ expect(screen.queryByText('Open chat links in')).toBeNull()
+ act(() => { browserAvailable.set(true) })
+ expect(screen.getByRole('button', { name: 'New browser tab' })).toBeDefined()
+ act(() => { browserAvailable.set(false) })
+ expect(screen.queryByText('Open chat links in')).toBeNull()
+ expect(source.getSnapshot()).toBe('new-tab')
+ })
+
+ it.each([
+ [en, 'Open chat links in', 'Built-in browser', 'New browser tab'],
+ [zh, '聊天链接打开方式', '内置浏览器', '浏览器新标签页'],
+ ] as const)('selects either destination using localized labels (%s)', (dictionary, title, sidebar, newTab) => {
+ const b = mount('compact', dictionary)
+ const source = createSnapshotStore('sidebar')
+ const setLinkOpening = vi.fn((destination: LinkOpening) => { source.set(destination) })
+ render()
+ expect(screen.getByText(title)).toBeDefined()
+ fireEvent.click(screen.getByRole('button', { name: sidebar }))
+ fireEvent.click(screen.getByRole('menuitem', { name: newTab }))
+ expect(setLinkOpening).toHaveBeenLastCalledWith('new-tab')
+ fireEvent.click(screen.getByRole('button', { name: newTab }))
+ fireEvent.click(screen.getByRole('menuitem', { name: sidebar }))
+ expect(setLinkOpening).toHaveBeenLastCalledWith('sidebar')
+ expect(screen.getByRole('button', { name: sidebar }).getAttribute('aria-expanded')).toBe('false')
+ expect(b.setTranscriptView).not.toHaveBeenCalled()
+ })
+})
+
describe('PerformanceUsageRow', () => {
it('selects compact statistics independently of conversation display', () => {
const b = mount()
diff --git a/packages/client/ui-plan/README.i18n.yaml b/packages/client/ui-plan/README.i18n.yaml
index 74be8bbf76..24fc6a38eb 100644
--- a/packages/client/ui-plan/README.i18n.yaml
+++ b/packages/client/ui-plan/README.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/ui-plan/README.md
-README.md: b6072cd7d75446a0a45abe4009273235e4ff4e1b
-README.zh.md: 44b5ce85ccd6250f30904f80b01ee083f804f1ce
+README.md: 96ecd3777ef0ce4ce6babd977eef055ad5c683ec
+README.zh.md: fb6eb850b868913bdccec175500ff4e26d7a2157
diff --git a/packages/client/ui-plan/README.md b/packages/client/ui-plan/README.md
index b6072cd7d7..96ecd3777e 100644
--- a/packages/client/ui-plan/README.md
+++ b/packages/client/ui-plan/README.md
@@ -51,7 +51,7 @@ Admission failures (`matched: false`, business errors, transport faults) surface
The chip occupies the conversation-declared `conversation.input.plan` single seat; the node half is an empty apply (the roster row). Reads ride the generic projection pair through the standard-kit `useProjection`: the effective target is `pending ? !active : active` — a folded host value, not client optimism, so an arriving frame corrects the chip either way. The seat's injected face carries one verb, `exitPlanMode`, which executes `/plan off` through `ctx.remote.commands.execute` and maps admission failures to an inline error line. The placeholder and hint text live in ui-conversation's `conversation` locale namespace and are shared verbatim with the claimed `/plan` command hint.
-Plan cards derive from native `tool/call` or PTC dispatch arguments through a Conversation Definition, with each invocation’s resolved Turn location. They contribute to the additive `conversation.chat.turnTail` list alongside file deliveries. The plan resource address identifies the invocation and its complete ordinary or direct-parent subagent Session address; its provider reads existing Session history, including older pages, without storing document text in sidebar layout. The question plugin owns the review action slot and supplies its request key, complete text, and optional invocation identity. The [decision](../../../.agents/notes/implemented/feature/2026-09-17-persistent-plan-cards.md) explains why review lifetime and document lifetime remain separate.
+Plan cards derive from native `tool/call` or PTC dispatch arguments through a Conversation Definition, with each invocation’s resolved Turn location. They contribute to the additive `conversation.chat.turnTail` list alongside file deliveries. The plan resource address identifies the invocation and its complete ordinary or direct-parent subagent Session address; its provider reads existing Session history, including older pages, without storing document text in sidebar layout. The question plugin owns the review action slot and supplies its request key, complete text, and optional invocation identity. The [decision](../../../.agents/notes/implemented/feature/2026-09-17-persistent-plan-cards.md) explains why review lifetime and document lifetime remain separate. Subagent plan addresses also preserve unknown mode so history reads can resolve the child descriptor.
diff --git a/packages/client/ui-plan/README.zh.md b/packages/client/ui-plan/README.zh.md
index 44b5ce85cc..fb6eb850b8 100644
--- a/packages/client/ui-plan/README.zh.md
+++ b/packages/client/ui-plan/README.zh.md
@@ -51,7 +51,7 @@ kind: "package-reference"
徽章占据 conversation 声明的 `conversation.input.plan` 单实例座位;node 半部是空 apply(roster 行)。读取经 standard-kit 的 `useProjection` 走通用投影对:有效目标是 `pending ? !active : active`——折叠的宿主值而非客户端乐观态,因此到达的帧无论哪个方向都会纠正徽章。座位注入面携带一个动词 `exitPlanMode`,经 `ctx.remote.commands.execute` 执行 `/plan off`,并把准入失败映射为一行内联错误。placeholder 与提示文案位于 ui-conversation 的 `conversation` locale 命名空间,与已认领 `/plan` 命令的提示逐字共用。
-计划卡片通过 Conversation Definition 从原生 `tool/call` 或 PTC dispatch 参数派生,并使用每次调用已解析的回合位置。它们与文件产物一起贡献到可追加的 `conversation.chat.turnTail` 列表。计划资源地址标识调用及完整的普通会话地址或子会话直接父级地址;provider 读取已有会话历史及较早分页,不把正文存入侧边栏布局。提问插件拥有审批操作插槽,并提供请求键、完整正文和可选的调用标识。[决策记录](../../../.agents/notes/implemented/feature/2026-09-17-persistent-plan-cards.zh.md)说明审批与文档为何保持独立生命周期。
+计划卡片通过 Conversation Definition 从原生 `tool/call` 或 PTC dispatch 参数派生,并使用每次调用已解析的回合位置。它们与文件产物一起贡献到可追加的 `conversation.chat.turnTail` 列表。计划资源地址标识调用及完整的普通会话地址或子会话直接父级地址;provider 读取已有会话历史及较早分页,不把正文存入侧边栏布局。提问插件拥有审批操作插槽,并提供请求键、完整正文和可选的调用标识。[决策记录](../../../.agents/notes/implemented/feature/2026-09-17-persistent-plan-cards.zh.md)说明审批与文档为何保持独立生命周期。 子代理计划地址也保留未知模式,以便历史读取解析子 descriptor。
diff --git a/packages/client/ui-plan/src/client/plan.ts b/packages/client/ui-plan/src/client/plan.ts
index e3dff30e29..d44b8f2dd9 100644
--- a/packages/client/ui-plan/src/client/plan.ts
+++ b/packages/client/ui-plan/src/client/plan.ts
@@ -74,7 +74,7 @@ export function parsePlanAddress(address: string): PlanAddress | undefined {
if (parts.length === 2) return {
session: { kind: 'session', sessionId: parts[0] as SessionId }, callId: parts[1] as ToolCallId,
}
- if (parts.length === 5 && parts[0] === 'subagent' && (parts[3] === 'one-shot' || parts[3] === 'continuable')) return {
+ if (parts.length === 5 && parts[0] === 'subagent' && (parts[3] === 'one-shot' || parts[3] === 'continuable' || parts[3] === 'unknown')) return {
session: { kind: 'subagent', parentSessionId: parts[1] as SessionId, childSessionId: parts[2] as SessionId, mode: parts[3] },
callId: parts[4] as ToolCallId,
}
diff --git a/packages/client/ui-plan/tests/plan-resource.client.spec.ts b/packages/client/ui-plan/tests/plan-resource.client.spec.ts
index a27b03c185..57be9acd36 100644
--- a/packages/client/ui-plan/tests/plan-resource.client.spec.ts
+++ b/packages/client/ui-plan/tests/plan-resource.client.spec.ts
@@ -36,7 +36,7 @@ describe('plan history resource', () => {
expect(b.page).toHaveBeenCalledWith({ address: { kind: 'session', sessionId: 'session' }, throughSeq: 100, beforeSeq: 80 }, expect.any(AbortSignal))
expect(b.closed).toHaveBeenCalledOnce()
})
- it.each(['one-shot', 'continuable'] as const)('restores a %s subagent plan with its complete parent address on every page', async (mode) => {
+ it.each(['one-shot', 'continuable', 'unknown'] as const)('restores a %s subagent plan with its complete parent address on every page', async (mode) => {
const b = setup([{ type: 'event', event: { type: 'user/message', seq: 80, data: {} } }], true)
const address = `dsh-resource://plan/subagent/parent/child/${mode}/call`
const session = { kind: 'subagent', parentSessionId: 'parent', childSessionId: 'child', mode }
diff --git a/packages/client/ui-plugin-manager/README.i18n.yaml b/packages/client/ui-plugin-manager/README.i18n.yaml
index dfbe7fcedb..df24d45717 100644
--- a/packages/client/ui-plugin-manager/README.i18n.yaml
+++ b/packages/client/ui-plugin-manager/README.i18n.yaml
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/ui-plugin-manager/README.md
-README.md: d7bcd2299d93dab90c8440565ac87112b37c9c10
-README.zh.md: 368058dabc27968b86088c34ee387dc5dd5bd364
+README.md: c04a614668d5afb2e09c1f923ac9be473a4aab5a
+README.zh.md: f0b30c91cb87ce96349d92086673809139956e0a
diff --git a/packages/client/ui-plugin-manager/README.md b/packages/client/ui-plugin-manager/README.md
index d7bcd2299d..c04a614668 100644
--- a/packages/client/ui-plugin-manager/README.md
+++ b/packages/client/ui-plugin-manager/README.md
@@ -27,7 +27,7 @@ Use the **Plugins** entry in the Web sidebar to manage the profile's installed b
Select **Plugins** in the sidebar. The page reads the inventory and the bundles through `api-remotes` when first opened; a Host without a managed profile shows the page as unavailable. **Official** comes first and lists the bundles the installation ships for switching on — off until switched on, without an uninstall, and tagged **Beta** where the feature is one — followed by the official plugins that registered a configuration page; **Installed** lists the bundles the profile holds. Cards are listed by name, so switching a bundle on or off does not move its card. A dependency without a bundle patch is not a plugin and is not listed unless the profile selects it, in which case it carries a problem tag. Global configuration remains in the Settings **Plugins** section.
-Installed bundles and their plugin rows display their own title and description in the current UI language on cards and detail pages. Each field falls back from exported locale `meta` to the accessible `package.json` at that plugin address; the final title is the full package or module name, with no package description when both sources omit it. See [Plugin display metadata](../../../docs/cookbook/adding-a-package.md#plugin-display-metadata) for the author format. Installation previews still use registry or manifest information.
+Installed bundles and their plugin rows display their own title and description in the current UI language on cards and detail pages. Each field falls back from exported locale `meta` to the accessible `package.json` at that plugin address; the final title is the full package or module name, with no package description when both sources omit it. See [Plugin display metadata](../../../docs/cookbook/adding-a-package.md#plugin-display-metadata) for the author format. Bundle cards, details, and component rows display the image declared by their own `package.json.icon`; absent or undecodable images retain the default artwork. Installation previews still use registry or manifest information.
### Installing a bundle
diff --git a/packages/client/ui-plugin-manager/README.zh.md b/packages/client/ui-plugin-manager/README.zh.md
index 368058dabc..f0b30c91cb 100644
--- a/packages/client/ui-plugin-manager/README.zh.md
+++ b/packages/client/ui-plugin-manager/README.zh.md
@@ -27,7 +27,7 @@ kind: "package-reference"
在侧栏选择**插件**。页面首次打开时通过 `api-remotes` 读取清单与组合包;没有受管 profile 的 Host 上页面显示为不可用。**官方**排在前面,列出安装随附、供开启的组合包——开启前保持关闭、没有卸载、属于 beta 功能的带 **Beta** 标签——其后是注册了配置页的官方插件;**已安装**列出 profile 持有的组合包。卡片按名称排序,启停组合包不会挪动它的卡片。没有组合包 patch 的依赖不是插件,除非 profile 选中了它才会带异常标签列出。全局配置仍在设置的**插件**分区中编辑。
-已安装的组合包及其插件行在卡片和详情页中,按当前界面语言显示各自的标题与描述。每个字段先读取导出的 locale `meta`,缺失时回退到该插件地址下可访问的 `package.json`;标题最终使用完整包名或模块名,两处都没有描述时不提供包描述。作者格式见[插件展示元信息](../../../docs/cookbook/adding-a-package.zh.md#plugin-display-metadata)。安装预览仍使用注册表或 manifest 信息。
+已安装的组合包及其插件行在卡片和详情页中,按当前界面语言显示各自的标题与描述。每个字段先读取导出的 locale `meta`,缺失时回退到该插件地址下可访问的 `package.json`;标题最终使用完整包名或模块名,两处都没有描述时不提供包描述。作者格式见[插件展示元信息](../../../docs/cookbook/adding-a-package.zh.md#plugin-display-metadata)。组合包卡片、详情和组件行显示各自 `package.json.icon` 声明的图片;未声明或无法解码时保留默认插画。安装预览仍使用注册表或 manifest 信息。
### 安装一个组合包
diff --git a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css
index 96286b3b16..a5f1da6197 100644
--- a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css
+++ b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css
@@ -202,6 +202,10 @@
color: var(--dsw-alias-label-secondary);
}
+.packageImage {
+ object-fit: contain;
+}
+
.cardMain {
flex: 1;
min-width: 0;
@@ -1112,13 +1116,13 @@ label.registryOption {
line-height: 22px;
}
-/* The package name under the title: the exact spec that installs the package
- elsewhere, where a title of its own or a shortened name hides it. */
+/* The package or row identity under the title: the exact spec that installs the
+ package elsewhere, where a title of its own or a shortened name hides it. */
.detailName {
margin: 0;
font-size: 12px;
line-height: 18px;
- color: var(--dsw-alias-label-caption);
+ color: var(--dsw-alias-label-tertiary);
overflow-wrap: anywhere;
}
diff --git a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx
index 5235d53cd0..5ef0212a3c 100644
--- a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx
+++ b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx
@@ -17,7 +17,7 @@ import {
IconChevronRightOutlineRegular, IconCloseOutlineMedium,
IconPlusOutlineRegular, IconRefreshOutlineRegular, IconTrashOutlineRegular,
IconWarningOutlineRegular, Input, Modal,
- PluginArtworkDefault, PluginArtworkLoop, PluginArtworkSearch, PluginArtworkSubagent, PluginArtworkTeam, PluginArtworkTerminal,
+ PluginArtworkDefault, PluginArtworkLoop, PluginArtworkSearch, PluginArtworkSubagent, PluginArtworkTerminal,
StateDot, Switch, Tag, TerminalBlock, Toast, useAnchoredPosition, useDismissOnOutsidePointer,
type IconProps, type StateDotState, type TerminalBlockLabels,
} from '@deepseek-ai/dsh-client-ui-primitives'
@@ -130,21 +130,23 @@ const ITEM_ARTWORK = new Map ReactNode>([
['web-search', PluginArtworkSearch],
])
-/** The artwork of the official bundles with artwork of their own, by package name. */
-const PACKAGE_ARTWORK = new Map ReactNode>([
- ['@deepseek-ai/dsh-experimental-agent-team-profile', PluginArtworkTeam],
-])
-
/** An official plugin's card and page artwork; plugins without their own get the default. */
function itemArtwork(id: string): ReactNode {
const Artwork = ITEM_ARTWORK.get(id) ?? PluginArtworkDefault
return
}
-/** A package's card and page artwork; packages without their own get the default. */
-function packageArtwork(name: string): ReactNode {
- const Artwork = PACKAGE_ARTWORK.get(name) ?? PluginArtworkDefault
- return
+/** Manifest images remain isolated from the page DOM; a failed decode keeps the position's default artwork. */
+function PackageArtwork({ src, row = false, size = row ? ROW_ARTWORK_SIZE : CARD_ARTWORK_SIZE }: {
+ readonly src: string | undefined
+ readonly row?: boolean
+ readonly size?: number
+}): ReactNode {
+ const [failedSource, setFailedSource] = useState()
+ const Fallback = row ? PluginArtworkSubagent : PluginArtworkDefault
+ return src === undefined || src === failedSource
+ ?
+ : { setFailedSource(src) }} />
}
/** A row's switch: locked, saying why, when the Host refuses to address the row through the profile patch. */
@@ -234,7 +236,7 @@ function RowsSection({ rows, t, resolveText, toggle, configure }: {
{...row.phase === 'failed' ? { 'data-state': 'failed' } : row.enabled ? {} : { 'data-state': 'off' }}
>