@dsmm/dsmm 0.2.0 → 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 (291) hide show
  1. package/README.md +38 -66
  2. package/agent-presets/dsmm-builder/agent.cordis.yml +10 -2015
  3. package/agent-presets/dsmm-clarifier/agent.cordis.yml +24 -343
  4. package/agent-presets/dsmm-code-search/agent.cordis.yml +19 -6
  5. package/agent-presets/dsmm-coding/agent.cordis.yml +19 -438
  6. package/agent-presets/dsmm-complex/agent.cordis.yml +23 -1009
  7. package/agent-presets/dsmm-creative/agent.cordis.yml +25 -442
  8. package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +29 -1013
  9. package/agent-presets/dsmm-deep/agent.cordis.yml +24 -1008
  10. package/agent-presets/dsmm-doc-search/agent.cordis.yml +19 -6
  11. package/agent-presets/dsmm-documenting/agent.cordis.yml +26 -439
  12. package/agent-presets/dsmm-frontend/agent.cordis.yml +21 -440
  13. package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +22 -441
  14. package/agent-presets/dsmm-media-reader/agent.cordis.yml +19 -6
  15. package/agent-presets/dsmm-normal-task/agent.cordis.yml +19 -438
  16. package/agent-presets/dsmm-oracle/agent.cordis.yml +25 -340
  17. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +25 -340
  18. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +29 -2025
  19. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +24 -341
  20. package/agent-presets/dsmm-planner/agent.cordis.yml +14 -344
  21. package/agent-presets/dsmm-quick/agent.cordis.yml +19 -6
  22. package/agent-presets/dsmm-research/agent.cordis.yml +23 -8
  23. package/agent-presets/dsmm-reviewer/agent.cordis.yml +25 -340
  24. package/docs/agent-presets.md +36 -52
  25. package/docs/compatibility.md +50 -108
  26. package/docs/deferred-native-approval-risk.md +19 -0
  27. package/docs/design.md +2 -2
  28. package/docs/lsp.md +11 -21
  29. package/docs/migration-from-ocmm.md +2 -2
  30. package/docs/model-routing.md +84 -59
  31. package/docs/native-permissions.md +35 -0
  32. package/docs/profiles.md +40 -87
  33. package/docs/releasing.md +83 -2
  34. package/docs/roadmap.md +71 -17
  35. package/docs/settings-status.md +34 -169
  36. package/docs/skill-sync.md +52 -15
  37. package/lib/child-admission-contract.d.ts +37 -0
  38. package/lib/child-admission-contract.js +2 -0
  39. package/lib/child-admission.d.ts +42 -0
  40. package/lib/child-admission.js +162 -0
  41. package/lib/child-capture.d.ts +81 -0
  42. package/lib/child-capture.js +203 -0
  43. package/lib/child-evidence.d.ts +17 -0
  44. package/lib/child-evidence.js +43 -0
  45. package/lib/client/ChildrenPanel.d.ts +43 -0
  46. package/lib/client/ChildrenPanel.js +82 -0
  47. package/lib/client/DeploymentPage.js +15 -8
  48. package/lib/client/EditableChoice.d.ts +17 -0
  49. package/lib/client/EditableChoice.js +49 -0
  50. package/lib/client/PermissionsPanel.d.ts +14 -0
  51. package/lib/client/PermissionsPanel.js +46 -0
  52. package/lib/client/ProfilesSection.js +30 -15
  53. package/lib/client/RoleAvailability.d.ts +7 -0
  54. package/lib/client/RoleAvailability.js +19 -0
  55. package/lib/client/SessionProfiles.js +27 -9
  56. package/lib/client/StructuredEditor.js +15 -7
  57. package/lib/client/children-controller.d.ts +98 -0
  58. package/lib/client/children-controller.js +296 -0
  59. package/lib/client/children-locales.d.ts +367 -0
  60. package/lib/client/children-locales.js +69 -0
  61. package/lib/client/controller.d.ts +6 -1
  62. package/lib/client/controller.js +14 -8
  63. package/lib/client/deployment-data.d.ts +2 -1
  64. package/lib/client/deployment-data.js +34 -5
  65. package/lib/client/deployment-locales.d.ts +4 -0
  66. package/lib/client/deployment-locales.js +11 -2
  67. package/lib/client/diagnostics.d.ts +14 -0
  68. package/lib/client/diagnostics.js +53 -0
  69. package/lib/client/index.d.ts +4 -0
  70. package/lib/client/index.js +96 -2
  71. package/lib/client/locales.d.ts +54 -0
  72. package/lib/client/locales.js +34 -16
  73. package/lib/client/permission-client.d.ts +16 -0
  74. package/lib/client/permission-client.js +38 -0
  75. package/lib/client/permission-controller.d.ts +62 -0
  76. package/lib/client/permission-controller.js +149 -0
  77. package/lib/client/permission-locales.d.ts +114 -0
  78. package/lib/client/permission-locales.js +75 -0
  79. package/lib/client/session-labels.js +4 -4
  80. package/lib/client/structured.js +19 -5
  81. package/lib/client/styles.d.ts +1 -1
  82. package/lib/client/styles.js +20 -0
  83. package/lib/client.js +5780 -1679
  84. package/lib/core-permission-authority.d.ts +18 -0
  85. package/lib/core-permission-authority.js +255 -0
  86. package/lib/core-permissions.d.ts +8 -0
  87. package/lib/core-permissions.js +33 -0
  88. package/lib/delivery-authority.d.ts +68 -0
  89. package/lib/delivery-authority.js +260 -0
  90. package/lib/deployment-config.d.ts +23 -0
  91. package/lib/deployment-config.js +61 -40
  92. package/lib/deployment-permission-rules.d.ts +55 -0
  93. package/lib/deployment-permission-rules.js +306 -0
  94. package/lib/dsh-types.d.ts +10 -4
  95. package/lib/guards.d.ts +1 -1
  96. package/lib/guards.js +29 -8
  97. package/lib/host-llm-startup.d.ts +41 -0
  98. package/lib/host-llm-startup.js +65 -0
  99. package/lib/host-llm.d.ts +92 -0
  100. package/lib/host-llm.js +325 -0
  101. package/lib/index.d.ts +15 -4
  102. package/lib/index.js +300 -47
  103. package/lib/legacy-child-policy.d.ts +51 -0
  104. package/lib/legacy-child-policy.js +123 -0
  105. package/lib/legacy-read-composition.d.ts +20 -0
  106. package/lib/legacy-read-composition.js +144 -0
  107. package/lib/legacy-read-contracts.d.ts +157 -0
  108. package/lib/legacy-read-contracts.js +39 -0
  109. package/lib/legacy-read-host.d.ts +19 -0
  110. package/lib/legacy-read-host.js +67 -0
  111. package/lib/legacy-read-integration.d.ts +121 -0
  112. package/lib/legacy-read-integration.js +522 -0
  113. package/lib/legacy-read-proxy.d.ts +26 -0
  114. package/lib/legacy-read-proxy.js +237 -0
  115. package/lib/live-pi-ai-owner.d.ts +18 -0
  116. package/lib/live-pi-ai-owner.js +144 -0
  117. package/lib/llm-runtime.d.ts +11 -0
  118. package/lib/llm-runtime.js +21 -0
  119. package/lib/managed-settings.d.ts +5 -0
  120. package/lib/managed-settings.js +14 -0
  121. package/lib/model-parameter-policy.d.ts +11 -0
  122. package/lib/model-parameter-policy.js +27 -0
  123. package/lib/model-routing.js +28 -17
  124. package/lib/modules.d.ts +13 -5
  125. package/lib/modules.js +17 -1
  126. package/lib/native-child-evidence.d.ts +42 -0
  127. package/lib/native-child-evidence.js +133 -0
  128. package/lib/native-pi-ai-wire.d.ts +37 -0
  129. package/lib/native-pi-ai-wire.js +261 -0
  130. package/lib/native-scope.js +1 -1
  131. package/lib/permission-bash.d.ts +6 -0
  132. package/lib/permission-bash.js +7 -0
  133. package/lib/permission-control.d.ts +73 -0
  134. package/lib/permission-control.js +205 -0
  135. package/lib/permission-controller.d.ts +68 -0
  136. package/lib/permission-controller.js +317 -0
  137. package/lib/permission-errors.d.ts +7 -0
  138. package/lib/permission-errors.js +21 -0
  139. package/lib/permission-fs-search.d.ts +5 -0
  140. package/lib/permission-fs-search.js +7 -0
  141. package/lib/permission-fs.d.ts +5 -0
  142. package/lib/permission-fs.js +7 -0
  143. package/lib/permission-native-access.d.ts +11 -0
  144. package/lib/permission-native-access.js +6 -0
  145. package/lib/permission-native-command.d.ts +10 -0
  146. package/lib/permission-native-command.js +93 -0
  147. package/lib/permission-native-rules.d.ts +75 -0
  148. package/lib/permission-native-rules.js +278 -0
  149. package/lib/permission-pwsh.d.ts +6 -0
  150. package/lib/permission-pwsh.js +7 -0
  151. package/lib/permission-remote.d.ts +26 -0
  152. package/lib/permission-remote.js +53 -0
  153. package/lib/permission-rpc.d.ts +29 -0
  154. package/lib/permission-rpc.js +152 -0
  155. package/lib/permission-rules.d.ts +115 -0
  156. package/lib/permission-rules.js +256 -0
  157. package/lib/permission-settings.d.ts +45 -0
  158. package/lib/permission-settings.js +48 -0
  159. package/lib/permission-shell.d.ts +38 -0
  160. package/lib/permission-shell.js +150 -0
  161. package/lib/permission-web.d.ts +5 -0
  162. package/lib/permission-web.js +7 -0
  163. package/lib/preset-registry.js +36 -25
  164. package/lib/profile-diagnostics.d.ts +45 -0
  165. package/lib/profile-diagnostics.js +148 -0
  166. package/lib/profile-locale.d.ts +3 -0
  167. package/lib/profile-locale.js +2 -0
  168. package/lib/profile-remote.d.ts +8 -0
  169. package/lib/profile-remote.js +163 -39
  170. package/lib/profile-rpc.d.ts +4 -3
  171. package/lib/profile-rpc.js +14 -12
  172. package/lib/profile-runtime.d.ts +40 -1
  173. package/lib/profile-runtime.js +368 -93
  174. package/lib/profile-store.d.ts +11 -0
  175. package/lib/profile-store.js +143 -11
  176. package/lib/profile-types.d.ts +70 -1
  177. package/lib/profile-types.js +1 -0
  178. package/lib/profiles.d.ts +16 -2
  179. package/lib/profiles.js +156 -79
  180. package/lib/prompt-content.js +1 -1
  181. package/lib/prompts.d.ts +37 -2
  182. package/lib/prompts.js +111 -9
  183. package/lib/recovery-policy.js +20 -7
  184. package/lib/role-control-remote.d.ts +38 -0
  185. package/lib/role-control-remote.js +211 -0
  186. package/lib/role-control-rpc.d.ts +51 -0
  187. package/lib/role-control-rpc.js +377 -0
  188. package/lib/role-control-types.d.ts +92 -0
  189. package/lib/role-control-types.js +8 -0
  190. package/lib/role-invocation.d.ts +47 -0
  191. package/lib/role-invocation.js +135 -0
  192. package/lib/role-llm-runtime.d.ts +17 -0
  193. package/lib/role-llm-runtime.js +62 -0
  194. package/lib/role-llm.d.ts +31 -0
  195. package/lib/role-llm.js +66 -0
  196. package/lib/role-policy.d.ts +49 -8
  197. package/lib/role-policy.js +437 -60
  198. package/lib/role-providers.d.ts +1 -1
  199. package/lib/role-providers.js +30 -35
  200. package/lib/role-routing.d.ts +11 -2
  201. package/lib/role-routing.js +42 -25
  202. package/lib/role-runs.d.ts +135 -0
  203. package/lib/role-runs.js +304 -0
  204. package/lib/role-subagents.d.ts +58 -3
  205. package/lib/role-subagents.js +169 -56
  206. package/lib/roles.d.ts +5 -6
  207. package/lib/roles.js +10 -39
  208. package/lib/route-json.d.ts +19 -0
  209. package/lib/route-json.js +129 -0
  210. package/lib/routing-policy.d.ts +2 -0
  211. package/lib/routing-policy.js +12 -2
  212. package/lib/runtime-integration.d.ts +112 -0
  213. package/lib/runtime-integration.js +784 -0
  214. package/lib/runtime-recovery.js +18 -8
  215. package/lib/settings.d.ts +47 -13
  216. package/lib/settings.js +217 -82
  217. package/lib/skills.js +2 -2
  218. package/lib/status.d.ts +10 -1
  219. package/lib/status.js +11 -8
  220. package/lib/subagent-runtime.d.ts +45 -0
  221. package/lib/subagent-runtime.js +131 -0
  222. package/package.json +106 -56
  223. package/patches/subagent-runtime.yml +15 -0
  224. package/prompts/deepseek-flash.md +1 -1
  225. package/prompts/deepseek-v4-pro.md +2 -2
  226. package/prompts/deepwork.md +27 -18
  227. package/prompts/source/agents/clarifier.md +5 -3
  228. package/prompts/source/agents/orchestrator.md +18 -9
  229. package/prompts/source/agents/plan-critic.md +5 -1
  230. package/prompts/source/agents/planner.md +4 -2
  231. package/prompts/source/agents/reviewer.md +6 -0
  232. package/prompts/source/category/complex.md +4 -4
  233. package/prompts/source/category/creative.md +6 -4
  234. package/prompts/source/category/cross-cutting.md +10 -8
  235. package/prompts/source/category/deep.md +5 -3
  236. package/prompts/source/category/documenting.md +7 -1
  237. package/prompts/source/category/frontend.md +2 -2
  238. package/prompts/source/category/hard-reasoning.md +3 -3
  239. package/prompts/source/category/research.md +4 -2
  240. package/prompts/source/deepwork/claude-opus-5.md +2 -2
  241. package/prompts/source/deepwork/codex.md +1 -1
  242. package/prompts/source/deepwork/default.md +22 -15
  243. package/prompts/source/deepwork/gemini.md +23 -16
  244. package/prompts/source/deepwork/glm.md +21 -14
  245. package/prompts/source/deepwork/gpt.md +12 -6
  246. package/prompts/source/deepwork/planner.md +8 -5
  247. package/prompts/source/manifest.json +178 -63
  248. package/prompts/source/shared/dsh-host-contract.md +5 -3
  249. package/prompts/source/shared/locale.md +2 -2
  250. package/prompts/source/terminal/orchestrator.md +1 -1
  251. package/scripts/cold-profile-composition.mjs +329 -0
  252. package/scripts/cold-profile-sources.mjs +238 -0
  253. package/scripts/migrate-cold-profile.mjs +315 -0
  254. package/skills/ast-grep/SKILL.md +7 -4
  255. package/skills/brainstorming/SKILL.md +43 -22
  256. package/skills/coding-agent-sessions/SKILL.md +7 -4
  257. package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -46
  258. package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -130
  259. package/skills/debugging/SKILL.md +14 -9
  260. package/skills/debugging/references/methodology/00-setup.md +14 -62
  261. package/skills/debugging/references/methodology/02-investigate.md +4 -4
  262. package/skills/debugging/references/methodology/03-flaky-triage.md +3 -3
  263. package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +2 -14
  264. package/skills/debugging/references/methodology/06-fix.md +6 -6
  265. package/skills/debugging/references/methodology/08-qa.md +5 -5
  266. package/skills/debugging/references/methodology/09-cleanup.md +15 -153
  267. package/skills/debugging/references/methodology/partial-runtime-evidence.md +3 -16
  268. package/skills/debugging/references/runtimes/bundled-js-binary.md +1 -16
  269. package/skills/debugging/references/runtimes/native-binary.md +9 -54
  270. package/skills/debugging/references/runtimes/node.md +4 -15
  271. package/skills/debugging/references/runtimes/python.md +3 -15
  272. package/skills/debugging/references/runtimes/rust.md +2 -18
  273. package/skills/debugging/references/tools/dap.md +1 -1
  274. package/skills/debugging/references/tools/ghidra.md +4 -15
  275. package/skills/debugging/references/tools/playwright-cli.md +3 -15
  276. package/skills/debugging/references/tools/pwntools.md +4 -16
  277. package/skills/dispatching-parallel-agents/SKILL.md +18 -16
  278. package/skills/frontend/SKILL.md +7 -4
  279. package/skills/frontend/references/design/react-dev-tooling-skill.md +1 -1
  280. package/skills/git-master/SKILL.md +7 -4
  281. package/skills/init-deep/SKILL.md +7 -4
  282. package/skills/receiving-code-review/SKILL.md +17 -12
  283. package/skills/remove-ai-slops/SKILL.md +39 -38
  284. package/skills/requesting-code-review/SKILL.md +19 -17
  285. package/skills/requesting-code-review/code-reviewer.md +13 -1
  286. package/skills/subagent-driven-development/SKILL.md +29 -26
  287. package/skills/subagent-driven-development/implementer-prompt.md +29 -11
  288. package/skills/subagent-driven-development/spec-reviewer-prompt.md +6 -1
  289. package/skills/using-git-worktrees/SKILL.md +7 -4
  290. package/skills/writing-plans/SKILL.md +29 -24
  291. package/skills/writing-plans/plan-document-reviewer-prompt.md +10 -1
@@ -1,16 +1,20 @@
1
1
  # DSMM source-content synchronization
2
2
 
3
- The source baseline is OCMM `89ca14b`, with DSH fixed to **0.2.0-rc.2**. This is full-content adaptation, not short personas. The maintenance inventory lives in `scripts/source-inventory.mjs`; generated `prompts/source/manifest.json` records actual source → artifact → consumer, source anchors, adaptation rules, canonical role/skill inventories, attribution and exclusions. Runtime uses package-relative assets only; it never requires an OCMM checkout, global SDK path or maintenance compiler.
3
+ DSH is fixed to **0.2.0-rc.2**. Source synchronization reads the committed **DSMM-owned `source-inputs/` snapshot**, never a live or historical OCMM Root fallback. Explicit maintenance refresh captures raw bytes from the Root worktree. `source-inputs/manifest.json` records the actual full Root baseline commit and the paths whose raw Git blobs differ from that baseline, including uncommitted/untracked worktree content or checkout byte differences. The captured baseline is `3b680211feeb93508b3817546f37bee2291c402b`; raw-byte `overlayPaths` do not by themselves claim uncommitted semantic changes or a new Root commit. Generated `prompts/source/manifest.json` derives `sourceRef` from that captured baseline and retains the overlay provenance. This is full-content adaptation, not short personas. The maintenance inventory lives in `scripts/source-inventory.mjs`; the generated manifest carries the actual source → artifact → consumer, source anchors, adaptation rules, canonical role/skill inventories, attribution and exclusions. Runtime uses package-relative prepared assets only; it never requires the raw snapshot, an OCMM checkout, global SDK path or maintenance compiler. Root AGENTS, Codex bundles and user/provider/model configuration are not synchronization inputs.
4
+
5
+ The raw closure is limited to the two catalog TS files, `src/hooks/config.ts`, prompt-loader/model-family assembly anchors, shared shell safety, the explicitly selected v1 role/category/workflow Markdown, and the fourteen selected recursive skill resource trees. `source-inputs/root/` preserves their actual bytes; no whole-Root copy, runtime import of Root code, extra ledger or whole-repository hash is used. The one input manifest binds paths, byte lengths and SHA-256 digests for source/resource integrity. Snapshot `.gitattributes` disables Git text conversion for `root/**`; DSMM's local `.gitattributes` also preserves prepared source prompts, skill resources and `src/skills.ts` bytes through Git checkout. Excluded frontend attribution/license inputs are supplied by DSMM's existing fixed-pin recipe, not copied and falsely claimed as consumed Root inputs.
4
6
 
5
7
  ## Inventories and assembly
6
8
 
7
- Primary/all personas also retain the actual source default `buildLocaleGuidance` prefix: infer the user's language, preserve identifiers/quotes, and respect any explicit host locale. This introduces no DSMM locale setting or private host-config lookup.
9
+ Every role/category persona adapts the source default `buildLocaleGuidance` prefix for visible output. `buildDsmmLocaleGuidance` and `buildDsmmAgentGuidance` add the exact Agent's immutable captured `settings.locale`: `en`, `zh-Hans`, `zh-Hant`, `ja`, `ko`, `de`, `fr`, `es`, `pt-BR`, or `ru`. Omission inherits applicable host/user language guidance, otherwise the request/context; it is not an English default. The current user's explicit output-language request wins. Preserve code, identifiers, paths, commands, protocol fields and exact quotations; child assignments retain explicit language instructions. A later parent Apply does not rewrite an old child's captured preference. No Root session preference, private host-config lookup, internal reasoning-language guarantee or host/project locale change is supplied.
8
10
 
9
11
  The 11 base roles come from `src/data/agents.ts`; the 11 categories come from `src/data/categories.ts`. Oracle slots reuse the full reviewer source. Builder/code-search/doc-search/media-reader have no standalone source role Markdown: their actual catalog responsibilities, source workflow and terminal TS policy are consumed, not invented personas. Existing `dsmm-creative` remains the one creative category. All 22 have stable metadata and templates; cross-cutting alone defaults off. File existence is never callable evidence.
10
12
 
11
- `src/prompt-content.ts` is a content-only package loader; it avoids a roles → prompt/model-routing initialization cycle. Role/category bodies and source `terminalPromptSuffixFor` policies are assembled into persona once. Category `<model-calibration>` blocks are removed from persistent persona and selected separately. The active common section preserves the full default workflow; model guidance is additive and subordinate to persona, permissions and output contract. Planner adds its source doctrine; Opus 5/5.5 calibration is orchestrator-only; GPT/Codex gets the shared GPT layer once; Gemini/GLM, exact Kimi Code aliases and SWE-2 retain their applicable full source guidance. The v1 Codex variant is adapted tool compatibility, not a separate Codex host or adapter behavior stack.
13
+ `src/prompt-content.ts` is a content-only package loader with no settings/model-routing runtime dependency. Role/category bodies, shared language priority and source `terminalPromptSuffixFor` policies assemble into persona once. Category `<model-calibration>` blocks are removed from persistent persona and selected separately. `src/prompts.ts` also keeps calibration assembly independent of the provider/routing graph. The active common section preserves the full default workflow; model guidance is additive and subordinate to persona, permissions and output contract. Planner adds its source doctrine; Opus 5/5.5 calibration is orchestrator-only; GPT/Codex gets the shared GPT layer once; Gemini/GLM, exact Kimi Code aliases and SWE-2 retain their applicable full source guidance. The v1 Codex variant is adapted tool compatibility, not a separate Codex host or adapter behavior stack.
14
+
15
+ The current Root sources preserve final-state artifacts and functional/interface regression evidence, orchestrator-owned complex product planning, direct routine non-product work, bounded useful delegation, and material-relevance evidence reuse. DSMM retains those requirements in full while adapting native read-only planner persistence, lazy skill loading, tool topology, per-invocation resource selection and lifecycle authority. Common mode off withdraws workflow/DSMM skills only; persona, read-only, Git authorization and scoped language guidance remain independent.
12
16
 
13
- The fourteen skills are brainstorming, writing-plans, requesting-code-review, receiving-code-review, subagent-driven-development, dispatching-parallel-agents, remove-ai-slops, debugging, frontend, git-master, ast-grep, coding-agent-sessions, init-deep, and using-git-worktrees. **Actual canonical remove-ai-slops is `skills/remove-ai-slops`**, not a nonexistent v1 copy or generated Codex/DSMM summary. Its ten cleanup categories and green regression protection remain; arbitrary batches, LOC splitting, redundant tests, forced status tokens and unauthorized Git restore are adapted to bounded evidence-led cleanup.
17
+ The fourteen skills are brainstorming, writing-plans, requesting-code-review, receiving-code-review, subagent-driven-development, dispatching-parallel-agents, remove-ai-slops, debugging, frontend, git-master, ast-grep, coding-agent-sessions, init-deep, and using-git-worktrees. **Actual canonical remove-ai-slops is `skills/remove-ai-slops`**, not a nonexistent v1 copy or generated Codex/DSMM summary. Its ten categories protect final valid requirements and committed contracts with passing functional/interface evidence, not uncommitted transition behavior or descriptive-text locks. Routine maintenance resolves directly; coordination stays in session. Arbitrary batches, LOC splitting, redundant tests, forced status tokens and unauthorized Git restore are adapted to bounded evidence-led cleanup and corrections of task-owned edits.
14
18
 
15
19
  ## Lazy native resources
16
20
 
@@ -20,22 +24,55 @@ The Stage A ancestor snapshot/precedence, incomplete-observation refusal, invoca
20
24
 
21
25
  The published 0.1.9 `./preset-skills` export retains its minimal Config/name/inject/apply compatibility shape; apply itself registers nothing. Its module is not dead: the main entry still calls the actual `registerAgentSkills` there, with unchanged registration/lifecycle. Likewise, `renderAgentCordis` and the shared renderer retain their ignored optional skills argument in its original second position so existing enabledRoles/roleRouting callers do not shift. Native Agent configuration controls visibility. This is a bounded public compatibility ruling, not a future provider/wrapper or remaining removal blocker; no module/function has been moved to another helper.
22
26
 
23
- ## Reproduce and check (maintainer checkout only)
27
+ ## Refresh, reproduce and check
24
28
 
25
- Use existing Node/TypeScript/pnpm. A new checkout first needs explicit fixed-pin frontend materialization; this fetches only approved documentation/CSV/Python/license bytes and executes no third-party code or installer:
29
+ Use existing Node/TypeScript/pnpm. To deliberately adopt reviewed Root worktree changes, run from `dsmm/` with the existing complete fixed-pin frontend library:
26
30
 
27
31
  ```powershell
28
- pnpm run sync:source
29
- pnpm run sync:frontend # explicit network operation; no HEAD/alternate pin fallback
30
- pnpm run sync:source # records validated frontend provenance in the manifest
31
- pnpm run build
32
- pnpm run generate:roles
33
- pnpm run check:source
32
+ node --experimental-strip-types scripts/source-inputs.mjs --refresh
33
+ pnpm run sync:source # adapts the sealed snapshot; never refreshes it implicitly
34
34
  ```
35
35
 
36
- During development use direct targeted Node tests and typecheck. `sync:source -- --check` compares source-adapted results without writing; `generate:roles -- --check` checks renderer output without writing. Sync writes changed artifacts only; a second run must report no differences. An anchor mismatch fails before artifacts are written; do not silently accept changed source assembly. Update the baseline, mapping/rules and useful regressions together after reviewing a source change. Do not hand-edit generated prompt/source assets, skills or presets.
36
+ Refresh reads only the declared closure twice and compares raw bytes, path inventory and baseline provenance. A changed capture gets at most one consistency retake; continued drift fails before snapshot writes. The destination's existing parent and all ancestors must be regular directories. An existing snapshot must validate completely, including both metadata files and every raw input; dangling/live links, malformed directories, unknown entries and integrity drift are refused before mutation. Refresh writes exclusively into a new task-owned sibling candidate, loads that candidate and runs the adapter's catalog, permission/assembly anchors and adapted resource-closure checks there. It rechecks the existing snapshot before same-parent rename publication and restores the untouched original on publication failure. Unknown existing content is never deleted as a refresh repair. A failed rollback preserves the original backup and reports its location rather than cleaning it away; post-commit staging cleanup limitations are reported explicitly. Review and commit the entire refreshed snapshot, adapter changes when needed, and prepared targets together through the authorized commit owner. Missing, additional, changed, linked or non-regular snapshot inputs fail closed; source check never repairs them from Root. A stale prepared resource not in the current output inventory is a failure and must be reviewed/removed explicitly, not silently retained or deleted by sync.
37
+
38
+ CI and a cold released checkout use the tag's own adapter/generator and committed snapshot by default:
39
+
40
+ ```powershell
41
+ pnpm run sync:source # optional rebuild of prepared source targets from sealed inputs
42
+ pnpm run build # coordinated build owner; offline frontend integrity gate first
43
+ pnpm run generate:roles # coordinated renderer owner, after build
44
+ pnpm run check:source # read-only regenerated byte comparison plus resource gates
45
+ ```
46
+
47
+ `node --experimental-strip-types scripts/sync-source-assets.mjs --check` regenerates all source-adapted bytes in memory and compares them to prepared targets without writing. It checks inputs before targets, rather than hashing targets alone or skipping source drift. `node scripts/generate-role-assets.mjs --check` separately checks renderer output. `check:source` requires both comparisons and the actual resource/fixed-pin gates; a passing source-only comparison is not full build/renderer/release completion. Prepared targets must retain their generated bytes in the released checkout, without text-conversion filters; `src/skills.ts` retains its existing surrounding source while regenerating the metadata section.
48
+
49
+ Direct regression checks do not emit shared `lib/` or presets:
50
+
51
+ ```powershell
52
+ node --import ./test/prompt-source-loader.mjs --test --experimental-strip-types --test-concurrency=1 test/source-inputs.test.ts test/source-sync.test.ts
53
+ ```
54
+
55
+ These checks commit the DSMM source snapshot and prepared targets in a disposable fixture repository, then clone and execute that checkout's generator with no Root catalog/policy/prompt/skill checkout, using only the already-installed compiler. The cold Git-only clone first refuses absent ignored frontend resources. Once the already-verified fixed-pin library is delivered, check and fresh regeneration must reproduce every adapted byte, including a text-converting checkout. Cold regeneration removes every prepared target, including the frontend index, while retaining the authored `src/skills.ts` shell and genuine fixed-pin vendor library. The replay's generated index drives recipe selection, offline vendor validation and resource closure; stale prepared index bytes cannot supply the recipe or mask missing input dependencies. Missing/drifted vendor resources remain fatal before output writes. Checks also exercise raw-input tamper/missing/extra/link refusal, resealed permission-anchor and resource-closure errors, actual metadata regeneration, prepared extra-resource refusal, bounded capture drift, metadata/ancestor link refusal without outside writes, unknown-content preservation and candidate-publication rollback. For current source/native SDK prompt/tool behavior, run `test/prompt-guidance.test.ts test/skills.test.ts` through the same in-memory loader. The resource sync and role renderer remain separate entry points; coordinate shared compiled output/preset generation with its owner. Sync writes changed artifacts only; a second run must report no differences. Do not hand-edit generated prompt/source assets, skills or presets.
56
+
57
+ Cold rebuild needs the existing approved toolchain/dependencies and the **prepared complete frontend fixed-pin library** as well as the committed raw snapshot. Committing the raw snapshot does not deliver ignored third-party bodies. An authorized release/build owner must preserve their delivery to the cold checkout/staging surface; missing bodies or inventory fail offline with no download or older-Root fallback. Separately authorized `pnpm run sync:frontend` can materialize missing fixed-pin resources, but is never an implicit CI/build/check action. No software installation is authorized by these commands.
58
+
59
+ Source Markdown is kept in full, with precise anchored changes and an explicit DSH resource/authority boundary. Native read/glob/grep, web_search/web_fetch, write/edit, bash/pwsh and skill invocation are the tools mapped here; native read uses `file_path`. Exposed `todo_write` replaces the owning Agent's whole content/status list under its actual parallel policy; exposed `ask_user_question` provides questions, otherwise conversation does. LSP, image/browser, documentation services and native controls remain actual-catalog/route capabilities. Host compaction is not OCMM `compress`. No Task, todowrite, compress or Context7 MCP interface is invented. Template fields describe an assignment, not callable parameters. Native delegation groups preserve root/stage-owner Builder versus bounded child Builder, strict-leaf research, read-only utility restrictions and local-coordinator specialists; runtime policy enforces these boundaries.
60
+
61
+ Role IDs remain `dsmm-<name>`. `subagents.toolTopology=per-role` exposes individual `kind=role` underscore tools plus `dsmm_category`; `parameterized` exposes `dsmm_role` and `dsmm_category` with their respective admitted target enums. Empty groups have no tool. Actual arguments are `description`, `prompt`, optional `level`, deployment-authorized/exposed `route`, and capability-exposed `run_in_background`; no template grants them. Omitted/normal preserves the default route; `roleRouting.<id>.levels` contains only configured low/high/max complete routes or effort-only choices requiring exact native preflight. A complete per-call route requires paired provider/model, drops stale effort on model changes and does not silently fall back; an effort-only override must be supported by the selected native model. Route override additionally requires captured deployment `allowRouteOverride=true`. Source tier advice never generates suffix roles or fixed max effort. Target/caller/read-only/depth authority is unchanged by topology or level. Missing required planning/review capability is reported, not bypassed. Read-only planners return complete Markdown for authorized coordinator persistence. Reviewer/Oracle independence requires different observed routes, not names.
62
+
63
+ One-shot defaults foreground; permitted one-shot background is native-job-owned. An admitted managed continuable configuration defaults background and returns a durable child ID; explicit `run_in_background:false` starts a non-reusable one-shot. A wired user foreground handoff transfers the same existing run to native jobs without another start, after operator/session/epoch/ownership/background gates; failed preflight leaves foreground ownership/cancellation intact. Existing continuable children use exposed `send_message` for nearest-step running, idle next-turn or same-ID cold delivery and the actual native user queue/steer surface. Receipts mean inbox acceptance, not execution/review completion. A settled one-shot cannot revive. Reuse does not reselect role/level/route or replace original captured locale/authority with the parent's latest profile. Background enablement, native capacity/depth, ownership, cancellation, provider support and permissions always gate execution. No OpenCode `task_id`/resume/retry, automatic retry or guessed idempotency is supplied.
64
+
65
+ Managed message delivery requires explicit startup composition: disable the stock `subagents` registration row, bind the unique PUBLIC DSMM `SubagentRuntime` subclass, then restart. Stock cannot be unloaded/drained for hot replacement or shadowed by a parallel runtime. The assembler takes the observed `SubagentRuntimeAdmissionView`; stock/unavailable/unready states give the explicit composition/restart limitation, not a readiness promise. Native controls remain genuine SDK capabilities, but tool exposure and operator-gated user surfaces must be separately observed. Unconnected C3 tool/RPC surfaces are not announced. Legacy-conservative evidence permits useful proven capabilities under the same durable ID intersected with current normal parent authority and native boundaries; missing evidence denies that capability with a reason, neither denying all legacy children nor inheriting the parent's latest policy. Captured child epochs need not equal the parent's current epoch.
66
+
67
+ ### Runtime assembler consumer interface
68
+
69
+ `buildDsmmAgentGuidance(capturedSettings, observation: DsmmPromptObservation)` is pure and installs no tools, policy, provider, RPC or locale. The integration owner registers it once in the exact admitted Agent scope, independently of the mode-gated `buildDeepworkPrompt`; do not also inject a second dynamic locale block. Use that root/child's immutable settings, never desired deployment/editor drafts or the ancestor's new admission. Persistent `buildRolePersona` contains only shared language priority, not a configured locale.
70
+
71
+ Pass B's `callableRoleInventory` entries (`name`, `kind`, `targets`, optional `targetParameter`) **after actual admission/provider/tool filtering**, plus current policy-filtered native `ToolSchema[]`. The assembler intersects those schemas and target enums with optional observed role availability, and lists configured levels only when the schema exposes them. A role-availability row is not proof of a tool. Pass observed `DsmmInvocationView` under `invocation: {view, routeKind:'initial'|'actual'}`: initial is a preflighted start route, actual comes from native request/status after fallback; never infer either from raw args or a role name. Runtime admission, invocation (including route), and child evidence are explicitly projected to allowed output fields; structurally compatible objects' extra properties are not serialized. Evidence field/code/effect lists are closed and limitation output is bounded.
72
+
73
+ `capabilities.continuable` observes **new child creation**. `capabilities.managedChildDelivery` independently observes **managed parent-to-existing-continuable-child delivery under this exact Agent's authority**; omitted/false does not establish reuse, even with a ready binding and native `send_message`. Model reuse guidance requires that flag, a ready unique DSMM delivery fence and the actual exposed control. Native user queue/steer additionally requires an actually wired `nativeBrowserPrompt.surface`; its name/readiness alone does not prove delivery. Existing-child delivery does not require creation/background to be enabled. Exposed native child-to-parent reporting remains separate and retains exact-sender/adjacency semantics. Supply native jobs capability and a wired `foregroundHandoff.surface` only when supported. Optional `ChildAdmissionEvidenceView` supplies original/proven fields and precise capability limitations, never extra private state. These observations describe availability; actual target, operator/connection/session/epoch/lifetime and native permission gates remain the execution authority.
37
74
 
38
- Source Markdown is kept in full, with precise anchored changes and an explicit DSH resource/authority boundary. Native read/glob/grep, web_search/web_fetch, write/edit, bash/pwsh and skill invocation are the tools mapped here. Question, LSP, image, browser, tracking, background and continuation behavior is conditional on the actual catalog/provider. No Task, todowrite, compress or Context7 MCP interface is invented. Template fields describe an assignment, not callable parameters. Native delegation groups preserve root/stage-owner Builder versus bounded child Builder, strict-leaf research, read-only utility restrictions and local-coordinator specialists; Stage C must enforce those policies on real execution paths.
75
+ DeepSeek V4 Pro/Flash guidance applies only to the exact verified provider/model pairs, uses adapter-advertised efforts and treats configured default effort as policy, not an observed request result. Ordinary root native model/effort and explicit preflighted invocation effort remain authoritative. Preset-derived max reasoning policy is not part of this calibration.
39
76
 
40
77
  Authored frontend router/tooling text overrides install-by-default/implicit latest behavior: inspect existing capabilities, require separate setup authorization, and report unverified evidence without hiding incomplete declared resources. Verbatim UI/UX README paths/cwd examples are superseded by the authored DSH entry: resolve the absolute native resourceBase script, require the already-active target project context, and supply an explicitly approved project-owned output-dir for persistence. The installed skill tree is never an output target; no tool cwd field or shell cd is invented. Public renderer inputs retain the old object shape with optional source metadata; only the canonical catalog requires those trusted source fields.
41
78
 
@@ -55,4 +92,4 @@ Body/data/Python resources and `.frontend-materialized.json` are gitignored. Act
55
92
 
56
93
  `node scripts/materialize-frontend.mjs` defaults to read-only/offline check. `pnpm run build`, `check:source` and `check:release` refuse incomplete/drifted materialization without downloading. Explicit `sync:frontend` reuses complete validated content with zero requests/writes; no arbitrary destination CLI is accepted. Runtime distribution needs only package-relative resources, never an upstream checkout or network materialization.
57
94
 
58
- **E/CI handoff:** after installing the already-authorized build toolchain, run `sync:source`, explicit `sync:frontend`, `sync:source`, then build/generate/check/pack. A Git checkout alone does not contain the ignored bodies. Materialize before a source Docker build context is created; frozen tarballs must already carry the entire library. Do not insert network fetching into default build or use a compiled/ignored local tree as proof that CI packed it. Full packed inventory and missing-resource refusal remain separate evidence from native C/D capability/permission/lifecycle completion.
95
+ **Distribution handoff:** with the authorized build toolchain and complete fixed-pin resources, run snapshot-backed `sync:source`, then coordinated build/generate/check/pack. Only deliberate Root adoption uses `source-inputs.mjs --refresh`; only separately authorized materialization uses `sync:frontend`. The raw snapshot is committed maintenance input and is not required in the npm runtime package. Prepared prompts/skills and every fixed-pin runtime resource must still be delivered; ignored status does not supply them to a cold checkout. Frozen tarballs must already carry the complete library. Default build/check does not fetch resources. Local compiled/materialized content is not proof of packed delivery. Full packed inventory and missing-resource refusal remain separate evidence from native runtime/UI capability, permission and lifecycle completion.
@@ -0,0 +1,37 @@
1
+ import type { DshAgent } from "./dsh-types.js";
2
+ import type { DsmmProfileAdmission } from "./settings.js";
3
+ import type { ChildAdmissionEvidence, LegacyChildEvidence, PreparedChildAdmission } from "./child-capture.js";
4
+ import type { SubagentRuntimeAdmissionView } from "./profile-types.js";
5
+ export interface ParentAdmissionTicket {
6
+ readonly parent: DshAgent;
7
+ readonly owner: object;
8
+ readonly admission: DsmmProfileAdmission;
9
+ readonly parentEpoch: string;
10
+ readonly signal: AbortSignal;
11
+ }
12
+ /** Implemented by the explicit Host composition; no default or stock fallback. */
13
+ export interface DsmmChildAdmissionAuthority {
14
+ view(): SubagentRuntimeAdmissionView;
15
+ registerParent(parent: DshAgent, admission: DsmmProfileAdmission, owner: object): void;
16
+ acquireParentTicket(parent: DshAgent): ParentAdmissionTicket;
17
+ resolveChildEvidence(ticket: ParentAdmissionTicket, childId: string, signal: AbortSignal): Promise<ChildAdmissionEvidence>;
18
+ /** Preparation may fail before durable commit. Publication is synchronous and nonthrowing after it. */
19
+ prepareParentAdmission(parent: DshAgent, expectedEpoch: string, nextAdmission: DsmmProfileAdmission): void;
20
+ /** Host-only non-delivery CAS; it never issues or authorizes a delivery ticket. */
21
+ assertCoreParentAdmission?(parent: DshAgent, owner: object, expected: DsmmProfileAdmission): void;
22
+ prepareCoreParentAdmission?(parent: DshAgent, owner: object, expected: DsmmProfileAdmission, next: DsmmProfileAdmission): void;
23
+ publishParentAdmission(parent: DshAgent, expectedEpoch: string, nextAdmission: DsmmProfileAdmission, install: () => void): void;
24
+ revokeParent(parent: DshAgent, reason: string): void;
25
+ }
26
+ export interface ChildAdmissionCompletion {
27
+ /** A/C resolve immutable original evidence; B verifies identity and target ceiling in validateRole. */
28
+ prepare(agent: DshAgent, parent: DshAgent, ticket: ParentAdmissionTicket, signal: AbortSignal): Promise<PreparedChildAdmission>;
29
+ validateRole(agent: DshAgent, parent: DshAgent, prepared: ChildRoleAdmissionCandidate): void;
30
+ }
31
+ export interface ChildRoleAdmissionCandidate extends PreparedChildAdmission {
32
+ /** Derived from the exact live residency cache, not supplied by a caller or inferred from epoch equality. */
33
+ readonly retained: boolean;
34
+ }
35
+ /** Trusted physical native folds; called only after verified absence of a new capture. */
36
+ export type LegacyChildEvidenceReader = (ticket: ParentAdmissionTicket, childId: string, signal: AbortSignal) => Promise<LegacyChildEvidence>;
37
+ //# sourceMappingURL=child-admission-contract.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=child-admission-contract.js.map
@@ -0,0 +1,42 @@
1
+ import type { Context } from "@deepseek-ai/cordis";
2
+ import type { Agent } from "@deepseek-ai/dsh-agent";
3
+ import type { ChildAdmissionCompletion, DsmmChildAdmissionAuthority, LegacyChildEvidenceReader, ParentAdmissionTicket } from "./child-admission-contract.js";
4
+ import type { ChildAdmissionEvidence, ChildAdmissionEvidenceView, ChildEvidenceField } from "./child-capture.js";
5
+ import type { DeliveryPolicyBinding, DsmmDeliveryAuthority } from "./delivery-authority.js";
6
+ import type { DshAgent } from "./dsh-types.js";
7
+ import type { NativeChildHistory } from "./native-child-evidence.js";
8
+ import type { LegacyCapabilityCollaborators } from "./legacy-child-policy.js";
9
+ import type { DsmmProfileAdmission, DsmmSettings } from "./settings.js";
10
+ export interface ChildAdmissionCollaborators {
11
+ /** A owns resident/durable capture lookup and corruption-vs-absence decisions. */
12
+ resolveOriginalChildEvidence(ticket: ParentAdmissionTicket, childId: string, signal: AbortSignal, readLegacy: LegacyChildEvidenceReader): Promise<ChildAdmissionEvidence>;
13
+ /** B owns fresh invocation capture, role identity and target ceiling validation. */
14
+ childAdmission: ChildAdmissionCompletion;
15
+ assertDelivery(ticket: ParentAdmissionTicket, childId: string, evidence: ChildAdmissionEvidence): void;
16
+ classifyParent(parent: Agent): "dsmm" | "native";
17
+ }
18
+ export interface ChildAdmissionBindingOptions {
19
+ readonly ctx: Context;
20
+ readonly owner: object;
21
+ readonly deliveryAuthority: DsmmDeliveryAuthority<DsmmProfileAdmission, ChildAdmissionEvidence>;
22
+ readonly collaborators: ChildAdmissionCollaborators;
23
+ readonly nativeSubstrate: DsmmSettings;
24
+ /** The exact public Host query service, borrowed in the same scope as the native catalog. */
25
+ readonly nativeHistory: NativeChildHistory;
26
+ readonly legacyCapabilities: LegacyCapabilityCollaborators;
27
+ }
28
+ /** Connects A's structural contract to C1's opaque ticket provenance without manufacturing Agents. */
29
+ export declare function createChildAdmissionBinding(options: ChildAdmissionBindingOptions): {
30
+ authority: DsmmChildAdmissionAuthority;
31
+ policy: DeliveryPolicyBinding<DsmmProfileAdmission, ChildAdmissionEvidence>;
32
+ childAdmission: ChildAdmissionCompletion;
33
+ readLegacy: LegacyChildEvidenceReader;
34
+ resolveOriginalEvidence: (ticket: ParentAdmissionTicket, id: string, signal: AbortSignal) => Promise<ChildAdmissionEvidence>;
35
+ bind(scope: Context): () => void;
36
+ onAdmissionGuardsInstalled(): void;
37
+ /** Holder owner calls this before native disposal/drain; no replacement residency is revoked. */
38
+ revokeBeforeDispose(parent: DshAgent, dispose: () => void | Promise<void>): Promise<void>;
39
+ };
40
+ /** DTO consumers supply the CURRENT direct-parent epoch; original epochs are not an authorization equality test. */
41
+ export declare function projectChildAdmissionEvidence(evidence: ChildAdmissionEvidence, parentAdmissionEpoch: string, parentDenied?: readonly ChildEvidenceField[]): ChildAdmissionEvidenceView;
42
+ //# sourceMappingURL=child-admission.d.ts.map
@@ -0,0 +1,162 @@
1
+ import { SessionId } from "@deepseek-ai/dsh-session";
2
+ import { SubagentError } from "@deepseek-ai/dsh-subagent";
3
+ import { parseChildAdmissionCapture, parseChildAdmissionEvidenceView, parseLegacyChildEvidence } from "./child-capture.js";
4
+ import { NativeChildEvidenceReader, assertNativeChildCapture, legacyEvidenceFromNativeFacts } from "./native-child-evidence.js";
5
+ import { createConservativeLegacyAdmission, installLegacyChildToolPolicy } from "./legacy-child-policy.js";
6
+ function unauthorized() { throw new SubagentError("Child admission requires an issued ticket and exact native Agent owner", "UNAUTHORIZED"); }
7
+ /** Connects A's structural contract to C1's opaque ticket provenance without manufacturing Agents. */
8
+ export function createChildAdmissionBinding(options) {
9
+ const { ctx, owner, deliveryAuthority: delivery, collaborators } = options;
10
+ const nativeTickets = new WeakMap();
11
+ const profileTickets = new WeakMap();
12
+ const registeredParents = new WeakMap();
13
+ const exact = (parent) => {
14
+ if (parent.id === undefined)
15
+ unauthorized();
16
+ const actual = ctx.agents.get(SessionId(parent.id));
17
+ if (actual === undefined || actual !== parent)
18
+ unauthorized();
19
+ return actual;
20
+ };
21
+ const assertNative = (ticket) => {
22
+ delivery.assertTicket(ticket);
23
+ if (ticket.owner !== owner || exact(ticket.parent) !== ticket.parent)
24
+ unauthorized();
25
+ };
26
+ const profileTicket = (ticket) => {
27
+ assertNative(ticket);
28
+ let borrowed = profileTickets.get(ticket);
29
+ if (borrowed === undefined) {
30
+ borrowed = Object.freeze({ parent: ticket.parent, owner: ticket.owner, admission: ticket.admission,
31
+ parentEpoch: ticket.parentEpoch, signal: ticket.signal });
32
+ profileTickets.set(ticket, borrowed);
33
+ nativeTickets.set(borrowed, ticket);
34
+ }
35
+ return borrowed;
36
+ };
37
+ const nativeTicket = (ticket) => {
38
+ const actual = nativeTickets.get(ticket);
39
+ if (actual === undefined)
40
+ unauthorized();
41
+ assertNative(actual);
42
+ return actual;
43
+ };
44
+ const reader = new NativeChildEvidenceReader(ctx, assertNative, options.nativeHistory);
45
+ const readLegacy = (ticket, id, signal) => reader.legacy(nativeTicket(ticket), id, signal);
46
+ const resolve = async (ticket, id, callerSignal) => {
47
+ assertNative(ticket);
48
+ const signal = AbortSignal.any([ticket.signal, callerSignal]);
49
+ signal.throwIfAborted();
50
+ const evidence = await collaborators.resolveOriginalChildEvidence(profileTicket(ticket), id, signal, readLegacy);
51
+ signal.throwIfAborted();
52
+ assertNative(ticket);
53
+ const parsed = "mode" in evidence ? parseLegacyChildEvidence(evidence) : parseChildAdmissionCapture(evidence);
54
+ const facts = await reader.read(ticket, id, signal);
55
+ signal.throwIfAborted();
56
+ assertNative(ticket);
57
+ if ("mode" in parsed) {
58
+ const physical = legacyEvidenceFromNativeFacts(facts);
59
+ if (!sameLegacyEvidence(parsed, physical))
60
+ unauthorized();
61
+ }
62
+ else
63
+ assertNativeChildCapture(parsed, facts);
64
+ return evidence;
65
+ };
66
+ const authority = {
67
+ view: () => delivery.view(),
68
+ registerParent: (parent, admission, requestedOwner) => {
69
+ if (requestedOwner !== owner)
70
+ unauthorized();
71
+ const actual = exact(parent);
72
+ delivery.registerParent(actual, admission, owner);
73
+ registeredParents.set(parent, actual);
74
+ },
75
+ acquireParentTicket: parent => profileTicket(delivery.acquireParentTicket(exact(parent))),
76
+ resolveChildEvidence: async (ticket, id, signal) => resolve(nativeTicket(ticket), id, signal),
77
+ prepareParentAdmission: (parent, epoch, next) => delivery.prepareParentAdmission(exact(parent), epoch, next),
78
+ assertCoreParentAdmission: (parent, requestedOwner, expected) => {
79
+ if (requestedOwner !== owner)
80
+ unauthorized();
81
+ delivery.assertCoreParentAdmission(exact(parent), owner, expected);
82
+ },
83
+ prepareCoreParentAdmission: (parent, requestedOwner, expected, next) => {
84
+ if (requestedOwner !== owner)
85
+ unauthorized();
86
+ delivery.prepareCoreParentAdmission(exact(parent), owner, expected, next);
87
+ },
88
+ publishParentAdmission: (parent, epoch, next, install) => delivery.publishParentAdmission(exact(parent), epoch, next, install),
89
+ // Revocation may run during registry removal: use the exact object, never look up a replacement by ID.
90
+ revokeParent: (parent, reason) => {
91
+ const actual = registeredParents.get(parent);
92
+ if (actual !== undefined) {
93
+ delivery.revokeParent(actual, reason);
94
+ registeredParents.delete(parent);
95
+ }
96
+ },
97
+ };
98
+ const policy = {
99
+ classifyParent: collaborators.classifyParent,
100
+ resolveChildEvidence: resolve,
101
+ assertDelivery(ticket, id, evidence) { assertNative(ticket); collaborators.assertDelivery(profileTicket(ticket), id, evidence); assertNative(ticket); },
102
+ };
103
+ const childAdmission = {
104
+ async prepare(agent, parent, ticket, signal) {
105
+ const issued = nativeTicket(ticket);
106
+ if (exact(parent) !== issued.parent || ctx.agents.get(SessionId(agent.id)) !== agent || !ctx.agents.isOwnedBy(SessionId(agent.id), issued.parent))
107
+ unauthorized();
108
+ const merged = AbortSignal.any([signal, issued.signal]);
109
+ merged.throwIfAborted();
110
+ const prepared = await collaborators.childAdmission.prepare(agent, parent, ticket, merged);
111
+ merged.throwIfAborted();
112
+ assertNative(issued);
113
+ return "mode" in prepared.evidence ? { ...prepared,
114
+ admission: createConservativeLegacyAdmission(prepared.evidence, ticket.admission, options.nativeSubstrate) } : prepared;
115
+ },
116
+ validateRole(agent, parent, candidate) {
117
+ collaborators.childAdmission.validateRole(agent, parent, candidate);
118
+ if ("mode" in candidate.evidence && !candidate.retained) {
119
+ installLegacyChildToolPolicy(candidate.evidence, exact(parent), exact(agent), options.legacyCapabilities);
120
+ }
121
+ },
122
+ };
123
+ return { authority, policy, childAdmission, readLegacy,
124
+ resolveOriginalEvidence: (ticket, id, signal) => resolve(nativeTicket(ticket), id, signal),
125
+ bind(scope) { return delivery.bindPolicy(scope, owner, policy); },
126
+ onAdmissionGuardsInstalled() { delivery.enablePolicy(owner); },
127
+ /** Holder owner calls this before native disposal/drain; no replacement residency is revoked. */
128
+ async revokeBeforeDispose(parent, dispose) {
129
+ authority.revokeParent(parent, "holder-disposed");
130
+ await dispose();
131
+ },
132
+ };
133
+ }
134
+ function sameLegacyEvidence(left, right) {
135
+ return left.childSessionId === right.childSessionId && left.parentSessionId === right.parentSessionId && left.role === right.role
136
+ && left.depth === right.depth && JSON.stringify(left.route) === JSON.stringify(right.route)
137
+ && JSON.stringify(left.toolFilter) === JSON.stringify(right.toolFilter)
138
+ && left.provenFields.every(field => right.provenFields.includes(field));
139
+ }
140
+ /** DTO consumers supply the CURRENT direct-parent epoch; original epochs are not an authorization equality test. */
141
+ export function projectChildAdmissionEvidence(evidence, parentAdmissionEpoch, parentDenied = []) {
142
+ let view;
143
+ if ("mode" in evidence) {
144
+ const legacy = parseLegacyChildEvidence(evidence);
145
+ view = parseChildAdmissionEvidenceView({ mode: "legacy-conservative", parentAdmissionEpoch, provenFields: legacy.provenFields, limitations: legacy.limitations });
146
+ }
147
+ else {
148
+ const capture = parseChildAdmissionCapture(evidence);
149
+ const provenFields = ["lineage", "role", "route", "profile-pin", "admission-epoch", "invocation-level", "runtime-policy", "modules", "roles",
150
+ "read-only", "route-override", "max-depth", "locale", "tool-topology", "guards", "git-write", "shell", "delegation"];
151
+ if (capture.authorityCeiling.toolFilter !== undefined)
152
+ provenFields.push("tool-filter");
153
+ view = parseChildAdmissionEvidenceView({ mode: "captured", parentAdmissionEpoch, originalAdmissionEpoch: capture.originalAdmissionEpoch, provenFields,
154
+ limitations: [{ field: "active-intent", code: "missing-evidence", effect: "display-only" }, { field: "max-tokens", code: "not-persisted", effect: "native-default" },
155
+ { field: "output-schema", code: "unverified", effect: "capability-denied" }] });
156
+ }
157
+ const limitations = new Map(view.limitations.map(item => [item.field, item]));
158
+ for (const field of parentDenied)
159
+ limitations.set(field, { field, code: "parent-denied", effect: "capability-denied" });
160
+ return parseChildAdmissionEvidenceView({ ...view, limitations: [...limitations.values()] });
161
+ }
162
+ //# sourceMappingURL=child-admission.js.map
@@ -0,0 +1,81 @@
1
+ import type { DsmmInvocationLevel, DsmmLocale, DsmmModelRoute, DsmmProfileAdmission, DsmmSettings, DsmmToolTopology } from "./settings.js";
2
+ import type { ResolvedModelParameterPolicy } from "./model-parameter-policy.js";
3
+ import type { DsmmRoleId } from "./roles.js";
4
+ import type { ChildAdmissionLimitation, ChildEvidenceField } from "./child-evidence.js";
5
+ export { CHILD_EVIDENCE_FIELDS, parseChildAdmissionEvidenceView } from "./child-evidence.js";
6
+ export type { ChildAdmissionEvidenceView, ChildAdmissionLimitation, ChildEvidenceField } from "./child-evidence.js";
7
+ import type { DsmmRouteSource } from "./profile-types.js";
8
+ export { DSMM_ROUTE_SOURCES } from "./profile-types.js";
9
+ export type { DsmmRouteSource } from "./profile-types.js";
10
+ export interface ChildToolFilter {
11
+ allow?: string[];
12
+ deny?: string[];
13
+ }
14
+ export interface ChildAuthorityCeiling {
15
+ roles: DsmmRoleId[];
16
+ readOnly: boolean;
17
+ toolFilter?: ChildToolFilter;
18
+ allowRouteOverride: boolean;
19
+ maxDepth: number;
20
+ }
21
+ export type ChildRuntimePolicyCapture = Pick<DsmmSettings, "modules" | "roleRouting" | "runtimePolicy" | "workflow" | "guards" | "runtimeRecovery" | "defaultActive" | "deepseekV4ProCalibration" | "deepseekV4ProDefaultReasoningEffort" | "deepseekFlashCalibration" | "deepseekFlashDefaultReasoningEffort" | "skills"> & {
22
+ subagents: Pick<DsmmSettings["subagents"], "enableRunInBackground" | "backgroundMode">;
23
+ };
24
+ interface ChildAdmissionCaptureBase {
25
+ childSessionId: string;
26
+ parentSessionId: string;
27
+ role: DsmmRoleId;
28
+ profilePin: {
29
+ id: string;
30
+ revision: string;
31
+ } | null;
32
+ originalAdmissionEpoch: string;
33
+ invocation: {
34
+ level: DsmmInvocationLevel;
35
+ initialRoute: DsmmModelRoute;
36
+ routeSource: DsmmRouteSource;
37
+ };
38
+ runtimePolicyCapture: ChildRuntimePolicyCapture;
39
+ authorityCeiling: ChildAuthorityCeiling;
40
+ locale?: DsmmLocale;
41
+ toolTopology: DsmmToolTopology;
42
+ }
43
+ export interface ChildAdmissionCaptureV1 extends ChildAdmissionCaptureBase {
44
+ version: 1;
45
+ }
46
+ export interface ChildAdmissionCaptureV2 extends ChildAdmissionCaptureBase {
47
+ version: 2;
48
+ modelParameterPolicy: ResolvedModelParameterPolicy;
49
+ invocation: ChildAdmissionCaptureBase["invocation"] & {
50
+ requestedRoute: DsmmModelRoute;
51
+ effortSource: "native" | "dsmm-config";
52
+ };
53
+ }
54
+ export type ChildAdmissionCapture = ChildAdmissionCaptureV1 | ChildAdmissionCaptureV2;
55
+ /** Trusted native folds only; never synthesized from the current parent's settings. */
56
+ export interface LegacyChildEvidence {
57
+ version: 1;
58
+ mode: "legacy-conservative";
59
+ childSessionId: string;
60
+ parentSessionId: string;
61
+ role: DsmmRoleId;
62
+ route: DsmmModelRoute;
63
+ depth: number;
64
+ toolFilter?: ChildToolFilter;
65
+ active?: boolean;
66
+ provenFields: ChildEvidenceField[];
67
+ limitations: ChildAdmissionLimitation[];
68
+ }
69
+ export type ChildAdmissionEvidence = ChildAdmissionCapture | LegacyChildEvidence;
70
+ export interface PreparedChildAdmission {
71
+ evidence: ChildAdmissionEvidence;
72
+ /** The trusted resolver supplies legacy's conservative intersection, not a parent clone. */
73
+ admission: DsmmProfileAdmission;
74
+ /** Only new creation writes a capture. Retained/cold evidence never rewrites it. */
75
+ creation: boolean;
76
+ }
77
+ export declare function parseLegacyChildEvidence(input: unknown): LegacyChildEvidence;
78
+ export declare function parseChildAdmissionCapture(input: unknown): ChildAdmissionCapture;
79
+ /** Native service substrate stays Host-owned; all executable policy comes from original capture. */
80
+ export declare function admissionFromChildCapture(input: ChildAdmissionCapture, nativeSubstrate: DsmmSettings): DsmmProfileAdmission;
81
+ //# sourceMappingURL=child-capture.d.ts.map