@dsmm/dsmm 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (409) hide show
  1. package/README.md +40 -24
  2. package/agent-presets/dsmm-builder/agent.cordis.yml +1949 -39
  3. package/agent-presets/dsmm-builder/preset.yml +1 -1
  4. package/agent-presets/dsmm-clarifier/agent.cordis.yml +436 -14
  5. package/agent-presets/dsmm-clarifier/preset.yml +1 -1
  6. package/agent-presets/dsmm-code-search/agent.cordis.yml +56 -14
  7. package/agent-presets/dsmm-code-search/preset.yml +1 -1
  8. package/agent-presets/dsmm-coding/agent.cordis.yml +588 -0
  9. package/agent-presets/dsmm-coding/preset.yml +3 -0
  10. package/agent-presets/dsmm-complex/agent.cordis.yml +1140 -0
  11. package/agent-presets/dsmm-complex/preset.yml +3 -0
  12. package/agent-presets/dsmm-creative/agent.cordis.yml +536 -12
  13. package/agent-presets/dsmm-creative/preset.yml +1 -1
  14. package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +1163 -0
  15. package/agent-presets/dsmm-cross-cutting/preset.yml +3 -0
  16. package/agent-presets/dsmm-deep/agent.cordis.yml +1173 -0
  17. package/agent-presets/dsmm-deep/preset.yml +3 -0
  18. package/agent-presets/dsmm-doc-search/agent.cordis.yml +56 -14
  19. package/agent-presets/dsmm-doc-search/preset.yml +1 -1
  20. package/agent-presets/dsmm-documenting/agent.cordis.yml +581 -0
  21. package/agent-presets/dsmm-documenting/preset.yml +3 -0
  22. package/agent-presets/dsmm-frontend/agent.cordis.yml +580 -0
  23. package/agent-presets/dsmm-frontend/preset.yml +3 -0
  24. package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +572 -0
  25. package/agent-presets/dsmm-hard-reasoning/preset.yml +3 -0
  26. package/agent-presets/dsmm-media-reader/agent.cordis.yml +56 -14
  27. package/agent-presets/dsmm-media-reader/preset.yml +1 -1
  28. package/agent-presets/dsmm-normal-task/agent.cordis.yml +546 -0
  29. package/agent-presets/dsmm-normal-task/preset.yml +3 -0
  30. package/agent-presets/dsmm-oracle/agent.cordis.yml +421 -12
  31. package/agent-presets/dsmm-oracle/preset.yml +1 -1
  32. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +421 -12
  33. package/agent-presets/dsmm-oracle-2nd/preset.yml +1 -1
  34. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +2023 -43
  35. package/agent-presets/dsmm-orchestrator/preset.yml +1 -1
  36. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +416 -13
  37. package/agent-presets/dsmm-plan-critic/preset.yml +1 -1
  38. package/agent-presets/dsmm-planner/agent.cordis.yml +462 -13
  39. package/agent-presets/dsmm-planner/preset.yml +1 -1
  40. package/agent-presets/dsmm-quick/agent.cordis.yml +119 -0
  41. package/agent-presets/dsmm-quick/preset.yml +3 -0
  42. package/agent-presets/dsmm-research/agent.cordis.yml +141 -0
  43. package/agent-presets/dsmm-research/preset.yml +3 -0
  44. package/agent-presets/dsmm-reviewer/agent.cordis.yml +420 -13
  45. package/agent-presets/dsmm-reviewer/preset.yml +1 -1
  46. package/cordis.patch.yml +1 -5
  47. package/docs/agent-presets.md +64 -15
  48. package/docs/compatibility.md +61 -13
  49. package/docs/design.md +41 -0
  50. package/docs/lsp.md +12 -2
  51. package/docs/migration-from-ocmm.md +8 -0
  52. package/docs/profiles.md +41 -15
  53. package/docs/releasing.md +78 -8
  54. package/docs/roadmap.md +6 -0
  55. package/docs/runtime-recovery.md +12 -0
  56. package/docs/safety-guards.md +7 -3
  57. package/docs/settings-status.md +148 -7
  58. package/docs/skill-sync.md +52 -14
  59. package/lib/client/DeploymentPage.d.ts +18 -0
  60. package/lib/client/DeploymentPage.js +120 -0
  61. package/lib/client/ProfilesSection.js +4 -2
  62. package/lib/client/deployment-controller.d.ts +50 -0
  63. package/lib/client/deployment-controller.js +193 -0
  64. package/lib/client/deployment-data.d.ts +16 -0
  65. package/lib/client/deployment-data.js +109 -0
  66. package/lib/client/deployment-locales.d.ts +66 -0
  67. package/lib/client/deployment-locales.js +72 -0
  68. package/lib/client/index.js +50 -0
  69. package/lib/client/locales.d.ts +4 -0
  70. package/lib/client/locales.js +4 -2
  71. package/lib/client/plugins-contract.d.ts +27 -0
  72. package/lib/client/plugins-contract.js +2 -0
  73. package/lib/client/styles.d.ts +1 -1
  74. package/lib/client/styles.js +16 -0
  75. package/lib/client.js +1048 -29
  76. package/lib/commands.js +3 -0
  77. package/lib/config-file-store.d.ts +23 -0
  78. package/lib/config-file-store.js +67 -0
  79. package/lib/deployment-config.d.ts +37 -0
  80. package/lib/deployment-config.js +184 -0
  81. package/lib/dsh-home.d.ts +3 -0
  82. package/lib/dsh-home.js +10 -0
  83. package/lib/dsh-types.d.ts +12 -65
  84. package/lib/guards.d.ts +2 -1
  85. package/lib/guards.js +19 -2
  86. package/lib/index.d.ts +8 -1
  87. package/lib/index.js +115 -25
  88. package/lib/lsp.d.ts +13 -0
  89. package/lib/lsp.js +60 -0
  90. package/lib/mode.js +42 -47
  91. package/lib/model-routing.js +5 -2
  92. package/lib/modules.d.ts +27 -0
  93. package/lib/modules.js +21 -0
  94. package/lib/native-scope.d.ts +9 -0
  95. package/lib/native-scope.js +20 -0
  96. package/lib/plan-validation.js +6 -44
  97. package/lib/preset-materializer.js +2 -0
  98. package/lib/preset-registry.d.ts +1 -1
  99. package/lib/preset-registry.js +7 -4
  100. package/lib/preset-skills.d.ts +4 -1
  101. package/lib/preset-skills.js +60 -19
  102. package/lib/profile-remote.d.ts +14 -0
  103. package/lib/profile-remote.js +197 -4
  104. package/lib/profile-rpc.d.ts +24 -1
  105. package/lib/profile-rpc.js +139 -1
  106. package/lib/profile-runtime.d.ts +24 -0
  107. package/lib/profile-runtime.js +177 -33
  108. package/lib/profile-store.d.ts +45 -1
  109. package/lib/profile-store.js +236 -102
  110. package/lib/profile-types.d.ts +55 -0
  111. package/lib/prompt-content.d.ts +25 -0
  112. package/lib/prompt-content.js +27 -0
  113. package/lib/prompts.d.ts +8 -2
  114. package/lib/prompts.js +46 -34
  115. package/lib/role-policy.d.ts +51 -0
  116. package/lib/role-policy.js +224 -0
  117. package/lib/role-providers.d.ts +6 -2
  118. package/lib/role-providers.js +72 -39
  119. package/lib/role-subagents.d.ts +6 -2
  120. package/lib/role-subagents.js +187 -48
  121. package/lib/roles.d.ts +16 -4
  122. package/lib/roles.js +86 -186
  123. package/lib/runtime-recovery.js +16 -5
  124. package/lib/session-scope.js +2 -0
  125. package/lib/settings.d.ts +69 -1
  126. package/lib/settings.js +262 -91
  127. package/lib/skills.d.ts +24 -9
  128. package/lib/skills.js +114 -35
  129. package/lib/state.d.ts +10 -6
  130. package/lib/state.js +48 -49
  131. package/lib/status.d.ts +25 -0
  132. package/lib/status.js +47 -9
  133. package/locale/en.json +2 -2
  134. package/locale/zh.json +2 -2
  135. package/package.json +19 -2
  136. package/prompts/deepwork.md +144 -20
  137. package/prompts/source/agents/clarifier.md +45 -0
  138. package/prompts/source/agents/orchestrator.md +63 -0
  139. package/prompts/source/agents/plan-critic.md +25 -0
  140. package/prompts/source/agents/planner.md +19 -0
  141. package/prompts/source/agents/reviewer.md +17 -0
  142. package/prompts/source/catalog.json +548 -0
  143. package/prompts/source/category/coding.md +46 -0
  144. package/prompts/source/category/complex.md +29 -0
  145. package/prompts/source/category/creative.md +38 -0
  146. package/prompts/source/category/cross-cutting.md +52 -0
  147. package/prompts/source/category/deep.md +62 -0
  148. package/prompts/source/category/documenting.md +62 -0
  149. package/prompts/source/category/frontend.md +38 -0
  150. package/prompts/source/category/hard-reasoning.md +53 -0
  151. package/prompts/source/category/normal-task.md +27 -0
  152. package/prompts/source/category/quick.md +34 -0
  153. package/prompts/source/category/research.md +56 -0
  154. package/prompts/source/deepwork/claude-opus-5.md +28 -0
  155. package/prompts/source/deepwork/codex.md +9 -0
  156. package/prompts/source/deepwork/default.md +129 -0
  157. package/prompts/source/deepwork/gemini.md +184 -0
  158. package/prompts/source/deepwork/glm.md +256 -0
  159. package/prompts/source/deepwork/gpt.md +43 -0
  160. package/prompts/source/deepwork/kimi-k27.md +13 -0
  161. package/prompts/source/deepwork/planner.md +41 -0
  162. package/prompts/source/deepwork/swe-2.md +13 -0
  163. package/prompts/source/manifest.json +3118 -0
  164. package/prompts/source/shared/dsh-host-contract.md +6 -0
  165. package/prompts/source/shared/locale.md +8 -0
  166. package/prompts/source/shared/shell-safety.md +7 -0
  167. package/prompts/source/terminal/builder.md +13 -0
  168. package/prompts/source/terminal/clarifier.md +41 -0
  169. package/prompts/source/terminal/code-search.md +39 -0
  170. package/prompts/source/terminal/coding.md +41 -0
  171. package/prompts/source/terminal/complex.md +43 -0
  172. package/prompts/source/terminal/creative.md +41 -0
  173. package/prompts/source/terminal/cross-cutting.md +43 -0
  174. package/prompts/source/terminal/deep.md +43 -0
  175. package/prompts/source/terminal/doc-search.md +39 -0
  176. package/prompts/source/terminal/documenting.md +41 -0
  177. package/prompts/source/terminal/frontend.md +41 -0
  178. package/prompts/source/terminal/hard-reasoning.md +41 -0
  179. package/prompts/source/terminal/media-reader.md +39 -0
  180. package/prompts/source/terminal/normal-task.md +41 -0
  181. package/prompts/source/terminal/oracle-2nd.md +53 -0
  182. package/prompts/source/terminal/oracle.md +53 -0
  183. package/prompts/source/terminal/orchestrator.md +26 -0
  184. package/prompts/source/terminal/plan-critic.md +41 -0
  185. package/prompts/source/terminal/planner.md +42 -0
  186. package/prompts/source/terminal/quick.md +39 -0
  187. package/prompts/source/terminal/research.md +39 -0
  188. package/prompts/source/terminal/reviewer.md +53 -0
  189. package/skills/ast-grep/LICENSE +21 -0
  190. package/skills/ast-grep/README.md +138 -0
  191. package/skills/ast-grep/SKILL.md +284 -0
  192. package/skills/ast-grep/SOURCE +1 -0
  193. package/skills/ast-grep/install.ps1 +235 -0
  194. package/skills/ast-grep/install.sh +286 -0
  195. package/skills/ast-grep/references/cli.md +233 -0
  196. package/skills/ast-grep/references/install.md +168 -0
  197. package/skills/ast-grep/references/patterns.md +149 -0
  198. package/skills/ast-grep/references/pitfalls.md +305 -0
  199. package/skills/ast-grep/references/recipes.md +404 -0
  200. package/skills/ast-grep/references/sgconfig.md +250 -0
  201. package/skills/ast-grep/references/yaml-rules.md +511 -0
  202. package/skills/ast-grep/scripts/ast_grep_helper.py +760 -0
  203. package/skills/ast-grep/tests/smoke.ps1 +129 -0
  204. package/skills/ast-grep/tests/smoke.sh +212 -0
  205. package/skills/ast-grep/tests/test_resolver.py +154 -0
  206. package/skills/brainstorming/SKILL.md +102 -9
  207. package/skills/coding-agent-sessions/LICENSE-UPSTREAM.md +82 -0
  208. package/skills/coding-agent-sessions/NOTICE.md +24 -0
  209. package/skills/coding-agent-sessions/SKILL.md +144 -0
  210. package/skills/coding-agent-sessions/agents/openai.yaml +4 -0
  211. package/skills/coding-agent-sessions/pyrightconfig.json +5 -0
  212. package/skills/coding-agent-sessions/references/all-platforms.md +77 -0
  213. package/skills/coding-agent-sessions/references/claude.md +34 -0
  214. package/skills/coding-agent-sessions/references/codex.md +32 -0
  215. package/skills/coding-agent-sessions/references/opencode.md +45 -0
  216. package/skills/coding-agent-sessions/references/senpi.md +29 -0
  217. package/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
  218. package/skills/coding-agent-sessions/scripts/agent_sessions/aside_scanner.py +140 -0
  219. package/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
  220. package/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
  221. package/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
  222. package/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
  223. package/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
  224. package/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
  225. package/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
  226. package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -0
  227. package/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +104 -0
  228. package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
  229. package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
  230. package/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
  231. package/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
  232. package/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
  233. package/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
  234. package/skills/coding-agent-sessions/scripts/tests/test_agent_sessions.py +322 -0
  235. package/skills/coding-agent-sessions/scripts/tests/test_aside_scanner.py +131 -0
  236. package/skills/coding-agent-sessions/scripts/tests/test_cli_contract.py +126 -0
  237. package/skills/coding-agent-sessions/scripts/tests/test_extended_scanners.py +262 -0
  238. package/skills/coding-agent-sessions/scripts/tests/test_optional_sqlite_scanners.py +79 -0
  239. package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -0
  240. package/skills/debugging/SKILL.md +125 -4
  241. package/skills/debugging/references/logging.md +2 -0
  242. package/skills/debugging/references/methodology/00-setup.md +2 -0
  243. package/skills/debugging/references/methodology/02-investigate.md +8 -2
  244. package/skills/debugging/references/methodology/03-flaky-triage.md +3 -1
  245. package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +4 -2
  246. package/skills/debugging/references/methodology/05-escalate.md +2 -0
  247. package/skills/debugging/references/methodology/06-fix.md +2 -0
  248. package/skills/debugging/references/methodology/08-qa.md +2 -0
  249. package/skills/debugging/references/methodology/09-cleanup.md +2 -0
  250. package/skills/debugging/references/methodology/partial-runtime-evidence.md +4 -2
  251. package/skills/debugging/references/runtimes/bundled-js-binary.md +2 -0
  252. package/skills/debugging/references/runtimes/go.md +2 -0
  253. package/skills/debugging/references/runtimes/native-binary.md +2 -0
  254. package/skills/debugging/references/runtimes/node.md +2 -0
  255. package/skills/debugging/references/runtimes/python.md +2 -0
  256. package/skills/debugging/references/runtimes/rust.md +2 -0
  257. package/skills/debugging/references/scripts/dap.test.mjs +539 -0
  258. package/skills/debugging/references/scripts/fixture-adapter.mjs +164 -0
  259. package/skills/debugging/references/tools/dap.md +3 -1
  260. package/skills/debugging/references/tools/ghidra.md +2 -0
  261. package/skills/debugging/references/tools/playwright-cli.md +2 -0
  262. package/skills/debugging/references/tools/pwndbg.md +2 -0
  263. package/skills/debugging/references/tools/pwntools.md +2 -0
  264. package/skills/dispatching-parallel-agents/SKILL.md +94 -7
  265. package/skills/frontend/.frontend-materialized.json +856 -0
  266. package/skills/frontend/ATTRIBUTION.md +37 -0
  267. package/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
  268. package/skills/frontend/LICENSE-taste-skill.txt +21 -0
  269. package/skills/frontend/LICENSE-ui-ux-pro-max.txt +21 -0
  270. package/skills/frontend/SKILL.md +142 -0
  271. package/skills/frontend/references/design/README.md +256 -0
  272. package/skills/frontend/references/design/_INDEX.md +206 -0
  273. package/skills/frontend/references/design/airbnb.md +393 -0
  274. package/skills/frontend/references/design/airtable.md +92 -0
  275. package/skills/frontend/references/design/apple.md +250 -0
  276. package/skills/frontend/references/design/aside.md +211 -0
  277. package/skills/frontend/references/design/binance.md +348 -0
  278. package/skills/frontend/references/design/bmw.md +183 -0
  279. package/skills/frontend/references/design/brutalist-skill.md +92 -0
  280. package/skills/frontend/references/design/bugatti.md +271 -0
  281. package/skills/frontend/references/design/cal.md +262 -0
  282. package/skills/frontend/references/design/claude.md +315 -0
  283. package/skills/frontend/references/design/clay.md +307 -0
  284. package/skills/frontend/references/design/clickhouse.md +284 -0
  285. package/skills/frontend/references/design/clone-from-url.md +69 -0
  286. package/skills/frontend/references/design/cohere.md +269 -0
  287. package/skills/frontend/references/design/coinbase.md +132 -0
  288. package/skills/frontend/references/design/composio.md +310 -0
  289. package/skills/frontend/references/design/cursor.md +312 -0
  290. package/skills/frontend/references/design/design-system-architecture.md +250 -0
  291. package/skills/frontend/references/design/elevenlabs.md +268 -0
  292. package/skills/frontend/references/design/expo.md +284 -0
  293. package/skills/frontend/references/design/ferrari.md +317 -0
  294. package/skills/frontend/references/design/figma.md +223 -0
  295. package/skills/frontend/references/design/framer.md +249 -0
  296. package/skills/frontend/references/design/gpt-tasteskill.md +74 -0
  297. package/skills/frontend/references/design/hashicorp.md +281 -0
  298. package/skills/frontend/references/design/ibm.md +335 -0
  299. package/skills/frontend/references/design/image-to-code-skill.md +1228 -0
  300. package/skills/frontend/references/design/imagegen-brandkit.md +798 -0
  301. package/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
  302. package/skills/frontend/references/design/imagegen-frontend-web.md +987 -0
  303. package/skills/frontend/references/design/interaction-skill.md +52 -0
  304. package/skills/frontend/references/design/intercom.md +149 -0
  305. package/skills/frontend/references/design/kraken.md +128 -0
  306. package/skills/frontend/references/design/lamborghini.md +291 -0
  307. package/skills/frontend/references/design/linear.app.md +370 -0
  308. package/skills/frontend/references/design/lovable.md +301 -0
  309. package/skills/frontend/references/design/mastercard.md +368 -0
  310. package/skills/frontend/references/design/meta.md +369 -0
  311. package/skills/frontend/references/design/minimalist-skill.md +85 -0
  312. package/skills/frontend/references/design/minimax.md +260 -0
  313. package/skills/frontend/references/design/mintlify.md +329 -0
  314. package/skills/frontend/references/design/miro.md +111 -0
  315. package/skills/frontend/references/design/mistral.ai.md +264 -0
  316. package/skills/frontend/references/design/mongodb.md +269 -0
  317. package/skills/frontend/references/design/nike.md +366 -0
  318. package/skills/frontend/references/design/notion.md +312 -0
  319. package/skills/frontend/references/design/nvidia.md +296 -0
  320. package/skills/frontend/references/design/ollama.md +270 -0
  321. package/skills/frontend/references/design/opencode.ai.md +284 -0
  322. package/skills/frontend/references/design/output-skill.md +49 -0
  323. package/skills/frontend/references/design/pinterest.md +233 -0
  324. package/skills/frontend/references/design/playstation.md +367 -0
  325. package/skills/frontend/references/design/posthog.md +259 -0
  326. package/skills/frontend/references/design/raycast.md +271 -0
  327. package/skills/frontend/references/design/react-dev-tooling-skill.md +232 -0
  328. package/skills/frontend/references/design/redesign-skill.md +178 -0
  329. package/skills/frontend/references/design/renault.md +314 -0
  330. package/skills/frontend/references/design/replicate.md +264 -0
  331. package/skills/frontend/references/design/resend.md +306 -0
  332. package/skills/frontend/references/design/revolut.md +188 -0
  333. package/skills/frontend/references/design/runwayml.md +247 -0
  334. package/skills/frontend/references/design/sanity.md +360 -0
  335. package/skills/frontend/references/design/sentry.md +265 -0
  336. package/skills/frontend/references/design/shopify.md +353 -0
  337. package/skills/frontend/references/design/soft-skill.md +98 -0
  338. package/skills/frontend/references/design/spacex.md +197 -0
  339. package/skills/frontend/references/design/spotify.md +249 -0
  340. package/skills/frontend/references/design/starbucks.md +583 -0
  341. package/skills/frontend/references/design/stitch-design-example.md +121 -0
  342. package/skills/frontend/references/design/stitch-skill.md +184 -0
  343. package/skills/frontend/references/design/stripe.md +325 -0
  344. package/skills/frontend/references/design/supabase.md +258 -0
  345. package/skills/frontend/references/design/superhuman.md +255 -0
  346. package/skills/frontend/references/design/taste-skill.md +1206 -0
  347. package/skills/frontend/references/design/tesla.md +289 -0
  348. package/skills/frontend/references/design/theverge.md +342 -0
  349. package/skills/frontend/references/design/together.ai.md +266 -0
  350. package/skills/frontend/references/design/uber.md +298 -0
  351. package/skills/frontend/references/design/vercel.md +313 -0
  352. package/skills/frontend/references/design/vodafone.md +426 -0
  353. package/skills/frontend/references/design/voltagent.md +326 -0
  354. package/skills/frontend/references/design/warp.md +256 -0
  355. package/skills/frontend/references/design/webflow.md +95 -0
  356. package/skills/frontend/references/design/wired.md +281 -0
  357. package/skills/frontend/references/design/wise.md +176 -0
  358. package/skills/frontend/references/design/x.ai.md +260 -0
  359. package/skills/frontend/references/design/zapier.md +331 -0
  360. package/skills/frontend/references/perfection/README.md +264 -0
  361. package/skills/frontend/references/perfection/react-perf-tooling.md +234 -0
  362. package/skills/frontend/references/ui-ux-db/README.md +659 -0
  363. package/skills/frontend/references/ui-ux-db/data/app-interface.csv +31 -0
  364. package/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
  365. package/skills/frontend/references/ui-ux-db/data/colors.csv +162 -0
  366. package/skills/frontend/references/ui-ux-db/data/google-fonts.csv +1924 -0
  367. package/skills/frontend/references/ui-ux-db/data/icons.csv +106 -0
  368. package/skills/frontend/references/ui-ux-db/data/landing.csv +35 -0
  369. package/skills/frontend/references/ui-ux-db/data/products.csv +162 -0
  370. package/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
  371. package/skills/frontend/references/ui-ux-db/data/stacks/angular.csv +51 -0
  372. package/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
  373. package/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
  374. package/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
  375. package/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
  376. package/skills/frontend/references/ui-ux-db/data/stacks/laravel.csv +51 -0
  377. package/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
  378. package/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
  379. package/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
  380. package/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
  381. package/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
  382. package/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
  383. package/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
  384. package/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
  385. package/skills/frontend/references/ui-ux-db/data/stacks/threejs.csv +54 -0
  386. package/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
  387. package/skills/frontend/references/ui-ux-db/data/styles.csv +85 -0
  388. package/skills/frontend/references/ui-ux-db/data/typography.csv +74 -0
  389. package/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +162 -0
  390. package/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
  391. package/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
  392. package/skills/frontend/references/ui-ux-db/scripts/core.py +262 -0
  393. package/skills/frontend/references/ui-ux-db/scripts/design_system.py +1148 -0
  394. package/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
  395. package/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
  396. package/skills/git-master/SKILL.md +112 -0
  397. package/skills/git-master/agents/openai.yaml +13 -0
  398. package/skills/init-deep/SKILL.md +279 -0
  399. package/skills/receiving-code-review/SKILL.md +112 -7
  400. package/skills/remove-ai-slops/SKILL.md +159 -8
  401. package/skills/requesting-code-review/SKILL.md +96 -3
  402. package/skills/requesting-code-review/code-reviewer.md +47 -0
  403. package/skills/subagent-driven-development/SKILL.md +176 -6
  404. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +23 -0
  405. package/skills/subagent-driven-development/implementer-prompt.md +69 -0
  406. package/skills/subagent-driven-development/spec-reviewer-prompt.md +32 -0
  407. package/skills/using-git-worktrees/SKILL.md +141 -0
  408. package/skills/writing-plans/SKILL.md +121 -7
  409. package/skills/writing-plans/plan-document-reviewer-prompt.md +38 -0
@@ -5,24 +5,63 @@ import { parseTree } from "jsonc-parser";
5
5
  import { ABSENT_PROFILE_SELECTION_REVISION } from "./profile-types.js";
6
6
  import { DsmmProfileError, MAX_PROFILE_BYTES, MAX_PROFILE_COUNT, MAX_PROFILE_DIRECTORY_ENTRIES, MAX_PROFILE_REVISIONS, parseProfileDocument, profileErrorInfo, validateProfileId, validateProfileRevision } from "./profiles.js";
7
7
  export const MAX_SESSION_PROFILE_CHOICES = 1024;
8
+ const trustedLayout = Symbol("trusted profile storage layout");
9
+ const LEGACY_WRITE_RESTRICTION = "Legacy profiles are read-only. Explicitly import them before saving or changing selections.";
8
10
  /** This directory is supplied by the Host, never by a remote method parameter. */
9
11
  export class ProfileStore {
10
12
  profileDir;
13
+ stateDir;
11
14
  timeoutMs;
12
15
  pollMs;
13
16
  rename;
14
17
  rootIdentity;
18
+ origin;
19
+ hostProfile;
20
+ identities = new Map();
15
21
  constructor(profileDir, options = {}) {
16
- if (!isAbsolute(profileDir) || dirname(resolve(profileDir)) === resolve(profileDir) || basename(resolve(profileDir)) !== "dsmm-profiles") {
22
+ const layout = options[trustedLayout];
23
+ if (!isAbsolute(profileDir) || dirname(resolve(profileDir)) === resolve(profileDir) || (layout === undefined && basename(resolve(profileDir)) !== "dsmm-profiles")) {
17
24
  throw new DsmmProfileError("unsafe-path", "The Host must supply its native profile's dsmm-profiles directory.");
18
25
  }
19
26
  this.profileDir = resolve(profileDir);
27
+ this.stateDir = layout?.stateDir ?? this.profileDir;
28
+ this.origin = layout?.origin ?? "explicit";
29
+ this.hostProfile = layout?.hostProfile;
20
30
  this.timeoutMs = boundedOption(options.lockTimeoutMs, 2000, 0, 30000);
21
31
  this.pollMs = boundedOption(options.lockPollMs, 25, 1, 1000);
22
32
  this.rename = options.rename ?? renameSync;
23
33
  }
34
+ static fromCentral(home, canonicalHostProfile, actualEntryId, options = {}) {
35
+ const root = trustedHome(home);
36
+ validateTrustedDirectoryPath(canonicalHostProfile);
37
+ if (resolve(canonicalHostProfile) !== canonicalHostProfile)
38
+ throw new DsmmProfileError("unsafe-path", "A canonical Host profile identity is required.");
39
+ validateDirectories(canonicalHostProfile, false);
40
+ if (typeof actualEntryId !== "string" || actualEntryId.length < 1 || actualEntryId.length > 256 || actualEntryId.trim().length === 0
41
+ || /[\u0000-\u001f\u007f]/u.test(actualEntryId) || Buffer.from(actualEntryId, "utf8").toString("utf8") !== actualEntryId) {
42
+ throw new DsmmProfileError("validation", "A bounded native entry identity is required.", "actualEntryId");
43
+ }
44
+ const identity = process.platform === "win32" ? canonicalHostProfile.toLowerCase() : canonicalHostProfile;
45
+ const profileDir = join(root, "plugins", "dsmm", "profiles");
46
+ const stateDir = join(profileDir, ".state", digest(Buffer.from(JSON.stringify([identity, actualEntryId]), "utf8")));
47
+ const trusted = { ...options, [trustedLayout]: { origin: "central", stateDir, hostProfile: canonicalHostProfile } };
48
+ const store = new ProfileStore(profileDir, trusted);
49
+ store.validateRoot(false);
50
+ store.validateState(false);
51
+ return store;
52
+ }
53
+ static fromLegacy(legacyDir, options = {}) {
54
+ validateTrustedDirectoryPath(legacyDir);
55
+ if (basename(resolve(legacyDir)) !== "dsmm-profiles")
56
+ throw new DsmmProfileError("unsafe-path", "The legacy store must be the Host's exact dsmm-profiles directory.");
57
+ const root = resolve(legacyDir);
58
+ const trusted = { ...options, [trustedLayout]: { origin: "legacy", stateDir: root } };
59
+ const store = new ProfileStore(root, trusted);
60
+ store.validateRoot(false);
61
+ return store;
62
+ }
24
63
  async describe() {
25
- return this.locked(() => {
64
+ return this.readOperation(() => {
26
65
  const entries = this.inventory();
27
66
  const profiles = entries.map((name) => {
28
67
  const id = name.slice(0, -6);
@@ -39,19 +78,20 @@ export class ProfileStore {
39
78
  });
40
79
  try {
41
80
  const selected = this.selection();
42
- return { profiles, selectedId: selected.selectedId, appliedRevision: selected.appliedRevision, selectionRevision: selected.selectionRevision };
81
+ return { ...this.metadata(), profiles, selectedId: selected.selectedId, appliedRevision: selected.appliedRevision, selectionRevision: selected.selectionRevision };
43
82
  }
44
83
  catch (error) {
45
84
  // An error is not a successful fallback to the baseline.
46
- return { profiles, selectedId: null, appliedRevision: null, selectionRevision: "unavailable", selectionError: profileErrorInfo(error, "corrupt-selection") };
85
+ return { ...this.metadata(), profiles, selectedId: null, appliedRevision: null, selectionRevision: "unavailable", selectionError: profileErrorInfo(error, "corrupt-selection") };
47
86
  }
48
87
  });
49
88
  }
50
89
  async read(id) {
51
90
  validateProfileId(id);
52
- return this.locked(() => this.readResult(this.draft(id, this.inventory())));
91
+ return this.readOperation(() => this.readResult(this.draft(id, this.inventory())));
53
92
  }
54
93
  async save(request) {
94
+ this.assertWritable();
55
95
  validateProfileId(request.id);
56
96
  const document = parseProfileDocument(request.content, request.id);
57
97
  if (request.expectedRevision !== null)
@@ -76,13 +116,14 @@ export class ProfileStore {
76
116
  });
77
117
  }
78
118
  async loadSelection() {
79
- return this.locked(() => this.selection());
119
+ return this.readOperation(() => this.selection());
80
120
  }
81
121
  async loadSessionSelection(sessionId) {
82
122
  validateSessionProfileId(sessionId);
83
- return this.locked(() => this.sessionSelection(sessionId));
123
+ return this.readOperation(() => this.sessionSelection(sessionId));
84
124
  }
85
125
  async selectSession(request, epoch, validateCandidate, commit) {
126
+ this.assertWritable();
86
127
  validateSessionProfileId(request.sessionId);
87
128
  validateSelectionRequest(request);
88
129
  validateProfileRevision(epoch, "admissionEpoch");
@@ -102,7 +143,7 @@ export class ProfileStore {
102
143
  throw error;
103
144
  throw new DsmmProfileError("activation", "The candidate profile could not be activated; the previous session selection was retained.");
104
145
  }
105
- const directory = join(this.profileDir, ".sessions");
146
+ const directory = join(this.stateDir, ".sessions");
106
147
  const target = join(directory, `${sessionChoiceKey(request.sessionId)}.json`);
107
148
  const fence = (temporary) => {
108
149
  commit.assertCurrent();
@@ -110,7 +151,7 @@ export class ProfileStore {
110
151
  conflict("The session selection was edited externally. Refresh before selecting again.");
111
152
  if (draft !== undefined && this.draft(request.id, this.inventory()).revision !== draft.revision)
112
153
  conflict("The draft changed during activation. Reload and select again.");
113
- validateDirectories(directory, false);
154
+ validateDirectories(directory, false, false, this.identities);
114
155
  // The one exclusive atomic staging file is not a session choice.
115
156
  const entries = boundedEntries(directory, MAX_SESSION_PROFILE_CHOICES + (temporary === undefined ? 0 : 1))
116
157
  .filter((name) => temporary === undefined || name !== basename(temporary));
@@ -119,7 +160,7 @@ export class ProfileStore {
119
160
  };
120
161
  assertLock();
121
162
  commit.assertCurrent();
122
- validateDirectories(directory, true);
163
+ validateDirectories(directory, true, false, this.identities);
123
164
  fence();
124
165
  if (draft !== undefined)
125
166
  this.publishRevision(draft, assertLock);
@@ -133,6 +174,7 @@ export class ProfileStore {
133
174
  });
134
175
  }
135
176
  async select(request, validateCandidate) {
177
+ this.assertWritable();
136
178
  validateSelectionRequest(request);
137
179
  return this.locked(async (assertLock) => {
138
180
  const current = this.selection();
@@ -159,7 +201,8 @@ export class ProfileStore {
159
201
  this.publishRevision(draft, assertLock);
160
202
  const pointer = { version: 1, id: request.id, revision: draft?.revision ?? null };
161
203
  const bytes = Buffer.from(`${JSON.stringify(pointer)}\n`, "utf8");
162
- this.atomicReplace(join(this.profileDir, ".selection.json"), bytes, () => {
204
+ this.validateState(true);
205
+ this.atomicReplace(join(this.stateDir, ".selection.json"), bytes, () => {
163
206
  this.assertSelectionRevision(request.expectedSelectionRevision);
164
207
  if (draft !== undefined && this.draft(request.id, this.inventory()).revision !== draft.revision)
165
208
  conflict("The draft changed during selection. Reload and select again.");
@@ -174,7 +217,8 @@ export class ProfileStore {
174
217
  return { id: draft.document.id, ...(draft.document.label === undefined ? {} : { label: draft.document.label }), revision: draft.revision, content: draft.content };
175
218
  }
176
219
  inventory() {
177
- this.validateRoot(false);
220
+ if (!this.validateRoot(false))
221
+ return [];
178
222
  const names = boundedEntries(this.profileDir, MAX_PROFILE_DIRECTORY_ENTRIES).filter((name) => !name.startsWith(".") && /\.jsonc$/iu.test(name)).sort();
179
223
  if (names.length > MAX_PROFILE_COUNT)
180
224
  throw new DsmmProfileError("limit", "Profile inventory exceeds the 128-profile limit.");
@@ -204,9 +248,13 @@ export class ProfileStore {
204
248
  }
205
249
  selection() {
206
250
  this.validateRoot(false);
207
- const path = join(this.profileDir, ".selection.json");
208
- if (status(path) === undefined)
251
+ this.validateState(false);
252
+ const path = join(this.stateDir, ".selection.json");
253
+ if (status(path) === undefined) {
254
+ if (this.origin === "legacy")
255
+ throw new DsmmProfileError("corrupt-selection", "The legacy selection is missing. Restore its original pointer and immutable revision explicitly.");
209
256
  return { selectedId: null, appliedRevision: null, selectionRevision: ABSENT_PROFILE_SELECTION_REVISION, document: null, content: null };
257
+ }
210
258
  try {
211
259
  const file = regularFile(path, 1024);
212
260
  const pointer = parseSelectionPointer(file.content);
@@ -227,9 +275,10 @@ export class ProfileStore {
227
275
  }
228
276
  sessionSelection(sessionId, temporary) {
229
277
  this.validateRoot(false);
278
+ this.validateState(false);
230
279
  const absent = { sessionId, admissionEpoch: null, selectedId: null, appliedRevision: null,
231
280
  selectionRevision: ABSENT_PROFILE_SELECTION_REVISION, document: null, content: null };
232
- const directory = join(this.profileDir, ".sessions");
281
+ const directory = join(this.stateDir, ".sessions");
233
282
  if (status(directory) === undefined)
234
283
  return absent;
235
284
  validateDirectories(directory, false);
@@ -295,112 +344,181 @@ export class ProfileStore {
295
344
  }
296
345
  }
297
346
  atomicReplace(target, bytes, beforeRename, assertLock) {
298
- assertLock();
299
- if (status(target) !== undefined)
300
- assertRegular(status(target));
301
- const temporary = join(dirname(target), `.dsmm-tmp-${randomUUID()}`);
302
- let fd;
303
- let created = false;
304
- try {
305
- fd = openSync(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 0o600);
306
- created = true;
307
- writeAll(fd, bytes);
308
- fsyncSync(fd);
309
- closeSync(fd);
310
- fd = undefined;
311
- this.validateRoot(false);
312
- if (status(target) !== undefined)
313
- assertRegular(status(target));
314
- beforeRename(temporary);
347
+ atomicReplace(target, bytes, beforeRename, () => {
315
348
  assertLock();
316
- this.rename(temporary, target);
317
- created = false;
318
- // rename is the transaction commit. No fallible work follows it.
319
- }
320
- finally {
321
- if (fd !== undefined)
322
- closeSync(fd);
323
- if (created) {
324
- try {
325
- unlinkSync(temporary);
326
- }
327
- catch { /* Never remove another or previous file to recover a failed commit. */ }
328
- }
329
- }
349
+ validateDirectories(dirname(target), false, false, this.identities);
350
+ }, this.rename);
330
351
  }
331
352
  validateRoot(create) {
332
- validateDirectories(this.profileDir, create);
353
+ if (this.hostProfile !== undefined)
354
+ validateDirectories(this.hostProfile, false, false, this.identities);
355
+ if (!validateDirectories(this.profileDir, create, this.origin === "central", this.identities))
356
+ return false;
333
357
  const current = lstatSync(this.profileDir);
334
358
  if (this.rootIdentity !== undefined && !sameFile(this.rootIdentity, current)) {
335
359
  throw new DsmmProfileError("unsafe-path", "The profile storage directory was replaced during this Host's lifetime; no operation was committed.");
336
360
  }
337
361
  this.rootIdentity ??= current;
362
+ return true;
338
363
  }
339
- async locked(operation) {
340
- let fd;
341
- let ownedStatus;
342
- let ownedBytes;
343
- const lockPath = join(this.profileDir, ".lock");
344
- const assertLock = () => {
345
- this.validateRoot(false);
346
- const current = status(lockPath);
347
- if (fd === undefined || ownedStatus === undefined || ownedBytes === undefined || current === undefined || !sameFile(ownedStatus, current) || !sameFile(ownedStatus, fstatSync(fd))) {
348
- conflict("Profile lock ownership changed during this operation. No selection was committed; retry after the current owner finishes.");
349
- }
350
- assertRegular(current);
351
- assertRegular(fstatSync(fd));
352
- if (!regularFile(lockPath, 256).bytes.equals(ownedBytes))
353
- conflict("The profile lock was altered during this operation. No selection was committed; retry after the current owner finishes.");
354
- };
364
+ validateState(create) {
365
+ return validateDirectories(this.stateDir, create, this.origin === "central", this.identities);
366
+ }
367
+ metadata() {
368
+ return { origin: this.origin, readOnly: this.origin === "legacy", ...(this.origin === "legacy" ? { writeRestriction: LEGACY_WRITE_RESTRICTION } : {}) };
369
+ }
370
+ get readOnly() { return this.origin === "legacy"; }
371
+ get writeRestriction() { return this.readOnly ? LEGACY_WRITE_RESTRICTION : undefined; }
372
+ assertWritable() {
373
+ if (this.origin === "legacy")
374
+ throw new DsmmProfileError("unavailable", LEGACY_WRITE_RESTRICTION);
375
+ }
376
+ async readOperation(operation) {
377
+ if (this.origin === "explicit")
378
+ return this.locked(operation);
355
379
  try {
356
- this.validateRoot(true);
357
- const deadline = performance.now() + this.timeoutMs;
358
- for (;;) {
359
- this.validateRoot(false);
360
- try {
361
- fd = openSync(lockPath, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 0o600);
362
- ownedStatus = fstatSync(fd);
363
- ownedBytes = Buffer.from(`${process.pid} ${randomUUID()}\n`, "utf8");
364
- writeAll(fd, ownedBytes);
365
- fsyncSync(fd);
366
- break;
367
- }
368
- catch (error) {
369
- if (fd !== undefined || errorCode(error) !== "EEXIST")
370
- throw error;
371
- const existing = status(lockPath);
372
- if (existing !== undefined)
373
- assertRegular(existing);
374
- if (performance.now() >= deadline)
375
- throw new DsmmProfileError("lock-timeout", "Another process owns the profile lock. Retry after it finishes; locks are never stolen.");
376
- await new Promise((done) => setTimeout(done, Math.min(this.pollMs, Math.max(1, deadline - performance.now()))));
377
- }
380
+ const first = operation();
381
+ const second = operation();
382
+ this.validateRoot(false);
383
+ this.validateState(false);
384
+ if (JSON.stringify(first) !== JSON.stringify(second)) {
385
+ throw new DsmmProfileError(this.origin === "legacy" ? "corrupt-selection" : "conflict", "Profile storage changed during the read. No selection was admitted; retry after it is stable.");
378
386
  }
379
- assertLock();
380
- return await operation(assertLock);
387
+ return second;
381
388
  }
382
389
  catch (error) {
383
390
  if (error instanceof DsmmProfileError)
384
391
  throw error;
385
- throw new DsmmProfileError("io", "Deepwork profile storage failed. Existing files and the previous selection were retained.");
392
+ throw new DsmmProfileError("io", "Deepwork profile storage could not be read safely.");
386
393
  }
387
- finally {
388
- if (fd !== undefined) {
389
- try {
390
- closeSync(fd);
391
- }
392
- catch { /* A committed pointer must remain a successful transaction. */ }
393
- try {
394
- this.validateRoot(false);
395
- const current = status(lockPath);
396
- if (ownedStatus !== undefined && ownedBytes !== undefined && current !== undefined && sameFile(ownedStatus, current) && current.isFile() && !current.isSymbolicLink() && regularFile(lockPath, 256).bytes.equals(ownedBytes))
397
- unlinkSync(lockPath);
398
- }
399
- catch { /* Do not delete a replacement lock or traverse an altered root. */ }
394
+ }
395
+ async locked(operation) {
396
+ this.assertWritable();
397
+ return locked(this.profileDir, ".lock", (create) => { this.validateRoot(create); }, this.timeoutMs, this.pollMs, operation);
398
+ }
399
+ }
400
+ async function locked(directory, lockName, validateRoot, timeoutMs, pollMs, operation) {
401
+ let fd;
402
+ let ownedStatus;
403
+ let ownedBytes;
404
+ const lockPath = join(directory, lockName);
405
+ const assertLock = () => {
406
+ validateRoot(false);
407
+ const current = status(lockPath);
408
+ if (fd === undefined || ownedStatus === undefined || ownedBytes === undefined || current === undefined || !sameFile(ownedStatus, current) || !sameFile(ownedStatus, fstatSync(fd))) {
409
+ conflict("Profile lock ownership changed during this operation. No selection was committed; retry after the current owner finishes.");
410
+ }
411
+ assertRegular(current);
412
+ assertRegular(fstatSync(fd));
413
+ if (!regularFile(lockPath, 256).bytes.equals(ownedBytes))
414
+ conflict("The profile lock was altered during this operation. No selection was committed; retry after the current owner finishes.");
415
+ };
416
+ try {
417
+ validateRoot(true);
418
+ const deadline = performance.now() + timeoutMs;
419
+ for (;;) {
420
+ validateRoot(false);
421
+ try {
422
+ fd = openSync(lockPath, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 0o600);
423
+ ownedStatus = fstatSync(fd);
424
+ ownedBytes = Buffer.from(`${process.pid} ${randomUUID()}\n`, "utf8");
425
+ writeAll(fd, ownedBytes);
426
+ fsyncSync(fd);
427
+ break;
428
+ }
429
+ catch (error) {
430
+ if (fd !== undefined || errorCode(error) !== "EEXIST")
431
+ throw error;
432
+ const existing = status(lockPath);
433
+ if (existing !== undefined)
434
+ assertRegular(existing);
435
+ if (performance.now() >= deadline)
436
+ throw new DsmmProfileError("lock-timeout", "Another process owns the profile lock. Retry after it finishes; locks are never stolen.");
437
+ await new Promise((done) => setTimeout(done, Math.min(pollMs, Math.max(1, deadline - performance.now()))));
400
438
  }
401
439
  }
440
+ assertLock();
441
+ return await operation(assertLock);
442
+ }
443
+ catch (error) {
444
+ if (error instanceof DsmmProfileError)
445
+ throw error;
446
+ throw new DsmmProfileError("io", "Deepwork profile storage failed. Existing files and the previous selection were retained.");
447
+ }
448
+ finally {
449
+ if (fd !== undefined) {
450
+ try {
451
+ closeSync(fd);
452
+ }
453
+ catch { /* A committed pointer must remain a successful transaction. */ }
454
+ try {
455
+ validateRoot(false);
456
+ const current = status(lockPath);
457
+ if (ownedStatus !== undefined && ownedBytes !== undefined && current !== undefined && sameFile(ownedStatus, current) && current.isFile() && !current.isSymbolicLink() && regularFile(lockPath, 256).bytes.equals(ownedBytes))
458
+ unlinkSync(lockPath);
459
+ }
460
+ catch { /* Do not delete a replacement lock or traverse an altered root. */ }
461
+ }
462
+ }
463
+ }
464
+ function atomicReplace(target, bytes, beforeRename, assertAuthority, rename, assertCurrent) {
465
+ assertAuthority();
466
+ if (status(target) !== undefined)
467
+ assertRegular(status(target));
468
+ const temporary = join(dirname(target), `.dsmm-tmp-${randomUUID()}`);
469
+ let fd;
470
+ let created = false;
471
+ let owned;
472
+ try {
473
+ fd = openSync(temporary, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 0o600);
474
+ created = true;
475
+ owned = fstatSync(fd);
476
+ assertRegular(owned);
477
+ writeAll(fd, bytes);
478
+ fsyncSync(fd);
479
+ closeSync(fd);
480
+ fd = undefined;
481
+ assertAuthority();
482
+ if (status(target) !== undefined)
483
+ assertRegular(status(target));
484
+ beforeRename(temporary);
485
+ assertAuthority();
486
+ const staged = regularFile(temporary, bytes.length);
487
+ if (!sameFile(owned, lstatSync(temporary)) || !staged.bytes.equals(bytes))
488
+ conflict("The staged file changed before commit. No file was replaced.");
489
+ assertCurrent?.();
490
+ rename(temporary, target);
491
+ created = false;
492
+ // rename is the transaction commit. No fallible work follows it.
493
+ }
494
+ finally {
495
+ if (fd !== undefined)
496
+ closeSync(fd);
497
+ if (created) {
498
+ try {
499
+ assertAuthority();
500
+ const current = status(temporary);
501
+ if (owned !== undefined && current !== undefined && sameFile(owned, current))
502
+ unlinkSync(temporary);
503
+ }
504
+ catch { /* Never traverse an altered root or remove another owner's staging file. */ }
505
+ }
506
+ }
507
+ }
508
+ function validateTrustedDirectoryPath(path) {
509
+ if (typeof path !== "string" || path.length > 4096 || !isAbsolute(path) || /[\u0000-\u001f\u007f]/u.test(path)
510
+ || Buffer.from(path, "utf8").toString("utf8") !== path || dirname(resolve(path)) === resolve(path)) {
511
+ throw new DsmmProfileError("unsafe-path", "A bounded absolute trusted Host directory is required.");
402
512
  }
403
513
  }
514
+ function trustedHome(home) {
515
+ validateTrustedDirectoryPath(home);
516
+ const root = resolve(home);
517
+ validateDirectories(root, false, true);
518
+ return root;
519
+ }
520
+ /** @internal Shared only by the fixed config file adapter; not a wire-path storage API. */
521
+ export const profileStoreFilePrimitives = { trustedHome, validateDirectories, status, regularFile, digest, boundedOption, locked, atomicReplace };
404
522
  function boundedOption(value, fallback, minimum, maximum) {
405
523
  if (value === undefined)
406
524
  return fallback;
@@ -424,7 +542,7 @@ function status(path) {
424
542
  throw error;
425
543
  }
426
544
  }
427
- function validateDirectories(directory, create) {
545
+ function validateDirectories(directory, create, allowMissing = false, identities) {
428
546
  const absolute = resolve(directory);
429
547
  const root = parse(absolute).root;
430
548
  const parts = [];
@@ -433,6 +551,8 @@ function validateDirectories(directory, create) {
433
551
  parts.unshift(root);
434
552
  for (const path of parts) {
435
553
  let found = status(path);
554
+ if (found === undefined && identities?.has(path))
555
+ throw new DsmmProfileError("unsafe-path", "A pinned storage directory disappeared; storage authority was invalidated.");
436
556
  if (found === undefined && create) {
437
557
  try {
438
558
  mkdirSync(path, { mode: 0o700 });
@@ -443,13 +563,21 @@ function validateDirectories(directory, create) {
443
563
  }
444
564
  found = status(path);
445
565
  }
566
+ if (found === undefined && allowMissing) {
567
+ return false;
568
+ }
446
569
  if (found === undefined || found.isSymbolicLink() || !found.isDirectory())
447
570
  throw new DsmmProfileError("unsafe-path", "Profile directories and every ancestor must be real directories, not links or junctions.");
448
571
  const canonical = resolve(realpathSync(path));
449
572
  if ((process.platform === "win32" ? canonical.toLowerCase() : canonical) !== (process.platform === "win32" ? path.toLowerCase() : path)) {
450
573
  throw new DsmmProfileError("unsafe-path", "Profile storage must not traverse redirected directories or reparse points.");
451
574
  }
575
+ const pinned = identities?.get(path);
576
+ if (pinned !== undefined && !sameFile(pinned, found))
577
+ throw new DsmmProfileError("unsafe-path", "A storage directory was replaced; storage authority was invalidated.");
578
+ identities?.set(path, found);
452
579
  }
580
+ return true;
453
581
  }
454
582
  function assertRegular(found) {
455
583
  if (found.isSymbolicLink() || !found.isFile() || found.nlink !== 1)
@@ -459,6 +587,7 @@ function sameFile(first, second) {
459
587
  return first.dev === second.dev && first.ino === second.ino;
460
588
  }
461
589
  function regularFile(path, maximum) {
590
+ validateDirectories(dirname(path), false);
462
591
  const before = status(path);
463
592
  if (before === undefined)
464
593
  throw new DsmmProfileError("not-found", "The required profile file does not exist.");
@@ -467,6 +596,7 @@ function regularFile(path, maximum) {
467
596
  throw new DsmmProfileError("limit", "Profile storage contains an oversized file.");
468
597
  const fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
469
598
  try {
599
+ validateDirectories(dirname(path), false);
470
600
  const opened = fstatSync(fd);
471
601
  assertRegular(opened);
472
602
  if (!sameFile(before, opened))
@@ -483,6 +613,10 @@ function regularFile(path, maximum) {
483
613
  throw new DsmmProfileError("limit", "Profile storage contains an oversized file.");
484
614
  const after = fstatSync(fd);
485
615
  const named = status(path);
616
+ validateDirectories(dirname(path), false);
617
+ assertRegular(after);
618
+ if (named !== undefined)
619
+ assertRegular(named);
486
620
  if (named === undefined || !sameFile(opened, named) || opened.size !== after.size || opened.mtimeMs !== after.mtimeMs || opened.ctimeMs !== after.ctimeMs)
487
621
  conflict("The profile file was edited while being read. Retry the operation.");
488
622
  const bytes = buffer.subarray(0, size);
@@ -1,6 +1,55 @@
1
1
  /** Wire-only profile data: safe to import from the native browser client. */
2
2
  import type { DsmmRoleId } from "./roles.js";
3
+ import type { DsmmModuleState } from "./modules.js";
3
4
  import type { DsmmModelRoute, DsmmProfileScope } from "./settings.js";
5
+ /** Non-executable schema projection for the native deployment editor. */
6
+ export interface DeploymentSchemaNode {
7
+ type: string;
8
+ fields?: Record<string, DeploymentSchemaNode>;
9
+ inner?: DeploymentSchemaNode;
10
+ alternatives?: DeploymentSchemaNode[];
11
+ value?: string | number | boolean;
12
+ min?: number;
13
+ max?: number;
14
+ step?: number;
15
+ required?: boolean;
16
+ keys?: readonly string[];
17
+ nonempty?: boolean;
18
+ }
19
+ export interface DeploymentAdmissionView {
20
+ /** Host-redacted read-only view, never raw editor input or actual runtime settings. */
21
+ settings: Record<string, unknown>;
22
+ sources: Record<string, string>;
23
+ captures: Record<string, string>;
24
+ restartRequired: readonly string[];
25
+ named: {
26
+ id: string;
27
+ revision: string;
28
+ } | null;
29
+ }
30
+ export interface DeploymentEditorSnapshot {
31
+ entryId: string;
32
+ namespace: string | null;
33
+ hostProfileKey: string;
34
+ global: Record<string, unknown>;
35
+ globalRevision: string;
36
+ profile: Record<string, unknown>;
37
+ nativeRevision: string;
38
+ nativeFormRevision: number | null;
39
+ nativeForm: {
40
+ base: unknown;
41
+ user: unknown;
42
+ } | null;
43
+ /** Host-redacted inspector layers. global/profile/nativeForm remain C0 editor input. */
44
+ desired: Record<string, unknown>;
45
+ sources: Record<string, string>;
46
+ startup: Record<string, unknown>;
47
+ startupSources?: Record<string, string>;
48
+ defaults: Record<string, unknown>;
49
+ schema: DeploymentSchemaNode;
50
+ nextRoot: DeploymentAdmissionView | null;
51
+ modules: DsmmModuleState[];
52
+ }
4
53
  import type { DsmmRateLimitPolicy, DsmmRoutingStrategy, DsmmRuntimePolicyConfig, DsmmRuntimePolicySettings } from "./routing-policy.js";
5
54
  export type ProfileErrorCode = "validation" | "conflict" | "not-found" | "lock-timeout" | "unsafe-path" | "io" | "activation" | "corrupt-selection" | "limit" | "busy" | "maintenance" | "disposed" | "not-owned" | "unavailable" | "cancelled";
6
55
  export interface ProfileErrorInfo {
@@ -25,6 +74,9 @@ export interface ProfileSnapshot extends ProfileSelectionState {
25
74
  /** Native deployment role inventory; excludes provider accounts and auth data. */
26
75
  roles?: ProfileRoleMetadata[];
27
76
  editorDefaults?: DsmmRuntimePolicySettings;
77
+ origin?: "central" | "legacy" | "explicit";
78
+ readOnly?: boolean;
79
+ writeRestriction?: string;
28
80
  }
29
81
  export interface ProfileReadResult {
30
82
  id: string;
@@ -75,6 +127,9 @@ export interface SessionProfileSnapshot {
75
127
  profileModel?: DsmmModelRoute;
76
128
  /** Optional for older Hosts; explicit session intent always beats defaults. */
77
129
  deepwork?: SessionDeepworkState;
130
+ /** Safe captured module admission; not a read of the current global editor. */
131
+ modules?: DsmmModuleState[];
132
+ configuration?: DeploymentAdmissionView;
78
133
  }
79
134
  export interface SessionDeepworkState {
80
135
  active: boolean;
@@ -0,0 +1,25 @@
1
+ import type { DsmmDelegationGroup, DsmmRoleMode } from "./roles.js";
2
+ export declare function readPromptAsset(path: string): string;
3
+ export interface SourceRoleContent {
4
+ id: string;
5
+ sourceId: string;
6
+ kind: "role" | "category";
7
+ name: string;
8
+ description: string;
9
+ order: number;
10
+ mode: DsmmRoleMode;
11
+ enabledByDefault: boolean;
12
+ access: "read-only" | "write";
13
+ delegation: DsmmDelegationGroup;
14
+ allowedChildren: string[];
15
+ childBuilderAllowedChildren?: string[];
16
+ promptArtifact: string | null;
17
+ terminalArtifact: string;
18
+ }
19
+ export declare const SOURCE_ROLE_CATALOG: readonly SourceRoleContent[];
20
+ export declare function splitCategory(text: string): {
21
+ base: string;
22
+ calibrations: Map<string, string>;
23
+ };
24
+ export declare function buildRolePersona(role: SourceRoleContent): string;
25
+ //# sourceMappingURL=prompt-content.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ // This content-only dependency must not import settings or model routing:
5
+ // roles need it during ESM initialization, including prompts-first imports.
6
+ const sourceRoot = join(dirname(dirname(fileURLToPath(import.meta.url))), "prompts", "source");
7
+ const assets = new Map();
8
+ export function readPromptAsset(path) {
9
+ let text = assets.get(path);
10
+ if (text === undefined) {
11
+ text = readFileSync(join(sourceRoot, path), "utf8").trim();
12
+ assets.set(path, text);
13
+ }
14
+ return text;
15
+ }
16
+ export const SOURCE_ROLE_CATALOG = JSON.parse(readPromptAsset("catalog.json"));
17
+ export function splitCategory(text) {
18
+ const calibrations = new Map();
19
+ const base = text.replace(/\r?\n?<model-calibration model="([^"]+)">\r?\n([\s\S]*?)\r?\n<\/model-calibration>\r?\n?/gu, (_block, model, calibration) => { calibrations.set(model, calibration.trim()); return "\n"; }).trim();
20
+ return { base, calibrations };
21
+ }
22
+ export function buildRolePersona(role) {
23
+ const source = role.promptArtifact === null ? role.description : readPromptAsset(role.promptArtifact.replace("prompts/source/", ""));
24
+ const body = role.kind === "category" ? splitCategory(source).base : source;
25
+ return [`You are ${role.name} (role ID: ${role.id}).`, role.mode === "primary" || role.mode === "all" ? readPromptAsset("shared/locale.md") : "", body, readPromptAsset("shared/dsh-host-contract.md"), readPromptAsset(role.terminalArtifact.replace("prompts/source/", ""))].filter(Boolean).join("\n\n---\n\n");
26
+ }
27
+ //# sourceMappingURL=prompt-content.js.map