@dsmm/dsmm 0.3.15 → 0.3.17

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 (55) hide show
  1. package/README.md +13 -5
  2. package/docs/agent-presets.md +1 -1
  3. package/docs/compatibility.md +5 -5
  4. package/docs/deferred-native-approval-risk.md +1 -1
  5. package/docs/design.md +1 -1
  6. package/docs/lsp.md +1 -1
  7. package/docs/maintenance.md +2 -1
  8. package/docs/model-routing.md +13 -6
  9. package/docs/native-permissions.md +1 -1
  10. package/docs/profiles.md +3 -1
  11. package/docs/releasing.md +2 -2
  12. package/docs/roadmap.md +3 -3
  13. package/docs/runtime-recovery.md +4 -4
  14. package/docs/safety-guards.md +1 -1
  15. package/docs/settings-status.md +4 -2
  16. package/docs/tui.md +53 -0
  17. package/dsh-plugin.json +41 -0
  18. package/lib/client/ProfilesSection.js +1 -1
  19. package/lib/client/SessionProfiles.js +8 -7
  20. package/lib/client/children-locales.d.ts +1 -1
  21. package/lib/client/controller.d.ts +13 -1
  22. package/lib/client/controller.js +114 -20
  23. package/lib/client/deployment-locales.js +3 -2
  24. package/lib/client/deployment-modules.js +1 -1
  25. package/lib/client/index.js +22 -4
  26. package/lib/client/locales.d.ts +1 -0
  27. package/lib/client/locales.js +2 -0
  28. package/lib/client.js +144 -29
  29. package/lib/commands.d.ts +7 -3
  30. package/lib/commands.js +20 -11
  31. package/lib/host-llm.js +6 -1
  32. package/lib/index.d.ts +1 -1
  33. package/lib/index.js +2 -6
  34. package/lib/model-routing.js +43 -19
  35. package/lib/profile-diagnostics.js +1 -0
  36. package/lib/profile-runtime.js +1 -1
  37. package/lib/request-routing.d.ts +27 -0
  38. package/lib/request-routing.js +69 -0
  39. package/lib/role-llm-runtime.js +15 -2
  40. package/lib/role-routing.d.ts +4 -3
  41. package/lib/role-routing.js +17 -10
  42. package/lib/runtime-recovery.js +56 -16
  43. package/lib/settings.d.ts +3 -0
  44. package/lib/settings.js +9 -0
  45. package/lib/state.d.ts +2 -2
  46. package/lib/state.js +13 -4
  47. package/lib/status.d.ts +5 -0
  48. package/lib/status.js +18 -7
  49. package/lib/tui-actions.d.ts +21 -0
  50. package/lib/tui-actions.js +301 -0
  51. package/lib/tui-adapter.d.ts +25 -0
  52. package/lib/tui-adapter.js +422 -0
  53. package/lib/tui-types.d.ts +98 -0
  54. package/lib/tui-types.js +2 -0
  55. package/package.json +4 -2
@@ -0,0 +1,422 @@
1
+ import { symbols } from "@deepseek-ai/cordis";
2
+ import { createDeepworkCommandDefinition, createDsmmStatusCommandDefinition } from "./commands.js";
3
+ import { DSMM_LOCALES } from "./settings.js";
4
+ import { createDsmmManagementCommandDefinition, DIALOG_TIMEOUT_MS, DSMM_TUI_CONTRIBUTIONS } from "./tui-actions.js";
5
+ const INHERIT = "inherit";
6
+ const ACTION_TIMEOUT_MS = 120_000;
7
+ const ADMISSION_RETRY_INTERVAL_MS = 200;
8
+ const ADMISSION_RETRY_ATTEMPTS = 105;
9
+ const SYSTEM_CLOCK = {
10
+ setTimeout: (callback, delayMs) => globalThis.setTimeout(callback, delayMs),
11
+ clearTimeout: handle => globalThis.clearTimeout(handle)
12
+ };
13
+ export function createDsmmTuiSettingsSection(namespace) {
14
+ const select = (path, label, values, descriptions) => ({
15
+ path, label, descriptions, kind: "select",
16
+ options: [{ value: INHERIT, label: "Inherit", descriptions: { zh: "继承" } }, ...values.map(value => ({ value, label: value }))],
17
+ format(value) { return typeof value === "string" && values.includes(value) ? value : INHERIT; },
18
+ parse(text) { return text === INHERIT ? { kind: "clear" } : values.includes(text) ? { kind: "set", value: text } : undefined; }
19
+ });
20
+ const boolean = (path, label, descriptions) => ({
21
+ path, label, descriptions, kind: "select",
22
+ options: [
23
+ { value: INHERIT, label: "Inherit", descriptions: { zh: "继承" } },
24
+ { value: "true", label: "Enabled", descriptions: { zh: "开启" } },
25
+ { value: "false", label: "Disabled", descriptions: { zh: "关闭" } }
26
+ ],
27
+ format(value) { return value === true ? "true" : value === false ? "false" : INHERIT; },
28
+ parse(text) { return text === INHERIT ? { kind: "clear" } : text === "true" ? { kind: "set", value: true } : text === "false" ? { kind: "set", value: false } : undefined; }
29
+ });
30
+ return {
31
+ ns: namespace,
32
+ title: "DSMM",
33
+ descriptions: { zh: "DSMM" },
34
+ groups: [{ id: "deployment", title: "Deployment", descriptions: { zh: "部署" }, mode: "inline" }],
35
+ fields: [
36
+ { ...select(["rootModelPolicy"], "Root model policy", ["native", "configured"], { zh: "根模型策略" }), group: "deployment" },
37
+ { ...boolean(["defaultActive"], "Deepwork default", { zh: "Deepwork 默认状态" }), group: "deployment" },
38
+ { ...select(["locale"], "Locale", DSMM_LOCALES, { zh: "语言" }), group: "deployment" },
39
+ { ...select(["workflow", "policy"], "Workflow policy", ["risk-based", "legacy"], { zh: "工作流策略" }), group: "deployment" },
40
+ { ...select(["subagents", "toolTopology"], "Subagent tool topology", ["per-role", "parameterized"], { zh: "子 Agent 工具拓扑" }), group: "deployment" }
41
+ ]
42
+ };
43
+ }
44
+ class DsmmTuiAdapter {
45
+ ctx;
46
+ options;
47
+ stickyManaged = false;
48
+ disposed = false;
49
+ raw;
50
+ mediated;
51
+ settings;
52
+ admissionRetry;
53
+ operations = new Set();
54
+ listener;
55
+ queue = Promise.resolve();
56
+ warned = new Set();
57
+ get managed() { return this.stickyManaged; }
58
+ constructor(ctx, options) {
59
+ this.ctx = ctx;
60
+ this.options = options;
61
+ const remove = ctx.on?.("internal/service", (name) => {
62
+ if (!["commands", "tuiPluginHost", "tuiDialogs", "tuiSettingsSections", "settings", "agents"].includes(name))
63
+ return;
64
+ this.abortOperations();
65
+ if (name === "tuiPluginHost") {
66
+ const observed = softGet(this.ctx, "tuiPluginHost");
67
+ if (observed !== undefined) {
68
+ this.stickyManaged = true;
69
+ this.disposeRaw();
70
+ }
71
+ const host = validHost(observed);
72
+ if (this.mediated !== undefined && (host === undefined || original(host) !== this.mediated.owner
73
+ || host.generationId !== this.mediated.generationId)) {
74
+ this.disposeMediated();
75
+ this.disposeSettings();
76
+ }
77
+ }
78
+ else if (name === "commands") {
79
+ const commands = softGet(this.ctx, "commands");
80
+ const owner = originalMaybe(commands);
81
+ if (this.raw !== undefined && this.raw.commandsOwner !== owner)
82
+ this.disposeRaw();
83
+ if (this.mediated !== undefined && this.mediated.commandsOwner !== owner) {
84
+ this.disposeMediated();
85
+ this.disposeSettings();
86
+ }
87
+ }
88
+ else if (name === "tuiSettingsSections" || name === "settings") {
89
+ this.disposeSettings();
90
+ }
91
+ this.schedule();
92
+ }, { global: true });
93
+ if (typeof remove === "function")
94
+ this.listener = remove;
95
+ ctx.effect?.(() => () => this.dispose());
96
+ this.schedule();
97
+ }
98
+ settled() { return this.queue; }
99
+ dispose() {
100
+ if (this.disposed)
101
+ return;
102
+ this.disposed = true;
103
+ this.abortOperations();
104
+ this.disposeRaw();
105
+ this.disposeMediated();
106
+ this.disposeSettings();
107
+ this.clearAdmissionRetry();
108
+ this.listener?.();
109
+ this.listener = undefined;
110
+ }
111
+ schedule() {
112
+ this.queue = this.queue.then(() => this.reconcile()).catch(cause => {
113
+ this.warn("reconcile", `DSMM TUI adapter reconciliation failed: ${safeMessage(cause)}`);
114
+ });
115
+ }
116
+ async reconcile() {
117
+ if (this.disposed)
118
+ return;
119
+ const observedHost = softGet(this.ctx, "tuiPluginHost");
120
+ if (observedHost !== undefined)
121
+ this.stickyManaged = true;
122
+ const commands = softGet(this.ctx, "commands");
123
+ if (!this.stickyManaged) {
124
+ this.disposeMediated();
125
+ this.disposeSettings();
126
+ this.ensureRaw(commands);
127
+ return;
128
+ }
129
+ this.disposeRaw();
130
+ const host = validHost(observedHost);
131
+ if (host === undefined || commands === undefined) {
132
+ this.clearAdmissionRetry();
133
+ this.disposeMediated();
134
+ this.disposeSettings();
135
+ if (observedHost !== undefined && host === undefined)
136
+ this.warn("host", "DSMM identified a TUI management service with an incompatible public interface; raw command fallback remains disabled.");
137
+ return;
138
+ }
139
+ const hostOwner = original(host);
140
+ const commandsOwner = original(commands);
141
+ if (this.mediated === undefined || this.mediated.owner !== hostOwner || this.mediated.generationId !== host.generationId || this.mediated.commandsOwner !== commandsOwner) {
142
+ this.disposeMediated();
143
+ if (this.admissionRetryReady(hostOwner, host.generationId, commandsOwner)) {
144
+ this.mediated = this.registerManaged(host, hostOwner, commandsOwner);
145
+ }
146
+ }
147
+ await this.reconcileSettings(hostOwner, host.generationId);
148
+ }
149
+ ensureRaw(commands) {
150
+ if (commands === undefined) {
151
+ this.disposeRaw();
152
+ return;
153
+ }
154
+ const owner = original(commands);
155
+ if (this.raw?.commandsOwner === owner)
156
+ return;
157
+ this.disposeRaw();
158
+ const disposers = [];
159
+ try {
160
+ disposers.push(requireDisposer(commands.register(createDsmmStatusCommandDefinition(this.options.controller, this.options.getSettings))));
161
+ if (this.options.getSettings().modules.deepwork.enabled) {
162
+ disposers.push(requireDisposer(commands.register(createDeepworkCommandDefinition(this.options.controller, this.options.getSettings))));
163
+ }
164
+ this.raw = { commandsOwner: owner, disposers };
165
+ }
166
+ catch (cause) {
167
+ disposeAll(disposers);
168
+ this.warn("raw", `DSMM raw command registration failed: ${safeMessage(cause)}`);
169
+ }
170
+ }
171
+ registerManaged(host, owner, commandsOwner) {
172
+ const disposers = [];
173
+ try {
174
+ const begin = (invocation, contributionId, requireDialogs) => this.begin(invocation, contributionId, requireDialogs);
175
+ const deps = { ...this.options, begin };
176
+ disposers.push(requireDisposer(host.registerCommand(this.ctx, DSMM_TUI_CONTRIBUTIONS.manage, createDsmmManagementCommandDefinition(deps))));
177
+ const watcher = host.grants.onChange?.(this.ctx, () => this.abortOperations());
178
+ this.clearAdmissionRetry();
179
+ return { owner, generationId: host.generationId, host, commandsOwner, disposers,
180
+ ...(typeof watcher === "function" ? { grantWatcher: watcher } : {}) };
181
+ }
182
+ catch (cause) {
183
+ disposeAll(disposers);
184
+ if (componentNotAdmitted(cause)) {
185
+ this.deferAdmissionRetry(owner, host.generationId, commandsOwner);
186
+ return undefined;
187
+ }
188
+ this.clearAdmissionRetry();
189
+ this.warn("managed", `DSMM mediated command registration was refused: ${safeMessage(cause)}. Raw fallback remains disabled.`);
190
+ return undefined;
191
+ }
192
+ }
193
+ async reconcileSettings(hostOwner, generationId) {
194
+ const sections = softGet(this.ctx, "tuiSettingsSections");
195
+ const settings = softGet(this.ctx, "settings");
196
+ if (sections === undefined || settings === undefined || typeof sections.register !== "function" || typeof settings.describe !== "function") {
197
+ this.disposeSettings();
198
+ return;
199
+ }
200
+ const sectionsOwner = original(sections);
201
+ const settingsOwner = original(settings);
202
+ let desired;
203
+ try {
204
+ desired = await this.options.deployment.readDesired();
205
+ }
206
+ catch (cause) {
207
+ this.disposeSettings();
208
+ this.warn("namespace-read", `DSMM TUI settings are unavailable: ${safeMessage(cause)}`);
209
+ return;
210
+ }
211
+ if (!this.currentHost(hostOwner, generationId) || this.disposed
212
+ || originalMaybe(softGet(this.ctx, "tuiSettingsSections")) !== sectionsOwner
213
+ || originalMaybe(softGet(this.ctx, "settings")) !== settingsOwner)
214
+ return;
215
+ const namespace = desired.nativeNamespace;
216
+ if (typeof namespace !== "string" || namespace.length === 0) {
217
+ this.disposeSettings();
218
+ this.warn("namespace-missing", "DSMM TUI settings require the Host's real native namespace; none is available.");
219
+ return;
220
+ }
221
+ let descriptor;
222
+ try {
223
+ descriptor = settings.describe({ redactSecrets: true }).find(row => row.ns === namespace);
224
+ }
225
+ catch (cause) {
226
+ this.disposeSettings();
227
+ this.warn("namespace-describe", `DSMM could not verify its native settings namespace: ${safeMessage(cause)}`);
228
+ return;
229
+ }
230
+ if (descriptor === undefined || typeof descriptor.revision !== "number") {
231
+ this.disposeSettings();
232
+ this.warn("namespace-incompatible", `DSMM native settings namespace "${namespace}" is not served by the public settings descriptor.`);
233
+ return;
234
+ }
235
+ if (this.settings?.owner === sectionsOwner && this.settings.namespace === namespace
236
+ && this.settings.hostOwner === hostOwner && this.settings.generationId === generationId)
237
+ return;
238
+ this.disposeSettings();
239
+ try {
240
+ const dispose = requireDisposer(sections.register(createDsmmTuiSettingsSection(namespace)));
241
+ const currentSections = softGet(this.ctx, "tuiSettingsSections");
242
+ const currentSettings = softGet(this.ctx, "settings");
243
+ if (!this.currentHost(hostOwner, generationId) || this.disposed || currentSections === undefined || currentSettings === undefined
244
+ || original(currentSections) !== sectionsOwner || original(currentSettings) !== settingsOwner) {
245
+ dispose();
246
+ return;
247
+ }
248
+ this.settings = { owner: sectionsOwner, namespace, hostOwner, generationId, dispose };
249
+ }
250
+ catch (cause) {
251
+ this.warn("settings-register", `DSMM TUI settings registration was refused for native namespace "${namespace}": ${safeMessage(cause)}`);
252
+ }
253
+ }
254
+ begin(invocation, contributionId, requireDialogs) {
255
+ const mounted = this.mediated;
256
+ if (mounted === undefined || !this.currentHost(mounted.owner, mounted.generationId))
257
+ throw new Error("DSMM TUI management is unavailable.");
258
+ if (!mounted.host.grants.allows(this.ctx, "commands.invoke", contributionId))
259
+ throw new Error("DSMM TUI command permission is not granted.");
260
+ const agents = softGet(this.ctx, "agents");
261
+ const agent = invocation.agent;
262
+ const id = agent.id ?? agent.session.id;
263
+ if (agents === undefined || typeof id !== "string" || agents.get(id) !== agent)
264
+ throw new Error("The command is not bound to an exact live Agent.");
265
+ const agentsOwner = original(agents);
266
+ const admission = this.options.getSettings.admission?.(agent);
267
+ const dialogs = requireDialogs ? softGet(this.ctx, "tuiDialogs") : undefined;
268
+ if (requireDialogs && (dialogs === undefined || typeof dialogs.select !== "function" || typeof dialogs.confirm !== "function" || typeof dialogs.input !== "function")) {
269
+ throw new Error("Managed TUI dialogs are unavailable; no action was started.");
270
+ }
271
+ const dialogsOwner = dialogs === undefined ? undefined : original(dialogs);
272
+ const local = new AbortController();
273
+ const deadline = new AbortController();
274
+ const clock = this.options.clock ?? SYSTEM_CLOCK;
275
+ const deadlineTimer = clock.setTimeout(() => deadline.abort(), ACTION_TIMEOUT_MS);
276
+ this.operations.add(local);
277
+ const signal = invocation.signal === undefined
278
+ ? AbortSignal.any([local.signal, deadline.signal])
279
+ : AbortSignal.any([local.signal, deadline.signal, invocation.signal]);
280
+ const assertCurrent = () => {
281
+ if (signal.aborted || this.disposed)
282
+ throw abortError();
283
+ if (this.mediated !== mounted || !this.currentHost(mounted.owner, mounted.generationId)
284
+ || !mounted.host.grants.allows(this.ctx, "commands.invoke", contributionId))
285
+ throw new Error("DSMM TUI command authority changed.");
286
+ const currentAgents = softGet(this.ctx, "agents");
287
+ if (currentAgents === undefined || original(currentAgents) !== agentsOwner || currentAgents.get(id) !== agent)
288
+ throw new Error("The exact live Agent changed.");
289
+ if (admission !== undefined) {
290
+ const current = this.options.getSettings.admission?.(agent);
291
+ if (current !== admission || current?.epoch !== admission.epoch)
292
+ throw new Error("The DSMM admission changed.");
293
+ }
294
+ if (dialogsOwner !== undefined) {
295
+ const currentDialogs = softGet(this.ctx, "tuiDialogs");
296
+ if (currentDialogs === undefined || original(currentDialogs) !== dialogsOwner)
297
+ throw new Error("The managed dialog owner changed.");
298
+ }
299
+ };
300
+ const checked = async (operation) => {
301
+ assertCurrent();
302
+ const result = await operation();
303
+ assertCurrent();
304
+ return result;
305
+ };
306
+ let closed = false;
307
+ return {
308
+ signal,
309
+ agent,
310
+ assertCurrent,
311
+ select: (title, options) => checked(() => dialogs.select({ title, options, signal, timeoutMs: DIALOG_TIMEOUT_MS })),
312
+ confirm: (title, message, confirmLabel) => checked(() => dialogs.confirm({ title, message,
313
+ ...(confirmLabel === undefined ? {} : { confirmLabel }), cancelLabel: "Cancel", signal, timeoutMs: DIALOG_TIMEOUT_MS })),
314
+ input: (title, placeholder) => checked(() => dialogs.input({ title, ...(placeholder === undefined ? {} : { placeholder }), signal, timeoutMs: DIALOG_TIMEOUT_MS })),
315
+ close: () => { if (closed)
316
+ return; closed = true; clock.clearTimeout(deadlineTimer); this.operations.delete(local); local.abort(); }
317
+ };
318
+ }
319
+ currentHost(owner, generationId) {
320
+ const host = validHost(softGet(this.ctx, "tuiPluginHost"));
321
+ return host !== undefined && original(host) === owner && host.generationId === generationId;
322
+ }
323
+ abortOperations() {
324
+ for (const operation of this.operations)
325
+ operation.abort();
326
+ this.operations.clear();
327
+ }
328
+ admissionRetryReady(owner, generationId, commandsOwner) {
329
+ const retry = this.admissionRetry;
330
+ if (retry === undefined)
331
+ return true;
332
+ if (retry.owner !== owner || retry.generationId !== generationId || retry.commandsOwner !== commandsOwner) {
333
+ this.clearAdmissionRetry();
334
+ return true;
335
+ }
336
+ return retry.ready && retry.failures < ADMISSION_RETRY_ATTEMPTS;
337
+ }
338
+ deferAdmissionRetry(owner, generationId, commandsOwner) {
339
+ let retry = this.admissionRetry;
340
+ if (retry === undefined || retry.owner !== owner || retry.generationId !== generationId || retry.commandsOwner !== commandsOwner) {
341
+ this.clearAdmissionRetry();
342
+ retry = { owner, generationId, commandsOwner, failures: 0, ready: false };
343
+ this.admissionRetry = retry;
344
+ }
345
+ retry.failures++;
346
+ retry.ready = false;
347
+ if (retry.failures >= ADMISSION_RETRY_ATTEMPTS) {
348
+ this.warn(`managed-admission-${generationId}`, "DSMM TUI command registration did not become admitted within the bounded readiness window; raw fallback remains disabled.");
349
+ return;
350
+ }
351
+ const clock = this.options.clock ?? SYSTEM_CLOCK;
352
+ retry.timer = clock.setTimeout(() => {
353
+ if (this.admissionRetry !== retry)
354
+ return;
355
+ retry.timer = undefined;
356
+ if (this.disposed || !this.currentHost(owner, generationId)
357
+ || originalMaybe(softGet(this.ctx, "commands")) !== commandsOwner) {
358
+ this.clearAdmissionRetry();
359
+ return;
360
+ }
361
+ retry.ready = true;
362
+ this.schedule();
363
+ }, ADMISSION_RETRY_INTERVAL_MS);
364
+ }
365
+ clearAdmissionRetry() {
366
+ const retry = this.admissionRetry;
367
+ if (retry?.timer !== undefined)
368
+ (this.options.clock ?? SYSTEM_CLOCK).clearTimeout(retry.timer);
369
+ this.admissionRetry = undefined;
370
+ }
371
+ disposeRaw() { if (this.raw !== undefined)
372
+ disposeAll(this.raw.disposers); this.raw = undefined; }
373
+ disposeMediated() {
374
+ if (this.mediated !== undefined) {
375
+ this.mediated.grantWatcher?.();
376
+ disposeAll(this.mediated.disposers);
377
+ }
378
+ this.mediated = undefined;
379
+ this.abortOperations();
380
+ }
381
+ disposeSettings() { this.settings?.dispose(); this.settings = undefined; }
382
+ warn(key, message) {
383
+ if (this.warned.has(key))
384
+ return;
385
+ this.warned.add(key);
386
+ this.ctx.logger?.warn(message);
387
+ }
388
+ }
389
+ export function registerDsmmTuiAdapter(ctx, options) {
390
+ return new DsmmTuiAdapter(ctx, options);
391
+ }
392
+ function softGet(ctx, name) {
393
+ return ctx.get?.call(ctx, name, false);
394
+ }
395
+ function validHost(value) {
396
+ if (value === null || typeof value !== "object")
397
+ return undefined;
398
+ const host = value;
399
+ return typeof host.generationId === "string" && host.generationId.length > 0 && typeof host.registerCommand === "function"
400
+ && host.grants !== undefined && typeof host.grants.allows === "function" ? host : undefined;
401
+ }
402
+ function original(value) { return Reflect.get(value, symbols.original) ?? value; }
403
+ function originalMaybe(value) { return value !== null && typeof value === "object" ? original(value) : undefined; }
404
+ function requireDisposer(value) {
405
+ if (typeof value !== "function")
406
+ throw new Error("Host registration did not expose a disposer");
407
+ return value;
408
+ }
409
+ function disposeAll(disposers) {
410
+ for (const dispose of [...disposers].reverse()) {
411
+ try {
412
+ dispose();
413
+ }
414
+ catch { }
415
+ }
416
+ }
417
+ function abortError() { const error = new Error("DSMM TUI action was cancelled."); error.name = "AbortError"; return error; }
418
+ function safeMessage(cause) { return cause instanceof Error ? cause.message.replace(/[\u0000-\u001F\u007F]/gu, " ").slice(0, 400) : "unknown error"; }
419
+ function componentNotAdmitted(cause) {
420
+ return cause !== null && typeof cause === "object" && Reflect.get(cause, "code") === "COMPONENT_NOT_ADMITTED";
421
+ }
422
+ //# sourceMappingURL=tui-adapter.js.map
@@ -0,0 +1,98 @@
1
+ import type { DshCommandInvocation, DshCommandResult, DshContext } from "./dsh-types.js";
2
+ import type { DsmmCommandDefinition } from "./commands.js";
3
+ export interface TuiPluginHostLike {
4
+ readonly generationId: string;
5
+ readonly grants: {
6
+ allows(pluginCtx: DshContext, permission: string, scope: string): boolean;
7
+ onChange?(pluginCtx: DshContext, listener: () => void): (() => void) | undefined;
8
+ };
9
+ registerCommand(pluginCtx: DshContext, contributionId: string, definition: DsmmCommandDefinition): () => void;
10
+ }
11
+ export interface TuiDialogOption {
12
+ id: string;
13
+ label: string;
14
+ description?: string;
15
+ }
16
+ export interface TuiDialogsLike {
17
+ select(request: {
18
+ title: string;
19
+ options: readonly TuiDialogOption[];
20
+ signal?: AbortSignal;
21
+ timeoutMs?: number;
22
+ }): Promise<string | undefined>;
23
+ confirm(request: {
24
+ title: string;
25
+ message?: string;
26
+ confirmLabel?: string;
27
+ cancelLabel?: string;
28
+ signal?: AbortSignal;
29
+ timeoutMs?: number;
30
+ }): Promise<boolean>;
31
+ input(request: {
32
+ title: string;
33
+ placeholder?: string;
34
+ initial?: string;
35
+ signal?: AbortSignal;
36
+ timeoutMs?: number;
37
+ }): Promise<string | undefined>;
38
+ }
39
+ export type TuiSettingsFieldWrite = {
40
+ kind: "set";
41
+ value: unknown;
42
+ } | {
43
+ kind: "clear";
44
+ };
45
+ export interface TuiSettingsFieldOption {
46
+ value: string;
47
+ label: string;
48
+ descriptions?: Record<string, string>;
49
+ }
50
+ export interface TuiSettingsField {
51
+ path: readonly string[];
52
+ label: string;
53
+ descriptions?: Record<string, string>;
54
+ hint?: string;
55
+ hintDescriptions?: Record<string, string>;
56
+ group?: string;
57
+ kind: "text" | "number" | "boolean" | "select";
58
+ options?: readonly TuiSettingsFieldOption[];
59
+ format?(value: unknown): string;
60
+ parse?(text: string): TuiSettingsFieldWrite | undefined;
61
+ }
62
+ export interface TuiSettingsSection {
63
+ ns: string;
64
+ title: string;
65
+ descriptions?: Record<string, string>;
66
+ groups?: readonly {
67
+ id: string;
68
+ title: string;
69
+ descriptions?: Record<string, string>;
70
+ mode?: "inline" | "page";
71
+ }[];
72
+ fields: readonly TuiSettingsField[];
73
+ }
74
+ export interface TuiSettingsSectionsLike {
75
+ register(section: TuiSettingsSection): () => void;
76
+ }
77
+ export interface TuiSettingsLike {
78
+ describe(options?: {
79
+ redactSecrets?: boolean;
80
+ }): readonly {
81
+ ns: string;
82
+ revision: number;
83
+ value?: unknown;
84
+ user?: unknown;
85
+ }[];
86
+ }
87
+ export interface DsmmTuiActionAuthority {
88
+ readonly signal: AbortSignal;
89
+ readonly agent: DshCommandInvocation["agent"];
90
+ assertCurrent(): void;
91
+ select(title: string, options: readonly TuiDialogOption[]): Promise<string | undefined>;
92
+ confirm(title: string, message: string, confirmLabel?: string): Promise<boolean>;
93
+ input(title: string, placeholder?: string): Promise<string | undefined>;
94
+ close(): void;
95
+ }
96
+ export type BeginDsmmTuiAction = (invocation: DshCommandInvocation, contributionId: string, requireDialogs: boolean) => DsmmTuiActionAuthority;
97
+ export type DsmmTuiCommandHandler = (invocation: DshCommandInvocation) => DshCommandResult | Promise<DshCommandResult>;
98
+ //# sourceMappingURL=tui-types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tui-types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsmm/dsmm",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
4
4
  "description": "Native Deepwork roles, routing, profiles, and permission controls for DeepSeek Harness.",
5
5
  "author": "Hugefiver",
6
6
  "license": "LicenseRef-AAAPL",
@@ -102,17 +102,19 @@
102
102
  "docs/safety-guards.md",
103
103
  "docs/settings-status.md",
104
104
  "docs/testing.md",
105
+ "docs/tui.md",
105
106
  "docs/web-fetch-fakeip.md",
106
107
  "patches",
107
108
  "prompts",
108
109
  "skills",
109
110
  "cordis.patch.yml",
111
+ "dsh-plugin.json",
110
112
  "LICENSE",
111
113
  "README.md"
112
114
  ],
113
115
  "engines": {
114
116
  "node": ">=22",
115
- "dsh": "0.2.1-rc.2"
117
+ "dsh": ">=0.2.1-rc.2 <0.3.0"
116
118
  },
117
119
  "dependencies": {
118
120
  "@deepseek-ai/dsh-web-fetch-http": "0.2.1-rc.2",