@dsmm/dsmm 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -42
- package/cordis.patch.yml +1 -0
- package/docs/agent-presets.md +26 -14
- package/docs/compatibility.md +20 -79
- package/docs/deferred-native-approval-risk.md +8 -12
- package/docs/design.md +25 -254
- package/docs/lsp.md +2 -2
- package/docs/migration-from-ocmm.md +38 -51
- package/docs/model-routing.md +21 -21
- package/docs/native-permissions.md +17 -7
- package/docs/profiles.md +13 -9
- package/docs/releasing.md +34 -240
- package/docs/roadmap.md +23 -254
- package/docs/runtime-recovery.md +29 -91
- package/docs/safety-guards.md +19 -16
- package/docs/settings-status.md +23 -11
- package/docs/skill-sync.md +17 -17
- package/docs/web-fetch-fakeip.md +82 -0
- package/lib/child-capture.d.ts +16 -2
- package/lib/child-capture.js +29 -10
- package/lib/client/ChildrenPanel.d.ts +1 -4
- package/lib/client/ChildrenPanel.js +4 -16
- package/lib/client/DeploymentFields.d.ts +28 -0
- package/lib/client/DeploymentFields.js +68 -0
- package/lib/client/DeploymentPage.d.ts +17 -5
- package/lib/client/DeploymentPage.js +79 -112
- package/lib/client/NativeCommandEntries.d.ts +17 -0
- package/lib/client/NativeCommandEntries.js +68 -0
- package/lib/client/PermissionsPanel.d.ts +1 -1
- package/lib/client/PermissionsPanel.js +8 -8
- package/lib/client/ProfilesSection.js +7 -5
- package/lib/client/RoleToolView-data.d.ts +35 -0
- package/lib/client/RoleToolView-data.js +52 -0
- package/lib/client/RoleToolView-locales.d.ts +36 -0
- package/lib/client/RoleToolView-locales.js +20 -0
- package/lib/client/RoleToolView.d.ts +10 -0
- package/lib/client/RoleToolView.js +47 -0
- package/lib/client/SessionProfiles.js +39 -15
- package/lib/client/children-controller.d.ts +2 -8
- package/lib/client/children-controller.js +1 -26
- package/lib/client/children-locales.d.ts +26 -51
- package/lib/client/children-locales.js +8 -12
- package/lib/client/configuration-display.d.ts +5 -0
- package/lib/client/configuration-display.js +11 -0
- package/lib/client/controller.d.ts +1 -0
- package/lib/client/controller.js +20 -13
- package/lib/client/deployment-controller.d.ts +13 -1
- package/lib/client/deployment-controller.js +85 -25
- package/lib/client/deployment-data.d.ts +1 -0
- package/lib/client/deployment-data.js +4 -1
- package/lib/client/deployment-locales.d.ts +43 -0
- package/lib/client/deployment-locales.js +35 -9
- package/lib/client/deployment-modules.d.ts +9 -0
- package/lib/client/deployment-modules.js +24 -0
- package/lib/client/deployment-workspace.d.ts +48 -0
- package/lib/client/deployment-workspace.js +123 -0
- package/lib/client/index.js +11 -74
- package/lib/client/locales.d.ts +7 -0
- package/lib/client/locales.js +12 -6
- package/lib/client/permission-controller.d.ts +1 -0
- package/lib/client/permission-controller.js +3 -2
- package/lib/client/permission-locales.d.ts +25 -0
- package/lib/client/permission-locales.js +24 -4
- package/lib/client/session-labels.js +4 -3
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +9 -8
- package/lib/client.js +2716 -2364
- package/lib/commands.js +2 -0
- package/lib/config-file-store.d.ts +3 -0
- package/lib/config-file-store.js +4 -2
- package/lib/config-revision.d.ts +5 -0
- package/lib/config-revision.js +11 -0
- package/lib/core-permission-authority.js +11 -41
- package/lib/deployment-config.d.ts +9 -2
- package/lib/deployment-config.js +35 -8
- package/lib/deployment-permission-rules.js +19 -7
- package/lib/dsh-types.d.ts +1 -1
- package/lib/host-llm-startup.js +3 -3
- package/lib/host-llm.d.ts +9 -3
- package/lib/host-llm.js +48 -8
- package/lib/index.d.ts +17 -21
- package/lib/index.js +131 -430
- package/lib/lifetime.d.ts +4 -0
- package/lib/lifetime.js +22 -0
- package/lib/live-pi-ai-owner.d.ts +1 -0
- package/lib/live-pi-ai-owner.js +8 -4
- package/lib/mode.d.ts +3 -2
- package/lib/mode.js +28 -41
- package/lib/model-routing.d.ts +2 -8
- package/lib/model-routing.js +59 -175
- package/lib/native-admission.d.ts +56 -0
- package/lib/native-admission.js +313 -0
- package/lib/native-pi-ai-wire.d.ts +3 -1
- package/lib/native-pi-ai-wire.js +47 -13
- package/lib/permission-control.d.ts +0 -3
- package/lib/permission-rpc.js +3 -3
- package/lib/preset-registry.js +3 -2
- package/lib/preset-skills.d.ts +3 -12
- package/lib/preset-skills.js +28 -58
- package/lib/profile-diagnostics.d.ts +1 -1
- package/lib/profile-diagnostics.js +2 -2
- package/lib/profile-remote.js +61 -22
- package/lib/profile-rpc.d.ts +4 -3
- package/lib/profile-rpc.js +39 -41
- package/lib/profile-runtime.d.ts +31 -74
- package/lib/profile-runtime.js +224 -639
- package/lib/profile-store.d.ts +18 -6
- package/lib/profile-store.js +106 -64
- package/lib/profile-types.d.ts +18 -4
- package/lib/profiles.d.ts +3 -1
- package/lib/profiles.js +9 -7
- package/lib/prompt-content.d.ts +1 -0
- package/lib/prompt-content.js +4 -1
- package/lib/prompts.d.ts +2 -12
- package/lib/prompts.js +11 -66
- package/lib/role-control-remote.d.ts +1 -4
- package/lib/role-control-remote.js +8 -36
- package/lib/role-control-rpc.d.ts +10 -36
- package/lib/role-control-rpc.js +112 -265
- package/lib/role-control-types.d.ts +3 -26
- package/lib/role-control-types.js +3 -4
- package/lib/role-identity.d.ts +5 -0
- package/lib/role-identity.js +10 -0
- package/lib/role-invocation.d.ts +2 -2
- package/lib/role-llm-runtime.js +5 -11
- package/lib/role-policy.d.ts +19 -53
- package/lib/role-policy.js +136 -525
- package/lib/role-providers.d.ts +5 -8
- package/lib/role-providers.js +20 -126
- package/lib/role-routing.d.ts +1 -3
- package/lib/role-routing.js +24 -34
- package/lib/role-subagents.d.ts +5 -14
- package/lib/role-subagents.js +149 -97
- package/lib/runtime-integration.d.ts +5 -109
- package/lib/runtime-integration.js +11 -779
- package/lib/session-metadata.d.ts +13 -12
- package/lib/session-metadata.js +6 -31
- package/lib/session-scope.js +6 -2
- package/lib/settings.d.ts +5 -18
- package/lib/settings.js +19 -43
- package/lib/state.d.ts +3 -2
- package/lib/state.js +26 -10
- package/lib/status.d.ts +1 -9
- package/lib/status.js +3 -55
- package/lib/web-fetch-address-policy.d.ts +24 -0
- package/lib/web-fetch-address-policy.js +189 -0
- package/lib/web-fetch-fakeip.d.ts +25 -0
- package/lib/web-fetch-fakeip.js +107 -0
- package/package.json +133 -113
- package/docs/research/deepseek-v4-pro.md +0 -74
- package/docs/research/oh-dsh.md +0 -96
- package/lib/child-admission.d.ts +0 -42
- package/lib/child-admission.js +0 -162
- package/lib/delivery-authority.d.ts +0 -68
- package/lib/delivery-authority.js +0 -260
- package/lib/legacy-child-policy.d.ts +0 -51
- package/lib/legacy-child-policy.js +0 -123
- package/lib/legacy-read-composition.d.ts +0 -20
- package/lib/legacy-read-composition.js +0 -144
- package/lib/legacy-read-contracts.d.ts +0 -157
- package/lib/legacy-read-contracts.js +0 -39
- package/lib/legacy-read-host.d.ts +0 -19
- package/lib/legacy-read-host.js +0 -67
- package/lib/legacy-read-integration.d.ts +0 -121
- package/lib/legacy-read-integration.js +0 -522
- package/lib/legacy-read-proxy.d.ts +0 -26
- package/lib/legacy-read-proxy.js +0 -237
- package/lib/native-child-evidence.d.ts +0 -42
- package/lib/native-child-evidence.js +0 -133
- package/lib/role-runs.d.ts +0 -135
- package/lib/role-runs.js +0 -304
- package/lib/session-persistence.d.ts +0 -35
- package/lib/session-persistence.js +0 -304
- package/lib/subagent-runtime.d.ts +0 -45
- package/lib/subagent-runtime.js +0 -131
- package/prompts/deepseek-flash.md +0 -11
- package/prompts/deepseek-v4-pro.md +0 -14
- package/scripts/cold-profile-composition.mjs +0 -329
- package/scripts/cold-profile-sources.mjs +0 -238
- package/scripts/migrate-cold-profile.mjs +0 -315
- package/scripts/repair-session-log.mjs +0 -476
- package/scripts/session-repair-native-verifier.mjs +0 -367
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { equal, editLayer, layerDiff, mergeLayer, record, validateEditorValue } from "./deployment-data.js";
|
|
1
|
+
import { equal, editLayer, layerDiff, mergeLayer, record, scopeSchema, validateEditorValue } from "./deployment-data.js";
|
|
2
2
|
class Refusal extends Error {
|
|
3
3
|
code;
|
|
4
4
|
constructor(code) {
|
|
@@ -6,6 +6,32 @@ class Refusal extends Error {
|
|
|
6
6
|
this.code = code;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
/** Native wire shape only; schema semantics remain independently validated. */
|
|
10
|
+
function isNativeJson(value, active = new Set()) {
|
|
11
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
12
|
+
return true;
|
|
13
|
+
if (typeof value === "number")
|
|
14
|
+
return Number.isFinite(value);
|
|
15
|
+
if (typeof value !== "object" || active.has(value) || Object.getOwnPropertySymbols(value).length > 0)
|
|
16
|
+
return false;
|
|
17
|
+
const array = Array.isArray(value), prototype = Object.getPrototypeOf(value);
|
|
18
|
+
if (array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null)
|
|
19
|
+
return false;
|
|
20
|
+
active.add(value);
|
|
21
|
+
const properties = Object.getOwnPropertyDescriptors(value);
|
|
22
|
+
const valid = Object.entries(properties).every(([key, descriptor]) => array && key === "length" || descriptor.enumerable
|
|
23
|
+
&& Object.hasOwn(descriptor, "value") && (!array || /^(0|[1-9][0-9]*)$/u.test(key) && Number(key) < value.length)
|
|
24
|
+
&& isNativeJson(descriptor.value, active));
|
|
25
|
+
active.delete(value);
|
|
26
|
+
return valid && (!array || Object.keys(properties).length === value.length + 1);
|
|
27
|
+
}
|
|
28
|
+
function nativePathEdit(edit) {
|
|
29
|
+
if (edit.op === "unset")
|
|
30
|
+
return edit;
|
|
31
|
+
if (!isNativeJson(edit.value))
|
|
32
|
+
throw new Refusal("validation");
|
|
33
|
+
return { op: "set", path: edit.path, value: edit.value };
|
|
34
|
+
}
|
|
9
35
|
async function unwrap(promise) {
|
|
10
36
|
const result = await promise;
|
|
11
37
|
if (result.ok)
|
|
@@ -21,7 +47,7 @@ export class DeploymentController {
|
|
|
21
47
|
remote;
|
|
22
48
|
layer;
|
|
23
49
|
rowNamespace;
|
|
24
|
-
state = { snapshot: null, draft: {}, dirty: false, busy: false, issue: null, saved: false, session: null };
|
|
50
|
+
state = { snapshot: null, draft: {}, dirty: false, busy: false, issue: null, saved: false, session: null, raw: {}, invalidFields: [], refreshRequired: false };
|
|
25
51
|
listeners = new Set();
|
|
26
52
|
generation = 0;
|
|
27
53
|
disposed = false;
|
|
@@ -31,6 +57,7 @@ export class DeploymentController {
|
|
|
31
57
|
connection = null;
|
|
32
58
|
connectionBaseline;
|
|
33
59
|
stopConnection = null;
|
|
60
|
+
children = new Set();
|
|
34
61
|
constructor(remote, layer, rowNamespace = null) {
|
|
35
62
|
this.remote = remote;
|
|
36
63
|
this.layer = layer;
|
|
@@ -42,6 +69,8 @@ export class DeploymentController {
|
|
|
42
69
|
bindConnection(source) {
|
|
43
70
|
this.stopConnection?.();
|
|
44
71
|
this.connection = source;
|
|
72
|
+
for (const child of this.children)
|
|
73
|
+
child.bindConnection(source);
|
|
45
74
|
this.stopConnection = source.subscribe(() => {
|
|
46
75
|
if (this.disposed)
|
|
47
76
|
return;
|
|
@@ -53,6 +82,7 @@ export class DeploymentController {
|
|
|
53
82
|
const controller = new DeploymentController(this.remote, "profile", namespace);
|
|
54
83
|
if (this.connection !== null)
|
|
55
84
|
controller.bindConnection(this.connection);
|
|
85
|
+
this.children.add(controller);
|
|
56
86
|
return controller;
|
|
57
87
|
}
|
|
58
88
|
currentConnection() { return this.connection === null || this.connection.getSnapshot() !== undefined && this.connection.getSnapshot() === this.connectionBaseline; }
|
|
@@ -72,17 +102,35 @@ export class DeploymentController {
|
|
|
72
102
|
this.invalid.add(path);
|
|
73
103
|
else
|
|
74
104
|
this.invalid.delete(path);
|
|
75
|
-
this.publish({ dirty: this.invalid.size > 0 || !equal(this.baseline, this.state.draft), saved: false });
|
|
105
|
+
this.publish({ invalidFields: [...this.invalid], dirty: this.invalid.size > 0 || !equal(this.baseline, this.state.draft), saved: false });
|
|
106
|
+
}
|
|
107
|
+
setRaw(path, text, invalid) {
|
|
108
|
+
if (!this.canEdit())
|
|
109
|
+
return;
|
|
110
|
+
this.publish({ raw: { ...this.state.raw, [path]: { text, invalid } } });
|
|
111
|
+
this.setInvalid(path, invalid);
|
|
76
112
|
}
|
|
113
|
+
clearRaw(prefix) {
|
|
114
|
+
if (!this.canEdit())
|
|
115
|
+
return;
|
|
116
|
+
const raw = Object.fromEntries(Object.entries(this.state.raw).filter(([path]) => path !== prefix && !path.startsWith(`${prefix}.`)));
|
|
117
|
+
for (const path of [...this.invalid])
|
|
118
|
+
if (path === prefix || path.startsWith(`${prefix}.`))
|
|
119
|
+
this.invalid.delete(path);
|
|
120
|
+
this.publish({ raw, invalidFields: [...this.invalid], dirty: this.invalid.size > 0 || !equal(this.baseline, this.state.draft) });
|
|
121
|
+
}
|
|
122
|
+
canEdit() { return !this.disposed && !this.state.busy && !this.state.refreshRequired && this.state.snapshot !== null && this.state.snapshot.globalRevision !== "unavailable" && (this.layer === "global" || this.state.snapshot.nativeRevision !== "unavailable") && this.currentConnection() && (this.state.issue === null || this.state.issue === "validation") && (this.layer === "global" || this.canWriteProfile()); }
|
|
123
|
+
canSave() { return this.canEdit() && this.state.issue === null && this.state.dirty && this.invalid.size === 0; }
|
|
124
|
+
pendingPaths() { return [...new Set([...layerDiff(this.baseline, this.state.draft).map(edit => edit.path.join(".")), ...this.invalid])]; }
|
|
77
125
|
canWriteProfile(snapshot = this.state.snapshot) {
|
|
78
126
|
const native = this.form?.state;
|
|
79
127
|
return this.currentConnection() && snapshot !== null && this.rowNamespace !== null && this.rowNamespace === snapshot.namespace
|
|
80
|
-
&& native?.status === "ready" && native.
|
|
128
|
+
&& native?.status === "ready" && native.writable
|
|
81
129
|
&& native.revision === snapshot.nativeFormRevision && snapshot.nativeForm !== null
|
|
82
130
|
&& equal(native.base ?? null, snapshot.nativeForm.base) && equal(native.user ?? null, snapshot.nativeForm.user);
|
|
83
131
|
}
|
|
84
132
|
edit(path, value) {
|
|
85
|
-
if (
|
|
133
|
+
if (!this.canEdit())
|
|
86
134
|
return;
|
|
87
135
|
const draft = editLayer(this.state.draft, path, value);
|
|
88
136
|
this.publish({ draft, dirty: this.invalid.size > 0 || !equal(this.baseline, draft), issue: null, saved: false });
|
|
@@ -99,6 +147,8 @@ export class DeploymentController {
|
|
|
99
147
|
const snapshot = await unwrap(this.remote.describeSettings());
|
|
100
148
|
if (this.disposed || generation !== this.generation)
|
|
101
149
|
return;
|
|
150
|
+
if (snapshot.globalRevision === "unavailable" || this.layer === "profile" && snapshot.nativeRevision === "unavailable")
|
|
151
|
+
throw new Refusal("unavailable");
|
|
102
152
|
const old = this.state.snapshot;
|
|
103
153
|
if (old !== null && (old.entryId !== snapshot.entryId || old.hostProfileKey !== snapshot.hostProfileKey))
|
|
104
154
|
throw new Refusal("unavailable");
|
|
@@ -110,7 +160,7 @@ export class DeploymentController {
|
|
|
110
160
|
this.invalid.clear();
|
|
111
161
|
this.connectionBaseline = connection;
|
|
112
162
|
this.baseline = this.layer === "global" ? snapshot.global : record(snapshot.nativeForm?.user) ? snapshot.nativeForm.user : {};
|
|
113
|
-
this.publish({ snapshot, draft: structuredClone(this.baseline), dirty: false, issue: null });
|
|
163
|
+
this.publish({ snapshot, draft: structuredClone(this.baseline), raw: {}, invalidFields: [], dirty: false, issue: null, refreshRequired: false });
|
|
114
164
|
}
|
|
115
165
|
}
|
|
116
166
|
catch (error) {
|
|
@@ -124,22 +174,20 @@ export class DeploymentController {
|
|
|
124
174
|
}
|
|
125
175
|
async save() {
|
|
126
176
|
const { snapshot, draft, dirty, busy, issue } = this.state;
|
|
127
|
-
if (this.
|
|
177
|
+
if (!this.canSave() || snapshot === null || !dirty || busy || issue !== null)
|
|
178
|
+
return;
|
|
179
|
+
if (snapshot.globalRevision === "unavailable" || this.layer === "profile" && snapshot.nativeRevision === "unavailable") {
|
|
180
|
+
this.publish({ issue: "unavailable" });
|
|
128
181
|
return;
|
|
129
|
-
const schema = this.layer === "global" ? snapshot.schema : { ...snapshot.schema, fields: Object.fromEntries(Object.entries(snapshot.schema.fields ?? {}).filter(([key]) => key !== "modules")) };
|
|
130
|
-
const editable = { ...draft };
|
|
131
|
-
if (this.layer === "profile") {
|
|
132
|
-
if (!equal(editable.sessionPersistence, this.baseline.sessionPersistence)) {
|
|
133
|
-
this.publish({ issue: "validation" });
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
delete editable.sessionPersistence;
|
|
137
182
|
}
|
|
183
|
+
const selectedSchema = scopeSchema(snapshot, this.layer);
|
|
184
|
+
const schema = { ...selectedSchema, fields: Object.fromEntries(Object.entries(selectedSchema.fields ?? {}).filter(([key]) => key !== (this.layer === "global" ? "runtime" : "modules"))) };
|
|
185
|
+
const mergedSchema = { ...snapshot.schema, fields: { ...snapshot.schema.fields, ...snapshot.nativeSchema?.fields } };
|
|
186
|
+
const editable = { ...draft };
|
|
138
187
|
const lower = this.layer === "global" ? snapshot.defaults : mergeLayer(mergeLayer(snapshot.defaults, snapshot.global), snapshot.nativeForm?.base ?? {});
|
|
139
188
|
const candidate = mergeLayer(lower, editable);
|
|
140
189
|
const merged = (this.layer === "global" ? mergeLayer(candidate, snapshot.profile) : candidate);
|
|
141
|
-
|
|
142
|
-
if (!validateEditorValue(editable, schema, true) || !validateEditorValue(merged, snapshot.schema)) {
|
|
190
|
+
if (!validateEditorValue(editable, schema, true) || !validateEditorValue(merged, mergedSchema)) {
|
|
143
191
|
this.publish({ issue: "validation" });
|
|
144
192
|
return;
|
|
145
193
|
}
|
|
@@ -156,28 +204,40 @@ export class DeploymentController {
|
|
|
156
204
|
return;
|
|
157
205
|
if (current.entryId !== snapshot.entryId || current.hostProfileKey !== snapshot.hostProfileKey || current.globalRevision !== snapshot.globalRevision)
|
|
158
206
|
throw new Refusal("conflict");
|
|
159
|
-
|
|
160
|
-
|
|
207
|
+
let acceptedRefreshRequired = false;
|
|
208
|
+
if (this.layer === "global") {
|
|
209
|
+
const accepted = await unwrap(this.remote.save({ expectedRevision: snapshot.globalRevision, edits }));
|
|
210
|
+
acceptedRefreshRequired = accepted.refreshRequired === true || accepted.revision === "unavailable";
|
|
211
|
+
}
|
|
161
212
|
else {
|
|
162
213
|
if (current.nativeRevision !== snapshot.nativeRevision || !this.canWriteProfile(current))
|
|
163
214
|
throw new Refusal("conflict");
|
|
164
215
|
const form = this.form;
|
|
165
|
-
if (!await form.mutate(edits, snapshot.nativeFormRevision))
|
|
166
|
-
throw new Refusal("
|
|
216
|
+
if (!await form.mutate(edits.map(nativePathEdit), snapshot.nativeFormRevision))
|
|
217
|
+
throw new Refusal("unconfirmed");
|
|
167
218
|
}
|
|
168
219
|
if (this.disposed || generation !== this.generation)
|
|
169
220
|
return;
|
|
170
221
|
this.baseline = structuredClone(draft);
|
|
171
|
-
this.
|
|
222
|
+
this.invalid.clear();
|
|
223
|
+
this.publish({ dirty: false, saved: true, issue: null, raw: {}, invalidFields: [], refreshRequired: true });
|
|
172
224
|
// A successful durable save remains successful even if the follow-up read fails.
|
|
225
|
+
if (acceptedRefreshRequired)
|
|
226
|
+
return;
|
|
173
227
|
try {
|
|
174
228
|
const next = await unwrap(this.remote.describeSettings());
|
|
175
|
-
if (!this.disposed && generation === this.generation)
|
|
176
|
-
|
|
229
|
+
if (!this.disposed && generation === this.generation) {
|
|
230
|
+
if (next.entryId !== snapshot.entryId || next.hostProfileKey !== snapshot.hostProfileKey || next.globalRevision === "unavailable" || this.layer === "profile" && next.nativeRevision === "unavailable")
|
|
231
|
+
this.publish({ refreshRequired: true });
|
|
232
|
+
else {
|
|
233
|
+
this.baseline = structuredClone(this.layer === "global" ? next.global : record(next.nativeForm?.user) ? next.nativeForm.user : {});
|
|
234
|
+
this.publish({ snapshot: next, draft: structuredClone(this.baseline), refreshRequired: false });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
177
237
|
}
|
|
178
238
|
catch {
|
|
179
239
|
if (!this.disposed && generation === this.generation)
|
|
180
|
-
this.publish({
|
|
240
|
+
this.publish({ refreshRequired: true });
|
|
181
241
|
}
|
|
182
242
|
}
|
|
183
243
|
catch (error) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DeploymentAdmissionView, DeploymentEditorSnapshot, DeploymentSchemaNode } from "../profile-types.js";
|
|
2
2
|
import type { DeploymentPathEdit } from "../deployment-config.js";
|
|
3
3
|
export declare function record(value: unknown): value is Record<string, unknown>;
|
|
4
|
+
export declare function scopeSchema(snapshot: DeploymentEditorSnapshot, layer: "global" | "profile"): DeploymentSchemaNode;
|
|
4
5
|
export declare function at(value: unknown, path: readonly string[]): unknown;
|
|
5
6
|
export declare function equal(a: unknown, b: unknown): boolean;
|
|
6
7
|
export declare function mergeLayer(base: unknown, override: unknown): unknown;
|
|
@@ -3,6 +3,9 @@ import { copyRouteJson, normalizeModelRouteJson } from "../route-json.js";
|
|
|
3
3
|
export function record(value) {
|
|
4
4
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5
5
|
}
|
|
6
|
+
export function scopeSchema(snapshot, layer) {
|
|
7
|
+
return layer === "profile" ? snapshot.nativeSchema ?? snapshot.schema : snapshot.schema;
|
|
8
|
+
}
|
|
6
9
|
export function at(value, path) {
|
|
7
10
|
return path.reduce((node, key) => record(node) && Object.hasOwn(node, key) ? node[key] : undefined, value);
|
|
8
11
|
}
|
|
@@ -115,7 +118,7 @@ export function enumValues(schema) {
|
|
|
115
118
|
? schema.alternatives.map(node => node.value) : null;
|
|
116
119
|
}
|
|
117
120
|
export function visibleDeploymentPath(path) {
|
|
118
|
-
return
|
|
121
|
+
return !["lsp", "modeName", "section"].includes(path[0]);
|
|
119
122
|
}
|
|
120
123
|
/** Only visible Host-projected inspector layers, never raw sparse editor input. */
|
|
121
124
|
export function inspectorPaths(snapshot, admitted) {
|
|
@@ -16,6 +16,45 @@ export declare const deploymentEn: {
|
|
|
16
16
|
coreHint: string;
|
|
17
17
|
modelParametersHint: string;
|
|
18
18
|
permissionControlHint: string;
|
|
19
|
+
modules: string;
|
|
20
|
+
scope: string;
|
|
21
|
+
close: string;
|
|
22
|
+
loading: string;
|
|
23
|
+
unset: string;
|
|
24
|
+
"module:run": string;
|
|
25
|
+
"module:routes": string;
|
|
26
|
+
"module:workflow": string;
|
|
27
|
+
"module:subagents": string;
|
|
28
|
+
"module:permissions": string;
|
|
29
|
+
"module:other": string;
|
|
30
|
+
"module:state": string;
|
|
31
|
+
saveScope: string;
|
|
32
|
+
pendingModules: string;
|
|
33
|
+
savedRefreshRequired: string;
|
|
34
|
+
sessionObserved: string;
|
|
35
|
+
noModuleFields: string;
|
|
36
|
+
leaveDraft: string;
|
|
37
|
+
continueEditing: string;
|
|
38
|
+
keepDraft: string;
|
|
39
|
+
discardDraft: string;
|
|
40
|
+
rootRules: string;
|
|
41
|
+
rootRulesHint: string;
|
|
42
|
+
rootRulesUnavailable: string;
|
|
43
|
+
nativeRuntimeHint: string;
|
|
44
|
+
nativeRuntimeReadinessHint: string;
|
|
45
|
+
unsetGroup: string;
|
|
46
|
+
nativeRuntimeState: string;
|
|
47
|
+
nativeRuntimeBinding: string;
|
|
48
|
+
nativeRuntimeFence: string;
|
|
49
|
+
nativeRuntimeRestart: string;
|
|
50
|
+
nativeRuntimeStock: string;
|
|
51
|
+
nativeRuntimeUnavailable: string;
|
|
52
|
+
"nativeRuntimeReason-explicit-composition-required": string;
|
|
53
|
+
"nativeRuntimeReason-duplicate-provider": string;
|
|
54
|
+
"nativeRuntimeReason-authority-not-ready": string;
|
|
55
|
+
"nativeRuntimeReason-disabled": string;
|
|
56
|
+
"nativeRuntimeReason-pending-restart": string;
|
|
57
|
+
"nativeRuntimeReason-scope-conflict": string;
|
|
19
58
|
saveGlobal: string;
|
|
20
59
|
saveProfile: string;
|
|
21
60
|
saving: string;
|
|
@@ -48,6 +87,9 @@ export declare const deploymentEn: {
|
|
|
48
87
|
off: string;
|
|
49
88
|
state: string;
|
|
50
89
|
module: string;
|
|
90
|
+
versionObserved: string;
|
|
91
|
+
versionAbsent: string;
|
|
92
|
+
versionUnknown: string;
|
|
51
93
|
advanced: string;
|
|
52
94
|
advancedHint: string;
|
|
53
95
|
invalid: string;
|
|
@@ -56,6 +98,7 @@ export declare const deploymentEn: {
|
|
|
56
98
|
"not-owned": string;
|
|
57
99
|
validation: string;
|
|
58
100
|
transport: string;
|
|
101
|
+
unconfirmed: string;
|
|
59
102
|
namedIndependent: string;
|
|
60
103
|
};
|
|
61
104
|
export type DeploymentLocaleKey = keyof typeof deploymentEn;
|
|
@@ -3,15 +3,26 @@ export const deploymentEn = {
|
|
|
3
3
|
title: "DSMM", summary: "Global config and profile overrides",
|
|
4
4
|
description: "Layers save independently; native models and running sessions stay unchanged.",
|
|
5
5
|
global: "DSMM Global config", globalHint: "Shared by this Home’s DSH profiles. Unset fields use built-in defaults.",
|
|
6
|
-
profile: "Current DSH profile overrides", profileHint: "This entry only. Unset fields inherit Global
|
|
6
|
+
profile: "Current DSH profile overrides", profileHint: "This native entry only. Ordinary Unset fields inherit Global plus Host base pins. Native runtime uses Host base/native defaults, never Global.",
|
|
7
7
|
profileUnavailable: "Unavailable",
|
|
8
|
-
unavailableForm: "
|
|
8
|
+
unavailableForm: "Current profile is read-only: no verified writable native form at this connection, namespace and revision. Global configuration remains a separate authority.",
|
|
9
9
|
ceiling: "Deepwork master is Global-only; profiles and session modes cannot lift its captured ceiling.",
|
|
10
10
|
hostUnknown: "Host bundle status: unknown (separate switch).",
|
|
11
11
|
boundaries: "New roots capture saved settings within startup capabilities. Save does not restart the Host; startup-only changes require a separate Host restart, which may cancel sessions.",
|
|
12
12
|
core: "Core", coreHint: "Core-owned desired settings. Model-parameter passthrough is ordinary config, not a subplugin. The permission-control enabled flag is startup-pinned. Save does not change current-session admission; inspect desired, startup and admitted values below. Unavailable admission stays unknown.",
|
|
13
13
|
modelParametersHint: "Default On. Off retains saved custom/opaque model parameters without forwarding them, and DSMM reasoningEffort / reasoning_effort aliases use native defaults. Standard SDK parameters and explicit native root choices remain intact. Raw JSON and exact effort values remain editable; saving desired settings does not verify provider transport readiness.",
|
|
14
|
-
permissionControlHint: "Permission-control
|
|
14
|
+
permissionControlHint: "Permission-control mounting is startup-pinned. Saved configuration does not prove runtime coverage or remove current protections. Root rules keep their independent authority inside Permissions.",
|
|
15
|
+
modules: "Configuration modules", scope: "Configuration scope", close: "Close module", loading: "Loading configuration…", unset: "Unset — inherit",
|
|
16
|
+
"module:run": "Run and modules", "module:routes": "Model routes and recovery", "module:workflow": "Workflow, roles and skills", "module:subagents": "Subagent settings", "module:permissions": "Permissions and guards", "module:other": "Other settings", "module:state": "Configuration state",
|
|
17
|
+
saveScope: "Save selected configuration scope", pendingModules: "Pending modules in this scope", savedRefreshRequired: "Saved — refresh required before further edits", sessionObserved: "Current-session admission observed",
|
|
18
|
+
noModuleFields: "No editable schema fields for this module in the selected scope.",
|
|
19
|
+
leaveDraft: "Unsaved or invalid draft. Choose how to leave; nothing is saved or discarded automatically.", continueEditing: "Continue editing", keepDraft: "Keep draft and return", discardDraft: "Discard draft and leave",
|
|
20
|
+
rootRules: "Current Root rules", rootRulesHint: "This transaction is separate from Global/native configuration Save. It requires an open trusted Root, writable operator authority and synchronized runtime. It never borrows Global authority to bypass a refusal.", rootRulesUnavailable: "Root rules service unavailable. No session or authority is inferred.",
|
|
21
|
+
nativeRuntimeHint: "Native default On; Host base pins still apply. Mounting is captured at startup. Saving stages desired configuration only; it does not start/stop providers or cancel running sessions. A separate Host restart may cancel sessions.",
|
|
22
|
+
nativeRuntimeReadinessHint: "Official Host services own execution and JSONL storage. This snapshot reports native execution admission readiness, not guaranteed inbox acceptance or completion. Storage is configured on the native JSONL service, not DSMM.",
|
|
23
|
+
unsetGroup: "Unset this group — restore inheritance",
|
|
24
|
+
nativeRuntimeState: "Observed native runtime", nativeRuntimeBinding: "Observed runtime composition", nativeRuntimeFence: "Execution admission ready", nativeRuntimeRestart: "Restart required", nativeRuntimeStock: "Official Host runtime", nativeRuntimeUnavailable: "Unavailable / unknown",
|
|
25
|
+
"nativeRuntimeReason-explicit-composition-required": "The Host requires an explicit native runtime composition.", "nativeRuntimeReason-duplicate-provider": "More than one native provider is present; readiness is not confirmed.", "nativeRuntimeReason-authority-not-ready": "Native execution authority is not ready.", "nativeRuntimeReason-disabled": "The saved native runtime is disabled.", "nativeRuntimeReason-pending-restart": "Saved desired state differs from the mounted native composition; restart is pending.", "nativeRuntimeReason-scope-conflict": "Native scope ownership conflicts; readiness is not confirmed.",
|
|
15
26
|
saveGlobal: "Save Global config", saveProfile: "Save profile overrides", saving: "Saving…", refresh: "Refresh", discard: "Discard and reload", dirty: "Unsaved changes", saved: "Saved",
|
|
16
27
|
inherit: "Inherit", explicit: "Override", defaultPin: "Built-in default pinned", hostPin: "Host pin remains when cleared",
|
|
17
28
|
globalSource: "Global", profileSource: "DSH profile", defaultsSource: "Built-in default", namedSource: "Named/session", startupSource: "Startup capture", deploymentCapture: "Deployment capture",
|
|
@@ -19,6 +30,7 @@ export const deploymentEn = {
|
|
|
19
30
|
sessionUnavailable: "Session admission unavailable. Reconnect and refresh the session separately.",
|
|
20
31
|
absent: "Absent", mixedSource: "Mixed sources", inspectorStale: "Saved state, not draft",
|
|
21
32
|
pending: "Pending independent restart", unknown: "Unknown", on: "On", off: "Off", state: "Field sources and effective state", module: "Deepwork module",
|
|
33
|
+
versionObserved: "Metadata observed", versionAbsent: "Not stored", versionUnknown: "Version unavailable",
|
|
22
34
|
advanced: "Advanced JSON", advancedHint: "Schema keys only; omit to inherit. Arrays replace. No credentials or scripts; use existing providers.",
|
|
23
35
|
invalid: "Invalid field. Check type, bounds and keys; draft retained.",
|
|
24
36
|
conflict: "Revision conflict; draft retained. Review changes, then discard and reload. Refresh does not merge.",
|
|
@@ -26,21 +38,33 @@ export const deploymentEn = {
|
|
|
26
38
|
"not-owned": "Read-only: requires an authenticated local Host operator.",
|
|
27
39
|
validation: "Host rejected configuration; draft retained. Check fields and merged constraints.",
|
|
28
40
|
transport: "Disconnected; draft retained. Reconnect and refresh.",
|
|
41
|
+
unconfirmed: "The native form did not confirm Save. The Host may have committed; refresh the affected source before deciding to retry. Draft retained; no automatic replay.",
|
|
29
42
|
namedIndependent: "Deepwork Profiles is a separate named JSONC runtime-resource editor in Settings. Saving here does not apply a named profile or select its model.",
|
|
30
43
|
};
|
|
31
44
|
export const deploymentZh = {
|
|
32
45
|
title: "DSMM", summary: "全局配置与当前配置覆盖",
|
|
33
46
|
description: "两层独立保存,不改原生模型或运行中会话。",
|
|
34
47
|
global: "DSMM 全局配置", globalHint: "同一 Home 的 DSH 配置共用;未设置字段使用内建默认值。",
|
|
35
|
-
profile: "当前 DSH 配置覆盖", profileHint: "
|
|
48
|
+
profile: "当前 DSH 配置覆盖", profileHint: "仅此原生实例。普通字段 Unset 后继承 Global 与 Host base 固定值;原生 runtime 仅取 Host base/原生默认值,不继承 Global。",
|
|
36
49
|
profileUnavailable: "不可用",
|
|
37
|
-
unavailableForm: "
|
|
50
|
+
unavailableForm: "当前配置只读:连接、namespace 与版本尚无已核验的可写原生表单;Global 配置仍使用独立权限。",
|
|
38
51
|
ceiling: "Deepwork 总开关仅全局可改;配置和会话模式不能突破已捕获上限。",
|
|
39
52
|
hostUnknown: "宿主整包状态:未知(独立开关)。",
|
|
40
53
|
boundaries: "新根会话在启动能力内采用已保存设置。保存不重启宿主;仅启动时生效的更改需另行重启宿主,可能取消会话。",
|
|
41
54
|
core: "Core 核心配置", coreHint: "Core 所有的 desired 意图配置。模型参数透传为普通配置,非子插件;权限控制 enabled 仅启动时捕获。保存不改变当前会话准入;下方可检查意图、启动与准入值,不可用的准入仍为未知。",
|
|
42
55
|
modelParametersHint: "默认开启。关闭后仍保存 custom/opaque 模型参数但不发送;DSMM reasoningEffort/reasoning_effort 两种别名采用原生默认值。标准 SDK 参数与根会话原生显式选择保留。仍可编辑原始 JSON 和精确 effort 值;保存意图不代表提供商传输已就绪。",
|
|
43
|
-
permissionControlHint: "
|
|
56
|
+
permissionControlHint: "权限控制挂载仅启动时捕获。保存配置不证明运行时覆盖,也不移除当前保护;Root 规则在权限模块内保持独立权限。",
|
|
57
|
+
modules: "配置模块", scope: "配置作用域", close: "关闭模块", loading: "正在加载配置…", unset: "Unset——继承",
|
|
58
|
+
"module:run": "运行与模块", "module:routes": "模型路由与恢复", "module:workflow": "工作流、角色与技能", "module:subagents": "子 Agent 设置", "module:permissions": "权限与保护", "module:other": "其他设置", "module:state": "配置状态",
|
|
59
|
+
saveScope: "保存所选配置作用域", pendingModules: "此作用域的待保存模块", savedRefreshRequired: "已保存——需刷新后继续编辑", sessionObserved: "已观测当前会话准入",
|
|
60
|
+
noModuleFields: "所选作用域中,此模块没有可编辑的 schema 字段。",
|
|
61
|
+
leaveDraft: "仍有未保存或无效草稿,请选择离开方式;不会自动保存或丢弃。", continueEditing: "继续编辑", keepDraft: "保留草稿并返回", discardDraft: "放弃草稿并离开",
|
|
62
|
+
rootRules: "当前 Root 规则", rootRulesHint: "此事务与 Global/native 配置保存分开,需要已打开的可信 Root、可写 operator 权限及已同步运行时;不会借 Global 权限绕过拒绝。", rootRulesUnavailable: "Root 规则服务不可用,不推断或创建会话和权限。",
|
|
63
|
+
nativeRuntimeHint: "原生默认开启,Host base 固定值仍适用;挂载仅启动时捕获。保存只设置 desired,不会启动/停止提供商或取消当前会话;独立 Host 重启可能取消会话。",
|
|
64
|
+
nativeRuntimeReadinessHint: "执行和 JSONL 存储由官方 Host 服务负责。此快照只报告原生执行准入就绪,不保证收件箱接受或任务完成。存储配置属于原生 JSONL 服务,不属于 DSMM。",
|
|
65
|
+
unsetGroup: "Unset 整组——恢复继承",
|
|
66
|
+
nativeRuntimeState: "已观测原生运行时", nativeRuntimeBinding: "已观测运行时组合", nativeRuntimeFence: "执行准入已就绪", nativeRuntimeRestart: "需要重启", nativeRuntimeStock: "官方 Host 运行时", nativeRuntimeUnavailable: "不可用/未知",
|
|
67
|
+
"nativeRuntimeReason-explicit-composition-required": "Host 需要显式的原生运行时组合。", "nativeRuntimeReason-duplicate-provider": "存在重复原生 provider,无法确认就绪状态。", "nativeRuntimeReason-authority-not-ready": "原生执行权限尚未就绪。", "nativeRuntimeReason-disabled": "已保存的原生运行时为关闭。", "nativeRuntimeReason-pending-restart": "已保存 desired 与已挂载原生组合不同,等待独立重启。", "nativeRuntimeReason-scope-conflict": "原生 scope 所有权冲突,无法确认就绪状态。",
|
|
44
68
|
saveGlobal: "保存全局配置", saveProfile: "保存当前配置覆盖", saving: "正在保存…", refresh: "刷新", discard: "丢弃并重载", dirty: "未保存", saved: "已保存",
|
|
45
69
|
inherit: "继承", explicit: "覆盖", defaultPin: "固定为内建默认值", hostPin: "清除后仍有宿主固定值",
|
|
46
70
|
globalSource: "全局", profileSource: "DSH 配置", defaultsSource: "内建默认", namedSource: "具名/会话", startupSource: "启动捕获", deploymentCapture: "部署捕获",
|
|
@@ -48,6 +72,7 @@ export const deploymentZh = {
|
|
|
48
72
|
sessionUnavailable: "会话准入暂不可用;恢复连接后另行刷新会话。",
|
|
49
73
|
absent: "不存在", mixedSource: "混合来源", inspectorStale: "已保存状态,非草稿",
|
|
50
74
|
pending: "等待独立重启", unknown: "未知", on: "开启", off: "关闭", state: "字段来源与实际生效状态", module: "Deepwork 子模块",
|
|
75
|
+
versionObserved: "已观测元数据", versionAbsent: "未存储", versionUnknown: "版本不可用",
|
|
51
76
|
advanced: "高级 JSON", advancedHint: "仅 schema 声明的键;省略为继承,数组整项替换。不填凭据或脚本,仅用已有提供商。",
|
|
52
77
|
invalid: "字段无效,请核对类型、范围与键;草稿保留。",
|
|
53
78
|
conflict: "版本冲突,草稿保留。核对后丢弃并重载;刷新不自动合并。",
|
|
@@ -55,18 +80,19 @@ export const deploymentZh = {
|
|
|
55
80
|
"not-owned": "只读:需要本地宿主已认证 operator 权限。",
|
|
56
81
|
validation: "宿主拒绝配置,草稿保留;核对字段及合并约束。",
|
|
57
82
|
transport: "连接中断,草稿保留;重连后刷新。",
|
|
83
|
+
unconfirmed: "原生表单未确认保存结果,Host 可能已提交。请先刷新受影响的来源再决定是否重试;草稿已保留,不会自动重放。",
|
|
58
84
|
namedIndependent: "设置中的 Deepwork Profiles 是独立的具名 JSONC 运行时资源编辑器。在此保存不会应用具名配置或选择其模型。",
|
|
59
85
|
};
|
|
60
86
|
/** Stable public field names stay visible alongside localized context. */
|
|
61
87
|
export const deploymentFieldLabels = {
|
|
62
|
-
modelParameters: ["Model parameters", "模型参数"], passthrough: ["Model parameter passthrough", "模型参数透传"],
|
|
88
|
+
modelParameters: ["Model parameters", "模型参数"], passthrough: ["Model parameter passthrough", "模型参数透传"], locale: ["Agent business language", "Agent 业务语言"],
|
|
63
89
|
permissionControl: ["Permission-control module", "权限控制子模块"],
|
|
64
90
|
modules: ["Modules", "子模块"], skills: ["Skills", "技能"], roles: ["Agent roles", "Agent 角色"],
|
|
65
|
-
deepwork: ["Deepwork", "Deepwork"],
|
|
91
|
+
deepwork: ["Deepwork", "Deepwork"], runtime: ["Native runtime (restart required)", "原生运行时(需重启)"],
|
|
66
92
|
roleRouting: ["Existing-provider routes", "已有提供商路由"], runtimePolicy: ["Routing and retry policy", "路由与重试策略"],
|
|
67
93
|
workflow: ["Workflow gates", "工作流关卡"], guards: ["Safety guards", "安全保护"], runtimeRecovery: ["Runtime recovery", "运行时恢复"],
|
|
68
94
|
subagents: ["Subagents", "子 Agent"], lsp: ["LSP", "LSP"], presets: ["Preset materialization", "预设物化"],
|
|
69
|
-
|
|
95
|
+
promptOrder: ["Prompt order", "提示词顺序"], defaultActive: ["Default Deepwork mode", "默认 Deepwork 模式"],
|
|
70
96
|
enabled: ["Enabled", "启用"], materialize: ["Materialize presets", "物化预设"], scope: ["Guard scope", "保护范围"],
|
|
71
97
|
plannerRootEnabled: ["Planner main-chat preset (restart required)", "Planner 主聊天预设(需重启)"],
|
|
72
98
|
shellCommandSafety: ["Shell command safety", "Shell 命令安全"], gitWriteGuard: ["Git write policy", "Git 写入策略"],
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DeploymentSchemaNode } from "../profile-types.js";
|
|
2
|
+
import type { DeploymentLocaleKey } from "./deployment-locales.js";
|
|
3
|
+
export declare const CONFIG_MODULES: readonly ["run", "routes", "workflow", "subagents", "permissions", "other", "state"];
|
|
4
|
+
export type ConfigModule = typeof CONFIG_MODULES[number];
|
|
5
|
+
export declare const moduleTitle: (module: ConfigModule) => DeploymentLocaleKey;
|
|
6
|
+
export declare function moduleFor(path: string): Exclude<ConfigModule, "state">;
|
|
7
|
+
export declare function editableConfigField(key: string, layer: "global" | "profile"): boolean;
|
|
8
|
+
export declare function moduleFields(schema: DeploymentSchemaNode, module: ConfigModule, layer: "global" | "profile"): Array<[string, DeploymentSchemaNode]>;
|
|
9
|
+
//# sourceMappingURL=deployment-modules.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const CONFIG_MODULES = ["run", "routes", "workflow", "subagents", "permissions", "other", "state"];
|
|
2
|
+
export const moduleTitle = (module) => `module:${module}`;
|
|
3
|
+
export function moduleFor(path) {
|
|
4
|
+
const key = path.split(".")[0];
|
|
5
|
+
if (["defaultActive", "modules", "modelParameters", "runtime"].includes(key))
|
|
6
|
+
return "run";
|
|
7
|
+
if (["roleRouting", "runtimePolicy", "runtimeRecovery"].includes(key))
|
|
8
|
+
return "routes";
|
|
9
|
+
if (["workflow", "roles", "skills", "presets", "businessLocale", "locale", "promptOrder", "plannerRootEnabled"].includes(key))
|
|
10
|
+
return "workflow";
|
|
11
|
+
if (key === "subagents")
|
|
12
|
+
return "subagents";
|
|
13
|
+
if (["permissionControl", "guards"].includes(key))
|
|
14
|
+
return "permissions";
|
|
15
|
+
return "other";
|
|
16
|
+
}
|
|
17
|
+
export function editableConfigField(key, layer) {
|
|
18
|
+
return !["lsp", "modeName", "section"].includes(key)
|
|
19
|
+
&& !(key === "modules" && layer === "profile") && !(key === "runtime" && layer === "global");
|
|
20
|
+
}
|
|
21
|
+
export function moduleFields(schema, module, layer) {
|
|
22
|
+
return Object.entries(schema.fields ?? {}).filter(([key]) => editableConfigField(key, layer) && moduleFor(key) === module);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=deployment-modules.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ConfigForms } from "@deepseek-ai/dsh-client-ui-settings/client";
|
|
2
|
+
import type { DeploymentController } from "./deployment-controller.js";
|
|
3
|
+
import type { PermissionController } from "./permission-controller.js";
|
|
4
|
+
import type { ConfigModule } from "./deployment-modules.js";
|
|
5
|
+
export type ConfigScope = "global" | "profile";
|
|
6
|
+
interface Destination {
|
|
7
|
+
scope: ConfigScope;
|
|
8
|
+
module: ConfigModule | null;
|
|
9
|
+
}
|
|
10
|
+
interface WorkspaceView extends Destination {
|
|
11
|
+
pending: Destination | null;
|
|
12
|
+
native: DeploymentController | null;
|
|
13
|
+
revision: number;
|
|
14
|
+
}
|
|
15
|
+
/** Contribution-owned memory only. Navigation never saves, applies, or rebases drafts. */
|
|
16
|
+
export declare class DeploymentWorkspace {
|
|
17
|
+
readonly core: DeploymentController;
|
|
18
|
+
readonly permissions?: PermissionController | undefined;
|
|
19
|
+
private state;
|
|
20
|
+
private listeners;
|
|
21
|
+
private forms;
|
|
22
|
+
private profiles;
|
|
23
|
+
private stopForm?;
|
|
24
|
+
private stopNative?;
|
|
25
|
+
private stopCore;
|
|
26
|
+
private stopPermissions?;
|
|
27
|
+
private identity;
|
|
28
|
+
private globalVersion?;
|
|
29
|
+
private sourceBlocked;
|
|
30
|
+
private attachCurrentForm?;
|
|
31
|
+
constructor(core: DeploymentController, permissions?: PermissionController | undefined);
|
|
32
|
+
readonly getSnapshot: () => WorkspaceView;
|
|
33
|
+
readonly subscribe: (listener: () => void) => (() => void);
|
|
34
|
+
private changed;
|
|
35
|
+
bindForms(forms: ConfigForms | null): void;
|
|
36
|
+
private sync;
|
|
37
|
+
controller(scope?: ConfigScope): DeploymentController | null;
|
|
38
|
+
hasPending(): boolean;
|
|
39
|
+
request(destination: Destination): void;
|
|
40
|
+
continueEditing(): void;
|
|
41
|
+
keepAndNavigate(): void;
|
|
42
|
+
discardAndNavigate(): Promise<void>;
|
|
43
|
+
save(): Promise<void>;
|
|
44
|
+
dispose(): void;
|
|
45
|
+
}
|
|
46
|
+
export declare function deploymentWorkspace(core: DeploymentController, permissions?: PermissionController): DeploymentWorkspace;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=deployment-workspace.d.ts.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/** Contribution-owned memory only. Navigation never saves, applies, or rebases drafts. */
|
|
2
|
+
export class DeploymentWorkspace {
|
|
3
|
+
core;
|
|
4
|
+
permissions;
|
|
5
|
+
state = { scope: "global", module: null, pending: null, native: null, revision: 0 };
|
|
6
|
+
listeners = new Set();
|
|
7
|
+
forms = null;
|
|
8
|
+
profiles = new Map();
|
|
9
|
+
stopForm;
|
|
10
|
+
stopNative;
|
|
11
|
+
stopCore;
|
|
12
|
+
stopPermissions;
|
|
13
|
+
identity = null;
|
|
14
|
+
globalVersion;
|
|
15
|
+
sourceBlocked = false;
|
|
16
|
+
attachCurrentForm;
|
|
17
|
+
constructor(core, permissions) {
|
|
18
|
+
this.core = core;
|
|
19
|
+
this.permissions = permissions;
|
|
20
|
+
this.stopCore = core.subscribe(() => { this.sync(); this.changed(); });
|
|
21
|
+
this.stopPermissions = permissions?.store.subscribe(() => this.changed());
|
|
22
|
+
this.sync();
|
|
23
|
+
}
|
|
24
|
+
getSnapshot = () => this.state;
|
|
25
|
+
subscribe = (listener) => { this.listeners.add(listener); return () => this.listeners.delete(listener); };
|
|
26
|
+
changed(patch = {}) { this.state = { ...this.state, ...patch, revision: this.state.revision + 1 }; for (const listener of this.listeners)
|
|
27
|
+
listener(); }
|
|
28
|
+
bindForms(forms) { if (this.forms === forms)
|
|
29
|
+
return; this.forms = forms; this.identity = null; this.sync(); this.changed(); }
|
|
30
|
+
sync() {
|
|
31
|
+
const snapshot = this.core.getSnapshot().snapshot;
|
|
32
|
+
const issue = this.core.getSnapshot().issue, blocked = issue === "unavailable" || issue === "not-owned" || issue === "transport", restored = this.sourceBlocked && !blocked;
|
|
33
|
+
this.sourceBlocked = blocked;
|
|
34
|
+
const key = snapshot?.namespace == null ? null : JSON.stringify([snapshot.hostProfileKey, snapshot.entryId, snapshot.namespace]);
|
|
35
|
+
const changedGlobal = snapshot?.globalRevision !== this.globalVersion;
|
|
36
|
+
this.globalVersion = snapshot?.globalRevision;
|
|
37
|
+
if (key === this.identity) {
|
|
38
|
+
if (blocked)
|
|
39
|
+
this.state.native?.attachForm(null);
|
|
40
|
+
else if (restored)
|
|
41
|
+
this.attachCurrentForm?.();
|
|
42
|
+
if (!blocked && changedGlobal && this.state.native !== null && !this.state.native.getSnapshot().busy)
|
|
43
|
+
void this.state.native.refresh();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.identity = key;
|
|
47
|
+
this.stopForm?.();
|
|
48
|
+
this.stopNative?.();
|
|
49
|
+
this.attachCurrentForm = undefined;
|
|
50
|
+
let native = null;
|
|
51
|
+
if (key !== null && snapshot !== null) {
|
|
52
|
+
native = this.profiles.get(key) ?? this.core.forProfile(snapshot.namespace);
|
|
53
|
+
this.profiles.set(key, native);
|
|
54
|
+
this.stopNative = native.subscribe(() => this.changed());
|
|
55
|
+
if (this.forms !== null) {
|
|
56
|
+
const form = this.forms.get(snapshot.namespace);
|
|
57
|
+
const attach = () => { native.attachForm(this.sourceBlocked ? null : { state: form.getSnapshot(), mutate: (ops, revision) => form.mutate(ops, revision) }); this.changed(); if (!this.sourceBlocked && !native.getSnapshot().busy)
|
|
58
|
+
void native.refresh(); };
|
|
59
|
+
this.attachCurrentForm = attach;
|
|
60
|
+
this.stopForm = form.subscribe(attach);
|
|
61
|
+
attach();
|
|
62
|
+
}
|
|
63
|
+
else
|
|
64
|
+
native.attachForm(null);
|
|
65
|
+
if (native.getSnapshot().snapshot === null)
|
|
66
|
+
void native.refresh();
|
|
67
|
+
}
|
|
68
|
+
this.changed({ native });
|
|
69
|
+
}
|
|
70
|
+
controller(scope = this.state.scope) { return scope === "global" ? this.core : this.state.native; }
|
|
71
|
+
hasPending() { return this.controller()?.getSnapshot().dirty === true || this.state.module === "permissions" && this.permissions?.store.getSnapshot().dirty === true; }
|
|
72
|
+
request(destination) {
|
|
73
|
+
const switched = destination.scope !== this.state.scope;
|
|
74
|
+
const leaving = switched || this.state.module !== null && destination.module !== this.state.module;
|
|
75
|
+
if (leaving && this.hasPending())
|
|
76
|
+
this.changed({ pending: destination });
|
|
77
|
+
else {
|
|
78
|
+
this.changed({ ...destination, pending: null });
|
|
79
|
+
if (switched)
|
|
80
|
+
void this.controller()?.refresh();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
continueEditing() { this.changed({ pending: null }); }
|
|
84
|
+
keepAndNavigate() { const target = this.state.pending; if (target !== null) {
|
|
85
|
+
const switched = target.scope !== this.state.scope;
|
|
86
|
+
this.changed({ ...target, pending: null });
|
|
87
|
+
if (switched)
|
|
88
|
+
void this.controller()?.refresh();
|
|
89
|
+
} }
|
|
90
|
+
async discardAndNavigate() {
|
|
91
|
+
const destination = this.state.pending;
|
|
92
|
+
if (destination === null)
|
|
93
|
+
return;
|
|
94
|
+
const controller = this.controller();
|
|
95
|
+
if (controller?.getSnapshot().dirty) {
|
|
96
|
+
await controller.refresh(true);
|
|
97
|
+
if (controller.getSnapshot().dirty || controller.getSnapshot().issue !== null)
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (this.state.module === "permissions" && this.permissions?.store.getSnapshot().dirty) {
|
|
101
|
+
await this.permissions.refresh(this.permissions.store.getSnapshot().generation, true);
|
|
102
|
+
if (this.permissions.store.getSnapshot().dirty)
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (this.state.pending === destination)
|
|
106
|
+
this.changed({ ...destination, pending: null });
|
|
107
|
+
}
|
|
108
|
+
async save() { const controller = this.controller(); if (controller === null)
|
|
109
|
+
return; await controller.save(); if (controller !== this.core && controller.getSnapshot().saved)
|
|
110
|
+
await this.core.refresh(); }
|
|
111
|
+
dispose() { this.stopCore(); this.stopForm?.(); this.stopNative?.(); this.stopPermissions?.(); for (const controller of this.profiles.values())
|
|
112
|
+
controller.dispose(); this.listeners.clear(); }
|
|
113
|
+
}
|
|
114
|
+
const workspaces = new WeakMap();
|
|
115
|
+
export function deploymentWorkspace(core, permissions) {
|
|
116
|
+
let workspace = workspaces.get(core);
|
|
117
|
+
if (workspace === undefined) {
|
|
118
|
+
workspace = new DeploymentWorkspace(core, permissions);
|
|
119
|
+
workspaces.set(core, workspace);
|
|
120
|
+
}
|
|
121
|
+
return workspace;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=deployment-workspace.js.map
|