@dsmm/dsmm 0.3.13 → 0.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +77 -36
  2. package/docs/agent-presets.md +1 -1
  3. package/docs/compatibility.md +2 -2
  4. package/docs/deferred-native-approval-risk.md +4 -4
  5. package/docs/design.md +1 -1
  6. package/docs/lsp.md +1 -1
  7. package/docs/model-routing.md +1 -1
  8. package/docs/native-permissions.md +12 -2
  9. package/docs/profiles.md +14 -5
  10. package/docs/roadmap.md +67 -30
  11. package/docs/runtime-recovery.md +1 -1
  12. package/docs/safety-guards.md +1 -1
  13. package/docs/settings-status.md +1 -1
  14. package/lib/client/DeploymentFields.js +3 -1
  15. package/lib/client/DeploymentPage.js +34 -2
  16. package/lib/client/EditableChoice.js +5 -2
  17. package/lib/client/PermissionsPanel.js +1 -1
  18. package/lib/client/ProfileModelsDialog.d.ts +4 -2
  19. package/lib/client/ProfileModelsDialog.js +46 -7
  20. package/lib/client/ProfilesSection.js +47 -17
  21. package/lib/client/RoleToolView-locales.d.ts +1 -1
  22. package/lib/client/RoleToolView-locales.js +2 -2
  23. package/lib/client/SessionProfiles.js +24 -6
  24. package/lib/client/children-locales.d.ts +1 -1
  25. package/lib/client/controller.d.ts +23 -1
  26. package/lib/client/controller.js +289 -8
  27. package/lib/client/deployment-locales.d.ts +2 -0
  28. package/lib/client/deployment-locales.js +3 -1
  29. package/lib/client/index.js +10 -2
  30. package/lib/client/locales.d.ts +8 -0
  31. package/lib/client/locales.js +16 -6
  32. package/lib/client/profile-blank.d.ts +43 -0
  33. package/lib/client/profile-blank.js +19 -0
  34. package/lib/client/session-labels.d.ts +1 -0
  35. package/lib/client/session-labels.js +3 -0
  36. package/lib/client/styles.d.ts +1 -1
  37. package/lib/client/styles.js +27 -12
  38. package/lib/client.js +714 -234
  39. package/lib/command-approval.d.ts +2 -0
  40. package/lib/command-approval.js +4 -1
  41. package/lib/index.js +2 -1
  42. package/lib/native-admission.d.ts +10 -3
  43. package/lib/native-admission.js +129 -28
  44. package/lib/profile-runtime.js +3 -5
  45. package/package.json +1 -1
@@ -88,6 +88,8 @@ export function Field({ schema, path, controller, initiallyOpen = false, disclos
88
88
  };
89
89
  const explicit = at(state.draft, path), inherited = controller.layer === "global" ? at(snapshot.defaults, path) : at(mergeLayer(mergeLayer(snapshot.defaults, snapshot.global), snapshot.nativeForm?.base ?? {}), path);
90
90
  const choices = enumValues(schema), disabled = !controller.canEdit();
91
+ const choiceLabel = (value) => name === "guards.gitWriteScope" && (value === "all-writes" || value === "high-risk")
92
+ ? t(value === "all-writes" ? "gitWriteAllWrites" : "gitWriteHighRisk") : displayValue(value, t);
91
93
  if (name === "permissionControl.nativeCommands.entries")
92
94
  return _jsx("div", { "data-field": name, children: _jsx(NativeCommandEntries, { controller: controller, value: explicit, inherited: (inherited ?? []), disabled: disabled, onChange: value => controller.edit(path, value), setInvalid: (key, bad) => controller.setInvalid(key, bad), t: permissionText(t) }) });
93
95
  if (name === "permissionControl.rules")
@@ -96,6 +98,6 @@ export function Field({ schema, path, controller, initiallyOpen = false, disclos
96
98
  return _jsxs("details", { className: "dsmm-deployment-group", "data-field": name, open: open, onToggle: event => expand(event.currentTarget.open), children: [_jsx("summary", { className: "dsmm-group-summary-row", children: _jsxs("span", { className: "dsmm-group-summary", children: [_jsx("span", { className: "dsmm-group-summary-label", children: fieldLabel(path, t) }), _jsx(Button, { type: "button", variant: "outline", className: "dsmm-group-summary-action", "data-dsmm-unset": name, hidden: !open, disabled: disabled || explicit === undefined && !Object.keys(state.raw).some(key => key === name || key.startsWith(`${name}.`)), onClick: unsetGroup, children: unsetLabel })] }) }), _jsxs("div", { children: [name === "permissionControl" && _jsx("p", { className: "dsmm-hint", children: permissionText(t)("configPolicyHint") }), Object.entries(schema.fields).map(([key, node]) => _jsx(Field, { schema: node, path: [...path, key], controller: controller, disclosures: disclosures, t: t }, key))] })] });
97
99
  if (!["boolean", "string", "number"].includes(schema.type) && choices === null)
98
100
  return _jsx(AdvancedField, { schema: schema, path: path, controller: controller, inherited: inherited, upper: controller.layer === "global" ? at(snapshot.profile, path) : undefined, expanded: open, onExpandedChange: expand, t: t });
99
- return _jsxs("div", { className: "dsmm-field dsmm-deployment-field", "data-field": name, children: [schema.type === "boolean" || choices !== null ? _jsxs(_Fragment, { children: [_jsx("label", { htmlFor: id, children: fieldLabel(path, t) }), _jsxs("select", { id: id, disabled: disabled, value: explicit === undefined ? "inherit" : JSON.stringify(explicit), onChange: event => controller.edit(path, event.currentTarget.value === "inherit" ? undefined : JSON.parse(event.currentTarget.value)), children: [_jsx("option", { value: "inherit", children: `${unsetLabel} · ${displayValue(inherited, t)}` }), (choices ?? [true, false]).map(choice => _jsx("option", { value: JSON.stringify(choice), children: displayValue(choice, t) }, String(choice)))] })] }) : _jsx(ScalarField, { schema: schema, path: path, controller: controller, inherited: inherited, t: t }), name === "modelParameters.passthrough" && _jsx("p", { className: "dsmm-hint", children: t("modelParametersHint") }), name === "permissionControl.enabled" && _jsx("p", { className: "dsmm-hint", children: permissionText(t)("coldHint") })] });
101
+ return _jsxs("div", { className: "dsmm-field dsmm-deployment-field", "data-field": name, children: [schema.type === "boolean" || choices !== null ? _jsxs(_Fragment, { children: [_jsx("label", { htmlFor: id, children: fieldLabel(path, t) }), _jsxs("select", { id: id, disabled: disabled, value: explicit === undefined ? "inherit" : JSON.stringify(explicit), onChange: event => controller.edit(path, event.currentTarget.value === "inherit" ? undefined : JSON.parse(event.currentTarget.value)), children: [_jsx("option", { value: "inherit", children: `${unsetLabel} · ${choiceLabel(inherited)}` }), (choices ?? [true, false]).map(choice => _jsx("option", { value: JSON.stringify(choice), children: choiceLabel(choice) }, String(choice)))] })] }) : _jsx(ScalarField, { schema: schema, path: path, controller: controller, inherited: inherited, t: t }), name === "modelParameters.passthrough" && _jsx("p", { className: "dsmm-hint", children: t("modelParametersHint") }), name === "permissionControl.enabled" && _jsx("p", { className: "dsmm-hint", children: permissionText(t)("coldHint") })] });
100
102
  }
101
103
  //# sourceMappingURL=DeploymentFields.js.map
@@ -11,7 +11,39 @@ import { permissionEn } from "./permission-locales.js";
11
11
  export function ScopeSave({ controller, workspace, refreshOnly = false, t }) {
12
12
  const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
13
13
  const pending = [...new Set(controller.pendingPaths().map(moduleFor))];
14
- return _jsxs("section", { className: "dsmm-scope-save", "aria-label": t("saveScope"), children: [_jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: refreshOnly ? state.busy ? t("loading") : "" : state.busy ? t("saving") : state.refreshRequired ? t("savedRefreshRequired") : state.saved ? t("saved") : state.dirty ? t("dirty") : "" }), !refreshOnly && pending.length > 0 && _jsxs("p", { children: [t("pendingModules"), ": ", pending.map(module => t(moduleTitle(module))).join(" · ")] }), state.issue !== null && _jsx("p", { className: "dsmm-issue", role: "alert", children: t(state.issue) }), !refreshOnly && state.invalidFields.length > 0 && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("invalid") }), controller.layer === "profile" && !controller.canWriteProfile() && _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") }), _jsxs("div", { className: "dsmm-actions", children: [!refreshOnly && _jsx(Button, { type: "button", variant: "primary", disabled: !controller.canSave(), onClick: () => void (workspace?.save() ?? controller.save()), children: t(controller.layer === "global" ? "saveGlobal" : "saveProfile") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => void controller.refresh(), children: t("refresh") }), !refreshOnly && _jsx(Button, { type: "button", variant: "outline", disabled: state.busy || !state.dirty && state.issue === null && !state.refreshRequired, onClick: () => void controller.refresh(true), children: t("discard") })] })] });
14
+ const ref = useRef(null);
15
+ useEffect(() => {
16
+ const el = ref.current;
17
+ if (!el)
18
+ return;
19
+ const parent = el.closest(".dsmm-section-panel");
20
+ const update = () => {
21
+ const height = el.offsetHeight;
22
+ if (parent) {
23
+ parent.style.setProperty("--dsmm-scope-save-offset", `${height}px`);
24
+ }
25
+ };
26
+ update();
27
+ if (typeof ResizeObserver !== "undefined") {
28
+ const ro = new ResizeObserver(update);
29
+ ro.observe(el);
30
+ return () => {
31
+ ro.disconnect();
32
+ if (parent) {
33
+ parent.style.removeProperty("--dsmm-scope-save-offset");
34
+ }
35
+ };
36
+ }
37
+ return () => {
38
+ if (parent) {
39
+ parent.style.removeProperty("--dsmm-scope-save-offset");
40
+ }
41
+ };
42
+ }, []);
43
+ const status = refreshOnly
44
+ ? (state.busy ? t("loading") : "")
45
+ : (state.busy ? t("saving") : state.refreshRequired ? t("savedRefreshRequired") : state.saved ? t("saved") : state.dirty ? t("dirty") : "");
46
+ return _jsxs("section", { ref: ref, className: "dsmm-scope-save", "aria-label": t("saveScope"), children: [_jsxs("div", { className: "dsmm-actions", children: [!refreshOnly && _jsx(Button, { type: "button", variant: "primary", disabled: !controller.canSave(), onClick: () => void (workspace?.save() ?? controller.save()), children: t(controller.layer === "global" ? "saveGlobal" : "saveProfile") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => void controller.refresh(), children: t("refresh") }), !refreshOnly && _jsx(Button, { type: "button", variant: "outline", disabled: state.busy || !state.dirty && state.issue === null && !state.refreshRequired, onClick: () => void controller.refresh(true), children: t("discard") }), status !== "" && _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: status })] }), !refreshOnly && pending.length > 0 && _jsxs("p", { className: "dsmm-hint", children: [t("pendingModules"), ": ", pending.map(module => t(moduleTitle(module))).join(" · ")] }), state.issue !== null && _jsx("p", { className: "dsmm-issue", role: "alert", children: t(state.issue) }), !refreshOnly && state.invalidFields.length > 0 && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("invalid") }), controller.layer === "profile" && !controller.canWriteProfile() && _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") })] });
15
47
  }
16
48
  export function NativeRuntimeState({ value, t }) {
17
49
  return _jsxs("details", { className: "dsmm-availability", children: [_jsx("summary", { children: t("nativeRuntimeState") }), _jsxs("p", { children: [t("nativeRuntimeBinding"), ": ", t(value?.binding === "stock" ? "nativeRuntimeStock" : value?.binding === "unavailable" ? "nativeRuntimeUnavailable" : "unknown")] }), _jsxs("p", { children: [t("nativeRuntimeFence"), ": ", value === undefined ? t("unknown") : t(value.deliveryFenceReady ? "on" : "off"), " \u00B7 ", t("nativeRuntimeRestart"), ": ", value === undefined ? t("unknown") : t(value.restartRequired ? "on" : "off")] }), value?.reason !== undefined && _jsx("p", { children: t(`nativeRuntimeReason-${value.reason}`) })] });
@@ -99,7 +131,7 @@ export function DeploymentPage(props) {
99
131
  }, children: [_jsx("option", { value: "global", children: t("global") }), _jsx("option", { value: "profile", children: t("profile") })] })] }), _jsx("p", { className: "dsmm-hint", children: t(navigation.scope === "global" ? "globalHint" : "profileHint") }), navigation.scope === "profile" && (navigation.native === null || !navigation.native.canWriteProfile()) && _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") }), _jsx("div", { className: "dsmm-section-tabs", role: "tablist", "aria-label": t("modules"), children: tabs.map((module, index) => _jsx(Button, { ref: element => { if (element !== null)
100
132
  triggers.current.set(module, element);
101
133
  else
102
- triggers.current.delete(module); }, role: "tab", type: "button", id: `${id}-tab-${module}`, "aria-selected": active === module, "aria-controls": `${id}-panel`, tabIndex: active === module ? 0 : -1, "data-dsmm-tab": module, onKeyDown: event => onTabKey(event, index), onClick: () => select(module), children: t(moduleTitle(module)) }, module)) }), active !== null && _jsxs("section", { id: `${id}-panel`, role: "tabpanel", className: "dsmm-section-panel", "aria-labelledby": `${id}-tab-${active}`, "data-dsmm-module": active, children: [_jsx("div", { className: "dsmm-panel-heading", children: _jsx("h2", { id: `${id}-heading`, ref: heading, tabIndex: -1, children: t(moduleTitle(active)) }) }), active === "state" ? _jsxs(_Fragment, { children: [_jsx(StateInspector, { controller: props.core, t: t }), scopeActions] }) : _jsxs(_Fragment, { children: [navigation.scope === "profile" && navigation.native === null ? _jsx("p", { children: t("unavailableForm") }) : state.snapshot === null ? _jsx("p", { children: t(state.busy ? "loading" : "unavailable") }) : _jsxs("div", { "data-dsmm-layer": controller.layer, "aria-busy": state.busy, className: "dsmm-structured", children: [fields.length === 0 && _jsx("p", { className: "dsmm-hint", children: t("noModuleFields") }), fields.map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, initiallyOpen: fields.length === 1 && active !== "permissions", disclosures: disclosures.current[navigation.scope], t: t }, `${navigation.scope}:${key}`)), active === "run" && controller.layer === "profile" && _jsx(NativeRuntimeState, { value: state.snapshot.subagentRuntime, t: t })] }), scopeActions, active === "permissions" && _jsx("section", { className: "dsmm-zone dsmm-rules-transaction", "aria-label": t("rootRules"), children: workspace.permissions === undefined ? _jsx("p", { children: t("rootRulesUnavailable") }) : _jsx(PermissionsPanel, { controller: workspace.permissions, t: props.permissionsT ?? (key => Object.hasOwn(permissionEn, key) ? permissionText(t)(key) : key) }) })] })] }), navigation.pending !== null && _jsxs("section", { className: "dsmm-confirm", role: "group", "aria-label": t("leaveDraft"), onKeyDown: event => { if (event.key === "Escape" && !event.defaultPrevented) {
134
+ triggers.current.delete(module); }, role: "tab", type: "button", id: `${id}-tab-${module}`, "aria-selected": active === module, "aria-controls": `${id}-panel`, tabIndex: active === module ? 0 : -1, "data-dsmm-tab": module, onKeyDown: event => onTabKey(event, index), onClick: () => select(module), children: t(moduleTitle(module)) }, module)) }), active !== null && _jsxs("section", { id: `${id}-panel`, role: "tabpanel", className: "dsmm-section-panel", "aria-labelledby": `${id}-tab-${active}`, "data-dsmm-module": active, children: [_jsx("div", { className: "dsmm-panel-heading", children: _jsx("h2", { id: `${id}-heading`, ref: heading, tabIndex: -1, children: t(moduleTitle(active)) }) }), scopeActions, active === "state" ? _jsx(StateInspector, { controller: props.core, t: t }) : _jsxs(_Fragment, { children: [navigation.scope === "profile" && navigation.native === null ? _jsx("p", { children: t("unavailableForm") }) : state.snapshot === null ? _jsx("p", { children: t(state.busy ? "loading" : "unavailable") }) : _jsxs("div", { "data-dsmm-layer": controller.layer, "aria-busy": state.busy, className: "dsmm-structured", children: [fields.length === 0 && _jsx("p", { className: "dsmm-hint", children: t("noModuleFields") }), fields.map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, initiallyOpen: fields.length === 1 && active !== "permissions", disclosures: disclosures.current[navigation.scope], t: t }, `${navigation.scope}:${key}`)), active === "run" && controller.layer === "profile" && _jsx(NativeRuntimeState, { value: state.snapshot.subagentRuntime, t: t })] }), active === "permissions" && _jsx("section", { className: "dsmm-zone dsmm-rules-transaction", "aria-label": t("rootRules"), children: workspace.permissions === undefined ? _jsx("p", { children: t("rootRulesUnavailable") }) : _jsx(PermissionsPanel, { controller: workspace.permissions, t: props.permissionsT ?? (key => Object.hasOwn(permissionEn, key) ? permissionText(t)(key) : key) }) })] })] }), navigation.pending !== null && _jsxs("section", { className: "dsmm-confirm", role: "group", "aria-label": t("leaveDraft"), onKeyDown: event => { if (event.key === "Escape" && !event.defaultPrevented) {
103
135
  event.preventDefault();
104
136
  workspace.continueEditing();
105
137
  } }, children: [_jsx("p", { children: t("leaveDraft") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { ref: confirmation, type: "button", variant: "primary", onClick: () => workspace.continueEditing(), children: t("continueEditing") }), _jsx(Button, { type: "button", variant: "outline", onClick: () => workspace.keepAndNavigate(), children: t("keepDraft") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => void workspace.discardAndNavigate(), children: t("discardDraft") })] })] })] });
@@ -25,7 +25,10 @@ export function EditableChoice({ id, label, value, options, disabled, placeholde
25
25
  if (visible && activeIndex >= 0)
26
26
  document.getElementById(`${id}-choice-${activeIndex}`)?.scrollIntoView({ block: "nearest" });
27
27
  }, [id, visible, activeIndex]);
28
- return _jsxs("div", { className: "dsmm-choice", children: [_jsx(Input, { ref: input, id: id, className: "dsmm-input", role: "combobox", "aria-autocomplete": "list", "aria-expanded": visible, "aria-controls": visible ? `${id}-choices` : undefined, "aria-activedescendant": visible && activeIndex >= 0 ? `${id}-choice-${activeIndex}` : undefined, value: value, disabled: disabled, placeholder: placeholder, autoComplete: "off", onBlur: close, onChange: event => { onChange(event.currentTarget.value); setOpen(true); setActiveId(null); }, onKeyDown: event => {
28
+ return _jsxs("div", { className: "dsmm-choice", children: [_jsx(Input, { ref: input, id: id, className: "dsmm-input", role: "combobox", "aria-autocomplete": "list", "aria-expanded": visible, "aria-controls": visible ? `${id}-choices` : undefined, "aria-activedescendant": visible && activeIndex >= 0 ? `${id}-choice-${activeIndex}` : undefined, value: value, disabled: disabled, placeholder: placeholder, autoComplete: "off", onBlur: close, onClick: () => { if (!disabled && choices.length > 0 && !visible) {
29
+ setOpen(true);
30
+ setActiveId(null);
31
+ } }, onChange: event => { onChange(event.currentTarget.value); setOpen(true); setActiveId(null); }, onKeyDown: event => {
29
32
  if (event.nativeEvent.isComposing)
30
33
  return;
31
34
  if ((event.key === "ArrowDown" || event.key === "ArrowUp") && choices.length > 0) {
@@ -44,6 +47,6 @@ export function EditableChoice({ id, label, value, options, disabled, placeholde
44
47
  else
45
48
  close();
46
49
  }
47
- } }), _jsx(Button, { type: "button", size: "sm", variant: "toolbar", tabIndex: -1, className: "dsmm-choice-toggle", "aria-label": label, "aria-haspopup": "listbox", "aria-expanded": visible, disabled: disabled || choices.length === 0, icon: _jsx(IconChevronDownOutlineRegular, {}), onMouseDown: event => event.preventDefault(), onClick: () => { input.current?.focus(); setOpen(!visible); setActiveId(null); } }), visible && _jsx("ul", { className: "dsmm-choice-list", id: `${id}-choices`, role: "listbox", "aria-label": label, children: choices.map((option, index) => _jsx("li", { id: `${id}-choice-${index}`, role: "option", "data-value": option.id, "aria-selected": option.id === activeId, onMouseDown: event => event.preventDefault(), onClick: () => choose(option.id), children: option.name === option.id ? option.id : `${option.name} (${option.id})` }, option.id)) })] });
50
+ } }), _jsx(Button, { type: "button", size: "sm", variant: "ghost", tabIndex: -1, className: "dsmm-choice-toggle", "aria-label": label, "aria-haspopup": "listbox", "aria-expanded": visible, disabled: disabled || choices.length === 0, icon: _jsx(IconChevronDownOutlineRegular, {}), onMouseDown: event => event.preventDefault(), onClick: () => { input.current?.focus(); setOpen(!visible); setActiveId(null); } }), visible && _jsx("ul", { className: "dsmm-choice-list", id: `${id}-choices`, role: "listbox", "aria-label": label, children: choices.map((option, index) => _jsx("li", { id: `${id}-choice-${index}`, role: "option", "data-value": option.id, "aria-selected": option.id === activeId, onMouseDown: event => event.preventDefault(), onClick: () => choose(option.id), children: option.name === option.id ? option.id : `${option.name} (${option.id})` }, option.id)) })] });
48
51
  }
49
52
  //# sourceMappingURL=EditableChoice.js.map
@@ -36,7 +36,7 @@ function PermissionCoverage({ state, t }) {
36
36
  export function PermissionRulesEditor({ controller, state, t }) {
37
37
  const id = useId(), draft = state.draft, disabled = !controller.canEdit(state.generation), value = observedRules(state), observedPolicy = value?.snapshot ?? null;
38
38
  const writable = state.scope === "root" && state.connected;
39
- return _jsxs("section", { className: "dsmm-zone", "aria-label": t("rules"), children: [_jsx("h3", { children: t("rules") }), _jsx("p", { className: "dsmm-hint", children: t("rulesHint") }), _jsx(Issue, { value: state.rulesIssue, t: t }), displayUnconfirmed(state) && _jsx("p", { className: "dsmm-hint", children: t("unconfirmedObservation") }), _jsx("p", { className: "dsmm-hint", children: t("observedPolicy") }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("profileOverrideState") }), _jsx("dd", { children: t("profileOverrideUnknown") })] }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("runtime") }), _jsx("dd", { children: value === null ? t("unknown") : t(value.runtime.state) }), _jsx("dt", { children: t("mounted") }), _jsx("dd", { children: value === null ? t("unknown") : t(value.runtime.mounted ? "on" : "off") })] }), value?.runtime.restartRequired && _jsx("p", { children: t("restart") }), disabled && !state.reading && !displayUnconfirmed(state) && _jsx("p", { className: "dsmm-hint", children: t("rulesUnavailable") }), observedPolicy !== null && _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: "permissionControl.enabled" }), _jsxs("dd", { children: [t(observedPolicy.policy.enabled ? "on" : "off"), " \u00B7 ", t("coldHint")] }), _jsx("dt", { children: "permissionControl.nativeCommands.enabled" }), _jsx("dd", { children: t(observedPolicy.policy.nativeCommands.enabled ? "on" : "off") })] }), _jsxs("details", { className: "dsmm-deployment-group", children: [_jsx("summary", { children: t("coverageDetails") }), _jsx(PermissionCoverage, { state: state, t: t })] }), draft !== null && _jsxs(_Fragment, { children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-outside`, children: t("outsideReads") }), _jsx(ActionSelect, { id: `${id}-outside`, value: draft.outsideReads, disabled: disabled, t: t, onChange: outsideReads => controller.edit(state.generation, { outsideReads }) })] }), ["webSearch", "webFetch"].map(key => _jsxs("fieldset", { children: [_jsx("legend", { children: t(key) }), _jsxs("label", { className: "dsmm-actions", htmlFor: `${id}-${key}-enabled`, children: [_jsx("input", { type: "checkbox", id: `${id}-${key}-enabled`, checked: draft[key].enabled, disabled: disabled, onChange: event => controller.edit(state.generation, { [key]: { ...draft[key], enabled: event.currentTarget.checked } }) }), t("enabled")] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-${key}-rule`, children: t("rule") }), _jsx(ActionSelect, { id: `${id}-${key}-rule`, value: draft[key].rule, disabled: disabled, t: t, onChange: rule => controller.edit(state.generation, { [key]: { ...draft[key], rule } }) })] })] }, key)), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || draft.editor !== null, onClick: () => controller.edit(state.generation, { editor: { id: "", action: "ask", match: newMatch("outside-read") } }), children: t("newRule") }), _jsx(RuleEditor, { controller: controller, state: state, t: t }), (draft.upsert.length > 0 || draft.revoke.length > 0) && _jsxs("div", { className: "dsmm-structured", children: [_jsx("h3", { children: t("staged") }), draft.upsert.map(row => _jsxs("div", { className: "dsmm-field", children: [_jsxs("p", { children: [row.id, " \u00B7 ", t(`kind:${row.match.kind}`), " \u00B7 ", t(`action:${row.action}`)] }), _jsxs(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => controller.edit(state.generation, { upsert: draft.upsert.filter(rule => rule.id !== row.id) }), children: [t("unstage"), ": ", row.id] })] }, row.id)), draft.revoke.map(ruleId => _jsxs("div", { className: "dsmm-field", children: [_jsxs("p", { children: [t("stageRevoke"), ": ", ruleId] }), _jsxs(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => controller.edit(state.generation, { revoke: draft.revoke.filter(id => id !== ruleId) }), children: [t("unstage"), ": ", ruleId] })] }, ruleId))] })] }), _jsx(RuleRecords, { state: state, controller: controller, t: t }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: !controller.canSave(state.generation), onClick: () => void controller.save(state.generation), children: t("save") }), _jsx(Button, { type: "button", variant: "outline", disabled: !writable || state.reading || state.busy !== null, onClick: () => void controller.refresh(state.generation), children: t("refresh") }), _jsx(Button, { type: "button", variant: "outline", disabled: !writable || state.reading || state.busy !== null || !state.dirty && state.rulesIssue === null, onClick: () => void controller.refresh(state.generation, true), children: t("discard") })] }), state.dirty && _jsx("p", { children: t("dirty") })] });
39
+ return _jsxs("section", { className: "dsmm-zone", "aria-label": t("rules"), children: [_jsxs("div", { className: "dsmm-rules-save-bar", children: [_jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: !controller.canSave(state.generation), onClick: () => void controller.save(state.generation), children: t("save") }), _jsx(Button, { type: "button", variant: "outline", disabled: !writable || state.reading || state.busy !== null, onClick: () => void controller.refresh(state.generation), children: t("refresh") }), _jsx(Button, { type: "button", variant: "outline", disabled: !writable || state.reading || state.busy !== null || !state.dirty && state.rulesIssue === null, onClick: () => void controller.refresh(state.generation, true), children: t("discard") })] }), state.dirty && _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: t("dirty") })] }), _jsx("h3", { children: t("rules") }), _jsx("p", { className: "dsmm-hint", children: t("rulesHint") }), _jsx(Issue, { value: state.rulesIssue, t: t }), displayUnconfirmed(state) && _jsx("p", { className: "dsmm-hint", children: t("unconfirmedObservation") }), _jsx("p", { className: "dsmm-hint", children: t("observedPolicy") }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("profileOverrideState") }), _jsx("dd", { children: t("profileOverrideUnknown") })] }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("runtime") }), _jsx("dd", { children: value === null ? t("unknown") : t(value.runtime.state) }), _jsx("dt", { children: t("mounted") }), _jsx("dd", { children: value === null ? t("unknown") : t(value.runtime.mounted ? "on" : "off") })] }), value?.runtime.restartRequired && _jsx("p", { children: t("restart") }), disabled && !state.reading && !displayUnconfirmed(state) && _jsx("p", { className: "dsmm-hint", children: t("rulesUnavailable") }), observedPolicy !== null && _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: "permissionControl.enabled" }), _jsxs("dd", { children: [t(observedPolicy.policy.enabled ? "on" : "off"), " \u00B7 ", t("coldHint")] }), _jsx("dt", { children: "permissionControl.nativeCommands.enabled" }), _jsx("dd", { children: t(observedPolicy.policy.nativeCommands.enabled ? "on" : "off") })] }), _jsxs("details", { className: "dsmm-deployment-group", children: [_jsx("summary", { children: t("coverageDetails") }), _jsx(PermissionCoverage, { state: state, t: t })] }), draft !== null && _jsxs(_Fragment, { children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-outside`, children: t("outsideReads") }), _jsx(ActionSelect, { id: `${id}-outside`, value: draft.outsideReads, disabled: disabled, t: t, onChange: outsideReads => controller.edit(state.generation, { outsideReads }) })] }), ["webSearch", "webFetch"].map(key => _jsxs("fieldset", { children: [_jsx("legend", { children: t(key) }), _jsxs("label", { className: "dsmm-actions", htmlFor: `${id}-${key}-enabled`, children: [_jsx("input", { type: "checkbox", id: `${id}-${key}-enabled`, checked: draft[key].enabled, disabled: disabled, onChange: event => controller.edit(state.generation, { [key]: { ...draft[key], enabled: event.currentTarget.checked } }) }), t("enabled")] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-${key}-rule`, children: t("rule") }), _jsx(ActionSelect, { id: `${id}-${key}-rule`, value: draft[key].rule, disabled: disabled, t: t, onChange: rule => controller.edit(state.generation, { [key]: { ...draft[key], rule } }) })] })] }, key)), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || draft.editor !== null, onClick: () => controller.edit(state.generation, { editor: { id: "", action: "ask", match: newMatch("outside-read") } }), children: t("newRule") }), _jsx(RuleEditor, { controller: controller, state: state, t: t }), (draft.upsert.length > 0 || draft.revoke.length > 0) && _jsxs("div", { className: "dsmm-structured", children: [_jsx("h3", { children: t("staged") }), draft.upsert.map(row => _jsxs("div", { className: "dsmm-field", children: [_jsxs("p", { children: [row.id, " \u00B7 ", t(`kind:${row.match.kind}`), " \u00B7 ", t(`action:${row.action}`)] }), _jsxs(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => controller.edit(state.generation, { upsert: draft.upsert.filter(rule => rule.id !== row.id) }), children: [t("unstage"), ": ", row.id] })] }, row.id)), draft.revoke.map(ruleId => _jsxs("div", { className: "dsmm-field", children: [_jsxs("p", { children: [t("stageRevoke"), ": ", ruleId] }), _jsxs(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => controller.edit(state.generation, { revoke: draft.revoke.filter(id => id !== ruleId) }), children: [t("unstage"), ": ", ruleId] })] }, ruleId))] })] }), _jsx(RuleRecords, { state: state, controller: controller, t: t })] });
40
40
  }
41
41
  export function PermissionsPanel({ controller, t, sessionId }) {
42
42
  const state = useSyncExternalStore(controller.store.subscribe, controller.store.getSnapshot);
@@ -2,6 +2,8 @@ import type { RefObject } from "react";
2
2
  import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
3
3
  import type { ProfilesActions, ProfilesViewSnapshot } from "./controller.js";
4
4
  import type { StructuredDocument } from "./structured.js";
5
+ import { displayRoleLabel } from "./session-labels.js";
6
+ export { displayRoleLabel };
5
7
  type Locale = PropsLocale<"settings.dsmm-profiles">;
6
8
  export declare function hasExplicitModelOverride(roleId: string, doc: StructuredDocument | null): boolean;
7
9
  export interface ProfileModelsDialogProps extends Locale {
@@ -17,7 +19,7 @@ export interface ProfileModelsDialogProps extends Locale {
17
19
  targetField?: string | null;
18
20
  onTargetLocated?: () => void;
19
21
  onJumpToJsonc?: () => void;
22
+ canSave?: boolean;
20
23
  }
21
- export declare function ProfileModelsDialog({ open, onClose, state, actions, disabled, document: doc, isInvalidProjection, triggerRef, targetRoleId, targetField, onTargetLocated, onJumpToJsonc, t, }: ProfileModelsDialogProps): import("react").JSX.Element;
22
- export {};
24
+ export declare function ProfileModelsDialog({ open, onClose, state, actions, disabled, document: doc, isInvalidProjection, triggerRef, targetRoleId, targetField, onTargetLocated, onJumpToJsonc, canSave: canSaveProp, t, }: ProfileModelsDialogProps): import("react").JSX.Element;
23
25
  //# sourceMappingURL=ProfileModelsDialog.d.ts.map
@@ -5,6 +5,8 @@ import { DSMM_RATE_LIMIT_BOUNDS, normalizeRateLimitPolicy } from "../routing-pol
5
5
  import { LevelFields, PolicyFields, RouteFields } from "./StructuredEditor.js";
6
6
  import { RoleAvailability, roleAvailability } from "./RoleAvailability.js";
7
7
  import { IssueDetails, issueKey } from "./diagnostics.js";
8
+ import { displayRoleLabel } from "./session-labels.js";
9
+ export { displayRoleLabel };
8
10
  function locateFieldInsideRole(roleCard, field) {
9
11
  if (!field)
10
12
  return null;
@@ -79,11 +81,12 @@ export function hasExplicitModelOverride(roleId, doc) {
79
81
  return true;
80
82
  return false;
81
83
  }
82
- export function ProfileModelsDialog({ open, onClose, state, actions, disabled, document: doc, isInvalidProjection, triggerRef, targetRoleId, targetField, onTargetLocated, onJumpToJsonc, t, }) {
84
+ export function ProfileModelsDialog({ open, onClose, state, actions, disabled, document: doc, isInvalidProjection, triggerRef, targetRoleId, targetField, onTargetLocated, onJumpToJsonc, canSave: canSaveProp, t, }) {
83
85
  const prefix = useId();
84
86
  const [searchQuery, setSearchQuery] = useState("");
85
87
  const [filterExplicitOnly, setFilterExplicitOnly] = useState(false);
86
88
  const pendingFallbackFocusRef = useRef(null);
89
+ const dialogTopBarRef = useRef(null);
87
90
  const wasOpenRef = useRef(open);
88
91
  useEffect(() => {
89
92
  if (wasOpenRef.current && !open) {
@@ -226,11 +229,14 @@ export function ProfileModelsDialog({ open, onClose, state, actions, disabled, d
226
229
  const roles = state.snapshot?.roles ?? [];
227
230
  const effectiveDisabled = disabled || isInvalidProjection || doc === null;
228
231
  const baseline = state.snapshot?.editorDefaults;
232
+ const canSave = canSaveProp ?? (!disabled && !isInvalidProjection && doc !== null && state.dirty && state.snapshot !== null && state.invalidFields.length === 0);
233
+ const isSaveLocked = (state.dirty || state.invalidFields.length > 0) && !disabled && doc !== null && state.snapshot !== null && (state.invalidFields.length > 0 || Boolean(isInvalidProjection));
229
234
  const filteredRoles = roles.filter((role) => {
230
235
  if (searchQuery.trim()) {
231
236
  const q = searchQuery.trim().toLowerCase();
232
237
  const matchesId = role.id.toLowerCase().includes(q);
233
- const matchesLabel = role.label.toLowerCase().includes(q);
238
+ const displayLabel = displayRoleLabel(role.label);
239
+ const matchesLabel = role.label.toLowerCase().includes(q) || displayLabel.toLowerCase().includes(q);
234
240
  if (!matchesId && !matchesLabel)
235
241
  return false;
236
242
  }
@@ -240,7 +246,40 @@ export function ProfileModelsDialog({ open, onClose, state, actions, disabled, d
240
246
  }
241
247
  return true;
242
248
  });
243
- return (_jsxs(Modal, { open: open, onClose: onClose, title: t("modelsDialogTitle"), description: t("modelsDialogDesc"), closeLabel: t("cancel"), className: "dsmm-profile-models-dialog", contentClassName: "dsmm-profile-models-dialog-content", onKeyDownCapture: handleKeyDownCapture, children: [_jsxs("div", { className: "dsmm-models-filter-bar dsmm-dialog-filter-bar", children: [_jsx("div", { className: "dsmm-field dsmm-filter-search", children: _jsx(Input, { id: `${prefix}-role-search`, className: "dsmm-input", type: "search", value: searchQuery, placeholder: t("searchRolesPlaceholder"), disabled: effectiveDisabled, onChange: (e) => setSearchQuery(e.currentTarget.value), "data-dsmm-role-search": true, "data-modal-autofocus": true }) }), _jsxs("label", { className: "dsmm-filter-label dsmm-filter-override-toggle", children: [_jsx("input", { type: "checkbox", checked: filterExplicitOnly, disabled: effectiveDisabled, onChange: (e) => setFilterExplicitOnly(e.currentTarget.checked), "data-dsmm-filter-overrides": true }), _jsx("span", { children: t("filterExplicitOverrides") })] })] }), state.issue !== null && (_jsxs("div", { className: "dsmm-issue dsmm-dialog-issue", role: "region", "aria-label": t("savedInventory"), children: [_jsx("p", { className: "dsmm-dialog-issue-title", children: t(issueKey(state.issue)) }), _jsx(IssueDetails, { issue: state.issue, t: t }), onJumpToJsonc && (_jsx("div", { className: "dsmm-dialog-issue-action", children: _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: onJumpToJsonc, children: t("jumpToJsonc") }) }))] })), doc === null && (_jsxs("div", { className: "dsmm-structured-invalid", "data-dsmm-structured-invalid": true, children: [_jsx("p", { children: t("rawInvalid") }), _jsx("p", { className: "dsmm-hint", children: t("rawInvalidFormDisabled") }), onJumpToJsonc && (_jsx(Button, { type: "button", variant: "outline", onClick: onJumpToJsonc, children: t("viewConfiguration") }))] })), doc !== null && (_jsxs("div", { className: "dsmm-roles-list dsmm-dialog-roles-list", children: [filteredRoles.length === 0 && (_jsx("p", { className: "dsmm-hint dsmm-no-roles", children: t("noMatchingRoles") })), filteredRoles.map((role) => {
249
+ useEffect(() => {
250
+ if (!open)
251
+ return;
252
+ const el = dialogTopBarRef.current;
253
+ if (!el)
254
+ return;
255
+ const parent = el.closest(".dsmm-profile-models-dialog-content");
256
+ const update = () => {
257
+ const height = el.offsetHeight;
258
+ if (parent) {
259
+ parent.style.setProperty("--dsmm-dialog-bar-offset", `${height}px`);
260
+ }
261
+ };
262
+ update();
263
+ if (typeof ResizeObserver !== "undefined") {
264
+ const ro = new ResizeObserver(update);
265
+ ro.observe(el);
266
+ return () => {
267
+ ro.disconnect();
268
+ if (parent) {
269
+ parent.style.removeProperty("--dsmm-dialog-bar-offset");
270
+ }
271
+ };
272
+ }
273
+ return () => {
274
+ if (parent) {
275
+ parent.style.removeProperty("--dsmm-dialog-bar-offset");
276
+ }
277
+ };
278
+ }, [open, state.dirty, isSaveLocked, state.busy]);
279
+ return (_jsxs(Modal, { open: open, onClose: onClose, title: t("modelsDialogTitle"), description: t("modelsDialogDesc"), closeLabel: t("cancel"), className: "dsmm-profile-models-dialog", contentClassName: "dsmm-profile-models-dialog-content", onKeyDownCapture: handleKeyDownCapture, children: [_jsxs("div", { ref: dialogTopBarRef, className: "dsmm-dialog-top-bar", children: [_jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: !canSave, onClick: () => { void actions.save(); }, children: t(state.busy === "save" ? "saving" : "save") }), _jsx(Button, { type: "button", variant: "outline", onClick: onClose, children: t("cancel") })] }), state.busy === "save" ? (_jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: t("saving") })) : state.dirty ? (_jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: t("dirty") })) : null, isSaveLocked && (_jsx("div", { className: "dsmm-save-lock-reason", role: "status", children: _jsx("span", { className: "dsmm-save-lock-text", children: isInvalidProjection
280
+ ? t("rawInvalid")
281
+ : t("saveLockedReason", { count: state.invalidFields.length }) }) }))] }), _jsxs("div", { className: "dsmm-models-filter-bar dsmm-dialog-filter-bar", children: [_jsx("div", { className: "dsmm-field dsmm-filter-search", children: _jsx(Input, { id: `${prefix}-role-search`, className: "dsmm-input", type: "search", value: searchQuery, placeholder: t("searchRolesPlaceholder"), disabled: effectiveDisabled, onChange: (e) => setSearchQuery(e.currentTarget.value), "data-dsmm-role-search": true, "data-modal-autofocus": true }) }), _jsxs("label", { className: "dsmm-filter-label dsmm-filter-override-toggle", children: [_jsx("input", { type: "checkbox", checked: filterExplicitOnly, disabled: effectiveDisabled, onChange: (e) => setFilterExplicitOnly(e.currentTarget.checked), "data-dsmm-filter-overrides": true }), _jsx("span", { children: t("filterExplicitOverrides") })] })] }), state.issue !== null && (_jsxs("div", { className: "dsmm-issue dsmm-dialog-issue", role: "region", "aria-label": t("savedInventory"), children: [_jsx("p", { className: "dsmm-dialog-issue-title", children: t(issueKey(state.issue)) }), _jsx(IssueDetails, { issue: state.issue, t: t }), onJumpToJsonc && (_jsx("div", { className: "dsmm-dialog-issue-action", children: _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: onJumpToJsonc, children: t("jumpToJsonc") }) }))] })), doc === null && (_jsxs("div", { className: "dsmm-structured-invalid", "data-dsmm-structured-invalid": true, children: [_jsx("p", { children: t("rawInvalid") }), _jsx("p", { className: "dsmm-hint", children: t("rawInvalidFormDisabled") }), onJumpToJsonc && (_jsx(Button, { type: "button", variant: "outline", onClick: onJumpToJsonc, children: t("viewConfiguration") }))] })), doc !== null && (_jsxs("div", { className: "dsmm-roles-list dsmm-dialog-roles-list", children: [filteredRoles.length === 0 && (_jsx("p", { className: "dsmm-hint dsmm-no-roles", children: t("noMatchingRoles") })), filteredRoles.map((role) => {
282
+ const roleName = displayRoleLabel(role.label);
244
283
  const policy = doc.roleRouting[role.id] ?? {};
245
284
  const rolePath = ["settings", "roleRouting", role.id];
246
285
  const isOrchestrator = role.id === "dsmm-orchestrator";
@@ -283,8 +322,8 @@ export function ProfileModelsDialog({ open, onClose, state, actions, disabled, d
283
322
  ? t("roleSettingsOverridden")
284
323
  : t("roleSettingsInherited");
285
324
  const nonModelSummary = t("roleSettingsSummary", { status: statusSummary, retry: retrySummary });
286
- return (_jsxs("div", { className: "dsmm-role-card dsmm-dialog-role-card", "data-dsmm-role": role.id, children: [_jsxs("div", { className: "dsmm-role-main-row", children: [_jsx("div", { className: "dsmm-dialog-role-header", children: _jsxs("div", { className: "dsmm-role-title-group", children: [_jsx("span", { className: "dsmm-role-title", children: role.label }), _jsx("code", { className: "dsmm-role-id-badge", children: role.id }), explicitOverride && (_jsx("span", { className: "dsmm-override-badge", children: t("roleSettingsOverridden") }))] }) }), _jsxs("div", { className: "dsmm-role-primary-route", children: [_jsxs("div", { className: "dsmm-field dsmm-primary-mode-field", children: [_jsx("label", { htmlFor: `${prefix}-${role.id}-primary-mode`, children: t("primaryMode", { name: role.label }) }), _jsxs("select", { id: `${prefix}-${role.id}-primary-mode`, disabled: effectiveDisabled, value: policy.primary === undefined ? "inherit" : "explicit", onChange: (event) => actions.editPath([...rolePath, "primary"], event.currentTarget.value === "inherit" ? undefined : { provider: "", model: "" }), children: [_jsx("option", { value: "inherit", children: t("inheritRoute") }), _jsx("option", { value: "explicit", children: t("configuredRoute") })] })] }), policy.primary !== undefined ? (_jsx(RouteFields, { t: t, value: policy.primary, path: [...rolePath, "primary"], name: t("primaryName", { name: role.label }), catalog: state.catalog, disabled: effectiveDisabled, edit: actions.editPath, editRoute: actions.editRoute, naturalLabels: true })) : (_jsx("div", { className: "dsmm-route-inherited-hint", children: _jsx("span", { children: t("inheritRouteDesc") }) })), isOrchestrator && (_jsx("span", { className: "dsmm-orchestrator-tag", children: t("orchestratorNoLevelsHint") }))] })] }), _jsxs("div", { className: "dsmm-role-details-bar", children: [!isOrchestrator && (_jsxs("details", { className: "dsmm-role-levels-details dsmm-compact-details", "data-dsmm-details": "levels", children: [_jsxs("summary", { className: "dsmm-details-summary dsmm-details-pill", children: [_jsxs("span", { className: "dsmm-pill-label", children: [t("callingLevels"), ":"] }), _jsx("span", { className: "dsmm-pill-val", children: levelsSummary })] }), _jsxs("div", { className: "dsmm-details-content", children: [_jsx("p", { className: "dsmm-hint", children: t("levelsHint") }), ["low", "high", "max"].map((level) => (_jsx(LevelFields, { level: level, value: policy.levels?.[level], path: [...rolePath, "levels", level], catalog: state.catalog, disabled: effectiveDisabled, actions: actions, t: t }, level)))] })] })), _jsxs("details", { className: "dsmm-role-fallback-details dsmm-compact-details", "data-dsmm-details": "fallback", children: [_jsxs("summary", { className: "dsmm-details-summary dsmm-details-pill", children: [_jsxs("span", { className: "dsmm-pill-label", children: [t("fallbackRoutes"), ":"] }), _jsx("span", { className: "dsmm-pill-val", children: fallbackSummary })] }), _jsxs("div", { className: "dsmm-details-content", children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-${role.id}-fallback-mode`, children: t("fallbackMode", { name: role.label }) }), _jsxs("select", { id: `${prefix}-${role.id}-fallback-mode`, disabled: effectiveDisabled, value: policy.fallbackRoutes === undefined ? "inherit" : "explicit", onChange: (event) => actions.editPath([...rolePath, "fallbackRoutes"], event.currentTarget.value === "inherit" ? undefined : []), children: [_jsx("option", { value: "inherit", children: t("inheritChain") }), _jsx("option", { value: "explicit", children: t("configuredChain") })] })] }), policy.fallbackRoutes?.length === 0 && (_jsx("p", { className: "dsmm-hint", children: t("emptyChain") })), policy.fallbackRoutes?.map((candidate, index) => {
287
- const name = t("fallbackName", { name: role.label, index: index + 1 });
325
+ return (_jsxs("div", { className: "dsmm-role-card dsmm-dialog-role-card", "data-dsmm-role": role.id, children: [_jsxs("div", { className: "dsmm-role-main-row", children: [_jsx("div", { className: "dsmm-dialog-role-header", children: _jsxs("div", { className: "dsmm-role-title-group", children: [_jsx("span", { className: "dsmm-role-title", children: roleName }), _jsx("code", { className: "dsmm-role-id-badge", children: role.id }), explicitOverride && (_jsx("span", { className: "dsmm-override-badge", children: t("roleSettingsOverridden") }))] }) }), _jsxs("div", { className: "dsmm-role-primary-route", children: [_jsxs("div", { className: "dsmm-field dsmm-primary-mode-field", children: [_jsx("label", { htmlFor: `${prefix}-${role.id}-primary-mode`, children: t("primaryMode", { name: roleName }) }), _jsxs("select", { id: `${prefix}-${role.id}-primary-mode`, disabled: effectiveDisabled, value: policy.primary === undefined ? "inherit" : "explicit", onChange: (event) => actions.editPath([...rolePath, "primary"], event.currentTarget.value === "inherit" ? undefined : { provider: "", model: "" }), children: [_jsx("option", { value: "inherit", children: t("inheritRoute") }), _jsx("option", { value: "explicit", children: t("configuredRoute") })] })] }), policy.primary !== undefined ? (_jsx(RouteFields, { t: t, value: policy.primary, path: [...rolePath, "primary"], name: t("primaryName", { name: roleName }), catalog: state.catalog, disabled: effectiveDisabled, edit: actions.editPath, editRoute: actions.editRoute, naturalLabels: true })) : (_jsx("div", { className: "dsmm-route-inherited-hint", children: _jsx("span", { children: t("inheritRouteDesc") }) })), isOrchestrator && (_jsx("span", { className: "dsmm-orchestrator-tag", children: t("orchestratorNoLevelsHint") }))] })] }), _jsxs("div", { className: "dsmm-role-details-bar", children: [!isOrchestrator && (_jsxs("details", { className: "dsmm-role-levels-details dsmm-compact-details", "data-dsmm-details": "levels", children: [_jsxs("summary", { className: "dsmm-details-summary dsmm-details-pill", children: [_jsxs("span", { className: "dsmm-pill-label", children: [t("callingLevels"), ":"] }), _jsx("span", { className: "dsmm-pill-val", children: levelsSummary })] }), _jsxs("div", { className: "dsmm-details-content", children: [_jsx("p", { className: "dsmm-hint", children: t("levelsHint") }), ["low", "high", "max"].map((level) => (_jsx(LevelFields, { level: level, value: policy.levels?.[level], path: [...rolePath, "levels", level], catalog: state.catalog, disabled: effectiveDisabled, actions: actions, t: t }, level)))] })] })), _jsxs("details", { className: "dsmm-role-fallback-details dsmm-compact-details", "data-dsmm-details": "fallback", children: [_jsxs("summary", { className: "dsmm-details-summary dsmm-details-pill", children: [_jsxs("span", { className: "dsmm-pill-label", children: [t("fallbackRoutes"), ":"] }), _jsx("span", { className: "dsmm-pill-val", children: fallbackSummary })] }), _jsxs("div", { className: "dsmm-details-content", children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-${role.id}-fallback-mode`, children: t("fallbackMode", { name: roleName }) }), _jsxs("select", { id: `${prefix}-${role.id}-fallback-mode`, disabled: effectiveDisabled, value: policy.fallbackRoutes === undefined ? "inherit" : "explicit", onChange: (event) => actions.editPath([...rolePath, "fallbackRoutes"], event.currentTarget.value === "inherit" ? undefined : []), children: [_jsx("option", { value: "inherit", children: t("inheritChain") }), _jsx("option", { value: "explicit", children: t("configuredChain") })] })] }), policy.fallbackRoutes?.length === 0 && (_jsx("p", { className: "dsmm-hint", children: t("emptyChain") })), policy.fallbackRoutes?.map((candidate, index) => {
326
+ const name = t("fallbackName", { name: roleName, index: index + 1 });
288
327
  return (_jsxs("fieldset", { className: "dsmm-fallback-item", "data-dsmm-fallback-index": index, children: [_jsx("legend", { children: name }), _jsx(RouteFields, { t: t, value: candidate, path: [...rolePath, "fallbackRoutes", index], name: name, catalog: state.catalog, disabled: effectiveDisabled, edit: actions.editPath, editRoute: actions.editRoute, naturalLabels: true }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", "data-dsmm-action": "moveUp", disabled: effectiveDisabled || index === 0, onClick: () => {
289
328
  pendingFallbackFocusRef.current = { roleId: role.id, index: index - 1, action: "moveUp" };
290
329
  actions.moveFallback(role.id, index, index - 1);
@@ -309,10 +348,10 @@ export function ProfileModelsDialog({ open, onClose, state, actions, disabled, d
309
348
  else {
310
349
  actions.editPath([...rolePath, "fallbackRoutes", policy.fallbackRoutes.length], { provider: "", model: "" });
311
350
  }
312
- }, children: t("addFallback", { name: role.label }) })] })] }), _jsxs("details", { className: "dsmm-role-nonmodel-details dsmm-compact-details", "data-dsmm-details": "non-model", children: [_jsxs("summary", { className: "dsmm-details-summary dsmm-details-pill", children: [_jsxs("span", { className: "dsmm-pill-label", children: [t("roleNonModelSettings"), ":"] }), _jsx("span", { className: "dsmm-pill-val", children: nonModelSummary })] }), _jsxs("div", { className: "dsmm-details-content", children: [_jsx(RoleAvailability, { value: role.availability, t: t }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-${role.id}-role-enabled`, children: t("namedRole", { name: role.label }) }), _jsxs("select", { id: `${prefix}-${role.id}-role-enabled`, value: namedRoles?.[role.id] === undefined ? "" : String(namedRoles[role.id]), disabled: effectiveDisabled, "aria-describedby": `${prefix}-${role.id}-role-hint`, onChange: (event) => actions.editPath(["settings", "roles", role.id], event.currentTarget.value === "" ? undefined : event.currentTarget.value === "true"), children: [_jsx("option", { value: "", children: t("inherit") }), _jsx("option", { value: "true", disabled: availability === undefined ||
351
+ }, children: t("addFallback", { name: roleName }) })] })] }), _jsxs("details", { className: "dsmm-role-nonmodel-details dsmm-compact-details", "data-dsmm-details": "non-model", children: [_jsxs("summary", { className: "dsmm-details-summary dsmm-details-pill", children: [_jsxs("span", { className: "dsmm-pill-label", children: [t("roleNonModelSettings"), ":"] }), _jsx("span", { className: "dsmm-pill-val", children: nonModelSummary })] }), _jsxs("div", { className: "dsmm-details-content", children: [_jsx(RoleAvailability, { value: role.availability, t: t }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-${role.id}-role-enabled`, children: t("namedRole", { name: roleName }) }), _jsxs("select", { id: `${prefix}-${role.id}-role-enabled`, value: namedRoles?.[role.id] === undefined ? "" : String(namedRoles[role.id]), disabled: effectiveDisabled, "aria-describedby": `${prefix}-${role.id}-role-hint`, onChange: (event) => actions.editPath(["settings", "roles", role.id], event.currentTarget.value === "" ? undefined : event.currentTarget.value === "true"), children: [_jsx("option", { value: "", children: t("inherit") }), _jsx("option", { value: "true", disabled: availability === undefined ||
313
352
  !availability.startupAvailable ||
314
353
  !availability.deploymentEnabled ||
315
- availability.reason === "module-off", children: t("enabled") }), _jsx("option", { value: "false", disabled: availability === undefined || availability.required, children: t("disabled") })] }), _jsx("p", { id: `${prefix}-${role.id}-role-hint`, className: "dsmm-hint", children: t("namedRoleHint") })] }), _jsx(PolicyFields, { t: t, value: policy, inherited: inherited, path: rolePath, name: role.label, disabled: effectiveDisabled, actions: actions })] })] })] })] }, role.id));
354
+ availability.reason === "module-off", children: t("enabled") }), _jsx("option", { value: "false", disabled: availability === undefined || availability.required, children: t("disabled") })] }), _jsx("p", { id: `${prefix}-${role.id}-role-hint`, className: "dsmm-hint", children: t("namedRoleHint") })] }), _jsx(PolicyFields, { t: t, value: policy, inherited: inherited, path: rolePath, name: roleName, disabled: effectiveDisabled, actions: actions })] })] })] })] }, role.id));
316
355
  })] }))] }));
317
356
  }
318
357
  //# sourceMappingURL=ProfileModelsDialog.js.map
@@ -42,6 +42,7 @@ export function ProfilesSection(props) {
42
42
  const hadConfirmation = useRef(false);
43
43
  const initiatorRef = useRef(null);
44
44
  const dialogInitiatorRef = useRef(null);
45
+ const saveBarRef = useRef(null);
45
46
  const orchestratorRef = useRef(null);
46
47
  const sessionScopeRef = useRef(null);
47
48
  const [modelsDialogOpen, setModelsDialogOpen] = useState(false);
@@ -68,6 +69,7 @@ export function ProfilesSection(props) {
68
69
  }
69
70
  const basicDoc = structuredDoc ?? (lastValidBasicDocRef.current !== null && lastValidBasicDocRef.current.id === editor?.id && lastValidBasicDocRef.current.epoch === state.editorEpoch ? lastValidBasicDocRef.current.doc : null);
70
71
  const rawInvalid = editor !== null && structuredDoc === null;
72
+ const canSave = !editorDisabled && state.dirty && snapshot !== null && state.invalidFields.length === 0 && !rawInvalid;
71
73
  function focusJsonc(location) {
72
74
  if (advancedRef.current !== null) {
73
75
  advancedRef.current.open = true;
@@ -183,6 +185,34 @@ export function ProfilesSection(props) {
183
185
  else if (snapshot?.selectedId !== null && snapshot?.selectedId !== undefined)
184
186
  selection = t("appliedProfile", { id: snapshot.selectedId, revision: t(configurationVersionState(snapshot.sourceRevision)) });
185
187
  const notice = state.notice === null ? "" : t(state.notice.key === "reset" ? "resetDone" : state.notice.key, { id: state.notice.id });
188
+ useEffect(() => {
189
+ const el = saveBarRef.current;
190
+ if (!el)
191
+ return;
192
+ const parent = el.closest(".dsmm-editor");
193
+ const update = () => {
194
+ const height = el.offsetHeight;
195
+ if (parent) {
196
+ parent.style.setProperty("--dsmm-save-bar-offset", `${height}px`);
197
+ }
198
+ };
199
+ update();
200
+ if (typeof ResizeObserver !== "undefined") {
201
+ const ro = new ResizeObserver(update);
202
+ ro.observe(el);
203
+ return () => {
204
+ ro.disconnect();
205
+ if (parent) {
206
+ parent.style.removeProperty("--dsmm-save-bar-offset");
207
+ }
208
+ };
209
+ }
210
+ return () => {
211
+ if (parent) {
212
+ parent.style.removeProperty("--dsmm-save-bar-offset");
213
+ }
214
+ };
215
+ }, [editor?.id, state.dirty, state.invalidFields.length, rawInvalid, invalid]);
186
216
  const warnings = editor === null ? [] : draftWarnings(editor.content);
187
217
  return _jsxs("section", { className: "dsmm-profiles dsmm-named-profiles", "aria-label": t("title"), "aria-busy": state.busy !== null, children: [readOnly && _jsx("p", { role: "status", className: "dsmm-hint", children: t("readOnlyOrigin") }), _jsx("h2", { children: t("title") }), _jsx("p", { className: "dsmm-hint", children: t("description") }), _jsxs("div", { className: "dsmm-browse-row", children: [snapshot !== null && _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-select`, children: t("editorSelect") }), _jsxs("select", { ref: selectRef, id: `${prefix}-select`, disabled: disabled, value: editor?.revision == null ? "" : editor.id, onChange: (event) => { initiatorRef.current = event.currentTarget; if (event.currentTarget.value)
188
218
  void props.open(event.currentTarget.value); }, children: [_jsx("option", { value: "", children: t(editor?.revision === null ? "newDraft" : "choose") }), snapshot.profiles.map((profile, index) => _jsxs("option", { value: profile.id, children: [profile.label?.trim() ? `${profile.label} (${profile.id})` : profile.id, profile.error === undefined ? "" : ` — ${t("invalidProfile", { id: profile.id })}`, profile.warnings?.length ? ` — ${t("warningProfile")}` : ""] }, `${index}:${profile.id}`))] })] }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || snapshot === null, onClick: (event) => { initiatorRef.current = event.currentTarget; void props.create(); }, children: t("new") }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: (event) => { initiatorRef.current = event.currentTarget; void props.refresh(); }, children: t(state.busy === "refresh" ? "refreshing" : "refresh") })] }), editor !== null && _jsx("p", { className: "dsmm-badge", "data-dsmm-editor-state": state.invalidFields.length > 0 || invalid || rawInvalid ? "invalid" : state.dirty ? "dirty" : readOnly ? "readonly" : "ready", children: t(editor.refreshRequired ? "savedRefreshRequired" : state.invalidFields.length > 0 || invalid || rawInvalid ? "validation" : state.dirty ? "dirty" : applied ? "savedApplied" : relationship === "unknown" ? "savedRelationshipUnknown" : "savedNotApplied") })] }), snapshot?.profiles.length === 0 && _jsx("p", { className: "dsmm-hint", children: t("empty") }), snapshot !== null && snapshot.profiles.some(profile => profile.error !== undefined || profile.warnings?.length) && _jsx("ul", { className: "dsmm-profile-list", "aria-label": t("savedInventory"), children: snapshot.profiles.filter(profile => profile.error !== undefined || profile.warnings?.length).map((profile, index) => _jsxs("li", { children: [_jsx("p", { children: profile.label?.trim() ? `${profile.label} (${profile.id})` : profile.id }), _jsx(ProfileWarnings, { warnings: profile.warnings, t: t }), profile.error !== undefined && _jsx(IssueDetails, { issue: profile.error, t: t })] }, `${index}:${profile.id}`)) }), state.pendingEditor !== null && _jsxs("div", { className: "dsmm-confirm", role: "group", "aria-labelledby": `${prefix}-confirm`, onKeyDown: (event) => { if (event.key === "Escape") {
@@ -195,22 +225,7 @@ export function ProfilesSection(props) {
195
225
  }
196
226
  const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
197
227
  sessionScopeRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
198
- }, children: t("locateSessionScope") })] }), _jsx(SessionScopeFeedback, { state: state, t: t }), _jsxs("details", { ref: moreActionsRef, className: "dsmm-more-actions", open: moreActionsOpenRef.current || undefined, onToggle: e => { moreActionsOpenRef.current = e.currentTarget.open; }, children: [_jsx("summary", { children: t("moreActions") }), _jsxs("div", { children: [_jsxs("div", { children: [_jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || !reconcilable || (snapshot?.selectedId === null && !selectionConflict), onClick: () => { void props.reset(); }, children: t(state.busy === "reset" ? "resetting" : "reset") }), _jsx("p", { className: "dsmm-hint", children: t("futureResetHint") })] }), _jsx("div", { ref: sessionScopeRef, children: _jsx(SessionScope, { state: state, actions: props, t: t, showFeedback: false }) })] })] })] }), editor === null && _jsx("p", { className: "dsmm-hint", children: t("noEditor") }), editor !== null && _jsxs("div", { className: "dsmm-editor", children: [warnings.length > 0 && _jsxs("div", { children: [_jsx("p", { children: t("draftWarnings") }), _jsx(ProfileWarnings, { warnings: warnings, t: t })] }), editor.warnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("savedWarnings") }), _jsx(ProfileWarnings, { warnings: editor.warnings, t: t })] }) : null, _jsxs("div", { className: "dsmm-catalog", children: [state.catalogUnavailable && _jsx("p", { className: "dsmm-hint", children: t("catalogUnavailable") }), state.catalog?.failures.map((failure) => _jsx("p", { className: "dsmm-hint", children: t("catalogFailure", { name: failure.name, id: failure.id }) }, failure.id)), _jsx(Button, { type: "button", variant: "outline", disabled: state.catalogBusy, onClick: () => { void props.refreshCatalog(); }, children: t(state.catalogBusy ? "catalogRefreshing" : "catalogRefresh") })] }), _jsxs("div", { className: "dsmm-basic-settings", "data-dsmm-basic-settings": true, children: [structuredDoc === null && (_jsxs("div", { className: "dsmm-structured-invalid", "data-dsmm-structured-invalid": true, children: [_jsx("p", { children: t("rawInvalid") }), _jsx("p", { className: "dsmm-hint", children: t("rawInvalidFormDisabled") }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
199
- if (advancedRef.current !== null) {
200
- advancedRef.current.open = true;
201
- jsoncOpenRef.current = true;
202
- }
203
- const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
204
- editorRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
205
- editorRef.current?.focus();
206
- }, children: t("viewConfiguration") })] })), basicDoc !== null && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-label`, children: t("profileLabel") }), _jsx(Input, { ref: labelRef, id: `${prefix}-label`, className: "dsmm-input", value: basicDoc.label ?? "", disabled: editorDisabled || structuredDoc === null, onChange: (event) => props.editPath(["label"], event.currentTarget.value) }), _jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || structuredDoc === null || basicDoc.label === undefined, onClick: () => props.editPath(["label"], undefined), children: t("omitLabel") })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-id`, children: t("profileId") }), _jsx(Input, { ref: inputRef, id: `${prefix}-id`, className: "dsmm-input", value: editor.id, disabled: editorDisabled || structuredDoc === null || editor.revision !== null, "aria-invalid": idInvalid || undefined, "aria-describedby": `${prefix}-id-hint${idInvalid ? ` ${prefix}-issue` : ""}`, onChange: (event) => props.editId(event.currentTarget.value) }), _jsx("p", { id: `${prefix}-id-hint`, className: "dsmm-hint", children: t("idHint") })] }), _jsxs("div", { ref: orchestratorRef, className: "dsmm-field", id: `${prefix}-orchestrator-primary`, children: [_jsx("label", { htmlFor: `${prefix}-orch-mode`, children: t("orchestratorModel") }), _jsx("p", { className: "dsmm-hint", children: t("orchestratorModelDesc") }), _jsxs("select", { id: `${prefix}-orch-mode`, disabled: editorDisabled || structuredDoc === null || !hasOrchestrator, "aria-describedby": !hasOrchestrator ? `${prefix}-orch-unavailable` : undefined, value: basicDoc.roleRouting["dsmm-orchestrator"]?.primary === undefined ? "inherit" : "explicit", onChange: (event) => props.editPath(["settings", "roleRouting", "dsmm-orchestrator", "primary"], event.currentTarget.value === "inherit" ? undefined : { provider: "", model: "" }), children: [_jsx("option", { value: "inherit", children: t("inheritRoute") }), _jsx("option", { value: "explicit", children: t("configuredRoute") })] }), !hasOrchestrator && _jsx("p", { className: "dsmm-hint", id: `${prefix}-orch-unavailable`, children: t("orchestratorUnavailable") }), basicDoc.roleRouting["dsmm-orchestrator"]?.primary !== undefined && (_jsx(RouteFields, { t: t, value: basicDoc.roleRouting["dsmm-orchestrator"].primary, path: ["settings", "roleRouting", "dsmm-orchestrator", "primary"], naturalLabels: true, catalog: state.catalog, disabled: editorDisabled || structuredDoc === null || !hasOrchestrator, edit: props.editPath, editRoute: props.editRoute })), _jsx("p", { className: "dsmm-hint", children: t("effortChangeHint") })] }), _jsxs("div", { className: "dsmm-field dsmm-configure-models-field", children: [_jsx("label", { children: t("configureAllAgentModels") }), _jsx("p", { className: "dsmm-hint", children: t("modelsDialogDesc") }), _jsx("div", { children: _jsx(Button, { type: "button", variant: "outline", className: "dsmm-open-models-dialog-btn", disabled: editorDisabled || structuredDoc === null, onClick: (event) => {
207
- dialogInitiatorRef.current = event.currentTarget;
208
- setModelsDialogOpen(true);
209
- }, children: t("configureAllAgentModels") }) })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-locale`, children: t("businessLocale") }), _jsxs("select", { id: `${prefix}-locale`, value: String(basicDoc.settings.locale ?? ""), disabled: editorDisabled || structuredDoc === null, "aria-describedby": `${prefix}-locale-hint`, onChange: (event) => props.editPath(["settings", "locale"], event.currentTarget.value || undefined), children: [_jsx("option", { value: "", children: t("inheritLocale") }), typeof basicDoc.settings.locale === "string" && !DSMM_LOCALES.includes(basicDoc.settings.locale) && (_jsx("option", { value: basicDoc.settings.locale, children: t("unsupportedLocale") })), DSMM_LOCALES.map((locale) => (_jsx("option", { value: locale, children: locale }, locale)))] }), _jsx("p", { id: `${prefix}-locale-hint`, className: "dsmm-hint", children: t("localeHint") })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-active`, children: t("defaultActive") }), _jsxs("select", { id: `${prefix}-active`, disabled: editorDisabled || structuredDoc === null, value: basicDoc.settings.defaultActive === undefined ? "" : String(basicDoc.settings.defaultActive), onChange: (event) => props.editPath(["settings", "defaultActive"], event.currentTarget.value === "" ? undefined : event.currentTarget.value === "true"), children: [_jsx("option", { value: "", children: t("inherit") }), _jsx("option", { value: "true", children: t("enabled") }), _jsx("option", { value: "false", children: t("disabled") })] }), _jsx("p", { className: "dsmm-hint", children: t("activeHint") })] })] }))] }, `basic:${state.editorEpoch}`), _jsxs("details", { ref: advancedSettingsRef, className: "dsmm-advanced-settings", open: advancedOpenRef.current || undefined, onToggle: e => { advancedOpenRef.current = e.currentTarget.open; }, children: [_jsx("summary", { children: t("advancedSettings") }), _jsx("div", { children: _jsx(AdvancedSettings, { state: state, actions: props, disabled: editorDisabled, document: basicDoc, isInvalidProjection: rawInvalid, t: t }) })] }, `advanced-settings:${state.editorEpoch}`), _jsxs("details", { ref: advancedRef, className: "dsmm-advanced", open: jsoncOpenRef.current || undefined, onToggle: e => { jsoncOpenRef.current = e.currentTarget.open; }, children: [_jsx("summary", { children: t("configuration") }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-content`, children: t("configuration") }), _jsx("textarea", { ref: editorRef, id: `${prefix}-content`, rows: 12, spellCheck: false, value: editor.content, readOnly: readOnly, disabled: editorDisabled, "aria-invalid": rawInvalid || (invalid && !idInvalid) || undefined, "aria-describedby": `${prefix}-content-hint ${prefix}-structural-hint${invalid && !idInvalid ? ` ${prefix}-issue` : ""}`, onChange: (event) => props.editContent(event.currentTarget.value) }), _jsx("p", { id: `${prefix}-content-hint`, className: "dsmm-hint", children: t("configurationHint") }), _jsx("p", { id: `${prefix}-structural-hint`, className: "dsmm-hint", children: t("structuralHint") })] })] }, `advanced:${state.editorEpoch}`), _jsx(ProfileModelsDialog, { open: modelsDialogOpen, onClose: () => closeModelsDialog("trigger"), state: state, actions: props, disabled: editorDisabled, document: basicDoc, isInvalidProjection: rawInvalid, targetRoleId: targetRole, targetField: targetRoleField, onTargetLocated: () => {
210
- handledValidation.current = state.validationEpoch;
211
- setTargetRole(null);
212
- setTargetRoleField(null);
213
- }, onJumpToJsonc: () => closeModelsDialog("jsonc"), t: t }), _jsxs("div", { className: "dsmm-save-bar", children: [(() => {
228
+ }, children: t("locateSessionScope") })] }), _jsx(SessionScopeFeedback, { state: state, t: t }), _jsxs("details", { ref: moreActionsRef, className: "dsmm-more-actions", open: moreActionsOpenRef.current || undefined, onToggle: e => { moreActionsOpenRef.current = e.currentTarget.open; }, children: [_jsx("summary", { children: t("moreActions") }), _jsxs("div", { children: [_jsxs("div", { children: [_jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || !reconcilable || (snapshot?.selectedId === null && !selectionConflict), onClick: () => { void props.reset(); }, children: t(state.busy === "reset" ? "resetting" : "reset") }), _jsx("p", { className: "dsmm-hint", children: t("futureResetHint") })] }), _jsx("div", { ref: sessionScopeRef, children: _jsx(SessionScope, { state: state, actions: props, t: t, showFeedback: false }) })] })] })] }), editor === null && _jsx("p", { className: "dsmm-hint", children: t("noEditor") }), editor !== null && _jsxs("div", { className: "dsmm-editor", children: [_jsxs("div", { ref: saveBarRef, className: "dsmm-save-bar", children: [_jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: !canSave, onClick: () => { void props.save(); }, children: t(state.busy === "save" ? "saving" : "save") }), _jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || (!state.dirty && state.invalidFields.length === 0), onClick: (event) => { initiatorRef.current = event.currentTarget; props.discard(); }, children: t("discard") }), editor.revision !== null && !state.dirty && _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: (event) => { initiatorRef.current = event.currentTarget; void props.reload(); }, children: t("reload") }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.busy === "refresh" && snapshot === null ? t("loading") : state.busy === "read" ? t("reading") : notice })] }), (() => {
214
229
  const isSaveLocked = (state.dirty || state.invalidFields.length > 0) && !editorDisabled && snapshot !== null && (state.invalidFields.length > 0 || rawInvalid || invalid);
215
230
  if (!isSaveLocked)
216
231
  return null;
@@ -274,6 +289,21 @@ export function ProfilesSection(props) {
274
289
  }
275
290
  }, children: t("jumpToJsonc") }));
276
291
  })()] })] }));
277
- })(), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: editorDisabled || !state.dirty || snapshot === null || state.invalidFields.length > 0 || rawInvalid, onClick: () => { void props.save(); }, children: t(state.busy === "save" ? "saving" : "save") }), _jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || (!state.dirty && state.invalidFields.length === 0), onClick: (event) => { initiatorRef.current = event.currentTarget; props.discard(); }, children: t("discard") }), editor.revision !== null && !state.dirty && _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: (event) => { initiatorRef.current = event.currentTarget; void props.reload(); }, children: t("reload") })] })] })] }), state.issue !== null && !modelsDialogOpen && _jsxs("div", { className: "dsmm-issue", id: `${prefix}-issue`, role: "alert", children: [_jsx("p", { children: t(issueKey(state.issue)) }), _jsx(IssueDetails, { issue: state.issue, t: t })] }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.busy === "refresh" && snapshot === null ? t("loading") : state.busy === "read" ? t("reading") : notice })] });
292
+ })()] }), warnings.length > 0 && _jsxs("div", { children: [_jsx("p", { children: t("draftWarnings") }), _jsx(ProfileWarnings, { warnings: warnings, t: t })] }), editor.warnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("savedWarnings") }), _jsx(ProfileWarnings, { warnings: editor.warnings, t: t })] }) : null, _jsxs("div", { className: "dsmm-catalog", children: [state.catalogUnavailable && _jsx("p", { className: "dsmm-hint", children: t("catalogUnavailable") }), state.catalog?.failures.map((failure) => _jsx("p", { className: "dsmm-hint", children: t("catalogFailure", { name: failure.name, id: failure.id }) }, failure.id)), _jsx(Button, { type: "button", variant: "outline", disabled: state.catalogBusy, onClick: () => { void props.refreshCatalog(); }, children: t(state.catalogBusy ? "catalogRefreshing" : "catalogRefresh") })] }), _jsxs("div", { className: "dsmm-basic-settings", "data-dsmm-basic-settings": true, children: [structuredDoc === null && (_jsxs("div", { className: "dsmm-structured-invalid", "data-dsmm-structured-invalid": true, children: [_jsx("p", { children: t("rawInvalid") }), _jsx("p", { className: "dsmm-hint", children: t("rawInvalidFormDisabled") }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
293
+ if (advancedRef.current !== null) {
294
+ advancedRef.current.open = true;
295
+ jsoncOpenRef.current = true;
296
+ }
297
+ const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
298
+ editorRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
299
+ editorRef.current?.focus();
300
+ }, children: t("viewConfiguration") })] })), basicDoc !== null && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-label`, children: t("profileLabel") }), _jsx(Input, { ref: labelRef, id: `${prefix}-label`, className: "dsmm-input", value: basicDoc.label ?? "", disabled: editorDisabled || structuredDoc === null, onChange: (event) => props.editPath(["label"], event.currentTarget.value) }), _jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || structuredDoc === null || basicDoc.label === undefined, onClick: () => props.editPath(["label"], undefined), children: t("omitLabel") })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-id`, children: t("profileId") }), _jsx(Input, { ref: inputRef, id: `${prefix}-id`, className: "dsmm-input", value: editor.id, disabled: editorDisabled || structuredDoc === null || editor.revision !== null, "aria-invalid": idInvalid || undefined, "aria-describedby": `${prefix}-id-hint${idInvalid ? ` ${prefix}-issue` : ""}`, onChange: (event) => props.editId(event.currentTarget.value) }), _jsx("p", { id: `${prefix}-id-hint`, className: "dsmm-hint", children: t("idHint") })] }), _jsxs("div", { ref: orchestratorRef, className: "dsmm-field", id: `${prefix}-orchestrator-primary`, children: [_jsx("label", { htmlFor: `${prefix}-orch-mode`, children: t("orchestratorModel") }), _jsx("p", { className: "dsmm-hint", children: t("orchestratorModelDesc") }), _jsxs("select", { id: `${prefix}-orch-mode`, disabled: editorDisabled || structuredDoc === null || !hasOrchestrator, "aria-describedby": !hasOrchestrator ? `${prefix}-orch-unavailable` : undefined, value: basicDoc.roleRouting["dsmm-orchestrator"]?.primary === undefined ? "inherit" : "explicit", onChange: (event) => props.editPath(["settings", "roleRouting", "dsmm-orchestrator", "primary"], event.currentTarget.value === "inherit" ? undefined : { provider: "", model: "" }), children: [_jsx("option", { value: "inherit", children: t("inheritRoute") }), _jsx("option", { value: "explicit", children: t("configuredRoute") })] }), !hasOrchestrator && _jsx("p", { className: "dsmm-hint", id: `${prefix}-orch-unavailable`, children: t("orchestratorUnavailable") }), basicDoc.roleRouting["dsmm-orchestrator"]?.primary !== undefined && (_jsx(RouteFields, { t: t, value: basicDoc.roleRouting["dsmm-orchestrator"].primary, path: ["settings", "roleRouting", "dsmm-orchestrator", "primary"], naturalLabels: true, catalog: state.catalog, disabled: editorDisabled || structuredDoc === null || !hasOrchestrator, edit: props.editPath, editRoute: props.editRoute })), _jsx("p", { className: "dsmm-hint", children: t("effortChangeHint") })] }), _jsxs("div", { className: "dsmm-field dsmm-configure-models-field", children: [_jsx("label", { children: t("configureAllAgentModels") }), _jsx("p", { className: "dsmm-hint", children: t("modelsDialogDesc") }), _jsx("div", { children: _jsx(Button, { type: "button", variant: "outline", className: "dsmm-open-models-dialog-btn", disabled: editorDisabled || structuredDoc === null, onClick: (event) => {
301
+ dialogInitiatorRef.current = event.currentTarget;
302
+ setModelsDialogOpen(true);
303
+ }, children: t("configureAllAgentModels") }) })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-locale`, children: t("businessLocale") }), _jsxs("select", { id: `${prefix}-locale`, value: String(basicDoc.settings.locale ?? ""), disabled: editorDisabled || structuredDoc === null, "aria-describedby": `${prefix}-locale-hint`, onChange: (event) => props.editPath(["settings", "locale"], event.currentTarget.value || undefined), children: [_jsx("option", { value: "", children: t("inheritLocale") }), typeof basicDoc.settings.locale === "string" && !DSMM_LOCALES.includes(basicDoc.settings.locale) && (_jsx("option", { value: basicDoc.settings.locale, children: t("unsupportedLocale") })), DSMM_LOCALES.map((locale) => (_jsx("option", { value: locale, children: locale }, locale)))] }), _jsx("p", { id: `${prefix}-locale-hint`, className: "dsmm-hint", children: t("localeHint") })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-active`, children: t("defaultActive") }), _jsxs("select", { id: `${prefix}-active`, disabled: editorDisabled || structuredDoc === null, value: basicDoc.settings.defaultActive === undefined ? "" : String(basicDoc.settings.defaultActive), onChange: (event) => props.editPath(["settings", "defaultActive"], event.currentTarget.value === "" ? undefined : event.currentTarget.value === "true"), children: [_jsx("option", { value: "", children: t("inherit") }), _jsx("option", { value: "true", children: t("enabled") }), _jsx("option", { value: "false", children: t("disabled") })] }), _jsx("p", { className: "dsmm-hint", children: t("activeHint") })] })] }))] }, `basic:${state.editorEpoch}`), _jsxs("details", { ref: advancedSettingsRef, className: "dsmm-advanced-settings", open: advancedOpenRef.current || undefined, onToggle: e => { advancedOpenRef.current = e.currentTarget.open; }, children: [_jsx("summary", { children: t("advancedSettings") }), _jsx("div", { children: _jsx(AdvancedSettings, { state: state, actions: props, disabled: editorDisabled, document: basicDoc, isInvalidProjection: rawInvalid, t: t }) })] }, `advanced-settings:${state.editorEpoch}`), _jsxs("details", { ref: advancedRef, className: "dsmm-advanced", open: jsoncOpenRef.current || undefined, onToggle: e => { jsoncOpenRef.current = e.currentTarget.open; }, children: [_jsx("summary", { children: t("configuration") }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-content`, children: t("configuration") }), _jsx("textarea", { ref: editorRef, id: `${prefix}-content`, rows: 12, spellCheck: false, value: editor.content, readOnly: readOnly, disabled: editorDisabled, "aria-invalid": rawInvalid || (invalid && !idInvalid) || undefined, "aria-describedby": `${prefix}-content-hint ${prefix}-structural-hint${invalid && !idInvalid ? ` ${prefix}-issue` : ""}`, onChange: (event) => props.editContent(event.currentTarget.value) }), _jsx("p", { id: `${prefix}-content-hint`, className: "dsmm-hint", children: t("configurationHint") }), _jsx("p", { id: `${prefix}-structural-hint`, className: "dsmm-hint", children: t("structuralHint") })] })] }, `advanced:${state.editorEpoch}`), _jsx(ProfileModelsDialog, { open: modelsDialogOpen, onClose: () => closeModelsDialog("trigger"), state: state, actions: props, disabled: editorDisabled, document: basicDoc, isInvalidProjection: rawInvalid, targetRoleId: targetRole, targetField: targetRoleField, onTargetLocated: () => {
304
+ handledValidation.current = state.validationEpoch;
305
+ setTargetRole(null);
306
+ setTargetRoleField(null);
307
+ }, onJumpToJsonc: () => closeModelsDialog("jsonc"), canSave: canSave, t: t })] }), state.issue !== null && !modelsDialogOpen && _jsxs("div", { className: "dsmm-issue", id: `${prefix}-issue`, role: "alert", children: [_jsx("p", { children: t(issueKey(state.issue)) }), _jsx(IssueDetails, { issue: state.issue, t: t })] }), editor === null && _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.busy === "refresh" && snapshot === null ? t("loading") : state.busy === "read" ? t("reading") : notice })] });
278
308
  }
279
309
  //# sourceMappingURL=ProfilesSection.js.map
@@ -21,7 +21,7 @@ export declare const roleToolEn: {
21
21
  readonly output: "Complete result content";
22
22
  readonly failure: "Error details";
23
23
  readonly metadata: "Invocation metadata";
24
- readonly inspect: "Inspect tool call";
24
+ readonly inspect: "View call details";
25
25
  readonly copy: "Copy";
26
26
  readonly copied: "Copied";
27
27
  readonly emptyArgs: "Arguments not available yet";
@@ -7,7 +7,7 @@ export const roleToolEn = {
7
7
  background: "Background", error: "Failed", stopped: "Interrupted",
8
8
  technicalDetails: "Technical details",
9
9
  args: "Original arguments", preparingArgs: "Arguments received so far", output: "Complete result content", failure: "Error details", metadata: "Invocation metadata",
10
- inspect: "Inspect tool call", copy: "Copy", copied: "Copied", emptyArgs: "Arguments not available yet",
10
+ inspect: "View call details", copy: "Copy", copied: "Copied", emptyArgs: "Arguments not available yet",
11
11
  unavailable: "Actual identity unavailable; requested identity only", level: "Level", route: "Reported route", routeSource: "Route source",
12
12
  table: "Table", json: "JSON", viewMode: "View mode", property: "Property", value: "Value",
13
13
  };
@@ -19,7 +19,7 @@ export const roleToolZh = {
19
19
  background: "后台调用", error: "失败", stopped: "已中断",
20
20
  technicalDetails: "技术详情",
21
21
  args: "原始参数", preparingArgs: "目前已收到的参数", output: "完整结果内容", failure: "错误详情", metadata: "调用元数据",
22
- inspect: "检查工具调用", copy: "复制", copied: "已复制", emptyArgs: "参数尚不可用",
22
+ inspect: "查看调用详情", copy: "复制", copied: "已复制", emptyArgs: "参数尚不可用",
23
23
  unavailable: "实际身份不可用,仅显示请求身份", level: "等级", route: "报告的路由", routeSource: "路由来源",
24
24
  table: "表格", json: "JSON", viewMode: "视图模式", property: "属性", value: "值",
25
25
  };