@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,157 +0,0 @@
1
- import type { Context } from "@deepseek-ai/cordis";
2
- import type { Agent } from "@deepseek-ai/dsh-agent";
3
- import { HarnessError } from "@deepseek-ai/dsh-llm";
4
- import type { ToolDefinition, ToolExecution, ToolExecutionResult } from "@deepseek-ai/dsh-tools";
5
- import type { LegacyChildEvidence } from "./child-capture.js";
6
- export type LegacyReadUnavailableCode = "composition-unavailable" | "evidence-unavailable" | "provenance-unavailable" | "target-unavailable" | "arguments-unavailable" | "approval-unavailable" | "audit-unavailable" | "lifetime-unavailable";
7
- export declare class LegacyReadUnavailable extends HarnessError {
8
- readonly code: LegacyReadUnavailableCode;
9
- constructor(code: LegacyReadUnavailableCode);
10
- }
11
- export interface LegacyReadTarget {
12
- readonly targetKey: unknown;
13
- readonly displayPath: string;
14
- }
15
- /** Structural public FileSystem surface: no provider-private target decoding. */
16
- export interface LegacyReadFileSystem {
17
- resolve(path: string, options: {
18
- cwd?: string;
19
- signal: AbortSignal;
20
- }): Promise<LegacyReadTarget>;
21
- processPath(target: LegacyReadTarget): string;
22
- processPathFromHostPath(path: string): string | undefined;
23
- }
24
- export interface LegacyReadBindings {
25
- readonly parent: Agent;
26
- readonly child: Agent;
27
- readonly definition: ToolDefinition;
28
- readonly mount: object;
29
- readonly config: object;
30
- readonly caps: {
31
- readonly limit: number;
32
- readonly maxBytes: number;
33
- readonly maxLineLength: number;
34
- readonly streamMinSize: number;
35
- };
36
- readonly parentFs: LegacyReadFileSystem;
37
- readonly childFs: LegacyReadFileSystem;
38
- readonly parentProvider: object;
39
- readonly childProvider: object;
40
- readonly parentWorld: object;
41
- readonly childWorld: object;
42
- }
43
- export interface LegacyReadParentTicket {
44
- readonly parent: Agent;
45
- readonly owner: object;
46
- readonly admission: object;
47
- readonly parentEpoch: string;
48
- readonly signal: AbortSignal;
49
- }
50
- export interface LegacyReadEvidenceBinding {
51
- readonly evidence: LegacyChildEvidence;
52
- readonly admission: object;
53
- readonly source: "physical-old";
54
- readonly physicalRecords: readonly object[];
55
- /** A present original capture belongs to the captured path, never this proxy. */
56
- readonly originalCapture?: never;
57
- readonly childLifetime: AbortSignal;
58
- }
59
- export type LegacyReadStage = "pre" | "guard" | "around" | "post" | "project" | "finalization" | "filter";
60
- export interface LegacyReadClosedSnapshot {
61
- readonly owner: LegacyReadHostOwner;
62
- readonly coverage: "host-owned-complete";
63
- readonly scopes: readonly {
64
- readonly ctx: Context;
65
- readonly key: object;
66
- readonly ancestors: readonly object[];
67
- }[];
68
- readonly policies: readonly {
69
- readonly side: "parent" | "child" | "both";
70
- readonly stage: LegacyReadStage;
71
- readonly scope: Context;
72
- readonly reference: object;
73
- readonly order: number;
74
- readonly semantics: "audited-zero-or-once" | "unknown" | "metadata-dependent" | "failure-content-dependent" | "context-dependent" | "ambiguous-transform" | "detached-retry" | "multiple-next";
75
- }[];
76
- readonly bindings: readonly LegacyReadBindings[];
77
- readonly approval: "never-ask" | "coordinated-turn";
78
- readonly fidelity: "canonical-value-content-contexts";
79
- readonly mutation: "owner-coordinated";
80
- }
81
- export interface LegacyReadActualOutcomes {
82
- readonly childExecution: Readonly<ToolExecution>;
83
- readonly parentExecution?: {
84
- readonly callId: string;
85
- readonly rootCallId: string;
86
- readonly parent: ToolExecution["token"];
87
- };
88
- readonly parentResult?: ToolExecutionResult;
89
- readonly childResult: ToolExecutionResult;
90
- }
91
- declare const ownerBrand: unique symbol;
92
- declare const compositionBrand: unique symbol;
93
- declare const callBrand: unique symbol;
94
- export interface LegacyReadCompositionLease {
95
- readonly [compositionBrand]: true;
96
- readonly owner: LegacyReadHostOwner;
97
- readonly generation: number;
98
- readonly signal: AbortSignal;
99
- readonly ticket: LegacyReadParentTicket;
100
- readonly bindings: LegacyReadBindings;
101
- readonly approval: LegacyReadClosedSnapshot["approval"];
102
- assertActive(): void;
103
- release(): void;
104
- }
105
- export interface LegacyReadCallLease {
106
- readonly [callBrand]: true;
107
- readonly approval: {
108
- readonly kind: "never-ask";
109
- } | {
110
- readonly kind: "coordinated-turn";
111
- readonly turn: {
112
- readonly parent: Agent;
113
- readonly openTurnStartSeq: number;
114
- };
115
- readonly signal: AbortSignal;
116
- /** Optional real child turn for local fences/dispatch; not proof of native caller lifetime or child approval support. */
117
- readonly childTurn?: {
118
- readonly child: Agent;
119
- readonly openTurnStartSeq: number;
120
- readonly signal: AbortSignal;
121
- };
122
- };
123
- readonly signal: AbortSignal;
124
- /** Check the real turn/audit route again after awaits and immediately before dispatch. */
125
- assertAvailable(): void;
126
- finish(outcomes: LegacyReadActualOutcomes): Promise<void>;
127
- release(): void;
128
- }
129
- export interface LegacyReadHostOwnerCallbacks {
130
- captureClosedComposition(): LegacyReadClosedSnapshot | undefined;
131
- acquireParentTicket(parent: Agent): LegacyReadParentTicket;
132
- assertParentTicket(ticket: LegacyReadParentTicket): void;
133
- resolveChildAdmission(parent: Agent, child: Agent, evidence: LegacyChildEvidence, ticket: LegacyReadParentTicket): LegacyReadEvidenceBinding;
134
- resolveReadBindings(parent: Agent, child: Agent, lease: LegacyReadCompositionLease): LegacyReadBindings;
135
- /**
136
- * Runs before downstream child pre/approval, and before target mapping or parent dispatch.
137
- * exec remains the read-only native view with original child arguments and caller signal.
138
- * Acquisition must consume lease.signal (caller/parent/child/composition revocation) and
139
- * coordinate real turn leases before its own awaits. The returned lease covers the entire child pipeline,
140
- * including child-only denial/cancel/error, whose actual outcomes have no parent execution.
141
- * The owner cleans up resources if acquisition fails before it returns a branded lease.
142
- */
143
- acquireCallContext(parent: Agent, child: Agent, exec: ToolExecution, lease: LegacyReadCompositionLease): Promise<LegacyReadCallLease>;
144
- /** Synchronous admission/opaque-handle revocation BEFORE native drain. */
145
- revoke(reason: string): void;
146
- reportAuditFault(error: unknown, outcomes: LegacyReadActualOutcomes): void;
147
- }
148
- export interface LegacyReadHostOwner extends LegacyReadHostOwnerCallbacks {
149
- readonly [ownerBrand]: true;
150
- }
151
- /** Trusted startup code only. Neither factory is a JSON/RPC attestation endpoint. */
152
- export declare function createLegacyReadHostOwner(callbacks: LegacyReadHostOwnerCallbacks): LegacyReadHostOwner;
153
- export declare function isLegacyReadHostOwner(owner: unknown): owner is LegacyReadHostOwner;
154
- export declare function createLegacyReadCallLease(callbacks: Omit<LegacyReadCallLease, typeof callBrand>): LegacyReadCallLease;
155
- export declare function isLegacyReadCallLease(lease: unknown): lease is LegacyReadCallLease;
156
- export {};
157
- //# sourceMappingURL=legacy-read-contracts.d.ts.map
@@ -1,39 +0,0 @@
1
- import { HarnessError } from "@deepseek-ai/dsh-llm";
2
- export class LegacyReadUnavailable extends HarnessError {
3
- code;
4
- constructor(code) {
5
- super(code, code);
6
- this.code = code;
7
- this.name = "LegacyReadUnavailable";
8
- }
9
- }
10
- const owners = new WeakSet();
11
- const callLeases = new WeakSet();
12
- /** Trusted startup code only. Neither factory is a JSON/RPC attestation endpoint. */
13
- export function createLegacyReadHostOwner(callbacks) {
14
- const owner = Object.freeze({
15
- captureClosedComposition: callbacks.captureClosedComposition.bind(callbacks),
16
- acquireParentTicket: callbacks.acquireParentTicket.bind(callbacks),
17
- assertParentTicket: callbacks.assertParentTicket.bind(callbacks),
18
- resolveChildAdmission: callbacks.resolveChildAdmission.bind(callbacks),
19
- resolveReadBindings: callbacks.resolveReadBindings.bind(callbacks),
20
- acquireCallContext: callbacks.acquireCallContext.bind(callbacks),
21
- revoke: callbacks.revoke.bind(callbacks),
22
- reportAuditFault: callbacks.reportAuditFault.bind(callbacks),
23
- });
24
- owners.add(owner);
25
- return owner;
26
- }
27
- export function isLegacyReadHostOwner(owner) {
28
- return typeof owner === "object" && owner !== null && owners.has(owner);
29
- }
30
- export function createLegacyReadCallLease(callbacks) {
31
- const lease = Object.freeze({ approval: callbacks.approval, signal: callbacks.signal,
32
- assertAvailable: callbacks.assertAvailable.bind(callbacks), finish: callbacks.finish.bind(callbacks), release: callbacks.release.bind(callbacks) });
33
- callLeases.add(lease);
34
- return lease;
35
- }
36
- export function isLegacyReadCallLease(lease) {
37
- return typeof lease === "object" && lease !== null && callLeases.has(lease);
38
- }
39
- //# sourceMappingURL=legacy-read-contracts.js.map
@@ -1,19 +0,0 @@
1
- import type { Agent } from "@deepseek-ai/dsh-agent";
2
- import type { ToolDefinition } from "@deepseek-ai/dsh-tools";
3
- import type { LegacyChildEvidence } from "./child-capture.js";
4
- import type { LegacyReadHostOwner } from "./legacy-read-contracts.js";
5
- import type { LegacyReadProxy } from "./legacy-read-proxy.js";
6
- export { createLegacyReadHostOwner, createLegacyReadCallLease, LegacyReadUnavailable } from "./legacy-read-contracts.js";
7
- export type * from "./legacy-read-contracts.js";
8
- export { createLegacyReadComposition } from "./legacy-read-composition.js";
9
- export type { LegacyReadComposition } from "./legacy-read-composition.js";
10
- export type { LegacyReadProxy } from "./legacy-read-proxy.js";
11
- /** Explicit startup entry only; default DSMM bootstrap never installs this composition. */
12
- export declare function createLegacyReadHost(owner: LegacyReadHostOwner): {
13
- composition: import("./legacy-read-composition.js").LegacyReadComposition;
14
- attachChild(parent: Agent, child: Agent, evidence: LegacyChildEvidence, definition: ToolDefinition): LegacyReadProxy;
15
- releaseAfterChildDispose(child: Agent): Promise<void>;
16
- publishCheckedGeneration(): void;
17
- dispose(nativeDrain: () => Promise<void>): Promise<void>;
18
- };
19
- //# sourceMappingURL=legacy-read-host.d.ts.map
@@ -1,67 +0,0 @@
1
- import { scopeChainOf, scopeOf } from "@deepseek-ai/dsh-scope";
2
- import { createLegacyReadComposition } from "./legacy-read-composition.js";
3
- import { LegacyReadUnavailable } from "./legacy-read-contracts.js";
4
- import { installLegacyReadProxy } from "./legacy-read-proxy.js";
5
- export { createLegacyReadHostOwner, createLegacyReadCallLease, LegacyReadUnavailable } from "./legacy-read-contracts.js";
6
- export { createLegacyReadComposition } from "./legacy-read-composition.js";
7
- /** Explicit startup entry only; default DSMM bootstrap never installs this composition. */
8
- export function createLegacyReadHost(owner) {
9
- const composition = createLegacyReadComposition(owner);
10
- const children = new Map();
11
- return {
12
- composition,
13
- attachChild(parent, child, evidence, definition) {
14
- if (children.has(child))
15
- throw new LegacyReadUnavailable("composition-unavailable");
16
- const proxy = installLegacyReadProxy(composition, parent, child, evidence, definition);
17
- children.set(child, proxy);
18
- return proxy;
19
- },
20
- async releaseAfterChildDispose(child) {
21
- if (composition.view().state === "ready")
22
- throw new LegacyReadUnavailable("composition-unavailable");
23
- const proxy = children.get(child);
24
- if (proxy === undefined)
25
- return;
26
- await proxy.releaseAfterChildDispose();
27
- children.delete(child);
28
- },
29
- publishCheckedGeneration() {
30
- const snapshot = composition.captureClosedComposition();
31
- if (snapshot === undefined)
32
- throw new LegacyReadUnavailable("composition-unavailable");
33
- for (const proxy of children.values()) {
34
- if (!snapshot.bindings.some(binding => binding.parent === proxy.parent && binding.child === proxy.child && binding.definition === proxy.nativeDefinition)
35
- || proxy.parent.ctx.tools.get("read", proxy.parent) !== proxy.nativeDefinition
36
- || proxy.child.ctx.tools.get("read", proxy.child) !== proxy.definition
37
- || proxy.parent.ctx.agents.get(proxy.parent.id) !== proxy.parent || proxy.child.ctx.agents.get(proxy.child.id) !== proxy.child
38
- || !snapshot.scopes.some(scope => scope.ctx === proxy.proxyScope.ctx) || !snapshot.scopes.some(scope => scope.ctx === proxy.standingScope.ctx)
39
- || proxy.contributions.some(contribution => !snapshot.policies.some(policy => policy.scope === contribution.scope.ctx
40
- && policy.reference === contribution.reference && policy.stage === contribution.stage)))
41
- throw new LegacyReadUnavailable("composition-unavailable");
42
- const effectiveScopes = new Set(scopeChainOf(proxy.child));
43
- for (const stage of ["pre", "around"]) {
44
- const contribution = proxy.contributions.find(value => value.stage === stage);
45
- const adapter = snapshot.policies.find(policy => policy.reference === contribution.reference && policy.scope === contribution.scope.ctx);
46
- if (snapshot.policies.some(policy => {
47
- const scope = scopeOf(policy.scope);
48
- return policy.stage === stage && policy.side !== "parent" && policy.reference !== contribution.reference
49
- && (scope === undefined || effectiveScopes.has(scope)) && policy.order <= adapter.order;
50
- }))
51
- throw new LegacyReadUnavailable("composition-unavailable");
52
- }
53
- }
54
- composition.publishGeneration(snapshot, composition.view().generation);
55
- },
56
- async dispose(nativeDrain) {
57
- // Calling close synchronously revokes before either async drain is entered.
58
- const leases = composition.closeForDispose("host-dispose");
59
- await leases;
60
- await nativeDrain();
61
- for (const proxy of children.values())
62
- await proxy.releaseAfterChildDispose();
63
- children.clear();
64
- },
65
- };
66
- }
67
- //# sourceMappingURL=legacy-read-host.js.map
@@ -1,121 +0,0 @@
1
- import type { Context } from "@deepseek-ai/cordis";
2
- import type { Agent } from "@deepseek-ai/dsh-agent";
3
- import type { Scope } from "@deepseek-ai/dsh-scope";
4
- import type { ToolDefinition, ToolExecution } from "@deepseek-ai/dsh-tools";
5
- import type { ChildAdmissionEvidence, LegacyChildEvidence } from "./child-capture.js";
6
- import type { ChildAdmissionCollaborators } from "./child-admission.js";
7
- import type { ParentAdmissionTicket as ProfileParentAdmissionTicket } from "./child-admission-contract.js";
8
- import type { DsmmDeliveryAuthority, ParentAdmissionTicket } from "./delivery-authority.js";
9
- import type { LegacyCapabilityCollaborators, LegacyToolCapability } from "./legacy-child-policy.js";
10
- import type { LegacyReadActualOutcomes, LegacyReadBindings, LegacyReadCallLease, LegacyReadClosedSnapshot, LegacyReadCompositionLease } from "./legacy-read-contracts.js";
11
- import type { LegacyReadProxy } from "./legacy-read-proxy.js";
12
- import type { NativeChildHistory } from "./native-child-evidence.js";
13
- import type { DsmmProfileAdmission } from "./settings.js";
14
- export interface LegacyReadAdmissionSource {
15
- /** A's corruption-vs-absence resolver, using the issued C1 ticket; a capture never enters this adapter. */
16
- resolveOriginalChildEvidence(ticket: ParentAdmissionTicket<DsmmProfileAdmission>, childId: string, signal: AbortSignal): Promise<ChildAdmissionEvidence>;
17
- /** The exact immutable A admission, published before external execution but after original evidence validation. */
18
- childAdmission(child: Agent): DsmmProfileAdmission;
19
- /** B's current module/role/direct-target ceiling. This does not check or grant a read permission. */
20
- assertCurrentParent(ticket: ParentAdmissionTicket<DsmmProfileAdmission>, child: Agent, evidence: LegacyChildEvidence): void;
21
- }
22
- export interface LegacyReadIntegrationChild {
23
- readonly parent: Agent;
24
- readonly child: Agent;
25
- readonly evidence: LegacyChildEvidence;
26
- readonly admission: DsmmProfileAdmission;
27
- readonly bindings: LegacyReadBindings;
28
- readonly proxy: LegacyReadProxy;
29
- readonly policyScope: Scope;
30
- readonly contributions: LegacyReadClosedSnapshot["policies"];
31
- }
32
- export interface LegacyReadTrustedStartup {
33
- /** Host constructs/controls ALL applicable ancestors/global policies and service/mount/config ordering. No SDK scanning. */
34
- captureClosedComposition(children: readonly LegacyReadIntegrationChild[]): Omit<LegacyReadClosedSnapshot, "owner" | "bindings"> | undefined;
35
- /** References from the actual Host-owned native FS mount, never a tool-name/visibility lookup as provenance. */
36
- resolveReadBindings(parent: Agent, child: Agent): LegacyReadBindings | undefined;
37
- /** Outer pre acquisition receives RAW child arguments BEFORE body validation/target mapping and downstream child policy.
38
- * Never infer permission from those arguments. Consume lease.signal before own awaits and cover both pipelines/finalization.
39
- * finish must audit child-only deny/cancel/error without parentExecution/parentResult. Never-ask covers both sides;
40
- * The native pre exec.signal is read-only: use local fusion, never cast/write it.
41
- * Stock/model/native child asks are unavailable before approval; childTurn does not enable controlled child ask.
42
- * Legal parent approval uses L's merged PUBLIC parent tools.execute input from the proxy body. */
43
- acquireCallContext(parent: Agent, child: Agent, exec: ToolExecution, lease: LegacyReadCompositionLease): Promise<LegacyReadCallLease>;
44
- reportAuditFault(error: unknown, outcomes: LegacyReadActualOutcomes): void;
45
- reportRetirementFault(error: unknown, child: Agent): void;
46
- /** Close Host-owned turn/audit lifetimes synchronously, before native drain. */
47
- revoke(reason: string): void;
48
- }
49
- export interface LegacyReadProxyDefinitions {
50
- /** Awaited registration in B's actual exact-Agent trusted-definition registry, not a name allowlist. */
51
- admit(parent: Agent, child: Agent, definition: ToolDefinition): void | Promise<void>;
52
- /** Assert the exact registered object in B's real guard. This is NOT parent parameter permission. */
53
- assertAdmitted(child: Agent, definition: ToolDefinition): void;
54
- }
55
- export interface LegacyReadCoreAdmissions {
56
- /** A's actual resolver receives the bridge's genuine borrowed-ticket -> native-history reader as its fourth argument. */
57
- readonly resolveOriginalChildEvidence: ChildAdmissionCollaborators["resolveOriginalChildEvidence"];
58
- /** B's actual original/current direct-parent delivery validator, not a tool-permission query. */
59
- readonly assertDelivery: ChildAdmissionCollaborators["assertDelivery"];
60
- }
61
- export interface LegacyReadCoreConsumption {
62
- readonly legacyCapabilities: LegacyCapabilityCollaborators;
63
- readonly classifyLegacyTool: LegacyCapabilityCollaborators["classifyTool"];
64
- readonly resolveOriginalChildEvidence: ChildAdmissionCollaborators["resolveOriginalChildEvidence"];
65
- /** Called ONLY inside the bridge's already native-ticket-validated legacy delivery branch. Captured delivery stays in Core/B. */
66
- assertLegacyDelivery(ticket: ProfileParentAdmissionTicket, childId: string, evidence: LegacyChildEvidence): void;
67
- /** Await after immutable A admission, inside native serial created admission BEFORE the holder/inbox is exposed. */
68
- afterChildAdmission(parent: Agent, child: Agent, signal: AbortSignal): Promise<LegacyReadIntegrationChild | undefined>;
69
- publishCheckedGeneration(): void;
70
- changeConfiguration(reason: string, mutate: () => void | Promise<void>): Promise<void>;
71
- /** Wrap Core's revoke/registry/native disposal; revoke operation lifetimes and drain audit before calling it. */
72
- revokeBeforeDispose(agent: Agent, nativeDrainAndDispose: () => void | Promise<void>): Promise<void>;
73
- dispose(nativeDrain: () => Promise<void>): Promise<void>;
74
- }
75
- export interface LegacyReadIntegrationOptions<E = ChildAdmissionEvidence> {
76
- readonly ctx: Context;
77
- readonly authority: DsmmDeliveryAuthority<DsmmProfileAdmission, E>;
78
- readonly authorityOwner: object;
79
- readonly admissions: LegacyReadAdmissionSource;
80
- readonly nativeHistory: NativeChildHistory;
81
- /** Missing managed-definition admission makes the optional read path unavailable. */
82
- readonly proxyDefinitions?: LegacyReadProxyDefinitions;
83
- /** Optional COLD Core seam. Construct before this actual C1 authority enables delivery; never a post-ready replacement. */
84
- readonly coreAdmissions?: LegacyReadCoreAdmissions;
85
- /** B's exact native report contract is independent of the optional read composition. */
86
- readonly classifyChildReport?: LegacyCapabilityCollaborators["classifyTool"];
87
- /** Omitted by default. A profile/RPC boolean is not this trusted programmatic startup contract. */
88
- readonly trustedHostStartup?: LegacyReadTrustedStartup;
89
- }
90
- export interface LegacyReadIntegrationView {
91
- readonly state: "off" | "ready" | "quiescing" | "unavailable";
92
- readonly operation: "read";
93
- readonly generation?: number;
94
- readonly activeCalls: number;
95
- readonly reason?: "startup-opt-in-required" | "unknown-chain" | "audit-unavailable";
96
- }
97
- /** Explicit Host programmatic composition only. Owns glue, not a second permission, retry or audit service. */
98
- export declare function createLegacyReadIntegration<E>(options: LegacyReadIntegrationOptions<E>): {
99
- core: LegacyReadCoreConsumption | undefined;
100
- host: {
101
- composition: import("./legacy-read-composition.js").LegacyReadComposition;
102
- attachChild(parent: Agent, child: Agent, evidence: LegacyChildEvidence, definition: ToolDefinition): LegacyReadProxy;
103
- releaseAfterChildDispose(child: Agent): Promise<void>;
104
- publishCheckedGeneration(): void;
105
- dispose(nativeDrain: () => Promise<void>): Promise<void>;
106
- };
107
- legacyCapabilities: LegacyCapabilityCollaborators;
108
- /** B consumes this same classifier when validating the child report/tool definition. */
109
- classifyLegacyTool: (name: string, tools: import("@deepseek-ai/dsh-tools").ToolRuntime, child: Agent) => LegacyToolCapability | undefined;
110
- view(): LegacyReadIntegrationView;
111
- attachChild(parent: Agent, child: Agent, signal: AbortSignal): Promise<LegacyReadIntegrationChild>;
112
- publishCheckedGeneration(): void;
113
- /** Close synchronously; mutate only after real pipelines AND audit leases have drained. */
114
- change(reason: string, mutate: () => void | Promise<void>): Promise<void>;
115
- removeProxy(child: Agent): Promise<void>;
116
- /** Opaque native holders call before beginning disposal; ordinary residency teardown also retires automatically. */
117
- revokeChildBeforeDispose(child: Agent, nativeDispose: () => void | Promise<void>): Promise<void>;
118
- whenChildRetired(child: Agent): Promise<void>;
119
- dispose(nativeDrain: () => Promise<void>): Promise<void>;
120
- };
121
- //# sourceMappingURL=legacy-read-integration.d.ts.map