@dsmm/dsmm 0.3.11 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/agent-presets.md +4 -4
- package/docs/compatibility.md +10 -4
- package/docs/deferred-native-approval-risk.md +1 -1
- package/docs/design.md +15 -5
- package/docs/lsp.md +1 -1
- package/docs/model-routing.md +6 -6
- package/docs/native-permissions.md +1 -1
- package/docs/profiles.md +36 -5
- package/docs/roadmap.md +3 -3
- package/docs/runtime-recovery.md +5 -5
- package/docs/safety-guards.md +1 -1
- package/docs/settings-status.md +3 -3
- package/lib/child-capture.d.ts +9 -0
- package/lib/child-capture.js +24 -1
- package/lib/client/ProfilesSection.js +65 -13
- package/lib/client/RoleToolView-data.d.ts +4 -4
- package/lib/client/RoleToolView-data.js +3 -1
- package/lib/client/RoleToolView-locales.d.ts +7 -4
- package/lib/client/RoleToolView-locales.js +10 -6
- package/lib/client/RoleToolView.js +20 -5
- package/lib/client/SessionProfiles.d.ts +5 -1
- package/lib/client/SessionProfiles.js +13 -9
- package/lib/client/StructuredEditor.d.ts +32 -0
- package/lib/client/StructuredEditor.js +75 -23
- package/lib/client/controller.d.ts +10 -0
- package/lib/client/controller.js +44 -14
- package/lib/client/locales.d.ts +36 -0
- package/lib/client/locales.js +47 -17
- package/lib/client/session-labels.js +4 -1
- package/lib/client/structured.d.ts +4 -0
- package/lib/client/structured.js +16 -1
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +19 -1
- package/lib/client.js +762 -303
- package/lib/host-llm.js +3 -3
- package/lib/index.js +1 -1
- package/lib/model-routing.d.ts +3 -2
- package/lib/model-routing.js +28 -7
- package/lib/native-admission.d.ts +2 -0
- package/lib/native-admission.js +106 -34
- package/lib/profile-runtime.d.ts +11 -0
- package/lib/profile-runtime.js +48 -13
- package/lib/profile-store.d.ts +4 -1
- package/lib/profile-store.js +37 -14
- package/lib/role-control-rpc.js +18 -5
- package/lib/role-llm-runtime.js +10 -1
- package/lib/role-policy.d.ts +4 -3
- package/lib/role-policy.js +6 -6
- package/lib/role-providers.js +1 -0
- package/lib/runtime-recovery.d.ts +2 -2
- package/lib/runtime-recovery.js +7 -4
- package/package.json +1 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useRef } from "react";
|
|
3
3
|
import { Button, Input } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
4
|
import { canReconcileSelection } from "./controller.js";
|
|
5
|
-
import {
|
|
6
|
-
import { SessionScope } from "./SessionProfiles.js";
|
|
5
|
+
import { AdvancedSettings, RouteFields } from "./StructuredEditor.js";
|
|
6
|
+
import { SessionScope, SessionScopeFeedback } from "./SessionProfiles.js";
|
|
7
|
+
import { sessionProfileLabels } from "./session-labels.js";
|
|
7
8
|
import { structuredDocument } from "./structured.js";
|
|
8
9
|
import { draftWarnings, IssueDetails, ProfileWarnings } from "./diagnostics.js";
|
|
9
10
|
import { configurationVersionState, sourceRelationship } from "./configuration-display.js";
|
|
11
|
+
import { DSMM_LOCALES } from "../profile-locale.js";
|
|
10
12
|
function issueKey(issue) {
|
|
11
13
|
if (issue.source === "selection")
|
|
12
14
|
return issue.code === "conflict" ? "selectionConflict" : "appliedInvalid";
|
|
@@ -23,13 +25,23 @@ export function ProfilesSection(props) {
|
|
|
23
25
|
const prefix = useId();
|
|
24
26
|
const selectRef = useRef(null);
|
|
25
27
|
const inputRef = useRef(null);
|
|
28
|
+
const labelRef = useRef(null);
|
|
26
29
|
const editorRef = useRef(null);
|
|
27
30
|
const advancedRef = useRef(null);
|
|
31
|
+
const advancedSettingsRef = useRef(null);
|
|
32
|
+
const moreActionsRef = useRef(null);
|
|
28
33
|
const handledValidation = useRef(0);
|
|
29
34
|
const cancelRef = useRef(null);
|
|
30
35
|
const hadConfirmation = useRef(false);
|
|
36
|
+
const initiatorRef = useRef(null);
|
|
37
|
+
const orchestratorRef = useRef(null);
|
|
38
|
+
const sessionScopeRef = useRef(null);
|
|
39
|
+
const advancedOpenRef = useRef(false);
|
|
40
|
+
const jsoncOpenRef = useRef(false);
|
|
41
|
+
const moreActionsOpenRef = useRef(false);
|
|
31
42
|
const disabled = state.busy !== null || state.pendingEditor !== null || state.sessionBusy === "apply" || state.sessionBusy === "reset";
|
|
32
43
|
const snapshot = state.snapshot;
|
|
44
|
+
const hasOrchestrator = snapshot?.roles?.some(role => role.id === "dsmm-orchestrator") === true;
|
|
33
45
|
const editor = state.editor;
|
|
34
46
|
const readOnly = snapshot?.readOnly === true;
|
|
35
47
|
const editorDisabled = disabled || readOnly || editor?.refreshRequired === true || editor?.revision === "unavailable";
|
|
@@ -37,32 +49,53 @@ export function ProfilesSection(props) {
|
|
|
37
49
|
const selectionConflict = reconcilable && snapshot?.selectionError?.code === "conflict";
|
|
38
50
|
const invalid = state.issue?.kind === "domain" && state.issue.code === "validation";
|
|
39
51
|
const idInvalid = invalid && state.issue?.field === "id" && state.issue.location === undefined && editor?.revision === null && !editorDisabled;
|
|
40
|
-
const
|
|
52
|
+
const structuredDoc = editor === null ? null : structuredDocument(editor.content);
|
|
53
|
+
const lastValidBasicDocRef = useRef(null);
|
|
54
|
+
if (structuredDoc !== null) {
|
|
55
|
+
lastValidBasicDocRef.current = structuredDoc;
|
|
56
|
+
}
|
|
57
|
+
const basicDoc = structuredDoc ?? lastValidBasicDocRef.current;
|
|
58
|
+
const rawInvalid = editor !== null && structuredDoc === null;
|
|
41
59
|
useEffect(() => {
|
|
42
60
|
if (state.pendingEditor !== null) {
|
|
43
61
|
cancelRef.current?.focus();
|
|
44
62
|
hadConfirmation.current = true;
|
|
45
63
|
}
|
|
46
64
|
else if (hadConfirmation.current) {
|
|
47
|
-
selectRef.current?.focus();
|
|
48
65
|
hadConfirmation.current = false;
|
|
66
|
+
if (initiatorRef.current && initiatorRef.current.isConnected) {
|
|
67
|
+
initiatorRef.current.focus();
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
selectRef.current?.focus();
|
|
71
|
+
}
|
|
49
72
|
}
|
|
50
73
|
}, [state.pendingEditor]);
|
|
51
74
|
useEffect(() => {
|
|
52
75
|
if (state.busy === null && state.validationEpoch > handledValidation.current && state.issue?.kind === "domain" && state.issue.code === "validation") {
|
|
53
76
|
handledValidation.current = state.validationEpoch;
|
|
77
|
+
const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
78
|
+
const scrollOpt = { behavior: reducedMotion ? "auto" : "smooth", block: "nearest" };
|
|
54
79
|
if (state.issue.location === undefined && state.issue.field === "id" && inputRef.current !== null
|
|
55
|
-
&& !inputRef.current.disabled && !inputRef.current.readOnly)
|
|
80
|
+
&& !inputRef.current.disabled && !inputRef.current.readOnly) {
|
|
81
|
+
if (typeof inputRef.current.scrollIntoView === "function")
|
|
82
|
+
inputRef.current.scrollIntoView(scrollOpt);
|
|
56
83
|
inputRef.current.focus();
|
|
84
|
+
}
|
|
57
85
|
else {
|
|
58
|
-
if (advancedRef.current !== null)
|
|
86
|
+
if (advancedRef.current !== null) {
|
|
59
87
|
advancedRef.current.open = true;
|
|
88
|
+
jsoncOpenRef.current = true;
|
|
89
|
+
}
|
|
60
90
|
const input = editorRef.current;
|
|
61
91
|
if (input !== null) {
|
|
92
|
+
if (typeof input.scrollIntoView === "function")
|
|
93
|
+
input.scrollIntoView(scrollOpt);
|
|
62
94
|
input.focus();
|
|
63
95
|
const location = state.issue.location;
|
|
64
|
-
if (location !== undefined && location.offset + location.length <= input.value.length)
|
|
96
|
+
if (location !== undefined && location.offset + location.length <= input.value.length) {
|
|
65
97
|
input.setSelectionRange(location.offset, location.offset + location.length);
|
|
98
|
+
}
|
|
66
99
|
}
|
|
67
100
|
}
|
|
68
101
|
}
|
|
@@ -76,10 +109,29 @@ export function ProfilesSection(props) {
|
|
|
76
109
|
selection = t("appliedProfile", { id: snapshot.selectedId, revision: t(configurationVersionState(snapshot.sourceRevision)) });
|
|
77
110
|
const notice = state.notice === null ? "" : t(state.notice.key === "reset" ? "resetDone" : state.notice.key, { id: state.notice.id });
|
|
78
111
|
const warnings = editor === null ? [] : draftWarnings(editor.content);
|
|
79
|
-
return _jsxs("section", { className: "dsmm-profiles", "aria-label": t("title"), "aria-busy": state.busy !== null, children: [readOnly && _jsx("p", { role: "status", className: "dsmm-hint", children: t("readOnlyOrigin") }),
|
|
80
|
-
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}`))] }), snapshot.profiles.length === 0 && _jsx("p", { className: "dsmm-hint", children: t("empty") })
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
112
|
+
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)
|
|
113
|
+
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") {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
props.cancelDiscard();
|
|
116
|
+
} }, children: [_jsx("p", { id: `${prefix}-confirm`, children: t("discardPrompt") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => { void props.discardAndOpen(); }, children: t("discard") }), _jsx(Button, { ref: cancelRef, type: "button", variant: "primary", onClick: props.cancelDiscard, children: t("cancel") })] })] }), _jsxs("div", { className: "dsmm-effective-summary", "data-dsmm-effective-summary": true, children: [_jsxs("div", { className: "dsmm-summary-row", children: [_jsxs("div", { children: [_jsx("span", { className: "dsmm-summary-label", children: t("futureDefaultSummary") }), " ", _jsx("span", { className: "dsmm-summary-val", "data-dsmm-selection": true, children: selection })] }), _jsx(Button, { type: "button", variant: "primary", size: "sm", disabled: editorDisabled || state.dirty || state.invalidFields.length > 0 || editor?.revision == null || !reconcilable || (applied && !selectionConflict), onClick: () => { void props.apply(); }, children: t(state.busy === "apply" ? "applying" : "apply") })] }), snapshot?.refreshRequired && _jsx("p", { role: "status", children: t("savedRefreshRequired") }), snapshot?.selectedWarnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("futureWarnings") }), _jsx(ProfileWarnings, { warnings: snapshot.selectedWarnings, t: t })] }) : null, snapshot?.selectionError !== undefined && _jsxs("div", { className: "dsmm-issue", children: [_jsx("p", { children: t(selectionConflict ? "selectionConflict" : "retry") }), _jsx(IssueDetails, { issue: snapshot.selectionError, t: t })] }), _jsxs("div", { className: "dsmm-summary-row", children: [_jsxs("div", { children: [_jsx("span", { className: "dsmm-summary-label", children: t("currentSessionSummary") }), " ", _jsx("span", { className: "dsmm-summary-val", children: state.session === null ? t("sessionUnavailable") : sessionProfileLabels(state.session, t).admitted })] }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => {
|
|
117
|
+
if (moreActionsRef.current !== null) {
|
|
118
|
+
moreActionsRef.current.open = true;
|
|
119
|
+
moreActionsOpenRef.current = true;
|
|
120
|
+
}
|
|
121
|
+
const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
122
|
+
sessionScopeRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
|
|
123
|
+
}, 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: () => {
|
|
124
|
+
if (advancedRef.current !== null) {
|
|
125
|
+
advancedRef.current.open = true;
|
|
126
|
+
jsoncOpenRef.current = true;
|
|
127
|
+
}
|
|
128
|
+
const reducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
129
|
+
editorRef.current?.scrollIntoView({ behavior: reducedMotion ? "auto" : "smooth" });
|
|
130
|
+
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 })] });
|
|
84
136
|
}
|
|
85
137
|
//# sourceMappingURL=ProfilesSection.js.map
|
|
@@ -23,10 +23,10 @@ export declare function requestedRoleTool(toolName: string, raw: string): {
|
|
|
23
23
|
/** Read during render: the native owner republishes changes to these lazy answers. */
|
|
24
24
|
export declare function preparingRoleTool(toolName: string, args: ToolArgs): {
|
|
25
25
|
requested: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
description: string | undefined;
|
|
27
|
+
kind: "role" | "category";
|
|
28
|
+
target: string | undefined;
|
|
29
|
+
level: string | undefined;
|
|
30
30
|
};
|
|
31
31
|
preview: string;
|
|
32
32
|
};
|
|
@@ -32,7 +32,9 @@ export function preparingRoleTool(toolName, args) {
|
|
|
32
32
|
return value === undefined ? [] : [[key, value]];
|
|
33
33
|
}));
|
|
34
34
|
const complete = Object.fromEntries(Object.entries(received).filter(([key]) => args.complete(key)));
|
|
35
|
-
|
|
35
|
+
const requested = requestedRoleTool(toolName, args.invalid ? "" : JSON.stringify(complete));
|
|
36
|
+
const description = requested.description ?? (typeof received.description === "string" ? received.description : undefined);
|
|
37
|
+
return { requested: { ...requested, description },
|
|
36
38
|
preview: Object.keys(received).length === 0 ? "" : JSON.stringify(received, null, 2) };
|
|
37
39
|
}
|
|
38
40
|
export function actualRoleTool(toolName, meta, failed) {
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
export declare const ROLE_TOOL_NS = "conversation.dsmm-role-tool";
|
|
2
2
|
export declare const roleToolEn: {
|
|
3
3
|
readonly call: "Call";
|
|
4
|
+
readonly calling: "Calling";
|
|
4
5
|
readonly unknownTarget: "DSMM agent · target pending";
|
|
5
6
|
readonly requested: "Requested";
|
|
6
7
|
readonly actual: "Actual";
|
|
7
8
|
readonly role: "Role";
|
|
8
9
|
readonly category: "Category";
|
|
9
10
|
readonly unknown: "Unknown";
|
|
11
|
+
readonly actualUnknown: "Actual unknown";
|
|
10
12
|
readonly preparing: "Preparing";
|
|
11
|
-
readonly running: "
|
|
12
|
-
readonly result: "
|
|
13
|
-
readonly background: "
|
|
14
|
-
readonly error: "
|
|
13
|
+
readonly running: "Calling";
|
|
14
|
+
readonly result: "Returned";
|
|
15
|
+
readonly background: "Background";
|
|
16
|
+
readonly error: "Failed";
|
|
15
17
|
readonly stopped: "Interrupted";
|
|
18
|
+
readonly technicalDetails: "Technical details";
|
|
16
19
|
readonly args: "Original arguments";
|
|
17
20
|
readonly preparingArgs: "Arguments received so far";
|
|
18
21
|
readonly output: "Complete result content";
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
export const ROLE_TOOL_NS = "conversation.dsmm-role-tool";
|
|
2
2
|
export const roleToolEn = {
|
|
3
|
-
call: "Call", unknownTarget: "DSMM agent · target pending",
|
|
3
|
+
call: "Call", calling: "Calling", unknownTarget: "DSMM agent · target pending",
|
|
4
4
|
requested: "Requested", actual: "Actual", role: "Role", category: "Category", unknown: "Unknown",
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
actualUnknown: "Actual unknown",
|
|
6
|
+
preparing: "Preparing", running: "Calling", result: "Returned",
|
|
7
|
+
background: "Background", error: "Failed", stopped: "Interrupted",
|
|
8
|
+
technicalDetails: "Technical details",
|
|
7
9
|
args: "Original arguments", preparingArgs: "Arguments received so far", output: "Complete result content", failure: "Error details", metadata: "Invocation metadata",
|
|
8
10
|
inspect: "Inspect tool call", copy: "Copy", copied: "Copied", emptyArgs: "Arguments not available yet",
|
|
9
11
|
unavailable: "Actual identity unavailable; requested identity only", level: "Level", route: "Reported route", routeSource: "Route source",
|
|
10
12
|
};
|
|
11
13
|
export const roleToolZh = {
|
|
12
|
-
call: "调用", unknownTarget: "DSMM 代理 · 目标待确定",
|
|
14
|
+
call: "调用", calling: "正在调用", unknownTarget: "DSMM 代理 · 目标待确定",
|
|
13
15
|
requested: "请求", actual: "实际", role: "角色", category: "类别", unknown: "未知",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
actualUnknown: "实际未知",
|
|
17
|
+
preparing: "准备中", running: "调用中", result: "已返回",
|
|
18
|
+
background: "后台调用", error: "失败", stopped: "已中断",
|
|
19
|
+
technicalDetails: "技术详情",
|
|
16
20
|
args: "原始参数", preparingArgs: "目前已收到的参数", output: "完整结果内容", failure: "错误详情", metadata: "调用元数据",
|
|
17
21
|
inspect: "检查工具调用", copy: "复制", copied: "已复制", emptyArgs: "参数尚不可用",
|
|
18
22
|
unavailable: "实际身份不可用,仅显示请求身份", level: "等级", route: "报告的路由", routeSource: "路由来源",
|
|
@@ -5,13 +5,21 @@ import { ROLE_TOOL_NS, roleToolEn, roleToolZh } from "./RoleToolView-locales.js"
|
|
|
5
5
|
const styles = `
|
|
6
6
|
.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
7
|
.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}
|
|
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}
|
|
9
10
|
.dsmm-role-tool .dsmm-role-text{flex:1;min-width:0}
|
|
10
|
-
.dsmm-role-tool .dsmm-role-body{display:flex;flex-direction:column;gap:
|
|
11
|
+
.dsmm-role-tool .dsmm-role-body{display:flex;flex-direction:column;gap:8px;min-width:0;padding:8px 0}
|
|
11
12
|
.dsmm-role-tool p{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
|
|
12
13
|
.dsmm-role-tool .dsmm-role-status{color:var(--dsw-alias-label-secondary)}
|
|
13
14
|
.dsmm-role-tool .dsmm-role-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
|
|
14
|
-
.dsmm-role-tool
|
|
15
|
+
.dsmm-role-tool .dsmm-role-identity{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}
|
|
16
|
+
.dsmm-role-tool .dsmm-role-task{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}
|
|
17
|
+
.dsmm-role-tool .dsmm-role-dim{color:var(--dsw-alias-label-tertiary)}
|
|
18
|
+
.dsmm-role-tool .dsmm-role-section-title{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;margin-bottom:4px}
|
|
19
|
+
.dsmm-role-tool .dsmm-role-details{border-top:1px solid var(--dsw-alias-border-l2);padding-top:8px;margin-top:4px}
|
|
20
|
+
.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
|
+
.dsmm-role-tool .dsmm-role-details-body{display:flex;flex-direction:column;gap:8px;margin-top:8px;padding-left:8px}
|
|
22
|
+
.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}
|
|
15
23
|
`;
|
|
16
24
|
export function RoleToolView(props) {
|
|
17
25
|
const { expanded, toggle } = props.useDisclosure();
|
|
@@ -23,10 +31,17 @@ export function RoleToolView(props) {
|
|
|
23
31
|
const failed = result !== undefined && (result.isError || result.error != null);
|
|
24
32
|
const actual = result === undefined ? undefined : actualRoleTool(props.toolName, result.meta, failed);
|
|
25
33
|
const target = actual?.role ?? requested.target;
|
|
26
|
-
const
|
|
34
|
+
const action = props.phase === "preparing" ? t("calling") : t("call");
|
|
35
|
+
const targetLabel = target === undefined ? t("unknownTarget") : roleToolDisplay(target);
|
|
36
|
+
const rawDesc = requested.description?.trim();
|
|
37
|
+
const singleLineDesc = rawDesc ? rawDesc.replace(/\s+/gu, " ") : undefined;
|
|
38
|
+
const title = singleLineDesc ? `${action} ${targetLabel}: ${singleLineDesc}` : `${action} ${targetLabel}`;
|
|
27
39
|
const state = result?.error?.code === "interrupted" ? "stopped" : failed ? "error" : result === undefined ? props.phase === "preparing" ? "preparing" : "running" : actual?.jobId !== undefined || actual?.mode === "continuable" ? "background" : "result";
|
|
28
40
|
const code = (value) => _jsx(CodeBlock, { code: value, copyLabel: t("copy"), copiedLabel: t("copied") });
|
|
29
|
-
|
|
41
|
+
const roleDiffers = requested.target !== undefined && actual !== undefined && actual.role !== requested.target;
|
|
42
|
+
const levelDiffers = requested.level !== undefined && actual !== undefined && actual.level !== requested.level;
|
|
43
|
+
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") })] })] });
|
|
30
45
|
}
|
|
31
46
|
/** Called once by the parent client apply(ctx), alongside the other slot registrations. */
|
|
32
47
|
export function registerRoleToolViews(ctx) {
|
|
@@ -9,10 +9,14 @@ type Injected = ProfilesActions & {
|
|
|
9
9
|
export type SessionProfilesProps = InjectFace<Injected> & PropsLocale<"settings.dsmm-profiles"> & {
|
|
10
10
|
sessionId?: string;
|
|
11
11
|
};
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function SessionScopeFeedback({ state, t }: PropsLocale<"settings.dsmm-profiles"> & {
|
|
13
|
+
state: ProfilesViewSnapshot;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
export declare function SessionScope({ state, actions, t, compact, showFeedback }: PropsLocale<"settings.dsmm-profiles"> & {
|
|
13
16
|
state: ProfilesViewSnapshot;
|
|
14
17
|
actions: ProfilesActions;
|
|
15
18
|
compact?: boolean;
|
|
19
|
+
showFeedback?: boolean;
|
|
16
20
|
}): import("react").JSX.Element;
|
|
17
21
|
/** Root-scoped native menu; an explicitly scoped foreign occurrence still refuses. */
|
|
18
22
|
export declare function SessionProfiles(props: SessionProfilesProps): import("react").JSX.Element | null;
|
|
@@ -28,7 +28,15 @@ function menuIssue(issue) {
|
|
|
28
28
|
// arbitrary wire fields, provider identifiers, credentials or file paths.
|
|
29
29
|
return { code, ...(isSafeDiagnosticField(field) ? { field } : {}) };
|
|
30
30
|
}
|
|
31
|
-
export function
|
|
31
|
+
export function SessionScopeFeedback({ state, t }) {
|
|
32
|
+
const session = state.session;
|
|
33
|
+
const status = state.sessionNotice === null ? "" : t(state.sessionNotice === "mode-on" ? "headerModeOn" : state.sessionNotice === "mode-off" ? "headerModeOff" : state.sessionNotice === "applied-with-model" ? "sessionAppliedWithModel" : state.sessionNotice === "applied" ? "sessionApplied" : "sessionResetDone");
|
|
34
|
+
return _jsxs("div", { "data-dsmm-session-feedback": true, children: [session?.warnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("admissionWarnings") }), _jsx(ProfileWarnings, { warnings: session.warnings, t: t })] }) : null, state.dirty && _jsx("p", { className: "dsmm-hint", children: t("sessionDirty") }), (session?.refreshRequired || session?.selection.refreshRequired) && _jsx("p", { role: "status", children: t("sessionCommittedRefresh") }), state.sessionUnconfirmed && _jsx("p", { role: "status", children: t("sessionUnconfirmedRefresh") }), state.sessionIssue !== null && _jsxs(_Fragment, { children: [_jsx("p", { role: "alert", children: state.sessionIssue.source === "profile-model" ? t(state.sessionIssue.code === "model-unconfigured" ? "headerNoProfileModel" : state.sessionIssue.code === "model-choice-changed" ? "headerModelChoiceChanged" : "headerModelUnconfirmed")
|
|
35
|
+
: state.sessionIssue.code === "conflict" ? t("sessionConflict")
|
|
36
|
+
: ["busy", "maintenance", "disposed", "not-owned"].includes(state.sessionIssue.code) ? t("sessionBusy", { reason: state.sessionIssue.code })
|
|
37
|
+
: t(state.sessionIssue.code === "validation" ? "validation" : "sessionUnavailable") }), _jsx(IssueDetails, { issue: state.sessionIssue, t: t })] }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.sessionBusy === "read" ? t("reading") : status })] });
|
|
38
|
+
}
|
|
39
|
+
export function SessionScope({ state, actions, t, compact = false, showFeedback = true }) {
|
|
32
40
|
const prefix = useId();
|
|
33
41
|
const session = state.session;
|
|
34
42
|
const labels = session === null ? null : sessionProfileLabels(session, t);
|
|
@@ -38,7 +46,6 @@ export function SessionScope({ state, actions, t, compact = false }) {
|
|
|
38
46
|
const ready = session !== null && !state.sessionUnconfirmed && !session.refreshRequired && !session.selection.refreshRequired && writableSelectionVersion(session.selection.selectionRevision);
|
|
39
47
|
const allowed = ready && session.canApplyOverlay === true && session.applyOverlayUnavailableReason !== "new-session-required";
|
|
40
48
|
const modelAllowed = ready && session.canSelectModel === true && session.profileModel !== undefined;
|
|
41
|
-
const status = state.sessionNotice === null ? "" : t(state.sessionNotice === "mode-on" ? "headerModeOn" : state.sessionNotice === "mode-off" ? "headerModeOff" : state.sessionNotice === "applied-with-model" ? "sessionAppliedWithModel" : state.sessionNotice === "applied" ? "sessionApplied" : "sessionResetDone");
|
|
42
49
|
let binding = session?.subagentRuntime;
|
|
43
50
|
try {
|
|
44
51
|
if (binding !== undefined)
|
|
@@ -47,15 +54,12 @@ export function SessionScope({ state, actions, t, compact = false }) {
|
|
|
47
54
|
catch {
|
|
48
55
|
binding = undefined;
|
|
49
56
|
}
|
|
50
|
-
return _jsxs("div", { className: "dsmm-session-scope", "aria-busy": state.sessionBusy !== null, "data-dsmm-session-scope": true, children: [!compact && _jsx("h3", { children: t("sessionScope") }), state.currentSessionId === null ? _jsx("p", { className: "dsmm-hint", children: t("sessionChooseWorkspace") }) : _jsxs(_Fragment, { children: [labels !== null && _jsx("p", { "data-dsmm-session-state": true, children: labels.admitted }), labels !== null && !compact && _jsx("p", { className: "dsmm-hint", "data-dsmm-session-future-default": true, children: labels.futureDefault }), session === null && _jsx("p", { className: "dsmm-hint", id: `${prefix}-overlay-reason`, children: t("sessionUnavailable") }), session
|
|
51
|
-
actions.chooseSessionProfile(event.currentTarget.value || null); }, children: [_jsx("option", { value: "", children: t("sessionBaseline") }), state.sessionChoice !== null && selected === undefined && _jsx("option", { value: state.sessionChoice, children: state.sessionChoice }), state.snapshot?.profiles.map((profile) => _jsxs("option", { value: profile.id, disabled: !isConfigRevision(profile.revision) || profile.error !== undefined, children: [profile.label?.trim() || profile.id, profileWarnings(profile.warnings).length ? ` — ${t("warningProfile")}` : ""] }, profile.id))] })] }), !compact && _jsxs(_Fragment, { children: [_jsx("p", { className: "dsmm-hint", children: t("
|
|
52
|
-
void actions.useSessionProfileModel(); }, children: t("headerUseCurrentModel") }), !modelAllowed && _jsx("p", { className: "dsmm-hint", id: `${prefix}-model-reason`, children: capabilityReason(session?.selectModelUnavailableReason, t) }), session !== null && _jsxs("details", { children: [_jsx("summary", { children: t("technicalDetails") }), _jsxs("div", { className: "dsmm-availability", children: [_jsx("p", { children: binding === undefined ? t("bindingUnknown") : t("bindingState", { binding: binding.binding, ready: t(binding.deliveryFenceReady ? "enabled" : "disabled"), restart: t(binding.restartRequired ? "enabled" : "disabled") }) }), binding?.reason !== undefined && _jsx("p", { children: t("bindingReason", { reason: binding.reason }) })] }), session.roles !== undefined && _jsxs("details", { children: [_jsx("summary", { children: t("admittedRoles") }), session.roles.map(role => _jsxs("div", { className: "dsmm-availability", children: [_jsx("p", { children: role.id }), _jsx(RoleAvailability, { value: role, t: t })] }, role.id))] }), session.rolePolicy !== undefined && _jsx("p", { "data-dsmm-session-policy": true, children: t("roleState", { route: session.rolePolicy.route === undefined ? t("inheritRoute") : `${session.rolePolicy.route.provider}/${session.rolePolicy.route.model}${session.rolePolicy.route.reasoningEffort === undefined ? "" : ` (${session.rolePolicy.route.reasoningEffort})`}`, strategy: session.rolePolicy.strategy, retries: session.rolePolicy.retries, failures: session.rolePolicy.rateLimitFailures, switches: session.rolePolicy.switches, delay: session.rolePolicy.totalDelayMs }) })] })] }),
|
|
57
|
+
return _jsxs("div", { className: "dsmm-session-scope", "aria-busy": state.sessionBusy !== null, "data-dsmm-session-scope": true, children: [!compact && _jsx("h3", { children: t("sessionScope") }), state.currentSessionId === null ? _jsx("p", { className: "dsmm-hint", children: t("sessionChooseWorkspace") }) : _jsxs(_Fragment, { children: [labels !== null && _jsx("p", { "data-dsmm-session-state": true, children: labels.admitted }), labels !== null && !compact && _jsx("p", { className: "dsmm-hint", "data-dsmm-session-future-default": true, children: labels.futureDefault }), session === null && _jsx("p", { className: "dsmm-hint", id: `${prefix}-overlay-reason`, children: t("sessionUnavailable") }), session !== null && !allowed && _jsx("p", { className: "dsmm-hint", id: `${prefix}-overlay-reason`, children: capabilityReason(session.applyOverlayUnavailableReason, t) }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-choice`, children: t("sessionSelect") }), _jsxs("select", { id: `${prefix}-choice`, value: state.sessionChoice ?? "", disabled: disabled || !allowed, "aria-describedby": !allowed ? `${prefix}-overlay-reason` : undefined, onChange: (event) => { if (current())
|
|
58
|
+
actions.chooseSessionProfile(event.currentTarget.value || null); }, children: [_jsx("option", { value: "", children: t("sessionBaseline") }), state.sessionChoice !== null && selected === undefined && _jsx("option", { value: state.sessionChoice, children: state.sessionChoice }), state.snapshot?.profiles.map((profile) => _jsxs("option", { value: profile.id, disabled: !isConfigRevision(profile.revision) || profile.error !== undefined, children: [profile.label?.trim() || profile.id, profileWarnings(profile.warnings).length ? ` — ${t("warningProfile")}` : ""] }, profile.id))] })] }), !compact && _jsxs(_Fragment, { children: [_jsx("p", { className: "dsmm-hint", id: `${prefix}-model-hint`, children: t("useSessionProfileModelDesc") }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || !modelAllowed, "aria-describedby": `${prefix}-model-hint${!modelAllowed ? ` ${prefix}-model-reason` : ""}`, onClick: () => { if (current())
|
|
59
|
+
void actions.useSessionProfileModel(); }, children: t("headerUseCurrentModel") }), !modelAllowed && _jsx("p", { className: "dsmm-hint", id: `${prefix}-model-reason`, children: capabilityReason(session?.selectModelUnavailableReason, t) }), session !== null && _jsxs("details", { children: [_jsx("summary", { children: t("technicalDetails") }), _jsxs("div", { className: "dsmm-availability", children: [_jsx("p", { children: binding === undefined ? t("bindingUnknown") : t("bindingState", { binding: binding.binding, ready: t(binding.deliveryFenceReady ? "enabled" : "disabled"), restart: t(binding.restartRequired ? "enabled" : "disabled") }) }), binding?.reason !== undefined && _jsx("p", { children: t("bindingReason", { reason: binding.reason }) })] }), session.roles !== undefined && _jsxs("details", { children: [_jsx("summary", { children: t("admittedRoles") }), session.roles.map(role => _jsxs("div", { className: "dsmm-availability", children: [_jsx("p", { children: role.id }), _jsx(RoleAvailability, { value: role, t: t })] }, role.id))] }), session.rolePolicy !== undefined && _jsx("p", { "data-dsmm-session-policy": true, children: t("roleState", { route: session.rolePolicy.route === undefined ? t("inheritRoute") : `${session.rolePolicy.route.provider}/${session.rolePolicy.route.model}${session.rolePolicy.route.reasoningEffort === undefined ? "" : ` (${session.rolePolicy.route.reasoningEffort})`}`, strategy: session.rolePolicy.strategy, retries: session.rolePolicy.retries, failures: session.rolePolicy.rateLimitFailures, switches: session.rolePolicy.switches, delay: session.rolePolicy.totalDelayMs }) })] })] }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: disabled || !allowed || (state.sessionChoice !== null && !isConfigRevision(selected?.revision)), "aria-describedby": !allowed ? `${prefix}-overlay-reason` : undefined, onClick: () => { if (current())
|
|
53
60
|
void actions.applySession(); }, children: t(state.sessionBusy === "apply" ? "sessionApplying" : "sessionApply") }), !compact && _jsx(Button, { type: "button", variant: "outline", disabled: disabled || !allowed, "aria-describedby": !allowed ? `${prefix}-overlay-reason` : undefined, onClick: () => { if (current())
|
|
54
61
|
void actions.resetSession(); }, children: t(state.sessionBusy === "reset" ? "sessionResetting" : "sessionReset") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.sessionBusy !== null || state.busy !== null || state.pendingEditor !== null, onClick: () => { if (current())
|
|
55
|
-
void actions.refreshSession(); }, children: t("sessionRefresh") })] })] }),
|
|
56
|
-
: state.sessionIssue.code === "conflict" ? t("sessionConflict")
|
|
57
|
-
: ["busy", "maintenance", "disposed", "not-owned"].includes(state.sessionIssue.code) ? t("sessionBusy", { reason: state.sessionIssue.code })
|
|
58
|
-
: t(state.sessionIssue.code === "validation" ? "validation" : "sessionUnavailable") }), state.sessionIssue !== null && _jsx(IssueDetails, { issue: state.sessionIssue, t: t }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.sessionBusy === "read" ? t("reading") : status })] });
|
|
62
|
+
void actions.refreshSession(); }, children: t("sessionRefresh") })] })] }), showFeedback && _jsx(SessionScopeFeedback, { state: state, t: t })] });
|
|
59
63
|
}
|
|
60
64
|
/** Root-scoped native menu; an explicitly scoped foreign occurrence still refuses. */
|
|
61
65
|
export function SessionProfiles(props) {
|
|
@@ -1,6 +1,38 @@
|
|
|
1
|
+
import type { Ref } from "react";
|
|
1
2
|
import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
|
|
3
|
+
import type { ModelCatalog } from "@deepseek-ai/dsh-api-session-controller";
|
|
4
|
+
import type { DsmmModelRoute } from "../settings.js";
|
|
2
5
|
import type { ProfilesActions, ProfilesViewSnapshot } from "./controller.js";
|
|
6
|
+
import type { JsonPath } from "./structured.js";
|
|
3
7
|
type Locale = PropsLocale<"settings.dsmm-profiles">;
|
|
8
|
+
type Edit = ProfilesActions["editPath"];
|
|
9
|
+
export declare function RouteFields({ value, path, name, catalog, disabled, edit, editRoute, t, naturalLabels }: Locale & {
|
|
10
|
+
value: DsmmModelRoute;
|
|
11
|
+
path: JsonPath;
|
|
12
|
+
name?: string;
|
|
13
|
+
catalog: ModelCatalog | null;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
edit: Edit;
|
|
16
|
+
editRoute: ProfilesActions["editRoute"];
|
|
17
|
+
naturalLabels?: boolean;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
export type BasicSettingsProps = Locale & {
|
|
20
|
+
state: ProfilesViewSnapshot;
|
|
21
|
+
actions: ProfilesActions;
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
24
|
+
idInvalid?: boolean;
|
|
25
|
+
orchestratorRef?: Ref<HTMLDivElement>;
|
|
26
|
+
onJumpToJsonc?: () => void;
|
|
27
|
+
};
|
|
28
|
+
export declare function BasicSettings({ state, actions, disabled, inputRef, idInvalid, orchestratorRef, onJumpToJsonc, t }: BasicSettingsProps): import("react").JSX.Element | null;
|
|
29
|
+
export type AdvancedSettingsProps = Locale & {
|
|
30
|
+
state: ProfilesViewSnapshot;
|
|
31
|
+
actions: ProfilesActions;
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
onJumpToOrchestrator?: () => void;
|
|
34
|
+
};
|
|
35
|
+
export declare function AdvancedSettings({ state, actions, disabled, onJumpToOrchestrator, t }: AdvancedSettingsProps): import("react").JSX.Element | null;
|
|
4
36
|
/** The same raw draft drives every control; there is no form-to-document rewrite. */
|
|
5
37
|
export declare function StructuredEditor({ state, actions, disabled, t }: Locale & {
|
|
6
38
|
state: ProfilesViewSnapshot;
|