@dsmm/dsmm 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -40
- package/cordis.patch.yml +9 -13
- package/docs/agent-presets.md +26 -14
- package/docs/compatibility.md +24 -68
- package/docs/deferred-native-approval-risk.md +8 -12
- package/docs/design.md +25 -254
- package/docs/lsp.md +2 -2
- package/docs/migration-from-ocmm.md +38 -51
- package/docs/model-routing.md +21 -21
- package/docs/native-permissions.md +17 -7
- package/docs/profiles.md +13 -9
- package/docs/releasing.md +25 -311
- package/docs/roadmap.md +52 -241
- package/docs/runtime-recovery.md +29 -91
- package/docs/safety-guards.md +19 -16
- package/docs/settings-status.md +23 -11
- package/docs/skill-sync.md +17 -17
- package/docs/web-fetch-fakeip.md +82 -0
- package/lib/child-capture.d.ts +12 -2
- package/lib/child-capture.js +22 -5
- package/lib/client/ChildPermissions.d.ts +43 -0
- package/lib/client/ChildPermissions.js +100 -0
- package/lib/client/ChildrenPanel.d.ts +5 -5
- package/lib/client/ChildrenPanel.js +6 -18
- package/lib/client/DeploymentFields.d.ts +32 -0
- package/lib/client/DeploymentFields.js +70 -0
- package/lib/client/DeploymentPage.d.ts +21 -6
- package/lib/client/DeploymentPage.js +80 -112
- package/lib/client/HistoryContinuation.d.ts +7 -0
- package/lib/client/HistoryContinuation.js +22 -0
- package/lib/client/NativeCommandEntries.d.ts +17 -0
- package/lib/client/NativeCommandEntries.js +68 -0
- package/lib/client/PermissionPanelEntry.d.ts +8 -0
- package/lib/client/PermissionPanelEntry.js +11 -0
- package/lib/client/PermissionsPanel.d.ts +3 -1
- package/lib/client/PermissionsPanel.js +10 -9
- package/lib/client/ProfilesSection.js +8 -6
- package/lib/client/RoleAvailability.js +1 -1
- package/lib/client/RoleToolView-data.d.ts +35 -0
- package/lib/client/RoleToolView-data.js +52 -0
- package/lib/client/RoleToolView-locales.d.ts +36 -0
- package/lib/client/RoleToolView-locales.js +20 -0
- package/lib/client/RoleToolView.d.ts +10 -0
- package/lib/client/RoleToolView.js +47 -0
- package/lib/client/SessionProfiles.js +51 -24
- package/lib/client/TemporaryPermissions.d.ts +21 -0
- package/lib/client/TemporaryPermissions.js +94 -0
- package/lib/client/children-controller.d.ts +2 -8
- package/lib/client/children-controller.js +1 -26
- package/lib/client/children-locales.d.ts +27 -52
- package/lib/client/children-locales.js +8 -12
- package/lib/client/configuration-display.d.ts +5 -0
- package/lib/client/configuration-display.js +11 -0
- package/lib/client/controller.d.ts +18 -0
- package/lib/client/controller.js +118 -28
- package/lib/client/deployment-controller.d.ts +13 -1
- package/lib/client/deployment-controller.js +84 -24
- package/lib/client/deployment-data.d.ts +1 -0
- package/lib/client/deployment-data.js +4 -1
- package/lib/client/deployment-locales.d.ts +43 -0
- package/lib/client/deployment-locales.js +45 -19
- package/lib/client/deployment-modules.d.ts +9 -0
- package/lib/client/deployment-modules.js +24 -0
- package/lib/client/deployment-workspace.d.ts +48 -0
- package/lib/client/deployment-workspace.js +123 -0
- package/lib/client/history-controller.d.ts +29 -0
- package/lib/client/history-controller.js +111 -0
- package/lib/client/history-entry.d.ts +11 -0
- package/lib/client/history-entry.js +106 -0
- package/lib/client/history-locales.d.ts +95 -0
- package/lib/client/history-locales.js +41 -0
- package/lib/client/index.js +26 -76
- package/lib/client/locales.d.ts +13 -0
- package/lib/client/locales.js +104 -86
- package/lib/client/permission-controller.d.ts +1 -0
- package/lib/client/permission-controller.js +3 -2
- package/lib/client/permission-locales.d.ts +51 -0
- package/lib/client/permission-locales.js +59 -19
- package/lib/client/session-labels.js +4 -3
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +9 -8
- package/lib/client/temporary-permission-client.d.ts +20 -0
- package/lib/client/temporary-permission-client.js +52 -0
- package/lib/client/temporary-permission-entry.d.ts +6 -0
- package/lib/client/temporary-permission-entry.js +56 -0
- package/lib/client.js +5691 -3439
- package/lib/commands.js +2 -0
- package/lib/config-file-store.d.ts +3 -0
- package/lib/config-file-store.js +4 -2
- package/lib/config-revision.d.ts +5 -0
- package/lib/config-revision.js +11 -0
- package/lib/core-permission-authority.js +11 -41
- package/lib/deployment-config.d.ts +9 -2
- package/lib/deployment-config.js +35 -8
- package/lib/deployment-permission-rules.js +19 -7
- package/lib/dsh-types.d.ts +1 -1
- package/lib/history-candidates.d.ts +30 -0
- package/lib/history-candidates.js +176 -0
- package/lib/history-codec.d.ts +11 -0
- package/lib/history-codec.js +102 -0
- package/lib/history-contract.d.ts +44 -0
- package/lib/history-contract.js +2 -0
- package/lib/history-controller.d.ts +42 -0
- package/lib/history-controller.js +329 -0
- package/lib/history-policy.d.ts +4 -0
- package/lib/history-policy.js +8 -0
- package/lib/history-remote.d.ts +28 -0
- package/lib/history-remote.js +17 -0
- package/lib/history-rpc.d.ts +24 -0
- package/lib/history-rpc.js +136 -0
- package/lib/history-support.d.ts +15 -0
- package/lib/history-support.js +21 -0
- package/lib/history-types.d.ts +67 -0
- package/lib/history-types.js +2 -0
- package/lib/host-llm-startup.js +3 -3
- package/lib/host-llm.d.ts +9 -3
- package/lib/host-llm.js +48 -8
- package/lib/index.d.ts +18 -20
- package/lib/index.js +147 -415
- package/lib/lifetime.d.ts +4 -0
- package/lib/lifetime.js +22 -0
- package/lib/live-pi-ai-owner.d.ts +1 -0
- package/lib/live-pi-ai-owner.js +8 -4
- package/lib/mode.d.ts +3 -2
- package/lib/mode.js +28 -41
- package/lib/model-routing.d.ts +2 -8
- package/lib/model-routing.js +59 -175
- package/lib/native-admission.d.ts +77 -0
- package/lib/native-admission.js +503 -0
- package/lib/native-pi-ai-wire.d.ts +3 -1
- package/lib/native-pi-ai-wire.js +47 -13
- package/lib/permission-child-control.d.ts +36 -0
- package/lib/permission-child-control.js +164 -0
- package/lib/permission-control.d.ts +2 -3
- package/lib/permission-control.js +7 -0
- package/lib/permission-controller.js +2 -2
- package/lib/permission-exec-argv.d.ts +32 -0
- package/lib/permission-exec-argv.js +171 -0
- package/lib/permission-fs-search.js +2 -1
- package/lib/permission-fs.js +2 -1
- package/lib/permission-native-rules.js +3 -3
- package/lib/permission-temporary-files.d.ts +19 -0
- package/lib/permission-temporary-files.js +248 -0
- package/lib/permission-temporary-grants.d.ts +106 -0
- package/lib/permission-temporary-grants.js +198 -0
- package/lib/permission-temporary-install.d.ts +25 -0
- package/lib/permission-temporary-install.js +86 -0
- package/lib/permission-temporary-remote.d.ts +19 -0
- package/lib/permission-temporary-remote.js +75 -0
- package/lib/permission-temporary-rpc.d.ts +37 -0
- package/lib/permission-temporary-rpc.js +154 -0
- package/lib/permission-temporary-types.d.ts +47 -0
- package/lib/permission-temporary-types.js +2 -0
- package/lib/permission-temporary-web.d.ts +11 -0
- package/lib/permission-temporary-web.js +154 -0
- package/lib/permission-web.js +2 -1
- package/lib/preset-registry.js +3 -2
- package/lib/preset-skills.d.ts +3 -12
- package/lib/preset-skills.js +28 -58
- package/lib/profile-diagnostics.d.ts +1 -1
- package/lib/profile-diagnostics.js +2 -2
- package/lib/profile-remote.js +61 -22
- package/lib/profile-rpc.d.ts +4 -3
- package/lib/profile-rpc.js +35 -37
- package/lib/profile-runtime.d.ts +42 -74
- package/lib/profile-runtime.js +314 -617
- package/lib/profile-store.d.ts +20 -8
- package/lib/profile-store.js +112 -63
- package/lib/profile-types.d.ts +19 -4
- package/lib/profiles.d.ts +3 -1
- package/lib/profiles.js +9 -7
- package/lib/prompt-content.d.ts +1 -0
- package/lib/prompt-content.js +4 -1
- package/lib/prompts.d.ts +2 -12
- package/lib/prompts.js +11 -66
- package/lib/role-control-remote.d.ts +1 -4
- package/lib/role-control-remote.js +8 -36
- package/lib/role-control-rpc.d.ts +10 -36
- package/lib/role-control-rpc.js +112 -269
- package/lib/role-control-types.d.ts +3 -26
- package/lib/role-control-types.js +3 -4
- package/lib/role-identity.d.ts +5 -0
- package/lib/role-identity.js +10 -0
- package/lib/role-invocation.d.ts +3 -3
- package/lib/role-invocation.js +2 -2
- package/lib/role-llm-runtime.js +5 -11
- package/lib/role-policy.d.ts +19 -50
- package/lib/role-policy.js +136 -508
- package/lib/role-providers.d.ts +5 -8
- package/lib/role-providers.js +20 -86
- package/lib/role-routing.d.ts +1 -3
- package/lib/role-routing.js +24 -34
- package/lib/role-subagents.d.ts +5 -14
- package/lib/role-subagents.js +163 -108
- package/lib/runtime-integration.d.ts +5 -78
- package/lib/runtime-integration.js +11 -697
- package/lib/session-metadata.d.ts +13 -12
- package/lib/session-metadata.js +6 -31
- package/lib/session-scope.js +2 -1
- package/lib/settings.d.ts +5 -18
- package/lib/settings.js +19 -43
- package/lib/skills.d.ts +1 -0
- package/lib/skills.js +5 -1
- package/lib/state.d.ts +3 -2
- package/lib/state.js +26 -10
- package/lib/status.d.ts +1 -9
- package/lib/status.js +3 -55
- package/lib/web-fetch-address-policy.d.ts +24 -0
- package/lib/web-fetch-address-policy.js +189 -0
- package/lib/web-fetch-fakeip.d.ts +25 -0
- package/lib/web-fetch-fakeip.js +107 -0
- package/package.json +124 -106
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-gateway@0.2.1-rc.2.patch +13291 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-remotes@0.2.1-rc.2.patch +9133 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-client-ui-approval@0.2.1-rc.2.patch +156 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-subagent@0.2.1-rc.2.patch +3546 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-user-approval@0.2.1-rc.2.patch +431 -0
- package/patches/dsh-approval-settlement/@deepseek-ai__dsh-web@0.2.1-rc.2.patch +119 -0
- package/patches/dsh-approval-settlement/README.md +41 -0
- package/patches/dsh-approval-settlement/metadata.json +10 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-loop@0.2.1-rc.2.patch +383 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-preset-registry@0.2.1-rc.2.patch +55 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-api-session-controller@0.2.1-rc.2.patch +16673 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-subagent@0.2.1-rc.2.patch +29 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-workspace@0.2.1-rc.2.patch +196 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence-jsonl@0.2.1-rc.2.patch +35 -0
- package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence@0.2.1-rc.2.patch +40 -0
- package/docs/research/deepseek-v4-pro.md +0 -74
- package/docs/research/oh-dsh.md +0 -96
- package/lib/agent-registry.d.ts +0 -36
- package/lib/agent-registry.js +0 -75
- package/lib/child-admission.d.ts +0 -40
- package/lib/child-admission.js +0 -151
- package/lib/delivery-authority.d.ts +0 -83
- package/lib/delivery-authority.js +0 -397
- package/lib/native-child-evidence.d.ts +0 -40
- package/lib/native-child-evidence.js +0 -104
- package/lib/role-runs.d.ts +0 -138
- package/lib/role-runs.js +0 -335
- package/lib/session-persistence.d.ts +0 -36
- package/lib/session-persistence.js +0 -304
- package/lib/subagent-runtime.d.ts +0 -57
- package/lib/subagent-runtime.js +0 -257
- package/prompts/deepseek-flash.md +0 -11
- package/prompts/deepseek-v4-pro.md +0 -14
|
@@ -6,6 +6,7 @@ import { StructuredEditor } from "./StructuredEditor.js";
|
|
|
6
6
|
import { SessionScope } from "./SessionProfiles.js";
|
|
7
7
|
import { structuredDocument } from "./structured.js";
|
|
8
8
|
import { draftWarnings, IssueDetails, ProfileWarnings } from "./diagnostics.js";
|
|
9
|
+
import { configurationVersionState, sourceRelationship } from "./configuration-display.js";
|
|
9
10
|
function issueKey(issue) {
|
|
10
11
|
if (issue.source === "selection")
|
|
11
12
|
return issue.code === "conflict" ? "selectionConflict" : "appliedInvalid";
|
|
@@ -31,7 +32,7 @@ export function ProfilesSection(props) {
|
|
|
31
32
|
const snapshot = state.snapshot;
|
|
32
33
|
const editor = state.editor;
|
|
33
34
|
const readOnly = snapshot?.readOnly === true;
|
|
34
|
-
const editorDisabled = disabled || readOnly;
|
|
35
|
+
const editorDisabled = disabled || readOnly || editor?.refreshRequired === true || editor?.revision === "unavailable";
|
|
35
36
|
const reconcilable = canReconcileSelection(snapshot);
|
|
36
37
|
const selectionConflict = reconcilable && snapshot?.selectionError?.code === "conflict";
|
|
37
38
|
const invalid = state.issue?.kind === "domain" && state.issue.code === "validation";
|
|
@@ -66,18 +67,19 @@ export function ProfilesSection(props) {
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
}, [state.issue, state.busy, state.validationEpoch]);
|
|
69
|
-
const
|
|
70
|
+
const relationship = editor?.revision != null && editor.id === snapshot?.selectedId ? sourceRelationship(snapshot, editor.revision) : "changed";
|
|
71
|
+
const applied = relationship === "current";
|
|
70
72
|
let selection = t(snapshot === null ? "unavailable" : "baseline");
|
|
71
73
|
if (snapshot?.selectionError !== undefined && !selectionConflict)
|
|
72
74
|
selection = t("appliedInvalid");
|
|
73
75
|
else if (snapshot?.selectedId !== null && snapshot?.selectedId !== undefined)
|
|
74
|
-
selection = t("appliedProfile", { id: snapshot.selectedId, revision: snapshot.
|
|
76
|
+
selection = t("appliedProfile", { id: snapshot.selectedId, revision: t(configurationVersionState(snapshot.sourceRevision)) });
|
|
75
77
|
const notice = state.notice === null ? "" : t(state.notice.key === "reset" ? "resetDone" : state.notice.key, { id: state.notice.id });
|
|
76
78
|
const warnings = editor === null ? [] : draftWarnings(editor.content);
|
|
77
|
-
return _jsxs("section", { className: "dsmm-profiles", "aria-
|
|
78
|
-
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") })] }), snapshot !== null && snapshot.profiles.
|
|
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") }), _jsxs("section", { className: "dsmm-zone", "aria-labelledby": `${prefix}-browse`, "data-dsmm-zone": "browse", children: [_jsx("h3", { id: `${prefix}-browse`, children: t("browseZone") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || snapshot === null, onClick: () => { void props.create(); }, children: t("new") }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => { void props.refresh(); }, children: t(state.busy === "refresh" ? "refreshing" : "refresh") })] }), 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) => { if (event.currentTarget.value)
|
|
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") })] }), 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") {
|
|
79
81
|
event.preventDefault();
|
|
80
82
|
props.cancelDiscard();
|
|
81
|
-
} }, 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("section", { className: "dsmm-zone", "aria-labelledby": `${prefix}-edit`, "data-dsmm-zone": "edit", children: [_jsx("h3", { id: `${prefix}-edit`, children: t("editZone") }), editor === null && _jsx("p", { className: "dsmm-hint", children: t("noEditor") }), editor !== null && _jsxs("div", { className: "dsmm-editor", children: [_jsx("p", { "data-dsmm-editor-state": true, children: t(state.dirty ? "dirty" : applied ? "savedApplied" :
|
|
83
|
+
} }, 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("section", { className: "dsmm-zone", "aria-labelledby": `${prefix}-edit`, "data-dsmm-zone": "edit", children: [_jsx("h3", { id: `${prefix}-edit`, children: t("editZone") }), editor === null && _jsx("p", { className: "dsmm-hint", children: t("noEditor") }), editor !== null && _jsxs("div", { className: "dsmm-editor", children: [_jsx("p", { "data-dsmm-editor-state": true, children: t(editor.refreshRequired ? "savedRefreshRequired" : state.dirty ? "dirty" : applied ? "savedApplied" : relationship === "unknown" ? "savedRelationshipUnknown" : "savedNotApplied") }), _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") }), editor.revision !== null && _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => { void props.reload(); }, children: t("reload") })] }), 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-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 || 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", { 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") })] }), _jsx(StructuredEditor, { state: state, actions: props, disabled: editorDisabled, t: t }, `structured:${state.editorEpoch}`), _jsxs("details", { ref: advancedRef, className: "dsmm-advanced", children: [_jsx("summary", { children: t("advanced") }), _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}`)] }), 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 })] })] }), _jsxs("section", { className: "dsmm-zone", "aria-labelledby": `${prefix}-global`, "data-dsmm-zone": "future-default", children: [_jsx("h3", { id: `${prefix}-global`, children: t("globalScope") }), _jsx("p", { id: `${prefix}-global-action`, className: "dsmm-hint", children: t("newSessions") }), _jsx("p", { "data-dsmm-selection": true, children: selection }), 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, _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", "aria-describedby": `${prefix}-global-action`, disabled: editorDisabled || state.dirty || editor?.revision == null || !reconcilable || (applied && !selectionConflict), onClick: () => { void props.apply(); }, children: t(state.busy === "apply" ? "applying" : "apply") }), _jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || !reconcilable || (snapshot?.selectedId === null && !selectionConflict), onClick: () => { void props.reset(); }, children: t(state.busy === "reset" ? "resetting" : "reset") })] }), snapshot?.selectionError !== undefined && _jsxs("div", { className: "dsmm-issue", children: [_jsx("p", { children: t(selectionConflict ? "selectionConflict" : "retry") }), _jsx(IssueDetails, { issue: snapshot.selectionError, t: t })] })] }), _jsx("section", { className: "dsmm-zone", "aria-label": t("sessionScope"), "data-dsmm-zone": "current-session", children: _jsx(SessionScope, { state: state, actions: props, 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 })] });
|
|
82
84
|
}
|
|
83
85
|
//# sourceMappingURL=ProfilesSection.js.map
|
|
@@ -14,6 +14,6 @@ export function RoleAvailability({ value, t }) {
|
|
|
14
14
|
const state = roleAvailability(value);
|
|
15
15
|
if (state === undefined)
|
|
16
16
|
return _jsx("p", { className: "dsmm-hint", children: t("availabilityUnknown") });
|
|
17
|
-
return _jsxs("div", { className: "dsmm-availability", "data-dsmm-role-availability": state.id, children: [_jsx("p", { children: t(state.required ? "roleRequired" : "roleOptional", { reason: state.requiredReason ?? "—" }) }), _jsx("p", { children: t("roleCeiling", { startup: t(state.startupAvailable ? "enabled" : "disabled"), deployment: t(state.deploymentEnabled ? "enabled" : "disabled"), admitted: t(state.admitted ? "enabled" : "disabled") }) }), _jsx("p", { className: "dsmm-hint", children: t("roleProvenance", { source: state.source, capture: state.capture }) })
|
|
17
|
+
return _jsxs("div", { className: "dsmm-availability", "data-dsmm-role-availability": state.id, children: [_jsx("p", { children: t(state.required ? "roleRequired" : "roleOptional", { reason: state.requiredReason ?? "—" }) }), state.reason !== undefined && _jsx("p", { children: t("roleUnavailableReason", { reason: state.reason }) }), _jsxs("details", { children: [_jsx("summary", { children: t("technicalDetails") }), _jsx("p", { children: t("roleCeiling", { startup: t(state.startupAvailable ? "enabled" : "disabled"), deployment: t(state.deploymentEnabled ? "enabled" : "disabled"), admitted: t(state.admitted ? "enabled" : "disabled") }) }), _jsx("p", { className: "dsmm-hint", children: t("roleProvenance", { source: state.source, capture: state.capture }) })] })] });
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=RoleAvailability.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DsmmInvocationView } from "../profile-types.js";
|
|
2
|
+
import type { ToolArgs } from "@deepseek-ai/dsh-client-ui-conversation/client";
|
|
3
|
+
/** Presentation keys only; this table does not describe callable admission. */
|
|
4
|
+
export declare const roleToolKeys: {
|
|
5
|
+
readonly dsmm_planner: "dsmm-planner";
|
|
6
|
+
readonly dsmm_plan_critic: "dsmm-plan-critic";
|
|
7
|
+
readonly dsmm_builder: "dsmm-builder";
|
|
8
|
+
readonly dsmm_reviewer: "dsmm-reviewer";
|
|
9
|
+
readonly dsmm_oracle: "dsmm-oracle";
|
|
10
|
+
readonly dsmm_oracle_2nd: "dsmm-oracle-2nd";
|
|
11
|
+
readonly dsmm_code_search: "dsmm-code-search";
|
|
12
|
+
readonly dsmm_doc_search: "dsmm-doc-search";
|
|
13
|
+
readonly dsmm_clarifier: "dsmm-clarifier";
|
|
14
|
+
readonly dsmm_media_reader: "dsmm-media-reader";
|
|
15
|
+
};
|
|
16
|
+
export declare function roleToolArguments(raw: string): Record<string, unknown> | undefined;
|
|
17
|
+
export declare function requestedRoleTool(toolName: string, raw: string): {
|
|
18
|
+
readonly kind: "role" | "category";
|
|
19
|
+
readonly target: string | undefined;
|
|
20
|
+
readonly level: string | undefined;
|
|
21
|
+
readonly description: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
/** Read during render: the native owner republishes changes to these lazy answers. */
|
|
24
|
+
export declare function preparingRoleTool(toolName: string, args: ToolArgs): {
|
|
25
|
+
requested: {
|
|
26
|
+
readonly kind: "role" | "category";
|
|
27
|
+
readonly target: string | undefined;
|
|
28
|
+
readonly level: string | undefined;
|
|
29
|
+
readonly description: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
preview: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function actualRoleTool(toolName: string, meta: unknown, failed: boolean): DsmmInvocationView | undefined;
|
|
34
|
+
export declare function roleToolDisplay(target: string): string;
|
|
35
|
+
//# sourceMappingURL=RoleToolView-data.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { parseDsmmInvocationView } from "../profile-remote.js";
|
|
2
|
+
/** Presentation keys only; this table does not describe callable admission. */
|
|
3
|
+
export const roleToolKeys = {
|
|
4
|
+
dsmm_planner: "dsmm-planner", dsmm_plan_critic: "dsmm-plan-critic", dsmm_builder: "dsmm-builder",
|
|
5
|
+
dsmm_reviewer: "dsmm-reviewer", dsmm_oracle: "dsmm-oracle", dsmm_oracle_2nd: "dsmm-oracle-2nd",
|
|
6
|
+
dsmm_code_search: "dsmm-code-search", dsmm_doc_search: "dsmm-doc-search", dsmm_clarifier: "dsmm-clarifier",
|
|
7
|
+
dsmm_media_reader: "dsmm-media-reader",
|
|
8
|
+
};
|
|
9
|
+
const categories = new Set(["dsmm-creative", "dsmm-frontend", "dsmm-hard-reasoning", "dsmm-research", "dsmm-quick", "dsmm-coding", "dsmm-normal-task", "dsmm-complex", "dsmm-deep", "dsmm-documenting", "dsmm-cross-cutting"]);
|
|
10
|
+
const roles = new Set(Object.values(roleToolKeys));
|
|
11
|
+
export function roleToolArguments(raw) {
|
|
12
|
+
try {
|
|
13
|
+
const value = JSON.parse(raw);
|
|
14
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function requestedRoleTool(toolName, raw) {
|
|
21
|
+
const args = roleToolArguments(raw), kind = toolName === "dsmm_category" ? "category" : "role";
|
|
22
|
+
const fixed = Object.hasOwn(roleToolKeys, toolName) ? roleToolKeys[toolName] : undefined;
|
|
23
|
+
const candidate = fixed ?? args?.[kind];
|
|
24
|
+
const target = typeof candidate === "string" && (kind === "category" ? categories : roles).has(candidate) ? candidate : undefined;
|
|
25
|
+
const level = typeof args?.level === "string" && ["normal", "low", "high", "max"].includes(args.level) ? args.level : undefined;
|
|
26
|
+
return { kind, target, level, description: typeof args?.description === "string" ? args.description : undefined };
|
|
27
|
+
}
|
|
28
|
+
/** Read during render: the native owner republishes changes to these lazy answers. */
|
|
29
|
+
export function preparingRoleTool(toolName, args) {
|
|
30
|
+
const received = Object.fromEntries(args.keys().flatMap(key => {
|
|
31
|
+
const value = args.text(key) ?? args.value(key);
|
|
32
|
+
return value === undefined ? [] : [[key, value]];
|
|
33
|
+
}));
|
|
34
|
+
const complete = Object.fromEntries(Object.entries(received).filter(([key]) => args.complete(key)));
|
|
35
|
+
return { requested: requestedRoleTool(toolName, args.invalid ? "" : JSON.stringify(complete)),
|
|
36
|
+
preview: Object.keys(received).length === 0 ? "" : JSON.stringify(received, null, 2) };
|
|
37
|
+
}
|
|
38
|
+
export function actualRoleTool(toolName, meta, failed) {
|
|
39
|
+
if (failed)
|
|
40
|
+
return undefined;
|
|
41
|
+
try {
|
|
42
|
+
const value = parseDsmmInvocationView(meta);
|
|
43
|
+
return (toolName === "dsmm_category" ? categories : roles).has(value.role) ? value : undefined;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function roleToolDisplay(target) {
|
|
50
|
+
return target.slice("dsmm-".length).split("-").map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=RoleToolView-data.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const ROLE_TOOL_NS = "conversation.dsmm-role-tool";
|
|
2
|
+
export declare const roleToolEn: {
|
|
3
|
+
readonly call: "Call";
|
|
4
|
+
readonly unknownTarget: "DSMM agent · target pending";
|
|
5
|
+
readonly requested: "Requested";
|
|
6
|
+
readonly actual: "Actual";
|
|
7
|
+
readonly role: "Role";
|
|
8
|
+
readonly category: "Category";
|
|
9
|
+
readonly unknown: "Unknown";
|
|
10
|
+
readonly preparing: "Preparing";
|
|
11
|
+
readonly running: "Running";
|
|
12
|
+
readonly result: "Tool returned · child completion not inferred";
|
|
13
|
+
readonly background: "Started / handed off · child completion not confirmed";
|
|
14
|
+
readonly error: "Tool error";
|
|
15
|
+
readonly stopped: "Interrupted";
|
|
16
|
+
readonly args: "Original arguments";
|
|
17
|
+
readonly preparingArgs: "Arguments received so far";
|
|
18
|
+
readonly output: "Complete result content";
|
|
19
|
+
readonly failure: "Error details";
|
|
20
|
+
readonly metadata: "Invocation metadata";
|
|
21
|
+
readonly inspect: "Inspect tool call";
|
|
22
|
+
readonly copy: "Copy";
|
|
23
|
+
readonly copied: "Copied";
|
|
24
|
+
readonly emptyArgs: "Arguments not available yet";
|
|
25
|
+
readonly unavailable: "Actual identity unavailable; requested identity only";
|
|
26
|
+
readonly level: "Level";
|
|
27
|
+
readonly route: "Reported route";
|
|
28
|
+
readonly routeSource: "Route source";
|
|
29
|
+
};
|
|
30
|
+
export declare const roleToolZh: Record<keyof typeof roleToolEn, string>;
|
|
31
|
+
declare module "@deepseek-ai/dsh-client-ui-slots" {
|
|
32
|
+
interface LocaleNamespaceMap {
|
|
33
|
+
"conversation.dsmm-role-tool": keyof typeof roleToolEn;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=RoleToolView-locales.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const ROLE_TOOL_NS = "conversation.dsmm-role-tool";
|
|
2
|
+
export const roleToolEn = {
|
|
3
|
+
call: "Call", unknownTarget: "DSMM agent · target pending",
|
|
4
|
+
requested: "Requested", actual: "Actual", role: "Role", category: "Category", unknown: "Unknown",
|
|
5
|
+
preparing: "Preparing", running: "Running", result: "Tool returned · child completion not inferred",
|
|
6
|
+
background: "Started / handed off · child completion not confirmed", error: "Tool error", stopped: "Interrupted",
|
|
7
|
+
args: "Original arguments", preparingArgs: "Arguments received so far", output: "Complete result content", failure: "Error details", metadata: "Invocation metadata",
|
|
8
|
+
inspect: "Inspect tool call", copy: "Copy", copied: "Copied", emptyArgs: "Arguments not available yet",
|
|
9
|
+
unavailable: "Actual identity unavailable; requested identity only", level: "Level", route: "Reported route", routeSource: "Route source",
|
|
10
|
+
};
|
|
11
|
+
export const roleToolZh = {
|
|
12
|
+
call: "调用", unknownTarget: "DSMM 代理 · 目标待确定",
|
|
13
|
+
requested: "请求", actual: "实际", role: "角色", category: "类别", unknown: "未知",
|
|
14
|
+
preparing: "准备中", running: "运行中", result: "工具已返回 · 不推断子任务完成",
|
|
15
|
+
background: "已启动/移交 · 尚未确认子任务完成", error: "工具错误", stopped: "已中断",
|
|
16
|
+
args: "原始参数", preparingArgs: "目前已收到的参数", output: "完整结果内容", failure: "错误详情", metadata: "调用元数据",
|
|
17
|
+
inspect: "检查工具调用", copy: "复制", copied: "已复制", emptyArgs: "参数尚不可用",
|
|
18
|
+
unavailable: "实际身份不可用,仅显示请求身份", level: "等级", route: "报告的路由", routeSource: "路由来源",
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=RoleToolView-locales.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import type { ToolCallViewProps } from "@deepseek-ai/dsh-client-ui-tool/client";
|
|
3
|
+
import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
|
|
4
|
+
import { ROLE_TOOL_NS } from "./RoleToolView-locales.js";
|
|
5
|
+
type Props = ToolCallViewProps & PropsLocale<typeof ROLE_TOOL_NS>;
|
|
6
|
+
export declare function RoleToolView(props: Props): import("react").JSX.Element;
|
|
7
|
+
/** Called once by the parent client apply(ctx), alongside the other slot registrations. */
|
|
8
|
+
export declare function registerRoleToolViews(ctx: Context): void;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=RoleToolView.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
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";
|
|
4
|
+
import { ROLE_TOOL_NS, roleToolEn, roleToolZh } from "./RoleToolView-locales.js";
|
|
5
|
+
const styles = `
|
|
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
|
+
.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}
|
|
9
|
+
.dsmm-role-tool .dsmm-role-text{flex:1;min-width:0}
|
|
10
|
+
.dsmm-role-tool .dsmm-role-body{display:flex;flex-direction:column;gap:12px;min-width:0;padding:8px 0}
|
|
11
|
+
.dsmm-role-tool p{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
|
|
12
|
+
.dsmm-role-tool .dsmm-role-status{color:var(--dsw-alias-label-secondary)}
|
|
13
|
+
.dsmm-role-tool .dsmm-role-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
|
|
14
|
+
.dsmm-role-tool :is(button,[role=button]):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
|
+
`;
|
|
16
|
+
export function RoleToolView(props) {
|
|
17
|
+
const { expanded, toggle } = props.useDisclosure();
|
|
18
|
+
const partial = props.phase === "preparing" ? preparingRoleTool(props.toolName, props.block.args) : undefined;
|
|
19
|
+
const { t } = props;
|
|
20
|
+
const raw = props.phase === "preparing" ? partial.preview : props.phase === "start" ? props.block.argsRaw : props.block.call?.argsRaw ?? "";
|
|
21
|
+
const requested = partial?.requested ?? requestedRoleTool(props.toolName, raw);
|
|
22
|
+
const result = props.phase === "result" ? props.block : undefined;
|
|
23
|
+
const failed = result !== undefined && (result.isError || result.error != null);
|
|
24
|
+
const actual = result === undefined ? undefined : actualRoleTool(props.toolName, result.meta, failed);
|
|
25
|
+
const target = actual?.role ?? requested.target;
|
|
26
|
+
const title = `${t("call")} ${target === undefined ? t("unknownTarget") : roleToolDisplay(target)}${(actual?.level ?? requested.level) === undefined ? "" : ` · ${actual?.level ?? requested.level}`}`;
|
|
27
|
+
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
|
+
const code = (value) => _jsx(CodeBlock, { code: value, copyLabel: t("copy"), copiedLabel: t("copied") });
|
|
29
|
+
return _jsxs("div", { className: "dsmm-role-tool", "data-dsmm-role-tool": props.toolName, "data-identity": actual === undefined ? "requested" : "actual", "data-state": state, 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", { children: [props.toolName, " \u00B7 ", props.callId] }), _jsxs("p", { className: "dsmm-role-status", children: [t("requested"), " ", t(requested.kind), ": ", requested.target === undefined ? t("unknown") : roleToolDisplay(requested.target)] }), requested.description !== undefined && _jsx("p", { className: "dsmm-role-status", children: requested.description }), actual !== undefined && _jsxs(_Fragment, { children: [_jsxs("p", { children: [t("actual"), " ", t(requested.kind), ": ", roleToolDisplay(actual.role), " \u00B7 ", t("level"), ": ", actual.level] }), _jsxs("p", { children: [t("routeSource"), ": ", actual.routeSource, " \u00B7 ", t("route"), ": ", actual.route === undefined ? t("unknown") : `${actual.route.provider}/${actual.route.model}${actual.route.reasoningEffort === undefined ? "" : ` · ${actual.route.reasoningEffort}`}`] })] }), _jsxs("div", { children: [_jsx("p", { children: t(props.phase === "preparing" ? "preparingArgs" : "args") }), raw === "" ? _jsx("p", { children: t("emptyArgs") }) : code(raw)] }), result !== undefined && _jsxs(_Fragment, { children: [actual === undefined && _jsx("p", { children: t("unavailable") }), _jsxs("div", { children: [_jsx("p", { children: t("output") }), code(JSON.stringify(result.content, null, 2))] }), result.error != null && _jsxs("div", { children: [_jsx("p", { children: t("failure") }), code(JSON.stringify(result.error, null, 2))] }), result.meta != null && _jsxs("div", { children: [_jsx("p", { 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
|
+
}
|
|
31
|
+
/** Called once by the parent client apply(ctx), alongside the other slot registrations. */
|
|
32
|
+
export function registerRoleToolViews(ctx) {
|
|
33
|
+
ctx.effect(() => ctx.locale.register(ROLE_TOOL_NS, { en: roleToolEn, zh: roleToolZh }), "dsmm: role tool locale");
|
|
34
|
+
ctx.effect(() => {
|
|
35
|
+
const style = document.createElement("style");
|
|
36
|
+
style.dataset.dsmmRoleToolStyles = "";
|
|
37
|
+
style.textContent = styles;
|
|
38
|
+
document.head.append(style);
|
|
39
|
+
return () => style.remove();
|
|
40
|
+
}, "dsmm: role tool styles");
|
|
41
|
+
ctx.slots.inject("tool.call.toolview", () => {
|
|
42
|
+
const disposers = [...Object.keys(roleToolKeys), "dsmm_role", "dsmm_category"].map(key => ctx.slots.register({ name: "tool.call.toolview", key, locale: ROLE_TOOL_NS }, RoleToolView));
|
|
43
|
+
return () => { for (const dispose of disposers.reverse())
|
|
44
|
+
dispose(); };
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=RoleToolView.js.map
|
|
@@ -6,7 +6,21 @@ import { IssueDetails, ProfileWarnings, profileWarnings } from "./diagnostics.js
|
|
|
6
6
|
import { RoleAvailability } from "./RoleAvailability.js";
|
|
7
7
|
import { parseSubagentRuntimeAdmissionView } from "../profile-remote.js";
|
|
8
8
|
import { isSafeDiagnosticField } from "../profile-diagnostics.js";
|
|
9
|
-
|
|
9
|
+
import { isConfigRevision } from "../config-revision.js";
|
|
10
|
+
import { sourceRelationship, writableSelectionVersion } from "./configuration-display.js";
|
|
11
|
+
const MENU_ISSUE_CODES = new Set(["validation", "conflict", "not-found", "lock-timeout", "unsafe-path", "io", "activation", "corrupt-selection", "limit", "busy", "maintenance", "disposed", "not-owned", "unavailable", "cancelled", "module-off", "runtime-unavailable", "new-session-required", "model-unconfigured", "model-choice-changed", "model-service-unavailable", "model-observation-unavailable", "model-selection-failed"]);
|
|
12
|
+
function capabilityReason(reason, t) {
|
|
13
|
+
switch (reason) {
|
|
14
|
+
case "busy": return t("headerBusy");
|
|
15
|
+
case "maintenance": return t("headerMaintenanceRefused");
|
|
16
|
+
case "module-off": return t("sessionModuleOff");
|
|
17
|
+
case "runtime-unavailable": return t("headerUnavailableRefused");
|
|
18
|
+
case "model-unconfigured": return t("headerNoProfileModel");
|
|
19
|
+
case "model-service-unavailable": return t("headerModelUnconfirmed");
|
|
20
|
+
case "new-session-required": return t("sessionNewRequired");
|
|
21
|
+
default: return t("headerActionUnavailable");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
10
24
|
function menuIssue(issue) {
|
|
11
25
|
const code = MENU_ISSUE_CODES.has(issue.code) ? issue.code : issue.kind === "transport" ? "transport" : "unavailable";
|
|
12
26
|
const field = issue.field;
|
|
@@ -19,9 +33,11 @@ export function SessionScope({ state, actions, t, compact = false }) {
|
|
|
19
33
|
const session = state.session;
|
|
20
34
|
const labels = session === null ? null : sessionProfileLabels(session, t);
|
|
21
35
|
const selected = state.snapshot?.profiles.find((profile) => profile.id === state.sessionChoice);
|
|
22
|
-
const disabled = state.busy !== null || state.pendingEditor !== null || state.sessionBusy !== null || state.dirty;
|
|
23
|
-
const current = () => actions.readProfileView().currentSessionId === state.currentSessionId;
|
|
24
|
-
const
|
|
36
|
+
const disabled = state.busy !== null || state.pendingEditor !== null || state.sessionBusy !== null || state.dirty || state.invalidFields.length > 0;
|
|
37
|
+
const current = () => { const live = actions.readProfileView(); return live.currentSessionId === state.currentSessionId && live.sessionViewEpoch === state.sessionViewEpoch && live.session === session; };
|
|
38
|
+
const ready = session !== null && !state.sessionUnconfirmed && !session.refreshRequired && !session.selection.refreshRequired && writableSelectionVersion(session.selection.selectionRevision);
|
|
39
|
+
const allowed = ready && session.canApplyOverlay === true && session.applyOverlayUnavailableReason !== "new-session-required";
|
|
40
|
+
const modelAllowed = ready && session.canSelectModel === true && session.profileModel !== undefined;
|
|
25
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");
|
|
26
42
|
let binding = session?.subagentRuntime;
|
|
27
43
|
try {
|
|
@@ -31,12 +47,12 @@ export function SessionScope({ state, actions, t, compact = false }) {
|
|
|
31
47
|
catch {
|
|
32
48
|
binding = undefined;
|
|
33
49
|
}
|
|
34
|
-
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("
|
|
35
|
-
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: profile.revision
|
|
36
|
-
void actions.useSessionProfileModel(); }, children: t("headerUseCurrentModel") }), session !== null && _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
|
|
37
|
-
void actions.applySession(); }, children: t(state.sessionBusy === "apply" ? "sessionApplying" : "sessionApply") }), !compact && _jsx(Button, { type: "button", variant: "outline", disabled: disabled || !allowed, onClick: () => { if (current())
|
|
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?.warnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("admissionWarnings") }), _jsx(ProfileWarnings, { warnings: session.warnings, t: t })] }) : null, 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())
|
|
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("sessionModelHint") }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || !modelAllowed, "aria-describedby": !modelAllowed ? `${prefix}-model-reason` : undefined, onClick: () => { if (current())
|
|
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 }) })] })] }), 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") }), _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
|
+
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())
|
|
38
54
|
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())
|
|
39
|
-
void actions.refreshSession(); }, children: t("sessionRefresh") })] })
|
|
55
|
+
void actions.refreshSession(); }, children: t("sessionRefresh") })] })] }), state.sessionIssue !== null && _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")
|
|
40
56
|
: state.sessionIssue.code === "conflict" ? t("sessionConflict")
|
|
41
57
|
: ["busy", "maintenance", "disposed", "not-owned"].includes(state.sessionIssue.code) ? t("sessionBusy", { reason: state.sessionIssue.code })
|
|
42
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 })] });
|
|
@@ -58,10 +74,16 @@ export function SessionProfiles(props) {
|
|
|
58
74
|
const profiles = state.snapshot?.profiles ?? [];
|
|
59
75
|
const currentSaved = profiles.find((profile) => profile.id === current);
|
|
60
76
|
const committing = state.sessionBusy !== null;
|
|
61
|
-
const
|
|
62
|
-
|
|
77
|
+
const unavailable = id === null || committing || state.busy !== null || state.sessionUnconfirmed || session === null || session.refreshRequired === true || session.selection.refreshRequired === true;
|
|
78
|
+
const profileDisabled = unavailable || state.pendingEditor !== null || state.dirty || state.invalidFields.length > 0
|
|
79
|
+
|| session === null || !writableSelectionVersion(session.selection.selectionRevision);
|
|
80
|
+
const disabled = profileDisabled || session?.canApplyOverlay !== true || session?.applyOverlayUnavailableReason === "new-session-required" || state.snapshot === null;
|
|
63
81
|
let feedback = "";
|
|
64
|
-
if (state.
|
|
82
|
+
if (state.sessionUnconfirmed)
|
|
83
|
+
feedback = t("sessionUnconfirmedRefresh");
|
|
84
|
+
else if (session?.refreshRequired || session?.selection.refreshRequired)
|
|
85
|
+
feedback = t("sessionCommittedRefresh");
|
|
86
|
+
else if (state.sessionIssue !== null)
|
|
65
87
|
feedback = t(state.sessionIssue.source === "profile-model" ? state.sessionIssue.code === "model-unconfigured" ? "headerNoProfileModel" : state.sessionIssue.code === "model-choice-changed" ? "headerModelChoiceChanged" : "headerModelUnconfirmed"
|
|
66
88
|
: state.sessionIssue.code === "conflict" ? "headerConflict" : state.sessionIssue.code === "activation" ? "headerActivationRefused"
|
|
67
89
|
: state.sessionIssue.code === "maintenance" ? "headerMaintenanceRefused" : state.sessionIssue.code === "busy" ? "headerBusyRefused"
|
|
@@ -71,28 +93,28 @@ export function SessionProfiles(props) {
|
|
|
71
93
|
else if (state.dirty || state.invalidFields.length > 0 || state.pendingEditor !== null)
|
|
72
94
|
feedback = t("headerDraft");
|
|
73
95
|
else if (id === null)
|
|
74
|
-
feedback = t("
|
|
96
|
+
feedback = t("sessionChooseWorkspace");
|
|
75
97
|
else if (session === null || state.snapshot === null)
|
|
76
98
|
feedback = t("headerUnavailable");
|
|
77
|
-
else if (!session.switchAllowed)
|
|
78
|
-
feedback = t("headerBusy");
|
|
79
99
|
else if (state.sessionNotice !== null)
|
|
80
100
|
feedback = t(state.sessionNotice === "mode-on" ? "headerModeOn" : state.sessionNotice === "mode-off" ? "headerModeOff" : state.sessionNotice === "applied-with-model" ? "headerAppliedWithModel" : "headerApplied");
|
|
81
|
-
const profileName = unknownCaptured ? t("headerCaptured") : currentSaved?.revision ===
|
|
101
|
+
const profileName = unknownCaptured ? t("headerCaptured") : admission !== undefined && sourceRelationship(admission, currentSaved?.revision) === "current" && currentSaved?.label?.trim() ? currentSaved.label : admission?.selectedId ?? t("sessionBaseline");
|
|
82
102
|
const currentLabel = t("headerCurrentProfile", { profile: session === null ? t("headerUnavailable") : profileName });
|
|
83
103
|
const entries = [{ type: "label", id: "@current", text: currentLabel }];
|
|
84
104
|
for (const warning of profileWarnings(session?.warnings))
|
|
85
105
|
entries.push({ type: "label", id: `@warning:${warning.code}`, text: t("warningMarker", { code: warning.code, field: warning.field }) });
|
|
86
|
-
if (id === null && state.snapshot !== null)
|
|
106
|
+
if ((id === null || session?.canApplyOverlay === true) && state.snapshot !== null)
|
|
87
107
|
entries.push({ type: "label", id: "@future", text: t("sessionFutureDefault", { profile: state.snapshot.profiles.find((profile) => profile.id === state.snapshot.selectedId)?.label?.trim() || state.snapshot.selectedId || t("sessionBaseline") }) });
|
|
88
|
-
if (feedback !== "" && (state.sessionNotice === null || state.sessionIssue !== null))
|
|
108
|
+
if (feedback !== "" && (state.sessionNotice === null || state.sessionIssue !== null || state.sessionUnconfirmed || session?.refreshRequired || session?.selection.refreshRequired))
|
|
89
109
|
entries.push({ type: "label", id: "@status", text: feedback });
|
|
90
110
|
const mode = session?.deepwork;
|
|
91
111
|
entries.push({ id: "@mode", label: t(mode === undefined ? "headerModeUnavailable" : mode.locked ? "headerModePreset" : mode.active ? "headerModeDisable" : "headerModeEnable"),
|
|
92
|
-
disabled:
|
|
112
|
+
disabled: unavailable || session?.canToggleMode !== true || mode === undefined || mode.locked });
|
|
113
|
+
if (session !== null && session.canToggleMode !== true)
|
|
114
|
+
entries.push({ type: "label", id: "@mode-reason", text: capabilityReason(session.toggleModeUnavailableReason, t) });
|
|
93
115
|
const diagnostic = state.sessionIssue === null ? null : menuIssue(state.sessionIssue);
|
|
94
116
|
const diagnosticText = diagnostic === null ? "" : t("headerIssueCode", { code: diagnostic.code }) + (diagnostic.field === undefined ? "" : ` ${t("headerIssueField", { field: diagnostic.field })}`);
|
|
95
|
-
const retryHint = t(diagnostic?.code === "maintenance" || diagnostic?.code === "busy" ? "headerWaitRetryHint" : "headerRetryHint");
|
|
117
|
+
const retryHint = t(state.sessionUnconfirmed ? "sessionUnconfirmedRefresh" : diagnostic?.code === "maintenance" || diagnostic?.code === "busy" ? "headerWaitRetryHint" : "headerRetryHint");
|
|
96
118
|
if (diagnostic !== null)
|
|
97
119
|
entries.push({ type: "label", id: "@diagnostic", text: diagnosticText }, { type: "label", id: "@retry", text: retryHint });
|
|
98
120
|
if (admission?.selectedId != null && currentSaved === undefined)
|
|
@@ -100,17 +122,22 @@ export function SessionProfiles(props) {
|
|
|
100
122
|
if (unknownCaptured)
|
|
101
123
|
entries.push({ id: "__dsmm_captured_default__", label: t("headerCaptured"), disabled: true });
|
|
102
124
|
entries.push({ type: "separator", id: "@keep-separator" }, { type: "label", id: "@keep-heading", text: t("headerCompactProfiles") }, { id: "", label: t("sessionBaseline"), disabled });
|
|
125
|
+
if (session !== null && (session.canApplyOverlay !== true || session.applyOverlayUnavailableReason === "new-session-required"))
|
|
126
|
+
entries.push({ type: "label", id: "@overlay-reason", text: capabilityReason(session.applyOverlayUnavailableReason, t) });
|
|
103
127
|
for (const profile of profiles)
|
|
104
|
-
entries.push({ id: profile.id, label: (profile.label?.trim() ? profile.label : profile.id) + (profile.error === undefined && profile.revision
|
|
105
|
-
entries.push({ type: "separator", id: "@model-separator" }, { id: "@use-model", label: t("headerUseCurrentModel"), disabled:
|
|
128
|
+
entries.push({ id: profile.id, label: (profile.label?.trim() ? profile.label : profile.id) + (profile.error === undefined && isConfigRevision(profile.revision) ? "" : ` — ${t("headerSavedUnavailable")}`) + (profileWarnings(profile.warnings).length ? ` — ${t("warningProfile")}` : ""), disabled: disabled || !isConfigRevision(profile.revision) || profile.error !== undefined });
|
|
129
|
+
entries.push({ type: "separator", id: "@model-separator" }, { id: "@use-model", label: t("headerUseCurrentModel"), disabled: profileDisabled || session?.canSelectModel !== true || session?.profileModel === undefined });
|
|
130
|
+
if (session !== null && session.canSelectModel !== true)
|
|
131
|
+
entries.push({ type: "label", id: "@model-reason", text: capabilityReason(session.selectModelUnavailableReason, t) });
|
|
106
132
|
const open = openFor === id;
|
|
107
133
|
return _jsxs("div", { className: "dsmm-header-profiles", "data-dsmm-header-profile": true, "aria-busy": committing, children: [_jsx(Menu, { open: open, autoFocus: true, portal: true, align: "start", className: "dsmm-profile-anchor", listClassName: "dsmm-profile-menu", items: entries, selectedId: current, footer: [{ id: "@refresh", label: t("headerCompactRefresh"), disabled: committing || state.busy !== null }], anchor: _jsx(Button, { type: "button", size: "sm", variant: "toolbar", className: "dsmm-profile-trigger", icon: _jsx(IconBranchOutlineRegular, {}), "aria-label": t("headerProfileLabel"), "aria-haspopup": "menu", "aria-expanded": open, "aria-describedby": `${prefix}-feedback`, onClick: () => setOpenFor(open ? undefined : id) }), onClose: () => setOpenFor(undefined), onSelect: (value) => {
|
|
108
|
-
|
|
134
|
+
const live = props.readProfileView();
|
|
135
|
+
if (live.currentSessionId !== id || live.sessionViewEpoch !== state.sessionViewEpoch || live.session !== session)
|
|
109
136
|
return;
|
|
110
137
|
if (value === "@refresh") {
|
|
111
138
|
if (committing || state.busy !== null)
|
|
112
139
|
return;
|
|
113
|
-
void (async () => { await props.refresh(); if (id !== null && props.readProfileView().currentSessionId === id)
|
|
140
|
+
void (async () => { await props.refresh(); if (id !== null && props.readProfileView().currentSessionId === id && props.readProfileView().sessionViewEpoch === state.sessionViewEpoch)
|
|
114
141
|
await props.refreshSession(); })();
|
|
115
142
|
}
|
|
116
143
|
else {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
|
|
2
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
3
|
+
import type { ConnectionHandle } from "@deepseek-ai/dsh-client-connection/client";
|
|
4
|
+
import type { TemporaryPermissionRemote } from "../permission-temporary-types.js";
|
|
5
|
+
import type { TemporaryPendingApproval } from "./temporary-permission-client.js";
|
|
6
|
+
type Locale = PropsLocale<"settings.dsmm-permissions">;
|
|
7
|
+
/** Parent mounts after native approval UI and registers the existing permission dictionaries. */
|
|
8
|
+
export declare function registerTemporaryPermissionSlots(ctx: Context, connection: ConnectionHandle): void;
|
|
9
|
+
/** Render beside the native prompt, never replace its approve/reject/cancel controls. */
|
|
10
|
+
export declare function TemporaryApproval({ pending, remote, t, child }: Locale & {
|
|
11
|
+
pending: TemporaryPendingApproval;
|
|
12
|
+
remote: TemporaryPermissionRemote;
|
|
13
|
+
child?: boolean;
|
|
14
|
+
}): import("react").JSX.Element | null;
|
|
15
|
+
export declare function TemporaryGrants({ sessionId, remote, t, child }: Locale & {
|
|
16
|
+
sessionId: string;
|
|
17
|
+
remote: TemporaryPermissionRemote;
|
|
18
|
+
child?: boolean;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=TemporaryPermissions.d.ts.map
|