@morlay/dsh-subagent 0.0.1-alpha.2 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,18 @@
1
1
  # @morlay/dsh-subagent
2
2
 
3
- 上游 `@deepseek-ai/dsh-subagent` 的**薄壳 fork**:host 半只改一件事——continuable 子代理首条任务后面的
4
- **回报指引换成中文**(上游是英文)。服务名(`ctx.subagents`)、providers、其余子路径(`./internal` 等)
5
- 与装配位置都不变。设置页那张「子代理」卡片是本包自己的 client 半(见下),不是从上游 fork 来的。
3
+ 上游 `@deepseek-ai/dsh-subagent` 的**薄壳 fork**:host 半只改两件事——continuable 子代理首条任务后面的
4
+ **回报指引**换成中文(上游是英文,且只在"会话挂着本部署那份 preset"时用,其余会话保持上游那套),以及
5
+ **接管官方那一行**(行 id 仍是 `subagent`,见下)。服务名(`ctx.subagents`)、providers、其余子路径
6
+ (`./internal` 等)与装配位置都不变。配置页由**官方**那张卡片承担(行 id 没换,`subagent` namespace 照旧)。
6
7
 
7
- 装配由本包的 bundle patch 完成(`cordis.patch.yml`):官方 `subagent` 行 `disabled: true` + insert
8
- `subagent-fork`(`@morlay/dsh-subagent`),并停掉官方设置卡那两条行(`ui-settings-subagent` 与
9
- `subagent-model-selection-settings`,理由见 [ADR](./.agents/adrs/20260923-设置页自建client半并停掉官方两条入口行.md));
10
- app 的 `dsh.profile.bundles` 里引用本包。
8
+ 装配由本包的装配数据完成(`cordis.patch.yml` / `rows` 出口):**按官方行 id 复用**——插一条
9
+ `{ id: "subagent", name: "@morlay/dsh-subagent" }`,Loader 对同 id 复用同一个 Entry、后者替换入口 options,
10
+ 所以行 id 与 settings namespace 都还是 `subagent`,官方设置卡(`ui-settings-subagent`)与它的服务行
11
+ (`subagent-model-selection-settings`)都不动;顺序前提是本包排在 `@deepseek-ai/dsh-base` 之后。理由与被否的
12
+ 路线见 [ADR 接管官方行按 id 复用](./.agents/adrs/20260928-接管官方行按id复用而非换id.md)。
13
+
14
+ 回报指引的名单走这一行的 `config.localizedReturnGuidancePresets`(装配给,`.hidden()` 不进设置页);app 的
15
+ `dsh.profile.bundles` 里引用本包。
11
16
 
12
17
  ## 保留文件(3 个)
13
18
 
@@ -15,16 +20,20 @@ app 的 `dsh.profile.bundles` 里引用本包。
15
20
  `vendor/deepseek-harness/packages/subagent/subagent/src/...`,构建时内联进 `dist/index.mjs`
16
21
  (发布物自包含)。
17
22
 
18
- | 保留文件(`src/`) | 保留什么 |
19
- | -------------------------- | ------------------------------------------------------------------------------ |
20
- | `continuation-messages.ts` | **唯一实质改动**:`withContinuableReturnGuidance` 的中文文案(保留父 id 插值) |
21
- | `continuation.ts` | 只有一行接线不同:`continuation-messages.ts` 指向本包那一份 |
22
- | `index.ts` | 接线 + 两处结构性偏离(见下) |
23
+ | 保留文件(`src/`) | 保留什么 |
24
+ | -------------------------- | ------------------------------------------------------------------------------------------ |
25
+ | `continuation-messages.ts` | 中文文案 + 判定函数 `localizedReturnGuidance`("这个会话要不要本包那份文案") |
26
+ | `continuation.ts` | 接线 + 调用点从"永远是本包文案"改成"按会话选"(读 `ctx.agentPresets` 的 `composedPreset`) |
27
+ | `index.ts` | 接线 + 装配面配置字段(`localizedReturnGuidancePresets`)+ 两处结构性偏离(见下) |
23
28
 
24
29
  静态 import 链决定了复制面:`continuation-messages` ← `continuation` ← `index`,要替换中间那一份就得
25
30
  连同引用它的两个文件一起接管。原因、被否掉的路线与后果见
26
31
  [ADR 薄壳 fork 接管 subagent 行只改回报文案](./.agents/adrs/20260923-薄壳fork接管subagent行只改回报文案.md)。
27
32
 
33
+ **偏离清单是可执行的**:`src/__tests__/upstream-wiring.spec.ts` 的 `DELTAS` 表逐条登记上面每处偏离(新增
34
+ 块、改过的行、装配面字段),偏离表里的片段没命中就红——加偏离必须同时登记,否则测试报"偏离表里的片段不在
35
+ 文件里"。
36
+
28
37
  ## 两处结构性偏离
29
38
 
30
39
  - **`index.ts` 不复述 cordis 合并接口**:上游此处 `declare module '@deepseek-ai/cordis'` 声明
@@ -36,27 +45,26 @@ app 的 `dsh.profile.bundles` 里引用本包。
36
45
  本包三个保留文件**不做格式化**(`.oxfmtrc.json` 的 `ignorePatterns`):它们与上游逐行对照是同步纪律的
37
46
  守护面,格式改了那条守护就失去意义。
38
47
 
39
- ## 设置页(client 半)
48
+ ## 配置页
49
+
50
+ **子代理用哪个模型不在这张卡上**:它跟着**父会话的模式**走(`@morlay/dsh-session-mode` 顶层 `models` 里
51
+ 「模式 → 服务商 / 模型」那两个选择器)。
40
52
 
41
- `src/client/` 是**本包自己的代码**(不与上游对照,格式照常走 oxfmt):Plugins 页里那张「子代理」卡片,
42
- 只有限额一段——递归深度(≥ 0)与并行上限(≥ 1),staged 编辑 + 保存/丢弃。
53
+ 限额两个字段(`maxDepth` / `maxActiveSubagents`,标了 `.volatile()`)由**官方**那张设置卡承担:接管没换行 id,
54
+ `subagent` namespace 照旧,`ui-settings-subagent` 与 `subagent-model-selection-settings` 都不动。
43
55
 
44
- | 面 | 内容 |
45
- | ----------------------------------------------- | ----------------------------------------------------------------------------- |
46
- | `plugins.row.config`(key `@morlay/dsh-subagent#subagent-fork`) | `view: 'summary'` 给一句话说明;`view: 'page'` 给限额表单 |
47
- | settings namespace `subagent-fork` | 本包 host 行 id 就是 namespace 名;可编辑字段是 `Config` 的两个 volatile 字段 |
48
- | locale namespace `settings.subagent` | 卡片文案(zh + en,标题「子代理」) |
56
+ 本包**不再有 client 半**(`./client` 出口、字典与字段文案槽都删了):卡片回来之后它是重复面——两套都注册
57
+ `settings.subagent` 字典时,`locale.register` 对同 namespace 同 locale 直接抛错
58
+ (`locale namespace "settings.subagent" already has locale "zh"`),官方卡片那一行会加载失败。
49
59
 
50
- 装配只有两条:包声明了 `dsh.client`(`platform: 'web'`)与 `./client` 入口,client 半就随 app-boot 的
51
- browser roster 一起装(**不需要额外的插行**);host 行被描述出来之后(`configForms.whileServed(['subagent-fork'])`)
52
- 卡片才注册,行不在时卡片一起消失。表单原语来自 fork 的 `@morlay/dsh-client-ui-primitives/client`
53
- (`SettingsForm` / `SettingsValueField` / `SettingsFormModel` / `settingsNumberField`)。
60
+ `Config` 的 `localizedReturnGuidancePresets` 是**装配面**字段(`.hidden()`):它不进设置页,由装配那一行给。
54
61
 
55
62
  ## 文档
56
63
 
57
64
  - 决策与理由:
58
65
  [ADR 薄壳 fork 接管 subagent 行只改回报文案](./.agents/adrs/20260923-薄壳fork接管subagent行只改回报文案.md)、
59
- [ADR 设置页自建 client 半并停掉官方两条入口行](./.agents/adrs/20260923-设置页自建client半并停掉官方两条入口行.md)
66
+ [ADR 接管官方行按 id 复用](./.agents/adrs/20260928-接管官方行按id复用而非换id.md)、
67
+ (已作废)[ADR 停掉官方设置卡的两条入口行](./.agents/adrs/20260923-停掉官方设置卡的两条入口行.md)
60
68
  - 已知的债(两处 `continuation-messages` 实例、保留文件跟随方式):
61
69
  [债务 continuation-messages 两份实例与保留文件跟随](./.agents/debts/20260923-continuation-messages两份实例与保留文件跟随.md)
62
70
  - 测试落点与判据:[本包规范 how-to-verify](./.agents/standards/how-to-verify.md);薄壳 fork 的通用写法约束见
package/dist/index.d.mts CHANGED
@@ -19,47 +19,43 @@ import { SessionId as SessionId$1, SessionSeq as SessionSeq$1 } from "@deepseek-
19
19
  * rather than imported.
20
20
  */
21
21
  type SubagentPromptRequestId = Branded<'session-request-id'>;
22
- /** Shared child fields for complete-descendant listing. */
22
+ /** Shared child fields for recursive catalog listing. */
23
23
  type SubagentCatalogRow = {
24
24
  /** The durable child session id, stable across Activations. */
25
25
  readonly id: SessionId$1;
26
26
  /**
27
- * Whether complete-descendant listing observed a resident Session. This
27
+ * Whether recursive catalog listing observed a resident Session. This
28
28
  * does not encode a durable outcome or guarantee continuation delivery.
29
29
  */
30
30
  readonly activity: 'running' | 'inactive';
31
31
  } & ({
32
32
  /** A terminal one-shot child. */
33
33
  readonly mode: 'one-shot';
34
- /** Optional durable creation label from the owning catalog or child descriptor. */
34
+ /** Optional durable creation label from the parent catalog. */
35
35
  readonly label?: string;
36
36
  } | {
37
37
  /** A resumable conversation. */
38
38
  readonly mode: 'continuable';
39
- /** Durable creation label from the owning catalog or child descriptor. */
39
+ /** Durable creation label from the parent catalog. */
40
40
  readonly label: string;
41
41
  });
42
42
  /**
43
- * One complete-descendant row. Enumeration may also return diagnostics for
44
- * child identity observations from the complete Session corpus.
43
+ * One recursive catalog row. Traversal may also return diagnostics for
44
+ * unknown catalog modes or unreadable child catalogs.
45
45
  */
46
46
  type SubagentListEntry = (SubagentCatalogRow & {
47
47
  readonly kind: 'child';
48
- /** Whether complete-corpus enumeration observed a direct child. */
48
+ /** Whether the child catalog contains a direct child. */
49
49
  readonly hasChildren: boolean;
50
50
  }) | {
51
51
  readonly kind: 'diagnostic';
52
52
  /** The candidate's session id. */
53
53
  readonly id: SessionId$1;
54
54
  /**
55
- * Why the candidate has no `child` row: `corrupt` for a settled candidate
56
- * whose projection fold served no identity (a missing, malformed, or
57
- * unrecognized-version descriptor — deliberately undistinguished), and
58
- * for any candidate whose log makes a registered unit's fold or schema
59
- * throw (deterministic data damage, contained per child); `unavailable`
60
- * when the candidate's Session observation was absent or transiently
61
- * unreadable (retried on the next listing). `unsupported` is never produced; it remains in the
62
- * union for consumers that route on it.
55
+ * `corrupt` means the child catalog read found invalid or conflicting
56
+ * Session data; `unavailable` means it could not be read. Either failure
57
+ * stops that branch. `unsupported` means the parent catalog records an
58
+ * unknown child mode; its readable catalog is still traversed.
63
59
  */
64
60
  readonly reason: 'corrupt' | 'unsupported' | 'unavailable';
65
61
  };
@@ -699,13 +695,9 @@ declare module '@deepseek-ai/dsh-session-projection/types' {
699
695
  }
700
696
  //#endregion
701
697
  //#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/list-children.d.ts
702
- /**
703
- * One entry of a descendant listing: the interpreted subagent facts plus its
704
- * position in the complete session tree. `parentId` is the durable direct
705
- * parent from the enumerated header, and `depth` counts edges from the root.
706
- */
698
+ /** One catalog descendant with its direct parent and edge distance from the requested root. */
707
699
  type SubagentDescendantListEntry = SubagentListEntry & {
708
- /** Durable direct parent of this candidate in the enumerated tree. */
700
+ /** Parent whose catalog contains this child. */
709
701
  readonly parentId: SessionId;
710
702
  /** Edge distance from the requested root; direct children are `1`. */
711
703
  readonly depth: number;
@@ -1609,7 +1601,10 @@ interface ChildComposition {
1609
1601
  declare function applyChildComposition(childCtx: Context, parent: Agent, composition: ChildComposition): void;
1610
1602
  /** Policy seeded onto a child session's log at the delegation boundary. */
1611
1603
  interface DelegatedPolicyOverrides {
1612
- /** The shared-bundle preset identity when the parent currently runs in Auto or Full access. */
1604
+ /**
1605
+ * The parent's current preset identity when it runs in Auto or Full access;
1606
+ * the child keeps it under the pinned `never` approval policy.
1607
+ */
1613
1608
  readonly permissionPreset: 'auto' | 'danger-full-access' | undefined;
1614
1609
  /** The parent session's explicit sandbox-mode override, or `undefined` without one. */
1615
1610
  readonly sandboxMode: SandboxMode | undefined;
@@ -1834,19 +1829,19 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
1834
1829
  */
1835
1830
  listChildren(parentSessionId: SessionId, signal?: AbortSignal): Promise<SubagentCatalogEntry[]>;
1836
1831
  /**
1837
- * Enumerate the root's complete session-backed subagent tree in stable
1838
- * pre-order from one live-preferred corpus, without loading or resuming an
1839
- * Agent. Ordinary sessions and one-shot children remain traversal nodes so
1840
- * continuable descendants below them are discovered; each returned entry
1841
- * adds its durable `parentId` and root-relative `depth`. Identity resolution,
1842
- * diagnostics, optional persistence, and cancellation use the registered
1843
- * child identity projection and complete Session corpus.
1844
- * @param rootSessionId - session whose complete descendant tree is listed.
1845
- * @param signal - caller-owned cancellation forwarded to persistence reads
1846
- * and observed around every read await.
1847
- * @returns children and per-candidate diagnostics with tree position, in
1848
- * stable pre-order.
1832
+ * Recursively list reachable parent catalogs in stable pre-order, preserving
1833
+ * each catalog's event order. Each row carries its catalog parent and depth;
1834
+ * one-shot and unknown-mode children remain traversal nodes. Unknown modes
1835
+ * produce unsupported diagnostics. Unreadable child catalogs produce corrupt
1836
+ * or unavailable diagnostics and stop only that branch. Root read failures,
1837
+ * missing services or projections, and cancellation reject the whole listing.
1838
+ * Each catalog is observed once and released before the next read. No Agent
1839
+ * is loaded or resumed; Sessions absent from reachable catalogs are omitted.
1840
+ * @param rootSessionId - session whose catalog starts descendant discovery.
1841
+ * @param signal - cancellation forwarded to and checked around each catalog read.
1842
+ * @returns children and branch diagnostics in parent-catalog pre-order.
1849
1843
  * @throws {@link SubagentError} when listing dependencies are unavailable or the caller cancels.
1844
+ * @throws SessionQueryError when the root catalog cannot be read.
1850
1845
  */
1851
1846
  listDescendants(rootSessionId: SessionId, signal?: AbortSignal): Promise<SubagentDescendantListEntry[]>;
1852
1847
  /**
@@ -1981,6 +1976,13 @@ interface Config {
1981
1976
  maxActiveSubagents: Volatile<number>;
1982
1977
  /** Default delegation depth for tools without an explicit limit; defaults to 1. */
1983
1978
  maxDepth: Volatile<number>;
1979
+ /**
1980
+ * Preset ids whose sessions get this package's Chinese return guidance; default empty.
1981
+ *
1982
+ * 名单由**装配**给(这一行的 `config`):文案是模型可见的东西,跟着 preset 走,其余会话走上游英文那套。
1983
+ * 装配面,不是用户面——所以不进设置页(`.hidden()`)。
1984
+ */
1985
+ localizedReturnGuidancePresets: string[];
1984
1986
  }
1985
1987
  /** Named provider registry with one-shot runs, durable discovery, and continuable-child operations. */
1986
1988
  declare class SubagentRuntime extends TypertRemoteService {
@@ -1988,9 +1990,11 @@ declare class SubagentRuntime extends TypertRemoteService {
1988
1990
  static Config: z<Schemastery.ObjectS<NoInfer<{
1989
1991
  maxDepth: z<number, number, "volatile-defined">;
1990
1992
  maxActiveSubagents: z<number, number, "volatile-defined">;
1993
+ localizedReturnGuidancePresets: z<string[], string[], "defined">;
1991
1994
  }>>, Schemastery.ObjectT<NoInfer<{
1992
1995
  maxDepth: z<number, number, "volatile-defined">;
1993
1996
  maxActiveSubagents: z<number, number, "volatile-defined">;
1997
+ localizedReturnGuidancePresets: z<string[], string[], "defined">;
1994
1998
  }>>, "plain">;
1995
1999
  private providers;
1996
2000
  private continuations;
@@ -2094,19 +2098,19 @@ declare class SubagentRuntime extends TypertRemoteService {
2094
2098
  */
2095
2099
  listChildren(parentSessionId: SessionId, signal?: AbortSignal): Promise<SubagentCatalogEntry[]>;
2096
2100
  /**
2097
- * Enumerate the root's complete session-backed subagent tree in stable
2098
- * pre-order from one live-preferred corpus, without loading or resuming an
2099
- * Agent. Ordinary sessions and one-shot children remain traversal nodes so
2100
- * continuable descendants below them are discovered; each returned entry
2101
- * adds its durable `parentId` and root-relative `depth`. Identity resolution,
2102
- * diagnostics, optional persistence, and cancellation use the registered
2103
- * child identity projection and complete Session corpus.
2104
- * @param rootSessionId - session whose complete descendant tree is listed.
2105
- * @param signal - caller-owned cancellation forwarded to persistence reads
2106
- * and observed around every read await.
2107
- * @returns children and per-candidate diagnostics with tree position, in
2108
- * stable pre-order.
2101
+ * Recursively list reachable parent catalogs in stable pre-order, preserving
2102
+ * each catalog's event order. Each row carries its catalog parent and depth;
2103
+ * one-shot and unknown-mode children remain traversal nodes. Unknown modes
2104
+ * produce unsupported diagnostics. Unreadable child catalogs produce corrupt
2105
+ * or unavailable diagnostics and stop only that branch. Root read failures,
2106
+ * missing services or projections, and cancellation reject the whole listing.
2107
+ * Each catalog is observed once and released before the next read. No Agent
2108
+ * is loaded or resumed; Sessions absent from reachable catalogs are omitted.
2109
+ * @param rootSessionId - session whose catalog starts descendant discovery.
2110
+ * @param signal - cancellation forwarded to and checked around each catalog read.
2111
+ * @returns children and branch diagnostics in parent-catalog pre-order.
2109
2112
  * @throws {@link SubagentError} when listing dependencies are unavailable or the caller cancels.
2113
+ * @throws SessionQueryError when the root catalog cannot be read.
2110
2114
  */
2111
2115
  listDescendants(rootSessionId: SessionId, signal?: AbortSignal): Promise<SubagentDescendantListEntry[]>;
2112
2116
  /**