@deepseek-ai/dsh-subagent 0.1.2-alpha.5 → 0.1.3-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.
@@ -90,6 +90,8 @@ export interface SubagentPromptRequest {
90
90
  readonly childSessionId: SessionId;
91
91
  /** Required discriminator retained from the browser control address. */
92
92
  readonly mode: 'continuable';
93
+ /** Whether this message queues a later turn or targets the nearest step. */
94
+ readonly delivery: 'queue' | 'steer';
93
95
  /**
94
96
  * Browser prompt parts delivered as the child's user message. The Host
95
97
  * admits and persists image parts before delivery, so the wire never
@@ -17,6 +17,10 @@ declare const CONTROL_ID_SCHEMAS: {
17
17
  parentSessionId: z.ZodString;
18
18
  childSessionId: z.ZodString;
19
19
  mode: z.ZodLiteral<"continuable">;
20
+ delivery: z.ZodEnum<{
21
+ queue: "queue";
22
+ steer: "steer";
23
+ }>;
20
24
  }, z.core.$strip>;
21
25
  readonly 'subagent.interrupt': z.ZodObject<{
22
26
  parentSessionId: z.ZodString;
@@ -16,6 +16,7 @@ const CONTROL_ID_SCHEMAS = {
16
16
  parentSessionId: SESSION_ID_SCHEMA,
17
17
  childSessionId: SESSION_ID_SCHEMA,
18
18
  mode: z.literal('continuable'),
19
+ delivery: z.enum(['queue', 'steer']),
19
20
  }),
20
21
  'subagent.interrupt': z.object({
21
22
  parentSessionId: SESSION_ID_SCHEMA,
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Activation-local admission around one continuable subagent's Agent inbox.
3
+ *
4
+ * @module @deepseek-ai/dsh-subagent/inbox
5
+ */
6
+ import type { Agent } from '@deepseek-ai/dsh-agent';
7
+ import type { UserMessage } from '@deepseek-ai/dsh-session';
8
+ import type { SubagentPromptRequest } from './control-types.ts';
9
+ /** One Agent inbox destination, as the wire request selects it. */
10
+ export type SubagentDelivery = SubagentPromptRequest['delivery'];
11
+ /** Delegate Queue and Steer to one live Agent until its Activation starts closing. */
12
+ export declare class SubagentInbox {
13
+ private readonly agent;
14
+ private closingPromise;
15
+ /**
16
+ * Wrap one live continuable Agent.
17
+ * @param agent - the Agent whose inbox receives accepted deliveries.
18
+ */
19
+ constructor(agent: Agent);
20
+ /**
21
+ * Read the Activation's close transaction.
22
+ * @returns the memoized transaction, or `undefined` while delivery remains open.
23
+ */
24
+ get closing(): Promise<void> | undefined;
25
+ /**
26
+ * Read whether the underlying Agent still has accepted work to claim.
27
+ * @returns whether either Agent inbox destination is non-empty.
28
+ */
29
+ get hasPending(): boolean;
30
+ /**
31
+ * Submit through the Agent only while its Activation remains resident.
32
+ * @param message - the accepted input to submit.
33
+ * @param delivery - whether to queue a distinct turn or steer the nearest step.
34
+ */
35
+ deliver(message: UserMessage, delivery: SubagentDelivery): void;
36
+ /**
37
+ * Close delivery synchronously and share one asynchronous release.
38
+ * @param release - the one release operation to start after closing admission.
39
+ * @returns the memoized release transaction.
40
+ */
41
+ close(release: () => Promise<void>): Promise<void>;
42
+ }
43
+ //# sourceMappingURL=inbox.d.ts.map
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Activation-local admission around one continuable subagent's Agent inbox.
3
+ *
4
+ * @module @deepseek-ai/dsh-subagent/inbox
5
+ */
6
+ import { SubagentError } from "./error.js";
7
+ /** Delegate Queue and Steer to one live Agent until its Activation starts closing. */
8
+ export class SubagentInbox {
9
+ agent;
10
+ closingPromise;
11
+ /**
12
+ * Wrap one live continuable Agent.
13
+ * @param agent - the Agent whose inbox receives accepted deliveries.
14
+ */
15
+ constructor(agent) {
16
+ this.agent = agent;
17
+ }
18
+ /**
19
+ * Read the Activation's close transaction.
20
+ * @returns the memoized transaction, or `undefined` while delivery remains open.
21
+ */
22
+ get closing() {
23
+ return this.closingPromise;
24
+ }
25
+ /**
26
+ * Read whether the underlying Agent still has accepted work to claim.
27
+ * @returns whether either Agent inbox destination is non-empty.
28
+ */
29
+ get hasPending() {
30
+ return this.agent.inbox.hasPending;
31
+ }
32
+ /**
33
+ * Submit through the Agent only while its Activation remains resident.
34
+ * @param message - the accepted input to submit.
35
+ * @param delivery - whether to queue a distinct turn or steer the nearest step.
36
+ */
37
+ deliver(message, delivery) {
38
+ if (this.closingPromise !== undefined) {
39
+ throw new SubagentError(`subagent "${this.agent.id}" activation is being disposed; the message was not accepted`, 'ACTIVATION_CLOSING');
40
+ }
41
+ if (delivery === 'steer')
42
+ this.agent.steer(message);
43
+ else
44
+ this.agent.followup(message);
45
+ }
46
+ /**
47
+ * Close delivery synchronously and share one asynchronous release.
48
+ * @param release - the one release operation to start after closing admission.
49
+ * @returns the memoized release transaction.
50
+ */
51
+ close(release) {
52
+ const existing = this.closingPromise;
53
+ if (existing !== undefined)
54
+ return existing;
55
+ const completion = Promise.withResolvers();
56
+ this.closingPromise = completion.promise;
57
+ void release().then(completion.resolve, completion.reject);
58
+ return completion.promise;
59
+ }
60
+ }
61
+ //# sourceMappingURL=inbox.js.map
@@ -35,23 +35,21 @@ import type { Agent } from '@deepseek-ai/dsh-agent';
35
35
  import type { SessionId } from '@deepseek-ai/dsh-session';
36
36
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
37
37
  import type { SubagentCatalog, SubagentInterruptReceipt, SubagentPromptReceipt, SubagentPromptRequest } from './control-types.ts';
38
- import type { SubagentProvider, SubagentRun, SubagentRunEndInfo, SubagentRunInfo, SubagentStartRequest } from './types.ts';
39
- import type { ContinuableStart, ContinuableStartSpec, SubagentInterruptAuthority, SubagentSendMessageOptions } from './continuation.ts';
38
+ import type { ContinuableStart, ContinuableStartSpec, SubagentInterruptAuthority, SubagentProvider, SubagentRun, SubagentRunEndInfo, SubagentRunInfo, SubagentSendMessageOptions, SubagentStartRequest } from './types.ts';
40
39
  import type { SubagentDescendantListEntry, SubagentListEntry } from './list-children.ts';
41
- import { queueSubagentPrompt } from './internal.ts';
40
+ import { deliverSubagentPrompt } from './internal.ts';
42
41
  export * from './out-of-process.ts';
43
42
  export { AssistantOutputFold, finalAssistantOutput } from './assistant-output.ts';
44
43
  export { SubagentRunId } from './types.ts';
45
- export type { ContinuableCreateRequest, ContinuableCreateSpec, ResolvedSubagentStartRequest, SubagentCapabilities, SubagentProvider, SubagentResult, SubagentRun, SubagentStartRequest, SubagentStopReason, SubagentStopReasonMap, } from './types.ts';
44
+ export type { ContinuableCreateRequest, ContinuableCreateSpec, ContinuableStart, ContinuableStartSpec, ResolvedSubagentStartRequest, SubagentCapabilities, SubagentInterruptAuthority, SubagentProvider, SubagentResult, SubagentRun, SubagentSendMessageOptions, SubagentStartRequest, SubagentStopReason, SubagentStopReasonMap, } from './types.ts';
46
45
  export { foldSubagentDescriptor, snapshotSubagentDescriptor, SUBAGENT_DESCRIPTOR_VERSION, } from './descriptor.ts';
47
46
  export type { ContinuableSubagentDescriptorData, ContinuableSubagentDescriptorInput, OneShotSubagentDescriptorData, OneShotSubagentDescriptorInput, SubagentDescriptorData, SubagentDescriptorInput, } from './descriptor.ts';
48
- export { seedDescriptorTurn } from './descriptor-seed.ts';
49
47
  export { SubagentError } from './error.ts';
50
48
  export { settleRun } from './run-settlement.ts';
51
49
  export { assertSubagentMaxDepth, delegationDepthOf } from './depth.ts';
52
50
  export { appendDelegatedPolicyOverrides, applyChildComposition, captureDelegatedPolicyOverrides, childSessionMeta, parentAgentOptionsForDelegation, resolveChildAgentOptions, resolveChildDepth, SubagentDepthError, } from './child-agent.ts';
53
51
  export type { ChildComposition, DelegatedPolicyOverrides } from './child-agent.ts';
54
- export type { AgentMessageSource, ContinuableStart, ContinuableStartSpec, SubagentInterruptAuthority, SubagentSendMessageOptions, SubagentSettledMessageSource, } from './continuation.ts';
52
+ export type { AgentMessageSource, SubagentSettledMessageSource } from './continuation-messages.ts';
55
53
  export type * from './control-types.ts';
56
54
  export type { SubagentDescendantListEntry } from './list-children.ts';
57
55
  export type { SubagentRunEndInfo, SubagentRunInfo } from './types.ts';
@@ -132,7 +130,7 @@ export declare class SubagentRuntime extends TypertRemoteService {
132
130
  */
133
131
  sendMessage(sender: Agent, targetId: SessionId, content: ContentBlock[], options: SubagentSendMessageOptions): Promise<MessageId>;
134
132
  /**
135
- * Queue one host-protocol message as a distinct direct-child turn.
133
+ * Deliver one host-protocol message to a direct continuable child.
136
134
  * Symbol-keyed so host adapters can preserve their own provenance without
137
135
  * widening the public Service Definition or impersonating an Agent sender.
138
136
  * @param parent - exact live direct parent authorizing delivery.
@@ -140,9 +138,10 @@ export declare class SubagentRuntime extends TypertRemoteService {
140
138
  * @param content - host-authored content to deliver.
141
139
  * @param source - durable host-protocol provenance.
142
140
  * @param signal - caller cancellation before inbox acceptance.
141
+ * @param delivery - Queue as a distinct turn or Steer at the nearest step.
143
142
  * @returns the accepted message's inbox id.
144
143
  */
145
- private [queueSubagentPrompt];
144
+ private [deliverSubagentPrompt];
146
145
  /**
147
146
  * Interrupt one live continuable child's current turn under a human parent
148
147
  * address or an exact live ancestor Agent. Fire-and-return: the cancel
@@ -233,11 +232,12 @@ export declare class SubagentRuntime extends TypertRemoteService {
233
232
  * Deliver one browser-authored message to a continuable child through the
234
233
  * exact live direct parent, retaining the caller-minted request identity and
235
234
  * validated browser zone on the accepted message. Success identifies the
236
- * message the child's FIFO inbox accepted; later execution is independent of
237
- * this call.
235
+ * message the child's inbox accepted; later execution is independent of this
236
+ * call. Queue delivery targets a later turn; steer delivery targets the
237
+ * nearest step and retains the Agent loop's best-effort fallback semantics.
238
238
  * Image parts are admitted and persisted through the attachment store
239
239
  * before delivery, and the child's model must accept image input.
240
- * @param request - durable address, minted identity, content, and optional browser zone.
240
+ * @param request - durable address, delivery, minted identity, content, and optional browser zone.
241
241
  * @param signal - carrier cancellation, owning the call until inbox acceptance.
242
242
  * @returns the accepted message's inbox identity.
243
243
  * @throws {RemoteError} `gateway/bad-request`, `subagent/attachment-invalid`,
@@ -62,7 +62,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
62
62
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
63
63
  done = true;
64
64
  };
65
- import { admitPromptContent } from '@deepseek-ai/dsh-attachment';
66
65
  import { scopeTarget } from '@deepseek-ai/dsh-scope';
67
66
  import { assertObjectJsonSchema } from '@deepseek-ai/dsh-tools';
68
67
  import { canonicalClientTimeZone } from '@deepseek-ai/dsh-util-time';
@@ -75,12 +74,11 @@ import SubagentContinuationManager from "./continuation.js";
75
74
  import { listChildren as listSubagentChildren, listDescendants as listSubagentDescendants } from "./list-children.js";
76
75
  import { snapshotSubagentDescriptor } from "./descriptor.js";
77
76
  import { subagentIdentityProjectionDefinition, subagentTimingProjectionDefinition } from "./projection.js";
78
- import { queueSubagentPrompt } from "./internal.js";
77
+ import { deliverSubagentPrompt } from "./internal.js";
79
78
  export * from "./out-of-process.js";
80
79
  export { AssistantOutputFold, finalAssistantOutput } from "./assistant-output.js";
81
80
  export { SubagentRunId } from "./types.js";
82
81
  export { foldSubagentDescriptor, snapshotSubagentDescriptor, SUBAGENT_DESCRIPTOR_VERSION, } from "./descriptor.js";
83
- export { seedDescriptorTurn } from "./descriptor-seed.js";
84
82
  export { SubagentError } from "./error.js";
85
83
  export { settleRun } from "./run-settlement.js";
86
84
  export { assertSubagentMaxDepth, delegationDepthOf } from "./depth.js";
@@ -161,7 +159,7 @@ let SubagentRuntime = (() => {
161
159
  return this.requireContinuations().sendMessage(sender, targetId, content, options);
162
160
  }
163
161
  /**
164
- * Queue one host-protocol message as a distinct direct-child turn.
162
+ * Deliver one host-protocol message to a direct continuable child.
165
163
  * Symbol-keyed so host adapters can preserve their own provenance without
166
164
  * widening the public Service Definition or impersonating an Agent sender.
167
165
  * @param parent - exact live direct parent authorizing delivery.
@@ -169,10 +167,13 @@ let SubagentRuntime = (() => {
169
167
  * @param content - host-authored content to deliver.
170
168
  * @param source - durable host-protocol provenance.
171
169
  * @param signal - caller cancellation before inbox acceptance.
170
+ * @param delivery - Queue as a distinct turn or Steer at the nearest step.
172
171
  * @returns the accepted message's inbox id.
173
172
  */
174
- [queueSubagentPrompt](parent, childId, content, source, signal) {
175
- return this.requireContinuations().queuePrompt(parent, childId, content, source, signal);
173
+ [deliverSubagentPrompt](parent, childId, content, source, signal, delivery) {
174
+ return delivery === 'steer'
175
+ ? this.requireContinuations().steerPrompt(parent, childId, content, source, signal)
176
+ : this.requireContinuations().queuePrompt(parent, childId, content, source, signal);
176
177
  }
177
178
  /**
178
179
  * Interrupt one live continuable child's current turn under a human parent
@@ -289,11 +290,12 @@ let SubagentRuntime = (() => {
289
290
  * Deliver one browser-authored message to a continuable child through the
290
291
  * exact live direct parent, retaining the caller-minted request identity and
291
292
  * validated browser zone on the accepted message. Success identifies the
292
- * message the child's FIFO inbox accepted; later execution is independent of
293
- * this call.
293
+ * message the child's inbox accepted; later execution is independent of this
294
+ * call. Queue delivery targets a later turn; steer delivery targets the
295
+ * nearest step and retains the Agent loop's best-effort fallback semantics.
294
296
  * Image parts are admitted and persisted through the attachment store
295
297
  * before delivery, and the child's model must accept image input.
296
- * @param request - durable address, minted identity, content, and optional browser zone.
298
+ * @param request - durable address, delivery, minted identity, content, and optional browser zone.
297
299
  * @param signal - carrier cancellation, owning the call until inbox acceptance.
298
300
  * @returns the accepted message's inbox identity.
299
301
  * @throws {RemoteError} `gateway/bad-request`, `subagent/attachment-invalid`,
@@ -302,7 +304,7 @@ let SubagentRuntime = (() => {
302
304
  * `subagent/delivery-unavailable`, `gateway/cancelled`, or `gateway/internal`.
303
305
  */
304
306
  async prompt(request, signal) {
305
- const { parentSessionId, childSessionId, clientTimeZone } = request;
307
+ const { parentSessionId, childSessionId, clientTimeZone, delivery } = request;
306
308
  validateControlRequest('subagent.prompt', request);
307
309
  const canonicalTimeZone = clientTimeZone === undefined
308
310
  ? undefined
@@ -330,10 +332,10 @@ let SubagentRuntime = (() => {
330
332
  const attachments = this.ctx.get('attachments');
331
333
  if (attachments === undefined)
332
334
  throw new Error('subagent image prompt requires an attachment store');
333
- content = await admitPromptContent(attachments, request.content);
335
+ content = await attachments.admitPromptContent(request.content);
334
336
  }
335
337
  return {
336
- messageId: await this[queueSubagentPrompt](parent, childSessionId, content, source, signal),
338
+ messageId: await this[deliverSubagentPrompt](parent, childSessionId, content, source, signal, delivery),
337
339
  };
338
340
  }
339
341
  catch (error) {
@@ -8,6 +8,7 @@ import type { ContentBlock, MessageId, MessageSource } from '@deepseek-ai/dsh-ll
8
8
  import type { SessionId } from '@deepseek-ai/dsh-session';
9
9
  import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
10
10
  import type SubagentRuntime from './index.ts';
11
+ import type { SubagentDelivery } from './inbox.ts';
11
12
  /** Process-stable identity carried only by the standard adjacent-Agent messaging tool. */
12
13
  export declare const adjacentAgentSendMessageTool: unique symbol;
13
14
  /**
@@ -23,14 +24,14 @@ export declare function markAdjacentAgentSendMessageTool(definition: ToolDefinit
23
24
  */
24
25
  export declare function isAdjacentAgentSendMessageTool(definition: ToolDefinition | undefined): boolean;
25
26
  /**
26
- * Process-stable symbol-keyed Queue delivery shared by the bundled runtime
27
+ * Process-stable symbol-keyed host delivery shared by the bundled runtime
27
28
  * entry and this unbundled internal subpath.
28
29
  * @internal
29
30
  */
30
- export declare const queueSubagentPrompt: unique symbol;
31
- /** Runtime face required by the host-only Queue adapter. */
32
- export interface HostPromptQueue {
33
- [queueSubagentPrompt](parent: Agent, childId: SessionId, content: ContentBlock[], source: MessageSource, signal: AbortSignal): Promise<MessageId>;
31
+ export declare const deliverSubagentPrompt: unique symbol;
32
+ /** Runtime face required by the host-only prompt adapters. */
33
+ export interface HostPromptDeliverer {
34
+ [deliverSubagentPrompt](parent: Agent, childId: SessionId, content: ContentBlock[], source: MessageSource, signal: AbortSignal, delivery: SubagentDelivery): Promise<MessageId>;
34
35
  }
35
36
  /**
36
37
  * Queue one host-protocol message without exposing another Service operation.
@@ -43,4 +44,15 @@ export interface HostPromptQueue {
43
44
  * @returns the accepted message's inbox id.
44
45
  */
45
46
  export declare function queueHostSubagentPrompt(runtime: SubagentRuntime, parent: Agent, childId: SessionId, content: ContentBlock[], source: MessageSource, signal: AbortSignal): Promise<MessageId>;
47
+ /**
48
+ * Steer one host-protocol message without exposing another Service operation.
49
+ * @param runtime - subagent runtime owning continuation residency.
50
+ * @param parent - exact live direct parent authorizing delivery.
51
+ * @param childId - durable direct-child session id.
52
+ * @param content - host-authored content to deliver.
53
+ * @param source - durable host-protocol provenance.
54
+ * @param signal - caller cancellation before inbox acceptance.
55
+ * @returns the accepted message's inbox id.
56
+ */
57
+ export declare function steerHostSubagentPrompt(runtime: SubagentRuntime, parent: Agent, childId: SessionId, content: ContentBlock[], source: MessageSource, signal: AbortSignal): Promise<MessageId>;
46
58
  //# sourceMappingURL=internal.d.ts.map
@@ -24,11 +24,11 @@ export function isAdjacentAgentSendMessageTool(definition) {
24
24
  && definition[adjacentAgentSendMessageTool] === true;
25
25
  }
26
26
  /**
27
- * Process-stable symbol-keyed Queue delivery shared by the bundled runtime
27
+ * Process-stable symbol-keyed host delivery shared by the bundled runtime
28
28
  * entry and this unbundled internal subpath.
29
29
  * @internal
30
30
  */
31
- export const queueSubagentPrompt = Symbol.for('dsh.subagent.queuePrompt');
31
+ export const deliverSubagentPrompt = Symbol.for('dsh.subagent.deliverPrompt');
32
32
  /**
33
33
  * Queue one host-protocol message without exposing another Service operation.
34
34
  * @param runtime - subagent runtime owning continuation residency.
@@ -40,6 +40,19 @@ export const queueSubagentPrompt = Symbol.for('dsh.subagent.queuePrompt');
40
40
  * @returns the accepted message's inbox id.
41
41
  */
42
42
  export function queueHostSubagentPrompt(runtime, parent, childId, content, source, signal) {
43
- return runtime[queueSubagentPrompt](parent, childId, content, source, signal);
43
+ return runtime[deliverSubagentPrompt](parent, childId, content, source, signal, 'queue');
44
+ }
45
+ /**
46
+ * Steer one host-protocol message without exposing another Service operation.
47
+ * @param runtime - subagent runtime owning continuation residency.
48
+ * @param parent - exact live direct parent authorizing delivery.
49
+ * @param childId - durable direct-child session id.
50
+ * @param content - host-authored content to deliver.
51
+ * @param source - durable host-protocol provenance.
52
+ * @param signal - caller cancellation before inbox acceptance.
53
+ * @returns the accepted message's inbox id.
54
+ */
55
+ export function steerHostSubagentPrompt(runtime, parent, childId, content, source, signal) {
56
+ return runtime[deliverSubagentPrompt](parent, childId, content, source, signal, 'steer');
44
57
  }
45
58
  //# sourceMappingURL=internal.js.map
@@ -5,7 +5,7 @@
5
5
  * working-directory resolution (config override, else the delegating parent
6
6
  * session's workspace), the never-reject result settlement, and the standard
7
7
  * run-handle publication. Backends compose these with their own wire drivers;
8
- * the process machinery itself (spawn, env scrub, tree-scoped teardown)
8
+ * the process machinery itself (spawn, env scrub, managed-range teardown)
9
9
  * belongs to the `dsh-subprocess` seam.
10
10
  *
11
11
  * @module @deepseek-ai/dsh-subagent/out-of-process
@@ -5,7 +5,7 @@
5
5
  * working-directory resolution (config override, else the delegating parent
6
6
  * session's workspace), the never-reject result settlement, and the standard
7
7
  * run-handle publication. Backends compose these with their own wire drivers;
8
- * the process machinery itself (spawn, env scrub, tree-scoped teardown)
8
+ * the process machinery itself (spawn, env scrub, managed-range teardown)
9
9
  * belongs to the `dsh-subprocess` seam.
10
10
  *
11
11
  * @module @deepseek-ai/dsh-subagent/out-of-process
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import type { Agent, AgentOptions } from '@deepseek-ai/dsh-agent';
12
12
  import type { Branded } from '@deepseek-ai/dsh-brand';
13
- import type { ContentBlock } from '@deepseek-ai/dsh-llm';
13
+ import type { ContentBlock, MessageId } from '@deepseek-ai/dsh-llm';
14
14
  import type { SessionEvent, SessionId } from '@deepseek-ai/dsh-session';
15
15
  import type { ObjectJsonSchema, ToolRestriction } from '@deepseek-ai/dsh-tools';
16
16
  import type { SubagentDescriptorData } from './descriptor.ts';
@@ -22,6 +22,50 @@ export type SubagentRunId = Branded<'SubagentRunId'>;
22
22
  * @returns the same string, branded.
23
23
  */
24
24
  export declare function SubagentRunId(id: string): SubagentRunId;
25
+ /** What a caller asks for when starting a continuable background child. */
26
+ export interface ContinuableStartSpec {
27
+ /** The `ctx.subagents` provider whose continuable-creation capability establishes the child. */
28
+ readonly provider: string;
29
+ /** The initial delegation's short `description`, persisted as the child's creation label. */
30
+ readonly label: string;
31
+ /**
32
+ * Optional caller-reserved child identity. Omission preserves the manager's
33
+ * UUID allocation; supplying one lets a durable parent record provisioning
34
+ * before child materialization without a second identity handshake.
35
+ */
36
+ readonly childId?: SessionId;
37
+ /**
38
+ * The delegation request. The manager reserves the stable child id, resolves
39
+ * the durable descriptor, and composes the child itself.
40
+ */
41
+ readonly request: Omit<SubagentStartRequest, 'label' | 'signal' | 'outputSchema'>;
42
+ /** Caller cancellation, owning the operation only until inbox acceptance. */
43
+ readonly signal: AbortSignal;
44
+ }
45
+ /** Identities returned once a continuable child accepted its initial prompt. */
46
+ export interface ContinuableStart {
47
+ /** The durable child session id, stable across activations. */
48
+ readonly childId: SessionId;
49
+ /** The accepted initial prompt's inbox message id. */
50
+ readonly messageId: MessageId;
51
+ }
52
+ /**
53
+ * Authority under which one interrupt request is admitted. `user` carries the
54
+ * durable direct-parent address a human client presented; `ancestor` carries
55
+ * the exact live Agent object whose recorded lineage must contain the caller.
56
+ */
57
+ export type SubagentInterruptAuthority = {
58
+ readonly kind: 'user';
59
+ readonly parentSessionId: SessionId;
60
+ } | {
61
+ readonly kind: 'ancestor';
62
+ readonly agent: Agent;
63
+ };
64
+ /** Options for one model-authored message between adjacent Agents. */
65
+ export interface SubagentSendMessageOptions {
66
+ /** Caller cancellation, owning the operation only until inbox acceptance. */
67
+ readonly signal: AbortSignal;
68
+ }
25
69
  /**
26
70
  * Observe-only identifying detail for a published subagent run, carried by
27
71
  * `subagent/start`. One-shot runs and continuable Activation epochs share this
@@ -140,7 +184,7 @@ export interface SubagentStartRequest {
140
184
  /**
141
185
  * Optional per-child persona. Requires {@link SubagentCapabilities.persona};
142
186
  * rejected at start otherwise. In-process backends register it as a scoped
143
- * `deployment:persona` section on the child, SHADOWING the deployment's
187
+ * `deployment:persona-prefix` section on the child, SHADOWING the deployment's
144
188
  * persona for this child alone — same template semantics as the deployment
145
189
  * persona (strict `{{…}}` interpolation against the registered variables).
146
190
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-subagent",
3
3
  "description": "Abstract subagent seam (ctx.subagents): named-provider registry for delegating to child agents",
4
- "version": "0.1.2-alpha.5",
4
+ "version": "0.1.3-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -54,30 +54,30 @@
54
54
  "license": "MIT",
55
55
  "dependencies": {
56
56
  "zod": "^4.4.3",
57
- "@deepseek-ai/dsh-brand": "^0.1.2-alpha.5",
58
- "@deepseek-ai/dsh-util-values": "^0.1.2-alpha.5"
57
+ "@deepseek-ai/dsh-brand": "^0.1.3-alpha.2",
58
+ "@deepseek-ai/dsh-util-values": "^0.1.3-alpha.2"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@deepseek-ai/cordis": "^4.0.2",
62
- "@deepseek-ai/dsh-agent": "^0.1.2-alpha.5",
63
- "@deepseek-ai/dsh-agent-presets": "^0.1.2-alpha.5",
64
- "@deepseek-ai/dsh-attachment": "^0.1.2-alpha.5",
65
- "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.5",
66
- "@deepseek-ai/dsh-jobs": "^0.1.2-alpha.5",
67
- "@deepseek-ai/dsh-llm": "^0.1.2-alpha.5",
68
- "@deepseek-ai/dsh-sandbox": "^0.1.2-alpha.5",
69
- "@deepseek-ai/dsh-sandbox-policy": "^0.1.2-alpha.5",
70
- "@deepseek-ai/dsh-scope": "^0.1.2-alpha.5",
71
- "@deepseek-ai/dsh-session": "^0.1.2-alpha.5",
72
- "@deepseek-ai/dsh-session-persistence": "^0.1.2-alpha.5",
73
- "@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.5",
74
- "@deepseek-ai/dsh-session-projection-cache": "^0.1.2-alpha.5",
75
- "@deepseek-ai/dsh-session-query": "^0.1.2-alpha.5",
76
- "@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.5",
77
- "@deepseek-ai/dsh-tools": "^0.1.2-alpha.5",
78
- "@deepseek-ai/dsh-typert-protocol": "^0.1.2-alpha.5",
79
- "@deepseek-ai/dsh-util-time": "^0.1.2-alpha.5",
80
- "@deepseek-ai/dsh-user-approval": "^0.1.2-alpha.5"
62
+ "@deepseek-ai/dsh-agent": "^0.1.3-alpha.2",
63
+ "@deepseek-ai/dsh-agent-presets": "^0.1.3-alpha.2",
64
+ "@deepseek-ai/dsh-attachment": "^0.1.3-alpha.2",
65
+ "@deepseek-ai/dsh-invariants": "^0.1.3-alpha.2",
66
+ "@deepseek-ai/dsh-jobs": "^0.1.3-alpha.2",
67
+ "@deepseek-ai/dsh-llm": "^0.1.3-alpha.2",
68
+ "@deepseek-ai/dsh-sandbox": "^0.1.3-alpha.2",
69
+ "@deepseek-ai/dsh-sandbox-policy": "^0.1.3-alpha.2",
70
+ "@deepseek-ai/dsh-session": "^0.1.3-alpha.2",
71
+ "@deepseek-ai/dsh-session-persistence": "^0.1.3-alpha.2",
72
+ "@deepseek-ai/dsh-session-projection": "^0.1.3-alpha.2",
73
+ "@deepseek-ai/dsh-session-projection-cache": "^0.1.3-alpha.2",
74
+ "@deepseek-ai/dsh-session-query": "^0.1.3-alpha.2",
75
+ "@deepseek-ai/dsh-system-prompt": "^0.1.3-alpha.2",
76
+ "@deepseek-ai/dsh-typert-protocol": "^0.1.3-alpha.2",
77
+ "@deepseek-ai/dsh-scope": "^0.1.3-alpha.2",
78
+ "@deepseek-ai/dsh-tools": "^0.1.3-alpha.2",
79
+ "@deepseek-ai/dsh-user-approval": "^0.1.3-alpha.2",
80
+ "@deepseek-ai/dsh-util-time": "^0.1.3-alpha.2"
81
81
  },
82
82
  "peerDependenciesMeta": {
83
83
  "@deepseek-ai/dsh-agent-presets": {
@@ -110,27 +110,27 @@
110
110
  },
111
111
  "devDependencies": {
112
112
  "@deepseek-ai/cordis": "^4.0.2",
113
- "@deepseek-ai/dsh-agent": "^0.1.2-alpha.5",
114
- "@deepseek-ai/dsh-agent-presets": "^0.1.2-alpha.5",
115
- "@deepseek-ai/dsh-attachment": "^0.1.2-alpha.5",
116
- "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.5",
117
- "@deepseek-ai/dsh-jobs": "^0.1.2-alpha.5",
118
- "@deepseek-ai/dsh-llm": "^0.1.2-alpha.5",
119
- "@deepseek-ai/dsh-sandbox": "^0.1.2-alpha.5",
120
- "@deepseek-ai/dsh-sandbox-policy": "^0.1.2-alpha.5",
121
- "@deepseek-ai/dsh-scope": "^0.1.2-alpha.5",
122
- "@deepseek-ai/dsh-session": "^0.1.2-alpha.5",
123
- "@deepseek-ai/dsh-session-persistence": "^0.1.2-alpha.5",
124
- "@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.5",
125
- "@deepseek-ai/dsh-session-projection-cache": "^0.1.2-alpha.5",
126
- "@deepseek-ai/dsh-session-query": "^0.1.2-alpha.5",
127
- "@deepseek-ai/dsh-storage-domain": "^0.1.2-alpha.5",
128
- "@deepseek-ai/dsh-storage-json": "^0.1.2-alpha.5",
129
- "@deepseek-ai/dsh-tools": "^0.1.2-alpha.5",
130
- "@deepseek-ai/dsh-typert-protocol": "^0.1.2-alpha.5",
131
- "@deepseek-ai/dsh-storage": "^0.1.2-alpha.5",
132
- "@deepseek-ai/dsh-user-approval": "^0.1.2-alpha.5",
133
- "@deepseek-ai/dsh-util-time": "^0.1.2-alpha.5",
134
- "@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.5"
113
+ "@deepseek-ai/dsh-agent": "^0.1.3-alpha.2",
114
+ "@deepseek-ai/dsh-agent-presets": "^0.1.3-alpha.2",
115
+ "@deepseek-ai/dsh-attachment": "^0.1.3-alpha.2",
116
+ "@deepseek-ai/dsh-invariants": "^0.1.3-alpha.2",
117
+ "@deepseek-ai/dsh-jobs": "^0.1.3-alpha.2",
118
+ "@deepseek-ai/dsh-llm": "^0.1.3-alpha.2",
119
+ "@deepseek-ai/dsh-sandbox-policy": "^0.1.3-alpha.2",
120
+ "@deepseek-ai/dsh-sandbox": "^0.1.3-alpha.2",
121
+ "@deepseek-ai/dsh-scope": "^0.1.3-alpha.2",
122
+ "@deepseek-ai/dsh-session": "^0.1.3-alpha.2",
123
+ "@deepseek-ai/dsh-session-persistence": "^0.1.3-alpha.2",
124
+ "@deepseek-ai/dsh-session-projection": "^0.1.3-alpha.2",
125
+ "@deepseek-ai/dsh-session-query": "^0.1.3-alpha.2",
126
+ "@deepseek-ai/dsh-storage": "^0.1.3-alpha.2",
127
+ "@deepseek-ai/dsh-session-projection-cache": "^0.1.3-alpha.2",
128
+ "@deepseek-ai/dsh-storage-json": "^0.1.3-alpha.2",
129
+ "@deepseek-ai/dsh-system-prompt": "^0.1.3-alpha.2",
130
+ "@deepseek-ai/dsh-tools": "^0.1.3-alpha.2",
131
+ "@deepseek-ai/dsh-typert-protocol": "^0.1.3-alpha.2",
132
+ "@deepseek-ai/dsh-user-approval": "^0.1.3-alpha.2",
133
+ "@deepseek-ai/dsh-storage-domain": "^0.1.3-alpha.2",
134
+ "@deepseek-ai/dsh-util-time": "^0.1.3-alpha.2"
135
135
  }
136
136
  }
@@ -1,21 +0,0 @@
1
- /**
2
- * Seeding of a continuable child's durable descriptor event: the model-hidden
3
- * record of the child's declared composition before its first request, so a
4
- * later cold resume can reconstruct it from its own log.
5
- *
6
- * @module @deepseek-ai/dsh-subagent/descriptor-seed
7
- */
8
- import type { SessionEvent, SessionId } from '@deepseek-ai/dsh-session';
9
- import type { SubagentDescriptorData } from './descriptor.ts';
10
- /**
11
- * Build the child's creation seed: any inherited parent-history prefix followed
12
- * by one model-hidden, between-turn `descriptor` event. Staging through a
13
- * `Session` assigns the sequence number and enforces the same lossless-JSON
14
- * rules the durable log does.
15
- * @param childId - the reserved child session id the staged log belongs to.
16
- * @param seed - the inherited completed-turn prefix, or `undefined` for a fresh child.
17
- * @param descriptor - the snapshotted composition record to persist.
18
- * @returns the complete seed events, contiguous from sequence zero.
19
- */
20
- export declare function seedDescriptorTurn(childId: SessionId, seed: readonly SessionEvent[] | undefined, descriptor: SubagentDescriptorData): readonly SessionEvent[];
21
- //# sourceMappingURL=descriptor-seed.d.ts.map
@@ -1,24 +0,0 @@
1
- /**
2
- * Seeding of a continuable child's durable descriptor event: the model-hidden
3
- * record of the child's declared composition before its first request, so a
4
- * later cold resume can reconstruct it from its own log.
5
- *
6
- * @module @deepseek-ai/dsh-subagent/descriptor-seed
7
- */
8
- import { Session } from '@deepseek-ai/dsh-session';
9
- /**
10
- * Build the child's creation seed: any inherited parent-history prefix followed
11
- * by one model-hidden, between-turn `descriptor` event. Staging through a
12
- * `Session` assigns the sequence number and enforces the same lossless-JSON
13
- * rules the durable log does.
14
- * @param childId - the reserved child session id the staged log belongs to.
15
- * @param seed - the inherited completed-turn prefix, or `undefined` for a fresh child.
16
- * @param descriptor - the snapshotted composition record to persist.
17
- * @returns the complete seed events, contiguous from sequence zero.
18
- */
19
- export function seedDescriptorTurn(childId, seed, descriptor) {
20
- const staged = Session.create(childId, seed);
21
- staged.append('subagent/descriptor', descriptor);
22
- return staged.snapshotEvents();
23
- }
24
- //# sourceMappingURL=descriptor-seed.js.map