@dsmm/dsmm 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/README.md +37 -67
  2. package/agent-presets/dsmm-builder/agent.cordis.yml +10 -2015
  3. package/agent-presets/dsmm-clarifier/agent.cordis.yml +24 -343
  4. package/agent-presets/dsmm-code-search/agent.cordis.yml +19 -6
  5. package/agent-presets/dsmm-coding/agent.cordis.yml +19 -438
  6. package/agent-presets/dsmm-complex/agent.cordis.yml +23 -1009
  7. package/agent-presets/dsmm-creative/agent.cordis.yml +25 -442
  8. package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +29 -1013
  9. package/agent-presets/dsmm-deep/agent.cordis.yml +24 -1008
  10. package/agent-presets/dsmm-doc-search/agent.cordis.yml +19 -6
  11. package/agent-presets/dsmm-documenting/agent.cordis.yml +26 -439
  12. package/agent-presets/dsmm-frontend/agent.cordis.yml +21 -440
  13. package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +22 -441
  14. package/agent-presets/dsmm-media-reader/agent.cordis.yml +19 -6
  15. package/agent-presets/dsmm-normal-task/agent.cordis.yml +19 -438
  16. package/agent-presets/dsmm-oracle/agent.cordis.yml +25 -340
  17. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +25 -340
  18. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +29 -2025
  19. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +24 -341
  20. package/agent-presets/dsmm-planner/agent.cordis.yml +14 -344
  21. package/agent-presets/dsmm-quick/agent.cordis.yml +19 -6
  22. package/agent-presets/dsmm-research/agent.cordis.yml +23 -8
  23. package/agent-presets/dsmm-reviewer/agent.cordis.yml +25 -340
  24. package/cordis.patch.yml +14 -0
  25. package/docs/agent-presets.md +36 -52
  26. package/docs/compatibility.md +47 -110
  27. package/docs/deferred-native-approval-risk.md +19 -0
  28. package/docs/design.md +2 -2
  29. package/docs/lsp.md +11 -21
  30. package/docs/migration-from-ocmm.md +2 -2
  31. package/docs/model-routing.md +84 -59
  32. package/docs/native-permissions.md +35 -0
  33. package/docs/profiles.md +40 -87
  34. package/docs/releasing.md +123 -2
  35. package/docs/roadmap.md +71 -17
  36. package/docs/settings-status.md +34 -169
  37. package/docs/skill-sync.md +52 -15
  38. package/lib/agent-registry.d.ts +36 -0
  39. package/lib/agent-registry.js +75 -0
  40. package/lib/child-admission-contract.d.ts +37 -0
  41. package/lib/child-admission-contract.js +2 -0
  42. package/lib/child-admission.d.ts +40 -0
  43. package/lib/child-admission.js +151 -0
  44. package/lib/child-capture.d.ts +85 -0
  45. package/lib/child-capture.js +205 -0
  46. package/lib/child-evidence.d.ts +17 -0
  47. package/lib/child-evidence.js +43 -0
  48. package/lib/client/ChildrenPanel.d.ts +43 -0
  49. package/lib/client/ChildrenPanel.js +82 -0
  50. package/lib/client/DeploymentPage.js +15 -8
  51. package/lib/client/EditableChoice.d.ts +17 -0
  52. package/lib/client/EditableChoice.js +49 -0
  53. package/lib/client/PermissionsPanel.d.ts +14 -0
  54. package/lib/client/PermissionsPanel.js +46 -0
  55. package/lib/client/ProfilesSection.js +30 -15
  56. package/lib/client/RoleAvailability.d.ts +7 -0
  57. package/lib/client/RoleAvailability.js +19 -0
  58. package/lib/client/SessionProfiles.js +27 -9
  59. package/lib/client/StructuredEditor.js +15 -7
  60. package/lib/client/children-controller.d.ts +98 -0
  61. package/lib/client/children-controller.js +296 -0
  62. package/lib/client/children-locales.d.ts +367 -0
  63. package/lib/client/children-locales.js +69 -0
  64. package/lib/client/controller.d.ts +6 -1
  65. package/lib/client/controller.js +14 -8
  66. package/lib/client/deployment-controller.js +1 -1
  67. package/lib/client/deployment-data.d.ts +2 -1
  68. package/lib/client/deployment-data.js +34 -5
  69. package/lib/client/deployment-locales.d.ts +4 -0
  70. package/lib/client/deployment-locales.js +11 -2
  71. package/lib/client/diagnostics.d.ts +14 -0
  72. package/lib/client/diagnostics.js +53 -0
  73. package/lib/client/index.d.ts +4 -0
  74. package/lib/client/index.js +96 -2
  75. package/lib/client/locales.d.ts +54 -0
  76. package/lib/client/locales.js +34 -16
  77. package/lib/client/permission-client.d.ts +16 -0
  78. package/lib/client/permission-client.js +38 -0
  79. package/lib/client/permission-controller.d.ts +62 -0
  80. package/lib/client/permission-controller.js +149 -0
  81. package/lib/client/permission-locales.d.ts +114 -0
  82. package/lib/client/permission-locales.js +75 -0
  83. package/lib/client/session-labels.js +4 -4
  84. package/lib/client/structured.js +19 -5
  85. package/lib/client/styles.d.ts +1 -1
  86. package/lib/client/styles.js +20 -0
  87. package/lib/client.js +5780 -1679
  88. package/lib/core-permission-authority.d.ts +18 -0
  89. package/lib/core-permission-authority.js +255 -0
  90. package/lib/core-permissions.d.ts +8 -0
  91. package/lib/core-permissions.js +33 -0
  92. package/lib/delivery-authority.d.ts +83 -0
  93. package/lib/delivery-authority.js +397 -0
  94. package/lib/deployment-config.d.ts +23 -0
  95. package/lib/deployment-config.js +61 -40
  96. package/lib/deployment-permission-rules.d.ts +55 -0
  97. package/lib/deployment-permission-rules.js +306 -0
  98. package/lib/dsh-types.d.ts +10 -4
  99. package/lib/guards.d.ts +1 -1
  100. package/lib/guards.js +29 -8
  101. package/lib/host-llm-startup.d.ts +41 -0
  102. package/lib/host-llm-startup.js +65 -0
  103. package/lib/host-llm.d.ts +92 -0
  104. package/lib/host-llm.js +325 -0
  105. package/lib/index.d.ts +15 -4
  106. package/lib/index.js +288 -48
  107. package/lib/live-pi-ai-owner.d.ts +18 -0
  108. package/lib/live-pi-ai-owner.js +144 -0
  109. package/lib/llm-runtime.d.ts +11 -0
  110. package/lib/llm-runtime.js +21 -0
  111. package/lib/managed-settings.d.ts +5 -0
  112. package/lib/managed-settings.js +14 -0
  113. package/lib/model-parameter-policy.d.ts +11 -0
  114. package/lib/model-parameter-policy.js +27 -0
  115. package/lib/model-routing.js +28 -17
  116. package/lib/modules.d.ts +13 -5
  117. package/lib/modules.js +17 -1
  118. package/lib/native-child-evidence.d.ts +40 -0
  119. package/lib/native-child-evidence.js +104 -0
  120. package/lib/native-pi-ai-wire.d.ts +37 -0
  121. package/lib/native-pi-ai-wire.js +261 -0
  122. package/lib/native-scope.js +1 -1
  123. package/lib/permission-bash.d.ts +6 -0
  124. package/lib/permission-bash.js +7 -0
  125. package/lib/permission-control.d.ts +73 -0
  126. package/lib/permission-control.js +205 -0
  127. package/lib/permission-controller.d.ts +68 -0
  128. package/lib/permission-controller.js +317 -0
  129. package/lib/permission-errors.d.ts +7 -0
  130. package/lib/permission-errors.js +21 -0
  131. package/lib/permission-fs-search.d.ts +5 -0
  132. package/lib/permission-fs-search.js +7 -0
  133. package/lib/permission-fs.d.ts +5 -0
  134. package/lib/permission-fs.js +7 -0
  135. package/lib/permission-native-access.d.ts +11 -0
  136. package/lib/permission-native-access.js +6 -0
  137. package/lib/permission-native-command.d.ts +10 -0
  138. package/lib/permission-native-command.js +93 -0
  139. package/lib/permission-native-rules.d.ts +75 -0
  140. package/lib/permission-native-rules.js +278 -0
  141. package/lib/permission-pwsh.d.ts +6 -0
  142. package/lib/permission-pwsh.js +7 -0
  143. package/lib/permission-remote.d.ts +26 -0
  144. package/lib/permission-remote.js +53 -0
  145. package/lib/permission-rpc.d.ts +29 -0
  146. package/lib/permission-rpc.js +152 -0
  147. package/lib/permission-rules.d.ts +115 -0
  148. package/lib/permission-rules.js +256 -0
  149. package/lib/permission-settings.d.ts +45 -0
  150. package/lib/permission-settings.js +48 -0
  151. package/lib/permission-shell.d.ts +38 -0
  152. package/lib/permission-shell.js +150 -0
  153. package/lib/permission-web.d.ts +5 -0
  154. package/lib/permission-web.js +7 -0
  155. package/lib/preset-registry.js +36 -25
  156. package/lib/profile-diagnostics.d.ts +45 -0
  157. package/lib/profile-diagnostics.js +148 -0
  158. package/lib/profile-locale.d.ts +3 -0
  159. package/lib/profile-locale.js +2 -0
  160. package/lib/profile-remote.d.ts +8 -0
  161. package/lib/profile-remote.js +163 -39
  162. package/lib/profile-rpc.d.ts +4 -3
  163. package/lib/profile-rpc.js +20 -16
  164. package/lib/profile-runtime.d.ts +40 -1
  165. package/lib/profile-runtime.js +368 -93
  166. package/lib/profile-store.d.ts +11 -0
  167. package/lib/profile-store.js +143 -11
  168. package/lib/profile-types.d.ts +70 -1
  169. package/lib/profile-types.js +1 -0
  170. package/lib/profiles.d.ts +16 -2
  171. package/lib/profiles.js +156 -79
  172. package/lib/prompt-content.js +1 -1
  173. package/lib/prompts.d.ts +37 -2
  174. package/lib/prompts.js +111 -9
  175. package/lib/recovery-policy.js +20 -7
  176. package/lib/role-control-remote.d.ts +38 -0
  177. package/lib/role-control-remote.js +211 -0
  178. package/lib/role-control-rpc.d.ts +51 -0
  179. package/lib/role-control-rpc.js +381 -0
  180. package/lib/role-control-types.d.ts +92 -0
  181. package/lib/role-control-types.js +8 -0
  182. package/lib/role-invocation.d.ts +47 -0
  183. package/lib/role-invocation.js +135 -0
  184. package/lib/role-llm-runtime.d.ts +17 -0
  185. package/lib/role-llm-runtime.js +62 -0
  186. package/lib/role-llm.d.ts +31 -0
  187. package/lib/role-llm.js +66 -0
  188. package/lib/role-policy.d.ts +46 -8
  189. package/lib/role-policy.js +421 -61
  190. package/lib/role-providers.d.ts +2 -2
  191. package/lib/role-providers.js +27 -72
  192. package/lib/role-routing.d.ts +11 -2
  193. package/lib/role-routing.js +42 -25
  194. package/lib/role-runs.d.ts +138 -0
  195. package/lib/role-runs.js +335 -0
  196. package/lib/role-subagents.d.ts +58 -3
  197. package/lib/role-subagents.js +179 -56
  198. package/lib/roles.d.ts +5 -6
  199. package/lib/roles.js +10 -39
  200. package/lib/route-json.d.ts +19 -0
  201. package/lib/route-json.js +129 -0
  202. package/lib/routing-policy.d.ts +2 -0
  203. package/lib/routing-policy.js +12 -2
  204. package/lib/runtime-integration.d.ts +81 -0
  205. package/lib/runtime-integration.js +702 -0
  206. package/lib/runtime-recovery.js +18 -8
  207. package/lib/session-persistence.d.ts +2 -1
  208. package/lib/session-persistence.js +1 -1
  209. package/lib/session-scope.js +4 -1
  210. package/lib/settings.d.ts +47 -13
  211. package/lib/settings.js +217 -82
  212. package/lib/skills.js +2 -2
  213. package/lib/status.d.ts +10 -1
  214. package/lib/status.js +11 -8
  215. package/lib/subagent-runtime.d.ts +57 -0
  216. package/lib/subagent-runtime.js +257 -0
  217. package/package.json +149 -89
  218. package/patches/subagent-runtime.yml +15 -0
  219. package/prompts/deepseek-flash.md +1 -1
  220. package/prompts/deepseek-v4-pro.md +2 -2
  221. package/prompts/deepwork.md +27 -18
  222. package/prompts/source/agents/clarifier.md +5 -3
  223. package/prompts/source/agents/orchestrator.md +18 -9
  224. package/prompts/source/agents/plan-critic.md +5 -1
  225. package/prompts/source/agents/planner.md +4 -2
  226. package/prompts/source/agents/reviewer.md +6 -0
  227. package/prompts/source/category/complex.md +4 -4
  228. package/prompts/source/category/creative.md +6 -4
  229. package/prompts/source/category/cross-cutting.md +10 -8
  230. package/prompts/source/category/deep.md +5 -3
  231. package/prompts/source/category/documenting.md +7 -1
  232. package/prompts/source/category/frontend.md +2 -2
  233. package/prompts/source/category/hard-reasoning.md +3 -3
  234. package/prompts/source/category/research.md +4 -2
  235. package/prompts/source/deepwork/claude-opus-5.md +2 -2
  236. package/prompts/source/deepwork/codex.md +1 -1
  237. package/prompts/source/deepwork/default.md +22 -15
  238. package/prompts/source/deepwork/gemini.md +23 -16
  239. package/prompts/source/deepwork/glm.md +21 -14
  240. package/prompts/source/deepwork/gpt.md +12 -6
  241. package/prompts/source/deepwork/planner.md +8 -5
  242. package/prompts/source/manifest.json +178 -63
  243. package/prompts/source/shared/dsh-host-contract.md +5 -3
  244. package/prompts/source/shared/locale.md +2 -2
  245. package/prompts/source/terminal/orchestrator.md +1 -1
  246. package/skills/ast-grep/SKILL.md +7 -4
  247. package/skills/brainstorming/SKILL.md +43 -22
  248. package/skills/coding-agent-sessions/SKILL.md +7 -4
  249. package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -46
  250. package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -130
  251. package/skills/debugging/SKILL.md +14 -9
  252. package/skills/debugging/references/methodology/00-setup.md +14 -62
  253. package/skills/debugging/references/methodology/02-investigate.md +4 -4
  254. package/skills/debugging/references/methodology/03-flaky-triage.md +3 -3
  255. package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +2 -14
  256. package/skills/debugging/references/methodology/06-fix.md +6 -6
  257. package/skills/debugging/references/methodology/08-qa.md +5 -5
  258. package/skills/debugging/references/methodology/09-cleanup.md +15 -153
  259. package/skills/debugging/references/methodology/partial-runtime-evidence.md +3 -16
  260. package/skills/debugging/references/runtimes/bundled-js-binary.md +1 -16
  261. package/skills/debugging/references/runtimes/native-binary.md +9 -54
  262. package/skills/debugging/references/runtimes/node.md +4 -15
  263. package/skills/debugging/references/runtimes/python.md +3 -15
  264. package/skills/debugging/references/runtimes/rust.md +2 -18
  265. package/skills/debugging/references/tools/dap.md +1 -1
  266. package/skills/debugging/references/tools/ghidra.md +4 -15
  267. package/skills/debugging/references/tools/playwright-cli.md +3 -15
  268. package/skills/debugging/references/tools/pwntools.md +4 -16
  269. package/skills/dispatching-parallel-agents/SKILL.md +18 -16
  270. package/skills/frontend/SKILL.md +7 -4
  271. package/skills/frontend/references/design/react-dev-tooling-skill.md +1 -1
  272. package/skills/git-master/SKILL.md +7 -4
  273. package/skills/init-deep/SKILL.md +7 -4
  274. package/skills/receiving-code-review/SKILL.md +17 -12
  275. package/skills/remove-ai-slops/SKILL.md +39 -38
  276. package/skills/requesting-code-review/SKILL.md +19 -17
  277. package/skills/requesting-code-review/code-reviewer.md +13 -1
  278. package/skills/subagent-driven-development/SKILL.md +29 -26
  279. package/skills/subagent-driven-development/implementer-prompt.md +29 -11
  280. package/skills/subagent-driven-development/spec-reviewer-prompt.md +6 -1
  281. package/skills/using-git-worktrees/SKILL.md +7 -4
  282. package/skills/writing-plans/SKILL.md +29 -24
  283. package/skills/writing-plans/plan-document-reviewer-prompt.md +10 -1
  284. package/scripts/repair-session-log.mjs +0 -476
  285. package/scripts/session-repair-native-verifier.mjs +0 -367
@@ -1,10 +1,12 @@
1
1
  import { createUserMessage, expandAssistantStream } from "@deepseek-ai/dsh-llm";
2
2
  import { foldDurableRecoveryWork, isCurrentRecoveryStep } from "./recovery-policy.js";
3
3
  import { isDsmmRoleId } from "./roles.js";
4
- import { applyModelRoute, isUnavailableRouteFailure, latestNativeModelSelection, liveRolePolicyIdentity, recordAdmittedRecoveryRoute, roleRouteLock, sameModelRoute, selectInitialModelRoute } from "./role-routing.js";
4
+ import { applyModelRoute, isUnavailableRouteFailure, latestNativeModelSelection, liveRolePolicyIdentity, recordAdmittedRecoveryRoute, roleRouteLock, sameExactModelRoute, selectInitialModelRouteChoice } from "./role-routing.js";
5
+ import { modelRouteFromCall, modelRouteFromHeader, projectModelRouteParameters } from "./role-llm.js";
5
6
  import { childOwnedSessionEvents, resolveSelectedAgentPreset, sessionEvents } from "./session-scope.js";
6
7
  import { resolveAdmittedDsmmRole as resolveEffectiveDsmmRole } from "./role-policy.js";
7
8
  import { resolveRoleRuntimePolicy } from "./routing-policy.js";
9
+ import { configuredModelParameterPolicy, resolvedModelParameterPolicy } from "./model-parameter-policy.js";
8
10
  const installedContexts = new WeakSet();
9
11
  const RECOVERY_WARNING = "dsmm runtime recovery refused an unproven or exhausted retry";
10
12
  const CONTINUATION_WARNING = "dsmm runtime recovery continuation steering failed for turn";
@@ -115,7 +117,7 @@ export function registerRuntimeRecovery(ctx, controller, getSettings) {
115
117
  }
116
118
  const previous = attemptsByAgent.get(agent);
117
119
  const attempt = { id: frame.attemptId, turn: frame.turn, step: frame.step, revision: frame.revision, chunks: 0,
118
- route: { provider: header.config.provider, model: header.config.model }, header, policy, generation: lock?.generation, manualSelectionSeq: lock?.manualSelectionSeq,
120
+ route: modelRouteFromHeader(header), header, policy, generation: lock?.generation, manualSelectionSeq: lock?.manualSelectionSeq,
119
121
  valid: Number.isSafeInteger(frame.revision) && frame.revision >= 1 && (previous === undefined || frame.revision === previous.revision + 1), output: false, consumed: false };
120
122
  attemptsByAgent.set(agent, attempt);
121
123
  if (lock !== undefined)
@@ -177,10 +179,10 @@ export function registerRuntimeRecovery(ctx, controller, getSettings) {
177
179
  return downstream;
178
180
  }
179
181
  }
180
- const accepted = frame.agent.session.requestHeader?.()?.config;
182
+ const accepted = frame.agent.session.requestHeader?.();
181
183
  const lock = pending.policy === undefined ? undefined : roleRouteLock(frame.agent, pending.policy);
182
184
  if (!active || lock === undefined || lock.generation !== pending.generation || attemptsByAgent.get(frame.agent) !== pending.attempt
183
- || accepted === undefined || !sameModelRoute(accepted, pending.failedRoute)) {
185
+ || accepted === undefined || !sameExactModelRoute(modelRouteFromHeader(accepted), pending.failedRoute)) {
184
186
  pendingByAgent.delete(frame.agent);
185
187
  return downstream;
186
188
  }
@@ -215,7 +217,7 @@ export function registerRuntimeRecovery(ctx, controller, getSettings) {
215
217
  const attempt = attemptsByAgent.get(frame.agent);
216
218
  const header = frame.agent.session.requestHeader?.();
217
219
  if (!active || frame.signal.aborted || lock === undefined || header === undefined
218
- || header.config.provider !== frame.provider || !sameModelRoute(header.config, lock.route)
220
+ || header.config.provider !== frame.provider || !sameExactModelRoute(modelRouteFromHeader(header), lock.route)
219
221
  || attempt === undefined || attempt.policy !== policy || attempt.generation !== lock.generation
220
222
  || latestNativeModelSelection(frame.agent)?.seq !== attempt.manualSelectionSeq
221
223
  || !isCurrentRecoveryStep(recoveryEvents(frame.agent), frame.turn, frame.step) || !positiveNoOutput(frame, attempt))
@@ -224,6 +226,7 @@ export function registerRuntimeRecovery(ctx, controller, getSettings) {
224
226
  const resolved = resolveRoleRuntimePolicy(settings, role);
225
227
  const bounds = resolved.rateLimit;
226
228
  let route = lock.route;
229
+ let candidateIndex = lock.candidateIndex;
227
230
  let switching = false;
228
231
  if (unavailable) {
229
232
  if (lock.startupSettled || lock.attempts !== 1)
@@ -241,12 +244,18 @@ export function registerRuntimeRecovery(ctx, controller, getSettings) {
241
244
  if (switching) {
242
245
  if (!unavailable && lock.switches >= bounds.maxSwitches)
243
246
  return undefined;
244
- const index = lock.candidates.findIndex((candidate) => sameModelRoute(candidate, lock.route));
247
+ const index = lock.candidateIndex;
245
248
  const candidates = lock.candidates.slice(index + 1);
246
249
  if (index < 0 || candidates.length === 0)
247
250
  return undefined;
248
251
  const llm = frame.agent.ctx?.get?.("llm") ?? ctx.get?.("llm") ?? ctx.llm;
249
- route = await selectInitialModelRoute(llm ?? {}, candidates, frame.signal);
252
+ const admission = getSettings.admission?.(frame.agent);
253
+ const parameterPolicy = admission === undefined ? configuredModelParameterPolicy(settings) : resolvedModelParameterPolicy(admission);
254
+ const selected = await selectInitialModelRouteChoice(llm ?? {}, candidates, frame.signal, parameterPolicy.mode === "passthrough" ? ctx.get?.("dsmmLlmRoutes") : undefined);
255
+ route = parameterPolicy.mode === "native-defaults"
256
+ ? modelRouteFromCall(projectModelRouteParameters(selected.route, selected.requestedRoute.reasoningEffort === undefined ? "dsmm-config" : "native", false))
257
+ : selected.route;
258
+ candidateIndex = index + 1 + candidates.findIndex(candidate => sameExactModelRoute(candidate, selected.requestedRoute));
250
259
  }
251
260
  const serverMinimum = frame.failure.providerRetryAfterMs;
252
261
  if (serverMinimum !== undefined && (!Number.isSafeInteger(serverMinimum) || serverMinimum < 0))
@@ -281,9 +290,10 @@ export function registerRuntimeRecovery(ctx, controller, getSettings) {
281
290
  || attemptsByAgent.get(frame.agent) !== attempt || !isCurrentRecoveryStep(recoveryEvents(frame.agent), frame.turn, frame.step)
282
291
  || latestNativeModelSelection(frame.agent)?.seq !== attempt.manualSelectionSeq
283
292
  || !positiveNoOutput(frame, attempt, true)
284
- || !sameModelRoute(frame.agent.session.requestHeader?.()?.config ?? { provider: "", model: "" }, attempt.route))
293
+ || !sameExactModelRoute(modelRouteFromHeader(frame.agent.session.requestHeader?.()), attempt.route))
285
294
  return undefined;
286
295
  if (switching) {
296
+ lock.candidateIndex = candidateIndex;
287
297
  lock.generation += 1;
288
298
  if (!unavailable)
289
299
  lock.switches += 1;
@@ -2,6 +2,7 @@ import { Context, Service } from "@deepseek-ai/cordis";
2
2
  import type { SessionHeader, SessionId } from "@deepseek-ai/dsh-session";
3
3
  import { SessionPersistence } from "@deepseek-ai/dsh-session-persistence";
4
4
  import type { SessionAccess, SessionHandle, SessionPersistenceCreateOptions, SessionPersistenceListOptions, SessionPersistenceOpenOptions, SessionPersistenceStatOptions } from "@deepseek-ai/dsh-session-persistence";
5
+ import * as JsonlSessionPersistence from "@deepseek-ai/dsh-session-persistence-jsonl";
5
6
  import type { Config } from "@deepseek-ai/dsh-session-persistence-jsonl";
6
7
  export { DSMM_PERSISTENCE_COMPATIBILITY } from "./session-metadata.js";
7
8
  export type { Config } from "@deepseek-ai/dsh-session-persistence-jsonl";
@@ -12,7 +13,7 @@ export type { Config } from "@deepseek-ai/dsh-session-persistence-jsonl";
12
13
  */
13
14
  export default class DsmmSessionPersistence extends SessionPersistence {
14
15
  readonly config: Config;
15
- static Config: import("@deepseek-ai/schemastery").default<Config>;
16
+ static Config: import("@deepseek-ai/schemastery").default<JsonlSessionPersistence.Config>;
16
17
  readonly name = "dsmm-session-persistence";
17
18
  private readonly inner;
18
19
  private readonly ready;
@@ -1,6 +1,6 @@
1
1
  import { Context, Service } from "@deepseek-ai/cordis";
2
2
  import { SessionHandleClosedError, SessionPersistence, SessionReadOnlyError, materializeAppendBatch } from "@deepseek-ai/dsh-session-persistence";
3
- import JsonlSessionPersistence from "@deepseek-ai/dsh-session-persistence-jsonl";
3
+ import * as JsonlSessionPersistence from "@deepseek-ai/dsh-session-persistence-jsonl";
4
4
  import { isDeepStrictEqual } from "node:util";
5
5
  import { annotateDsmmEvent, DSMM_PERSISTENCE_COMPATIBILITY } from "./session-metadata.js";
6
6
  export { DSMM_PERSISTENCE_COMPATIBILITY } from "./session-metadata.js";
@@ -1,6 +1,7 @@
1
1
  import { foldSubagentDescriptor } from "@deepseek-ai/dsh-subagent";
2
2
  import { isDsmmRoleId } from "./roles.js";
3
3
  import { roleFromProviderName } from "./role-providers.js";
4
+ import { capturedRoleInvocation } from "./role-invocation.js";
4
5
  export function sessionEvents(session) {
5
6
  return session?.snapshotEvents?.() ?? session?.events ?? [];
6
7
  }
@@ -31,7 +32,9 @@ export function resolveEffectiveDsmmRole(agent, settings, modeActive) {
31
32
  if (agent.session.header?.origin === "subagent") {
32
33
  const own = childOwnedSessionEvents(agent.session);
33
34
  const descriptor = foldSubagentDescriptor(own);
34
- role = descriptor?.mode === "one-shot" ? roleFromProviderName(descriptor.provider) : undefined;
35
+ // Native lifecycle mode does not determine an exact Agent's admitted DSMM role.
36
+ role = capturedRoleInvocation(agent)?.target
37
+ ?? (descriptor?.mode === "one-shot" ? roleFromProviderName(descriptor.provider) : undefined);
35
38
  }
36
39
  else {
37
40
  const preset = resolveSelectedAgentPreset(agent.session);
package/lib/settings.d.ts CHANGED
@@ -5,6 +5,11 @@ import type { DsmmRoleId } from "./roles.js";
5
5
  import type { DsmmSkillName } from "./skills.js";
6
6
  import type { DsmmRateLimitPolicy, DsmmRoutingStrategy, DsmmRuntimePolicyConfig, DsmmRuntimePolicySettings } from "./routing-policy.js";
7
7
  import type { DeploymentSchemaNode } from "./profile-types.js";
8
+ import type { DsmmLocale } from "./profile-locale.js";
9
+ import type { ModelRouteJson } from "./route-json.js";
10
+ import type { PermissionControlSchemaInput, PermissionControlSettings } from "./permission-settings.js";
11
+ export { DSMM_LOCALES } from "./profile-locale.js";
12
+ export type { DsmmLocale } from "./profile-locale.js";
8
13
  export type { DsmmRateLimitPolicy, DsmmRoutingStrategy, DsmmRuntimePolicyConfig, DsmmRuntimePolicySettings } from "./routing-policy.js";
9
14
  export { resolveRoleRuntimePolicy } from "./routing-policy.js";
10
15
  export { DSMM_SKILL_NAMES, MVP_SKILL_NAMES } from "./skills.js";
@@ -14,6 +19,17 @@ export type DeepseekDefaultReasoningEffort = "off" | "low" | "high";
14
19
  export type DsmmFinalReviewPolicy = "simple-oracle-complex-reviewer" | "reviewer-only" | "off";
15
20
  export type DsmmGuardScope = "deepwork-or-dsmm-agent" | "always" | "off";
16
21
  export type DsmmGitWritePolicy = "ask" | "deny" | "off";
22
+ export type DsmmInvocationLevel = "normal" | "low" | "high" | "max";
23
+ export type DsmmLevelOverride = {
24
+ reasoningEffort: string;
25
+ provider?: never;
26
+ model?: never;
27
+ } | DsmmModelRoute;
28
+ export interface DsmmInvocationOptions {
29
+ level?: DsmmInvocationLevel;
30
+ route?: DsmmLevelOverride;
31
+ }
32
+ export type DsmmToolTopology = "per-role" | "parameterized";
17
33
  export interface DsmmWorkflowSettings {
18
34
  policy: "risk-based" | "legacy";
19
35
  strictGates: boolean;
@@ -22,9 +38,13 @@ export interface DsmmWorkflowSettings {
22
38
  }
23
39
  export interface DsmmPresetSettings {
24
40
  materialize: boolean;
41
+ /** Startup-pinned root exposure only; workflow Planner delegation stays enabled. */
42
+ plannerRootEnabled: boolean;
25
43
  root?: string;
26
44
  }
27
45
  export interface DsmmSubagentSettings {
46
+ toolTopology: DsmmToolTopology;
47
+ allowRouteOverride: boolean;
28
48
  enableRunInBackground: boolean;
29
49
  backgroundMode: "one-shot" | "continuable";
30
50
  /** Omitted delegates to the native host limit (rc.2 default 1). */
@@ -45,14 +65,10 @@ export interface DsmmGuardSettings {
45
65
  };
46
66
  todoDisciplineHelper: boolean;
47
67
  }
48
- export interface DsmmModelRoute {
49
- provider: string;
50
- model: string;
51
- reasoningEffort?: string;
52
- }
53
- export interface DsmmRecoveryRoute extends DsmmModelRoute {
54
- }
68
+ export type DsmmModelRoute = ModelRouteJson;
69
+ export type DsmmRecoveryRoute = DsmmModelRoute;
55
70
  export interface DsmmRoleRoutingConfig {
71
+ levels?: Partial<Record<Exclude<DsmmInvocationLevel, "normal">, DsmmLevelOverride>>;
56
72
  primary?: DsmmModelRoute;
57
73
  fallbackRoutes?: DsmmModelRoute[];
58
74
  strategy?: DsmmRoutingStrategy;
@@ -76,10 +92,16 @@ type DsmmGuardConfig = Partial<Omit<DsmmGuardSettings, "toolOutputTruncation" |
76
92
  questionLabelHelper?: Partial<DsmmGuardSettings["questionLabelHelper"]>;
77
93
  };
78
94
  type DsmmRuntimeRecoveryConfig = Partial<Omit<DsmmRuntimeRecoverySettings, "fallbackRoutes" | "idleContinuation">> & {
79
- fallbackRoutes?: Array<Partial<DsmmRecoveryRoute>>;
95
+ fallbackRoutes?: DsmmRecoveryRoute[];
80
96
  idleContinuation?: Partial<DsmmRuntimeRecoverySettings["idleContinuation"]>;
81
97
  };
82
98
  export interface DsmmPluginConfig {
99
+ /** Deployment-only; the mounted permission owner retains its cold-start policy. */
100
+ permissionControl?: PermissionControlSchemaInput;
101
+ modelParameters?: {
102
+ passthrough?: boolean;
103
+ };
104
+ locale?: DsmmLocale;
83
105
  /** Only global deployment input; native/legacy profile transport rejects it. */
84
106
  modules?: {
85
107
  deepwork?: {
@@ -95,10 +117,8 @@ export interface DsmmPluginConfig {
95
117
  section?: string;
96
118
  deepseekV4ProCalibration?: DeepseekCalibration;
97
119
  deepseekV4ProDefaultReasoningEffort?: DeepseekDefaultReasoningEffort;
98
- deepseekV4ProMaxReasoningPresets?: DsmmRoleId[];
99
120
  deepseekFlashCalibration?: DeepseekCalibration;
100
121
  deepseekFlashDefaultReasoningEffort?: DeepseekDefaultReasoningEffort;
101
- deepseekFlashMaxReasoningPresets?: DsmmRoleId[];
102
122
  defaultActive?: boolean;
103
123
  promptOrder?: number;
104
124
  skills?: Partial<Record<DsmmSkillName, boolean>>;
@@ -113,6 +133,11 @@ export interface DsmmPluginConfig {
113
133
  lsp?: Partial<DsmmLspSettings>;
114
134
  }
115
135
  export interface DsmmSettings {
136
+ permissionControl: PermissionControlSettings;
137
+ modelParameters: {
138
+ passthrough: boolean;
139
+ };
140
+ locale?: DsmmLocale;
116
141
  modules: {
117
142
  deepwork: {
118
143
  enabled: boolean;
@@ -123,10 +148,8 @@ export interface DsmmSettings {
123
148
  promptOrder: number;
124
149
  deepseekV4ProCalibration: DeepseekCalibration;
125
150
  deepseekV4ProDefaultReasoningEffort: DeepseekDefaultReasoningEffort;
126
- deepseekV4ProMaxReasoningPresets: DsmmRoleId[];
127
151
  deepseekFlashCalibration: DeepseekCalibration;
128
152
  deepseekFlashDefaultReasoningEffort: DeepseekDefaultReasoningEffort;
129
- deepseekFlashMaxReasoningPresets: DsmmRoleId[];
130
153
  skills: Record<DsmmSkillName, boolean>;
131
154
  roles: Record<DsmmRoleId, boolean>;
132
155
  roleRouting: DsmmRoleRouting;
@@ -140,12 +163,17 @@ export interface DsmmSettings {
140
163
  }
141
164
  export type DsmmProfileScope = "global-default" | "session-override" | "deployment-baseline";
142
165
  export interface DsmmProfileAdmission {
166
+ childCapture?: import("./child-capture.js").ChildAdmissionCapture;
167
+ childEvidence?: import("./child-capture.js").ChildAdmissionEvidenceView;
168
+ warnings?: import("./profile-diagnostics.js").ProfileDiagnostic[];
169
+ roleAvailability?: import("./profile-types.js").DsmmRoleAvailabilityState[];
170
+ subagentRuntime?: import("./profile-types.js").SubagentRuntimeAdmissionView;
143
171
  settings: DsmmSettings;
144
172
  profile: {
145
173
  id: string;
146
174
  revision: string;
147
175
  } | null;
148
- epoch: string;
176
+ readonly epoch: string;
149
177
  scope: DsmmProfileScope;
150
178
  deployment?: DsmmDeploymentSnapshot;
151
179
  restartRequired?: readonly string[];
@@ -186,6 +214,7 @@ export interface DsmmDeploymentSnapshot {
186
214
  export type DsmmSettingsGetter = ((agent?: DshAgent) => DsmmSettings) & {
187
215
  admission?: (agent?: DshAgent) => DsmmProfileAdmission;
188
216
  moduleStates?: (agent?: DshAgent) => import("./modules.js").DsmmModuleState[];
217
+ subagentRuntime?: () => import("./profile-types.js").SubagentRuntimeAdmissionView;
189
218
  };
190
219
  export interface DsmmResolvedRoleRuntimePolicy {
191
220
  readonly strategy: DsmmRoutingStrategy;
@@ -217,8 +246,13 @@ export declare function validateDeploymentPath(path: readonly string[]): void;
217
246
  export declare function mergeConfigLayers(...layers: DsmmPluginConfig[]): DsmmPluginConfig;
218
247
  export declare function resolveDeployment(global: DsmmPluginConfig, profile: DsmmPluginConfig): DsmmSettings;
219
248
  export declare function validateResolvedSettings(settings: DsmmSettings): DsmmSettings;
249
+ export declare function rejectDeprecatedFields(input: object, prefix?: string): void;
250
+ export declare function validateLocale(value: unknown, field?: string): asserts value is DsmmLocale;
251
+ export declare function normalizeLevelOverride(value: unknown, field?: string): DsmmLevelOverride;
220
252
  export declare function resolveRoleRouting(input: DsmmRoleRouting | undefined): DsmmRoleRouting;
221
253
  export declare function isRoleEnabled(settings: DsmmSettings, role: DsmmRoleId): boolean;
254
+ /** Native standing-root availability is independent of child role enablement. */
255
+ export declare function isRootRoleEnabled(settings: DsmmSettings, id: DsmmRoleId): boolean;
222
256
  export declare function resolveGuardSettings(config: DsmmPluginConfig["guards"]): DsmmGuardSettings;
223
257
  export declare function registerSettings(ctx: DshContext, config?: DsmmPluginConfig, options?: RegisterSettingsOptions): () => DsmmSettings;
224
258
  //# sourceMappingURL=settings.d.ts.map