@dsmm/dsmm 0.3.12 → 0.3.13

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.
@@ -1,22 +1,29 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useId, useRef } from "react";
2
+ import { useEffect, useId, useRef, useState } from "react";
3
3
  import { Button, Input } from "@deepseek-ai/dsh-client-ui-primitives";
4
4
  import { canReconcileSelection } from "./controller.js";
5
5
  import { AdvancedSettings, RouteFields } from "./StructuredEditor.js";
6
+ import { ProfileModelsDialog } from "./ProfileModelsDialog.js";
6
7
  import { SessionScope, SessionScopeFeedback } from "./SessionProfiles.js";
7
8
  import { sessionProfileLabels } from "./session-labels.js";
8
9
  import { structuredDocument } from "./structured.js";
9
- import { draftWarnings, IssueDetails, ProfileWarnings } from "./diagnostics.js";
10
+ import { draftWarnings, IssueDetails, issueKey, ProfileWarnings } from "./diagnostics.js";
10
11
  import { configurationVersionState, sourceRelationship } from "./configuration-display.js";
11
12
  import { DSMM_LOCALES } from "../profile-locale.js";
12
- function issueKey(issue) {
13
- if (issue.source === "selection")
14
- return issue.code === "conflict" ? "selectionConflict" : "appliedInvalid";
15
- if (issue.kind === "assembly")
16
- return "unavailable";
17
- if (issue.kind === "transport")
18
- return "transport";
19
- return issue.code === "conflict" || issue.code === "validation" ? issue.code : "io";
13
+ import { DSMM_RATE_LIMIT_BOUNDS } from "../routing-policy.js";
14
+ function locateGlobalField(container, field) {
15
+ const path = field.replace(/^settings\./, "");
16
+ const selectors = {
17
+ "runtimePolicy.strategy": "select[id$='-strategy']",
18
+ "guards.gitWriteGuard": "select[id$='-git-guard']",
19
+ "guards.gitWriteScope": "select[id$='-git-scope']",
20
+ "subagents.toolTopology": "select[id$='-topology']",
21
+ };
22
+ const rateLimit = /^runtimePolicy\.rateLimit\.([a-zA-Z]+)$/.exec(path);
23
+ const selector = rateLimit && Object.hasOwn(DSMM_RATE_LIMIT_BOUNDS, rateLimit[1])
24
+ ? `input[data-dsmm-policy-field='${rateLimit[1]}']`
25
+ : Object.hasOwn(selectors, path) ? selectors[path] : undefined;
26
+ return selector === undefined ? null : container.querySelector(selector);
20
27
  }
21
28
  /** One native settings.section; policy selection is never coupled to browsing. */
22
29
  export function ProfilesSection(props) {
@@ -34,8 +41,13 @@ export function ProfilesSection(props) {
34
41
  const cancelRef = useRef(null);
35
42
  const hadConfirmation = useRef(false);
36
43
  const initiatorRef = useRef(null);
44
+ const dialogInitiatorRef = useRef(null);
37
45
  const orchestratorRef = useRef(null);
38
46
  const sessionScopeRef = useRef(null);
47
+ const [modelsDialogOpen, setModelsDialogOpen] = useState(false);
48
+ const [targetRole, setTargetRole] = useState(null);
49
+ const [targetRoleField, setTargetRoleField] = useState(null);
50
+ const pendingDialogFocus = useRef(null);
39
51
  const advancedOpenRef = useRef(false);
40
52
  const jsoncOpenRef = useRef(false);
41
53
  const moreActionsOpenRef = useRef(false);
@@ -51,11 +63,68 @@ export function ProfilesSection(props) {
51
63
  const idInvalid = invalid && state.issue?.field === "id" && state.issue.location === undefined && editor?.revision === null && !editorDisabled;
52
64
  const structuredDoc = editor === null ? null : structuredDocument(editor.content);
53
65
  const lastValidBasicDocRef = useRef(null);
54
- if (structuredDoc !== null) {
55
- lastValidBasicDocRef.current = structuredDoc;
66
+ if (editor !== null && structuredDoc !== null) {
67
+ lastValidBasicDocRef.current = { id: editor.id, epoch: state.editorEpoch, doc: structuredDoc };
56
68
  }
57
- const basicDoc = structuredDoc ?? lastValidBasicDocRef.current;
69
+ const basicDoc = structuredDoc ?? (lastValidBasicDocRef.current !== null && lastValidBasicDocRef.current.id === editor?.id && lastValidBasicDocRef.current.epoch === state.editorEpoch ? lastValidBasicDocRef.current.doc : null);
58
70
  const rawInvalid = editor !== null && structuredDoc === null;
71
+ function focusJsonc(location) {
72
+ if (advancedRef.current !== null) {
73
+ advancedRef.current.open = true;
74
+ jsoncOpenRef.current = true;
75
+ }
76
+ const input = editorRef.current;
77
+ if (input === null)
78
+ return false;
79
+ const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
80
+ input.scrollIntoView?.({ behavior: reducedMotion ? "auto" : "smooth", block: "nearest" });
81
+ input.focus();
82
+ if (input.ownerDocument.activeElement !== input)
83
+ return false;
84
+ if (location !== undefined && location.offset + location.length <= input.value.length) {
85
+ input.setSelectionRange(location.offset, location.offset + location.length);
86
+ }
87
+ return true;
88
+ }
89
+ function focusGlobalField(field) {
90
+ const container = advancedSettingsRef.current;
91
+ if (container === null)
92
+ return false;
93
+ const target = locateGlobalField(container, field);
94
+ if (target === null)
95
+ return false;
96
+ container.open = true;
97
+ advancedOpenRef.current = true;
98
+ const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
99
+ target.scrollIntoView?.({ behavior: reducedMotion ? "auto" : "smooth", block: "nearest" });
100
+ target.focus();
101
+ return target.ownerDocument.activeElement === target;
102
+ }
103
+ function closeModelsDialog(kind) {
104
+ pendingDialogFocus.current = { kind, editorEpoch: state.editorEpoch, validationEpoch: state.validationEpoch,
105
+ issue: state.issue, trigger: dialogInitiatorRef.current };
106
+ setModelsDialogOpen(false);
107
+ setTargetRole(null);
108
+ setTargetRoleField(null);
109
+ }
110
+ // Passive effect cleanup restores Modal isolation before the new focus destination runs.
111
+ useEffect(() => {
112
+ if (modelsDialogOpen)
113
+ return;
114
+ const pending = pendingDialogFocus.current;
115
+ if (pending === null)
116
+ return;
117
+ pendingDialogFocus.current = null;
118
+ if (pending.editorEpoch !== state.editorEpoch || pending.validationEpoch !== state.validationEpoch || pending.issue !== state.issue)
119
+ return;
120
+ if (pending.kind === "jsonc") {
121
+ if (focusJsonc(pending.issue?.location))
122
+ handledValidation.current = pending.validationEpoch;
123
+ }
124
+ else if (pending.trigger?.isConnected) {
125
+ pending.trigger.focus();
126
+ }
127
+ }, [modelsDialogOpen, state.editorEpoch, state.validationEpoch, state.issue]);
59
128
  useEffect(() => {
60
129
  if (state.pendingEditor !== null) {
61
130
  cancelRef.current?.focus();
@@ -73,33 +142,39 @@ export function ProfilesSection(props) {
73
142
  }, [state.pendingEditor]);
74
143
  useEffect(() => {
75
144
  if (state.busy === null && state.validationEpoch > handledValidation.current && state.issue?.kind === "domain" && state.issue.code === "validation") {
76
- handledValidation.current = state.validationEpoch;
77
145
  const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
78
146
  const scrollOpt = { behavior: reducedMotion ? "auto" : "smooth", block: "nearest" };
79
- if (state.issue.location === undefined && state.issue.field === "id" && inputRef.current !== null
147
+ // Case 1: ID field
148
+ if (state.issue.location === undefined && (state.issue.field === "id" || state.issue.field === "newId") && inputRef.current !== null
80
149
  && !inputRef.current.disabled && !inputRef.current.readOnly) {
150
+ handledValidation.current = state.validationEpoch;
81
151
  if (typeof inputRef.current.scrollIntoView === "function")
82
152
  inputRef.current.scrollIntoView(scrollOpt);
83
153
  inputRef.current.focus();
154
+ return;
84
155
  }
85
- else {
86
- if (advancedRef.current !== null) {
87
- advancedRef.current.open = true;
88
- jsoncOpenRef.current = true;
89
- }
90
- const input = editorRef.current;
91
- if (input !== null) {
92
- if (typeof input.scrollIntoView === "function")
93
- input.scrollIntoView(scrollOpt);
94
- input.focus();
95
- const location = state.issue.location;
96
- if (location !== undefined && location.offset + location.length <= input.value.length) {
97
- input.setSelectionRange(location.offset, location.offset + location.length);
98
- }
99
- }
156
+ // Case 2: Role field that maps to snapshot role
157
+ const field = state.issue.field ?? "";
158
+ const roleMatch = /^(?:settings\.)?(?:roleRouting|roles)\.([a-zA-Z0-9_-]+)(?:\.|$)/.exec(field);
159
+ const roleId = roleMatch?.[1];
160
+ if (roleId && snapshot?.roles?.some(r => r.id === roleId)) {
161
+ setTargetRole(roleId);
162
+ setTargetRoleField(field);
163
+ setModelsDialogOpen(true);
164
+ return;
165
+ }
166
+ // Case 3: Global setting in advanced settings
167
+ if (focusGlobalField(field)) {
168
+ handledValidation.current = state.validationEpoch;
169
+ return;
100
170
  }
171
+ // Case 4: Unmapped Host diagnostic or missing role in inventory -> JSONC fallback with UTF16 offset/length
172
+ if (modelsDialogOpen)
173
+ closeModelsDialog("jsonc");
174
+ else if (focusJsonc(state.issue.location))
175
+ handledValidation.current = state.validationEpoch;
101
176
  }
102
- }, [state.issue, state.busy, state.validationEpoch]);
177
+ }, [state.issue, state.busy, state.validationEpoch, snapshot?.roles]);
103
178
  const relationship = editor?.revision != null && editor.id === snapshot?.selectedId ? sourceRelationship(snapshot, editor.revision) : "changed";
104
179
  const applied = relationship === "current";
105
180
  let selection = t(snapshot === null ? "unavailable" : "baseline");
@@ -128,10 +203,77 @@ export function ProfilesSection(props) {
128
203
  const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
129
204
  editorRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
130
205
  editorRef.current?.focus();
131
- }, 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", 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, onJumpToOrchestrator: () => {
132
- const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
133
- orchestratorRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
134
- orchestratorRef.current?.querySelector("select, input")?.focus();
135
- }, 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("div", { className: "dsmm-save-bar", children: _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: editorDisabled || !state.dirty || snapshot === null || state.invalidFields.length > 0, 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 && _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 })] });
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: [(() => {
214
+ const isSaveLocked = (state.dirty || state.invalidFields.length > 0) && !editorDisabled && snapshot !== null && (state.invalidFields.length > 0 || rawInvalid || invalid);
215
+ if (!isSaveLocked)
216
+ return null;
217
+ return (_jsxs("div", { className: "dsmm-save-lock-reason", role: "status", children: [_jsx("span", { className: "dsmm-save-lock-text", children: rawInvalid
218
+ ? t("rawInvalid")
219
+ : state.invalidFields.length > 0
220
+ ? t("saveLockedReason", { count: state.invalidFields.length })
221
+ : t("validation") }), _jsxs("div", { className: "dsmm-save-lock-action", children: [rawInvalid && (_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => {
222
+ if (advancedRef.current !== null) {
223
+ advancedRef.current.open = true;
224
+ jsoncOpenRef.current = true;
225
+ }
226
+ const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
227
+ editorRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
228
+ editorRef.current?.focus();
229
+ }, children: t("jumpToJsonc") })), !rawInvalid && state.invalidFields.length > 0 && (() => {
230
+ const firstInvalid = state.invalidFields[0];
231
+ const roleMatch = /^(?:settings\.)?(?:roleRouting|roles)\.([a-zA-Z0-9_-]+)(?:\.|$)/.exec(firstInvalid);
232
+ const roleId = roleMatch?.[1];
233
+ if (roleId) {
234
+ return (_jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: (e) => {
235
+ dialogInitiatorRef.current = e.currentTarget;
236
+ setTargetRole(roleId);
237
+ setTargetRoleField(firstInvalid);
238
+ setModelsDialogOpen(true);
239
+ }, children: [t("jumpToField"), ": ", firstInvalid] }));
240
+ }
241
+ return (_jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: () => {
242
+ if (!focusGlobalField(firstInvalid))
243
+ focusJsonc(state.issue?.location);
244
+ }, children: [t("jumpToField"), ": ", firstInvalid] }));
245
+ })(), !rawInvalid && state.invalidFields.length === 0 && invalid && (() => {
246
+ if (state.issue?.field === "id" || state.issue?.field === "newId") {
247
+ return (_jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: () => {
248
+ const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
249
+ inputRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
250
+ inputRef.current?.focus();
251
+ }, children: [t("jumpToField"), ": ID"] }));
252
+ }
253
+ const roleMatch = /^(?:settings\.)?(?:roleRouting|roles)\.([a-zA-Z0-9_-]+)(?:\.|$)/.exec(state.issue?.field ?? "");
254
+ const roleId = roleMatch?.[1];
255
+ if (roleId && snapshot?.roles?.some(r => r.id === roleId)) {
256
+ return (_jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: (e) => {
257
+ dialogInitiatorRef.current = e.currentTarget;
258
+ setTargetRole(roleId);
259
+ setTargetRoleField(state.issue?.field ?? null);
260
+ setModelsDialogOpen(true);
261
+ }, children: [t("jumpToRole"), ": ", roleId] }));
262
+ }
263
+ return (_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => {
264
+ if (advancedRef.current !== null) {
265
+ advancedRef.current.open = true;
266
+ jsoncOpenRef.current = true;
267
+ }
268
+ const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
269
+ editorRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
270
+ editorRef.current?.focus();
271
+ const location = state.issue?.location;
272
+ if (location !== undefined && editorRef.current && location.offset + location.length <= editorRef.current.value.length) {
273
+ editorRef.current.setSelectionRange(location.offset, location.offset + location.length);
274
+ }
275
+ }, children: t("jumpToJsonc") }));
276
+ })()] })] }));
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 })] });
136
278
  }
137
279
  //# sourceMappingURL=ProfilesSection.js.map
@@ -32,4 +32,11 @@ export declare function preparingRoleTool(toolName: string, args: ToolArgs): {
32
32
  };
33
33
  export declare function actualRoleTool(toolName: string, meta: unknown, failed: boolean): DsmmInvocationView | undefined;
34
34
  export declare function roleToolDisplay(target: string): string;
35
+ export interface TechnicalRow {
36
+ property: string;
37
+ value: unknown;
38
+ isComplex: boolean;
39
+ }
40
+ export declare function technicalTableRows(toolName: string, callId: string, rawArgs: string, meta?: unknown, routeSource?: string): TechnicalRow[];
41
+ export declare function technicalJsonData(toolName: string, callId: string, rawArgs: string, meta?: unknown, routeSource?: string): Record<string, unknown>;
35
42
  //# sourceMappingURL=RoleToolView-data.d.ts.map
@@ -51,4 +51,49 @@ export function actualRoleTool(toolName, meta, failed) {
51
51
  export function roleToolDisplay(target) {
52
52
  return target.slice("dsmm-".length).split("-").map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
53
53
  }
54
+ export function technicalTableRows(toolName, callId, rawArgs, meta, routeSource) {
55
+ const rows = [];
56
+ rows.push({ property: "toolName", value: toolName, isComplex: false });
57
+ rows.push({ property: "callId", value: callId, isComplex: false });
58
+ if (routeSource !== undefined) {
59
+ rows.push({ property: "routeSource", value: routeSource, isComplex: false });
60
+ }
61
+ const argsObj = roleToolArguments(rawArgs);
62
+ if (argsObj !== undefined) {
63
+ for (const [k, v] of Object.entries(argsObj)) {
64
+ const isComplex = typeof v === "object" && v !== null;
65
+ rows.push({ property: `args.${k}`, value: v, isComplex });
66
+ }
67
+ }
68
+ else if (rawArgs !== "") {
69
+ rows.push({ property: "args", value: rawArgs, isComplex: false });
70
+ }
71
+ if (meta !== undefined && meta !== null) {
72
+ if (typeof meta === "object" && !Array.isArray(meta)) {
73
+ for (const [k, v] of Object.entries(meta)) {
74
+ const isComplex = typeof v === "object" && v !== null;
75
+ rows.push({ property: `meta.${k}`, value: v, isComplex });
76
+ }
77
+ }
78
+ else {
79
+ rows.push({ property: "meta", value: meta, isComplex: typeof meta === "object" });
80
+ }
81
+ }
82
+ return rows;
83
+ }
84
+ export function technicalJsonData(toolName, callId, rawArgs, meta, routeSource) {
85
+ const parsedArgs = roleToolArguments(rawArgs);
86
+ const data = {
87
+ toolName,
88
+ callId,
89
+ };
90
+ if (routeSource !== undefined) {
91
+ data.routeSource = routeSource;
92
+ }
93
+ data.args = parsedArgs !== undefined ? parsedArgs : rawArgs;
94
+ if (meta !== undefined && meta !== null) {
95
+ data.meta = meta;
96
+ }
97
+ return data;
98
+ }
54
99
  //# sourceMappingURL=RoleToolView-data.js.map
@@ -29,6 +29,11 @@ export declare const roleToolEn: {
29
29
  readonly level: "Level";
30
30
  readonly route: "Reported route";
31
31
  readonly routeSource: "Route source";
32
+ readonly table: "Table";
33
+ readonly json: "JSON";
34
+ readonly viewMode: "View mode";
35
+ readonly property: "Property";
36
+ readonly value: "Value";
32
37
  };
33
38
  export declare const roleToolZh: Record<keyof typeof roleToolEn, string>;
34
39
  declare module "@deepseek-ai/dsh-client-ui-slots" {
@@ -9,6 +9,7 @@ export const roleToolEn = {
9
9
  args: "Original arguments", preparingArgs: "Arguments received so far", output: "Complete result content", failure: "Error details", metadata: "Invocation metadata",
10
10
  inspect: "Inspect tool call", 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
+ table: "Table", json: "JSON", viewMode: "View mode", property: "Property", value: "Value",
12
13
  };
13
14
  export const roleToolZh = {
14
15
  call: "调用", calling: "正在调用", unknownTarget: "DSMM 代理 · 目标待确定",
@@ -20,5 +21,6 @@ export const roleToolZh = {
20
21
  args: "原始参数", preparingArgs: "目前已收到的参数", output: "完整结果内容", failure: "错误详情", metadata: "调用元数据",
21
22
  inspect: "检查工具调用", copy: "复制", copied: "已复制", emptyArgs: "参数尚不可用",
22
23
  unavailable: "实际身份不可用,仅显示请求身份", level: "等级", route: "报告的路由", routeSource: "路由来源",
24
+ table: "表格", json: "JSON", viewMode: "视图模式", property: "属性", value: "值",
23
25
  };
24
26
  //# sourceMappingURL=RoleToolView-locales.js.map
@@ -1,13 +1,16 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button, CodeBlock, DisclosureRow, StateDot } from "@deepseek-ai/dsh-client-ui-primitives";
3
- import { actualRoleTool, preparingRoleTool, requestedRoleTool, roleToolDisplay, roleToolKeys } from "./RoleToolView-data.js";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Button, CodeBlock, DisclosureRow, IconAgentPresetOutlineRegular, SegmentedControl, StateDot, TextShimmer } from "@deepseek-ai/dsh-client-ui-primitives";
4
+ import { actualRoleTool, preparingRoleTool, requestedRoleTool, roleToolDisplay, roleToolKeys, technicalJsonData, technicalTableRows } from "./RoleToolView-data.js";
4
5
  import { ROLE_TOOL_NS, roleToolEn, roleToolZh } from "./RoleToolView-locales.js";
5
6
  const styles = `
6
7
  .dsmm-role-tool{min-width:0;color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family);font-size:14px;line-height:22px}
7
8
  .dsmm-role-tool .dsmm-role-heading{color:var(--dsw-alias-label-primary);height:auto;min-height:32px}
8
- .dsmm-role-tool .dsmm-role-title{white-space:normal;overflow-wrap:anywhere;min-width:0;max-width:100%;color:inherit;font-size:inherit;line-height:inherit;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;overflow:hidden;text-overflow:ellipsis}
9
- .dsmm-role-tool[data-expanded="true"] .dsmm-role-title{display:block;-webkit-line-clamp:unset;overflow:visible}
10
- .dsmm-role-tool .dsmm-role-text{flex:1;min-width:0}
9
+ .dsmm-role-tool .dsmm-role-title{white-space:nowrap;flex:none;color:inherit;font-size:inherit;line-height:inherit}
10
+ .dsmm-role-tool .dsmm-role-text{display:inline-flex;align-items:center;min-width:0;flex:1;overflow:hidden}
11
+ .dsmm-role-tool .dsmm-role-sep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}
12
+ .dsmm-role-tool .dsmm-role-summary{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(24px + var(--dsh-content-font-delta,0px));flex:auto;overflow:hidden;color:var(--dsw-alias-label-secondary)}
13
+ .dsmm-role-tool .dsmm-role-icon{flex:none;color:inherit}
11
14
  .dsmm-role-tool .dsmm-role-body{display:flex;flex-direction:column;gap:8px;min-width:0;padding:8px 0}
12
15
  .dsmm-role-tool p{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
13
16
  .dsmm-role-tool .dsmm-role-status{color:var(--dsw-alias-label-secondary)}
@@ -19,6 +22,15 @@ const styles = `
19
22
  .dsmm-role-tool .dsmm-role-details{border-top:1px solid var(--dsw-alias-border-l2);padding-top:8px;margin-top:4px}
20
23
  .dsmm-role-tool .dsmm-role-details summary{cursor:pointer;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;user-select:none}
21
24
  .dsmm-role-tool .dsmm-role-details-body{display:flex;flex-direction:column;gap:8px;margin-top:8px;padding-left:8px}
25
+ .dsmm-role-tool .dsmm-role-details-header{display:flex;align-items:center;margin-bottom:4px}
26
+ .dsmm-role-tool .dsmm-role-view-switch{margin-bottom:4px}
27
+ .dsmm-role-tool .dsmm-role-table{width:100%;border-collapse:collapse;font-size:12px;line-height:18px;margin-top:4px}
28
+ .dsmm-role-tool .dsmm-role-table th,.dsmm-role-tool .dsmm-role-table td{padding:4px 8px;text-align:left;vertical-align:top;border-bottom:1px solid var(--dsw-alias-border-l1)}
29
+ .dsmm-role-tool .dsmm-role-table th{color:var(--dsw-alias-label-secondary);font-weight:500;border-bottom:1px solid var(--dsw-alias-border-l2)}
30
+ .dsmm-role-tool .dsmm-role-prop-cell{color:var(--dsw-alias-label-secondary);font-family:var(--dsw-font-family-code,monospace);word-break:break-all;width:35%;max-width:180px}
31
+ .dsmm-role-tool .dsmm-role-val-cell{color:var(--dsw-alias-label-primary);word-break:break-word}
32
+ .dsmm-role-tool .dsmm-role-cell-text{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
33
+ .dsmm-role-tool .dsmm-role-cell-code{margin:0;font-family:var(--dsw-font-family-code,monospace);font-size:11px;line-height:16px;white-space:pre-wrap;word-break:break-all;background:var(--dsw-alias-bg-layer-2,rgba(0,0,0,0.04));padding:4px 6px;border-radius:4px}
22
34
  .dsmm-role-tool :is(button,[role=button],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}
23
35
  `;
24
36
  export function RoleToolView(props) {
@@ -35,13 +47,26 @@ export function RoleToolView(props) {
35
47
  const targetLabel = target === undefined ? t("unknownTarget") : roleToolDisplay(target);
36
48
  const rawDesc = requested.description?.trim();
37
49
  const singleLineDesc = rawDesc ? rawDesc.replace(/\s+/gu, " ") : undefined;
38
- const title = singleLineDesc ? `${action} ${targetLabel}: ${singleLineDesc}` : `${action} ${targetLabel}`;
50
+ const title = `${action} ${targetLabel}`;
39
51
  const state = result?.error?.code === "interrupted" ? "stopped" : failed ? "error" : result === undefined ? props.phase === "preparing" ? "preparing" : "running" : actual?.jobId !== undefined || actual?.mode === "continuable" ? "background" : "result";
52
+ const isOngoing = state === "running" || props.phase === "preparing";
40
53
  const code = (value) => _jsx(CodeBlock, { code: value, copyLabel: t("copy"), copiedLabel: t("copied") });
54
+ const [viewMode, setViewMode] = useState("table");
55
+ const controlId = `dsmm-tech-${props.callId || "call"}`;
56
+ const viewOptions = [
57
+ { value: "table", label: t("table") },
58
+ { value: "json", label: t("json") },
59
+ ];
60
+ const tableRows = technicalTableRows(props.toolName, props.callId, raw, result?.meta, actual?.routeSource);
61
+ const jsonData = technicalJsonData(props.toolName, props.callId, raw, result?.meta, actual?.routeSource);
41
62
  const roleDiffers = requested.target !== undefined && actual !== undefined && actual.role !== requested.target;
42
63
  const levelDiffers = requested.level !== undefined && actual !== undefined && actual.level !== requested.level;
43
64
  const showRequestedVsActual = roleDiffers || levelDiffers;
44
- return _jsxs("div", { className: "dsmm-role-tool", "data-dsmm-role-tool": props.toolName, "data-identity": actual === undefined ? "requested" : "actual", "data-state": state, "data-expanded": expanded ? "true" : "false", children: [_jsx(DisclosureRow, { title: title, titleClassName: "dsmm-role-title", rowClassName: "dsmm-role-heading", contentClassName: "dsmm-role-text", icon: _jsx(StateDot, { state: state === "error" ? "error" : state === "stopped" ? "warning" : result === undefined ? "ongoing" : state === "background" ? "idle" : "done" }), open: expanded, expandable: true, onToggle: toggle, expandOnRowClick: true, children: _jsxs("div", { className: "dsmm-role-body", children: [_jsxs("p", { className: "dsmm-role-identity", children: [showRequestedVsActual ? _jsxs(_Fragment, { children: [_jsxs("span", { className: "dsmm-role-dim", children: [t("requested"), ": "] }), _jsxs("span", { children: [requested.target === undefined ? t("unknown") : roleToolDisplay(requested.target), requested.level ? ` (${requested.level})` : ""] }), _jsx("span", { className: "dsmm-role-dim", children: " \u2192 " }), _jsxs("span", { className: "dsmm-role-dim", children: [t("actual"), ": "] }), _jsxs("span", { children: [roleToolDisplay(actual.role), " (", actual.level, ")"] })] }) : _jsxs("span", { children: [actual !== undefined ? roleToolDisplay(actual.role) : requested.target === undefined ? t("unknownTarget") : roleToolDisplay(requested.target), (actual?.level ?? requested.level) !== undefined && ` · ${actual?.level ?? requested.level}`, result !== undefined && actual === undefined && _jsxs("span", { className: "dsmm-role-dim", children: [" \u00B7 ", t("actualUnknown")] })] }), actual?.route !== undefined && _jsxs("span", { className: "dsmm-role-model", children: [" · ", actual.route.provider, "/", actual.route.model, actual.route.reasoningEffort ? ` · ${actual.route.reasoningEffort}` : ""] })] }), requested.description !== undefined && _jsx("p", { className: "dsmm-role-task", children: requested.description }), result?.error != null && _jsxs("div", { className: "dsmm-role-failure", children: [_jsx("p", { className: "dsmm-role-section-title", children: t("failure") }), code(JSON.stringify(result.error, null, 2))] }), result?.content !== undefined && (result.error == null || result.content.length > 0) && _jsxs("div", { className: "dsmm-role-output", children: [_jsx("p", { className: "dsmm-role-section-title", children: t("output") }), code(JSON.stringify(result.content, null, 2))] }), _jsxs("details", { className: "dsmm-role-details", children: [_jsx("summary", { children: t("technicalDetails") }), _jsxs("div", { className: "dsmm-role-details-body", children: [_jsxs("p", { children: [props.toolName, " \u00B7 ", props.callId] }), actual?.routeSource !== undefined && _jsxs("p", { children: [t("routeSource"), ": ", actual.routeSource] }), _jsxs("div", { children: [_jsx("p", { className: "dsmm-role-section-title", children: t(props.phase === "preparing" ? "preparingArgs" : "args") }), raw === "" ? _jsx("p", { className: "dsmm-role-empty", children: t("emptyArgs") }) : code(raw)] }), result?.meta != null && _jsxs("div", { children: [_jsx("p", { className: "dsmm-role-section-title", children: t("metadata") }), code(JSON.stringify(result.meta, null, 2))] })] })] })] }) }), _jsxs("div", { className: "dsmm-role-actions", children: [_jsx("p", { className: "dsmm-role-status", role: "status", children: t(state) }), props.inspect !== undefined && _jsx(Button, { variant: "ghost", size: "sm", onClick: props.inspect, children: t("inspect") })] })] });
65
+ const collapsedContent = singleLineDesc ? _jsxs(_Fragment, { children: [_jsx("span", { className: "dsmm-role-sep", "aria-hidden": "true" }), _jsx("span", { className: "dsmm-role-summary", children: _jsx(TextShimmer, { active: isOngoing, children: singleLineDesc }) })] }) : undefined;
66
+ const stateDotState = state === "error" ? "error" : state === "stopped" ? "warning" : result === undefined ? "ongoing" : state === "background" ? "idle" : "done";
67
+ return _jsxs("div", { className: "dsmm-role-tool", "data-dsmm-role-tool": props.toolName, "data-identity": actual === undefined ? "requested" : "actual", "data-state": state, "data-expanded": expanded ? "true" : "false", children: [_jsx(DisclosureRow, { title: title, titleClassName: "dsmm-role-title", rowClassName: "dsmm-role-heading", contentClassName: "dsmm-role-text", icon: _jsx(IconAgentPresetOutlineRegular, { size: 14, className: "dsmm-role-icon" }), collapsedContent: collapsedContent, keepContentWhenOpen: true, running: isOngoing, open: expanded, expandable: true, onToggle: toggle, expandOnRowClick: true, children: _jsxs("div", { className: "dsmm-role-body", children: [_jsxs("p", { className: "dsmm-role-identity", children: [showRequestedVsActual ? _jsxs(_Fragment, { children: [_jsxs("span", { className: "dsmm-role-dim", children: [t("requested"), ": "] }), _jsxs("span", { children: [requested.target === undefined ? t("unknown") : roleToolDisplay(requested.target), requested.level ? ` (${requested.level})` : ""] }), _jsx("span", { className: "dsmm-role-dim", children: " \u2192 " }), _jsxs("span", { className: "dsmm-role-dim", children: [t("actual"), ": "] }), _jsxs("span", { children: [roleToolDisplay(actual.role), " (", actual.level, ")"] })] }) : _jsxs("span", { children: [actual !== undefined ? roleToolDisplay(actual.role) : requested.target === undefined ? t("unknownTarget") : roleToolDisplay(requested.target), (actual?.level ?? requested.level) !== undefined && ` · ${actual?.level ?? requested.level}`, result !== undefined && actual === undefined && _jsxs("span", { className: "dsmm-role-dim", children: [" \u00B7 ", t("actualUnknown")] })] }), actual?.route !== undefined && _jsxs("span", { className: "dsmm-role-model", children: [" · ", actual.route.provider, "/", actual.route.model, actual.route.reasoningEffort ? ` · ${actual.route.reasoningEffort}` : ""] })] }), requested.description !== undefined && _jsx("p", { className: "dsmm-role-task", children: requested.description }), result?.error != null && _jsxs("div", { className: "dsmm-role-failure", children: [_jsx("p", { className: "dsmm-role-section-title", children: t("failure") }), code(JSON.stringify(result.error, null, 2))] }), _jsxs("details", { className: "dsmm-role-details", children: [_jsx("summary", { children: t("technicalDetails") }), _jsxs("div", { className: "dsmm-role-details-body", children: [_jsx("div", { className: "dsmm-role-details-header", children: _jsx(SegmentedControl, { id: controlId, value: viewMode, options: viewOptions, onChange: setViewMode, label: t("viewMode"), className: "dsmm-role-view-switch" }) }), _jsx("div", { id: `${controlId}-table-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-table`, hidden: viewMode !== "table", tabIndex: 0, children: viewMode === "table" && _jsxs("table", { className: "dsmm-role-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: t("property") }), _jsx("th", { scope: "col", children: t("value") })] }) }), _jsx("tbody", { children: tableRows.map(row => _jsxs("tr", { children: [_jsx("td", { className: "dsmm-role-prop-cell", children: row.property }), _jsx("td", { className: "dsmm-role-val-cell", children: row.isComplex ? _jsx("pre", { className: "dsmm-role-cell-code", children: JSON.stringify(row.value, null, 2) })
68
+ : typeof row.value === "string" ? _jsx("span", { className: "dsmm-role-cell-text", children: row.value })
69
+ : _jsx("span", { children: row.value === null ? "null" : row.value === undefined ? "undefined" : String(row.value) }) })] }, row.property)) })] }) }), _jsx("div", { id: `${controlId}-json-panel`, role: "tabpanel", "aria-labelledby": `${controlId}-json`, hidden: viewMode !== "json", tabIndex: 0, children: viewMode === "json" && code(JSON.stringify(jsonData, null, 2)) })] })] })] }) }), _jsxs("div", { className: "dsmm-role-actions", children: [_jsx(StateDot, { state: stateDotState }), _jsx("p", { className: "dsmm-role-status", role: "status", children: t(state) }), props.inspect !== undefined && _jsx(Button, { variant: "ghost", size: "sm", onClick: props.inspect, children: t("inspect") })] })] });
45
70
  }
46
71
  /** Called once by the parent client apply(ctx), alongside the other slot registrations. */
47
72
  export function registerRoleToolViews(ctx) {
@@ -1,11 +1,22 @@
1
1
  import type { Ref } from "react";
2
2
  import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
3
3
  import type { ModelCatalog } from "@deepseek-ai/dsh-api-session-controller";
4
- import type { DsmmModelRoute } from "../settings.js";
4
+ import type { DsmmInvocationLevel, DsmmLevelOverride, DsmmModelRoute } from "../settings.js";
5
+ import type { DsmmRateLimitPolicy, DsmmRuntimePolicyConfig, DsmmRuntimePolicySettings } from "../routing-policy.js";
5
6
  import type { ProfilesActions, ProfilesViewSnapshot } from "./controller.js";
6
- import type { JsonPath } from "./structured.js";
7
+ import type { JsonPath, StructuredDocument } from "./structured.js";
7
8
  type Locale = PropsLocale<"settings.dsmm-profiles">;
8
9
  type Edit = ProfilesActions["editPath"];
10
+ export declare function RetryNumber({ id, name, field, value, inherited, path, disabled, actions, t }: Locale & {
11
+ id: string;
12
+ name: string;
13
+ field: keyof DsmmRateLimitPolicy;
14
+ value: number | undefined;
15
+ inherited: number | undefined;
16
+ path: JsonPath;
17
+ disabled: boolean;
18
+ actions: ProfilesActions;
19
+ }): import("react").JSX.Element;
9
20
  export declare function RouteFields({ value, path, name, catalog, disabled, edit, editRoute, t, naturalLabels }: Locale & {
10
21
  value: DsmmModelRoute;
11
22
  path: JsonPath;
@@ -16,6 +27,22 @@ export declare function RouteFields({ value, path, name, catalog, disabled, edit
16
27
  editRoute: ProfilesActions["editRoute"];
17
28
  naturalLabels?: boolean;
18
29
  }): import("react").JSX.Element;
30
+ export declare function PolicyFields({ value, inherited, path, name, disabled, actions, t }: Locale & {
31
+ value: DsmmRuntimePolicyConfig;
32
+ inherited: DsmmRuntimePolicySettings | undefined;
33
+ path: JsonPath;
34
+ name: string;
35
+ disabled: boolean;
36
+ actions: ProfilesActions;
37
+ }): import("react").JSX.Element;
38
+ export declare function LevelFields({ level, value, path, catalog, disabled, actions, t }: Locale & {
39
+ level: Exclude<DsmmInvocationLevel, "normal">;
40
+ value?: DsmmLevelOverride;
41
+ path: JsonPath;
42
+ catalog: ModelCatalog | null;
43
+ disabled: boolean;
44
+ actions: ProfilesActions;
45
+ }): import("react").JSX.Element;
19
46
  export type BasicSettingsProps = Locale & {
20
47
  state: ProfilesViewSnapshot;
21
48
  actions: ProfilesActions;
@@ -30,9 +57,10 @@ export type AdvancedSettingsProps = Locale & {
30
57
  state: ProfilesViewSnapshot;
31
58
  actions: ProfilesActions;
32
59
  disabled: boolean;
33
- onJumpToOrchestrator?: () => void;
60
+ document?: StructuredDocument | null;
61
+ isInvalidProjection?: boolean;
34
62
  };
35
- export declare function AdvancedSettings({ state, actions, disabled, onJumpToOrchestrator, t }: AdvancedSettingsProps): import("react").JSX.Element | null;
63
+ export declare function AdvancedSettings({ state, actions, disabled, document: propDoc, isInvalidProjection: propInvalid, t }: AdvancedSettingsProps): import("react").JSX.Element | null;
36
64
  /** The same raw draft drives every control; there is no form-to-document rewrite. */
37
65
  export declare function StructuredEditor({ state, actions, disabled, t }: Locale & {
38
66
  state: ProfilesViewSnapshot;