@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
@@ -1,10 +1,7 @@
1
1
  import { LlmError } from "@deepseek-ai/dsh-llm";
2
- import { requiresDsmmCallAdmission, snapshotDsmmCall } from "./host-llm.js";
2
+ import { captureDsmmEffortSource, requiresDsmmCallAdmission, snapshotDsmmCall } from "./host-llm.js";
3
3
  import { resolvedModelParameterPolicy } from "./model-parameter-policy.js";
4
4
  import { modelRouteFromCall, projectModelRouteParameters } from "./role-llm.js";
5
- import { capturedRoleInvocation } from "./role-invocation.js";
6
- import { latestNativeModelSelection } from "./role-routing.js";
7
- import { resolveSelectedAgentPreset } from "./session-scope.js";
8
5
  /** Connect the cold Host LLM owner to the existing exact Agent/role admission authority. */
9
6
  export function createDsmmRoleLlmOwner(ctx, providers) {
10
7
  const nativeFallback = async (frame, proposal) => {
@@ -32,20 +29,17 @@ export function createDsmmRoleLlmOwner(ctx, providers) {
32
29
  if (original !== admission.admission)
33
30
  throw new Error("LLM policy does not own the exact admission");
34
31
  const policy = resolvedModelParameterPolicy(original);
35
- const invocation = capturedRoleInvocation(agent);
36
- const effortSource = latestNativeModelSelection(agent) !== undefined
37
- || frame.agent.session.header.origin !== "subagent" && !resolveSelectedAgentPreset(agent.session)?.startsWith("dsmm-")
38
- ? "native" : invocation?.effortSource ?? (invocation?.routeSource === "inherited" ? "native" : "dsmm-config");
32
+ const effortSource = captureDsmmEffortSource(frame.agent);
39
33
  const config = snapshotDsmmCall(projectModelRouteParameters(modelRouteFromCall(proposal), effortSource, policy.mode !== "native-defaults"));
40
34
  admission.assertCurrent();
41
35
  if (policy.mode !== "passthrough") {
42
- return { kind: "stock", admission, config };
36
+ return { kind: "stock", admission, config, effortSource };
43
37
  }
44
38
  if (!requiresDsmmCallAdmission(config, providers)) {
45
39
  try {
46
40
  await ctx.get("llm").resolveCallConfig(config, frame.signal);
47
41
  admission.assertCurrent();
48
- return { kind: "stock", admission, config };
42
+ return { kind: "stock", admission, config, effortSource };
49
43
  }
50
44
  catch (error) {
51
45
  if (!(error instanceof LlmError) || error.code !== "UNSUPPORTED_OPTION"
@@ -55,7 +49,7 @@ export function createDsmmRoleLlmOwner(ctx, providers) {
55
49
  }
56
50
  const generation = providers.generation(config.provider);
57
51
  admission.assertCurrent();
58
- return { kind: "dsmm", admission, config, generation };
52
+ return { kind: "dsmm", admission, config, generation, effortSource };
59
53
  },
60
54
  };
61
55
  }
@@ -3,10 +3,6 @@ import type { DshAgent, DshContext } from "./dsh-types.js";
3
3
  export { allowedRoleChildren } from "./roles.js";
4
4
  import type { DsmmRoleId } from "./roles.js";
5
5
  import type { DsmmProfileAdmission, DsmmSettings, DsmmSettingsGetter } from "./settings.js";
6
- import type { ChildAdmissionCompletion, ChildRoleAdmissionCandidate, ParentAdmissionTicket } from "./child-admission-contract.js";
7
- import type { ChildAdmissionEvidence, PreparedChildAdmission } from "./child-capture.js";
8
- import type { LegacyCapabilityCollaborators } from "./legacy-child-policy.js";
9
- export { createConservativeLegacyAdmission as conservativeLegacyAdmission } from "./legacy-child-policy.js";
10
6
  import type { ResolvedRoleInvocation } from "./role-invocation.js";
11
7
  import type { DeepworkModeController } from "./state.js";
12
8
  export interface DsmmRoleIdentity {
@@ -18,75 +14,45 @@ export interface DsmmRoleIdentity {
18
14
  readonly toolFilter?: ToolRestriction;
19
15
  }
20
16
  export declare const READONLY_ROLE_DENIED_TOOLS: readonly ["write", "edit", "bash", "pwsh"];
21
- export declare function inheritToolFilter(parent?: ToolRestriction, requested?: ToolRestriction): ToolRestriction | undefined;
22
- export declare function resolveAdmittedDsmmRole(agent: DshAgent, settings: DsmmSettings, active: boolean): DsmmRoleId | undefined;
23
17
  export declare function roleToolName(role: DsmmRoleId): string;
24
18
  export declare function roleFromToolName(name: string): DsmmRoleId | undefined;
25
19
  export declare function readonlyRoleTool(name: string, settings: DsmmSettings): boolean;
26
- interface DelegationIdentity {
27
- parent: DshAgent;
28
- role: DsmmRoleId;
29
- epoch: string;
30
- toolFilter?: ToolRestriction;
31
- maxDepth?: number;
32
- admittedChild?(agent: DshAgent): void;
33
- }
34
- export interface RoleAdmissionCollaborators {
35
- resolveOriginalEvidence(ticket: ParentAdmissionTicket, childId: string, signal: AbortSignal): Promise<ChildAdmissionEvidence>;
36
- nativeSubstrate: DsmmSettings;
37
- revokeParent(agent: DshAgent, reason: string): void;
38
- /** Shared C2b native-capability audit; this does not grant parent tool permissions. */
39
- classifyLegacyTool?: LegacyCapabilityCollaborators["classifyTool"];
40
- }
41
- /** Identity admission only: native services retain every run, inbox and retry lifecycle. */
20
+ export declare function inheritToolFilter(parent?: ToolRestriction, requested?: ToolRestriction): ToolRestriction | undefined;
21
+ export declare function resolveAdmittedDsmmRole(agent: DshAgent, settings: DsmmSettings, active: boolean): DsmmRoleId | undefined;
22
+ /** Role and exact-call restrictions; no child creation or execution owner. */
42
23
  export declare class DsmmRolePolicy {
43
24
  private readonly ctx;
44
25
  private readonly getSettings;
45
26
  private readonly mode;
46
- private readonly calls;
47
27
  private readonly executions;
48
28
  private readonly toolCalls;
49
- private readonly providers;
50
- private readonly continuableCreations;
51
- private readonly preparedInvocations;
52
- private readonly preparedCaptures;
53
- private collaborators?;
54
29
  constructor(ctx: DshContext, getSettings: DsmmSettingsGetter, mode: DeepworkModeController);
55
- captureProvider(provider: object): void;
56
- ownsProvider(provider: object): boolean;
57
- revokeResidency(agent: DshAgent): void;
58
- configureAdmission(collaborators: RoleAdmissionCollaborators): ChildAdmissionCompletion;
59
- validateRootRole(agent: DshAgent, admission: DsmmProfileAdmission): void;
60
- recordContinuableCreation(childId: string, parent: DshAgent, role: DsmmRoleId, invocation: ResolvedRoleInvocation | undefined, expectedEpoch: string, signal: AbortSignal): void;
61
- prepareChildAdmission(agent: DshAgent, parent: DshAgent, ticket: ParentAdmissionTicket, signal: AbortSignal): Promise<PreparedChildAdmission>;
62
- /** Used at A's single awaited completion point; old original epochs remain valid facts. */
63
- validatePreparedRole(agent: DshAgent, parent: DshAgent, candidate: ChildRoleAdmissionCandidate): void;
64
- assertChildDelivery(ticket: ParentAdmissionTicket, childId: string, raw: ChildAdmissionEvidence): void;
65
- private readOnly;
66
30
  private agents;
67
31
  assertLive(agent: DshAgent): void;
68
- private isAdmittedChild;
69
- private assertPlannerRootAdmission;
70
- /** Core fence runs before native prompt/body assembly or provider execution. */
32
+ private selected;
33
+ validateRootRole(agent: DshAgent, admission: DsmmProfileAdmission): void;
34
+ bindChild(agent: DshAgent, parent: DshAgent, admission: DsmmProfileAdmission, invocation: ResolvedRoleInvocation, maximum: number | undefined, toolFilter: ToolRestriction): void;
35
+ release(agent: DshAgent): void;
71
36
  assertModuleAdmission(agent: DshAgent): void;
72
37
  identity(agent: DshAgent): DsmmRoleIdentity;
73
- targets(agent: DshAgent): readonly DsmmRoleId[];
74
- assertDelegation(parent: DshAgent, role: DsmmRoleId): DelegationIdentity;
75
- duringDelegation<T>(parent: DshAgent, role: DsmmRoleId, operation: () => T, toolFilter?: ToolRestriction, maxDepth?: number, admittedChild?: (agent: DshAgent) => void): T;
76
- prepareContinuable(parent: DshAgent, role: DsmmRoleId, signal: AbortSignal): DelegationIdentity;
77
38
  admit(agent: DshAgent): DsmmRoleIdentity;
78
- private captureIdentity;
79
- captureTools(agent: DshAgent, tools: ToolRuntime, controlledNames?: readonly string[], reset?: boolean): void;
80
- /** Existing exact role denials only; missing admission or capability proof is not a blacklist. */
39
+ private readOnly;
40
+ targets(agent: DshAgent): readonly DsmmRoleId[];
41
+ assertDelegation(parent: DshAgent, role: DsmmRoleId): {
42
+ parent: DshAgent;
43
+ role: "dsmm-orchestrator" | "dsmm-planner" | "dsmm-plan-critic" | "dsmm-builder" | "dsmm-reviewer" | "dsmm-oracle" | "dsmm-oracle-2nd" | "dsmm-creative" | "dsmm-code-search" | "dsmm-doc-search" | "dsmm-clarifier" | "dsmm-media-reader" | "dsmm-frontend" | "dsmm-hard-reasoning" | "dsmm-research" | "dsmm-quick" | "dsmm-coding" | "dsmm-normal-task" | "dsmm-complex" | "dsmm-deep" | "dsmm-documenting" | "dsmm-cross-cutting";
44
+ epoch: string;
45
+ };
46
+ captureTools(agent: DshAgent, tools: ToolRuntime, names?: readonly string[], reset?: boolean): void;
81
47
  toolBlacklistDenial(agent: DshAgent, name: string, execution?: Readonly<ToolExecution>): string | undefined;
82
- private blacklistDenial;
83
- captureToolExecution(execution: Readonly<ToolExecution>, full: boolean): void;
48
+ captureToolExecution(execution: Readonly<ToolExecution>, _full: boolean): void;
49
+ /** Visible native names are a narrowing ceiling, never permission to execute a definition. */
50
+ private visibleToolCeiling;
51
+ delegationToolFilter(execution: Readonly<ToolExecution>): ToolRestriction;
84
52
  assertToolExecution(execution: Readonly<ToolExecution>): void;
85
53
  beforeToolDecision<T>(operation: () => T): T;
86
54
  duringToolExecution<T>(execution: Readonly<ToolExecution>, operation: () => Promise<T>): Promise<T>;
87
55
  toolDenial(agent: DshAgent, name: string, tools?: ToolRuntime, execution?: Readonly<ToolExecution>): string | undefined;
88
56
  preToolDenial(agent: DshAgent, name: string, tools?: ToolRuntime, execution?: Readonly<ToolExecution>): string | undefined;
89
- private permissionDenial;
90
- installDrain(agent: DshAgent): void;
91
57
  }
92
58
  //# sourceMappingURL=role-policy.d.ts.map