@dsmm/dsmm 0.2.2 → 0.3.1
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 -42
- package/cordis.patch.yml +1 -0
- package/docs/agent-presets.md +26 -14
- package/docs/compatibility.md +20 -79
- 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 +34 -240
- package/docs/roadmap.md +23 -254
- 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 +16 -2
- package/lib/child-capture.js +29 -10
- package/lib/client/ChildrenPanel.d.ts +1 -4
- package/lib/client/ChildrenPanel.js +4 -16
- package/lib/client/DeploymentFields.d.ts +28 -0
- package/lib/client/DeploymentFields.js +68 -0
- package/lib/client/DeploymentPage.d.ts +17 -5
- package/lib/client/DeploymentPage.js +79 -112
- package/lib/client/NativeCommandEntries.d.ts +17 -0
- package/lib/client/NativeCommandEntries.js +68 -0
- package/lib/client/PermissionsPanel.d.ts +1 -1
- package/lib/client/PermissionsPanel.js +8 -8
- package/lib/client/ProfilesSection.js +7 -5
- 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 +39 -15
- package/lib/client/children-controller.d.ts +2 -8
- package/lib/client/children-controller.js +1 -26
- package/lib/client/children-locales.d.ts +26 -51
- 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 +1 -0
- package/lib/client/controller.js +20 -13
- package/lib/client/deployment-controller.d.ts +13 -1
- package/lib/client/deployment-controller.js +85 -25
- 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 +35 -9
- 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/index.js +11 -74
- package/lib/client/locales.d.ts +7 -0
- package/lib/client/locales.js +12 -6
- package/lib/client/permission-controller.d.ts +1 -0
- package/lib/client/permission-controller.js +3 -2
- package/lib/client/permission-locales.d.ts +25 -0
- package/lib/client/permission-locales.js +24 -4
- 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.js +2716 -2364
- 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/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 +17 -21
- package/lib/index.js +131 -430
- 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 +56 -0
- package/lib/native-admission.js +313 -0
- package/lib/native-pi-ai-wire.d.ts +3 -1
- package/lib/native-pi-ai-wire.js +47 -13
- package/lib/permission-control.d.ts +0 -3
- package/lib/permission-rpc.js +3 -3
- 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 +39 -41
- package/lib/profile-runtime.d.ts +31 -74
- package/lib/profile-runtime.js +224 -639
- package/lib/profile-store.d.ts +18 -6
- package/lib/profile-store.js +106 -64
- package/lib/profile-types.d.ts +18 -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 -265
- 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 +2 -2
- package/lib/role-llm-runtime.js +5 -11
- package/lib/role-policy.d.ts +19 -53
- package/lib/role-policy.js +136 -525
- package/lib/role-providers.d.ts +5 -8
- package/lib/role-providers.js +20 -126
- 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 +149 -97
- package/lib/runtime-integration.d.ts +5 -109
- package/lib/runtime-integration.js +11 -779
- package/lib/session-metadata.d.ts +13 -12
- package/lib/session-metadata.js +6 -31
- package/lib/session-scope.js +6 -2
- package/lib/settings.d.ts +5 -18
- package/lib/settings.js +19 -43
- 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 +133 -113
- package/docs/research/deepseek-v4-pro.md +0 -74
- package/docs/research/oh-dsh.md +0 -96
- package/lib/child-admission.d.ts +0 -42
- package/lib/child-admission.js +0 -162
- package/lib/delivery-authority.d.ts +0 -68
- package/lib/delivery-authority.js +0 -260
- package/lib/legacy-child-policy.d.ts +0 -51
- package/lib/legacy-child-policy.js +0 -123
- package/lib/legacy-read-composition.d.ts +0 -20
- package/lib/legacy-read-composition.js +0 -144
- package/lib/legacy-read-contracts.d.ts +0 -157
- package/lib/legacy-read-contracts.js +0 -39
- package/lib/legacy-read-host.d.ts +0 -19
- package/lib/legacy-read-host.js +0 -67
- package/lib/legacy-read-integration.d.ts +0 -121
- package/lib/legacy-read-integration.js +0 -522
- package/lib/legacy-read-proxy.d.ts +0 -26
- package/lib/legacy-read-proxy.js +0 -237
- package/lib/native-child-evidence.d.ts +0 -42
- package/lib/native-child-evidence.js +0 -133
- package/lib/role-runs.d.ts +0 -135
- package/lib/role-runs.js +0 -304
- package/lib/session-persistence.d.ts +0 -35
- package/lib/session-persistence.js +0 -304
- package/lib/subagent-runtime.d.ts +0 -45
- package/lib/subagent-runtime.js +0 -131
- package/prompts/deepseek-flash.md +0 -11
- package/prompts/deepseek-v4-pro.md +0 -14
- package/scripts/cold-profile-composition.mjs +0 -329
- package/scripts/cold-profile-sources.mjs +0 -238
- package/scripts/migrate-cold-profile.mjs +0 -315
- package/scripts/repair-session-log.mjs +0 -476
- package/scripts/session-repair-native-verifier.mjs +0 -367
|
@@ -9,6 +9,6 @@ export declare function PermissionRulesEditor({ controller, state, t }: Locale &
|
|
|
9
9
|
controller: PermissionController;
|
|
10
10
|
state: PermissionView;
|
|
11
11
|
}): import("react").JSX.Element;
|
|
12
|
-
export declare function PermissionsPanel({ controller, t, sessionId }: PermissionsPanelProps): import("react").JSX.Element
|
|
12
|
+
export declare function PermissionsPanel({ controller, t, sessionId }: PermissionsPanelProps): import("react").JSX.Element;
|
|
13
13
|
export {};
|
|
14
14
|
//# sourceMappingURL=PermissionsPanel.d.ts.map
|
|
@@ -7,7 +7,7 @@ const ruleDraft = (rule) => ({ id: rule.id, action: rule.action, match: structur
|
|
|
7
7
|
const newMatch = (kind) => kind === "outside-read" ? { kind, path: "", scope: "exact" } : kind === "shell" ? { kind, executable: "", command: "", workingDirectory: "" } : { kind };
|
|
8
8
|
function Issue({ value, t }) { return value === null ? null : _jsxs("p", { className: "dsmm-issue", role: "alert", children: [t(`issue:${value}`), " ", _jsx("code", { children: value })] }); }
|
|
9
9
|
function RootState({ state, t }) {
|
|
10
|
-
return _jsxs(_Fragment, { children: [_jsxs("p", { children: [t("root"), ": ",
|
|
10
|
+
return _jsxs(_Fragment, { children: [_jsxs("p", { children: [t("root"), ": ", t(state.scope === "root" && state.connected ? "active" : "unknown")] }), state.scope !== "root" && _jsx("p", { className: "dsmm-hint", children: t(state.scope === "child" ? "child" : "noRoot") }), !state.connected && _jsx("p", { className: "dsmm-hint", children: t("unknown") })] });
|
|
11
11
|
}
|
|
12
12
|
function ActionSelect({ id, value, inherit = true, onChange, disabled, t }) {
|
|
13
13
|
return _jsx("select", { id: id, value: value, disabled: disabled, onChange: event => { const choice = actions.find(value => value === event.currentTarget.value); if (choice !== undefined)
|
|
@@ -17,7 +17,7 @@ function RuleEditor({ controller, state, t }) {
|
|
|
17
17
|
const id = useId(), editor = state.draft?.editor;
|
|
18
18
|
if (editor == null)
|
|
19
19
|
return null;
|
|
20
|
-
const disabled = state.
|
|
20
|
+
const disabled = !controller.canEdit(state.generation), change = (value) => controller.edit(state.generation, { editor: value });
|
|
21
21
|
const field = (key, label) => _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-${key}`, children: t(label) }), _jsx(Input, { className: "dsmm-input", id: `${id}-${key}`, required: true, maxLength: 32768, disabled: disabled, value: key in editor.match ? String(Reflect.get(editor.match, key)) : "", onChange: event => change({ ...editor, match: { ...editor.match, [key]: event.currentTarget.value } }) })] });
|
|
22
22
|
return _jsxs("form", { className: "dsmm-structured", "aria-label": t("editor"), onSubmit: event => { event.preventDefault(); controller.stageRule(state.generation); }, children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-id`, children: t("id") }), _jsx(Input, { className: "dsmm-input", id: `${id}-id`, required: true, maxLength: 256, value: editor.id, disabled: disabled, onChange: event => change({ ...editor, id: event.currentTarget.value }) })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-action`, children: t("action") }), _jsx(ActionSelect, { id: `${id}-action`, value: editor.action, disabled: disabled, inherit: false, t: t, onChange: action => { if (action !== "inherit")
|
|
23
23
|
change({ ...editor, action }); } })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-kind`, children: t("match") }), _jsx("select", { id: `${id}-kind`, value: editor.match.kind, disabled: disabled, onChange: event => { const kind = kinds.find(value => value === event.currentTarget.value); if (kind !== undefined)
|
|
@@ -26,21 +26,21 @@ function RuleEditor({ controller, state, t }) {
|
|
|
26
26
|
}
|
|
27
27
|
function RuleRecords({ controller, state, t }) {
|
|
28
28
|
const records = state.rules?.snapshot.policy.rules ?? state.base?.policy.rules;
|
|
29
|
-
return _jsxs("div", { className: "dsmm-structured", children: [records?.length === 0 && _jsx("p", { children: t("noRules") }), records?.map(rule => _jsxs("fieldset", { children: [_jsx("legend", { children: rule.id }), _jsxs("p", { children: [t(rule.revoked ? "revoked" : "active"), " \u00B7 ", t(`action:${rule.action}`)] }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("match") }), _jsx("dd", { children: t(`kind:${rule.match.kind}`) }), rule.match.kind === "outside-read" && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("path") }), _jsxs("dd", { children: [rule.match.path, " \u00B7 ", t(rule.match.scope)] })] }), rule.match.kind === "shell" && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("executable") }), _jsx("dd", { children: rule.match.executable }), _jsx("dt", { children: t("command") }), _jsx("dd", { children: _jsx("code", { children: rule.match.command }) }), _jsx("dt", { children: t("cwd") }), _jsx("dd", { children: rule.match.workingDirectory })] }), _jsx("dt", { children: t("
|
|
29
|
+
return _jsxs("div", { className: "dsmm-structured", children: [records?.length === 0 && _jsx("p", { children: t("noRules") }), records?.map(rule => _jsxs("fieldset", { children: [_jsx("legend", { children: rule.id }), _jsxs("p", { children: [t(rule.revoked ? "revoked" : "active"), " \u00B7 ", t(`action:${rule.action}`)] }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("match") }), _jsx("dd", { children: t(`kind:${rule.match.kind}`) }), rule.match.kind === "outside-read" && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("path") }), _jsxs("dd", { children: [rule.match.path, " \u00B7 ", t(rule.match.scope)] })] }), rule.match.kind === "shell" && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("executable") }), _jsx("dd", { children: rule.match.executable }), _jsx("dt", { children: t("command") }), _jsx("dd", { children: _jsx("code", { children: rule.match.command }) }), _jsx("dt", { children: t("cwd") }), _jsx("dd", { children: rule.match.workingDirectory })] }), _jsx("dt", { children: t("source") }), _jsx("dd", { children: t(rule.source.kind === "operator" ? "operator" : "imported") })] }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: !controller.canEdit(state.generation) || state.draft === null, onClick: () => controller.edit(state.generation, { editor: ruleDraft(rule) }), children: t("editRule") }), _jsx(Button, { type: "button", variant: "outline", disabled: !controller.canEdit(state.generation) || state.draft === null || rule.revoked || state.draft.revoke.includes(rule.id), onClick: () => controller.stageRevoke(state.generation, rule.id), children: t("stageRevoke") })] })] }, rule.id))] });
|
|
30
30
|
}
|
|
31
31
|
function PermissionCoverage({ state, t }) {
|
|
32
32
|
const value = state.rules?.capabilities;
|
|
33
|
-
return _jsxs("section", { className: "dsmm-structured", "aria-label": t("coverageTitle"), children: [_jsx("h3", { children: t("coverageTitle") }), _jsx("p", { className: "dsmm-hint", children: t("coverage") }), value === undefined ? _jsx("p", { children: t("coverageUnavailable") }) : _jsxs(_Fragment, { children: [_jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("coverageRuntime") }), _jsxs("dd", { children: [t(value.runtime.state), " \u00B7 ", t("mounted"), ": ", t(value.runtime.mounted ? "on" : "off")] })
|
|
33
|
+
return _jsxs("section", { className: "dsmm-structured", "aria-label": t("coverageTitle"), children: [_jsx("h3", { children: t("coverageTitle") }), _jsx("p", { className: "dsmm-hint", children: t("coverage") }), _jsx("p", { className: "dsmm-hint", children: t("registrationUnresolved") }), value === undefined ? _jsx("p", { children: t("coverageUnavailable") }) : _jsxs(_Fragment, { children: [_jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("coverageRuntime") }), _jsxs("dd", { children: [t(value.runtime.state), " \u00B7 ", t("mounted"), ": ", t(value.runtime.mounted ? "on" : "off")] })] }), value.runtime.restartRequired && _jsx("p", { children: t("restart") }), value.tools.length === 0 ? _jsx("p", { children: t("coverageEmpty") }) : _jsx("ul", { className: "dsmm-profile-list", children: value.tools.map(tool => _jsx("li", { children: _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("toolName") }), _jsx("dd", { children: _jsx("code", { children: tool.name }) }), _jsx("dt", { children: t("toolKind") }), _jsx("dd", { children: _jsx("code", { children: tool.kind }) }), _jsx("dt", { children: t("toolApproval") }), _jsx("dd", { children: t("nativeOnce") }), _jsx("dt", { children: t("toolMemory") }), _jsx("dd", { children: t("notProvided") })] }) }, tool.name)) }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("outsideReads") }), _jsx("dd", { children: t("limit:outsideReads") }), _jsx("dt", { children: t("finalInode") }), _jsx("dd", { children: t("limit:finalInode") }), _jsx("dt", { children: t("toolMemory") }), _jsx("dd", { children: t("limit:scopedMemory") }), _jsx("dt", { children: t("webFetch") }), _jsx("dd", { children: t("limit:webFetch") }), _jsx("dt", { children: t("searchDestinations") }), _jsx("dd", { children: t("limit:webSearchDestinations") }), _jsx("dt", { children: t("proxyBinding") }), _jsx("dd", { children: t("limit:proxyAddressBinding") }), _jsx("dt", { children: t("shellSockets") }), _jsx("dd", { children: t("limit:shellSockets") }), _jsx("dt", { children: t("providerAuthMcp") }), _jsx("dd", { children: t("limit:providerAuthMcp") })] })] }), _jsx("p", { className: "dsmm-hint", children: t("pathEvidence") })] });
|
|
34
34
|
}
|
|
35
35
|
export function PermissionRulesEditor({ controller, state, t }) {
|
|
36
|
-
const id = useId(), draft = state.draft, disabled = state.
|
|
37
|
-
return _jsxs("section", { className: "dsmm-zone", "aria-label": t("rules"), children: [_jsx("h3", { children: t("rules") }), _jsx("p", { className: "dsmm-hint", children: t("rulesHint") }), _jsx("p", { className: "dsmm-hint", children: t("networkLimit") }), _jsx("p", { className: "dsmm-hint", children: t("matchHint") }), _jsx(Issue, { value: state.rulesIssue, t: t }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("
|
|
36
|
+
const id = useId(), draft = state.draft, disabled = !controller.canEdit(state.generation), value = state.rules;
|
|
37
|
+
return _jsxs("section", { className: "dsmm-zone", "aria-label": t("rules"), children: [_jsx("h3", { children: t("rules") }), _jsx("p", { className: "dsmm-hint", children: t("rulesHint") }), _jsx("p", { className: "dsmm-hint", children: t("networkLimit") }), _jsx("p", { className: "dsmm-hint", children: t("matchHint") }), _jsx(Issue, { value: state.rulesIssue, t: t }), _jsx("p", { className: "dsmm-hint", children: t("observedPolicy") }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("profileOverrideState") }), _jsx("dd", { children: t("profileOverrideUnknown") })] }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("runtime") }), _jsx("dd", { children: value === null ? t("unknown") : t(value.runtime.state) }), _jsx("dt", { children: t("mounted") }), _jsx("dd", { children: value === null ? t("unknown") : t(value.runtime.mounted ? "on" : "off") })] }), value?.runtime.restartRequired && _jsx("p", { children: t("restart") }), disabled && _jsx("p", { className: "dsmm-hint", children: t(state.reading ? "reading" : "rulesUnavailable") }), state.base !== null && _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: "permissionControl.enabled" }), _jsxs("dd", { children: [t(state.base.policy.enabled ? "on" : "off"), " \u00B7 ", t("coldHint")] }), _jsx("dt", { children: "permissionControl.nativeCommands.enabled" }), _jsx("dd", { children: t(state.base.policy.nativeCommands.enabled ? "on" : "off") })] }), _jsx(PermissionCoverage, { state: state, t: t }), draft !== null && _jsxs(_Fragment, { children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-outside`, children: t("outsideReads") }), _jsx(ActionSelect, { id: `${id}-outside`, value: draft.outsideReads, disabled: disabled, t: t, onChange: outsideReads => controller.edit(state.generation, { outsideReads }) })] }), ["webSearch", "webFetch"].map(key => _jsxs("fieldset", { children: [_jsx("legend", { children: t(key) }), _jsxs("label", { className: "dsmm-actions", htmlFor: `${id}-${key}-enabled`, children: [_jsx("input", { type: "checkbox", id: `${id}-${key}-enabled`, checked: draft[key].enabled, disabled: disabled, onChange: event => controller.edit(state.generation, { [key]: { ...draft[key], enabled: event.currentTarget.checked } }) }), t("enabled")] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-${key}-rule`, children: t("rule") }), _jsx(ActionSelect, { id: `${id}-${key}-rule`, value: draft[key].rule, disabled: disabled, t: t, onChange: rule => controller.edit(state.generation, { [key]: { ...draft[key], rule } }) })] })] }, key)), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || draft.editor !== null, onClick: () => controller.edit(state.generation, { editor: { id: "", action: "ask", match: newMatch("outside-read") } }), children: t("newRule") }), _jsx(RuleEditor, { controller: controller, state: state, t: t }), (draft.upsert.length > 0 || draft.revoke.length > 0) && _jsxs("div", { className: "dsmm-structured", children: [_jsx("h3", { children: t("staged") }), draft.upsert.map(row => _jsxs("div", { className: "dsmm-field", children: [_jsxs("p", { children: [row.id, " \u00B7 ", t(`kind:${row.match.kind}`), " \u00B7 ", t(`action:${row.action}`)] }), _jsxs(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => controller.edit(state.generation, { upsert: draft.upsert.filter(rule => rule.id !== row.id) }), children: [t("unstage"), ": ", row.id] })] }, row.id)), draft.revoke.map(ruleId => _jsxs("div", { className: "dsmm-field", children: [_jsxs("p", { children: [t("stageRevoke"), ": ", ruleId] }), _jsxs(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => controller.edit(state.generation, { revoke: draft.revoke.filter(id => id !== ruleId) }), children: [t("unstage"), ": ", ruleId] })] }, ruleId))] })] }), _jsx(RuleRecords, { state: state, controller: controller, t: t }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: !controller.canSave(state.generation), onClick: () => void controller.save(state.generation), children: t("save") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.scope !== "root" || !state.connected || state.reading || state.busy !== null, onClick: () => void controller.refresh(state.generation, true), children: t("discard") })] }), state.dirty && _jsx("p", { children: t("dirty") })] });
|
|
38
38
|
}
|
|
39
39
|
export function PermissionsPanel({ controller, t, sessionId }) {
|
|
40
40
|
const state = useSyncExternalStore(controller.store.subscribe, controller.store.getSnapshot);
|
|
41
41
|
useEffect(() => controller.watch(), [controller]);
|
|
42
42
|
if (sessionId !== undefined && sessionId !== state.sessionId)
|
|
43
|
-
return
|
|
44
|
-
return _jsxs("section", { className: "dsmm-profiles dsmm-children dsmm-permissions", "data-dsmm-permissions": true, "aria-label": t("title"), "aria-busy": state.reading || state.busy !== null, children: [_jsx("h2", { children: t("title") }), _jsx(RootState, { state: state, t: t }), _jsx("p", { className: "dsmm-hint", children: t("nativeApproval") }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: state.busy !== null ? t("busy") : state.notice === null ? "" : t(state.notice) }), _jsx(PermissionRulesEditor, { controller: controller, state: state, t: t })] });
|
|
43
|
+
return _jsx("p", { className: "dsmm-hint", role: "status", children: t("rulesUnavailable") });
|
|
44
|
+
return _jsxs("section", { className: "dsmm-profiles dsmm-children dsmm-permissions", "data-dsmm-permissions": true, "aria-label": t("title"), "aria-busy": state.reading || state.busy !== null, children: [_jsx("h2", { children: t("title") }), _jsx(RootState, { state: state, t: t }), _jsx("p", { className: "dsmm-hint", children: t("nativeApproval") }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: state.busy !== null ? t("busy") : state.reading ? t("reading") : state.notice === null ? "" : t(state.notice) }), _jsx(PermissionRulesEditor, { controller: controller, state: state, t: t })] });
|
|
45
45
|
}
|
|
46
46
|
//# sourceMappingURL=PermissionsPanel.js.map
|
|
@@ -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
79
|
return _jsxs("section", { className: "dsmm-profiles", "aria-labelledby": `${prefix}-title`, "aria-busy": state.busy !== null, children: [_jsx("h2", { id: `${prefix}-title`, children: t("title") }), _jsx("p", { children: t("description") }), snapshot?.origin !== undefined && _jsx("p", { className: "dsmm-hint", children: t(snapshot.origin === "legacy" ? "legacyOrigin" : snapshot.origin === "central" ? "centralOrigin" : "explicitOrigin") }), 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)
|
|
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.length > 0 && _jsx("ul", { className: "dsmm-profile-list", "aria-label": t("savedInventory"), children: snapshot.profiles.map((profile, index) => _jsxs("li", { children: [_jsx("p", { children: profile.label?.trim() ? `${profile.label} (${profile.id})` : profile.id }), _jsx("p", { className: "dsmm-hint", children: t("savedRevision", { revision: profile.revision
|
|
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.length > 0 && _jsx("ul", { className: "dsmm-profile-list", "aria-label": t("savedInventory"), children: snapshot.profiles.map((profile, index) => _jsxs("li", { children: [_jsx("p", { children: profile.label?.trim() ? `${profile.label} (${profile.id})` : profile.id }), _jsx("p", { className: "dsmm-hint", children: t("savedRevision", { revision: t(configurationVersionState(profile.revision)) }) }), _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" : "savedNotApplied") }), _jsx("p", { className: "dsmm-hint", children: t("savedRevision", { revision: editor.revision
|
|
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") }), _jsx("p", { className: "dsmm-hint", children: t("savedRevision", { revision: t(editor.revision === null ? "versionAbsent" : configurationVersionState(editor.revision)) }) }), _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: [_jsx("h3", { children: t("catalogTitle") }), _jsx("p", { className: "dsmm-hint", children: t("catalogHint") }), 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", { className: "dsmm-hint", children: t("newSessions") }), _jsx("p", { "data-dsmm-selection": true, children: selection }), _jsx("p", { className: "dsmm-hint", children: t("futurePin", { revision: t(configurationVersionState(snapshot?.selectionRevision)) }) }), 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, _jsx("p", { className: "dsmm-hint", children: t("savedOnlyHint") }), _jsx("p", { id: `${prefix}-global-action`, className: "dsmm-hint", children: t("globalActionHint") }), _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
|
|
@@ -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("headerUnavailable");
|
|
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;
|
|
36
|
+
const disabled = state.busy !== null || state.pendingEditor !== null || state.sessionBusy !== null || state.dirty || state.invalidFields.length > 0;
|
|
23
37
|
const current = () => actions.readProfileView().currentSessionId === state.currentSessionId;
|
|
24
|
-
const
|
|
38
|
+
const ready = session !== null && !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,10 +47,10 @@ 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("noSession") }) : _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", children: t("sessionUnavailable") }), session?.warnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("admissionWarnings") }), _jsx(ProfileWarnings, { warnings: session.warnings, t: t })] }) : null, session !== null && !
|
|
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?.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))] })] }), state.dirty && _jsx("p", { className: "dsmm-hint", children: t("sessionDirty") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: disabled || !allowed || (state.sessionChoice !== null && selected?.revision
|
|
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("noSession") }) : _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.label} (${profile.id})` : 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("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))] })] }), state.dirty && _jsx("p", { className: "dsmm-hint", children: t("sessionDirty") }), (session?.refreshRequired || session?.selection.refreshRequired) && _jsx("p", { role: "status", children: t("savedRefreshRequired") }), _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
55
|
void actions.refreshSession(); }, children: t("sessionRefresh") })] }), !compact && 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.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")
|
|
@@ -58,8 +74,10 @@ 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 || 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
82
|
if (state.sessionIssue !== null)
|
|
65
83
|
feedback = t(state.sessionIssue.source === "profile-model" ? state.sessionIssue.code === "model-unconfigured" ? "headerNoProfileModel" : state.sessionIssue.code === "model-choice-changed" ? "headerModelChoiceChanged" : "headerModelUnconfirmed"
|
|
@@ -74,11 +92,11 @@ export function SessionProfiles(props) {
|
|
|
74
92
|
feedback = t("headerNoSession");
|
|
75
93
|
else if (session === null || state.snapshot === null)
|
|
76
94
|
feedback = t("headerUnavailable");
|
|
77
|
-
else if (
|
|
78
|
-
feedback = t("
|
|
95
|
+
else if (session.refreshRequired || session.selection.refreshRequired)
|
|
96
|
+
feedback = t("savedRefreshRequired");
|
|
79
97
|
else if (state.sessionNotice !== null)
|
|
80
98
|
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 ===
|
|
99
|
+
const profileName = unknownCaptured ? t("headerCaptured") : admission !== undefined && sourceRelationship(admission, currentSaved?.revision) === "current" && currentSaved?.label?.trim() ? `${currentSaved.label} (${currentSaved.id})` : admission?.selectedId ?? t("sessionBaseline");
|
|
82
100
|
const currentLabel = t("headerCurrentProfile", { profile: session === null ? t("headerUnavailable") : profileName });
|
|
83
101
|
const entries = [{ type: "label", id: "@current", text: currentLabel }];
|
|
84
102
|
for (const warning of profileWarnings(session?.warnings))
|
|
@@ -89,7 +107,9 @@ export function SessionProfiles(props) {
|
|
|
89
107
|
entries.push({ type: "label", id: "@status", text: feedback });
|
|
90
108
|
const mode = session?.deepwork;
|
|
91
109
|
entries.push({ id: "@mode", label: t(mode === undefined ? "headerModeUnavailable" : mode.locked ? "headerModePreset" : mode.active ? "headerModeDisable" : "headerModeEnable"),
|
|
92
|
-
disabled:
|
|
110
|
+
disabled: unavailable || session?.canToggleMode !== true || mode === undefined || mode.locked });
|
|
111
|
+
if (session !== null && session.canToggleMode !== true)
|
|
112
|
+
entries.push({ type: "label", id: "@mode-reason", text: capabilityReason(session.toggleModeUnavailableReason, t) });
|
|
93
113
|
const diagnostic = state.sessionIssue === null ? null : menuIssue(state.sessionIssue);
|
|
94
114
|
const diagnosticText = diagnostic === null ? "" : t("headerIssueCode", { code: diagnostic.code }) + (diagnostic.field === undefined ? "" : ` ${t("headerIssueField", { field: diagnostic.field })}`);
|
|
95
115
|
const retryHint = t(diagnostic?.code === "maintenance" || diagnostic?.code === "busy" ? "headerWaitRetryHint" : "headerRetryHint");
|
|
@@ -100,9 +120,13 @@ export function SessionProfiles(props) {
|
|
|
100
120
|
if (unknownCaptured)
|
|
101
121
|
entries.push({ id: "__dsmm_captured_default__", label: t("headerCaptured"), disabled: true });
|
|
102
122
|
entries.push({ type: "separator", id: "@keep-separator" }, { type: "label", id: "@keep-heading", text: t("headerCompactProfiles") }, { id: "", label: t("sessionBaseline"), disabled });
|
|
123
|
+
if (session !== null && (session.canApplyOverlay !== true || session.applyOverlayUnavailableReason === "new-session-required"))
|
|
124
|
+
entries.push({ type: "label", id: "@overlay-reason", text: capabilityReason(session.applyOverlayUnavailableReason, t) });
|
|
103
125
|
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:
|
|
126
|
+
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 });
|
|
127
|
+
entries.push({ type: "separator", id: "@model-separator" }, { id: "@use-model", label: t("headerUseCurrentModel"), disabled: profileDisabled || session?.canSelectModel !== true || session?.profileModel === undefined });
|
|
128
|
+
if (session !== null && session.canSelectModel !== true)
|
|
129
|
+
entries.push({ type: "label", id: "@model-reason", text: capabilityReason(session.selectModelUnavailableReason, t) });
|
|
106
130
|
const open = openFor === id;
|
|
107
131
|
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
132
|
if (props.readProfileView().currentSessionId !== id)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DsmmChildrenRemote } from "../role-control-remote.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ChildSessionSnapshot, RoleControlAvailability, RoleControlDescendantsSnapshot, RoleControlErrorInfo, SubagentInterruptReceipt, SubagentPromptReceipt, SubagentPromptRequest } from "../role-control-types.js";
|
|
3
3
|
export interface ChildrenIssue extends Partial<RoleControlErrorInfo> {
|
|
4
4
|
kind: "domain" | "transport" | "protocol" | "local";
|
|
5
5
|
code: RoleControlErrorInfo["code"];
|
|
@@ -16,9 +16,6 @@ export interface ChildDraft {
|
|
|
16
16
|
uncertain: boolean;
|
|
17
17
|
}
|
|
18
18
|
export type ChildOutcome = {
|
|
19
|
-
kind: "background";
|
|
20
|
-
receipt: BackgroundTransitionResult;
|
|
21
|
-
} | {
|
|
22
19
|
kind: "prompt";
|
|
23
20
|
receipt: SubagentPromptReceipt;
|
|
24
21
|
} | {
|
|
@@ -35,13 +32,12 @@ export interface ChildrenSnapshot {
|
|
|
35
32
|
issue: ChildrenIssue | null;
|
|
36
33
|
descendantIssue: ChildrenIssue | null;
|
|
37
34
|
drafts: ReadonlyMap<string, ChildDraft>;
|
|
38
|
-
pending: ReadonlyMap<string, "
|
|
35
|
+
pending: ReadonlyMap<string, "prompt" | "interrupt">;
|
|
39
36
|
issues: ReadonlyMap<string, ChildrenIssue>;
|
|
40
37
|
outcomes: ReadonlyMap<string, ChildOutcome>;
|
|
41
38
|
}
|
|
42
39
|
export interface ChildrenActions {
|
|
43
40
|
refresh(generation: number): Promise<void>;
|
|
44
|
-
background(generation: number, toolCallId: string, runId: string): Promise<void>;
|
|
45
41
|
prompt(generation: number, childId: string): Promise<void>;
|
|
46
42
|
interrupt(generation: number, childId: string): Promise<void>;
|
|
47
43
|
editText(generation: number, childId: string, text: string): void;
|
|
@@ -52,7 +48,6 @@ export interface ChildrenActions {
|
|
|
52
48
|
}
|
|
53
49
|
export declare const EMPTY_CHILD_DRAFT: ChildDraft;
|
|
54
50
|
export declare const childActionKey: (childId: string) => string;
|
|
55
|
-
export declare const runActionKey: (toolCallId: string, runId: string) => string;
|
|
56
51
|
export declare function enabled(availability: RoleControlAvailability | undefined): boolean;
|
|
57
52
|
/** Client presentation/draft state only. Host owns all run, inbox and admission authority. */
|
|
58
53
|
export declare class ChildrenController {
|
|
@@ -89,7 +84,6 @@ export declare class ChildrenController {
|
|
|
89
84
|
private finish;
|
|
90
85
|
private refuse;
|
|
91
86
|
private accepted;
|
|
92
|
-
background(generation: number, toolCallId: string, runId: string): Promise<void>;
|
|
93
87
|
private canControl;
|
|
94
88
|
prompt(generation: number, id: string): Promise<void>;
|
|
95
89
|
interrupt(generation: number, id: string): Promise<void>;
|