@dsmm/dsmm 0.1.5 → 0.1.7

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/lib/client.js CHANGED
@@ -204,21 +204,22 @@ function rolePolicy(value) {
204
204
  switches: integer(item.switches, "switches", 10),
205
205
  totalDelayMs: integer(item.totalDelayMs, "totalDelayMs", 12e4),
206
206
  ...optional(item, "role", role),
207
- ...optional(item, "route", (input) => {
208
- const route2 = object(input, ["provider", "model"], ["reasoningEffort"]);
209
- const provider = routeText(route2.provider, "provider", 128);
210
- const model = routeText(route2.model, "model", 512);
211
- if (!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$/u.test(provider) || model.includes("://")) fail("route");
212
- return { provider, model, ...optional(route2, "reasoningEffort", (value2) => routeText(value2, "reasoningEffort", 64)) };
213
- })
207
+ ...optional(item, "route", modelRoute)
214
208
  };
215
209
  }
210
+ function modelRoute(value) {
211
+ const route2 = object(value, ["provider", "model"], ["reasoningEffort"]);
212
+ const provider = routeText(route2.provider, "provider", 128);
213
+ const model = routeText(route2.model, "model", 512);
214
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$/u.test(provider) || model.includes("://")) fail("route");
215
+ return { provider, model, ...optional(route2, "reasoningEffort", (input) => routeText(input, "reasoningEffort", 64)) };
216
+ }
216
217
  function selectionState(value) {
217
218
  const item = object(value, ["selectedId", "appliedRevision", "selectionRevision"]);
218
219
  return { selectedId: item.selectedId === null ? null : id(item.selectedId), appliedRevision: item.appliedRevision === null ? null : revision(item.appliedRevision), selectionRevision: selectionRevision(item.selectionRevision) };
219
220
  }
220
221
  function sessionSnapshot(value) {
221
- const item = object(value, ["sessionId", "globalDefault", "selection", "scope", "admissionEpoch", "switchAllowed"], ["admittedSelection", "switchUnavailableReason", "rolePolicy"]);
222
+ const item = object(value, ["sessionId", "globalDefault", "selection", "scope", "admissionEpoch", "switchAllowed"], ["admittedSelection", "switchUnavailableReason", "rolePolicy", "profileModel"]);
222
223
  if (typeof item.scope !== "string" || !["global-default", "session-override", "deployment-baseline"].includes(item.scope)) fail("scope");
223
224
  return {
224
225
  sessionId: sessionId(item.sessionId),
@@ -232,7 +233,8 @@ function sessionSnapshot(value) {
232
233
  if (typeof input !== "string" || !["busy", "maintenance", "disposed", "not-owned", "unavailable"].includes(input)) fail("switchUnavailableReason");
233
234
  return input;
234
235
  }),
235
- ...optional(item, "rolePolicy", rolePolicy)
236
+ ...optional(item, "rolePolicy", rolePolicy),
237
+ ...optional(item, "profileModel", modelRoute)
236
238
  };
237
239
  }
238
240
  function saveRequest(value) {
@@ -1729,6 +1731,11 @@ function moveFallback(content2, role2, from, to) {
1729
1731
  }
1730
1732
 
1731
1733
  // src/client/controller.ts
1734
+ function modelSelectionWatermark(window) {
1735
+ let watermark = -1;
1736
+ for (const entry of window.entries) if (entry.type === "event" && entry.event.type === "model/selection") watermark = Math.max(watermark, Number(entry.event.seq));
1737
+ return watermark;
1738
+ }
1732
1739
  var NEW_EDITOR = "";
1733
1740
  var 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';
1734
1741
  function canReconcileSelection(snapshot2) {
@@ -1765,6 +1772,21 @@ var ProfilesController = class {
1765
1772
  sessionGeneration = 0;
1766
1773
  catalogGeneration = 0;
1767
1774
  catalogRemote = null;
1775
+ modelSelectorGeneration = 0;
1776
+ modelSelector = null;
1777
+ modelSelectionSource = null;
1778
+ modelSelectionSessionId = null;
1779
+ modelSelectionGeneration = 0;
1780
+ stopModelSelection = null;
1781
+ modelEvents = null;
1782
+ modelEventsSessionId = null;
1783
+ modelEventsGeneration = 0;
1784
+ modelEventsWatermark = -1;
1785
+ stopModelEvents = null;
1786
+ modelInteraction = null;
1787
+ modelInteractionSessionId = null;
1788
+ modelInteractionGeneration = 0;
1789
+ stopModelInteraction = null;
1768
1790
  store = {
1769
1791
  getSnapshot: () => this.current,
1770
1792
  subscribe: (listener) => {
@@ -1794,7 +1816,7 @@ var ProfilesController = class {
1794
1816
  chooseSessionProfile: (id2) => {
1795
1817
  if (!this.disposed && this.current.sessionBusy === null && this.current.busy === null && !this.current.dirty) this.publish({ sessionChoice: id2, sessionNotice: null });
1796
1818
  },
1797
- applySession: () => this.selectSession(false),
1819
+ applySession: (options) => this.selectSession(false, options),
1798
1820
  resetSession: () => this.selectSession(true),
1799
1821
  setFieldInvalid: (field, invalid) => {
1800
1822
  if (this.disposed) return;
@@ -1808,9 +1830,64 @@ var ProfilesController = class {
1808
1830
  this.generation += 1;
1809
1831
  this.sessionGeneration += 1;
1810
1832
  this.catalogGeneration += 1;
1833
+ this.modelSelectorGeneration += 1;
1834
+ this.modelSelectionGeneration += 1;
1835
+ this.stopModelSelection?.();
1836
+ this.stopModelEvents?.();
1837
+ this.stopModelInteraction?.();
1838
+ this.stopModelSelection = null;
1839
+ this.stopModelEvents = null;
1840
+ this.stopModelInteraction = null;
1841
+ this.modelSelectionSource = null;
1842
+ this.modelEvents = null;
1843
+ this.modelInteraction = null;
1811
1844
  this.catalogRemote = null;
1845
+ this.modelSelector = null;
1812
1846
  this.listeners.clear();
1813
1847
  }
1848
+ attachModelSelector(remote) {
1849
+ if (this.disposed) return;
1850
+ this.modelSelectorGeneration += 1;
1851
+ this.modelSelector = remote;
1852
+ }
1853
+ attachModelSelectionSource(sessionId2, source) {
1854
+ if (this.disposed || sessionId2 === this.modelSelectionSessionId && source === this.modelSelectionSource) return;
1855
+ this.modelSelectionGeneration += 1;
1856
+ this.stopModelSelection?.();
1857
+ this.modelSelectionSessionId = sessionId2;
1858
+ this.modelSelectionSource = source;
1859
+ this.stopModelSelection = source?.subscribe(() => {
1860
+ this.modelSelectionGeneration += 1;
1861
+ }) ?? null;
1862
+ }
1863
+ attachModelEventSource(sessionId2, source) {
1864
+ if (this.disposed || sessionId2 === this.modelEventsSessionId && source === this.modelEvents) return;
1865
+ this.modelEventsGeneration += 1;
1866
+ this.stopModelEvents?.();
1867
+ this.modelEventsSessionId = sessionId2;
1868
+ this.modelEvents = source;
1869
+ this.modelEventsWatermark = source === null ? -1 : modelSelectionWatermark(source.getSnapshot());
1870
+ this.stopModelEvents = source?.subscribe(() => {
1871
+ const window = source.getSnapshot(), change = window.change;
1872
+ if (change.kind === "settle-assistant") return;
1873
+ let watermark = change.kind === "replace" ? -1 : this.modelEventsWatermark;
1874
+ for (const entry of change.entries) if (entry.type === "event" && entry.event.type === "model/selection") watermark = Math.max(watermark, Number(entry.event.seq));
1875
+ if (watermark !== this.modelEventsWatermark) {
1876
+ this.modelEventsWatermark = watermark;
1877
+ this.modelEventsGeneration += 1;
1878
+ }
1879
+ }) ?? null;
1880
+ }
1881
+ attachModelInteractionSource(sessionId2, source) {
1882
+ if (this.disposed || sessionId2 === this.modelInteractionSessionId && source === this.modelInteraction) return;
1883
+ this.modelInteractionGeneration += 1;
1884
+ this.stopModelInteraction?.();
1885
+ this.modelInteractionSessionId = sessionId2;
1886
+ this.modelInteraction = source;
1887
+ this.stopModelInteraction = source?.subscribe(() => {
1888
+ if (source.getSnapshot().status === "selecting") this.modelInteractionGeneration += 1;
1889
+ }) ?? null;
1890
+ }
1814
1891
  attachCatalog(remote) {
1815
1892
  if (this.disposed) return;
1816
1893
  this.catalogGeneration += 1;
@@ -1821,6 +1898,9 @@ var ProfilesController = class {
1821
1898
  setSession(id2) {
1822
1899
  if (this.disposed || id2 === this.current.currentSessionId) return;
1823
1900
  this.sessionGeneration += 1;
1901
+ if (id2 !== this.modelSelectionSessionId) this.attachModelSelectionSource(null, null);
1902
+ if (id2 !== this.modelEventsSessionId) this.attachModelEventSource(null, null);
1903
+ if (id2 !== this.modelInteractionSessionId) this.attachModelInteractionSource(null, null);
1824
1904
  this.publish({ currentSessionId: id2, session: null, sessionChoice: null, sessionBusy: null, sessionIssue: null, sessionNotice: null });
1825
1905
  if (id2 !== null) void this.refreshSession();
1826
1906
  }
@@ -1853,14 +1933,23 @@ var ProfilesController = class {
1853
1933
  if (live()) this.publish({ sessionBusy: null });
1854
1934
  }
1855
1935
  }
1856
- async selectSession(reset) {
1936
+ async selectSession(reset, options) {
1857
1937
  const { currentSessionId: id2, session, sessionChoice, snapshot: snapshot2 } = this.current;
1858
1938
  if (this.disposed || id2 === null || session === null || !session.switchAllowed || this.current.sessionBusy !== null || this.current.busy !== null || this.current.dirty || this.current.pendingEditor !== null) return;
1859
1939
  const selectedId = reset ? null : sessionChoice;
1860
1940
  const revision2 = snapshot2?.profiles.find((profile) => profile.id === selectedId)?.revision;
1861
1941
  if (selectedId !== null && revision2 == null) return;
1862
1942
  const generation = ++this.sessionGeneration;
1943
+ const useProfileModel = !reset && options?.useProfileModel === true;
1944
+ const selector = this.modelSelector, selectorGeneration = this.modelSelectorGeneration;
1945
+ const modelSource = this.modelSelectionSource, modelGeneration = this.modelSelectionGeneration;
1946
+ const modelSnapshot = modelSource?.getSnapshot();
1947
+ const eventSource = this.modelEvents, eventGeneration = this.modelEventsGeneration;
1948
+ const eventWatermark = eventSource === null ? -1 : modelSelectionWatermark(eventSource.getSnapshot());
1949
+ const interaction = this.modelInteraction, interactionGeneration = this.modelInteractionGeneration;
1950
+ const pendingNativeChoice = interaction?.getSnapshot().status === "selecting";
1863
1951
  const live = () => !this.disposed && generation === this.sessionGeneration && id2 === this.current.currentSessionId;
1952
+ const selectorLive = () => live() && selector !== null && selector === this.modelSelector && selectorGeneration === this.modelSelectorGeneration;
1864
1953
  this.publish({ sessionBusy: reset ? "reset" : "apply", sessionIssue: null, sessionNotice: null });
1865
1954
  try {
1866
1955
  const accepted = await this.unwrap(this.remote.selectSession(id2, {
@@ -1871,7 +1960,39 @@ var ProfilesController = class {
1871
1960
  expectedAdmissionEpoch: session.admissionEpoch
1872
1961
  }));
1873
1962
  if (accepted.sessionId !== id2) throw { kind: "assembly", code: "unavailable" };
1874
- if (live()) this.publish({ session: accepted, sessionChoice: accepted.selection.selectedId, sessionNotice: reset ? "reset" : "applied" });
1963
+ if (!live()) return;
1964
+ this.publish({ session: accepted, sessionChoice: accepted.selection.selectedId, sessionNotice: useProfileModel ? null : reset ? "reset" : "applied" });
1965
+ if (!useProfileModel || !live()) return;
1966
+ if (accepted.profileModel === void 0) {
1967
+ this.publish({ sessionIssue: { kind: "assembly", code: "model-unconfigured", source: "profile-model" } });
1968
+ return;
1969
+ }
1970
+ if (!selectorLive()) {
1971
+ this.publish({ sessionIssue: { kind: "assembly", code: "model-service-unavailable", source: "profile-model" } });
1972
+ return;
1973
+ }
1974
+ if (modelSource === null || modelSnapshot === void 0 || this.modelSelectionSessionId !== id2 || modelSource !== this.modelSelectionSource || modelSource.getSnapshot() === void 0) {
1975
+ this.publish({ sessionIssue: { kind: "assembly", code: "model-observation-unavailable", source: "profile-model" } });
1976
+ return;
1977
+ }
1978
+ if (modelGeneration !== this.modelSelectionGeneration || !Object.is(modelSnapshot, modelSource.getSnapshot())) {
1979
+ this.publish({ sessionIssue: { kind: "assembly", code: "model-choice-changed", source: "profile-model" } });
1980
+ return;
1981
+ }
1982
+ if (eventSource === null || eventSource !== this.modelEvents || this.modelEventsSessionId !== id2 || interaction === null || interaction !== this.modelInteraction || this.modelInteractionSessionId !== id2) {
1983
+ this.publish({ sessionIssue: { kind: "assembly", code: "model-observation-unavailable", source: "profile-model" } });
1984
+ return;
1985
+ }
1986
+ if (eventGeneration !== this.modelEventsGeneration || eventWatermark !== modelSelectionWatermark(eventSource.getSnapshot()) || interactionGeneration !== this.modelInteractionGeneration || pendingNativeChoice || interaction.getSnapshot().status === "selecting") {
1987
+ this.publish({ sessionIssue: { kind: "assembly", code: "model-choice-changed", source: "profile-model" } });
1988
+ return;
1989
+ }
1990
+ try {
1991
+ await this.unwrap(selector.selectModel({ sessionId: id2, ...accepted.profileModel }));
1992
+ if (live()) this.publish(selectorLive() && modelSource === this.modelSelectionSource && this.modelSelectionSessionId === id2 ? { sessionNotice: "applied-with-model" } : { sessionIssue: { kind: "assembly", code: "model-service-unavailable", source: "profile-model" } });
1993
+ } catch {
1994
+ if (live()) this.publish({ sessionIssue: { kind: "assembly", code: selectorLive() ? "model-selection-failed" : "model-service-unavailable", source: "profile-model" } });
1995
+ }
1875
1996
  } catch (error) {
1876
1997
  if (live()) this.publish({ sessionIssue: this.issue(error) });
1877
1998
  } finally {
@@ -2101,6 +2222,38 @@ var en = {
2101
2222
  sessionScope: "Current native session",
2102
2223
  sessionSelect: "Current-session profile",
2103
2224
  globalActionHint: "Apply saved profile below changes the global default for future unscoped sessions only. It does not apply to the current session.",
2225
+ headerProfile: "Profile",
2226
+ headerProfileLabel: "Current-session profile (header)",
2227
+ headerCaptured: "captured global default",
2228
+ headerSavedUnavailable: "saved profile unavailable",
2229
+ headerCurrentProfile: "Current profile: {profile}",
2230
+ headerRefresh: "Refresh profiles and current-session state",
2231
+ headerUseModelAction: "Use profile model: {profile}",
2232
+ headerLoading: "Loading profile…",
2233
+ headerApplying: "Applying profile…",
2234
+ headerApplied: "Profile applied.",
2235
+ headerBusy: "Session is busy.",
2236
+ headerUnavailable: "Profile unavailable.",
2237
+ headerDraft: "Save or discard the draft in Settings.",
2238
+ headerConflict: "The session profile or admission changed elsewhere. Refresh current-session state before retrying.",
2239
+ headerRefused: "Profile change unconfirmed. Check Settings.",
2240
+ headerKeepModelGroup: "Switch profile — keep current model",
2241
+ headerUseModelGroup: "Switch and use profile model",
2242
+ headerModelDefaultHint: "Normal switching preserves the current model. Explicit switch-and-use-model also saves the native model default, like the Models tab.",
2243
+ headerNoProfileModel: "Profile applied; no main model configured. Current model kept.",
2244
+ headerModelUnconfirmed: "Profile applied; model change unconfirmed. Check Models/Settings.",
2245
+ headerAppliedWithModel: "Profile and native model applied.",
2246
+ headerModelChoiceChanged: "Profile applied; newer native model choice kept.",
2247
+ headerActivationRefused: "Profile activation was refused. Check its configuration and native model catalog.",
2248
+ headerSelectionRefused: "The profile change could not be confirmed.",
2249
+ headerIssueCode: "Reason: {code}.",
2250
+ headerIssueField: "Configuration field: {field}.",
2251
+ headerRetryHint: "Refresh profiles and current-session state, resolve the indicated issue in Settings or native Models, then retry when the session is idle.",
2252
+ headerMaintenanceRefused: "Native maintenance owns this session. The previous profile is kept.",
2253
+ headerBusyRefused: "The session is busy. The previous profile is kept.",
2254
+ headerCancelledRefused: "The profile request was cancelled. Refresh current-session state before retrying; do not assume a change completed.",
2255
+ headerUnavailableRefused: "The native session or profile service is unavailable. Reconnect and refresh before retrying.",
2256
+ headerWaitRetryHint: "Wait for the native work or maintenance to finish, then Refresh and retry. No profile change is queued automatically.",
2104
2257
  noSession: "No native session is selected. Session Apply is disabled; global defaults and drafts remain editable.",
2105
2258
  sessionUnavailable: "The current session could not be confirmed. Refresh its state before retrying; the prior policy is kept.",
2106
2259
  sessionBusy: "Switching is unavailable: {reason}. The Host must reserve a truly idle ordinary session before applying.",
@@ -2117,6 +2270,7 @@ var en = {
2117
2270
  sessionRefresh: "Refresh current-session state",
2118
2271
  sessionApplied: "Applied the saved revision to this session only. Global default and existing children were not changed.",
2119
2272
  sessionResetDone: "Pinned the deployment baseline for this session only. Global default was not changed.",
2273
+ sessionAppliedWithModel: "Applied this session profile and explicitly selected its native main model. Native model-default persistence follows the Models tab; the global profile default was not changed.",
2120
2274
  sessionDirty: "Save or explicitly discard the editor draft before applying a current-session choice.",
2121
2275
  roleState: "Admitted route {route}; strategy {strategy}; retries {retries}; rate-limit failures {failures}; switches {switches}; total delay {delay} ms.",
2122
2276
  catalogTitle: "Native model catalog",
@@ -2229,6 +2383,38 @@ var zh = {
2229
2383
  sessionScope: "当前原生会话",
2230
2384
  sessionSelect: "当前会话配置档",
2231
2385
  globalActionHint: "下方应用已保存配置档仅改变未来没有独立选择的会话的全局默认值,不会应用到当前会话。",
2386
+ headerProfile: "配置档",
2387
+ headerProfileLabel: "当前会话配置档(会话栏)",
2388
+ headerCaptured: "已捕获的全局默认值",
2389
+ headerSavedUnavailable: "保存的配置档不可用",
2390
+ headerCurrentProfile: "当前配置档:{profile}",
2391
+ headerRefresh: "刷新配置档和当前会话状态",
2392
+ headerUseModelAction: "使用配置档模型:{profile}",
2393
+ headerLoading: "加载配置档…",
2394
+ headerApplying: "应用配置档…",
2395
+ headerApplied: "配置档已应用。",
2396
+ headerBusy: "会话忙碌。",
2397
+ headerUnavailable: "配置档不可用。",
2398
+ headerDraft: "请在设置中保存或丢弃草稿。",
2399
+ headerConflict: "会话配置档或准入代次已在其他位置改变,请刷新当前会话状态后重试。",
2400
+ headerRefused: "未确认配置档更改,请检查设置。",
2401
+ headerKeepModelGroup: "切换配置档 — 保留当前模型",
2402
+ headerUseModelGroup: "切换并使用配置档模型",
2403
+ headerModelDefaultHint: "普通切换保留当前模型。明确切换并使用模型还会像模型页一样保存原生模型默认值。",
2404
+ headerNoProfileModel: "配置档已应用,未配置主模型。当前模型已保留。",
2405
+ headerModelUnconfirmed: "配置档已应用,模型更改未确认。请检查模型或设置页。",
2406
+ headerAppliedWithModel: "配置档和原生模型已应用。",
2407
+ headerModelChoiceChanged: "配置档已应用,已保留更新的原生模型选择。",
2408
+ headerActivationRefused: "配置档启用被拒绝,请检查其配置和原生模型目录。",
2409
+ headerSelectionRefused: "无法确认配置档更改。",
2410
+ headerIssueCode: "原因:{code}。",
2411
+ headerIssueField: "配置字段:{field}。",
2412
+ headerRetryHint: "请刷新配置档和当前会话状态,在设置或原生模型页解决所示问题,然后在会话空闲时重试。",
2413
+ headerMaintenanceRefused: "原生维护正在占用此会话,原配置档已保留。",
2414
+ headerBusyRefused: "会话正在运行,原配置档已保留。",
2415
+ headerCancelledRefused: "配置档请求已取消,请刷新当前会话状态后重试,不要假定更改已完成。",
2416
+ headerUnavailableRefused: "原生会话或配置档服务不可用,请重新连接并刷新后重试。",
2417
+ headerWaitRetryHint: "请等待原生运行或维护结束,然后刷新并重试。不会自动排队应用配置档。",
2232
2418
  noSession: "未选择原生会话。会话应用已禁用;仍可编辑全局默认值和草稿。",
2233
2419
  sessionUnavailable: "无法确认当前会话。重试前请刷新状态;原策略已保留。",
2234
2420
  sessionBusy: "暂不可切换:{reason}。Host 必须先保留真正空闲的普通会话。",
@@ -2246,6 +2432,7 @@ var zh = {
2246
2432
  sessionApplied: "已仅对此会话应用保存的修订。全局默认值和已有子会话未改变。",
2247
2433
  sessionResetDone: "已仅对此会话固定部署基线。全局默认值未改变。",
2248
2434
  sessionDirty: "应用当前会话选择之前,请保存或明确丢弃编辑器草稿。",
2435
+ sessionAppliedWithModel: "已应用此会话配置档,并明确选择其原生主模型。模型默认值像模型页一样保存;全局配置档默认值未改变。",
2249
2436
  roleState: "准入路由 {route};策略 {strategy};重试 {retries};限流失败 {failures};切换 {switches};累计延迟 {delay} 毫秒。",
2250
2437
  catalogTitle: "原生模型目录",
2251
2438
  catalogHint: "目录仅供参考,不是网络或账户健康检查。未列出或手动路由仍可编辑;刷新不会改变草稿或原生模型默认值。",
@@ -2543,6 +2730,14 @@ function sessionProfileLabels(session, t) {
2543
2730
 
2544
2731
  // src/client/SessionProfiles.tsx
2545
2732
  var import_jsx_runtime2 = require("react/jsx-runtime");
2733
+ var MENU_ISSUE_CODES = /* @__PURE__ */ new Set(["validation", "conflict", "not-found", "lock-timeout", "unsafe-path", "io", "activation", "corrupt-selection", "limit", "busy", "maintenance", "disposed", "not-owned", "unavailable", "cancelled", "model-unconfigured", "model-choice-changed", "model-service-unavailable", "model-observation-unavailable", "model-selection-failed"]);
2734
+ var MENU_ROLE_FIELD = /^(?:settings\.roleRouting\.)?dsmm-(?:orchestrator|planner|plan-critic|builder|reviewer|oracle|oracle-2nd|creative|code-search|doc-search|clarifier|media-reader)(?:\.(?:primary|fallbackRoutes)(?:\[[0-7]\])?(?:\.(?:provider|model|reasoningEffort))?|\.strategy|\.rateLimit(?:\.(?:maxRetries|initialDelayMs|maxDelayMs|maxTotalDelayMs|switchAfterRateLimits|maxSwitches))?)?$/u;
2735
+ var MENU_COMMON_FIELD = /^(?:version|id|label|content|sessionId|expectedRevision|expectedSelectionRevision|expectedAdmissionEpoch|settings(?:\.(?:defaultActive|roleRouting|workflow|guards|runtimeRecovery|runtimePolicy))?)$/u;
2736
+ function menuIssue(issue) {
2737
+ const code = MENU_ISSUE_CODES.has(issue.code) ? issue.code : issue.kind === "transport" ? "transport" : "unavailable";
2738
+ const field = issue.field;
2739
+ return { code, ...typeof field === "string" && field.length <= 128 && (MENU_ROLE_FIELD.test(field) || MENU_COMMON_FIELD.test(field)) ? { field } : {} };
2740
+ }
2546
2741
  function SessionScope({ state, actions, t, compact = false }) {
2547
2742
  const prefix = (0, import_react2.useId)();
2548
2743
  const session = state.session;
@@ -2550,7 +2745,7 @@ function SessionScope({ state, actions, t, compact = false }) {
2550
2745
  const selected = state.snapshot?.profiles.find((profile) => profile.id === state.sessionChoice);
2551
2746
  const disabled = state.busy !== null || state.pendingEditor !== null || state.sessionBusy !== null || state.dirty;
2552
2747
  const allowed = session !== null && session.switchAllowed && /^[a-f0-9]{64}$|^absent$/u.test(session.selection.selectionRevision);
2553
- const status = state.sessionNotice === null ? "" : t(state.sessionNotice === "applied" ? "sessionApplied" : "sessionResetDone");
2748
+ const status = state.sessionNotice === null ? "" : t(state.sessionNotice === "applied-with-model" ? "sessionAppliedWithModel" : state.sessionNotice === "applied" ? "sessionApplied" : "sessionResetDone");
2554
2749
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsmm-session-scope", "aria-busy": state.sessionBusy !== null, "data-dsmm-session-scope": true, children: [
2555
2750
  !compact && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: t("sessionScope") }),
2556
2751
  state.currentSessionId === null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dsmm-hint", children: t("noSession") }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
@@ -2579,17 +2774,92 @@ function SessionScope({ state, actions, t, compact = false }) {
2579
2774
  ] }),
2580
2775
  !compact && session?.rolePolicy !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { "data-dsmm-session-policy": true, children: t("roleState", { route: session.rolePolicy.route === void 0 ? t("inheritRoute") : `${session.rolePolicy.route.provider}/${session.rolePolicy.route.model}${session.rolePolicy.route.reasoningEffort === void 0 ? "" : ` (${session.rolePolicy.route.reasoningEffort})`}`, strategy: session.rolePolicy.strategy, retries: session.rolePolicy.retries, failures: session.rolePolicy.rateLimitFailures, switches: session.rolePolicy.switches, delay: session.rolePolicy.totalDelayMs }) })
2581
2776
  ] }),
2582
- state.sessionIssue !== null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { role: "alert", children: state.sessionIssue.code === "conflict" ? t("sessionConflict") : ["busy", "maintenance", "disposed", "not-owned"].includes(state.sessionIssue.code) ? t("sessionBusy", { reason: state.sessionIssue.code }) : t(state.sessionIssue.code === "validation" ? "validation" : "sessionUnavailable") }),
2777
+ state.sessionIssue !== null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { role: "alert", children: state.sessionIssue.source === "profile-model" ? t(state.sessionIssue.code === "model-unconfigured" ? "headerNoProfileModel" : state.sessionIssue.code === "model-choice-changed" ? "headerModelChoiceChanged" : "headerModelUnconfirmed") : state.sessionIssue.code === "conflict" ? t("sessionConflict") : ["busy", "maintenance", "disposed", "not-owned"].includes(state.sessionIssue.code) ? t("sessionBusy", { reason: state.sessionIssue.code }) : t(state.sessionIssue.code === "validation" ? "validation" : "sessionUnavailable") }),
2583
2778
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.sessionBusy === "read" ? t("reading") : status })
2584
2779
  ] });
2585
2780
  }
2586
2781
  function SessionProfiles(props) {
2782
+ const prefix = (0, import_react2.useId)();
2587
2783
  const state = props.useProfiles((snapshot2) => snapshot2);
2588
- if (props.sessionId !== state.currentSessionId) return null;
2589
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsmm-profiles dsmm-header-profiles", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { children: [
2590
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: props.t("title") }),
2591
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SessionScope, { state, actions: props, t: props.t, compact: true })
2592
- ] }) });
2784
+ const id2 = state.currentSessionId;
2785
+ const [openFor, setOpenFor] = (0, import_react2.useState)(void 0);
2786
+ (0, import_react2.useEffect)(() => {
2787
+ setOpenFor(void 0);
2788
+ }, [id2]);
2789
+ if (props.sessionId !== void 0 && props.sessionId !== id2) return null;
2790
+ const { t } = props;
2791
+ const session = state.session;
2792
+ const admission = session?.admittedSelection ?? (session?.scope === "global-default" ? void 0 : session?.selection);
2793
+ const unknownCaptured = session !== null && admission === void 0;
2794
+ const current = session === null ? "__dsmm_session_unavailable__" : unknownCaptured ? "__dsmm_captured_default__" : admission?.selectedId ?? "";
2795
+ const profiles = state.snapshot?.profiles ?? [];
2796
+ const currentSaved = profiles.find((profile) => profile.id === current);
2797
+ const committing = state.sessionBusy !== null;
2798
+ const disabled = id2 === null || committing || state.busy !== null || state.pendingEditor !== null || state.dirty || state.invalidFields.length > 0 || session === null || !session.switchAllowed || state.snapshot === null;
2799
+ let feedback = "";
2800
+ if (state.sessionIssue !== null) feedback = t(state.sessionIssue.source === "profile-model" ? state.sessionIssue.code === "model-unconfigured" ? "headerNoProfileModel" : state.sessionIssue.code === "model-choice-changed" ? "headerModelChoiceChanged" : "headerModelUnconfirmed" : state.sessionIssue.code === "conflict" ? "headerConflict" : state.sessionIssue.code === "activation" ? "headerActivationRefused" : state.sessionIssue.code === "maintenance" ? "headerMaintenanceRefused" : state.sessionIssue.code === "busy" ? "headerBusyRefused" : state.sessionIssue.code === "cancelled" ? "headerCancelledRefused" : state.sessionIssue.code === "unavailable" || state.sessionIssue.kind === "assembly" ? "headerUnavailableRefused" : "headerSelectionRefused");
2801
+ else if (committing || state.busy !== null) feedback = t(state.sessionBusy === "apply" || state.sessionBusy === "reset" ? "headerApplying" : "headerLoading");
2802
+ else if (state.dirty || state.invalidFields.length > 0 || state.pendingEditor !== null) feedback = t("headerDraft");
2803
+ else if (id2 === null) feedback = t("noSession");
2804
+ else if (session === null || state.snapshot === null) feedback = t("headerUnavailable");
2805
+ else if (!session.switchAllowed) feedback = t("headerBusy");
2806
+ else if (state.sessionNotice !== null) feedback = t(state.sessionNotice === "applied-with-model" ? "headerAppliedWithModel" : "headerApplied");
2807
+ const capturedSuffix = session?.scope === "global-default" && !unknownCaptured ? ` — ${t("headerCaptured")}` : "";
2808
+ const profileName = unknownCaptured ? t("headerCaptured") : currentSaved?.label === void 0 ? admission?.selectedId ?? t("sessionBaseline") : `${currentSaved.label} (${currentSaved.id})`;
2809
+ const currentLabel = t("headerCurrentProfile", { profile: session === null ? t("headerUnavailable") : profileName + capturedSuffix });
2810
+ const entries = [{ type: "label", id: "@current", text: currentLabel }];
2811
+ if (id2 === null && state.snapshot !== null) entries.push({ type: "label", id: "@future", text: t("sessionFutureDefault", { profile: state.snapshot.profiles.find((profile) => profile.id === state.snapshot.selectedId)?.label ?? state.snapshot.selectedId ?? t("sessionBaseline") }) });
2812
+ if (feedback !== "") entries.push({ type: "label", id: "@status", text: feedback });
2813
+ const diagnostic = state.sessionIssue === null ? null : menuIssue(state.sessionIssue);
2814
+ const diagnosticText = diagnostic === null ? "" : t("headerIssueCode", { code: diagnostic.code }) + (diagnostic.field === void 0 ? "" : ` ${t("headerIssueField", { field: diagnostic.field })}`);
2815
+ const retryHint = t(diagnostic?.code === "maintenance" || diagnostic?.code === "busy" ? "headerWaitRetryHint" : "headerRetryHint");
2816
+ if (diagnostic !== null) entries.push({ type: "label", id: "@diagnostic", text: diagnosticText }, { type: "label", id: "@retry", text: retryHint });
2817
+ if (admission?.selectedId != null && currentSaved === void 0) entries.push({ id: admission.selectedId, label: `${admission.selectedId} — ${t("headerSavedUnavailable")}${capturedSuffix}`, disabled: true });
2818
+ if (unknownCaptured) entries.push({ id: "__dsmm_captured_default__", label: t("headerCaptured"), disabled: true });
2819
+ entries.push({ type: "separator", id: "@keep-separator" }, { type: "label", id: "@keep-heading", text: t("headerKeepModelGroup") }, { id: "", label: t("sessionBaseline") + (current === "" ? capturedSuffix : ""), disabled });
2820
+ for (const profile of profiles) entries.push({ id: profile.id, label: (profile.label ?? profile.id) + (profile.id === current ? capturedSuffix : "") + (profile.error === void 0 && profile.revision !== null ? "" : ` — ${t("headerSavedUnavailable")}`), disabled: disabled || profile.revision === null || profile.error !== void 0 });
2821
+ entries.push({ type: "separator", id: "@model-separator" }, { type: "label", id: "@model-heading", text: t("headerUseModelGroup") }, { type: "label", id: "@model-hint", text: t("headerModelDefaultHint") }, { id: "@model:", label: t("sessionBaseline"), disabled });
2822
+ for (const profile of profiles) entries.push({ id: `@model:${profile.id}`, label: t("headerUseModelAction", { profile: profile.label ?? profile.id }) + (profile.error === void 0 && profile.revision !== null ? "" : ` — ${t("headerSavedUnavailable")}`), disabled: disabled || profile.revision === null || profile.error !== void 0 });
2823
+ const open = openFor === id2;
2824
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsmm-header-profiles", "data-dsmm-header-profile": true, "aria-busy": committing, children: [
2825
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2826
+ import_dsh_client_ui_primitives2.Menu,
2827
+ {
2828
+ open,
2829
+ autoFocus: true,
2830
+ portal: true,
2831
+ align: "start",
2832
+ className: "dsmm-profile-anchor",
2833
+ listClassName: "dsmm-profile-menu",
2834
+ items: entries,
2835
+ selectedId: current,
2836
+ footer: [{ id: "@refresh", label: t("headerRefresh"), disabled: committing || state.busy !== null }],
2837
+ anchor: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Button, { type: "button", size: "sm", variant: "toolbar", className: "dsmm-profile-trigger", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.IconBranchOutlineRegular, {}), "aria-label": t("headerProfileLabel"), "aria-haspopup": "menu", "aria-expanded": open, "aria-describedby": `${prefix}-feedback`, onClick: () => setOpenFor(open ? void 0 : id2) }),
2838
+ onClose: () => setOpenFor(void 0),
2839
+ onSelect: (value) => {
2840
+ if (props.readProfileView().currentSessionId !== id2) return;
2841
+ if (value === "@refresh") {
2842
+ if (committing || state.busy !== null) return;
2843
+ void (async () => {
2844
+ await props.refresh();
2845
+ if (id2 !== null && props.readProfileView().currentSessionId === id2) await props.refreshSession();
2846
+ })();
2847
+ } else {
2848
+ const row = entries.find((entry) => entry.id === value && !("type" in entry));
2849
+ if (row === void 0 || !("disabled" in row) || row.disabled) return;
2850
+ const useProfileModel = value.startsWith("@model:");
2851
+ props.chooseSessionProfile((useProfileModel ? value.slice("@model:".length) : value) || null);
2852
+ void props.applySession(useProfileModel ? { useProfileModel: true } : void 0);
2853
+ }
2854
+ setOpenFor(void 0);
2855
+ }
2856
+ }
2857
+ ),
2858
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "dsmm-profile-announcement", id: `${prefix}-feedback`, role: state.sessionIssue === null ? "status" : "alert", "aria-live": "polite", "aria-atomic": "true", children: [
2859
+ feedback || currentLabel,
2860
+ diagnostic === null ? "" : ` ${diagnosticText} ${retryHint}`
2861
+ ] })
2862
+ ] });
2593
2863
  }
2594
2864
 
2595
2865
  // src/client/ProfilesSection.tsx
@@ -2755,7 +3025,14 @@ var PROFILE_STYLES = `
2755
3025
  .dsmm-profiles summary{cursor:pointer;color:var(--dsw-alias-label-primary);min-height:32px;line-height:32px}
2756
3026
  .dsmm-profiles summary:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
2757
3027
  .dsmm-profiles .dsmm-advanced[open]>div{margin-top:8px}
2758
- .dsmm-header-profiles{width:auto;max-width:760px}
3028
+ .dsmm-header-profiles{display:inline-flex;align-items:center;min-width:0;font-family:var(--dsw-font-family);color:var(--dsw-alias-label-primary)}
3029
+ .dsmm-header-profiles .dsmm-profile-trigger{width:28px;height:28px;min-height:28px;padding:6px;justify-content:center}
3030
+ .dsmm-profile-trigger:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
3031
+ .dsmm-profile-menu{font-family:var(--dsw-font-family);font-size:14px;line-height:22px;max-width:calc(100vw - 24px);color:var(--dsw-alias-label-primary)}
3032
+ .dsmm-profile-menu [role=presentation]{font:inherit;white-space:normal;overflow-wrap:anywhere;color:var(--dsw-alias-label-secondary)}
3033
+ .dsmm-profile-menu [role=menuitem]{font:inherit}
3034
+ .dsmm-profile-menu [role=menuitem]>span{white-space:normal;overflow-wrap:anywhere}
3035
+ .dsmm-profile-announcement{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
2759
3036
  .dsmm-profiles p{margin:0;overflow-wrap:anywhere}
2760
3037
  .dsmm-profiles .dsmm-hint{color:var(--dsw-alias-label-secondary)}
2761
3038
  .dsmm-profiles .dsmm-field{min-width:0;display:flex;flex-direction:column;gap:6px}
@@ -2801,23 +3078,54 @@ async function apply(ctx) {
2801
3078
  locale: NS,
2802
3079
  inject: () => ({ hooks: { profiles: controller.store }, ...controller.actions })
2803
3080
  }, ProfilesSection));
3081
+ profileCtx.slots.inject("conversation.header.leading", () => profileCtx.slots.register({
3082
+ name: "conversation.header.leading",
3083
+ priority: Number.MAX_SAFE_INTEGER,
3084
+ locale: NS,
3085
+ inject: () => ({ hooks: { profiles: controller.store }, readProfileView: controller.store.getSnapshot, ...controller.actions })
3086
+ }, SessionProfiles));
2804
3087
  void profileCtx.inject(["remote.session"], (catalogCtx) => {
2805
3088
  controller.attachCatalog(catalogCtx.remote.session);
2806
- catalogCtx.effect(() => () => controller.attachCatalog(null), "dsmm: native catalog lifetime");
3089
+ controller.attachModelSelector(catalogCtx.remote.session);
3090
+ catalogCtx.effect(() => () => {
3091
+ controller.attachModelSelector(null);
3092
+ controller.attachCatalog(null);
3093
+ }, "dsmm: native catalog/selector lifetime");
2807
3094
  });
2808
- void profileCtx.inject(["uiSession"], (sessionCtx) => {
3095
+ void profileCtx.inject(["uiSession", "sessions"], (sessionCtx) => {
2809
3096
  const source = sessionCtx.uiSession.adapter.current;
2810
- const update = () => controller.setSession(source.getSnapshot().key ?? null);
3097
+ const nativeSessions = sessionCtx.sessions;
3098
+ const update = () => {
3099
+ const binding = source.getSnapshot();
3100
+ controller.setSession(binding.key ?? null);
3101
+ controller.attachModelSelectionSource(binding.key ?? null, binding.key === void 0 ? null : binding.keyedHooks.projection?.("modelSelection") ?? null);
3102
+ controller.attachModelEventSource(binding.key ?? null, binding.key === void 0 ? null : nativeSessions.binding(binding.key)?.eventSource ?? null);
3103
+ };
2811
3104
  update();
2812
3105
  sessionCtx.effect(() => source.subscribe(update), "dsmm: current native session");
2813
- sessionCtx.effect(() => () => controller.setSession(null), "dsmm: native session withdrawal");
2814
- sessionCtx.slots.inject("conversation.session.header.utilities", () => sessionCtx.slots.register({
2815
- name: "conversation.session.header.utilities",
2816
- id: "dsmm-session-profiles",
2817
- order: 30,
2818
- locale: NS,
2819
- inject: () => ({ hooks: { profiles: controller.store }, ...controller.actions })
2820
- }, SessionProfiles));
3106
+ sessionCtx.effect(() => () => {
3107
+ controller.attachModelSelectionSource(null, null);
3108
+ controller.attachModelEventSource(null, null);
3109
+ controller.attachModelInteractionSource(null, null);
3110
+ controller.setSession(null);
3111
+ }, "dsmm: native session withdrawal");
3112
+ void sessionCtx.inject(["modelDirectories", "remote.session"], (modelCtx) => {
3113
+ const updateInteraction = () => {
3114
+ const id2 = source.getSnapshot().key;
3115
+ if (id2 === void 0 || nativeSessions.binding(id2) === void 0) {
3116
+ controller.attachModelInteractionSource(null, null);
3117
+ return;
3118
+ }
3119
+ try {
3120
+ controller.attachModelInteractionSource(id2, modelCtx.modelDirectories.directoryFor(id2).store);
3121
+ } catch {
3122
+ controller.attachModelInteractionSource(null, null);
3123
+ }
3124
+ };
3125
+ updateInteraction();
3126
+ modelCtx.effect(() => source.subscribe(updateInteraction), "dsmm: native model interaction binding");
3127
+ modelCtx.effect(() => () => controller.attachModelInteractionSource(null, null), "dsmm: native model interaction withdrawal");
3128
+ });
2821
3129
  });
2822
3130
  void controller.refresh();
2823
3131
  });
@@ -58,6 +58,7 @@ export function registerModelRouting(ctx, controller, getSettings) {
58
58
  if (frame.signal.aborted)
59
59
  return downstream;
60
60
  const settings = getSettings(frame.agent);
61
+ const ordinaryRoot = frame.agent.session.header?.origin !== "subagent";
61
62
  const admitted = takeAdmittedRecoveryRoute(frame);
62
63
  const active = controller.active(frame.agent, settings.defaultActive);
63
64
  const role = resolveEffectiveDsmmRole(frame.agent, settings, active);
@@ -75,6 +76,18 @@ export function registerModelRouting(ctx, controller, getSettings) {
75
76
  const exactPolicy = primary !== undefined || policy?.fallbackRoutes !== undefined || fallbacks.length > 0;
76
77
  const captured = assembledSelections.get(frame.agent);
77
78
  const manual = captured?.signal === frame.signal ? captured.intent : undefined;
79
+ if (ordinaryRoot) {
80
+ const selected = { provider: downstream.provider, model: downstream.model,
81
+ ...(downstream.reasoningEffort === undefined ? {} : { reasoningEffort: downstream.reasoningEffort }) };
82
+ if (lock === undefined || !sameExactModelRoute(lock.route, selected) || lock.manualSelectionSeq !== manual?.seq) {
83
+ const generation = (lock?.generation ?? -1) + 1;
84
+ lock = pinRoleRoute(frame.agent, identity, selected, [selected]);
85
+ lock.manualSelectionSeq = manual?.seq;
86
+ lock.generation = generation;
87
+ lockedAgents.add(frame.agent);
88
+ }
89
+ return downstream;
90
+ }
78
91
  if (manual !== undefined && lock?.manualSelectionSeq !== manual.seq
79
92
  && (sameExactModelRoute(downstream, manual.route) || nativeModelSelectionWasAccepted(frame.agent, manual))) {
80
93
  const llm = frame.agent.ctx?.get?.("llm")
@@ -124,6 +137,9 @@ export function registerModelRouting(ctx, controller, getSettings) {
124
137
  if (exactPolicy || lock.attempts > 0)
125
138
  return downstream;
126
139
  }
140
+ // Ordinary roots belong to the native model tab, including its exact effort.
141
+ if (ordinaryRoot)
142
+ return downstream;
127
143
  // Named fallback efforts are native policy IDs, never legacy calibration inputs.
128
144
  if (fallbacks.some((fallback) => fallback.reasoningEffort !== undefined
129
145
  && sameModelRoute(fallback, downstream) && fallback.reasoningEffort === downstream.reasoningEffort))
@@ -136,22 +136,23 @@ function rolePolicy(value) {
136
136
  switches: integer(item.switches, "switches", 10),
137
137
  totalDelayMs: integer(item.totalDelayMs, "totalDelayMs", 120000),
138
138
  ...optional(item, "role", role),
139
- ...optional(item, "route", (input) => {
140
- const route = object(input, ["provider", "model"], ["reasoningEffort"]);
141
- const provider = routeText(route.provider, "provider", 128);
142
- const model = routeText(route.model, "model", 512);
143
- if (!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$/u.test(provider) || model.includes("://"))
144
- fail("route");
145
- return { provider, model, ...optional(route, "reasoningEffort", (value) => routeText(value, "reasoningEffort", 64)) };
146
- }),
139
+ ...optional(item, "route", modelRoute),
147
140
  };
148
141
  }
142
+ function modelRoute(value) {
143
+ const route = object(value, ["provider", "model"], ["reasoningEffort"]);
144
+ const provider = routeText(route.provider, "provider", 128);
145
+ const model = routeText(route.model, "model", 512);
146
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$/u.test(provider) || model.includes("://"))
147
+ fail("route");
148
+ return { provider, model, ...optional(route, "reasoningEffort", (input) => routeText(input, "reasoningEffort", 64)) };
149
+ }
149
150
  function selectionState(value) {
150
151
  const item = object(value, ["selectedId", "appliedRevision", "selectionRevision"]);
151
152
  return { selectedId: item.selectedId === null ? null : id(item.selectedId), appliedRevision: item.appliedRevision === null ? null : revision(item.appliedRevision), selectionRevision: selectionRevision(item.selectionRevision) };
152
153
  }
153
154
  function sessionSnapshot(value) {
154
- const item = object(value, ["sessionId", "globalDefault", "selection", "scope", "admissionEpoch", "switchAllowed"], ["admittedSelection", "switchUnavailableReason", "rolePolicy"]);
155
+ const item = object(value, ["sessionId", "globalDefault", "selection", "scope", "admissionEpoch", "switchAllowed"], ["admittedSelection", "switchUnavailableReason", "rolePolicy", "profileModel"]);
155
156
  if (typeof item.scope !== "string" || !["global-default", "session-override", "deployment-baseline"].includes(item.scope))
156
157
  fail("scope");
157
158
  return {
@@ -164,6 +165,7 @@ function sessionSnapshot(value) {
164
165
  return input;
165
166
  }),
166
167
  ...optional(item, "rolePolicy", rolePolicy),
168
+ ...optional(item, "profileModel", modelRoute),
167
169
  };
168
170
  }
169
171
  function saveRequest(value) {
@@ -50,6 +50,7 @@ export declare class DsmmProfileRuntime {
50
50
  select(request: ProfileSelectRequest): Promise<ProfileSnapshot>;
51
51
  private prepare;
52
52
  private profileAdmission;
53
+ private declaredProfileModel;
53
54
  private agents;
54
55
  private bind;
55
56
  private owner;