@toddzheng024/dscode-bundle 0.7.27 → 0.7.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.md +10 -10
- package/bootstrap.mjs +1 -1
- package/cordis.patch.yml +433 -46
- package/package.json +280 -245
- package/plugins/account/index.mjs +178 -0
- package/plugins/account/state.mjs +123 -0
- package/plugins/auto-review/index.mjs +8 -5
- package/plugins/code-review/index.mjs +1 -1
- package/plugins/computer-use/index.mjs +37 -0
- package/plugins/cordis-config/plain.mjs +31 -0
- package/plugins/dscode/index.mjs +1 -1
- package/plugins/exec/cli.mjs +1 -1
- package/plugins/grok/index.mjs +28 -24
- package/plugins/i18n/messages.mjs +204 -0
- package/plugins/memory/index.mjs +1 -1
- package/plugins/message-source/kind.mjs +20 -0
- package/plugins/openrouter/adapter.mjs +29 -13
- package/plugins/openrouter/index.mjs +31 -28
- package/plugins/session-bridge/communication.mjs +6 -3
- package/plugins/session-bridge/server.mjs +3 -2
- package/plugins/session-bridge/tasks.mjs +3 -1
- package/plugins/session-cards/index.mjs +1 -1
- package/plugins/time-marks/index.mjs +3 -2
- package/plugins/time-marks/marks.mjs +6 -5
- package/plugins/triggers/config.mjs +1 -1
- package/plugins/triggers/tools.mjs +1 -1
- package/plugins/tui-tools/doctor.mjs +1 -1
- package/plugins/tui-tools/index.mjs +16 -4
- package/plugins/ultra/policy.mjs +16 -0
- package/vendor/bash/index.js +455 -186
- package/vendor/bash/types/background.d.ts +38 -7
- package/vendor/bash/types/index.d.ts +20 -4
- package/vendor/bash/types/render.d.ts +28 -9
- package/vendor/command-goal/index.js +3 -1
- package/vendor/deepseek/index.js +1378 -1246
- package/vendor/deepseek/types/adapter.d.ts +16 -155
- package/vendor/deepseek/types/config.d.ts +127 -0
- package/vendor/deepseek/types/defaults.d.ts +24 -0
- package/vendor/deepseek/types/file-store.d.ts +5 -3
- package/vendor/deepseek/types/files-api.d.ts +12 -9
- package/vendor/deepseek/types/image-tokens.d.ts +24 -9
- package/vendor/deepseek/types/images.d.ts +35 -0
- package/vendor/deepseek/types/index.d.ts +10 -94
- package/vendor/deepseek/types/messages-api.d.ts +10 -0
- package/vendor/deepseek/types/model-info.d.ts +16 -0
- package/vendor/deepseek/types/models.d.ts +4 -0
- package/vendor/deepseek/types/replay.d.ts +27 -0
- package/vendor/deepseek/types/request-extensions.d.ts +16 -0
- package/vendor/deepseek/types/request-files.d.ts +49 -0
- package/vendor/deepseek/types/request-pricing.d.ts +32 -20
- package/vendor/deepseek/types/serialize.d.ts +17 -82
- package/vendor/deepseek/types/sse.d.ts +6 -22
- package/vendor/deepseek/types/translate.d.ts +13 -36
- package/vendor/deepseek/types/transport.d.ts +15 -0
- package/vendor/deepseek/types/types.d.ts +106 -167
- package/vendor/deepseek/types/wire-types.d.ts +62 -0
- package/vendor/persistent/index.js +9 -3
- package/vendor/subagent/index.js +11 -8
- package/vendor/subagent/model-selection-settings.js +12 -38
- package/vendor/subagent/types/index.d.ts +4 -3
- package/vendor/subagent/types/model-selection-settings.d.ts +12 -10
- package/vendor/subagent-core/index.js +401 -264
- package/vendor/subagent-core/typert.host.js +103 -113
- package/vendor/subagent-core/typert.remote-client.d.ts +1 -3
- package/vendor/subagent-core/typert.remote-client.js +23 -69
- package/vendor/subagent-core/types/archive-admission.d.ts +16 -0
- package/vendor/subagent-core/types/archive-admission.js +151 -0
- package/vendor/subagent-core/types/assistant-output.d.ts +2 -2
- package/vendor/subagent-core/types/catalog.d.ts +17 -10
- package/vendor/subagent-core/types/catalog.js +12 -6
- package/vendor/subagent-core/types/child-agent.d.ts +8 -5
- package/vendor/subagent-core/types/child-agent.js +11 -5
- package/vendor/subagent-core/types/continuation-activation.d.ts +17 -1
- package/vendor/subagent-core/types/continuation-activation.js +41 -4
- package/vendor/subagent-core/types/continuation-messages.d.ts +1 -1
- package/vendor/subagent-core/types/continuation-messages.js +7 -3
- package/vendor/subagent-core/types/continuation.d.ts +1 -1
- package/vendor/subagent-core/types/continuation.js +2 -2
- package/vendor/subagent-core/types/control-types.d.ts +29 -36
- package/vendor/subagent-core/types/control-types.js +2 -3
- package/vendor/subagent-core/types/control.d.ts +2 -28
- package/vendor/subagent-core/types/control.js +3 -40
- package/vendor/subagent-core/types/index.d.ts +45 -41
- package/vendor/subagent-core/types/index.js +46 -82
- package/vendor/subagent-core/types/internal.d.ts +2 -2
- package/vendor/subagent-core/types/internal.js +2 -2
- package/vendor/subagent-core/types/lifecycle.d.ts +1 -1
- package/vendor/subagent-core/types/lifecycle.js +5 -3
- package/vendor/subagent-core/types/list-children.d.ts +15 -32
- package/vendor/subagent-core/types/list-children.js +45 -49
- package/vendor/subagent-core/types/out-of-process.d.ts +1 -1
- package/vendor/subagent-core/types/projection-types.d.ts +9 -1
- package/vendor/subagent-core/types/projection.d.ts +5 -0
- package/vendor/subagent-core/types/projection.js +10 -4
- package/vendor/subagent-core/types/run-settlement.js +1 -1
- package/vendor/subagent-core/types/types.d.ts +2 -2
- package/vendor/terminal/index.js +94 -30
- package/vendor/tui/lib/index.mjs +2 -1
- package/vendor/tui/lib/kernel-panels.mjs +1 -1
- package/vendor/tui/lib/render/projection.mjs +50 -36
- package/presets/dscode/agent.cordis.yml +0 -321
- package/presets/dscode/preset.yml +0 -3
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Service Definition for the subagent capability seam (`ctx.subagents`): a named-provider registry plus a
|
|
3
|
-
* capability-validating asynchronous start API. Providers establish a
|
|
4
|
-
* child before returning its run, so fulfillment is the single publication and
|
|
5
|
-
* ownership-transfer boundary.
|
|
6
|
-
*
|
|
7
|
-
* Multiple providers coexist: each registers under a unique name and callers
|
|
8
|
-
* select one by name.
|
|
9
|
-
*
|
|
10
|
-
* This package owns the Service Definition role of the capability seam. Service Providers
|
|
11
|
-
* (`@deepseek-ai/dsh-subagent-spawn-in-process`, `-fork`, `-acp`) and the model-facing
|
|
12
|
-
* consumer (`@deepseek-ai/dsh-tool-subagent`) are separate packages.
|
|
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. Child and descendant
|
|
21
|
-
* discovery read the live session store and optional session persistence
|
|
22
|
-
* directly and do not require that continuation runtime.
|
|
23
|
-
*
|
|
24
|
-
* Same-process providers are trusted typed collaborators. Requests, provider
|
|
25
|
-
* descriptors, results, and lifecycle payloads are borrowed immutable values;
|
|
26
|
-
* serialization and hostile-input validation belong at real process, worker,
|
|
27
|
-
* persistence, and model boundaries.
|
|
28
|
-
*
|
|
29
|
-
* @module @deepseek-ai/dsh-subagent
|
|
30
|
-
*/
|
|
31
1
|
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
32
2
|
var useValue = arguments.length > 2;
|
|
33
3
|
for (var i = 0; i < initializers.length; i++) {
|
|
@@ -62,16 +32,18 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
62
32
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
63
33
|
done = true;
|
|
64
34
|
};
|
|
35
|
+
import z from '@deepseek-ai/schemastery';
|
|
65
36
|
import { scopeTarget } from '@deepseek-ai/dsh-scope';
|
|
66
37
|
import { assertObjectJsonSchema } from '@deepseek-ai/dsh-tools';
|
|
67
38
|
import { canonicalClientTimeZone } from '@deepseek-ai/dsh-util-time';
|
|
68
39
|
import { Remote, RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
69
|
-
import {
|
|
40
|
+
import { rejectPrompt, validateControlRequest, } from "./control.js";
|
|
70
41
|
import { SubagentError } from "./error.js";
|
|
71
42
|
import { assertSubagentMaxDepth } from "./depth.js";
|
|
72
43
|
import { createActivationObserver, createLifecycleEmitter, observeRun } from "./lifecycle.js";
|
|
73
44
|
import SubagentContinuationManager from "./continuation.js";
|
|
74
45
|
import { listChildren as listSubagentChildren, listDescendants as listSubagentDescendants } from "./list-children.js";
|
|
46
|
+
import { installSubagentArchiveAdmission } from "./archive-admission.js";
|
|
75
47
|
import { snapshotSubagentDescriptor } from "./descriptor.js";
|
|
76
48
|
import { subagentIdentityProjectionDefinition, subagentTimingProjectionDefinition } from "./projection.js";
|
|
77
49
|
import { establishCatalogChild, subagentCatalogProjectionDefinition } from "./catalog.js";
|
|
@@ -88,21 +60,23 @@ export { appendDelegatedPolicyOverrides, applyChildComposition, captureDelegated
|
|
|
88
60
|
let SubagentRuntime = (() => {
|
|
89
61
|
let _classSuper = TypertRemoteService;
|
|
90
62
|
let _instanceExtraInitializers = [];
|
|
91
|
-
let _remoteExportList_decorators;
|
|
92
63
|
let _prompt_decorators;
|
|
93
64
|
let _interruptByParent_decorators;
|
|
94
65
|
return class SubagentRuntime extends _classSuper {
|
|
95
66
|
static {
|
|
96
67
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
97
|
-
_remoteExportList_decorators = [Remote('list')];
|
|
98
68
|
_prompt_decorators = [Remote('prompt')];
|
|
99
69
|
_interruptByParent_decorators = [Remote('interruptByParent')];
|
|
100
|
-
__esDecorate(this, null, _remoteExportList_decorators, { kind: "method", name: "remoteExportList", static: false, private: false, access: { has: obj => "remoteExportList" in obj, get: obj => obj.remoteExportList }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
101
70
|
__esDecorate(this, null, _prompt_decorators, { kind: "method", name: "prompt", static: false, private: false, access: { has: obj => "prompt" in obj, get: obj => obj.prompt }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
102
71
|
__esDecorate(this, null, _interruptByParent_decorators, { kind: "method", name: "interruptByParent", static: false, private: false, access: { has: obj => "interruptByParent" in obj, get: obj => obj.interruptByParent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
103
72
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
104
73
|
}
|
|
105
|
-
|
|
74
|
+
config = __runInitializers(this, _instanceExtraInitializers);
|
|
75
|
+
static Config = z.object({
|
|
76
|
+
maxDepth: z.number().step(1).min(0).max(Number.MAX_SAFE_INTEGER).default(1).volatile(),
|
|
77
|
+
maxActiveSubagents: z.number().step(1).min(1).max(Number.MAX_SAFE_INTEGER).default(8).volatile(),
|
|
78
|
+
});
|
|
79
|
+
providers = new Map();
|
|
106
80
|
continuations;
|
|
107
81
|
/**
|
|
108
82
|
* The contained lifecycle-edge publisher. Built here because scoped dispatch
|
|
@@ -110,14 +84,15 @@ let SubagentRuntime = (() => {
|
|
|
110
84
|
* composes into the carrier.
|
|
111
85
|
*/
|
|
112
86
|
emitLifecycle;
|
|
113
|
-
constructor(ctx) {
|
|
87
|
+
constructor(ctx, config) {
|
|
114
88
|
super(ctx, 'subagents');
|
|
89
|
+
this.config = config;
|
|
115
90
|
this.emitLifecycle = createLifecycleEmitter(this.ctx, parent => scopeTarget(this, parent));
|
|
116
91
|
ctx.inject(['agents'], (childCtx) => {
|
|
117
92
|
const manager = new SubagentContinuationManager(childCtx, {
|
|
118
93
|
prepareContinuable: (name, request) => this.prepareContinuable(name, request),
|
|
119
94
|
observeActivation: (provider, childId, parent) => this.observeActivation(provider, childId, parent),
|
|
120
|
-
});
|
|
95
|
+
}, () => this.config.maxActiveSubagents.get());
|
|
121
96
|
this.continuations = manager;
|
|
122
97
|
childCtx.effect(() => () => {
|
|
123
98
|
/* v8 ignore else -- one injected binding owns the slot until its fiber disposes. */
|
|
@@ -126,10 +101,28 @@ let SubagentRuntime = (() => {
|
|
|
126
101
|
}, 'subagents.continuationBinding()');
|
|
127
102
|
});
|
|
128
103
|
ctx.inject(['sessionProjections'], (projectionCtx) => {
|
|
129
|
-
projectionCtx.sessionProjections
|
|
130
|
-
|
|
131
|
-
|
|
104
|
+
const projections = projectionCtx.sessionProjections;
|
|
105
|
+
projections.register(subagentCatalogProjectionDefinition);
|
|
106
|
+
projections.register(subagentTimingProjectionDefinition);
|
|
107
|
+
projections.register(subagentIdentityProjectionDefinition);
|
|
132
108
|
});
|
|
109
|
+
// Archive admission: this runtime is the owner that knows which live
|
|
110
|
+
// children descend from a Session and how a parent stops them.
|
|
111
|
+
ctx.inject(['agents'], (agentsCtx) => { installSubagentArchiveAdmission(agentsCtx); });
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Resolve a delegation tool's depth policy against the current user setting.
|
|
115
|
+
* @param configured - Explicit tool limit, or provider-managed for external delegation.
|
|
116
|
+
* @returns The numeric limit, or undefined when the provider owns depth enforcement.
|
|
117
|
+
*/
|
|
118
|
+
resolveMaxDepth(configured) {
|
|
119
|
+
if (configured === 'provider-managed')
|
|
120
|
+
return undefined;
|
|
121
|
+
if (configured !== undefined)
|
|
122
|
+
return configured;
|
|
123
|
+
const depth = this.config.maxDepth.get();
|
|
124
|
+
assertSubagentMaxDepth(depth);
|
|
125
|
+
return depth;
|
|
133
126
|
}
|
|
134
127
|
/**
|
|
135
128
|
* Establish one durable continuable child and deliver its initial prompt.
|
|
@@ -162,12 +155,12 @@ let SubagentRuntime = (() => {
|
|
|
162
155
|
}
|
|
163
156
|
/**
|
|
164
157
|
* Deliver one host-protocol message to a direct continuable child.
|
|
165
|
-
* Symbol-keyed so host adapters can preserve their own
|
|
158
|
+
* Symbol-keyed so host adapters can preserve their own source descriptors without
|
|
166
159
|
* widening the public Service Definition or impersonating an Agent sender.
|
|
167
160
|
* @param parent - exact live direct parent authorizing delivery.
|
|
168
161
|
* @param childId - durable direct-child session id.
|
|
169
162
|
* @param content - host-authored content to deliver.
|
|
170
|
-
* @param source - durable host-protocol
|
|
163
|
+
* @param source - durable host-protocol source descriptor.
|
|
171
164
|
* @param signal - caller cancellation before inbox acceptance.
|
|
172
165
|
* @param delivery - Queue as a distinct turn or Steer at the nearest step.
|
|
173
166
|
* @returns the accepted message's inbox id.
|
|
@@ -229,21 +222,13 @@ let SubagentRuntime = (() => {
|
|
|
229
222
|
await manager.drainChildren(parent, childIds);
|
|
230
223
|
}
|
|
231
224
|
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
* around each await. Read rejections that settle
|
|
240
|
-
* after an abort become a stable `SubagentError` with code `CANCELLED`.
|
|
241
|
-
* @param parentSessionId - parent session whose direct children are listed.
|
|
242
|
-
* @param signal - caller-owned cancellation forwarded to Session queries
|
|
243
|
-
* and observed around every read await.
|
|
244
|
-
* @returns children and per-child diagnostics ordered by `createdAt`, then id.
|
|
245
|
-
* @throws {@link SubagentError} when the projection registry or the session
|
|
246
|
-
* store is not mounted, or the caller cancels the listing.
|
|
225
|
+
* Read the parent's durable direct-child catalog without loading or resuming an Agent.
|
|
226
|
+
* The service owns and releases the live-preferred Session observation.
|
|
227
|
+
* @param parentSessionId - parent whose direct children are requested.
|
|
228
|
+
* @param signal - cancellation forwarded to the Session query.
|
|
229
|
+
* @returns catalog children in parent event order.
|
|
230
|
+
* @throws {@link SubagentError} when query or catalog projection is unavailable.
|
|
231
|
+
* @throws SessionQueryError when the parent cannot be read or the query is cancelled.
|
|
247
232
|
*/
|
|
248
233
|
listChildren(parentSessionId, signal) {
|
|
249
234
|
return listSubagentChildren(this.ctx, parentSessionId, signal);
|
|
@@ -254,40 +239,18 @@ let SubagentRuntime = (() => {
|
|
|
254
239
|
* Agent. Ordinary sessions and one-shot children remain traversal nodes so
|
|
255
240
|
* continuable descendants below them are discovered; each returned entry
|
|
256
241
|
* adds its durable `parentId` and root-relative `depth`. Identity resolution,
|
|
257
|
-
* diagnostics, optional persistence, and cancellation
|
|
258
|
-
* projection
|
|
242
|
+
* diagnostics, optional persistence, and cancellation use the registered
|
|
243
|
+
* child identity projection and complete Session corpus.
|
|
259
244
|
* @param rootSessionId - session whose complete descendant tree is listed.
|
|
260
245
|
* @param signal - caller-owned cancellation forwarded to persistence reads
|
|
261
246
|
* and observed around every read await.
|
|
262
247
|
* @returns children and per-candidate diagnostics with tree position, in
|
|
263
248
|
* stable pre-order.
|
|
264
|
-
* @throws {@link SubagentError}
|
|
249
|
+
* @throws {@link SubagentError} when listing dependencies are unavailable or the caller cancels.
|
|
265
250
|
*/
|
|
266
251
|
listDescendants(rootSessionId, signal) {
|
|
267
252
|
return listSubagentDescendants(this.ctx, rootSessionId, signal);
|
|
268
253
|
}
|
|
269
|
-
/**
|
|
270
|
-
* Remote face of {@link listChildren} for one browser: the durable listing
|
|
271
|
-
* plus live Agent activity and the delivery-time parent availability hint.
|
|
272
|
-
* Parent availability is a hint; {@link prompt} performs the authoritative
|
|
273
|
-
* check. Named apart from the provider-name {@link list}, which owns the
|
|
274
|
-
* member.
|
|
275
|
-
* @param parentSessionId - parent session whose direct children are listed.
|
|
276
|
-
* @param signal - carrier cancellation forwarded to Session queries.
|
|
277
|
-
* @returns the catalog view for that parent.
|
|
278
|
-
* @throws {RemoteError} `gateway/bad-request` for an empty parent id,
|
|
279
|
-
* `gateway/cancelled` for an aborted read, `subagent/projections-unavailable` when
|
|
280
|
-
* the deployment has no projection registry, otherwise `gateway/internal`.
|
|
281
|
-
*/
|
|
282
|
-
async remoteExportList(parentSessionId, signal) {
|
|
283
|
-
validateControlRequest('subagent.list', { parentSessionId });
|
|
284
|
-
try {
|
|
285
|
-
return catalogView(this.ctx, parentSessionId, await this.listChildren(parentSessionId, signal));
|
|
286
|
-
}
|
|
287
|
-
catch (error) {
|
|
288
|
-
return rejectCatalogRead(error, signal);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
254
|
/**
|
|
292
255
|
* Deliver one browser-authored message to a continuable child through the
|
|
293
256
|
* exact live direct parent, retaining the caller-minted request identity and
|
|
@@ -297,6 +260,7 @@ let SubagentRuntime = (() => {
|
|
|
297
260
|
* nearest step and retains the Agent loop's best-effort fallback semantics.
|
|
298
261
|
* Image parts are admitted and persisted through the attachment store
|
|
299
262
|
* before delivery, and the child's model must accept image input.
|
|
263
|
+
* Cold resume at capacity rejects with `subagent/delivery-unavailable`.
|
|
300
264
|
* @param request - durable address, delivery, minted identity, content, and optional browser zone.
|
|
301
265
|
* @param signal - carrier cancellation, owning the call until inbox acceptance.
|
|
302
266
|
* @returns the accepted message's inbox identity.
|
|
@@ -39,7 +39,7 @@ export interface HostPromptDeliverer {
|
|
|
39
39
|
* @param parent - exact live direct parent authorizing delivery.
|
|
40
40
|
* @param childId - durable direct-child session id.
|
|
41
41
|
* @param content - host-authored content to deliver.
|
|
42
|
-
* @param source - durable host-protocol
|
|
42
|
+
* @param source - durable host-protocol source descriptor.
|
|
43
43
|
* @param signal - caller cancellation before inbox acceptance.
|
|
44
44
|
* @returns the accepted message's inbox id.
|
|
45
45
|
*/
|
|
@@ -50,7 +50,7 @@ export declare function queueHostSubagentPrompt(runtime: SubagentRuntime, parent
|
|
|
50
50
|
* @param parent - exact live direct parent authorizing delivery.
|
|
51
51
|
* @param childId - durable direct-child session id.
|
|
52
52
|
* @param content - host-authored content to deliver.
|
|
53
|
-
* @param source - durable host-protocol
|
|
53
|
+
* @param source - durable host-protocol source descriptor.
|
|
54
54
|
* @param signal - caller cancellation before inbox acceptance.
|
|
55
55
|
* @returns the accepted message's inbox id.
|
|
56
56
|
*/
|
|
@@ -35,7 +35,7 @@ export const deliverSubagentPrompt = Symbol.for('dsh.subagent.deliverPrompt');
|
|
|
35
35
|
* @param parent - exact live direct parent authorizing delivery.
|
|
36
36
|
* @param childId - durable direct-child session id.
|
|
37
37
|
* @param content - host-authored content to deliver.
|
|
38
|
-
* @param source - durable host-protocol
|
|
38
|
+
* @param source - durable host-protocol source descriptor.
|
|
39
39
|
* @param signal - caller cancellation before inbox acceptance.
|
|
40
40
|
* @returns the accepted message's inbox id.
|
|
41
41
|
*/
|
|
@@ -48,7 +48,7 @@ export function queueHostSubagentPrompt(runtime, parent, childId, content, sourc
|
|
|
48
48
|
* @param parent - exact live direct parent authorizing delivery.
|
|
49
49
|
* @param childId - durable direct-child session id.
|
|
50
50
|
* @param content - host-authored content to deliver.
|
|
51
|
-
* @param source - durable host-protocol
|
|
51
|
+
* @param source - durable host-protocol source descriptor.
|
|
52
52
|
* @param signal - caller cancellation before inbox acceptance.
|
|
53
53
|
* @returns the accepted message's inbox id.
|
|
54
54
|
*/
|
|
@@ -26,7 +26,7 @@ export interface ActivationTerminal {
|
|
|
26
26
|
/** Why this epoch's last ordinary turn ended, or `error` when teardown failed. */
|
|
27
27
|
readonly stopReason: SubagentResult['stopReason'];
|
|
28
28
|
/** The epoch's final assistant content, absent when it produced none or failed. */
|
|
29
|
-
readonly output?: ContentBlock[];
|
|
29
|
+
readonly output?: readonly ContentBlock[];
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Lifecycle observer for one Activation's residency epoch, so continuable
|
|
@@ -106,6 +106,7 @@ export function createActivationObserver(emit, provider, childId, parent) {
|
|
|
106
106
|
emit('subagent/start', identity, parent);
|
|
107
107
|
},
|
|
108
108
|
capture: (child) => {
|
|
109
|
+
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
|
|
109
110
|
const own = child.session.snapshotEvents(boundary);
|
|
110
111
|
const output = finalAssistantOutput(own);
|
|
111
112
|
captured = {
|
|
@@ -159,9 +160,10 @@ function epochStopReason(events) {
|
|
|
159
160
|
case undefined:
|
|
160
161
|
case 'completed':
|
|
161
162
|
return droppedUnrun ? 'aborted' : 'completed';
|
|
162
|
-
/* v8 ignore next
|
|
163
|
-
*
|
|
164
|
-
*
|
|
163
|
+
/* v8 ignore next 4 -- `forked` appears only in constructor seed history, while
|
|
164
|
+
* this function reads an epoch-owned suffix. `TurnEndReason` is merge-extensible,
|
|
165
|
+
* so a backend-added variant cannot be listed; treating an unnameable reason as
|
|
166
|
+
* success would report failed work as completed. */
|
|
165
167
|
default:
|
|
166
168
|
return 'error';
|
|
167
169
|
}
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* an unseeded durable projection-cache row, and one shared Session observation
|
|
8
|
-
* otherwise. A seeded header deliberately lacks its exact inherited cut, so
|
|
9
|
-
* it takes the body-bearing observation path before classifying an identity.
|
|
10
|
-
* The projection fold is the single classification
|
|
11
|
-
* authority — this module parses no descriptor
|
|
12
|
-
* itself. Absent persistence, enumeration is live-only: a cold child is
|
|
13
|
-
* unreachable for resume anyway, so its absence is capability absence, not an
|
|
14
|
-
* error. The module owns no catalog state and does not consult Activation,
|
|
15
|
-
* Agent-registry, continuation-manager, or provider state.
|
|
2
|
+
* Direct-child discovery from a parent-owned `subagent/catalog` projection,
|
|
3
|
+
* plus complete descendant-tree enumeration from the Session corpus. A direct
|
|
4
|
+
* listing owns one parent observation and reads no child log. Descendant
|
|
5
|
+
* enumeration retains the complete corpus and the child identity projection
|
|
6
|
+
* because ordinary Sessions and one-shot children remain traversal nodes.
|
|
16
7
|
*
|
|
17
8
|
* @module @deepseek-ai/dsh-subagent
|
|
18
9
|
*/
|
|
19
10
|
import type { Context } from '@deepseek-ai/cordis';
|
|
20
11
|
import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
21
12
|
import type { SubagentListEntry } from './control-types.ts';
|
|
13
|
+
import type { SubagentCatalogEntry } from './projection-types.ts';
|
|
22
14
|
export type { SubagentListEntry } from './control-types.ts';
|
|
23
15
|
/**
|
|
24
16
|
* One entry of a descendant listing: the interpreted subagent facts plus its
|
|
@@ -32,34 +24,25 @@ export type SubagentDescendantListEntry = SubagentListEntry & {
|
|
|
32
24
|
readonly depth: number;
|
|
33
25
|
};
|
|
34
26
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @see SubagentRuntime.listChildren for the public cancellation and failure contract.
|
|
42
|
-
* @param ctx - context carrying the session store, the projection registry,
|
|
43
|
-
* optional persistence, and the optional projection cache.
|
|
44
|
-
* @param parentSessionId - parent session whose direct children are listed.
|
|
45
|
-
* @param signal - caller-owned cancellation observed around every persistence read.
|
|
46
|
-
* @returns children and per-child diagnostics ordered by `createdAt`, then id.
|
|
47
|
-
* @throws {@link SubagentError} when the projection registry or the session
|
|
48
|
-
* store is not mounted, or the caller cancels the listing.
|
|
27
|
+
* Read one parent's durable catalog through a live-preferred Session observation.
|
|
28
|
+
* @param ctx - context carrying the Session query service.
|
|
29
|
+
* @param parentSessionId - parent whose direct children are requested.
|
|
30
|
+
* @param signal - cancellation forwarded to the Session observation.
|
|
31
|
+
* @returns direct-child rows in parent catalog event order.
|
|
32
|
+
* @throws {@link SubagentError} when query or catalog projection is unavailable.
|
|
49
33
|
*/
|
|
50
|
-
export declare function listChildren(ctx: Context, parentSessionId: SessionId, signal?: AbortSignal): Promise<
|
|
34
|
+
export declare function listChildren(ctx: Context, parentSessionId: SessionId, signal?: AbortSignal): Promise<SubagentCatalogEntry[]>;
|
|
51
35
|
/**
|
|
52
36
|
* Enumerate every session-backed subagent below one root in stable pre-order.
|
|
53
37
|
* Ordinary sessions and one-shot children remain traversal nodes, so a
|
|
54
38
|
* continuable child below either is still discovered. Classification uses the
|
|
55
|
-
*
|
|
56
|
-
* resumed.
|
|
39
|
+
* registered child identity projection; no Agent is loaded or resumed.
|
|
57
40
|
* @see SubagentRuntime.listDescendants for the public cancellation and failure contract.
|
|
58
41
|
* @param ctx - context carrying the session store, projection registry, and optional persistence/cache.
|
|
59
42
|
* @param rootSessionId - session whose complete descendant tree is listed.
|
|
60
43
|
* @param signal - caller-owned cancellation observed around every persistence read.
|
|
61
44
|
* @returns interpreted subagents with durable direct-parent and root-relative depth.
|
|
62
|
-
* @throws {@link SubagentError}
|
|
45
|
+
* @throws {@link SubagentError} when listing dependencies are unavailable or the caller cancels.
|
|
63
46
|
*/
|
|
64
47
|
export declare function listDescendants(ctx: Context, rootSessionId: SessionId, signal?: AbortSignal): Promise<SubagentDescendantListEntry[]>;
|
|
65
48
|
//# sourceMappingURL=list-children.d.ts.map
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* an unseeded durable projection-cache row, and one shared Session observation
|
|
8
|
-
* otherwise. A seeded header deliberately lacks its exact inherited cut, so
|
|
9
|
-
* it takes the body-bearing observation path before classifying an identity.
|
|
10
|
-
* The projection fold is the single classification
|
|
11
|
-
* authority — this module parses no descriptor
|
|
12
|
-
* itself. Absent persistence, enumeration is live-only: a cold child is
|
|
13
|
-
* unreachable for resume anyway, so its absence is capability absence, not an
|
|
14
|
-
* error. The module owns no catalog state and does not consult Activation,
|
|
15
|
-
* Agent-registry, continuation-manager, or provider state.
|
|
2
|
+
* Direct-child discovery from a parent-owned `subagent/catalog` projection,
|
|
3
|
+
* plus complete descendant-tree enumeration from the Session corpus. A direct
|
|
4
|
+
* listing owns one parent observation and reads no child log. Descendant
|
|
5
|
+
* enumeration retains the complete corpus and the child identity projection
|
|
6
|
+
* because ordinary Sessions and one-shot children remain traversal nodes.
|
|
16
7
|
*
|
|
17
8
|
* @module @deepseek-ai/dsh-subagent
|
|
18
9
|
*/
|
|
@@ -68,7 +59,6 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
68
59
|
var e = new Error(message);
|
|
69
60
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
70
61
|
});
|
|
71
|
-
import { SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
72
62
|
import { SubagentError } from "./error.js";
|
|
73
63
|
/**
|
|
74
64
|
* Concurrent cold observations per explicit catalog listing. Current Session
|
|
@@ -77,42 +67,48 @@ import { SubagentError } from "./error.js";
|
|
|
77
67
|
*/
|
|
78
68
|
const COLD_READ_CONCURRENCY = 4;
|
|
79
69
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* @see SubagentRuntime.listChildren for the public cancellation and failure contract.
|
|
87
|
-
* @param ctx - context carrying the session store, the projection registry,
|
|
88
|
-
* optional persistence, and the optional projection cache.
|
|
89
|
-
* @param parentSessionId - parent session whose direct children are listed.
|
|
90
|
-
* @param signal - caller-owned cancellation observed around every persistence read.
|
|
91
|
-
* @returns children and per-child diagnostics ordered by `createdAt`, then id.
|
|
92
|
-
* @throws {@link SubagentError} when the projection registry or the session
|
|
93
|
-
* store is not mounted, or the caller cancels the listing.
|
|
70
|
+
* Read one parent's durable catalog through a live-preferred Session observation.
|
|
71
|
+
* @param ctx - context carrying the Session query service.
|
|
72
|
+
* @param parentSessionId - parent whose direct children are requested.
|
|
73
|
+
* @param signal - cancellation forwarded to the Session observation.
|
|
74
|
+
* @returns direct-child rows in parent catalog event order.
|
|
75
|
+
* @throws {@link SubagentError} when query or catalog projection is unavailable.
|
|
94
76
|
*/
|
|
95
77
|
export async function listChildren(ctx, parentSessionId, signal) {
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
78
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
79
|
+
try {
|
|
80
|
+
const query = ctx.get('sessionQuery');
|
|
81
|
+
if (query === undefined) {
|
|
82
|
+
throw new SubagentError('listing subagents requires the sessionQuery service (load @deepseek-ai/dsh-session-query)', 'SUBAGENT_CONTROL_QUERY_UNAVAILABLE');
|
|
83
|
+
}
|
|
84
|
+
const parent = __addDisposableResource(env_1, await query.observeSession(parentSessionId, {
|
|
85
|
+
...signal === undefined ? {} : { signal },
|
|
86
|
+
}), false);
|
|
87
|
+
const entries = parent.projections?.values.subagentCatalog;
|
|
88
|
+
if (entries === undefined) {
|
|
89
|
+
throw new SubagentError('listing subagents requires the registered subagentCatalog projection', 'SUBAGENT_CONTROL_PROJECTIONS_UNAVAILABLE');
|
|
90
|
+
}
|
|
91
|
+
return entries;
|
|
92
|
+
}
|
|
93
|
+
catch (e_1) {
|
|
94
|
+
env_1.error = e_1;
|
|
95
|
+
env_1.hasError = true;
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
__disposeResources(env_1);
|
|
99
|
+
}
|
|
103
100
|
}
|
|
104
101
|
/**
|
|
105
102
|
* Enumerate every session-backed subagent below one root in stable pre-order.
|
|
106
103
|
* Ordinary sessions and one-shot children remain traversal nodes, so a
|
|
107
104
|
* continuable child below either is still discovered. Classification uses the
|
|
108
|
-
*
|
|
109
|
-
* resumed.
|
|
105
|
+
* registered child identity projection; no Agent is loaded or resumed.
|
|
110
106
|
* @see SubagentRuntime.listDescendants for the public cancellation and failure contract.
|
|
111
107
|
* @param ctx - context carrying the session store, projection registry, and optional persistence/cache.
|
|
112
108
|
* @param rootSessionId - session whose complete descendant tree is listed.
|
|
113
109
|
* @param signal - caller-owned cancellation observed around every persistence read.
|
|
114
110
|
* @returns interpreted subagents with durable direct-parent and root-relative depth.
|
|
115
|
-
* @throws {@link SubagentError}
|
|
111
|
+
* @throws {@link SubagentError} when listing dependencies are unavailable or the caller cancels.
|
|
116
112
|
*/
|
|
117
113
|
export async function listDescendants(ctx, rootSessionId, signal) {
|
|
118
114
|
const listing = await prepareListing(ctx, signal);
|
|
@@ -271,17 +267,17 @@ function compareCorpusRecords(a, b) {
|
|
|
271
267
|
* throw — are final, so they report `corrupt`.
|
|
272
268
|
*/
|
|
273
269
|
async function resolveColdIdentity(query, cache, header, hasChildren, signal) {
|
|
274
|
-
const
|
|
270
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
275
271
|
try {
|
|
276
272
|
const childId = header.id;
|
|
277
273
|
// A header deliberately exposes only whether a fork cut exists, not its
|
|
278
|
-
// integer. An unseeded lifecycle has the exact cut 0
|
|
279
|
-
//
|
|
280
|
-
// classified as inherited or owned.
|
|
274
|
+
// integer. An unseeded lifecycle has the exact cut 0, so its cached
|
|
275
|
+
// descriptor is owned at every valid seq; a seeded lifecycle must read the
|
|
276
|
+
// body before an identity seq can be classified as inherited or owned.
|
|
281
277
|
if (cache !== undefined && !header.isSeeded) {
|
|
282
278
|
let cached;
|
|
283
279
|
try {
|
|
284
|
-
cached = cache.cachedSnapshot(header,
|
|
280
|
+
cached = cache.cachedSnapshot(header, ['subagent'])?.values.subagent;
|
|
285
281
|
}
|
|
286
282
|
catch {
|
|
287
283
|
// Unlike the preparation fold below, a throwing cache read renders no
|
|
@@ -317,7 +313,7 @@ async function resolveColdIdentity(query, cache, header, hasChildren, signal) {
|
|
|
317
313
|
: 'unavailable',
|
|
318
314
|
};
|
|
319
315
|
}
|
|
320
|
-
const ownedObservation = __addDisposableResource(
|
|
316
|
+
const ownedObservation = __addDisposableResource(env_2, observation, false);
|
|
321
317
|
assertListingNotCancelled(signal);
|
|
322
318
|
// A session id names a slot, not a lifecycle: a child deleted and
|
|
323
319
|
// re-published under another owner between the enumeration and this read
|
|
@@ -332,12 +328,12 @@ async function resolveColdIdentity(query, cache, header, hasChildren, signal) {
|
|
|
332
328
|
}
|
|
333
329
|
return childRow(childId, identity, 'inactive', hasChildren);
|
|
334
330
|
}
|
|
335
|
-
catch (
|
|
336
|
-
|
|
337
|
-
|
|
331
|
+
catch (e_2) {
|
|
332
|
+
env_2.error = e_2;
|
|
333
|
+
env_2.hasError = true;
|
|
338
334
|
}
|
|
339
335
|
finally {
|
|
340
|
-
__disposeResources(
|
|
336
|
+
__disposeResources(env_2);
|
|
341
337
|
}
|
|
342
338
|
}
|
|
343
339
|
/** Materialize one served identity as its child row. */
|
|
@@ -68,7 +68,7 @@ export interface RunResultSettlement {
|
|
|
68
68
|
/** The turn attempt (typically racing local cancellation); returns the terminal result. */
|
|
69
69
|
attempt: () => Promise<SubagentResult>;
|
|
70
70
|
/** Snapshot the provider exposes when cancellation or failure wins settlement. */
|
|
71
|
-
collectOutput: () => ContentBlock[];
|
|
71
|
+
collectOutput: () => readonly ContentBlock[];
|
|
72
72
|
/** Snapshot safe provider-authored detail when a failure wins settlement. */
|
|
73
73
|
collectDiagnostic?: (() => string | undefined) | undefined;
|
|
74
74
|
/** Whether local cancellation settled before the attempt's outcome is observed. */
|
|
@@ -14,6 +14,9 @@ export type SubagentCatalogEntry = {
|
|
|
14
14
|
} | {
|
|
15
15
|
readonly mode: 'continuable';
|
|
16
16
|
readonly label: string;
|
|
17
|
+
} | {
|
|
18
|
+
readonly mode: 'unknown';
|
|
19
|
+
readonly label?: string;
|
|
17
20
|
});
|
|
18
21
|
/** Durable active-turn timing for one descriptor-backed child session. */
|
|
19
22
|
export interface SubagentTimingProjection {
|
|
@@ -26,6 +29,11 @@ export interface SubagentTimingProjection {
|
|
|
26
29
|
/** Latest event time folded into this projection cut. */
|
|
27
30
|
through: number;
|
|
28
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Whether the latest closed turn after the child's own descriptor completed
|
|
34
|
+
* normally; absent while a turn is open or before one closes.
|
|
35
|
+
*/
|
|
36
|
+
lastTurnCompleted?: boolean;
|
|
29
37
|
}
|
|
30
38
|
/**
|
|
31
39
|
* Durable identity of one descriptor-backed subagent session: lifecycle mode
|
|
@@ -57,7 +65,7 @@ declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
|
57
65
|
interface SessionProjectionMap {
|
|
58
66
|
/** Direct children in parent catalog event order, excluding fork-inherited facts. */
|
|
59
67
|
subagentCatalog: SubagentCatalogEntry[];
|
|
60
|
-
/** Active-turn duration for a descriptor-backed subagent session. */
|
|
68
|
+
/** Active-turn duration and latest closed-turn completion for a descriptor-backed subagent session. */
|
|
61
69
|
subagentTiming: SubagentTimingProjection;
|
|
62
70
|
/**
|
|
63
71
|
* Identity of a descriptor-backed subagent session. `null` ⟺ no valid
|
|
@@ -20,6 +20,8 @@ export interface TimingState {
|
|
|
20
20
|
pendingTurnStart?: number | undefined;
|
|
21
21
|
/** Whether the fold has crossed a descriptor in this logical log. */
|
|
22
22
|
descriptorSeen: boolean;
|
|
23
|
+
/** Whether the latest closed post-descriptor turn completed normally; absent while a turn is open or before one closes. */
|
|
24
|
+
lastTurnCompleted?: boolean | undefined;
|
|
23
25
|
}
|
|
24
26
|
declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
25
27
|
interface SessionProjectionStateMap {
|
|
@@ -52,10 +54,13 @@ export declare const subagentTimingProjectionDefinition: {
|
|
|
52
54
|
} | undefined;
|
|
53
55
|
/** Whether the fold has crossed a descriptor in this logical log. */
|
|
54
56
|
descriptorSeen: boolean;
|
|
57
|
+
/** Whether the latest closed post-descriptor turn completed normally; absent while a turn is open or before one closes. */
|
|
58
|
+
lastTurnCompleted?: boolean | undefined;
|
|
55
59
|
};
|
|
56
60
|
wire: {
|
|
57
61
|
viewSchema: z.ZodType<SubagentTimingProjection, unknown, z.core.$ZodTypeInternals<SubagentTimingProjection, unknown>>;
|
|
58
62
|
view: (state: NoInfer<TimingState>) => {
|
|
63
|
+
lastTurnCompleted?: boolean;
|
|
59
64
|
active?: {
|
|
60
65
|
since: number;
|
|
61
66
|
through: number;
|