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.
Files changed (80) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +21 -0
  3. package/README.md +135 -0
  4. package/lib/bridge-contract.d.ts +41 -0
  5. package/lib/bridge-contract.d.ts.map +1 -0
  6. package/lib/bridge-contract.js +7 -0
  7. package/lib/bridge-contract.js.map +1 -0
  8. package/lib/bridge-entry.d.ts +29 -0
  9. package/lib/bridge-entry.d.ts.map +1 -0
  10. package/lib/bridge-entry.js +10 -0
  11. package/lib/bridge-entry.js.map +1 -0
  12. package/lib/client/RoleCard.d.ts +23 -0
  13. package/lib/client/RoleCard.d.ts.map +1 -0
  14. package/lib/client/RoleCard.js +72 -0
  15. package/lib/client/RoleCard.js.map +1 -0
  16. package/lib/client/SubagentModelDock.d.ts +29 -0
  17. package/lib/client/SubagentModelDock.d.ts.map +1 -0
  18. package/lib/client/SubagentModelDock.js +32 -0
  19. package/lib/client/SubagentModelDock.js.map +1 -0
  20. package/lib/client/SubagentOptionsSection.d.ts +23 -0
  21. package/lib/client/SubagentOptionsSection.d.ts.map +1 -0
  22. package/lib/client/SubagentOptionsSection.js +164 -0
  23. package/lib/client/SubagentOptionsSection.js.map +1 -0
  24. package/lib/client/index.d.ts +44 -0
  25. package/lib/client/index.d.ts.map +1 -0
  26. package/lib/client/index.js +1541 -0
  27. package/lib/client/index.js.map +1 -0
  28. package/lib/client/locales.d.ts +13 -0
  29. package/lib/client/locales.d.ts.map +1 -0
  30. package/lib/client/locales.js +107 -0
  31. package/lib/client/locales.js.map +1 -0
  32. package/lib/client/store-logic.d.ts +105 -0
  33. package/lib/client/store-logic.d.ts.map +1 -0
  34. package/lib/client/store-logic.js +143 -0
  35. package/lib/client/store-logic.js.map +1 -0
  36. package/lib/client/store.d.ts +104 -0
  37. package/lib/client/store.d.ts.map +1 -0
  38. package/lib/client/store.js +223 -0
  39. package/lib/client/store.js.map +1 -0
  40. package/lib/client/subagent-model.d.ts +47 -0
  41. package/lib/client/subagent-model.d.ts.map +1 -0
  42. package/lib/client/subagent-model.js +81 -0
  43. package/lib/client/subagent-model.js.map +1 -0
  44. package/lib/client/ui.d.ts +26 -0
  45. package/lib/client/ui.d.ts.map +1 -0
  46. package/lib/client/ui.js +102 -0
  47. package/lib/client/ui.js.map +1 -0
  48. package/lib/config.d.ts +63 -0
  49. package/lib/config.d.ts.map +1 -0
  50. package/lib/config.js +26 -0
  51. package/lib/config.js.map +1 -0
  52. package/lib/delegation-tool.d.ts +169 -0
  53. package/lib/delegation-tool.d.ts.map +1 -0
  54. package/lib/delegation-tool.js +404 -0
  55. package/lib/delegation-tool.js.map +1 -0
  56. package/lib/envelope.d.ts +97 -0
  57. package/lib/envelope.d.ts.map +1 -0
  58. package/lib/envelope.js +136 -0
  59. package/lib/envelope.js.map +1 -0
  60. package/lib/guidance.d.ts +37 -0
  61. package/lib/guidance.d.ts.map +1 -0
  62. package/lib/guidance.js +46 -0
  63. package/lib/guidance.js.map +1 -0
  64. package/lib/index.d.ts +29 -0
  65. package/lib/index.d.ts.map +1 -0
  66. package/lib/index.js +63 -0
  67. package/lib/index.js.map +1 -0
  68. package/lib/remote.d.ts +102 -0
  69. package/lib/remote.d.ts.map +1 -0
  70. package/lib/remote.js +254 -0
  71. package/lib/remote.js.map +1 -0
  72. package/lib/route-resolver.d.ts +118 -0
  73. package/lib/route-resolver.d.ts.map +1 -0
  74. package/lib/route-resolver.js +71 -0
  75. package/lib/route-resolver.js.map +1 -0
  76. package/lib/settings.d.ts +157 -0
  77. package/lib/settings.d.ts.map +1 -0
  78. package/lib/settings.js +118 -0
  79. package/lib/settings.js.map +1 -0
  80. package/package.json +110 -0
@@ -0,0 +1,223 @@
1
+ import { SUBAGENT_DIRECTOR_RPC_CHANNEL, SUBAGENT_DIRECTOR_RPC_VIEW, SUBAGENT_DIRECTOR_RPC_MUTATE, } from '../bridge-contract.js';
2
+ import { createSnapshotStore } from '@deepseek-ai/dsh-client-runtime/client';
3
+ import { addRoleOps, classifyMutateError, defaultModelOps, removeRoleOps, restoreDefaultsOps, setDefaultRoleOps, updateRoleOps, } from './store-logic.js';
4
+ /** The settings namespace this page reads and writes. */
5
+ export const SUBAGENT_DIRECTOR_NS = 'subagent-director';
6
+ /** Initial empty snapshot. */
7
+ export function initialSubagentOptionsState() {
8
+ return {
9
+ status: 'idle',
10
+ error: null,
11
+ writable: true,
12
+ namespace: undefined,
13
+ section: undefined,
14
+ revision: 0,
15
+ providers: [],
16
+ models: [],
17
+ loading: false,
18
+ };
19
+ }
20
+ /** Human text for a rejected wire call. */
21
+ export function messageOf(error) {
22
+ if (error instanceof Error)
23
+ return error.message;
24
+ return typeof error === 'string' ? error : String(error);
25
+ }
26
+ /**
27
+ * Raised when the /subagent-director bridge channel is not reachable on the
28
+ * current transport (a Host that predates the bridge answers nothing). The
29
+ * store surfaces this as the localized `bridgeUnavailable` copy instead of a
30
+ * raw transport string.
31
+ */
32
+ export class BridgeUnavailableError extends Error {
33
+ constructor() {
34
+ super('Subagent Director settings bridge (/subagent-director) is not available on this server');
35
+ }
36
+ }
37
+ /** Whether a thrown value means the bridge channel could not be called at all. */
38
+ export function isBridgeUnavailable(error) {
39
+ return error instanceof BridgeUnavailableError;
40
+ }
41
+ /** The settings page controller (one per settings surface). */
42
+ export class SubagentOptionsStore {
43
+ store;
44
+ wire;
45
+ generation = 0;
46
+ constructor(wire) {
47
+ this.wire = wire;
48
+ this.store = createSnapshotStore(initialSubagentOptionsState());
49
+ }
50
+ /**
51
+ * Call one bridge endpoint over the generic RPC channel. Returns the RpcResult
52
+ * (ok or error branch). A transport-level rejection — the Host has no
53
+ * /subagent-director channel — is folded into BridgeUnavailableError so the
54
+ * caller can show the localized message.
55
+ */
56
+ async callBridge(endpoint, payload) {
57
+ let result;
58
+ try {
59
+ result = (await this.wire.rpc.call(SUBAGENT_DIRECTOR_RPC_CHANNEL, endpoint, payload));
60
+ }
61
+ catch (error) {
62
+ throw new BridgeUnavailableError();
63
+ }
64
+ if (!result.ok) {
65
+ return { ok: false, error: result.error };
66
+ }
67
+ return { ok: true, value: result.value };
68
+ }
69
+ /** Refresh the whole page snapshot: provider directory + model catalog + own namespace. */
70
+ async load() {
71
+ const generation = ++this.generation;
72
+ this.store.update((s) => {
73
+ s.status = 'loading';
74
+ s.error = null;
75
+ s.loading = true;
76
+ });
77
+ try {
78
+ const [providersResponse, modelsResponse, viewResult] = await Promise.all([
79
+ this.wire.llm.providers({}),
80
+ this.wire.llm.models({}),
81
+ this.callBridge(SUBAGENT_DIRECTOR_RPC_VIEW),
82
+ ]);
83
+ if (!providersResponse.result.ok)
84
+ throw new Error(providersResponse.result.error.message);
85
+ if (!modelsResponse.result.ok)
86
+ throw new Error(modelsResponse.result.error.message);
87
+ if (!viewResult.ok)
88
+ throw new Error(this.errorMessage(viewResult.error));
89
+ if (generation !== this.generation)
90
+ return;
91
+ const view = viewResult.value.view;
92
+ const section = (view?.value ?? {});
93
+ const writable = viewResult.value.writable;
94
+ const providers = providersResponse.result.value.providers;
95
+ const models = modelsResponse.result.value.groups;
96
+ this.store.update((s) => {
97
+ s.status = 'ready';
98
+ s.error = null;
99
+ s.writable = writable;
100
+ s.providers = providers;
101
+ s.models = models;
102
+ s.namespace = view;
103
+ s.section = section;
104
+ s.revision = view?.revision ?? 0;
105
+ s.loading = false;
106
+ });
107
+ }
108
+ catch (error) {
109
+ if (generation !== this.generation)
110
+ return;
111
+ this.store.update((s) => {
112
+ s.status = 'error';
113
+ s.error = isBridgeUnavailable(error) ? this.wire.t('bridgeUnavailable') : messageOf(error);
114
+ s.loading = false;
115
+ });
116
+ }
117
+ }
118
+ /** Human text for a bridge RPC error branch. */
119
+ errorMessage(error) {
120
+ if (error !== null && typeof error === 'object' && 'message' in error) {
121
+ const message = error.message;
122
+ if (typeof message === 'string')
123
+ return message;
124
+ }
125
+ return messageOf(error);
126
+ }
127
+ /**
128
+ * Run one mutate and update the snapshot's revision. Returns a failure
129
+ * message (localized by the caller) or undefined on success. A
130
+ * settings-conflict re-reads the namespace and returns the conflict kind so
131
+ * the UI can show the "please review and retry" message.
132
+ */
133
+ async mutate(ops) {
134
+ const state = this.store.getSnapshot();
135
+ const ns = SUBAGENT_DIRECTOR_NS;
136
+ const revision = state.revision;
137
+ let result;
138
+ try {
139
+ result = await this.callBridge(SUBAGENT_DIRECTOR_RPC_MUTATE, { ns, ops, expectedRevision: revision });
140
+ }
141
+ catch (error) {
142
+ return {
143
+ ok: false,
144
+ kind: 'fatal',
145
+ message: isBridgeUnavailable(error) ? this.wire.t('bridgeUnavailable') : messageOf(error),
146
+ };
147
+ }
148
+ if (result.ok) {
149
+ const admitted = result.value;
150
+ this.store.update((s) => {
151
+ s.revision = admitted.revision;
152
+ // Refresh the cached section/namespace from the acknowledged view.
153
+ s.namespace = admitted;
154
+ s.section = (admitted.value ?? {});
155
+ });
156
+ return { ok: true, kind: 'fatal', message: undefined };
157
+ }
158
+ const code = this.errorCode(result.error);
159
+ const message = this.errorMessage(result.error);
160
+ const kind = classifyMutateError(code, message);
161
+ if (kind === 'conflict') {
162
+ // Re-read the authoritative namespace so the user reviews fresh values.
163
+ await this.reloadNamespace();
164
+ return { ok: false, kind, message };
165
+ }
166
+ return { ok: false, kind, message };
167
+ }
168
+ async reloadNamespace() {
169
+ try {
170
+ const result = await this.callBridge(SUBAGENT_DIRECTOR_RPC_VIEW);
171
+ if (!result.ok)
172
+ return;
173
+ const view = result.value.view;
174
+ if (!view)
175
+ return;
176
+ this.store.update((s) => {
177
+ s.namespace = view;
178
+ s.section = (view.value ?? {});
179
+ s.revision = view.revision;
180
+ s.writable = result.value.writable;
181
+ });
182
+ }
183
+ catch {
184
+ /* keep last good snapshot */
185
+ }
186
+ }
187
+ /** Error code of a bridge RPC error branch, when present. */
188
+ errorCode(error) {
189
+ if (error !== null && typeof error === 'object' && 'code' in error) {
190
+ const code = error.code;
191
+ return typeof code === 'string' ? code : undefined;
192
+ }
193
+ return undefined;
194
+ }
195
+ async addRole(id, draft) {
196
+ const result = await this.mutate(addRoleOps(id, draft));
197
+ return result.ok ? undefined : result.message;
198
+ }
199
+ async updateRole(id, before, draft) {
200
+ const result = await this.mutate(updateRoleOps(id, before, draft));
201
+ return result.ok ? undefined : result.message;
202
+ }
203
+ async removeRole(id) {
204
+ const state = this.store.getSnapshot();
205
+ const result = await this.mutate(removeRoleOps(id, { defaultRole: state.section?.defaultRole }));
206
+ return result.ok ? undefined : result.message;
207
+ }
208
+ async setDefaultRole(id) {
209
+ const result = await this.mutate(setDefaultRoleOps(id));
210
+ return result.ok ? undefined : result.message;
211
+ }
212
+ async setDefaultModel(edits) {
213
+ const state = this.store.getSnapshot();
214
+ const result = await this.mutate(defaultModelOps(state.section ?? {}, edits));
215
+ return result.ok ? undefined : result.message;
216
+ }
217
+ async restoreDefaults() {
218
+ const state = this.store.getSnapshot();
219
+ const result = await this.mutate(restoreDefaultsOps(state.section ?? {}));
220
+ return result.ok ? undefined : result.message;
221
+ }
222
+ }
223
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/client/store.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,4BAA4B,GAE7B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAsB,MAAM,wCAAwC,CAAC;AACjG,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,GAMd,MAAM,kBAAkB,CAAC;AAE1B,yDAAyD;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAuBxD,8BAA8B;AAC9B,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,IAAI;QACd,SAAS,E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ent Director — M3b observability pure logic.
3
+ *
4
+ * Extracts the provider/model a subagent actually ran on, straight from an
5
+ * opened subagent conversation snapshot with zero extra RPC: each finalized
6
+ * assistant message may carry a reported `provenance` (the adapter-reported
7
+ * provider/model) and the `requestConfig` that was requested. We take the
8
+ * latest assistant message that exposes either, preferring the reported
9
+ * provenance over the requested config, and format a localized readout.
10
+ *
11
+ * Pure and framework-free so the formatting rules are unit-testable.
12
+ */
13
+ import type { AssistantMessageNode, ConversationSnapshot } from '@deepseek-ai/dsh-client-runtime/client';
14
+ /** The durable provider/model identity of one subagent run. */
15
+ export interface SubagentModelRef {
16
+ readonly found: true;
17
+ readonly provider: string;
18
+ readonly model: string;
19
+ }
20
+ /** A transcript has not yet proven which provider/model a subagent used. */
21
+ export interface NoSubagentModel {
22
+ readonly found: false;
23
+ }
24
+ export type SubagentModelLookup = SubagentModelRef | NoSubagentModel;
25
+ /**
26
+ * Prefer the latest assistant message's reported provenance; fall back to its
27
+ * requested config. Order walks the snapshot's node list from the tail so we
28
+ * surface the most recent completed request, which is the meaningful one when
29
+ * a subagent retried or only partially ran.
30
+ */
31
+ export declare function latestSubagentModel(snapshot: Pick<ConversationSnapshot, 'nodes'>): SubagentModelLookup;
32
+ /** Resolve the model identity off one assistant message (provenance first). */
33
+ export declare function provenanceOf(assistant: AssistantMessageNode): SubagentModelRef | null;
34
+ /**
35
+ * Whether this conversation is an addressed subagent (a catalog-discovered
36
+ * child) — the surface where the official read-only composer shows and where
37
+ * a model readout is most useful. A null `subagent` on an ordinary session
38
+ * returns false even when nodes carry provenance.
39
+ */
40
+ export declare function isAddressedSubagent(snapshot: Pick<ConversationSnapshot, 'subagent'> | null | undefined): boolean;
41
+ /**
42
+ * Compact provider/model label, e.g. "deepseek/deepseek-v4-flash". The model
43
+ * id can already include a provider prefix; we do not hyphenate or re-quote
44
+ * so the exact route stays readable in one line.
45
+ */
46
+ export declare function formatModelRef(ref: SubagentModelRef): string;
47
+ //# sourceMappingURL=subagent-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagent-model.d.ts","sourceRoot":"","sources":["../../src/client/subagent-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAGpB,oBAAoB,EACrB,MAAM,wCAAwC,CAAC;AAEhD,+DAA+D;AAC/D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;CACvB;AAED,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAErE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAC5C,mBAAmB,CAerB;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAC1B,SAAS,EAAE,oBAAoB,GAC9B,gBAAgB,GAAG,IAAI,CAwBzB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,GAAG,IAAI,GAAG,SAAS,GAClE,OAAO,CAIT;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAE5D"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Subagent Director — M3b observability pure logic.
3
+ *
4
+ * Extracts the provider/model a subagent actually ran on, straight from an
5
+ * opened subagent conversation snapshot with zero extra RPC: each finalized
6
+ * assistant message may carry a reported `provenance` (the adapter-reported
7
+ * provider/model) and the `requestConfig` that was requested. We take the
8
+ * latest assistant message that exposes either, preferring the reported
9
+ * provenance over the requested config, and format a localized readout.
10
+ *
11
+ * Pure and framework-free so the formatting rules are unit-testable.
12
+ */
13
+ /**
14
+ * Prefer the latest assistant message's reported provenance; fall back to its
15
+ * requested config. Order walks the snapshot's node list from the tail so we
16
+ * surface the most recent completed request, which is the meaningful one when
17
+ * a subagent retried or only partially ran.
18
+ */
19
+ export function latestSubagentModel(snapshot) {
20
+ if (snapshot === null || typeof snapshot !== 'object') {
21
+ return { found: false };
22
+ }
23
+ const nodes = snapshot.nodes;
24
+ if (!Array.isArray(nodes))
25
+ return { found: false };
26
+ for (let i = nodes.length - 1; i >= 0; i -= 1) {
27
+ const node = nodes[i];
28
+ if (node === null || typeof node !== 'object')
29
+ continue;
30
+ if (node.kind !== 'assistant')
31
+ continue;
32
+ const assistant = node;
33
+ const ref = provenanceOf(assistant);
34
+ if (ref !== null)
35
+ return ref;
36
+ }
37
+ return { found: false };
38
+ }
39
+ /** Resolve the model identity off one assistant message (provenance first). */
40
+ export function provenanceOf(assistant) {
41
+ const reported = assistant.provenance;
42
+ if (reported !== null &&
43
+ typeof reported === 'object' &&
44
+ typeof reported.provider === 'string' &&
45
+ reported.provider !== '' &&
46
+ typeof reported.model === 'string' &&
47
+ reported.model !== '') {
48
+ return { found: true, provider: reported.provider, model: reported.model };
49
+ }
50
+ const requested = assistant.requestConfig;
51
+ if (requested !== null &&
52
+ typeof requested === 'object' &&
53
+ typeof requested.provider === 'string' &&
54
+ requested.provider !== '' &&
55
+ typeof requested.model === 'string' &&
56
+ requested.model !== '') {
57
+ return { found: true, provider: requested.provider, model: requested.model };
58
+ }
59
+ return null;
60
+ }
61
+ /**
62
+ * Whether this conversation is an addressed subagent (a catalog-discovered
63
+ * child) — the surface where the official read-only composer shows and where
64
+ * a model readout is most useful. A null `subagent` on an ordinary session
65
+ * returns false even when nodes carry provenance.
66
+ */
67
+ export function isAddressedSubagent(snapshot) {
68
+ if (snapshot === null || snapshot === undefined)
69
+ return false;
70
+ const subagent = snapshot.subagent;
71
+ return subagent !== null && subagent !== undefined;
72
+ }
73
+ /**
74
+ * Compact provider/model label, e.g. "deepseek/deepseek-v4-flash". The model
75
+ * id can already include a provider prefix; we do not hyphenate or re-quote
76
+ * so the exact route stays readable in one line.
77
+ */
78
+ export function formatModelRef(ref) {
79
+ return `${ref.provider}/${ref.model}`;
80
+ }
81
+ //# sourceMappingURL=subagent-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagent-model.js","sourceRoot":"","sources":["../../src/client/subagent-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAuBH;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAA6C;IAE7C,IAAI,QAAQ,KAAK,IAAI,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACtD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;IACD,MAAM,KAAK,GAA4C,QAAQ,CAAC,KAAK,CAAC;IACtE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACnD,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,SAAS;QACxD,IAAK,IAA2B,CAAC,IAAI,KAAK,WAAW;YAAE,SAAS;QAChE,MAAM,SAAS,GAAG,IAA4B,CAAC;QAC/C,MAAM,GAAG,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,GAAG,CAAC;IAC/B,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAC1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AAC,QAAQ,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;AACxC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /** Shared inline styles + design tokens for the Subagent Director settings pages.
2
+ * M2 intentionally does not introduce a CSS Modules pipeline (documented
3
+ * design deviation): style comes from design tokens and inline styles. */
4
+ import type { CSSProperties } from 'react';
5
+ export declare const token: {
6
+ labelPrimary: string;
7
+ labelSecondary: string;
8
+ labelTertiary: string;
9
+ border: string;
10
+ bgLayer1: string;
11
+ bgLayer3: string;
12
+ accent: string;
13
+ danger: string;
14
+ shadow: string;
15
+ };
16
+ export declare const rowStyle: CSSProperties;
17
+ export declare const fieldLabelStyle: CSSProperties;
18
+ export declare const selectStyle: CSSProperties;
19
+ export declare const textInputStyle: CSSProperties;
20
+ export declare const textAreaStyle: CSSProperties;
21
+ export declare const primaryButtonStyle: CSSProperties;
22
+ export declare const ghostButtonStyle: CSSProperties;
23
+ export declare const dangerButtonStyle: CSSProperties;
24
+ export declare const cardStyle: CSSProperties;
25
+ export declare const sectionWidth: CSSProperties;
26
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/client/ui.ts"],"names":[],"mappings":"AAAA;;0EAE0E;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,KAAK;IAChB,YAAY;IACZ,cAAc;IACd,aAAa;IACb,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,aAItB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,aAI7B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,aAUzB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,aAU5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAY3B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,aAUhC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,aAU9B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,aAI/B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,aASvB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,aAO1B,CAAC"}
@@ -0,0 +1,102 @@
1
+ export const token = {
2
+ labelPrimary: 'var(--dsw-alias-label-primary)',
3
+ labelSecondary: 'var(--dsw-alias-label-secondary)',
4
+ labelTertiary: 'var(--dsw-alias-label-tertiary)',
5
+ border: 'var(--dsw-alias-border-l2)',
6
+ bgLayer1: 'var(--dsw-alias-bg-layer-1)',
7
+ bgLayer3: 'var(--dsw-alias-bg-layer-3)',
8
+ accent: 'var(--dsw-alias-state-business-primary)',
9
+ danger: 'var(--dsw-alias-state-error-primary)',
10
+ shadow: 'var(--dsw-shadow-lv1)',
11
+ };
12
+ export const rowStyle = {
13
+ display: 'flex',
14
+ flexDirection: 'column',
15
+ gap: 6,
16
+ };
17
+ export const fieldLabelStyle = {
18
+ color: token.labelSecondary,
19
+ fontSize: 12,
20
+ lineHeight: '16px',
21
+ };
22
+ export const selectStyle = {
23
+ height: 30,
24
+ borderRadius: 6,
25
+ border: '1px solid ' + token.border,
26
+ background: token.bgLayer1,
27
+ color: token.labelPrimary,
28
+ font: 'inherit',
29
+ fontSize: 13,
30
+ padding: '0 8px',
31
+ outline: 'none',
32
+ };
33
+ export const textInputStyle = {
34
+ height: 30,
35
+ borderRadius: 6,
36
+ border: '1px solid ' + token.border,
37
+ background: token.bgLayer1,
38
+ color: token.labelPrimary,
39
+ font: 'inherit',
40
+ fontSize: 13,
41
+ padding: '0 8px',
42
+ outline: 'none',
43
+ };
44
+ export const textAreaStyle = {
45
+ borderRadius: 6,
46
+ border: '1px solid ' + token.border,
47
+ background: token.bgLayer1,
48
+ color: token.labelPrimary,
49
+ font: 'inherit',
50
+ fontSize: 13,
51
+ lineHeight: '18px',
52
+ padding: '6px 8px',
53
+ resize: 'vertical',
54
+ minHeight: 56,
55
+ outline: 'none',
56
+ };
57
+ export const primaryButtonStyle = {
58
+ height: 28,
59
+ borderRadius: 6,
60
+ border: '1px solid ' + token.accent,
61
+ background: token.accent,
62
+ color: '#fff',
63
+ font: 'inherit',
64
+ fontSize: 13,
65
+ cursor: 'pointer',
66
+ padding: '0 12px',
67
+ };
68
+ export const ghostButtonStyle = {
69
+ height: 28,
70
+ borderRadius: 6,
71
+ border: '1px solid ' + token.border,
72
+ background: 'transparent',
73
+ color: token.labelPrimary,
74
+ font: 'inherit',
75
+ fontSize: 13,
76
+ cursor: 'pointer',
77
+ padding: '0 12px',
78
+ };
79
+ export const dangerButtonStyle = {
80
+ ...ghostButtonStyle,
81
+ color: token.danger,
82
+ borderColor: token.danger,
83
+ };
84
+ export const cardStyle = {
85
+ border: '1px solid ' + token.border,
86
+ background: token.bgLayer3,
87
+ borderRadius: 10,
88
+ padding: 12,
89
+ display: 'flex',
90
+ flexDirection: 'column',
91
+ gap: 10,
92
+ minWidth: 0,
93
+ };
94
+ export const sectionWidth = {
95
+ width: '100%',
96
+ maxWidth: 760,
97
+ display: 'flex',
98
+ flexDirection: 'column',
99
+ gap: 16,
100
+ color: token.labelPrimary,
101
+ };
102
+ //# sourceMappingURL=ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/client/ui.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,YAAY,EAAE,gCAAgC;IAC9C,cAAc,EAAE,kCAAkC;IAClD,aAAa,EAAE,iCAAiC;IAChD,MAAM,EAAE,4BAA4B;IACpC,QAAQ,EAAE,6BAA6B;IACvC,QAAQ,EAAE,6BAA6B;IACvC,MAAM,EAAE,yCAAyC;IACjD,MAAM,EAAE,sCAAsC;IAC9C,MAAM,EAAE,uBAAuB;CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAkB;IACrC,OAAO,EAAE,MAAM;IAC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in Config for Subagent Director (the Cordis composition-entry layer).
3
+ *
4
+ * This mirrors the field semantics of `@deepseek-ai/dsh-tool-subagent` (see
5
+ * its `lib/types/index.d.ts`) so the two delegation tools stay behaviourally
6
+ * consistent in the ecosystem.
7
+ *
8
+ * Two provider namespaces live side by side here and MUST NOT be confused
9
+ * (design section 14, risk R2):
10
+ * - `subagentProvider`: the subagent TRANSPORT provider name handed to
11
+ * `ctx.subagents.start(...)` (e.g. `spawn`, `fork`, `acp`).
12
+ * - `agentOptions.provider` / `defaultProvider` (settings): the LLM route
13
+ * provider that actually serves model requests (e.g. `deepseek-official`,
14
+ * a pi-ai route). They are unrelated name spaces.
15
+ */
16
+ import z from '@deepseek-ai/schemastery';
17
+ /**
18
+ * Cordis-layer plugin configuration.
19
+ *
20
+ * All fields are optional so an empty composition entry degrades to the DSH
21
+ * default behaviour (inherit the parent agent's model; one-shot foreground).
22
+ */
23
+ export interface DirectorConfig {
24
+ /**
25
+ * The subagent TRANSPORT provider to start runs on. This is the `name`
26
+ * argument of `ctx.subagents.start(name, request)`, NOT an LLM route.
27
+ * Default 'spawn'.
28
+ */
29
+ subagentProvider?: string;
30
+ /** Model-facing tool name, default 'subagent_role'. Each loaded instance must use a distinct name. */
31
+ toolName?: string;
32
+ /** Expose `run_in_background` (default true). Disabled instances omit the argument. */
33
+ enableRunInBackground?: boolean;
34
+ /**
35
+ * Background execution policy (default 'one-shot').
36
+ * 'one-shot' defaults calls to foreground and runs background calls as a
37
+ * plain Task. 'continuable' defaults calls to background via
38
+ * ctx.subagents.startContinuable(), requires the transport provider's
39
+ * prepareContinuable capability, and returns the durable child id for later
40
+ * send_message follow-up (FR-5.3).
41
+ */
42
+ backgroundMode?: 'one-shot' | 'continuable';
43
+ /**
44
+ * Maximum child delegation depth (default 3). A numeric cap requires the
45
+ * provider's `depthLimit` capability. 'provider-managed' sends no cap.
46
+ */
47
+ maxDepth?: number | 'provider-managed';
48
+ }
49
+ /** Schemastery schema for {@link DirectorConfig}. */
50
+ export declare const Config: z<Schemastery.ObjectS<{
51
+ subagentProvider: z<string, string>;
52
+ toolName: z<string, string>;
53
+ enableRunInBackground: z<boolean, boolean>;
54
+ backgroundMode: z<"continuable" | "one-shot", "continuable" | "one-shot">;
55
+ maxDepth: z<number | "provider-managed", number | "provider-managed">;
56
+ }>, Schemastery.ObjectT<{
57
+ subagentProvider: z<string, string>;
58
+ toolName: z<string, string>;
59
+ enableRunInBackground: z<boolean, boolean>;
60
+ backgroundMode: z<"continuable" | "one-shot", "continuable" | "one-shot">;
61
+ maxDepth: z<number | "provider-managed", number | "provider-managed">;
62
+ }>>;
63
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,sGAAsG;IACtG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uFAAuF;IACvF,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC;IAE5C;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACxC;AAED,qDAAqD;AACrD,eAAO,MAAM,MAAM;;;;;;;;;;;;GAOjB,CAAC"}
package/lib/config.js ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Plugin Config for Subagent Director (the Cordis composition-entry layer).
3
+ *
4
+ * This mirrors the field semantics of `@deepseek-ai/dsh-tool-subagent` (see
5
+ * its `lib/types/index.d.ts`) so the two delegation tools stay behaviourally
6
+ * consistent in the ecosystem.
7
+ *
8
+ * Two provider namespaces live side by side here and MUST NOT be confused
9
+ * (design section 14, risk R2):
10
+ * - `subagentProvider`: the subagent TRANSPORT provider name handed to
11
+ * `ctx.subagents.start(...)` (e.g. `spawn`, `fork`, `acp`).
12
+ * - `agentOptions.provider` / `defaultProvider` (settings): the LLM route
13
+ * provider that actually serves model requests (e.g. `deepseek-official`,
14
+ * a pi-ai route). They are unrelated name spaces.
15
+ */
16
+ import z from '@deepseek-ai/schemastery';
17
+ /** Schemastery schema for {@link DirectorConfig}. */
18
+ export const Config = z.object({
19
+ subagentProvider: z.string().default('spawn'),
20
+ toolName: z.string().default('subagent_role'),
21
+ enableRunInBackground: z.boolean().default(true),
22
+ backgroundMode: z.union(['one-shot', 'continuable']).default('one-shot'),
23
+ maxDepth: z
24
+ .union([z.natural().max(Number.MAX_SAFE_INTEGER), z.const('provider-managed')]),
25
+ });
26
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAuCzC,qDAAqD;AACrD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC;IAC7C,qBAAqB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAChD,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IACxE,QAAQ,EAAE,CAAC;SACR,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;CAClF,CAAC,CAAC"}