@dsmm/dsmm 0.1.1 → 0.1.5

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 (108) hide show
  1. package/README.md +26 -15
  2. package/agent-presets/dsmm-builder/agent.cordis.yml +14 -12
  3. package/agent-presets/dsmm-builder/preset.yml +1 -1
  4. package/agent-presets/dsmm-clarifier/agent.cordis.yml +4 -2
  5. package/agent-presets/dsmm-clarifier/preset.yml +1 -1
  6. package/agent-presets/dsmm-code-search/agent.cordis.yml +4 -2
  7. package/agent-presets/dsmm-code-search/preset.yml +1 -1
  8. package/agent-presets/dsmm-creative/agent.cordis.yml +3 -1
  9. package/agent-presets/dsmm-creative/preset.yml +1 -1
  10. package/agent-presets/dsmm-doc-search/agent.cordis.yml +4 -2
  11. package/agent-presets/dsmm-doc-search/preset.yml +1 -1
  12. package/agent-presets/dsmm-media-reader/agent.cordis.yml +4 -2
  13. package/agent-presets/dsmm-media-reader/preset.yml +1 -1
  14. package/agent-presets/dsmm-oracle/agent.cordis.yml +3 -1
  15. package/agent-presets/dsmm-oracle/preset.yml +1 -1
  16. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +3 -1
  17. package/agent-presets/dsmm-oracle-2nd/preset.yml +1 -1
  18. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +15 -13
  19. package/agent-presets/dsmm-orchestrator/preset.yml +2 -2
  20. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +4 -2
  21. package/agent-presets/dsmm-plan-critic/preset.yml +1 -1
  22. package/agent-presets/dsmm-planner/agent.cordis.yml +4 -2
  23. package/agent-presets/dsmm-planner/preset.yml +1 -1
  24. package/agent-presets/dsmm-reviewer/agent.cordis.yml +4 -2
  25. package/agent-presets/dsmm-reviewer/preset.yml +1 -1
  26. package/docs/agent-presets.md +15 -5
  27. package/docs/compatibility.md +66 -11
  28. package/docs/migration-from-ocmm.md +8 -0
  29. package/docs/model-routing.md +25 -7
  30. package/docs/profiles.md +95 -0
  31. package/docs/releasing.md +66 -19
  32. package/docs/runtime-recovery.md +39 -14
  33. package/docs/settings-status.md +13 -5
  34. package/lib/client/ProfilesSection.d.ts +11 -0
  35. package/lib/client/ProfilesSection.js +66 -0
  36. package/lib/client/SessionProfiles.d.ts +19 -0
  37. package/lib/client/SessionProfiles.js +24 -0
  38. package/lib/client/StructuredEditor.d.ts +11 -0
  39. package/lib/client/StructuredEditor.js +74 -0
  40. package/lib/client/controller.d.ts +115 -0
  41. package/lib/client/controller.js +340 -0
  42. package/lib/client/index.d.ts +13 -0
  43. package/lib/client/index.js +54 -0
  44. package/lib/client/locales.d.ts +145 -0
  45. package/lib/client/locales.js +91 -0
  46. package/lib/client/session-labels.d.ts +8 -0
  47. package/lib/client/session-labels.js +13 -0
  48. package/lib/client/structured.d.ts +18 -0
  49. package/lib/client/structured.js +98 -0
  50. package/lib/client/styles.d.ts +3 -0
  51. package/lib/client/styles.js +36 -0
  52. package/lib/client.js +2825 -0
  53. package/lib/commands.d.ts +3 -3
  54. package/lib/commands.js +5 -4
  55. package/lib/dsh-types.d.ts +20 -0
  56. package/lib/guards.d.ts +2 -2
  57. package/lib/guards.js +3 -2
  58. package/lib/index.d.ts +12 -4
  59. package/lib/index.js +98 -20
  60. package/lib/mode.d.ts +2 -2
  61. package/lib/mode.js +1 -1
  62. package/lib/model-routing.d.ts +2 -2
  63. package/lib/model-routing.js +100 -15
  64. package/lib/preset-registry.js +5 -3
  65. package/lib/profile-remote.d.ts +37 -0
  66. package/lib/profile-remote.js +219 -0
  67. package/lib/profile-rpc.d.ts +35 -0
  68. package/lib/profile-rpc.js +187 -0
  69. package/lib/profile-runtime.d.ts +63 -0
  70. package/lib/profile-runtime.js +310 -0
  71. package/lib/profile-store.d.ts +60 -0
  72. package/lib/profile-store.js +588 -0
  73. package/lib/profile-types.d.ts +80 -0
  74. package/lib/profile-types.js +2 -0
  75. package/lib/profiles.d.ts +26 -0
  76. package/lib/profiles.js +269 -0
  77. package/lib/prompts.d.ts +2 -2
  78. package/lib/prompts.js +4 -4
  79. package/lib/role-providers.d.ts +2 -2
  80. package/lib/role-providers.js +49 -6
  81. package/lib/role-routing.d.ts +37 -3
  82. package/lib/role-routing.js +110 -35
  83. package/lib/role-subagents.d.ts +2 -2
  84. package/lib/role-subagents.js +6 -4
  85. package/lib/roles.d.ts +4 -0
  86. package/lib/roles.js +43 -27
  87. package/lib/routing-policy.d.ts +32 -0
  88. package/lib/routing-policy.js +92 -0
  89. package/lib/runtime-recovery.d.ts +2 -2
  90. package/lib/runtime-recovery.js +215 -54
  91. package/lib/session-metadata.d.ts +13 -0
  92. package/lib/session-metadata.js +34 -0
  93. package/lib/session-persistence.d.ts +35 -0
  94. package/lib/session-persistence.js +304 -0
  95. package/lib/settings.d.ts +34 -1
  96. package/lib/settings.js +33 -7
  97. package/lib/state.d.ts +1 -0
  98. package/lib/state.js +4 -0
  99. package/lib/status.d.ts +9 -1
  100. package/lib/status.js +34 -12
  101. package/locale/en.json +6 -0
  102. package/locale/zh.json +6 -0
  103. package/package.json +66 -15
  104. package/patches/agent-presets-root.example.cordis.patch.yml +6 -10
  105. package/prompts/deepseek-v4-pro.md +1 -1
  106. package/prompts/deepwork.md +3 -3
  107. package/scripts/repair-session-log.mjs +476 -0
  108. package/scripts/session-repair-native-verifier.mjs +367 -0
@@ -0,0 +1,340 @@
1
+ import { isProfileId } from "../profile-remote.js";
2
+ import { editStructuredPath, moveFallback } from "./structured.js";
3
+ const NEW_EDITOR = "";
4
+ export const NEW_PROFILE_CONTENT = '{\n "version": 1,\n "id": "new-profile",\n "label": "New profile",\n "settings": {\n // Runtime overlay only. Omitted fields inherit the deployment baseline.\n "defaultActive": true\n }\n}\n';
5
+ /** A valid external CAS conflict is reconcilable; corruption is never reset implicitly. */
6
+ export function canReconcileSelection(snapshot) {
7
+ return snapshot !== null && (snapshot.selectionRevision === "absent" || /^[a-f0-9]{64}$/u.test(snapshot.selectionRevision))
8
+ && (snapshot.selectionError === undefined || snapshot.selectionError.code === "conflict");
9
+ }
10
+ /** Stable native Store seat, with no filesystem or transport authority. */
11
+ export class ProfilesController {
12
+ remote;
13
+ current = { snapshot: null, editor: null, dirty: false, busy: null, issue: null, notice: null, pendingEditor: null,
14
+ catalog: null, catalogBusy: false, catalogUnavailable: true, currentSessionId: null, session: null, sessionChoice: null, sessionBusy: null, sessionIssue: null, sessionNotice: null, invalidFields: [], editorEpoch: 0 };
15
+ accepted = null;
16
+ listeners = new Set();
17
+ generation = 0;
18
+ disposed = false;
19
+ sessionGeneration = 0;
20
+ catalogGeneration = 0;
21
+ catalogRemote = null;
22
+ store = {
23
+ getSnapshot: () => this.current,
24
+ subscribe: (listener) => {
25
+ this.listeners.add(listener);
26
+ return () => { this.listeners.delete(listener); };
27
+ },
28
+ };
29
+ actions = {
30
+ refresh: () => this.refresh(), open: (id) => this.open(id), create: () => this.open(NEW_EDITOR), reload: () => this.reload(),
31
+ editId: (id) => this.editId(id), editContent: (content) => this.editContent(content),
32
+ save: () => this.save(), apply: () => this.apply(), reset: () => this.reset(),
33
+ discardAndOpen: () => this.discardAndOpen(), cancelDiscard: () => this.publish({ pendingEditor: null }),
34
+ editPath: (path, value) => this.editPath(path, value), moveFallback: (role, from, to) => this.editFallbackOrder(role, from, to),
35
+ editRoute: (path, provider, model) => this.editRoute(path, provider, model),
36
+ refreshCatalog: () => this.refreshCatalog(), refreshSession: () => this.refreshSession(),
37
+ chooseSessionProfile: (id) => { if (!this.disposed && this.current.sessionBusy === null && this.current.busy === null && !this.current.dirty)
38
+ this.publish({ sessionChoice: id, sessionNotice: null }); },
39
+ applySession: () => this.selectSession(false), resetSession: () => this.selectSession(true),
40
+ setFieldInvalid: (field, invalid) => {
41
+ if (this.disposed)
42
+ return;
43
+ const invalidFields = this.current.invalidFields.filter((candidate) => candidate !== field);
44
+ if (invalid)
45
+ invalidFields.push(field);
46
+ if (invalidFields.join("\n") !== this.current.invalidFields.join("\n"))
47
+ this.publish({ invalidFields, ...(invalid ? { dirty: true } : {}) });
48
+ },
49
+ };
50
+ constructor(remote) {
51
+ this.remote = remote;
52
+ }
53
+ dispose() { this.disposed = true; this.generation += 1; this.sessionGeneration += 1; this.catalogGeneration += 1; this.catalogRemote = null; this.listeners.clear(); }
54
+ attachCatalog(remote) {
55
+ if (this.disposed)
56
+ return;
57
+ this.catalogGeneration += 1;
58
+ this.catalogRemote = remote;
59
+ this.publish({ catalogBusy: false, catalogUnavailable: remote === null });
60
+ if (remote !== null)
61
+ void this.refreshCatalog();
62
+ }
63
+ setSession(id) {
64
+ if (this.disposed || id === this.current.currentSessionId)
65
+ return;
66
+ this.sessionGeneration += 1;
67
+ this.publish({ currentSessionId: id, session: null, sessionChoice: null, sessionBusy: null, sessionIssue: null, sessionNotice: null });
68
+ if (id !== null)
69
+ void this.refreshSession();
70
+ }
71
+ async refreshCatalog() {
72
+ if (this.disposed || this.current.catalogBusy || this.catalogRemote === null)
73
+ return;
74
+ const remote = this.catalogRemote, generation = ++this.catalogGeneration;
75
+ this.publish({ catalogBusy: true });
76
+ try {
77
+ const catalog = await this.unwrap(remote.modelCatalog());
78
+ if (!this.disposed && generation === this.catalogGeneration)
79
+ this.publish({ catalog, catalogUnavailable: false });
80
+ }
81
+ catch {
82
+ if (!this.disposed && generation === this.catalogGeneration)
83
+ this.publish({ catalogUnavailable: true });
84
+ }
85
+ finally {
86
+ if (!this.disposed && generation === this.catalogGeneration)
87
+ this.publish({ catalogBusy: false });
88
+ }
89
+ }
90
+ async refreshSession() {
91
+ const id = this.current.currentSessionId;
92
+ if (this.disposed || id === null || this.current.sessionBusy !== null)
93
+ return;
94
+ const generation = ++this.sessionGeneration;
95
+ const live = () => !this.disposed && generation === this.sessionGeneration && id === this.current.currentSessionId;
96
+ this.publish({ sessionBusy: "read", sessionIssue: null, sessionNotice: null });
97
+ try {
98
+ const session = await this.unwrap(this.remote.describeSession(id));
99
+ if (session.sessionId !== id)
100
+ throw { kind: "assembly", code: "unavailable" };
101
+ if (live())
102
+ this.publish({ session, sessionChoice: session.selection.selectedId });
103
+ }
104
+ catch (error) {
105
+ if (live())
106
+ this.publish({ sessionIssue: this.issue(error) });
107
+ }
108
+ finally {
109
+ if (live())
110
+ this.publish({ sessionBusy: null });
111
+ }
112
+ }
113
+ async selectSession(reset) {
114
+ const { currentSessionId: id, session, sessionChoice, snapshot } = this.current;
115
+ if (this.disposed || id === null || session === null || !session.switchAllowed || this.current.sessionBusy !== null
116
+ || this.current.busy !== null || this.current.dirty || this.current.pendingEditor !== null)
117
+ return;
118
+ const selectedId = reset ? null : sessionChoice;
119
+ const revision = snapshot?.profiles.find((profile) => profile.id === selectedId)?.revision;
120
+ if (selectedId !== null && revision == null)
121
+ return;
122
+ const generation = ++this.sessionGeneration;
123
+ const live = () => !this.disposed && generation === this.sessionGeneration && id === this.current.currentSessionId;
124
+ this.publish({ sessionBusy: reset ? "reset" : "apply", sessionIssue: null, sessionNotice: null });
125
+ try {
126
+ const accepted = await this.unwrap(this.remote.selectSession(id, {
127
+ sessionId: id, id: selectedId, ...(selectedId === null ? {} : { expectedRevision: revision }),
128
+ expectedSelectionRevision: session.selection.selectionRevision, expectedAdmissionEpoch: session.admissionEpoch,
129
+ }));
130
+ if (accepted.sessionId !== id)
131
+ throw { kind: "assembly", code: "unavailable" };
132
+ if (live())
133
+ this.publish({ session: accepted, sessionChoice: accepted.selection.selectedId, sessionNotice: reset ? "reset" : "applied" });
134
+ }
135
+ catch (error) {
136
+ if (live())
137
+ this.publish({ sessionIssue: this.issue(error) });
138
+ }
139
+ finally {
140
+ if (live())
141
+ this.publish({ sessionBusy: null });
142
+ }
143
+ }
144
+ publish(patch) {
145
+ if (this.disposed)
146
+ return;
147
+ this.current = { ...this.current, ...patch };
148
+ for (const listener of this.listeners)
149
+ listener();
150
+ }
151
+ accept(document) {
152
+ this.accepted = { ...document };
153
+ this.publish({ editor: { ...document }, dirty: false, pendingEditor: null, invalidFields: [], editorEpoch: this.current.editorEpoch + 1 });
154
+ }
155
+ async unwrap(request, field) {
156
+ const result = await request;
157
+ if (result.ok)
158
+ return result.value;
159
+ if (result.error.code === "dsmm-profiles/refused") {
160
+ throw { kind: "domain", ...result.error.details };
161
+ }
162
+ if (["gateway/input-invalid", "gateway/arguments-invalid"].includes(String(result.error.code))) {
163
+ throw { kind: "domain", code: "validation", field, message: "The native Host rejected a request field. Check the profile ID and document size before retrying." };
164
+ }
165
+ throw { kind: "transport", code: result.error.code };
166
+ }
167
+ issue(error) {
168
+ if (typeof error === "object" && error !== null && "kind" in error && (error.kind === "domain" || error.kind === "transport"))
169
+ return error;
170
+ return { kind: "assembly", code: "unavailable" };
171
+ }
172
+ async perform(busy, operation) {
173
+ if (this.disposed || this.current.busy !== null || this.current.sessionBusy === "apply" || this.current.sessionBusy === "reset" || this.current.pendingEditor !== null)
174
+ return;
175
+ const generation = ++this.generation;
176
+ const live = () => !this.disposed && generation === this.generation;
177
+ this.publish({ busy, issue: null, notice: null });
178
+ try {
179
+ await operation(live);
180
+ }
181
+ catch (error) {
182
+ if (live())
183
+ this.publish({ issue: this.issue(error) });
184
+ }
185
+ finally {
186
+ if (live())
187
+ this.publish({ busy: null });
188
+ }
189
+ }
190
+ async refresh() {
191
+ await this.perform("refresh", async (live) => {
192
+ const snapshot = await this.unwrap(this.remote.describe());
193
+ if (live())
194
+ this.publish({ snapshot });
195
+ });
196
+ }
197
+ async open(id) {
198
+ if (this.disposed || this.current.busy !== null || this.current.pendingEditor !== null)
199
+ return;
200
+ if (id !== NEW_EDITOR && this.current.editor?.id === id)
201
+ return;
202
+ if (this.current.dirty) {
203
+ this.publish({ pendingEditor: id });
204
+ return;
205
+ }
206
+ await this.loadEditor(id);
207
+ }
208
+ async reload() {
209
+ const editor = this.current.editor;
210
+ if (editor === null || editor.revision === null || this.current.busy !== null || this.current.pendingEditor !== null)
211
+ return;
212
+ if (this.current.dirty) {
213
+ this.publish({ pendingEditor: editor.id });
214
+ return;
215
+ }
216
+ await this.loadEditor(editor.id);
217
+ }
218
+ async loadEditor(id) {
219
+ if (id === NEW_EDITOR) {
220
+ this.accepted = null;
221
+ this.publish({ editor: { id: "new-profile", content: NEW_PROFILE_CONTENT, revision: null }, dirty: true, issue: null, notice: null, pendingEditor: null, invalidFields: [], editorEpoch: this.current.editorEpoch + 1 });
222
+ return;
223
+ }
224
+ await this.perform("read", async (live) => {
225
+ const document = await this.unwrap(this.remote.read(id), "id");
226
+ if (live())
227
+ this.accept(document);
228
+ });
229
+ }
230
+ async discardAndOpen() {
231
+ const wanted = this.current.pendingEditor;
232
+ if (wanted === null || this.current.busy !== null)
233
+ return;
234
+ this.publish({ pendingEditor: null });
235
+ // Only explicit confirmation clears a draft; a failed read restores it.
236
+ const previous = this.current.editor;
237
+ const accepted = this.accepted;
238
+ await this.loadEditor(wanted);
239
+ if (this.current.issue !== null && previous !== null) {
240
+ this.accepted = accepted;
241
+ this.publish({ editor: previous, dirty: true });
242
+ }
243
+ }
244
+ editId(id) {
245
+ const editor = this.current.editor;
246
+ if (editor === null || editor.revision !== null || this.current.busy !== null || this.current.pendingEditor !== null)
247
+ return;
248
+ const content = editStructuredPath(editor.content, ["id"], id);
249
+ if (content === null) {
250
+ this.publish({ issue: { kind: "domain", code: "validation", field: "content" }, notice: null });
251
+ return;
252
+ }
253
+ this.publish({ editor: { ...editor, id, content }, dirty: true, issue: null, notice: null });
254
+ }
255
+ editContent(content) {
256
+ const editor = this.current.editor;
257
+ if (editor === null || this.current.busy !== null || this.current.pendingEditor !== null)
258
+ return;
259
+ this.publish({ editor: { ...editor, content }, dirty: this.accepted === null || this.accepted.content !== content || this.accepted.id !== editor.id, issue: null, notice: null });
260
+ }
261
+ editPath(path, value) {
262
+ const editor = this.current.editor;
263
+ if (editor === null || this.current.busy !== null || this.current.pendingEditor !== null)
264
+ return;
265
+ const content = editStructuredPath(editor.content, path, value);
266
+ if (content === null) {
267
+ this.publish({ issue: { kind: "domain", code: "validation", field: "content" }, notice: null });
268
+ return;
269
+ }
270
+ this.editContent(content);
271
+ }
272
+ editRoute(path, provider, model) {
273
+ const editor = this.current.editor;
274
+ if (editor === null || this.current.busy !== null || this.current.pendingEditor !== null)
275
+ return;
276
+ let content = editor.content;
277
+ for (const [key, value] of [["provider", provider], ["model", model], ["reasoningEffort", undefined]]) {
278
+ content = editStructuredPath(content, [...path, key], value);
279
+ if (content === null) {
280
+ this.publish({ issue: { kind: "domain", code: "validation", field: "content" }, notice: null });
281
+ return;
282
+ }
283
+ }
284
+ this.editContent(content);
285
+ }
286
+ editFallbackOrder(role, from, to) {
287
+ const editor = this.current.editor;
288
+ if (editor === null || this.current.busy !== null || this.current.pendingEditor !== null)
289
+ return;
290
+ const content = moveFallback(editor.content, role, from, to);
291
+ if (content !== null)
292
+ this.editContent(content);
293
+ }
294
+ async save() {
295
+ const editor = this.current.editor;
296
+ if (editor === null || !this.current.dirty || this.current.snapshot === null || this.current.busy !== null || this.current.pendingEditor !== null || this.current.invalidFields.length > 0)
297
+ return;
298
+ if (!isProfileId(editor.id)) {
299
+ this.publish({ issue: { kind: "domain", code: "validation", field: "id" }, notice: null });
300
+ return;
301
+ }
302
+ await this.perform("save", async (live) => {
303
+ const document = await this.unwrap(this.remote.save({ id: editor.id, content: editor.content, expectedRevision: editor.revision }), "content");
304
+ if (!live())
305
+ return;
306
+ this.accept(document);
307
+ // The accepted response proves save; applying remains a separate commit.
308
+ const old = this.current.snapshot;
309
+ const profiles = old.profiles.filter((item) => item.id !== document.id);
310
+ profiles.push({ id: document.id, revision: document.revision, ...(document.label === undefined ? {} : { label: document.label }) });
311
+ profiles.sort((a, b) => a.id.localeCompare(b.id));
312
+ this.publish({ snapshot: { ...old, profiles }, notice: { key: "saved", id: document.id } });
313
+ });
314
+ }
315
+ async apply() {
316
+ const { editor, snapshot, dirty } = this.current;
317
+ if (editor?.revision == null || !canReconcileSelection(snapshot) || dirty)
318
+ return;
319
+ await this.perform("apply", async (live) => {
320
+ const accepted = await this.unwrap(this.remote.select({ id: editor.id, expectedRevision: editor.revision, expectedSelectionRevision: snapshot.selectionRevision }));
321
+ if (live())
322
+ this.acceptSelection(accepted, { key: "applied", id: accepted.selectedId ?? undefined });
323
+ });
324
+ }
325
+ async reset() {
326
+ const snapshot = this.current.snapshot;
327
+ if (!canReconcileSelection(snapshot))
328
+ return;
329
+ await this.perform("reset", async (live) => {
330
+ const accepted = await this.unwrap(this.remote.select({ id: null, expectedSelectionRevision: snapshot.selectionRevision }));
331
+ if (live())
332
+ this.acceptSelection(accepted, { key: "reset" });
333
+ });
334
+ }
335
+ acceptSelection(snapshot, notice) {
336
+ this.publish({ snapshot, notice: snapshot.selectionError === undefined ? notice : null,
337
+ issue: snapshot.selectionError === undefined ? null : { kind: "domain", ...snapshot.selectionError, source: "selection" } });
338
+ }
339
+ }
340
+ //# sourceMappingURL=controller.js.map
@@ -0,0 +1,13 @@
1
+ import type { Context } from "@deepseek-ai/cordis";
2
+ export { ProfilesController, NEW_PROFILE_CONTENT } from "./controller.js";
3
+ export type { ProfilesActions, ProfilesViewSnapshot, ProfilesIssue } from "./controller.js";
4
+ export { ProfilesSection } from "./ProfilesSection.js";
5
+ export type { ProfilesSectionProps, ProfilesInjected } from "./ProfilesSection.js";
6
+ export { NS, en, zh } from "./locales.js";
7
+ export { TYPERT_REMOTE } from "../profile-remote.js";
8
+ export { SessionProfiles } from "./SessionProfiles.js";
9
+ export { structuredDocument, editStructuredPath, moveFallback } from "./structured.js";
10
+ /** No self-dependency on a namespace that this contribution has not mounted. */
11
+ export declare const inject: readonly ["slots", "locale", "remote"];
12
+ export declare function apply(ctx: Context): Promise<void>;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,54 @@
1
+ import { TYPERT_REMOTE } from "../profile-remote.js";
2
+ import { ProfilesController } from "./controller.js";
3
+ import { NS, en, zh } from "./locales.js";
4
+ import { ProfilesSection } from "./ProfilesSection.js";
5
+ import { PROFILE_STYLES } from "./styles.js";
6
+ import { SessionProfiles } from "./SessionProfiles.js";
7
+ export { ProfilesController, NEW_PROFILE_CONTENT } from "./controller.js";
8
+ export { ProfilesSection } from "./ProfilesSection.js";
9
+ export { NS, en, zh } from "./locales.js";
10
+ export { TYPERT_REMOTE } from "../profile-remote.js";
11
+ export { SessionProfiles } from "./SessionProfiles.js";
12
+ export { structuredDocument, editStructuredPath, moveFallback } from "./structured.js";
13
+ /** No self-dependency on a namespace that this contribution has not mounted. */
14
+ export const inject = ["slots", "locale", "remote"];
15
+ export async function apply(ctx) {
16
+ await ctx.remote.$mount(TYPERT_REMOTE);
17
+ await ctx.inject(["remote.dsmmProfiles"], (profileCtx) => {
18
+ const controller = new ProfilesController(profileCtx.remote.dsmmProfiles);
19
+ profileCtx.effect(() => () => controller.dispose(), "dsmm: profile editor");
20
+ profileCtx.effect(() => profileCtx.locale.register(NS, { en, zh }), "dsmm: profile locale");
21
+ profileCtx.effect(() => {
22
+ const style = document.createElement("style");
23
+ style.dataset.dsmmProfiles = "";
24
+ style.textContent = PROFILE_STYLES;
25
+ document.head.append(style);
26
+ return () => style.remove();
27
+ }, "dsmm: profile styles");
28
+ const t = profileCtx.locale.bind(NS);
29
+ profileCtx.slots.inject("settings.section", () => profileCtx.slots.register({
30
+ name: "settings.section", id: "dsmm-profiles", order: 30,
31
+ label: () => t("title"), locale: NS,
32
+ inject: () => ({ hooks: { profiles: controller.store }, ...controller.actions }),
33
+ }, ProfilesSection));
34
+ // Optional native services have their own lifetime. Do not await them or
35
+ // make sessionless Settings depend on a Conversation/session provider.
36
+ void profileCtx.inject(["remote.session"], (catalogCtx) => {
37
+ controller.attachCatalog(catalogCtx.remote.session);
38
+ catalogCtx.effect(() => () => controller.attachCatalog(null), "dsmm: native catalog lifetime");
39
+ });
40
+ void profileCtx.inject(["uiSession"], (sessionCtx) => {
41
+ const source = sessionCtx.uiSession.adapter.current;
42
+ const update = () => controller.setSession(source.getSnapshot().key ?? null);
43
+ update();
44
+ sessionCtx.effect(() => source.subscribe(update), "dsmm: current native session");
45
+ sessionCtx.effect(() => () => controller.setSession(null), "dsmm: native session withdrawal");
46
+ sessionCtx.slots.inject("conversation.session.header.utilities", () => sessionCtx.slots.register({
47
+ name: "conversation.session.header.utilities", id: "dsmm-session-profiles", order: 30, locale: NS,
48
+ inject: () => ({ hooks: { profiles: controller.store }, ...controller.actions }),
49
+ }, SessionProfiles));
50
+ });
51
+ void controller.refresh();
52
+ });
53
+ }
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,145 @@
1
+ export declare const NS = "settings.dsmm-profiles";
2
+ export declare const en: {
3
+ title: string;
4
+ description: string;
5
+ newSessions: string;
6
+ editorSelect: string;
7
+ choose: string;
8
+ newDraft: string;
9
+ new: string;
10
+ profileId: string;
11
+ idHint: string;
12
+ configuration: string;
13
+ configurationHint: string;
14
+ structuralHint: string;
15
+ save: string;
16
+ saving: string;
17
+ apply: string;
18
+ applying: string;
19
+ reset: string;
20
+ resetting: string;
21
+ refresh: string;
22
+ refreshing: string;
23
+ reload: string;
24
+ loading: string;
25
+ reading: string;
26
+ empty: string;
27
+ baseline: string;
28
+ appliedProfile: string;
29
+ appliedInvalid: string;
30
+ selectionConflict: string;
31
+ dirty: string;
32
+ savedNotApplied: string;
33
+ savedApplied: string;
34
+ saved: string;
35
+ applied: string;
36
+ resetDone: string;
37
+ discardPrompt: string;
38
+ discard: string;
39
+ cancel: string;
40
+ conflict: string;
41
+ validation: string;
42
+ io: string;
43
+ unavailable: string;
44
+ transport: string;
45
+ invalidProfile: string;
46
+ details: string;
47
+ retry: string;
48
+ globalScope: string;
49
+ sessionScope: string;
50
+ sessionSelect: string;
51
+ globalActionHint: string;
52
+ noSession: string;
53
+ sessionUnavailable: string;
54
+ sessionBusy: string;
55
+ sessionState: string;
56
+ sessionBaseline: string;
57
+ sessionGlobalCaptured: string;
58
+ sessionAdmittedProfile: string;
59
+ sessionFutureDefault: string;
60
+ sessionConflict: string;
61
+ sessionApply: string;
62
+ sessionApplying: string;
63
+ sessionReset: string;
64
+ sessionResetting: string;
65
+ sessionRefresh: string;
66
+ sessionApplied: string;
67
+ sessionResetDone: string;
68
+ sessionDirty: string;
69
+ roleState: string;
70
+ catalogTitle: string;
71
+ catalogHint: string;
72
+ catalogUnavailable: string;
73
+ catalogRefresh: string;
74
+ catalogRefreshing: string;
75
+ catalogFailure: string;
76
+ profileLabel: string;
77
+ defaultActive: string;
78
+ activeHint: string;
79
+ enabled: string;
80
+ disabled: string;
81
+ inherit: string;
82
+ profileDefaults: string;
83
+ roleSelect: string;
84
+ rolesUnavailable: string;
85
+ roleEnabled: string;
86
+ roleDisabled: string;
87
+ strategy: string;
88
+ inheritStrategy: string;
89
+ startupLock: string;
90
+ rateFallback: string;
91
+ strategyHint: string;
92
+ retryField: string;
93
+ inheritNumber: string;
94
+ retryBounds: string;
95
+ unknownDefault: string;
96
+ retryCount: string;
97
+ initialDelay: string;
98
+ maxDelay: string;
99
+ totalWait: string;
100
+ switchThreshold: string;
101
+ maxSwitches: string;
102
+ primaryMode: string;
103
+ inheritRoute: string;
104
+ configuredRoute: string;
105
+ primaryName: string;
106
+ fallbackMode: string;
107
+ inheritChain: string;
108
+ configuredChain: string;
109
+ emptyChain: string;
110
+ fallbackName: string;
111
+ addFallback: string;
112
+ removeFallback: string;
113
+ moveUp: string;
114
+ moveDown: string;
115
+ routeProvider: string;
116
+ routeModel: string;
117
+ routeEffort: string;
118
+ manualProvider: string;
119
+ manualModel: string;
120
+ manualEffort: string;
121
+ manual: string;
122
+ manualValue: string;
123
+ unset: string;
124
+ effortDefault: string;
125
+ effortChangeHint: string;
126
+ advanced: string;
127
+ rawInvalid: string;
128
+ invalidNumber: string;
129
+ };
130
+ export type ProfilesLocaleKey = keyof typeof en;
131
+ export declare const zh: Record<ProfilesLocaleKey, string>;
132
+ export declare const RETRY_FIELD_LABEL_KEYS: {
133
+ readonly maxRetries: "retryCount";
134
+ readonly initialDelayMs: "initialDelay";
135
+ readonly maxDelayMs: "maxDelay";
136
+ readonly maxTotalDelayMs: "totalWait";
137
+ readonly switchAfterRateLimits: "switchThreshold";
138
+ readonly maxSwitches: "maxSwitches";
139
+ };
140
+ declare module "@deepseek-ai/dsh-client-ui-slots" {
141
+ interface LocaleNamespaceMap {
142
+ "settings.dsmm-profiles": ProfilesLocaleKey;
143
+ }
144
+ }
145
+ //# sourceMappingURL=locales.d.ts.map