@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.
- package/README.md +26 -15
- package/agent-presets/dsmm-builder/agent.cordis.yml +14 -12
- package/agent-presets/dsmm-builder/preset.yml +1 -1
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-clarifier/preset.yml +1 -1
- package/agent-presets/dsmm-code-search/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-code-search/preset.yml +1 -1
- package/agent-presets/dsmm-creative/agent.cordis.yml +3 -1
- package/agent-presets/dsmm-creative/preset.yml +1 -1
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-doc-search/preset.yml +1 -1
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-media-reader/preset.yml +1 -1
- package/agent-presets/dsmm-oracle/agent.cordis.yml +3 -1
- package/agent-presets/dsmm-oracle/preset.yml +1 -1
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +3 -1
- package/agent-presets/dsmm-oracle-2nd/preset.yml +1 -1
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +15 -13
- package/agent-presets/dsmm-orchestrator/preset.yml +2 -2
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-plan-critic/preset.yml +1 -1
- package/agent-presets/dsmm-planner/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-planner/preset.yml +1 -1
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +4 -2
- package/agent-presets/dsmm-reviewer/preset.yml +1 -1
- package/docs/agent-presets.md +15 -5
- package/docs/compatibility.md +66 -11
- package/docs/migration-from-ocmm.md +8 -0
- package/docs/model-routing.md +25 -7
- package/docs/profiles.md +95 -0
- package/docs/releasing.md +66 -19
- package/docs/runtime-recovery.md +39 -14
- package/docs/settings-status.md +13 -5
- package/lib/client/ProfilesSection.d.ts +11 -0
- package/lib/client/ProfilesSection.js +66 -0
- package/lib/client/SessionProfiles.d.ts +19 -0
- package/lib/client/SessionProfiles.js +24 -0
- package/lib/client/StructuredEditor.d.ts +11 -0
- package/lib/client/StructuredEditor.js +74 -0
- package/lib/client/controller.d.ts +115 -0
- package/lib/client/controller.js +340 -0
- package/lib/client/index.d.ts +13 -0
- package/lib/client/index.js +54 -0
- package/lib/client/locales.d.ts +145 -0
- package/lib/client/locales.js +91 -0
- package/lib/client/session-labels.d.ts +8 -0
- package/lib/client/session-labels.js +13 -0
- package/lib/client/structured.d.ts +18 -0
- package/lib/client/structured.js +98 -0
- package/lib/client/styles.d.ts +3 -0
- package/lib/client/styles.js +36 -0
- package/lib/client.js +2825 -0
- package/lib/commands.d.ts +3 -3
- package/lib/commands.js +5 -4
- package/lib/dsh-types.d.ts +20 -0
- package/lib/guards.d.ts +2 -2
- package/lib/guards.js +3 -2
- package/lib/index.d.ts +12 -4
- package/lib/index.js +98 -20
- package/lib/mode.d.ts +2 -2
- package/lib/mode.js +1 -1
- package/lib/model-routing.d.ts +2 -2
- package/lib/model-routing.js +100 -15
- package/lib/preset-registry.js +5 -3
- package/lib/profile-remote.d.ts +37 -0
- package/lib/profile-remote.js +219 -0
- package/lib/profile-rpc.d.ts +35 -0
- package/lib/profile-rpc.js +187 -0
- package/lib/profile-runtime.d.ts +63 -0
- package/lib/profile-runtime.js +310 -0
- package/lib/profile-store.d.ts +60 -0
- package/lib/profile-store.js +588 -0
- package/lib/profile-types.d.ts +80 -0
- package/lib/profile-types.js +2 -0
- package/lib/profiles.d.ts +26 -0
- package/lib/profiles.js +269 -0
- package/lib/prompts.d.ts +2 -2
- package/lib/prompts.js +4 -4
- package/lib/role-providers.d.ts +2 -2
- package/lib/role-providers.js +49 -6
- package/lib/role-routing.d.ts +37 -3
- package/lib/role-routing.js +110 -35
- package/lib/role-subagents.d.ts +2 -2
- package/lib/role-subagents.js +6 -4
- package/lib/roles.d.ts +4 -0
- package/lib/roles.js +43 -27
- package/lib/routing-policy.d.ts +32 -0
- package/lib/routing-policy.js +92 -0
- package/lib/runtime-recovery.d.ts +2 -2
- package/lib/runtime-recovery.js +215 -54
- package/lib/session-metadata.d.ts +13 -0
- package/lib/session-metadata.js +34 -0
- package/lib/session-persistence.d.ts +35 -0
- package/lib/session-persistence.js +304 -0
- package/lib/settings.d.ts +34 -1
- package/lib/settings.js +33 -7
- package/lib/state.d.ts +1 -0
- package/lib/state.js +4 -0
- package/lib/status.d.ts +9 -1
- package/lib/status.js +34 -12
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +66 -15
- package/patches/agent-presets-root.example.cordis.patch.yml +6 -10
- package/prompts/deepseek-v4-pro.md +1 -1
- package/prompts/deepwork.md +3 -3
- package/scripts/repair-session-log.mjs +476 -0
- package/scripts/session-repair-native-verifier.mjs +367 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
import { constants, closeSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, opendirSync, readSync, realpathSync, renameSync, unlinkSync, writeSync } from "node:fs";
|
|
2
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
3
|
+
import { basename, dirname, isAbsolute, join, parse, resolve } from "node:path";
|
|
4
|
+
import { parseTree } from "jsonc-parser";
|
|
5
|
+
import { ABSENT_PROFILE_SELECTION_REVISION } from "./profile-types.js";
|
|
6
|
+
import { DsmmProfileError, MAX_PROFILE_BYTES, MAX_PROFILE_COUNT, MAX_PROFILE_DIRECTORY_ENTRIES, MAX_PROFILE_REVISIONS, parseProfileDocument, profileErrorInfo, validateProfileId, validateProfileRevision } from "./profiles.js";
|
|
7
|
+
export const MAX_SESSION_PROFILE_CHOICES = 1024;
|
|
8
|
+
/** This directory is supplied by the Host, never by a remote method parameter. */
|
|
9
|
+
export class ProfileStore {
|
|
10
|
+
profileDir;
|
|
11
|
+
timeoutMs;
|
|
12
|
+
pollMs;
|
|
13
|
+
rename;
|
|
14
|
+
rootIdentity;
|
|
15
|
+
constructor(profileDir, options = {}) {
|
|
16
|
+
if (!isAbsolute(profileDir) || dirname(resolve(profileDir)) === resolve(profileDir) || basename(resolve(profileDir)) !== "dsmm-profiles") {
|
|
17
|
+
throw new DsmmProfileError("unsafe-path", "The Host must supply its native profile's dsmm-profiles directory.");
|
|
18
|
+
}
|
|
19
|
+
this.profileDir = resolve(profileDir);
|
|
20
|
+
this.timeoutMs = boundedOption(options.lockTimeoutMs, 2000, 0, 30000);
|
|
21
|
+
this.pollMs = boundedOption(options.lockPollMs, 25, 1, 1000);
|
|
22
|
+
this.rename = options.rename ?? renameSync;
|
|
23
|
+
}
|
|
24
|
+
async describe() {
|
|
25
|
+
return this.locked(() => {
|
|
26
|
+
const entries = this.inventory();
|
|
27
|
+
const profiles = entries.map((name) => {
|
|
28
|
+
const id = name.slice(0, -6);
|
|
29
|
+
try {
|
|
30
|
+
validateProfileId(id);
|
|
31
|
+
if (name !== `${id}.jsonc`)
|
|
32
|
+
throw new DsmmProfileError("unsafe-path", "Profile filename must use lowercase .jsonc and match its ID.");
|
|
33
|
+
const draft = this.draft(id, entries);
|
|
34
|
+
return { id, ...(draft.document.label === undefined ? {} : { label: draft.document.label }), revision: draft.revision };
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return { id: safeInventoryId(id), revision: null, error: profileErrorInfo(error) };
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
try {
|
|
41
|
+
const selected = this.selection();
|
|
42
|
+
return { profiles, selectedId: selected.selectedId, appliedRevision: selected.appliedRevision, selectionRevision: selected.selectionRevision };
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
// An error is not a successful fallback to the baseline.
|
|
46
|
+
return { profiles, selectedId: null, appliedRevision: null, selectionRevision: "unavailable", selectionError: profileErrorInfo(error, "corrupt-selection") };
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async read(id) {
|
|
51
|
+
validateProfileId(id);
|
|
52
|
+
return this.locked(() => this.readResult(this.draft(id, this.inventory())));
|
|
53
|
+
}
|
|
54
|
+
async save(request) {
|
|
55
|
+
validateProfileId(request.id);
|
|
56
|
+
const document = parseProfileDocument(request.content, request.id);
|
|
57
|
+
if (request.expectedRevision !== null)
|
|
58
|
+
validateProfileRevision(request.expectedRevision);
|
|
59
|
+
return this.locked((assertLock) => {
|
|
60
|
+
const entries = this.inventory();
|
|
61
|
+
const name = this.draftName(request.id, entries);
|
|
62
|
+
const current = name === undefined ? undefined : this.draft(request.id, entries);
|
|
63
|
+
if ((current?.revision ?? null) !== request.expectedRevision)
|
|
64
|
+
conflict("The profile changed since it was opened. Reload it before saving.");
|
|
65
|
+
if (current === undefined && entries.length >= MAX_PROFILE_COUNT)
|
|
66
|
+
throw new DsmmProfileError("limit", "At most 128 Deepwork profiles are supported.");
|
|
67
|
+
const bytes = Buffer.from(request.content, "utf8");
|
|
68
|
+
const target = join(this.profileDir, `${request.id}.jsonc`);
|
|
69
|
+
this.atomicReplace(target, bytes, () => {
|
|
70
|
+
const latestNames = this.inventory();
|
|
71
|
+
const latest = this.draftName(request.id, latestNames) === undefined ? null : this.draft(request.id, latestNames).revision;
|
|
72
|
+
if (latest !== request.expectedRevision)
|
|
73
|
+
conflict("The profile was edited externally during save. Reload it before saving.");
|
|
74
|
+
}, assertLock);
|
|
75
|
+
return this.readResult({ bytes, content: request.content, revision: digest(bytes), document });
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
async loadSelection() {
|
|
79
|
+
return this.locked(() => this.selection());
|
|
80
|
+
}
|
|
81
|
+
async loadSessionSelection(sessionId) {
|
|
82
|
+
validateSessionProfileId(sessionId);
|
|
83
|
+
return this.locked(() => this.sessionSelection(sessionId));
|
|
84
|
+
}
|
|
85
|
+
async selectSession(request, epoch, validateCandidate, commit) {
|
|
86
|
+
validateSessionProfileId(request.sessionId);
|
|
87
|
+
validateSelectionRequest(request);
|
|
88
|
+
validateProfileRevision(epoch, "admissionEpoch");
|
|
89
|
+
return this.locked(async (assertLock) => {
|
|
90
|
+
commit.assertCurrent();
|
|
91
|
+
if (this.sessionSelection(request.sessionId).selectionRevision !== request.expectedSelectionRevision)
|
|
92
|
+
conflict("The session profile changed. Refresh before selecting again.");
|
|
93
|
+
const draft = request.id === null ? undefined : this.draft(request.id, this.inventory());
|
|
94
|
+
if (draft !== undefined && draft.revision !== request.expectedRevision)
|
|
95
|
+
conflict("The profile changed before selection. Reload and select its latest revision.");
|
|
96
|
+
let prepared;
|
|
97
|
+
try {
|
|
98
|
+
prepared = await validateCandidate(draft === undefined ? null : structuredClone(draft.document));
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
if (error instanceof DsmmProfileError)
|
|
102
|
+
throw error;
|
|
103
|
+
throw new DsmmProfileError("activation", "The candidate profile could not be activated; the previous session selection was retained.");
|
|
104
|
+
}
|
|
105
|
+
const directory = join(this.profileDir, ".sessions");
|
|
106
|
+
const target = join(directory, `${sessionChoiceKey(request.sessionId)}.json`);
|
|
107
|
+
const fence = (temporary) => {
|
|
108
|
+
commit.assertCurrent();
|
|
109
|
+
if (this.sessionSelection(request.sessionId, temporary).selectionRevision !== request.expectedSelectionRevision)
|
|
110
|
+
conflict("The session selection was edited externally. Refresh before selecting again.");
|
|
111
|
+
if (draft !== undefined && this.draft(request.id, this.inventory()).revision !== draft.revision)
|
|
112
|
+
conflict("The draft changed during activation. Reload and select again.");
|
|
113
|
+
validateDirectories(directory, false);
|
|
114
|
+
// The one exclusive atomic staging file is not a session choice.
|
|
115
|
+
const entries = boundedEntries(directory, MAX_SESSION_PROFILE_CHOICES + (temporary === undefined ? 0 : 1))
|
|
116
|
+
.filter((name) => temporary === undefined || name !== basename(temporary));
|
|
117
|
+
if (status(target) === undefined && entries.length >= MAX_SESSION_PROFILE_CHOICES)
|
|
118
|
+
throw new DsmmProfileError("limit", "The session profile choice inventory is full; no selection was committed.");
|
|
119
|
+
};
|
|
120
|
+
assertLock();
|
|
121
|
+
commit.assertCurrent();
|
|
122
|
+
validateDirectories(directory, true);
|
|
123
|
+
fence();
|
|
124
|
+
if (draft !== undefined)
|
|
125
|
+
this.publishRevision(draft, assertLock);
|
|
126
|
+
const pointer = { version: 1, sessionId: request.sessionId, id: request.id, revision: draft?.revision ?? null, epoch };
|
|
127
|
+
const bytes = Buffer.from(`${JSON.stringify(pointer)}\n`, "utf8");
|
|
128
|
+
const selection = { sessionId: request.sessionId, admissionEpoch: epoch,
|
|
129
|
+
selectedId: request.id, appliedRevision: draft?.revision ?? null, selectionRevision: digest(bytes), document: draft?.document ?? null, content: draft?.content ?? null };
|
|
130
|
+
this.atomicReplace(target, bytes, fence, assertLock);
|
|
131
|
+
commit.committed(selection, prepared);
|
|
132
|
+
return { selection, prepared };
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
async select(request, validateCandidate) {
|
|
136
|
+
validateSelectionRequest(request);
|
|
137
|
+
return this.locked(async (assertLock) => {
|
|
138
|
+
const current = this.selection();
|
|
139
|
+
if (current.selectionRevision !== request.expectedSelectionRevision)
|
|
140
|
+
conflict("The selected profile changed. Refresh before selecting again.");
|
|
141
|
+
const draft = request.id === null ? undefined : this.draft(request.id, this.inventory());
|
|
142
|
+
if (draft !== undefined && draft.revision !== request.expectedRevision)
|
|
143
|
+
conflict("The profile changed before selection. Reload and select its latest revision.");
|
|
144
|
+
let prepared;
|
|
145
|
+
try {
|
|
146
|
+
prepared = await validateCandidate?.(draft === undefined ? null : structuredClone(draft.document));
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
if (error instanceof DsmmProfileError)
|
|
150
|
+
throw error;
|
|
151
|
+
throw new DsmmProfileError("activation", "The candidate profile could not be activated; the previous selection was retained.");
|
|
152
|
+
}
|
|
153
|
+
// The audit may await native work. Recheck security and CAS afterwards.
|
|
154
|
+
assertLock();
|
|
155
|
+
this.assertSelectionRevision(request.expectedSelectionRevision);
|
|
156
|
+
if (draft !== undefined && this.draft(request.id, this.inventory()).revision !== draft.revision)
|
|
157
|
+
conflict("The draft changed during activation. Reload and select again.");
|
|
158
|
+
if (draft !== undefined)
|
|
159
|
+
this.publishRevision(draft, assertLock);
|
|
160
|
+
const pointer = { version: 1, id: request.id, revision: draft?.revision ?? null };
|
|
161
|
+
const bytes = Buffer.from(`${JSON.stringify(pointer)}\n`, "utf8");
|
|
162
|
+
this.atomicReplace(join(this.profileDir, ".selection.json"), bytes, () => {
|
|
163
|
+
this.assertSelectionRevision(request.expectedSelectionRevision);
|
|
164
|
+
if (draft !== undefined && this.draft(request.id, this.inventory()).revision !== draft.revision)
|
|
165
|
+
conflict("The draft changed during selection. Reload and select again.");
|
|
166
|
+
}, assertLock);
|
|
167
|
+
return {
|
|
168
|
+
selection: { selectedId: request.id, appliedRevision: draft?.revision ?? null, selectionRevision: digest(bytes), document: draft?.document ?? null, content: draft?.content ?? null },
|
|
169
|
+
prepared
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
readResult(draft) {
|
|
174
|
+
return { id: draft.document.id, ...(draft.document.label === undefined ? {} : { label: draft.document.label }), revision: draft.revision, content: draft.content };
|
|
175
|
+
}
|
|
176
|
+
inventory() {
|
|
177
|
+
this.validateRoot(false);
|
|
178
|
+
const names = boundedEntries(this.profileDir, MAX_PROFILE_DIRECTORY_ENTRIES).filter((name) => !name.startsWith(".") && /\.jsonc$/iu.test(name)).sort();
|
|
179
|
+
if (names.length > MAX_PROFILE_COUNT)
|
|
180
|
+
throw new DsmmProfileError("limit", "Profile inventory exceeds the 128-profile limit.");
|
|
181
|
+
const seen = new Set();
|
|
182
|
+
for (const name of names) {
|
|
183
|
+
const key = name.toLowerCase();
|
|
184
|
+
if (seen.has(key))
|
|
185
|
+
throw new DsmmProfileError("unsafe-path", "Profile filenames collide case-insensitively; rename the conflicting files manually.");
|
|
186
|
+
seen.add(key);
|
|
187
|
+
}
|
|
188
|
+
return names;
|
|
189
|
+
}
|
|
190
|
+
draftName(id, entries) {
|
|
191
|
+
const expected = `${id}.jsonc`;
|
|
192
|
+
const found = entries.find((name) => name.toLowerCase() === expected);
|
|
193
|
+
if (found !== undefined && found !== expected)
|
|
194
|
+
throw new DsmmProfileError("unsafe-path", "An existing profile has a conflicting filename case; rename it manually.");
|
|
195
|
+
return found;
|
|
196
|
+
}
|
|
197
|
+
draft(id, entries) {
|
|
198
|
+
validateProfileId(id);
|
|
199
|
+
const name = this.draftName(id, entries);
|
|
200
|
+
if (name === undefined)
|
|
201
|
+
throw new DsmmProfileError("not-found", "The requested Deepwork profile does not exist.");
|
|
202
|
+
const file = regularFile(join(this.profileDir, name), MAX_PROFILE_BYTES);
|
|
203
|
+
return { ...file, document: parseProfileDocument(file.content, id) };
|
|
204
|
+
}
|
|
205
|
+
selection() {
|
|
206
|
+
this.validateRoot(false);
|
|
207
|
+
const path = join(this.profileDir, ".selection.json");
|
|
208
|
+
if (status(path) === undefined)
|
|
209
|
+
return { selectedId: null, appliedRevision: null, selectionRevision: ABSENT_PROFILE_SELECTION_REVISION, document: null, content: null };
|
|
210
|
+
try {
|
|
211
|
+
const file = regularFile(path, 1024);
|
|
212
|
+
const pointer = parseSelectionPointer(file.content);
|
|
213
|
+
if (pointer.id === null)
|
|
214
|
+
return { selectedId: null, appliedRevision: null, selectionRevision: file.revision, document: null, content: null };
|
|
215
|
+
validateDirectories(join(this.profileDir, ".revisions"), false);
|
|
216
|
+
const immutable = regularFile(join(this.profileDir, ".revisions", `${pointer.revision}.jsonc`), MAX_PROFILE_BYTES);
|
|
217
|
+
if (immutable.revision !== pointer.revision)
|
|
218
|
+
throw new DsmmProfileError("corrupt-selection", "The selected immutable profile revision failed its SHA256 verification.");
|
|
219
|
+
const document = parseProfileDocument(immutable.content, pointer.id);
|
|
220
|
+
return { selectedId: pointer.id, appliedRevision: pointer.revision, selectionRevision: file.revision, document, content: immutable.content };
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
if (error instanceof DsmmProfileError && error.code === "unsafe-path")
|
|
224
|
+
throw error;
|
|
225
|
+
throw new DsmmProfileError("corrupt-selection", "The selected profile pointer or immutable revision is missing or invalid. Repair it explicitly; the baseline was not silently selected.");
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
sessionSelection(sessionId, temporary) {
|
|
229
|
+
this.validateRoot(false);
|
|
230
|
+
const absent = { sessionId, admissionEpoch: null, selectedId: null, appliedRevision: null,
|
|
231
|
+
selectionRevision: ABSENT_PROFILE_SELECTION_REVISION, document: null, content: null };
|
|
232
|
+
const directory = join(this.profileDir, ".sessions");
|
|
233
|
+
if (status(directory) === undefined)
|
|
234
|
+
return absent;
|
|
235
|
+
validateDirectories(directory, false);
|
|
236
|
+
const entries = boundedEntries(directory, MAX_SESSION_PROFILE_CHOICES + (temporary === undefined ? 0 : 1))
|
|
237
|
+
.filter((name) => temporary === undefined || name !== basename(temporary));
|
|
238
|
+
if (entries.length > MAX_SESSION_PROFILE_CHOICES)
|
|
239
|
+
throw new DsmmProfileError("limit", "The session profile choice inventory exceeds its supported limit.");
|
|
240
|
+
const path = join(directory, `${sessionChoiceKey(sessionId)}.json`);
|
|
241
|
+
if (status(path) === undefined)
|
|
242
|
+
return absent;
|
|
243
|
+
try {
|
|
244
|
+
const file = regularFile(path, 2048);
|
|
245
|
+
const pointer = parseSessionSelectionPointer(file.content, sessionId);
|
|
246
|
+
if (pointer.id === null)
|
|
247
|
+
return { ...absent, admissionEpoch: pointer.epoch, selectionRevision: file.revision };
|
|
248
|
+
validateDirectories(join(this.profileDir, ".revisions"), false);
|
|
249
|
+
const immutable = regularFile(join(this.profileDir, ".revisions", `${pointer.revision}.jsonc`), MAX_PROFILE_BYTES);
|
|
250
|
+
if (immutable.revision !== pointer.revision)
|
|
251
|
+
throw new DsmmProfileError("corrupt-selection", "The session's immutable profile revision failed SHA256 verification.");
|
|
252
|
+
return { sessionId, admissionEpoch: pointer.epoch, selectedId: pointer.id, appliedRevision: pointer.revision,
|
|
253
|
+
selectionRevision: file.revision, document: parseProfileDocument(immutable.content, pointer.id), content: immutable.content };
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
if (error instanceof DsmmProfileError && error.code === "unsafe-path")
|
|
257
|
+
throw error;
|
|
258
|
+
throw new DsmmProfileError("corrupt-selection", "The session profile choice or immutable revision is missing or invalid. Repair it explicitly; no global or baseline fallback was admitted.");
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
assertSelectionRevision(expected) {
|
|
262
|
+
if (this.selection().selectionRevision !== expected)
|
|
263
|
+
conflict("The selection was edited externally. Refresh before selecting again.");
|
|
264
|
+
}
|
|
265
|
+
publishRevision(draft, assertLock) {
|
|
266
|
+
assertLock();
|
|
267
|
+
const directory = join(this.profileDir, ".revisions");
|
|
268
|
+
validateDirectories(directory, true);
|
|
269
|
+
const path = join(directory, `${draft.revision}.jsonc`);
|
|
270
|
+
if (status(path) !== undefined) {
|
|
271
|
+
const existing = regularFile(path, MAX_PROFILE_BYTES);
|
|
272
|
+
if (existing.revision !== draft.revision || !existing.bytes.equals(draft.bytes))
|
|
273
|
+
throw new DsmmProfileError("corrupt-selection", "An immutable profile revision has been altered; no selection was committed.");
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (boundedEntries(directory, MAX_PROFILE_REVISIONS).length >= MAX_PROFILE_REVISIONS)
|
|
277
|
+
throw new DsmmProfileError("limit", "The immutable revision inventory is full; no selection was committed.");
|
|
278
|
+
let fd;
|
|
279
|
+
let created = false;
|
|
280
|
+
try {
|
|
281
|
+
assertLock();
|
|
282
|
+
fd = openSync(path, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 0o600);
|
|
283
|
+
created = true;
|
|
284
|
+
writeAll(fd, draft.bytes);
|
|
285
|
+
fsyncSync(fd);
|
|
286
|
+
closeSync(fd);
|
|
287
|
+
fd = undefined;
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
if (fd !== undefined)
|
|
291
|
+
closeSync(fd);
|
|
292
|
+
if (created)
|
|
293
|
+
unlinkSync(path);
|
|
294
|
+
throw error;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
atomicReplace(target, bytes, beforeRename, assertLock) {
|
|
298
|
+
assertLock();
|
|
299
|
+
if (status(target) !== undefined)
|
|
300
|
+
assertRegular(status(target));
|
|
301
|
+
const temporary = join(dirname(target), `.dsmm-tmp-${randomUUID()}`);
|
|
302
|
+
let fd;
|
|
303
|
+
let created = false;
|
|
304
|
+
try {
|
|
305
|
+
fd = openSync(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 0o600);
|
|
306
|
+
created = true;
|
|
307
|
+
writeAll(fd, bytes);
|
|
308
|
+
fsyncSync(fd);
|
|
309
|
+
closeSync(fd);
|
|
310
|
+
fd = undefined;
|
|
311
|
+
this.validateRoot(false);
|
|
312
|
+
if (status(target) !== undefined)
|
|
313
|
+
assertRegular(status(target));
|
|
314
|
+
beforeRename(temporary);
|
|
315
|
+
assertLock();
|
|
316
|
+
this.rename(temporary, target);
|
|
317
|
+
created = false;
|
|
318
|
+
// rename is the transaction commit. No fallible work follows it.
|
|
319
|
+
}
|
|
320
|
+
finally {
|
|
321
|
+
if (fd !== undefined)
|
|
322
|
+
closeSync(fd);
|
|
323
|
+
if (created) {
|
|
324
|
+
try {
|
|
325
|
+
unlinkSync(temporary);
|
|
326
|
+
}
|
|
327
|
+
catch { /* Never remove another or previous file to recover a failed commit. */ }
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
validateRoot(create) {
|
|
332
|
+
validateDirectories(this.profileDir, create);
|
|
333
|
+
const current = lstatSync(this.profileDir);
|
|
334
|
+
if (this.rootIdentity !== undefined && !sameFile(this.rootIdentity, current)) {
|
|
335
|
+
throw new DsmmProfileError("unsafe-path", "The profile storage directory was replaced during this Host's lifetime; no operation was committed.");
|
|
336
|
+
}
|
|
337
|
+
this.rootIdentity ??= current;
|
|
338
|
+
}
|
|
339
|
+
async locked(operation) {
|
|
340
|
+
let fd;
|
|
341
|
+
let ownedStatus;
|
|
342
|
+
let ownedBytes;
|
|
343
|
+
const lockPath = join(this.profileDir, ".lock");
|
|
344
|
+
const assertLock = () => {
|
|
345
|
+
this.validateRoot(false);
|
|
346
|
+
const current = status(lockPath);
|
|
347
|
+
if (fd === undefined || ownedStatus === undefined || ownedBytes === undefined || current === undefined || !sameFile(ownedStatus, current) || !sameFile(ownedStatus, fstatSync(fd))) {
|
|
348
|
+
conflict("Profile lock ownership changed during this operation. No selection was committed; retry after the current owner finishes.");
|
|
349
|
+
}
|
|
350
|
+
assertRegular(current);
|
|
351
|
+
assertRegular(fstatSync(fd));
|
|
352
|
+
if (!regularFile(lockPath, 256).bytes.equals(ownedBytes))
|
|
353
|
+
conflict("The profile lock was altered during this operation. No selection was committed; retry after the current owner finishes.");
|
|
354
|
+
};
|
|
355
|
+
try {
|
|
356
|
+
this.validateRoot(true);
|
|
357
|
+
const deadline = performance.now() + this.timeoutMs;
|
|
358
|
+
for (;;) {
|
|
359
|
+
this.validateRoot(false);
|
|
360
|
+
try {
|
|
361
|
+
fd = openSync(lockPath, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 0o600);
|
|
362
|
+
ownedStatus = fstatSync(fd);
|
|
363
|
+
ownedBytes = Buffer.from(`${process.pid} ${randomUUID()}\n`, "utf8");
|
|
364
|
+
writeAll(fd, ownedBytes);
|
|
365
|
+
fsyncSync(fd);
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
catch (error) {
|
|
369
|
+
if (fd !== undefined || errorCode(error) !== "EEXIST")
|
|
370
|
+
throw error;
|
|
371
|
+
const existing = status(lockPath);
|
|
372
|
+
if (existing !== undefined)
|
|
373
|
+
assertRegular(existing);
|
|
374
|
+
if (performance.now() >= deadline)
|
|
375
|
+
throw new DsmmProfileError("lock-timeout", "Another process owns the profile lock. Retry after it finishes; locks are never stolen.");
|
|
376
|
+
await new Promise((done) => setTimeout(done, Math.min(this.pollMs, Math.max(1, deadline - performance.now()))));
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
assertLock();
|
|
380
|
+
return await operation(assertLock);
|
|
381
|
+
}
|
|
382
|
+
catch (error) {
|
|
383
|
+
if (error instanceof DsmmProfileError)
|
|
384
|
+
throw error;
|
|
385
|
+
throw new DsmmProfileError("io", "Deepwork profile storage failed. Existing files and the previous selection were retained.");
|
|
386
|
+
}
|
|
387
|
+
finally {
|
|
388
|
+
if (fd !== undefined) {
|
|
389
|
+
try {
|
|
390
|
+
closeSync(fd);
|
|
391
|
+
}
|
|
392
|
+
catch { /* A committed pointer must remain a successful transaction. */ }
|
|
393
|
+
try {
|
|
394
|
+
this.validateRoot(false);
|
|
395
|
+
const current = status(lockPath);
|
|
396
|
+
if (ownedStatus !== undefined && ownedBytes !== undefined && current !== undefined && sameFile(ownedStatus, current) && current.isFile() && !current.isSymbolicLink() && regularFile(lockPath, 256).bytes.equals(ownedBytes))
|
|
397
|
+
unlinkSync(lockPath);
|
|
398
|
+
}
|
|
399
|
+
catch { /* Do not delete a replacement lock or traverse an altered root. */ }
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
function boundedOption(value, fallback, minimum, maximum) {
|
|
405
|
+
if (value === undefined)
|
|
406
|
+
return fallback;
|
|
407
|
+
if (!Number.isSafeInteger(value) || value < minimum || value > maximum)
|
|
408
|
+
throw new DsmmProfileError("validation", "Profile lock timing is outside supported bounds.");
|
|
409
|
+
return value;
|
|
410
|
+
}
|
|
411
|
+
function digest(bytes) {
|
|
412
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
413
|
+
}
|
|
414
|
+
function errorCode(error) {
|
|
415
|
+
return typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : undefined;
|
|
416
|
+
}
|
|
417
|
+
function status(path) {
|
|
418
|
+
try {
|
|
419
|
+
return lstatSync(path);
|
|
420
|
+
}
|
|
421
|
+
catch (error) {
|
|
422
|
+
if (errorCode(error) === "ENOENT")
|
|
423
|
+
return undefined;
|
|
424
|
+
throw error;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
function validateDirectories(directory, create) {
|
|
428
|
+
const absolute = resolve(directory);
|
|
429
|
+
const root = parse(absolute).root;
|
|
430
|
+
const parts = [];
|
|
431
|
+
for (let current = absolute; current !== root; current = dirname(current))
|
|
432
|
+
parts.unshift(current);
|
|
433
|
+
parts.unshift(root);
|
|
434
|
+
for (const path of parts) {
|
|
435
|
+
let found = status(path);
|
|
436
|
+
if (found === undefined && create) {
|
|
437
|
+
try {
|
|
438
|
+
mkdirSync(path, { mode: 0o700 });
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
if (errorCode(error) !== "EEXIST")
|
|
442
|
+
throw error;
|
|
443
|
+
}
|
|
444
|
+
found = status(path);
|
|
445
|
+
}
|
|
446
|
+
if (found === undefined || found.isSymbolicLink() || !found.isDirectory())
|
|
447
|
+
throw new DsmmProfileError("unsafe-path", "Profile directories and every ancestor must be real directories, not links or junctions.");
|
|
448
|
+
const canonical = resolve(realpathSync(path));
|
|
449
|
+
if ((process.platform === "win32" ? canonical.toLowerCase() : canonical) !== (process.platform === "win32" ? path.toLowerCase() : path)) {
|
|
450
|
+
throw new DsmmProfileError("unsafe-path", "Profile storage must not traverse redirected directories or reparse points.");
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
function assertRegular(found) {
|
|
455
|
+
if (found.isSymbolicLink() || !found.isFile() || found.nlink !== 1)
|
|
456
|
+
throw new DsmmProfileError("unsafe-path", "Profile files and lock files must be regular, unlinked files, not symlinks, junctions, directories or hard links.");
|
|
457
|
+
}
|
|
458
|
+
function sameFile(first, second) {
|
|
459
|
+
return first.dev === second.dev && first.ino === second.ino;
|
|
460
|
+
}
|
|
461
|
+
function regularFile(path, maximum) {
|
|
462
|
+
const before = status(path);
|
|
463
|
+
if (before === undefined)
|
|
464
|
+
throw new DsmmProfileError("not-found", "The required profile file does not exist.");
|
|
465
|
+
assertRegular(before);
|
|
466
|
+
if (before.size > maximum)
|
|
467
|
+
throw new DsmmProfileError("limit", "Profile storage contains an oversized file.");
|
|
468
|
+
const fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
469
|
+
try {
|
|
470
|
+
const opened = fstatSync(fd);
|
|
471
|
+
assertRegular(opened);
|
|
472
|
+
if (!sameFile(before, opened))
|
|
473
|
+
conflict("The profile file changed while it was opened. Retry the operation.");
|
|
474
|
+
const buffer = Buffer.alloc(maximum + 1);
|
|
475
|
+
let size = 0;
|
|
476
|
+
while (size < buffer.length) {
|
|
477
|
+
const count = readSync(fd, buffer, size, buffer.length - size, size);
|
|
478
|
+
if (count === 0)
|
|
479
|
+
break;
|
|
480
|
+
size += count;
|
|
481
|
+
}
|
|
482
|
+
if (size > maximum)
|
|
483
|
+
throw new DsmmProfileError("limit", "Profile storage contains an oversized file.");
|
|
484
|
+
const after = fstatSync(fd);
|
|
485
|
+
const named = status(path);
|
|
486
|
+
if (named === undefined || !sameFile(opened, named) || opened.size !== after.size || opened.mtimeMs !== after.mtimeMs || opened.ctimeMs !== after.ctimeMs)
|
|
487
|
+
conflict("The profile file was edited while being read. Retry the operation.");
|
|
488
|
+
const bytes = buffer.subarray(0, size);
|
|
489
|
+
let content;
|
|
490
|
+
try {
|
|
491
|
+
content = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
|
|
492
|
+
}
|
|
493
|
+
catch {
|
|
494
|
+
throw new DsmmProfileError("validation", "Profile files must contain valid UTF-8 text.", "content");
|
|
495
|
+
}
|
|
496
|
+
return { bytes, content, revision: digest(bytes) };
|
|
497
|
+
}
|
|
498
|
+
finally {
|
|
499
|
+
closeSync(fd);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function boundedEntries(directory, maximum) {
|
|
503
|
+
const handle = opendirSync(directory);
|
|
504
|
+
const entries = [];
|
|
505
|
+
try {
|
|
506
|
+
for (;;) {
|
|
507
|
+
const entry = handle.readSync();
|
|
508
|
+
if (entry === null)
|
|
509
|
+
break;
|
|
510
|
+
if (entries.length >= maximum)
|
|
511
|
+
throw new DsmmProfileError("limit", "Profile storage inventory exceeds its supported limit.");
|
|
512
|
+
entries.push(entry.name);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
finally {
|
|
516
|
+
handle.closeSync();
|
|
517
|
+
}
|
|
518
|
+
return entries;
|
|
519
|
+
}
|
|
520
|
+
function writeAll(fd, bytes) {
|
|
521
|
+
let offset = 0;
|
|
522
|
+
while (offset < bytes.length) {
|
|
523
|
+
const count = writeSync(fd, bytes, offset, bytes.length - offset);
|
|
524
|
+
if (count === 0)
|
|
525
|
+
throw new Error("Incomplete profile file write");
|
|
526
|
+
offset += count;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function parseSelectionPointer(content) {
|
|
530
|
+
const errors = [];
|
|
531
|
+
const tree = parseTree(content, errors, { disallowComments: true, allowTrailingComma: false, allowEmptyContent: false });
|
|
532
|
+
if (tree?.type !== "object" || errors.length > 0 || tree.children?.length !== 3)
|
|
533
|
+
throw new DsmmProfileError("corrupt-selection", "The selected profile pointer must contain exactly three unique fields in valid JSON.");
|
|
534
|
+
let input;
|
|
535
|
+
try {
|
|
536
|
+
input = JSON.parse(content);
|
|
537
|
+
}
|
|
538
|
+
catch {
|
|
539
|
+
throw new DsmmProfileError("corrupt-selection", "The selected profile pointer is not valid JSON.");
|
|
540
|
+
}
|
|
541
|
+
if (typeof input !== "object" || input === null || Array.isArray(input))
|
|
542
|
+
throw new DsmmProfileError("corrupt-selection", "The selected profile pointer must be a versioned object.");
|
|
543
|
+
const record = input;
|
|
544
|
+
if (Object.keys(record).length !== 3 || !["version", "id", "revision"].every((key) => Object.hasOwn(record, key)) || record.version !== 1)
|
|
545
|
+
throw new DsmmProfileError("corrupt-selection", "The selected profile pointer has an unsupported shape or version.");
|
|
546
|
+
if (record.id === null && record.revision === null)
|
|
547
|
+
return { version: 1, id: null, revision: null };
|
|
548
|
+
validateProfileId(record.id);
|
|
549
|
+
validateProfileRevision(record.revision, "revision");
|
|
550
|
+
return { version: 1, id: record.id, revision: record.revision };
|
|
551
|
+
}
|
|
552
|
+
export function validateSessionProfileId(id) {
|
|
553
|
+
if (typeof id !== "string" || id.length < 1 || id.length > 256 || /[\u0000-\u001f\u007f]/u.test(id) || Buffer.from(id, "utf8").toString("utf8") !== id) {
|
|
554
|
+
throw new DsmmProfileError("validation", "A bounded native session ID is required.", "sessionId");
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
function sessionChoiceKey(sessionId) { return digest(Buffer.from(sessionId, "utf8")); }
|
|
558
|
+
function validateSelectionRequest(request) {
|
|
559
|
+
if (request.id !== null) {
|
|
560
|
+
validateProfileId(request.id);
|
|
561
|
+
validateProfileRevision(request.expectedRevision);
|
|
562
|
+
}
|
|
563
|
+
else if (request.expectedRevision !== undefined) {
|
|
564
|
+
throw new DsmmProfileError("validation", "Baseline selection must not include a draft revision.", "expectedRevision");
|
|
565
|
+
}
|
|
566
|
+
if (request.expectedSelectionRevision !== ABSENT_PROFILE_SELECTION_REVISION)
|
|
567
|
+
validateProfileRevision(request.expectedSelectionRevision, "expectedSelectionRevision");
|
|
568
|
+
}
|
|
569
|
+
function parseSessionSelectionPointer(content, sessionId) {
|
|
570
|
+
const errors = [];
|
|
571
|
+
const tree = parseTree(content, errors, { disallowComments: true, allowTrailingComma: false, allowEmptyContent: false });
|
|
572
|
+
if (tree?.type !== "object" || errors.length > 0 || tree.children?.length !== 5)
|
|
573
|
+
throw new DsmmProfileError("corrupt-selection", "The session choice must contain exactly five unique fields in valid JSON.");
|
|
574
|
+
const record = JSON.parse(content);
|
|
575
|
+
if (Object.keys(record).length !== 5 || !["version", "sessionId", "id", "revision", "epoch"].every((key) => Object.hasOwn(record, key)) || record.version !== 1 || record.sessionId !== sessionId) {
|
|
576
|
+
throw new DsmmProfileError("corrupt-selection", "The session choice identity, shape or version is invalid.");
|
|
577
|
+
}
|
|
578
|
+
validateProfileRevision(record.epoch, "admissionEpoch");
|
|
579
|
+
const selection = parseSelectionPointer(JSON.stringify({ version: record.version, id: record.id, revision: record.revision }));
|
|
580
|
+
return { ...selection, sessionId, epoch: record.epoch };
|
|
581
|
+
}
|
|
582
|
+
function conflict(message) {
|
|
583
|
+
throw new DsmmProfileError("conflict", message);
|
|
584
|
+
}
|
|
585
|
+
function safeInventoryId(id) {
|
|
586
|
+
return /^[a-zA-Z0-9_-]{1,64}$/u.test(id) ? id : "invalid-profile";
|
|
587
|
+
}
|
|
588
|
+
//# sourceMappingURL=profile-store.js.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** Wire-only profile data: safe to import from the native browser client. */
|
|
2
|
+
import type { DsmmRoleId } from "./roles.js";
|
|
3
|
+
import type { DsmmModelRoute, DsmmProfileScope } from "./settings.js";
|
|
4
|
+
import type { DsmmRateLimitPolicy, DsmmRoutingStrategy, DsmmRuntimePolicyConfig, DsmmRuntimePolicySettings } from "./routing-policy.js";
|
|
5
|
+
export type ProfileErrorCode = "validation" | "conflict" | "not-found" | "lock-timeout" | "unsafe-path" | "io" | "activation" | "corrupt-selection" | "limit" | "busy" | "maintenance" | "disposed" | "not-owned" | "unavailable" | "cancelled";
|
|
6
|
+
export interface ProfileErrorInfo {
|
|
7
|
+
code: ProfileErrorCode;
|
|
8
|
+
message: string;
|
|
9
|
+
field?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ProfileSummary {
|
|
12
|
+
id: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
revision: string | null;
|
|
15
|
+
error?: ProfileErrorInfo;
|
|
16
|
+
}
|
|
17
|
+
export interface ProfileSelectionState {
|
|
18
|
+
selectedId: string | null;
|
|
19
|
+
appliedRevision: string | null;
|
|
20
|
+
selectionRevision: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ProfileSnapshot extends ProfileSelectionState {
|
|
23
|
+
profiles: ProfileSummary[];
|
|
24
|
+
selectionError?: ProfileErrorInfo;
|
|
25
|
+
/** Native deployment role inventory; excludes provider accounts and auth data. */
|
|
26
|
+
roles?: ProfileRoleMetadata[];
|
|
27
|
+
editorDefaults?: DsmmRuntimePolicySettings;
|
|
28
|
+
}
|
|
29
|
+
export interface ProfileReadResult {
|
|
30
|
+
id: string;
|
|
31
|
+
label?: string;
|
|
32
|
+
revision: string;
|
|
33
|
+
content: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ProfileSaveRequest {
|
|
36
|
+
id: string;
|
|
37
|
+
content: string;
|
|
38
|
+
expectedRevision: string | null;
|
|
39
|
+
}
|
|
40
|
+
export interface ProfileSelectRequest {
|
|
41
|
+
id: string | null;
|
|
42
|
+
expectedRevision?: string;
|
|
43
|
+
expectedSelectionRevision: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ProfileRoleMetadata {
|
|
46
|
+
id: DsmmRoleId;
|
|
47
|
+
label: string;
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
/** Explicit deployment overrides inherited by a profile's omitted role fields. */
|
|
50
|
+
runtimePolicy?: DsmmRuntimePolicyConfig;
|
|
51
|
+
}
|
|
52
|
+
export interface DsmmRoleRuntimeState {
|
|
53
|
+
role?: DsmmRoleId;
|
|
54
|
+
strategy: DsmmRoutingStrategy;
|
|
55
|
+
rateLimit: DsmmRateLimitPolicy;
|
|
56
|
+
route?: DsmmModelRoute;
|
|
57
|
+
retries: number;
|
|
58
|
+
rateLimitFailures: number;
|
|
59
|
+
switches: number;
|
|
60
|
+
totalDelayMs: number;
|
|
61
|
+
}
|
|
62
|
+
export interface SessionProfileSnapshot {
|
|
63
|
+
sessionId: string;
|
|
64
|
+
globalDefault: ProfileSelectionState;
|
|
65
|
+
/** Current sidecar state: the authority for session-selection CAS. */
|
|
66
|
+
selection: ProfileSelectionState;
|
|
67
|
+
/** Exact live admission, for display only; may differ from the future global default. */
|
|
68
|
+
admittedSelection?: ProfileSelectionState;
|
|
69
|
+
scope: DsmmProfileScope;
|
|
70
|
+
admissionEpoch: string;
|
|
71
|
+
switchAllowed: boolean;
|
|
72
|
+
switchUnavailableReason?: "busy" | "maintenance" | "disposed" | "not-owned" | "unavailable";
|
|
73
|
+
rolePolicy?: DsmmRoleRuntimeState;
|
|
74
|
+
}
|
|
75
|
+
export interface SessionProfileSelectRequest extends ProfileSelectRequest {
|
|
76
|
+
sessionId: string;
|
|
77
|
+
expectedAdmissionEpoch: string;
|
|
78
|
+
}
|
|
79
|
+
export declare const ABSENT_PROFILE_SELECTION_REVISION = "absent";
|
|
80
|
+
//# sourceMappingURL=profile-types.d.ts.map
|