@dsmm/dsmm 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/README.md +26 -40
  2. package/cordis.patch.yml +9 -13
  3. package/docs/agent-presets.md +26 -14
  4. package/docs/compatibility.md +24 -68
  5. package/docs/deferred-native-approval-risk.md +8 -12
  6. package/docs/design.md +25 -254
  7. package/docs/lsp.md +2 -2
  8. package/docs/migration-from-ocmm.md +38 -51
  9. package/docs/model-routing.md +21 -21
  10. package/docs/native-permissions.md +17 -7
  11. package/docs/profiles.md +13 -9
  12. package/docs/releasing.md +25 -311
  13. package/docs/roadmap.md +52 -241
  14. package/docs/runtime-recovery.md +29 -91
  15. package/docs/safety-guards.md +19 -16
  16. package/docs/settings-status.md +23 -11
  17. package/docs/skill-sync.md +17 -17
  18. package/docs/web-fetch-fakeip.md +82 -0
  19. package/lib/child-capture.d.ts +12 -2
  20. package/lib/child-capture.js +22 -5
  21. package/lib/client/ChildPermissions.d.ts +43 -0
  22. package/lib/client/ChildPermissions.js +100 -0
  23. package/lib/client/ChildrenPanel.d.ts +5 -5
  24. package/lib/client/ChildrenPanel.js +6 -18
  25. package/lib/client/DeploymentFields.d.ts +32 -0
  26. package/lib/client/DeploymentFields.js +70 -0
  27. package/lib/client/DeploymentPage.d.ts +21 -6
  28. package/lib/client/DeploymentPage.js +80 -112
  29. package/lib/client/HistoryContinuation.d.ts +7 -0
  30. package/lib/client/HistoryContinuation.js +22 -0
  31. package/lib/client/NativeCommandEntries.d.ts +17 -0
  32. package/lib/client/NativeCommandEntries.js +68 -0
  33. package/lib/client/PermissionPanelEntry.d.ts +8 -0
  34. package/lib/client/PermissionPanelEntry.js +11 -0
  35. package/lib/client/PermissionsPanel.d.ts +3 -1
  36. package/lib/client/PermissionsPanel.js +10 -9
  37. package/lib/client/ProfilesSection.js +8 -6
  38. package/lib/client/RoleAvailability.js +1 -1
  39. package/lib/client/RoleToolView-data.d.ts +35 -0
  40. package/lib/client/RoleToolView-data.js +52 -0
  41. package/lib/client/RoleToolView-locales.d.ts +36 -0
  42. package/lib/client/RoleToolView-locales.js +20 -0
  43. package/lib/client/RoleToolView.d.ts +10 -0
  44. package/lib/client/RoleToolView.js +47 -0
  45. package/lib/client/SessionProfiles.js +51 -24
  46. package/lib/client/TemporaryPermissions.d.ts +21 -0
  47. package/lib/client/TemporaryPermissions.js +94 -0
  48. package/lib/client/children-controller.d.ts +2 -8
  49. package/lib/client/children-controller.js +1 -26
  50. package/lib/client/children-locales.d.ts +27 -52
  51. package/lib/client/children-locales.js +8 -12
  52. package/lib/client/configuration-display.d.ts +5 -0
  53. package/lib/client/configuration-display.js +11 -0
  54. package/lib/client/controller.d.ts +18 -0
  55. package/lib/client/controller.js +118 -28
  56. package/lib/client/deployment-controller.d.ts +13 -1
  57. package/lib/client/deployment-controller.js +84 -24
  58. package/lib/client/deployment-data.d.ts +1 -0
  59. package/lib/client/deployment-data.js +4 -1
  60. package/lib/client/deployment-locales.d.ts +43 -0
  61. package/lib/client/deployment-locales.js +45 -19
  62. package/lib/client/deployment-modules.d.ts +9 -0
  63. package/lib/client/deployment-modules.js +24 -0
  64. package/lib/client/deployment-workspace.d.ts +48 -0
  65. package/lib/client/deployment-workspace.js +123 -0
  66. package/lib/client/history-controller.d.ts +29 -0
  67. package/lib/client/history-controller.js +111 -0
  68. package/lib/client/history-entry.d.ts +11 -0
  69. package/lib/client/history-entry.js +106 -0
  70. package/lib/client/history-locales.d.ts +95 -0
  71. package/lib/client/history-locales.js +41 -0
  72. package/lib/client/index.js +26 -76
  73. package/lib/client/locales.d.ts +13 -0
  74. package/lib/client/locales.js +104 -86
  75. package/lib/client/permission-controller.d.ts +1 -0
  76. package/lib/client/permission-controller.js +3 -2
  77. package/lib/client/permission-locales.d.ts +51 -0
  78. package/lib/client/permission-locales.js +59 -19
  79. package/lib/client/session-labels.js +4 -3
  80. package/lib/client/styles.d.ts +1 -1
  81. package/lib/client/styles.js +9 -8
  82. package/lib/client/temporary-permission-client.d.ts +20 -0
  83. package/lib/client/temporary-permission-client.js +52 -0
  84. package/lib/client/temporary-permission-entry.d.ts +6 -0
  85. package/lib/client/temporary-permission-entry.js +56 -0
  86. package/lib/client.js +5691 -3439
  87. package/lib/commands.js +2 -0
  88. package/lib/config-file-store.d.ts +3 -0
  89. package/lib/config-file-store.js +4 -2
  90. package/lib/config-revision.d.ts +5 -0
  91. package/lib/config-revision.js +11 -0
  92. package/lib/core-permission-authority.js +11 -41
  93. package/lib/deployment-config.d.ts +9 -2
  94. package/lib/deployment-config.js +35 -8
  95. package/lib/deployment-permission-rules.js +19 -7
  96. package/lib/dsh-types.d.ts +1 -1
  97. package/lib/history-candidates.d.ts +30 -0
  98. package/lib/history-candidates.js +176 -0
  99. package/lib/history-codec.d.ts +11 -0
  100. package/lib/history-codec.js +102 -0
  101. package/lib/history-contract.d.ts +44 -0
  102. package/lib/history-contract.js +2 -0
  103. package/lib/history-controller.d.ts +42 -0
  104. package/lib/history-controller.js +329 -0
  105. package/lib/history-policy.d.ts +4 -0
  106. package/lib/history-policy.js +8 -0
  107. package/lib/history-remote.d.ts +28 -0
  108. package/lib/history-remote.js +17 -0
  109. package/lib/history-rpc.d.ts +24 -0
  110. package/lib/history-rpc.js +136 -0
  111. package/lib/history-support.d.ts +15 -0
  112. package/lib/history-support.js +21 -0
  113. package/lib/history-types.d.ts +67 -0
  114. package/lib/history-types.js +2 -0
  115. package/lib/host-llm-startup.js +3 -3
  116. package/lib/host-llm.d.ts +9 -3
  117. package/lib/host-llm.js +48 -8
  118. package/lib/index.d.ts +18 -20
  119. package/lib/index.js +147 -415
  120. package/lib/lifetime.d.ts +4 -0
  121. package/lib/lifetime.js +22 -0
  122. package/lib/live-pi-ai-owner.d.ts +1 -0
  123. package/lib/live-pi-ai-owner.js +8 -4
  124. package/lib/mode.d.ts +3 -2
  125. package/lib/mode.js +28 -41
  126. package/lib/model-routing.d.ts +2 -8
  127. package/lib/model-routing.js +59 -175
  128. package/lib/native-admission.d.ts +77 -0
  129. package/lib/native-admission.js +503 -0
  130. package/lib/native-pi-ai-wire.d.ts +3 -1
  131. package/lib/native-pi-ai-wire.js +47 -13
  132. package/lib/permission-child-control.d.ts +36 -0
  133. package/lib/permission-child-control.js +164 -0
  134. package/lib/permission-control.d.ts +2 -3
  135. package/lib/permission-control.js +7 -0
  136. package/lib/permission-controller.js +2 -2
  137. package/lib/permission-exec-argv.d.ts +32 -0
  138. package/lib/permission-exec-argv.js +171 -0
  139. package/lib/permission-fs-search.js +2 -1
  140. package/lib/permission-fs.js +2 -1
  141. package/lib/permission-native-rules.js +3 -3
  142. package/lib/permission-temporary-files.d.ts +19 -0
  143. package/lib/permission-temporary-files.js +248 -0
  144. package/lib/permission-temporary-grants.d.ts +106 -0
  145. package/lib/permission-temporary-grants.js +198 -0
  146. package/lib/permission-temporary-install.d.ts +25 -0
  147. package/lib/permission-temporary-install.js +86 -0
  148. package/lib/permission-temporary-remote.d.ts +19 -0
  149. package/lib/permission-temporary-remote.js +75 -0
  150. package/lib/permission-temporary-rpc.d.ts +37 -0
  151. package/lib/permission-temporary-rpc.js +154 -0
  152. package/lib/permission-temporary-types.d.ts +47 -0
  153. package/lib/permission-temporary-types.js +2 -0
  154. package/lib/permission-temporary-web.d.ts +11 -0
  155. package/lib/permission-temporary-web.js +154 -0
  156. package/lib/permission-web.js +2 -1
  157. package/lib/preset-registry.js +3 -2
  158. package/lib/preset-skills.d.ts +3 -12
  159. package/lib/preset-skills.js +28 -58
  160. package/lib/profile-diagnostics.d.ts +1 -1
  161. package/lib/profile-diagnostics.js +2 -2
  162. package/lib/profile-remote.js +61 -22
  163. package/lib/profile-rpc.d.ts +4 -3
  164. package/lib/profile-rpc.js +35 -37
  165. package/lib/profile-runtime.d.ts +42 -74
  166. package/lib/profile-runtime.js +314 -617
  167. package/lib/profile-store.d.ts +20 -8
  168. package/lib/profile-store.js +112 -63
  169. package/lib/profile-types.d.ts +19 -4
  170. package/lib/profiles.d.ts +3 -1
  171. package/lib/profiles.js +9 -7
  172. package/lib/prompt-content.d.ts +1 -0
  173. package/lib/prompt-content.js +4 -1
  174. package/lib/prompts.d.ts +2 -12
  175. package/lib/prompts.js +11 -66
  176. package/lib/role-control-remote.d.ts +1 -4
  177. package/lib/role-control-remote.js +8 -36
  178. package/lib/role-control-rpc.d.ts +10 -36
  179. package/lib/role-control-rpc.js +112 -269
  180. package/lib/role-control-types.d.ts +3 -26
  181. package/lib/role-control-types.js +3 -4
  182. package/lib/role-identity.d.ts +5 -0
  183. package/lib/role-identity.js +10 -0
  184. package/lib/role-invocation.d.ts +3 -3
  185. package/lib/role-invocation.js +2 -2
  186. package/lib/role-llm-runtime.js +5 -11
  187. package/lib/role-policy.d.ts +19 -50
  188. package/lib/role-policy.js +136 -508
  189. package/lib/role-providers.d.ts +5 -8
  190. package/lib/role-providers.js +20 -86
  191. package/lib/role-routing.d.ts +1 -3
  192. package/lib/role-routing.js +24 -34
  193. package/lib/role-subagents.d.ts +5 -14
  194. package/lib/role-subagents.js +163 -108
  195. package/lib/runtime-integration.d.ts +5 -78
  196. package/lib/runtime-integration.js +11 -697
  197. package/lib/session-metadata.d.ts +13 -12
  198. package/lib/session-metadata.js +6 -31
  199. package/lib/session-scope.js +2 -1
  200. package/lib/settings.d.ts +5 -18
  201. package/lib/settings.js +19 -43
  202. package/lib/skills.d.ts +1 -0
  203. package/lib/skills.js +5 -1
  204. package/lib/state.d.ts +3 -2
  205. package/lib/state.js +26 -10
  206. package/lib/status.d.ts +1 -9
  207. package/lib/status.js +3 -55
  208. package/lib/web-fetch-address-policy.d.ts +24 -0
  209. package/lib/web-fetch-address-policy.js +189 -0
  210. package/lib/web-fetch-fakeip.d.ts +25 -0
  211. package/lib/web-fetch-fakeip.js +107 -0
  212. package/package.json +124 -106
  213. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-gateway@0.2.1-rc.2.patch +13291 -0
  214. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-api-remotes@0.2.1-rc.2.patch +9133 -0
  215. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-client-ui-approval@0.2.1-rc.2.patch +156 -0
  216. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-subagent@0.2.1-rc.2.patch +3546 -0
  217. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-user-approval@0.2.1-rc.2.patch +431 -0
  218. package/patches/dsh-approval-settlement/@deepseek-ai__dsh-web@0.2.1-rc.2.patch +119 -0
  219. package/patches/dsh-approval-settlement/README.md +41 -0
  220. package/patches/dsh-approval-settlement/metadata.json +10 -0
  221. package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-loop@0.2.1-rc.2.patch +383 -0
  222. package/patches/dsh-session-activation/@deepseek-ai__dsh-agent-preset-registry@0.2.1-rc.2.patch +55 -0
  223. package/patches/dsh-session-activation/@deepseek-ai__dsh-api-session-controller@0.2.1-rc.2.patch +16673 -0
  224. package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-subagent@0.2.1-rc.2.patch +29 -0
  225. package/patches/dsh-session-activation/@deepseek-ai__dsh-client-ui-workspace@0.2.1-rc.2.patch +196 -0
  226. package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence-jsonl@0.2.1-rc.2.patch +35 -0
  227. package/patches/dsh-session-activation/@deepseek-ai__dsh-session-persistence@0.2.1-rc.2.patch +40 -0
  228. package/docs/research/deepseek-v4-pro.md +0 -74
  229. package/docs/research/oh-dsh.md +0 -96
  230. package/lib/agent-registry.d.ts +0 -36
  231. package/lib/agent-registry.js +0 -75
  232. package/lib/child-admission.d.ts +0 -40
  233. package/lib/child-admission.js +0 -151
  234. package/lib/delivery-authority.d.ts +0 -83
  235. package/lib/delivery-authority.js +0 -397
  236. package/lib/native-child-evidence.d.ts +0 -40
  237. package/lib/native-child-evidence.js +0 -104
  238. package/lib/role-runs.d.ts +0 -138
  239. package/lib/role-runs.js +0 -335
  240. package/lib/session-persistence.d.ts +0 -36
  241. package/lib/session-persistence.js +0 -304
  242. package/lib/subagent-runtime.d.ts +0 -57
  243. package/lib/subagent-runtime.js +0 -257
  244. package/prompts/deepseek-flash.md +0 -11
  245. package/prompts/deepseek-v4-pro.md +0 -14
@@ -0,0 +1,100 @@
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,5 +1,6 @@
1
+ import type { ReactNode } from "react";
1
2
  import type { InjectFace, PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
2
- import type { ChildAdmissionEvidenceView, DsmmInvocationView, RoleControlAvailability, RoleControlChildView } from "../role-control-types.js";
3
+ import type { DsmmInvocationView, RoleControlAvailability, RoleControlChildView } from "../role-control-types.js";
3
4
  import type { DsmmRoleRouteComparison } from "../profile-types.js";
4
5
  import type { ChildrenActions, ChildrenController, ChildrenSnapshot } from "./children-controller.js";
5
6
  import type { ChildrenLocaleKey } from "./children-locales.js";
@@ -11,6 +12,7 @@ export type ChildrenInjected = ChildrenActions & {
11
12
  };
12
13
  export type ChildrenPanelProps = InjectFace<ChildrenInjected> & Locale & {
13
14
  sessionId?: string;
15
+ renderChildPermissions?: (child: RoleControlChildView) => ReactNode;
14
16
  };
15
17
  export declare function ControlAvailability({ value, label, t }: Locale & {
16
18
  value?: RoleControlAvailability;
@@ -23,19 +25,17 @@ export declare function InvocationDetails({ value, t, showComparison }: Locale &
23
25
  value?: DsmmInvocationView;
24
26
  showComparison?: boolean;
25
27
  }): import("react").JSX.Element;
26
- export declare function EvidenceDetails({ value, t }: Locale & {
27
- value?: ChildAdmissionEvidenceView;
28
- }): import("react").JSX.Element;
29
28
  export declare function ChildComposer({ child, state, actions, t }: Locale & {
30
29
  child: RoleControlChildView;
31
30
  state: ChildrenSnapshot;
32
31
  actions: ChildrenActions;
33
32
  }): import("react").JSX.Element;
34
- export declare function ChildDetails({ child, state, actions, t, inspection }: Locale & {
33
+ export declare function ChildDetails({ child, state, actions, t, inspection, renderChildPermissions }: Locale & {
35
34
  child: RoleControlChildView;
36
35
  state: ChildrenSnapshot;
37
36
  actions: ChildrenActions;
38
37
  inspection?: boolean;
38
+ renderChildPermissions?: ChildrenPanelProps["renderChildPermissions"];
39
39
  }): import("react").JSX.Element;
40
40
  /** Native session-scoped Conversation View, not a replacement composer or navigation shell. */
41
41
  export declare function ChildrenPanel(props: ChildrenPanelProps): import("react").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useId, useRef } from "react";
3
3
  import { Button } from "@deepseek-ai/dsh-client-ui-primitives";
4
- import { childActionKey, EMPTY_CHILD_DRAFT, enabled, runActionKey } from "./children-controller.js";
4
+ import { childActionKey, EMPTY_CHILD_DRAFT, enabled } from "./children-controller.js";
5
5
  export function ControlAvailability({ value, label, t }) {
6
6
  return _jsxs("div", { className: "dsmm-availability", children: [_jsxs("p", { children: [t(label), ": ", t(value?.enabled === true ? "enabled" : "disabled")] }), value?.enabled !== true && _jsx("p", { className: "dsmm-hint", children: t(`reason:${value?.reason ?? "unavailable"}`) })] });
7
7
  }
@@ -20,13 +20,6 @@ export function InvocationDetails({ value, t, showComparison = true }) {
20
20
  return _jsx("p", { className: "dsmm-hint", children: t("invocationUnavailable") });
21
21
  return _jsxs(_Fragment, { children: [showComparison && _jsx(RouteComparisonDetails, { value: value.routeComparison, t: t }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("role") }), _jsxs("dd", { children: [value.label, " \u00B7 ", value.role] }), _jsx("dt", { children: t("level") }), _jsx("dd", { children: value.level }), _jsx("dt", { children: t("mode") }), _jsx("dd", { children: value.mode }), _jsx("dt", { children: t("reportedRoute") }), _jsx("dd", { children: value.route === undefined ? t("routeUnreported") : routeText(value.route) }), _jsx("dt", { children: t("routeSource") }), _jsx("dd", { children: value.routeSource }), value.runId !== undefined && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("runId") }), _jsx("dd", { children: value.runId })] }), value.childId !== undefined && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("childId") }), _jsx("dd", { children: value.childId })] }), value.jobId !== undefined && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("jobId") }), _jsx("dd", { children: value.jobId })] })] })] });
22
22
  }
23
- export function EvidenceDetails({ value, t }) {
24
- if (value === undefined)
25
- return _jsx("p", { className: "dsmm-hint", children: t("evidenceMissing") });
26
- const codes = { "missing-evidence": "missingEvidence", "not-persisted": "notPersisted", unverified: "unverified", "parent-denied": "parentDenied" };
27
- const effects = { "capability-denied": "capabilityDenied", "native-default": "nativeDefault", "display-only": "displayOnly" };
28
- return _jsxs("section", { className: "dsmm-availability", "aria-label": t("evidence"), children: [_jsx("p", { children: t(value.mode === "captured" ? "captured" : "legacy") }), value.originalAdmissionEpoch !== undefined && _jsxs("p", { children: [t("originalEpoch"), ": ", value.originalAdmissionEpoch] }), _jsxs("p", { children: [t("epoch"), ": ", value.parentAdmissionEpoch] }), _jsxs("p", { children: [t("proven"), ": ", value.provenFields.length ? value.provenFields.join(", ") : t("noneProven")] }), _jsx("p", { children: t("limitations") }), value.limitations.length === 0 ? _jsx("p", { className: "dsmm-hint", children: t("noLimitations") }) : _jsx("ul", { className: "dsmm-profile-list", children: value.limitations.map((item, index) => _jsxs("li", { children: [_jsxs("p", { children: [item.field, " \u00B7 ", item.code, " \u00B7 ", t(codes[item.code])] }), _jsxs("p", { children: [item.effect, " \u00B7 ", t(effects[item.effect])] })] }, `${item.field}-${index}`)) })] });
29
- }
30
23
  function Issue({ value, t }) {
31
24
  if (!value)
32
25
  return null;
@@ -36,7 +29,7 @@ function Outcome({ value, t }) {
36
29
  if (!value)
37
30
  return null;
38
31
  return _jsx("div", { className: "dsmm-availability", role: "status", "aria-live": "polite", children: value.kind === "prompt" ? _jsx("p", { children: t("promptAccepted", { id: value.receipt.messageId }) })
39
- : value.kind === "interrupt" ? _jsx("p", { children: t("interruptAccepted") }) : _jsxs(_Fragment, { children: [_jsx("p", { children: t("backgroundReceipt", { status: value.receipt.status, id: value.receipt.runId }) }), value.receipt.jobId !== undefined && _jsxs("p", { children: [t("jobId"), ": ", value.receipt.jobId] })] }) });
32
+ : _jsx("p", { children: t("interruptAccepted") }) });
40
33
  }
41
34
  export function ChildComposer({ child, state, actions, t }) {
42
35
  const prefix = useId(), picker = useRef(null), generation = state.generation, key = childActionKey(child.id);
@@ -59,8 +52,8 @@ export function ChildComposer({ child, state, actions, t }) {
59
52
  } }), _jsx(Button, { type: "button", variant: "outline", disabled: !canImages, "aria-describedby": `${prefix}-images-hint`, onClick: () => { if (canImages)
60
53
  picker.current?.click(); }, children: t("images") }), _jsx(ControlAvailability, { value: state.snapshot?.capabilities.images, label: "imageAvailability", t: t }), draft.images.length > 0 && _jsx("ul", { className: "dsmm-profile-list", children: draft.images.map((image, index) => _jsxs("li", { children: [_jsxs("p", { children: [image.name ?? image.mediaType, " \u00B7 ", image.mediaType] }), _jsx(Button, { type: "button", variant: "outline", disabled: pending || draft.imageBusy, onClick: () => actions.removeImage(generation, child.id, image), "aria-label": `${t("removeImage")}: ${image.name ?? image.mediaType}`, children: t("removeImage") })] }, index)) })] }), draft.uncertain && _jsxs("div", { className: "dsmm-warning", children: [_jsx("p", { id: `${prefix}-unknown`, children: t("unknown") }), _jsx(Button, { type: "button", variant: "outline", disabled: !state.fresh || state.reading || pending, onClick: () => actions.acknowledgeUnknown(generation, child.id), children: t("acknowledge") })] }), _jsx(ControlAvailability, { value: !enabled(state.snapshot?.capabilities.prompt) ? state.snapshot?.capabilities.prompt : child.controls.prompt, label: "promptAvailability", t: t }), draft.text.trim() === "" && draft.images.length === 0 && _jsx("p", { className: "dsmm-hint", children: t("emptyMessage") }), draft.images.length > 0 && !enabled(state.snapshot?.capabilities.images) && _jsx("p", { className: "dsmm-hint", children: t("deniedImages") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "submit", variant: "primary", disabled: !submit, children: t("send") }), _jsx(Button, { type: "button", variant: "outline", disabled: !available || !enabled(state.snapshot?.capabilities.interrupt) || !enabled(child.controls.interrupt) || child.readonly || child.mode !== "continuable", onClick: () => void actions.interrupt(generation, child.id), children: t("interrupt") })] }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: pending ? t("pending") : draft.imageBusy ? t("imageReading") : "" })] });
61
54
  }
62
- export function ChildDetails({ child, state, actions, t, inspection = false }) {
63
- return _jsxs("fieldset", { children: [_jsx("legend", { children: child.label?.trim() ? child.label : child.id }), _jsxs("p", { children: [t("childId"), ": ", child.id] }), _jsxs("p", { children: [t("parentId"), ": ", child.parentSessionId] }), _jsxs("p", { children: [t("mode"), ": ", child.mode] }), _jsxs("p", { children: [t("activity"), ": ", child.activity] }), (inspection || child.readonly) && _jsx("p", { children: t("readonly") }), child.mode === "one-shot" && _jsx("p", { className: "dsmm-hint", children: t("oneShot") }), _jsx(RouteComparisonDetails, { value: child.routeComparison, t: t }), _jsx(InvocationDetails, { value: child.invocation, t: t, showComparison: false }), _jsx(EvidenceDetails, { value: child.evidence, t: t }), (!inspection || !child.controls.prompt.enabled) && _jsx(ControlAvailability, { value: child.controls.prompt, label: "promptAvailability", t: t }), (!inspection || !child.controls.interrupt.enabled) && _jsx(ControlAvailability, { value: child.controls.interrupt, label: "interruptAvailability", t: t }), !inspection && child.mode === "continuable" && !child.readonly && _jsx(ChildComposer, { child: child, state: state, actions: actions, t: t }), !inspection && _jsxs(_Fragment, { children: [_jsx(Issue, { value: state.issues.get(childActionKey(child.id)), t: t }), _jsx(Outcome, { value: state.outcomes.get(childActionKey(child.id)), t: t })] })] });
55
+ export function ChildDetails({ child, state, actions, t, inspection = false, renderChildPermissions }) {
56
+ return _jsxs("fieldset", { children: [_jsx("legend", { children: child.label?.trim() ? child.label : child.id }), _jsxs("p", { children: [t("childId"), ": ", child.id] }), _jsxs("p", { children: [t("parentId"), ": ", child.parentSessionId] }), _jsxs("p", { children: [t("mode"), ": ", child.mode] }), _jsxs("p", { children: [t("activity"), ": ", child.activity] }), (inspection || child.readonly) && _jsx("p", { children: t("readonly") }), child.mode === "one-shot" && _jsx("p", { className: "dsmm-hint", children: t("oneShot") }), _jsx(RouteComparisonDetails, { value: child.routeComparison, t: t }), _jsx(InvocationDetails, { value: child.invocation, t: t, showComparison: false }), (!inspection || !child.controls.prompt.enabled) && _jsx(ControlAvailability, { value: child.controls.prompt, label: "promptAvailability", t: t }), (!inspection || !child.controls.interrupt.enabled) && _jsx(ControlAvailability, { value: child.controls.interrupt, label: "interruptAvailability", t: t }), !inspection && child.mode === "continuable" && !child.readonly && _jsx(ChildComposer, { child: child, state: state, actions: actions, t: t }), !inspection && child.mode === "continuable" && !child.readonly && renderChildPermissions?.(child), !inspection && _jsxs(_Fragment, { children: [_jsx(Issue, { value: state.issues.get(childActionKey(child.id)), t: t }), _jsx(Outcome, { value: state.outcomes.get(childActionKey(child.id)), t: t })] })] });
64
57
  }
65
58
  /** Native session-scoped Conversation View, not a replacement composer or navigation shell. */
66
59
  export function ChildrenPanel(props) {
@@ -69,13 +62,8 @@ export function ChildrenPanel(props) {
69
62
  return _jsxs("section", { className: "dsmm-profiles dsmm-children", children: [_jsx("h2", { children: t("title") }), _jsx("p", { children: t(state.sessionId === null ? "noSession" : "foreign") })] });
70
63
  const data = state.snapshot;
71
64
  const refreshingDisabled = state.reading || state.pending.size > 0 || [...state.drafts.values()].some(draft => draft.imageBusy);
72
- return _jsxs("section", { className: "dsmm-profiles dsmm-children", "aria-label": t("title"), "aria-busy": state.reading, children: [_jsx("h2", { children: t("title") }), _jsx("p", { className: "dsmm-hint", children: t("description") }), _jsxs("p", { children: [t("session"), ": ", state.sessionId] }), _jsx("div", { className: "dsmm-actions", children: _jsx(Button, { type: "button", variant: "outline", disabled: refreshingDisabled, onClick: () => void props.refresh(generation), children: t("refresh") }) }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: state.reading ? t("reading") : state.pending.size > 0 ? t("pending") : !state.fresh ? t(data === null ? "unavailable" : "stale") : "" }), _jsx(Issue, { value: state.issue, t: t }), data !== null && _jsxs(_Fragment, { children: [_jsxs("p", { children: [t("epoch"), ": ", data.admissionEpoch] }), _jsxs("section", { className: "dsmm-availability", children: [_jsxs("p", { children: [t("runtime"), ": ", data.capabilities.runtime.binding] }), _jsxs("p", { children: [t("fence"), ": ", t(data.capabilities.runtime.deliveryFenceReady ? "yes" : "no")] }), _jsxs("p", { children: [t("restart"), ": ", t(data.capabilities.runtime.restartRequired ? "yes" : "no")] }), data.capabilities.runtime.reason !== undefined && _jsx("p", { children: t(data.capabilities.runtime.reason === "explicit-composition-required" ? "composition" : data.capabilities.runtime.reason === "duplicate-provider" ? "duplicate" : "authority") }), _jsx(ControlAvailability, { value: data.capabilities.background, label: "backgroundAvailability", t: t }), _jsx(ControlAvailability, { value: data.capabilities.prompt, label: "promptAvailability", t: t }), _jsx(ControlAvailability, { value: data.capabilities.interrupt, label: "interruptAvailability", t: t })] }), _jsxs("section", { className: "dsmm-zone", "aria-label": t("runs"), children: [_jsx("h3", { children: t("runs") }), data.runs.length === 0 ? _jsx("p", { className: "dsmm-hint", children: t("emptyRuns") }) : data.runs.map(run => {
73
- const runId = run.invocation?.runId, key = runId === undefined ? null : runActionKey(run.toolCallId, runId);
74
- const disabled = !state.fresh || state.reading || run.state !== "running" || !enabled(run.background) || !enabled(data.capabilities.background)
75
- || key === null || state.pending.has(key) || state.outcomes.get(key)?.kind === "background";
76
- return _jsxs("fieldset", { children: [_jsx("legend", { children: run.invocation?.label ?? t(run.state === "starting" ? "starting" : "invocationUnavailable") }), _jsxs("p", { children: [t("toolCallId"), ": ", run.toolCallId] }), _jsxs("p", { children: [t("runState"), ": ", run.state] }), run.invocation !== undefined && _jsx(InvocationDetails, { value: run.invocation, t: t }), _jsx(ControlAvailability, { value: run.background, label: "backgroundAvailability", t: t }), _jsx("p", { className: "dsmm-hint", children: t("backgroundHint") }), runId !== undefined && _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => void props.background(generation, run.toolCallId, runId), children: t("background") }), key !== null && _jsxs(_Fragment, { children: [_jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: state.pending.has(key) ? t("pending") : "" }), _jsx(Issue, { value: state.issues.get(key), t: t }), _jsx(Outcome, { value: state.outcomes.get(key), t: t })] })] }, run.toolCallId);
77
- })] }), _jsxs("section", { className: "dsmm-zone", "aria-label": t("children"), children: [_jsx("h3", { children: t("children") }), data.children.length === 0 ? _jsx("p", { className: "dsmm-hint", children: t("emptyChildren") })
78
- : data.children.map(child => _jsx(ChildDetails, { child: child, state: state, actions: props, t: t }, child.id))] })] }), _jsxs("section", { className: "dsmm-zone", "aria-label": t("descendants"), children: [_jsx("h3", { children: t("descendants") }), _jsx(Issue, { value: state.descendantIssue, t: t }), state.descendants === null ? _jsx("p", { className: "dsmm-hint", children: t("treeUnavailable") }) : state.descendants.descendants.length === 0 ? _jsx("p", { className: "dsmm-hint", children: t("emptyDescendants") })
65
+ return _jsxs("section", { className: "dsmm-profiles dsmm-children", "aria-label": t("title"), "aria-busy": state.reading, children: [_jsx("h2", { children: t("title") }), _jsx("p", { className: "dsmm-hint", children: t("description") }), _jsxs("p", { children: [t("session"), ": ", state.sessionId] }), _jsx("div", { className: "dsmm-actions", children: _jsx(Button, { type: "button", variant: "outline", disabled: refreshingDisabled, onClick: () => void props.refresh(generation), children: t("refresh") }) }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: state.reading ? t("reading") : state.pending.size > 0 ? t("pending") : !state.fresh ? t(data === null ? "unavailable" : "stale") : "" }), _jsx(Issue, { value: state.issue, t: t }), data !== null && _jsxs(_Fragment, { children: [_jsxs("p", { children: [t("epoch"), ": ", data.admissionEpoch] }), _jsxs("section", { className: "dsmm-availability", children: [_jsxs("p", { children: [t("runtime"), ": ", data.capabilities.runtime.binding] }), _jsxs("p", { children: [t("fence"), ": ", t(data.capabilities.runtime.deliveryFenceReady ? "yes" : "no")] }), _jsxs("p", { children: [t("restart"), ": ", t(data.capabilities.runtime.restartRequired ? "yes" : "no")] }), data.capabilities.runtime.reason !== undefined && _jsx("p", { children: t("authority") }), _jsx(ControlAvailability, { value: data.capabilities.prompt, label: "promptAvailability", t: t }), _jsx(ControlAvailability, { value: data.capabilities.interrupt, label: "interruptAvailability", t: t })] }), _jsx("p", { className: "dsmm-hint", children: t("backgroundHint") }), _jsxs("section", { className: "dsmm-zone", "aria-label": t("children"), children: [_jsx("h3", { children: t("children") }), data.children.length === 0 ? _jsx("p", { className: "dsmm-hint", children: t("emptyChildren") })
66
+ : data.children.map(child => _jsx(ChildDetails, { child: child, state: state, actions: props, t: t, renderChildPermissions: props.renderChildPermissions }, child.id))] })] }), _jsxs("section", { className: "dsmm-zone", "aria-label": t("descendants"), children: [_jsx("h3", { children: t("descendants") }), _jsx(Issue, { value: state.descendantIssue, t: t }), state.descendants === null ? _jsx("p", { className: "dsmm-hint", children: t("treeUnavailable") }) : state.descendants.descendants.length === 0 ? _jsx("p", { className: "dsmm-hint", children: t("emptyDescendants") })
79
67
  : state.descendants.descendants.map((entry, index) => _jsxs("div", { className: "dsmm-availability", children: [_jsxs("p", { children: [t("depth"), ": ", entry.depth] }), entry.kind === "diagnostic" ? _jsxs("div", { className: "dsmm-issue", children: [_jsx("p", { children: t("diagnostic", { reason: entry.reason }) }), _jsxs("p", { children: [t("childId"), ": ", entry.id] }), _jsxs("p", { children: [t("parentId"), ": ", entry.parentSessionId] })] })
80
68
  : _jsxs(_Fragment, { children: [_jsxs("p", { children: [t("subtree"), ": ", t(entry.hasChildren ? "yes" : "no")] }), _jsx(ChildDetails, { child: entry.child, state: state, actions: props, t: t, inspection: true })] })] }, index))] })] });
81
69
  }
@@ -0,0 +1,32 @@
1
+ import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
2
+ import type { DeploymentSchemaNode } from "../profile-types.js";
3
+ import type { DeploymentController } from "./deployment-controller.js";
4
+ import type { PermissionLocaleKey } from "./permission-locales.js";
5
+ type Locale = PropsLocale<"plugins.dsmm">;
6
+ export declare const permissionText: (t: Locale["t"]) => (key: PermissionLocaleKey) => string;
7
+ export declare function fieldLabel(path: readonly string[], t: Locale["t"]): string;
8
+ export declare function displayValue(value: unknown, t: Locale["t"]): string;
9
+ export declare function AdvancedField({ schema, path, controller, inherited, upper, expanded, onExpandedChange, t }: Locale & {
10
+ schema: DeploymentSchemaNode;
11
+ path: string[];
12
+ controller: DeploymentController;
13
+ inherited: unknown;
14
+ upper: unknown;
15
+ expanded?: boolean;
16
+ onExpandedChange?: (expanded: boolean) => void;
17
+ }): import("react").JSX.Element;
18
+ export declare function ScalarField({ schema, path, controller, inherited, t }: Locale & {
19
+ schema: DeploymentSchemaNode;
20
+ path: string[];
21
+ controller: DeploymentController;
22
+ inherited: unknown;
23
+ }): import("react").JSX.Element;
24
+ export declare function Field({ schema, path, controller, initiallyOpen, disclosures, t }: Locale & {
25
+ schema: DeploymentSchemaNode;
26
+ path: string[];
27
+ controller: DeploymentController;
28
+ initiallyOpen?: boolean;
29
+ disclosures?: Map<string, boolean>;
30
+ }): import("react").JSX.Element;
31
+ export {};
32
+ //# sourceMappingURL=DeploymentFields.d.ts.map
@@ -0,0 +1,70 @@
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useId, useState, useSyncExternalStore } from "react";
3
+ import { Button, Input } from "@deepseek-ai/dsh-client-ui-primitives";
4
+ import { at, enumValues, equal, mergeLayer, parseAdvanced, validateEditorValue } from "./deployment-data.js";
5
+ import { deploymentFieldLabels } from "./deployment-locales.js";
6
+ import { permissionEn, permissionZh } from "./permission-locales.js";
7
+ import { NativeCommandEntries } from "./NativeCommandEntries.js";
8
+ export const permissionText = (t) => (key) => (t("global") === "DSMM 全局配置" ? permissionZh : permissionEn)[key];
9
+ export function fieldLabel(path, t) {
10
+ const key = path.at(-1);
11
+ if (path[0] === "permissionControl" && ["outsideReads", "webSearch", "webFetch", "rules", "nativeCommands", "rule"].includes(key))
12
+ return permissionText(t)(key);
13
+ const item = deploymentFieldLabels[key];
14
+ return item === undefined ? key.replace(/^dsmm-/u, "").replace(/([a-z])([A-Z])/gu, "$1 $2") : item[t("global") === "DSMM 全局配置" ? 1 : 0];
15
+ }
16
+ export function displayValue(value, t) {
17
+ if (value === undefined)
18
+ return t("unknown");
19
+ if (typeof value === "boolean")
20
+ return t(value ? "on" : "off");
21
+ const text = JSON.stringify(value);
22
+ return text.length > 120 ? `${text.slice(0, 120)}…` : text;
23
+ }
24
+ export function AdvancedField({ schema, path, controller, inherited, upper, expanded, onExpandedChange, t }) {
25
+ const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), id = useId(), name = path.join(".");
26
+ const value = at(state.draft, path), raw = state.raw[name], text = raw?.text ?? (value === undefined ? "" : JSON.stringify(value, null, 2)), invalid = raw?.invalid === true;
27
+ return _jsxs("details", { className: "dsmm-deployment-group", "data-field": name, open: expanded, onToggle: event => onExpandedChange?.(event.currentTarget.open), children: [_jsxs("summary", { id: `${id}-label`, children: [fieldLabel(path, t), " \u00B7 ", t("advanced")] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("p", { className: "dsmm-hint", id: `${id}-hint`, children: t("advancedHint") }), path[0] === "permissionControl" && _jsx("p", { className: "dsmm-hint", children: permissionText(t)("configRulesHint") }), _jsx("p", { className: "dsmm-hint", children: t(value === undefined ? "inherit" : "explicit") }), upper !== undefined && _jsxs("p", { className: "dsmm-hint", children: [t("profileSource"), ": ", displayValue(upper, t)] }), _jsx("textarea", { id: id, rows: 6, maxLength: 32768, value: text, disabled: !controller.canEdit(), "aria-labelledby": `${id}-label`, "aria-invalid": invalid, "aria-describedby": `${id}-hint ${id}-error`, onChange: event => {
28
+ const next = event.currentTarget.value;
29
+ let parsed, valid = true;
30
+ try {
31
+ parsed = parseAdvanced(next);
32
+ const candidate = parsed === undefined ? inherited : mergeLayer(inherited, parsed);
33
+ valid = parsed === undefined || validateEditorValue(parsed, schema, true) && validateEditorValue(upper === undefined ? candidate : mergeLayer(candidate, upper), schema);
34
+ }
35
+ catch {
36
+ valid = false;
37
+ }
38
+ controller.setRaw(name, next, !valid);
39
+ if (valid)
40
+ controller.edit(path, parsed);
41
+ } }), _jsx("p", { id: `${id}-error`, className: "dsmm-hint", children: invalid ? t("invalid") : "" }), _jsx(Button, { type: "button", variant: "outline", "data-dsmm-unset": name, disabled: !controller.canEdit() || value === undefined && raw === undefined, onClick: () => { controller.clearRaw(name); controller.edit(path, undefined); }, children: t("unset") }), _jsxs("details", { children: [_jsx("summary", { children: t("inherit") }), _jsx("pre", { children: JSON.stringify(inherited, null, 2) })] }), _jsxs("details", { children: [_jsx("summary", { children: "schema" }), _jsx("pre", { children: JSON.stringify(schema, null, 2) })] })] })] });
42
+ }
43
+ export function ScalarField({ schema, path, controller, inherited, t }) {
44
+ const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), id = useId(), name = path.join(".");
45
+ const value = at(state.draft, path), raw = state.raw[name], bad = raw?.invalid === true;
46
+ return _jsxs(_Fragment, { children: [_jsx("label", { htmlFor: id, children: fieldLabel(path, t) }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Input, { className: "dsmm-input", id: id, type: "text", inputMode: schema.type === "number" ? "decimal" : undefined, value: raw?.text ?? String(value ?? inherited ?? ""), disabled: !controller.canEdit(), "aria-invalid": bad, "aria-describedby": `${id}-error`, onChange: event => {
47
+ const text = event.currentTarget.value, candidate = schema.type === "number" ? Number(text) : text;
48
+ const valid = (schema.type !== "number" || text.trim() !== "") && validateEditorValue(candidate, schema);
49
+ controller.setRaw(name, text, !valid);
50
+ if (valid)
51
+ controller.edit(path, candidate);
52
+ } }), _jsx(Button, { type: "button", variant: "outline", "data-dsmm-unset": name, disabled: !controller.canEdit() || value === undefined && raw === undefined, onClick: () => { controller.clearRaw(name); controller.edit(path, undefined); }, children: t("unset") })] }), _jsxs("p", { id: `${id}-error`, className: "dsmm-hint", children: [bad ? t("invalid") : "", schema.type === "number" && (schema.min !== undefined || schema.max !== undefined) ? ` ${schema.min ?? "—"} – ${schema.max ?? "—"}` : ""] })] });
53
+ }
54
+ export function Field({ schema, path, controller, initiallyOpen = false, disclosures, t }) {
55
+ if (schema.type === "transform" && schema.inner !== undefined)
56
+ schema = schema.inner;
57
+ const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), snapshot = state.snapshot, id = useId(), name = path.join(".");
58
+ const [open, setOpen] = useState(disclosures?.get(name) ?? initiallyOpen);
59
+ const expand = (expanded) => { disclosures?.set(name, expanded); setOpen(expanded); };
60
+ const explicit = at(state.draft, path), inherited = controller.layer === "global" ? at(snapshot.defaults, path) : at(mergeLayer(mergeLayer(snapshot.defaults, snapshot.global), snapshot.nativeForm?.base ?? {}), path);
61
+ const choices = enumValues(schema), disabled = !controller.canEdit();
62
+ if (name === "permissionControl.nativeCommands.entries")
63
+ return _jsx("div", { "data-field": name, children: _jsx(NativeCommandEntries, { controller: controller, value: explicit, inherited: (inherited ?? []), disabled: disabled, onChange: value => controller.edit(path, value), setInvalid: (key, bad) => controller.setInvalid(key, bad), t: permissionText(t) }) });
64
+ if (schema.type === "object" && schema.fields !== undefined && path[0] !== "roleRouting")
65
+ return _jsxs("details", { className: "dsmm-deployment-group", "data-field": name, open: open, onToggle: event => expand(event.currentTarget.open), children: [_jsx("summary", { children: fieldLabel(path, t) }), _jsxs("div", { children: [name === "permissionControl" && _jsx("p", { className: "dsmm-hint", children: permissionText(t)("configPolicyHint") }), _jsx("p", { className: "dsmm-hint", children: t(explicit === undefined ? "inherit" : "explicit") }), _jsx(Button, { type: "button", variant: "outline", "data-dsmm-unset": name, disabled: disabled || explicit === undefined && !Object.keys(state.raw).some(key => key === name || key.startsWith(`${name}.`)), onClick: () => { controller.clearRaw(name); controller.edit(path, undefined); }, children: t("unsetGroup") }), Object.entries(schema.fields).map(([key, node]) => _jsx(Field, { schema: node, path: [...path, key], controller: controller, disclosures: disclosures, t: t }, key))] })] });
66
+ if (!["boolean", "string", "number"].includes(schema.type) && choices === null)
67
+ return _jsx(AdvancedField, { schema: schema, path: path, controller: controller, inherited: inherited, upper: controller.layer === "global" ? at(snapshot.profile, path) : undefined, expanded: open, onExpandedChange: expand, t: t });
68
+ return _jsxs("div", { className: "dsmm-field dsmm-deployment-field", "data-field": name, children: [schema.type === "boolean" || choices !== null ? _jsxs(_Fragment, { children: [_jsx("label", { htmlFor: id, children: fieldLabel(path, t) }), _jsxs("select", { id: id, disabled: disabled, value: explicit === undefined ? "inherit" : JSON.stringify(explicit), onChange: event => controller.edit(path, event.currentTarget.value === "inherit" ? undefined : JSON.parse(event.currentTarget.value)), children: [_jsx("option", { value: "inherit", children: `${t("unset")} · ${displayValue(inherited, t)}` }), (choices ?? [true, false]).map(choice => _jsx("option", { value: JSON.stringify(choice), children: displayValue(choice, t) }, String(choice)))] })] }) : _jsx(ScalarField, { schema: schema, path: path, controller: controller, inherited: inherited, t: t }), name === "modelParameters.passthrough" && _jsx("p", { className: "dsmm-hint", children: t("modelParametersHint") }), name === "permissionControl.enabled" && _jsx("p", { className: "dsmm-hint", children: permissionText(t)("coldHint") }), explicit !== undefined && _jsx("p", { className: "dsmm-hint", children: t(equal(explicit, at(snapshot.defaults, path)) ? "defaultPin" : "explicit") }), controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined && _jsx("p", { className: "dsmm-hint", children: t("hostPin") }), controller.layer === "global" && at(snapshot.profile, path) !== undefined && _jsxs("p", { className: "dsmm-hint", children: [t("profileSource"), ": ", displayValue(at(snapshot.profile, path), t), " \u00B7 ", t("explicit")] })] });
69
+ }
70
+ //# sourceMappingURL=DeploymentFields.js.map
@@ -1,18 +1,33 @@
1
- import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
1
+ import type { HostObservable, PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
2
+ import type { TemporaryPermissionRemote } from "../permission-temporary-types.js";
2
3
  import type { ConfigForms } from "@deepseek-ai/dsh-client-ui-settings/client";
3
- import { DeploymentController } from "./deployment-controller.js";
4
- import type { NativePageForm } from "./deployment-controller.js";
5
4
  import type { DsmmConfigRemote } from "../profile-remote.js";
5
+ import type { SubagentRuntimeAdmissionView } from "../profile-types.js";
6
+ import type { DeploymentController } from "./deployment-controller.js";
7
+ import type { PermissionController } from "./permission-controller.js";
8
+ import type { DeploymentWorkspace } from "./deployment-workspace.js";
6
9
  type Locale = PropsLocale<"plugins.dsmm">;
7
10
  export interface DeploymentPageProps extends Locale {
8
11
  view: "summary" | "page";
9
- form?: NativePageForm;
10
12
  core: DeploymentController;
11
13
  remote: DsmmConfigRemote;
14
+ workspace?: DeploymentWorkspace;
15
+ permissions?: PermissionController;
16
+ temporaryPermissions?: HostObservable<TemporaryPermissionRemote | undefined>;
17
+ permissionsT?: PropsLocale<"settings.dsmm-permissions">["t"];
12
18
  forms?: ConfigForms;
13
- rowNamespace?: string;
14
- profilePage?: boolean;
15
19
  }
20
+ export declare function ScopeSave({ controller, workspace, refreshOnly, t }: Locale & {
21
+ controller: DeploymentController;
22
+ workspace?: DeploymentWorkspace;
23
+ refreshOnly?: boolean;
24
+ }): import("react").JSX.Element;
25
+ export declare function NativeRuntimeState({ value, t }: Locale & {
26
+ value?: SubagentRuntimeAdmissionView;
27
+ }): import("react").JSX.Element;
28
+ export declare function StateInspector({ controller, t }: Locale & {
29
+ controller: DeploymentController;
30
+ }): import("react").JSX.Element;
16
31
  export declare function DeploymentPage(props: DeploymentPageProps): import("react").JSX.Element;
17
32
  export {};
18
33
  //# sourceMappingURL=DeploymentPage.d.ts.map