@dsmm/dsmm 0.3.2 → 0.3.3

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.
Files changed (110) hide show
  1. package/README.md +2 -2
  2. package/cordis.patch.yml +0 -9
  3. package/docs/agent-presets.md +5 -5
  4. package/docs/compatibility.md +2 -6
  5. package/docs/migration-from-ocmm.md +1 -1
  6. package/docs/roadmap.md +5 -12
  7. package/docs/settings-status.md +1 -1
  8. package/lib/client/ChildrenPanel.d.ts +1 -4
  9. package/lib/client/ChildrenPanel.js +3 -3
  10. package/lib/client/DeploymentPage.d.ts +1 -3
  11. package/lib/client/DeploymentPage.js +2 -2
  12. package/lib/client/PermissionsPanel.d.ts +1 -3
  13. package/lib/client/PermissionsPanel.js +2 -3
  14. package/lib/client/children-locales.d.ts +4 -4
  15. package/lib/client/controller.js +4 -1
  16. package/lib/client/deployment-locales.js +0 -1
  17. package/lib/client/deployment-modules.js +1 -1
  18. package/lib/client/index.js +2 -7
  19. package/lib/client/locales.js +131 -119
  20. package/lib/client/permission-locales.d.ts +0 -26
  21. package/lib/client/permission-locales.js +0 -20
  22. package/lib/client.js +1837 -3634
  23. package/lib/index.d.ts +0 -2
  24. package/lib/index.js +9 -22
  25. package/lib/native-admission.d.ts +0 -3
  26. package/lib/native-admission.js +12 -45
  27. package/lib/permission-fs-search.js +1 -2
  28. package/lib/permission-fs.js +1 -2
  29. package/lib/permission-web.js +1 -2
  30. package/lib/preset-materializer.js +3 -3
  31. package/lib/preset-registry.d.ts +20 -2
  32. package/lib/preset-registry.js +46 -17
  33. package/lib/profile-diagnostics.js +1 -1
  34. package/lib/profile-remote.js +1 -3
  35. package/lib/role-policy.js +2 -2
  36. package/lib/role-subagents.js +2 -1
  37. package/lib/roles.d.ts +2 -0
  38. package/lib/roles.js +2 -0
  39. package/lib/settings.d.ts +1 -3
  40. package/lib/settings.js +4 -9
  41. package/package.json +1 -5
  42. package/lib/client/ChildPermissions.d.ts +0 -43
  43. package/lib/client/ChildPermissions.js +0 -100
  44. package/lib/client/HistoryContinuation.d.ts +0 -7
  45. package/lib/client/HistoryContinuation.js +0 -22
  46. package/lib/client/PermissionPanelEntry.d.ts +0 -8
  47. package/lib/client/PermissionPanelEntry.js +0 -11
  48. package/lib/client/TemporaryPermissions.d.ts +0 -21
  49. package/lib/client/TemporaryPermissions.js +0 -94
  50. package/lib/client/history-controller.d.ts +0 -29
  51. package/lib/client/history-controller.js +0 -111
  52. package/lib/client/history-entry.d.ts +0 -11
  53. package/lib/client/history-entry.js +0 -106
  54. package/lib/client/history-locales.d.ts +0 -95
  55. package/lib/client/history-locales.js +0 -41
  56. package/lib/client/temporary-permission-client.d.ts +0 -20
  57. package/lib/client/temporary-permission-client.js +0 -52
  58. package/lib/client/temporary-permission-entry.d.ts +0 -6
  59. package/lib/client/temporary-permission-entry.js +0 -56
  60. package/lib/history-candidates.d.ts +0 -30
  61. package/lib/history-candidates.js +0 -176
  62. package/lib/history-codec.d.ts +0 -11
  63. package/lib/history-codec.js +0 -102
  64. package/lib/history-contract.d.ts +0 -44
  65. package/lib/history-contract.js +0 -2
  66. package/lib/history-controller.d.ts +0 -42
  67. package/lib/history-controller.js +0 -329
  68. package/lib/history-policy.d.ts +0 -4
  69. package/lib/history-policy.js +0 -8
  70. package/lib/history-remote.d.ts +0 -28
  71. package/lib/history-remote.js +0 -17
  72. package/lib/history-rpc.d.ts +0 -24
  73. package/lib/history-rpc.js +0 -136
  74. package/lib/history-support.d.ts +0 -15
  75. package/lib/history-support.js +0 -21
  76. package/lib/history-types.d.ts +0 -67
  77. package/lib/history-types.js +0 -2
  78. package/lib/permission-child-control.d.ts +0 -36
  79. package/lib/permission-child-control.js +0 -164
  80. package/lib/permission-exec-argv.d.ts +0 -32
  81. package/lib/permission-exec-argv.js +0 -171
  82. package/lib/permission-temporary-files.d.ts +0 -19
  83. package/lib/permission-temporary-files.js +0 -248
  84. package/lib/permission-temporary-grants.d.ts +0 -106
  85. package/lib/permission-temporary-grants.js +0 -198
  86. package/lib/permission-temporary-install.d.ts +0 -25
  87. package/lib/permission-temporary-install.js +0 -86
  88. package/lib/permission-temporary-remote.d.ts +0 -19
  89. package/lib/permission-temporary-remote.js +0 -75
  90. package/lib/permission-temporary-rpc.d.ts +0 -37
  91. package/lib/permission-temporary-rpc.js +0 -154
  92. package/lib/permission-temporary-types.d.ts +0 -47
  93. package/lib/permission-temporary-types.js +0 -2
  94. package/lib/permission-temporary-web.d.ts +0 -11
  95. package/lib/permission-temporary-web.js +0 -154
  96. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-gateway@0.2.1-rc.2.patch +0 -13291
  97. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-remotes@0.2.1-rc.2.patch +0 -9133
  98. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-client-ui-approval@0.2.1-rc.2.patch +0 -156
  99. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-subagent@0.2.1-rc.2.patch +0 -3546
  100. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-user-approval@0.2.1-rc.2.patch +0 -431
  101. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-web@0.2.1-rc.2.patch +0 -119
  102. package/patches/dsh-approval-settlement/README.md +0 -41
  103. package/patches/dsh-approval-settlement/metadata.json +0 -10
  104. package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-loop@0.2.1-rc.2.patch +0 -383
  105. package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-preset-registry@0.2.1-rc.2.patch +0 -55
  106. package/patches/dsh-session-activation/@deepseek-ai__dsh-api-session-controller@0.2.1-rc.2.patch +0 -16673
  107. package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-subagent@0.2.1-rc.2.patch +0 -29
  108. package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-workspace@0.2.1-rc.2.patch +0 -196
  109. package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence-jsonl@0.2.1-rc.2.patch +0 -35
  110. package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence@0.2.1-rc.2.patch +0 -40
@@ -1,43 +0,0 @@
1
- import type { Context } from "@deepseek-ai/cordis";
2
- import type { PropsLocale, PropsRenderSlots } from "@deepseek-ai/dsh-client-ui-slots";
3
- import type { ConnectionHandle } from "@deepseek-ai/dsh-client-connection/client";
4
- import type { ISessions } from "@deepseek-ai/dsh-api-session-controller/client";
5
- import type { UiSession } from "@deepseek-ai/dsh-client-ui-session/client";
6
- import type { RoleControlChildView } from "../role-control-types.js";
7
- import { PERMISSIONS_NS } from "./permission-locales.js";
8
- interface Owner {
9
- parentSessionId: string;
10
- child: RoleControlChildView;
11
- }
12
- interface Services {
13
- sessions: ISessions;
14
- uiSession: UiSession;
15
- connection: ConnectionHandle;
16
- }
17
- type Locale = PropsLocale<typeof PERMISSIONS_NS>;
18
- type Composer = PropsRenderSlots<"conversation.composer">;
19
- /** Direct-child card action. Retention is Client-only; it never keeps the Host child alive. */
20
- export declare function ChildPermissions(props: Owner & Services & Composer & Locale): import("react").JSX.Element | null;
21
- export declare const CHILD_PERMISSION_SLOTS: {
22
- readonly "conversation.dsmm-child-permissions": {
23
- readonly kind: "list";
24
- readonly scope: "root";
25
- };
26
- };
27
- export declare function registerChildPermissionEntry(ctx: Context): void;
28
- declare module "@deepseek-ai/dsh-client-ui-slots" {
29
- interface SlotMap {
30
- "conversation.dsmm-child-permissions": {
31
- kind: "list";
32
- scope: "root";
33
- owner: Owner;
34
- };
35
- }
36
- }
37
- declare module "@deepseek-ai/dsh-api-session-controller/client" {
38
- interface SessionReferenceSourceMap {
39
- dsmmChildPermissions: unknown;
40
- }
41
- }
42
- export {};
43
- //# sourceMappingURL=ChildPermissions.d.ts.map
@@ -1,100 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from "react";
3
- import { Button } from "@deepseek-ai/dsh-client-ui-primitives";
4
- import { temporaryPermissionClient } from "./temporary-permission-client.js";
5
- import { TemporaryGrants } from "./TemporaryPermissions.js";
6
- import { PERMISSIONS_NS } from "./permission-locales.js";
7
- function NativeChildApproval(props) {
8
- const { active, uiSession, SessionProvider } = props;
9
- const session = useSyncExternalStore(listener => active.binding.session.subscribe(listener), () => active.binding.session.getSnapshot());
10
- const statuses = useSyncExternalStore(listener => uiSession.sessionStatus.subscribe(listener), () => uiSession.sessionStatus.getSnapshot());
11
- if (!props.current())
12
- return _jsx("p", { className: "dsmm-hint", children: props.t("childUnavailable") });
13
- return _jsx(SessionProvider, { session: active.reference, children: props.renderSlotChain("conversation.composer", {
14
- sessionId: active.binding.sessionId, session, pendingInteraction: statuses.get(active.binding.sessionId)?.pendingInteraction,
15
- }, { fallback: _jsx("p", { className: "dsmm-hint", children: props.t("childNoPending") }) }) });
16
- }
17
- /** Direct-child card action. Retention is Client-only; it never keeps the Host child alive. */
18
- export function ChildPermissions(props) {
19
- const id = useId(), trigger = useRef(null), heading = useRef(null);
20
- const generation = useSyncExternalStore(listener => props.connection.generation.subscribe(listener), () => props.connection.generation.getSnapshot());
21
- useSyncExternalStore(listener => props.sessions.list.subscribe(listener), () => props.sessions.list.getSnapshot());
22
- const identity = useMemo(() => ({}), [props.parentSessionId, props.child.id, props.sessions, props.uiSession, props.connection, generation]);
23
- const latest = useRef(identity);
24
- latest.current = identity;
25
- const [open, setOpen] = useState(false), [refresh, setRefresh] = useState(0), [active, setActive] = useState();
26
- const [view, setView] = useState(), [busy, setBusy] = useState(false), [error, setError] = useState(false);
27
- const current = () => !!active && active.identity === identity && latest.current === identity && !active.signal.aborted
28
- && props.connection.generation.getSnapshot() === generation && props.sessions.binding(active.binding.sessionId) === active.binding
29
- && active.binding.session.getSnapshot().openState === "open" && !active.binding.session.getSnapshot().removed;
30
- useEffect(() => {
31
- setActive(undefined);
32
- setView(undefined);
33
- setBusy(false);
34
- setError(false);
35
- if (!open || generation === undefined)
36
- return;
37
- const abort = new AbortController();
38
- const reference = props.sessions.retain({ parentSessionId: props.parentSessionId,
39
- childSessionId: props.child.id, mode: "continuable" }, { source: "dsmmChildPermissions", signal: abort.signal });
40
- const remote = temporaryPermissionClient(props.connection, abort.signal);
41
- void reference.ready.then(async (binding) => {
42
- if (abort.signal.aborted || latest.current !== identity)
43
- return;
44
- if (props.sessions.scopeOf(binding.ctx) !== props.child.id || props.sessions.binding(binding.sessionId) !== binding)
45
- throw new Error("Native child scope changed.");
46
- setActive({ identity, reference, binding, remote, signal: abort.signal });
47
- const value = await remote.child(props.parentSessionId, props.child.id);
48
- if (!abort.signal.aborted && latest.current === identity && props.sessions.binding(binding.sessionId) === binding)
49
- setView(value);
50
- }).catch(() => { if (!abort.signal.aborted && latest.current === identity)
51
- setError(true); });
52
- return () => { abort.abort(); reference.release(); };
53
- }, [identity, open, refresh]);
54
- useEffect(() => { if (open)
55
- heading.current?.focus(); }, [open]);
56
- if (props.child.mode !== "continuable" || props.child.parentSessionId !== props.parentSessionId)
57
- return null;
58
- const available = current() && !busy && view?.parentSessionId === props.parentSessionId && view.childSessionId === props.child.id;
59
- async function change(operation) {
60
- if (!available || !active)
61
- return;
62
- const captured = active;
63
- setBusy(true);
64
- setError(false);
65
- try {
66
- const value = await captured.remote[operation](props.parentSessionId, props.child.id);
67
- if (latest.current === identity && !captured.signal.aborted)
68
- setView(value);
69
- }
70
- catch {
71
- if (latest.current === identity && !captured.signal.aborted) {
72
- setView(undefined);
73
- setError(true);
74
- }
75
- }
76
- finally {
77
- if (latest.current === identity && !captured.signal.aborted)
78
- setBusy(false);
79
- }
80
- }
81
- return _jsxs("div", { className: "dsmm-child-permissions", children: [_jsx(Button, { ref: trigger, type: "button", variant: "outline", "aria-expanded": open, "aria-controls": id, onClick: () => {
82
- if (open) {
83
- setOpen(false);
84
- trigger.current?.focus();
85
- }
86
- else
87
- setOpen(true);
88
- }, children: props.t("childPermissions") }), open && _jsxs("section", { id: id, className: "dsmm-zone", "aria-labelledby": `${id}-heading`, "aria-busy": busy, children: [_jsx("h3", { id: `${id}-heading`, ref: heading, tabIndex: -1, children: props.child.label ?? props.child.id }), _jsx("p", { children: props.child.id }), _jsx("p", { className: "dsmm-hint", children: props.t("childPermissionBoundary") }), view && _jsxs(_Fragment, { children: [_jsxs("p", { children: [props.t("childProject"), ": ", view.project] }), _jsxs("p", { children: [props.t("childRole"), ": ", view.role ?? props.t("unknown"), view.readOnly ? ` · ${props.t("childReadOnly")}` : ""] }), _jsx("p", { role: "status", "aria-live": "polite", children: props.t(view.state === "enabled" ? "childEnabled" : view.state === "disabled" ? "childDisabled" : "childUnavailable") })] }), (!current() || !view) && !error && _jsx("p", { role: "status", children: props.t(generation === undefined ? "childUnavailable" : "reading") }), error && _jsx("p", { className: "dsmm-issue", role: "alert", children: props.t("childUnconfirmed") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: !available || !view?.canEnable || view.state === "enabled", onClick: () => void change("enableChild"), children: props.t("childEnable") }), _jsx(Button, { type: "button", variant: "outline", disabled: !available || !view?.canRevoke, onClick: () => void change("revokeChild"), children: props.t("childRevoke") }), _jsx(Button, { type: "button", variant: "outline", disabled: busy || generation === undefined, onClick: () => setRefresh(value => value + 1), children: props.t("temporaryRefresh") })] }), active?.identity === identity && current() && _jsxs(_Fragment, { children: [_jsx(NativeChildApproval, { ...props, active: active, current: current }), view?.state === "enabled" && _jsx(TemporaryGrants, { sessionId: props.child.id, remote: active.remote, t: props.t, child: true })] })] })] });
89
- }
90
- export const CHILD_PERMISSION_SLOTS = { "conversation.dsmm-child-permissions": { kind: "list", scope: "root" } };
91
- export function registerChildPermissionEntry(ctx) {
92
- void ctx.inject(["sessions", "uiSession", "connection"], scope => {
93
- scope.slots.inject("conversation.dsmm-child-permissions", () => scope.slots.register({
94
- name: "conversation.dsmm-child-permissions", id: "dsmm-child-permissions", locale: PERMISSIONS_NS,
95
- children: { "conversation.composer": { kind: "chain", scope: "session" } },
96
- inject: () => ({ sessions: scope.sessions, uiSession: scope.uiSession, connection: scope.connection }),
97
- }, ChildPermissions));
98
- });
99
- }
100
- //# sourceMappingURL=ChildPermissions.js.map
@@ -1,7 +0,0 @@
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
@@ -1,22 +0,0 @@
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
@@ -1,8 +0,0 @@
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
@@ -1,11 +0,0 @@
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,21 +0,0 @@
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
@@ -1,94 +0,0 @@
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
@@ -1,29 +0,0 @@
1
- import type { DsmmHistoryRemote } from "../history-remote.js";
2
- import type { HistoryChoices, HistoryFailure, HistoryPreview, HistoryStatus } from "../history-types.js";
3
- export interface HistoryClientSnapshot {
4
- sessionId: string | null;
5
- phase: "disconnected" | "loading" | "ready" | "previewing" | "confirming" | "unknown";
6
- status: HistoryStatus | null;
7
- choices: HistoryChoices | null;
8
- preview: HistoryPreview | null;
9
- issue: HistoryFailure | null;
10
- }
11
- /** Connection/session generation fences for continuation only; native history and composer stay authoritative. */
12
- export declare class HistoryContinuationController {
13
- private scope;
14
- private state;
15
- private request;
16
- private disposed;
17
- private readonly listeners;
18
- readonly getSnapshot: () => HistoryClientSnapshot;
19
- readonly subscribe: (listener: () => void) => (() => void);
20
- private publish;
21
- bind(remote: DsmmHistoryRemote | undefined, connection: object | undefined, sessionId: string | null, owner?: object): void;
22
- /** Observed compatibility only, never a pre-follow navigation or write-admission guard. */
23
- get historyBrowsingAllowed(): boolean;
24
- dispose(): void;
25
- refresh(expected: HistoryClientSnapshot): Promise<void>;
26
- preview(expected: HistoryClientSnapshot, preset: string, profileId: string | null): Promise<void>;
27
- confirm(expected: HistoryClientSnapshot, processPending: boolean, acceptMigration: boolean): Promise<void>;
28
- }
29
- //# sourceMappingURL=history-controller.d.ts.map
@@ -1,111 +0,0 @@
1
- import { parseHistoryChoices, parseHistoryFailure, parseHistoryPreview, parseHistoryResult, parseHistoryStatus } from "../history-codec.js";
2
- function initial(sessionId = null) { return { sessionId, phase: sessionId === null ? "disconnected" : "loading", status: null, choices: null, preview: null, issue: null }; }
3
- function value(result, parse) { if (result.ok)
4
- return parse(result.value); throw result.error; }
5
- function failure(error, confirming = false) {
6
- if (error && typeof error === "object" && Reflect.get(error, "code") === "dsmm-history/refused") {
7
- try {
8
- return parseHistoryFailure(Reflect.get(error, "details"));
9
- }
10
- catch { /* Unknown wire errors cannot authorize a retry. */ }
11
- }
12
- return { code: "unavailable", storageEffects: confirming ? "may-have-committed" : "none" };
13
- }
14
- /** Connection/session generation fences for continuation only; native history and composer stay authoritative. */
15
- export class HistoryContinuationController {
16
- scope;
17
- state = initial();
18
- request;
19
- disposed = false;
20
- listeners = new Set();
21
- getSnapshot = () => this.state;
22
- subscribe = (listener) => { this.listeners.add(listener); return () => this.listeners.delete(listener); };
23
- publish(next) { this.state = next; for (const listener of this.listeners)
24
- listener(); }
25
- bind(remote, connection, sessionId, owner) {
26
- if (this.disposed)
27
- return;
28
- if (this.scope?.remote === remote && this.scope?.connection === connection && this.scope?.sessionId === sessionId && this.scope?.owner === owner)
29
- return;
30
- if (!this.scope && (!remote || !connection || !sessionId) && this.state.sessionId === sessionId && this.state.phase === "disconnected")
31
- return;
32
- this.scope = remote && connection && sessionId ? { remote, connection, sessionId, owner } : undefined;
33
- const scope = this.scope;
34
- this.request = undefined;
35
- this.publish({ ...initial(sessionId), phase: this.scope ? "loading" : "disconnected" });
36
- if (scope && this.scope === scope)
37
- void this.refresh(this.state);
38
- }
39
- /** Observed compatibility only, never a pre-follow navigation or write-admission guard. */
40
- get historyBrowsingAllowed() { return this.state.status?.compatibleHost === true; }
41
- dispose() { this.scope = undefined; this.request = undefined; this.disposed = true; this.listeners.clear(); }
42
- async refresh(expected) {
43
- const scope = this.scope;
44
- if (!scope || this.state !== expected || this.state.phase === "confirming")
45
- return;
46
- const request = this.request = {};
47
- this.publish({ ...this.state, phase: "loading", preview: null, issue: null });
48
- if (this.scope !== scope || this.request !== request)
49
- return;
50
- try {
51
- const status = value(await scope.remote.describe(scope.sessionId), parseHistoryStatus);
52
- if (this.scope !== scope || this.request !== request)
53
- return;
54
- if (status.sessionId !== scope.sessionId)
55
- throw new TypeError("Mismatched history response");
56
- const choices = status.execution === "authorization-required" ? value(await scope.remote.choices(), parseHistoryChoices) : null;
57
- if (this.scope !== scope || this.request !== request)
58
- return;
59
- this.publish({ sessionId: scope.sessionId, phase: "ready", status, choices, preview: null, issue: null });
60
- }
61
- catch (error) {
62
- if (this.scope === scope && this.request === request)
63
- this.publish({ ...this.state, phase: "ready", issue: failure(error), preview: null });
64
- }
65
- }
66
- async preview(expected, preset, profileId) {
67
- const scope = this.scope;
68
- if (!scope || this.state !== expected || expected.phase !== "ready" || expected.status?.execution !== "authorization-required" || !expected.status.compatibleHost)
69
- return;
70
- const request = this.request = {};
71
- this.publish({ ...this.state, phase: "previewing", preview: null, issue: null });
72
- if (this.scope !== scope || this.request !== request)
73
- return;
74
- try {
75
- const preview = value(await scope.remote.preview(scope.sessionId, { sessionId: scope.sessionId, preset, profileId }), parseHistoryPreview);
76
- if (this.scope !== scope || this.request !== request)
77
- return;
78
- if (preview.sessionId !== scope.sessionId || preview.candidate.preset.id !== preset || (preview.candidate.profile?.id ?? null) !== profileId)
79
- throw new TypeError("Mismatched continuation proposal");
80
- this.publish({ ...this.state, phase: "ready", preview });
81
- }
82
- catch (error) {
83
- if (this.scope === scope && this.request === request)
84
- this.publish({ ...this.state, phase: "ready", issue: failure(error), preview: null });
85
- }
86
- }
87
- async confirm(expected, processPending, acceptMigration) {
88
- const scope = this.scope, preview = expected.preview;
89
- if (!scope || this.state !== expected || expected.phase !== "ready" || !preview || !processPending || preview.migrationRequired && !acceptMigration)
90
- return;
91
- const request = this.request = {};
92
- this.publish({ ...this.state, phase: "confirming", issue: null });
93
- if (this.scope !== scope || this.request !== request)
94
- return;
95
- try {
96
- const receipt = value(await scope.remote.confirm(scope.sessionId, { sessionId: scope.sessionId, intentId: preview.intentId, processPending, acceptMigration }), parseHistoryResult);
97
- if (this.scope !== scope || this.request !== request)
98
- return;
99
- if (receipt.sessionId !== scope.sessionId)
100
- throw new TypeError("Mismatched continuation receipt");
101
- this.publish({ ...this.state, phase: "ready", preview: null, status: { sessionId: scope.sessionId, readable: "readable", compatibleHost: true, execution: "active" } });
102
- }
103
- catch (error) {
104
- if (this.scope !== scope || this.request !== request)
105
- return;
106
- const issue = failure(error, true);
107
- this.publish({ ...this.state, phase: issue.storageEffects === "may-have-committed" ? "unknown" : "ready", preview: null, issue });
108
- }
109
- }
110
- }
111
- //# sourceMappingURL=history-controller.js.map
@@ -1,11 +0,0 @@
1
- import type { Context } from "@deepseek-ai/cordis";
2
- import type { LocaleRuntime } from "@deepseek-ai/dsh-client-locale/client";
3
- import { HistoryContinuationController } from "./history-controller.js";
4
- export declare function HistoryContinuationEntry({ controller, locale, sessionId }: {
5
- controller: HistoryContinuationController;
6
- locale: LocaleRuntime;
7
- sessionId: string;
8
- }): import("react").JSX.Element | null;
9
- /** Read-only native binding observer; Host admission owns all history activation. */
10
- export declare function registerHistoryContinuation(ctx: Context): void;
11
- //# sourceMappingURL=history-entry.d.ts.map
@@ -1,106 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useSyncExternalStore } from "react";
3
- import { HistoryContinuation } from "./HistoryContinuation.js";
4
- import { HistoryContinuationController } from "./history-controller.js";
5
- import { historyLocales } from "./history-locales.js";
6
- export function HistoryContinuationEntry({ controller, locale, sessionId }) {
7
- const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
8
- const language = useSyncExternalStore(listener => locale.subscribe(listener), () => locale.getSnapshot());
9
- if (state.sessionId !== sessionId || state.status?.execution === "active" || state.phase === "loading" && state.status === null && state.issue === null)
10
- return null;
11
- return _jsx(HistoryContinuation, { controller: controller, locale: language.active === "zh" ? "zh" : "en" });
12
- }
13
- /** Read-only native binding observer; Host admission owns all history activation. */
14
- export function registerHistoryContinuation(ctx) {
15
- void ctx.inject(["remote.dsmmHistory"], historyCtx => {
16
- const controller = new HistoryContinuationController(), remote = historyCtx.remote.dsmmHistory;
17
- let disposed = false;
18
- let connection, selected;
19
- let blocks;
20
- let held;
21
- let watched, stopBlock;
22
- const release = () => {
23
- const owned = held;
24
- held = undefined;
25
- if (owned && blocks?.storeFor(owned.id) === owned.store && owned.store.getSnapshot() === owned.block)
26
- blocks.set(owned.id, undefined);
27
- };
28
- const syncBlock = () => {
29
- const state = controller.getSnapshot(), id = state.sessionId;
30
- if (disposed || id === null || state.status?.execution === "active") {
31
- stopBlock?.();
32
- stopBlock = undefined;
33
- watched = undefined;
34
- release();
35
- return;
36
- }
37
- if (held && held.id !== id)
38
- release();
39
- const text = historyLocales[historyCtx.locale.getLocale().active === "zh" ? "zh" : "en"];
40
- const reason = state.phase === "disconnected" ? text.disconnected : state.phase === "unknown" ? text.unknown
41
- : state.phase === "confirming" || state.status?.execution === "activating" ? text.confirming : text.reasons[state.issue?.code ?? (state.status?.compatibleHost === false ? "unsupported-host" : state.status?.reason) ?? "authorization-required"];
42
- const store = blocks?.storeFor(id);
43
- if (watched !== store) {
44
- stopBlock?.();
45
- watched = store;
46
- stopBlock = store?.subscribe(syncBlock);
47
- }
48
- if (held && (held.store !== store || held.store.getSnapshot() !== held.block))
49
- held = undefined;
50
- if (held && (held.id !== id || held.block.reason !== reason))
51
- release();
52
- if (!blocks || !store || held)
53
- return;
54
- if (store.getSnapshot() !== undefined)
55
- return;
56
- const block = { reason };
57
- held = { id, store, block };
58
- blocks.set(id, block);
59
- };
60
- const update = () => {
61
- if (disposed)
62
- return;
63
- const state = selected?.session.getSnapshot();
64
- const id = selected && state?.sessionId === selected.sessionId && !state.removed ? selected.sessionId : null;
65
- controller.bind(remote, connection?.generation.getSnapshot(), id, selected);
66
- syncBlock();
67
- };
68
- historyCtx.effect(() => controller.subscribe(syncBlock));
69
- historyCtx.effect(() => historyCtx.locale.subscribe(syncBlock));
70
- historyCtx.effect(() => () => { disposed = true; stopBlock?.(); release(); controller.dispose(); }, "dsmm: history continuation owner");
71
- historyCtx.slots.inject("conversation.input.dock", () => historyCtx.slots.register({
72
- name: "conversation.input.dock", id: "dsmm-history-continuation", order: 10, inject: () => ({ controller, locale: historyCtx.locale }),
73
- }, HistoryContinuationEntry));
74
- void historyCtx.inject(["conversation"], conversationCtx => {
75
- blocks = conversationCtx.conversation.blocks;
76
- syncBlock();
77
- conversationCtx.effect(() => () => { stopBlock?.(); stopBlock = undefined; watched = undefined; release(); blocks = undefined; }, "dsmm: history composer lifetime");
78
- });
79
- void historyCtx.inject(["connection"], connectionCtx => {
80
- connection = connectionCtx.connection;
81
- update();
82
- connectionCtx.effect(() => connection.generation.subscribe(update));
83
- connectionCtx.effect(() => () => { connection = undefined; update(); }, "dsmm: history connection lifetime");
84
- });
85
- void historyCtx.inject(["uiSession", "sessions"], sessionCtx => {
86
- const source = sessionCtx.uiSession.adapter.current, sessions = sessionCtx.sessions;
87
- let stop;
88
- const observe = () => {
89
- const id = source.getSnapshot().key;
90
- const candidate = id === undefined ? undefined : sessions.binding(id);
91
- const binding = candidate?.sessionId === id ? candidate : undefined;
92
- if (binding !== selected) {
93
- stop?.();
94
- selected = binding;
95
- stop = binding?.session.subscribe(update);
96
- }
97
- update();
98
- };
99
- observe();
100
- sessionCtx.effect(() => source.subscribe(observe));
101
- sessionCtx.effect(() => sessions.list.subscribe(observe));
102
- sessionCtx.effect(() => () => { stop?.(); selected = undefined; update(); }, "dsmm: history native scope lifetime");
103
- });
104
- });
105
- }
106
- //# sourceMappingURL=history-entry.js.map