@morlay/dsh-subagent 0.0.5 → 0.0.7
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 +6 -5
- package/dist/index.d.mts +334 -1019
- package/dist/index.mjs +2000 -7392
- package/package.json +38 -30
- package/src/continuation-messages.ts +185 -0
- package/src/delegation-context.ts +39 -0
- package/src/index.ts +627 -0
- package/src/manager.ts +1515 -0
- package/src/rows.ts +44 -0
- package/src/vendor/dsh-subagent/activation.ts +200 -0
- package/src/vendor/dsh-subagent/archive-admission.ts +97 -0
- package/src/vendor/dsh-subagent/assistant-output.ts +77 -0
- package/src/vendor/dsh-subagent/catalog.ts +196 -0
- package/src/vendor/dsh-subagent/child-agent.ts +300 -0
- package/src/vendor/dsh-subagent/continuation-messages.ts +177 -0
- package/src/vendor/dsh-subagent/control-types.ts +146 -0
- package/src/vendor/dsh-subagent/control.ts +123 -0
- package/src/vendor/dsh-subagent/depth.ts +55 -0
- package/src/vendor/dsh-subagent/descriptor.ts +275 -0
- package/src/vendor/dsh-subagent/error.ts +15 -0
- package/src/vendor/dsh-subagent/index.ts +718 -0
- package/src/vendor/dsh-subagent/internal.ts +114 -0
- package/src/vendor/dsh-subagent/lifecycle.ts +172 -0
- package/src/vendor/dsh-subagent/list-children.ts +141 -0
- package/src/vendor/dsh-subagent/manager.ts +1649 -0
- package/src/vendor/dsh-subagent/out-of-process.ts +219 -0
- package/src/vendor/dsh-subagent/projection-types.ts +84 -0
- package/src/vendor/dsh-subagent/projection.ts +205 -0
- package/src/vendor/dsh-subagent/structured.ts +164 -0
- package/src/vendor/dsh-subagent/types.ts +356 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import { Context, Volatile } from "@deepseek-ai/cordis";
|
|
1
2
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
-
import {
|
|
3
|
-
import { ObjectJsonSchema, ToolRestriction } from "@deepseek-ai/dsh-tools";
|
|
4
|
-
import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
5
|
-
import { ContentBlock, HarnessError, MessageId, ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
3
|
+
import { ContentBlock, HarnessError, MessageId, ReasoningEffortId } from "@deepseek-ai/dsh-llm";
|
|
6
4
|
import { Agent, AgentOptions, CreateAgentOptions } from "@deepseek-ai/dsh-agent";
|
|
7
5
|
import { Session, SessionEvent, SessionId, SessionLogOffset } from "@deepseek-ai/dsh-session";
|
|
8
|
-
import {
|
|
9
|
-
import { Context, Service, Volatile } from "@deepseek-ai/cordis";
|
|
6
|
+
import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
10
7
|
import { PromptContentPart } from "@deepseek-ai/dsh-attachment/types";
|
|
8
|
+
import { Branded } from "@deepseek-ai/dsh-brand";
|
|
11
9
|
import { MessageId as MessageId$1 } from "@deepseek-ai/dsh-llm/brand";
|
|
12
|
-
import { SessionId as SessionId$1, SessionSeq
|
|
13
|
-
|
|
10
|
+
import { SessionId as SessionId$1, SessionSeq } from "@deepseek-ai/dsh-session/types";
|
|
11
|
+
import { ObjectJsonSchema, ToolRestriction } from "@deepseek-ai/dsh-tools";
|
|
12
|
+
import { Scoped } from "@deepseek-ai/dsh-scope";
|
|
13
|
+
import { ChunkedList } from "@deepseek-ai/dsh-chunked-list";
|
|
14
|
+
import { SandboxMode } from "@deepseek-ai/dsh-sandbox";
|
|
15
|
+
//#region src/vendor/dsh-subagent/control-types.d.ts
|
|
14
16
|
/**
|
|
15
17
|
* Client-minted identity of one browser prompt, persisted on the exact accepted
|
|
16
18
|
* message. It carries the Session Controller's `session-request-id` brand so a
|
|
@@ -18,7 +20,7 @@ import { SessionId as SessionId$1, SessionSeq as SessionSeq$1 } from "@deepseek-
|
|
|
18
20
|
* vocabulary; that package depends on this one, so the brand is spelled here
|
|
19
21
|
* rather than imported.
|
|
20
22
|
*/
|
|
21
|
-
type SubagentPromptRequestId = Branded<
|
|
23
|
+
type SubagentPromptRequestId = Branded<"session-request-id">;
|
|
22
24
|
/** Shared child fields for recursive catalog listing. */
|
|
23
25
|
type SubagentCatalogRow = {
|
|
24
26
|
/** The durable child session id, stable across Activations. */
|
|
@@ -27,15 +29,20 @@ type SubagentCatalogRow = {
|
|
|
27
29
|
* Whether recursive catalog listing observed a resident Session. This
|
|
28
30
|
* does not encode a durable outcome or guarantee continuation delivery.
|
|
29
31
|
*/
|
|
30
|
-
readonly activity:
|
|
32
|
+
readonly activity: "running" | "inactive";
|
|
31
33
|
} & ({
|
|
32
34
|
/** A terminal one-shot child. */
|
|
33
|
-
readonly mode:
|
|
35
|
+
readonly mode: "one-shot";
|
|
36
|
+
/** Optional durable creation label from the parent catalog. */
|
|
37
|
+
readonly label?: string;
|
|
38
|
+
} | {
|
|
39
|
+
/** An external execution without a local child Session. */
|
|
40
|
+
readonly mode: "external";
|
|
34
41
|
/** Optional durable creation label from the parent catalog. */
|
|
35
42
|
readonly label?: string;
|
|
36
43
|
} | {
|
|
37
44
|
/** A resumable conversation. */
|
|
38
|
-
readonly mode:
|
|
45
|
+
readonly mode: "continuable";
|
|
39
46
|
/** Durable creation label from the parent catalog. */
|
|
40
47
|
readonly label: string;
|
|
41
48
|
});
|
|
@@ -44,11 +51,11 @@ type SubagentCatalogRow = {
|
|
|
44
51
|
* unknown catalog modes or unreadable child catalogs.
|
|
45
52
|
*/
|
|
46
53
|
type SubagentListEntry = (SubagentCatalogRow & {
|
|
47
|
-
readonly kind:
|
|
54
|
+
readonly kind: "child";
|
|
48
55
|
/** Whether the child catalog contains a direct child. */
|
|
49
56
|
readonly hasChildren: boolean;
|
|
50
57
|
}) | {
|
|
51
|
-
readonly kind:
|
|
58
|
+
readonly kind: "diagnostic";
|
|
52
59
|
/** The candidate's session id. */
|
|
53
60
|
readonly id: SessionId$1;
|
|
54
61
|
/**
|
|
@@ -57,19 +64,21 @@ type SubagentListEntry = (SubagentCatalogRow & {
|
|
|
57
64
|
* stops that branch. `unsupported` means the parent catalog records an
|
|
58
65
|
* unknown child mode; its readable catalog is still traversed.
|
|
59
66
|
*/
|
|
60
|
-
readonly reason:
|
|
67
|
+
readonly reason: "corrupt" | "unsupported" | "unavailable";
|
|
61
68
|
};
|
|
62
69
|
/** Durable parent/child browsing address; unknown mode is resolved when child history is read. */
|
|
63
70
|
type SubagentAddress = {
|
|
64
71
|
readonly parentSessionId: SessionId$1;
|
|
65
72
|
readonly childSessionId: SessionId$1;
|
|
66
73
|
} & ({
|
|
67
|
-
readonly mode:
|
|
74
|
+
readonly mode: "one-shot";
|
|
68
75
|
} | {
|
|
69
|
-
readonly mode:
|
|
76
|
+
readonly mode: "continuable";
|
|
70
77
|
} | {
|
|
71
|
-
readonly mode:
|
|
78
|
+
readonly mode: "unknown";
|
|
72
79
|
});
|
|
80
|
+
/** One Agent inbox destination, as the prompt request selects it. */
|
|
81
|
+
type SubagentDelivery = SubagentPromptRequest["delivery"];
|
|
73
82
|
/** One human message addressed to a continuable direct child. */
|
|
74
83
|
interface SubagentPromptRequest {
|
|
75
84
|
/** Identity persisted on the accepted message, minted before the call. */
|
|
@@ -77,9 +86,9 @@ interface SubagentPromptRequest {
|
|
|
77
86
|
readonly parentSessionId: SessionId$1;
|
|
78
87
|
readonly childSessionId: SessionId$1;
|
|
79
88
|
/** Required discriminator retained from the browser control address. */
|
|
80
|
-
readonly mode:
|
|
89
|
+
readonly mode: "continuable";
|
|
81
90
|
/** Whether this message queues a later turn or targets the nearest step. */
|
|
82
|
-
readonly delivery:
|
|
91
|
+
readonly delivery: "queue" | "steer";
|
|
83
92
|
/**
|
|
84
93
|
* Browser prompt parts delivered as the child's user message. The Host
|
|
85
94
|
* admits and persists image parts before delivery, so the wire never
|
|
@@ -101,195 +110,78 @@ interface SubagentInterruptReceipt {
|
|
|
101
110
|
* Failure details the control surface answers with. Prompts and interrupts
|
|
102
111
|
* share these failures with the Client Remote result.
|
|
103
112
|
*/
|
|
104
|
-
declare module
|
|
113
|
+
declare module "@deepseek-ai/dsh-workspace/types" {
|
|
105
114
|
interface SessionActivityKindMap {
|
|
106
115
|
/** A subagent session delegated from this session (at any depth) is inside a turn. */
|
|
107
116
|
subagent: true;
|
|
108
117
|
}
|
|
109
118
|
}
|
|
110
|
-
declare module
|
|
119
|
+
declare module "@deepseek-ai/dsh-typert-protocol" {
|
|
111
120
|
interface RemoteErrorDetailsMap {
|
|
112
121
|
/** A browser-supplied zone is neither UTC nor a canonical IANA name. */
|
|
113
|
-
|
|
122
|
+
"subagent/invalid-time-zone": {
|
|
114
123
|
readonly value: string;
|
|
115
124
|
};
|
|
116
125
|
/** No live Agent carries the addressed parent session. */
|
|
117
|
-
|
|
126
|
+
"subagent/parent-unavailable": {
|
|
118
127
|
readonly parentSessionId: SessionId$1;
|
|
119
128
|
};
|
|
120
129
|
/** The addressed child cannot take a continuation. */
|
|
121
|
-
|
|
130
|
+
"subagent/not-resumable": {
|
|
122
131
|
readonly childSessionId: SessionId$1;
|
|
123
132
|
};
|
|
124
133
|
/** The claimed parent does not own the addressed child. */
|
|
125
|
-
|
|
134
|
+
"subagent/unauthorized": {
|
|
126
135
|
readonly childSessionId: SessionId$1;
|
|
127
136
|
};
|
|
128
137
|
/** Image admission or model image-capability refusal. */
|
|
129
|
-
|
|
138
|
+
"subagent/attachment-invalid": {
|
|
130
139
|
readonly reason: string;
|
|
131
140
|
};
|
|
132
141
|
/** The child exists but its inbox cannot admit the message now. */
|
|
133
|
-
|
|
142
|
+
"subagent/delivery-unavailable": {
|
|
134
143
|
readonly childSessionId: SessionId$1;
|
|
135
144
|
};
|
|
136
145
|
}
|
|
137
146
|
}
|
|
138
147
|
//#endregion
|
|
139
|
-
//#region
|
|
140
|
-
declare module '@deepseek-ai/dsh-session/types' {
|
|
141
|
-
interface SessionEventMap {
|
|
142
|
-
/**
|
|
143
|
-
* Durable identity and lifecycle mode of a session-backed subagent child,
|
|
144
|
-
* appended once by the establishing provider inside the child's initial
|
|
145
|
-
* turn, before its first request. Continuable records also carry their
|
|
146
|
-
* resumable composition. Log-only: it carries no `surfaceOp`, never enters
|
|
147
|
-
* model history, and survives compaction.
|
|
148
|
-
*/
|
|
149
|
-
'subagent/descriptor': SubagentDescriptorData;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* The current descriptor format version, stamped into every appended
|
|
154
|
-
* `subagent/descriptor` event and required verbatim by {@link foldSubagentDescriptor}.
|
|
155
|
-
* Supporting another composition input is a deliberate version change, never
|
|
156
|
-
* an implicit extra field.
|
|
157
|
-
*/
|
|
158
|
-
export declare const SUBAGENT_DESCRIPTOR_VERSION = 3;
|
|
159
|
-
/** Fields shared by every supported `subagent/descriptor` payload. */
|
|
160
|
-
interface SubagentDescriptorBase {
|
|
161
|
-
/** Descriptor format version ({@link SUBAGENT_DESCRIPTOR_VERSION}). */
|
|
162
|
-
readonly version: number;
|
|
163
|
-
/** Whether the child is a terminal one-shot run or a resumable conversation. */
|
|
164
|
-
readonly mode: 'one-shot' | 'continuable';
|
|
165
|
-
/** The `ctx.subagents` provider name that established the child. */
|
|
166
|
-
readonly provider: string;
|
|
167
|
-
}
|
|
168
|
-
/** A session-backed subagent that cannot be cold-resumed after its run. */
|
|
169
|
-
interface OneShotSubagentDescriptorData extends SubagentDescriptorBase {
|
|
170
|
-
readonly mode: 'one-shot';
|
|
171
|
-
/**
|
|
172
|
-
* The initial delegation's short `description`, kept as the child's durable
|
|
173
|
-
* creation label so enumeration can identify the conversation without
|
|
174
|
-
* replaying parent tool results or exposing the child prompt.
|
|
175
|
-
*/
|
|
176
|
-
readonly label?: string;
|
|
177
|
-
}
|
|
178
|
-
/** A session-backed subagent whose declared composition supports cold resume. */
|
|
179
|
-
interface ContinuableSubagentDescriptorData extends SubagentDescriptorBase {
|
|
180
|
-
readonly mode: 'continuable';
|
|
181
|
-
/** The initial delegation's short `description`, used for durable enumeration. */
|
|
182
|
-
readonly label: string;
|
|
183
|
-
/** Resolved child `agentOptions.provider`, when one was declared. */
|
|
184
|
-
readonly agentProvider?: string;
|
|
185
|
-
/** Resolved child `agentOptions.model`, when one was declared. */
|
|
186
|
-
readonly agentModel?: string;
|
|
187
|
-
/** Resolved child `agentOptions.reasoningEffort`, when one was declared. */
|
|
188
|
-
readonly agentReasoningEffort?: ReasoningEffortId;
|
|
189
|
-
/** Per-child persona that shadows the deployment persona on resume. */
|
|
190
|
-
readonly persona?: string;
|
|
191
|
-
/** Child tool scoping reapplied on resume. */
|
|
192
|
-
readonly toolFilter?: ToolRestriction;
|
|
193
|
-
}
|
|
194
|
-
/** The supported durable subagent identity and optional continuation composition. */
|
|
195
|
-
type SubagentDescriptorData = OneShotSubagentDescriptorData | ContinuableSubagentDescriptorData;
|
|
196
|
-
/** Fields shared by descriptor snapshot inputs. */
|
|
197
|
-
interface SubagentDescriptorInputBase {
|
|
198
|
-
/** Whether the child is a terminal one-shot run or a resumable conversation. */
|
|
199
|
-
readonly mode: 'one-shot' | 'continuable';
|
|
200
|
-
/** The `ctx.subagents` provider name that will establish the child. */
|
|
201
|
-
readonly provider: string;
|
|
202
|
-
}
|
|
203
|
-
/** Input for a one-shot child's durable identity. */
|
|
204
|
-
interface OneShotSubagentDescriptorInput extends SubagentDescriptorInputBase {
|
|
205
|
-
readonly mode: 'one-shot';
|
|
206
|
-
/** Optional initial delegation `description` used as the durable creation label. */
|
|
207
|
-
readonly label?: string;
|
|
208
|
-
}
|
|
209
|
-
/** Input for a continuable child's durable identity and resumable composition. */
|
|
210
|
-
interface ContinuableSubagentDescriptorInput extends SubagentDescriptorInputBase {
|
|
211
|
-
readonly mode: 'continuable';
|
|
212
|
-
/** Initial delegation `description` used for durable enumeration. */
|
|
213
|
-
readonly label: string;
|
|
214
|
-
/** Requested child `agentOptions.provider`. */
|
|
215
|
-
readonly agentProvider?: string;
|
|
216
|
-
/** Requested child `agentOptions.model`. */
|
|
217
|
-
readonly agentModel?: string;
|
|
218
|
-
/** Requested child `agentOptions.reasoningEffort`. */
|
|
219
|
-
readonly agentReasoningEffort?: ReasoningEffortId;
|
|
220
|
-
/** Requested per-child persona. */
|
|
221
|
-
readonly persona?: string;
|
|
222
|
-
/** Requested child tool scoping. */
|
|
223
|
-
readonly toolFilter?: ToolRestriction;
|
|
224
|
-
}
|
|
225
|
-
/** Inputs {@link snapshotSubagentDescriptor} validates and detaches. */
|
|
226
|
-
type SubagentDescriptorInput = OneShotSubagentDescriptorInput | ContinuableSubagentDescriptorInput;
|
|
227
|
-
/**
|
|
228
|
-
* Validate and detach descriptor inputs into the durable payload, before any
|
|
229
|
-
* Task or provider work begins — the same detached lossless-JSON boundary the
|
|
230
|
-
* session log itself enforces, applied early so a synchronous validation
|
|
231
|
-
* failure rejects the tool call without creating a Task.
|
|
232
|
-
* @param input - the caller-collected composition fields.
|
|
233
|
-
* @returns the versioned, detached descriptor payload.
|
|
234
|
-
* @throws when a field is not losslessly JSON-serializable.
|
|
235
|
-
*/
|
|
236
|
-
export declare function snapshotSubagentDescriptor(input: OneShotSubagentDescriptorInput): OneShotSubagentDescriptorData;
|
|
237
|
-
/**
|
|
238
|
-
* Validate and detach a continuable descriptor input.
|
|
239
|
-
* @param input - the caller-collected continuable composition fields.
|
|
240
|
-
* @returns the versioned, detached continuable descriptor payload.
|
|
241
|
-
* @throws when a field is not losslessly JSON-serializable.
|
|
242
|
-
*/
|
|
243
|
-
export declare function snapshotSubagentDescriptor(input: ContinuableSubagentDescriptorInput): ContinuableSubagentDescriptorData;
|
|
244
|
-
/**
|
|
245
|
-
* Fold a persisted child log to its supported descriptor. The first
|
|
246
|
-
* `subagent/descriptor` event is authoritative — the establishing provider
|
|
247
|
-
* appends exactly one, so a later same-type event cannot rewrite the declared
|
|
248
|
-
* composition.
|
|
249
|
-
* @param events - the loaded child session events.
|
|
250
|
-
* @returns the descriptor, or `undefined` when the log has none or its
|
|
251
|
-
* version is not {@link SUBAGENT_DESCRIPTOR_VERSION} (the child cannot be
|
|
252
|
-
* classified by this runtime).
|
|
253
|
-
* @throws when a current-version persisted payload does not match its complete
|
|
254
|
-
* declared schema.
|
|
255
|
-
*/
|
|
256
|
-
export declare function foldSubagentDescriptor(events: readonly SessionEvent[]): SubagentDescriptorData | undefined;
|
|
257
|
-
//#endregion
|
|
258
|
-
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/types.d.ts
|
|
148
|
+
//#region src/vendor/dsh-subagent/types.d.ts
|
|
259
149
|
/** Identifies one accepted subagent run across its lifecycle event pair. */
|
|
260
|
-
export type SubagentRunId = Branded<
|
|
150
|
+
export type SubagentRunId = Branded<"SubagentRunId">;
|
|
261
151
|
/**
|
|
262
152
|
* Brand a string as a {@link SubagentRunId}.
|
|
263
153
|
* @param id - the raw run id.
|
|
264
154
|
* @returns the same string, branded.
|
|
265
155
|
*/
|
|
266
156
|
export declare function SubagentRunId(id: string): SubagentRunId;
|
|
267
|
-
/**
|
|
268
|
-
interface
|
|
269
|
-
/**
|
|
157
|
+
/** One managed child execution and its result delivery policy. */
|
|
158
|
+
interface SubagentActivationSpec {
|
|
159
|
+
/** Registered backend to use. */
|
|
270
160
|
readonly provider: string;
|
|
271
|
-
/**
|
|
161
|
+
/** Short task label retained in cataloged child membership. */
|
|
272
162
|
readonly label: string;
|
|
273
|
-
/**
|
|
274
|
-
* Optional caller-reserved child identity. Omission preserves the manager's
|
|
275
|
-
* UUID allocation; supplying one lets a durable parent record provisioning
|
|
276
|
-
* before child materialization without a second identity handshake.
|
|
277
|
-
*/
|
|
163
|
+
/** Optional reserved identity for a local child; external backends allocate their own ids. */
|
|
278
164
|
readonly childId?: SessionId;
|
|
279
|
-
/**
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
*/
|
|
283
|
-
readonly request: Omit<SubagentStartRequest, 'label' | 'signal' | 'outputSchema'>;
|
|
284
|
-
/** Caller cancellation, owning the operation only until inbox acceptance. */
|
|
165
|
+
/** Task, parent, and backend-supported execution options. */
|
|
166
|
+
readonly request: Omit<SubagentStartRequest, "label" | "signal">;
|
|
167
|
+
/** Cancellation before publication; callers own later cancellation through dispose. */
|
|
285
168
|
readonly signal: AbortSignal;
|
|
169
|
+
/** Parent delivery notifies the model; caller delivery only returns the result. Local children always enter the parent catalog. */
|
|
170
|
+
readonly delivery: "parent" | "caller";
|
|
286
171
|
}
|
|
287
|
-
/**
|
|
288
|
-
interface
|
|
289
|
-
/**
|
|
172
|
+
/** A managed execution; disposal addresses this exact activation, never a later resume. */
|
|
173
|
+
interface SubagentActivation {
|
|
174
|
+
/** Stable identity of the child. */
|
|
290
175
|
readonly childId: SessionId;
|
|
291
|
-
/**
|
|
292
|
-
readonly messageId
|
|
176
|
+
/** Accepted inbox message, when the backend has a local inbox. */
|
|
177
|
+
readonly messageId?: MessageId;
|
|
178
|
+
/**
|
|
179
|
+
* Execution result after teardown settles and notifications are sent; capture failures reject.
|
|
180
|
+
* Teardown failures are reported by dispose() without replacing a captured result.
|
|
181
|
+
*/
|
|
182
|
+
readonly result: Promise<SubagentResult>;
|
|
183
|
+
/** Stop and release this activation and its owned descendants; rejects on teardown failure. */
|
|
184
|
+
dispose(): Promise<void>;
|
|
293
185
|
}
|
|
294
186
|
/**
|
|
295
187
|
* Authority under which one interrupt request is admitted. `user` carries the
|
|
@@ -297,10 +189,10 @@ interface ContinuableStart {
|
|
|
297
189
|
* the exact live Agent object whose recorded lineage must contain the caller.
|
|
298
190
|
*/
|
|
299
191
|
type SubagentInterruptAuthority = {
|
|
300
|
-
readonly kind:
|
|
192
|
+
readonly kind: "user";
|
|
301
193
|
readonly parentSessionId: SessionId;
|
|
302
194
|
} | {
|
|
303
|
-
readonly kind:
|
|
195
|
+
readonly kind: "ancestor";
|
|
304
196
|
readonly agent: Agent;
|
|
305
197
|
};
|
|
306
198
|
/** Options for one model-authored message between adjacent Agents. */
|
|
@@ -310,22 +202,19 @@ interface SubagentSendMessageOptions {
|
|
|
310
202
|
}
|
|
311
203
|
/**
|
|
312
204
|
* Observe-only identifying detail for a published subagent run, carried by
|
|
313
|
-
* `subagent/start`.
|
|
314
|
-
* payload, so an observer sees the same vocabulary for both.
|
|
205
|
+
* `subagent/start`. Local and external activations share this payload.
|
|
315
206
|
*/
|
|
316
207
|
interface SubagentRunInfo {
|
|
317
208
|
/** Unique identity shared with the paired terminal event. */
|
|
318
209
|
readonly runId: SubagentRunId;
|
|
319
210
|
/**
|
|
320
|
-
* Provider name recorded when the child was first created
|
|
321
|
-
*
|
|
322
|
-
* Activation cold-resumes, because neither lifecycle depends on continued
|
|
323
|
-
* registration.
|
|
211
|
+
* Provider name recorded when the child was first created, retained even
|
|
212
|
+
* after that provider is unregistered.
|
|
324
213
|
*/
|
|
325
214
|
readonly provider: string;
|
|
326
215
|
/** The child agent's id. */
|
|
327
216
|
readonly id: SessionId;
|
|
328
|
-
/**
|
|
217
|
+
/** Whether this activation owns a local Agent, fixed at publication. */
|
|
329
218
|
readonly local: boolean;
|
|
330
219
|
}
|
|
331
220
|
/**
|
|
@@ -339,10 +228,10 @@ interface SubagentRunEndInfo {
|
|
|
339
228
|
readonly provider: string;
|
|
340
229
|
/** The child agent's id. */
|
|
341
230
|
readonly id: SessionId;
|
|
342
|
-
/**
|
|
231
|
+
/** Whether this activation owns a local Agent, fixed at publication. */
|
|
343
232
|
readonly local: boolean;
|
|
344
233
|
/** The terminal stop reason. */
|
|
345
|
-
readonly stopReason: SubagentResult[
|
|
234
|
+
readonly stopReason: SubagentResult["stopReason"];
|
|
346
235
|
/**
|
|
347
236
|
* The child's final assistant output, selected by the same rule as
|
|
348
237
|
* {@link SubagentResult.output}; absent on infrastructure rejection or when
|
|
@@ -351,39 +240,39 @@ interface SubagentRunEndInfo {
|
|
|
351
240
|
readonly lastAssistantMessage?: readonly ContentBlock[];
|
|
352
241
|
}
|
|
353
242
|
/**
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
* {@link SubagentProvider.start} path, where the provider composes the child;
|
|
359
|
-
* continuable children are composed by the continuation manager itself and are
|
|
360
|
-
* gated by {@link SubagentProvider.prepareContinuable} instead. Each flag
|
|
361
|
-
* corresponds one-to-one to a {@link SubagentStartRequest} option: `depthLimit`
|
|
362
|
-
* to `maxDepth`; the other names match.
|
|
243
|
+
* Start-time options supported by a registered backend. The manager checks
|
|
244
|
+
* every requested option before preparing a local child or starting an external
|
|
245
|
+
* execution. depthLimit controls maxDepth; the remaining flag names match
|
|
246
|
+
* SubagentStartRequest fields.
|
|
363
247
|
*/
|
|
364
248
|
interface SubagentCapabilities {
|
|
365
249
|
readonly agentOptions: boolean;
|
|
250
|
+
/** Supports selecting a preset independently of the parent's composition. */
|
|
251
|
+
readonly agentPreset: boolean;
|
|
366
252
|
readonly outputSchema: boolean;
|
|
367
253
|
readonly depthLimit: boolean;
|
|
368
|
-
readonly toolFilter: boolean;
|
|
369
|
-
readonly persona: boolean;
|
|
370
254
|
}
|
|
371
255
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
* and resolves the durable descriptor before dispatching to
|
|
376
|
-
* {@link SubagentProvider.start}.
|
|
256
|
+
* Task and optional capabilities supplied to a backend. startActivation carries
|
|
257
|
+
* these fields in request while owning its label, cancellation, and delivery
|
|
258
|
+
* policy separately.
|
|
377
259
|
*/
|
|
378
260
|
interface SubagentStartRequest {
|
|
261
|
+
/** Initial child directory; relative paths resolve against the parent's current directory. Omitted inherits that directory at start. */
|
|
262
|
+
readonly cwd?: string;
|
|
263
|
+
/**
|
|
264
|
+
* Independent preset id; omission joins the parent's current generation.
|
|
265
|
+
* Requires a provider with `capabilities.agentPreset` that does not inherit
|
|
266
|
+
* parent context.
|
|
267
|
+
*/
|
|
268
|
+
readonly agentPreset?: string;
|
|
379
269
|
/** Optional short display label persisted with a session-backed child. */
|
|
380
270
|
readonly label?: string;
|
|
381
271
|
/** Content delivered as the child's user message. */
|
|
382
272
|
readonly prompt: ContentBlock[];
|
|
383
273
|
/**
|
|
384
|
-
* The spawning agent.
|
|
385
|
-
*
|
|
386
|
-
* and only when no deployment `cwd` override is configured.
|
|
274
|
+
* The spawning agent. Its effective directory supplies the default cwd;
|
|
275
|
+
* in-process children retain its origin, lineage, and delegation depth.
|
|
387
276
|
*/
|
|
388
277
|
readonly parent: Agent;
|
|
389
278
|
/**
|
|
@@ -415,30 +304,11 @@ interface SubagentStartRequest {
|
|
|
415
304
|
* start otherwise.
|
|
416
305
|
*/
|
|
417
306
|
readonly maxDepth?: number;
|
|
418
|
-
/**
|
|
419
|
-
* Optional child tool scoping. Requires {@link SubagentCapabilities.toolFilter};
|
|
420
|
-
* rejected at start otherwise. In-process backends apply it as a scoped
|
|
421
|
-
* `tools.restrict()` in the child's creation window: the named tools vanish
|
|
422
|
-
* from the child's prompt AND refuse to execute (one visibility), with loud
|
|
423
|
-
* unknown-name validation.
|
|
424
|
-
*/
|
|
425
|
-
readonly toolFilter?: ToolRestriction;
|
|
426
|
-
/**
|
|
427
|
-
* Optional per-child persona. Requires {@link SubagentCapabilities.persona};
|
|
428
|
-
* rejected at start otherwise. In-process backends register it as a scoped
|
|
429
|
-
* `deployment:persona-prefix` section on the child, SHADOWING the deployment's
|
|
430
|
-
* persona for this child alone — same template semantics as the deployment
|
|
431
|
-
* persona (strict `{{…}}` interpolation against the registered variables).
|
|
432
|
-
*/
|
|
433
|
-
readonly persona?: string;
|
|
434
307
|
}
|
|
435
|
-
/**
|
|
436
|
-
* Provider-facing one-shot request after {@link SubagentRuntime.start} resolves
|
|
437
|
-
* the durable child descriptor.
|
|
438
|
-
*/
|
|
308
|
+
/** Provider-facing request with an absolute directory selected before startup. */
|
|
439
309
|
interface ResolvedSubagentStartRequest extends SubagentStartRequest {
|
|
440
|
-
/**
|
|
441
|
-
readonly
|
|
310
|
+
/** Absolute child directory captured from the parent or explicit request. */
|
|
311
|
+
readonly cwd: string;
|
|
442
312
|
}
|
|
443
313
|
/**
|
|
444
314
|
* What the continuation manager asks a provider for while materializing one
|
|
@@ -448,6 +318,8 @@ interface ResolvedSubagentStartRequest extends SubagentStartRequest {
|
|
|
448
318
|
* history.
|
|
449
319
|
*/
|
|
450
320
|
interface ContinuableCreateRequest {
|
|
321
|
+
/** Absolute initial directory captured before provider preparation. */
|
|
322
|
+
readonly cwd: string;
|
|
451
323
|
/** The reserved durable child session id, for provider diagnostics. */
|
|
452
324
|
readonly sessionId: SessionId;
|
|
453
325
|
/** The delegating parent agent whose history a seeding provider reads. */
|
|
@@ -480,15 +352,15 @@ interface ContinuableCreateSpec {
|
|
|
480
352
|
*/
|
|
481
353
|
interface SubagentStopReasonMap {
|
|
482
354
|
/** The child finished its turn normally. */
|
|
483
|
-
completed:
|
|
355
|
+
completed: "completed";
|
|
484
356
|
/** Cancelled through the request signal or disposal. */
|
|
485
|
-
aborted:
|
|
357
|
+
aborted: "aborted";
|
|
486
358
|
/** Model or transport failure. */
|
|
487
|
-
error:
|
|
359
|
+
error: "error";
|
|
488
360
|
/** The child hit its token ceiling before finishing. */
|
|
489
|
-
|
|
361
|
+
"max-tokens": "max-tokens";
|
|
490
362
|
/** The child declined the task. */
|
|
491
|
-
refusal:
|
|
363
|
+
refusal: "refusal";
|
|
492
364
|
}
|
|
493
365
|
/** The union over {@link SubagentStopReasonMap} — widens automatically as backends merge in variants. */
|
|
494
366
|
type SubagentStopReason = SubagentStopReasonMap[keyof SubagentStopReasonMap];
|
|
@@ -523,27 +395,15 @@ interface SubagentResult {
|
|
|
523
395
|
readonly stopReason: SubagentStopReason;
|
|
524
396
|
}
|
|
525
397
|
/**
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
* continuation manager holds their `AgentHandle` directly and orders every
|
|
532
|
-
* turn through the child's own inbox.
|
|
398
|
+
* Backend execution handle owned directly by the activation registry.
|
|
399
|
+
* A result may become available before resource release; the manager always
|
|
400
|
+
* disposes the handle and awaits cleanup. Backend startup failures clean up
|
|
401
|
+
* partial resources before rejecting, while accepted execution failures settle
|
|
402
|
+
* through result.
|
|
533
403
|
*/
|
|
534
404
|
interface SubagentRun {
|
|
535
|
-
/**
|
|
536
|
-
* Parent-scoped run id. For a local run, this MUST equal the published child
|
|
537
|
-
* session id, whose `parentSession` records `request.parent.session.id`; a
|
|
538
|
-
* remote provider mints an id unique in the parent namespace.
|
|
539
|
-
*/
|
|
405
|
+
/** Provider-minted id, unique across all parents, providers, and local Sessions in this runtime. */
|
|
540
406
|
readonly id: SessionId;
|
|
541
|
-
/**
|
|
542
|
-
* The exact published in-process child, or `undefined` for a remote run.
|
|
543
|
-
* When present, its id is {@link id}; the provider retains no ownership
|
|
544
|
-
* implication beyond the run's ordinary {@link dispose} contract.
|
|
545
|
-
*/
|
|
546
|
-
readonly localAgent: Agent | undefined;
|
|
547
407
|
/**
|
|
548
408
|
* Resolves with the child's terminal {@link SubagentResult} when the run
|
|
549
409
|
* settles. Does NOT reject on a child-level failure — a model/transport
|
|
@@ -578,7 +438,7 @@ interface SubagentProvider {
|
|
|
578
438
|
*/
|
|
579
439
|
readonly inheritsParentContext: boolean;
|
|
580
440
|
/**
|
|
581
|
-
* Optional static provider-owned provider/model route for
|
|
441
|
+
* Optional static provider-owned provider/model route for child Agent
|
|
582
442
|
* options. Consumers merge tool/model overrides over these values before
|
|
583
443
|
* preflight; providers whose route derives from the parent omit it. The value
|
|
584
444
|
* is detached immutable data and requires `agentOptions` support.
|
|
@@ -588,24 +448,21 @@ interface SubagentProvider {
|
|
|
588
448
|
model: string;
|
|
589
449
|
}>;
|
|
590
450
|
/**
|
|
591
|
-
* Establish
|
|
451
|
+
* Establish one external execution and return its owned handle.
|
|
592
452
|
* The service has already validated that every requested start-time
|
|
593
|
-
* capability is supported
|
|
594
|
-
*
|
|
595
|
-
* initial turn. Before fulfillment, the provider owns setup and cleans any
|
|
596
|
-
* unpublished partial resources before rejecting. Ownership transfers on
|
|
453
|
+
* capability is supported. Before fulfillment, the provider owns setup and
|
|
454
|
+
* cleans any unpublished partial resources before rejecting. Ownership transfers on
|
|
597
455
|
* fulfillment; subsequent turn or infrastructure failure settles through
|
|
598
456
|
* the returned run. Distinct starts may overlap; cancellation, failure,
|
|
599
457
|
* result settlement, and disposal remain independent for each run.
|
|
600
458
|
*/
|
|
601
|
-
start(request: ResolvedSubagentStartRequest): Promise<SubagentRun>;
|
|
459
|
+
start?(request: ResolvedSubagentStartRequest): Promise<SubagentRun>;
|
|
602
460
|
/**
|
|
603
461
|
* OPTIONAL (continuable-creation capability): contribute the detached
|
|
604
462
|
* creation inputs that distinguish this provider's continuable children —
|
|
605
463
|
* only whether the child session is seeded with parent history. Method
|
|
606
|
-
* presence
|
|
607
|
-
*
|
|
608
|
-
* ordinary one-shot delegations.
|
|
464
|
+
* presence selects local activation execution. Providers without it execute
|
|
465
|
+
* through start and do not accept subsequent messages.
|
|
609
466
|
*
|
|
610
467
|
* This is the provider's ONLY participation in a continuable child. The
|
|
611
468
|
* continuation manager owns identity reservation, composition, Agent
|
|
@@ -617,19 +474,22 @@ interface SubagentProvider {
|
|
|
617
474
|
prepareContinuable?(request: ContinuableCreateRequest): Promise<ContinuableCreateSpec>;
|
|
618
475
|
}
|
|
619
476
|
//#endregion
|
|
620
|
-
//#region
|
|
477
|
+
//#region src/vendor/dsh-subagent/projection-types.d.ts
|
|
621
478
|
/** One current direct-child discovery row materialized from parent facts. */
|
|
622
479
|
type SubagentCatalogEntry = {
|
|
623
480
|
readonly id: SessionId$1;
|
|
624
481
|
readonly createdAt: number;
|
|
625
482
|
} & ({
|
|
626
|
-
readonly mode:
|
|
483
|
+
readonly mode: "one-shot";
|
|
627
484
|
readonly label?: string;
|
|
628
485
|
} | {
|
|
629
|
-
readonly mode:
|
|
486
|
+
readonly mode: "external";
|
|
487
|
+
readonly label?: string;
|
|
488
|
+
} | {
|
|
489
|
+
readonly mode: "continuable";
|
|
630
490
|
readonly label: string;
|
|
631
491
|
} | {
|
|
632
|
-
readonly mode:
|
|
492
|
+
readonly mode: "unknown";
|
|
633
493
|
readonly label?: string;
|
|
634
494
|
});
|
|
635
495
|
/** Durable active-turn timing for one descriptor-backed child session. */
|
|
@@ -657,7 +517,7 @@ interface SubagentTimingProjection {
|
|
|
657
517
|
*/
|
|
658
518
|
type SubagentIdentityProjection = {
|
|
659
519
|
/** A terminal one-shot child. */
|
|
660
|
-
mode:
|
|
520
|
+
mode: "one-shot";
|
|
661
521
|
/** Optional durable creation label from the child's descriptor. */
|
|
662
522
|
label?: string;
|
|
663
523
|
/**
|
|
@@ -666,16 +526,16 @@ type SubagentIdentityProjection = {
|
|
|
666
526
|
* OWN log suffix — where a descriptor is immutable once appended — and
|
|
667
527
|
* not from a fork seed's replayed ancestor descriptor.
|
|
668
528
|
*/
|
|
669
|
-
seq: SessionSeq
|
|
529
|
+
seq: SessionSeq;
|
|
670
530
|
} | {
|
|
671
531
|
/** A resumable conversation. */
|
|
672
|
-
mode:
|
|
532
|
+
mode: "continuable";
|
|
673
533
|
/** Durable creation label from the child's descriptor. */
|
|
674
534
|
label: string;
|
|
675
535
|
/** Seq of the folded descriptor event; see the one-shot arm for the own-suffix proof. */
|
|
676
|
-
seq: SessionSeq
|
|
536
|
+
seq: SessionSeq;
|
|
677
537
|
};
|
|
678
|
-
declare module
|
|
538
|
+
declare module "@deepseek-ai/dsh-session-projection/types" {
|
|
679
539
|
interface SessionProjectionMap {
|
|
680
540
|
/** Direct children in parent catalog event order, excluding fork-inherited facts. */
|
|
681
541
|
subagentCatalog: SubagentCatalogEntry[];
|
|
@@ -694,7 +554,7 @@ declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
|
694
554
|
}
|
|
695
555
|
}
|
|
696
556
|
//#endregion
|
|
697
|
-
//#region
|
|
557
|
+
//#region src/vendor/dsh-subagent/list-children.d.ts
|
|
698
558
|
/** One catalog descendant with its direct parent and edge distance from the requested root. */
|
|
699
559
|
type SubagentDescendantListEntry = SubagentListEntry & {
|
|
700
560
|
/** Parent whose catalog contains this child. */
|
|
@@ -703,26 +563,15 @@ type SubagentDescendantListEntry = SubagentListEntry & {
|
|
|
703
563
|
readonly depth: number;
|
|
704
564
|
};
|
|
705
565
|
//#endregion
|
|
706
|
-
//#region
|
|
707
|
-
/**
|
|
708
|
-
* Newest chunk of an immutable list; `undefined` represents the empty list.
|
|
709
|
-
* Values within each chunk follow insertion order. Callers treat nodes, arrays,
|
|
710
|
-
* and stored values as immutable; operations share values and older chunks.
|
|
711
|
-
*/
|
|
712
|
-
interface ChunkedList<T> {
|
|
713
|
-
readonly values: readonly T[];
|
|
714
|
-
readonly previous?: ChunkedList<T> | undefined;
|
|
715
|
-
}
|
|
716
|
-
//#endregion
|
|
717
|
-
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/catalog.d.ts
|
|
566
|
+
//#region src/vendor/dsh-subagent/catalog.d.ts
|
|
718
567
|
type KnownCatalogMode = {
|
|
719
|
-
readonly mode:
|
|
568
|
+
readonly mode: "one-shot";
|
|
720
569
|
readonly label?: string;
|
|
721
570
|
} | {
|
|
722
|
-
readonly mode:
|
|
571
|
+
readonly mode: "continuable";
|
|
723
572
|
readonly label: string;
|
|
724
573
|
};
|
|
725
|
-
/** Parent catalog v0 records
|
|
574
|
+
/** Parent catalog v0 records local modes, v1 adds unknown children, and v2 records external executions. */
|
|
726
575
|
type SubagentCatalogEvent = {
|
|
727
576
|
readonly childId: SessionId;
|
|
728
577
|
readonly childCreatedAt: number;
|
|
@@ -731,16 +580,20 @@ type SubagentCatalogEvent = {
|
|
|
731
580
|
} & KnownCatalogMode) | ({
|
|
732
581
|
readonly version: 1;
|
|
733
582
|
} & (KnownCatalogMode | {
|
|
734
|
-
readonly mode:
|
|
583
|
+
readonly mode: "unknown";
|
|
735
584
|
readonly label?: string;
|
|
736
|
-
}))
|
|
737
|
-
|
|
585
|
+
})) | {
|
|
586
|
+
readonly version: 2;
|
|
587
|
+
readonly mode: "external";
|
|
588
|
+
readonly label?: string;
|
|
589
|
+
});
|
|
590
|
+
declare module "@deepseek-ai/dsh-session/types" {
|
|
738
591
|
interface SessionEventMap {
|
|
739
592
|
/**
|
|
740
593
|
* A direct child's identity and available discovery fields.
|
|
741
594
|
* @param data - versioned parent-owned catalog entry.
|
|
742
595
|
*/
|
|
743
|
-
|
|
596
|
+
"subagent/catalog": SubagentCatalogEvent;
|
|
744
597
|
}
|
|
745
598
|
}
|
|
746
599
|
/** Host fold state for one parent catalog. */
|
|
@@ -748,17 +601,17 @@ interface SubagentCatalogState {
|
|
|
748
601
|
readonly inheritedEventCount: SessionLogOffset;
|
|
749
602
|
readonly head?: ChunkedList<SubagentCatalogEvent> | undefined;
|
|
750
603
|
}
|
|
751
|
-
declare module
|
|
604
|
+
declare module "@deepseek-ai/dsh-session-projection/types" {
|
|
752
605
|
interface SessionProjectionStateMap {
|
|
753
606
|
subagentCatalog: SubagentCatalogState;
|
|
754
607
|
}
|
|
755
608
|
}
|
|
756
609
|
//#endregion
|
|
757
|
-
//#region
|
|
610
|
+
//#region src/vendor/dsh-subagent/out-of-process.d.ts
|
|
758
611
|
/**
|
|
759
612
|
* The capability advertisement of an out-of-process backend: NONE. A child in
|
|
760
613
|
* another process cannot honor parent-enforced start features
|
|
761
|
-
* (`agentOptions`/`outputSchema`/`maxDepth
|
|
614
|
+
* (`agentOptions`/`agentPreset`/`outputSchema`/`maxDepth`), so the service rejects a
|
|
762
615
|
* request needing any of them before `start` runs — never accepted-then-ignored.
|
|
763
616
|
*/
|
|
764
617
|
export declare const NO_START_CAPABILITIES: SubagentCapabilities;
|
|
@@ -781,31 +634,6 @@ export declare function assertPositiveFinite(prefix: string, name: string, value
|
|
|
781
634
|
* @returns `cwd`, validated.
|
|
782
635
|
*/
|
|
783
636
|
export declare function assertUsableCwd(prefix: string, label: string, cwd: string): string;
|
|
784
|
-
/**
|
|
785
|
-
* Validate a configured `cwd` override ONCE, at plugin load: reject the empty
|
|
786
|
-
* string (`path.resolve('')` is the process cwd — it would silently
|
|
787
|
-
* reintroduce the launch-directory fallback this resolution removes),
|
|
788
|
-
* interpret a relative path against the harness launch directory, and require
|
|
789
|
-
* an enterable directory.
|
|
790
|
-
* @param prefix - the consuming plugin's diagnostic prefix.
|
|
791
|
-
* @param cwd - the configured override, or `undefined` when the config omits it.
|
|
792
|
-
* @returns the validated absolute override, or `undefined` when omitted.
|
|
793
|
-
*/
|
|
794
|
-
export declare function validateConfiguredCwd(prefix: string, cwd: string | undefined): string | undefined;
|
|
795
|
-
/**
|
|
796
|
-
* Resolve the child's working directory at start: the deployment override
|
|
797
|
-
* when configured (already validated at load), else the parent session's
|
|
798
|
-
* workspace cwd (validated here, its earliest resolvable point). Fails loud
|
|
799
|
-
* when neither exists — falling back to the harness process cwd would
|
|
800
|
-
* silently bind the child to the server's launch directory instead of the
|
|
801
|
-
* delegating session's workspace (one server process serves many sessions,
|
|
802
|
-
* each with its own cwd).
|
|
803
|
-
* @param prefix - the consuming plugin's diagnostic prefix.
|
|
804
|
-
* @param configured - the load-validated override, or `undefined`.
|
|
805
|
-
* @param parentCwd - the delegating parent session's workspace cwd, if any.
|
|
806
|
-
* @returns the absolute child working directory.
|
|
807
|
-
*/
|
|
808
|
-
export declare function resolveChildCwd(prefix: string, configured: string | undefined, parentCwd: string | undefined): string;
|
|
809
637
|
/** Inputs to {@link settleRunResult}. */
|
|
810
638
|
export interface RunResultSettlement {
|
|
811
639
|
/** The turn attempt (typically racing local cancellation); returns the terminal result. */
|
|
@@ -837,7 +665,7 @@ export declare function settleRunResult(parts: RunResultSettlement): Promise<Sub
|
|
|
837
665
|
/** Inputs to {@link subprocessRunHandle}. */
|
|
838
666
|
export interface SubprocessRunHandleParts {
|
|
839
667
|
/** The parent-scoped run id. */
|
|
840
|
-
id: SubagentRun[
|
|
668
|
+
id: SubagentRun["id"];
|
|
841
669
|
/** The flattened, never-rejecting result (the seam contract). */
|
|
842
670
|
result: Promise<SubagentResult>;
|
|
843
671
|
/** The request's cancellation signal (the listener is removed on dispose). */
|
|
@@ -855,11 +683,11 @@ export interface SubprocessRunHandleParts {
|
|
|
855
683
|
* local cancellation — there is no assumption the child cooperates — and then
|
|
856
684
|
* awaits the backend's teardown to actual exit.
|
|
857
685
|
* @param parts - the run identity, result, cancellation wiring, and teardown.
|
|
858
|
-
* @returns the
|
|
686
|
+
* @returns the external run handle.
|
|
859
687
|
*/
|
|
860
688
|
export declare function subprocessRunHandle(parts: SubprocessRunHandleParts): SubagentRun;
|
|
861
689
|
//#endregion
|
|
862
|
-
//#region
|
|
690
|
+
//#region src/vendor/dsh-subagent/assistant-output.d.ts
|
|
863
691
|
/**
|
|
864
692
|
* Incremental fold of the selection rule, for backends that observe a child's
|
|
865
693
|
* output as it streams: session-event backends {@link push} each event, and
|
|
@@ -895,484 +723,98 @@ export declare class AssistantOutputFold {
|
|
|
895
723
|
*/
|
|
896
724
|
export declare function finalAssistantOutput(events: readonly SessionEvent[]): readonly ContentBlock[] | undefined;
|
|
897
725
|
//#endregion
|
|
898
|
-
//#region
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
type JobId = Branded<'JobId'>;
|
|
910
|
-
/**
|
|
911
|
-
* Brand a string as a {@link JobId}.
|
|
912
|
-
* @param id - the raw job-id string (the registry generates `<kind>-N`).
|
|
913
|
-
* @returns the same string, branded; no validation is performed.
|
|
914
|
-
*/
|
|
915
|
-
declare function JobId(id: string): JobId;
|
|
916
|
-
//#endregion
|
|
917
|
-
//#region ../../../vendor/deepseek-harness/packages/jobs/jobs/lib/types/view.d.ts
|
|
918
|
-
/**
|
|
919
|
-
* Job lifecycle: `running`, optionally `stopping`, then exactly one terminal
|
|
920
|
-
* status. Producer-specific facts belong in {@link JobView.progress} and
|
|
921
|
-
* {@link JobView.detail}.
|
|
922
|
-
*/
|
|
923
|
-
type JobStatus = 'running' | 'stopping' | 'completed' | 'killed' | 'failed';
|
|
924
|
-
declare module '@deepseek-ai/dsh-workspace/types' {
|
|
925
|
-
interface SessionActivityKindMap {
|
|
926
|
-
/** A background job owned by this session is running or stopping. */
|
|
927
|
-
job: true;
|
|
726
|
+
//#region src/vendor/dsh-subagent/descriptor.d.ts
|
|
727
|
+
declare module "@deepseek-ai/dsh-session/types" {
|
|
728
|
+
interface SessionEventMap {
|
|
729
|
+
/**
|
|
730
|
+
* Durable identity and lifecycle mode of a session-backed subagent child,
|
|
731
|
+
* appended once inside the child's initial turn, before its first
|
|
732
|
+
* request. Continuable records also carry their
|
|
733
|
+
* resumable composition. Log-only: it carries no `surfaceOp`, never enters
|
|
734
|
+
* model history, and survives compaction.
|
|
735
|
+
*/
|
|
736
|
+
"subagent/descriptor": SubagentDescriptorData;
|
|
928
737
|
}
|
|
929
738
|
}
|
|
930
739
|
/**
|
|
931
|
-
*
|
|
932
|
-
*
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
bash: 'bash';
|
|
936
|
-
subagent: 'subagent';
|
|
937
|
-
}
|
|
938
|
-
/** The merge-extensible union of registered producer kind names. */
|
|
939
|
-
type JobKind = JobKindMap[keyof JobKindMap];
|
|
940
|
-
/**
|
|
941
|
-
* Stream label of one output chunk. `stdout` and `stderr` reach the model's
|
|
942
|
-
* consuming read; `log` marks producer narration (a workflow's phase lines)
|
|
943
|
-
* that only observers see. Consumers treat an unrecognized label like an
|
|
944
|
-
* absent one.
|
|
945
|
-
*/
|
|
946
|
-
type JobChannel = 'stdout' | 'stderr' | 'log';
|
|
947
|
-
/** One chunk of a job's output ring: absolute offset, text, channel, and loss marker. */
|
|
948
|
-
interface JobChunk {
|
|
949
|
-
/** Absolute offset of the chunk's first byte; offsets never move once assigned. */
|
|
950
|
-
readonly at: number;
|
|
951
|
-
/** Chunk text exactly as appended (possibly tail-trimmed by retention). */
|
|
952
|
-
readonly text: string;
|
|
953
|
-
/** Stream label, when the producer supplied one. */
|
|
954
|
-
readonly channel?: JobChannel;
|
|
955
|
-
/** Bytes immediately before this chunk were lost, at the producer or to retention. */
|
|
956
|
-
readonly gapBefore?: true;
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* Read-only projection of one job — a fresh object per call, never live
|
|
960
|
-
* registry state. The model tools, the browser roster, and the observation
|
|
961
|
-
* stream all consume this one shape.
|
|
962
|
-
*/
|
|
963
|
-
interface JobView {
|
|
964
|
-
/** The registry-issued id (`<kind>-N`). */
|
|
965
|
-
readonly id: JobId;
|
|
966
|
-
/**
|
|
967
|
-
* The producer kind the job was registered with: a Host-registered
|
|
968
|
-
* `JobKind`, carried as an open string because a browser bundle or a Remote
|
|
969
|
-
* codec sees only the `JobKindMap` merges its own program compiles.
|
|
970
|
-
*/
|
|
971
|
-
readonly kind: string;
|
|
972
|
-
/** The producer-supplied one-line label. */
|
|
973
|
-
readonly label: string;
|
|
974
|
-
/** Owning session; absent for an unowned job, which every caller can see. */
|
|
975
|
-
readonly owner?: SessionId$1;
|
|
976
|
-
/** Producer-owned cap for complete model-facing notices and reads, in UTF-8 bytes. */
|
|
977
|
-
readonly outputLimitBytes?: number;
|
|
978
|
-
/** Current lifecycle state. */
|
|
979
|
-
readonly status: JobStatus;
|
|
980
|
-
/** The producer's live progress line (`3/10`, the current phase); cleared at settlement. */
|
|
981
|
-
readonly progress?: string;
|
|
982
|
-
/** Terminal reason (`exit code: 3`); a recorded kill reason is merged in. */
|
|
983
|
-
readonly detail?: string;
|
|
984
|
-
/** Epoch ms when the job was registered. */
|
|
985
|
-
readonly startedAt: number;
|
|
986
|
-
/** Epoch ms when the job settled; absent while live. */
|
|
987
|
-
readonly finishedAt?: number;
|
|
988
|
-
/**
|
|
989
|
-
* The output ring's absolute coordinates and the complete-stream files
|
|
990
|
-
* behind it. `total` is the offset the next chunk starts at (0 while
|
|
991
|
-
* nothing was written); `earliest` is the oldest retained byte, greater
|
|
992
|
-
* than zero exactly when retention dropped the head. `spillPaths` lists the
|
|
993
|
-
* spill files the job's pull sources currently keep, in source order and
|
|
994
|
-
* deduplicated, and is absent while no source keeps one: it outlives any
|
|
995
|
-
* chunk, so a reader below `earliest` can still name where the bytes went.
|
|
996
|
-
*/
|
|
997
|
-
readonly output: {
|
|
998
|
-
readonly total: number;
|
|
999
|
-
readonly earliest: number;
|
|
1000
|
-
readonly spillPaths?: readonly string[];
|
|
1001
|
-
};
|
|
1002
|
-
}
|
|
1003
|
-
//#endregion
|
|
1004
|
-
//#region ../../../vendor/deepseek-harness/packages/jobs/jobs/lib/types/types.d.ts
|
|
1005
|
-
/** Terminal result supplied by a producer through {@link JobHooks.done}. */
|
|
1006
|
-
interface JobOutcome {
|
|
1007
|
-
/** How the job ended: finished (`completed`), cancelled (`killed`), or broke (`failed`). */
|
|
1008
|
-
status: 'completed' | 'killed' | 'failed';
|
|
1009
|
-
/**
|
|
1010
|
-
* Terminal reason rendered into status lines (`exit code: 3`, `max-tokens`).
|
|
1011
|
-
* When the job settles `killed` after a {@link JobRegistry.kill} with a
|
|
1012
|
-
* reason, the registry appends that reason.
|
|
1013
|
-
*/
|
|
1014
|
-
detail?: string;
|
|
1015
|
-
/**
|
|
1016
|
-
* Return value for jobs whose result is a value rather than a stream (a
|
|
1017
|
-
* workflow's rendered result, a subagent's report). The output ring carries
|
|
1018
|
-
* the stream; this is handed out once by the model's next {@link JobRegistry.read}.
|
|
1019
|
-
*/
|
|
1020
|
-
result?: string;
|
|
1021
|
-
}
|
|
1022
|
-
/** One incremental read from a {@link JobOutputSource}. */
|
|
1023
|
-
interface JobSourceRead {
|
|
1024
|
-
/** Text captured since the requested offset (the whole retained tail when lossy). */
|
|
1025
|
-
text: string;
|
|
1026
|
-
/** Whole-stream offset to resume from on the next read. */
|
|
1027
|
-
nextOffset: number;
|
|
1028
|
-
/** True when the requested offset slid out of the source's retained window. */
|
|
1029
|
-
lossy: boolean;
|
|
1030
|
-
/**
|
|
1031
|
-
* Host path of a file holding the complete stream, when the source
|
|
1032
|
-
* currently keeps an intact one. Reported on every read, so the registry
|
|
1033
|
-
* tracks it as source metadata: a later read without it withdraws the file.
|
|
1034
|
-
*/
|
|
1035
|
-
spillPath?: string;
|
|
1036
|
-
}
|
|
1037
|
-
/**
|
|
1038
|
-
* A pull source the registry pumps into the job's output ring — the subprocess
|
|
1039
|
-
* `readFrom` family. The registry owns the cadence and drains every source one
|
|
1040
|
-
* last time before settlement closes the ring, so a producer folds nothing
|
|
1041
|
-
* into its `done`.
|
|
1042
|
-
*/
|
|
1043
|
-
interface JobOutputSource {
|
|
1044
|
-
/** Stream label attached to every chunk this source yields. */
|
|
1045
|
-
channel?: JobChannel;
|
|
1046
|
-
/**
|
|
1047
|
-
* Read everything captured since `fromByte` without consuming it.
|
|
1048
|
-
* @param fromByte - whole-stream offset to resume from (a prior read's `nextOffset`; 0 first).
|
|
1049
|
-
* @returns the delta text, the next offset, the lossy flag, and the spill path the source currently keeps.
|
|
1050
|
-
*/
|
|
1051
|
-
read(fromByte: number): JobSourceRead;
|
|
1052
|
-
}
|
|
1053
|
-
/** Options for one {@link JobHandle.append}. */
|
|
1054
|
-
interface JobAppendOptions {
|
|
1055
|
-
/** Stream label for the chunk; omitted for producers without distinct streams. */
|
|
1056
|
-
channel?: JobChannel;
|
|
1057
|
-
/**
|
|
1058
|
-
* Marks that producer-side bytes between the previous chunk and this one
|
|
1059
|
-
* were lost, so an observer can render the discontinuity instead of a
|
|
1060
|
-
* silent splice.
|
|
1061
|
-
*/
|
|
1062
|
-
gapBefore?: true;
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* Producer face of one registered job, handed to {@link JobSpec.run} and
|
|
1066
|
-
* valid for the job's whole life. All methods are synchronous. Writes staged
|
|
1067
|
-
* inside the starter call are retained and become visible with the
|
|
1068
|
-
* registration commit; after settlement — the producer's own outcome, a kill,
|
|
1069
|
-
* or a registry-forced teardown end — writes log and drop instead of
|
|
1070
|
-
* throwing, so a producer's trailing flush cannot break its own teardown path.
|
|
740
|
+
* The current descriptor format version, stamped into every appended
|
|
741
|
+
* `subagent/descriptor` event and required verbatim by {@link foldSubagentDescriptor}.
|
|
742
|
+
* Supporting another composition input is a deliberate version change, never
|
|
743
|
+
* an implicit extra field.
|
|
1071
744
|
*/
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
/**
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
append(text: string, options?: JobAppendOptions): void;
|
|
1082
|
-
/**
|
|
1083
|
-
* Replace the live progress line (`3/10`, the current phase). Settlement
|
|
1084
|
-
* clears it; the terminal reason travels in {@link JobOutcome.detail}.
|
|
1085
|
-
* @param line - the new progress line.
|
|
1086
|
-
*/
|
|
1087
|
-
updateProgress(line: string): void;
|
|
1088
|
-
}
|
|
1089
|
-
/** Hooks through which the runtime controls and observes producer work. */
|
|
1090
|
-
interface JobHooks {
|
|
1091
|
-
/**
|
|
1092
|
-
* Request termination. Must be synchronous, idempotent, and eventually settle
|
|
1093
|
-
* {@link done}; throws propagate. The optional reason is forwarded verbatim.
|
|
1094
|
-
*/
|
|
1095
|
-
cancel(reason?: string): void;
|
|
1096
|
-
/**
|
|
1097
|
-
* Resolves after the producer releases its resources, not merely when work
|
|
1098
|
-
* finishes. Must not reject; the runtime converts a rejection to `failed`.
|
|
1099
|
-
* If teardown cancellation throws, the runtime may force-fail only the
|
|
1100
|
-
* registry record without claiming that the work stopped.
|
|
1101
|
-
*/
|
|
1102
|
-
done: Promise<JobOutcome>;
|
|
745
|
+
export declare const SUBAGENT_DESCRIPTOR_VERSION = 3;
|
|
746
|
+
/** Fields shared by every supported `subagent/descriptor` payload. */
|
|
747
|
+
interface SubagentDescriptorBase {
|
|
748
|
+
/** Descriptor format version ({@link SUBAGENT_DESCRIPTOR_VERSION}). */
|
|
749
|
+
readonly version: number;
|
|
750
|
+
/** Whether the child is a terminal one-shot run or a resumable conversation. */
|
|
751
|
+
readonly mode: "one-shot" | "continuable";
|
|
752
|
+
/** The `ctx.subagents` provider name that established the child. */
|
|
753
|
+
readonly provider: string;
|
|
1103
754
|
}
|
|
1104
|
-
/**
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
* execution resources while the runtime owns identity, lifecycle state, and
|
|
1108
|
-
* the output ring.
|
|
1109
|
-
*/
|
|
1110
|
-
interface JobSpec {
|
|
1111
|
-
/** Producer kind — also the id prefix (`bash`, `subagent`, …). */
|
|
1112
|
-
kind: JobKind;
|
|
1113
|
-
/** One-line model-facing label (the command; the delegation description). */
|
|
1114
|
-
label: string;
|
|
1115
|
-
/**
|
|
1116
|
-
* Owning session. Access is fenced by it, and the owner's live Agent must be
|
|
1117
|
-
* the one currently registered under that id: its disposal cancels and
|
|
1118
|
-
* awaits the job. Omitting the owner creates an unowned job, open to any
|
|
1119
|
-
* caller until service disposal.
|
|
1120
|
-
*/
|
|
1121
|
-
owner?: SessionId;
|
|
1122
|
-
/**
|
|
1123
|
-
* Optional UTF-8 byte cap for each complete model-facing completion notice or
|
|
1124
|
-
* output read, including controller status metadata. Independent of ring
|
|
1125
|
-
* retention: it bounds the consuming model surface, never observers.
|
|
1126
|
-
*/
|
|
1127
|
-
outputLimitBytes?: number;
|
|
1128
|
-
/**
|
|
1129
|
-
* Pull sources the registry pumps into the ring at its own cadence.
|
|
1130
|
-
* Producers that narrate their own progress use {@link JobHandle.append}
|
|
1131
|
-
* instead; a job may use both.
|
|
1132
|
-
*/
|
|
1133
|
-
output?: readonly JobOutputSource[];
|
|
755
|
+
/** A session-backed subagent that cannot be cold-resumed after its run. */
|
|
756
|
+
interface OneShotSubagentDescriptorData extends SubagentDescriptorBase {
|
|
757
|
+
readonly mode: "one-shot";
|
|
1134
758
|
/**
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1138
|
-
* started resources.
|
|
1139
|
-
* @param job - the issued id plus the ring append and progress writers.
|
|
759
|
+
* The initial delegation's short `description`, kept as the child's durable
|
|
760
|
+
* creation label so enumeration can identify the conversation without
|
|
761
|
+
* replaying parent tool results or exposing the child prompt.
|
|
1140
762
|
*/
|
|
1141
|
-
|
|
1142
|
-
}
|
|
1143
|
-
/** Output and post-read state returned by the consuming {@link JobRegistry.read}. */
|
|
1144
|
-
interface JobRead {
|
|
1145
|
-
/** Ring chunks appended since the model cursor, in offset order; every channel included. */
|
|
1146
|
-
chunks: readonly JobChunk[];
|
|
1147
|
-
/** True when the cursor fell below the oldest retained byte, so bytes are missing before `chunks`. */
|
|
1148
|
-
lossy: boolean;
|
|
1149
|
-
/** The producer's {@link JobOutcome.result}, handed out by the first read after settlement only. */
|
|
1150
|
-
result?: string;
|
|
1151
|
-
/** The job's state at read time. */
|
|
1152
|
-
job: JobView;
|
|
763
|
+
readonly label?: string;
|
|
1153
764
|
}
|
|
1154
|
-
/**
|
|
1155
|
-
interface
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
/**
|
|
1166
|
-
|
|
765
|
+
/** A session-backed subagent whose declared composition supports cold resume. */
|
|
766
|
+
interface ContinuableSubagentDescriptorData extends SubagentDescriptorBase {
|
|
767
|
+
readonly mode: "continuable";
|
|
768
|
+
/** The initial delegation's short `description`, used for durable enumeration. */
|
|
769
|
+
readonly label: string;
|
|
770
|
+
/** Resolved child `agentOptions.provider`, when one was declared. */
|
|
771
|
+
readonly agentProvider?: string;
|
|
772
|
+
/** Resolved child `agentOptions.model`, when one was declared. */
|
|
773
|
+
readonly agentModel?: string;
|
|
774
|
+
/** Resolved child `agentOptions.reasoningEffort`, when one was declared. */
|
|
775
|
+
readonly agentReasoningEffort?: ReasoningEffortId;
|
|
776
|
+
/** Per-child persona that shadows the deployment persona on resume. */
|
|
777
|
+
readonly persona?: string;
|
|
778
|
+
/** Child tool scoping reapplied on resume. */
|
|
779
|
+
readonly toolFilter?: ToolRestriction;
|
|
1167
780
|
}
|
|
781
|
+
/** The supported durable subagent identity and optional continuation composition. */
|
|
782
|
+
type SubagentDescriptorData = OneShotSubagentDescriptorData | ContinuableSubagentDescriptorData;
|
|
783
|
+
/** Continuable composition fields before the snapshot stamps their format version. */
|
|
784
|
+
type ContinuableSubagentDescriptorInput = Omit<ContinuableSubagentDescriptorData, "version">;
|
|
1168
785
|
/**
|
|
1169
|
-
*
|
|
1170
|
-
*
|
|
1171
|
-
*
|
|
1172
|
-
|
|
1173
|
-
type JobSettleCause = 'producer' | 'kill' | 'teardown';
|
|
1174
|
-
/**
|
|
1175
|
-
* One lifecycle or output event. Lifecycle events carry the job's projection
|
|
1176
|
-
* after the commit they announce; `output` carries only the id and the new
|
|
1177
|
-
* total, so an observer schedules a {@link JobRegistry.readAt} from its own
|
|
1178
|
-
* cursor and the registry never pushes payloads.
|
|
786
|
+
* Validate and detach a continuable descriptor input.
|
|
787
|
+
* @param input - the caller-collected continuable composition fields.
|
|
788
|
+
* @returns the versioned, detached continuable descriptor payload.
|
|
789
|
+
* @throws when a field is not losslessly JSON-serializable.
|
|
1179
790
|
*/
|
|
1180
|
-
|
|
1181
|
-
/** Registration commit, progress line change, stopping transition, or removal from the visible set. */
|
|
1182
|
-
readonly type: 'registered' | 'progress' | 'stopping' | 'removed';
|
|
1183
|
-
readonly job: JobView;
|
|
1184
|
-
} | {
|
|
1185
|
-
readonly type: 'settled';
|
|
1186
|
-
readonly job: JobView;
|
|
1187
|
-
readonly cause: JobSettleCause;
|
|
1188
|
-
/**
|
|
1189
|
-
* Whether this settlement released a live {@link JobRegistry.wait}. That
|
|
1190
|
-
* waiter's caller receives the terminal projection as its own result, so
|
|
1191
|
-
* a completion reporter treats an awaited settlement as already delivered
|
|
1192
|
-
* and reports only the unawaited ones. A wait that timed out or was
|
|
1193
|
-
* aborted before the settlement does not count.
|
|
1194
|
-
*/
|
|
1195
|
-
readonly awaited: boolean;
|
|
1196
|
-
} | {
|
|
1197
|
-
readonly type: 'output';
|
|
1198
|
-
readonly id: JobId;
|
|
1199
|
-
/** Owning session, absent for an unowned job. */
|
|
1200
|
-
readonly owner?: SessionId;
|
|
1201
|
-
/** The ring's total after the append (or at settlement, which ends the stream). */
|
|
1202
|
-
readonly total: number;
|
|
1203
|
-
};
|
|
791
|
+
export declare function snapshotSubagentDescriptor(input: ContinuableSubagentDescriptorInput): ContinuableSubagentDescriptorData;
|
|
1204
792
|
/**
|
|
1205
|
-
*
|
|
1206
|
-
*
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
793
|
+
* Fold a persisted child log to its supported descriptor. The first
|
|
794
|
+
* `subagent/descriptor` event is authoritative — the establishing provider
|
|
795
|
+
* appends exactly one, so a later same-type event cannot rewrite the declared
|
|
796
|
+
* composition.
|
|
797
|
+
* @param events - the loaded child session events.
|
|
798
|
+
* @returns the descriptor, or `undefined` when the log has none or its
|
|
799
|
+
* version is not {@link SUBAGENT_DESCRIPTOR_VERSION} (the child cannot be
|
|
800
|
+
* classified by this runtime).
|
|
801
|
+
* @throws when a current-version persisted payload does not match its complete
|
|
802
|
+
* declared schema.
|
|
1210
803
|
*/
|
|
1211
|
-
|
|
1212
|
-
readonly owner: SessionId;
|
|
1213
|
-
} | {
|
|
1214
|
-
readonly owners: 'all' | 'scope';
|
|
1215
|
-
};
|
|
1216
|
-
/** Event callback; contained by the registry, never awaited. */
|
|
1217
|
-
type JobEventListener = (event: JobEvent) => void;
|
|
1218
|
-
/** The registry's event stream. */
|
|
1219
|
-
interface JobEvents {
|
|
1220
|
-
/**
|
|
1221
|
-
* Register an effect-scoped listener. Events are dispatched synchronously
|
|
1222
|
-
* after the commit they announce; a job's first event is `registered`, and
|
|
1223
|
-
* a `settled` event follows the release of every waiter. No listener runs
|
|
1224
|
-
* after service disposal.
|
|
1225
|
-
* @param filter - which owners' events to deliver.
|
|
1226
|
-
* @param listener - receives each matching event.
|
|
1227
|
-
* @returns disposer that unregisters the listener.
|
|
1228
|
-
*/
|
|
1229
|
-
subscribe(filter: JobEventFilter, listener: JobEventListener): () => void;
|
|
1230
|
-
}
|
|
804
|
+
export declare function foldSubagentDescriptor(events: readonly SessionEvent[]): SubagentDescriptorData | undefined;
|
|
1231
805
|
//#endregion
|
|
1232
|
-
//#region
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
jobs: JobRegistry;
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
/**
|
|
1239
|
-
* Abstract background job registry. Subclass, implement the abstract members,
|
|
1240
|
-
* and load the subclass as a plugin — it registers as `ctx.jobs` (one
|
|
1241
|
-
* implementation per context; loading a second throws, which is cordis'
|
|
1242
|
-
* standard duplicate-service behavior).
|
|
1243
|
-
*
|
|
1244
|
-
* Implementations must honor these semantics:
|
|
1245
|
-
* - Registrations outlive producer and controller fibers. Owner and
|
|
1246
|
-
* service disposal cancel live work and await compliant producers; a
|
|
1247
|
-
* throwing teardown cancel force-fails only the record. Such settlements
|
|
1248
|
-
* announce `cause: 'teardown'`, because a job whose owner is being destroyed
|
|
1249
|
-
* has no reader left.
|
|
1250
|
-
* - Owned-job access is fenced by the owner's session id. Ids are
|
|
1251
|
-
* predictable, so authorization — not secrecy — is the boundary.
|
|
1252
|
-
* - Settlement is first-wins: one terminal record, released waiters, then one
|
|
1253
|
-
* round of contained event delivery, even against a late producer outcome.
|
|
1254
|
-
* The `settled` event follows every released waiter and reports whether it
|
|
1255
|
-
* released one (`awaited`), so a completion reporter can skip settlements a
|
|
1256
|
-
* waiting caller already collected.
|
|
1257
|
-
* - A settled record stays listed until its owner's disposal, service
|
|
1258
|
-
* disposal, or an explicit {@link remove} by a caller that collected the
|
|
1259
|
-
* terminal state itself and never handed the id out.
|
|
1260
|
-
* - {@link start} refuses work while no attached job controller serves the
|
|
1261
|
-
* spec's owner, so a producer cannot start work that owner cannot collect
|
|
1262
|
-
* or stop. One registry serves every composition in the process, so this
|
|
1263
|
-
* question — and event delivery under `{ owners: 'scope' }` — is
|
|
1264
|
-
* owner-relative rather than process-wide: registrations made from an
|
|
1265
|
-
* unscoped context serve every owner, and registrations made under an agent
|
|
1266
|
-
* composition's scope serve exactly the agents composed under it.
|
|
1267
|
-
* - Every job owns one output ring. Pull sources named by the spec are pumped
|
|
1268
|
-
* by the registry and drained once more before settlement; pushed appends
|
|
1269
|
-
* land whole. The model's consuming cursor and observers' absolute offsets
|
|
1270
|
-
* read the same bytes and never disturb each other.
|
|
1271
|
-
* - Ring retention is bounded. Appends past the live cap drop the oldest
|
|
1272
|
-
* retained bytes; a reader below the retained window gets a lossy read,
|
|
1273
|
-
* never an error. Settlement trims retention to the settled cap and ends
|
|
1274
|
-
* the stream; the ring has no separate lifecycle.
|
|
1275
|
-
*/
|
|
1276
|
-
declare abstract class JobRegistry extends Service {
|
|
1277
|
-
constructor(ctx: Context);
|
|
1278
|
-
/** Lifecycle and output events, filtered per subscription. */
|
|
1279
|
-
abstract readonly events: JobEvents;
|
|
1280
|
-
/**
|
|
1281
|
-
* Preflight access, validation, owner cleanup, and implementation-owned
|
|
1282
|
-
* admission before starting and atomically registering work. Any preflight
|
|
1283
|
-
* rejection leaves no job id or execution resource. A throwing starter
|
|
1284
|
-
* leaves nothing registered; after it returns, registration cannot fail.
|
|
1285
|
-
* @param spec - job identity, owner, output sources, and synchronous starter.
|
|
1286
|
-
* @returns the registry-issued `<kind>-N` id.
|
|
1287
|
-
*/
|
|
1288
|
-
abstract start(spec: JobSpec): JobId;
|
|
1289
|
-
/**
|
|
1290
|
-
* List caller-owned and unowned jobs in registration order.
|
|
1291
|
-
* @param caller - reading session; omission sees only unowned jobs.
|
|
1292
|
-
* @returns fresh projections.
|
|
1293
|
-
*/
|
|
1294
|
-
abstract list(caller?: SessionId): JobView[];
|
|
1295
|
-
/**
|
|
1296
|
-
* Project one job without changing its cursor. Throws for an unknown or
|
|
1297
|
-
* foreign job.
|
|
1298
|
-
* @param id - job to look up.
|
|
1299
|
-
* @param caller - reading session checked against the owner.
|
|
1300
|
-
* @returns a fresh projection.
|
|
1301
|
-
*/
|
|
1302
|
-
abstract get(id: JobId, caller?: SessionId): JobView;
|
|
1303
|
-
/**
|
|
1304
|
-
* Consume the ring from the model cursor and advance it to the current
|
|
1305
|
-
* total. After settlement the first read also carries the producer's
|
|
1306
|
-
* result. Throws for an unknown or foreign job.
|
|
1307
|
-
* @param id - job to read.
|
|
1308
|
-
* @param caller - reading session checked against the owner.
|
|
1309
|
-
* @returns the chunks since the cursor, the lossy flag, the result once, and the post-read projection.
|
|
1310
|
-
*/
|
|
1311
|
-
abstract read(id: JobId, caller?: SessionId): JobRead;
|
|
1312
|
-
/**
|
|
1313
|
-
* Read retained ring output without moving the model cursor. Resume with
|
|
1314
|
-
* a previous read's `next`; an offset inside a retained chunk returns the
|
|
1315
|
-
* whole chunk (its `at` may precede `from`). Throws for a negative or
|
|
1316
|
-
* non-integer offset, or an unknown or foreign job.
|
|
1317
|
-
* @param id - job to read.
|
|
1318
|
-
* @param from - absolute byte offset to read from (0 for the retained head).
|
|
1319
|
-
* @param caller - reading session checked against the owner.
|
|
1320
|
-
* @returns retained chunks overlapping `[from, total)`, the resume offset, and the lossy flag.
|
|
1321
|
-
*/
|
|
1322
|
-
abstract readAt(id: JobId, from: number, caller?: SessionId): JobOutputRead;
|
|
1323
|
-
/**
|
|
1324
|
-
* Request cancellation, then mark the job stopping. A producer throw
|
|
1325
|
-
* propagates without changing job state. A supplied reason is merged into
|
|
1326
|
-
* terminal `detail` when the job settles `killed`. Throws for an unknown
|
|
1327
|
-
* or foreign job.
|
|
1328
|
-
* @param id - job to cancel.
|
|
1329
|
-
* @param caller - killing session checked against the owner.
|
|
1330
|
-
* @param reason - cancellation reason forwarded verbatim to the producer.
|
|
1331
|
-
* @returns `requested` for live work, otherwise `already-finished`.
|
|
1332
|
-
*/
|
|
1333
|
-
abstract kill(id: JobId, caller?: SessionId, reason?: string): 'requested' | 'already-finished';
|
|
1334
|
-
/**
|
|
1335
|
-
* Wait for settlement or timeout without cancelling the job. Caller abort
|
|
1336
|
-
* rejects only while the job is live; after settlement the terminal
|
|
1337
|
-
* projection wins. Rejects for an invalid timeout or an unknown or foreign
|
|
1338
|
-
* job.
|
|
1339
|
-
* @param id - job to wait for.
|
|
1340
|
-
* @param timeoutMs - positive finite wait bound in milliseconds.
|
|
1341
|
-
* @param caller - waiting session checked against the owner.
|
|
1342
|
-
* @param signal - optional cancellation of the wait itself.
|
|
1343
|
-
* @returns projection at settlement or timeout.
|
|
1344
|
-
*/
|
|
1345
|
-
abstract wait(id: JobId, timeoutMs: number, caller?: SessionId, signal?: AbortSignal): Promise<JobView>;
|
|
1346
|
-
/**
|
|
1347
|
-
* Drop one settled job's record from the visible set and announce
|
|
1348
|
-
* `removed`. For a caller that collected the terminal state through its own
|
|
1349
|
-
* {@link wait} and never handed the id to the model, such as a shell tool's
|
|
1350
|
-
* foreground call. Throws for a job that is still live, unknown, or foreign.
|
|
1351
|
-
* @param id - settled job to drop.
|
|
1352
|
-
* @param caller - removing session checked against the owner.
|
|
1353
|
-
*/
|
|
1354
|
-
abstract remove(id: JobId, caller?: SessionId): void;
|
|
1355
|
-
/**
|
|
1356
|
-
* Attach an effect-scoped controller that can read and stop jobs. It serves the
|
|
1357
|
-
* owners its registering context's scope covers, and {@link start} refuses an
|
|
1358
|
-
* owner no attached controller serves.
|
|
1359
|
-
* @param name - diagnostic label; duplicate names remain independent.
|
|
1360
|
-
* @returns disposer that detaches this controller.
|
|
1361
|
-
*/
|
|
1362
|
-
abstract attachController(name: string): () => void;
|
|
1363
|
-
}
|
|
806
|
+
//#region src/vendor/dsh-subagent/structured.d.ts
|
|
807
|
+
/** The model-facing tool name a structured child must call to finish. */
|
|
808
|
+
export declare const STRUCTURED_OUTPUT_TOOL = "structured_output";
|
|
1364
809
|
//#endregion
|
|
1365
|
-
//#region
|
|
1366
|
-
/**
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
* @returns outcome after child resources are released.
|
|
1371
|
-
*/
|
|
1372
|
-
export declare function settleRun(run: SubagentRun): Promise<JobOutcome>;
|
|
810
|
+
//#region src/vendor/dsh-subagent/error.d.ts
|
|
811
|
+
/** Typed failure for the subagent seam. */
|
|
812
|
+
export declare class SubagentError extends HarnessError {
|
|
813
|
+
constructor(message: string, code: string, options?: ErrorOptions);
|
|
814
|
+
}
|
|
1373
815
|
//#endregion
|
|
1374
|
-
//#region
|
|
1375
|
-
declare module
|
|
816
|
+
//#region src/vendor/dsh-subagent/depth.d.ts
|
|
817
|
+
declare module "@deepseek-ai/dsh-agent" {
|
|
1376
818
|
interface AgentOptions {
|
|
1377
819
|
/** Delegation depth: zero for a top-level agent and parent depth + 1 for a child. */
|
|
1378
820
|
subagentDepth?: number;
|
|
@@ -1395,124 +837,7 @@ export declare function delegationDepthOf(agent: Agent): number;
|
|
|
1395
837
|
*/
|
|
1396
838
|
export declare function assertSubagentMaxDepth(maxDepth: unknown): void;
|
|
1397
839
|
//#endregion
|
|
1398
|
-
//#region
|
|
1399
|
-
/**
|
|
1400
|
-
* File-effect policy for confined processes. `read-only` permits only required
|
|
1401
|
-
* sinks such as `/dev/null`; `workspace-write` also permits the workspace and a
|
|
1402
|
-
* backend-defined temp area; `danger-full-access` bypasses confinement. Network
|
|
1403
|
-
* and process visibility are outside this vocabulary.
|
|
1404
|
-
*/
|
|
1405
|
-
type SandboxMode = 'read-only' | 'workspace-write' | 'danger-full-access';
|
|
1406
|
-
/** A confining (non-`danger-full-access`) mode — the modes a {@link SandboxPolicy} can carry. */
|
|
1407
|
-
type ConfinedSandboxMode = Exclude<SandboxMode, 'danger-full-access'>;
|
|
1408
|
-
/**
|
|
1409
|
-
* The complete file-effect policy resolved for one capability call. The root
|
|
1410
|
-
* is carried even under modes that do not consume it so callers can resolve
|
|
1411
|
-
* policy once before choosing the enforcement path.
|
|
1412
|
-
*/
|
|
1413
|
-
interface SandboxExecutionPolicy {
|
|
1414
|
-
/** The file-effect mode this execution runs under. */
|
|
1415
|
-
mode: SandboxMode;
|
|
1416
|
-
/** Absolute root directory `workspace-write` may write under. */
|
|
1417
|
-
workspaceRoot: string;
|
|
1418
|
-
/**
|
|
1419
|
-
* Opaque identity of the calling session (the branded `dsh-session`
|
|
1420
|
-
* SessionId). Backends key per-session state off it (e.g. windows-acl gives
|
|
1421
|
-
* each live session/workspace pair a random private temp directory and SID,
|
|
1422
|
-
* while the workspace SID and standing grant remain per-workspace); absent
|
|
1423
|
-
* for agentless calls, which fall back to per-call backend state.
|
|
1424
|
-
*/
|
|
1425
|
-
sessionId?: SessionId;
|
|
1426
|
-
}
|
|
1427
|
-
/**
|
|
1428
|
-
* Enforcement completeness for this host. `partial` means an active backend or
|
|
1429
|
-
* older kernel ABI cannot govern every promised file effect; callers requiring
|
|
1430
|
-
* an absolute boundary must not treat it as `full`.
|
|
1431
|
-
*/
|
|
1432
|
-
type SandboxEnforcement = 'full' | 'partial';
|
|
1433
|
-
/**
|
|
1434
|
-
* What one confined execution is allowed to touch — carried PER CALL, not
|
|
1435
|
-
* fixed on the provider: two consumers may confine under different policies
|
|
1436
|
-
* at the same instant (bash under `read-only` while a confined child agent
|
|
1437
|
-
* needs its state directory writable), and an approved escalated retry is a
|
|
1438
|
-
* new call with a wider policy. Defaulting/resolution is an explicit step at
|
|
1439
|
-
* the consumer boundary; the provider treats the policy as fully specified.
|
|
1440
|
-
*/
|
|
1441
|
-
interface SandboxPolicy extends SandboxExecutionPolicy {
|
|
1442
|
-
/** The file-effect mode this execution runs under. */
|
|
1443
|
-
mode: ConfinedSandboxMode;
|
|
1444
|
-
}
|
|
1445
|
-
/**
|
|
1446
|
-
* Evidence that identifies a sandbox runner failing before it executes the
|
|
1447
|
-
* wrapped command. A consumer first applies {@link allowedExitCodes} when
|
|
1448
|
-
* present, removes {@link informationalLines} by case-insensitive exact line
|
|
1449
|
-
* equality, then matches {@link fatalSignatures} case-insensitively within
|
|
1450
|
-
* each remaining stderr line. Exit status alone never proves runner failure.
|
|
1451
|
-
*/
|
|
1452
|
-
interface RunnerFailureRule {
|
|
1453
|
-
/** Nonzero process exit codes on which this rule may match; omitted permits any nonzero exit. */
|
|
1454
|
-
allowedExitCodes?: readonly number[];
|
|
1455
|
-
/** Non-empty substrings identifying a fatal runner diagnostic on one stderr line. */
|
|
1456
|
-
fatalSignatures: readonly string[];
|
|
1457
|
-
/** Benign stderr lines excluded by exact full-line equality before fatal matching. */
|
|
1458
|
-
informationalLines?: readonly string[];
|
|
1459
|
-
}
|
|
1460
|
-
/**
|
|
1461
|
-
* A {@link SandboxProvider.confine} result: the argv to spawn in place of
|
|
1462
|
-
* the caller's own, plus the enforcement completeness the selected backend
|
|
1463
|
-
* achieves for it.
|
|
1464
|
-
*/
|
|
1465
|
-
interface ConfinedArgv {
|
|
1466
|
-
/** The wrapped argv (runner, profile, separator, then the caller's argv). */
|
|
1467
|
-
argv: string[];
|
|
1468
|
-
/** How completely the selected backend enforces the policy's file effects. */
|
|
1469
|
-
enforcement: SandboxEnforcement;
|
|
1470
|
-
/**
|
|
1471
|
-
* The selected backend's denial DIALECT: the case-insensitive stderr
|
|
1472
|
-
* substrings a file effect denied by THIS backend produces (EROFS text
|
|
1473
|
-
* under bwrap's read-only binds, EACCES under Landlock, EPERM under
|
|
1474
|
-
* Seatbelt). A consumer that infers denials from a failed run's stderr
|
|
1475
|
-
* matches against exactly these rather than a cross-backend union — the
|
|
1476
|
-
* union claims denials a given backend never produces.
|
|
1477
|
-
*/
|
|
1478
|
-
denialSignatures: readonly string[];
|
|
1479
|
-
/**
|
|
1480
|
-
* Structured runner-failure evidence rules. Consumers require a matching
|
|
1481
|
-
* fatal stderr line (after informational exclusions) and any rule-specific
|
|
1482
|
-
* exit-code gate before checking denial signatures: runner failure means the
|
|
1483
|
-
* command never ran, while denial means confinement worked and blocked it.
|
|
1484
|
-
*/
|
|
1485
|
-
runnerFailureRules: readonly RunnerFailureRule[];
|
|
1486
|
-
}
|
|
1487
|
-
declare module '@deepseek-ai/cordis' {
|
|
1488
|
-
interface Context {
|
|
1489
|
-
sandbox: SandboxProvider;
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
/**
|
|
1493
|
-
* Abstract process-sandbox service. {@link confine} must return enforcing argv
|
|
1494
|
-
* or fail closed at wrap or runner-execution time; silent unconfined passthrough
|
|
1495
|
-
* is forbidden. Functional probes arbitrate multi-runner chains and may be
|
|
1496
|
-
* skipped for a sole candidate, whose own refusal remains the fail-closed end.
|
|
1497
|
-
*/
|
|
1498
|
-
declare abstract class SandboxProvider extends Service {
|
|
1499
|
-
constructor(ctx: Context);
|
|
1500
|
-
/**
|
|
1501
|
-
* Wrap `argv` so it executes confined under `policy` on this host; the
|
|
1502
|
-
* caller spawns the returned argv in place of its own.
|
|
1503
|
-
* @param argv - the exact argv the caller is about to spawn (program plus
|
|
1504
|
-
* arguments), NOT a shell string — a shell-shaped consumer passes
|
|
1505
|
-
* `['bash', '-c', command]`.
|
|
1506
|
-
* @param policy - the file-effect policy this execution runs under,
|
|
1507
|
-
* carried per call (see {@link SandboxPolicy}).
|
|
1508
|
-
* @param signal - cancellation while the provider resolves the policy and runner.
|
|
1509
|
-
* @returns the argv to spawn instead, plus the enforcement completeness
|
|
1510
|
-
* the selected backend achieves for it.
|
|
1511
|
-
*/
|
|
1512
|
-
abstract confine(argv: readonly string[], policy: SandboxPolicy, signal?: AbortSignal): Promise<ConfinedArgv>;
|
|
1513
|
-
}
|
|
1514
|
-
//#endregion
|
|
1515
|
-
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/child-agent.d.ts
|
|
840
|
+
//#region src/vendor/dsh-subagent/child-agent.d.ts
|
|
1516
841
|
/** Thrown when starting a child would exceed the requested depth cap. */
|
|
1517
842
|
export declare class SubagentDepthError extends Error {
|
|
1518
843
|
readonly attemptedDepth: number;
|
|
@@ -1557,55 +882,41 @@ export declare function resolveChildAgentOptions(parent: Agent, requested: Agent
|
|
|
1557
882
|
* survive persistence, the seed boundary that separates inherited parent
|
|
1558
883
|
* history from child work, and the composition the child runs under.
|
|
1559
884
|
*
|
|
1560
|
-
*
|
|
1561
|
-
*
|
|
1562
|
-
* composition and its header still names the older one. Recording it is what
|
|
1563
|
-
* makes a child's history reconstructable: without it a cold read of the child
|
|
1564
|
-
* resolves the deployment default and rebuilds turns under a tool set the
|
|
1565
|
-
* child never had.
|
|
885
|
+
* Omitted selection uses the parent's live composition, including any switch
|
|
886
|
+
* made while the parent was blank.
|
|
1566
887
|
* @param parent - the delegating parent agent.
|
|
1567
888
|
* @param childDepth - the resolved delegation depth to persist.
|
|
1568
889
|
* @param isSeeded - whether this child inherits a parent-log prefix, including an explicitly empty one.
|
|
890
|
+
* @param selectedPreset - independent selection, or omission to inherit the parent.
|
|
1569
891
|
* @returns the `meta` for `ctx.agents.create()`.
|
|
1570
892
|
*/
|
|
1571
|
-
export declare function childSessionMeta(parent: Agent, childDepth: number, isSeeded: boolean): NonNullable<CreateAgentOptions[
|
|
893
|
+
export declare function childSessionMeta(parent: Agent, childDepth: number, isSeeded: boolean, selectedPreset?: string): NonNullable<CreateAgentOptions["meta"]>;
|
|
1572
894
|
/** The scoped composition a child agent's creation window applies. */
|
|
1573
895
|
interface ChildComposition {
|
|
1574
|
-
/**
|
|
896
|
+
/** Independently mounted preset; omission shares the parent's standing generation. */
|
|
897
|
+
readonly agentPreset?: string | undefined;
|
|
898
|
+
/** Historical descriptor persona reapplied only during cold resume. */
|
|
1575
899
|
readonly persona?: string | undefined;
|
|
1576
|
-
/**
|
|
900
|
+
/** Historical descriptor tool restriction reapplied only during cold resume. */
|
|
1577
901
|
readonly toolFilter?: ToolRestriction | undefined;
|
|
1578
902
|
}
|
|
1579
903
|
/**
|
|
1580
|
-
* Compose
|
|
1581
|
-
*
|
|
1582
|
-
*
|
|
1583
|
-
* scope and therefore invisible to its parent and siblings. Creation and cold
|
|
1584
|
-
* resume both pass through here.
|
|
1585
|
-
*
|
|
1586
|
-
* The join comes first and the child's own registrations second, which is the
|
|
1587
|
-
* order the layering already implies — the nearest scope wins a name, and a
|
|
1588
|
-
* per-child restriction intersects with everything its chain admits — but
|
|
1589
|
-
* stating it here keeps the two steps from being read as independent.
|
|
1590
|
-
*
|
|
1591
|
-
* The join and the per-child registrations live in ONE call because a child
|
|
1592
|
-
* composed without the join is exactly the defect this function exists to
|
|
1593
|
-
* prevent: with every model-facing row on the agent plane, a child that joins
|
|
1594
|
-
* no preset sees an empty tool registry and none of its parent's prompt
|
|
1595
|
-
* sections. Taking the parent as a parameter is what makes that omission
|
|
1596
|
-
* unrepresentable at the call sites.
|
|
904
|
+
* Compose a child before publication and restore historical descriptor overrides.
|
|
905
|
+
* Explicit selection mounts the named preset; omission synchronously joins the
|
|
906
|
+
* parent's current generation. Registrations belong to the child's scope.
|
|
1597
907
|
* @param childCtx - the child agent's scoped creation context.
|
|
1598
|
-
* @param parent - the delegating parent
|
|
1599
|
-
* @param composition -
|
|
908
|
+
* @param parent - the delegating parent used when no preset is selected.
|
|
909
|
+
* @param composition - independent preset and any overrides read from a historical descriptor.
|
|
910
|
+
* @returns A promise when mounting an independent preset; otherwise completes synchronously.
|
|
1600
911
|
*/
|
|
1601
|
-
export declare function applyChildComposition(childCtx: Context, parent: Agent, composition: ChildComposition): void
|
|
912
|
+
export declare function applyChildComposition(childCtx: Context, parent: Agent, composition: ChildComposition): void | Promise<void>;
|
|
1602
913
|
/** Policy seeded onto a child session's log at the delegation boundary. */
|
|
1603
914
|
interface DelegatedPolicyOverrides {
|
|
1604
915
|
/**
|
|
1605
916
|
* The parent's current preset identity when it runs in Auto or Full access;
|
|
1606
917
|
* the child keeps it under the pinned `never` approval policy.
|
|
1607
918
|
*/
|
|
1608
|
-
readonly permissionPreset:
|
|
919
|
+
readonly permissionPreset: "auto" | "danger-full-access" | undefined;
|
|
1609
920
|
/** The parent session's explicit sandbox-mode override, or `undefined` without one. */
|
|
1610
921
|
readonly sandboxMode: SandboxMode | undefined;
|
|
1611
922
|
/**
|
|
@@ -1613,7 +924,7 @@ interface DelegatedPolicyOverrides {
|
|
|
1613
924
|
* otherwise: a delegated child acts only within the sandbox scope fixed at
|
|
1614
925
|
* delegation, so its asks are rejected deterministically.
|
|
1615
926
|
*/
|
|
1616
|
-
readonly approvalPolicy:
|
|
927
|
+
readonly approvalPolicy: "never" | undefined;
|
|
1617
928
|
}
|
|
1618
929
|
/**
|
|
1619
930
|
* Capture the permission state to seed into one delegation. Call synchronously before
|
|
@@ -1638,12 +949,12 @@ export declare function captureDelegatedPolicyOverrides(parent: Agent): Delegate
|
|
|
1638
949
|
*/
|
|
1639
950
|
export declare function appendDelegatedPolicyOverrides(childSession: Session, overrides: DelegatedPolicyOverrides): void;
|
|
1640
951
|
//#endregion
|
|
1641
|
-
//#region
|
|
1642
|
-
/** Durable attribution for one model-authored message between
|
|
952
|
+
//#region src/vendor/dsh-subagent/continuation-messages.d.ts
|
|
953
|
+
/** Durable attribution for one model-authored message between Agents. */
|
|
1643
954
|
interface AgentMessageSource$1 {
|
|
1644
|
-
readonly kind:
|
|
955
|
+
readonly kind: "agent-message";
|
|
1645
956
|
/** A message another agent addressed to this one (`relay` context form). */
|
|
1646
|
-
readonly form:
|
|
957
|
+
readonly form: "relay";
|
|
1647
958
|
/** Session id of the Agent whose tool call produced the message. */
|
|
1648
959
|
readonly senderSessionId: SessionId;
|
|
1649
960
|
}
|
|
@@ -1655,23 +966,23 @@ interface AgentMessageSource$1 {
|
|
|
1655
966
|
* transcript that merged them would credit the child with words it never wrote.
|
|
1656
967
|
*/
|
|
1657
968
|
interface SubagentSettledMessageSource$1 {
|
|
1658
|
-
readonly kind:
|
|
969
|
+
readonly kind: "subagent-settled";
|
|
1659
970
|
/** A runtime account shown without expanding the row (`notice` context form). */
|
|
1660
|
-
readonly form:
|
|
971
|
+
readonly form: "notice";
|
|
1661
972
|
/** One-line account of how the child ended. */
|
|
1662
973
|
readonly summary: string;
|
|
1663
974
|
/** Session id of the child that settled. */
|
|
1664
975
|
readonly senderSessionId: SessionId;
|
|
1665
976
|
}
|
|
1666
|
-
declare module
|
|
977
|
+
declare module "@deepseek-ai/dsh-llm" {
|
|
1667
978
|
interface MessageSourceMap {
|
|
1668
|
-
|
|
1669
|
-
|
|
979
|
+
"agent-message": AgentMessageSource$1;
|
|
980
|
+
"subagent-settled": SubagentSettledMessageSource$1;
|
|
1670
981
|
}
|
|
1671
982
|
}
|
|
1672
983
|
//#endregion
|
|
1673
|
-
//#region
|
|
1674
|
-
declare module
|
|
984
|
+
//#region src/vendor/dsh-subagent/index.d.ts
|
|
985
|
+
declare module "@deepseek-ai/cordis" {
|
|
1675
986
|
interface Context {
|
|
1676
987
|
subagents: SubagentRuntime$1;
|
|
1677
988
|
}
|
|
@@ -1681,13 +992,13 @@ declare module '@deepseek-ai/cordis' {
|
|
|
1681
992
|
* @param provider - the registered provider.
|
|
1682
993
|
* @mode emit
|
|
1683
994
|
*/
|
|
1684
|
-
|
|
995
|
+
"subagent/provider-added"(provider: SubagentProvider): void;
|
|
1685
996
|
/**
|
|
1686
997
|
* A provider left the registry. Accepted runs remain holder-owned.
|
|
1687
998
|
* @param name - the provider name that no longer resolves.
|
|
1688
999
|
* @mode emit
|
|
1689
1000
|
*/
|
|
1690
|
-
|
|
1001
|
+
"subagent/provider-removed"(name: string): void;
|
|
1691
1002
|
/**
|
|
1692
1003
|
* A provider established a published child. For in-process providers,
|
|
1693
1004
|
* `ctx.agents.get(info.id)` resolves during this notification.
|
|
@@ -1695,19 +1006,17 @@ declare module '@deepseek-ai/cordis' {
|
|
|
1695
1006
|
* parent-scoped listener observes only its own delegations. Paired with
|
|
1696
1007
|
* `subagent/end`.
|
|
1697
1008
|
* @param info - the provider and published child identity.
|
|
1698
|
-
* @dshScopeScan unsupported
|
|
1699
1009
|
* @mode emit
|
|
1700
1010
|
*/
|
|
1701
|
-
|
|
1011
|
+
"subagent/start"(this: Scoped<SubagentRuntime$1>, info: SubagentRunInfo): void;
|
|
1702
1012
|
/**
|
|
1703
1013
|
* A published child settled. Scope-filtered dispatch uses the same delegating
|
|
1704
1014
|
* parent carrier as `subagent/start`, so the lifecycle pair reaches the
|
|
1705
1015
|
* same scoped audience.
|
|
1706
1016
|
* @param info - the run identity and terminal outcome.
|
|
1707
|
-
* @dshScopeScan unsupported
|
|
1708
1017
|
* @mode emit
|
|
1709
1018
|
*/
|
|
1710
|
-
|
|
1019
|
+
"subagent/end"(this: Scoped<SubagentRuntime$1>, info: SubagentRunEndInfo): void;
|
|
1711
1020
|
}
|
|
1712
1021
|
}
|
|
1713
1022
|
/** Host configuration for continuable subagent capacity. */
|
|
@@ -1717,7 +1026,7 @@ interface Config$1 {
|
|
|
1717
1026
|
/** Default delegation depth for tools without an explicit limit; defaults to 1. */
|
|
1718
1027
|
maxDepth: Volatile<number>;
|
|
1719
1028
|
}
|
|
1720
|
-
/** Named provider registry with
|
|
1029
|
+
/** Named provider registry with managed activations, durable discovery, and local child messaging. */
|
|
1721
1030
|
declare class SubagentRuntime$1 extends TypertRemoteService {
|
|
1722
1031
|
private config;
|
|
1723
1032
|
static Config: z<Schemastery.ObjectS<NoInfer<{
|
|
@@ -1727,8 +1036,9 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
|
|
|
1727
1036
|
maxDepth: z<number, number, "volatile-defined">;
|
|
1728
1037
|
maxActiveSubagents: z<number, number, "volatile-defined">;
|
|
1729
1038
|
}>>, "plain">;
|
|
1039
|
+
static inject: string[];
|
|
1730
1040
|
private providers;
|
|
1731
|
-
private
|
|
1041
|
+
private manager;
|
|
1732
1042
|
/**
|
|
1733
1043
|
* The contained lifecycle-edge publisher. Built here because scoped dispatch
|
|
1734
1044
|
* keys its carrier by this exact service instance, whose own context filter
|
|
@@ -1741,17 +1051,30 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
|
|
|
1741
1051
|
* @param configured - Explicit tool limit, or provider-managed for external delegation.
|
|
1742
1052
|
* @returns The numeric limit, or undefined when the provider owns depth enforcement.
|
|
1743
1053
|
*/
|
|
1744
|
-
resolveMaxDepth(configured?: number |
|
|
1054
|
+
resolveMaxDepth(configured?: number | "provider-managed"): number | undefined;
|
|
1055
|
+
/**
|
|
1056
|
+
* Start a local child under its reserved identity.
|
|
1057
|
+
* @param spec - local task, reserved child id, and result recipient.
|
|
1058
|
+
* @returns activation with its accepted initial message id.
|
|
1059
|
+
*/
|
|
1060
|
+
startActivation(spec: SubagentActivationSpec & {
|
|
1061
|
+
readonly childId: SessionId;
|
|
1062
|
+
}): Promise<SubagentActivation & {
|
|
1063
|
+
readonly messageId: MessageId;
|
|
1064
|
+
}>;
|
|
1745
1065
|
/**
|
|
1746
|
-
*
|
|
1747
|
-
*
|
|
1748
|
-
*
|
|
1749
|
-
* failure rejects with no ids and rolls back the child entirely.
|
|
1750
|
-
* @param spec - provider, delegation request, and caller cancellation.
|
|
1751
|
-
* @returns the durable child id and the accepted prompt's message id.
|
|
1752
|
-
* @throws when continuation services are unavailable or materialization fails.
|
|
1066
|
+
* Start a local or external child.
|
|
1067
|
+
* @param spec - task, backend, and result recipient.
|
|
1068
|
+
* @returns activation with a message id only for local children.
|
|
1753
1069
|
*/
|
|
1754
|
-
|
|
1070
|
+
startActivation(spec: SubagentActivationSpec): Promise<SubagentActivation>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Join progressing descendants without cancelling them. Idle descendants whose
|
|
1073
|
+
* inboxes require a later wake stay resident and do not delay host completion.
|
|
1074
|
+
* @param parent - the exact parent whose descendant work is observed.
|
|
1075
|
+
* @returns whether work was joined; hosts recheck parent idle after true.
|
|
1076
|
+
*/
|
|
1077
|
+
waitForChildren(parent: Agent): Promise<boolean>;
|
|
1755
1078
|
/**
|
|
1756
1079
|
* Steer one model-authored message to the sender's direct parent or direct
|
|
1757
1080
|
* continuable child. A running target admits it at the nearest step boundary;
|
|
@@ -1781,13 +1104,13 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
|
|
|
1781
1104
|
*/
|
|
1782
1105
|
private [deliverSubagentPrompt];
|
|
1783
1106
|
/**
|
|
1784
|
-
* Interrupt one live
|
|
1107
|
+
* Interrupt one live child's current execution under a human parent
|
|
1785
1108
|
* address or an exact live ancestor Agent. Fire-and-return: the cancel
|
|
1786
1109
|
* signal is issued before this returns, but the target may keep running
|
|
1787
1110
|
* until it observes the signal. Unclaimed pending inbox work, the Activation,
|
|
1788
1111
|
* and published descendants are preserved; claimed work is not requeued.
|
|
1789
|
-
* Once the interrupted
|
|
1790
|
-
* queue.
|
|
1112
|
+
* Once the interrupted Agent is idle, a waking send resumes the parked FIFO
|
|
1113
|
+
* queue. External backends stop their single execution. An absent target
|
|
1791
1114
|
* is an accepted no-op, as is a manager-less composition, which cannot own a
|
|
1792
1115
|
* live Activation.
|
|
1793
1116
|
* @param targetSessionId - the durable child session id to interrupt.
|
|
@@ -1797,27 +1120,27 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
|
|
|
1797
1120
|
*/
|
|
1798
1121
|
interrupt(targetSessionId: SessionId, authority: SubagentInterruptAuthority): void;
|
|
1799
1122
|
/**
|
|
1800
|
-
* Close
|
|
1123
|
+
* Close subagent admission below exact live parent Agents, stop only their
|
|
1801
1124
|
* visible descendant Activations synchronously, then await admitted scoped
|
|
1802
1125
|
* materializations and release those forests child-first. The scoped cutoff
|
|
1803
1126
|
* lasts until each exact parent leaves the registry; unrelated parent trees
|
|
1804
1127
|
* remain live.
|
|
1805
1128
|
* @param parents - exact host-owned parent Agents entering teardown.
|
|
1806
|
-
* @returns once every retained descendant
|
|
1129
|
+
* @returns once every retained descendant activation released its execution handle.
|
|
1807
1130
|
* @throws an aggregate error after all branches settle when any failed.
|
|
1808
1131
|
*/
|
|
1809
|
-
|
|
1132
|
+
drainDescendants(parents: readonly Agent[]): Promise<void>;
|
|
1810
1133
|
/**
|
|
1811
|
-
* Release selected resident
|
|
1134
|
+
* Release selected resident direct children of one exact live
|
|
1812
1135
|
* parent. Other children of the same parent remain admitted and resident.
|
|
1813
1136
|
* Absent targets and a manager-less composition are accepted no-ops.
|
|
1814
1137
|
* @param parent - exact live direct parent authorizing the selected release.
|
|
1815
1138
|
* @param childIds - durable direct-child ids to release when resident.
|
|
1816
|
-
* @returns once every selected
|
|
1139
|
+
* @returns once every selected activation released its execution handle.
|
|
1817
1140
|
* @throws {SubagentError} `UNAUTHORIZED` when a resident target belongs to a
|
|
1818
1141
|
* different parent or the supplied parent identity is stale.
|
|
1819
1142
|
*/
|
|
1820
|
-
|
|
1143
|
+
drainChildren(parent: Agent, childIds: readonly SessionId[]): Promise<void>;
|
|
1821
1144
|
/**
|
|
1822
1145
|
* Read the parent's durable direct-child catalog without loading or resuming an Agent.
|
|
1823
1146
|
* The service owns and releases the live-preferred Session observation.
|
|
@@ -1831,7 +1154,8 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
|
|
|
1831
1154
|
/**
|
|
1832
1155
|
* Recursively list reachable parent catalogs in stable pre-order, preserving
|
|
1833
1156
|
* each catalog's event order. Each row carries its catalog parent and depth;
|
|
1834
|
-
* one-shot and unknown-mode children remain
|
|
1157
|
+
* external children are leaves; one-shot and unknown-mode children remain
|
|
1158
|
+
* traversal nodes. Unknown modes
|
|
1835
1159
|
* produce unsupported diagnostics. Unreadable child catalogs produce corrupt
|
|
1836
1160
|
* or unavailable diagnostics and stop only that branch. Root read failures,
|
|
1837
1161
|
* missing services or projections, and cancellation reject the whole listing.
|
|
@@ -1877,11 +1201,12 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
|
|
|
1877
1201
|
* `subagent/unauthorized` when the address does not own the live target,
|
|
1878
1202
|
* otherwise `gateway/internal`.
|
|
1879
1203
|
*/
|
|
1880
|
-
interruptByParent(childSessionId: SessionId, parentSessionId: SessionId, mode:
|
|
1204
|
+
interruptByParent(childSessionId: SessionId, parentSessionId: SessionId, mode: "continuable"): SubagentInterruptReceipt;
|
|
1881
1205
|
/**
|
|
1882
1206
|
* Register a provider under its name. Registration is effect-scoped and HMR
|
|
1883
1207
|
* safe; removing a provider blocks new starts but does not revoke runs that
|
|
1884
|
-
* were already returned to their holders.
|
|
1208
|
+
* were already returned to their holders. Providers without either execution
|
|
1209
|
+
* method are rejected with UNSUPPORTED_CAPABILITY before registration.
|
|
1885
1210
|
* @param provider - the trusted provider implementation.
|
|
1886
1211
|
* @returns the exact Cordis effect disposer.
|
|
1887
1212
|
*/
|
|
@@ -1897,19 +1222,6 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
|
|
|
1897
1222
|
* @returns the registered names.
|
|
1898
1223
|
*/
|
|
1899
1224
|
list(): string[];
|
|
1900
|
-
/**
|
|
1901
|
-
* Establish a published child on the named provider. Capability and semantic
|
|
1902
|
-
* checks run before delegation. Provider ownership lasts until its promise
|
|
1903
|
-
* fulfills; a rejection therefore has no run for the caller to dispose and
|
|
1904
|
-
* emits no run lifecycle events. Post-publication turn and infrastructure
|
|
1905
|
-
* failures settle through the returned run.
|
|
1906
|
-
* A catalog append failure disposes the run and handles its result rejection;
|
|
1907
|
-
* the caller receives the catalog error even if disposal also fails.
|
|
1908
|
-
* @param name - the provider to use.
|
|
1909
|
-
* @param request - child label, prompt, parent, signal, and optional capabilities.
|
|
1910
|
-
* @returns the published holder-owned run.
|
|
1911
|
-
*/
|
|
1912
|
-
start(name: string, request: SubagentStartRequest): Promise<SubagentRun>;
|
|
1913
1225
|
/**
|
|
1914
1226
|
* Resolve one provider's detached continuable-creation contribution. Method
|
|
1915
1227
|
* presence on the provider IS the capability, so a provider without it is
|
|
@@ -1918,8 +1230,8 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
|
|
|
1918
1230
|
private prepareContinuable;
|
|
1919
1231
|
/** Look up a provider for dispatch or fail loud. */
|
|
1920
1232
|
private expectProvider;
|
|
1921
|
-
/** Resolve the
|
|
1922
|
-
private
|
|
1233
|
+
/** Resolve the subagent manager or fail loud. */
|
|
1234
|
+
private requireManager;
|
|
1923
1235
|
/**
|
|
1924
1236
|
* Build the lifecycle observer for one continuable Activation's residency
|
|
1925
1237
|
* epoch, so the manager publishes its edges without owning event dispatch.
|
|
@@ -1929,7 +1241,7 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
|
|
|
1929
1241
|
private assertCapabilities;
|
|
1930
1242
|
}
|
|
1931
1243
|
//#endregion
|
|
1932
|
-
//#region
|
|
1244
|
+
//#region src/vendor/dsh-subagent/internal.d.ts
|
|
1933
1245
|
/**
|
|
1934
1246
|
* Process-stable symbol-keyed host delivery shared by the bundled runtime
|
|
1935
1247
|
* entry and this unbundled internal subpath.
|
|
@@ -1938,7 +1250,7 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
|
|
|
1938
1250
|
declare const deliverSubagentPrompt: unique symbol;
|
|
1939
1251
|
//#endregion
|
|
1940
1252
|
//#region src/continuation-messages.d.ts
|
|
1941
|
-
/** Durable attribution for one model-authored message between
|
|
1253
|
+
/** Durable attribution for one model-authored message between Agents. */
|
|
1942
1254
|
interface AgentMessageSource {
|
|
1943
1255
|
readonly kind: 'agent-message';
|
|
1944
1256
|
/** A message another agent addressed to this one (`relay` context form). */
|
|
@@ -1984,7 +1296,7 @@ export interface Config {
|
|
|
1984
1296
|
*/
|
|
1985
1297
|
localizedReturnGuidancePresets: string[];
|
|
1986
1298
|
}
|
|
1987
|
-
/** Named provider registry with
|
|
1299
|
+
/** Named provider registry with managed activations, durable discovery, and local child messaging. */
|
|
1988
1300
|
export declare class SubagentRuntime extends TypertRemoteService {
|
|
1989
1301
|
private config;
|
|
1990
1302
|
static Config: z<Schemastery.ObjectS<NoInfer<{
|
|
@@ -1996,8 +1308,9 @@ export declare class SubagentRuntime extends TypertRemoteService {
|
|
|
1996
1308
|
maxActiveSubagents: z<number, number, "volatile-defined">;
|
|
1997
1309
|
localizedReturnGuidancePresets: z<string[], string[], "defined">;
|
|
1998
1310
|
}>>, "plain">;
|
|
1311
|
+
static inject: string[];
|
|
1999
1312
|
private providers;
|
|
2000
|
-
private
|
|
1313
|
+
private manager;
|
|
2001
1314
|
/**
|
|
2002
1315
|
* The contained lifecycle-edge publisher. Built here because scoped dispatch
|
|
2003
1316
|
* keys its carrier by this exact service instance, whose own context filter
|
|
@@ -2012,15 +1325,28 @@ export declare class SubagentRuntime extends TypertRemoteService {
|
|
|
2012
1325
|
*/
|
|
2013
1326
|
resolveMaxDepth(configured?: number | 'provider-managed'): number | undefined;
|
|
2014
1327
|
/**
|
|
2015
|
-
*
|
|
2016
|
-
*
|
|
2017
|
-
*
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
1328
|
+
* Start a local child under its reserved identity.
|
|
1329
|
+
* @param spec - local task, reserved child id, and result recipient.
|
|
1330
|
+
* @returns activation with its accepted initial message id.
|
|
1331
|
+
*/
|
|
1332
|
+
startActivation(spec: SubagentActivationSpec & {
|
|
1333
|
+
readonly childId: SessionId;
|
|
1334
|
+
}): Promise<SubagentActivation & {
|
|
1335
|
+
readonly messageId: MessageId;
|
|
1336
|
+
}>;
|
|
1337
|
+
/**
|
|
1338
|
+
* Start a local or external child.
|
|
1339
|
+
* @param spec - task, backend, and result recipient.
|
|
1340
|
+
* @returns activation with a message id only for local children.
|
|
2022
1341
|
*/
|
|
2023
|
-
|
|
1342
|
+
startActivation(spec: SubagentActivationSpec): Promise<SubagentActivation>;
|
|
1343
|
+
/**
|
|
1344
|
+
* Join progressing descendants without cancelling them. Idle descendants whose
|
|
1345
|
+
* inboxes require a later wake stay resident and do not delay host completion.
|
|
1346
|
+
* @param parent - the exact parent whose descendant work is observed.
|
|
1347
|
+
* @returns whether work was joined; hosts recheck parent idle after true.
|
|
1348
|
+
*/
|
|
1349
|
+
waitForChildren(parent: Agent): Promise<boolean>;
|
|
2024
1350
|
/**
|
|
2025
1351
|
* Steer one model-authored message to the sender's direct parent or direct
|
|
2026
1352
|
* continuable child. A running target admits it at the nearest step boundary;
|
|
@@ -2050,13 +1376,13 @@ export declare class SubagentRuntime extends TypertRemoteService {
|
|
|
2050
1376
|
*/
|
|
2051
1377
|
private [deliverSubagentPrompt];
|
|
2052
1378
|
/**
|
|
2053
|
-
* Interrupt one live
|
|
1379
|
+
* Interrupt one live child's current execution under a human parent
|
|
2054
1380
|
* address or an exact live ancestor Agent. Fire-and-return: the cancel
|
|
2055
1381
|
* signal is issued before this returns, but the target may keep running
|
|
2056
1382
|
* until it observes the signal. Unclaimed pending inbox work, the Activation,
|
|
2057
1383
|
* and published descendants are preserved; claimed work is not requeued.
|
|
2058
|
-
* Once the interrupted
|
|
2059
|
-
* queue.
|
|
1384
|
+
* Once the interrupted Agent is idle, a waking send resumes the parked FIFO
|
|
1385
|
+
* queue. External backends stop their single execution. An absent target
|
|
2060
1386
|
* is an accepted no-op, as is a manager-less composition, which cannot own a
|
|
2061
1387
|
* live Activation.
|
|
2062
1388
|
* @param targetSessionId - the durable child session id to interrupt.
|
|
@@ -2066,27 +1392,27 @@ export declare class SubagentRuntime extends TypertRemoteService {
|
|
|
2066
1392
|
*/
|
|
2067
1393
|
interrupt(targetSessionId: SessionId, authority: SubagentInterruptAuthority): void;
|
|
2068
1394
|
/**
|
|
2069
|
-
* Close
|
|
1395
|
+
* Close subagent admission below exact live parent Agents, stop only their
|
|
2070
1396
|
* visible descendant Activations synchronously, then await admitted scoped
|
|
2071
1397
|
* materializations and release those forests child-first. The scoped cutoff
|
|
2072
1398
|
* lasts until each exact parent leaves the registry; unrelated parent trees
|
|
2073
1399
|
* remain live.
|
|
2074
1400
|
* @param parents - exact host-owned parent Agents entering teardown.
|
|
2075
|
-
* @returns once every retained descendant
|
|
1401
|
+
* @returns once every retained descendant activation released its execution handle.
|
|
2076
1402
|
* @throws an aggregate error after all branches settle when any failed.
|
|
2077
1403
|
*/
|
|
2078
|
-
|
|
1404
|
+
drainDescendants(parents: readonly Agent[]): Promise<void>;
|
|
2079
1405
|
/**
|
|
2080
|
-
* Release selected resident
|
|
1406
|
+
* Release selected resident direct children of one exact live
|
|
2081
1407
|
* parent. Other children of the same parent remain admitted and resident.
|
|
2082
1408
|
* Absent targets and a manager-less composition are accepted no-ops.
|
|
2083
1409
|
* @param parent - exact live direct parent authorizing the selected release.
|
|
2084
1410
|
* @param childIds - durable direct-child ids to release when resident.
|
|
2085
|
-
* @returns once every selected
|
|
1411
|
+
* @returns once every selected activation released its execution handle.
|
|
2086
1412
|
* @throws {SubagentError} `UNAUTHORIZED` when a resident target belongs to a
|
|
2087
1413
|
* different parent or the supplied parent identity is stale.
|
|
2088
1414
|
*/
|
|
2089
|
-
|
|
1415
|
+
drainChildren(parent: Agent, childIds: readonly SessionId[]): Promise<void>;
|
|
2090
1416
|
/**
|
|
2091
1417
|
* Read the parent's durable direct-child catalog without loading or resuming an Agent.
|
|
2092
1418
|
* The service owns and releases the live-preferred Session observation.
|
|
@@ -2100,7 +1426,8 @@ export declare class SubagentRuntime extends TypertRemoteService {
|
|
|
2100
1426
|
/**
|
|
2101
1427
|
* Recursively list reachable parent catalogs in stable pre-order, preserving
|
|
2102
1428
|
* each catalog's event order. Each row carries its catalog parent and depth;
|
|
2103
|
-
* one-shot and unknown-mode children remain
|
|
1429
|
+
* external children are leaves; one-shot and unknown-mode children remain
|
|
1430
|
+
* traversal nodes. Unknown modes
|
|
2104
1431
|
* produce unsupported diagnostics. Unreadable child catalogs produce corrupt
|
|
2105
1432
|
* or unavailable diagnostics and stop only that branch. Root read failures,
|
|
2106
1433
|
* missing services or projections, and cancellation reject the whole listing.
|
|
@@ -2150,7 +1477,8 @@ export declare class SubagentRuntime extends TypertRemoteService {
|
|
|
2150
1477
|
/**
|
|
2151
1478
|
* Register a provider under its name. Registration is effect-scoped and HMR
|
|
2152
1479
|
* safe; removing a provider blocks new starts but does not revoke runs that
|
|
2153
|
-
* were already returned to their holders.
|
|
1480
|
+
* were already returned to their holders. Providers without either execution
|
|
1481
|
+
* method are rejected with UNSUPPORTED_CAPABILITY before registration.
|
|
2154
1482
|
* @param provider - the trusted provider implementation.
|
|
2155
1483
|
* @returns the exact Cordis effect disposer.
|
|
2156
1484
|
*/
|
|
@@ -2166,19 +1494,6 @@ export declare class SubagentRuntime extends TypertRemoteService {
|
|
|
2166
1494
|
* @returns the registered names.
|
|
2167
1495
|
*/
|
|
2168
1496
|
list(): string[];
|
|
2169
|
-
/**
|
|
2170
|
-
* Establish a published child on the named provider. Capability and semantic
|
|
2171
|
-
* checks run before delegation. Provider ownership lasts until its promise
|
|
2172
|
-
* fulfills; a rejection therefore has no run for the caller to dispose and
|
|
2173
|
-
* emits no run lifecycle events. Post-publication turn and infrastructure
|
|
2174
|
-
* failures settle through the returned run.
|
|
2175
|
-
* A catalog append failure disposes the run and handles its result rejection;
|
|
2176
|
-
* the caller receives the catalog error even if disposal also fails.
|
|
2177
|
-
* @param name - the provider to use.
|
|
2178
|
-
* @param request - child label, prompt, parent, signal, and optional capabilities.
|
|
2179
|
-
* @returns the published holder-owned run.
|
|
2180
|
-
*/
|
|
2181
|
-
start(name: string, request: SubagentStartRequest): Promise<SubagentRun>;
|
|
2182
1497
|
/**
|
|
2183
1498
|
* Resolve one provider's detached continuable-creation contribution. Method
|
|
2184
1499
|
* presence on the provider IS the capability, so a provider without it is
|
|
@@ -2187,8 +1502,8 @@ export declare class SubagentRuntime extends TypertRemoteService {
|
|
|
2187
1502
|
private prepareContinuable;
|
|
2188
1503
|
/** Look up a provider for dispatch or fail loud. */
|
|
2189
1504
|
private expectProvider;
|
|
2190
|
-
/** Resolve the
|
|
2191
|
-
private
|
|
1505
|
+
/** Resolve the subagent manager or fail loud. */
|
|
1506
|
+
private requireManager;
|
|
2192
1507
|
/**
|
|
2193
1508
|
* Build the lifecycle observer for one continuable Activation's residency
|
|
2194
1509
|
* epoch, so the manager publishes its edges without owning event dispatch.
|
|
@@ -2198,4 +1513,4 @@ export declare class SubagentRuntime extends TypertRemoteService {
|
|
|
2198
1513
|
private assertCapabilities;
|
|
2199
1514
|
}
|
|
2200
1515
|
//#endregion
|
|
2201
|
-
export { type AgentMessageSource, type ChildComposition, type ContinuableCreateRequest, type ContinuableCreateSpec, type
|
|
1516
|
+
export { type AgentMessageSource, type ChildComposition, type ContinuableCreateRequest, type ContinuableCreateSpec, type ContinuableSubagentDescriptorData, type ContinuableSubagentDescriptorInput, type DelegatedPolicyOverrides, type OneShotSubagentDescriptorData, type ResolvedSubagentStartRequest, type SubagentActivation, type SubagentActivationSpec, type SubagentAddress, type SubagentCapabilities, type SubagentCatalogEntry, type SubagentCatalogRow, type SubagentDelivery, type SubagentDescendantListEntry, type SubagentDescriptorData, 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 };
|