@dsmm/dsmm 0.3.1 → 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/cordis.patch.yml +9 -0
- package/docs/compatibility.md +10 -0
- package/docs/releasing.md +25 -65
- package/docs/roadmap.md +44 -2
- package/lib/client/ChildPermissions.d.ts +43 -0
- package/lib/client/ChildPermissions.js +100 -0
- package/lib/client/ChildrenPanel.d.ts +4 -1
- package/lib/client/ChildrenPanel.js +3 -3
- package/lib/client/DeploymentFields.d.ts +6 -2
- package/lib/client/DeploymentFields.js +8 -6
- package/lib/client/DeploymentPage.d.ts +4 -1
- package/lib/client/DeploymentPage.js +5 -4
- package/lib/client/HistoryContinuation.d.ts +7 -0
- package/lib/client/HistoryContinuation.js +22 -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 +3 -2
- package/lib/client/ProfilesSection.js +3 -3
- package/lib/client/RoleAvailability.js +1 -1
- package/lib/client/SessionProfiles.js +21 -18
- package/lib/client/TemporaryPermissions.d.ts +21 -0
- package/lib/client/TemporaryPermissions.js +94 -0
- package/lib/client/children-locales.d.ts +4 -4
- package/lib/client/controller.d.ts +17 -0
- package/lib/client/controller.js +101 -18
- package/lib/client/deployment-locales.js +26 -26
- 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 +16 -3
- package/lib/client/locales.d.ts +6 -0
- package/lib/client/locales.js +104 -92
- package/lib/client/permission-locales.d.ts +26 -0
- package/lib/client/permission-locales.js +55 -35
- 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 +3881 -1981
- 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/index.d.ts +2 -0
- package/lib/index.js +24 -6
- package/lib/native-admission.d.ts +21 -0
- package/lib/native-admission.js +206 -16
- package/lib/permission-child-control.d.ts +36 -0
- package/lib/permission-child-control.js +164 -0
- package/lib/permission-control.d.ts +2 -0
- 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-skills.d.ts +1 -1
- package/lib/preset-skills.js +2 -2
- package/lib/profile-rpc.js +2 -0
- package/lib/profile-runtime.d.ts +12 -1
- package/lib/profile-runtime.js +122 -10
- package/lib/profile-store.d.ts +2 -2
- package/lib/profile-store.js +8 -1
- package/lib/profile-types.d.ts +1 -0
- package/lib/role-invocation.d.ts +1 -1
- package/lib/role-invocation.js +2 -2
- package/lib/role-subagents.js +16 -3
- package/lib/skills.d.ts +1 -0
- package/lib/skills.js +5 -1
- package/package.json +41 -33
- 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
|
@@ -6,7 +6,7 @@ import { CONFIG_MODULES, moduleFields, moduleFor, moduleTitle } from "./deployme
|
|
|
6
6
|
import { at, inspectorPaths, scopeSchema, visibleDeploymentPath } from "./deployment-data.js";
|
|
7
7
|
import { Field, displayValue, permissionText } from "./DeploymentFields.js";
|
|
8
8
|
import { configurationVersionState } from "./configuration-display.js";
|
|
9
|
-
import {
|
|
9
|
+
import { PermissionPanelEntry } from "./PermissionPanelEntry.js";
|
|
10
10
|
import { permissionEn } from "./permission-locales.js";
|
|
11
11
|
export function ScopeSave({ controller, workspace, refreshOnly = false, t }) {
|
|
12
12
|
const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
|
|
@@ -14,7 +14,7 @@ export function ScopeSave({ controller, workspace, refreshOnly = false, t }) {
|
|
|
14
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") })] })] });
|
|
15
15
|
}
|
|
16
16
|
export function NativeRuntimeState({ value, t }) {
|
|
17
|
-
return _jsxs("
|
|
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}`) })] });
|
|
18
18
|
}
|
|
19
19
|
export function StateInspector({ controller, t }) {
|
|
20
20
|
const { snapshot, session, dirty, issue } = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
|
|
@@ -35,6 +35,7 @@ export function DeploymentPage(props) {
|
|
|
35
35
|
const id = useId(), heading = useRef(null), triggers = useRef(new Map()), previous = useRef(null);
|
|
36
36
|
const scopeControl = useRef(null), confirmation = useRef(null);
|
|
37
37
|
const resume = useRef(null);
|
|
38
|
+
const disclosures = useRef({ global: new Map(), profile: new Map() });
|
|
38
39
|
const { t } = props, snapshot = state.snapshot ?? core.snapshot, active = navigation.module;
|
|
39
40
|
useEffect(() => { if (props.view === "page")
|
|
40
41
|
void props.core.refresh(); }, [props.core, props.view]);
|
|
@@ -70,7 +71,7 @@ export function DeploymentPage(props) {
|
|
|
70
71
|
const fields = snapshot === null || active === null ? [] : moduleFields(scopeSchema(snapshot, controller.layer), active, controller.layer);
|
|
71
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);
|
|
72
73
|
const scopeActions = _jsx(ScopeSave, { controller: active === "state" ? props.core : controller, workspace: workspace, refreshOnly: active === "state" || workspace.controller() === null, t: t });
|
|
73
|
-
return _jsxs("section", { className: "dsmm-profiles dsmm-deployment", "data-dsmm-page": true, "aria-label": t("title"), children: [_jsx("p", {
|
|
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 => {
|
|
74
75
|
const scope = event.currentTarget.value;
|
|
75
76
|
if (scope === "global" || scope === "profile")
|
|
76
77
|
workspace.request({ scope, module: active });
|
|
@@ -86,7 +87,7 @@ export function DeploymentPage(props) {
|
|
|
86
87
|
workspace.continueEditing();
|
|
87
88
|
else
|
|
88
89
|
workspace.request({ scope: navigation.scope, module: null });
|
|
89
|
-
}, 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, t: t }, 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(
|
|
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) {
|
|
90
91
|
event.preventDefault();
|
|
91
92
|
workspace.continueEditing();
|
|
92
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") })] })] })] });
|
|
@@ -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,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,6 +1,7 @@
|
|
|
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) });
|
|
@@ -36,11 +37,11 @@ export function PermissionRulesEditor({ controller, state, t }) {
|
|
|
36
37
|
const id = useId(), draft = state.draft, disabled = !controller.canEdit(state.generation), value = state.rules;
|
|
37
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
44
|
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
|
+
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
|
|
@@ -76,10 +76,10 @@ export function ProfilesSection(props) {
|
|
|
76
76
|
selection = t("appliedProfile", { id: snapshot.selectedId, revision: t(configurationVersionState(snapshot.sourceRevision)) });
|
|
77
77
|
const notice = state.notice === null ? "" : t(state.notice.key === "reset" ? "resetDone" : state.notice.key, { id: state.notice.id });
|
|
78
78
|
const warnings = editor === null ? [] : draftWarnings(editor.content);
|
|
79
|
-
return _jsxs("section", { className: "dsmm-profiles", "aria-
|
|
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.
|
|
79
|
+
return _jsxs("section", { className: "dsmm-profiles", "aria-label": t("title"), "aria-busy": state.busy !== null, children: [readOnly && _jsx("p", { role: "status", className: "dsmm-hint", children: t("readOnlyOrigin") }), _jsxs("section", { className: "dsmm-zone", "aria-labelledby": `${prefix}-browse`, "data-dsmm-zone": "browse", children: [_jsx("h3", { id: `${prefix}-browse`, children: t("browseZone") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || snapshot === null, onClick: () => { void props.create(); }, children: t("new") }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => { void props.refresh(); }, children: t(state.busy === "refresh" ? "refreshing" : "refresh") })] }), snapshot !== null && _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-select`, children: t("editorSelect") }), _jsxs("select", { ref: selectRef, id: `${prefix}-select`, disabled: disabled, value: editor?.revision == null ? "" : editor.id, onChange: (event) => { if (event.currentTarget.value)
|
|
80
|
+
void props.open(event.currentTarget.value); }, children: [_jsx("option", { value: "", children: t(editor?.revision === null ? "newDraft" : "choose") }), snapshot.profiles.map((profile, index) => _jsxs("option", { value: profile.id, children: [profile.label?.trim() ? `${profile.label} (${profile.id})` : profile.id, profile.error === undefined ? "" : ` — ${t("invalidProfile", { id: profile.id })}`, profile.warnings?.length ? ` — ${t("warningProfile")}` : ""] }, `${index}:${profile.id}`))] }), snapshot.profiles.length === 0 && _jsx("p", { className: "dsmm-hint", children: t("empty") })] }), snapshot !== null && snapshot.profiles.some(profile => profile.error !== undefined || profile.warnings?.length) && _jsx("ul", { className: "dsmm-profile-list", "aria-label": t("savedInventory"), children: snapshot.profiles.filter(profile => profile.error !== undefined || profile.warnings?.length).map((profile, index) => _jsxs("li", { children: [_jsx("p", { children: profile.label?.trim() ? `${profile.label} (${profile.id})` : profile.id }), _jsx(ProfileWarnings, { warnings: profile.warnings, t: t }), profile.error !== undefined && _jsx(IssueDetails, { issue: profile.error, t: t })] }, `${index}:${profile.id}`)) }), state.pendingEditor !== null && _jsxs("div", { className: "dsmm-confirm", role: "group", "aria-labelledby": `${prefix}-confirm`, onKeyDown: (event) => { if (event.key === "Escape") {
|
|
81
81
|
event.preventDefault();
|
|
82
82
|
props.cancelDiscard();
|
|
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") }),
|
|
83
|
+
} }, children: [_jsx("p", { id: `${prefix}-confirm`, children: t("discardPrompt") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => { void props.discardAndOpen(); }, children: t("discard") }), _jsx(Button, { ref: cancelRef, type: "button", variant: "primary", onClick: props.cancelDiscard, children: t("cancel") })] })] })] }), _jsxs("section", { className: "dsmm-zone", "aria-labelledby": `${prefix}-edit`, "data-dsmm-zone": "edit", children: [_jsx("h3", { id: `${prefix}-edit`, children: t("editZone") }), editor === null && _jsx("p", { className: "dsmm-hint", children: t("noEditor") }), editor !== null && _jsxs("div", { className: "dsmm-editor", children: [_jsx("p", { "data-dsmm-editor-state": true, children: t(editor.refreshRequired ? "savedRefreshRequired" : state.dirty ? "dirty" : applied ? "savedApplied" : relationship === "unknown" ? "savedRelationshipUnknown" : "savedNotApplied") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: editorDisabled || !state.dirty || snapshot === null || state.invalidFields.length > 0, onClick: () => { void props.save(); }, children: t(state.busy === "save" ? "saving" : "save") }), editor.revision !== null && _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => { void props.reload(); }, children: t("reload") })] }), warnings.length > 0 && _jsxs("div", { children: [_jsx("p", { children: t("draftWarnings") }), _jsx(ProfileWarnings, { warnings: warnings, t: t })] }), editor.warnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("savedWarnings") }), _jsx(ProfileWarnings, { warnings: editor.warnings, t: t })] }) : null, _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-id`, children: t("profileId") }), _jsx(Input, { ref: inputRef, id: `${prefix}-id`, className: "dsmm-input", value: editor.id, disabled: editorDisabled || editor.revision !== null, "aria-invalid": idInvalid || undefined, "aria-describedby": `${prefix}-id-hint${idInvalid ? ` ${prefix}-issue` : ""}`, onChange: (event) => props.editId(event.currentTarget.value) }), _jsx("p", { id: `${prefix}-id-hint`, className: "dsmm-hint", children: t("idHint") })] }), _jsxs("div", { className: "dsmm-catalog", children: [state.catalogUnavailable && _jsx("p", { className: "dsmm-hint", children: t("catalogUnavailable") }), state.catalog?.failures.map((failure) => _jsx("p", { className: "dsmm-hint", children: t("catalogFailure", { name: failure.name, id: failure.id }) }, failure.id)), _jsx(Button, { type: "button", variant: "outline", disabled: state.catalogBusy, onClick: () => { void props.refreshCatalog(); }, children: t(state.catalogBusy ? "catalogRefreshing" : "catalogRefresh") })] }), _jsx(StructuredEditor, { state: state, actions: props, disabled: editorDisabled, t: t }, `structured:${state.editorEpoch}`), _jsxs("details", { ref: advancedRef, className: "dsmm-advanced", children: [_jsx("summary", { children: t("advanced") }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-content`, children: t("configuration") }), _jsx("textarea", { ref: editorRef, id: `${prefix}-content`, rows: 12, spellCheck: false, value: editor.content, readOnly: readOnly, disabled: editorDisabled, "aria-invalid": rawInvalid || (invalid && !idInvalid) || undefined, "aria-describedby": `${prefix}-content-hint ${prefix}-structural-hint${invalid && !idInvalid ? ` ${prefix}-issue` : ""}`, onChange: (event) => props.editContent(event.currentTarget.value) }), _jsx("p", { id: `${prefix}-content-hint`, className: "dsmm-hint", children: t("configurationHint") }), _jsx("p", { id: `${prefix}-structural-hint`, className: "dsmm-hint", children: t("structuralHint") })] })] }, `advanced:${state.editorEpoch}`)] }), state.issue !== null && _jsxs("div", { className: "dsmm-issue", id: `${prefix}-issue`, role: "alert", children: [_jsx("p", { children: t(issueKey(state.issue)) }), _jsx(IssueDetails, { issue: state.issue, t: t })] })] }), _jsxs("section", { className: "dsmm-zone", "aria-labelledby": `${prefix}-global`, "data-dsmm-zone": "future-default", children: [_jsx("h3", { id: `${prefix}-global`, children: t("globalScope") }), _jsx("p", { id: `${prefix}-global-action`, className: "dsmm-hint", children: t("newSessions") }), _jsx("p", { "data-dsmm-selection": true, children: selection }), snapshot?.refreshRequired && _jsx("p", { role: "status", children: t("savedRefreshRequired") }), snapshot?.selectedWarnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("futureWarnings") }), _jsx(ProfileWarnings, { warnings: snapshot.selectedWarnings, t: t })] }) : null, _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", "aria-describedby": `${prefix}-global-action`, disabled: editorDisabled || state.dirty || editor?.revision == null || !reconcilable || (applied && !selectionConflict), onClick: () => { void props.apply(); }, children: t(state.busy === "apply" ? "applying" : "apply") }), _jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || !reconcilable || (snapshot?.selectedId === null && !selectionConflict), onClick: () => { void props.reset(); }, children: t(state.busy === "reset" ? "resetting" : "reset") })] }), snapshot?.selectionError !== undefined && _jsxs("div", { className: "dsmm-issue", children: [_jsx("p", { children: t(selectionConflict ? "selectionConflict" : "retry") }), _jsx(IssueDetails, { issue: snapshot.selectionError, t: t })] })] }), _jsx("section", { className: "dsmm-zone", "aria-label": t("sessionScope"), "data-dsmm-zone": "current-session", children: _jsx(SessionScope, { state: state, actions: props, t: t }) }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.busy === "refresh" && snapshot === null ? t("loading") : state.busy === "read" ? t("reading") : notice })] });
|
|
84
84
|
}
|
|
85
85
|
//# sourceMappingURL=ProfilesSection.js.map
|
|
@@ -14,6 +14,6 @@ export function RoleAvailability({ value, t }) {
|
|
|
14
14
|
const state = roleAvailability(value);
|
|
15
15
|
if (state === undefined)
|
|
16
16
|
return _jsx("p", { className: "dsmm-hint", children: t("availabilityUnknown") });
|
|
17
|
-
return _jsxs("div", { className: "dsmm-availability", "data-dsmm-role-availability": state.id, children: [_jsx("p", { children: t(state.required ? "roleRequired" : "roleOptional", { reason: state.requiredReason ?? "—" }) }), _jsx("p", { children: t("roleCeiling", { startup: t(state.startupAvailable ? "enabled" : "disabled"), deployment: t(state.deploymentEnabled ? "enabled" : "disabled"), admitted: t(state.admitted ? "enabled" : "disabled") }) }), _jsx("p", { className: "dsmm-hint", children: t("roleProvenance", { source: state.source, capture: state.capture }) })
|
|
17
|
+
return _jsxs("div", { className: "dsmm-availability", "data-dsmm-role-availability": state.id, children: [_jsx("p", { children: t(state.required ? "roleRequired" : "roleOptional", { reason: state.requiredReason ?? "—" }) }), state.reason !== undefined && _jsx("p", { children: t("roleUnavailableReason", { reason: state.reason }) }), _jsxs("details", { children: [_jsx("summary", { children: t("technicalDetails") }), _jsx("p", { children: t("roleCeiling", { startup: t(state.startupAvailable ? "enabled" : "disabled"), deployment: t(state.deploymentEnabled ? "enabled" : "disabled"), admitted: t(state.admitted ? "enabled" : "disabled") }) }), _jsx("p", { className: "dsmm-hint", children: t("roleProvenance", { source: state.source, capture: state.capture }) })] })] });
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=RoleAvailability.js.map
|
|
@@ -18,7 +18,7 @@ function capabilityReason(reason, t) {
|
|
|
18
18
|
case "model-unconfigured": return t("headerNoProfileModel");
|
|
19
19
|
case "model-service-unavailable": return t("headerModelUnconfirmed");
|
|
20
20
|
case "new-session-required": return t("sessionNewRequired");
|
|
21
|
-
default: return t("
|
|
21
|
+
default: return t("headerActionUnavailable");
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
function menuIssue(issue) {
|
|
@@ -34,8 +34,8 @@ export function SessionScope({ state, actions, t, compact = false }) {
|
|
|
34
34
|
const labels = session === null ? null : sessionProfileLabels(session, t);
|
|
35
35
|
const selected = state.snapshot?.profiles.find((profile) => profile.id === state.sessionChoice);
|
|
36
36
|
const disabled = state.busy !== null || state.pendingEditor !== null || state.sessionBusy !== null || state.dirty || state.invalidFields.length > 0;
|
|
37
|
-
const current = () => actions.readProfileView().currentSessionId === state.currentSessionId;
|
|
38
|
-
const ready = session !== null && !session.refreshRequired && !session.selection.refreshRequired && writableSelectionVersion(session.selection.selectionRevision);
|
|
37
|
+
const current = () => { const live = actions.readProfileView(); return live.currentSessionId === state.currentSessionId && live.sessionViewEpoch === state.sessionViewEpoch && live.session === session; };
|
|
38
|
+
const ready = session !== null && !state.sessionUnconfirmed && !session.refreshRequired && !session.selection.refreshRequired && writableSelectionVersion(session.selection.selectionRevision);
|
|
39
39
|
const allowed = ready && session.canApplyOverlay === true && session.applyOverlayUnavailableReason !== "new-session-required";
|
|
40
40
|
const modelAllowed = ready && session.canSelectModel === true && session.profileModel !== undefined;
|
|
41
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");
|
|
@@ -47,12 +47,12 @@ export function SessionScope({ state, actions, t, compact = false }) {
|
|
|
47
47
|
catch {
|
|
48
48
|
binding = undefined;
|
|
49
49
|
}
|
|
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("
|
|
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()
|
|
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
|
|
50
|
+
return _jsxs("div", { className: "dsmm-session-scope", "aria-busy": state.sessionBusy !== null, "data-dsmm-session-scope": true, children: [!compact && _jsx("h3", { children: t("sessionScope") }), state.currentSessionId === null ? _jsx("p", { className: "dsmm-hint", children: t("sessionChooseWorkspace") }) : _jsxs(_Fragment, { children: [labels !== null && _jsx("p", { "data-dsmm-session-state": true, children: labels.admitted }), labels !== null && !compact && _jsx("p", { className: "dsmm-hint", "data-dsmm-session-future-default": true, children: labels.futureDefault }), session === null && _jsx("p", { className: "dsmm-hint", id: `${prefix}-overlay-reason`, children: t("sessionUnavailable") }), session?.warnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("admissionWarnings") }), _jsx(ProfileWarnings, { warnings: session.warnings, t: t })] }) : null, session !== null && !allowed && _jsx("p", { className: "dsmm-hint", id: `${prefix}-overlay-reason`, children: capabilityReason(session.applyOverlayUnavailableReason, t) }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-choice`, children: t("sessionSelect") }), _jsxs("select", { id: `${prefix}-choice`, value: state.sessionChoice ?? "", disabled: disabled || !allowed, "aria-describedby": !allowed ? `${prefix}-overlay-reason` : undefined, onChange: (event) => { if (current())
|
|
51
|
+
actions.chooseSessionProfile(event.currentTarget.value || null); }, children: [_jsx("option", { value: "", children: t("sessionBaseline") }), state.sessionChoice !== null && selected === undefined && _jsx("option", { value: state.sessionChoice, children: state.sessionChoice }), state.snapshot?.profiles.map((profile) => _jsxs("option", { value: profile.id, disabled: !isConfigRevision(profile.revision) || profile.error !== undefined, children: [profile.label?.trim() || profile.id, profileWarnings(profile.warnings).length ? ` — ${t("warningProfile")}` : ""] }, profile.id))] })] }), !compact && _jsxs(_Fragment, { children: [_jsx("p", { className: "dsmm-hint", children: t("sessionModelHint") }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || !modelAllowed, "aria-describedby": !modelAllowed ? `${prefix}-model-reason` : undefined, onClick: () => { if (current())
|
|
52
|
+
void actions.useSessionProfileModel(); }, children: t("headerUseCurrentModel") }), !modelAllowed && _jsx("p", { className: "dsmm-hint", id: `${prefix}-model-reason`, children: capabilityReason(session?.selectModelUnavailableReason, t) }), session !== null && _jsxs("details", { children: [_jsx("summary", { children: t("technicalDetails") }), _jsxs("div", { className: "dsmm-availability", children: [_jsx("p", { children: binding === undefined ? t("bindingUnknown") : t("bindingState", { binding: binding.binding, ready: t(binding.deliveryFenceReady ? "enabled" : "disabled"), restart: t(binding.restartRequired ? "enabled" : "disabled") }) }), binding?.reason !== undefined && _jsx("p", { children: t("bindingReason", { reason: binding.reason }) })] }), session.roles !== undefined && _jsxs("details", { children: [_jsx("summary", { children: t("admittedRoles") }), session.roles.map(role => _jsxs("div", { className: "dsmm-availability", children: [_jsx("p", { children: role.id }), _jsx(RoleAvailability, { value: role, t: t })] }, role.id))] }), session.rolePolicy !== undefined && _jsx("p", { "data-dsmm-session-policy": true, children: t("roleState", { route: session.rolePolicy.route === undefined ? t("inheritRoute") : `${session.rolePolicy.route.provider}/${session.rolePolicy.route.model}${session.rolePolicy.route.reasoningEffort === undefined ? "" : ` (${session.rolePolicy.route.reasoningEffort})`}`, strategy: session.rolePolicy.strategy, retries: session.rolePolicy.retries, failures: session.rolePolicy.rateLimitFailures, switches: session.rolePolicy.switches, delay: session.rolePolicy.totalDelayMs }) })] })] }), state.dirty && _jsx("p", { className: "dsmm-hint", children: t("sessionDirty") }), (session?.refreshRequired || session?.selection.refreshRequired) && _jsx("p", { role: "status", children: t("sessionCommittedRefresh") }), state.sessionUnconfirmed && _jsx("p", { role: "status", children: t("sessionUnconfirmedRefresh") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: disabled || !allowed || (state.sessionChoice !== null && !isConfigRevision(selected?.revision)), "aria-describedby": !allowed ? `${prefix}-overlay-reason` : undefined, onClick: () => { if (current())
|
|
53
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())
|
|
54
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())
|
|
55
|
-
void actions.refreshSession(); }, children: t("sessionRefresh") })] })
|
|
55
|
+
void actions.refreshSession(); }, children: t("sessionRefresh") })] })] }), state.sessionIssue !== null && _jsx("p", { role: "alert", children: state.sessionIssue.source === "profile-model" ? t(state.sessionIssue.code === "model-unconfigured" ? "headerNoProfileModel" : state.sessionIssue.code === "model-choice-changed" ? "headerModelChoiceChanged" : "headerModelUnconfirmed")
|
|
56
56
|
: state.sessionIssue.code === "conflict" ? t("sessionConflict")
|
|
57
57
|
: ["busy", "maintenance", "disposed", "not-owned"].includes(state.sessionIssue.code) ? t("sessionBusy", { reason: state.sessionIssue.code })
|
|
58
58
|
: t(state.sessionIssue.code === "validation" ? "validation" : "sessionUnavailable") }), state.sessionIssue !== null && _jsx(IssueDetails, { issue: state.sessionIssue, t: t }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.sessionBusy === "read" ? t("reading") : status })] });
|
|
@@ -74,12 +74,16 @@ export function SessionProfiles(props) {
|
|
|
74
74
|
const profiles = state.snapshot?.profiles ?? [];
|
|
75
75
|
const currentSaved = profiles.find((profile) => profile.id === current);
|
|
76
76
|
const committing = state.sessionBusy !== null;
|
|
77
|
-
const unavailable = id === null || committing || state.busy !== null || session === null || session.refreshRequired === true || session.selection.refreshRequired === true;
|
|
77
|
+
const unavailable = id === null || committing || state.busy !== null || state.sessionUnconfirmed || session === null || session.refreshRequired === true || session.selection.refreshRequired === true;
|
|
78
78
|
const profileDisabled = unavailable || state.pendingEditor !== null || state.dirty || state.invalidFields.length > 0
|
|
79
79
|
|| session === null || !writableSelectionVersion(session.selection.selectionRevision);
|
|
80
80
|
const disabled = profileDisabled || session?.canApplyOverlay !== true || session?.applyOverlayUnavailableReason === "new-session-required" || state.snapshot === null;
|
|
81
81
|
let feedback = "";
|
|
82
|
-
if (state.
|
|
82
|
+
if (state.sessionUnconfirmed)
|
|
83
|
+
feedback = t("sessionUnconfirmedRefresh");
|
|
84
|
+
else if (session?.refreshRequired || session?.selection.refreshRequired)
|
|
85
|
+
feedback = t("sessionCommittedRefresh");
|
|
86
|
+
else if (state.sessionIssue !== null)
|
|
83
87
|
feedback = t(state.sessionIssue.source === "profile-model" ? state.sessionIssue.code === "model-unconfigured" ? "headerNoProfileModel" : state.sessionIssue.code === "model-choice-changed" ? "headerModelChoiceChanged" : "headerModelUnconfirmed"
|
|
84
88
|
: state.sessionIssue.code === "conflict" ? "headerConflict" : state.sessionIssue.code === "activation" ? "headerActivationRefused"
|
|
85
89
|
: state.sessionIssue.code === "maintenance" ? "headerMaintenanceRefused" : state.sessionIssue.code === "busy" ? "headerBusyRefused"
|
|
@@ -89,21 +93,19 @@ export function SessionProfiles(props) {
|
|
|
89
93
|
else if (state.dirty || state.invalidFields.length > 0 || state.pendingEditor !== null)
|
|
90
94
|
feedback = t("headerDraft");
|
|
91
95
|
else if (id === null)
|
|
92
|
-
feedback = t("
|
|
96
|
+
feedback = t("sessionChooseWorkspace");
|
|
93
97
|
else if (session === null || state.snapshot === null)
|
|
94
98
|
feedback = t("headerUnavailable");
|
|
95
|
-
else if (session.refreshRequired || session.selection.refreshRequired)
|
|
96
|
-
feedback = t("savedRefreshRequired");
|
|
97
99
|
else if (state.sessionNotice !== null)
|
|
98
100
|
feedback = t(state.sessionNotice === "mode-on" ? "headerModeOn" : state.sessionNotice === "mode-off" ? "headerModeOff" : state.sessionNotice === "applied-with-model" ? "headerAppliedWithModel" : "headerApplied");
|
|
99
|
-
const profileName = unknownCaptured ? t("headerCaptured") : admission !== undefined && sourceRelationship(admission, currentSaved?.revision) === "current" && currentSaved?.label?.trim() ?
|
|
101
|
+
const profileName = unknownCaptured ? t("headerCaptured") : admission !== undefined && sourceRelationship(admission, currentSaved?.revision) === "current" && currentSaved?.label?.trim() ? currentSaved.label : admission?.selectedId ?? t("sessionBaseline");
|
|
100
102
|
const currentLabel = t("headerCurrentProfile", { profile: session === null ? t("headerUnavailable") : profileName });
|
|
101
103
|
const entries = [{ type: "label", id: "@current", text: currentLabel }];
|
|
102
104
|
for (const warning of profileWarnings(session?.warnings))
|
|
103
105
|
entries.push({ type: "label", id: `@warning:${warning.code}`, text: t("warningMarker", { code: warning.code, field: warning.field }) });
|
|
104
|
-
if (id === null && state.snapshot !== null)
|
|
106
|
+
if ((id === null || session?.canApplyOverlay === true) && state.snapshot !== null)
|
|
105
107
|
entries.push({ type: "label", id: "@future", text: t("sessionFutureDefault", { profile: state.snapshot.profiles.find((profile) => profile.id === state.snapshot.selectedId)?.label?.trim() || state.snapshot.selectedId || t("sessionBaseline") }) });
|
|
106
|
-
if (feedback !== "" && (state.sessionNotice === null || state.sessionIssue !== null))
|
|
108
|
+
if (feedback !== "" && (state.sessionNotice === null || state.sessionIssue !== null || state.sessionUnconfirmed || session?.refreshRequired || session?.selection.refreshRequired))
|
|
107
109
|
entries.push({ type: "label", id: "@status", text: feedback });
|
|
108
110
|
const mode = session?.deepwork;
|
|
109
111
|
entries.push({ id: "@mode", label: t(mode === undefined ? "headerModeUnavailable" : mode.locked ? "headerModePreset" : mode.active ? "headerModeDisable" : "headerModeEnable"),
|
|
@@ -112,7 +114,7 @@ export function SessionProfiles(props) {
|
|
|
112
114
|
entries.push({ type: "label", id: "@mode-reason", text: capabilityReason(session.toggleModeUnavailableReason, t) });
|
|
113
115
|
const diagnostic = state.sessionIssue === null ? null : menuIssue(state.sessionIssue);
|
|
114
116
|
const diagnosticText = diagnostic === null ? "" : t("headerIssueCode", { code: diagnostic.code }) + (diagnostic.field === undefined ? "" : ` ${t("headerIssueField", { field: diagnostic.field })}`);
|
|
115
|
-
const retryHint = t(diagnostic?.code === "maintenance" || diagnostic?.code === "busy" ? "headerWaitRetryHint" : "headerRetryHint");
|
|
117
|
+
const retryHint = t(state.sessionUnconfirmed ? "sessionUnconfirmedRefresh" : diagnostic?.code === "maintenance" || diagnostic?.code === "busy" ? "headerWaitRetryHint" : "headerRetryHint");
|
|
116
118
|
if (diagnostic !== null)
|
|
117
119
|
entries.push({ type: "label", id: "@diagnostic", text: diagnosticText }, { type: "label", id: "@retry", text: retryHint });
|
|
118
120
|
if (admission?.selectedId != null && currentSaved === undefined)
|
|
@@ -129,12 +131,13 @@ export function SessionProfiles(props) {
|
|
|
129
131
|
entries.push({ type: "label", id: "@model-reason", text: capabilityReason(session.selectModelUnavailableReason, t) });
|
|
130
132
|
const open = openFor === id;
|
|
131
133
|
return _jsxs("div", { className: "dsmm-header-profiles", "data-dsmm-header-profile": true, "aria-busy": committing, children: [_jsx(Menu, { open: open, autoFocus: true, portal: true, align: "start", className: "dsmm-profile-anchor", listClassName: "dsmm-profile-menu", items: entries, selectedId: current, footer: [{ id: "@refresh", label: t("headerCompactRefresh"), disabled: committing || state.busy !== null }], anchor: _jsx(Button, { type: "button", size: "sm", variant: "toolbar", className: "dsmm-profile-trigger", icon: _jsx(IconBranchOutlineRegular, {}), "aria-label": t("headerProfileLabel"), "aria-haspopup": "menu", "aria-expanded": open, "aria-describedby": `${prefix}-feedback`, onClick: () => setOpenFor(open ? undefined : id) }), onClose: () => setOpenFor(undefined), onSelect: (value) => {
|
|
132
|
-
|
|
134
|
+
const live = props.readProfileView();
|
|
135
|
+
if (live.currentSessionId !== id || live.sessionViewEpoch !== state.sessionViewEpoch || live.session !== session)
|
|
133
136
|
return;
|
|
134
137
|
if (value === "@refresh") {
|
|
135
138
|
if (committing || state.busy !== null)
|
|
136
139
|
return;
|
|
137
|
-
void (async () => { await props.refresh(); if (id !== null && props.readProfileView().currentSessionId === id)
|
|
140
|
+
void (async () => { await props.refresh(); if (id !== null && props.readProfileView().currentSessionId === id && props.readProfileView().sessionViewEpoch === state.sessionViewEpoch)
|
|
138
141
|
await props.refreshSession(); })();
|
|
139
142
|
}
|
|
140
143
|
else {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
|
|
2
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
3
|
+
import type { ConnectionHandle } from "@deepseek-ai/dsh-client-connection/client";
|
|
4
|
+
import type { TemporaryPermissionRemote } from "../permission-temporary-types.js";
|
|
5
|
+
import type { TemporaryPendingApproval } from "./temporary-permission-client.js";
|
|
6
|
+
type Locale = PropsLocale<"settings.dsmm-permissions">;
|
|
7
|
+
/** Parent mounts after native approval UI and registers the existing permission dictionaries. */
|
|
8
|
+
export declare function registerTemporaryPermissionSlots(ctx: Context, connection: ConnectionHandle): void;
|
|
9
|
+
/** Render beside the native prompt, never replace its approve/reject/cancel controls. */
|
|
10
|
+
export declare function TemporaryApproval({ pending, remote, t, child }: Locale & {
|
|
11
|
+
pending: TemporaryPendingApproval;
|
|
12
|
+
remote: TemporaryPermissionRemote;
|
|
13
|
+
child?: boolean;
|
|
14
|
+
}): import("react").JSX.Element | null;
|
|
15
|
+
export declare function TemporaryGrants({ sessionId, remote, t, child }: Locale & {
|
|
16
|
+
sessionId: string;
|
|
17
|
+
remote: TemporaryPermissionRemote;
|
|
18
|
+
child?: boolean;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=TemporaryPermissions.d.ts.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { Button } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
|
+
import { answerWithTemporaryPermit, pendingDelivery, retainAndAnswer, temporaryPermissionClient } from "./temporary-permission-client.js";
|
|
5
|
+
import { PERMISSIONS_NS } from "./permission-locales.js";
|
|
6
|
+
const durations = ["once", "session", "15min", "1h"];
|
|
7
|
+
/** Parent mounts after native approval UI and registers the existing permission dictionaries. */
|
|
8
|
+
export function registerTemporaryPermissionSlots(ctx, connection) {
|
|
9
|
+
const lifetime = new AbortController();
|
|
10
|
+
ctx.effect(() => () => lifetime.abort());
|
|
11
|
+
ctx.slots.inject("conversation.composer", () => ctx.slots.register({
|
|
12
|
+
name: "conversation.approval.permissions", priority: 0, locale: PERMISSIONS_NS,
|
|
13
|
+
}, function PermissionSlot(props) {
|
|
14
|
+
const remote = useMemo(() => temporaryPermissionClient(connection, lifetime.signal), [props.pending]);
|
|
15
|
+
const child = props.useSession(snapshot => snapshot.subagent !== undefined);
|
|
16
|
+
return _jsx(TemporaryApproval, { pending: props.pending, remote: remote, t: props.t, child: child }, props.pending.key);
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
/** Render beside the native prompt, never replace its approve/reject/cancel controls. */
|
|
20
|
+
export function TemporaryApproval({ pending, remote, t, child = false }) {
|
|
21
|
+
const id = useId(), [view, setView] = useState(), [duration, setDuration] = useState("once");
|
|
22
|
+
const [busy, setBusy] = useState(false), [error, setError] = useState(false);
|
|
23
|
+
const [scope, setScope] = useState("exact");
|
|
24
|
+
const identity = useRef({ pending, remote, active: true });
|
|
25
|
+
if (identity.current.pending !== pending || identity.current.remote !== remote)
|
|
26
|
+
identity.current = { pending, remote, active: true };
|
|
27
|
+
const captured = identity.current, isCurrent = () => captured.active && identity.current === captured;
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
let current = true;
|
|
30
|
+
setView(undefined);
|
|
31
|
+
setDuration("once");
|
|
32
|
+
setScope("exact");
|
|
33
|
+
setError(false);
|
|
34
|
+
setBusy(false);
|
|
35
|
+
const delivery = pendingDelivery(pending);
|
|
36
|
+
if (delivery)
|
|
37
|
+
void remote.request(pending.sessionId, delivery).then(async (value) => {
|
|
38
|
+
if (!current)
|
|
39
|
+
return;
|
|
40
|
+
setView(value);
|
|
41
|
+
if (value.reusable)
|
|
42
|
+
await answerWithTemporaryPermit(pending, remote, () => current);
|
|
43
|
+
}).catch(() => { if (current)
|
|
44
|
+
setError(true); });
|
|
45
|
+
captured.active = true;
|
|
46
|
+
return () => { current = false; captured.active = false; };
|
|
47
|
+
}, [pending, remote]);
|
|
48
|
+
if (!pendingDelivery(pending))
|
|
49
|
+
return null;
|
|
50
|
+
return _jsxs("section", { className: "dsmm-structured", "aria-label": t("temporaryTitle"), "aria-busy": busy, children: [view && _jsxs(_Fragment, { children: [_jsx("p", { children: view.summary }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: id, children: t("temporaryDuration") }), _jsx("select", { id: id, value: duration, disabled: busy || !pending.answerable, onChange: event => {
|
|
51
|
+
const value = durations.find(value => value === event.currentTarget.value);
|
|
52
|
+
if (value)
|
|
53
|
+
setDuration(value);
|
|
54
|
+
}, children: durations.filter(value => view.reusable || value === "once").map(value => _jsx("option", { value: value, children: t(child && value === "session" ? "temporaryChildSession" : `temporary:${value}`) }, value)) })] }), !!view.scopes?.length && duration !== "once" && _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-scope`, children: t("pathScope") }), _jsxs("select", { id: `${id}-scope`, value: scope, disabled: busy || !pending.answerable, onChange: event => setScope(event.currentTarget.value), children: [_jsx("option", { value: "exact", children: view.summary }), view.scopes.map(choice => _jsx("option", { value: choice.id, children: choice.summary }, choice.id))] })] }), _jsx(Button, { variant: "primary", disabled: busy || !pending.answerable, onClick: () => {
|
|
55
|
+
setBusy(true);
|
|
56
|
+
setError(false);
|
|
57
|
+
void retainAndAnswer(pending, remote, duration, isCurrent, scope).catch(() => { if (isCurrent())
|
|
58
|
+
setError(true); }).finally(() => { if (isCurrent())
|
|
59
|
+
setBusy(false); });
|
|
60
|
+
}, children: t("temporaryApprove") })] }), _jsx("p", { className: "dsmm-hint", children: t("temporaryBoundary") }), view?.tool === "web_fetch" && _jsx("p", { className: "dsmm-hint", children: t("temporaryWebBoundary") }), error && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("temporaryUnavailable") })] });
|
|
61
|
+
}
|
|
62
|
+
export function TemporaryGrants({ sessionId, remote, t, child = false }) {
|
|
63
|
+
const [grants, setGrants] = useState(), [busy, setBusy] = useState(false), [error, setError] = useState(false);
|
|
64
|
+
const identity = useRef({ sessionId, remote, active: true });
|
|
65
|
+
if (identity.current.sessionId !== sessionId || identity.current.remote !== remote)
|
|
66
|
+
identity.current = { sessionId, remote, active: true };
|
|
67
|
+
const captured = identity.current, current = () => captured.active && identity.current === captured;
|
|
68
|
+
const accept = (value) => { if (current())
|
|
69
|
+
setGrants(value); };
|
|
70
|
+
const fail = () => { if (current())
|
|
71
|
+
setError(true); };
|
|
72
|
+
const finish = () => { if (current())
|
|
73
|
+
setBusy(false); };
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
let current = true;
|
|
76
|
+
setGrants(undefined);
|
|
77
|
+
setError(false);
|
|
78
|
+
void remote.describe(sessionId).then(value => { if (current)
|
|
79
|
+
setGrants(value); }).catch(() => { if (current)
|
|
80
|
+
setError(true); });
|
|
81
|
+
captured.active = true;
|
|
82
|
+
return () => { current = false; captured.active = false; };
|
|
83
|
+
}, [sessionId, remote]);
|
|
84
|
+
return _jsxs("section", { className: "dsmm-zone", "aria-label": t("temporaryTitle"), "aria-busy": busy, children: [_jsx("h3", { children: t("temporaryTitle") }), grants?.length === 0 && _jsx("p", { children: t("temporaryEmpty") }), grants?.map(grant => _jsxs("fieldset", { children: [_jsx("legend", { children: grant.tool }), _jsx("p", { children: grant.summary }), _jsx("p", { children: t(child && grant.duration === "session" ? "temporaryChildSession" : `temporary:${grant.duration}`) }), grant.tool === "web_fetch" && _jsx("p", { className: "dsmm-hint", children: t("temporaryWebBoundary") }), _jsx(Button, { variant: "outline", disabled: busy, onClick: () => {
|
|
85
|
+
setBusy(true);
|
|
86
|
+
setError(false);
|
|
87
|
+
void remote.revoke(sessionId, grant.id).then(accept).catch(fail).finally(finish);
|
|
88
|
+
}, children: t("temporaryRevoke") })] }, grant.id)), _jsx(Button, { variant: "outline", disabled: busy, onClick: () => {
|
|
89
|
+
setBusy(true);
|
|
90
|
+
setError(false);
|
|
91
|
+
void remote.describe(sessionId).then(accept).catch(fail).finally(finish);
|
|
92
|
+
}, children: t("temporaryRefresh") }), error && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("temporaryUnavailable") }), _jsx("p", { className: "dsmm-hint", children: t("temporaryBoundary") })] });
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=TemporaryPermissions.js.map
|
|
@@ -261,9 +261,9 @@ export declare const childrenLocaleZh: {
|
|
|
261
261
|
no: string;
|
|
262
262
|
activity: string;
|
|
263
263
|
runtime: string;
|
|
264
|
-
images: string;
|
|
265
|
-
title: string;
|
|
266
264
|
liveRoute: string;
|
|
265
|
+
title: string;
|
|
266
|
+
images: string;
|
|
267
267
|
descendants: string;
|
|
268
268
|
interrupt: string;
|
|
269
269
|
readonly: string;
|
|
@@ -271,8 +271,10 @@ export declare const childrenLocaleZh: {
|
|
|
271
271
|
delivery: string;
|
|
272
272
|
queue: string;
|
|
273
273
|
steer: string;
|
|
274
|
+
authority: string;
|
|
274
275
|
foreign: string;
|
|
275
276
|
reading: string;
|
|
277
|
+
restart: string;
|
|
276
278
|
refresh: string;
|
|
277
279
|
noSession: string;
|
|
278
280
|
runs: string;
|
|
@@ -319,8 +321,6 @@ export declare const childrenLocaleZh: {
|
|
|
319
321
|
interruptAvailability: string;
|
|
320
322
|
imageAvailability: string;
|
|
321
323
|
fence: string;
|
|
322
|
-
restart: string;
|
|
323
|
-
authority: string;
|
|
324
324
|
evidence: string;
|
|
325
325
|
evidenceMissing: string;
|
|
326
326
|
originalEpoch: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { RemoteResult } from "@deepseek-ai/dsh-typert-protocol";
|
|
2
2
|
import type { HostObservable } from "@deepseek-ai/dsh-client-ui-slots";
|
|
3
|
+
import type { ConnectionGenerationState } from "@deepseek-ai/dsh-client-connection/client";
|
|
4
|
+
import type { ComposerBlocks } from "@deepseek-ai/dsh-client-ui-conversation/client";
|
|
3
5
|
import type { SessionEventSource } from "@deepseek-ai/dsh-api-session-controller/client";
|
|
4
6
|
import type { ModelDirectoryState } from "@deepseek-ai/dsh-client-ui-model-selection/client";
|
|
5
7
|
import type { DsmmProfilesRemote } from "../profile-remote.js";
|
|
@@ -42,6 +44,8 @@ export interface ProfilesViewSnapshot {
|
|
|
42
44
|
catalogBusy: boolean;
|
|
43
45
|
catalogUnavailable: boolean;
|
|
44
46
|
currentSessionId: string | null;
|
|
47
|
+
sessionViewEpoch: number;
|
|
48
|
+
sessionUnconfirmed: boolean;
|
|
45
49
|
session: SessionProfileSnapshot | null;
|
|
46
50
|
sessionChoice: string | null;
|
|
47
51
|
sessionBusy: "read" | "apply" | "reset" | "mode" | null;
|
|
@@ -95,6 +99,14 @@ export declare class ProfilesController {
|
|
|
95
99
|
private generation;
|
|
96
100
|
private disposed;
|
|
97
101
|
private sessionGeneration;
|
|
102
|
+
private pendingSessionSelections;
|
|
103
|
+
private connection;
|
|
104
|
+
private connectionBaseline;
|
|
105
|
+
private connectionBound;
|
|
106
|
+
private stopConnection;
|
|
107
|
+
private composerBlocks;
|
|
108
|
+
private composerReason;
|
|
109
|
+
private composerBlock;
|
|
98
110
|
private catalogGeneration;
|
|
99
111
|
private catalogRemote;
|
|
100
112
|
private modelSelectorGeneration;
|
|
@@ -121,6 +133,11 @@ export declare class ProfilesController {
|
|
|
121
133
|
readonly actions: ProfilesActions;
|
|
122
134
|
constructor(remote: DsmmProfilesRemote);
|
|
123
135
|
dispose(): void;
|
|
136
|
+
bindConnection(source: ConnectionGenerationState | null): void;
|
|
137
|
+
private connectionCurrent;
|
|
138
|
+
attachComposerBlocks(blocks: ComposerBlocks | null, reason?: () => string): void;
|
|
139
|
+
private releaseComposerBlock;
|
|
140
|
+
private syncComposerBlock;
|
|
124
141
|
attachModelSelector(remote: ProfileModelSelectorRemote | null): void;
|
|
125
142
|
attachModelSelectionSource(sessionId: string | null, source: HostObservable<unknown> | null): void;
|
|
126
143
|
attachModelEventSource(sessionId: string | null, source: SessionEventSource | null): void;
|