@dsmm/dsmm 0.2.0 → 0.3.0

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 (285) hide show
  1. package/README.md +37 -67
  2. package/agent-presets/dsmm-builder/agent.cordis.yml +10 -2015
  3. package/agent-presets/dsmm-clarifier/agent.cordis.yml +24 -343
  4. package/agent-presets/dsmm-code-search/agent.cordis.yml +19 -6
  5. package/agent-presets/dsmm-coding/agent.cordis.yml +19 -438
  6. package/agent-presets/dsmm-complex/agent.cordis.yml +23 -1009
  7. package/agent-presets/dsmm-creative/agent.cordis.yml +25 -442
  8. package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +29 -1013
  9. package/agent-presets/dsmm-deep/agent.cordis.yml +24 -1008
  10. package/agent-presets/dsmm-doc-search/agent.cordis.yml +19 -6
  11. package/agent-presets/dsmm-documenting/agent.cordis.yml +26 -439
  12. package/agent-presets/dsmm-frontend/agent.cordis.yml +21 -440
  13. package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +22 -441
  14. package/agent-presets/dsmm-media-reader/agent.cordis.yml +19 -6
  15. package/agent-presets/dsmm-normal-task/agent.cordis.yml +19 -438
  16. package/agent-presets/dsmm-oracle/agent.cordis.yml +25 -340
  17. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +25 -340
  18. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +29 -2025
  19. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +24 -341
  20. package/agent-presets/dsmm-planner/agent.cordis.yml +14 -344
  21. package/agent-presets/dsmm-quick/agent.cordis.yml +19 -6
  22. package/agent-presets/dsmm-research/agent.cordis.yml +23 -8
  23. package/agent-presets/dsmm-reviewer/agent.cordis.yml +25 -340
  24. package/cordis.patch.yml +14 -0
  25. package/docs/agent-presets.md +36 -52
  26. package/docs/compatibility.md +47 -110
  27. package/docs/deferred-native-approval-risk.md +19 -0
  28. package/docs/design.md +2 -2
  29. package/docs/lsp.md +11 -21
  30. package/docs/migration-from-ocmm.md +2 -2
  31. package/docs/model-routing.md +84 -59
  32. package/docs/native-permissions.md +35 -0
  33. package/docs/profiles.md +40 -87
  34. package/docs/releasing.md +123 -2
  35. package/docs/roadmap.md +71 -17
  36. package/docs/settings-status.md +34 -169
  37. package/docs/skill-sync.md +52 -15
  38. package/lib/agent-registry.d.ts +36 -0
  39. package/lib/agent-registry.js +75 -0
  40. package/lib/child-admission-contract.d.ts +37 -0
  41. package/lib/child-admission-contract.js +2 -0
  42. package/lib/child-admission.d.ts +40 -0
  43. package/lib/child-admission.js +151 -0
  44. package/lib/child-capture.d.ts +85 -0
  45. package/lib/child-capture.js +205 -0
  46. package/lib/child-evidence.d.ts +17 -0
  47. package/lib/child-evidence.js +43 -0
  48. package/lib/client/ChildrenPanel.d.ts +43 -0
  49. package/lib/client/ChildrenPanel.js +82 -0
  50. package/lib/client/DeploymentPage.js +15 -8
  51. package/lib/client/EditableChoice.d.ts +17 -0
  52. package/lib/client/EditableChoice.js +49 -0
  53. package/lib/client/PermissionsPanel.d.ts +14 -0
  54. package/lib/client/PermissionsPanel.js +46 -0
  55. package/lib/client/ProfilesSection.js +30 -15
  56. package/lib/client/RoleAvailability.d.ts +7 -0
  57. package/lib/client/RoleAvailability.js +19 -0
  58. package/lib/client/SessionProfiles.js +27 -9
  59. package/lib/client/StructuredEditor.js +15 -7
  60. package/lib/client/children-controller.d.ts +98 -0
  61. package/lib/client/children-controller.js +296 -0
  62. package/lib/client/children-locales.d.ts +367 -0
  63. package/lib/client/children-locales.js +69 -0
  64. package/lib/client/controller.d.ts +6 -1
  65. package/lib/client/controller.js +14 -8
  66. package/lib/client/deployment-controller.js +1 -1
  67. package/lib/client/deployment-data.d.ts +2 -1
  68. package/lib/client/deployment-data.js +34 -5
  69. package/lib/client/deployment-locales.d.ts +4 -0
  70. package/lib/client/deployment-locales.js +11 -2
  71. package/lib/client/diagnostics.d.ts +14 -0
  72. package/lib/client/diagnostics.js +53 -0
  73. package/lib/client/index.d.ts +4 -0
  74. package/lib/client/index.js +96 -2
  75. package/lib/client/locales.d.ts +54 -0
  76. package/lib/client/locales.js +34 -16
  77. package/lib/client/permission-client.d.ts +16 -0
  78. package/lib/client/permission-client.js +38 -0
  79. package/lib/client/permission-controller.d.ts +62 -0
  80. package/lib/client/permission-controller.js +149 -0
  81. package/lib/client/permission-locales.d.ts +114 -0
  82. package/lib/client/permission-locales.js +75 -0
  83. package/lib/client/session-labels.js +4 -4
  84. package/lib/client/structured.js +19 -5
  85. package/lib/client/styles.d.ts +1 -1
  86. package/lib/client/styles.js +20 -0
  87. package/lib/client.js +5780 -1679
  88. package/lib/core-permission-authority.d.ts +18 -0
  89. package/lib/core-permission-authority.js +255 -0
  90. package/lib/core-permissions.d.ts +8 -0
  91. package/lib/core-permissions.js +33 -0
  92. package/lib/delivery-authority.d.ts +83 -0
  93. package/lib/delivery-authority.js +397 -0
  94. package/lib/deployment-config.d.ts +23 -0
  95. package/lib/deployment-config.js +61 -40
  96. package/lib/deployment-permission-rules.d.ts +55 -0
  97. package/lib/deployment-permission-rules.js +306 -0
  98. package/lib/dsh-types.d.ts +10 -4
  99. package/lib/guards.d.ts +1 -1
  100. package/lib/guards.js +29 -8
  101. package/lib/host-llm-startup.d.ts +41 -0
  102. package/lib/host-llm-startup.js +65 -0
  103. package/lib/host-llm.d.ts +92 -0
  104. package/lib/host-llm.js +325 -0
  105. package/lib/index.d.ts +15 -4
  106. package/lib/index.js +288 -48
  107. package/lib/live-pi-ai-owner.d.ts +18 -0
  108. package/lib/live-pi-ai-owner.js +144 -0
  109. package/lib/llm-runtime.d.ts +11 -0
  110. package/lib/llm-runtime.js +21 -0
  111. package/lib/managed-settings.d.ts +5 -0
  112. package/lib/managed-settings.js +14 -0
  113. package/lib/model-parameter-policy.d.ts +11 -0
  114. package/lib/model-parameter-policy.js +27 -0
  115. package/lib/model-routing.js +28 -17
  116. package/lib/modules.d.ts +13 -5
  117. package/lib/modules.js +17 -1
  118. package/lib/native-child-evidence.d.ts +40 -0
  119. package/lib/native-child-evidence.js +104 -0
  120. package/lib/native-pi-ai-wire.d.ts +37 -0
  121. package/lib/native-pi-ai-wire.js +261 -0
  122. package/lib/native-scope.js +1 -1
  123. package/lib/permission-bash.d.ts +6 -0
  124. package/lib/permission-bash.js +7 -0
  125. package/lib/permission-control.d.ts +73 -0
  126. package/lib/permission-control.js +205 -0
  127. package/lib/permission-controller.d.ts +68 -0
  128. package/lib/permission-controller.js +317 -0
  129. package/lib/permission-errors.d.ts +7 -0
  130. package/lib/permission-errors.js +21 -0
  131. package/lib/permission-fs-search.d.ts +5 -0
  132. package/lib/permission-fs-search.js +7 -0
  133. package/lib/permission-fs.d.ts +5 -0
  134. package/lib/permission-fs.js +7 -0
  135. package/lib/permission-native-access.d.ts +11 -0
  136. package/lib/permission-native-access.js +6 -0
  137. package/lib/permission-native-command.d.ts +10 -0
  138. package/lib/permission-native-command.js +93 -0
  139. package/lib/permission-native-rules.d.ts +75 -0
  140. package/lib/permission-native-rules.js +278 -0
  141. package/lib/permission-pwsh.d.ts +6 -0
  142. package/lib/permission-pwsh.js +7 -0
  143. package/lib/permission-remote.d.ts +26 -0
  144. package/lib/permission-remote.js +53 -0
  145. package/lib/permission-rpc.d.ts +29 -0
  146. package/lib/permission-rpc.js +152 -0
  147. package/lib/permission-rules.d.ts +115 -0
  148. package/lib/permission-rules.js +256 -0
  149. package/lib/permission-settings.d.ts +45 -0
  150. package/lib/permission-settings.js +48 -0
  151. package/lib/permission-shell.d.ts +38 -0
  152. package/lib/permission-shell.js +150 -0
  153. package/lib/permission-web.d.ts +5 -0
  154. package/lib/permission-web.js +7 -0
  155. package/lib/preset-registry.js +36 -25
  156. package/lib/profile-diagnostics.d.ts +45 -0
  157. package/lib/profile-diagnostics.js +148 -0
  158. package/lib/profile-locale.d.ts +3 -0
  159. package/lib/profile-locale.js +2 -0
  160. package/lib/profile-remote.d.ts +8 -0
  161. package/lib/profile-remote.js +163 -39
  162. package/lib/profile-rpc.d.ts +4 -3
  163. package/lib/profile-rpc.js +20 -16
  164. package/lib/profile-runtime.d.ts +40 -1
  165. package/lib/profile-runtime.js +368 -93
  166. package/lib/profile-store.d.ts +11 -0
  167. package/lib/profile-store.js +143 -11
  168. package/lib/profile-types.d.ts +70 -1
  169. package/lib/profile-types.js +1 -0
  170. package/lib/profiles.d.ts +16 -2
  171. package/lib/profiles.js +156 -79
  172. package/lib/prompt-content.js +1 -1
  173. package/lib/prompts.d.ts +37 -2
  174. package/lib/prompts.js +111 -9
  175. package/lib/recovery-policy.js +20 -7
  176. package/lib/role-control-remote.d.ts +38 -0
  177. package/lib/role-control-remote.js +211 -0
  178. package/lib/role-control-rpc.d.ts +51 -0
  179. package/lib/role-control-rpc.js +381 -0
  180. package/lib/role-control-types.d.ts +92 -0
  181. package/lib/role-control-types.js +8 -0
  182. package/lib/role-invocation.d.ts +47 -0
  183. package/lib/role-invocation.js +135 -0
  184. package/lib/role-llm-runtime.d.ts +17 -0
  185. package/lib/role-llm-runtime.js +62 -0
  186. package/lib/role-llm.d.ts +31 -0
  187. package/lib/role-llm.js +66 -0
  188. package/lib/role-policy.d.ts +46 -8
  189. package/lib/role-policy.js +421 -61
  190. package/lib/role-providers.d.ts +2 -2
  191. package/lib/role-providers.js +27 -72
  192. package/lib/role-routing.d.ts +11 -2
  193. package/lib/role-routing.js +42 -25
  194. package/lib/role-runs.d.ts +138 -0
  195. package/lib/role-runs.js +335 -0
  196. package/lib/role-subagents.d.ts +58 -3
  197. package/lib/role-subagents.js +179 -56
  198. package/lib/roles.d.ts +5 -6
  199. package/lib/roles.js +10 -39
  200. package/lib/route-json.d.ts +19 -0
  201. package/lib/route-json.js +129 -0
  202. package/lib/routing-policy.d.ts +2 -0
  203. package/lib/routing-policy.js +12 -2
  204. package/lib/runtime-integration.d.ts +81 -0
  205. package/lib/runtime-integration.js +702 -0
  206. package/lib/runtime-recovery.js +18 -8
  207. package/lib/session-persistence.d.ts +2 -1
  208. package/lib/session-persistence.js +1 -1
  209. package/lib/session-scope.js +4 -1
  210. package/lib/settings.d.ts +47 -13
  211. package/lib/settings.js +217 -82
  212. package/lib/skills.js +2 -2
  213. package/lib/status.d.ts +10 -1
  214. package/lib/status.js +11 -8
  215. package/lib/subagent-runtime.d.ts +57 -0
  216. package/lib/subagent-runtime.js +257 -0
  217. package/package.json +149 -89
  218. package/patches/subagent-runtime.yml +15 -0
  219. package/prompts/deepseek-flash.md +1 -1
  220. package/prompts/deepseek-v4-pro.md +2 -2
  221. package/prompts/deepwork.md +27 -18
  222. package/prompts/source/agents/clarifier.md +5 -3
  223. package/prompts/source/agents/orchestrator.md +18 -9
  224. package/prompts/source/agents/plan-critic.md +5 -1
  225. package/prompts/source/agents/planner.md +4 -2
  226. package/prompts/source/agents/reviewer.md +6 -0
  227. package/prompts/source/category/complex.md +4 -4
  228. package/prompts/source/category/creative.md +6 -4
  229. package/prompts/source/category/cross-cutting.md +10 -8
  230. package/prompts/source/category/deep.md +5 -3
  231. package/prompts/source/category/documenting.md +7 -1
  232. package/prompts/source/category/frontend.md +2 -2
  233. package/prompts/source/category/hard-reasoning.md +3 -3
  234. package/prompts/source/category/research.md +4 -2
  235. package/prompts/source/deepwork/claude-opus-5.md +2 -2
  236. package/prompts/source/deepwork/codex.md +1 -1
  237. package/prompts/source/deepwork/default.md +22 -15
  238. package/prompts/source/deepwork/gemini.md +23 -16
  239. package/prompts/source/deepwork/glm.md +21 -14
  240. package/prompts/source/deepwork/gpt.md +12 -6
  241. package/prompts/source/deepwork/planner.md +8 -5
  242. package/prompts/source/manifest.json +178 -63
  243. package/prompts/source/shared/dsh-host-contract.md +5 -3
  244. package/prompts/source/shared/locale.md +2 -2
  245. package/prompts/source/terminal/orchestrator.md +1 -1
  246. package/skills/ast-grep/SKILL.md +7 -4
  247. package/skills/brainstorming/SKILL.md +43 -22
  248. package/skills/coding-agent-sessions/SKILL.md +7 -4
  249. package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -46
  250. package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -130
  251. package/skills/debugging/SKILL.md +14 -9
  252. package/skills/debugging/references/methodology/00-setup.md +14 -62
  253. package/skills/debugging/references/methodology/02-investigate.md +4 -4
  254. package/skills/debugging/references/methodology/03-flaky-triage.md +3 -3
  255. package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +2 -14
  256. package/skills/debugging/references/methodology/06-fix.md +6 -6
  257. package/skills/debugging/references/methodology/08-qa.md +5 -5
  258. package/skills/debugging/references/methodology/09-cleanup.md +15 -153
  259. package/skills/debugging/references/methodology/partial-runtime-evidence.md +3 -16
  260. package/skills/debugging/references/runtimes/bundled-js-binary.md +1 -16
  261. package/skills/debugging/references/runtimes/native-binary.md +9 -54
  262. package/skills/debugging/references/runtimes/node.md +4 -15
  263. package/skills/debugging/references/runtimes/python.md +3 -15
  264. package/skills/debugging/references/runtimes/rust.md +2 -18
  265. package/skills/debugging/references/tools/dap.md +1 -1
  266. package/skills/debugging/references/tools/ghidra.md +4 -15
  267. package/skills/debugging/references/tools/playwright-cli.md +3 -15
  268. package/skills/debugging/references/tools/pwntools.md +4 -16
  269. package/skills/dispatching-parallel-agents/SKILL.md +18 -16
  270. package/skills/frontend/SKILL.md +7 -4
  271. package/skills/frontend/references/design/react-dev-tooling-skill.md +1 -1
  272. package/skills/git-master/SKILL.md +7 -4
  273. package/skills/init-deep/SKILL.md +7 -4
  274. package/skills/receiving-code-review/SKILL.md +17 -12
  275. package/skills/remove-ai-slops/SKILL.md +39 -38
  276. package/skills/requesting-code-review/SKILL.md +19 -17
  277. package/skills/requesting-code-review/code-reviewer.md +13 -1
  278. package/skills/subagent-driven-development/SKILL.md +29 -26
  279. package/skills/subagent-driven-development/implementer-prompt.md +29 -11
  280. package/skills/subagent-driven-development/spec-reviewer-prompt.md +6 -1
  281. package/skills/using-git-worktrees/SKILL.md +7 -4
  282. package/skills/writing-plans/SKILL.md +29 -24
  283. package/skills/writing-plans/plan-document-reviewer-prompt.md +10 -1
  284. package/scripts/repair-session-log.mjs +0 -476
  285. package/scripts/session-repair-native-verifier.mjs +0 -367
@@ -0,0 +1,82 @@
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useId, useRef } from "react";
3
+ import { Button } from "@deepseek-ai/dsh-client-ui-primitives";
4
+ import { childActionKey, EMPTY_CHILD_DRAFT, enabled, runActionKey } from "./children-controller.js";
5
+ export function ControlAvailability({ value, label, t }) {
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
+ }
8
+ function routeText(route) {
9
+ return `${route.provider}/${route.model}${route.reasoningEffort === undefined ? "" : ` (${route.reasoningEffort})`}`;
10
+ }
11
+ export function RouteComparisonDetails({ value, t }) {
12
+ const initial = value?.initialRoute, live = value?.liveRoute;
13
+ const liveReasons = { "no-own-request-header": "routeNoOwnHeader", "invalid-own-request-header": "routeInvalidOwnHeader", "not-observed": "routeNotObserved" };
14
+ return _jsxs("div", { className: "dsmm-availability", children: [value === undefined && _jsx("p", { className: "dsmm-hint", children: t("comparisonUnobserved") }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("initialRoute") }), _jsx("dd", { children: initial?.status === "known" ? routeText(initial.route) : t("routeUnknown") }), initial?.status === "known" ? _jsxs(_Fragment, { children: [_jsx("dt", { children: t("initialRouteSource") }), _jsxs("dd", { children: [t("routeCaptureSource"), " \u00B7 ", initial.source] })] })
15
+ : initial !== undefined && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("initialRouteReason") }), _jsxs("dd", { children: [t("routeMissingCapture"), " \u00B7 ", initial.reason] })] }), _jsx("dt", { children: t("liveRoute") }), _jsx("dd", { children: live?.status === "known" ? routeText(live.route) : t("routeUnknown") }), live?.status === "known" ? _jsxs(_Fragment, { children: [_jsx("dt", { children: t("liveRouteSource") }), _jsxs("dd", { children: [t("routeOwnHeaderSource"), " \u00B7 ", live.source] })] })
16
+ : live !== undefined && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("liveRouteReason") }), _jsxs("dd", { children: [t(liveReasons[live.reason]), " \u00B7 ", live.reason] })] })] })] });
17
+ }
18
+ export function InvocationDetails({ value, t, showComparison = true }) {
19
+ if (value === undefined)
20
+ return _jsx("p", { className: "dsmm-hint", children: t("invocationUnavailable") });
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
+ }
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
+ function Issue({ value, t }) {
31
+ if (!value)
32
+ return null;
33
+ return _jsxs("div", { className: "dsmm-issue", role: "alert", children: [_jsx("p", { children: t(value.unknown ? "unknownAction" : "error", { code: value.code }) }), _jsxs("p", { children: [value.code, value.field === undefined ? "" : ` · ${t("field")}: ${value.field}`] }), value.reason !== undefined && _jsx("p", { children: t(`reason:${value.reason}`) })] });
34
+ }
35
+ function Outcome({ value, t }) {
36
+ if (!value)
37
+ return null;
38
+ 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] })] }) });
40
+ }
41
+ export function ChildComposer({ child, state, actions, t }) {
42
+ const prefix = useId(), picker = useRef(null), generation = state.generation, key = childActionKey(child.id);
43
+ const draft = state.drafts.get(child.id) ?? EMPTY_CHILD_DRAFT;
44
+ const pending = state.pending.has(key), available = state.fresh && !state.reading && !pending;
45
+ const canPrompt = available && enabled(state.snapshot?.capabilities.prompt) && enabled(child.controls.prompt) && !child.readonly && child.mode === "continuable";
46
+ const canImages = canPrompt && enabled(state.snapshot?.capabilities.images) && !draft.imageBusy;
47
+ const submit = canPrompt && !draft.uncertain && !draft.imageBusy && (draft.text.trim() !== "" || draft.images.length > 0)
48
+ && (draft.images.length === 0 || enabled(state.snapshot?.capabilities.images));
49
+ return _jsxs("form", { className: "dsmm-child-composer", "aria-label": t("prompt"), onSubmit: event => { event.preventDefault(); if (submit)
50
+ void actions.prompt(generation, child.id); }, children: [!state.fresh && _jsx("p", { className: "dsmm-hint", children: t(state.reading ? "reading" : "stale") }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-message`, children: t("text") }), _jsx("textarea", { id: `${prefix}-message`, className: "dsmm-child-message", rows: 4, value: draft.text, disabled: pending, "aria-describedby": `${prefix}-delivery-hint${draft.uncertain ? ` ${prefix}-unknown` : ""}`, onChange: event => actions.editText(generation, child.id, event.currentTarget.value) })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-delivery`, children: t("delivery") }), _jsxs("select", { id: `${prefix}-delivery`, value: draft.delivery, disabled: !canPrompt, "aria-describedby": `${prefix}-delivery-hint`, onChange: event => {
51
+ const value = event.currentTarget.value;
52
+ if (value === "queue" || value === "steer")
53
+ actions.setDelivery(generation, child.id, value);
54
+ }, children: [_jsx("option", { value: "queue", children: t("queue") }), _jsx("option", { value: "steer", children: t("steer") })] }), _jsx("p", { id: `${prefix}-delivery-hint`, className: "dsmm-hint", children: t("deliveryHint") })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("p", { id: `${prefix}-images-hint`, className: "dsmm-hint", children: t("imagesHint") }), _jsx("input", { ref: picker, hidden: true, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", multiple: true, disabled: !canImages, "aria-label": t("images"), onChange: event => {
55
+ const files = Array.from(event.currentTarget.files ?? []);
56
+ event.currentTarget.value = "";
57
+ if (canImages)
58
+ void actions.addImages(generation, child.id, files);
59
+ } }), _jsx(Button, { type: "button", variant: "outline", disabled: !canImages, "aria-describedby": `${prefix}-images-hint`, onClick: () => { if (canImages)
60
+ 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
+ }
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 })] })] });
64
+ }
65
+ /** Native session-scoped Conversation View, not a replacement composer or navigation shell. */
66
+ export function ChildrenPanel(props) {
67
+ const state = props.useChildren(snapshot => snapshot), { t } = props, generation = state.generation;
68
+ if (props.sessionId === undefined || props.sessionId !== state.sessionId)
69
+ return _jsxs("section", { className: "dsmm-profiles dsmm-children", children: [_jsx("h2", { children: t("title") }), _jsx("p", { children: t(state.sessionId === null ? "noSession" : "foreign") })] });
70
+ const data = state.snapshot;
71
+ 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") })
79
+ : 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
+ : _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
+ }
82
+ //# sourceMappingURL=ChildrenPanel.js.map
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { useEffect, useId, useMemo, useState, useSyncExternalStore } from "react";
3
3
  import { Button, Input } from "@deepseek-ai/dsh-client-ui-primitives";
4
4
  import { DeploymentController } from "./deployment-controller.js";
5
- import { at, enumValues, equal, inspectorPaths, mergeLayer, parseAdvanced, validateEditorValue } from "./deployment-data.js";
5
+ import { at, enumValues, equal, inspectorPaths, mergeLayer, parseAdvanced, validateEditorValue, visibleDeploymentPath } from "./deployment-data.js";
6
6
  import { deploymentFieldLabels } from "./deployment-locales.js";
7
7
  function label(path, t) {
8
8
  const key = path.at(-1);
@@ -59,16 +59,19 @@ function ScalarField({ schema, path, controller, disabled, inherited, invalid, t
59
59
  } }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || value === undefined && !bad, onClick: () => { setText(String(inherited ?? "")); setBad(false); invalid(name, false); controller.edit(path, undefined); }, children: t("inherit") })] }), _jsxs("p", { id: `${id}-error`, className: "dsmm-hint", children: [bad ? t("invalid") : "", schema.type === "number" && (schema.min !== undefined || schema.max !== undefined) ? ` ${schema.min ?? "—"} – ${schema.max ?? "—"}` : ""] })] });
60
60
  }
61
61
  function Field({ schema, path, controller, invalid, t }) {
62
+ if (schema.type === "transform" && schema.inner !== undefined)
63
+ schema = schema.inner;
62
64
  const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), snapshot = state.snapshot;
63
65
  const id = useId(), name = path.join("."), explicit = at(state.draft, path);
64
66
  const inherited = controller.layer === "global" ? at(snapshot.defaults, path) : at(mergeLayer(mergeLayer(snapshot.defaults, snapshot.global), snapshot.nativeForm?.base ?? {}), path);
65
67
  const disabled = state.busy || state.issue === "not-owned" || state.issue === "unavailable" || state.issue === "transport" || controller.layer === "profile" && !controller.canWriteProfile();
66
68
  const choices = enumValues(schema);
67
- if (schema.type === "object" && schema.fields !== undefined && path[0] !== "roleRouting" && path[0] !== "lsp")
68
- return _jsxs("details", { className: "dsmm-deployment-group", children: [_jsxs("summary", { children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsx("div", { children: Object.entries(schema.fields).map(([key, node]) => _jsx(Field, { schema: node, path: [...path, key], controller: controller, invalid: invalid, t: t }, key)) })] });
69
+ const hint = name === "modelParameters.passthrough" ? "modelParametersHint" : name === "permissionControl.enabled" ? "permissionControlHint" : null;
70
+ if (schema.type === "object" && schema.fields !== undefined && path[0] !== "roleRouting")
71
+ return _jsxs("details", { className: "dsmm-deployment-group", children: [_jsxs("summary", { children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsx("div", { children: Object.entries(schema.fields).filter(([key]) => visibleDeploymentPath([...path, key])).map(([key, node]) => _jsx(Field, { schema: node, path: [...path, key], controller: controller, invalid: invalid, t: t }, key)) })] });
69
72
  if (!["boolean", "string", "number"].includes(schema.type) && choices === null)
70
73
  return _jsx(AdvancedField, { schema: schema, path: path, value: explicit, inherited: inherited, upper: controller.layer === "global" ? at(snapshot.profile, path) : undefined, reset: snapshot, disabled: disabled, t: t, onChange: value => controller.edit(path, value), setInvalid: invalid });
71
- return _jsxs("div", { className: "dsmm-field dsmm-deployment-field", children: [schema.type === "boolean" || choices !== null ? _jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: id, children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsxs("select", { id: id, disabled: disabled, value: explicit === undefined ? "inherit" : JSON.stringify(explicit), onChange: event => controller.edit(path, event.currentTarget.value === "inherit" ? undefined : JSON.parse(event.currentTarget.value)), children: [_jsxs("option", { value: "inherit", children: [t("inherit"), " \u00B7 ", displayValue(inherited, t)] }), (choices ?? [true, false]).map(choice => _jsx("option", { value: JSON.stringify(choice), children: displayValue(choice, t) }, String(choice)))] })] }) : _jsx(ScalarField, { schema: schema, path: path, controller: controller, disabled: disabled, inherited: inherited, invalid: invalid, t: t }), (explicit !== undefined || controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined) && _jsxs("p", { className: "dsmm-hint", children: [explicit === undefined ? "" : equal(explicit, at(snapshot.defaults, path)) ? t("defaultPin") : t("explicit"), controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined ? `${explicit === undefined ? "" : " · "}${t("hostPin")}` : ""] })] });
74
+ return _jsxs("div", { className: "dsmm-field dsmm-deployment-field", children: [schema.type === "boolean" || choices !== null ? _jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: id, children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsxs("select", { id: id, disabled: disabled, "aria-describedby": hint === null ? undefined : `${id}-hint`, value: explicit === undefined ? "inherit" : JSON.stringify(explicit), onChange: event => controller.edit(path, event.currentTarget.value === "inherit" ? undefined : JSON.parse(event.currentTarget.value)), children: [_jsxs("option", { value: "inherit", children: [t("inherit"), " \u00B7 ", displayValue(inherited, t)] }), (choices ?? [true, false]).map(choice => _jsx("option", { value: JSON.stringify(choice), children: displayValue(choice, t) }, String(choice)))] })] }) : _jsx(ScalarField, { schema: schema, path: path, controller: controller, disabled: disabled, inherited: inherited, invalid: invalid, t: t }), hint !== null && _jsx("p", { id: `${id}-hint`, className: "dsmm-hint", children: t(hint) }), (explicit !== undefined || controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined) && _jsxs("p", { className: "dsmm-hint", children: [explicit === undefined ? "" : equal(explicit, at(snapshot.defaults, path)) ? t("defaultPin") : t("explicit"), controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined ? `${explicit === undefined ? "" : " · "}${t("hostPin")}` : ""] })] });
72
75
  }
73
76
  function Layer({ controller, t }) {
74
77
  const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
@@ -80,7 +83,7 @@ function Layer({ controller, t }) {
80
83
  next.delete(path); return next; }); };
81
84
  const title = controller.layer === "global" ? "global" : "profile";
82
85
  const disabled = state.busy || state.snapshot === null || state.issue !== null || invalid.size > 0 || controller.layer === "profile" && !controller.canWriteProfile();
83
- return _jsxs("div", { "data-dsmm-layer": controller.layer, "aria-busy": state.busy, children: [_jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t(title), _jsx("span", { role: "status", "aria-live": "polite", className: "dsmm-hint", children: state.busy ? t("saving") : state.dirty ? t("dirty") : state.saved ? t("saved") : "" })] }), _jsxs("fieldset", { children: [_jsx("legend", { children: t(title) }), _jsx("p", { className: "dsmm-hint", children: t(title === "global" ? "globalHint" : "profileHint") }), state.snapshot !== null && Object.entries(state.snapshot.schema.fields ?? {}).filter(([key]) => controller.layer === "global" || key !== "modules").sort(([a], [b]) => a === "modules" ? -1 : b === "modules" ? 1 : 0).map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, invalid: updateInvalid, t: t }, key)), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: disabled || !state.dirty, onClick: () => { void controller.save(); }, children: t(state.busy ? "saving" : title === "global" ? "saveGlobal" : "saveProfile") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => { void controller.refresh(); }, children: t("refresh") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy || !state.dirty && state.issue === null, onClick: () => { setInvalid(new Set()); void controller.refresh(true); }, children: t("discard") })] })] })] }), state.issue !== null && _jsx("p", { className: "dsmm-issue", role: "alert", children: t(state.issue) }), invalid.size > 0 && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("invalid") }), controller.layer === "profile" && !controller.canWriteProfile() && _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") })] });
86
+ return _jsxs("div", { "data-dsmm-layer": controller.layer, "aria-busy": state.busy, children: [_jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t(title), _jsx("span", { role: "status", "aria-live": "polite", className: "dsmm-hint", children: state.busy ? t("saving") : state.dirty ? t("dirty") : state.saved ? t("saved") : "" })] }), _jsxs("fieldset", { children: [_jsx("legend", { children: t(title) }), _jsx("p", { className: "dsmm-hint", children: t(title === "global" ? "globalHint" : "profileHint") }), state.snapshot !== null && _jsxs(_Fragment, { children: [_jsxs("details", { className: "dsmm-deployment-group", children: [_jsx("summary", { children: t("core") }), _jsxs("div", { children: [_jsx("p", { className: "dsmm-hint", children: t("coreHint") }), Object.entries(state.snapshot.schema.fields ?? {}).filter(([key]) => key === "modelParameters" || key === "permissionControl").map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, invalid: updateInvalid, t: t }, key))] })] }), Object.entries(state.snapshot.schema.fields ?? {}).filter(([key]) => visibleDeploymentPath([key]) && key !== "modelParameters" && key !== "permissionControl" && (controller.layer === "global" || key !== "modules")).sort(([a], [b]) => a === "modules" ? -1 : b === "modules" ? 1 : 0).map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, invalid: updateInvalid, t: t }, key))] }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: disabled || !state.dirty, onClick: () => { void controller.save(); }, children: t(state.busy ? "saving" : title === "global" ? "saveGlobal" : "saveProfile") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => { void controller.refresh(); }, children: t("refresh") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy || !state.dirty && state.issue === null, onClick: () => { setInvalid(new Set()); void controller.refresh(true); }, children: t("discard") })] })] })] }), state.issue !== null && _jsx("p", { className: "dsmm-issue", role: "alert", children: t(state.issue) }), invalid.size > 0 && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("invalid") }), controller.layer === "profile" && !controller.canWriteProfile() && _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") })] });
84
87
  }
85
88
  function NativeProfileLayer({ namespace, forms, remote, form, core, t }) {
86
89
  const shared = useMemo(() => forms.get(namespace), [forms, namespace]);
@@ -101,10 +104,11 @@ function StateInspector({ controller, session, t }) {
101
104
  if (snapshot === null)
102
105
  return null;
103
106
  const admitted = session?.configuration ?? null;
107
+ const restartRequired = (snapshot.nextRoot?.restartRequired ?? []).filter(path => visibleDeploymentPath(path.split(".")));
104
108
  const source = (value) => t(value === "profile" ? "profileSource" : value === "global" ? "globalSource" : value === "defaults" ? "defaultsSource" : value === "named-session" ? "namedSource" : value === "startup" ? "startupSource" : value === "deployment" ? "deploymentCapture" : value === "mixed" ? "mixedSource" : "unknown");
105
109
  const value = (layer, path) => layer === undefined ? t("unknown") : at(layer, path.split(".")) === undefined ? t("absent") : displayValue(at(layer, path.split(".")), t);
106
110
  const metadata = (layer, path, entry) => layer !== undefined && at(layer, path.split(".")) === undefined && entry === undefined ? t("absent") : source(entry);
107
- return _jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t("state"), _jsx("span", { className: "dsmm-hint", children: (snapshot.nextRoot?.restartRequired.length ?? 0) > 0 ? t("pending") : dirty || issue !== null ? t("inspectorStale") : "" })] }), _jsxs("div", { children: [_jsx("p", { role: "status", "aria-live": "polite", children: session === null ? t("noSession") : admitted === null ? t("sessionUnavailable") : `${t("namedSource")}: ${admitted.named?.id ?? "—"}` }), session !== null && _jsxs("p", { children: [t("session"), ": ", _jsx("code", { children: session.sessionId }), " \u00B7 ", _jsx("code", { children: session.admissionEpoch }), " \u00B7 ", session.scope] }), (dirty || issue !== null) && _jsx("p", { className: "dsmm-hint", children: t("inspectorStale") }), _jsxs("p", { className: "dsmm-hint", children: ["Global CAS: ", _jsx("code", { children: snapshot.globalRevision }), " \u00B7 native CAS: ", _jsx("code", { children: snapshot.nativeRevision }), " \u00B7 Host form: ", snapshot.nativeFormRevision ?? "—"] }), inspectorPaths(snapshot, admitted).map(path => _jsxs("dl", { className: "dsmm-deployment-state", children: [_jsx("dt", { children: _jsx("code", { children: path }) }), _jsxs("dd", { children: [t("globalSource"), ": ", at(snapshot.global, path.split(".")) === undefined ? t("absent") : t("globalSource")] }), _jsxs("dd", { children: [t("desired"), ": ", value(snapshot.desired, path), " \u00B7 ", metadata(snapshot.desired, path, snapshot.sources[path])] }), _jsxs("dd", { children: [t("startup"), ": ", value(snapshot.startup, path), " \u00B7 ", metadata(snapshot.startup, path, snapshot.startupSources?.[path]), " / ", at(snapshot.startup, path.split(".")) === undefined ? t("absent") : t("startupSource")] }), _jsxs("dd", { children: [t("next"), ": ", value(snapshot.nextRoot?.settings, path), " \u00B7 ", metadata(snapshot.nextRoot?.settings, path, snapshot.nextRoot?.sources[path]), " / ", metadata(snapshot.nextRoot?.settings, path, snapshot.nextRoot?.captures[path])] }), _jsxs("dd", { children: [t("session"), ": ", value(admitted?.settings, path), " \u00B7 ", metadata(admitted?.settings, path, admitted?.sources[path]), " / ", metadata(admitted?.settings, path, admitted?.captures[path])] })] }, path)), (snapshot.nextRoot?.restartRequired.length ?? 0) > 0 && _jsxs("p", { children: [t("pending"), ": ", snapshot.nextRoot.restartRequired.join(", ")] })] })] });
111
+ return _jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t("state"), _jsx("span", { className: "dsmm-hint", children: restartRequired.length > 0 ? t("pending") : dirty || issue !== null ? t("inspectorStale") : "" })] }), _jsxs("div", { children: [_jsx("p", { role: "status", "aria-live": "polite", children: session === null ? t("noSession") : admitted === null ? t("sessionUnavailable") : `${t("namedSource")}: ${admitted.named?.id ?? "—"}` }), session !== null && _jsxs("p", { children: [t("session"), ": ", _jsx("code", { children: session.sessionId }), " \u00B7 ", _jsx("code", { children: session.admissionEpoch }), " \u00B7 ", session.scope] }), (dirty || issue !== null) && _jsx("p", { className: "dsmm-hint", children: t("inspectorStale") }), _jsxs("p", { className: "dsmm-hint", children: ["Global CAS: ", _jsx("code", { children: snapshot.globalRevision }), " \u00B7 native CAS: ", _jsx("code", { children: snapshot.nativeRevision }), " \u00B7 Host form: ", snapshot.nativeFormRevision ?? "—"] }), inspectorPaths(snapshot, admitted).map(path => _jsxs("dl", { className: "dsmm-deployment-state", children: [_jsx("dt", { children: _jsx("code", { children: path }) }), _jsxs("dd", { children: [t("globalSource"), ": ", at(snapshot.global, path.split(".")) === undefined ? t("absent") : t("globalSource")] }), _jsxs("dd", { children: [t("desired"), ": ", value(snapshot.desired, path), " \u00B7 ", metadata(snapshot.desired, path, snapshot.sources[path])] }), _jsxs("dd", { children: [t("startup"), ": ", value(snapshot.startup, path), " \u00B7 ", metadata(snapshot.startup, path, snapshot.startupSources?.[path]), " / ", at(snapshot.startup, path.split(".")) === undefined ? t("absent") : t("startupSource")] }), _jsxs("dd", { children: [t("next"), ": ", value(snapshot.nextRoot?.settings, path), " \u00B7 ", metadata(snapshot.nextRoot?.settings, path, snapshot.nextRoot?.sources[path]), " / ", metadata(snapshot.nextRoot?.settings, path, snapshot.nextRoot?.captures[path])] }), _jsxs("dd", { children: [t("session"), ": ", value(admitted?.settings, path), " \u00B7 ", metadata(admitted?.settings, path, admitted?.sources[path]), " / ", metadata(admitted?.settings, path, admitted?.captures[path])] })] }, path)), restartRequired.length > 0 && _jsxs("p", { children: [t("pending"), ": ", restartRequired.join(", ")] })] })] });
108
112
  }
109
113
  export function DeploymentPage(props) {
110
114
  const state = useSyncExternalStore(props.core.subscribe, props.core.getSnapshot);
@@ -112,8 +116,11 @@ export function DeploymentPage(props) {
112
116
  void props.core.refresh(); }, [props.core, props.view]);
113
117
  if (props.view === "summary")
114
118
  return _jsx("span", { children: props.t("summary") });
115
- const { t } = props, snapshot = state.snapshot, module = snapshot?.modules[0];
116
- return _jsxs("section", { className: "dsmm-profiles dsmm-deployment", "data-dsmm-page": true, "aria-label": t("title"), children: [_jsx("p", { className: "dsmm-hint", children: t("description") }), _jsx("p", { className: "dsmm-hint", children: t("boundaries") }), _jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t("module"), _jsx("span", { className: "dsmm-hint", children: module?.pending ? t("pending") : module === undefined ? t("unknown") : t(module.desired.enabled ? "on" : "off") })] }), _jsxs("div", { children: [_jsx("p", { children: t("hostUnknown") }), _jsxs("p", { children: [t("desired"), ": ", module === undefined ? t("unknown") : t(module.desired.enabled ? "on" : "off"), " \u00B7 ", module?.desired.source ?? "—"] }), _jsxs("p", { children: [t("startup"), ": ", module === undefined ? t("unknown") : t(module.startupMounted ? "on" : "off"), " \u00B7 ", t("next"), ": ", module === undefined ? t("unknown") : t(module.nextRoot.admitted ? "on" : "off")] }), _jsxs("p", { children: [t("session"), ": ", state.session?.modules?.[0]?.admitted == null ? t("unknown") : t(state.session.modules[0].admitted ? "on" : "off")] }), _jsx("p", { className: "dsmm-hint", children: t("ceiling") })] })] }), _jsx(Layer, { controller: props.core, t: t }), props.profilePage && props.forms !== undefined && snapshot?.namespace !== null && snapshot?.namespace !== undefined && (props.rowNamespace === undefined || props.rowNamespace === snapshot.namespace)
119
+ const { t } = props, snapshot = state.snapshot;
120
+ return _jsxs("section", { className: "dsmm-profiles dsmm-deployment", "data-dsmm-page": true, "aria-label": t("title"), children: [_jsx("p", { className: "dsmm-hint", children: t("description") }), _jsx("p", { className: "dsmm-hint", children: t("boundaries") }), snapshot?.modules.map(module => {
121
+ const admitted = state.session?.modules?.find(value => value.descriptor.id === module.descriptor.id)?.admitted;
122
+ return _jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [module.descriptor.label, _jsx("span", { className: "dsmm-hint", children: module.pending ? t("pending") : t(module.desired.enabled ? "on" : "off") })] }), _jsxs("div", { children: [_jsx("p", { children: t("hostUnknown") }), _jsxs("p", { children: [t("desired"), ": ", t(module.desired.enabled ? "on" : "off"), " \u00B7 ", module.desired.source] }), _jsxs("p", { children: [t("startup"), ": ", module.startupMounted == null ? t("unknown") : t(module.startupMounted ? "on" : "off"), " \u00B7 ", t("next"), ": ", module.nextRoot.admitted == null ? t("unknown") : t(module.nextRoot.admitted ? "on" : "off")] }), _jsxs("p", { children: [t("session"), ": ", admitted == null ? t("unknown") : t(admitted ? "on" : "off")] }), _jsx("p", { className: "dsmm-hint", children: t(module.descriptor.id === "deepwork" ? "ceiling" : "permissionControlHint") })] })] }, module.descriptor.id);
123
+ }), _jsx(Layer, { controller: props.core, t: t }), props.profilePage && props.forms !== undefined && snapshot?.namespace !== null && snapshot?.namespace !== undefined && (props.rowNamespace === undefined || props.rowNamespace === snapshot.namespace)
117
124
  ? _jsx(NativeProfileLayer, { namespace: snapshot.namespace, forms: props.forms, remote: props.remote, form: props.form, core: props.core, t: t }, `${snapshot.hostProfileKey}:${snapshot.entryId}`)
118
125
  : _jsxs("div", { children: [_jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t("profile"), _jsx("span", { className: "dsmm-hint", children: t("profileUnavailable") })] }), _jsx("div", { children: _jsx("p", { children: t("profileHint") }) })] }), _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") })] }), _jsx(StateInspector, { controller: props.core, session: state.session, t: t })] });
119
126
  }
@@ -0,0 +1,17 @@
1
+ export interface EditableChoiceOption {
2
+ id: string;
3
+ name: string;
4
+ }
5
+ export interface EditableChoiceProps {
6
+ id: string;
7
+ label: string;
8
+ value: string;
9
+ options: readonly EditableChoiceOption[];
10
+ disabled: boolean;
11
+ placeholder?: string;
12
+ onChange(value: string): void;
13
+ onSelect?(value: string): void;
14
+ }
15
+ /** Suggestions are advisory; the one input always retains the exact typed value. */
16
+ export declare function EditableChoice({ id, label, value, options, disabled, placeholder, onChange, onSelect }: EditableChoiceProps): import("react").JSX.Element;
17
+ //# sourceMappingURL=EditableChoice.d.ts.map
@@ -0,0 +1,49 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { Button, IconChevronDownOutlineRegular, Input } from "@deepseek-ai/dsh-client-ui-primitives";
4
+ /** Suggestions are advisory; the one input always retains the exact typed value. */
5
+ export function EditableChoice({ id, label, value, options, disabled, placeholder, onChange, onSelect }) {
6
+ const input = useRef(null);
7
+ const [open, setOpen] = useState(false);
8
+ const [activeId, setActiveId] = useState(null);
9
+ const distinct = new Map(options.map(option => [option.id, option]));
10
+ if (value !== "" && !distinct.has(value))
11
+ distinct.set(value, { id: value, name: value });
12
+ const choices = [...distinct.values()];
13
+ const activeIndex = choices.findIndex(option => option.id === activeId);
14
+ const visible = open && !disabled && choices.length > 0;
15
+ const close = () => { setOpen(false); setActiveId(null); };
16
+ const choose = (next) => { if (next !== value)
17
+ (onSelect ?? onChange)(next); close(); };
18
+ useEffect(() => { if (disabled)
19
+ close(); }, [disabled]);
20
+ useEffect(() => {
21
+ if (activeId !== null && activeIndex < 0)
22
+ setActiveId(null);
23
+ }, [activeId, activeIndex]);
24
+ useEffect(() => {
25
+ if (visible && activeIndex >= 0)
26
+ document.getElementById(`${id}-choice-${activeIndex}`)?.scrollIntoView({ block: "nearest" });
27
+ }, [id, visible, activeIndex]);
28
+ return _jsxs("div", { className: "dsmm-choice", children: [_jsx(Input, { ref: input, id: id, className: "dsmm-input", role: "combobox", "aria-autocomplete": "list", "aria-expanded": visible, "aria-controls": visible ? `${id}-choices` : undefined, "aria-activedescendant": visible && activeIndex >= 0 ? `${id}-choice-${activeIndex}` : undefined, value: value, disabled: disabled, placeholder: placeholder, autoComplete: "off", onBlur: close, onChange: event => { onChange(event.currentTarget.value); setOpen(true); setActiveId(null); }, onKeyDown: event => {
29
+ if (event.nativeEvent.isComposing)
30
+ return;
31
+ if ((event.key === "ArrowDown" || event.key === "ArrowUp") && choices.length > 0) {
32
+ event.preventDefault();
33
+ event.stopPropagation();
34
+ setOpen(true);
35
+ const next = event.key === "ArrowDown" ? !visible || activeIndex < 0 ? 0 : (activeIndex + 1) % choices.length
36
+ : !visible || activeIndex < 0 ? choices.length - 1 : (activeIndex - 1 + choices.length) % choices.length;
37
+ setActiveId(choices[next].id);
38
+ }
39
+ else if (visible && (event.key === "Escape" || event.key === "Enter")) {
40
+ event.preventDefault();
41
+ event.stopPropagation();
42
+ if (event.key === "Enter" && activeIndex >= 0)
43
+ choose(choices[activeIndex].id);
44
+ else
45
+ close();
46
+ }
47
+ } }), _jsx(Button, { type: "button", size: "sm", variant: "toolbar", tabIndex: -1, className: "dsmm-choice-toggle", "aria-label": label, "aria-haspopup": "listbox", "aria-expanded": visible, disabled: disabled || choices.length === 0, icon: _jsx(IconChevronDownOutlineRegular, {}), onMouseDown: event => event.preventDefault(), onClick: () => { input.current?.focus(); setOpen(!visible); setActiveId(null); } }), visible && _jsx("ul", { className: "dsmm-choice-list", id: `${id}-choices`, role: "listbox", "aria-label": label, children: choices.map((option, index) => _jsx("li", { id: `${id}-choice-${index}`, role: "option", "data-value": option.id, "aria-selected": option.id === activeId, onMouseDown: event => event.preventDefault(), onClick: () => choose(option.id), children: option.name === option.id ? option.id : `${option.name} (${option.id})` }, option.id)) })] });
48
+ }
49
+ //# sourceMappingURL=EditableChoice.js.map
@@ -0,0 +1,14 @@
1
+ import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
2
+ import type { PermissionController, PermissionView } from "./permission-controller.js";
3
+ type Locale = PropsLocale<"settings.dsmm-permissions">;
4
+ export type PermissionsPanelProps = Locale & {
5
+ controller: PermissionController;
6
+ sessionId?: string;
7
+ };
8
+ export declare function PermissionRulesEditor({ controller, state, t }: Locale & {
9
+ controller: PermissionController;
10
+ state: PermissionView;
11
+ }): import("react").JSX.Element;
12
+ export declare function PermissionsPanel({ controller, t, sessionId }: PermissionsPanelProps): import("react").JSX.Element | null;
13
+ export {};
14
+ //# sourceMappingURL=PermissionsPanel.d.ts.map
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useId, useSyncExternalStore } from "react";
3
+ import { Button, Input } from "@deepseek-ai/dsh-client-ui-primitives";
4
+ const actions = ["inherit", "allow", "ask", "deny"];
5
+ const kinds = ["outside-read", "shell", "webSearch", "webFetch"];
6
+ const ruleDraft = (rule) => ({ id: rule.id, action: rule.action, match: structuredClone(rule.match) });
7
+ const newMatch = (kind) => kind === "outside-read" ? { kind, path: "", scope: "exact" } : kind === "shell" ? { kind, executable: "", command: "", workingDirectory: "" } : { kind };
8
+ function Issue({ value, t }) { return value === null ? null : _jsxs("p", { className: "dsmm-issue", role: "alert", children: [t(`issue:${value}`), " ", _jsx("code", { children: value })] }); }
9
+ function RootState({ state, t }) {
10
+ return _jsxs(_Fragment, { children: [_jsxs("p", { children: [t("root"), ": ", _jsx("code", { children: state.sessionId ?? "—" })] }), state.scope !== "root" && _jsx("p", { className: "dsmm-hint", children: t(state.scope === "child" ? "child" : "noRoot") }), !state.connected && _jsx("p", { className: "dsmm-hint", children: t("unknown") })] });
11
+ }
12
+ function ActionSelect({ id, value, inherit = true, onChange, disabled, t }) {
13
+ return _jsx("select", { id: id, value: value, disabled: disabled, onChange: event => { const choice = actions.find(value => value === event.currentTarget.value); if (choice !== undefined)
14
+ onChange(choice); }, children: actions.filter(value => inherit || value !== "inherit").map(value => _jsx("option", { value: value, children: t(value === "inherit" ? "inherit" : `action:${value}`) }, value)) });
15
+ }
16
+ function RuleEditor({ controller, state, t }) {
17
+ const id = useId(), editor = state.draft?.editor;
18
+ if (editor == null)
19
+ return null;
20
+ const disabled = state.busy !== null, change = (value) => controller.edit(state.generation, { editor: value });
21
+ const field = (key, label) => _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-${key}`, children: t(label) }), _jsx(Input, { className: "dsmm-input", id: `${id}-${key}`, required: true, maxLength: 32768, disabled: disabled, value: key in editor.match ? String(Reflect.get(editor.match, key)) : "", onChange: event => change({ ...editor, match: { ...editor.match, [key]: event.currentTarget.value } }) })] });
22
+ return _jsxs("form", { className: "dsmm-structured", "aria-label": t("editor"), onSubmit: event => { event.preventDefault(); controller.stageRule(state.generation); }, children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-id`, children: t("id") }), _jsx(Input, { className: "dsmm-input", id: `${id}-id`, required: true, maxLength: 256, value: editor.id, disabled: disabled, onChange: event => change({ ...editor, id: event.currentTarget.value }) })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-action`, children: t("action") }), _jsx(ActionSelect, { id: `${id}-action`, value: editor.action, disabled: disabled, inherit: false, t: t, onChange: action => { if (action !== "inherit")
23
+ change({ ...editor, action }); } })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-kind`, children: t("match") }), _jsx("select", { id: `${id}-kind`, value: editor.match.kind, disabled: disabled, onChange: event => { const kind = kinds.find(value => value === event.currentTarget.value); if (kind !== undefined)
24
+ change({ ...editor, match: newMatch(kind) }); }, children: kinds.map(kind => _jsx("option", { value: kind, children: t(`kind:${kind}`) }, kind)) })] }), editor.match.kind === "outside-read" && _jsxs(_Fragment, { children: [field("path", "path"), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-path-scope`, children: t("pathScope") }), _jsxs("select", { id: `${id}-path-scope`, value: editor.match.scope, disabled: disabled, onChange: event => { const scope = event.currentTarget.value; if (editor.match.kind === "outside-read" && (scope === "exact" || scope === "tree"))
25
+ change({ ...editor, match: { ...editor.match, scope } }); }, children: [_jsx("option", { value: "exact", children: t("exact") }), _jsx("option", { value: "tree", children: t("tree") })] })] })] }), editor.match.kind === "shell" && _jsxs(_Fragment, { children: [field("executable", "executable"), field("command", "command"), field("workingDirectory", "cwd")] }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "submit", variant: "outline", disabled: disabled, children: t("stage") }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => controller.edit(state.generation, { editor: null }), children: t("cancel") })] })] });
26
+ }
27
+ function RuleRecords({ controller, state, t }) {
28
+ const records = state.rules?.snapshot.policy.rules ?? state.base?.policy.rules;
29
+ return _jsxs("div", { className: "dsmm-structured", children: [records?.length === 0 && _jsx("p", { children: t("noRules") }), records?.map(rule => _jsxs("fieldset", { children: [_jsx("legend", { children: rule.id }), _jsxs("p", { children: [t(rule.revoked ? "revoked" : "active"), " \u00B7 ", t(`action:${rule.action}`)] }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("match") }), _jsx("dd", { children: t(`kind:${rule.match.kind}`) }), rule.match.kind === "outside-read" && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("path") }), _jsxs("dd", { children: [rule.match.path, " \u00B7 ", t(rule.match.scope)] })] }), rule.match.kind === "shell" && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("executable") }), _jsx("dd", { children: rule.match.executable }), _jsx("dt", { children: t("command") }), _jsx("dd", { children: _jsx("code", { children: rule.match.command }) }), _jsx("dt", { children: t("cwd") }), _jsx("dd", { children: rule.match.workingDirectory })] }), _jsx("dt", { children: t("recordVersion") }), _jsx("dd", { children: rule.revision }), _jsx("dt", { children: t("source") }), _jsxs("dd", { children: [t(rule.source.kind === "operator" ? "operator" : "imported"), " \u00B7 ", rule.source.kind === "operator" ? rule.source.sessionId : rule.source.label] }), rule.source.kind === "operator" && _jsxs(_Fragment, { children: [_jsx("dt", { children: t("savedAt") }), _jsx("dd", { children: String(rule.source.savedAt) })] })] }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: state.busy !== null || state.draft === null, onClick: () => controller.edit(state.generation, { editor: ruleDraft(rule) }), children: t("editRule") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy !== null || state.draft === null || rule.revoked || state.draft.revoke.includes(rule.id), onClick: () => controller.stageRevoke(state.generation, rule.id), children: t("stageRevoke") })] })] }, rule.id))] });
30
+ }
31
+ function PermissionCoverage({ state, t }) {
32
+ const value = state.rules?.capabilities;
33
+ return _jsxs("section", { className: "dsmm-structured", "aria-label": t("coverageTitle"), children: [_jsx("h3", { children: t("coverageTitle") }), _jsx("p", { className: "dsmm-hint", children: t("coverage") }), value === undefined ? _jsx("p", { children: t("coverageUnavailable") }) : _jsxs(_Fragment, { children: [_jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("coverageRuntime") }), _jsxs("dd", { children: [t(value.runtime.state), " \u00B7 ", t("mounted"), ": ", t(value.runtime.mounted ? "on" : "off")] }), _jsx("dt", { children: t("coverageRevision") }), _jsx("dd", { children: _jsx("code", { children: value.runtime.runtimeRevision }) })] }), value.runtime.restartRequired && _jsx("p", { children: t("restart") }), value.tools.length === 0 ? _jsx("p", { children: t("coverageEmpty") }) : _jsx("ul", { className: "dsmm-profile-list", children: value.tools.map(tool => _jsx("li", { children: _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("toolName") }), _jsx("dd", { children: _jsx("code", { children: tool.name }) }), _jsx("dt", { children: t("toolKind") }), _jsx("dd", { children: _jsx("code", { children: tool.kind }) }), _jsx("dt", { children: t("toolApproval") }), _jsx("dd", { children: t("nativeOnce") }), _jsx("dt", { children: t("toolMemory") }), _jsx("dd", { children: t("notProvided") })] }) }, tool.name)) }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("outsideReads") }), _jsx("dd", { children: t("limit:outsideReads") }), _jsx("dt", { children: t("finalInode") }), _jsx("dd", { children: t("limit:finalInode") }), _jsx("dt", { children: t("toolMemory") }), _jsx("dd", { children: t("limit:scopedMemory") }), _jsx("dt", { children: t("webFetch") }), _jsx("dd", { children: t("limit:webFetch") }), _jsx("dt", { children: t("searchDestinations") }), _jsx("dd", { children: t("limit:webSearchDestinations") }), _jsx("dt", { children: t("proxyBinding") }), _jsx("dd", { children: t("limit:proxyAddressBinding") }), _jsx("dt", { children: t("shellSockets") }), _jsx("dd", { children: t("limit:shellSockets") }), _jsx("dt", { children: t("providerAuthMcp") }), _jsx("dd", { children: t("limit:providerAuthMcp") })] })] }), _jsx("p", { className: "dsmm-hint", children: t("pathEvidence") })] });
34
+ }
35
+ export function PermissionRulesEditor({ controller, state, t }) {
36
+ const id = useId(), draft = state.draft, disabled = state.busy !== null, value = state.rules;
37
+ return _jsxs("section", { className: "dsmm-zone", "aria-label": t("rules"), children: [_jsx("h3", { children: t("rules") }), _jsx("p", { className: "dsmm-hint", children: t("rulesHint") }), _jsx("p", { className: "dsmm-hint", children: t("networkLimit") }), _jsx("p", { className: "dsmm-hint", children: t("matchHint") }), _jsx(Issue, { value: state.rulesIssue, t: t }), _jsxs("dl", { className: "dsmm-child-meta", children: [_jsx("dt", { children: t("base") }), _jsx("dd", { children: _jsx("code", { children: state.base?.revision ?? t("unknown") }) }), _jsx("dt", { children: t("savedRevision") }), _jsx("dd", { children: _jsx("code", { children: value?.runtime.savedRevision ?? t("unknown") }) }), _jsx("dt", { children: t("runtimeRevision") }), _jsx("dd", { children: _jsx("code", { children: value?.runtime.runtimeRevision ?? t("unknown") }) }), _jsx("dt", { children: t("runtime") }), _jsx("dd", { children: value === null ? t("unknown") : t(value.runtime.state) }), _jsx("dt", { children: t("mounted") }), _jsx("dd", { children: value === null ? t("unknown") : t(value.runtime.mounted ? "on" : "off") })] }), value?.runtime.restartRequired && _jsx("p", { children: t("restart") }), _jsx(PermissionCoverage, { state: state, t: t }), draft !== null && _jsxs(_Fragment, { children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-outside`, children: t("outsideReads") }), _jsx(ActionSelect, { id: `${id}-outside`, value: draft.outsideReads, disabled: disabled, t: t, onChange: outsideReads => controller.edit(state.generation, { outsideReads }) })] }), ["webSearch", "webFetch"].map(key => _jsxs("fieldset", { children: [_jsx("legend", { children: t(key) }), _jsxs("label", { className: "dsmm-actions", htmlFor: `${id}-${key}-enabled`, children: [_jsx("input", { type: "checkbox", id: `${id}-${key}-enabled`, checked: draft[key].enabled, disabled: disabled, onChange: event => controller.edit(state.generation, { [key]: { ...draft[key], enabled: event.currentTarget.checked } }) }), t("enabled")] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${id}-${key}-rule`, children: t("rule") }), _jsx(ActionSelect, { id: `${id}-${key}-rule`, value: draft[key].rule, disabled: disabled, t: t, onChange: rule => controller.edit(state.generation, { [key]: { ...draft[key], rule } }) })] })] }, key)), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || draft.editor !== null, onClick: () => controller.edit(state.generation, { editor: { id: "", action: "ask", match: newMatch("outside-read") } }), children: t("newRule") }), _jsx(RuleEditor, { controller: controller, state: state, t: t }), (draft.upsert.length > 0 || draft.revoke.length > 0) && _jsxs("div", { className: "dsmm-structured", children: [_jsx("h3", { children: t("staged") }), draft.upsert.map(row => _jsxs("div", { className: "dsmm-field", children: [_jsxs("p", { children: [row.id, " \u00B7 ", t(`kind:${row.match.kind}`), " \u00B7 ", t(`action:${row.action}`)] }), _jsxs(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => controller.edit(state.generation, { upsert: draft.upsert.filter(rule => rule.id !== row.id) }), children: [t("unstage"), ": ", row.id] })] }, row.id)), draft.revoke.map(ruleId => _jsxs("div", { className: "dsmm-field", children: [_jsxs("p", { children: [t("stageRevoke"), ": ", ruleId] }), _jsxs(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => controller.edit(state.generation, { revoke: draft.revoke.filter(id => id !== ruleId) }), children: [t("unstage"), ": ", ruleId] })] }, ruleId))] })] }), _jsx(RuleRecords, { state: state, controller: controller, t: t }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: !controller.canSave(state.generation), onClick: () => void controller.save(state.generation), children: t("save") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.scope !== "root" || !state.connected || state.reading || disabled, onClick: () => void controller.refresh(state.generation, true), children: t("discard") })] }), state.dirty && _jsx("p", { children: t("dirty") })] });
38
+ }
39
+ export function PermissionsPanel({ controller, t, sessionId }) {
40
+ const state = useSyncExternalStore(controller.store.subscribe, controller.store.getSnapshot);
41
+ useEffect(() => controller.watch(), [controller]);
42
+ if (sessionId !== undefined && sessionId !== state.sessionId)
43
+ return null;
44
+ return _jsxs("section", { className: "dsmm-profiles dsmm-children dsmm-permissions", "data-dsmm-permissions": true, "aria-label": t("title"), "aria-busy": state.reading || state.busy !== null, children: [_jsx("h2", { children: t("title") }), _jsx(RootState, { state: state, t: t }), _jsx("p", { className: "dsmm-hint", children: t("nativeApproval") }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", children: state.busy !== null ? t("busy") : state.notice === null ? "" : t(state.notice) }), _jsx(PermissionRulesEditor, { controller: controller, state: state, t: t })] });
45
+ }
46
+ //# sourceMappingURL=PermissionsPanel.js.map
@@ -5,6 +5,7 @@ import { canReconcileSelection } from "./controller.js";
5
5
  import { StructuredEditor } from "./StructuredEditor.js";
6
6
  import { SessionScope } from "./SessionProfiles.js";
7
7
  import { structuredDocument } from "./structured.js";
8
+ import { draftWarnings, IssueDetails, ProfileWarnings } from "./diagnostics.js";
8
9
  function issueKey(issue) {
9
10
  if (issue.source === "selection")
10
11
  return issue.code === "conflict" ? "selectionConflict" : "appliedInvalid";
@@ -22,6 +23,8 @@ export function ProfilesSection(props) {
22
23
  const selectRef = useRef(null);
23
24
  const inputRef = useRef(null);
24
25
  const editorRef = useRef(null);
26
+ const advancedRef = useRef(null);
27
+ const handledValidation = useRef(0);
25
28
  const cancelRef = useRef(null);
26
29
  const hadConfirmation = useRef(false);
27
30
  const disabled = state.busy !== null || state.pendingEditor !== null || state.sessionBusy === "apply" || state.sessionBusy === "reset";
@@ -32,7 +35,7 @@ export function ProfilesSection(props) {
32
35
  const reconcilable = canReconcileSelection(snapshot);
33
36
  const selectionConflict = reconcilable && snapshot?.selectionError?.code === "conflict";
34
37
  const invalid = state.issue?.kind === "domain" && state.issue.code === "validation";
35
- const idInvalid = invalid && state.issue?.field === "id";
38
+ const idInvalid = invalid && state.issue?.field === "id" && state.issue.location === undefined && editor?.revision === null && !editorDisabled;
36
39
  const rawInvalid = editor !== null && structuredDocument(editor.content) === null;
37
40
  useEffect(() => {
38
41
  if (state.pendingEditor !== null) {
@@ -45,24 +48,36 @@ export function ProfilesSection(props) {
45
48
  }
46
49
  }, [state.pendingEditor]);
47
50
  useEffect(() => {
48
- if (state.issue?.kind === "domain" && state.issue.code === "validation") {
49
- if (state.issue.field === "id")
50
- inputRef.current?.focus();
51
- else
52
- editorRef.current?.focus();
51
+ if (state.busy === null && state.validationEpoch > handledValidation.current && state.issue?.kind === "domain" && state.issue.code === "validation") {
52
+ handledValidation.current = state.validationEpoch;
53
+ if (state.issue.location === undefined && state.issue.field === "id" && inputRef.current !== null
54
+ && !inputRef.current.disabled && !inputRef.current.readOnly)
55
+ inputRef.current.focus();
56
+ else {
57
+ if (advancedRef.current !== null)
58
+ advancedRef.current.open = true;
59
+ const input = editorRef.current;
60
+ if (input !== null) {
61
+ input.focus();
62
+ const location = state.issue.location;
63
+ if (location !== undefined && location.offset + location.length <= input.value.length)
64
+ input.setSelectionRange(location.offset, location.offset + location.length);
65
+ }
66
+ }
53
67
  }
54
- }, [state.issue]);
55
- const applied = editor?.revision !== null && editor?.id === snapshot?.selectedId && editor?.revision === snapshot?.appliedRevision;
56
- let selection = t("baseline");
68
+ }, [state.issue, state.busy, state.validationEpoch]);
69
+ const applied = editor?.revision != null && editor.id === snapshot?.selectedId && editor.revision === snapshot?.appliedRevision;
70
+ let selection = t(snapshot === null ? "unavailable" : "baseline");
57
71
  if (snapshot?.selectionError !== undefined && !selectionConflict)
58
72
  selection = t("appliedInvalid");
59
73
  else if (snapshot?.selectedId !== null && snapshot?.selectedId !== undefined)
60
- selection = t("appliedProfile", { id: snapshot.selectedId, revision: snapshot.appliedRevision?.slice(0, 12) ?? "—" });
74
+ selection = t("appliedProfile", { id: snapshot.selectedId, revision: snapshot.appliedRevision ?? "—" });
61
75
  const notice = state.notice === null ? "" : t(state.notice.key === "reset" ? "resetDone" : state.notice.key, { id: state.notice.id });
62
- return _jsxs("section", { className: "dsmm-profiles", "aria-labelledby": `${prefix}-title`, "aria-busy": state.busy !== null, children: [_jsx("h2", { id: `${prefix}-title`, children: t("title") }), _jsx("p", { children: t("description") }), snapshot?.origin !== undefined && _jsx("p", { className: "dsmm-hint", children: t(snapshot.origin === "legacy" ? "legacyOrigin" : snapshot.origin === "central" ? "centralOrigin" : "explicitOrigin") }), readOnly && _jsx("p", { role: "status", className: "dsmm-hint", children: t("readOnlyOrigin") }), _jsx("h3", { id: `${prefix}-global`, children: t("globalScope") }), _jsx("p", { className: "dsmm-hint", children: t("newSessions") }), _jsx("p", { "data-dsmm-selection": true, children: selection }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || snapshot === null, onClick: () => { void props.create(); }, children: t("new") }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => { void props.refresh(); }, children: t(state.busy === "refresh" ? "refreshing" : "refresh") }), _jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || !reconcilable || (snapshot?.selectedId === null && !selectionConflict), onClick: () => { void props.reset(); }, children: t(state.busy === "reset" ? "resetting" : "reset") })] }), snapshot !== null && _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-select`, children: t("editorSelect") }), _jsxs("select", { ref: selectRef, id: `${prefix}-select`, disabled: disabled, value: editor?.revision == null ? "" : editor.id, onChange: (event) => { if (event.currentTarget.value)
63
- void props.open(event.currentTarget.value); }, children: [_jsx("option", { value: "", children: t(editor?.revision === null ? "newDraft" : "choose") }), snapshot.profiles.map((profile, index) => _jsxs("option", { value: profile.id, children: [profile.label === undefined ? profile.id : `${profile.label} (${profile.id})`, profile.error === undefined ? "" : ` — ${t("invalidProfile", { id: profile.id })}`] }, `${index}:${profile.id}`))] }), snapshot.profiles.length === 0 && _jsx("p", { className: "dsmm-hint", children: t("empty") })] }), state.pendingEditor !== null && _jsxs("div", { className: "dsmm-confirm", role: "group", "aria-labelledby": `${prefix}-confirm`, onKeyDown: (event) => { if (event.key === "Escape") {
64
- event.preventDefault();
65
- props.cancelDiscard();
66
- } }, children: [_jsx("p", { id: `${prefix}-confirm`, children: t("discardPrompt") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => { void props.discardAndOpen(); }, children: t("discard") }), _jsx(Button, { ref: cancelRef, type: "button", variant: "primary", onClick: props.cancelDiscard, children: t("cancel") })] })] }), _jsx(SessionScope, { state: state, actions: props, t: t }), _jsxs("div", { className: "dsmm-catalog", children: [_jsx("h3", { children: t("catalogTitle") }), _jsx("p", { className: "dsmm-hint", children: t("catalogHint") }), state.catalogUnavailable && _jsx("p", { className: "dsmm-hint", children: t("catalogUnavailable") }), state.catalog?.failures.map((failure) => _jsx("p", { className: "dsmm-hint", children: t("catalogFailure", { name: failure.name, id: failure.id }) }, failure.id)), _jsx(Button, { type: "button", variant: "outline", disabled: state.catalogBusy, onClick: () => { void props.refreshCatalog(); }, children: t(state.catalogBusy ? "catalogRefreshing" : "catalogRefresh") })] }), editor !== null && _jsxs("div", { className: "dsmm-editor", children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-id`, children: t("profileId") }), _jsx(Input, { ref: inputRef, id: `${prefix}-id`, className: "dsmm-input", value: editor.id, disabled: disabled || editor.revision !== null, "aria-invalid": idInvalid || undefined, "aria-describedby": `${prefix}-id-hint${idInvalid ? ` ${prefix}-issue` : ""}`, onChange: (event) => props.editId(event.currentTarget.value) }), _jsx("p", { id: `${prefix}-id-hint`, className: "dsmm-hint", children: t("idHint") })] }), _jsx(StructuredEditor, { state: state, actions: props, disabled: editorDisabled, t: t }, state.editorEpoch), _jsxs("details", { className: "dsmm-advanced", open: true, children: [_jsx("summary", { children: t("advanced") }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-content`, children: t("configuration") }), _jsx("textarea", { ref: editorRef, id: `${prefix}-content`, rows: 12, spellCheck: false, value: editor.content, readOnly: readOnly, disabled: disabled, "aria-invalid": rawInvalid || (invalid && !idInvalid) || undefined, "aria-describedby": `${prefix}-content-hint ${prefix}-structural-hint${invalid && !idInvalid ? ` ${prefix}-issue` : ""}`, onChange: (event) => props.editContent(event.currentTarget.value) }), _jsx("p", { id: `${prefix}-content-hint`, className: "dsmm-hint", children: t("configurationHint") }), _jsx("p", { id: `${prefix}-structural-hint`, className: "dsmm-hint", children: t("structuralHint") })] })] }), _jsx("p", { "data-dsmm-editor-state": true, children: t(state.dirty ? "dirty" : applied ? "savedApplied" : "savedNotApplied") }), _jsx("p", { id: `${prefix}-global-action`, className: "dsmm-hint", children: t("globalActionHint") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: editorDisabled || !state.dirty || snapshot === null || state.invalidFields.length > 0, onClick: () => { void props.save(); }, children: t(state.busy === "save" ? "saving" : "save") }), _jsx(Button, { type: "button", variant: "outline", "aria-describedby": `${prefix}-global-action`, disabled: editorDisabled || state.dirty || editor.revision === null || !reconcilable || (applied && !selectionConflict), onClick: () => { void props.apply(); }, children: t(state.busy === "apply" ? "applying" : "apply") }), editor.revision !== null && _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => { void props.reload(); }, children: t("reload") })] })] }), state.issue !== null && _jsx("div", { className: "dsmm-issue", id: `${prefix}-issue`, role: "alert", children: _jsx("p", { children: t(issueKey(state.issue)) }) }), snapshot?.selectionError !== undefined && _jsx("div", { className: "dsmm-issue", children: _jsx("p", { children: t(selectionConflict ? "selectionConflict" : "retry") }) }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.busy === "refresh" && snapshot === null ? t("loading") : state.busy === "read" ? t("reading") : notice })] });
76
+ const warnings = editor === null ? [] : draftWarnings(editor.content);
77
+ return _jsxs("section", { className: "dsmm-profiles", "aria-labelledby": `${prefix}-title`, "aria-busy": state.busy !== null, children: [_jsx("h2", { id: `${prefix}-title`, children: t("title") }), _jsx("p", { children: t("description") }), snapshot?.origin !== undefined && _jsx("p", { className: "dsmm-hint", children: t(snapshot.origin === "legacy" ? "legacyOrigin" : snapshot.origin === "central" ? "centralOrigin" : "explicitOrigin") }), readOnly && _jsx("p", { role: "status", className: "dsmm-hint", children: t("readOnlyOrigin") }), _jsxs("section", { className: "dsmm-zone", "aria-labelledby": `${prefix}-browse`, "data-dsmm-zone": "browse", children: [_jsx("h3", { id: `${prefix}-browse`, children: t("browseZone") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || snapshot === null, onClick: () => { void props.create(); }, children: t("new") }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => { void props.refresh(); }, children: t(state.busy === "refresh" ? "refreshing" : "refresh") })] }), snapshot !== null && _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-select`, children: t("editorSelect") }), _jsxs("select", { ref: selectRef, id: `${prefix}-select`, disabled: disabled, value: editor?.revision == null ? "" : editor.id, onChange: (event) => { if (event.currentTarget.value)
78
+ void props.open(event.currentTarget.value); }, children: [_jsx("option", { value: "", children: t(editor?.revision === null ? "newDraft" : "choose") }), snapshot.profiles.map((profile, index) => _jsxs("option", { value: profile.id, children: [profile.label?.trim() ? `${profile.label} (${profile.id})` : profile.id, profile.error === undefined ? "" : ` — ${t("invalidProfile", { id: profile.id })}`, profile.warnings?.length ? ` — ${t("warningProfile")}` : ""] }, `${index}:${profile.id}`))] }), snapshot.profiles.length === 0 && _jsx("p", { className: "dsmm-hint", children: t("empty") })] }), snapshot !== null && snapshot.profiles.length > 0 && _jsx("ul", { className: "dsmm-profile-list", "aria-label": t("savedInventory"), children: snapshot.profiles.map((profile, index) => _jsxs("li", { children: [_jsx("p", { children: profile.label?.trim() ? `${profile.label} (${profile.id})` : profile.id }), _jsx("p", { className: "dsmm-hint", children: t("savedRevision", { revision: profile.revision ?? "—" }) }), _jsx(ProfileWarnings, { warnings: profile.warnings, t: t }), profile.error !== undefined && _jsx(IssueDetails, { issue: profile.error, t: t })] }, `${index}:${profile.id}`)) }), state.pendingEditor !== null && _jsxs("div", { className: "dsmm-confirm", role: "group", "aria-labelledby": `${prefix}-confirm`, onKeyDown: (event) => { if (event.key === "Escape") {
79
+ event.preventDefault();
80
+ props.cancelDiscard();
81
+ } }, children: [_jsx("p", { id: `${prefix}-confirm`, children: t("discardPrompt") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => { void props.discardAndOpen(); }, children: t("discard") }), _jsx(Button, { ref: cancelRef, type: "button", variant: "primary", onClick: props.cancelDiscard, children: t("cancel") })] })] })] }), _jsxs("section", { className: "dsmm-zone", "aria-labelledby": `${prefix}-edit`, "data-dsmm-zone": "edit", children: [_jsx("h3", { id: `${prefix}-edit`, children: t("editZone") }), editor === null && _jsx("p", { className: "dsmm-hint", children: t("noEditor") }), editor !== null && _jsxs("div", { className: "dsmm-editor", children: [_jsx("p", { "data-dsmm-editor-state": true, children: t(state.dirty ? "dirty" : applied ? "savedApplied" : "savedNotApplied") }), _jsx("p", { className: "dsmm-hint", children: t("savedRevision", { revision: editor.revision ?? "—" }) }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: editorDisabled || !state.dirty || snapshot === null || state.invalidFields.length > 0, onClick: () => { void props.save(); }, children: t(state.busy === "save" ? "saving" : "save") }), editor.revision !== null && _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => { void props.reload(); }, children: t("reload") })] }), warnings.length > 0 && _jsxs("div", { children: [_jsx("p", { children: t("draftWarnings") }), _jsx(ProfileWarnings, { warnings: warnings, t: t })] }), editor.warnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("savedWarnings") }), _jsx(ProfileWarnings, { warnings: editor.warnings, t: t })] }) : null, _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-id`, children: t("profileId") }), _jsx(Input, { ref: inputRef, id: `${prefix}-id`, className: "dsmm-input", value: editor.id, disabled: editorDisabled || editor.revision !== null, "aria-invalid": idInvalid || undefined, "aria-describedby": `${prefix}-id-hint${idInvalid ? ` ${prefix}-issue` : ""}`, onChange: (event) => props.editId(event.currentTarget.value) }), _jsx("p", { id: `${prefix}-id-hint`, className: "dsmm-hint", children: t("idHint") })] }), _jsxs("div", { className: "dsmm-catalog", children: [_jsx("h3", { children: t("catalogTitle") }), _jsx("p", { className: "dsmm-hint", children: t("catalogHint") }), state.catalogUnavailable && _jsx("p", { className: "dsmm-hint", children: t("catalogUnavailable") }), state.catalog?.failures.map((failure) => _jsx("p", { className: "dsmm-hint", children: t("catalogFailure", { name: failure.name, id: failure.id }) }, failure.id)), _jsx(Button, { type: "button", variant: "outline", disabled: state.catalogBusy, onClick: () => { void props.refreshCatalog(); }, children: t(state.catalogBusy ? "catalogRefreshing" : "catalogRefresh") })] }), _jsx(StructuredEditor, { state: state, actions: props, disabled: editorDisabled, t: t }, `structured:${state.editorEpoch}`), _jsxs("details", { ref: advancedRef, className: "dsmm-advanced", children: [_jsx("summary", { children: t("advanced") }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-content`, children: t("configuration") }), _jsx("textarea", { ref: editorRef, id: `${prefix}-content`, rows: 12, spellCheck: false, value: editor.content, readOnly: readOnly, disabled: disabled, "aria-invalid": rawInvalid || (invalid && !idInvalid) || undefined, "aria-describedby": `${prefix}-content-hint ${prefix}-structural-hint${invalid && !idInvalid ? ` ${prefix}-issue` : ""}`, onChange: (event) => props.editContent(event.currentTarget.value) }), _jsx("p", { id: `${prefix}-content-hint`, className: "dsmm-hint", children: t("configurationHint") }), _jsx("p", { id: `${prefix}-structural-hint`, className: "dsmm-hint", children: t("structuralHint") })] })] }, `advanced:${state.editorEpoch}`)] }), state.issue !== null && _jsxs("div", { className: "dsmm-issue", id: `${prefix}-issue`, role: "alert", children: [_jsx("p", { children: t(issueKey(state.issue)) }), _jsx(IssueDetails, { issue: state.issue, t: t })] })] }), _jsxs("section", { className: "dsmm-zone", "aria-labelledby": `${prefix}-global`, "data-dsmm-zone": "future-default", children: [_jsx("h3", { id: `${prefix}-global`, children: t("globalScope") }), _jsx("p", { className: "dsmm-hint", children: t("newSessions") }), _jsx("p", { "data-dsmm-selection": true, children: selection }), _jsx("p", { className: "dsmm-hint", children: t("futurePin", { revision: snapshot?.selectionRevision ?? "—" }) }), snapshot?.selectedWarnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("futureWarnings") }), _jsx(ProfileWarnings, { warnings: snapshot.selectedWarnings, t: t })] }) : null, _jsx("p", { className: "dsmm-hint", children: t("savedOnlyHint") }), _jsx("p", { id: `${prefix}-global-action`, className: "dsmm-hint", children: t("globalActionHint") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", "aria-describedby": `${prefix}-global-action`, disabled: editorDisabled || state.dirty || editor?.revision == null || !reconcilable || (applied && !selectionConflict), onClick: () => { void props.apply(); }, children: t(state.busy === "apply" ? "applying" : "apply") }), _jsx(Button, { type: "button", variant: "outline", disabled: editorDisabled || !reconcilable || (snapshot?.selectedId === null && !selectionConflict), onClick: () => { void props.reset(); }, children: t(state.busy === "reset" ? "resetting" : "reset") })] }), snapshot?.selectionError !== undefined && _jsxs("div", { className: "dsmm-issue", children: [_jsx("p", { children: t(selectionConflict ? "selectionConflict" : "retry") }), _jsx(IssueDetails, { issue: snapshot.selectionError, t: t })] })] }), _jsx("section", { className: "dsmm-zone", "aria-label": t("sessionScope"), "data-dsmm-zone": "current-session", children: _jsx(SessionScope, { state: state, actions: props, t: t }) }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.busy === "refresh" && snapshot === null ? t("loading") : state.busy === "read" ? t("reading") : notice })] });
67
82
  }
68
83
  //# sourceMappingURL=ProfilesSection.js.map
@@ -0,0 +1,7 @@
1
+ import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
2
+ import type { DsmmRoleAvailabilityState } from "../profile-types.js";
3
+ export declare function roleAvailability(value: DsmmRoleAvailabilityState | undefined): DsmmRoleAvailabilityState | undefined;
4
+ export declare function RoleAvailability({ value, t }: PropsLocale<"settings.dsmm-profiles"> & {
5
+ value?: DsmmRoleAvailabilityState;
6
+ }): import("react").JSX.Element;
7
+ //# sourceMappingURL=RoleAvailability.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { parseRoleAvailability } from "../profile-remote.js";
3
+ export function roleAvailability(value) {
4
+ if (value === undefined)
5
+ return undefined;
6
+ try {
7
+ return parseRoleAvailability(value);
8
+ }
9
+ catch {
10
+ return undefined;
11
+ }
12
+ }
13
+ export function RoleAvailability({ value, t }) {
14
+ const state = roleAvailability(value);
15
+ if (state === undefined)
16
+ return _jsx("p", { className: "dsmm-hint", children: t("availabilityUnknown") });
17
+ return _jsxs("div", { className: "dsmm-availability", "data-dsmm-role-availability": state.id, children: [_jsx("p", { children: t(state.required ? "roleRequired" : "roleOptional", { reason: state.requiredReason ?? "—" }) }), _jsx("p", { children: t("roleCeiling", { startup: t(state.startupAvailable ? "enabled" : "disabled"), deployment: t(state.deploymentEnabled ? "enabled" : "disabled"), admitted: t(state.admitted ? "enabled" : "disabled") }) }), _jsx("p", { className: "dsmm-hint", children: t("roleProvenance", { source: state.source, capture: state.capture }) }), state.reason !== undefined && _jsx("p", { children: t("roleUnavailableReason", { reason: state.reason }) })] });
18
+ }
19
+ //# sourceMappingURL=RoleAvailability.js.map