@morlay/dsh-subagent 0.0.9 → 0.0.11-alpha.0

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/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { Context, Volatile } from "@deepseek-ai/cordis";
1
+ import { Context, Service, Volatile } from "@deepseek-ai/cordis";
2
2
  import z from "@deepseek-ai/schemastery";
3
3
  import { ContentBlock, HarnessError, MessageId, ReasoningEffortId } from "@deepseek-ai/dsh-llm";
4
4
  import { Agent, AgentOptions, CreateAgentOptions } from "@deepseek-ai/dsh-agent";
5
- import { Session, SessionEvent, SessionId, SessionLogOffset } from "@deepseek-ai/dsh-session";
5
+ import { Session, SessionEvent, SessionId } from "@deepseek-ai/dsh-session";
6
6
  import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
7
7
  import { PromptContentPart } from "@deepseek-ai/dsh-attachment/types";
8
8
  import { Branded } from "@deepseek-ai/dsh-brand";
@@ -10,9 +10,8 @@ import { MessageId as MessageId$1 } from "@deepseek-ai/dsh-llm/brand";
10
10
  import { SessionId as SessionId$1, SessionSeq } from "@deepseek-ai/dsh-session/types";
11
11
  import { ObjectJsonSchema, ToolRestriction } from "@deepseek-ai/dsh-tools";
12
12
  import { Scoped } from "@deepseek-ai/dsh-scope";
13
- import { ChunkedList } from "@deepseek-ai/dsh-chunked-list";
13
+ import "@deepseek-ai/dsh-chunked-list";
14
14
  import { SandboxMode } from "@deepseek-ai/dsh-sandbox";
15
- //#region src/vendor/dsh-subagent/control-types.d.ts
16
15
  /**
17
16
  * Client-minted identity of one browser prompt, persisted on the exact accepted
18
17
  * message. It carries the Session Controller's `session-request-id` brand so a
@@ -20,7 +19,7 @@ import { SandboxMode } from "@deepseek-ai/dsh-sandbox";
20
19
  * vocabulary; that package depends on this one, so the brand is spelled here
21
20
  * rather than imported.
22
21
  */
23
- type SubagentPromptRequestId = Branded<"session-request-id">;
22
+ type SubagentPromptRequestId = Branded<'session-request-id'>;
24
23
  /** Shared child fields for recursive catalog listing. */
25
24
  type SubagentCatalogRow = {
26
25
  /** The durable child session id, stable across Activations. */
@@ -29,20 +28,20 @@ type SubagentCatalogRow = {
29
28
  * Whether recursive catalog listing observed a resident Session. This
30
29
  * does not encode a durable outcome or guarantee continuation delivery.
31
30
  */
32
- readonly activity: "running" | "inactive";
31
+ readonly activity: 'running' | 'inactive';
33
32
  } & ({
34
33
  /** A terminal one-shot child. */
35
- readonly mode: "one-shot";
34
+ readonly mode: 'one-shot';
36
35
  /** Optional durable creation label from the parent catalog. */
37
36
  readonly label?: string;
38
37
  } | {
39
38
  /** An external execution without a local child Session. */
40
- readonly mode: "external";
39
+ readonly mode: 'external';
41
40
  /** Optional durable creation label from the parent catalog. */
42
41
  readonly label?: string;
43
42
  } | {
44
43
  /** A resumable conversation. */
45
- readonly mode: "continuable";
44
+ readonly mode: 'continuable';
46
45
  /** Durable creation label from the parent catalog. */
47
46
  readonly label: string;
48
47
  });
@@ -51,11 +50,11 @@ type SubagentCatalogRow = {
51
50
  * unknown catalog modes or unreadable child catalogs.
52
51
  */
53
52
  type SubagentListEntry = (SubagentCatalogRow & {
54
- readonly kind: "child";
53
+ readonly kind: 'child';
55
54
  /** Whether the child catalog contains a direct child. */
56
55
  readonly hasChildren: boolean;
57
56
  }) | {
58
- readonly kind: "diagnostic";
57
+ readonly kind: 'diagnostic';
59
58
  /** The candidate's session id. */
60
59
  readonly id: SessionId$1;
61
60
  /**
@@ -64,21 +63,21 @@ type SubagentListEntry = (SubagentCatalogRow & {
64
63
  * stops that branch. `unsupported` means the parent catalog records an
65
64
  * unknown child mode; its readable catalog is still traversed.
66
65
  */
67
- readonly reason: "corrupt" | "unsupported" | "unavailable";
66
+ readonly reason: 'corrupt' | 'unsupported' | 'unavailable';
68
67
  };
69
68
  /** Durable parent/child browsing address; unknown mode is resolved when child history is read. */
70
69
  type SubagentAddress = {
71
70
  readonly parentSessionId: SessionId$1;
72
71
  readonly childSessionId: SessionId$1;
73
72
  } & ({
74
- readonly mode: "one-shot";
73
+ readonly mode: 'one-shot';
75
74
  } | {
76
- readonly mode: "continuable";
75
+ readonly mode: 'continuable';
77
76
  } | {
78
- readonly mode: "unknown";
77
+ readonly mode: 'unknown';
79
78
  });
80
79
  /** One Agent inbox destination, as the prompt request selects it. */
81
- type SubagentDelivery = SubagentPromptRequest["delivery"];
80
+ type SubagentDelivery = SubagentPromptRequest['delivery'];
82
81
  /** One human message addressed to a continuable direct child. */
83
82
  interface SubagentPromptRequest {
84
83
  /** Identity persisted on the accepted message, minted before the call. */
@@ -86,9 +85,9 @@ interface SubagentPromptRequest {
86
85
  readonly parentSessionId: SessionId$1;
87
86
  readonly childSessionId: SessionId$1;
88
87
  /** Required discriminator retained from the browser control address. */
89
- readonly mode: "continuable";
88
+ readonly mode: 'continuable';
90
89
  /** Whether this message queues a later turn or targets the nearest step. */
91
- readonly delivery: "queue" | "steer";
90
+ readonly delivery: 'queue' | 'steer';
92
91
  /**
93
92
  * Browser prompt parts delivered as the child's user message. The Host
94
93
  * admits and persists image parts before delivery, so the wire never
@@ -110,44 +109,42 @@ interface SubagentInterruptReceipt {
110
109
  * Failure details the control surface answers with. Prompts and interrupts
111
110
  * share these failures with the Client Remote result.
112
111
  */
113
- declare module "@deepseek-ai/dsh-workspace/types" {
112
+ declare module '@deepseek-ai/dsh-workspace/types' {
114
113
  interface SessionActivityKindMap {
115
114
  /** A subagent session delegated from this session (at any depth) is inside a turn. */
116
115
  subagent: true;
117
116
  }
118
117
  }
119
- declare module "@deepseek-ai/dsh-typert-protocol" {
118
+ declare module '@deepseek-ai/dsh-typert-protocol' {
120
119
  interface RemoteErrorDetailsMap {
121
120
  /** A browser-supplied zone is neither UTC nor a canonical IANA name. */
122
- "subagent/invalid-time-zone": {
121
+ 'subagent/invalid-time-zone': {
123
122
  readonly value: string;
124
123
  };
125
124
  /** No live Agent carries the addressed parent session. */
126
- "subagent/parent-unavailable": {
125
+ 'subagent/parent-unavailable': {
127
126
  readonly parentSessionId: SessionId$1;
128
127
  };
129
128
  /** The addressed child cannot take a continuation. */
130
- "subagent/not-resumable": {
129
+ 'subagent/not-resumable': {
131
130
  readonly childSessionId: SessionId$1;
132
131
  };
133
132
  /** The claimed parent does not own the addressed child. */
134
- "subagent/unauthorized": {
133
+ 'subagent/unauthorized': {
135
134
  readonly childSessionId: SessionId$1;
136
135
  };
137
136
  /** Image admission or model image-capability refusal. */
138
- "subagent/attachment-invalid": {
137
+ 'subagent/attachment-invalid': {
139
138
  readonly reason: string;
140
139
  };
141
140
  /** The child exists but its inbox cannot admit the message now. */
142
- "subagent/delivery-unavailable": {
141
+ 'subagent/delivery-unavailable': {
143
142
  readonly childSessionId: SessionId$1;
144
143
  };
145
144
  }
146
145
  }
147
- //#endregion
148
- //#region src/vendor/dsh-subagent/types.d.ts
149
146
  /** Identifies one accepted subagent run across its lifecycle event pair. */
150
- export type SubagentRunId = Branded<"SubagentRunId">;
147
+ export type SubagentRunId = Branded<'SubagentRunId'>;
151
148
  /**
152
149
  * Brand a string as a {@link SubagentRunId}.
153
150
  * @param id - the raw run id.
@@ -163,11 +160,11 @@ interface SubagentActivationSpec {
163
160
  /** Optional reserved identity for a local child; external backends allocate their own ids. */
164
161
  readonly childId?: SessionId;
165
162
  /** Task, parent, and backend-supported execution options. */
166
- readonly request: Omit<SubagentStartRequest, "label" | "signal">;
163
+ readonly request: Omit<SubagentStartRequest, 'label' | 'signal'>;
167
164
  /** Cancellation before publication; callers own later cancellation through dispose. */
168
165
  readonly signal: AbortSignal;
169
166
  /** Parent delivery notifies the model; caller delivery only returns the result. Local children always enter the parent catalog. */
170
- readonly delivery: "parent" | "caller";
167
+ readonly delivery: 'parent' | 'caller';
171
168
  }
172
169
  /** A managed execution; disposal addresses this exact activation, never a later resume. */
173
170
  interface SubagentActivation {
@@ -189,10 +186,10 @@ interface SubagentActivation {
189
186
  * the exact live Agent object whose recorded lineage must contain the caller.
190
187
  */
191
188
  type SubagentInterruptAuthority = {
192
- readonly kind: "user";
189
+ readonly kind: 'user';
193
190
  readonly parentSessionId: SessionId;
194
191
  } | {
195
- readonly kind: "ancestor";
192
+ readonly kind: 'ancestor';
196
193
  readonly agent: Agent;
197
194
  };
198
195
  /** Options for one model-authored message between adjacent Agents. */
@@ -231,7 +228,7 @@ interface SubagentRunEndInfo {
231
228
  /** Whether this activation owns a local Agent, fixed at publication. */
232
229
  readonly local: boolean;
233
230
  /** The terminal stop reason. */
234
- readonly stopReason: SubagentResult["stopReason"];
231
+ readonly stopReason: SubagentResult['stopReason'];
235
232
  /**
236
233
  * The child's final assistant output, selected by the same rule as
237
234
  * {@link SubagentResult.output}; absent on infrastructure rejection or when
@@ -352,15 +349,15 @@ interface ContinuableCreateSpec {
352
349
  */
353
350
  interface SubagentStopReasonMap {
354
351
  /** The child finished its turn normally. */
355
- completed: "completed";
352
+ completed: 'completed';
356
353
  /** Cancelled through the request signal or disposal. */
357
- aborted: "aborted";
354
+ aborted: 'aborted';
358
355
  /** Model or transport failure. */
359
- error: "error";
356
+ error: 'error';
360
357
  /** The child hit its token ceiling before finishing. */
361
- "max-tokens": "max-tokens";
358
+ 'max-tokens': 'max-tokens';
362
359
  /** The child declined the task. */
363
- refusal: "refusal";
360
+ refusal: 'refusal';
364
361
  }
365
362
  /** The union over {@link SubagentStopReasonMap} — widens automatically as backends merge in variants. */
366
363
  type SubagentStopReason = SubagentStopReasonMap[keyof SubagentStopReasonMap];
@@ -473,23 +470,21 @@ interface SubagentProvider {
473
470
  */
474
471
  prepareContinuable?(request: ContinuableCreateRequest): Promise<ContinuableCreateSpec>;
475
472
  }
476
- //#endregion
477
- //#region src/vendor/dsh-subagent/projection-types.d.ts
478
473
  /** One current direct-child discovery row materialized from parent facts. */
479
474
  type SubagentCatalogEntry = {
480
475
  readonly id: SessionId$1;
481
476
  readonly createdAt: number;
482
477
  } & ({
483
- readonly mode: "one-shot";
478
+ readonly mode: 'one-shot';
484
479
  readonly label?: string;
485
480
  } | {
486
- readonly mode: "external";
481
+ readonly mode: 'external';
487
482
  readonly label?: string;
488
483
  } | {
489
- readonly mode: "continuable";
484
+ readonly mode: 'continuable';
490
485
  readonly label: string;
491
486
  } | {
492
- readonly mode: "unknown";
487
+ readonly mode: 'unknown';
493
488
  readonly label?: string;
494
489
  });
495
490
  /** Durable active-turn timing for one descriptor-backed child session. */
@@ -517,7 +512,7 @@ interface SubagentTimingProjection {
517
512
  */
518
513
  type SubagentIdentityProjection = {
519
514
  /** A terminal one-shot child. */
520
- mode: "one-shot";
515
+ mode: 'one-shot';
521
516
  /** Optional durable creation label from the child's descriptor. */
522
517
  label?: string;
523
518
  /**
@@ -529,13 +524,13 @@ type SubagentIdentityProjection = {
529
524
  seq: SessionSeq;
530
525
  } | {
531
526
  /** A resumable conversation. */
532
- mode: "continuable";
527
+ mode: 'continuable';
533
528
  /** Durable creation label from the child's descriptor. */
534
529
  label: string;
535
530
  /** Seq of the folded descriptor event; see the one-shot arm for the own-suffix proof. */
536
531
  seq: SessionSeq;
537
532
  };
538
- declare module "@deepseek-ai/dsh-session-projection/types" {
533
+ declare module '@deepseek-ai/dsh-session-projection/types' {
539
534
  interface SessionProjectionMap {
540
535
  /** Direct children in parent catalog event order, excluding fork-inherited facts. */
541
536
  subagentCatalog: SubagentCatalogEntry[];
@@ -553,8 +548,6 @@ declare module "@deepseek-ai/dsh-session-projection/types" {
553
548
  subagent: SubagentIdentityProjection | null;
554
549
  }
555
550
  }
556
- //#endregion
557
- //#region src/vendor/dsh-subagent/list-children.d.ts
558
551
  /** One catalog descendant with its direct parent and edge distance from the requested root. */
559
552
  type SubagentDescendantListEntry = SubagentListEntry & {
560
553
  /** Parent whose catalog contains this child. */
@@ -562,13 +555,11 @@ type SubagentDescendantListEntry = SubagentListEntry & {
562
555
  /** Edge distance from the requested root; direct children are `1`. */
563
556
  readonly depth: number;
564
557
  };
565
- //#endregion
566
- //#region src/vendor/dsh-subagent/catalog.d.ts
567
558
  type KnownCatalogMode = {
568
- readonly mode: "one-shot";
559
+ readonly mode: 'one-shot';
569
560
  readonly label?: string;
570
561
  } | {
571
- readonly mode: "continuable";
562
+ readonly mode: 'continuable';
572
563
  readonly label: string;
573
564
  };
574
565
  /** Parent catalog v0 records local modes, v1 adds unknown children, and v2 records external executions. */
@@ -580,34 +571,22 @@ type SubagentCatalogEvent = {
580
571
  } & KnownCatalogMode) | ({
581
572
  readonly version: 1;
582
573
  } & (KnownCatalogMode | {
583
- readonly mode: "unknown";
574
+ readonly mode: 'unknown';
584
575
  readonly label?: string;
585
576
  })) | {
586
577
  readonly version: 2;
587
- readonly mode: "external";
578
+ readonly mode: 'external';
588
579
  readonly label?: string;
589
580
  });
590
- declare module "@deepseek-ai/dsh-session/types" {
581
+ declare module '@deepseek-ai/dsh-session/types' {
591
582
  interface SessionEventMap {
592
583
  /**
593
584
  * A direct child's identity and available discovery fields.
594
585
  * @param data - versioned parent-owned catalog entry.
595
586
  */
596
- "subagent/catalog": SubagentCatalogEvent;
587
+ 'subagent/catalog': SubagentCatalogEvent;
597
588
  }
598
589
  }
599
- /** Host fold state for one parent catalog. */
600
- interface SubagentCatalogState {
601
- readonly inheritedEventCount: SessionLogOffset;
602
- readonly head?: ChunkedList<SubagentCatalogEvent> | undefined;
603
- }
604
- declare module "@deepseek-ai/dsh-session-projection/types" {
605
- interface SessionProjectionStateMap {
606
- subagentCatalog: SubagentCatalogState;
607
- }
608
- }
609
- //#endregion
610
- //#region src/vendor/dsh-subagent/out-of-process.d.ts
611
590
  /**
612
591
  * The capability advertisement of an out-of-process backend: NONE. A child in
613
592
  * another process cannot honor parent-enforced start features
@@ -665,7 +644,7 @@ export declare function settleRunResult(parts: RunResultSettlement): Promise<Sub
665
644
  /** Inputs to {@link subprocessRunHandle}. */
666
645
  export interface SubprocessRunHandleParts {
667
646
  /** The parent-scoped run id. */
668
- id: SubagentRun["id"];
647
+ id: SubagentRun['id'];
669
648
  /** The flattened, never-rejecting result (the seam contract). */
670
649
  result: Promise<SubagentResult>;
671
650
  /** The request's cancellation signal (the listener is removed on dispose). */
@@ -686,8 +665,6 @@ export interface SubprocessRunHandleParts {
686
665
  * @returns the external run handle.
687
666
  */
688
667
  export declare function subprocessRunHandle(parts: SubprocessRunHandleParts): SubagentRun;
689
- //#endregion
690
- //#region src/vendor/dsh-subagent/assistant-output.d.ts
691
668
  /**
692
669
  * Incremental fold of the selection rule, for backends that observe a child's
693
670
  * output as it streams: session-event backends {@link push} each event, and
@@ -722,9 +699,7 @@ export declare class AssistantOutputFold {
722
699
  * @returns the selected output, or `undefined` when the child produced none.
723
700
  */
724
701
  export declare function finalAssistantOutput(events: readonly SessionEvent[]): readonly ContentBlock[] | undefined;
725
- //#endregion
726
- //#region src/vendor/dsh-subagent/descriptor.d.ts
727
- declare module "@deepseek-ai/dsh-session/types" {
702
+ declare module '@deepseek-ai/dsh-session/types' {
728
703
  interface SessionEventMap {
729
704
  /**
730
705
  * Durable identity and lifecycle mode of a session-backed subagent child,
@@ -733,7 +708,7 @@ declare module "@deepseek-ai/dsh-session/types" {
733
708
  * resumable composition. Log-only: it carries no `surfaceOp`, never enters
734
709
  * model history, and survives compaction.
735
710
  */
736
- "subagent/descriptor": SubagentDescriptorData;
711
+ 'subagent/descriptor': SubagentDescriptorData;
737
712
  }
738
713
  }
739
714
  /**
@@ -748,13 +723,13 @@ interface SubagentDescriptorBase {
748
723
  /** Descriptor format version ({@link SUBAGENT_DESCRIPTOR_VERSION}). */
749
724
  readonly version: number;
750
725
  /** Whether the child is a terminal one-shot run or a resumable conversation. */
751
- readonly mode: "one-shot" | "continuable";
726
+ readonly mode: 'one-shot' | 'continuable';
752
727
  /** The `ctx.subagents` provider name that established the child. */
753
728
  readonly provider: string;
754
729
  }
755
730
  /** A session-backed subagent that cannot be cold-resumed after its run. */
756
731
  interface OneShotSubagentDescriptorData extends SubagentDescriptorBase {
757
- readonly mode: "one-shot";
732
+ readonly mode: 'one-shot';
758
733
  /**
759
734
  * The initial delegation's short `description`, kept as the child's durable
760
735
  * creation label so enumeration can identify the conversation without
@@ -764,7 +739,7 @@ interface OneShotSubagentDescriptorData extends SubagentDescriptorBase {
764
739
  }
765
740
  /** A session-backed subagent whose declared composition supports cold resume. */
766
741
  interface ContinuableSubagentDescriptorData extends SubagentDescriptorBase {
767
- readonly mode: "continuable";
742
+ readonly mode: 'continuable';
768
743
  /** The initial delegation's short `description`, used for durable enumeration. */
769
744
  readonly label: string;
770
745
  /** Resolved child `agentOptions.provider`, when one was declared. */
@@ -781,7 +756,7 @@ interface ContinuableSubagentDescriptorData extends SubagentDescriptorBase {
781
756
  /** The supported durable subagent identity and optional continuation composition. */
782
757
  type SubagentDescriptorData = OneShotSubagentDescriptorData | ContinuableSubagentDescriptorData;
783
758
  /** Continuable composition fields before the snapshot stamps their format version. */
784
- type ContinuableSubagentDescriptorInput = Omit<ContinuableSubagentDescriptorData, "version">;
759
+ type ContinuableSubagentDescriptorInput = Omit<ContinuableSubagentDescriptorData, 'version'>;
785
760
  /**
786
761
  * Validate and detach a continuable descriptor input.
787
762
  * @param input - the caller-collected continuable composition fields.
@@ -802,19 +777,13 @@ export declare function snapshotSubagentDescriptor(input: ContinuableSubagentDes
802
777
  * declared schema.
803
778
  */
804
779
  export declare function foldSubagentDescriptor(events: readonly SessionEvent[]): SubagentDescriptorData | undefined;
805
- //#endregion
806
- //#region src/vendor/dsh-subagent/structured.d.ts
807
780
  /** The model-facing tool name a structured child must call to finish. */
808
781
  export declare const STRUCTURED_OUTPUT_TOOL = "structured_output";
809
- //#endregion
810
- //#region src/vendor/dsh-subagent/error.d.ts
811
782
  /** Typed failure for the subagent seam. */
812
783
  export declare class SubagentError extends HarnessError {
813
784
  constructor(message: string, code: string, options?: ErrorOptions);
814
785
  }
815
- //#endregion
816
- //#region src/vendor/dsh-subagent/depth.d.ts
817
- declare module "@deepseek-ai/dsh-agent" {
786
+ declare module '@deepseek-ai/dsh-agent' {
818
787
  interface AgentOptions {
819
788
  /** Delegation depth: zero for a top-level agent and parent depth + 1 for a child. */
820
789
  subagentDepth?: number;
@@ -836,8 +805,6 @@ export declare function delegationDepthOf(agent: Agent): number;
836
805
  * @param maxDepth - the optional runtime value to validate.
837
806
  */
838
807
  export declare function assertSubagentMaxDepth(maxDepth: unknown): void;
839
- //#endregion
840
- //#region src/vendor/dsh-subagent/child-agent.d.ts
841
808
  /** Thrown when starting a child would exceed the requested depth cap. */
842
809
  export declare class SubagentDepthError extends Error {
843
810
  readonly attemptedDepth: number;
@@ -890,7 +857,7 @@ export declare function resolveChildAgentOptions(parent: Agent, requested: Agent
890
857
  * @param selectedPreset - independent selection, or omission to inherit the parent.
891
858
  * @returns the `meta` for `ctx.agents.create()`.
892
859
  */
893
- export declare function childSessionMeta(parent: Agent, childDepth: number, isSeeded: boolean, selectedPreset?: string): NonNullable<CreateAgentOptions["meta"]>;
860
+ export declare function childSessionMeta(parent: Agent, childDepth: number, isSeeded: boolean, selectedPreset?: string): NonNullable<CreateAgentOptions['meta']>;
894
861
  /** The scoped composition a child agent's creation window applies. */
895
862
  interface ChildComposition {
896
863
  /** Independently mounted preset; omission shares the parent's standing generation. */
@@ -916,7 +883,7 @@ interface DelegatedPolicyOverrides {
916
883
  * The parent's current preset identity when it runs in Auto or Full access;
917
884
  * the child keeps it under the pinned `never` approval policy.
918
885
  */
919
- readonly permissionPreset: "auto" | "danger-full-access" | undefined;
886
+ readonly permissionPreset: 'auto' | 'danger-full-access' | undefined;
920
887
  /** The parent session's explicit sandbox-mode override, or `undefined` without one. */
921
888
  readonly sandboxMode: SandboxMode | undefined;
922
889
  /**
@@ -924,7 +891,7 @@ interface DelegatedPolicyOverrides {
924
891
  * otherwise: a delegated child acts only within the sandbox scope fixed at
925
892
  * delegation, so its asks are rejected deterministically.
926
893
  */
927
- readonly approvalPolicy: "never" | undefined;
894
+ readonly approvalPolicy: 'never' | undefined;
928
895
  }
929
896
  /**
930
897
  * Capture the permission state to seed into one delegation. Call synchronously before
@@ -940,21 +907,19 @@ interface DelegatedPolicyOverrides {
940
907
  export declare function captureDelegatedPolicyOverrides(parent: Agent): DelegatedPolicyOverrides;
941
908
  /**
942
909
  * Append the captured delegation policy onto the child's own log as
943
- * `source: 'delegation'` events inside the unpublished creation window, so the
910
+ * `source: 'delegation'` events after Session announcement and before Agent registration, so the
944
911
  * child's effective policy is reconstructable from its log alone. Appends land
945
912
  * after any fork seed, so fresh policy wins stale seed state; later child
946
913
  * switches still win over these events.
947
- * @param childSession - the unpublished child's session.
914
+ * @param childSession - the child's announced, writable Session.
948
915
  * @param overrides - the policy captured at delegation.
949
916
  */
950
917
  export declare function appendDelegatedPolicyOverrides(childSession: Session, overrides: DelegatedPolicyOverrides): void;
951
- //#endregion
952
- //#region src/vendor/dsh-subagent/continuation-messages.d.ts
953
918
  /** Durable attribution for one model-authored message between Agents. */
954
919
  interface AgentMessageSource$1 {
955
- readonly kind: "agent-message";
920
+ readonly kind: 'agent-message';
956
921
  /** A message another agent addressed to this one (`relay` context form). */
957
- readonly form: "relay";
922
+ readonly form: 'relay';
958
923
  /** Session id of the Agent whose tool call produced the message. */
959
924
  readonly senderSessionId: SessionId;
960
925
  }
@@ -966,23 +931,21 @@ interface AgentMessageSource$1 {
966
931
  * transcript that merged them would credit the child with words it never wrote.
967
932
  */
968
933
  interface SubagentSettledMessageSource$1 {
969
- readonly kind: "subagent-settled";
934
+ readonly kind: 'subagent-settled';
970
935
  /** A runtime account shown without expanding the row (`notice` context form). */
971
- readonly form: "notice";
936
+ readonly form: 'notice';
972
937
  /** One-line account of how the child ended. */
973
938
  readonly summary: string;
974
939
  /** Session id of the child that settled. */
975
940
  readonly senderSessionId: SessionId;
976
941
  }
977
- declare module "@deepseek-ai/dsh-llm" {
942
+ declare module '@deepseek-ai/dsh-llm' {
978
943
  interface MessageSourceMap {
979
- "agent-message": AgentMessageSource$1;
980
- "subagent-settled": SubagentSettledMessageSource$1;
944
+ 'agent-message': AgentMessageSource$1;
945
+ 'subagent-settled': SubagentSettledMessageSource$1;
981
946
  }
982
947
  }
983
- //#endregion
984
- //#region src/vendor/dsh-subagent/index.d.ts
985
- declare module "@deepseek-ai/cordis" {
948
+ declare module '@deepseek-ai/cordis' {
986
949
  interface Context {
987
950
  subagents: SubagentRuntime$1;
988
951
  }
@@ -992,13 +955,13 @@ declare module "@deepseek-ai/cordis" {
992
955
  * @param provider - the registered provider.
993
956
  * @mode emit
994
957
  */
995
- "subagent/provider-added"(provider: SubagentProvider): void;
958
+ 'subagent/provider-added'(provider: SubagentProvider): void;
996
959
  /**
997
960
  * A provider left the registry. Accepted runs remain holder-owned.
998
961
  * @param name - the provider name that no longer resolves.
999
962
  * @mode emit
1000
963
  */
1001
- "subagent/provider-removed"(name: string): void;
964
+ 'subagent/provider-removed'(name: string): void;
1002
965
  /**
1003
966
  * A provider established a published child. For in-process providers,
1004
967
  * `ctx.agents.get(info.id)` resolves during this notification.
@@ -1008,7 +971,7 @@ declare module "@deepseek-ai/cordis" {
1008
971
  * @param info - the provider and published child identity.
1009
972
  * @mode emit
1010
973
  */
1011
- "subagent/start"(this: Scoped<SubagentRuntime$1>, info: SubagentRunInfo): void;
974
+ 'subagent/start'(this: Scoped<SubagentRuntime$1>, info: SubagentRunInfo): void;
1012
975
  /**
1013
976
  * A published child settled. Scope-filtered dispatch uses the same delegating
1014
977
  * parent carrier as `subagent/start`, so the lifecycle pair reaches the
@@ -1016,7 +979,7 @@ declare module "@deepseek-ai/cordis" {
1016
979
  * @param info - the run identity and terminal outcome.
1017
980
  * @mode emit
1018
981
  */
1019
- "subagent/end"(this: Scoped<SubagentRuntime$1>, info: SubagentRunEndInfo): void;
982
+ 'subagent/end'(this: Scoped<SubagentRuntime$1>, info: SubagentRunEndInfo): void;
1020
983
  }
1021
984
  }
1022
985
  /** Host configuration for continuable subagent capacity. */
@@ -1046,12 +1009,13 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
1046
1009
  */
1047
1010
  private readonly emitLifecycle;
1048
1011
  constructor(ctx: Context, config: Config$1);
1012
+ protected [Service.init](): Promise<void>;
1049
1013
  /**
1050
1014
  * Resolve a delegation tool's depth policy against the current user setting.
1051
1015
  * @param configured - Explicit tool limit, or provider-managed for external delegation.
1052
1016
  * @returns The numeric limit, or undefined when the provider owns depth enforcement.
1053
1017
  */
1054
- resolveMaxDepth(configured?: number | "provider-managed"): number | undefined;
1018
+ resolveMaxDepth(configured?: number | 'provider-managed'): number | undefined;
1055
1019
  /**
1056
1020
  * Start a local child under its reserved identity.
1057
1021
  * @param spec - local task, reserved child id, and result recipient.
@@ -1201,7 +1165,7 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
1201
1165
  * `subagent/unauthorized` when the address does not own the live target,
1202
1166
  * otherwise `gateway/internal`.
1203
1167
  */
1204
- interruptByParent(childSessionId: SessionId, parentSessionId: SessionId, mode: "continuable"): SubagentInterruptReceipt;
1168
+ interruptByParent(childSessionId: SessionId, parentSessionId: SessionId, mode: 'continuable'): SubagentInterruptReceipt;
1205
1169
  /**
1206
1170
  * Register a provider under its name. Registration is effect-scoped and HMR
1207
1171
  * safe; removing a provider blocks new starts but does not revoke runs that
@@ -1240,21 +1204,17 @@ declare class SubagentRuntime$1 extends TypertRemoteService {
1240
1204
  /** Reject the first requested capability that the provider lacks. */
1241
1205
  private assertCapabilities;
1242
1206
  }
1243
- //#endregion
1244
- //#region src/vendor/dsh-subagent/internal.d.ts
1245
1207
  /**
1246
1208
  * Process-stable symbol-keyed host delivery shared by the bundled runtime
1247
1209
  * entry and this unbundled internal subpath.
1248
1210
  * @internal
1249
1211
  */
1250
1212
  declare const deliverSubagentPrompt: unique symbol;
1251
- //#endregion
1252
- //#region src/continuation-messages.d.ts
1253
1213
  /** Durable attribution for one model-authored message between Agents. */
1254
1214
  interface AgentMessageSource {
1255
- readonly kind: 'agent-message';
1215
+ readonly kind: "agent-message";
1256
1216
  /** A message another agent addressed to this one (`relay` context form). */
1257
- readonly form: 'relay';
1217
+ readonly form: "relay";
1258
1218
  /** Session id of the Agent whose tool call produced the message. */
1259
1219
  readonly senderSessionId: SessionId;
1260
1220
  }
@@ -1266,22 +1226,20 @@ interface AgentMessageSource {
1266
1226
  * transcript that merged them would credit the child with words it never wrote.
1267
1227
  */
1268
1228
  interface SubagentSettledMessageSource {
1269
- readonly kind: 'subagent-settled';
1229
+ readonly kind: "subagent-settled";
1270
1230
  /** A runtime account shown without expanding the row (`notice` context form). */
1271
- readonly form: 'notice';
1231
+ readonly form: "notice";
1272
1232
  /** One-line account of how the child ended. */
1273
1233
  readonly summary: string;
1274
1234
  /** Session id of the child that settled. */
1275
1235
  readonly senderSessionId: SessionId;
1276
1236
  }
1277
- declare module '@deepseek-ai/dsh-llm' {
1237
+ declare module "@deepseek-ai/dsh-llm" {
1278
1238
  interface MessageSourceMap {
1279
- 'agent-message': AgentMessageSource;
1280
- 'subagent-settled': SubagentSettledMessageSource;
1239
+ "agent-message": AgentMessageSource;
1240
+ "subagent-settled": SubagentSettledMessageSource;
1281
1241
  }
1282
1242
  }
1283
- //#endregion
1284
- //#region src/index.d.ts
1285
1243
  /** Host configuration for continuable subagent capacity. */
1286
1244
  export interface Config {
1287
1245
  /** Maximum live children sharing uninterrupted continuable parent links; defaults to 8. */
@@ -1323,7 +1281,7 @@ export declare class SubagentRuntime extends TypertRemoteService {
1323
1281
  * @param configured - Explicit tool limit, or provider-managed for external delegation.
1324
1282
  * @returns The numeric limit, or undefined when the provider owns depth enforcement.
1325
1283
  */
1326
- resolveMaxDepth(configured?: number | 'provider-managed'): number | undefined;
1284
+ resolveMaxDepth(configured?: number | "provider-managed"): number | undefined;
1327
1285
  /**
1328
1286
  * Start a local child under its reserved identity.
1329
1287
  * @param spec - local task, reserved child id, and result recipient.
@@ -1473,7 +1431,7 @@ export declare class SubagentRuntime extends TypertRemoteService {
1473
1431
  * `subagent/unauthorized` when the address does not own the live target,
1474
1432
  * otherwise `gateway/internal`.
1475
1433
  */
1476
- interruptByParent(childSessionId: SessionId, parentSessionId: SessionId, mode: 'continuable'): SubagentInterruptReceipt;
1434
+ interruptByParent(childSessionId: SessionId, parentSessionId: SessionId, mode: "continuable"): SubagentInterruptReceipt;
1477
1435
  /**
1478
1436
  * Register a provider under its name. Registration is effect-scoped and HMR
1479
1437
  * safe; removing a provider blocks new starts but does not revoke runs that
@@ -1512,5 +1470,4 @@ export declare class SubagentRuntime extends TypertRemoteService {
1512
1470
  /** Reject the first requested capability that the provider lacks. */
1513
1471
  private assertCapabilities;
1514
1472
  }
1515
- //#endregion
1516
1473
  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 };