dsh-plugin-subagent-director 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/LICENSE +21 -0
- package/README.md +135 -0
- package/lib/bridge-contract.d.ts +41 -0
- package/lib/bridge-contract.d.ts.map +1 -0
- package/lib/bridge-contract.js +7 -0
- package/lib/bridge-contract.js.map +1 -0
- package/lib/bridge-entry.d.ts +29 -0
- package/lib/bridge-entry.d.ts.map +1 -0
- package/lib/bridge-entry.js +10 -0
- package/lib/bridge-entry.js.map +1 -0
- package/lib/client/RoleCard.d.ts +23 -0
- package/lib/client/RoleCard.d.ts.map +1 -0
- package/lib/client/RoleCard.js +72 -0
- package/lib/client/RoleCard.js.map +1 -0
- package/lib/client/SubagentModelDock.d.ts +29 -0
- package/lib/client/SubagentModelDock.d.ts.map +1 -0
- package/lib/client/SubagentModelDock.js +32 -0
- package/lib/client/SubagentModelDock.js.map +1 -0
- package/lib/client/SubagentOptionsSection.d.ts +23 -0
- package/lib/client/SubagentOptionsSection.d.ts.map +1 -0
- package/lib/client/SubagentOptionsSection.js +164 -0
- package/lib/client/SubagentOptionsSection.js.map +1 -0
- package/lib/client/index.d.ts +44 -0
- package/lib/client/index.d.ts.map +1 -0
- package/lib/client/index.js +1541 -0
- package/lib/client/index.js.map +1 -0
- package/lib/client/locales.d.ts +13 -0
- package/lib/client/locales.d.ts.map +1 -0
- package/lib/client/locales.js +107 -0
- package/lib/client/locales.js.map +1 -0
- package/lib/client/store-logic.d.ts +105 -0
- package/lib/client/store-logic.d.ts.map +1 -0
- package/lib/client/store-logic.js +143 -0
- package/lib/client/store-logic.js.map +1 -0
- package/lib/client/store.d.ts +104 -0
- package/lib/client/store.d.ts.map +1 -0
- package/lib/client/store.js +223 -0
- package/lib/client/store.js.map +1 -0
- package/lib/client/subagent-model.d.ts +47 -0
- package/lib/client/subagent-model.d.ts.map +1 -0
- package/lib/client/subagent-model.js +81 -0
- package/lib/client/subagent-model.js.map +1 -0
- package/lib/client/ui.d.ts +26 -0
- package/lib/client/ui.d.ts.map +1 -0
- package/lib/client/ui.js +102 -0
- package/lib/client/ui.js.map +1 -0
- package/lib/config.d.ts +63 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +26 -0
- package/lib/config.js.map +1 -0
- package/lib/delegation-tool.d.ts +169 -0
- package/lib/delegation-tool.d.ts.map +1 -0
- package/lib/delegation-tool.js +404 -0
- package/lib/delegation-tool.js.map +1 -0
- package/lib/envelope.d.ts +97 -0
- package/lib/envelope.d.ts.map +1 -0
- package/lib/envelope.js +136 -0
- package/lib/envelope.js.map +1 -0
- package/lib/guidance.d.ts +37 -0
- package/lib/guidance.d.ts.map +1 -0
- package/lib/guidance.js +46 -0
- package/lib/guidance.js.map +1 -0
- package/lib/index.d.ts +29 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +63 -0
- package/lib/index.js.map +1 -0
- package/lib/remote.d.ts +102 -0
- package/lib/remote.d.ts.map +1 -0
- package/lib/remote.js +254 -0
- package/lib/remote.js.map +1 -0
- package/lib/route-resolver.d.ts +118 -0
- package/lib/route-resolver.d.ts.map +1 -0
- package/lib/route-resolver.js +71 -0
- package/lib/route-resolver.js.map +1 -0
- package/lib/settings.d.ts +157 -0
- package/lib/settings.d.ts.map +1 -0
- package/lib/settings.js +118 -0
- package/lib/settings.js.map +1 -0
- package/package.json +110 -0
package/lib/remote.js
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { SettingsConflictError, settingsNamespace, } from '@deepseek-ai/dsh-settings';
|
|
2
|
+
import { SettingsSchema, SUBAGENT_DIRECTOR_SETTINGS_NAMESPACE, } from './settings.js';
|
|
3
|
+
import { SUBAGENT_DIRECTOR_RPC_VIEW, SUBAGENT_DIRECTOR_RPC_MUTATE, } from './bridge-contract.js';
|
|
4
|
+
import { SUBAGENT_DIRECTOR_ROUTE_PATH, buildServerResponse, buildMethodMismatchResponse, buildBadRequestResponse, parseClientRequestEnvelope, isLoopbackHost, endpointFromPath, } from './envelope.js';
|
|
5
|
+
/** Wire route path the bridge owns on the Host web server. */
|
|
6
|
+
export { SUBAGENT_DIRECTOR_ROUTE_PATH as SUBAGENT_DIRECTOR_RPC_CHANNEL };
|
|
7
|
+
/** Endpoint that returns the namespace's redacted wire view. */
|
|
8
|
+
export { SUBAGENT_DIRECTOR_RPC_VIEW };
|
|
9
|
+
/** Endpoint that applies one path-op mutation. */
|
|
10
|
+
export { SUBAGENT_DIRECTOR_RPC_MUTATE };
|
|
11
|
+
/**
|
|
12
|
+
* Map one redacted settings descriptor to its wire view — mirrors apiproxy's
|
|
13
|
+
* `namespaceView` (dsh-host-apiproxy/lib/index.js:2385-2399) exactly, so the
|
|
14
|
+
* client store sees the same `SettingsNamespaceView` shape it already renders.
|
|
15
|
+
*/
|
|
16
|
+
export function toDirectorNamespaceView(descriptor) {
|
|
17
|
+
return {
|
|
18
|
+
ns: String(descriptor.ns),
|
|
19
|
+
schema: descriptor.schema,
|
|
20
|
+
value: descriptor.value,
|
|
21
|
+
...(descriptor.base === undefined ? {} : { base: descriptor.base }),
|
|
22
|
+
...(descriptor.user === undefined ? {} : { user: descriptor.user }),
|
|
23
|
+
applies: descriptor.applies,
|
|
24
|
+
secrets: (descriptor.secrets ?? []).map((secret) => ({
|
|
25
|
+
path: [...secret.path],
|
|
26
|
+
set: secret.set,
|
|
27
|
+
})),
|
|
28
|
+
revision: descriptor.revision,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Find the Subagent Director namespace in a redacted describe result and map
|
|
33
|
+
* it to its wire view; `undefined` when the namespace is not registered.
|
|
34
|
+
*/
|
|
35
|
+
export function pickDirectorNamespaceView(descriptors) {
|
|
36
|
+
for (const descriptor of descriptors) {
|
|
37
|
+
if (descriptor.ns === SUBAGENT_DIRECTOR_SETTINGS_NAMESPACE) {
|
|
38
|
+
return toDirectorNamespaceView(descriptor);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Read the current redacted namespace view straight from the settings seam.
|
|
45
|
+
* Exported for reuse by tests and by the bridge handler.
|
|
46
|
+
*/
|
|
47
|
+
export function readDirectorNamespaceView(settings) {
|
|
48
|
+
const descriptors = settings.describe({ redactSecrets: true });
|
|
49
|
+
return {
|
|
50
|
+
writable: settings.writable,
|
|
51
|
+
view: pickDirectorNamespaceView(descriptors),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** Build the `settings-rejected` RPC error for one seam failure. */
|
|
55
|
+
export function directorRejected(ns, error) {
|
|
56
|
+
return {
|
|
57
|
+
code: 'settings-rejected',
|
|
58
|
+
message: error instanceof Error ? error.message : String(error),
|
|
59
|
+
details: { ns },
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** Build the `settings-conflict` RPC error, mirroring apiproxy's mapping. */
|
|
63
|
+
export function directorConflict(conflict) {
|
|
64
|
+
// The runtime carries the branded namespace; the service type does not
|
|
65
|
+
// declare it, so recover it structurally for the details payload.
|
|
66
|
+
const ns = conflict.ns;
|
|
67
|
+
return {
|
|
68
|
+
code: 'settings-conflict',
|
|
69
|
+
message: conflict.message,
|
|
70
|
+
details: {
|
|
71
|
+
ns: ns === undefined ? 'subagent-director' : String(ns),
|
|
72
|
+
expected: conflict.expected,
|
|
73
|
+
actual: conflict.actual,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Build the ok payload for the settingsView endpoint.
|
|
79
|
+
* Mirrors the apiproxy `settings.describe` value minus `hasDocument` (the
|
|
80
|
+
* bridge does not own the document affordance; the client ignores it).
|
|
81
|
+
*/
|
|
82
|
+
export function directorViewOk(settings) {
|
|
83
|
+
return { ok: true, value: readDirectorNamespaceView(settings) };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Execute one path-op mutation against the settings seam and map the outcome
|
|
87
|
+
* to an RpcResult carrying the new redacted view (or a `settings-conflict` /
|
|
88
|
+
* `settings-rejected` error). Pure over the injected primitives for testing.
|
|
89
|
+
*/
|
|
90
|
+
export async function directorMutate(mutate, describe, ns, ops, expectedRevision) {
|
|
91
|
+
const branded = settingsNamespace(ns);
|
|
92
|
+
try {
|
|
93
|
+
await mutate(branded, ops, expectedRevision);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
if (error instanceof SettingsConflictError) {
|
|
97
|
+
return { ok: false, error: directorConflict(error) };
|
|
98
|
+
}
|
|
99
|
+
return { ok: false, error: directorRejected(ns, error) };
|
|
100
|
+
}
|
|
101
|
+
const descriptor = describe({ redactSecrets: true }).find((candidate) => candidate.ns === branded);
|
|
102
|
+
if (descriptor === undefined) {
|
|
103
|
+
return {
|
|
104
|
+
ok: false,
|
|
105
|
+
error: {
|
|
106
|
+
code: 'internal',
|
|
107
|
+
message: 'settings namespace "' + ns + '" was disposed after the mutate',
|
|
108
|
+
details: {},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return { ok: true, value: toDirectorNamespaceView(descriptor) };
|
|
113
|
+
}
|
|
114
|
+
/** Re-export the wire-envelope helpers so tests import them from one place. */
|
|
115
|
+
export { parseClientRequestEnvelope, isLoopbackHost, isLoopbackHostname, endpointFromPath, buildServerResponse, buildMethodMismatchResponse, buildBadRequestResponse, INVALID_REQUEST_RPC_ID, } from './envelope.js';
|
|
116
|
+
/**
|
|
117
|
+
* The node:http handler for the "/subagent-director" prefix route. Owns the
|
|
118
|
+
* full response lifecycle. Wire contract mirrors the generic Connection RPC
|
|
119
|
+
* channel (dsh-client-connection/lib/index.js:275-328):
|
|
120
|
+
* - non-POST → 404 "not found"
|
|
121
|
+
* - wrong content-type → 415
|
|
122
|
+
* - unparseable JSON body → 400 "body is not JSON"
|
|
123
|
+
* - malformed client-request envelope → 200 bad-request (fixed rpcId)
|
|
124
|
+
* - method vs endpoint mismatch → 200 bad-request
|
|
125
|
+
* - non-loopback Host header → 403 "forbidden" (lightweight trust fence)
|
|
126
|
+
* - dispatch error → 500 "handler failure: ..."
|
|
127
|
+
*/
|
|
128
|
+
export function handleDirectorBridgeRequest(settings, req, res) {
|
|
129
|
+
return handleDirectorBridgeRequestInner(settings, req.url ?? '/', req.headers.host, req, res);
|
|
130
|
+
}
|
|
131
|
+
async function handleDirectorBridgeRequestInner(settings, rawUrl, hostHeader, req, res) {
|
|
132
|
+
// Non-POST → 404.
|
|
133
|
+
if (req.method !== 'POST') {
|
|
134
|
+
sendPlain(res, 404, 'not found');
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
// Content type must be application/json → 415.
|
|
138
|
+
const contentType = (req.headers['content-type'] ?? '').split(';', 1)[0].trim().toLowerCase();
|
|
139
|
+
if (contentType !== 'application/json') {
|
|
140
|
+
sendPlain(res, 415, 'content type must be application/json');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
// Loopback Host fence → 403.
|
|
144
|
+
if (hostHeader === undefined || !isLoopbackHost(hostHeader)) {
|
|
145
|
+
sendPlain(res, 403, 'forbidden');
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// Read the JSON body → 400 on unparseable.
|
|
149
|
+
const raw = await readBody(req);
|
|
150
|
+
let body;
|
|
151
|
+
try {
|
|
152
|
+
body = raw.length === 0 ? {} : JSON.parse(raw);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
sendPlain(res, 400, 'body is not JSON');
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
// Envelope validation → 200 bad-request.
|
|
159
|
+
const parsed = parseClientRequestEnvelope(body);
|
|
160
|
+
if (!parsed.ok) {
|
|
161
|
+
sendJson(res, 200, buildBadRequestResponse(parsed.issues));
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const envelope = parsed.envelope;
|
|
165
|
+
// Method must match the path-derived endpoint.
|
|
166
|
+
const endpoint = endpointFromPath(SUBAGENT_DIRECTOR_ROUTE_PATH, pathnameOf(rawUrl));
|
|
167
|
+
if (endpoint === undefined || envelope.method !== endpoint) {
|
|
168
|
+
sendJson(res, 200, buildMethodMismatchResponse(envelope.rpcId, envelope.method, endpoint ?? '(invalid path)'));
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
// Dispatch.
|
|
172
|
+
const result = await dispatchBridgeEndpoint(settings, endpoint, envelope.payload);
|
|
173
|
+
sendJson(res, 200, buildServerResponse(envelope.rpcId, result));
|
|
174
|
+
}
|
|
175
|
+
/** Dispatch one validated endpoint to the settings seam. Throws on unknown endpoint. */
|
|
176
|
+
async function dispatchBridgeEndpoint(settings, endpoint, payload) {
|
|
177
|
+
if (endpoint === SUBAGENT_DIRECTOR_RPC_VIEW) {
|
|
178
|
+
return directorViewOk(settings);
|
|
179
|
+
}
|
|
180
|
+
if (endpoint === SUBAGENT_DIRECTOR_RPC_MUTATE) {
|
|
181
|
+
const request = payload;
|
|
182
|
+
if (request?.ns !== String(SUBAGENT_DIRECTOR_SETTINGS_NAMESPACE)) {
|
|
183
|
+
return {
|
|
184
|
+
ok: false,
|
|
185
|
+
error: {
|
|
186
|
+
code: 'bad-request',
|
|
187
|
+
message: 'settingsMutate: expected ns "' + String(SUBAGENT_DIRECTOR_SETTINGS_NAMESPACE) + '"',
|
|
188
|
+
details: { issues: [] },
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
const ops = (request?.ops ?? []);
|
|
193
|
+
return directorMutate((n, o, r) => settings.mutate(n, o, r), (opts) => settings.describe(opts), String(SUBAGENT_DIRECTOR_SETTINGS_NAMESPACE), ops, request?.expectedRevision);
|
|
194
|
+
}
|
|
195
|
+
throw new Error('unknown bridge endpoint ' + JSON.stringify(endpoint));
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Install the Subagent Director setting bridge on the Host web server via a
|
|
199
|
+
* self-published prefix route. Lazy-acquires `ctx.webServer`; a deployment
|
|
200
|
+
* without that service (e.g. headless) logs a debug line naming the missing
|
|
201
|
+
* service and installs nothing. Returns a disposer.
|
|
202
|
+
*/
|
|
203
|
+
export function installDirectorRemoteBridge(ctx) {
|
|
204
|
+
const settings = ctx.get('settings');
|
|
205
|
+
const webServer = ctx.get('webServer');
|
|
206
|
+
if (settings === undefined || webServer === undefined) {
|
|
207
|
+
ctx.logger.debug('[subagent-director] settings bridge not installed ' +
|
|
208
|
+
'(settings:' + String(settings !== undefined) +
|
|
209
|
+
', webServer:' + String(webServer !== undefined) + ')');
|
|
210
|
+
return () => { };
|
|
211
|
+
}
|
|
212
|
+
const handler = (req, res) => {
|
|
213
|
+
handleDirectorBridgeRequest(settings, req, res).catch((error) => {
|
|
214
|
+
// Dispatch throw (unknown endpoint or a settings seam blow-up) → 500.
|
|
215
|
+
if (res.headersSent) {
|
|
216
|
+
res.destroy();
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
sendPlain(res, 500, 'handler failure: ' + String(error));
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
return ctx.effect(() => webServer.register({ kind: 'prefix', path: SUBAGENT_DIRECTOR_ROUTE_PATH, handler }), 'subagent-director: settings bridge route');
|
|
223
|
+
}
|
|
224
|
+
/** Collect the full request body as a UTF-8 string. */
|
|
225
|
+
function readBody(req) {
|
|
226
|
+
return new Promise((resolve, reject) => {
|
|
227
|
+
const chunks = [];
|
|
228
|
+
req.on('data', (chunk) => chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)));
|
|
229
|
+
req.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
|
|
230
|
+
req.on('error', reject);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/** Pathname portion of a raw request URL (safe for endpointFromPath). */
|
|
234
|
+
function pathnameOf(rawUrl) {
|
|
235
|
+
try {
|
|
236
|
+
return new URL(rawUrl, 'http://dsh.internal').pathname;
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
return rawUrl;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/** Write a plain-text response with the given status. */
|
|
243
|
+
function sendPlain(res, status, text) {
|
|
244
|
+
res.writeHead(status, { 'content-type': 'text/plain; charset=utf-8' });
|
|
245
|
+
res.end(text);
|
|
246
|
+
}
|
|
247
|
+
/** Write a JSON response with the given status. */
|
|
248
|
+
function sendJson(res, status, payload) {
|
|
249
|
+
res.writeHead(status, { 'content-type': 'application/json; charset=utf-8' });
|
|
250
|
+
res.end(JSON.stringify(payload));
|
|
251
|
+
}
|
|
252
|
+
/** Convenience re-export for the namespaced schema used to document the view. */
|
|
253
|
+
export { SettingsSchema };
|
|
254
|
+
//# sourceMappingURL=remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAgCA,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAGlB,MAAM,2BAA2B,CAAC;AAQnC,OAAO,EACL,cAAc,EACd,oCAAoC,GACrC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,GAG7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,cAAc,EACd,gBAAgB,GAEjB,MAAM,eAAe,CAAC;AAEvB,8DAA8D;AAC9D,OAAO,EAAE,4BAA4B,IAAI,6BAA6B,EAAE,CAAC;AACzE,gEAAgE;AAChE,OAAO,EAAE,0BAA0B,EAAE,CAAC;AACtC,kDAAkD;AAClD,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAIxC;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,UAA8B;IACpE,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QACzB,MAAM,EAAE,UAAU,CAAC,MAAM;QAC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Ac,EAAE,2BAA2B,EAAE,CAAC,CAAC;IACvE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,mDAAmD;AACnD,SAAS,QAAQ,CAAC,GAAmB,EAAE,MAAc,EAAE,OAA+B;IACpF,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,cAAc,EAAE,iCAAiC,EAAE,CAAC,CAAC;IAC7E,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;AACnC,CAAC;AAED,iFAAiF;AACjF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route resolver - the pure-function core of Subagent Director (design section 6).
|
|
3
|
+
*
|
|
4
|
+
* Resolves which LLM provider/model an agentOptions should carry for one
|
|
5
|
+
* subagent delegation, walking the four-layer fallback chain:
|
|
6
|
+
*
|
|
7
|
+
* 1. call - explicit arguments on the tool call (per-call override)
|
|
8
|
+
* 2. role - the role template bound by args.role (or defaultRole)
|
|
9
|
+
* 3. default - plugin default provider/model from settings
|
|
10
|
+
* 4. inherit - nothing configured: do NOT inject anything, let the seam
|
|
11
|
+
* inherit the parent agent (zero intrusion, AC-3.2)
|
|
12
|
+
*
|
|
13
|
+
* Field resolution is independent: each of provider/model/reasoningEffort is
|
|
14
|
+
* filled by the highest-priority layer that specifies it. persona and
|
|
15
|
+
* toolFilter come ONLY from the role layer.
|
|
16
|
+
*
|
|
17
|
+
* The function is pure, synchronous, and side-effect-free (<1ms) so it is
|
|
18
|
+
* trivially unit-testable and replayable (FR-3.3, NFR-2).
|
|
19
|
+
*
|
|
20
|
+
* NOTE on the layer field: because resolution is field-level independent, one
|
|
21
|
+
* delegation can draw different fields from different layers. layer reports
|
|
22
|
+
* the highest-priority layer that contributed at least one resolved
|
|
23
|
+
* agentOptions field ('inherit' when none did) - a single value kept for
|
|
24
|
+
* observability (section 10), while per-field provenance lives implicitly in
|
|
25
|
+
* the resolved fields.
|
|
26
|
+
*
|
|
27
|
+
* NOTE on reasoningEffort: the DSH AgentOptions shape only carries
|
|
28
|
+
* provider/model/maxTokens (dsh-agent runtime-types). reasoningEffort is
|
|
29
|
+
* therefore surfaced on the result SEPARATELY from agentOptions so a caller
|
|
30
|
+
* can surface/validate it without pretending it belongs on
|
|
31
|
+
* SubagentStartRequest.agentOptions.
|
|
32
|
+
*/
|
|
33
|
+
import type { AgentOptions } from '@deepseek-ai/dsh-agent';
|
|
34
|
+
/** Which layer supplied the resolved agentOptions fields. */
|
|
35
|
+
export type RouteLayer = 'call' | 'role' | 'default' | 'inherit';
|
|
36
|
+
/** A user-defined role template (design section 5.2). */
|
|
37
|
+
export interface RoleTemplate {
|
|
38
|
+
/** Required, non-empty display name. */
|
|
39
|
+
displayName: string;
|
|
40
|
+
/** Required, non-empty delegation guidance shown to the main agent. */
|
|
41
|
+
description: string;
|
|
42
|
+
/** Persona text injected into the subagent (role-layer only). */
|
|
43
|
+
persona?: string;
|
|
44
|
+
/** LLM route provider override (role-layer only). */
|
|
45
|
+
provider?: string;
|
|
46
|
+
/** Model id override (role-layer only). */
|
|
47
|
+
model?: string;
|
|
48
|
+
/** Reasoning effort override (role-layer only; advisory). */
|
|
49
|
+
reasoningEffort?: string;
|
|
50
|
+
/** Tool scoping (role-layer only; requires toolFilter capability at runtime). */
|
|
51
|
+
toolFilter?: {
|
|
52
|
+
allow?: string[];
|
|
53
|
+
deny?: string[];
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Subagent Director settings namespace (design section 5.2). */
|
|
57
|
+
export interface SubagentDirectorSettings {
|
|
58
|
+
/** Default LLM route provider (default-layer). */
|
|
59
|
+
defaultProvider?: string;
|
|
60
|
+
/** Default model id (default-layer). */
|
|
61
|
+
defaultModel?: string;
|
|
62
|
+
/** Default reasoning effort (default-layer; advisory). */
|
|
63
|
+
defaultReasoningEffort?: string;
|
|
64
|
+
/** Id of the role template used when no role is given (default-layer). */
|
|
65
|
+
defaultRole?: string;
|
|
66
|
+
/** Whether an invalid role-bound model falls back to the parent (default true). */
|
|
67
|
+
fallbackOnInvalid?: boolean;
|
|
68
|
+
/** Named role templates. */
|
|
69
|
+
roles?: Record<string, RoleTemplate>;
|
|
70
|
+
}
|
|
71
|
+
/** Explicit per-call arguments accepted by the subagent_role tool. */
|
|
72
|
+
export interface RouteCallArgs {
|
|
73
|
+
role?: string;
|
|
74
|
+
provider?: string;
|
|
75
|
+
model?: string;
|
|
76
|
+
reasoningEffort?: string;
|
|
77
|
+
}
|
|
78
|
+
/** The parent agent's options (inherit-layer reference; not injected). */
|
|
79
|
+
export interface RouteParent {
|
|
80
|
+
provider?: string;
|
|
81
|
+
model?: string;
|
|
82
|
+
}
|
|
83
|
+
/** Inputs to a single route resolution. */
|
|
84
|
+
export interface RouteInput {
|
|
85
|
+
args?: RouteCallArgs;
|
|
86
|
+
settings: SubagentDirectorSettings;
|
|
87
|
+
parent?: RouteParent;
|
|
88
|
+
}
|
|
89
|
+
/** A tool scoping restriction mirroring dsh-tools ToolRestriction. */
|
|
90
|
+
export interface RouteToolFilter {
|
|
91
|
+
allow?: string[];
|
|
92
|
+
deny?: string[];
|
|
93
|
+
}
|
|
94
|
+
/** The result of one route resolution. */
|
|
95
|
+
export interface RouteResult {
|
|
96
|
+
/** Highest-priority layer that supplied a resolved agentOptions field. */
|
|
97
|
+
layer: RouteLayer;
|
|
98
|
+
/**
|
|
99
|
+
* Resolved provider/model overrides to inject into
|
|
100
|
+
* SubagentStartRequest.agentOptions. Present (non-empty) only when a
|
|
101
|
+
* non-inherit layer configured at least one of these fields; otherwise
|
|
102
|
+
* undefined so the seam inherits the parent (AC-3.2).
|
|
103
|
+
*/
|
|
104
|
+
agentOptions?: Pick<AgentOptions, 'provider' | 'model'>;
|
|
105
|
+
/** Resolved reasoning effort (advisory; NOT part of AgentOptions). */
|
|
106
|
+
reasoningEffort?: string;
|
|
107
|
+
/** Resolved role id when a valid role template was bound (role layer). */
|
|
108
|
+
roleId?: string;
|
|
109
|
+
/** Persona contributed by the role layer, when a valid role was bound. */
|
|
110
|
+
persona?: string;
|
|
111
|
+
/** Tool filter contributed by the role layer, when a valid role was bound. */
|
|
112
|
+
toolFilter?: RouteToolFilter;
|
|
113
|
+
/** Human-readable warnings for degraded references (nonexistent role, etc.). */
|
|
114
|
+
warnings: string[];
|
|
115
|
+
}
|
|
116
|
+
/** Core pure resolution logic. */
|
|
117
|
+
export declare function resolveRoute(input: RouteInput): RouteResult;
|
|
118
|
+
//# sourceMappingURL=route-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-resolver.d.ts","sourceRoot":"","sources":["../src/route-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,6DAA6D;AAC7D,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAEjE,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iFAAiF;IACjF,UAAU,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CACpD;AAED,iEAAiE;AACjE,MAAM,WAAW,wBAAwB;IACvC,kDAAkD;IAClD,eAAe,CAAC,EAAE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IACjB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,gFAAgF;IAChF,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAMD,kCAAkC;AAClC,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CA2E3D"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function isEmpty(value) {
|
|
2
|
+
return value === undefined || value === '';
|
|
3
|
+
}
|
|
4
|
+
/** Core pure resolution logic. */
|
|
5
|
+
export function resolveRoute(input) {
|
|
6
|
+
const { args = {}, settings, parent } = input;
|
|
7
|
+
const warnings = [];
|
|
8
|
+
// ---- Layer 1: per-call explicit arguments -------------------------------
|
|
9
|
+
const callProvider = isEmpty(args.provider) ? undefined : args.provider;
|
|
10
|
+
const callModel = isEmpty(args.model) ? undefined : args.model;
|
|
11
|
+
const callEffort = isEmpty(args.reasoningEffort) ? undefined : args.reasoningEffort;
|
|
12
|
+
// ---- Layer 2: role template ----------------------------------------------
|
|
13
|
+
const roles = settings.roles ?? {};
|
|
14
|
+
const explicitRole = isEmpty(args.role) ? undefined : args.role;
|
|
15
|
+
const roleIdRaw = explicitRole ?? settings.defaultRole;
|
|
16
|
+
let role;
|
|
17
|
+
let resolvedRoleId;
|
|
18
|
+
if (roleIdRaw !== undefined) {
|
|
19
|
+
const bound = roles[roleIdRaw];
|
|
20
|
+
if (bound !== undefined) {
|
|
21
|
+
role = bound;
|
|
22
|
+
resolvedRoleId = roleIdRaw;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
warnings.push('subagent-director: role "' + roleIdRaw + '" does not exist; its binding (persona/provider/model) is skipped');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const roleProvider = role === undefined || isEmpty(role.provider) ? undefined : role.provider;
|
|
29
|
+
const roleModel = role === undefined || isEmpty(role.model) ? undefined : role.model;
|
|
30
|
+
const roleEffort = role === undefined || isEmpty(role.reasoningEffort) ? undefined : role.reasoningEffort;
|
|
31
|
+
// ---- Layer 3: plugin defaults ----------------------------------------------
|
|
32
|
+
const defaultProvider = isEmpty(settings.defaultProvider) ? undefined : settings.defaultProvider;
|
|
33
|
+
const defaultModel = isEmpty(settings.defaultModel) ? undefined : settings.defaultModel;
|
|
34
|
+
const defaultEffort = isEmpty(settings.defaultReasoningEffort)
|
|
35
|
+
? undefined
|
|
36
|
+
: settings.defaultReasoningEffort;
|
|
37
|
+
// ---- Field-level resolution: highest-priority layer per field --------------
|
|
38
|
+
const provider = callProvider ?? roleProvider ?? defaultProvider;
|
|
39
|
+
const model = callModel ?? roleModel ?? defaultModel;
|
|
40
|
+
const reasoningEffort = callEffort ?? roleEffort ?? defaultEffort;
|
|
41
|
+
// ---- Build the output -------------------------------------------------------
|
|
42
|
+
const agentOptions = provider !== undefined || model !== undefined
|
|
43
|
+
? {
|
|
44
|
+
...(provider !== undefined ? { provider } : {}),
|
|
45
|
+
...(model !== undefined ? { model } : {}),
|
|
46
|
+
}
|
|
47
|
+
: undefined;
|
|
48
|
+
// Determine the dominant (highest-priority) contributing layer for agentOptions.
|
|
49
|
+
let layer = 'inherit';
|
|
50
|
+
if (provider !== undefined || model !== undefined) {
|
|
51
|
+
if (callProvider !== undefined || callModel !== undefined) {
|
|
52
|
+
layer = 'call';
|
|
53
|
+
}
|
|
54
|
+
else if (roleProvider !== undefined || roleModel !== undefined) {
|
|
55
|
+
layer = 'role';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
layer = 'default';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
layer,
|
|
63
|
+
...(agentOptions !== undefined ? { agentOptions } : {}),
|
|
64
|
+
...(reasoningEffort !== undefined ? { reasoningEffort } : {}),
|
|
65
|
+
...(resolvedRoleId !== undefined ? { roleId: resolvedRoleId } : {}),
|
|
66
|
+
...(role !== undefined && !isEmpty(role.persona) ? { persona: role.persona } : {}),
|
|
67
|
+
...(role !== undefined && role.toolFilter !== undefined ? { toolFilter: role.toolFilter } : {}),
|
|
68
|
+
warnings,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=route-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-resolver.js","sourceRoot":"","sources":["../src/route-resolver.ts"],"names":[],"mappings":"AAyHA,SAAS,OAAO,CAAC,KAAyB;IACxC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,CAAC;AAC7C,CAAC;AAED,kCAAkC;AAClC,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAC9C,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,4EAA4E;IAC5E,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IACxE,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC/D,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC;IAEpF,6EAA6E;IAC7E,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;IACnC,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAChE,MAAM,SAAS,GAAG,YAAY,IAAI,QAAQ,CAAC,WAAW,CAAC;IAEvD,IAAI,IAA8B,CAAC;IACnC,IAAI,cAAkC,CAAC;IACvC,IAAI,SAAS,K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AC,IAAI,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClF,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/F,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings namespace, schema, and write-time validation for Subagent Director
|
|
3
|
+
* (design section 5.2).
|
|
4
|
+
*
|
|
5
|
+
* This module owns the "subagent-director" settings namespace. It re-exports
|
|
6
|
+
* the role/settings types from ./route-resolver (single source of truth) and
|
|
7
|
+
* registers them with the canonical optional-settings consumer wiring so a
|
|
8
|
+
* deployment without a settings provider keeps working off its composition
|
|
9
|
+
* config (zero intrusion).
|
|
10
|
+
*
|
|
11
|
+
* Layering (design 5.2): the schemastery schema stays coercive/permissive
|
|
12
|
+
* (all fields optional, roles a string-keyed dict) so an absent section
|
|
13
|
+
* resolves cleanly; cross-field / semantic constraints that the schema cannot
|
|
14
|
+
* express are enforced at WRITE time by validate(), which throws to refuse the
|
|
15
|
+
* write exactly as SettingsRegisterOptions.validate / SettingsSectionHooks.validate
|
|
16
|
+
* demand (dsh-settings/lib/types/index.d.ts:24-48, 307-341).
|
|
17
|
+
*/
|
|
18
|
+
import { Context } from '@deepseek-ai/cordis';
|
|
19
|
+
import z from '@deepseek-ai/schemastery';
|
|
20
|
+
import { type SettingsSectionHooks } from '@deepseek-ai/dsh-settings';
|
|
21
|
+
import type { SubagentDirectorSettings } from './route-resolver.js';
|
|
22
|
+
/** Settings namespace for Subagent Director (design section 0 naming resolution). */
|
|
23
|
+
export declare const SUBAGENT_DIRECTOR_SETTINGS_NAMESPACE: import("@deepseek-ai/dsh-settings").SettingsNamespace;
|
|
24
|
+
export type { RoleTemplate, SubagentDirectorSettings } from './route-resolver.js';
|
|
25
|
+
/** Schemastery schema for one role template. All fields optional so a partial /
|
|
26
|
+
* absent role resolves; semantic requirements are enforced by validate(). */
|
|
27
|
+
export declare const RoleTemplateSchema: z<Schemastery.ObjectS<{
|
|
28
|
+
displayName: z<string, string>;
|
|
29
|
+
description: z<string, string>;
|
|
30
|
+
persona: z<string, string>;
|
|
31
|
+
provider: z<string, string>;
|
|
32
|
+
model: z<string, string>;
|
|
33
|
+
reasoningEffort: z<string, string>;
|
|
34
|
+
toolFilter: z<Schemastery.ObjectS<{
|
|
35
|
+
allow: z<string[], string[]>;
|
|
36
|
+
deny: z<string[], string[]>;
|
|
37
|
+
}>, Schemastery.ObjectT<{
|
|
38
|
+
allow: z<string[], string[]>;
|
|
39
|
+
deny: z<string[], string[]>;
|
|
40
|
+
}>>;
|
|
41
|
+
}>, Schemastery.ObjectT<{
|
|
42
|
+
displayName: z<string, string>;
|
|
43
|
+
description: z<string, string>;
|
|
44
|
+
persona: z<string, string>;
|
|
45
|
+
provider: z<string, string>;
|
|
46
|
+
model: z<string, string>;
|
|
47
|
+
reasoningEffort: z<string, string>;
|
|
48
|
+
toolFilter: z<Schemastery.ObjectS<{
|
|
49
|
+
allow: z<string[], string[]>;
|
|
50
|
+
deny: z<string[], string[]>;
|
|
51
|
+
}>, Schemastery.ObjectT<{
|
|
52
|
+
allow: z<string[], string[]>;
|
|
53
|
+
deny: z<string[], string[]>;
|
|
54
|
+
}>>;
|
|
55
|
+
}>>;
|
|
56
|
+
/**
|
|
57
|
+
* Schemastery schema for the Subagent Director settings section. Every field is
|
|
58
|
+
* optional (schemastery object fields are optional by default); roles is a
|
|
59
|
+
* string-keyed dict of RoleTemplateSchema.
|
|
60
|
+
*/
|
|
61
|
+
export declare const SettingsSchema: z<Schemastery.ObjectS<{
|
|
62
|
+
defaultProvider: z<string, string>;
|
|
63
|
+
defaultModel: z<string, string>;
|
|
64
|
+
defaultReasoningEffort: z<string, string>;
|
|
65
|
+
defaultRole: z<string, string>;
|
|
66
|
+
fallbackOnInvalid: z<boolean, boolean>;
|
|
67
|
+
roles: z<import("@deepseek-ai/cosmokit").Dict<{
|
|
68
|
+
displayName?: string | null | undefined;
|
|
69
|
+
description?: string | null | undefined;
|
|
70
|
+
persona?: string | null | undefined;
|
|
71
|
+
provider?: string | null | undefined;
|
|
72
|
+
model?: string | null | undefined;
|
|
73
|
+
reasoningEffort?: string | null | undefined;
|
|
74
|
+
toolFilter?: ({
|
|
75
|
+
allow?: string[] | null | undefined;
|
|
76
|
+
deny?: string[] | null | undefined;
|
|
77
|
+
} & import("@deepseek-ai/cosmokit").Dict) | null | undefined;
|
|
78
|
+
} & import("@deepseek-ai/cosmokit").Dict, string>, import("@deepseek-ai/cosmokit").Dict<Schemastery.ObjectT<{
|
|
79
|
+
displayName: z<string, string>;
|
|
80
|
+
description: z<string, string>;
|
|
81
|
+
persona: z<string, string>;
|
|
82
|
+
provider: z<string, string>;
|
|
83
|
+
model: z<string, string>;
|
|
84
|
+
reasoningEffort: z<string, string>;
|
|
85
|
+
toolFilter: z<Schemastery.ObjectS<{
|
|
86
|
+
allow: z<string[], string[]>;
|
|
87
|
+
deny: z<string[], string[]>;
|
|
88
|
+
}>, Schemastery.ObjectT<{
|
|
89
|
+
allow: z<string[], string[]>;
|
|
90
|
+
deny: z<string[], string[]>;
|
|
91
|
+
}>>;
|
|
92
|
+
}>, string>>;
|
|
93
|
+
}>, Schemastery.ObjectT<{
|
|
94
|
+
defaultProvider: z<string, string>;
|
|
95
|
+
defaultModel: z<string, string>;
|
|
96
|
+
defaultReasoningEffort: z<string, string>;
|
|
97
|
+
defaultRole: z<string, string>;
|
|
98
|
+
fallbackOnInvalid: z<boolean, boolean>;
|
|
99
|
+
roles: z<import("@deepseek-ai/cosmokit").Dict<{
|
|
100
|
+
displayName?: string | null | undefined;
|
|
101
|
+
description?: string | null | undefined;
|
|
102
|
+
persona?: string | null | undefined;
|
|
103
|
+
provider?: string | null | undefined;
|
|
104
|
+
model?: string | null | undefined;
|
|
105
|
+
reasoningEffort?: string | null | undefined;
|
|
106
|
+
toolFilter?: ({
|
|
107
|
+
allow?: string[] | null | undefined;
|
|
108
|
+
deny?: string[] | null | undefined;
|
|
109
|
+
} & import("@deepseek-ai/cosmokit").Dict) | null | undefined;
|
|
110
|
+
} & import("@deepseek-ai/cosmokit").Dict, string>, import("@deepseek-ai/cosmokit").Dict<Schemastery.ObjectT<{
|
|
111
|
+
displayName: z<string, string>;
|
|
112
|
+
description: z<string, string>;
|
|
113
|
+
persona: z<string, string>;
|
|
114
|
+
provider: z<string, string>;
|
|
115
|
+
model: z<string, string>;
|
|
116
|
+
reasoningEffort: z<string, string>;
|
|
117
|
+
toolFilter: z<Schemastery.ObjectS<{
|
|
118
|
+
allow: z<string[], string[]>;
|
|
119
|
+
deny: z<string[], string[]>;
|
|
120
|
+
}>, Schemastery.ObjectT<{
|
|
121
|
+
allow: z<string[], string[]>;
|
|
122
|
+
deny: z<string[], string[]>;
|
|
123
|
+
}>>;
|
|
124
|
+
}>, string>>;
|
|
125
|
+
}>>;
|
|
126
|
+
/**
|
|
127
|
+
* Write-time validator for a resolved settings section (design 5.2).
|
|
128
|
+
*
|
|
129
|
+
* Throws to refuse the write that produced value, as the settings seam
|
|
130
|
+
* contract requires. Checks:
|
|
131
|
+
* - every role key is kebab-case;
|
|
132
|
+
* - every role's displayName and description are present and non-empty;
|
|
133
|
+
* - defaultRole, when set, references an existing role key;
|
|
134
|
+
* - every explicitly-set provider is a non-empty string.
|
|
135
|
+
*
|
|
136
|
+
* @param value - the resolved section, schema-valid by construction.
|
|
137
|
+
*/
|
|
138
|
+
export declare function validateDirectorSettings(value: SubagentDirectorSettings): void;
|
|
139
|
+
/**
|
|
140
|
+
* Install the Subagent Director settings section through the canonical
|
|
141
|
+
* optional-settings consumer wiring.
|
|
142
|
+
*
|
|
143
|
+
* Mirrors dsh-agent-default-model/lib/index.js's optional pattern: the
|
|
144
|
+
* registration rides the scoped fiber, so a deployment with no settings
|
|
145
|
+
* service simply never mounts it. This helper guards that explicitly for
|
|
146
|
+
* readability and logs a debug line when the service is absent so the gradual
|
|
147
|
+
* fall-back to the composition config is observable.
|
|
148
|
+
*
|
|
149
|
+
* @param ctx - consumer plugin context owning the wiring.
|
|
150
|
+
* @param entry - the consumer's composition-layer config, used as the settings
|
|
151
|
+
* base while a provider is absent.
|
|
152
|
+
* @param hooks - source sink and change notification (plus optional validate).
|
|
153
|
+
*/
|
|
154
|
+
export declare function installDirectorSettings(ctx: Context, entry: SubagentDirectorSettings, hooks: SettingsSectionHooks<SubagentDirectorSettings>): void;
|
|
155
|
+
/** Convenience exported alias used by tests. */
|
|
156
|
+
export { SettingsSchema as SubagentDirectorSettingsSchema };
|
|
157
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAgB,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAElF,qFAAqF;AACrF,eAAO,MAAM,oCAAoC,uDAAyC,CAAC;AAE3F,YAAY,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAKlF;6EAC6E;AAC7E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAW7B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAOzB,CAAC;AAWH;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,wBAAwB,GAAG,IAAI,CA4B9E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,wBAAwB,EAC/B,KAAK,EAAE,oBAAoB,CAAC,wBAAwB,CAAC,GACpD,IAAI,CAQN;AAED,gDAAgD;AAChD,OAAO,EAAE,cAAc,IAAI,8BAA8B,EAAE,CAAC"}
|