@toddzheng024/dscode-bundle 0.7.26 → 0.7.28
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 +418 -45
- package/package.json +279 -245
- 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/exec/cli.mjs +1 -1
- package/plugins/grok/index.mjs +28 -24
- 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,38 +1,18 @@
|
|
|
1
1
|
/* Generated by @deepseek-ai/dsh-typert-generator from the Host FaceModel — do not edit. */
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const
|
|
4
|
+
let _deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_0$schema$value
|
|
5
|
+
const _deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_0$schema = () => (_deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
|
|
6
|
+
let _deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_1$schema$value
|
|
7
|
+
const _deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_1$schema = () => (_deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_1$schema$value ??= z.intersection(z.string(), z.unknown()))
|
|
8
|
+
let _deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_2$schema$value
|
|
9
|
+
const _deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_2$schema = () => (_deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_2$schema$value ??= z.literal("continuable"))
|
|
10
|
+
let _deepseek_ai_dsh_subagent_subagents_interruptByParent_result$schema$value
|
|
11
|
+
const _deepseek_ai_dsh_subagent_subagents_interruptByParent_result$schema = () => (_deepseek_ai_dsh_subagent_subagents_interruptByParent_result$schema$value ??= z.object({
|
|
8
12
|
'accepted': z.literal(true).readonly(),
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
'entries': z.array(z.union([z.intersection(z.object({
|
|
13
|
-
'kind': z.literal("child").readonly(),
|
|
14
|
-
'id': z.intersection(z.string(), z.unknown()).readonly(),
|
|
15
|
-
'activity': z.union([z.literal("running"), z.literal("inactive")]).readonly(),
|
|
16
|
-
'hasChildren': z.boolean().readonly(),
|
|
17
|
-
}), z.object({
|
|
18
|
-
'mode': z.literal("one-shot").readonly(),
|
|
19
|
-
'label': z.string().readonly().optional(),
|
|
20
|
-
})), z.intersection(z.object({
|
|
21
|
-
'kind': z.literal("child").readonly(),
|
|
22
|
-
'id': z.intersection(z.string(), z.unknown()).readonly(),
|
|
23
|
-
'activity': z.union([z.literal("running"), z.literal("inactive")]).readonly(),
|
|
24
|
-
'hasChildren': z.boolean().readonly(),
|
|
25
|
-
}), z.object({
|
|
26
|
-
'mode': z.literal("continuable").readonly(),
|
|
27
|
-
'label': z.string().readonly(),
|
|
28
|
-
})), z.object({
|
|
29
|
-
'kind': z.literal("diagnostic").readonly(),
|
|
30
|
-
'id': z.intersection(z.string(), z.unknown()).readonly(),
|
|
31
|
-
'reason': z.union([z.literal("corrupt"), z.literal("unsupported"), z.literal("unavailable")]).readonly(),
|
|
32
|
-
})])).readonly(),
|
|
33
|
-
'parentAvailable': z.boolean().readonly(),
|
|
34
|
-
})
|
|
35
|
-
const _deepseek_ai_dsh_subagent_subagents_prompt_parameter_0$schema = z.object({
|
|
13
|
+
}))
|
|
14
|
+
let _deepseek_ai_dsh_subagent_subagents_prompt_parameter_0$schema$value
|
|
15
|
+
const _deepseek_ai_dsh_subagent_subagents_prompt_parameter_0$schema = () => (_deepseek_ai_dsh_subagent_subagents_prompt_parameter_0$schema$value ??= z.object({
|
|
36
16
|
'requestId': z.intersection(z.string(), z.unknown()).readonly(),
|
|
37
17
|
'parentSessionId': z.intersection(z.string(), z.unknown()).readonly(),
|
|
38
18
|
'childSessionId': z.intersection(z.string(), z.unknown()).readonly(),
|
|
@@ -48,10 +28,11 @@ const _deepseek_ai_dsh_subagent_subagents_prompt_parameter_0$schema = z.object({
|
|
|
48
28
|
'name': z.string().readonly().optional(),
|
|
49
29
|
})])).readonly(),
|
|
50
30
|
'clientTimeZone': z.string().readonly().optional(),
|
|
51
|
-
})
|
|
52
|
-
|
|
31
|
+
}))
|
|
32
|
+
let _deepseek_ai_dsh_subagent_subagents_prompt_result$schema$value
|
|
33
|
+
const _deepseek_ai_dsh_subagent_subagents_prompt_result$schema = () => (_deepseek_ai_dsh_subagent_subagents_prompt_result$schema$value ??= z.object({
|
|
53
34
|
'messageId': z.intersection(z.string(), z.unknown()).readonly(),
|
|
54
|
-
})
|
|
35
|
+
}))
|
|
55
36
|
|
|
56
37
|
export const TYPERT_REMOTE = {
|
|
57
38
|
package: '@deepseek-ai/dsh-subagent',
|
|
@@ -70,7 +51,7 @@ export const TYPERT_REMOTE = {
|
|
|
70
51
|
codec: {
|
|
71
52
|
mode: 'strict',
|
|
72
53
|
typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
|
|
73
|
-
|
|
54
|
+
create: _deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_0$schema,
|
|
74
55
|
},
|
|
75
56
|
},
|
|
76
57
|
{
|
|
@@ -80,7 +61,7 @@ export const TYPERT_REMOTE = {
|
|
|
80
61
|
codec: {
|
|
81
62
|
mode: 'strict',
|
|
82
63
|
typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
|
|
83
|
-
|
|
64
|
+
create: _deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_1$schema,
|
|
84
65
|
},
|
|
85
66
|
},
|
|
86
67
|
{
|
|
@@ -90,43 +71,16 @@ export const TYPERT_REMOTE = {
|
|
|
90
71
|
codec: {
|
|
91
72
|
mode: 'strict',
|
|
92
73
|
typeSymbol: '@deepseek-ai/dsh-subagent#subagents/interruptByParent:mode',
|
|
93
|
-
|
|
74
|
+
create: _deepseek_ai_dsh_subagent_subagents_interruptByParent_parameter_2$schema,
|
|
94
75
|
},
|
|
95
76
|
},
|
|
96
77
|
],
|
|
97
78
|
result: {
|
|
98
79
|
mode: 'strict',
|
|
99
80
|
typeSymbol: '@deepseek-ai/dsh-subagent/client#SubagentInterruptReceipt',
|
|
100
|
-
|
|
101
|
-
},
|
|
102
|
-
sourceLocation: {"file":"packages/subagent/subagent/src/index.ts","line":480,"column":3},
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
id: '@deepseek-ai/dsh-subagent#subagents/list',
|
|
106
|
-
service: 'subagents',
|
|
107
|
-
namespace: 'subagents',
|
|
108
|
-
method: 'list',
|
|
109
|
-
implementation: 'remoteExportList',
|
|
110
|
-
invocation: { kind: 'direct' },
|
|
111
|
-
parameters: [
|
|
112
|
-
{
|
|
113
|
-
name: 'parentSessionId',
|
|
114
|
-
wire: 'parentSessionId',
|
|
115
|
-
source: 'json',
|
|
116
|
-
codec: {
|
|
117
|
-
mode: 'strict',
|
|
118
|
-
typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
|
|
119
|
-
schema: _deepseek_ai_dsh_subagent_subagents_list_parameter_0$schema,
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
cancellation: { parameter: 'signal' },
|
|
124
|
-
result: {
|
|
125
|
-
mode: 'strict',
|
|
126
|
-
typeSymbol: '@deepseek-ai/dsh-subagent/client#SubagentCatalog',
|
|
127
|
-
schema: _deepseek_ai_dsh_subagent_subagents_list_result$schema,
|
|
81
|
+
create: _deepseek_ai_dsh_subagent_subagents_interruptByParent_result$schema,
|
|
128
82
|
},
|
|
129
|
-
sourceLocation: {"file":"packages/subagent/subagent/src/index.ts","line":
|
|
83
|
+
sourceLocation: {"file":"packages/subagent/subagent/src/index.ts","line":483,"column":3},
|
|
130
84
|
},
|
|
131
85
|
{
|
|
132
86
|
id: '@deepseek-ai/dsh-subagent#subagents/prompt',
|
|
@@ -142,7 +96,7 @@ export const TYPERT_REMOTE = {
|
|
|
142
96
|
codec: {
|
|
143
97
|
mode: 'strict',
|
|
144
98
|
typeSymbol: '@deepseek-ai/dsh-subagent/client#SubagentPromptRequest',
|
|
145
|
-
|
|
99
|
+
create: _deepseek_ai_dsh_subagent_subagents_prompt_parameter_0$schema,
|
|
146
100
|
},
|
|
147
101
|
},
|
|
148
102
|
],
|
|
@@ -150,9 +104,9 @@ export const TYPERT_REMOTE = {
|
|
|
150
104
|
result: {
|
|
151
105
|
mode: 'strict',
|
|
152
106
|
typeSymbol: '@deepseek-ai/dsh-subagent/client#SubagentPromptReceipt',
|
|
153
|
-
|
|
107
|
+
create: _deepseek_ai_dsh_subagent_subagents_prompt_result$schema,
|
|
154
108
|
},
|
|
155
|
-
sourceLocation: {"file":"packages/subagent/subagent/src/index.ts","line":
|
|
109
|
+
sourceLocation: {"file":"packages/subagent/subagent/src/index.ts","line":416,"column":9},
|
|
156
110
|
},
|
|
157
111
|
],
|
|
158
112
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `subagent` family of the Workspace registry's archive admission: which
|
|
3
|
+
* subagent descendants of a Session are still inside a turn, and how they
|
|
4
|
+
* stop when the Session is archived with its work.
|
|
5
|
+
*
|
|
6
|
+
* @module @deepseek-ai/dsh-subagent
|
|
7
|
+
*/
|
|
8
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
9
|
+
/**
|
|
10
|
+
* Answer `workspace/session-activity` with the running subagent descendants of
|
|
11
|
+
* the asked Session, and `workspace/session-stop` by cancelling each of them
|
|
12
|
+
* as their parent would. Both listeners live as long as `ctx`'s fiber.
|
|
13
|
+
* @param ctx - context carrying the Agent registry; the Session query service is optional and only supplies labels.
|
|
14
|
+
*/
|
|
15
|
+
export declare function installSubagentArchiveAdmission(ctx: Context): void;
|
|
16
|
+
//# sourceMappingURL=archive-admission.d.ts.map
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `subagent` family of the Workspace registry's archive admission: which
|
|
3
|
+
* subagent descendants of a Session are still inside a turn, and how they
|
|
4
|
+
* stop when the Session is archived with its work.
|
|
5
|
+
*
|
|
6
|
+
* @module @deepseek-ai/dsh-subagent
|
|
7
|
+
*/
|
|
8
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
9
|
+
if (value !== null && value !== void 0) {
|
|
10
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
11
|
+
var dispose, inner;
|
|
12
|
+
if (async) {
|
|
13
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
14
|
+
dispose = value[Symbol.asyncDispose];
|
|
15
|
+
}
|
|
16
|
+
if (dispose === void 0) {
|
|
17
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
18
|
+
dispose = value[Symbol.dispose];
|
|
19
|
+
if (async) inner = dispose;
|
|
20
|
+
}
|
|
21
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
22
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
23
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
24
|
+
}
|
|
25
|
+
else if (async) {
|
|
26
|
+
env.stack.push({ async: true });
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
30
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
31
|
+
return function (env) {
|
|
32
|
+
function fail(e) {
|
|
33
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
34
|
+
env.hasError = true;
|
|
35
|
+
}
|
|
36
|
+
var r, s = 0;
|
|
37
|
+
function next() {
|
|
38
|
+
while (r = env.stack.pop()) {
|
|
39
|
+
try {
|
|
40
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
41
|
+
if (r.dispose) {
|
|
42
|
+
var result = r.dispose.call(r.value);
|
|
43
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
44
|
+
}
|
|
45
|
+
else s |= 1;
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
fail(e);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
52
|
+
if (env.hasError) throw env.error;
|
|
53
|
+
}
|
|
54
|
+
return next();
|
|
55
|
+
};
|
|
56
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
57
|
+
var e = new Error(message);
|
|
58
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
59
|
+
});
|
|
60
|
+
import { foldSubagentDescriptor } from "./descriptor.js";
|
|
61
|
+
/**
|
|
62
|
+
* Answer `workspace/session-activity` with the running subagent descendants of
|
|
63
|
+
* the asked Session, and `workspace/session-stop` by cancelling each of them
|
|
64
|
+
* as their parent would. Both listeners live as long as `ctx`'s fiber.
|
|
65
|
+
* @param ctx - context carrying the Agent registry; the Session query service is optional and only supplies labels.
|
|
66
|
+
*/
|
|
67
|
+
export function installSubagentArchiveAdmission(ctx) {
|
|
68
|
+
ctx.on('workspace/session-activity', async ({ sessionId }, next) => {
|
|
69
|
+
const running = runningDescendants(ctx, sessionId);
|
|
70
|
+
const rest = await next();
|
|
71
|
+
if (running.length === 0)
|
|
72
|
+
return rest;
|
|
73
|
+
const own = { kind: 'subagent', items: await Promise.all(running.map(child => describe(ctx, child))) };
|
|
74
|
+
return [own, ...rest];
|
|
75
|
+
});
|
|
76
|
+
ctx.on('workspace/session-stop', ({ sessionId }) => {
|
|
77
|
+
for (const child of runningDescendants(ctx, sessionId)) {
|
|
78
|
+
try {
|
|
79
|
+
child.cancel({ kind: 'parent' });
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
// One child refusing its cancel must not keep its siblings running for an archived parent.
|
|
83
|
+
ctx.logger.warn(`subagent: cancelling "${child.id}" for an archived Session failed: ${String(error)}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Live subagent descendants inside a turn, by durable lineage: a child whose
|
|
90
|
+
* header names its parent and carries the subagent origin this package
|
|
91
|
+
* records, at any depth. A fork shares the lineage field without the origin
|
|
92
|
+
* and is an independent conversation, so it never holds its source. Lineage
|
|
93
|
+
* is read as data, so a damaged header chain that loops is visited once.
|
|
94
|
+
*/
|
|
95
|
+
function runningDescendants(ctx, rootId) {
|
|
96
|
+
const childrenOf = new Map();
|
|
97
|
+
for (const agent of ctx.agents.list()) {
|
|
98
|
+
const { parentSession, origin } = agent.session.header;
|
|
99
|
+
if (parentSession === undefined || origin !== 'subagent')
|
|
100
|
+
continue;
|
|
101
|
+
const siblings = childrenOf.get(parentSession) ?? [];
|
|
102
|
+
siblings.push(agent);
|
|
103
|
+
childrenOf.set(parentSession, siblings);
|
|
104
|
+
}
|
|
105
|
+
const running = [];
|
|
106
|
+
const pending = [rootId];
|
|
107
|
+
const visited = new Set();
|
|
108
|
+
while (pending.length > 0) {
|
|
109
|
+
const parentId = pending.shift();
|
|
110
|
+
if (visited.has(parentId))
|
|
111
|
+
continue;
|
|
112
|
+
visited.add(parentId);
|
|
113
|
+
for (const child of childrenOf.get(parentId) ?? []) {
|
|
114
|
+
if (child.status === 'running')
|
|
115
|
+
running.push(child);
|
|
116
|
+
pending.push(child.id);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return running;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The child's activity item: its id, plus the durable creation label its
|
|
123
|
+
* descriptor carries, read through a live Session observation. Without the
|
|
124
|
+
* Session query service, or with a descriptor that is absent or unreadable,
|
|
125
|
+
* the item names the child by id alone.
|
|
126
|
+
*/
|
|
127
|
+
async function describe(ctx, child) {
|
|
128
|
+
const query = ctx.get('sessionQuery');
|
|
129
|
+
if (query === undefined)
|
|
130
|
+
return { id: child.id };
|
|
131
|
+
try {
|
|
132
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
133
|
+
try {
|
|
134
|
+
const observation = __addDisposableResource(env_1, await query.observeSession(child.id, { projectionMode: 'none' }), false);
|
|
135
|
+
const label = foldSubagentDescriptor(observation.events.slice(observation.inheritedEventCount))?.label;
|
|
136
|
+
return label === undefined ? { id: child.id } : { id: child.id, label };
|
|
137
|
+
}
|
|
138
|
+
catch (e_1) {
|
|
139
|
+
env_1.error = e_1;
|
|
140
|
+
env_1.hasError = true;
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
__disposeResources(env_1);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
// A damaged descriptor is data damage in the child; the report still names the child.
|
|
148
|
+
return { id: child.id };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=archive-admission.js.map
|
|
@@ -37,12 +37,12 @@ export declare class AssistantOutputFold {
|
|
|
37
37
|
* @returns the last non-empty assistant message, else the accumulated
|
|
38
38
|
* streamed text, or `undefined` when the child produced neither.
|
|
39
39
|
*/
|
|
40
|
-
collect(): ContentBlock[] | undefined;
|
|
40
|
+
collect(): readonly ContentBlock[] | undefined;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Apply the selection rule to one complete child-owned event suffix.
|
|
44
44
|
* @param events - the child-owned events (after any seed or epoch boundary).
|
|
45
45
|
* @returns the selected output, or `undefined` when the child produced none.
|
|
46
46
|
*/
|
|
47
|
-
export declare function finalAssistantOutput(events: readonly SessionEvent[]): ContentBlock[] | undefined;
|
|
47
|
+
export declare function finalAssistantOutput(events: readonly SessionEvent[]): readonly ContentBlock[] | undefined;
|
|
48
48
|
//# sourceMappingURL=assistant-output.d.ts.map
|
|
@@ -7,24 +7,31 @@ import { z } from 'zod';
|
|
|
7
7
|
import type { ChunkedList } from '@deepseek-ai/dsh-chunked-list';
|
|
8
8
|
import type { Session, SessionEvent, SessionHeader, SessionId, SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
9
9
|
import type { SubagentCatalogEntry } from './projection-types.ts';
|
|
10
|
-
/**
|
|
10
|
+
/** Catalog payload version emitted by live child creation. */
|
|
11
11
|
export declare const SUBAGENT_CATALOG_VERSION = 0;
|
|
12
|
-
|
|
13
|
-
export type SubagentCatalogEvent = {
|
|
14
|
-
readonly version: 0;
|
|
15
|
-
readonly childId: SessionId;
|
|
16
|
-
readonly childCreatedAt: number;
|
|
17
|
-
} & ({
|
|
12
|
+
type KnownCatalogMode = {
|
|
18
13
|
readonly mode: 'one-shot';
|
|
19
14
|
readonly label?: string;
|
|
20
15
|
} | {
|
|
21
16
|
readonly mode: 'continuable';
|
|
22
17
|
readonly label: string;
|
|
23
|
-
}
|
|
18
|
+
};
|
|
19
|
+
/** Parent catalog v0 records known modes; v1 also retains children with unknown mode. */
|
|
20
|
+
export type SubagentCatalogEvent = {
|
|
21
|
+
readonly childId: SessionId;
|
|
22
|
+
readonly childCreatedAt: number;
|
|
23
|
+
} & (({
|
|
24
|
+
readonly version: 0;
|
|
25
|
+
} & KnownCatalogMode) | ({
|
|
26
|
+
readonly version: 1;
|
|
27
|
+
} & (KnownCatalogMode | {
|
|
28
|
+
readonly mode: 'unknown';
|
|
29
|
+
readonly label?: string;
|
|
30
|
+
})));
|
|
24
31
|
declare module '@deepseek-ai/dsh-session/types' {
|
|
25
32
|
interface SessionEventMap {
|
|
26
33
|
/**
|
|
27
|
-
* A direct child's
|
|
34
|
+
* A direct child's identity and available discovery fields.
|
|
28
35
|
* @param data - versioned parent-owned catalog entry.
|
|
29
36
|
*/
|
|
30
37
|
'subagent/catalog': SubagentCatalogEvent;
|
|
@@ -41,7 +48,7 @@ declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
50
|
/**
|
|
44
|
-
* Materialize
|
|
51
|
+
* Materialize complete and unknown-mode child identities from parent catalog events.
|
|
45
52
|
* @param state - parent catalog fold state.
|
|
46
53
|
* @returns current direct-child rows in parent catalog event order.
|
|
47
54
|
*/
|
|
@@ -5,26 +5,28 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { appendChunkedList, chunkedListSchema, iterateChunkedList } from '@deepseek-ai/dsh-chunked-list';
|
|
8
|
-
/**
|
|
8
|
+
/** Catalog payload version emitted by live child creation. */
|
|
9
9
|
export const SUBAGENT_CATALOG_VERSION = 0;
|
|
10
10
|
const sessionIdSchema = z.string();
|
|
11
11
|
const oneShotCatalogSchema = z.object({
|
|
12
|
-
version: z.literal(
|
|
12
|
+
version: z.union([z.literal(0), z.literal(1)]),
|
|
13
13
|
childId: sessionIdSchema,
|
|
14
14
|
childCreatedAt: z.number().int().nonnegative(),
|
|
15
15
|
mode: z.literal('one-shot'),
|
|
16
16
|
label: z.string().optional(),
|
|
17
17
|
}).strict();
|
|
18
18
|
const continuableCatalogSchema = z.object({
|
|
19
|
-
version: z.literal(
|
|
19
|
+
version: z.union([z.literal(0), z.literal(1)]),
|
|
20
20
|
childId: sessionIdSchema,
|
|
21
21
|
childCreatedAt: z.number().int().nonnegative(),
|
|
22
22
|
mode: z.literal('continuable'),
|
|
23
23
|
label: z.string(),
|
|
24
24
|
}).strict();
|
|
25
|
+
const unknownCatalogSchema = oneShotCatalogSchema.extend({ version: z.literal(1), mode: z.literal('unknown') });
|
|
25
26
|
const eventDataSchema = z.union([
|
|
26
27
|
oneShotCatalogSchema,
|
|
27
28
|
continuableCatalogSchema,
|
|
29
|
+
unknownCatalogSchema,
|
|
28
30
|
]);
|
|
29
31
|
const viewSchema = z.array(z.union([
|
|
30
32
|
oneShotCatalogSchema.omit({ version: true, childId: true, childCreatedAt: true }).extend({
|
|
@@ -35,20 +37,24 @@ const viewSchema = z.array(z.union([
|
|
|
35
37
|
id: sessionIdSchema,
|
|
36
38
|
createdAt: continuableCatalogSchema.shape.childCreatedAt,
|
|
37
39
|
}),
|
|
40
|
+
unknownCatalogSchema.omit({ version: true, childId: true, childCreatedAt: true }).extend({
|
|
41
|
+
id: sessionIdSchema,
|
|
42
|
+
createdAt: unknownCatalogSchema.shape.childCreatedAt,
|
|
43
|
+
}),
|
|
38
44
|
]));
|
|
39
45
|
const stateSchema = z.object({
|
|
40
46
|
inheritedEventCount: z.number().int().nonnegative(),
|
|
41
47
|
head: chunkedListSchema(eventDataSchema).optional(),
|
|
42
48
|
}).strict();
|
|
43
49
|
/**
|
|
44
|
-
* Materialize
|
|
50
|
+
* Materialize complete and unknown-mode child identities from parent catalog events.
|
|
45
51
|
* @param state - parent catalog fold state.
|
|
46
52
|
* @returns current direct-child rows in parent catalog event order.
|
|
47
53
|
*/
|
|
48
54
|
function subagentCatalogEntries(state) {
|
|
49
55
|
const entries = [];
|
|
50
56
|
for (const data of iterateChunkedList(state.head)) {
|
|
51
|
-
entries.push(data.mode
|
|
57
|
+
entries.push(data.mode !== 'continuable'
|
|
52
58
|
? {
|
|
53
59
|
id: data.childId,
|
|
54
60
|
createdAt: data.childCreatedAt,
|
|
@@ -74,7 +80,7 @@ export const subagentCatalogProjectionDefinition = {
|
|
|
74
80
|
return state;
|
|
75
81
|
return { ...state, head: appendChunkedList(state.head, eventDataSchema.parse(event.data)) };
|
|
76
82
|
},
|
|
77
|
-
stateVersion:
|
|
83
|
+
stateVersion: 3,
|
|
78
84
|
wire: { viewSchema, view: subagentCatalogEntries },
|
|
79
85
|
};
|
|
80
86
|
/**
|
|
@@ -106,6 +106,8 @@ export declare const SUBAGENT_DELEGATION_CONTEXT: string;
|
|
|
106
106
|
export declare function applyChildComposition(childCtx: Context, parent: Agent, composition: ChildComposition): void;
|
|
107
107
|
/** Policy seeded onto a child session's log at the delegation boundary. */
|
|
108
108
|
export interface DelegatedPolicyOverrides {
|
|
109
|
+
/** The shared-bundle preset identity when the parent currently runs in Auto or Full access. */
|
|
110
|
+
readonly permissionPreset: 'auto' | 'danger-full-access' | undefined;
|
|
109
111
|
/** The parent session's explicit sandbox-mode override, or `undefined` without one. */
|
|
110
112
|
readonly sandboxMode: SandboxMode | undefined;
|
|
111
113
|
/**
|
|
@@ -116,12 +118,13 @@ export interface DelegatedPolicyOverrides {
|
|
|
116
118
|
readonly approvalPolicy: 'never' | undefined;
|
|
117
119
|
}
|
|
118
120
|
/**
|
|
119
|
-
* Capture the
|
|
121
|
+
* Capture the permission state to seed into one delegation. Call synchronously before
|
|
120
122
|
* the child start's first await: a later parent switch belongs to the
|
|
121
|
-
* parent's future, not to this child.
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
123
|
+
* parent's future, not to this child. Auto and Full access identities are
|
|
124
|
+
* inherited only through the in-process DSH path so either can replace a stale
|
|
125
|
+
* same-bundle fork value. Only the parent session's explicit sandbox override
|
|
126
|
+
* is captured — never deployment defaults or one-shot grants — and the approval
|
|
127
|
+
* policy is pinned to `'never'` regardless of the parent's own policy.
|
|
125
128
|
* @param parent - the delegating parent agent.
|
|
126
129
|
* @returns the sandbox override (or `undefined` without one) and the approval pin.
|
|
127
130
|
*/
|
|
@@ -172,17 +172,20 @@ export function applyChildComposition(childCtx, parent, composition) {
|
|
|
172
172
|
childCtx.tools.restrict(composition.toolFilter);
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
|
-
* Capture the
|
|
175
|
+
* Capture the permission state to seed into one delegation. Call synchronously before
|
|
176
176
|
* the child start's first await: a later parent switch belongs to the
|
|
177
|
-
* parent's future, not to this child.
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
177
|
+
* parent's future, not to this child. Auto and Full access identities are
|
|
178
|
+
* inherited only through the in-process DSH path so either can replace a stale
|
|
179
|
+
* same-bundle fork value. Only the parent session's explicit sandbox override
|
|
180
|
+
* is captured — never deployment defaults or one-shot grants — and the approval
|
|
181
|
+
* policy is pinned to `'never'` regardless of the parent's own policy.
|
|
181
182
|
* @param parent - the delegating parent agent.
|
|
182
183
|
* @returns the sandbox override (or `undefined` without one) and the approval pin.
|
|
183
184
|
*/
|
|
184
185
|
export function captureDelegatedPolicyOverrides(parent) {
|
|
186
|
+
const preset = parent.ctx.get('permissionPresets')?.current(parent.session);
|
|
185
187
|
return {
|
|
188
|
+
permissionPreset: preset === 'auto' || preset === 'danger-full-access' ? preset : undefined,
|
|
186
189
|
sandboxMode: parent.ctx.get('sandboxPolicy')?.overrideOf(parent.session),
|
|
187
190
|
approvalPolicy: parent.ctx.get('approval') === undefined ? undefined : 'never',
|
|
188
191
|
};
|
|
@@ -203,5 +206,8 @@ export function appendDelegatedPolicyOverrides(childSession, overrides) {
|
|
|
203
206
|
if (overrides.approvalPolicy !== undefined) {
|
|
204
207
|
childSession.append('approval/policy', { policy: overrides.approvalPolicy, source: 'delegation' });
|
|
205
208
|
}
|
|
209
|
+
if (overrides.permissionPreset !== undefined) {
|
|
210
|
+
childSession.append('permission/preset', { preset: overrides.permissionPreset });
|
|
211
|
+
}
|
|
206
212
|
}
|
|
207
213
|
//# sourceMappingURL=child-agent.js.map
|
|
@@ -18,12 +18,22 @@ import type { SubagentDescriptorData } from './descriptor.ts';
|
|
|
18
18
|
import { SubagentInbox } from './inbox.ts';
|
|
19
19
|
import type { SubagentDelivery } from './inbox.ts';
|
|
20
20
|
import type { ActivationObserver } from './lifecycle.ts';
|
|
21
|
+
/** Process-local slots shared through uninterrupted continuable parent links. */
|
|
22
|
+
declare class ActivationPool {
|
|
23
|
+
private readonly slots;
|
|
24
|
+
/** Reserve before reconstruction; the returned release also tolerates unpublished rollback. */
|
|
25
|
+
reserve(capacity: number): () => void;
|
|
26
|
+
}
|
|
21
27
|
/**
|
|
22
28
|
* One residency epoch for a reconstructed continuable child Agent. It directly
|
|
23
29
|
* owns the published `AgentHandle`; the registry's private activation-owner
|
|
24
30
|
* scope is its structural Cordis owner.
|
|
25
31
|
*/
|
|
26
32
|
export interface Activation {
|
|
33
|
+
/** Shared capacity for this Activation and all its continuable descendants. */
|
|
34
|
+
readonly pool: ActivationPool;
|
|
35
|
+
/** Return this epoch's slot after its handle has finished disposal. */
|
|
36
|
+
readonly releaseSlot: () => void;
|
|
27
37
|
/** The durable child this Activation is an epoch of. */
|
|
28
38
|
readonly childId: SessionId;
|
|
29
39
|
/**
|
|
@@ -104,8 +114,11 @@ export declare class ChildLock {
|
|
|
104
114
|
export declare class ContinuableActivationRegistry {
|
|
105
115
|
private readonly ctx;
|
|
106
116
|
private readonly observeActivation;
|
|
117
|
+
private readonly maxActiveSubagents;
|
|
107
118
|
/** Child session id → its live Activation. Process-local, never durable. */
|
|
108
119
|
private readonly resident;
|
|
120
|
+
/** Root identities retain their pool across child settlement without retaining dead roots. */
|
|
121
|
+
private readonly rootPools;
|
|
109
122
|
/** Materializations admitted before drain, tracked through publication or rollback. */
|
|
110
123
|
private readonly materializations;
|
|
111
124
|
/** Per-child serializer shared by delivery, release, and disposal. */
|
|
@@ -125,7 +138,7 @@ export declare class ContinuableActivationRegistry {
|
|
|
125
138
|
* @param ctx - context providing Agents, Sessions, and teardown ownership.
|
|
126
139
|
* @param observeActivation - build the lifecycle observer for one residency epoch.
|
|
127
140
|
*/
|
|
128
|
-
constructor(ctx: Context, observeActivation: (provider: string, childId: SessionId, parent: Agent) => ActivationObserver);
|
|
141
|
+
constructor(ctx: Context, observeActivation: (provider: string, childId: SessionId, parent: Agent) => ActivationObserver, maxActiveSubagents: () => number);
|
|
129
142
|
/**
|
|
130
143
|
* Return the live Activation for a durable child id, if resident.
|
|
131
144
|
* @param childId - durable child session id to look up.
|
|
@@ -227,6 +240,8 @@ export declare class ContinuableActivationRegistry {
|
|
|
227
240
|
private liveLineage;
|
|
228
241
|
/** Return the teardown that closed continuable admission for this agent's lineage. */
|
|
229
242
|
private closingTeardownFor;
|
|
243
|
+
/** Resolve a root's pool once; descendants inherit their resident parent's pool directly. */
|
|
244
|
+
private rootPool;
|
|
230
245
|
/** Perform one tracked materialization through publication or rollback. */
|
|
231
246
|
private materializeTracked;
|
|
232
247
|
/** Release an Activation whose start edge was not published. */
|
|
@@ -248,4 +263,5 @@ export declare class ContinuableActivationRegistry {
|
|
|
248
263
|
/** Request a best-effort final session flush before closing natural-settlement admission. */
|
|
249
264
|
private flushFinalState;
|
|
250
265
|
}
|
|
266
|
+
export {};
|
|
251
267
|
//# sourceMappingURL=continuation-activation.d.ts.map
|