@xneog/dsh-subagent 0.1.0 → 0.1.3-alpha.1
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 +108 -76
- package/README.zh.md +112 -80
- package/lib/index.js +1258 -718
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +923 -0
- package/lib/typert.remote-client.d.ts +27 -0
- package/lib/typert.remote-client.js +159 -0
- package/lib/types/assistant-output.d.ts +3 -3
- package/lib/types/assistant-output.js +8 -4
- package/lib/types/child-agent.d.ts +16 -5
- package/lib/types/child-agent.js +51 -13
- package/lib/types/client.d.ts +2 -1
- package/lib/types/client.js +1 -1
- package/lib/types/continuation.d.ts +100 -72
- package/lib/types/continuation.js +439 -169
- 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-seed.d.ts +1 -1
- package/lib/types/descriptor-seed.js +1 -1
- package/lib/types/descriptor.d.ts +6 -1
- package/lib/types/descriptor.js +6 -2
- package/lib/types/index.d.ts +103 -69
- package/lib/types/index.js +436 -287
- package/lib/types/internal.d.ts +59 -0
- package/lib/types/internal.js +58 -0
- package/lib/types/lifecycle.js +4 -3
- package/lib/types/list-children.d.ts +12 -59
- package/lib/types/list-children.js +166 -101
- package/lib/types/out-of-process.d.ts +5 -2
- package/lib/types/out-of-process.js +42 -4
- package/lib/types/projection-types.d.ts +4 -3
- package/lib/types/projection.d.ts +55 -8
- package/lib/types/projection.js +33 -17
- package/lib/types/run-settlement.js +17 -6
- package/lib/types/types.d.ts +25 -0
- package/package.json +67 -37
- package/lib/types/activation-setup-registry.d.ts +0 -57
- package/lib/types/activation-setup-registry.js +0 -148
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-safe subagent catalog and control vocabulary: the durable direct-child
|
|
3
|
+
* row both the listing and the browser catalog answer with, plus the
|
|
4
|
+
* browser-facing control surface's prompt, receipts, and failures.
|
|
5
|
+
*
|
|
6
|
+
* @module @xneog/dsh-subagent/control-types
|
|
7
|
+
*/
|
|
8
|
+
import type { PromptContentPart } from '@xneog/dsh-attachment/types';
|
|
9
|
+
import type { Branded } from '@xneog/dsh-brand';
|
|
10
|
+
import type { MessageId } from '@xneog/dsh-llm/brand';
|
|
11
|
+
import type { SessionId } from '@xneog/dsh-session/types';
|
|
12
|
+
/**
|
|
13
|
+
* Client-minted identity of one browser prompt, persisted on the exact accepted
|
|
14
|
+
* message. It carries the Session Controller's `session-request-id` brand so a
|
|
15
|
+
* subagent prompt and an ordinary Session prompt share one identity
|
|
16
|
+
* vocabulary; that package depends on this one, so the brand is spelled here
|
|
17
|
+
* rather than imported.
|
|
18
|
+
*/
|
|
19
|
+
export type SubagentPromptRequestId = Branded<'session-request-id'>;
|
|
20
|
+
/**
|
|
21
|
+
* One durable direct-child row, ordered by header `createdAt` with ties broken
|
|
22
|
+
* on id. Only a candidate whose durable header has `origin: 'subagent'` is
|
|
23
|
+
* interpreted. A served `subagent` projection value produces a `child`; a
|
|
24
|
+
* settled candidate whose fold served no identity produces a `diagnostic`; a
|
|
25
|
+
* running candidate without one is omitted — its descriptor may not be
|
|
26
|
+
* appended yet (the creation window). Diagnostics relay the projection fold's
|
|
27
|
+
* outcome or a failed read, never a per-child event scan, and never expose
|
|
28
|
+
* model-hidden descriptor content.
|
|
29
|
+
*/
|
|
30
|
+
export type SubagentListEntry = {
|
|
31
|
+
readonly kind: 'child';
|
|
32
|
+
/** The durable child session id, stable across Activations. */
|
|
33
|
+
readonly id: SessionId;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the child is live at the moment its reader sampled it: the
|
|
36
|
+
* durable listing reads the Session store (`running` means the logical
|
|
37
|
+
* record is resident, `inactive` that it exists only in persistence),
|
|
38
|
+
* while the browser catalog re-samples the child's Agent driver. Neither
|
|
39
|
+
* encodes a durable outcome, and a continuable child may still reject
|
|
40
|
+
* delivery as an ownership conflict.
|
|
41
|
+
*/
|
|
42
|
+
readonly activity: 'running' | 'inactive';
|
|
43
|
+
/** Whether a direct descendant has durable `origin: 'subagent'`. */
|
|
44
|
+
readonly hasChildren: boolean;
|
|
45
|
+
} & ({
|
|
46
|
+
/** A terminal one-shot child. */
|
|
47
|
+
readonly mode: 'one-shot';
|
|
48
|
+
/** Optional durable creation label from the child's descriptor. */
|
|
49
|
+
readonly label?: string;
|
|
50
|
+
} | {
|
|
51
|
+
/** A resumable conversation. */
|
|
52
|
+
readonly mode: 'continuable';
|
|
53
|
+
/** Durable creation label from the child's descriptor. */
|
|
54
|
+
readonly label: string;
|
|
55
|
+
}) | {
|
|
56
|
+
readonly kind: 'diagnostic';
|
|
57
|
+
/** The candidate's session id. */
|
|
58
|
+
readonly id: SessionId;
|
|
59
|
+
/**
|
|
60
|
+
* Why the candidate has no `child` row: `corrupt` for a settled candidate
|
|
61
|
+
* whose projection fold served no identity (a missing, malformed, or
|
|
62
|
+
* unrecognized-version descriptor — deliberately undistinguished), and
|
|
63
|
+
* for any candidate whose log makes a registered unit's fold or schema
|
|
64
|
+
* throw (deterministic data damage, contained per child); `unavailable`
|
|
65
|
+
* when the candidate's Session observation was absent or transiently
|
|
66
|
+
* unreadable (retried on the next listing). `unsupported` is never produced; it remains in the
|
|
67
|
+
* union for consumers that route on it.
|
|
68
|
+
*/
|
|
69
|
+
readonly reason: 'corrupt' | 'unsupported' | 'unavailable';
|
|
70
|
+
};
|
|
71
|
+
/** Complete direct-child catalog plus the delivery-time parent availability hint. */
|
|
72
|
+
export interface SubagentCatalog {
|
|
73
|
+
readonly entries: readonly SubagentListEntry[];
|
|
74
|
+
readonly parentAvailable: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** Durable parent/child address that selects subagent transport in the client. */
|
|
77
|
+
export type SubagentAddress = {
|
|
78
|
+
readonly parentSessionId: SessionId;
|
|
79
|
+
readonly childSessionId: SessionId;
|
|
80
|
+
} & ({
|
|
81
|
+
readonly mode: 'one-shot';
|
|
82
|
+
} | {
|
|
83
|
+
readonly mode: 'continuable';
|
|
84
|
+
});
|
|
85
|
+
/** One human message addressed to a continuable direct child. */
|
|
86
|
+
export interface SubagentPromptRequest {
|
|
87
|
+
/** Identity persisted on the accepted message, minted before the call. */
|
|
88
|
+
readonly requestId: SubagentPromptRequestId;
|
|
89
|
+
readonly parentSessionId: SessionId;
|
|
90
|
+
readonly childSessionId: SessionId;
|
|
91
|
+
/** Required discriminator retained from the browser control address. */
|
|
92
|
+
readonly mode: 'continuable';
|
|
93
|
+
/**
|
|
94
|
+
* Browser prompt parts delivered as the child's user message. The Host
|
|
95
|
+
* admits and persists image parts before delivery, so the wire never
|
|
96
|
+
* carries a durable attachment reference the caller could fabricate.
|
|
97
|
+
*/
|
|
98
|
+
readonly content: readonly PromptContentPart[];
|
|
99
|
+
/** Optional browser zone sampled for this exact human prompt. */
|
|
100
|
+
readonly clientTimeZone?: string;
|
|
101
|
+
}
|
|
102
|
+
/** Inbox identity returned once the continuation accepts one human message. */
|
|
103
|
+
export interface SubagentPromptReceipt {
|
|
104
|
+
readonly messageId: MessageId;
|
|
105
|
+
}
|
|
106
|
+
/** Uniform acknowledgement that one interrupt request was admitted. */
|
|
107
|
+
export interface SubagentInterruptReceipt {
|
|
108
|
+
readonly accepted: true;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Failure details the control surface answers with. Catalog reads, prompts,
|
|
112
|
+
* and interrupts share this vocabulary with the Client Remote result.
|
|
113
|
+
*/
|
|
114
|
+
declare module '@xneog/dsh-typert-protocol' {
|
|
115
|
+
interface RemoteErrorDetailsMap {
|
|
116
|
+
/** A browser-supplied zone is neither UTC nor a canonical IANA name. */
|
|
117
|
+
'subagent/invalid-time-zone': {
|
|
118
|
+
readonly value: string;
|
|
119
|
+
};
|
|
120
|
+
/** No live Agent carries the addressed parent session. */
|
|
121
|
+
'subagent/parent-unavailable': {
|
|
122
|
+
readonly parentSessionId: SessionId;
|
|
123
|
+
};
|
|
124
|
+
/** The addressed child cannot take a continuation. */
|
|
125
|
+
'subagent/not-resumable': {
|
|
126
|
+
readonly childSessionId: SessionId;
|
|
127
|
+
};
|
|
128
|
+
/** The claimed parent does not own the addressed child. */
|
|
129
|
+
'subagent/unauthorized': {
|
|
130
|
+
readonly childSessionId: SessionId;
|
|
131
|
+
};
|
|
132
|
+
/** Image admission or model image-capability refusal. */
|
|
133
|
+
'subagent/attachment-invalid': {
|
|
134
|
+
readonly reason: string;
|
|
135
|
+
};
|
|
136
|
+
/** The child exists but its inbox cannot admit the message now. */
|
|
137
|
+
'subagent/delivery-unavailable': {
|
|
138
|
+
readonly childSessionId: SessionId;
|
|
139
|
+
};
|
|
140
|
+
/** The deployment mounts no session-projection registry. */
|
|
141
|
+
'subagent/projections-unavailable': {};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=control-types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-safe subagent catalog and control vocabulary: the durable direct-child
|
|
3
|
+
* row both the listing and the browser catalog answer with, plus the
|
|
4
|
+
* browser-facing control surface's prompt, receipts, and failures.
|
|
5
|
+
*
|
|
6
|
+
* @module @xneog/dsh-subagent/control-types
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=control-types.js.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-facing subagent control assembly: the catalog view sampled against
|
|
3
|
+
* the live Agent registry, one browser zone's validation, and the stable
|
|
4
|
+
* failure codes the Remote surface answers with.
|
|
5
|
+
*
|
|
6
|
+
* @module @xneog/dsh-subagent
|
|
7
|
+
*/
|
|
8
|
+
import type { Context } from '@xneog/cordis';
|
|
9
|
+
import type { SessionId } from '@xneog/dsh-session';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import type { SubagentCatalog, SubagentListEntry } from './control-types.ts';
|
|
12
|
+
declare const CONTROL_ID_SCHEMAS: {
|
|
13
|
+
readonly 'subagent.list': z.ZodObject<{
|
|
14
|
+
parentSessionId: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
readonly 'subagent.prompt': z.ZodObject<{
|
|
17
|
+
parentSessionId: z.ZodString;
|
|
18
|
+
childSessionId: z.ZodString;
|
|
19
|
+
mode: z.ZodLiteral<"continuable">;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
readonly 'subagent.interrupt': z.ZodObject<{
|
|
22
|
+
parentSessionId: z.ZodString;
|
|
23
|
+
childSessionId: z.ZodString;
|
|
24
|
+
mode: z.ZodLiteral<"continuable">;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Apply the subagent payload checks that are stricter than generated
|
|
29
|
+
* branded-string codecs.
|
|
30
|
+
* @param method - method name carried in the failure message.
|
|
31
|
+
* @param payload - decoded control fields to validate.
|
|
32
|
+
* @throws {RemoteError} `gateway/bad-request` with the original Zod issues.
|
|
33
|
+
*/
|
|
34
|
+
export declare function validateControlRequest(method: keyof typeof CONTROL_ID_SCHEMAS, payload: unknown): void;
|
|
35
|
+
/**
|
|
36
|
+
* Project one durable listing onto the catalog view, replacing each row's
|
|
37
|
+
* store-derived activity with the live Agent driver's status and reporting
|
|
38
|
+
* whether the exact parent Agent is live. Without an Agent registry no driver
|
|
39
|
+
* runs at all, so every row is inactive and the parent is unavailable.
|
|
40
|
+
* @param ctx - Host context that may carry the Agent registry.
|
|
41
|
+
* @param parentSessionId - the listed parent.
|
|
42
|
+
* @param entries - the durable direct-child listing.
|
|
43
|
+
* @returns the catalog view answered to one browser.
|
|
44
|
+
*/
|
|
45
|
+
export declare function catalogView(ctx: Context, parentSessionId: SessionId, entries: readonly SubagentListEntry[]): SubagentCatalog;
|
|
46
|
+
/**
|
|
47
|
+
* Refuse one catalog read while preserving cancellation and a missing
|
|
48
|
+
* projections registry as distinct failures.
|
|
49
|
+
* @param error - the thrown value.
|
|
50
|
+
* @param signal - the caller's cancellation.
|
|
51
|
+
* @returns Never — the refusal is thrown.
|
|
52
|
+
* @throws {RemoteError} always.
|
|
53
|
+
*/
|
|
54
|
+
export declare function rejectCatalogRead(error: unknown, signal: AbortSignal): never;
|
|
55
|
+
/**
|
|
56
|
+
* Refuse one continuation prompt without exposing provider detail: admission
|
|
57
|
+
* failures the caller can act on keep their own code, everything else is
|
|
58
|
+
* internal.
|
|
59
|
+
* @param error - the thrown value.
|
|
60
|
+
* @param childSessionId - the addressed child.
|
|
61
|
+
* @param signal - the caller's cancellation.
|
|
62
|
+
* @returns Never — the refusal is thrown.
|
|
63
|
+
* @throws {RemoteError} always.
|
|
64
|
+
*/
|
|
65
|
+
export declare function rejectPrompt(error: unknown, childSessionId: SessionId, signal: AbortSignal): never;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=control.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-facing subagent control assembly: the catalog view sampled against
|
|
3
|
+
* the live Agent registry, one browser zone's validation, and the stable
|
|
4
|
+
* failure codes the Remote surface answers with.
|
|
5
|
+
*
|
|
6
|
+
* @module @xneog/dsh-subagent
|
|
7
|
+
*/
|
|
8
|
+
import { AttachmentError } from '@xneog/dsh-attachment';
|
|
9
|
+
import { RemoteError } from '@xneog/dsh-typert-protocol';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { SubagentError } from "./error.js";
|
|
12
|
+
const SESSION_ID_SCHEMA = z.string().min(1);
|
|
13
|
+
const CONTROL_ID_SCHEMAS = {
|
|
14
|
+
'subagent.list': z.object({ parentSessionId: SESSION_ID_SCHEMA }),
|
|
15
|
+
'subagent.prompt': z.object({
|
|
16
|
+
parentSessionId: SESSION_ID_SCHEMA,
|
|
17
|
+
childSessionId: SESSION_ID_SCHEMA,
|
|
18
|
+
mode: z.literal('continuable'),
|
|
19
|
+
}),
|
|
20
|
+
'subagent.interrupt': z.object({
|
|
21
|
+
parentSessionId: SESSION_ID_SCHEMA,
|
|
22
|
+
childSessionId: SESSION_ID_SCHEMA,
|
|
23
|
+
mode: z.literal('continuable'),
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Apply the subagent payload checks that are stricter than generated
|
|
28
|
+
* branded-string codecs.
|
|
29
|
+
* @param method - method name carried in the failure message.
|
|
30
|
+
* @param payload - decoded control fields to validate.
|
|
31
|
+
* @throws {RemoteError} `gateway/bad-request` with the original Zod issues.
|
|
32
|
+
*/
|
|
33
|
+
export function validateControlRequest(method, payload) {
|
|
34
|
+
const parsed = CONTROL_ID_SCHEMAS[method].safeParse(payload);
|
|
35
|
+
if (!parsed.success) {
|
|
36
|
+
throw new RemoteError('gateway/bad-request', `invalid payload for ${method}`, { issues: parsed.error.issues });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Project one durable listing onto the catalog view, replacing each row's
|
|
41
|
+
* store-derived activity with the live Agent driver's status and reporting
|
|
42
|
+
* whether the exact parent Agent is live. Without an Agent registry no driver
|
|
43
|
+
* runs at all, so every row is inactive and the parent is unavailable.
|
|
44
|
+
* @param ctx - Host context that may carry the Agent registry.
|
|
45
|
+
* @param parentSessionId - the listed parent.
|
|
46
|
+
* @param entries - the durable direct-child listing.
|
|
47
|
+
* @returns the catalog view answered to one browser.
|
|
48
|
+
*/
|
|
49
|
+
export function catalogView(ctx, parentSessionId, entries) {
|
|
50
|
+
const agents = ctx.get('agents');
|
|
51
|
+
return {
|
|
52
|
+
entries: entries.map((entry) => entry.kind === 'child'
|
|
53
|
+
? { ...entry, activity: agents?.get(entry.id)?.status === 'running' ? 'running' : 'inactive' }
|
|
54
|
+
: entry),
|
|
55
|
+
parentAvailable: agents?.get(parentSessionId) !== undefined,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Refuse one catalog read while preserving cancellation and a missing
|
|
60
|
+
* projections registry as distinct failures.
|
|
61
|
+
* @param error - the thrown value.
|
|
62
|
+
* @param signal - the caller's cancellation.
|
|
63
|
+
* @returns Never — the refusal is thrown.
|
|
64
|
+
* @throws {RemoteError} always.
|
|
65
|
+
*/
|
|
66
|
+
export function rejectCatalogRead(error, signal) {
|
|
67
|
+
if (isCancellation(error, signal)) {
|
|
68
|
+
throw new RemoteError('gateway/cancelled', 'subagent catalog read was cancelled', {}, { cause: error });
|
|
69
|
+
}
|
|
70
|
+
if (error instanceof SubagentError && error.code === 'SUBAGENT_CONTROL_PROJECTIONS_UNAVAILABLE') {
|
|
71
|
+
throw new RemoteError('subagent/projections-unavailable', 'subagent catalog is unavailable: this deployment does not mount the sessionProjections registry (load @xneog/dsh-session-projection)', {}, { cause: error });
|
|
72
|
+
}
|
|
73
|
+
throw new RemoteError('gateway/internal', 'subagent catalog read failed', {}, { cause: error });
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Refuse one continuation prompt without exposing provider detail: admission
|
|
77
|
+
* failures the caller can act on keep their own code, everything else is
|
|
78
|
+
* internal.
|
|
79
|
+
* @param error - the thrown value.
|
|
80
|
+
* @param childSessionId - the addressed child.
|
|
81
|
+
* @param signal - the caller's cancellation.
|
|
82
|
+
* @returns Never — the refusal is thrown.
|
|
83
|
+
* @throws {RemoteError} always.
|
|
84
|
+
*/
|
|
85
|
+
export function rejectPrompt(error, childSessionId, signal) {
|
|
86
|
+
if (isCancellation(error, signal)) {
|
|
87
|
+
throw new RemoteError('gateway/cancelled', 'subagent prompt was cancelled', {}, { cause: error });
|
|
88
|
+
}
|
|
89
|
+
if (error instanceof AttachmentError) {
|
|
90
|
+
throw new RemoteError('subagent/attachment-invalid', error.message, { reason: error.code }, { cause: error });
|
|
91
|
+
}
|
|
92
|
+
if (error instanceof SubagentError) {
|
|
93
|
+
switch (error.code) {
|
|
94
|
+
case 'MODEL_DOES_NOT_SUPPORT_IMAGES':
|
|
95
|
+
throw new RemoteError('subagent/attachment-invalid', error.message, { reason: error.code }, { cause: error });
|
|
96
|
+
case 'NOT_RESUMABLE':
|
|
97
|
+
throw new RemoteError('subagent/not-resumable', 'subagent cannot be resumed', { childSessionId }, { cause: error });
|
|
98
|
+
case 'UNAUTHORIZED':
|
|
99
|
+
throw new RemoteError('subagent/unauthorized', 'subagent does not belong to this parent', { childSessionId }, { cause: error });
|
|
100
|
+
case 'DRAINING':
|
|
101
|
+
case 'ACTIVATION_CLOSING':
|
|
102
|
+
case 'CONTINUATION_UNAVAILABLE':
|
|
103
|
+
case 'PERSISTENCE_UNAVAILABLE':
|
|
104
|
+
throw new RemoteError('subagent/delivery-unavailable', 'subagent follow-up is temporarily unavailable', { childSessionId }, { cause: error });
|
|
105
|
+
// A code outside the admission vocabulary is not the caller's move to make.
|
|
106
|
+
default:
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
throw new RemoteError('gateway/internal', 'subagent prompt failed', {}, { cause: error });
|
|
111
|
+
}
|
|
112
|
+
function isCancellation(error, signal) {
|
|
113
|
+
return signal.aborted || (error instanceof SubagentError && error.code === 'CANCELLED');
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=control.js.map
|
|
@@ -17,5 +17,5 @@ import type { SubagentDescriptorData } from './descriptor.ts';
|
|
|
17
17
|
* @param descriptor - the snapshotted composition record to persist.
|
|
18
18
|
* @returns the complete seed events, contiguous from sequence zero.
|
|
19
19
|
*/
|
|
20
|
-
export declare function seedDescriptorTurn(childId: SessionId, seed: readonly SessionEvent[] | undefined, descriptor: SubagentDescriptorData): SessionEvent[];
|
|
20
|
+
export declare function seedDescriptorTurn(childId: SessionId, seed: readonly SessionEvent[] | undefined, descriptor: SubagentDescriptorData): readonly SessionEvent[];
|
|
21
21
|
//# sourceMappingURL=descriptor-seed.d.ts.map
|
|
@@ -19,6 +19,6 @@ import { Session } from '@xneog/dsh-session';
|
|
|
19
19
|
export function seedDescriptorTurn(childId, seed, descriptor) {
|
|
20
20
|
const staged = Session.create(childId, seed);
|
|
21
21
|
staged.append('subagent/descriptor', descriptor);
|
|
22
|
-
return
|
|
22
|
+
return staged.snapshotEvents();
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=descriptor-seed.js.map
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* @module @xneog/dsh-subagent/descriptor
|
|
22
22
|
*/
|
|
23
23
|
import type { SessionEvent } from '@xneog/dsh-session';
|
|
24
|
+
import type { ReasoningEffortId } from '@xneog/dsh-llm';
|
|
24
25
|
import type { ToolRestriction } from '@xneog/dsh-tools';
|
|
25
26
|
declare module '@xneog/dsh-session/types' {
|
|
26
27
|
interface SessionEventMap {
|
|
@@ -40,7 +41,7 @@ declare module '@xneog/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 @xneog/dsh-subagent/descriptor
|
|
22
22
|
*/
|
|
23
|
-
import { snapshotJsonValue } from '@xneog/dsh-
|
|
23
|
+
import { snapshotJsonValue } from '@xneog/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
|
};
|