@dsmm/dsmm 0.1.9 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (553) hide show
  1. package/README.md +46 -58
  2. package/agent-presets/dsmm-builder/agent.cordis.yml +91 -186
  3. package/agent-presets/dsmm-builder/preset.yml +1 -1
  4. package/agent-presets/dsmm-clarifier/agent.cordis.yml +120 -17
  5. package/agent-presets/dsmm-clarifier/preset.yml +1 -1
  6. package/agent-presets/dsmm-code-search/agent.cordis.yml +72 -17
  7. package/agent-presets/dsmm-code-search/preset.yml +1 -1
  8. package/agent-presets/dsmm-coding/agent.cordis.yml +169 -0
  9. package/agent-presets/dsmm-coding/preset.yml +3 -0
  10. package/agent-presets/dsmm-complex/agent.cordis.yml +154 -0
  11. package/agent-presets/dsmm-complex/preset.yml +3 -0
  12. package/agent-presets/dsmm-creative/agent.cordis.yml +122 -15
  13. package/agent-presets/dsmm-creative/preset.yml +1 -1
  14. package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +179 -0
  15. package/agent-presets/dsmm-cross-cutting/preset.yml +3 -0
  16. package/agent-presets/dsmm-deep/agent.cordis.yml +189 -0
  17. package/agent-presets/dsmm-deep/preset.yml +3 -0
  18. package/agent-presets/dsmm-doc-search/agent.cordis.yml +72 -17
  19. package/agent-presets/dsmm-doc-search/preset.yml +1 -1
  20. package/agent-presets/dsmm-documenting/agent.cordis.yml +168 -0
  21. package/agent-presets/dsmm-documenting/preset.yml +3 -0
  22. package/agent-presets/dsmm-frontend/agent.cordis.yml +161 -0
  23. package/agent-presets/dsmm-frontend/preset.yml +3 -0
  24. package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +153 -0
  25. package/agent-presets/dsmm-hard-reasoning/preset.yml +3 -0
  26. package/agent-presets/dsmm-media-reader/agent.cordis.yml +72 -17
  27. package/agent-presets/dsmm-media-reader/preset.yml +1 -1
  28. package/agent-presets/dsmm-normal-task/agent.cordis.yml +127 -0
  29. package/agent-presets/dsmm-normal-task/preset.yml +3 -0
  30. package/agent-presets/dsmm-oracle/agent.cordis.yml +109 -15
  31. package/agent-presets/dsmm-oracle/preset.yml +1 -1
  32. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +109 -15
  33. package/agent-presets/dsmm-oracle-2nd/preset.yml +1 -1
  34. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +174 -190
  35. package/agent-presets/dsmm-orchestrator/preset.yml +1 -1
  36. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +102 -16
  37. package/agent-presets/dsmm-plan-critic/preset.yml +1 -1
  38. package/agent-presets/dsmm-planner/agent.cordis.yml +134 -15
  39. package/agent-presets/dsmm-planner/preset.yml +1 -1
  40. package/agent-presets/dsmm-quick/agent.cordis.yml +132 -0
  41. package/agent-presets/dsmm-quick/preset.yml +3 -0
  42. package/agent-presets/dsmm-research/agent.cordis.yml +156 -0
  43. package/agent-presets/dsmm-research/preset.yml +3 -0
  44. package/agent-presets/dsmm-reviewer/agent.cordis.yml +108 -16
  45. package/agent-presets/dsmm-reviewer/preset.yml +1 -1
  46. package/cordis.patch.yml +1 -5
  47. package/docs/agent-presets.md +48 -15
  48. package/docs/compatibility.md +58 -68
  49. package/docs/deferred-native-approval-risk.md +19 -0
  50. package/docs/design.md +43 -2
  51. package/docs/lsp.md +12 -12
  52. package/docs/migration-from-ocmm.md +10 -2
  53. package/docs/model-routing.md +84 -59
  54. package/docs/native-permissions.md +35 -0
  55. package/docs/profiles.md +43 -64
  56. package/docs/releasing.md +159 -8
  57. package/docs/roadmap.md +77 -17
  58. package/docs/runtime-recovery.md +12 -0
  59. package/docs/safety-guards.md +7 -3
  60. package/docs/settings-status.md +46 -40
  61. package/docs/skill-sync.md +89 -14
  62. package/lib/child-admission-contract.d.ts +37 -0
  63. package/lib/child-admission-contract.js +2 -0
  64. package/lib/child-admission.d.ts +42 -0
  65. package/lib/child-admission.js +162 -0
  66. package/lib/child-capture.d.ts +81 -0
  67. package/lib/child-capture.js +203 -0
  68. package/lib/child-evidence.d.ts +17 -0
  69. package/lib/child-evidence.js +43 -0
  70. package/lib/client/ChildrenPanel.d.ts +43 -0
  71. package/lib/client/ChildrenPanel.js +82 -0
  72. package/lib/client/DeploymentPage.d.ts +18 -0
  73. package/lib/client/DeploymentPage.js +127 -0
  74. package/lib/client/EditableChoice.d.ts +17 -0
  75. package/lib/client/EditableChoice.js +49 -0
  76. package/lib/client/PermissionsPanel.d.ts +14 -0
  77. package/lib/client/PermissionsPanel.js +46 -0
  78. package/lib/client/ProfilesSection.js +32 -15
  79. package/lib/client/RoleAvailability.d.ts +7 -0
  80. package/lib/client/RoleAvailability.js +19 -0
  81. package/lib/client/SessionProfiles.js +27 -9
  82. package/lib/client/StructuredEditor.js +15 -7
  83. package/lib/client/children-controller.d.ts +98 -0
  84. package/lib/client/children-controller.js +296 -0
  85. package/lib/client/children-locales.d.ts +367 -0
  86. package/lib/client/children-locales.js +69 -0
  87. package/lib/client/controller.d.ts +6 -1
  88. package/lib/client/controller.js +14 -8
  89. package/lib/client/deployment-controller.d.ts +50 -0
  90. package/lib/client/deployment-controller.js +193 -0
  91. package/lib/client/deployment-data.d.ts +17 -0
  92. package/lib/client/deployment-data.js +138 -0
  93. package/lib/client/deployment-locales.d.ts +70 -0
  94. package/lib/client/deployment-locales.js +81 -0
  95. package/lib/client/diagnostics.d.ts +14 -0
  96. package/lib/client/diagnostics.js +53 -0
  97. package/lib/client/index.d.ts +4 -0
  98. package/lib/client/index.js +145 -1
  99. package/lib/client/locales.d.ts +58 -0
  100. package/lib/client/locales.js +38 -18
  101. package/lib/client/permission-client.d.ts +16 -0
  102. package/lib/client/permission-client.js +38 -0
  103. package/lib/client/permission-controller.d.ts +62 -0
  104. package/lib/client/permission-controller.js +149 -0
  105. package/lib/client/permission-locales.d.ts +114 -0
  106. package/lib/client/permission-locales.js +75 -0
  107. package/lib/client/plugins-contract.d.ts +27 -0
  108. package/lib/client/plugins-contract.js +2 -0
  109. package/lib/client/session-labels.js +4 -4
  110. package/lib/client/structured.js +19 -5
  111. package/lib/client/styles.d.ts +1 -1
  112. package/lib/client/styles.js +36 -0
  113. package/lib/client.js +6724 -1604
  114. package/lib/commands.js +3 -0
  115. package/lib/config-file-store.d.ts +23 -0
  116. package/lib/config-file-store.js +67 -0
  117. package/lib/core-permission-authority.d.ts +18 -0
  118. package/lib/core-permission-authority.js +255 -0
  119. package/lib/core-permissions.d.ts +8 -0
  120. package/lib/core-permissions.js +33 -0
  121. package/lib/delivery-authority.d.ts +68 -0
  122. package/lib/delivery-authority.js +260 -0
  123. package/lib/deployment-config.d.ts +60 -0
  124. package/lib/deployment-config.js +205 -0
  125. package/lib/deployment-permission-rules.d.ts +55 -0
  126. package/lib/deployment-permission-rules.js +306 -0
  127. package/lib/dsh-home.d.ts +3 -0
  128. package/lib/dsh-home.js +10 -0
  129. package/lib/dsh-types.d.ts +22 -69
  130. package/lib/guards.d.ts +3 -2
  131. package/lib/guards.js +44 -6
  132. package/lib/host-llm-startup.d.ts +41 -0
  133. package/lib/host-llm-startup.js +65 -0
  134. package/lib/host-llm.d.ts +92 -0
  135. package/lib/host-llm.js +325 -0
  136. package/lib/index.d.ts +23 -5
  137. package/lib/index.js +383 -40
  138. package/lib/legacy-child-policy.d.ts +51 -0
  139. package/lib/legacy-child-policy.js +123 -0
  140. package/lib/legacy-read-composition.d.ts +20 -0
  141. package/lib/legacy-read-composition.js +144 -0
  142. package/lib/legacy-read-contracts.d.ts +157 -0
  143. package/lib/legacy-read-contracts.js +39 -0
  144. package/lib/legacy-read-host.d.ts +19 -0
  145. package/lib/legacy-read-host.js +67 -0
  146. package/lib/legacy-read-integration.d.ts +121 -0
  147. package/lib/legacy-read-integration.js +522 -0
  148. package/lib/legacy-read-proxy.d.ts +26 -0
  149. package/lib/legacy-read-proxy.js +237 -0
  150. package/lib/live-pi-ai-owner.d.ts +18 -0
  151. package/lib/live-pi-ai-owner.js +144 -0
  152. package/lib/llm-runtime.d.ts +11 -0
  153. package/lib/llm-runtime.js +21 -0
  154. package/lib/lsp.d.ts +13 -0
  155. package/lib/lsp.js +60 -0
  156. package/lib/managed-settings.d.ts +5 -0
  157. package/lib/managed-settings.js +14 -0
  158. package/lib/mode.js +42 -47
  159. package/lib/model-parameter-policy.d.ts +11 -0
  160. package/lib/model-parameter-policy.js +27 -0
  161. package/lib/model-routing.js +33 -19
  162. package/lib/modules.d.ts +35 -0
  163. package/lib/modules.js +37 -0
  164. package/lib/native-child-evidence.d.ts +42 -0
  165. package/lib/native-child-evidence.js +133 -0
  166. package/lib/native-pi-ai-wire.d.ts +37 -0
  167. package/lib/native-pi-ai-wire.js +261 -0
  168. package/lib/native-scope.d.ts +9 -0
  169. package/lib/native-scope.js +20 -0
  170. package/lib/permission-bash.d.ts +6 -0
  171. package/lib/permission-bash.js +7 -0
  172. package/lib/permission-control.d.ts +73 -0
  173. package/lib/permission-control.js +205 -0
  174. package/lib/permission-controller.d.ts +68 -0
  175. package/lib/permission-controller.js +317 -0
  176. package/lib/permission-errors.d.ts +7 -0
  177. package/lib/permission-errors.js +21 -0
  178. package/lib/permission-fs-search.d.ts +5 -0
  179. package/lib/permission-fs-search.js +7 -0
  180. package/lib/permission-fs.d.ts +5 -0
  181. package/lib/permission-fs.js +7 -0
  182. package/lib/permission-native-access.d.ts +11 -0
  183. package/lib/permission-native-access.js +6 -0
  184. package/lib/permission-native-command.d.ts +10 -0
  185. package/lib/permission-native-command.js +93 -0
  186. package/lib/permission-native-rules.d.ts +75 -0
  187. package/lib/permission-native-rules.js +278 -0
  188. package/lib/permission-pwsh.d.ts +6 -0
  189. package/lib/permission-pwsh.js +7 -0
  190. package/lib/permission-remote.d.ts +26 -0
  191. package/lib/permission-remote.js +53 -0
  192. package/lib/permission-rpc.d.ts +29 -0
  193. package/lib/permission-rpc.js +152 -0
  194. package/lib/permission-rules.d.ts +115 -0
  195. package/lib/permission-rules.js +256 -0
  196. package/lib/permission-settings.d.ts +45 -0
  197. package/lib/permission-settings.js +48 -0
  198. package/lib/permission-shell.d.ts +38 -0
  199. package/lib/permission-shell.js +150 -0
  200. package/lib/permission-web.d.ts +5 -0
  201. package/lib/permission-web.js +7 -0
  202. package/lib/plan-validation.js +6 -44
  203. package/lib/preset-materializer.js +2 -0
  204. package/lib/preset-registry.d.ts +1 -1
  205. package/lib/preset-registry.js +38 -24
  206. package/lib/preset-skills.d.ts +4 -1
  207. package/lib/preset-skills.js +60 -19
  208. package/lib/profile-diagnostics.d.ts +45 -0
  209. package/lib/profile-diagnostics.js +148 -0
  210. package/lib/profile-locale.d.ts +3 -0
  211. package/lib/profile-locale.js +2 -0
  212. package/lib/profile-remote.d.ts +22 -0
  213. package/lib/profile-remote.js +344 -27
  214. package/lib/profile-rpc.d.ts +25 -1
  215. package/lib/profile-rpc.js +143 -3
  216. package/lib/profile-runtime.d.ts +63 -0
  217. package/lib/profile-runtime.js +496 -77
  218. package/lib/profile-store.d.ts +56 -1
  219. package/lib/profile-store.js +377 -111
  220. package/lib/profile-types.d.ts +125 -1
  221. package/lib/profile-types.js +1 -0
  222. package/lib/profiles.d.ts +16 -2
  223. package/lib/profiles.js +156 -79
  224. package/lib/prompt-content.d.ts +25 -0
  225. package/lib/prompt-content.js +27 -0
  226. package/lib/prompts.d.ts +45 -4
  227. package/lib/prompts.js +157 -43
  228. package/lib/recovery-policy.js +20 -7
  229. package/lib/role-control-remote.d.ts +38 -0
  230. package/lib/role-control-remote.js +211 -0
  231. package/lib/role-control-rpc.d.ts +51 -0
  232. package/lib/role-control-rpc.js +377 -0
  233. package/lib/role-control-types.d.ts +92 -0
  234. package/lib/role-control-types.js +8 -0
  235. package/lib/role-invocation.d.ts +47 -0
  236. package/lib/role-invocation.js +135 -0
  237. package/lib/role-llm-runtime.d.ts +17 -0
  238. package/lib/role-llm-runtime.js +62 -0
  239. package/lib/role-llm.d.ts +31 -0
  240. package/lib/role-llm.js +66 -0
  241. package/lib/role-policy.d.ts +92 -0
  242. package/lib/role-policy.js +601 -0
  243. package/lib/role-providers.d.ts +7 -3
  244. package/lib/role-providers.js +74 -46
  245. package/lib/role-routing.d.ts +11 -2
  246. package/lib/role-routing.js +42 -25
  247. package/lib/role-runs.d.ts +135 -0
  248. package/lib/role-runs.js +304 -0
  249. package/lib/role-subagents.d.ts +63 -4
  250. package/lib/role-subagents.js +299 -47
  251. package/lib/roles.d.ts +20 -9
  252. package/lib/roles.js +87 -216
  253. package/lib/route-json.d.ts +19 -0
  254. package/lib/route-json.js +129 -0
  255. package/lib/routing-policy.d.ts +2 -0
  256. package/lib/routing-policy.js +12 -2
  257. package/lib/runtime-integration.d.ts +112 -0
  258. package/lib/runtime-integration.js +784 -0
  259. package/lib/runtime-recovery.js +34 -13
  260. package/lib/session-scope.js +2 -0
  261. package/lib/settings.d.ts +116 -14
  262. package/lib/settings.js +455 -149
  263. package/lib/skills.d.ts +24 -9
  264. package/lib/skills.js +114 -35
  265. package/lib/state.d.ts +10 -6
  266. package/lib/state.js +48 -49
  267. package/lib/status.d.ts +35 -1
  268. package/lib/status.js +58 -17
  269. package/lib/subagent-runtime.d.ts +45 -0
  270. package/lib/subagent-runtime.js +131 -0
  271. package/locale/en.json +2 -2
  272. package/locale/zh.json +2 -2
  273. package/package.json +112 -45
  274. package/patches/subagent-runtime.yml +15 -0
  275. package/prompts/deepseek-flash.md +1 -1
  276. package/prompts/deepseek-v4-pro.md +2 -2
  277. package/prompts/deepwork.md +153 -20
  278. package/prompts/source/agents/clarifier.md +47 -0
  279. package/prompts/source/agents/orchestrator.md +72 -0
  280. package/prompts/source/agents/plan-critic.md +29 -0
  281. package/prompts/source/agents/planner.md +21 -0
  282. package/prompts/source/agents/reviewer.md +23 -0
  283. package/prompts/source/catalog.json +548 -0
  284. package/prompts/source/category/coding.md +46 -0
  285. package/prompts/source/category/complex.md +29 -0
  286. package/prompts/source/category/creative.md +40 -0
  287. package/prompts/source/category/cross-cutting.md +54 -0
  288. package/prompts/source/category/deep.md +64 -0
  289. package/prompts/source/category/documenting.md +68 -0
  290. package/prompts/source/category/frontend.md +38 -0
  291. package/prompts/source/category/hard-reasoning.md +53 -0
  292. package/prompts/source/category/normal-task.md +27 -0
  293. package/prompts/source/category/quick.md +34 -0
  294. package/prompts/source/category/research.md +58 -0
  295. package/prompts/source/deepwork/claude-opus-5.md +28 -0
  296. package/prompts/source/deepwork/codex.md +9 -0
  297. package/prompts/source/deepwork/default.md +136 -0
  298. package/prompts/source/deepwork/gemini.md +191 -0
  299. package/prompts/source/deepwork/glm.md +263 -0
  300. package/prompts/source/deepwork/gpt.md +49 -0
  301. package/prompts/source/deepwork/kimi-k27.md +13 -0
  302. package/prompts/source/deepwork/planner.md +44 -0
  303. package/prompts/source/deepwork/swe-2.md +13 -0
  304. package/prompts/source/manifest.json +3233 -0
  305. package/prompts/source/shared/dsh-host-contract.md +8 -0
  306. package/prompts/source/shared/locale.md +8 -0
  307. package/prompts/source/shared/shell-safety.md +7 -0
  308. package/prompts/source/terminal/builder.md +13 -0
  309. package/prompts/source/terminal/clarifier.md +41 -0
  310. package/prompts/source/terminal/code-search.md +39 -0
  311. package/prompts/source/terminal/coding.md +41 -0
  312. package/prompts/source/terminal/complex.md +43 -0
  313. package/prompts/source/terminal/creative.md +41 -0
  314. package/prompts/source/terminal/cross-cutting.md +43 -0
  315. package/prompts/source/terminal/deep.md +43 -0
  316. package/prompts/source/terminal/doc-search.md +39 -0
  317. package/prompts/source/terminal/documenting.md +41 -0
  318. package/prompts/source/terminal/frontend.md +41 -0
  319. package/prompts/source/terminal/hard-reasoning.md +41 -0
  320. package/prompts/source/terminal/media-reader.md +39 -0
  321. package/prompts/source/terminal/normal-task.md +41 -0
  322. package/prompts/source/terminal/oracle-2nd.md +53 -0
  323. package/prompts/source/terminal/oracle.md +53 -0
  324. package/prompts/source/terminal/orchestrator.md +26 -0
  325. package/prompts/source/terminal/plan-critic.md +41 -0
  326. package/prompts/source/terminal/planner.md +42 -0
  327. package/prompts/source/terminal/quick.md +39 -0
  328. package/prompts/source/terminal/research.md +39 -0
  329. package/prompts/source/terminal/reviewer.md +53 -0
  330. package/scripts/cold-profile-composition.mjs +329 -0
  331. package/scripts/cold-profile-sources.mjs +238 -0
  332. package/scripts/migrate-cold-profile.mjs +315 -0
  333. package/skills/ast-grep/LICENSE +21 -0
  334. package/skills/ast-grep/README.md +138 -0
  335. package/skills/ast-grep/SKILL.md +287 -0
  336. package/skills/ast-grep/SOURCE +1 -0
  337. package/skills/ast-grep/install.ps1 +235 -0
  338. package/skills/ast-grep/install.sh +286 -0
  339. package/skills/ast-grep/references/cli.md +233 -0
  340. package/skills/ast-grep/references/install.md +168 -0
  341. package/skills/ast-grep/references/patterns.md +149 -0
  342. package/skills/ast-grep/references/pitfalls.md +305 -0
  343. package/skills/ast-grep/references/recipes.md +404 -0
  344. package/skills/ast-grep/references/sgconfig.md +250 -0
  345. package/skills/ast-grep/references/yaml-rules.md +511 -0
  346. package/skills/ast-grep/scripts/ast_grep_helper.py +760 -0
  347. package/skills/ast-grep/tests/smoke.ps1 +129 -0
  348. package/skills/ast-grep/tests/smoke.sh +212 -0
  349. package/skills/ast-grep/tests/test_resolver.py +154 -0
  350. package/skills/brainstorming/SKILL.md +123 -9
  351. package/skills/coding-agent-sessions/LICENSE-UPSTREAM.md +82 -0
  352. package/skills/coding-agent-sessions/NOTICE.md +24 -0
  353. package/skills/coding-agent-sessions/SKILL.md +147 -0
  354. package/skills/coding-agent-sessions/agents/openai.yaml +4 -0
  355. package/skills/coding-agent-sessions/pyrightconfig.json +5 -0
  356. package/skills/coding-agent-sessions/references/all-platforms.md +77 -0
  357. package/skills/coding-agent-sessions/references/claude.md +34 -0
  358. package/skills/coding-agent-sessions/references/codex.md +32 -0
  359. package/skills/coding-agent-sessions/references/opencode.md +45 -0
  360. package/skills/coding-agent-sessions/references/senpi.md +29 -0
  361. package/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
  362. package/skills/coding-agent-sessions/scripts/agent_sessions/aside_scanner.py +140 -0
  363. package/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
  364. package/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
  365. package/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
  366. package/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
  367. package/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
  368. package/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
  369. package/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
  370. package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -0
  371. package/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +104 -0
  372. package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
  373. package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
  374. package/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
  375. package/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
  376. package/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
  377. package/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
  378. package/skills/coding-agent-sessions/scripts/tests/test_agent_sessions.py +322 -0
  379. package/skills/coding-agent-sessions/scripts/tests/test_aside_scanner.py +131 -0
  380. package/skills/coding-agent-sessions/scripts/tests/test_cli_contract.py +126 -0
  381. package/skills/coding-agent-sessions/scripts/tests/test_extended_scanners.py +262 -0
  382. package/skills/coding-agent-sessions/scripts/tests/test_optional_sqlite_scanners.py +79 -0
  383. package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -0
  384. package/skills/debugging/SKILL.md +130 -4
  385. package/skills/debugging/references/logging.md +2 -0
  386. package/skills/debugging/references/methodology/00-setup.md +16 -62
  387. package/skills/debugging/references/methodology/02-investigate.md +11 -5
  388. package/skills/debugging/references/methodology/03-flaky-triage.md +6 -4
  389. package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +6 -16
  390. package/skills/debugging/references/methodology/05-escalate.md +2 -0
  391. package/skills/debugging/references/methodology/06-fix.md +8 -6
  392. package/skills/debugging/references/methodology/08-qa.md +7 -5
  393. package/skills/debugging/references/methodology/09-cleanup.md +16 -152
  394. package/skills/debugging/references/methodology/partial-runtime-evidence.md +7 -18
  395. package/skills/debugging/references/runtimes/bundled-js-binary.md +3 -16
  396. package/skills/debugging/references/runtimes/go.md +2 -0
  397. package/skills/debugging/references/runtimes/native-binary.md +11 -54
  398. package/skills/debugging/references/runtimes/node.md +6 -15
  399. package/skills/debugging/references/runtimes/python.md +5 -15
  400. package/skills/debugging/references/runtimes/rust.md +4 -18
  401. package/skills/debugging/references/scripts/dap.test.mjs +539 -0
  402. package/skills/debugging/references/scripts/fixture-adapter.mjs +164 -0
  403. package/skills/debugging/references/tools/dap.md +4 -2
  404. package/skills/debugging/references/tools/ghidra.md +6 -15
  405. package/skills/debugging/references/tools/playwright-cli.md +5 -15
  406. package/skills/debugging/references/tools/pwndbg.md +2 -0
  407. package/skills/debugging/references/tools/pwntools.md +6 -16
  408. package/skills/dispatching-parallel-agents/SKILL.md +96 -7
  409. package/skills/frontend/.frontend-materialized.json +856 -0
  410. package/skills/frontend/ATTRIBUTION.md +37 -0
  411. package/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
  412. package/skills/frontend/LICENSE-taste-skill.txt +21 -0
  413. package/skills/frontend/LICENSE-ui-ux-pro-max.txt +21 -0
  414. package/skills/frontend/SKILL.md +145 -0
  415. package/skills/frontend/references/design/README.md +256 -0
  416. package/skills/frontend/references/design/_INDEX.md +206 -0
  417. package/skills/frontend/references/design/airbnb.md +393 -0
  418. package/skills/frontend/references/design/airtable.md +92 -0
  419. package/skills/frontend/references/design/apple.md +250 -0
  420. package/skills/frontend/references/design/aside.md +211 -0
  421. package/skills/frontend/references/design/binance.md +348 -0
  422. package/skills/frontend/references/design/bmw.md +183 -0
  423. package/skills/frontend/references/design/brutalist-skill.md +92 -0
  424. package/skills/frontend/references/design/bugatti.md +271 -0
  425. package/skills/frontend/references/design/cal.md +262 -0
  426. package/skills/frontend/references/design/claude.md +315 -0
  427. package/skills/frontend/references/design/clay.md +307 -0
  428. package/skills/frontend/references/design/clickhouse.md +284 -0
  429. package/skills/frontend/references/design/clone-from-url.md +69 -0
  430. package/skills/frontend/references/design/cohere.md +269 -0
  431. package/skills/frontend/references/design/coinbase.md +132 -0
  432. package/skills/frontend/references/design/composio.md +310 -0
  433. package/skills/frontend/references/design/cursor.md +312 -0
  434. package/skills/frontend/references/design/design-system-architecture.md +250 -0
  435. package/skills/frontend/references/design/elevenlabs.md +268 -0
  436. package/skills/frontend/references/design/expo.md +284 -0
  437. package/skills/frontend/references/design/ferrari.md +317 -0
  438. package/skills/frontend/references/design/figma.md +223 -0
  439. package/skills/frontend/references/design/framer.md +249 -0
  440. package/skills/frontend/references/design/gpt-tasteskill.md +74 -0
  441. package/skills/frontend/references/design/hashicorp.md +281 -0
  442. package/skills/frontend/references/design/ibm.md +335 -0
  443. package/skills/frontend/references/design/image-to-code-skill.md +1228 -0
  444. package/skills/frontend/references/design/imagegen-brandkit.md +798 -0
  445. package/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
  446. package/skills/frontend/references/design/imagegen-frontend-web.md +987 -0
  447. package/skills/frontend/references/design/interaction-skill.md +52 -0
  448. package/skills/frontend/references/design/intercom.md +149 -0
  449. package/skills/frontend/references/design/kraken.md +128 -0
  450. package/skills/frontend/references/design/lamborghini.md +291 -0
  451. package/skills/frontend/references/design/linear.app.md +370 -0
  452. package/skills/frontend/references/design/lovable.md +301 -0
  453. package/skills/frontend/references/design/mastercard.md +368 -0
  454. package/skills/frontend/references/design/meta.md +369 -0
  455. package/skills/frontend/references/design/minimalist-skill.md +85 -0
  456. package/skills/frontend/references/design/minimax.md +260 -0
  457. package/skills/frontend/references/design/mintlify.md +329 -0
  458. package/skills/frontend/references/design/miro.md +111 -0
  459. package/skills/frontend/references/design/mistral.ai.md +264 -0
  460. package/skills/frontend/references/design/mongodb.md +269 -0
  461. package/skills/frontend/references/design/nike.md +366 -0
  462. package/skills/frontend/references/design/notion.md +312 -0
  463. package/skills/frontend/references/design/nvidia.md +296 -0
  464. package/skills/frontend/references/design/ollama.md +270 -0
  465. package/skills/frontend/references/design/opencode.ai.md +284 -0
  466. package/skills/frontend/references/design/output-skill.md +49 -0
  467. package/skills/frontend/references/design/pinterest.md +233 -0
  468. package/skills/frontend/references/design/playstation.md +367 -0
  469. package/skills/frontend/references/design/posthog.md +259 -0
  470. package/skills/frontend/references/design/raycast.md +271 -0
  471. package/skills/frontend/references/design/react-dev-tooling-skill.md +232 -0
  472. package/skills/frontend/references/design/redesign-skill.md +178 -0
  473. package/skills/frontend/references/design/renault.md +314 -0
  474. package/skills/frontend/references/design/replicate.md +264 -0
  475. package/skills/frontend/references/design/resend.md +306 -0
  476. package/skills/frontend/references/design/revolut.md +188 -0
  477. package/skills/frontend/references/design/runwayml.md +247 -0
  478. package/skills/frontend/references/design/sanity.md +360 -0
  479. package/skills/frontend/references/design/sentry.md +265 -0
  480. package/skills/frontend/references/design/shopify.md +353 -0
  481. package/skills/frontend/references/design/soft-skill.md +98 -0
  482. package/skills/frontend/references/design/spacex.md +197 -0
  483. package/skills/frontend/references/design/spotify.md +249 -0
  484. package/skills/frontend/references/design/starbucks.md +583 -0
  485. package/skills/frontend/references/design/stitch-design-example.md +121 -0
  486. package/skills/frontend/references/design/stitch-skill.md +184 -0
  487. package/skills/frontend/references/design/stripe.md +325 -0
  488. package/skills/frontend/references/design/supabase.md +258 -0
  489. package/skills/frontend/references/design/superhuman.md +255 -0
  490. package/skills/frontend/references/design/taste-skill.md +1206 -0
  491. package/skills/frontend/references/design/tesla.md +289 -0
  492. package/skills/frontend/references/design/theverge.md +342 -0
  493. package/skills/frontend/references/design/together.ai.md +266 -0
  494. package/skills/frontend/references/design/uber.md +298 -0
  495. package/skills/frontend/references/design/vercel.md +313 -0
  496. package/skills/frontend/references/design/vodafone.md +426 -0
  497. package/skills/frontend/references/design/voltagent.md +326 -0
  498. package/skills/frontend/references/design/warp.md +256 -0
  499. package/skills/frontend/references/design/webflow.md +95 -0
  500. package/skills/frontend/references/design/wired.md +281 -0
  501. package/skills/frontend/references/design/wise.md +176 -0
  502. package/skills/frontend/references/design/x.ai.md +260 -0
  503. package/skills/frontend/references/design/zapier.md +331 -0
  504. package/skills/frontend/references/perfection/README.md +264 -0
  505. package/skills/frontend/references/perfection/react-perf-tooling.md +234 -0
  506. package/skills/frontend/references/ui-ux-db/README.md +659 -0
  507. package/skills/frontend/references/ui-ux-db/data/app-interface.csv +31 -0
  508. package/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
  509. package/skills/frontend/references/ui-ux-db/data/colors.csv +162 -0
  510. package/skills/frontend/references/ui-ux-db/data/google-fonts.csv +1924 -0
  511. package/skills/frontend/references/ui-ux-db/data/icons.csv +106 -0
  512. package/skills/frontend/references/ui-ux-db/data/landing.csv +35 -0
  513. package/skills/frontend/references/ui-ux-db/data/products.csv +162 -0
  514. package/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
  515. package/skills/frontend/references/ui-ux-db/data/stacks/angular.csv +51 -0
  516. package/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
  517. package/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
  518. package/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
  519. package/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
  520. package/skills/frontend/references/ui-ux-db/data/stacks/laravel.csv +51 -0
  521. package/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
  522. package/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
  523. package/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
  524. package/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
  525. package/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
  526. package/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
  527. package/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
  528. package/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
  529. package/skills/frontend/references/ui-ux-db/data/stacks/threejs.csv +54 -0
  530. package/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
  531. package/skills/frontend/references/ui-ux-db/data/styles.csv +85 -0
  532. package/skills/frontend/references/ui-ux-db/data/typography.csv +74 -0
  533. package/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +162 -0
  534. package/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
  535. package/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
  536. package/skills/frontend/references/ui-ux-db/scripts/core.py +262 -0
  537. package/skills/frontend/references/ui-ux-db/scripts/design_system.py +1148 -0
  538. package/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
  539. package/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
  540. package/skills/git-master/SKILL.md +115 -0
  541. package/skills/git-master/agents/openai.yaml +13 -0
  542. package/skills/init-deep/SKILL.md +282 -0
  543. package/skills/receiving-code-review/SKILL.md +117 -7
  544. package/skills/remove-ai-slops/SKILL.md +160 -8
  545. package/skills/requesting-code-review/SKILL.md +98 -3
  546. package/skills/requesting-code-review/code-reviewer.md +59 -0
  547. package/skills/subagent-driven-development/SKILL.md +179 -6
  548. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +23 -0
  549. package/skills/subagent-driven-development/implementer-prompt.md +87 -0
  550. package/skills/subagent-driven-development/spec-reviewer-prompt.md +37 -0
  551. package/skills/using-git-worktrees/SKILL.md +144 -0
  552. package/skills/writing-plans/SKILL.md +126 -7
  553. package/skills/writing-plans/plan-document-reviewer-prompt.md +47 -0
@@ -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
@@ -0,0 +1,18 @@
1
+ import type { PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
2
+ import type { ConfigForms } from "@deepseek-ai/dsh-client-ui-settings/client";
3
+ import { DeploymentController } from "./deployment-controller.js";
4
+ import type { NativePageForm } from "./deployment-controller.js";
5
+ import type { DsmmConfigRemote } from "../profile-remote.js";
6
+ type Locale = PropsLocale<"plugins.dsmm">;
7
+ export interface DeploymentPageProps extends Locale {
8
+ view: "summary" | "page";
9
+ form?: NativePageForm;
10
+ core: DeploymentController;
11
+ remote: DsmmConfigRemote;
12
+ forms?: ConfigForms;
13
+ rowNamespace?: string;
14
+ profilePage?: boolean;
15
+ }
16
+ export declare function DeploymentPage(props: DeploymentPageProps): import("react").JSX.Element;
17
+ export {};
18
+ //# sourceMappingURL=DeploymentPage.d.ts.map
@@ -0,0 +1,127 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useId, useMemo, useState, useSyncExternalStore } from "react";
3
+ import { Button, Input } from "@deepseek-ai/dsh-client-ui-primitives";
4
+ import { DeploymentController } from "./deployment-controller.js";
5
+ import { at, enumValues, equal, inspectorPaths, mergeLayer, parseAdvanced, validateEditorValue, visibleDeploymentPath } from "./deployment-data.js";
6
+ import { deploymentFieldLabels } from "./deployment-locales.js";
7
+ function label(path, t) {
8
+ const key = path.at(-1);
9
+ const item = deploymentFieldLabels[key];
10
+ return item === undefined ? key.replace(/^dsmm-/u, "").replace(/([a-z])([A-Z])/gu, "$1 $2") : item[t("global") === "DSMM 全局配置" ? 1 : 0];
11
+ }
12
+ function displayValue(value, t) {
13
+ if (value === undefined)
14
+ return t("unknown");
15
+ if (typeof value === "boolean")
16
+ return t(value ? "on" : "off");
17
+ const text = JSON.stringify(value);
18
+ return text.length > 120 ? `${text.slice(0, 120)}…` : text;
19
+ }
20
+ function AdvancedField({ schema, path, value, inherited, upper, reset, disabled, onChange, setInvalid, t }) {
21
+ const id = useId(), name = path.join(".");
22
+ const serialized = value === undefined ? "" : JSON.stringify(value, null, 2);
23
+ const [text, setText] = useState(serialized);
24
+ const [invalid, setLocalInvalid] = useState(false);
25
+ useEffect(() => { setText(serialized); setLocalInvalid(false); setInvalid(name, false); }, [serialized, reset]);
26
+ return _jsxs("details", { className: "dsmm-deployment-group", children: [_jsxs("summary", { children: [label(path, t), " \u00B7 ", t("advanced"), " ", _jsx("code", { children: name })] }), _jsxs("div", { className: "dsmm-field", children: [_jsxs("label", { htmlFor: id, children: [label(path, t), " \u00B7 ", t("advanced"), " ", _jsx("code", { children: name })] }), _jsx("p", { className: "dsmm-hint", id: `${id}-hint`, children: t("advancedHint") }), _jsx("textarea", { id: id, rows: 6, maxLength: 32768, value: text, disabled: disabled, "aria-invalid": invalid, "aria-describedby": `${id}-hint ${id}-error`, onChange: event => {
27
+ const next = event.currentTarget.value;
28
+ setText(next);
29
+ let parsed, valid = true;
30
+ try {
31
+ parsed = parseAdvanced(next);
32
+ const candidate = parsed === undefined ? inherited : mergeLayer(inherited, parsed);
33
+ valid = parsed === undefined || validateEditorValue(parsed, schema, true) && validateEditorValue(upper === undefined ? candidate : mergeLayer(candidate, upper), schema);
34
+ }
35
+ catch {
36
+ valid = false;
37
+ }
38
+ setLocalInvalid(!valid);
39
+ setInvalid(name, !valid);
40
+ if (valid)
41
+ onChange(parsed);
42
+ } }), _jsx("p", { id: `${id}-error`, className: "dsmm-hint", children: invalid ? t("invalid") : "" }), _jsxs("details", { children: [_jsxs("summary", { children: [t("advanced"), " \u00B7 schema"] }), _jsx("pre", { children: JSON.stringify(schema, null, 2) })] })] })] });
43
+ }
44
+ function ScalarField({ schema, path, controller, disabled, inherited, invalid, t }) {
45
+ const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
46
+ const value = at(state.draft, path), name = path.join("."), id = useId();
47
+ const [text, setText] = useState(String(value ?? inherited ?? ""));
48
+ const [bad, setBad] = useState(false);
49
+ useEffect(() => { setText(String(value ?? inherited ?? "")); setBad(false); invalid(name, false); }, [value, inherited, state.snapshot]);
50
+ return _jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: id, children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Input, { className: "dsmm-input", id: id, type: "text", inputMode: schema.type === "number" ? "decimal" : undefined, value: text, disabled: disabled, "aria-invalid": bad, "aria-describedby": `${id}-error`, onChange: event => {
51
+ const raw = event.currentTarget.value;
52
+ setText(raw);
53
+ const candidate = schema.type === "number" ? Number(raw) : raw;
54
+ const valid = (schema.type !== "number" || raw.trim() !== "") && validateEditorValue(candidate, schema);
55
+ setBad(!valid);
56
+ invalid(name, !valid);
57
+ if (valid)
58
+ controller.edit(path, candidate);
59
+ } }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || value === undefined && !bad, onClick: () => { setText(String(inherited ?? "")); setBad(false); invalid(name, false); controller.edit(path, undefined); }, children: t("inherit") })] }), _jsxs("p", { id: `${id}-error`, className: "dsmm-hint", children: [bad ? t("invalid") : "", schema.type === "number" && (schema.min !== undefined || schema.max !== undefined) ? ` ${schema.min ?? "—"} – ${schema.max ?? "—"}` : ""] })] });
60
+ }
61
+ function Field({ schema, path, controller, invalid, t }) {
62
+ if (schema.type === "transform" && schema.inner !== undefined)
63
+ schema = schema.inner;
64
+ const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot), snapshot = state.snapshot;
65
+ const id = useId(), name = path.join("."), explicit = at(state.draft, path);
66
+ const inherited = controller.layer === "global" ? at(snapshot.defaults, path) : at(mergeLayer(mergeLayer(snapshot.defaults, snapshot.global), snapshot.nativeForm?.base ?? {}), path);
67
+ const disabled = state.busy || state.issue === "not-owned" || state.issue === "unavailable" || state.issue === "transport" || controller.layer === "profile" && !controller.canWriteProfile();
68
+ const choices = enumValues(schema);
69
+ const hint = name === "modelParameters.passthrough" ? "modelParametersHint" : name === "permissionControl.enabled" ? "permissionControlHint" : null;
70
+ if (schema.type === "object" && schema.fields !== undefined && path[0] !== "roleRouting")
71
+ return _jsxs("details", { className: "dsmm-deployment-group", children: [_jsxs("summary", { children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsx("div", { children: Object.entries(schema.fields).filter(([key]) => visibleDeploymentPath([...path, key])).map(([key, node]) => _jsx(Field, { schema: node, path: [...path, key], controller: controller, invalid: invalid, t: t }, key)) })] });
72
+ if (!["boolean", "string", "number"].includes(schema.type) && choices === null)
73
+ return _jsx(AdvancedField, { schema: schema, path: path, value: explicit, inherited: inherited, upper: controller.layer === "global" ? at(snapshot.profile, path) : undefined, reset: snapshot, disabled: disabled, t: t, onChange: value => controller.edit(path, value), setInvalid: invalid });
74
+ return _jsxs("div", { className: "dsmm-field dsmm-deployment-field", children: [schema.type === "boolean" || choices !== null ? _jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: id, children: [label(path, t), " ", _jsx("code", { children: name })] }), _jsxs("select", { id: id, disabled: disabled, "aria-describedby": hint === null ? undefined : `${id}-hint`, value: explicit === undefined ? "inherit" : JSON.stringify(explicit), onChange: event => controller.edit(path, event.currentTarget.value === "inherit" ? undefined : JSON.parse(event.currentTarget.value)), children: [_jsxs("option", { value: "inherit", children: [t("inherit"), " \u00B7 ", displayValue(inherited, t)] }), (choices ?? [true, false]).map(choice => _jsx("option", { value: JSON.stringify(choice), children: displayValue(choice, t) }, String(choice)))] })] }) : _jsx(ScalarField, { schema: schema, path: path, controller: controller, disabled: disabled, inherited: inherited, invalid: invalid, t: t }), hint !== null && _jsx("p", { id: `${id}-hint`, className: "dsmm-hint", children: t(hint) }), (explicit !== undefined || controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined) && _jsxs("p", { className: "dsmm-hint", children: [explicit === undefined ? "" : equal(explicit, at(snapshot.defaults, path)) ? t("defaultPin") : t("explicit"), controller.layer === "profile" && at(snapshot.nativeForm?.base, path) !== undefined ? `${explicit === undefined ? "" : " · "}${t("hostPin")}` : ""] })] });
75
+ }
76
+ function Layer({ controller, t }) {
77
+ const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
78
+ const [invalid, setInvalid] = useState(new Set());
79
+ const updateInvalid = (path, bad) => { controller.setInvalid(path, bad); setInvalid(previous => { if (previous.has(path) === bad)
80
+ return previous; const next = new Set(previous); if (bad)
81
+ next.add(path);
82
+ else
83
+ next.delete(path); return next; }); };
84
+ const title = controller.layer === "global" ? "global" : "profile";
85
+ const disabled = state.busy || state.snapshot === null || state.issue !== null || invalid.size > 0 || controller.layer === "profile" && !controller.canWriteProfile();
86
+ return _jsxs("div", { "data-dsmm-layer": controller.layer, "aria-busy": state.busy, children: [_jsxs("details", { className: "dsmm-deployment-card", children: [_jsxs("summary", { children: [t(title), _jsx("span", { role: "status", "aria-live": "polite", className: "dsmm-hint", children: state.busy ? t("saving") : state.dirty ? t("dirty") : state.saved ? t("saved") : "" })] }), _jsxs("fieldset", { children: [_jsx("legend", { children: t(title) }), _jsx("p", { className: "dsmm-hint", children: t(title === "global" ? "globalHint" : "profileHint") }), state.snapshot !== null && _jsxs(_Fragment, { children: [_jsxs("details", { className: "dsmm-deployment-group", children: [_jsx("summary", { children: t("core") }), _jsxs("div", { children: [_jsx("p", { className: "dsmm-hint", children: t("coreHint") }), Object.entries(state.snapshot.schema.fields ?? {}).filter(([key]) => key === "modelParameters" || key === "permissionControl").map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, invalid: updateInvalid, t: t }, key))] })] }), Object.entries(state.snapshot.schema.fields ?? {}).filter(([key]) => visibleDeploymentPath([key]) && key !== "modelParameters" && key !== "permissionControl" && (controller.layer === "global" || key !== "modules")).sort(([a], [b]) => a === "modules" ? -1 : b === "modules" ? 1 : 0).map(([key, schema]) => _jsx(Field, { schema: schema, path: [key], controller: controller, invalid: updateInvalid, t: t }, key))] }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "primary", disabled: disabled || !state.dirty, onClick: () => { void controller.save(); }, children: t(state.busy ? "saving" : title === "global" ? "saveGlobal" : "saveProfile") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy, onClick: () => { void controller.refresh(); }, children: t("refresh") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.busy || !state.dirty && state.issue === null, onClick: () => { setInvalid(new Set()); void controller.refresh(true); }, children: t("discard") })] })] })] }), state.issue !== null && _jsx("p", { className: "dsmm-issue", role: "alert", children: t(state.issue) }), invalid.size > 0 && _jsx("p", { className: "dsmm-issue", role: "alert", children: t("invalid") }), controller.layer === "profile" && !controller.canWriteProfile() && _jsx("p", { className: "dsmm-hint", children: t("unavailableForm") })] });
87
+ }
88
+ function NativeProfileLayer({ namespace, forms, remote, form, core, t }) {
89
+ const shared = useMemo(() => forms.get(namespace), [forms, namespace]);
90
+ const snapshot = useSyncExternalStore(listener => shared.subscribe(listener), () => shared.getSnapshot());
91
+ const controller = useMemo(() => core.forProfile(namespace), [core, remote, namespace]);
92
+ const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
93
+ const coreState = useSyncExternalStore(core.subscribe, core.getSnapshot);
94
+ controller.attachForm(form ?? { state: snapshot, mutate: (ops, revision) => shared.mutate(ops, revision) });
95
+ useEffect(() => { void controller.refresh(); return () => controller.dispose(); }, [controller]);
96
+ useEffect(() => { if (state.saved)
97
+ void core.refresh(); }, [state.saved, core]);
98
+ useEffect(() => { if (controller.getSnapshot().snapshot !== null)
99
+ void controller.refresh(); }, [coreState.snapshot?.globalRevision, snapshot.revision, controller]);
100
+ return _jsx(Layer, { controller: controller, t: t });
101
+ }
102
+ function StateInspector({ controller, session, t }) {
103
+ const { snapshot, dirty, issue } = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
104
+ if (snapshot === null)
105
+ return null;
106
+ const admitted = session?.configuration ?? null;
107
+ const restartRequired = (snapshot.nextRoot?.restartRequired ?? []).filter(path => visibleDeploymentPath(path.split(".")));
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");
109
+ const value = (layer, path) => layer === undefined ? t("unknown") : at(layer, path.split(".")) === undefined ? t("absent") : displayValue(at(layer, path.split(".")), t);
110
+ const metadata = (layer, path, entry) => layer !== undefined && at(layer, path.split(".")) === undefined && entry === undefined ? t("absent") : source(entry);
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(", ")] })] })] });
112
+ }
113
+ export function DeploymentPage(props) {
114
+ const state = useSyncExternalStore(props.core.subscribe, props.core.getSnapshot);
115
+ useEffect(() => { if (props.view === "page")
116
+ void props.core.refresh(); }, [props.core, props.view]);
117
+ if (props.view === "summary")
118
+ return _jsx("span", { children: props.t("summary") });
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)
124
+ ? _jsx(NativeProfileLayer, { namespace: snapshot.namespace, forms: props.forms, remote: props.remote, form: props.form, core: props.core, t: t }, `${snapshot.hostProfileKey}:${snapshot.entryId}`)
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 })] });
126
+ }
127
+ //# sourceMappingURL=DeploymentPage.js.map
@@ -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,15 +23,19 @@ 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";
28
31
  const snapshot = state.snapshot;
29
32
  const editor = state.editor;
33
+ const readOnly = snapshot?.readOnly === true;
34
+ const editorDisabled = disabled || readOnly;
30
35
  const reconcilable = canReconcileSelection(snapshot);
31
36
  const selectionConflict = reconcilable && snapshot?.selectionError?.code === "conflict";
32
37
  const invalid = state.issue?.kind === "domain" && state.issue.code === "validation";
33
- const idInvalid = invalid && state.issue?.field === "id";
38
+ const idInvalid = invalid && state.issue?.field === "id" && state.issue.location === undefined && editor?.revision === null && !editorDisabled;
34
39
  const rawInvalid = editor !== null && structuredDocument(editor.content) === null;
35
40
  useEffect(() => {
36
41
  if (state.pendingEditor !== null) {
@@ -43,24 +48,36 @@ export function ProfilesSection(props) {
43
48
  }
44
49
  }, [state.pendingEditor]);
45
50
  useEffect(() => {
46
- if (state.issue?.kind === "domain" && state.issue.code === "validation") {
47
- if (state.issue.field === "id")
48
- inputRef.current?.focus();
49
- else
50
- 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
+ }
51
67
  }
52
- }, [state.issue]);
53
- const applied = editor?.revision !== null && editor?.id === snapshot?.selectedId && editor?.revision === snapshot?.appliedRevision;
54
- 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");
55
71
  if (snapshot?.selectionError !== undefined && !selectionConflict)
56
72
  selection = t("appliedInvalid");
57
73
  else if (snapshot?.selectedId !== null && snapshot?.selectedId !== undefined)
58
- selection = t("appliedProfile", { id: snapshot.selectedId, revision: snapshot.appliedRevision?.slice(0, 12) ?? "—" });
74
+ selection = t("appliedProfile", { id: snapshot.selectedId, revision: snapshot.appliedRevision ?? "—" });
59
75
  const notice = state.notice === null ? "" : t(state.notice.key === "reset" ? "resetDone" : state.notice.key, { id: state.notice.id });
60
- 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") }), _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: disabled || 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: disabled || !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)
61
- 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") {
62
- event.preventDefault();
63
- props.cancelDiscard();
64
- } }, 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: disabled, 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, 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: disabled || !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: disabled || 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 && _jsxs("div", { className: "dsmm-issue", id: `${prefix}-issue`, role: "alert", children: [_jsx("p", { children: t(issueKey(state.issue)) }), state.issue.kind === "domain" && state.issue.message !== undefined && _jsxs("p", { children: [t("details"), ": ", state.issue.message] })] }), snapshot?.selectionError !== undefined && _jsxs("div", { className: "dsmm-issue", children: [_jsxs("p", { children: [t("details"), ": ", snapshot.selectionError.message] }), _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 })] });
65
82
  }
66
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