@dsmm/dsmm 0.2.2 → 0.3.1

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 (182) hide show
  1. package/README.md +26 -42
  2. package/cordis.patch.yml +1 -0
  3. package/docs/agent-presets.md +26 -14
  4. package/docs/compatibility.md +20 -79
  5. package/docs/deferred-native-approval-risk.md +8 -12
  6. package/docs/design.md +25 -254
  7. package/docs/lsp.md +2 -2
  8. package/docs/migration-from-ocmm.md +38 -51
  9. package/docs/model-routing.md +21 -21
  10. package/docs/native-permissions.md +17 -7
  11. package/docs/profiles.md +13 -9
  12. package/docs/releasing.md +34 -240
  13. package/docs/roadmap.md +23 -254
  14. package/docs/runtime-recovery.md +29 -91
  15. package/docs/safety-guards.md +19 -16
  16. package/docs/settings-status.md +23 -11
  17. package/docs/skill-sync.md +17 -17
  18. package/docs/web-fetch-fakeip.md +82 -0
  19. package/lib/child-capture.d.ts +16 -2
  20. package/lib/child-capture.js +29 -10
  21. package/lib/client/ChildrenPanel.d.ts +1 -4
  22. package/lib/client/ChildrenPanel.js +4 -16
  23. package/lib/client/DeploymentFields.d.ts +28 -0
  24. package/lib/client/DeploymentFields.js +68 -0
  25. package/lib/client/DeploymentPage.d.ts +17 -5
  26. package/lib/client/DeploymentPage.js +79 -112
  27. package/lib/client/NativeCommandEntries.d.ts +17 -0
  28. package/lib/client/NativeCommandEntries.js +68 -0
  29. package/lib/client/PermissionsPanel.d.ts +1 -1
  30. package/lib/client/PermissionsPanel.js +8 -8
  31. package/lib/client/ProfilesSection.js +7 -5
  32. package/lib/client/RoleToolView-data.d.ts +35 -0
  33. package/lib/client/RoleToolView-data.js +52 -0
  34. package/lib/client/RoleToolView-locales.d.ts +36 -0
  35. package/lib/client/RoleToolView-locales.js +20 -0
  36. package/lib/client/RoleToolView.d.ts +10 -0
  37. package/lib/client/RoleToolView.js +47 -0
  38. package/lib/client/SessionProfiles.js +39 -15
  39. package/lib/client/children-controller.d.ts +2 -8
  40. package/lib/client/children-controller.js +1 -26
  41. package/lib/client/children-locales.d.ts +26 -51
  42. package/lib/client/children-locales.js +8 -12
  43. package/lib/client/configuration-display.d.ts +5 -0
  44. package/lib/client/configuration-display.js +11 -0
  45. package/lib/client/controller.d.ts +1 -0
  46. package/lib/client/controller.js +20 -13
  47. package/lib/client/deployment-controller.d.ts +13 -1
  48. package/lib/client/deployment-controller.js +85 -25
  49. package/lib/client/deployment-data.d.ts +1 -0
  50. package/lib/client/deployment-data.js +4 -1
  51. package/lib/client/deployment-locales.d.ts +43 -0
  52. package/lib/client/deployment-locales.js +35 -9
  53. package/lib/client/deployment-modules.d.ts +9 -0
  54. package/lib/client/deployment-modules.js +24 -0
  55. package/lib/client/deployment-workspace.d.ts +48 -0
  56. package/lib/client/deployment-workspace.js +123 -0
  57. package/lib/client/index.js +11 -74
  58. package/lib/client/locales.d.ts +7 -0
  59. package/lib/client/locales.js +12 -6
  60. package/lib/client/permission-controller.d.ts +1 -0
  61. package/lib/client/permission-controller.js +3 -2
  62. package/lib/client/permission-locales.d.ts +25 -0
  63. package/lib/client/permission-locales.js +24 -4
  64. package/lib/client/session-labels.js +4 -3
  65. package/lib/client/styles.d.ts +1 -1
  66. package/lib/client/styles.js +9 -8
  67. package/lib/client.js +2716 -2364
  68. package/lib/commands.js +2 -0
  69. package/lib/config-file-store.d.ts +3 -0
  70. package/lib/config-file-store.js +4 -2
  71. package/lib/config-revision.d.ts +5 -0
  72. package/lib/config-revision.js +11 -0
  73. package/lib/core-permission-authority.js +11 -41
  74. package/lib/deployment-config.d.ts +9 -2
  75. package/lib/deployment-config.js +35 -8
  76. package/lib/deployment-permission-rules.js +19 -7
  77. package/lib/dsh-types.d.ts +1 -1
  78. package/lib/host-llm-startup.js +3 -3
  79. package/lib/host-llm.d.ts +9 -3
  80. package/lib/host-llm.js +48 -8
  81. package/lib/index.d.ts +17 -21
  82. package/lib/index.js +131 -430
  83. package/lib/lifetime.d.ts +4 -0
  84. package/lib/lifetime.js +22 -0
  85. package/lib/live-pi-ai-owner.d.ts +1 -0
  86. package/lib/live-pi-ai-owner.js +8 -4
  87. package/lib/mode.d.ts +3 -2
  88. package/lib/mode.js +28 -41
  89. package/lib/model-routing.d.ts +2 -8
  90. package/lib/model-routing.js +59 -175
  91. package/lib/native-admission.d.ts +56 -0
  92. package/lib/native-admission.js +313 -0
  93. package/lib/native-pi-ai-wire.d.ts +3 -1
  94. package/lib/native-pi-ai-wire.js +47 -13
  95. package/lib/permission-control.d.ts +0 -3
  96. package/lib/permission-rpc.js +3 -3
  97. package/lib/preset-registry.js +3 -2
  98. package/lib/preset-skills.d.ts +3 -12
  99. package/lib/preset-skills.js +28 -58
  100. package/lib/profile-diagnostics.d.ts +1 -1
  101. package/lib/profile-diagnostics.js +2 -2
  102. package/lib/profile-remote.js +61 -22
  103. package/lib/profile-rpc.d.ts +4 -3
  104. package/lib/profile-rpc.js +39 -41
  105. package/lib/profile-runtime.d.ts +31 -74
  106. package/lib/profile-runtime.js +224 -639
  107. package/lib/profile-store.d.ts +18 -6
  108. package/lib/profile-store.js +106 -64
  109. package/lib/profile-types.d.ts +18 -4
  110. package/lib/profiles.d.ts +3 -1
  111. package/lib/profiles.js +9 -7
  112. package/lib/prompt-content.d.ts +1 -0
  113. package/lib/prompt-content.js +4 -1
  114. package/lib/prompts.d.ts +2 -12
  115. package/lib/prompts.js +11 -66
  116. package/lib/role-control-remote.d.ts +1 -4
  117. package/lib/role-control-remote.js +8 -36
  118. package/lib/role-control-rpc.d.ts +10 -36
  119. package/lib/role-control-rpc.js +112 -265
  120. package/lib/role-control-types.d.ts +3 -26
  121. package/lib/role-control-types.js +3 -4
  122. package/lib/role-identity.d.ts +5 -0
  123. package/lib/role-identity.js +10 -0
  124. package/lib/role-invocation.d.ts +2 -2
  125. package/lib/role-llm-runtime.js +5 -11
  126. package/lib/role-policy.d.ts +19 -53
  127. package/lib/role-policy.js +136 -525
  128. package/lib/role-providers.d.ts +5 -8
  129. package/lib/role-providers.js +20 -126
  130. package/lib/role-routing.d.ts +1 -3
  131. package/lib/role-routing.js +24 -34
  132. package/lib/role-subagents.d.ts +5 -14
  133. package/lib/role-subagents.js +149 -97
  134. package/lib/runtime-integration.d.ts +5 -109
  135. package/lib/runtime-integration.js +11 -779
  136. package/lib/session-metadata.d.ts +13 -12
  137. package/lib/session-metadata.js +6 -31
  138. package/lib/session-scope.js +6 -2
  139. package/lib/settings.d.ts +5 -18
  140. package/lib/settings.js +19 -43
  141. package/lib/state.d.ts +3 -2
  142. package/lib/state.js +26 -10
  143. package/lib/status.d.ts +1 -9
  144. package/lib/status.js +3 -55
  145. package/lib/web-fetch-address-policy.d.ts +24 -0
  146. package/lib/web-fetch-address-policy.js +189 -0
  147. package/lib/web-fetch-fakeip.d.ts +25 -0
  148. package/lib/web-fetch-fakeip.js +107 -0
  149. package/package.json +133 -113
  150. package/docs/research/deepseek-v4-pro.md +0 -74
  151. package/docs/research/oh-dsh.md +0 -96
  152. package/lib/child-admission.d.ts +0 -42
  153. package/lib/child-admission.js +0 -162
  154. package/lib/delivery-authority.d.ts +0 -68
  155. package/lib/delivery-authority.js +0 -260
  156. package/lib/legacy-child-policy.d.ts +0 -51
  157. package/lib/legacy-child-policy.js +0 -123
  158. package/lib/legacy-read-composition.d.ts +0 -20
  159. package/lib/legacy-read-composition.js +0 -144
  160. package/lib/legacy-read-contracts.d.ts +0 -157
  161. package/lib/legacy-read-contracts.js +0 -39
  162. package/lib/legacy-read-host.d.ts +0 -19
  163. package/lib/legacy-read-host.js +0 -67
  164. package/lib/legacy-read-integration.d.ts +0 -121
  165. package/lib/legacy-read-integration.js +0 -522
  166. package/lib/legacy-read-proxy.d.ts +0 -26
  167. package/lib/legacy-read-proxy.js +0 -237
  168. package/lib/native-child-evidence.d.ts +0 -42
  169. package/lib/native-child-evidence.js +0 -133
  170. package/lib/role-runs.d.ts +0 -135
  171. package/lib/role-runs.js +0 -304
  172. package/lib/session-persistence.d.ts +0 -35
  173. package/lib/session-persistence.js +0 -304
  174. package/lib/subagent-runtime.d.ts +0 -45
  175. package/lib/subagent-runtime.js +0 -131
  176. package/prompts/deepseek-flash.md +0 -11
  177. package/prompts/deepseek-v4-pro.md +0 -14
  178. package/scripts/cold-profile-composition.mjs +0 -329
  179. package/scripts/cold-profile-sources.mjs +0 -238
  180. package/scripts/migrate-cold-profile.mjs +0 -315
  181. package/scripts/repair-session-log.mjs +0 -476
  182. package/scripts/session-repair-native-verifier.mjs +0 -367
package/lib/prompts.d.ts CHANGED
@@ -4,14 +4,11 @@ import type { SourceRoleContent } from "./prompt-content.js";
4
4
  import type { DsmmSettings } from "./settings.js";
5
5
  import type { DsmmInvocationView, DsmmRoleAvailabilityState, SubagentRuntimeAdmissionView } from "./profile-types.js";
6
6
  import type { DsmmCallableEntry } from "./role-subagents.js";
7
- import type { ChildAdmissionEvidenceView } from "./child-evidence.js";
8
7
  export { SOURCE_ROLE_CATALOG, buildRolePersona } from "./prompt-content.js";
9
8
  export type { SourceRoleContent } from "./prompt-content.js";
10
9
  export declare const BASE_DEEPWORK_PROMPT: string;
11
10
  export declare function promptModelVariants(role: string | undefined, model: string): string[];
12
11
  export declare function roleModelCalibration(role: SourceRoleContent | undefined, model: string): string;
13
- export declare const DEEPSEEK_V4_PRO_OVERLAY = "<dsmm-deepseek-v4-pro-calibration>\n\nDeepSeek V4 Pro calibration is active.\n\n- Treat complex coding, architecture, migration, debugging, and review tasks as deliberate reasoning tasks.\n- First classify the task and identify the evidence needed.\n- Use tools before making repository-specific or API-specific claims.\n- Runtime reasoning effort is enforced by `agent/request`, not this prompt.\n- Ordinary root model and effort stay under the native model picker. Explicit preflighted invocation effort takes precedence over calibration.\n- For other eligible child requests, `auto` preserves explicit upstream effort; `strict` uses the configured default only when the adapter advertises a supported effort. If none is advertised, leave the request unchanged.\n- Keep final answers concise and do not expose private chain-of-thought.\n- When tool calls are enabled through the provider, preserve the provider-required reasoning/tool-call continuity.\n\n</dsmm-deepseek-v4-pro-calibration>";
14
- export declare const DEEPSEEK_FLASH_OVERLAY = "<dsmm-deepseek-flash-calibration>\n\nDeepSeek-V41-Flash applies only to the verified deepseek-official/deepseek-flash or deepseek-account/deepseek-flash routes. The host catalog and explicit user model choice are authoritative.\n\n- Keep work outcome-first and avoid procedural review or approval loops.\n- Runtime reasoning effort is chosen by the adapter only from the resolved model's advertised efforts. If the catalog advertises no reasoning efforts, leave the request unchanged.\n- Ordinary root model and effort stay native-owned; explicit preflighted invocation effort takes precedence. For other eligible child requests, auto preserves explicit upstream effort; strict uses only an advertised effort.\n- Do not assume max, high, temperature, or another model's capabilities. Do not claim model heterogeneity when all child roles use the same route.\n- Maintain tool-call continuity required by the provider and never reveal private reasoning.\n\n</dsmm-deepseek-flash-calibration>";
15
12
  export interface DeepworkPromptOptions {
16
13
  route?: Pick<DshLlmCallConfig, "provider" | "model">;
17
14
  selectedPreset?: string;
@@ -32,20 +29,13 @@ export interface DsmmPromptObservation {
32
29
  };
33
30
  runtimeAdmission?: Readonly<SubagentRuntimeAdmissionView>;
34
31
  capabilities?: {
35
- nativeJobs?: boolean;
36
- /** Admitted creation of new continuable children, not existing-child delivery. */
37
32
  continuable?: boolean;
38
- /** Observed managed running/idle/same-ID cold delivery to existing continuable children under this Agent's authority. */
39
- managedChildDelivery?: boolean;
40
- /** Only set after the operator/session/epoch-gated user surface is wired. */
41
- foregroundHandoff?: {
42
- surface: string;
43
- };
33
+ /** Existing exact live child delivery; never a cold-recovery claim. */
34
+ nativeChildDelivery?: boolean;
44
35
  nativeBrowserPrompt?: {
45
36
  surface: string;
46
37
  };
47
38
  };
48
- childEvidence?: Readonly<ChildAdmissionEvidenceView>;
49
39
  }
50
40
  export declare function buildDsmmLocaleGuidance(settings: Pick<DsmmSettings, "locale">): string;
51
41
  /** Register independently of the common-mode section, in the exact Agent scope. */
package/lib/prompts.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { readPromptAsset as asset, SOURCE_ROLE_CATALOG, splitCategory } from "./prompt-content.js";
2
- import { CHILD_EVIDENCE_FIELDS } from "./child-evidence.js";
3
2
  export { SOURCE_ROLE_CATALOG, buildRolePersona } from "./prompt-content.js";
4
3
  const activation = `<dsmm-deepwork-mode>
5
4
  Use this workflow only while the \`{{modeName}}\` mode is effectively active. This is an opt-in boundary: ordinary presets default off; DW roles default on, but explicit off wins and retains only persona/access. Never force common workflow or skills on merely from a role name.
@@ -41,31 +40,6 @@ export function roleModelCalibration(role, model) {
41
40
  }
42
41
  return layers.join("\n\n---\n\n");
43
42
  }
44
- export const DEEPSEEK_V4_PRO_OVERLAY = `<dsmm-deepseek-v4-pro-calibration>
45
-
46
- DeepSeek V4 Pro calibration is active.
47
-
48
- - Treat complex coding, architecture, migration, debugging, and review tasks as deliberate reasoning tasks.
49
- - First classify the task and identify the evidence needed.
50
- - Use tools before making repository-specific or API-specific claims.
51
- - Runtime reasoning effort is enforced by \`agent/request\`, not this prompt.
52
- - Ordinary root model and effort stay under the native model picker. Explicit preflighted invocation effort takes precedence over calibration.
53
- - For other eligible child requests, \`auto\` preserves explicit upstream effort; \`strict\` uses the configured default only when the adapter advertises a supported effort. If none is advertised, leave the request unchanged.
54
- - Keep final answers concise and do not expose private chain-of-thought.
55
- - When tool calls are enabled through the provider, preserve the provider-required reasoning/tool-call continuity.
56
-
57
- </dsmm-deepseek-v4-pro-calibration>`;
58
- export const DEEPSEEK_FLASH_OVERLAY = `<dsmm-deepseek-flash-calibration>
59
-
60
- DeepSeek-V41-Flash applies only to the verified deepseek-official/deepseek-flash or deepseek-account/deepseek-flash routes. The host catalog and explicit user model choice are authoritative.
61
-
62
- - Keep work outcome-first and avoid procedural review or approval loops.
63
- - Runtime reasoning effort is chosen by the adapter only from the resolved model's advertised efforts. If the catalog advertises no reasoning efforts, leave the request unchanged.
64
- - Ordinary root model and effort stay native-owned; explicit preflighted invocation effort takes precedence. For other eligible child requests, auto preserves explicit upstream effort; strict uses only an advertised effort.
65
- - Do not assume max, high, temperature, or another model's capabilities. Do not claim model heterogeneity when all child roles use the same route.
66
- - Maintain tool-call continuity required by the provider and never reveal private reasoning.
67
-
68
- </dsmm-deepseek-flash-calibration>`;
69
43
  const localeNames = {
70
44
  en: "English", "zh-Hans": "Simplified Chinese", "zh-Hant": "Traditional Chinese", ja: "Japanese", ko: "Korean",
71
45
  de: "German", fr: "French", es: "Spanish", "pt-BR": "Brazilian Portuguese", ru: "Russian"
@@ -90,15 +64,6 @@ function projectInvocation({ routeKind, view }) {
90
64
  ...(view.jobId === undefined ? {} : { jobId: view.jobId })
91
65
  } };
92
66
  }
93
- function projectChildEvidence(evidence) {
94
- return { mode: evidence.mode, parentAdmissionEpoch: evidence.parentAdmissionEpoch,
95
- ...(evidence.mode === "captured" && evidence.originalAdmissionEpoch !== undefined ? { originalAdmissionEpoch: evidence.originalAdmissionEpoch } : {}),
96
- provenFields: [...new Set(evidence.provenFields.filter(field => CHILD_EVIDENCE_FIELDS.includes(field)))],
97
- limitations: evidence.limitations.filter(row => CHILD_EVIDENCE_FIELDS.includes(row.field)
98
- && ["missing-evidence", "not-persisted", "unverified", "parent-denied"].includes(row.code)
99
- && ["capability-denied", "native-default", "display-only"].includes(row.effect))
100
- .slice(0, CHILD_EVIDENCE_FIELDS.length).map(row => ({ field: row.field, code: row.code, effect: row.effect })) };
101
- }
102
67
  /** Register independently of the common-mode section, in the exact Agent scope. */
103
68
  export function buildDsmmAgentGuidance(settings, observed) {
104
69
  const availability = new Map(observed.roleAvailability?.map(row => [row.id, row]));
@@ -127,18 +92,15 @@ export function buildDsmmAgentGuidance(settings, observed) {
127
92
  restartRequired: observed.runtimeAdmission.restartRequired,
128
93
  ...(observed.runtimeAdmission.reason === undefined ? {} : { reason: observed.runtimeAdmission.reason })
129
94
  };
130
- const deliveryFenceReady = runtime?.binding === "dsmm" && runtime.deliveryFenceReady;
131
- const managedDelivery = deliveryFenceReady && observed.capabilities?.managedChildDelivery === true;
95
+ const ready = runtime?.binding === "stock" && runtime.deliveryFenceReady;
96
+ const liveDelivery = ready && observed.capabilities?.nativeChildDelivery === true;
132
97
  const lifecycle = {
133
98
  backgroundEnabled: settings.subagents.enableRunInBackground,
134
- backgroundMode: settings.subagents.backgroundMode,
135
- nativeJobs: settings.subagents.enableRunInBackground && observed.capabilities?.nativeJobs === true,
136
- continuable: settings.subagents.enableRunInBackground && observed.capabilities?.continuable === true && deliveryFenceReady,
137
- managedChildDelivery: managedDelivery,
138
- sendMessage: managedDelivery && controls.some(tool => tool.name === "send_message"),
99
+ continuable: observed.capabilities?.continuable === true && ready,
100
+ nativeChildDelivery: liveDelivery,
101
+ sendMessage: liveDelivery && controls.some(tool => tool.name === "send_message"),
139
102
  childToParentReporting: observed.scope === "child" && controls.some(tool => tool.name === "send_message"),
140
- foregroundHandoffSurface: settings.subagents.enableRunInBackground && observed.capabilities?.nativeJobs ? observed.capabilities.foregroundHandoff?.surface ?? null : null,
141
- browserPromptSurface: managedDelivery ? observed.capabilities?.nativeBrowserPrompt?.surface ?? null : null,
103
+ browserPromptSurface: liveDelivery ? observed.capabilities?.nativeBrowserPrompt?.surface ?? null : null,
142
104
  ...(runtime === undefined ? {} : { runtimeAdmission: runtime })
143
105
  };
144
106
  const sections = [buildDsmmLocaleGuidance(settings), `<dsmm-admitted-delegation>
@@ -153,18 +115,14 @@ Only the listed callable entries and target enums are observed here. Role availa
153
115
  sections.push(`<dsmm-child-lifecycle>
154
116
  <dsmm-child-lifecycle-state>\n${JSON.stringify(lifecycle, null, 2)}\n</dsmm-child-lifecycle-state>
155
117
  ${settings.subagents.enableRunInBackground ? "Background is enabled in this Agent's captured deployment policy; only tools that expose run_in_background may request it." : "Background is disabled in this Agent's captured policy; do not request it."}
156
- ${lifecycle.continuable && settings.subagents.backgroundMode === "continuable" ? "The admitted continuable configuration defaults background; explicit run_in_background:false still creates a non-reusable one-shot." : "No managed continuable default is established by this observation. One-shot calls default foreground; do not infer continuation from a persona or filename."}
157
- ${lifecycle.nativeJobs ? "Native jobs can own one-shot background work when the actual job controller admits it; use the returned job ID and exposed job controls." : "Native-job background ownership/controller is not established here; do not invent a job handle."}
158
- ${lifecycle.foregroundHandoffSurface !== null ? `The user surface ${lifecycle.foregroundHandoffSurface} may hand the existing foreground run to a native job, never start a duplicate. It rechecks exact operator/session/epoch, run ownership and background capacity before ownership transfer; failed preflight leaves foreground ownership/cancellation intact. A successful handoff releases only the foreground wait, not a child completion. Cancellation/settlement cannot revive a run.` : "No foreground-to-background user control is established here. Do not invent a tool or RPC for it."}
159
- ${lifecycle.sendMessage ? "Exposed send_message can address a permitted existing direct continuable child: running delivery reaches the nearest step, idle starts a next turn, and cold continuation uses the same durable child ID. An inbox receipt means accepted, not executed/completed. A settled one-shot cannot be revived. Reuse carries the child's original captured route/locale/authority intersected with the current exact parent's authority; it never inherits the parent's latest profile as its original policy." : "Managed parent-to-child continuation through send_message is not established here; do not advertise safe reuse from a static role or SDK method alone."}
118
+ Role calls wait for the native activation result by default. Explicit run_in_background:true chooses native parent delivery before starting and returns accepted child/message identity, not a completion or a job handle. Running calls cannot transfer foreground/background ownership. Partial output with a non-completed stop reason is not success and must not be replayed automatically.
119
+ ${lifecycle.sendMessage ? "Exposed send_message can address a permitted exact live adjacent child. Running delivery reaches the nearest step; an idle live child can accept a next turn. Cold DSMM recovery is unavailable. An inbox receipt means accepted, not executed/completed. Each child retains its immutable admission; messages, metadata and later profile saves cannot grant authority." : "No live child messaging tool is observed here; do not invent one or infer it from role metadata."}
160
120
  ${lifecycle.browserPromptSurface !== null ? `The actual native user surface ${lifecycle.browserPromptSurface} uses queue/steer for continuable children, with native attachment validation. Its operator/connection/session/epoch/lifetime gate precedes inbox acceptance. Do not impersonate an Agent sender. After acceptance do not automatically retry; an unknown disconnect outcome needs verification, not a guessed idempotency guarantee.` : "No operator-gated native user queue/steer surface is established here; do not announce an unconnected DSMM RPC."}
161
121
  ${controls.some(tool => tool.name === "interrupt_agent") ? "Exposed interrupt_agent requests cancellation, not proof of completion or a message-delivery fence." : "No child interruption tool is observed here."}
162
- ${lifecycle.childToParentReporting ? "Native child-to-parent reporting retains exact-sender/adjacency semantics; it does not grant parent-to-child delegation authority or replace the managed delivery gate." : ""}
163
- ${runtime === undefined ? "Managed runtime binding/readiness is unobserved; no delivery-fence guarantee follows from these resources." : deliveryFenceReady ? "The observed unique DSMM PUBLIC SubagentRuntime binding has a ready delivery fence. Binding readiness alone does not prove existing-child delivery capability. Where observed, current exact-parent tickets and target original evidence gate acceptance; later parent Apply does not rebind old children or cancel already accepted work. Native parent/Host teardown still cancels/drains owned work." : `Runtime binding=${runtime.binding}; deliveryFenceReady=${runtime.deliveryFenceReady}; restartRequired=${runtime.restartRequired}${runtime.reason === undefined ? "" : `; reason=${runtime.reason}`}. Managed child features require explicit startup composition: disable the stock subagents registration row, install the unique PUBLIC DSMM SubagentRuntime subclass, then restart. Never unload/drain a running stock instance to hot-replace it, register a shadow provider, or change the user's host configuration automatically.`}
122
+ ${lifecycle.childToParentReporting ? "Native child-to-parent reporting retains exact-sender/adjacency semantics; it does not grant delegation authority." : ""}
123
+ Official Registry, SubagentRuntime and JSONL services own execution, result delivery and persistence. DSMM execution guards require a trusted live admission; they do not claim to veto every native inbox acceptance. Owner teardown cancels owned work and surviving Agent guards remain fail-closed. Do not replace native services, recover permissions from logs, or change Host configuration automatically.
164
124
  Native capacity/depth, provider support, direct-parent ownership, captured permissions and cancellation remain mandatory in every branch. No OpenCode task_id/resume/retry protocol is supplied.
165
125
  </dsmm-child-lifecycle>`);
166
- if (observed.childEvidence !== undefined)
167
- sections.push(`<dsmm-child-evidence>\n${JSON.stringify(projectChildEvidence(observed.childEvidence), null, 2)}\n</dsmm-child-evidence>\n${observed.childEvidence.mode === "legacy-conservative" ? "Any actually admitted continuation of this captureless legacy child is limited to useful proven capabilities under the same durable ID, intersected with current normal parent authority and native lineage/depth/tool filters. Evidence alone is not delivery availability. Missing evidence denies that capability with its reason; it is neither a blanket denial of all legacy children nor permission to copy the parent's latest policy, synthesize old capture/level, rewrite records or revive a one-shot." : "The child's original immutable capture is its authority ceiling. A different current parent epoch is not an instruction to rebind it."}`);
168
126
  return sections.join("\n\n---\n\n");
169
127
  }
170
128
  export function buildDeepworkPrompt(settings, options = {}) {
@@ -178,19 +136,6 @@ strictGates: ${String(settings.workflow.strictGates)}
178
136
  reviewCap: ${String(settings.workflow.reviewCap)}
179
137
  finalReviewPolicy: ${settings.workflow.finalReviewPolicy}
180
138
  </dsmm-workflow-policy>` : `<dsmm-workflow-policy>policy: risk-based</dsmm-workflow-policy>`;
181
- const route = options.route;
182
- // Content assembly must not load the native routing/provider graph.
183
- const providerId = route?.provider.toLowerCase(), modelId = route?.model.toLowerCase();
184
- const model = providerId === "deepseek-official" && modelId === "deepseek-v4-pro" ? "v4-pro"
185
- : ["deepseek-official", "deepseek-account"].includes(providerId ?? "") && modelId === "deepseek-flash" ? "flash" : undefined;
186
- const calibration = model === "flash" ? settings.deepseekFlashCalibration : settings.deepseekV4ProCalibration;
187
- const calibrationPolicy = model === undefined ? "" : `<dsmm-deepseek-${model}-policy>
188
- calibrationMode: ${calibration}
189
- configuredDesiredReasoningEffort: ${model === "flash" ? settings.deepseekFlashDefaultReasoningEffort : settings.deepseekV4ProDefaultReasoningEffort}
190
- This configured default is not an observed request effort. Native root selection, explicit invocation effort and adapter capability remain authoritative.
191
- </dsmm-deepseek-${model}-policy>`;
192
- const calibrated = model !== undefined && calibration !== "off"
193
- ? `${base}\n\n${model === "flash" ? DEEPSEEK_FLASH_OVERLAY : DEEPSEEK_V4_PRO_OVERLAY}\n\n${calibrationPolicy}` : base;
194
- return `${calibrated}\n\n${workflowPolicy}`;
139
+ return `${base}\n\n${workflowPolicy}`;
195
140
  }
196
141
  //# sourceMappingURL=prompts.js.map
@@ -1,10 +1,9 @@
1
1
  import type { RemoteResult, TypertRemoteContribution } from "@deepseek-ai/dsh-typert-protocol";
2
2
  import type { TypertContribution } from "@deepseek-ai/dsh-typert-registry";
3
- import type { BackgroundTransitionResult, ChildSessionSnapshot, RoleControlBackgroundRequest, RoleControlCapabilities, RoleControlDescendantsSnapshot, RoleControlErrorInfo, RoleControlInterruptRequest, SubagentInterruptReceipt, SubagentPromptReceipt, SubagentPromptRequest } from "./role-control-types.js";
3
+ import type { ChildSessionSnapshot, RoleControlCapabilities, RoleControlDescendantsSnapshot, RoleControlErrorInfo, RoleControlInterruptRequest, SubagentInterruptReceipt, SubagentPromptReceipt, SubagentPromptRequest } from "./role-control-types.js";
4
4
  export interface DsmmChildrenRemote {
5
5
  describe(sessionId: string): Promise<RemoteResult<ChildSessionSnapshot>>;
6
6
  descendants(sessionId: string): Promise<RemoteResult<RoleControlDescendantsSnapshot>>;
7
- background(sessionId: string, request: RoleControlBackgroundRequest): Promise<RemoteResult<BackgroundTransitionResult>>;
8
7
  prompt(sessionId: string, request: SubagentPromptRequest): Promise<RemoteResult<SubagentPromptReceipt>>;
9
8
  interrupt(sessionId: string, request: RoleControlInterruptRequest): Promise<RemoteResult<SubagentInterruptReceipt>>;
10
9
  }
@@ -12,7 +11,6 @@ declare module "@deepseek-ai/dsh-typert-protocol/types" {
12
11
  interface TypertRemoteMap {
13
12
  "dsmmChildren/describe": DsmmChildrenRemote["describe"];
14
13
  "dsmmChildren/descendants": DsmmChildrenRemote["descendants"];
15
- "dsmmChildren/background": DsmmChildrenRemote["background"];
16
14
  "dsmmChildren/prompt": DsmmChildrenRemote["prompt"];
17
15
  "dsmmChildren/interrupt": DsmmChildrenRemote["interrupt"];
18
16
  }
@@ -26,7 +24,6 @@ declare module "@deepseek-ai/dsh-typert-protocol/types" {
26
24
  export declare const parseRoleControlErrorInfo: (value: unknown) => RoleControlErrorInfo;
27
25
  export declare const parseChildSessionSnapshot: (value: unknown) => ChildSessionSnapshot;
28
26
  export declare const parseRoleControlDescendants: (value: unknown) => RoleControlDescendantsSnapshot;
29
- export declare const parseRoleControlBackgroundRequest: (value: unknown) => RoleControlBackgroundRequest;
30
27
  export declare const parseRoleControlPromptRequest: (value: unknown) => SubagentPromptRequest;
31
28
  export declare const parseRoleControlInterruptRequest: (value: unknown) => RoleControlInterruptRequest;
32
29
  export declare const parseRoleControlCapabilities: (value: unknown) => RoleControlCapabilities;
@@ -1,5 +1,4 @@
1
1
  import { parseDsmmInvocationView, parseDsmmRoleRouteComparison, parseSubagentRuntimeAdmissionView, isNativeSessionId } from "./profile-remote.js";
2
- import { parseChildAdmissionEvidenceView } from "./child-evidence.js";
3
2
  import { ROLE_CONTROL_DISABLED_REASONS, ROLE_CONTROL_ERROR_CODES, ROLE_CONTROL_ERROR_FIELDS } from "./role-control-types.js";
4
3
  function fail() { throw new TypeError("Invalid Deepwork child control DTO."); }
5
4
  /** Reject executable/non-JSON shapes before accessing any properties. */
@@ -66,20 +65,11 @@ function availability(value) {
66
65
  return { enabled: false, reason: choice(row.reason, ROLE_CONTROL_DISABLED_REASONS) };
67
66
  }
68
67
  function capabilities(value) {
69
- const row = object(value, ["background", "prompt", "interrupt", "images", "runtime"]);
70
- return { background: availability(row.background), prompt: availability(row.prompt), interrupt: availability(row.interrupt), images: availability(row.images), runtime: parseSubagentRuntimeAdmissionView(row.runtime) };
71
- }
72
- function run(value) {
73
- const row = object(value, ["sessionId", "toolCallId", "state", "background"], ["invocation"]);
74
- const state = choice(row.state, ["starting", "running", "background", "settled", "cancelled"]);
75
- const invocation = Object.hasOwn(row, "invocation") ? parseDsmmInvocationView(row.invocation) : undefined;
76
- if (state === "starting" && invocation !== undefined || invocation !== undefined && (invocation.mode !== "one-shot" || invocation.runId === undefined)
77
- || ["running", "background", "settled"].includes(state) && invocation === undefined)
78
- fail();
79
- return { sessionId: identity(row.sessionId), toolCallId: identity(row.toolCallId), state, background: availability(row.background), ...(invocation === undefined ? {} : { invocation }) };
68
+ const row = object(value, ["prompt", "interrupt", "images", "runtime"]);
69
+ return { prompt: availability(row.prompt), interrupt: availability(row.interrupt), images: availability(row.images), runtime: parseSubagentRuntimeAdmissionView(row.runtime) };
80
70
  }
81
71
  function child(value) {
82
- const row = object(value, ["id", "parentSessionId", "mode", "activity", "readonly", "controls"], ["label", "invocation", "routeComparison", "evidence"]);
72
+ const row = object(value, ["id", "parentSessionId", "mode", "activity", "readonly", "controls"], ["label", "invocation", "routeComparison"]);
83
73
  const controls = object(row.controls, ["prompt", "interrupt"]);
84
74
  const mode = choice(row.mode, ["one-shot", "continuable", "unknown"]);
85
75
  const prompt = availability(controls.prompt), interrupt = availability(controls.interrupt);
@@ -88,24 +78,21 @@ function child(value) {
88
78
  fail();
89
79
  const invocation = Object.hasOwn(row, "invocation") ? parseDsmmInvocationView(row.invocation) : undefined;
90
80
  const routeComparison = Object.hasOwn(row, "routeComparison") ? parseDsmmRoleRouteComparison(row.routeComparison) : undefined;
91
- const evidence = Object.hasOwn(row, "evidence") ? parseChildAdmissionEvidenceView(row.evidence) : undefined;
92
81
  const id = identity(row.id);
93
82
  if (invocation !== undefined && (invocation.childId !== id || invocation.mode !== mode))
94
83
  fail();
95
84
  if (routeComparison !== undefined && routeComparison.childId !== id)
96
85
  fail();
97
- if (evidence?.mode === "legacy-conservative" && invocation !== undefined)
98
- fail();
99
86
  return { id, parentSessionId: identity(row.parentSessionId), mode, activity: choice(row.activity, ["running", "inactive"]), readonly,
100
87
  controls: { prompt, interrupt }, ...(Object.hasOwn(row, "label") ? { label: text(row.label, 120) } : {}),
101
- ...(invocation === undefined ? {} : { invocation }), ...(routeComparison === undefined ? {} : { routeComparison }), ...(evidence === undefined ? {} : { evidence }) };
88
+ ...(invocation === undefined ? {} : { invocation }), ...(routeComparison === undefined ? {} : { routeComparison }) };
102
89
  }
103
90
  function snapshot(value) {
104
- const row = object(value, ["sessionId", "admissionEpoch", "runs", "children", "capabilities"]);
105
- const sessionId = identity(row.sessionId), admissionEpoch = epoch(row.admissionEpoch), runs = array(row.runs).map(run), children = array(row.children).map(child);
106
- if (runs.some(run => run.sessionId !== sessionId) || children.some(child => child.parentSessionId !== sessionId || child.evidence !== undefined && child.evidence.parentAdmissionEpoch !== admissionEpoch))
91
+ const row = object(value, ["sessionId", "admissionEpoch", "children", "capabilities"]);
92
+ const sessionId = identity(row.sessionId), admissionEpoch = epoch(row.admissionEpoch), children = array(row.children).map(child);
93
+ if (children.some(child => child.parentSessionId !== sessionId))
107
94
  fail();
108
- return { sessionId, admissionEpoch, runs, children, capabilities: capabilities(row.capabilities) };
95
+ return { sessionId, admissionEpoch, children, capabilities: capabilities(row.capabilities) };
109
96
  }
110
97
  function descendants(value) {
111
98
  const row = object(value, ["sessionId", "admissionEpoch", "descendants"]);
@@ -128,22 +115,9 @@ function descendants(value) {
128
115
  const parent = entry.kind === "child" ? entry.child.parentSessionId : entry.parentSessionId;
129
116
  if ((entry.depth === 1) !== (parent === sessionId))
130
117
  fail();
131
- if (entry.kind === "child" && entry.child.evidence !== undefined && entry.child.evidence.parentAdmissionEpoch !== admissionEpoch)
132
- fail();
133
118
  }
134
119
  return { sessionId, admissionEpoch, descendants: entries };
135
120
  }
136
- function backgroundRequest(value) {
137
- const row = object(value, ["sessionId", "toolCallId", "runId", "expectedAdmissionEpoch"]);
138
- return { sessionId: identity(row.sessionId), toolCallId: identity(row.toolCallId), runId: identity(row.runId), expectedAdmissionEpoch: epoch(row.expectedAdmissionEpoch) };
139
- }
140
- function transition(value) {
141
- const row = object(value, ["status", "runId"], ["jobId"]);
142
- const status = choice(row.status, ["background", "already-background", "already-settled", "cancelled"]);
143
- if (["background", "already-background"].includes(status) !== Object.hasOwn(row, "jobId"))
144
- fail();
145
- return { status, runId: identity(row.runId), ...(Object.hasOwn(row, "jobId") ? { jobId: identity(row.jobId) } : {}) };
146
- }
147
121
  function promptRequest(value) {
148
122
  const row = object(value, ["requestId", "parentSessionId", "childSessionId", "mode", "delivery", "content"], ["clientTimeZone"]);
149
123
  if (row.mode !== "continuable")
@@ -185,7 +159,6 @@ function errorInfo(value) {
185
159
  export const parseRoleControlErrorInfo = (value) => errorInfo(json(value));
186
160
  export const parseChildSessionSnapshot = (value) => snapshot(json(value));
187
161
  export const parseRoleControlDescendants = (value) => descendants(json(value));
188
- export const parseRoleControlBackgroundRequest = (value) => backgroundRequest(json(value));
189
162
  export const parseRoleControlPromptRequest = (value) => promptRequest(json(value));
190
163
  export const parseRoleControlInterruptRequest = (value) => interruptRequest(json(value));
191
164
  export const parseRoleControlCapabilities = (value) => capabilities(json(value));
@@ -202,7 +175,6 @@ function descriptor(method, result, request) {
202
175
  export const ROLE_CONTROL_REMOTE = { package: "@dsmm/dsmm-children", descriptors: [
203
176
  descriptor("describe", codec("ChildSessionSnapshot", snapshot)),
204
177
  descriptor("descendants", codec("RoleControlDescendantsSnapshot", descendants)),
205
- descriptor("background", codec("BackgroundTransitionResult", transition), codec("RoleControlBackgroundRequest", backgroundRequest)),
206
178
  descriptor("prompt", codec("SubagentPromptReceipt", promptReceipt), codec("SubagentPromptRequest", promptRequest)),
207
179
  descriptor("interrupt", codec("SubagentInterruptReceipt", interruptReceipt), codec("RoleControlInterruptRequest", interruptRequest)),
208
180
  ] };
@@ -1,51 +1,25 @@
1
1
  import type { Context } from "@deepseek-ai/cordis";
2
- import type { SubagentCatalogEntry } from "@deepseek-ai/dsh-subagent";
3
2
  import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
4
- import type { DeliveryAdmission, ParentAdmissionTicket } from "./delivery-authority.js";
5
- import type { DsmmSubagentRuntime } from "./subagent-runtime.js";
6
- import type { RoleRunInvocation, RoleRunRegistry } from "./role-runs.js";
7
- import type { BackgroundTransitionResult, ChildAdmissionEvidenceView, ChildSessionSnapshot, DsmmInvocationView, DsmmRoleRouteComparison, RoleControlAvailability, RoleControlBackgroundRequest, RoleControlCapabilities, RoleControlDescendantsSnapshot, RoleControlInterruptRequest, SubagentInterruptReceipt, SubagentPromptReceipt, SubagentPromptRequest } from "./role-control-types.js";
8
- export interface RoleControlChildObservation {
9
- readonly invocation?: DsmmInvocationView;
10
- readonly routeComparison?: DsmmRoleRouteComparison;
11
- readonly evidence?: ChildAdmissionEvidenceView;
12
- readonly prompt: RoleControlAvailability;
13
- readonly interrupt: RoleControlAvailability;
14
- }
15
- /** Trusted Host adapters borrow captured B/C2b state, never wire claims or new settings. */
16
- export interface RoleControlCollaborators<A extends DeliveryAdmission, E, C, P> {
17
- readonly runtime: DsmmSubagentRuntime<A, E>;
18
- readonly runs: RoleRunRegistry<C, P>;
19
- capabilities(ticket: ParentAdmissionTicket<A>): RoleControlCapabilities;
20
- projectRun(invocation: RoleRunInvocation<C, P>): DsmmInvocationView;
21
- backgroundAvailability(ticket: ParentAdmissionTicket<A>, invocation: RoleRunInvocation<C, P>, signal: AbortSignal): Promise<RoleControlAvailability>;
22
- /** Read-only evidence fold; must not resume/materialize a child. */
23
- observeChild(ticket: ParentAdmissionTicket<A>, child: SubagentCatalogEntry, signal: AbortSignal): Promise<RoleControlChildObservation>;
24
- }
25
- /** Separate namespace: native inbox/jobs remain the sole execution owners. */
26
- export declare class DsmmChildrenHost<A extends DeliveryAdmission, E, C, P> extends TypertRemoteService {
3
+ import type { NativeAdmission } from "./native-admission.js";
4
+ import type { ChildSessionSnapshot, RoleControlDescendantsSnapshot, RoleControlInterruptRequest, SubagentPromptRequest, SubagentPromptReceipt, SubagentInterruptReceipt } from "./role-control-types.js";
5
+ /** Authenticated projection of the native catalog. Listing never wakes a session. */
6
+ export declare class DsmmChildrenHost extends TypertRemoteService {
7
+ private readonly admission;
27
8
  private readonly lifetime;
28
- private readonly backgroundJobs;
29
- private readonly collaborators;
30
- constructor(ctx: Context, collaborators: RoleControlCollaborators<A, E, C, P>);
31
- private invoke;
32
- private decode;
9
+ constructor(ctx: Context, admission: NativeAdmission);
33
10
  private scoped;
34
11
  private capabilities;
35
- private childView;
36
- private runView;
12
+ private child;
37
13
  describe(sessionId: string): Promise<ChildSessionSnapshot>;
38
14
  descendants(sessionId: string): Promise<RoleControlDescendantsSnapshot>;
39
- background(sessionId: string, input: RoleControlBackgroundRequest): Promise<BackgroundTransitionResult>;
40
- private directChild;
15
+ private direct;
41
16
  prompt(sessionId: string, input: SubagentPromptRequest): Promise<SubagentPromptReceipt>;
42
17
  interrupt(sessionId: string, input: RoleControlInterruptRequest): Promise<SubagentInterruptReceipt>;
43
18
  }
44
19
  declare module "@deepseek-ai/cordis" {
45
20
  interface Context {
46
- dsmmChildren: DsmmChildrenHost<DeliveryAdmission, unknown, unknown, unknown>;
21
+ dsmmChildren: DsmmChildrenHost;
47
22
  }
48
23
  }
49
- /** Caller supplies an owned Host injection fiber; no replacement or auto-mount. */
50
- export declare function registerRoleControlRpc<A extends DeliveryAdmission, E, C, P>(ctx: Context, collaborators: RoleControlCollaborators<A, E, C, P>): DsmmChildrenHost<A, E, C, P>;
24
+ export declare function registerRoleControlRpc(ctx: Context, admission: NativeAdmission): DsmmChildrenHost;
51
25
  //# sourceMappingURL=role-control-rpc.d.ts.map