@deepseek-ai/dsh-subagent 0.2.1-alpha.1 → 0.2.1-alpha.2

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.
Files changed (41) hide show
  1. package/README.i18n.yaml +34 -34
  2. package/README.md +32 -26
  3. package/README.zh.md +32 -26
  4. package/lib/index.js +1436 -1304
  5. package/lib/typert.host.js +59 -48
  6. package/lib/typert.remote-client.js +2 -2
  7. package/lib/types/activation.d.ts +114 -0
  8. package/lib/types/activation.js +112 -0
  9. package/lib/types/catalog.d.ts +14 -6
  10. package/lib/types/catalog.js +34 -30
  11. package/lib/types/child-agent.d.ts +1 -3
  12. package/lib/types/child-agent.js +1 -3
  13. package/lib/types/continuation-messages.d.ts +4 -3
  14. package/lib/types/continuation-messages.js +13 -5
  15. package/lib/types/control-types.d.ts +7 -0
  16. package/lib/types/descriptor.d.ts +7 -46
  17. package/lib/types/descriptor.js +20 -21
  18. package/lib/types/index.d.ts +52 -51
  19. package/lib/types/index.js +75 -95
  20. package/lib/types/internal.d.ts +1 -1
  21. package/lib/types/lifecycle.d.ts +28 -58
  22. package/lib/types/lifecycle.js +9 -74
  23. package/lib/types/list-children.js +1 -1
  24. package/lib/types/manager.d.ts +247 -0
  25. package/lib/types/manager.js +1294 -0
  26. package/lib/types/out-of-process.d.ts +2 -28
  27. package/lib/types/out-of-process.js +3 -44
  28. package/lib/types/projection-types.d.ts +3 -0
  29. package/lib/types/structured.d.ts +49 -0
  30. package/lib/types/structured.js +130 -0
  31. package/lib/types/types.d.ts +57 -81
  32. package/lib/types/types.js +1 -1
  33. package/package.json +50 -49
  34. package/lib/types/continuation-activation.d.ts +0 -267
  35. package/lib/types/continuation-activation.js +0 -700
  36. package/lib/types/continuation.d.ts +0 -124
  37. package/lib/types/continuation.js +0 -455
  38. package/lib/types/inbox.d.ts +0 -43
  39. package/lib/types/inbox.js +0 -61
  40. package/lib/types/run-settlement.d.ts +0 -17
  41. package/lib/types/run-settlement.js +0 -70
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { z } from 'zod';
7
7
  import { appendChunkedList, chunkedListSchema, iterateChunkedList } from '@deepseek-ai/dsh-chunked-list';
8
- /** Catalog payload version emitted by live child creation. */
8
+ /** Catalog payload version emitted by local child creation. */
9
9
  export const SUBAGENT_CATALOG_VERSION = 0;
10
10
  const sessionIdSchema = z.string();
11
11
  const oneShotCatalogSchema = z.object({
@@ -22,9 +22,11 @@ const continuableCatalogSchema = z.object({
22
22
  mode: z.literal('continuable'),
23
23
  label: z.string(),
24
24
  }).strict();
25
+ const externalCatalogSchema = oneShotCatalogSchema.extend({ version: z.literal(2), mode: z.literal('external') });
25
26
  const unknownCatalogSchema = oneShotCatalogSchema.extend({ version: z.literal(1), mode: z.literal('unknown') });
26
27
  const eventDataSchema = z.union([
27
28
  oneShotCatalogSchema,
29
+ externalCatalogSchema,
28
30
  continuableCatalogSchema,
29
31
  unknownCatalogSchema,
30
32
  ]);
@@ -33,6 +35,10 @@ const viewSchema = z.array(z.union([
33
35
  id: sessionIdSchema,
34
36
  createdAt: oneShotCatalogSchema.shape.childCreatedAt,
35
37
  }),
38
+ externalCatalogSchema.omit({ version: true, childId: true, childCreatedAt: true }).extend({
39
+ id: sessionIdSchema,
40
+ createdAt: externalCatalogSchema.shape.childCreatedAt,
41
+ }),
36
42
  continuableCatalogSchema.omit({ version: true, childId: true, childCreatedAt: true }).extend({
37
43
  id: sessionIdSchema,
38
44
  createdAt: continuableCatalogSchema.shape.childCreatedAt,
@@ -54,19 +60,8 @@ const stateSchema = z.object({
54
60
  function subagentCatalogEntries(state) {
55
61
  const entries = [];
56
62
  for (const data of iterateChunkedList(state.head)) {
57
- entries.push(data.mode !== 'continuable'
58
- ? {
59
- id: data.childId,
60
- createdAt: data.childCreatedAt,
61
- mode: data.mode,
62
- ...data.label === undefined ? {} : { label: data.label },
63
- }
64
- : {
65
- id: data.childId,
66
- createdAt: data.childCreatedAt,
67
- mode: data.mode,
68
- label: data.label,
69
- });
63
+ const { version: _version, childId, childCreatedAt, ...descriptor } = data;
64
+ entries.push({ id: childId, createdAt: childCreatedAt, ...descriptor });
70
65
  }
71
66
  return entries;
72
67
  }
@@ -80,7 +75,7 @@ export const subagentCatalogProjectionDefinition = {
80
75
  return state;
81
76
  return { ...state, head: appendChunkedList(state.head, eventDataSchema.parse(event.data)) };
82
77
  },
83
- stateVersion: 3,
78
+ stateVersion: 6,
84
79
  wire: { viewSchema, view: subagentCatalogEntries },
85
80
  };
86
81
  /**
@@ -90,20 +85,29 @@ export const subagentCatalogProjectionDefinition = {
90
85
  * @param descriptor - mode-discriminated creation label frozen with the child.
91
86
  */
92
87
  export function establishCatalogChild(parent, child, descriptor) {
93
- parent.append('subagent/catalog', descriptor.mode === 'one-shot'
94
- ? {
95
- version: SUBAGENT_CATALOG_VERSION,
96
- childId: child.id,
97
- childCreatedAt: child.createdAt,
98
- mode: descriptor.mode,
99
- ...descriptor.label === undefined ? {} : { label: descriptor.label },
100
- }
101
- : {
102
- version: SUBAGENT_CATALOG_VERSION,
103
- childId: child.id,
104
- childCreatedAt: child.createdAt,
105
- mode: descriptor.mode,
106
- label: descriptor.label,
107
- });
88
+ parent.append('subagent/catalog', {
89
+ version: SUBAGENT_CATALOG_VERSION,
90
+ childId: child.id,
91
+ childCreatedAt: child.createdAt,
92
+ mode: descriptor.mode,
93
+ label: descriptor.label,
94
+ });
95
+ }
96
+ /** Catalog payload version emitted by external execution creation. */
97
+ const EXTERNAL_SUBAGENT_CATALOG_VERSION = 2;
98
+ /**
99
+ * Record an external execution without a local child Session.
100
+ * @param parent - durable direct parent receiving the discovery fact.
101
+ * @param childId - identity returned by the external provider.
102
+ * @param label - display label assigned by the caller.
103
+ */
104
+ export function establishExternalCatalogChild(parent, childId, label) {
105
+ parent.append('subagent/catalog', {
106
+ version: EXTERNAL_SUBAGENT_CATALOG_VERSION,
107
+ childId,
108
+ childCreatedAt: Date.now(),
109
+ mode: 'external',
110
+ label,
111
+ });
108
112
  }
109
113
  //# sourceMappingURL=catalog.js.map
@@ -1,9 +1,7 @@
1
1
  /**
2
2
  * Shared in-process child composition: the delegation-depth budget, the
3
3
  * durable session metadata, the resolved child `AgentOptions`, the delegated
4
- * policy seed, and the scoped setup a child agent needs. Both the one-shot
5
- * provider driver and the continuation manager compose children this way, so
6
- * depth accounting, lineage stamping, and delegation policy have one home.
4
+ * policy seed, and the scoped setup used by local activations.
7
5
  *
8
6
  * @module @deepseek-ai/dsh-subagent/child-agent
9
7
  */
@@ -1,9 +1,7 @@
1
1
  /**
2
2
  * Shared in-process child composition: the delegation-depth budget, the
3
3
  * durable session metadata, the resolved child `AgentOptions`, the delegated
4
- * policy seed, and the scoped setup a child agent needs. Both the one-shot
5
- * provider driver and the continuation manager compose children this way, so
6
- * depth accounting, lineage stamping, and delegation policy have one home.
4
+ * policy seed, and the scoped setup used by local activations.
7
5
  *
8
6
  * @module @deepseek-ai/dsh-subagent/child-agent
9
7
  */
@@ -7,8 +7,8 @@ import type { Agent } from '@deepseek-ai/dsh-agent';
7
7
  import { createUserMessage } from '@deepseek-ai/dsh-llm';
8
8
  import type { ContentBlock } from '@deepseek-ai/dsh-llm';
9
9
  import type { SessionId } from '@deepseek-ai/dsh-session';
10
- import type { ActivationTerminal } from './lifecycle.ts';
11
- /** Durable attribution for one model-authored message between adjacent Agents. */
10
+ import type { SubagentResult } from './types.ts';
11
+ /** Durable attribution for one model-authored message between Agents. */
12
12
  export interface AgentMessageSource {
13
13
  readonly kind: 'agent-message';
14
14
  /** A message another agent addressed to this one (`relay` context form). */
@@ -56,7 +56,8 @@ export declare function withContinuableReturnGuidance(parentId: SessionId, promp
56
56
  * Build the runtime-owned settlement notice from the child's nonempty closing text.
57
57
  * @param childId - durable child session id named in the notice.
58
58
  * @param terminal - recorded terminal state for the settled Activation.
59
+ * @param continuable - whether the child can accept another task.
59
60
  * @returns the durable user-message representation delivered to the parent.
60
61
  */
61
- export declare function createSettlementMessage(childId: SessionId, terminal: ActivationTerminal): ReturnType<typeof createUserMessage>;
62
+ export declare function createSettlementMessage(childId: SessionId, terminal: SubagentResult, continuable?: boolean): ReturnType<typeof createUserMessage>;
62
63
  //# sourceMappingURL=continuation-messages.d.ts.map
@@ -52,13 +52,16 @@ export function withContinuableReturnGuidance(parentId, prompt) {
52
52
  * the parent's own task vocabulary.
53
53
  * @param childId - the durable child the parent knows by id.
54
54
  * @param stopReason - how the child's last ordinary turn ended.
55
+ * @param continuable - whether the child accepts a later message.
55
56
  * @returns the model-facing opening line of the settlement notice.
56
57
  */
57
- function settlementSummary(childId, stopReason) {
58
+ function settlementSummary(childId, stopReason, continuable) {
58
59
  const subject = `Background subagent ${childId}`;
59
60
  switch (stopReason) {
60
61
  case 'completed':
61
- return `${subject} finished and will do no further work unless you send it more.`;
62
+ return continuable
63
+ ? `${subject} finished and will do no further work unless you send it more.`
64
+ : `${subject} finished. It cannot receive follow-up messages.`;
62
65
  case 'aborted':
63
66
  return `${subject} was stopped before it finished.`;
64
67
  case 'max-tokens':
@@ -80,20 +83,25 @@ function settlementSummary(childId, stopReason) {
80
83
  * Build the runtime-owned settlement notice from the child's nonempty closing text.
81
84
  * @param childId - durable child session id named in the notice.
82
85
  * @param terminal - recorded terminal state for the settled Activation.
86
+ * @param continuable - whether the child can accept another task.
83
87
  * @returns the durable user-message representation delivered to the parent.
84
88
  */
85
- export function createSettlementMessage(childId, terminal) {
86
- const summary = settlementSummary(childId, terminal.stopReason);
89
+ export function createSettlementMessage(childId, terminal, continuable = true) {
90
+ const summary = settlementSummary(childId, terminal.stopReason, continuable);
87
91
  // Parent providers receive this notice as a user message and may reject
88
92
  // nontext assistant blocks. Keep this conversion local so SDK/UI consumers
89
93
  // retain the complete child output.
90
- const closingText = (terminal.output ?? []).flatMap(block => block.type === 'text' && block.text.length > 0 ? [block] : []);
94
+ const closingText = terminal.output.flatMap(block => block.type === 'text' && block.text.length > 0 ? [block] : []);
91
95
  return createUserMessage({
92
96
  content: [
93
97
  { type: 'text', text: summary },
94
98
  ...closingText.length === 0
95
99
  ? [{ type: 'text', text: 'It left no closing message.' }]
96
100
  : [{ type: 'text', text: 'Its closing message:' }, ...closingText],
101
+ ...terminal.structured !== undefined
102
+ ? [{ type: 'text', text: `Structured result: ${JSON.stringify(terminal.structured)}` }] : [],
103
+ ...terminal.diagnostic !== undefined
104
+ ? [{ type: 'text', text: terminal.diagnostic }] : [],
97
105
  ],
98
106
  source: {
99
107
  kind: 'subagent-settled',
@@ -30,6 +30,11 @@ export type SubagentCatalogRow = {
30
30
  readonly mode: 'one-shot';
31
31
  /** Optional durable creation label from the parent catalog. */
32
32
  readonly label?: string;
33
+ } | {
34
+ /** An external execution without a local child Session. */
35
+ readonly mode: 'external';
36
+ /** Optional durable creation label from the parent catalog. */
37
+ readonly label?: string;
33
38
  } | {
34
39
  /** A resumable conversation. */
35
40
  readonly mode: 'continuable';
@@ -67,6 +72,8 @@ export type SubagentAddress = {
67
72
  } | {
68
73
  readonly mode: 'unknown';
69
74
  });
75
+ /** One Agent inbox destination, as the prompt request selects it. */
76
+ export type SubagentDelivery = SubagentPromptRequest['delivery'];
70
77
  /** One human message addressed to a continuable direct child. */
71
78
  export interface SubagentPromptRequest {
72
79
  /** Identity persisted on the accepted message, minted before the call. */
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * The durable subagent-child descriptor: the versioned, model-hidden
3
3
  * `subagent/descriptor` session event that identifies every session-backed
4
- * subagent and records whether it is one-shot or continuable. Continuable
5
- * descriptors additionally preserve the declared composition required for
6
- * cold resume. Providers append it turn-enclosed in the child's initial turn.
4
+ * subagent, including historical one-shot records. The manager appends each
5
+ * continuable child's descriptor inside its initial turn, preserving the
6
+ * declared composition required for cold resume.
7
7
  *
8
8
  * The descriptor deliberately snapshots explicit fields rather than the
9
9
  * merge-extensible `AgentOptions` object: an unrelated extension value cannot
@@ -27,8 +27,8 @@ declare module '@deepseek-ai/dsh-session/types' {
27
27
  interface SessionEventMap {
28
28
  /**
29
29
  * Durable identity and lifecycle mode of a session-backed subagent child,
30
- * appended once by the establishing provider inside the child's initial
31
- * turn, before its first request. Continuable records also carry their
30
+ * appended once inside the child's initial turn, before its first
31
+ * request. Continuable records also carry their
32
32
  * resumable composition. Log-only: it carries no `surfaceOp`, never enters
33
33
  * model history, and survives compaction.
34
34
  */
@@ -79,47 +79,8 @@ export interface ContinuableSubagentDescriptorData extends SubagentDescriptorBas
79
79
  }
80
80
  /** The supported durable subagent identity and optional continuation composition. */
81
81
  export type SubagentDescriptorData = OneShotSubagentDescriptorData | ContinuableSubagentDescriptorData;
82
- /** Fields shared by descriptor snapshot inputs. */
83
- interface SubagentDescriptorInputBase {
84
- /** Whether the child is a terminal one-shot run or a resumable conversation. */
85
- readonly mode: 'one-shot' | 'continuable';
86
- /** The `ctx.subagents` provider name that will establish the child. */
87
- readonly provider: string;
88
- }
89
- /** Input for a one-shot child's durable identity. */
90
- export interface OneShotSubagentDescriptorInput extends SubagentDescriptorInputBase {
91
- readonly mode: 'one-shot';
92
- /** Optional initial delegation `description` used as the durable creation label. */
93
- readonly label?: string;
94
- }
95
- /** Input for a continuable child's durable identity and resumable composition. */
96
- export interface ContinuableSubagentDescriptorInput extends SubagentDescriptorInputBase {
97
- readonly mode: 'continuable';
98
- /** Initial delegation `description` used for durable enumeration. */
99
- readonly label: string;
100
- /** Requested child `agentOptions.provider`. */
101
- readonly agentProvider?: string;
102
- /** Requested child `agentOptions.model`. */
103
- readonly agentModel?: string;
104
- /** Requested child `agentOptions.reasoningEffort`. */
105
- readonly agentReasoningEffort?: ReasoningEffortId;
106
- /** Requested per-child persona. */
107
- readonly persona?: string;
108
- /** Requested child tool scoping. */
109
- readonly toolFilter?: ToolRestriction;
110
- }
111
- /** Inputs {@link snapshotSubagentDescriptor} validates and detaches. */
112
- export type SubagentDescriptorInput = OneShotSubagentDescriptorInput | ContinuableSubagentDescriptorInput;
113
- /**
114
- * Validate and detach descriptor inputs into the durable payload, before any
115
- * Task or provider work begins — the same detached lossless-JSON boundary the
116
- * session log itself enforces, applied early so a synchronous validation
117
- * failure rejects the tool call without creating a Task.
118
- * @param input - the caller-collected composition fields.
119
- * @returns the versioned, detached descriptor payload.
120
- * @throws when a field is not losslessly JSON-serializable.
121
- */
122
- export declare function snapshotSubagentDescriptor(input: OneShotSubagentDescriptorInput): OneShotSubagentDescriptorData;
82
+ /** Continuable composition fields before the snapshot stamps their format version. */
83
+ export type ContinuableSubagentDescriptorInput = Omit<ContinuableSubagentDescriptorData, 'version'>;
123
84
  /**
124
85
  * Validate and detach a continuable descriptor input.
125
86
  * @param input - the caller-collected continuable composition fields.
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * The durable subagent-child descriptor: the versioned, model-hidden
3
3
  * `subagent/descriptor` session event that identifies every session-backed
4
- * subagent and records whether it is one-shot or continuable. Continuable
5
- * descriptors additionally preserve the declared composition required for
6
- * cold resume. Providers append it turn-enclosed in the child's initial turn.
4
+ * subagent, including historical one-shot records. The manager appends each
5
+ * continuable child's descriptor inside its initial turn, preserving the
6
+ * declared composition required for cold resume.
7
7
  *
8
8
  * The descriptor deliberately snapshots explicit fields rather than the
9
9
  * merge-extensible `AgentOptions` object: an unrelated extension value cannot
@@ -147,25 +147,24 @@ function parseSubagentDescriptor(value) {
147
147
  ...toolFilter !== undefined ? { toolFilter } : {},
148
148
  };
149
149
  }
150
+ /**
151
+ * Validate and detach a continuable descriptor input.
152
+ * @param input - the caller-collected continuable composition fields.
153
+ * @returns the versioned, detached continuable descriptor payload.
154
+ * @throws when a field is not losslessly JSON-serializable.
155
+ */
150
156
  export function snapshotSubagentDescriptor(input) {
151
- const candidate = input.mode === 'one-shot'
152
- ? {
153
- version: SUBAGENT_DESCRIPTOR_VERSION,
154
- mode: input.mode,
155
- provider: input.provider,
156
- ...input.label !== undefined ? { label: input.label } : {},
157
- }
158
- : {
159
- version: SUBAGENT_DESCRIPTOR_VERSION,
160
- mode: input.mode,
161
- provider: input.provider,
162
- label: input.label,
163
- ...input.agentProvider !== undefined ? { agentProvider: input.agentProvider } : {},
164
- ...input.agentModel !== undefined ? { agentModel: input.agentModel } : {},
165
- ...input.agentReasoningEffort !== undefined ? { agentReasoningEffort: input.agentReasoningEffort } : {},
166
- ...input.persona !== undefined ? { persona: input.persona } : {},
167
- ...input.toolFilter !== undefined ? { toolFilter: input.toolFilter } : {},
168
- };
157
+ const candidate = {
158
+ version: SUBAGENT_DESCRIPTOR_VERSION,
159
+ mode: input.mode,
160
+ provider: input.provider,
161
+ label: input.label,
162
+ ...input.agentProvider !== undefined ? { agentProvider: input.agentProvider } : {},
163
+ ...input.agentModel !== undefined ? { agentModel: input.agentModel } : {},
164
+ ...input.agentReasoningEffort !== undefined ? { agentReasoningEffort: input.agentReasoningEffort } : {},
165
+ ...input.persona !== undefined ? { persona: input.persona } : {},
166
+ ...input.toolFilter !== undefined ? { toolFilter: input.toolFilter } : {},
167
+ };
169
168
  const snapshot = snapshotJsonValue(candidate);
170
169
  if (snapshot === undefined) {
171
170
  throw new Error('subagent descriptor is not losslessly JSON-serializable');
@@ -11,15 +11,14 @@
11
11
  * (`@deepseek-ai/dsh-subagent-spawn-in-process`, `-fork`, `-acp`) and the model-facing
12
12
  * consumer (`@deepseek-ai/dsh-tool-subagent`) are separate packages.
13
13
  *
14
- * Public operations express caller intent: `start` returns one published owned
15
- * one-shot run, `startContinuable` establishes a durable continuable child, and
16
- * `sendMessage` steers between adjacent Agents without exposing whether a child
17
- * is resident. Continuable children never become a {@link SubagentRun}: the
18
- * continuation manager holds their `AgentHandle` directly and orders every turn
19
- * through the child's own inbox, so providers contribute only the detached
20
- * creation spec and see no handle, turn, or teardown. Direct-child
21
- * discovery reads the parent catalog; descendant discovery recursively reads
22
- * those child catalogs. Neither read requires the continuation runtime.
14
+ * `startActivation` establishes every child under the activation manager, which
15
+ * owns execution, result delivery, and resource release. Local providers seed
16
+ * resumable Agents; external providers return a single execution handle.
17
+ * `sendMessage` steers between adjacent local Agents without exposing
18
+ * whether a child is resident. Discovery combines real child Sessions with
19
+ * parent-owned records for external executions.
20
+ * Direct discovery reads parent catalogs; descendants recursively read reachable
21
+ * child catalogs. External entries are leaves without local Sessions.
23
22
  *
24
23
  * Same-process providers are trusted typed collaborators. Requests, provider
25
24
  * descriptors, results, and lifecycle payloads are borrowed immutable values;
@@ -37,7 +36,7 @@ import type { Agent } from '@deepseek-ai/dsh-agent';
37
36
  import type { SessionId } from '@deepseek-ai/dsh-session';
38
37
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
39
38
  import type { SubagentInterruptReceipt, SubagentPromptReceipt, SubagentPromptRequest } from './control-types.ts';
40
- import type { ContinuableStart, ContinuableStartSpec, SubagentInterruptAuthority, SubagentProvider, SubagentRun, SubagentRunEndInfo, SubagentRunInfo, SubagentSendMessageOptions, SubagentStartRequest } from './types.ts';
39
+ import type { SubagentActivation, SubagentActivationSpec, SubagentInterruptAuthority, SubagentProvider, SubagentRunEndInfo, SubagentRunInfo, SubagentSendMessageOptions } from './types.ts';
41
40
  import type { SubagentDescendantListEntry } from './list-children.ts';
42
41
  import type { SubagentCatalogEntry } from './projection-types.ts';
43
42
  import { deliverSubagentPrompt } from './internal.ts';
@@ -45,12 +44,11 @@ export type {} from './catalog.ts';
45
44
  export * from './out-of-process.ts';
46
45
  export { AssistantOutputFold, finalAssistantOutput } from './assistant-output.ts';
47
46
  export { SubagentRunId } from './types.ts';
48
- export type { ContinuableCreateRequest, ContinuableCreateSpec, ContinuableStart, ContinuableStartSpec, ResolvedSubagentStartRequest, SubagentCapabilities, SubagentInterruptAuthority, SubagentProvider, SubagentResult, SubagentRun, SubagentSendMessageOptions, SubagentStartRequest, SubagentStopReason, SubagentStopReasonMap, } from './types.ts';
47
+ export type { ContinuableCreateRequest, ContinuableCreateSpec, SubagentCapabilities, SubagentActivation, SubagentActivationSpec, SubagentInterruptAuthority, SubagentProvider, SubagentResult, SubagentRun, SubagentSendMessageOptions, SubagentStartRequest, ResolvedSubagentStartRequest, SubagentStopReason, SubagentStopReasonMap, } from './types.ts';
49
48
  export { foldSubagentDescriptor, snapshotSubagentDescriptor, SUBAGENT_DESCRIPTOR_VERSION, } from './descriptor.ts';
50
- export type { ContinuableSubagentDescriptorData, ContinuableSubagentDescriptorInput, OneShotSubagentDescriptorData, OneShotSubagentDescriptorInput, SubagentDescriptorData, SubagentDescriptorInput, } from './descriptor.ts';
51
- export type { SubagentCatalogEntry } from './projection-types.ts';
49
+ export type { ContinuableSubagentDescriptorData, ContinuableSubagentDescriptorInput, OneShotSubagentDescriptorData, SubagentDescriptorData, } from './descriptor.ts';
50
+ export { STRUCTURED_OUTPUT_TOOL } from './structured.ts';
52
51
  export { SubagentError } from './error.ts';
53
- export { settleRun } from './run-settlement.ts';
54
52
  export { assertSubagentMaxDepth, delegationDepthOf } from './depth.ts';
55
53
  export { appendDelegatedPolicyOverrides, applyChildComposition, captureDelegatedPolicyOverrides, childSessionMeta, parentAgentOptionsForDelegation, resolveChildAgentOptions, resolveChildDepth, SubagentDepthError, } from './child-agent.ts';
56
54
  export type { ChildComposition, DelegatedPolicyOverrides } from './child-agent.ts';
@@ -58,7 +56,7 @@ export type { AgentMessageSource, SubagentSettledMessageSource } from './continu
58
56
  export type * from './control-types.ts';
59
57
  export type { SubagentDescendantListEntry } from './list-children.ts';
60
58
  export type { SubagentRunEndInfo, SubagentRunInfo } from './types.ts';
61
- export type { SubagentIdentityProjection, SubagentTimingProjection } from './projection-types.ts';
59
+ export type { SubagentCatalogEntry, SubagentIdentityProjection, SubagentTimingProjection } from './projection-types.ts';
62
60
  declare module '@deepseek-ai/cordis' {
63
61
  interface Context {
64
62
  subagents: SubagentRuntime;
@@ -103,7 +101,7 @@ export interface Config {
103
101
  /** Default delegation depth for tools without an explicit limit; defaults to 1. */
104
102
  maxDepth: Volatile<number>;
105
103
  }
106
- /** Named provider registry with one-shot runs, durable discovery, and continuable-child operations. */
104
+ /** Named provider registry with managed activations, durable discovery, and local child messaging. */
107
105
  export declare class SubagentRuntime extends TypertRemoteService {
108
106
  private config;
109
107
  static Config: z<Schemastery.ObjectS<NoInfer<{
@@ -113,8 +111,9 @@ export declare class SubagentRuntime extends TypertRemoteService {
113
111
  maxDepth: z<number, number, "volatile-defined">;
114
112
  maxActiveSubagents: z<number, number, "volatile-defined">;
115
113
  }>>, "plain">;
114
+ static inject: string[];
116
115
  private providers;
117
- private continuations;
116
+ private manager;
118
117
  /**
119
118
  * The contained lifecycle-edge publisher. Built here because scoped dispatch
120
119
  * keys its carrier by this exact service instance, whose own context filter
@@ -129,15 +128,28 @@ export declare class SubagentRuntime extends TypertRemoteService {
129
128
  */
130
129
  resolveMaxDepth(configured?: number | 'provider-managed'): number | undefined;
131
130
  /**
132
- * Establish one durable continuable child and deliver its initial prompt.
133
- * Resolves when the child's inbox accepts that prompt, without waiting for the
134
- * turn to start or for the message to reach the Session log; any earlier
135
- * failure rejects with no ids and rolls back the child entirely.
136
- * @param spec - provider, delegation request, and caller cancellation.
137
- * @returns the durable child id and the accepted prompt's message id.
138
- * @throws when continuation services are unavailable or materialization fails.
131
+ * Start a local child under its reserved identity.
132
+ * @param spec - local task, reserved child id, and result recipient.
133
+ * @returns activation with its accepted initial message id.
139
134
  */
140
- startContinuable(spec: ContinuableStartSpec): Promise<ContinuableStart>;
135
+ startActivation(spec: SubagentActivationSpec & {
136
+ readonly childId: SessionId;
137
+ }): Promise<SubagentActivation & {
138
+ readonly messageId: MessageId;
139
+ }>;
140
+ /**
141
+ * Start a local or external child.
142
+ * @param spec - task, backend, and result recipient.
143
+ * @returns activation with a message id only for local children.
144
+ */
145
+ startActivation(spec: SubagentActivationSpec): Promise<SubagentActivation>;
146
+ /**
147
+ * Join progressing descendants without cancelling them. Idle descendants whose
148
+ * inboxes require a later wake stay resident and do not delay host completion.
149
+ * @param parent - the exact parent whose descendant work is observed.
150
+ * @returns whether work was joined; hosts recheck parent idle after true.
151
+ */
152
+ waitForChildren(parent: Agent): Promise<boolean>;
141
153
  /**
142
154
  * Steer one model-authored message to the sender's direct parent or direct
143
155
  * continuable child. A running target admits it at the nearest step boundary;
@@ -167,13 +179,13 @@ export declare class SubagentRuntime extends TypertRemoteService {
167
179
  */
168
180
  private [deliverSubagentPrompt];
169
181
  /**
170
- * Interrupt one live continuable child's current turn under a human parent
182
+ * Interrupt one live child's current execution under a human parent
171
183
  * address or an exact live ancestor Agent. Fire-and-return: the cancel
172
184
  * signal is issued before this returns, but the target may keep running
173
185
  * until it observes the signal. Unclaimed pending inbox work, the Activation,
174
186
  * and published descendants are preserved; claimed work is not requeued.
175
- * Once the interrupted driver is idle, a waking send resumes the parked FIFO
176
- * queue. An absent target — including a one-shot or unknown id —
187
+ * Once the interrupted Agent is idle, a waking send resumes the parked FIFO
188
+ * queue. External backends stop their single execution. An absent target
177
189
  * is an accepted no-op, as is a manager-less composition, which cannot own a
178
190
  * live Activation.
179
191
  * @param targetSessionId - the durable child session id to interrupt.
@@ -183,27 +195,27 @@ export declare class SubagentRuntime extends TypertRemoteService {
183
195
  */
184
196
  interrupt(targetSessionId: SessionId, authority: SubagentInterruptAuthority): void;
185
197
  /**
186
- * Close continuable admission below exact live parent Agents, stop only their
198
+ * Close subagent admission below exact live parent Agents, stop only their
187
199
  * visible descendant Activations synchronously, then await admitted scoped
188
200
  * materializations and release those forests child-first. The scoped cutoff
189
201
  * lasts until each exact parent leaves the registry; unrelated parent trees
190
202
  * remain live.
191
203
  * @param parents - exact host-owned parent Agents entering teardown.
192
- * @returns once every retained descendant Activation released its `AgentHandle`.
204
+ * @returns once every retained descendant activation released its execution handle.
193
205
  * @throws an aggregate error after all branches settle when any failed.
194
206
  */
195
- drainContinuableDescendants(parents: readonly Agent[]): Promise<void>;
207
+ drainDescendants(parents: readonly Agent[]): Promise<void>;
196
208
  /**
197
- * Release selected resident continuable direct children of one exact live
209
+ * Release selected resident direct children of one exact live
198
210
  * parent. Other children of the same parent remain admitted and resident.
199
211
  * Absent targets and a manager-less composition are accepted no-ops.
200
212
  * @param parent - exact live direct parent authorizing the selected release.
201
213
  * @param childIds - durable direct-child ids to release when resident.
202
- * @returns once every selected Activation released its `AgentHandle`.
214
+ * @returns once every selected activation released its execution handle.
203
215
  * @throws {SubagentError} `UNAUTHORIZED` when a resident target belongs to a
204
216
  * different parent or the supplied parent identity is stale.
205
217
  */
206
- drainContinuableChildren(parent: Agent, childIds: readonly SessionId[]): Promise<void>;
218
+ drainChildren(parent: Agent, childIds: readonly SessionId[]): Promise<void>;
207
219
  /**
208
220
  * Read the parent's durable direct-child catalog without loading or resuming an Agent.
209
221
  * The service owns and releases the live-preferred Session observation.
@@ -217,7 +229,8 @@ export declare class SubagentRuntime extends TypertRemoteService {
217
229
  /**
218
230
  * Recursively list reachable parent catalogs in stable pre-order, preserving
219
231
  * each catalog's event order. Each row carries its catalog parent and depth;
220
- * one-shot and unknown-mode children remain traversal nodes. Unknown modes
232
+ * external children are leaves; one-shot and unknown-mode children remain
233
+ * traversal nodes. Unknown modes
221
234
  * produce unsupported diagnostics. Unreadable child catalogs produce corrupt
222
235
  * or unavailable diagnostics and stop only that branch. Root read failures,
223
236
  * missing services or projections, and cancellation reject the whole listing.
@@ -267,7 +280,8 @@ export declare class SubagentRuntime extends TypertRemoteService {
267
280
  /**
268
281
  * Register a provider under its name. Registration is effect-scoped and HMR
269
282
  * safe; removing a provider blocks new starts but does not revoke runs that
270
- * were already returned to their holders.
283
+ * were already returned to their holders. Providers without either execution
284
+ * method are rejected with UNSUPPORTED_CAPABILITY before registration.
271
285
  * @param provider - the trusted provider implementation.
272
286
  * @returns the exact Cordis effect disposer.
273
287
  */
@@ -283,19 +297,6 @@ export declare class SubagentRuntime extends TypertRemoteService {
283
297
  * @returns the registered names.
284
298
  */
285
299
  list(): string[];
286
- /**
287
- * Establish a published child on the named provider. Capability and semantic
288
- * checks run before delegation. Provider ownership lasts until its promise
289
- * fulfills; a rejection therefore has no run for the caller to dispose and
290
- * emits no run lifecycle events. Post-publication turn and infrastructure
291
- * failures settle through the returned run.
292
- * A catalog append failure disposes the run and handles its result rejection;
293
- * the caller receives the catalog error even if disposal also fails.
294
- * @param name - the provider to use.
295
- * @param request - child label, prompt, parent, signal, and optional capabilities.
296
- * @returns the published holder-owned run.
297
- */
298
- start(name: string, request: SubagentStartRequest): Promise<SubagentRun>;
299
300
  /**
300
301
  * Resolve one provider's detached continuable-creation contribution. Method
301
302
  * presence on the provider IS the capability, so a provider without it is
@@ -304,8 +305,8 @@ export declare class SubagentRuntime extends TypertRemoteService {
304
305
  private prepareContinuable;
305
306
  /** Look up a provider for dispatch or fail loud. */
306
307
  private expectProvider;
307
- /** Resolve the optional continuable-subagent manager or fail loud. */
308
- private requireContinuations;
308
+ /** Resolve the subagent manager or fail loud. */
309
+ private requireManager;
309
310
  /**
310
311
  * Build the lifecycle observer for one continuable Activation's residency
311
312
  * epoch, so the manager publishes its edges without owning event dispatch.