@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
|
@@ -1,127 +1,95 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useId,
|
|
3
|
-
import { Button
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
function displayValue(value, t) {
|
|
13
|
-
if (value === undefined)
|
|
14
|
-
return t("unknown");
|
|
15
|
-
if (typeof value === "boolean")
|
|
16
|
-
return t(value ? "on" : "off");
|
|
17
|
-
const text = JSON.stringify(value);
|
|
18
|
-
return text.length > 120 ? `${text.slice(0, 120)}…` : text;
|
|
19
|
-
}
|
|
20
|
-
function AdvancedField({ schema, path, value, inherited, upper, reset, disabled, onChange, setInvalid, t }) {
|
|
21
|
-
const id = useId(), name = path.join(".");
|
|
22
|
-
const serialized = value === undefined ? "" : JSON.stringify(value, null, 2);
|
|
23
|
-
const [text, setText] = useState(serialized);
|
|
24
|
-
const [invalid, setLocalInvalid] = useState(false);
|
|
25
|
-
useEffect(() => { setText(serialized); setLocalInvalid(false); setInvalid(name, false); }, [serialized, reset]);
|
|
26
|
-
return _jsxs("details", { className: "dsmm-deployment-group", children: [_jsxs("summary", { children: [label(path, t), " \u00B7 ", t("advanced"), " ", _jsx("code", { children: name })] }), _jsxs("div", { className: "dsmm-field", children: [_jsxs("label", { htmlFor: id, children: [label(path, t), " \u00B7 ", t("advanced"), " ", _jsx("code", { children: name })] }), _jsx("p", { className: "dsmm-hint", id: `${id}-hint`, children: t("advancedHint") }), _jsx("textarea", { id: id, rows: 6, maxLength: 32768, value: text, disabled: disabled, "aria-invalid": invalid, "aria-describedby": `${id}-hint ${id}-error`, onChange: event => {
|
|
27
|
-
const next = event.currentTarget.value;
|
|
28
|
-
setText(next);
|
|
29
|
-
let parsed, valid = true;
|
|
30
|
-
try {
|
|
31
|
-
parsed = parseAdvanced(next);
|
|
32
|
-
const candidate = parsed === undefined ? inherited : mergeLayer(inherited, parsed);
|
|
33
|
-
valid = parsed === undefined || validateEditorValue(parsed, schema, true) && validateEditorValue(upper === undefined ? candidate : mergeLayer(candidate, upper), schema);
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
valid = false;
|
|
37
|
-
}
|
|
38
|
-
setLocalInvalid(!valid);
|
|
39
|
-
setInvalid(name, !valid);
|
|
40
|
-
if (valid)
|
|
41
|
-
onChange(parsed);
|
|
42
|
-
} }), _jsx("p", { id: `${id}-error`, className: "dsmm-hint", children: invalid ? t("invalid") : "" }), _jsxs("details", { children: [_jsxs("summary", { children: [t("advanced"), " \u00B7 schema"] }), _jsx("pre", { children: JSON.stringify(schema, null, 2) })] })] })] });
|
|
43
|
-
}
|
|
44
|
-
function ScalarField({ schema, path, controller, disabled, inherited, invalid, t }) {
|
|
45
|
-
const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
|
|
46
|
-
const value = at(state.draft, path), name = path.join("."), id = useId();
|
|
47
|
-
const [text, setText] = useState(String(value ?? inherited ?? ""));
|
|
48
|
-
const [bad, setBad] = useState(false);
|
|
49
|
-
useEffect(() => { setText(String(value ?? inherited ?? "")); setBad(false); invalid(name, false); }, [value, inherited, state.snapshot]);
|
|
50
|
-
return _jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: id, children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Input, { className: "dsmm-input", id: id, type: "text", inputMode: schema.type === "number" ? "decimal" : undefined, value: text, disabled: disabled, "aria-invalid": bad, "aria-describedby": `${id}-error`, onChange: event => {
|
|
51
|
-
const raw = event.currentTarget.value;
|
|
52
|
-
setText(raw);
|
|
53
|
-
const candidate = schema.type === "number" ? Number(raw) : raw;
|
|
54
|
-
const valid = (schema.type !== "number" || raw.trim() !== "") && validateEditorValue(candidate, schema);
|
|
55
|
-
setBad(!valid);
|
|
56
|
-
invalid(name, !valid);
|
|
57
|
-
if (valid)
|
|
58
|
-
controller.edit(path, candidate);
|
|
59
|
-
} }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || value === undefined && !bad, onClick: () => { setText(String(inherited ?? "")); setBad(false); invalid(name, false); controller.edit(path, undefined); }, children: t("inherit") })] }), _jsxs("p", { id: `${id}-error`, className: "dsmm-hint", children: [bad ? t("invalid") : "", schema.type === "number" && (schema.min !== undefined || schema.max !== undefined) ? ` ${schema.min ?? "—"} – ${schema.max ?? "—"}` : ""] })] });
|
|
60
|
-
}
|
|
61
|
-
function Field({ schema, path, controller, invalid, t }) {
|
|
62
|
-
if (schema.type === "transform" && schema.inner !== undefined)
|
|
63
|
-
schema = schema.inner;
|
|
64
|
-
const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), snapshot = state.snapshot;
|
|
65
|
-
const id = useId(), name = path.join("."), explicit = at(state.draft, path);
|
|
66
|
-
const inherited = controller.layer === "global" ? at(snapshot.defaults, path) : at(mergeLayer(mergeLayer(snapshot.defaults, snapshot.global), snapshot.nativeForm?.base ?? {}), path);
|
|
67
|
-
const disabled = state.busy || state.issue === "not-owned" || state.issue === "unavailable" || state.issue === "transport" || controller.layer === "profile" && !controller.canWriteProfile();
|
|
68
|
-
const choices = enumValues(schema);
|
|
69
|
-
const hint = name === "modelParameters.passthrough" ? "modelParametersHint" : name === "permissionControl.enabled" ? "permissionControlHint" : null;
|
|
70
|
-
if (schema.type === "object" && schema.fields !== undefined && path[0] !== "roleRouting")
|
|
71
|
-
return _jsxs("details", { className: "dsmm-deployment-group", children: [_jsxs("summary", { children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsx("div", { children: Object.entries(schema.fields).filter(([key]) => visibleDeploymentPath([...path, key])).map(([key, node]) => _jsx(Field, { schema: node, path: [...path, key], controller: controller, invalid: invalid, t: t }, key)) })] });
|
|
72
|
-
if (!["boolean", "string", "number"].includes(schema.type) && choices === null)
|
|
73
|
-
return _jsx(AdvancedField, { schema: schema, path: path, value: explicit, inherited: inherited, upper: controller.layer === "global" ? at(snapshot.profile, path) : undefined, reset: snapshot, disabled: disabled, t: t, onChange: value => controller.edit(path, value), setInvalid: invalid });
|
|
74
|
-
return _jsxs("div", { className: "dsmm-field dsmm-deployment-field", children: [schema.type === "boolean" || choices !== null ? _jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: id, children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsxs("select", { id: id, disabled: disabled, "aria-describedby": hint === null ? undefined : `${id}-hint`, value: explicit === undefined ? "inherit" : JSON.stringify(explicit), onChange: event => controller.edit(path, event.currentTarget.value === "inherit" ? undefined : JSON.parse(event.currentTarget.value)), children: [_jsxs("option", { value: "inherit", children: [t("inherit"), " \u00B7 ", displayValue(inherited, t)] }), (choices ?? [true, false]).map(choice => _jsx("option", { value: JSON.stringify(choice), children: displayValue(choice, t) }, String(choice)))] })] }) : _jsx(ScalarField, { schema: schema, path: path, controller: controller, disabled: disabled, inherited: inherited, invalid: invalid, t: t }), hint !== null && _jsx("p", { id: `${id}-hint`, className: "dsmm-hint", children: t(hint) }), (explicit !== undefined || controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined) && _jsxs("p", { className: "dsmm-hint", children: [explicit === undefined ? "" : equal(explicit, at(snapshot.defaults, path)) ? t("defaultPin") : t("explicit"), controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined ? `${explicit === undefined ? "" : " · "}${t("hostPin")}` : ""] })] });
|
|
75
|
-
}
|
|
76
|
-
function Layer({ controller, t }) {
|
|
2
|
+
import { useEffect, useId, useRef, useSyncExternalStore } from "react";
|
|
3
|
+
import { Button } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
|
+
import { deploymentWorkspace } from "./deployment-workspace.js";
|
|
5
|
+
import { CONFIG_MODULES, moduleFields, moduleFor, moduleTitle } from "./deployment-modules.js";
|
|
6
|
+
import { at, inspectorPaths, scopeSchema, visibleDeploymentPath } from "./deployment-data.js";
|
|
7
|
+
import { Field, displayValue, permissionText } from "./DeploymentFields.js";
|
|
8
|
+
import { configurationVersionState } from "./configuration-display.js";
|
|
9
|
+
import { PermissionPanelEntry } from "./PermissionPanelEntry.js";
|
|
10
|
+
import { permissionEn } from "./permission-locales.js";
|
|
11
|
+
export function ScopeSave({ controller, workspace, refreshOnly = false, t }) {
|
|
77
12
|
const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
return previous; const next = new Set(previous); if (bad)
|
|
81
|
-
next.add(path);
|
|
82
|
-
else
|
|
83
|
-
next.delete(path); return next; }); };
|
|
84
|
-
const title = controller.layer === "global" ? "global" : "profile";
|
|
85
|
-
const disabled = state.busy || state.snapshot === null || state.issue !== null || invalid.size > 0 || controller.layer === "profile" && !controller.canWriteProfile();
|
|
86
|
-
return _jsxs("div", { "data-dsmm-layer": controller.layer, "aria-busy": state.busy, children: [_jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t(title), _jsx("span", { role: "status", "aria-live": "polite", className: "dsmm-hint", children: state.busy ? t("saving") : state.dirty ? t("dirty") : state.saved ? t("saved") : "" })] }), _jsxs("fieldset", { children: [_jsx("legend", { children: t(title) }), _jsx("p", { className: "dsmm-hint", children: t(title === "global" ? "globalHint" : "profileHint") }), state.snapshot !== null && _jsxs(_Fragment, { children: [_jsxs("details", { className: "dsmm-deployment-group", children: [_jsx("summary", { children: t("core") }), _jsxs("div", { children: [_jsx("p", { className: "dsmm-hint", children: t("coreHint") }), Object.entries(state.snapshot.schema.fields ?? {}).filter(([key]) => key === "modelParameters" || key === "permissionControl").map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, invalid: updateInvalid, t: t }, key))] })] }), Object.entries(state.snapshot.schema.fields ?? {}).filter(([key]) => visibleDeploymentPath([key]) && key !== "modelParameters" && key !== "permissionControl" && (controller.layer === "global" || key !== "modules")).sort(([a], [b]) => a === "modules" ? -1 : b === "modules" ? 1 : 0).map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, invalid: updateInvalid, t: t }, key))] }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: disabled || !state.dirty, onClick: () => { void controller.save(); }, children: t(state.busy ? "saving" : title === "global" ? "saveGlobal" : "saveProfile") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => { void controller.refresh(); }, children: t("refresh") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy || !state.dirty && state.issue === null, onClick: () => { setInvalid(new Set()); void controller.refresh(true); }, children: t("discard") })] })] })] }), state.issue !== null && _jsx("p", { className: "dsmm-issue", role: "alert", children: t(state.issue) }), invalid.size > 0 && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("invalid") }), controller.layer === "profile" && !controller.canWriteProfile() && _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") })] });
|
|
13
|
+
const pending = [...new Set(controller.pendingPaths().map(moduleFor))];
|
|
14
|
+
return _jsxs("section", { className: "dsmm-scope-save", "aria-label": t(refreshOnly ? "refresh" : "saveScope"), children: [_jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: refreshOnly ? state.busy ? t("loading") : "" : state.busy ? t("saving") : state.refreshRequired ? t("savedRefreshRequired") : state.saved ? t("saved") : state.dirty ? t("dirty") : "" }), !refreshOnly && pending.length > 0 && _jsxs("p", { children: [t("pendingModules"), ": ", pending.map(module => t(moduleTitle(module))).join(" · ")] }), state.issue !== null && _jsx("p", { className: "dsmm-issue", role: "alert", children: t(state.issue) }), !refreshOnly && state.invalidFields.length > 0 && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("invalid") }), controller.layer === "profile" && !controller.canWriteProfile() && _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") }), _jsxs("div", { className: "dsmm-actions", children: [!refreshOnly && _jsx(Button, { type: "button", variant: "primary", disabled: !controller.canSave(), onClick: () => void (workspace?.save() ?? controller.save()), children: t(controller.layer === "global" ? "saveGlobal" : "saveProfile") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => void controller.refresh(), children: t("refresh") }), !refreshOnly && _jsx(Button, { type: "button", variant: "outline", disabled: state.busy || !state.dirty && state.issue === null && !state.refreshRequired, onClick: () => void controller.refresh(true), children: t("discard") })] })] });
|
|
87
15
|
}
|
|
88
|
-
function
|
|
89
|
-
|
|
90
|
-
const snapshot = useSyncExternalStore(listener => shared.subscribe(listener), () => shared.getSnapshot());
|
|
91
|
-
const controller = useMemo(() => core.forProfile(namespace), [core, remote, namespace]);
|
|
92
|
-
const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
|
|
93
|
-
const coreState = useSyncExternalStore(core.subscribe, core.getSnapshot);
|
|
94
|
-
controller.attachForm(form ?? { state: snapshot, mutate: (ops, revision) => shared.mutate(ops, revision) });
|
|
95
|
-
useEffect(() => { void controller.refresh(); return () => controller.dispose(); }, [controller]);
|
|
96
|
-
useEffect(() => { if (state.saved)
|
|
97
|
-
void core.refresh(); }, [state.saved, core]);
|
|
98
|
-
useEffect(() => { if (controller.getSnapshot().snapshot !== null)
|
|
99
|
-
void controller.refresh(); }, [coreState.snapshot?.globalRevision, snapshot.revision, controller]);
|
|
100
|
-
return _jsx(Layer, { controller: controller, t: t });
|
|
16
|
+
export function NativeRuntimeState({ value, t }) {
|
|
17
|
+
return _jsxs("details", { className: "dsmm-availability", children: [_jsx("summary", { children: t("nativeRuntimeState") }), _jsxs("p", { children: [t("nativeRuntimeBinding"), ": ", t(value?.binding === "stock" ? "nativeRuntimeStock" : value?.binding === "unavailable" ? "nativeRuntimeUnavailable" : "unknown")] }), _jsxs("p", { children: [t("nativeRuntimeFence"), ": ", value === undefined ? t("unknown") : t(value.deliveryFenceReady ? "on" : "off"), " \u00B7 ", t("nativeRuntimeRestart"), ": ", value === undefined ? t("unknown") : t(value.restartRequired ? "on" : "off")] }), value?.reason !== undefined && _jsx("p", { children: t(`nativeRuntimeReason-${value.reason}`) })] });
|
|
101
18
|
}
|
|
102
|
-
function StateInspector({ controller,
|
|
103
|
-
const { snapshot, dirty, issue } = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
|
|
19
|
+
export function StateInspector({ controller, t }) {
|
|
20
|
+
const { snapshot, session, dirty, issue } = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
|
|
104
21
|
if (snapshot === null)
|
|
105
|
-
return
|
|
22
|
+
return _jsx("p", { children: t("unavailable") });
|
|
106
23
|
const admitted = session?.configuration ?? null;
|
|
107
|
-
const restartRequired = (snapshot.nextRoot?.restartRequired ?? []).filter(path => visibleDeploymentPath(path.split(".")));
|
|
108
24
|
const source = (value) => t(value === "profile" ? "profileSource" : value === "global" ? "globalSource" : value === "defaults" ? "defaultsSource" : value === "named-session" ? "namedSource" : value === "startup" ? "startupSource" : value === "deployment" ? "deploymentCapture" : value === "mixed" ? "mixedSource" : "unknown");
|
|
109
25
|
const value = (layer, path) => layer === undefined ? t("unknown") : at(layer, path.split(".")) === undefined ? t("absent") : displayValue(at(layer, path.split(".")), t);
|
|
110
|
-
const
|
|
111
|
-
return _jsxs("
|
|
26
|
+
const restart = (snapshot.nextRoot?.restartRequired ?? []).filter(path => visibleDeploymentPath(path.split(".")));
|
|
27
|
+
return _jsxs("div", { className: "dsmm-structured", children: [_jsx("p", { role: "status", children: session === null ? t("noSession") : admitted === null ? t("sessionUnavailable") : t("sessionObserved") }), (dirty || issue !== null) && _jsx("p", { className: "dsmm-hint", children: t("inspectorStale") }), _jsxs("p", { children: [t("globalSource"), ": ", t(configurationVersionState(snapshot.globalRevision)), " \u00B7 ", t("profileSource"), ": ", t(configurationVersionState(snapshot.nativeRevision))] }), snapshot.subagentRuntime !== undefined && _jsx(NativeRuntimeState, { value: snapshot.subagentRuntime, t: t }), snapshot.modules.map(module => _jsxs("section", { className: "dsmm-zone", children: [_jsx("h3", { children: module.descriptor.label }), _jsxs("p", { children: [t("desired"), ": ", t(module.desired.enabled ? "on" : "off"), " \u00B7 ", source(module.desired.source)] }), _jsxs("p", { children: [t("startup"), ": ", module.startupMounted == null ? t("unknown") : t(module.startupMounted ? "on" : "off")] }), _jsxs("p", { children: [t("next"), ": ", module.nextRoot.admitted == null ? t("unknown") : t(module.nextRoot.admitted ? "on" : "off")] }), module.pending && _jsx("p", { children: t("pending") })] }, module.descriptor.id)), inspectorPaths(snapshot, admitted).map(path => _jsxs("dl", { className: "dsmm-deployment-state", children: [_jsx("dt", { children: path }), _jsxs("dd", { children: [t("desired"), ": ", value(snapshot.desired, path), " \u00B7 ", source(snapshot.sources[path])] }), _jsxs("dd", { children: [t("startup"), ": ", value(snapshot.startup, path), " \u00B7 ", source(snapshot.startupSources?.[path])] }), _jsxs("dd", { children: [t("next"), ": ", value(snapshot.nextRoot?.settings, path), " \u00B7 ", source(snapshot.nextRoot?.sources[path])] }), _jsxs("dd", { children: [t("session"), ": ", value(admitted?.settings, path), " \u00B7 ", source(admitted?.sources[path])] })] }, path)), restart.length > 0 && _jsxs("p", { children: [t("pending"), ": ", restart.join(", ")] })] });
|
|
112
28
|
}
|
|
113
29
|
export function DeploymentPage(props) {
|
|
114
|
-
const
|
|
30
|
+
const workspace = props.workspace ?? deploymentWorkspace(props.core, props.permissions);
|
|
31
|
+
const navigation = useSyncExternalStore(workspace.subscribe, workspace.getSnapshot);
|
|
32
|
+
const core = useSyncExternalStore(props.core.subscribe, props.core.getSnapshot);
|
|
33
|
+
const controller = workspace.controller() ?? props.core;
|
|
34
|
+
const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
|
|
35
|
+
const id = useId(), heading = useRef(null), triggers = useRef(new Map()), previous = useRef(null);
|
|
36
|
+
const scopeControl = useRef(null), confirmation = useRef(null);
|
|
37
|
+
const resume = useRef(null);
|
|
38
|
+
const disclosures = useRef({ global: new Map(), profile: new Map() });
|
|
39
|
+
const { t } = props, snapshot = state.snapshot ?? core.snapshot, active = navigation.module;
|
|
115
40
|
useEffect(() => { if (props.view === "page")
|
|
116
41
|
void props.core.refresh(); }, [props.core, props.view]);
|
|
42
|
+
useEffect(() => { if (props.forms !== undefined)
|
|
43
|
+
workspace.bindForms(props.forms); }, [workspace, props.forms]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (active !== null)
|
|
46
|
+
heading.current?.focus();
|
|
47
|
+
else if (previous.current !== null)
|
|
48
|
+
triggers.current.get(previous.current)?.focus();
|
|
49
|
+
previous.current = active;
|
|
50
|
+
}, [active]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (navigation.pending !== null) {
|
|
53
|
+
resume.current = { element: document.activeElement, scope: navigation.scope, module: active };
|
|
54
|
+
confirmation.current?.focus();
|
|
55
|
+
}
|
|
56
|
+
else if (resume.current !== null) {
|
|
57
|
+
const from = resume.current;
|
|
58
|
+
resume.current = null;
|
|
59
|
+
if (from.scope === navigation.scope && from.module === active) {
|
|
60
|
+
if (from.element.isConnected)
|
|
61
|
+
from.element.focus();
|
|
62
|
+
}
|
|
63
|
+
else if (active !== null)
|
|
64
|
+
heading.current?.focus();
|
|
65
|
+
else if (from.scope !== navigation.scope)
|
|
66
|
+
scopeControl.current?.focus();
|
|
67
|
+
}
|
|
68
|
+
}, [navigation.pending, navigation.scope, active]);
|
|
117
69
|
if (props.view === "summary")
|
|
118
|
-
return _jsx("span", { children:
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
70
|
+
return _jsx("span", { children: t("summary") });
|
|
71
|
+
const fields = snapshot === null || active === null ? [] : moduleFields(scopeSchema(snapshot, controller.layer), active, controller.layer);
|
|
72
|
+
const modules = CONFIG_MODULES.filter(module => module === "state" || module === "permissions" || snapshot === null || moduleFields(snapshot.schema, module, "global").length + moduleFields(scopeSchema(snapshot, "profile"), module, "profile").length > 0);
|
|
73
|
+
const scopeActions = _jsx(ScopeSave, { controller: active === "state" ? props.core : controller, workspace: workspace, refreshOnly: active === "state" || workspace.controller() === null, t: t });
|
|
74
|
+
return _jsxs("section", { className: "dsmm-profiles dsmm-deployment", "data-dsmm-page": true, "aria-label": t("title"), children: [_jsx("p", { className: "dsmm-hint", children: t("boundaries") }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-scope`, children: t("scope") }), _jsxs("select", { ref: scopeControl, id: `${id}-scope`, value: navigation.scope, disabled: state.busy || navigation.pending !== null, onChange: event => {
|
|
75
|
+
const scope = event.currentTarget.value;
|
|
76
|
+
if (scope === "global" || scope === "profile")
|
|
77
|
+
workspace.request({ scope, module: active });
|
|
78
|
+
}, children: [_jsx("option", { value: "global", children: t("global") }), _jsx("option", { value: "profile", children: t("profile") })] })] }), _jsx("p", { className: "dsmm-hint", children: t(navigation.scope === "global" ? "globalHint" : "profileHint") }), navigation.scope === "profile" && (navigation.native === null || !navigation.native.canWriteProfile()) && _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") }), _jsxs("div", { className: "dsmm-deployment-frame", "data-drawer-open": active !== null, children: [_jsx("nav", { className: "dsmm-module-list", "aria-label": t("modules"), children: modules.map(module => _jsx(Button, { ref: element => { if (element !== null)
|
|
79
|
+
triggers.current.set(module, element); }, type: "button", variant: "outline", disabled: navigation.pending !== null, "aria-expanded": active === module, "aria-controls": `${id}-drawer`, onClick: () => workspace.request({ scope: navigation.scope, module }), children: t(moduleTitle(module)) }, module)) }), active !== null && _jsxs("aside", { id: `${id}-drawer`, className: "dsmm-module-drawer", "aria-labelledby": `${id}-heading`, "data-dsmm-module": active, onKeyDown: event => {
|
|
80
|
+
if (event.key !== "Escape" || event.defaultPrevented)
|
|
81
|
+
return;
|
|
82
|
+
const target = event.target;
|
|
83
|
+
if (target.tagName === "SELECT" && (!globalThis.CSS?.supports("selector(select:open)") || target.matches("select:open")))
|
|
84
|
+
return;
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
if (navigation.pending !== null)
|
|
87
|
+
workspace.continueEditing();
|
|
88
|
+
else
|
|
89
|
+
workspace.request({ scope: navigation.scope, module: null });
|
|
90
|
+
}, children: [_jsxs("div", { className: "dsmm-drawer-heading", children: [_jsx("h2", { id: `${id}-heading`, ref: heading, tabIndex: -1, children: t(moduleTitle(active)) }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => workspace.request({ scope: navigation.scope, module: null }), children: t("close") })] }), active === "state" ? _jsxs(_Fragment, { children: [_jsx(StateInspector, { controller: props.core, t: t }), scopeActions] }) : _jsxs(_Fragment, { children: [navigation.scope === "profile" && navigation.native === null ? _jsx("p", { children: t("unavailableForm") }) : state.snapshot === null ? _jsx("p", { children: t(state.busy ? "loading" : "unavailable") }) : _jsxs("div", { "data-dsmm-layer": controller.layer, "aria-busy": state.busy, className: "dsmm-structured", children: [fields.length === 0 && _jsx("p", { className: "dsmm-hint", children: t("noModuleFields") }), fields.map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, initiallyOpen: fields.length === 1 && active !== "permissions", disclosures: disclosures.current[navigation.scope], t: t }, `${navigation.scope}:${key}`)), active === "run" && controller.layer === "profile" && _jsx(NativeRuntimeState, { value: state.snapshot.subagentRuntime, t: t })] }), scopeActions, active === "permissions" && _jsxs("section", { className: "dsmm-zone", children: [_jsx("h3", { children: t("rootRules") }), _jsx("p", { className: "dsmm-hint", children: t("rootRulesHint") }), workspace.permissions === undefined ? _jsx("p", { children: t("rootRulesUnavailable") }) : _jsx(PermissionPanelEntry, { controller: workspace.permissions, temporary: props.temporaryPermissions, t: props.permissionsT ?? (key => Object.hasOwn(permissionEn, key) ? permissionText(t)(key) : key) })] })] })] })] }), navigation.pending !== null && _jsxs("section", { className: "dsmm-confirm", role: "group", "aria-label": t("leaveDraft"), onKeyDown: event => { if (event.key === "Escape" && !event.defaultPrevented) {
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
workspace.continueEditing();
|
|
93
|
+
} }, children: [_jsx("p", { children: t("leaveDraft") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { ref: confirmation, type: "button", variant: "primary", onClick: () => workspace.continueEditing(), children: t("continueEditing") }), _jsx(Button, { type: "button", variant: "outline", onClick: () => workspace.keepAndNavigate(), children: t("keepDraft") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => void workspace.discardAndNavigate(), children: t("discardDraft") })] })] })] });
|
|
126
94
|
}
|
|
127
95
|
//# sourceMappingURL=DeploymentPage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HistoryContinuationController } from "./history-controller.js";
|
|
2
|
+
/** Additive continuation controls; this component never opens, replaces, or clears native history. */
|
|
3
|
+
export declare function HistoryContinuation({ controller, locale }: {
|
|
4
|
+
controller: HistoryContinuationController;
|
|
5
|
+
locale?: "en" | "zh";
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=HistoryContinuation.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useState, useSyncExternalStore } from "react";
|
|
3
|
+
import { Button } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
|
+
import { historyLocales } from "./history-locales.js";
|
|
5
|
+
/** Additive continuation controls; this component never opens, replaces, or clears native history. */
|
|
6
|
+
export function HistoryContinuation({ controller, locale = "en" }) {
|
|
7
|
+
const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
|
|
8
|
+
const t = historyLocales[locale], id = useId();
|
|
9
|
+
const [preset, setPreset] = useState(""), [profile, setProfile] = useState("");
|
|
10
|
+
const proposal = state.preview;
|
|
11
|
+
const [consent, setConsent] = useState({ proposal: null, pending: false, migration: false });
|
|
12
|
+
const pending = consent.proposal === proposal && consent.pending, migration = consent.proposal === proposal && consent.migration;
|
|
13
|
+
useEffect(() => { setPreset(""); setProfile(""); }, [state.sessionId, controller]);
|
|
14
|
+
const busy = ["loading", "previewing", "confirming"].includes(state.phase);
|
|
15
|
+
const selectable = state.phase === "ready" && state.status?.execution === "authorization-required" && state.status.compatibleHost && state.choices !== null;
|
|
16
|
+
const selectedMatches = proposal?.candidate.preset.id === preset && (proposal?.candidate.profile?.id ?? "") === profile;
|
|
17
|
+
const reason = state.issue?.code ?? (state.status?.compatibleHost === false ? "unsupported-host" : state.status?.reason);
|
|
18
|
+
const notice = state.phase === "disconnected" ? t.disconnected : state.phase === "loading" ? t.loading : state.phase === "previewing" ? t.preparing
|
|
19
|
+
: state.phase === "confirming" || state.status?.execution === "activating" ? t.confirming : state.phase === "unknown" ? t.unknown : state.status?.execution === "active" ? t.active : t.browsing;
|
|
20
|
+
return _jsx("section", { className: "dsmm-profiles", "aria-labelledby": `${id}-heading`, "aria-busy": busy, "data-dsmm-history-continuation": true, children: _jsxs("div", { className: "dsmm-session-scope", children: [_jsx("h3", { id: `${id}-heading`, children: t.title }), _jsx("p", { role: "status", children: notice }), reason && _jsx("p", { role: "alert", children: t.reasons[reason] }), state.issue?.storageEffects === "may-have-committed" && _jsx("p", { children: t.effects }), selectable && _jsxs(_Fragment, { children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-preset`, children: t.preset }), _jsxs("select", { id: `${id}-preset`, value: preset, onChange: event => setPreset(event.currentTarget.value), children: [_jsx("option", { value: "", children: t.choose }), state.choices.presets.map(row => _jsx("option", { value: row.id, children: row.label || row.id }, row.id))] })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-profile`, children: t.profile }), _jsxs("select", { id: `${id}-profile`, value: profile, onChange: event => setProfile(event.currentTarget.value), children: [_jsx("option", { value: "", children: t.baseline }), state.choices.profiles.map(row => _jsx("option", { value: row.id, children: row.label || row.id }, row.id))] })] }), _jsx("div", { className: "dsmm-actions", children: _jsx(Button, { type: "button", variant: "outline", disabled: !preset || !state.choices.presets.some(row => row.id === preset), onClick: () => { void controller.preview(state, preset, profile || null); }, children: t.preview }) })] }), proposal && selectedMatches && _jsxs("div", { className: "dsmm-session-scope", "aria-labelledby": `${id}-proposal`, children: [_jsx("h4", { id: `${id}-proposal`, children: t.candidate }), _jsxs("p", { children: [proposal.candidate.preset.label || proposal.candidate.preset.id, " \u00B7 ", proposal.candidate.profile?.label || proposal.candidate.profile?.id || t.baseline] }), _jsxs("p", { children: [t.project, ": ", proposal.cwd] }), _jsxs("p", { children: [t.model, ": ", proposal.candidate.model.provider, "/", proposal.candidate.model.model, proposal.candidate.model.reasoningEffort ? ` (${proposal.candidate.model.reasoningEffort})` : ""] }), _jsxs("p", { children: [t.roles, ": ", proposal.candidate.roles.map(row => row.label || row.id).join(", ")] }), _jsxs("div", { children: [_jsx("h4", { children: t.permissions }), _jsx("ul", { children: proposal.candidate.restrictions.map((text, index) => _jsx("li", { children: text }, index)) })] }), proposal.candidate.differences.length > 0 && _jsxs("div", { children: [_jsx("h4", { children: t.differences }), _jsx("ul", { children: proposal.candidate.differences.map((text, index) => _jsx("li", { children: text }, index)) })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("h4", { children: t.pending }), _jsx("p", { id: `${id}-pending-hint`, children: t.pendingWarning }), proposal.pending.nextTurn.length === 0 && proposal.pending.nextStep.length === 0 ? _jsx("p", { children: t.noPending }) : _jsxs(_Fragment, { children: [_jsx("label", { htmlFor: `${id}-next-turn`, children: t.nextTurn }), _jsx("textarea", { id: `${id}-next-turn`, rows: 5, readOnly: true, value: JSON.stringify(proposal.pending.nextTurn, null, 2) }), _jsx("label", { htmlFor: `${id}-next-step`, children: t.nextStep }), _jsx("textarea", { id: `${id}-next-step`, rows: 5, readOnly: true, value: JSON.stringify(proposal.pending.nextStep, null, 2) })] }), _jsxs("label", { children: [_jsx("input", { type: "checkbox", checked: pending, disabled: busy, "aria-describedby": `${id}-pending-hint`, onChange: event => setConsent({ proposal, pending: event.currentTarget.checked, migration }) }), " ", t.consent] }), proposal.migrationRequired && _jsxs("label", { children: [_jsx("input", { type: "checkbox", checked: migration, disabled: busy, onChange: event => setConsent({ proposal, pending, migration: event.currentTarget.checked }) }), " ", t.migration] })] }), _jsx("div", { className: "dsmm-actions", children: _jsx(Button, { type: "button", disabled: busy || state.phase !== "ready" || !pending || proposal.migrationRequired && !migration, onClick: () => { void controller.confirm(state, pending, migration); }, children: t.confirm }) })] }), _jsx("div", { className: "dsmm-actions", children: _jsx(Button, { type: "button", variant: "outline", disabled: busy || state.phase === "disconnected", onClick: () => { void controller.refresh(state); }, children: t.refresh }) })] }) });
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=HistoryContinuation.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NativeCommandEntry } from "../permission-settings.js";
|
|
2
|
+
import type { PermissionLocaleKey } from "./permission-locales.js";
|
|
3
|
+
import type { DeploymentController } from "./deployment-controller.js";
|
|
4
|
+
type Text = (key: PermissionLocaleKey) => string;
|
|
5
|
+
export declare function validNativeEntries(entries: readonly NativeCommandEntry[]): boolean;
|
|
6
|
+
export declare function emptyNativeEntry(): NativeCommandEntry;
|
|
7
|
+
export declare function NativeCommandEntries({ value, inherited, controller, disabled, onChange, setInvalid, t }: {
|
|
8
|
+
value: readonly NativeCommandEntry[] | undefined;
|
|
9
|
+
inherited: readonly NativeCommandEntry[];
|
|
10
|
+
controller: DeploymentController;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
onChange(value: readonly NativeCommandEntry[] | undefined): void;
|
|
13
|
+
setInvalid(path: string, bad: boolean): void;
|
|
14
|
+
t: Text;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=NativeCommandEntries.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useSyncExternalStore } from "react";
|
|
3
|
+
import { Button, Input } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
|
+
import { parseNativeCommands } from "../permission-settings.js";
|
|
5
|
+
import { parseAdvanced } from "./deployment-data.js";
|
|
6
|
+
export function validNativeEntries(entries) {
|
|
7
|
+
try {
|
|
8
|
+
parseNativeCommands({ entries });
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function emptyNativeEntry() {
|
|
16
|
+
return { id: "", mode: "ask", sandboxMode: "workspace-write", match: { tool: "bash", executable: "", args: [], workingDirectory: "" } };
|
|
17
|
+
}
|
|
18
|
+
function Arguments({ value, controller, name, disabled, onChange, t }) {
|
|
19
|
+
const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), id = useId(), raw = state.raw[name], text = raw?.text ?? JSON.stringify(value), bad = raw?.invalid === true;
|
|
20
|
+
return _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: id, children: t("args") }), _jsx("textarea", { id: id, rows: 3, maxLength: 32768, disabled: disabled, value: text, "aria-invalid": bad, "aria-describedby": `${id}-error`, onChange: event => {
|
|
21
|
+
const raw = event.currentTarget.value;
|
|
22
|
+
let parsed;
|
|
23
|
+
try {
|
|
24
|
+
parsed = parseAdvanced(raw);
|
|
25
|
+
}
|
|
26
|
+
catch { /* Keep invalid text local until corrected. */ }
|
|
27
|
+
const valid = Array.isArray(parsed) && parsed.every(item => typeof item === "string" && item.trim() !== "" && !item.includes("\0") && item.length <= 32768);
|
|
28
|
+
controller.setRaw(name, raw, !valid);
|
|
29
|
+
if (valid)
|
|
30
|
+
onChange(parsed);
|
|
31
|
+
} }), _jsx("p", { id: `${id}-error`, className: "dsmm-hint", children: bad ? t("invalidEntry") : "" })] });
|
|
32
|
+
}
|
|
33
|
+
function Entry({ entry, index, controller, disabled, removeDisabled, change, remove, t }) {
|
|
34
|
+
const id = useId();
|
|
35
|
+
const valid = validNativeEntries([entry]);
|
|
36
|
+
const text = (key, label) => _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-${key}`, children: t(label) }), _jsx(Input, { className: "dsmm-input", id: `${id}-${key}`, value: key === "id" ? entry.id : entry.match[key] ?? "", maxLength: 32768, disabled: disabled, required: key !== "subcommand", onChange: event => {
|
|
37
|
+
const value = event.currentTarget.value;
|
|
38
|
+
if (key === "id")
|
|
39
|
+
change({ ...entry, id: value });
|
|
40
|
+
else if (key === "subcommand" && value === "") {
|
|
41
|
+
const { subcommand: _omitted, ...match } = entry.match;
|
|
42
|
+
change({ ...entry, match });
|
|
43
|
+
}
|
|
44
|
+
else
|
|
45
|
+
change({ ...entry, match: { ...entry.match, [key]: value } });
|
|
46
|
+
} })] });
|
|
47
|
+
return _jsxs("fieldset", { "aria-describedby": !valid ? `${id}-error` : undefined, children: [_jsxs("legend", { children: [t("nativeCommands"), " ", index + 1] }), !valid && _jsx("p", { className: "dsmm-hint", id: `${id}-error`, children: t("invalidEntry") }), text("id", "entryId"), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-tool`, children: t("tool") }), _jsx("select", { id: `${id}-tool`, disabled: disabled, value: entry.match.tool, onChange: event => {
|
|
48
|
+
const tool = event.currentTarget.value;
|
|
49
|
+
if (tool === "bash" || tool === "pwsh")
|
|
50
|
+
change({ ...entry, match: { ...entry.match, tool } });
|
|
51
|
+
}, children: ["bash", "pwsh"].map(value => _jsx("option", { value: value, children: value }, value)) })] }), text("executable", "nativeExecutable"), text("subcommand", "subcommand"), _jsx(Arguments, { value: entry.match.args, controller: controller, name: `permissionControl.nativeCommands.entries.${index}.args`, disabled: disabled, t: t, onChange: args => change({ ...entry, match: { ...entry.match, args } }) }), text("workingDirectory", "cwd"), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-sandbox`, children: t("sandboxMode") }), _jsxs("select", { id: `${id}-sandbox`, disabled: disabled, value: entry.sandboxMode, onChange: event => {
|
|
52
|
+
if (event.currentTarget.value === "workspace-write")
|
|
53
|
+
change({ ...entry, sandboxMode: "workspace-write" });
|
|
54
|
+
}, children: [_jsx("option", { value: "workspace-write", children: "workspace-write" }), entry.sandboxMode === "danger-full-access" && _jsxs("option", { value: "danger-full-access", disabled: true, children: ["danger-full-access (", t("source"), ")"] })] })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-mode`, children: t("mode") }), _jsxs("select", { id: `${id}-mode`, disabled: disabled, value: entry.mode, onChange: event => {
|
|
55
|
+
const mode = event.currentTarget.value;
|
|
56
|
+
if (mode === "ask" || mode === "allow")
|
|
57
|
+
change({ ...entry, mode });
|
|
58
|
+
}, children: [_jsx("option", { value: "ask", children: t("action:ask") }), _jsx("option", { value: "allow", children: t("action:allow") })] })] }), _jsxs(Button, { type: "button", variant: "outline", disabled: disabled || removeDisabled, onClick: remove, children: [t("removeEntry"), " ", index + 1] })] });
|
|
59
|
+
}
|
|
60
|
+
export function NativeCommandEntries({ value, inherited, controller, disabled, onChange, setInvalid, t }) {
|
|
61
|
+
const entries = value ?? inherited, name = "permissionControl.nativeCommands.entries";
|
|
62
|
+
const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
|
|
63
|
+
const invalidArgs = state.invalidFields.filter(path => path.startsWith(`${name}.`) && path.endsWith(".args"));
|
|
64
|
+
const valid = validNativeEntries(entries);
|
|
65
|
+
const change = (next) => { setInvalid(name, !validNativeEntries(next ?? inherited)); onChange(next); };
|
|
66
|
+
return _jsxs("details", { className: "dsmm-deployment-group", children: [_jsxs("summary", { children: [t("nativeCommands"), " ", _jsx("code", { children: name })] }), _jsxs("div", { className: "dsmm-structured", children: [_jsx("p", { className: "dsmm-hint", children: t("nativeCommandsHint") }), _jsx("p", { className: "dsmm-hint", children: t("registrationUnresolved") }), _jsx("p", { className: "dsmm-hint", children: t(value === undefined ? "inheritedEntries" : "explicitEntries") }), !valid && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("invalidEntry") }), invalidArgs.length > 0 && _jsx("p", { className: "dsmm-hint", children: t("invalidArgsHint") }), entries.length === 0 && _jsx("p", { children: t("noEntries") }), entries.map((entry, index) => _jsx(Entry, { entry: entry, index: index, controller: controller, disabled: disabled, removeDisabled: invalidArgs.length > 0, t: t, change: next => change(entries.map((row, position) => position === index ? next : row)), remove: () => { controller.clearRaw(name); change(entries.filter((_, position) => position !== index)); } }, index)), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: disabled || entries.length >= 1024, onClick: () => change([...entries, emptyNativeEntry()]), children: t("addEntry") }), _jsx(Button, { type: "button", variant: "outline", "data-dsmm-unset": name, disabled: disabled || value === undefined && invalidArgs.length === 0, onClick: () => { controller.clearRaw(name); change(undefined); }, children: t("unset") })] })] })] });
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=NativeCommandEntries.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HostObservable, PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
|
|
2
|
+
import type { TemporaryPermissionRemote } from "../permission-temporary-types.js";
|
|
3
|
+
import type { PermissionController } from "./permission-controller.js";
|
|
4
|
+
export declare function PermissionPanelEntry({ controller, temporary, t }: PropsLocale<"settings.dsmm-permissions"> & {
|
|
5
|
+
controller: PermissionController;
|
|
6
|
+
temporary?: HostObservable<TemporaryPermissionRemote | undefined>;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=PermissionPanelEntry.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
import { PermissionsPanel } from "./PermissionsPanel.js";
|
|
4
|
+
const absent = { getSnapshot: () => undefined, subscribe: () => () => { } };
|
|
5
|
+
export function PermissionPanelEntry({ controller, temporary, t }) {
|
|
6
|
+
const scope = useSyncExternalStore(controller.store.subscribe, controller.store.getSnapshot);
|
|
7
|
+
const source = temporary ?? absent;
|
|
8
|
+
const remote = useSyncExternalStore(source.subscribe, source.getSnapshot);
|
|
9
|
+
return _jsx(PermissionsPanel, { controller: controller, sessionId: scope.sessionId ?? undefined, temporary: remote, t: t });
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=PermissionPanelEntry.js.map
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
|
|
2
2
|
import type { PermissionController, PermissionView } from "./permission-controller.js";
|
|
3
|
+
import type { TemporaryPermissionRemote } from "../permission-temporary-types.js";
|
|
3
4
|
type Locale = PropsLocale<"settings.dsmm-permissions">;
|
|
4
5
|
export type PermissionsPanelProps = Locale & {
|
|
5
6
|
controller: PermissionController;
|
|
6
7
|
sessionId?: string;
|
|
8
|
+
temporary?: TemporaryPermissionRemote;
|
|
7
9
|
};
|
|
8
10
|
export declare function PermissionRulesEditor({ controller, state, t }: Locale & {
|
|
9
11
|
controller: PermissionController;
|
|
10
12
|
state: PermissionView;
|
|
11
13
|
}): import("react").JSX.Element;
|
|
12
|
-
export declare function PermissionsPanel({ controller, t, sessionId }: PermissionsPanelProps): import("react").JSX.Element
|
|
14
|
+
export declare function PermissionsPanel({ controller, t, sessionId, temporary }: PermissionsPanelProps): import("react").JSX.Element;
|
|
13
15
|
export {};
|
|
14
16
|
//# sourceMappingURL=PermissionsPanel.d.ts.map
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useSyncExternalStore } from "react";
|
|
3
3
|
import { Button, Input } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
|
+
import { TemporaryGrants } from "./TemporaryPermissions.js";
|
|
4
5
|
const actions = ["inherit", "allow", "ask", "deny"];
|
|
5
6
|
const kinds = ["outside-read", "shell", "webSearch", "webFetch"];
|
|
6
7
|
const ruleDraft = (rule) => ({ id: rule.id, action: rule.action, match: structuredClone(rule.match) });
|
|
7
8
|
const newMatch = (kind) => kind === "outside-read" ? { kind, path: "", scope: "exact" } : kind === "shell" ? { kind, executable: "", command: "", workingDirectory: "" } : { kind };
|
|
8
9
|
function Issue({ value, t }) { return value === null ? null : _jsxs("p", { className: "dsmm-issue", role: "alert", children: [t(`issue:${value}`), " ", _jsx("code", { children: value })] }); }
|
|
9
10
|
function RootState({ state, t }) {
|
|
10
|
-
return _jsxs(_Fragment, { children: [_jsxs("p", { children: [t("root"), ": ",
|
|
11
|
+
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
12
|
}
|
|
12
13
|
function ActionSelect({ id, value, inherit = true, onChange, disabled, t }) {
|
|
13
14
|
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 +18,7 @@ function RuleEditor({ controller, state, t }) {
|
|
|
17
18
|
const id = useId(), editor = state.draft?.editor;
|
|
18
19
|
if (editor == null)
|
|
19
20
|
return null;
|
|
20
|
-
const disabled = state.
|
|
21
|
+
const disabled = !controller.canEdit(state.generation), change = (value) => controller.edit(state.generation, { editor: value });
|
|
21
22
|
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
23
|
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
24
|
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 +27,21 @@ function RuleEditor({ controller, state, t }) {
|
|
|
26
27
|
}
|
|
27
28
|
function RuleRecords({ controller, state, t }) {
|
|
28
29
|
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("
|
|
30
|
+
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
31
|
}
|
|
31
32
|
function PermissionCoverage({ state, t }) {
|
|
32
33
|
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")] })
|
|
34
|
+
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
35
|
}
|
|
35
36
|
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("
|
|
37
|
+
const id = useId(), draft = state.draft, disabled = !controller.canEdit(state.generation), value = state.rules;
|
|
38
|
+
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
39
|
}
|
|
39
|
-
export function PermissionsPanel({ controller, t, sessionId }) {
|
|
40
|
+
export function PermissionsPanel({ controller, t, sessionId, temporary }) {
|
|
40
41
|
const state = useSyncExternalStore(controller.store.subscribe, controller.store.getSnapshot);
|
|
41
42
|
useEffect(() => controller.watch(), [controller]);
|
|
42
43
|
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 })] });
|
|
44
|
+
return _jsx("p", { className: "dsmm-hint", role: "status", children: t("rulesUnavailable") });
|
|
45
|
+
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 }), temporary && sessionId && _jsx(TemporaryGrants, { remote: temporary, sessionId: sessionId, t: t }, sessionId)] });
|
|
45
46
|
}
|
|
46
47
|
//# sourceMappingURL=PermissionsPanel.js.map
|