@morlay/dsh-subagent 0.0.2 → 0.0.4
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 +13 -66
- package/dist/index.d.mts +35 -35
- package/dist/index.mjs +23 -6
- package/dist/rows.d.mts +5 -24
- package/dist/rows.mjs +0 -1
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,74 +1,21 @@
|
|
|
1
1
|
# @morlay/dsh-subagent
|
|
2
2
|
|
|
3
|
-
上游 `@deepseek-ai/dsh-subagent` 的**薄壳 fork
|
|
4
|
-
**回报指引**换成中文(上游是英文,且只在"会话挂着本部署那份 preset"时用,其余会话保持上游那套),以及
|
|
5
|
-
**接管官方那一行**(行 id 仍是 `subagent`,见下)。服务名(`ctx.subagents`)、providers、其余子路径
|
|
6
|
-
(`./internal` 等)与装配位置都不变。配置页由**官方**那张卡片承担(行 id 没换,`subagent` namespace 照旧)。
|
|
3
|
+
上游 `@deepseek-ai/dsh-subagent` 的**薄壳 fork**:接管官方 `subagent` 行,改两处文案——
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
1. continuable 子代理首条任务后面的**回报指引**换成中文,**默认对任意会话生效**(官方四个 shipped preset、还没绑
|
|
6
|
+
preset 的会话都在内);只有在装配面给了 `localizedReturnGuidancePresets` 名单时才收窄成「只有名单里的 preset
|
|
7
|
+
用中文」,其余会话保持上游那套;
|
|
8
|
+
2. 子代理自己的**委派范围说明**(运行时上下文 `subagent:delegation`)换成中文,两条派发路径(continuable 与一次性)
|
|
9
|
+
一起覆盖。
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
`dsh.profile.bundles` 里引用本包。
|
|
11
|
+
## 用法
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
行数据在本包 `./rows` 出口(`subagentRows()`),由 [`@morlay/session-mode-profile`](../../bundles/session-mode-profile/README.md) 展开——它**不传** `localizedReturnGuidancePresets`(不配名单 = 不限 preset),传了才收窄。**按官方行 id 复用**,所以服务名(`ctx.subagents`)、providers、settings namespace 与官方设置卡都不变,限额字段(`maxDepth` / `maxActiveSubagents`)仍在那张卡上——本包没有 client 半。
|
|
18
14
|
|
|
19
|
-
薄壳
|
|
20
|
-
`vendor/deepseek-harness/packages/subagent/subagent/src/...`,构建时内联进 `dist/index.mjs`
|
|
21
|
-
(发布物自包含)。
|
|
15
|
+
保留文件、偏离登记与结构性约束见[设计 薄壳fork的接管面与保留文件](./.agents/designs/20260929-薄壳fork的接管面与保留文件.md)。
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
| -------------------------- | ------------------------------------------------------------------------------------------ |
|
|
25
|
-
| `continuation-messages.ts` | 中文文案 + 判定函数 `localizedReturnGuidance`("这个会话要不要本包那份文案") |
|
|
26
|
-
| `continuation.ts` | 接线 + 调用点从"永远是本包文案"改成"按会话选"(读 `ctx.agentPresets` 的 `composedPreset`) |
|
|
27
|
-
| `index.ts` | 接线 + 装配面配置字段(`localizedReturnGuidancePresets`)+ 两处结构性偏离(见下) |
|
|
17
|
+
## 委派范围说明怎么换的
|
|
28
18
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
**偏离清单是可执行的**:`src/__tests__/upstream-wiring.spec.ts` 的 `DELTAS` 表逐条登记上面每处偏离(新增
|
|
34
|
-
块、改过的行、装配面字段),偏离表里的片段没命中就红——加偏离必须同时登记,否则测试报"偏离表里的片段不在
|
|
35
|
-
文件里"。
|
|
36
|
-
|
|
37
|
-
## 两处结构性偏离
|
|
38
|
-
|
|
39
|
-
- **`index.ts` 不复述 cordis 合并接口**:上游此处 `declare module '@deepseek-ai/cordis'` 声明
|
|
40
|
-
`Context.subagents` 与 `subagent/*` 事件;本包 `import type {} from '@deepseek-ai/dsh-subagent'`
|
|
41
|
-
引用上游那一份(同形声明复述两遍会在同一个 program 里撞 `TS2717`)。
|
|
42
|
-
- **标准装饰器在构建期降级**:`@Remote(...)` 是 TC39 标准装饰器,rolldown/oxc 不降级它(上游管线里这步
|
|
43
|
-
由 tsc 完成),所以 `tsdown.config.ts` 里有一个 esbuild 预转换(只在检测到装饰器语法时生效)。
|
|
44
|
-
|
|
45
|
-
本包三个保留文件**不做格式化**(`.oxfmtrc.json` 的 `ignorePatterns`):它们与上游逐行对照是同步纪律的
|
|
46
|
-
守护面,格式改了那条守护就失去意义。
|
|
47
|
-
|
|
48
|
-
## 配置页
|
|
49
|
-
|
|
50
|
-
**子代理用哪个模型不在这张卡上**:它跟着**父会话的模式**走(`@morlay/dsh-session-mode` 顶层 `models` 里
|
|
51
|
-
「模式 → 服务商 / 模型」那两个选择器)。
|
|
52
|
-
|
|
53
|
-
限额两个字段(`maxDepth` / `maxActiveSubagents`,标了 `.volatile()`)由**官方**那张设置卡承担:接管没换行 id,
|
|
54
|
-
`subagent` namespace 照旧,`ui-settings-subagent` 与 `subagent-model-selection-settings` 都不动。
|
|
55
|
-
|
|
56
|
-
本包**不再有 client 半**(`./client` 出口、字典与字段文案槽都删了):卡片回来之后它是重复面——两套都注册
|
|
57
|
-
`settings.subagent` 字典时,`locale.register` 对同 namespace 同 locale 直接抛错
|
|
58
|
-
(`locale namespace "settings.subagent" already has locale "zh"`),官方卡片那一行会加载失败。
|
|
59
|
-
|
|
60
|
-
`Config` 的 `localizedReturnGuidancePresets` 是**装配面**字段(`.hidden()`):它不进设置页,由装配那一行给。
|
|
61
|
-
|
|
62
|
-
## 文档
|
|
63
|
-
|
|
64
|
-
- 决策与理由:
|
|
65
|
-
[ADR 薄壳 fork 接管 subagent 行只改回报文案](./.agents/adrs/20260923-薄壳fork接管subagent行只改回报文案.md)、
|
|
66
|
-
[ADR 接管官方行按 id 复用](./.agents/adrs/20260928-接管官方行按id复用而非换id.md)、
|
|
67
|
-
(已作废)[ADR 停掉官方设置卡的两条入口行](./.agents/adrs/20260923-停掉官方设置卡的两条入口行.md)
|
|
68
|
-
- 已知的债(两处 `continuation-messages` 实例、保留文件跟随方式):
|
|
69
|
-
[债务 continuation-messages 两份实例与保留文件跟随](./.agents/debts/20260923-continuation-messages两份实例与保留文件跟随.md)
|
|
70
|
-
- 测试落点与判据:[本包规范 how-to-verify](./.agents/standards/how-to-verify.md);薄壳 fork 的通用写法约束见
|
|
71
|
-
[`session/ui-conversation` 的 how-to-write](../../session/ui-conversation/.agents/standards/how-to-write.md)
|
|
72
|
-
(同一形态的包共享那份约束)。
|
|
73
|
-
|
|
74
|
-
上游同步(patch / 裁剪 / 升级评估)走 `dsh-plugin-upstream-sync` 技能;发布走 CI,本地只构建验证。
|
|
19
|
+
`subagent:delegation` 由上游在**子代理自己的 agent 作用域**上注册,两条常规接管手法都不通:同层重复注册同名 context
|
|
20
|
+
会抛错;fork `child-agent.ts` 也不改变运行期(注册这条文本的调用方都在上游未复制的文件里)。所以本包改的是**装配
|
|
21
|
+
结果**——`system-prompt/assemble` 瀑布里把该名字那条的文本换成中文(`src/delegation-context.ts`),在该次装配内生效。
|
package/dist/index.d.mts
CHANGED
|
@@ -155,7 +155,7 @@ declare module '@deepseek-ai/dsh-session/types' {
|
|
|
155
155
|
* Supporting another composition input is a deliberate version change, never
|
|
156
156
|
* an implicit extra field.
|
|
157
157
|
*/
|
|
158
|
-
declare const SUBAGENT_DESCRIPTOR_VERSION = 3;
|
|
158
|
+
export declare const SUBAGENT_DESCRIPTOR_VERSION = 3;
|
|
159
159
|
/** Fields shared by every supported `subagent/descriptor` payload. */
|
|
160
160
|
interface SubagentDescriptorBase {
|
|
161
161
|
/** Descriptor format version ({@link SUBAGENT_DESCRIPTOR_VERSION}). */
|
|
@@ -233,14 +233,14 @@ type SubagentDescriptorInput = OneShotSubagentDescriptorInput | ContinuableSubag
|
|
|
233
233
|
* @returns the versioned, detached descriptor payload.
|
|
234
234
|
* @throws when a field is not losslessly JSON-serializable.
|
|
235
235
|
*/
|
|
236
|
-
declare function snapshotSubagentDescriptor(input: OneShotSubagentDescriptorInput): OneShotSubagentDescriptorData;
|
|
236
|
+
export declare function snapshotSubagentDescriptor(input: OneShotSubagentDescriptorInput): OneShotSubagentDescriptorData;
|
|
237
237
|
/**
|
|
238
238
|
* Validate and detach a continuable descriptor input.
|
|
239
239
|
* @param input - the caller-collected continuable composition fields.
|
|
240
240
|
* @returns the versioned, detached continuable descriptor payload.
|
|
241
241
|
* @throws when a field is not losslessly JSON-serializable.
|
|
242
242
|
*/
|
|
243
|
-
declare function snapshotSubagentDescriptor(input: ContinuableSubagentDescriptorInput): ContinuableSubagentDescriptorData;
|
|
243
|
+
export declare function snapshotSubagentDescriptor(input: ContinuableSubagentDescriptorInput): ContinuableSubagentDescriptorData;
|
|
244
244
|
/**
|
|
245
245
|
* Fold a persisted child log to its supported descriptor. The first
|
|
246
246
|
* `subagent/descriptor` event is authoritative — the establishing provider
|
|
@@ -253,17 +253,17 @@ declare function snapshotSubagentDescriptor(input: ContinuableSubagentDescriptor
|
|
|
253
253
|
* @throws when a current-version persisted payload does not match its complete
|
|
254
254
|
* declared schema.
|
|
255
255
|
*/
|
|
256
|
-
declare function foldSubagentDescriptor(events: readonly SessionEvent[]): SubagentDescriptorData | undefined;
|
|
256
|
+
export declare function foldSubagentDescriptor(events: readonly SessionEvent[]): SubagentDescriptorData | undefined;
|
|
257
257
|
//#endregion
|
|
258
258
|
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/types.d.ts
|
|
259
259
|
/** Identifies one accepted subagent run across its lifecycle event pair. */
|
|
260
|
-
type SubagentRunId = Branded<'SubagentRunId'>;
|
|
260
|
+
export type SubagentRunId = Branded<'SubagentRunId'>;
|
|
261
261
|
/**
|
|
262
262
|
* Brand a string as a {@link SubagentRunId}.
|
|
263
263
|
* @param id - the raw run id.
|
|
264
264
|
* @returns the same string, branded.
|
|
265
265
|
*/
|
|
266
|
-
declare function SubagentRunId(id: string): SubagentRunId;
|
|
266
|
+
export declare function SubagentRunId(id: string): SubagentRunId;
|
|
267
267
|
/** What a caller asks for when starting a continuable background child. */
|
|
268
268
|
interface ContinuableStartSpec {
|
|
269
269
|
/** The `ctx.subagents` provider whose continuable-creation capability establishes the child. */
|
|
@@ -761,7 +761,7 @@ declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
|
761
761
|
* (`agentOptions`/`outputSchema`/`maxDepth`/`toolFilter`/`persona`), so the service rejects a
|
|
762
762
|
* request needing any of them before `start` runs — never accepted-then-ignored.
|
|
763
763
|
*/
|
|
764
|
-
declare const NO_START_CAPABILITIES: SubagentCapabilities;
|
|
764
|
+
export declare const NO_START_CAPABILITIES: SubagentCapabilities;
|
|
765
765
|
/**
|
|
766
766
|
* Assert a configured timing bound is a positive finite number (it bounds a
|
|
767
767
|
* teardown or shutdown wait; zero, negative, or NaN would skip or wedge it).
|
|
@@ -769,7 +769,7 @@ declare const NO_START_CAPABILITIES: SubagentCapabilities;
|
|
|
769
769
|
* @param name - the config field name, for the diagnostic.
|
|
770
770
|
* @param value - the configured value.
|
|
771
771
|
*/
|
|
772
|
-
declare function assertPositiveFinite(prefix: string, name: string, value: number): void;
|
|
772
|
+
export declare function assertPositiveFinite(prefix: string, name: string, value: number): void;
|
|
773
773
|
/**
|
|
774
774
|
* Assert `cwd` can actually host the child: absolute (it doubles as the
|
|
775
775
|
* child's workspace identity, and a relative path would be re-anchored to the
|
|
@@ -780,7 +780,7 @@ declare function assertPositiveFinite(prefix: string, name: string, value: numbe
|
|
|
780
780
|
* @param cwd - the candidate working directory.
|
|
781
781
|
* @returns `cwd`, validated.
|
|
782
782
|
*/
|
|
783
|
-
declare function assertUsableCwd(prefix: string, label: string, cwd: string): string;
|
|
783
|
+
export declare function assertUsableCwd(prefix: string, label: string, cwd: string): string;
|
|
784
784
|
/**
|
|
785
785
|
* Validate a configured `cwd` override ONCE, at plugin load: reject the empty
|
|
786
786
|
* string (`path.resolve('')` is the process cwd — it would silently
|
|
@@ -791,7 +791,7 @@ declare function assertUsableCwd(prefix: string, label: string, cwd: string): st
|
|
|
791
791
|
* @param cwd - the configured override, or `undefined` when the config omits it.
|
|
792
792
|
* @returns the validated absolute override, or `undefined` when omitted.
|
|
793
793
|
*/
|
|
794
|
-
declare function validateConfiguredCwd(prefix: string, cwd: string | undefined): string | undefined;
|
|
794
|
+
export declare function validateConfiguredCwd(prefix: string, cwd: string | undefined): string | undefined;
|
|
795
795
|
/**
|
|
796
796
|
* Resolve the child's working directory at start: the deployment override
|
|
797
797
|
* when configured (already validated at load), else the parent session's
|
|
@@ -805,9 +805,9 @@ declare function validateConfiguredCwd(prefix: string, cwd: string | undefined):
|
|
|
805
805
|
* @param parentCwd - the delegating parent session's workspace cwd, if any.
|
|
806
806
|
* @returns the absolute child working directory.
|
|
807
807
|
*/
|
|
808
|
-
declare function resolveChildCwd(prefix: string, configured: string | undefined, parentCwd: string | undefined): string;
|
|
808
|
+
export declare function resolveChildCwd(prefix: string, configured: string | undefined, parentCwd: string | undefined): string;
|
|
809
809
|
/** Inputs to {@link settleRunResult}. */
|
|
810
|
-
interface RunResultSettlement {
|
|
810
|
+
export interface RunResultSettlement {
|
|
811
811
|
/** The turn attempt (typically racing local cancellation); returns the terminal result. */
|
|
812
812
|
attempt: () => Promise<SubagentResult>;
|
|
813
813
|
/** Snapshot the provider exposes when cancellation or failure wins settlement. */
|
|
@@ -833,9 +833,9 @@ interface RunResultSettlement {
|
|
|
833
833
|
* @param parts - the attempt, output snapshot, cancellation state, sink, and signal wiring.
|
|
834
834
|
* @returns the terminal result (never a rejection).
|
|
835
835
|
*/
|
|
836
|
-
declare function settleRunResult(parts: RunResultSettlement): Promise<SubagentResult>;
|
|
836
|
+
export declare function settleRunResult(parts: RunResultSettlement): Promise<SubagentResult>;
|
|
837
837
|
/** Inputs to {@link subprocessRunHandle}. */
|
|
838
|
-
interface SubprocessRunHandleParts {
|
|
838
|
+
export interface SubprocessRunHandleParts {
|
|
839
839
|
/** The parent-scoped run id. */
|
|
840
840
|
id: SubagentRun['id'];
|
|
841
841
|
/** The flattened, never-rejecting result (the seam contract). */
|
|
@@ -857,7 +857,7 @@ interface SubprocessRunHandleParts {
|
|
|
857
857
|
* @param parts - the run identity, result, cancellation wiring, and teardown.
|
|
858
858
|
* @returns the seam run handle (`localAgent` is `undefined` for remote runs).
|
|
859
859
|
*/
|
|
860
|
-
declare function subprocessRunHandle(parts: SubprocessRunHandleParts): SubagentRun;
|
|
860
|
+
export declare function subprocessRunHandle(parts: SubprocessRunHandleParts): SubagentRun;
|
|
861
861
|
//#endregion
|
|
862
862
|
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/assistant-output.d.ts
|
|
863
863
|
/**
|
|
@@ -866,7 +866,7 @@ declare function subprocessRunHandle(parts: SubprocessRunHandleParts): SubagentR
|
|
|
866
866
|
* transports without session events (ACP content chunks) {@link pushText} raw
|
|
867
867
|
* text into the same streamed fallback.
|
|
868
868
|
*/
|
|
869
|
-
declare class AssistantOutputFold {
|
|
869
|
+
export declare class AssistantOutputFold {
|
|
870
870
|
private message;
|
|
871
871
|
private partial;
|
|
872
872
|
/**
|
|
@@ -893,11 +893,11 @@ declare class AssistantOutputFold {
|
|
|
893
893
|
* @param events - the child-owned events (after any seed or epoch boundary).
|
|
894
894
|
* @returns the selected output, or `undefined` when the child produced none.
|
|
895
895
|
*/
|
|
896
|
-
declare function finalAssistantOutput(events: readonly SessionEvent[]): readonly ContentBlock[] | undefined;
|
|
896
|
+
export declare function finalAssistantOutput(events: readonly SessionEvent[]): readonly ContentBlock[] | undefined;
|
|
897
897
|
//#endregion
|
|
898
898
|
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/error.d.ts
|
|
899
899
|
/** Typed failure for the subagent seam. */
|
|
900
|
-
declare class SubagentError extends HarnessError {
|
|
900
|
+
export declare class SubagentError extends HarnessError {
|
|
901
901
|
constructor(message: string, code: string, options?: ErrorOptions);
|
|
902
902
|
}
|
|
903
903
|
//#endregion
|
|
@@ -1369,7 +1369,7 @@ declare abstract class JobRegistry extends Service {
|
|
|
1369
1369
|
* @param run - live run to settle and release.
|
|
1370
1370
|
* @returns outcome after child resources are released.
|
|
1371
1371
|
*/
|
|
1372
|
-
declare function settleRun(run: SubagentRun): Promise<JobOutcome>;
|
|
1372
|
+
export declare function settleRun(run: SubagentRun): Promise<JobOutcome>;
|
|
1373
1373
|
//#endregion
|
|
1374
1374
|
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/depth.d.ts
|
|
1375
1375
|
declare module '@deepseek-ai/dsh-agent' {
|
|
@@ -1388,12 +1388,12 @@ declare module '@deepseek-ai/dsh-agent' {
|
|
|
1388
1388
|
* @returns its non-negative safe-integer depth.
|
|
1389
1389
|
* @throws if the runtime `AgentOptions.subagentDepth` is not a non-negative safe integer.
|
|
1390
1390
|
*/
|
|
1391
|
-
declare function delegationDepthOf(agent: Agent): number;
|
|
1391
|
+
export declare function delegationDepthOf(agent: Agent): number;
|
|
1392
1392
|
/**
|
|
1393
1393
|
* Reject a recursion cap that cannot represent an exact delegation depth.
|
|
1394
1394
|
* @param maxDepth - the optional runtime value to validate.
|
|
1395
1395
|
*/
|
|
1396
|
-
declare function assertSubagentMaxDepth(maxDepth: unknown): void;
|
|
1396
|
+
export declare function assertSubagentMaxDepth(maxDepth: unknown): void;
|
|
1397
1397
|
//#endregion
|
|
1398
1398
|
//#region ../../../vendor/deepseek-harness/packages/sandbox/sandbox/lib/types/index.d.ts
|
|
1399
1399
|
/**
|
|
@@ -1514,7 +1514,7 @@ declare abstract class SandboxProvider extends Service {
|
|
|
1514
1514
|
//#endregion
|
|
1515
1515
|
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/child-agent.d.ts
|
|
1516
1516
|
/** Thrown when starting a child would exceed the requested depth cap. */
|
|
1517
|
-
declare class SubagentDepthError extends Error {
|
|
1517
|
+
export declare class SubagentDepthError extends Error {
|
|
1518
1518
|
readonly attemptedDepth: number;
|
|
1519
1519
|
readonly maxDepth: number;
|
|
1520
1520
|
constructor(attemptedDepth: number, maxDepth: number);
|
|
@@ -1529,7 +1529,7 @@ declare class SubagentDepthError extends Error {
|
|
|
1529
1529
|
* @throws {SubagentDepthError} when the resolved depth exceeds `maxDepth`.
|
|
1530
1530
|
* @throws {RangeError} when the resolved depth leaves the safe-integer range.
|
|
1531
1531
|
*/
|
|
1532
|
-
declare function resolveChildDepth(parent: Agent, maxDepth: number | undefined): number;
|
|
1532
|
+
export declare function resolveChildDepth(parent: Agent, maxDepth: number | undefined): number;
|
|
1533
1533
|
/**
|
|
1534
1534
|
* Resolve the parent values inherited by a child. The latest request header
|
|
1535
1535
|
* owns provider, model, and reasoning effort after request-time selection;
|
|
@@ -1538,7 +1538,7 @@ declare function resolveChildDepth(parent: Agent, maxDepth: number | undefined):
|
|
|
1538
1538
|
* @param parent - delegating parent Agent.
|
|
1539
1539
|
* @returns detached Agent options for child-option merging.
|
|
1540
1540
|
*/
|
|
1541
|
-
declare function parentAgentOptionsForDelegation(parent: Agent): AgentOptions;
|
|
1541
|
+
export declare function parentAgentOptionsForDelegation(parent: Agent): AgentOptions;
|
|
1542
1542
|
/**
|
|
1543
1543
|
* Resolve the child's `AgentOptions`: the parent's provider/model,
|
|
1544
1544
|
* reasoning-effort, and maxTokens values unless the request overrides them,
|
|
@@ -1550,7 +1550,7 @@ declare function parentAgentOptionsForDelegation(parent: Agent): AgentOptions;
|
|
|
1550
1550
|
* @param childDepth - the resolved delegation depth to stamp.
|
|
1551
1551
|
* @returns the resolved options for `ctx.agents.create()`.
|
|
1552
1552
|
*/
|
|
1553
|
-
declare function resolveChildAgentOptions(parent: Agent, requested: AgentOptions | undefined, childDepth: number): AgentOptions;
|
|
1553
|
+
export declare function resolveChildAgentOptions(parent: Agent, requested: AgentOptions | undefined, childDepth: number): AgentOptions;
|
|
1554
1554
|
/**
|
|
1555
1555
|
* Build the child session's durable creation metadata: the parent's workspace,
|
|
1556
1556
|
* its direct lineage, coarse product origin, the recursion budget that must
|
|
@@ -1568,7 +1568,7 @@ declare function resolveChildAgentOptions(parent: Agent, requested: AgentOptions
|
|
|
1568
1568
|
* @param isSeeded - whether this child inherits a parent-log prefix, including an explicitly empty one.
|
|
1569
1569
|
* @returns the `meta` for `ctx.agents.create()`.
|
|
1570
1570
|
*/
|
|
1571
|
-
declare function childSessionMeta(parent: Agent, childDepth: number, isSeeded: boolean): NonNullable<CreateAgentOptions['meta']>;
|
|
1571
|
+
export declare function childSessionMeta(parent: Agent, childDepth: number, isSeeded: boolean): NonNullable<CreateAgentOptions['meta']>;
|
|
1572
1572
|
/** The scoped composition a child agent's creation window applies. */
|
|
1573
1573
|
interface ChildComposition {
|
|
1574
1574
|
/** Per-child persona shadowing the deployment persona. */
|
|
@@ -1598,7 +1598,7 @@ interface ChildComposition {
|
|
|
1598
1598
|
* @param parent - the delegating parent whose composition the child joins.
|
|
1599
1599
|
* @param composition - the per-child persona and tool filter to install.
|
|
1600
1600
|
*/
|
|
1601
|
-
declare function applyChildComposition(childCtx: Context, parent: Agent, composition: ChildComposition): void;
|
|
1601
|
+
export declare function applyChildComposition(childCtx: Context, parent: Agent, composition: ChildComposition): void;
|
|
1602
1602
|
/** Policy seeded onto a child session's log at the delegation boundary. */
|
|
1603
1603
|
interface DelegatedPolicyOverrides {
|
|
1604
1604
|
/**
|
|
@@ -1626,7 +1626,7 @@ interface DelegatedPolicyOverrides {
|
|
|
1626
1626
|
* @param parent - the delegating parent agent.
|
|
1627
1627
|
* @returns the sandbox override (or `undefined` without one) and the approval pin.
|
|
1628
1628
|
*/
|
|
1629
|
-
declare function captureDelegatedPolicyOverrides(parent: Agent): DelegatedPolicyOverrides;
|
|
1629
|
+
export declare function captureDelegatedPolicyOverrides(parent: Agent): DelegatedPolicyOverrides;
|
|
1630
1630
|
/**
|
|
1631
1631
|
* Append the captured delegation policy onto the child's own log as
|
|
1632
1632
|
* `source: 'delegation'` events inside the unpublished creation window, so the
|
|
@@ -1636,7 +1636,7 @@ declare function captureDelegatedPolicyOverrides(parent: Agent): DelegatedPolicy
|
|
|
1636
1636
|
* @param childSession - the unpublished child's session.
|
|
1637
1637
|
* @param overrides - the policy captured at delegation.
|
|
1638
1638
|
*/
|
|
1639
|
-
declare function appendDelegatedPolicyOverrides(childSession: Session, overrides: DelegatedPolicyOverrides): void;
|
|
1639
|
+
export declare function appendDelegatedPolicyOverrides(childSession: Session, overrides: DelegatedPolicyOverrides): void;
|
|
1640
1640
|
//#endregion
|
|
1641
1641
|
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/continuation-messages.d.ts
|
|
1642
1642
|
/** Durable attribution for one model-authored message between adjacent Agents. */
|
|
@@ -1971,21 +1971,21 @@ declare module '@deepseek-ai/dsh-llm' {
|
|
|
1971
1971
|
//#endregion
|
|
1972
1972
|
//#region src/index.d.ts
|
|
1973
1973
|
/** Host configuration for continuable subagent capacity. */
|
|
1974
|
-
interface Config {
|
|
1974
|
+
export interface Config {
|
|
1975
1975
|
/** Maximum live children sharing uninterrupted continuable parent links; defaults to 8. */
|
|
1976
1976
|
maxActiveSubagents: Volatile<number>;
|
|
1977
1977
|
/** Default delegation depth for tools without an explicit limit; defaults to 1. */
|
|
1978
1978
|
maxDepth: Volatile<number>;
|
|
1979
1979
|
/**
|
|
1980
|
-
* Preset ids
|
|
1980
|
+
* Preset ids the Chinese return guidance is restricted to; empty (default) means no restriction.
|
|
1981
1981
|
*
|
|
1982
|
-
*
|
|
1983
|
-
*
|
|
1982
|
+
* 不配 = 任意 preset 的会话都用本包的中文回报指引(官方四个 shipped preset 也在内,还有还没绑 preset 的会话)。
|
|
1983
|
+
* 要反过来只让某几份 preset 用中文,就在这里列出来。装配面,不是用户面——所以不进设置页(`.hidden()`)。
|
|
1984
1984
|
*/
|
|
1985
1985
|
localizedReturnGuidancePresets: string[];
|
|
1986
1986
|
}
|
|
1987
1987
|
/** Named provider registry with one-shot runs, durable discovery, and continuable-child operations. */
|
|
1988
|
-
declare class SubagentRuntime extends TypertRemoteService {
|
|
1988
|
+
export declare class SubagentRuntime extends TypertRemoteService {
|
|
1989
1989
|
private config;
|
|
1990
1990
|
static Config: z<Schemastery.ObjectS<NoInfer<{
|
|
1991
1991
|
maxDepth: z<number, number, "volatile-defined">;
|
|
@@ -2198,4 +2198,4 @@ declare class SubagentRuntime extends TypertRemoteService {
|
|
|
2198
2198
|
private assertCapabilities;
|
|
2199
2199
|
}
|
|
2200
2200
|
//#endregion
|
|
2201
|
-
export { type AgentMessageSource,
|
|
2201
|
+
export { type AgentMessageSource, type ChildComposition, type ContinuableCreateRequest, type ContinuableCreateSpec, type ContinuableStart, type ContinuableStartSpec, type ContinuableSubagentDescriptorData, type ContinuableSubagentDescriptorInput, type DelegatedPolicyOverrides, type OneShotSubagentDescriptorData, type OneShotSubagentDescriptorInput, type ResolvedSubagentStartRequest, type SubagentAddress, type SubagentCapabilities, type SubagentCatalogEntry, type SubagentCatalogRow, type SubagentDescendantListEntry, type SubagentDescriptorData, type SubagentDescriptorInput, type SubagentIdentityProjection, type SubagentInterruptAuthority, type SubagentInterruptReceipt, type SubagentListEntry, type SubagentPromptReceipt, type SubagentPromptRequest, type SubagentPromptRequestId, type SubagentProvider, type SubagentResult, type SubagentRun, type SubagentRunEndInfo, type SubagentRunInfo, SubagentRuntime as default, type SubagentSendMessageOptions, type SubagentSettledMessageSource, type SubagentStartRequest, type SubagentStopReason, type SubagentStopReasonMap, type SubagentTimingProjection };
|
package/dist/index.mjs
CHANGED
|
@@ -6572,15 +6572,17 @@ function createAgentMessage(sender, content) {
|
|
|
6572
6572
|
/**
|
|
6573
6573
|
* Whether this session's return guidance takes this package's Chinese wording.
|
|
6574
6574
|
*
|
|
6575
|
-
*
|
|
6576
|
-
*
|
|
6577
|
-
*
|
|
6575
|
+
* **默认对任意 preset 生效**:名单(本行的 `config.localizedReturnGuidancePresets`)不配就是不限制——官方四个
|
|
6576
|
+
* shipped preset、部署自建的、以及还没绑 preset 的会话(不装 registry 的部署、还没 join 的 agent)都拿中文。
|
|
6577
|
+
* 配了名单才反过来收窄成"只有这些 preset 的会话用中文"。文案是模型可见的东西,判据留在 host 平面
|
|
6578
|
+
* (`subagents` 是进程单例,这一行不能搬进 preset realm)。
|
|
6578
6579
|
*
|
|
6579
6580
|
* @param composedPreset - the preset id the session is mounted on, if any.
|
|
6580
|
-
* @param configured - preset ids this deployment
|
|
6581
|
+
* @param configured - preset ids this deployment restricts the Chinese wording to; empty means every session.
|
|
6581
6582
|
* @returns whether the Chinese guidance applies to this session.
|
|
6582
6583
|
*/
|
|
6583
6584
|
function localizedReturnGuidance(composedPreset, configured) {
|
|
6585
|
+
if (configured.length === 0) return true;
|
|
6584
6586
|
return composedPreset !== void 0 && configured.includes(composedPreset);
|
|
6585
6587
|
}
|
|
6586
6588
|
/**
|
|
@@ -7207,8 +7209,8 @@ var SubagentContinuationManager = class {
|
|
|
7207
7209
|
/**
|
|
7208
7210
|
* Return guidance for a continuable child's initial task, per session.
|
|
7209
7211
|
*
|
|
7210
|
-
*
|
|
7211
|
-
*
|
|
7212
|
+
* 默认(没配名单)对**任意**会话用本包的中文文案,官方四个 shipped preset 与还没绑 preset 的会话都覆盖;
|
|
7213
|
+
* 配了名单才收窄成"只有这些 preset 的会话用中文"。文案是模型可见的东西;但 `subagents` 是**进程单例**
|
|
7212
7214
|
* (跨会话查询面由 host 的 api-proxy 服务、provider 名全局唯一),realm 内的服务 realm 外读不到,所以这一行
|
|
7213
7215
|
* 不能搬进 preset realm——只能在 host 平面按会话判。
|
|
7214
7216
|
* @param parent - the exact live parent whose session owns the child.
|
|
@@ -7454,6 +7456,20 @@ var SubagentContinuationManager = class {
|
|
|
7454
7456
|
return query;
|
|
7455
7457
|
}
|
|
7456
7458
|
};
|
|
7459
|
+
const DELEGATION_CONTEXT_TEXT = "你是被派发的子代理:权限范围在创建时就固定,本会话内不能放宽——需要审批的操作一律被自动拒绝。\n任务需要超出这个范围时不要重试被拒的操作,在回复里说明这个限制,让派发你的智能体处理。";
|
|
7460
|
+
function installDelegationContext(ctx) {
|
|
7461
|
+
ctx.on("system-prompt/assemble", async (assembly, context, next) => {
|
|
7462
|
+
const assembled = await next();
|
|
7463
|
+
if (context.agent?.session.header.parentSession === void 0) return assembled;
|
|
7464
|
+
return {
|
|
7465
|
+
...assembled,
|
|
7466
|
+
contexts: assembled.contexts.map((entry) => entry.name === "subagent:delegation" ? {
|
|
7467
|
+
...entry,
|
|
7468
|
+
text: DELEGATION_CONTEXT_TEXT
|
|
7469
|
+
} : entry)
|
|
7470
|
+
};
|
|
7471
|
+
});
|
|
7472
|
+
}
|
|
7457
7473
|
//#endregion
|
|
7458
7474
|
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/list-children.ts
|
|
7459
7475
|
/**
|
|
@@ -8140,6 +8156,7 @@ var SubagentRuntime = class extends (_b = TypertRemoteService) {
|
|
|
8140
8156
|
* composes into the carrier.
|
|
8141
8157
|
*/
|
|
8142
8158
|
__publicField(this, "emitLifecycle");
|
|
8159
|
+
installDelegationContext(ctx);
|
|
8143
8160
|
this.emitLifecycle = createLifecycleEmitter(this.ctx, (parent) => scopeTarget(this, parent));
|
|
8144
8161
|
ctx.inject(["agents"], (childCtx) => {
|
|
8145
8162
|
const manager = new SubagentContinuationManager(childCtx, {
|
package/dist/rows.d.mts
CHANGED
|
@@ -1,35 +1,16 @@
|
|
|
1
1
|
//#region src/rows.d.ts
|
|
2
|
-
|
|
3
|
-
* 本包作为能力包发布的**装配数据**:行本身在部署那一层装
|
|
4
|
-
* (`packages/bundles/session-mode-profile` 引用它渲染 patch)。
|
|
5
|
-
*
|
|
6
|
-
* 接管方式是**按官方行 id 复用**,不是"禁掉官方行再插一行自己的":Loader 对同 id 的条目复用同一个 Entry、
|
|
7
|
-
* 后者替换入口 options(`EntryGroup.create` 的 `create: true`),所以行 id 与 settings namespace(namespace
|
|
8
|
-
* 就是行 id)都还是 `subagent`——官方设置卡 `ui-settings-subagent` 读得到那两个 namespace,照常可用;换掉的
|
|
9
|
-
* 只是实现包。顺序前提:本包排在 `@deepseek-ai/dsh-base` 之后(app 的 `dsh.profile.bundles` 已如此)。
|
|
10
|
-
*
|
|
11
|
-
* 模型白名单服务行(`subagent-model-selection-settings`)留给官方卡片第二段,本包不动它。
|
|
12
|
-
*/
|
|
13
|
-
/** 一行装配条目:与 `cordis.patch.yml` 的顶层结构同形。 */
|
|
14
|
-
interface PatchRow {
|
|
2
|
+
export interface PatchRow {
|
|
15
3
|
readonly id?: string;
|
|
16
4
|
readonly disabled?: boolean;
|
|
17
5
|
readonly insert?: readonly RowEntry[];
|
|
18
6
|
}
|
|
19
|
-
|
|
20
|
-
interface RowEntry {
|
|
7
|
+
export interface RowEntry {
|
|
21
8
|
readonly id: string;
|
|
22
9
|
readonly name: string;
|
|
23
10
|
readonly config?: Readonly<Record<string, unknown>>;
|
|
24
11
|
}
|
|
25
|
-
interface SubagentRowsOptions {
|
|
26
|
-
/**
|
|
27
|
-
* 哪些 preset 的会话用本包的中文回报指引(本行 `config.localizedReturnGuidancePresets`)。
|
|
28
|
-
* 由装配给:它才知道自己注册的那份 preset 叫什么;不传即一律上游英文。
|
|
29
|
-
*/
|
|
12
|
+
export interface SubagentRowsOptions {
|
|
30
13
|
readonly localizedReturnGuidancePresets?: readonly string[];
|
|
31
14
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
export { PatchRow, RowEntry, SubagentRowsOptions, subagentRows };
|
|
15
|
+
export declare function subagentRows(options?: SubagentRowsOptions): readonly PatchRow[];
|
|
16
|
+
//#endregion
|
package/dist/rows.mjs
CHANGED
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Subagent Service",
|
|
4
|
-
"description": "Thin-shell fork of @deepseek-ai/dsh-subagent: takes over the `subagent` row
|
|
4
|
+
"description": "Thin-shell fork of @deepseek-ai/dsh-subagent: takes over the official `subagent` row for two wording changes — the continuable child's return guidance and the child's delegation-scope statement, both in Chinese — plus row-id reuse; everything not intentionally changed is imported from the vendored upstream source."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "子智能体服务",
|
|
4
|
-
"description": "上游 @deepseek-ai/dsh-subagent 的薄壳 fork
|
|
4
|
+
"description": "上游 @deepseek-ai/dsh-subagent 的薄壳 fork:接管官方 `subagent` 行,改两处文案——连续子智能体的回报指引与子代理的委派范围说明都换成中文;并按官方行 id 复用(设置卡照旧)。其余未有意改动的都从 vendor 上游源码内联。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morlay/dsh-subagent",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Thin-shell fork of @deepseek-ai/dsh-subagent: takes over the `subagent` row
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "Thin-shell fork of @deepseek-ai/dsh-subagent: takes over the official `subagent` row for two wording changes — the continuable child's return guidance in Chinese wording and the child's Chinese delegation-scope runtime context (`subagent:delegation`) — plus the row-id reuse (same `subagent` id, so the official settings card stays); everything not intentionally changed is imported from the vendored upstream source.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
7
7
|
"dsh-bundle",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@deepseek-ai/dsh-session-persistence-jsonl": "0.2.0-rc.1",
|
|
38
38
|
"@deepseek-ai/dsh-subagent-fork-in-process": "0.2.0-rc.1",
|
|
39
39
|
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.0-rc.1",
|
|
40
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1",
|
|
40
41
|
"@deepseek-ai/dsh-tool-subagent-control": "0.2.0-rc.1",
|
|
41
42
|
"@deepseek-ai/dsh-util-values": "0.2.0-rc.1",
|
|
42
43
|
"@deepseek-ai/schemastery": "~3.18.4",
|