@deepseek-ai/dsh-subagent 0.1.1-rc.2 → 0.1.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +105 -75
- package/README.zh.md +110 -84
- package/lib/index.js +934 -434
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +925 -0
- package/lib/typert.remote-client.d.ts +27 -0
- package/lib/typert.remote-client.js +159 -0
- package/lib/types/child-agent.d.ts +14 -3
- package/lib/types/child-agent.js +48 -10
- package/lib/types/client.d.ts +2 -1
- package/lib/types/client.js +1 -1
- package/lib/types/continuation.d.ts +17 -2
- package/lib/types/continuation.js +174 -48
- package/lib/types/control-types.d.ts +144 -0
- package/lib/types/control-types.js +9 -0
- package/lib/types/control.d.ts +67 -0
- package/lib/types/control.js +115 -0
- package/lib/types/descriptor.d.ts +6 -1
- package/lib/types/descriptor.js +6 -2
- package/lib/types/index.d.ts +62 -26
- package/lib/types/index.js +444 -299
- package/lib/types/list-children.d.ts +10 -58
- package/lib/types/list-children.js +161 -97
- package/lib/types/out-of-process.d.ts +3 -2
- package/lib/types/out-of-process.js +11 -3
- package/lib/types/run-settlement.js +7 -3
- package/lib/types/types.d.ts +18 -0
- package/package.json +63 -37
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* @module @deepseek-ai/dsh-subagent/descriptor
|
|
22
22
|
*/
|
|
23
23
|
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
24
|
+
import type { ReasoningEffortId } from '@deepseek-ai/dsh-llm';
|
|
24
25
|
import type { ToolRestriction } from '@deepseek-ai/dsh-tools';
|
|
25
26
|
declare module '@deepseek-ai/dsh-session/types' {
|
|
26
27
|
interface SessionEventMap {
|
|
@@ -40,7 +41,7 @@ declare module '@deepseek-ai/dsh-session/types' {
|
|
|
40
41
|
* Supporting another composition input is a deliberate version change, never
|
|
41
42
|
* an implicit extra field.
|
|
42
43
|
*/
|
|
43
|
-
export declare const SUBAGENT_DESCRIPTOR_VERSION =
|
|
44
|
+
export declare const SUBAGENT_DESCRIPTOR_VERSION = 3;
|
|
44
45
|
/** Fields shared by every supported `subagent/descriptor` payload. */
|
|
45
46
|
interface SubagentDescriptorBase {
|
|
46
47
|
/** Descriptor format version ({@link SUBAGENT_DESCRIPTOR_VERSION}). */
|
|
@@ -69,6 +70,8 @@ export interface ContinuableSubagentDescriptorData extends SubagentDescriptorBas
|
|
|
69
70
|
readonly agentProvider?: string;
|
|
70
71
|
/** Resolved child `agentOptions.model`, when one was declared. */
|
|
71
72
|
readonly agentModel?: string;
|
|
73
|
+
/** Resolved child `agentOptions.reasoningEffort`, when one was declared. */
|
|
74
|
+
readonly agentReasoningEffort?: ReasoningEffortId;
|
|
72
75
|
/** Per-child persona that shadows the deployment persona on resume. */
|
|
73
76
|
readonly persona?: string;
|
|
74
77
|
/** Child tool scoping reapplied on resume. */
|
|
@@ -98,6 +101,8 @@ export interface ContinuableSubagentDescriptorInput extends SubagentDescriptorIn
|
|
|
98
101
|
readonly agentProvider?: string;
|
|
99
102
|
/** Requested child `agentOptions.model`. */
|
|
100
103
|
readonly agentModel?: string;
|
|
104
|
+
/** Requested child `agentOptions.reasoningEffort`. */
|
|
105
|
+
readonly agentReasoningEffort?: ReasoningEffortId;
|
|
101
106
|
/** Requested per-child persona. */
|
|
102
107
|
readonly persona?: string;
|
|
103
108
|
/** Requested child tool scoping. */
|
package/lib/types/descriptor.js
CHANGED
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
*
|
|
21
21
|
* @module @deepseek-ai/dsh-subagent/descriptor
|
|
22
22
|
*/
|
|
23
|
-
import { snapshotJsonValue } from '@deepseek-ai/dsh-
|
|
23
|
+
import { snapshotJsonValue } from '@deepseek-ai/dsh-util-values';
|
|
24
24
|
/**
|
|
25
25
|
* The current descriptor format version, stamped into every appended
|
|
26
26
|
* `subagent/descriptor` event and required verbatim by {@link foldSubagentDescriptor}.
|
|
27
27
|
* Supporting another composition input is a deliberate version change, never
|
|
28
28
|
* an implicit extra field.
|
|
29
29
|
*/
|
|
30
|
-
export const SUBAGENT_DESCRIPTOR_VERSION =
|
|
30
|
+
export const SUBAGENT_DESCRIPTOR_VERSION = 3;
|
|
31
31
|
const DESCRIPTOR_BASE_KEYS = [
|
|
32
32
|
'version',
|
|
33
33
|
'mode',
|
|
@@ -39,6 +39,7 @@ const CONTINUABLE_DESCRIPTOR_KEYS = new Set([
|
|
|
39
39
|
...DESCRIPTOR_BASE_KEYS,
|
|
40
40
|
'agentProvider',
|
|
41
41
|
'agentModel',
|
|
42
|
+
'agentReasoningEffort',
|
|
42
43
|
'persona',
|
|
43
44
|
'toolFilter',
|
|
44
45
|
]);
|
|
@@ -129,6 +130,7 @@ function parseSubagentDescriptor(value) {
|
|
|
129
130
|
}
|
|
130
131
|
const agentProvider = optionalString(value, 'agentProvider');
|
|
131
132
|
const agentModel = optionalString(value, 'agentModel');
|
|
133
|
+
const agentReasoningEffort = optionalString(value, 'agentReasoningEffort');
|
|
132
134
|
const persona = optionalString(value, 'persona');
|
|
133
135
|
const toolFilter = Object.hasOwn(value, 'toolFilter')
|
|
134
136
|
? parseToolFilter(value['toolFilter'])
|
|
@@ -140,6 +142,7 @@ function parseSubagentDescriptor(value) {
|
|
|
140
142
|
label,
|
|
141
143
|
...agentProvider !== undefined ? { agentProvider } : {},
|
|
142
144
|
...agentModel !== undefined ? { agentModel } : {},
|
|
145
|
+
...agentReasoningEffort !== undefined ? { agentReasoningEffort } : {},
|
|
143
146
|
...persona !== undefined ? { persona } : {},
|
|
144
147
|
...toolFilter !== undefined ? { toolFilter } : {},
|
|
145
148
|
};
|
|
@@ -159,6 +162,7 @@ export function snapshotSubagentDescriptor(input) {
|
|
|
159
162
|
label: input.label,
|
|
160
163
|
...input.agentProvider !== undefined ? { agentProvider: input.agentProvider } : {},
|
|
161
164
|
...input.agentModel !== undefined ? { agentModel: input.agentModel } : {},
|
|
165
|
+
...input.agentReasoningEffort !== undefined ? { agentReasoningEffort: input.agentReasoningEffort } : {},
|
|
162
166
|
...input.persona !== undefined ? { persona: input.persona } : {},
|
|
163
167
|
...input.toolFilter !== undefined ? { toolFilter: input.toolFilter } : {},
|
|
164
168
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
* child before returning its run, so fulfillment is the single publication and
|
|
5
5
|
* ownership-transfer boundary.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* one by name. The shape mirrors the LLM adapter registry
|
|
10
|
-
* (`LlmRuntime.registerAdapter`), not the single-service bash executor.
|
|
7
|
+
* Multiple providers coexist: each registers under a unique name and callers
|
|
8
|
+
* select one by name.
|
|
11
9
|
*
|
|
12
10
|
* This package owns the Service Definition role of the capability seam. Service Providers
|
|
13
11
|
* (`@deepseek-ai/dsh-subagent-spawn-in-process`, `-fork`, `-acp`) and the model-facing
|
|
@@ -30,11 +28,13 @@
|
|
|
30
28
|
*
|
|
31
29
|
* @module @deepseek-ai/dsh-subagent
|
|
32
30
|
*/
|
|
33
|
-
import { Context
|
|
31
|
+
import { Context } from '@deepseek-ai/cordis';
|
|
34
32
|
import type { Scoped } from '@deepseek-ai/dsh-scope';
|
|
35
33
|
import type { ContentBlock, MessageId } from '@deepseek-ai/dsh-llm';
|
|
36
34
|
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
37
35
|
import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
36
|
+
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
37
|
+
import type { SubagentCatalog, SubagentInterruptReceipt, SubagentPromptReceipt, SubagentPromptRequest } from './control-types.ts';
|
|
38
38
|
import type { SubagentProvider, SubagentRun, SubagentRunEndInfo, SubagentRunInfo, SubagentStartRequest } from './types.ts';
|
|
39
39
|
import type { ContinuableStart, ContinuableStartSpec, SubagentFollowupOptions, SubagentInterruptAuthority, SubagentReportOptions } from './continuation.ts';
|
|
40
40
|
import type { ContinuableSetupContribution } from './activation-setup-registry.ts';
|
|
@@ -49,11 +49,12 @@ export { seedDescriptorTurn } from './descriptor-seed.ts';
|
|
|
49
49
|
export { SubagentError } from './error.ts';
|
|
50
50
|
export { settleRun } from './run-settlement.ts';
|
|
51
51
|
export { assertSubagentMaxDepth, delegationDepthOf } from './depth.ts';
|
|
52
|
-
export { appendDelegatedPolicyOverrides, applyChildComposition, captureDelegatedPolicyOverrides, childSessionMeta, resolveChildAgentOptions, resolveChildDepth, SubagentDepthError, } from './child-agent.ts';
|
|
52
|
+
export { appendDelegatedPolicyOverrides, applyChildComposition, captureDelegatedPolicyOverrides, childSessionMeta, parentAgentOptionsForDelegation, resolveChildAgentOptions, resolveChildDepth, SubagentDepthError, } from './child-agent.ts';
|
|
53
53
|
export type { ChildComposition, DelegatedPolicyOverrides } from './child-agent.ts';
|
|
54
54
|
export type { ContinuableStart, ContinuableStartSpec, CoordinatorMessageSource, SubagentFollowupOptions, SubagentInterruptAuthority, SubagentReportDelivery, SubagentReportMessageSource, SubagentReportOptions, SubagentSettledMessageSource, } from './continuation.ts';
|
|
55
55
|
export type { ContinuableSetupContribution } from './activation-setup-registry.ts';
|
|
56
|
-
export type
|
|
56
|
+
export type * from './control-types.ts';
|
|
57
|
+
export type { SubagentDescendantListEntry } from './list-children.ts';
|
|
57
58
|
export type { SubagentRunEndInfo, SubagentRunInfo } from './types.ts';
|
|
58
59
|
export type { SubagentIdentityProjection, SubagentTimingProjection } from './projection-types.ts';
|
|
59
60
|
declare module '@deepseek-ai/cordis' {
|
|
@@ -96,7 +97,7 @@ declare module '@deepseek-ai/cordis' {
|
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
/** Named provider registry with one-shot runs, durable discovery, and continuable-child operations. */
|
|
99
|
-
export declare class SubagentRuntime extends
|
|
100
|
+
export declare class SubagentRuntime extends TypertRemoteService {
|
|
100
101
|
private providers;
|
|
101
102
|
private continuations;
|
|
102
103
|
/** Deployment contributions composed into unpublished continuable children. */
|
|
@@ -195,27 +196,16 @@ export declare class SubagentRuntime extends Service {
|
|
|
195
196
|
drainContinuableChildren(parent: Agent, childIds: readonly SessionId[]): Promise<void>;
|
|
196
197
|
/**
|
|
197
198
|
* Enumerate the parent's direct session-backed subagents without loading or
|
|
198
|
-
* resuming an Agent
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* projection
|
|
202
|
-
* snapshot for a live child; for a cold one, a durable projection-cache
|
|
203
|
-
* row when the optional cache serves an own-suffix identity (its `seq`
|
|
204
|
-
* gate proves the value postdates the fork seed, where a child's own
|
|
205
|
-
* descriptor is immutable once appended), else one persistence inspection
|
|
206
|
-
* folded through the registry. The
|
|
207
|
-
* projection fold is the single classification authority; per-child
|
|
208
|
-
* diagnostics relay a fold that served no identity or a failed inspection,
|
|
209
|
-
* never a list-time descriptor parse. Absent persistence, enumeration is
|
|
210
|
-
* live-only (a cold child cannot be resumed then either, so its absence is
|
|
211
|
-
* capability absence, not an error). This service consults no Agent
|
|
212
|
-
* registrations, Activations, or providers.
|
|
199
|
+
* resuming an Agent. The Session query service supplies one live-preferred
|
|
200
|
+
* corpus and shared point observations; the projection cache supplies
|
|
201
|
+
* immutable descriptor hits without opening cold logs. The registered
|
|
202
|
+
* `subagent` projection remains the sole mode/label classifier.
|
|
213
203
|
*
|
|
214
|
-
* Every
|
|
215
|
-
*
|
|
204
|
+
* Every query receives `signal`, and the listing rechecks cancellation
|
|
205
|
+
* around each await. Read rejections that settle
|
|
216
206
|
* after an abort become a stable `SubagentError` with code `CANCELLED`.
|
|
217
207
|
* @param parentSessionId - parent session whose direct children are listed.
|
|
218
|
-
* @param signal - caller-owned cancellation forwarded to
|
|
208
|
+
* @param signal - caller-owned cancellation forwarded to Session queries
|
|
219
209
|
* and observed around every read await.
|
|
220
210
|
* @returns children and per-child diagnostics ordered by `createdAt`, then id.
|
|
221
211
|
* @throws {@link SubagentError} when the projection registry or the session
|
|
@@ -238,6 +228,52 @@ export declare class SubagentRuntime extends Service {
|
|
|
238
228
|
* @throws {@link SubagentError} under the same conditions as {@link listChildren}.
|
|
239
229
|
*/
|
|
240
230
|
listDescendants(rootSessionId: SessionId, signal?: AbortSignal): Promise<SubagentDescendantListEntry[]>;
|
|
231
|
+
/**
|
|
232
|
+
* Remote face of {@link listChildren} for one browser: the durable listing
|
|
233
|
+
* plus live Agent activity and the delivery-time parent availability hint.
|
|
234
|
+
* Parent availability is a hint; {@link prompt} performs the authoritative
|
|
235
|
+
* check. Named apart from the provider-name {@link list}, which owns the
|
|
236
|
+
* member.
|
|
237
|
+
* @param parentSessionId - parent session whose direct children are listed.
|
|
238
|
+
* @param signal - carrier cancellation forwarded to Session queries.
|
|
239
|
+
* @returns the catalog view for that parent.
|
|
240
|
+
* @throws {RemoteError} `gateway/bad-request` for an empty parent id,
|
|
241
|
+
* `gateway/cancelled` for an aborted read, `subagent/projections-unavailable` when
|
|
242
|
+
* the deployment has no projection registry, otherwise `gateway/internal`.
|
|
243
|
+
*/
|
|
244
|
+
remoteExportList(parentSessionId: SessionId, signal: AbortSignal): Promise<SubagentCatalog>;
|
|
245
|
+
/**
|
|
246
|
+
* Deliver one browser-authored message to a continuable child through the
|
|
247
|
+
* exact live direct parent, retaining the caller-minted request identity and
|
|
248
|
+
* validated browser zone on the accepted message. Success identifies the
|
|
249
|
+
* message the child's FIFO inbox accepted; later execution is independent of
|
|
250
|
+
* this call.
|
|
251
|
+
* Image parts are admitted and persisted through the attachment store
|
|
252
|
+
* before delivery, and the child's model must accept image input.
|
|
253
|
+
* @param request - durable address, minted identity, content, and optional browser zone.
|
|
254
|
+
* @param signal - carrier cancellation, owning the call until inbox acceptance.
|
|
255
|
+
* @returns the accepted message's inbox identity.
|
|
256
|
+
* @throws {RemoteError} `gateway/bad-request`, `subagent/attachment-invalid`,
|
|
257
|
+
* `subagent/invalid-time-zone`, `subagent/parent-unavailable`,
|
|
258
|
+
* `subagent/not-resumable`, `subagent/unauthorized`,
|
|
259
|
+
* `subagent/delivery-unavailable`, `gateway/cancelled`, or `gateway/internal`.
|
|
260
|
+
*/
|
|
261
|
+
prompt(request: SubagentPromptRequest, signal: AbortSignal): Promise<SubagentPromptReceipt>;
|
|
262
|
+
/**
|
|
263
|
+
* Remote face of {@link interrupt} under one durable parent address. No
|
|
264
|
+
* catalog, history, persistence, or parent Agent lookup runs: the core
|
|
265
|
+
* primitive alone authorizes the address against the live Activation, which
|
|
266
|
+
* is what keeps a live child interruptible while its parent Agent is offline.
|
|
267
|
+
* Absent, idle, and already-completed targets are accepted no-ops there.
|
|
268
|
+
* @param childSessionId - durable child session id to interrupt.
|
|
269
|
+
* @param parentSessionId - durable direct parent whose authority is claimed.
|
|
270
|
+
* @param mode - required continuable-address discriminator.
|
|
271
|
+
* @returns acknowledgement that the cancel signal was admitted, not that the target is quiescent.
|
|
272
|
+
* @throws {RemoteError} `gateway/bad-request` for an empty id,
|
|
273
|
+
* `subagent/unauthorized` when the address does not own the live target,
|
|
274
|
+
* otherwise `gateway/internal`.
|
|
275
|
+
*/
|
|
276
|
+
interruptByParent(childSessionId: SessionId, parentSessionId: SessionId, mode: 'continuable'): SubagentInterruptReceipt;
|
|
241
277
|
/**
|
|
242
278
|
* Register a provider under its name. Registration is effect-scoped and HMR
|
|
243
279
|
* safe; removing a provider blocks new starts but does not revoke runs that
|