@dsmm/dsmm 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +8 -10
  2. package/cordis.patch.yml +14 -0
  3. package/docs/agent-presets.md +4 -4
  4. package/docs/compatibility.md +19 -24
  5. package/docs/deferred-native-approval-risk.md +2 -2
  6. package/docs/model-routing.md +3 -3
  7. package/docs/profiles.md +1 -1
  8. package/docs/releasing.md +46 -6
  9. package/docs/settings-status.md +2 -2
  10. package/lib/agent-registry.d.ts +36 -0
  11. package/lib/agent-registry.js +75 -0
  12. package/lib/child-admission.d.ts +0 -2
  13. package/lib/child-admission.js +13 -24
  14. package/lib/child-capture.d.ts +5 -1
  15. package/lib/child-capture.js +7 -5
  16. package/lib/client/children-locales.d.ts +13 -13
  17. package/lib/client/deployment-controller.js +1 -1
  18. package/lib/client.js +3 -3
  19. package/lib/delivery-authority.d.ts +18 -3
  20. package/lib/delivery-authority.js +149 -12
  21. package/lib/index.d.ts +2 -2
  22. package/lib/index.js +13 -26
  23. package/lib/native-child-evidence.d.ts +1 -3
  24. package/lib/native-child-evidence.js +0 -29
  25. package/lib/permission-rpc.js +3 -3
  26. package/lib/profile-rpc.js +6 -4
  27. package/lib/profile-store.js +2 -2
  28. package/lib/role-control-rpc.js +12 -8
  29. package/lib/role-invocation.d.ts +1 -1
  30. package/lib/role-policy.d.ts +1 -4
  31. package/lib/role-policy.js +24 -41
  32. package/lib/role-providers.d.ts +1 -1
  33. package/lib/role-providers.js +15 -55
  34. package/lib/role-runs.d.ts +17 -14
  35. package/lib/role-runs.js +45 -14
  36. package/lib/role-subagents.js +16 -6
  37. package/lib/runtime-integration.d.ts +4 -35
  38. package/lib/runtime-integration.js +38 -120
  39. package/lib/session-persistence.d.ts +2 -1
  40. package/lib/session-persistence.js +1 -1
  41. package/lib/session-scope.js +4 -1
  42. package/lib/subagent-runtime.d.ts +19 -7
  43. package/lib/subagent-runtime.js +141 -15
  44. package/package.json +110 -100
  45. package/lib/legacy-child-policy.d.ts +0 -51
  46. package/lib/legacy-child-policy.js +0 -123
  47. package/lib/legacy-read-composition.d.ts +0 -20
  48. package/lib/legacy-read-composition.js +0 -144
  49. package/lib/legacy-read-contracts.d.ts +0 -157
  50. package/lib/legacy-read-contracts.js +0 -39
  51. package/lib/legacy-read-host.d.ts +0 -19
  52. package/lib/legacy-read-host.js +0 -67
  53. package/lib/legacy-read-integration.d.ts +0 -121
  54. package/lib/legacy-read-integration.js +0 -522
  55. package/lib/legacy-read-proxy.d.ts +0 -26
  56. package/lib/legacy-read-proxy.js +0 -237
  57. package/scripts/cold-profile-composition.mjs +0 -329
  58. package/scripts/cold-profile-sources.mjs +0 -238
  59. package/scripts/migrate-cold-profile.mjs +0 -315
  60. package/scripts/repair-session-log.mjs +0 -476
  61. package/scripts/session-repair-native-verifier.mjs +0 -367
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsmm/dsmm",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "DeepSeek Harness deepwork mode bundle for ocmm-style agentic workflows.",
5
5
  "author": "Hugefiver",
6
6
  "license": "LicenseRef-AAAPL",
@@ -26,6 +26,10 @@
26
26
  "main": "./lib/index.js",
27
27
  "types": "./lib/index.d.ts",
28
28
  "exports": {
29
+ "./agent-registry": {
30
+ "types": "./lib/agent-registry.d.ts",
31
+ "default": "./lib/agent-registry.js"
32
+ },
29
33
  "./managed-settings": {
30
34
  "types": "./lib/managed-settings.d.ts",
31
35
  "default": "./lib/managed-settings.js"
@@ -70,10 +74,6 @@
70
74
  "types": "./lib/runtime-integration.d.ts",
71
75
  "default": "./lib/runtime-integration.js"
72
76
  },
73
- "./legacy-read-host": {
74
- "types": "./lib/legacy-read-host.d.ts",
75
- "default": "./lib/legacy-read-host.js"
76
- },
77
77
  "./client": {
78
78
  "types": "./lib/client/index.d.ts",
79
79
  "default": "./lib/client.js"
@@ -85,11 +85,18 @@
85
85
  "files": [
86
86
  "lib/**/*.js",
87
87
  "lib/**/*.d.ts",
88
- "scripts/repair-session-log.mjs",
89
- "scripts/session-repair-native-verifier.mjs",
90
- "scripts/migrate-cold-profile.mjs",
91
- "scripts/cold-profile-composition.mjs",
92
- "scripts/cold-profile-sources.mjs",
88
+ "!lib/legacy-read-host.js",
89
+ "!lib/legacy-read-host.d.ts",
90
+ "!lib/legacy-read-contracts.js",
91
+ "!lib/legacy-read-contracts.d.ts",
92
+ "!lib/legacy-read-composition.js",
93
+ "!lib/legacy-read-composition.d.ts",
94
+ "!lib/legacy-read-integration.js",
95
+ "!lib/legacy-read-integration.d.ts",
96
+ "!lib/legacy-read-proxy.js",
97
+ "!lib/legacy-read-proxy.d.ts",
98
+ "!lib/legacy-child-policy.js",
99
+ "!lib/legacy-child-policy.d.ts",
93
100
  "locale/*.json",
94
101
  "agent-presets",
95
102
  "docs/agent-presets.md",
@@ -116,102 +123,105 @@
116
123
  "README.md"
117
124
  ],
118
125
  "engines": {
119
- "node": ">=22"
126
+ "node": ">=22",
127
+ "dsh": ">=0.2.1-rc.1 <0.3.0-0"
120
128
  },
121
129
  "dependencies": {
122
- "@deepseek-ai/schemastery": "~3.18.4",
130
+ "@deepseek-ai/schemastery": "~3.18.5",
123
131
  "jsonc-parser": "^3.3.1"
124
132
  },
125
133
  "peerDependencies": {
126
- "@deepseek-ai/cordis": "~4.0.4",
127
- "@deepseek-ai/dsh-agent-instructions": "0.2.0-rc.2",
128
- "@deepseek-ai/dsh-agent-loop": "0.2.0-rc.2",
129
- "@deepseek-ai/dsh-agent-preset-registry": "0.2.0-rc.2",
130
- "@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
131
- "@deepseek-ai/dsh-brand": "0.2.0-rc.2",
132
- "@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
133
- "@deepseek-ai/dsh-command-compact": "0.2.0-rc.2",
134
- "@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
135
- "@deepseek-ai/dsh-compaction-tool-result-pruner": "0.2.0-rc.2",
136
- "@deepseek-ai/dsh-invariants": "0.2.0-rc.2",
137
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
138
- "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
139
- "@deepseek-ai/dsh-persona": "0.2.0-rc.2",
140
- "@deepseek-ai/dsh-plan-mode": "0.2.0-rc.2",
141
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
142
- "@deepseek-ai/dsh-session-persistence": "0.2.0-rc.2",
143
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.0-rc.2",
144
- "@deepseek-ai/dsh-settings": "0.2.0-rc.2",
145
- "@deepseek-ai/dsh-skill-filesystem": "0.2.0-rc.2",
146
- "@deepseek-ai/dsh-subagent": "0.2.0-rc.2",
147
- "@deepseek-ai/dsh-timeout": "0.2.0-rc.2",
148
- "@deepseek-ai/dsh-tool-ask-user": "0.2.0-rc.2",
149
- "@deepseek-ai/dsh-tool-bash": "0.2.0-rc.2",
150
- "@deepseek-ai/dsh-tool-fs": "0.2.0-rc.2",
151
- "@deepseek-ai/dsh-tool-fs-search": "0.2.0-rc.2",
152
- "@deepseek-ai/dsh-tool-jobs": "0.2.0-rc.2",
153
- "@deepseek-ai/dsh-tool-pwsh": "0.2.0-rc.2",
154
- "@deepseek-ai/dsh-tool-skill": "0.2.0-rc.2",
155
- "@deepseek-ai/dsh-tool-subagent": "0.2.0-rc.2",
156
- "@deepseek-ai/dsh-tool-todo": "0.2.0-rc.2",
157
- "@deepseek-ai/dsh-tool-web": "0.2.0-rc.2",
158
- "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
159
- "@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
160
- "@earendil-works/pi-ai": "0.87.1"
134
+ "@deepseek-ai/cordis": "~4.0.5",
135
+ "@deepseek-ai/dsh-agent-instructions": "0.2.1-rc.1",
136
+ "@deepseek-ai/dsh-agent-loop": "0.2.1-rc.1",
137
+ "@deepseek-ai/dsh-agent-preset-registry": "0.2.1-rc.1",
138
+ "@deepseek-ai/dsh-attachment": "0.2.1-rc.1",
139
+ "@deepseek-ai/dsh-brand": "0.2.1-rc.1",
140
+ "@deepseek-ai/dsh-client-connection": "0.2.1-rc.1",
141
+ "@deepseek-ai/dsh-command-compact": "0.2.1-rc.1",
142
+ "@deepseek-ai/dsh-compaction-basic": "0.2.1-rc.1",
143
+ "@deepseek-ai/dsh-compaction-tool-result-pruner": "0.2.1-rc.1",
144
+ "@deepseek-ai/dsh-jobs": "0.2.1-rc.1",
145
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.1",
146
+ "@deepseek-ai/dsh-llm-pi-ai": "0.2.1-rc.1",
147
+ "@deepseek-ai/dsh-persona": "0.2.1-rc.1",
148
+ "@deepseek-ai/dsh-plan-mode": "0.2.1-rc.1",
149
+ "@deepseek-ai/dsh-session": "0.2.1-rc.1",
150
+ "@deepseek-ai/dsh-session-persistence": "0.2.1-rc.1",
151
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-rc.1",
152
+ "@deepseek-ai/dsh-settings": "0.2.1-rc.1",
153
+ "@deepseek-ai/dsh-skill-filesystem": "0.2.1-rc.1",
154
+ "@deepseek-ai/dsh-subagent": "0.2.1-rc.1",
155
+ "@deepseek-ai/dsh-timeout": "0.2.1-rc.1",
156
+ "@deepseek-ai/dsh-tool-ask-user": "0.2.1-rc.1",
157
+ "@deepseek-ai/dsh-tool-bash": "0.2.1-rc.1",
158
+ "@deepseek-ai/dsh-tool-fs": "0.2.1-rc.1",
159
+ "@deepseek-ai/dsh-tool-fs-search": "0.2.1-rc.1",
160
+ "@deepseek-ai/dsh-tool-jobs": "0.2.1-rc.1",
161
+ "@deepseek-ai/dsh-tool-pwsh": "0.2.1-rc.1",
162
+ "@deepseek-ai/dsh-tool-skill": "0.2.1-rc.1",
163
+ "@deepseek-ai/dsh-tool-subagent": "0.2.1-rc.1",
164
+ "@deepseek-ai/dsh-tool-todo": "0.2.1-rc.1",
165
+ "@deepseek-ai/dsh-tool-web": "0.2.1-rc.1",
166
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.1",
167
+ "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.1",
168
+ "@earendil-works/pi-ai": "^1.1.0"
161
169
  },
162
170
  "devDependencies": {
163
- "@deepseek-ai/cordis": "~4.0.4",
164
- "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
165
- "@deepseek-ai/dsh-agent-instructions": "0.2.0-rc.2",
166
- "@deepseek-ai/dsh-agent-loop": "0.2.0-rc.2",
167
- "@deepseek-ai/dsh-agent-preset-registry": "0.2.0-rc.2",
168
- "@deepseek-ai/dsh-api-gateway": "0.2.0-rc.2",
169
- "@deepseek-ai/dsh-api-session-controller": "0.2.0-rc.2",
170
- "@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
171
- "@deepseek-ai/dsh-brand": "0.2.0-rc.2",
172
- "@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
173
- "@deepseek-ai/dsh-client-locale": "0.2.0-rc.2",
174
- "@deepseek-ai/dsh-client-store": "0.2.0-rc.2",
175
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.0-rc.2",
176
- "@deepseek-ai/dsh-client-ui-model-selection": "0.2.0-rc.2",
177
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.2",
178
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
179
- "@deepseek-ai/dsh-client-ui-session": "0.2.0-rc.2",
180
- "@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.2",
181
- "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
182
- "@deepseek-ai/dsh-command-compact": "0.2.0-rc.2",
183
- "@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
184
- "@deepseek-ai/dsh-compaction-tool-result-pruner": "0.2.0-rc.2",
185
- "@deepseek-ai/dsh-invariants": "0.2.0-rc.2",
186
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
187
- "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
188
- "@deepseek-ai/dsh-persona": "0.2.0-rc.2",
189
- "@deepseek-ai/dsh-plan-mode": "0.2.0-rc.2",
190
- "@deepseek-ai/dsh-scope": "0.2.0-rc.2",
191
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
192
- "@deepseek-ai/dsh-session-persistence": "0.2.0-rc.2",
193
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.0-rc.2",
194
- "@deepseek-ai/dsh-session-projection": "0.2.0-rc.2",
195
- "@deepseek-ai/dsh-settings": "0.2.0-rc.2",
196
- "@deepseek-ai/dsh-skill-filesystem": "0.2.0-rc.2",
197
- "@deepseek-ai/dsh-subagent": "0.2.0-rc.2",
198
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.0-rc.2",
199
- "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.2",
200
- "@deepseek-ai/dsh-timeout": "0.2.0-rc.2",
201
- "@deepseek-ai/dsh-tool-ask-user": "0.2.0-rc.2",
202
- "@deepseek-ai/dsh-tool-bash": "0.2.0-rc.2",
203
- "@deepseek-ai/dsh-tool-fs": "0.2.0-rc.2",
204
- "@deepseek-ai/dsh-tool-fs-search": "0.2.0-rc.2",
205
- "@deepseek-ai/dsh-tool-jobs": "0.2.0-rc.2",
206
- "@deepseek-ai/dsh-tool-pwsh": "0.2.0-rc.2",
207
- "@deepseek-ai/dsh-tool-skill": "0.2.0-rc.2",
208
- "@deepseek-ai/dsh-tool-subagent": "0.2.0-rc.2",
209
- "@deepseek-ai/dsh-tool-todo": "0.2.0-rc.2",
210
- "@deepseek-ai/dsh-tool-web": "0.2.0-rc.2",
211
- "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
212
- "@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
213
- "@deepseek-ai/dsh-typert-registry": "0.2.0-rc.2",
214
- "@earendil-works/pi-ai": "0.87.1",
171
+ "@deepseek-ai/cordis": "~4.0.5",
172
+ "@deepseek-ai/cordis-plugin-group": "1.0.5",
173
+ "@deepseek-ai/cordis-plugin-include": "1.0.10",
174
+ "@deepseek-ai/dsh-agent": "0.2.1-rc.1",
175
+ "@deepseek-ai/dsh-agent-instructions": "0.2.1-rc.1",
176
+ "@deepseek-ai/dsh-agent-loop": "0.2.1-rc.1",
177
+ "@deepseek-ai/dsh-agent-preset-registry": "0.2.1-rc.1",
178
+ "@deepseek-ai/dsh-api-gateway": "0.2.1-rc.1",
179
+ "@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.1",
180
+ "@deepseek-ai/dsh-attachment": "0.2.1-rc.1",
181
+ "@deepseek-ai/dsh-brand": "0.2.1-rc.1",
182
+ "@deepseek-ai/dsh-client-connection": "0.2.1-rc.1",
183
+ "@deepseek-ai/dsh-client-locale": "0.2.1-rc.1",
184
+ "@deepseek-ai/dsh-client-store": "0.2.1-rc.1",
185
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.1",
186
+ "@deepseek-ai/dsh-client-ui-model-selection": "0.2.1-rc.1",
187
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.1",
188
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.1",
189
+ "@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.1",
190
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.1",
191
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.1",
192
+ "@deepseek-ai/dsh-command-compact": "0.2.1-rc.1",
193
+ "@deepseek-ai/dsh-compaction-basic": "0.2.1-rc.1",
194
+ "@deepseek-ai/dsh-compaction-tool-result-pruner": "0.2.1-rc.1",
195
+ "@deepseek-ai/dsh-jobs": "0.2.1-rc.1",
196
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.1",
197
+ "@deepseek-ai/dsh-llm-pi-ai": "0.2.1-rc.1",
198
+ "@deepseek-ai/dsh-persona": "0.2.1-rc.1",
199
+ "@deepseek-ai/dsh-plan-mode": "0.2.1-rc.1",
200
+ "@deepseek-ai/dsh-scope": "0.2.1-rc.1",
201
+ "@deepseek-ai/dsh-session": "0.2.1-rc.1",
202
+ "@deepseek-ai/dsh-session-persistence": "0.2.1-rc.1",
203
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-rc.1",
204
+ "@deepseek-ai/dsh-session-projection": "0.2.1-rc.1",
205
+ "@deepseek-ai/dsh-settings": "0.2.1-rc.1",
206
+ "@deepseek-ai/dsh-skill-filesystem": "0.2.1-rc.1",
207
+ "@deepseek-ai/dsh-subagent": "0.2.1-rc.1",
208
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.1-rc.1",
209
+ "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.1",
210
+ "@deepseek-ai/dsh-timeout": "0.2.1-rc.1",
211
+ "@deepseek-ai/dsh-tool-ask-user": "0.2.1-rc.1",
212
+ "@deepseek-ai/dsh-tool-bash": "0.2.1-rc.1",
213
+ "@deepseek-ai/dsh-tool-fs": "0.2.1-rc.1",
214
+ "@deepseek-ai/dsh-tool-fs-search": "0.2.1-rc.1",
215
+ "@deepseek-ai/dsh-tool-jobs": "0.2.1-rc.1",
216
+ "@deepseek-ai/dsh-tool-pwsh": "0.2.1-rc.1",
217
+ "@deepseek-ai/dsh-tool-skill": "0.2.1-rc.1",
218
+ "@deepseek-ai/dsh-tool-subagent": "0.2.1-rc.1",
219
+ "@deepseek-ai/dsh-tool-todo": "0.2.1-rc.1",
220
+ "@deepseek-ai/dsh-tool-web": "0.2.1-rc.1",
221
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.1",
222
+ "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.1",
223
+ "@deepseek-ai/dsh-typert-registry": "0.2.1-rc.1",
224
+ "@earendil-works/pi-ai": "1.3.0",
215
225
  "@types/node": "^26.0.0",
216
226
  "@types/react": "^18.3.27",
217
227
  "esbuild": "^0.25.12",
@@ -245,7 +255,7 @@
245
255
  "typecheck": "tsc -p tsconfig.json --noEmit",
246
256
  "typecheck:test": "pnpm run build && tsc -p tsconfig.test.json --noEmit",
247
257
  "test": "pnpm run build && node --test --experimental-strip-types --import ./test/prompt-source-loader.mjs --test-concurrency=1 test/*.test.ts",
248
- "smoke:docker:build": "docker build --build-arg DSH_PACKAGE=@deepseek-ai/dsh@0.2.0-rc.2 -f docker/Dockerfile.smoke -t dsmm-dsh-smoke:0.2 ..",
258
+ "smoke:docker:build": "docker build --build-arg DSH_PACKAGE=@deepseek-ai/dsh@0.2.1-rc.1 -f docker/Dockerfile.smoke -t dsmm-dsh-smoke:0.2 ..",
249
259
  "smoke:docker:run": "docker run --rm dsmm-dsh-smoke:0.2",
250
260
  "smoke:docker": "node scripts/docker-smoke.mjs"
251
261
  }
@@ -1,51 +0,0 @@
1
- import type { Agent } from "@deepseek-ai/dsh-agent";
2
- import type { ToolDefinition, ToolExecution, ToolGuard, ToolRuntime } from "@deepseek-ai/dsh-tools";
3
- import type { ChildAdmissionLimitation, ChildEvidenceField, LegacyChildEvidence } from "./child-capture.js";
4
- import type { DsmmProfileAdmission, DsmmSettings } from "./settings.js";
5
- import type { LegacyReadCompositionLease } from "./legacy-read-contracts.js";
6
- import type { LegacyReadProxy } from "./legacy-read-proxy.js";
7
- export interface LegacyToolCapability {
8
- readonly kind: "read" | "child-report" | "write" | "shell" | "delegation" | "other";
9
- /** Stable native definition identity; name alone does not prove parameter permissions. */
10
- readonly definition: ToolDefinition;
11
- /** Exact schema/argument contract is audited by the Host/B collaborator, never inferred from a name. */
12
- assertArguments(arguments_: unknown): void;
13
- /** A read is admitted only inside the real registered proxy's leased native invocation. */
14
- readonly operation?: LegacyReadOperationCapability;
15
- }
16
- export interface LegacyReadOperationCapability {
17
- readonly parent: Agent;
18
- readonly child: Agent;
19
- readonly definition: ToolDefinition;
20
- assertLeasedOperation(exec: Readonly<ToolExecution>): void;
21
- }
22
- /** Process-local glue for the trusted startup adapter, never a permission-query or wire grant. */
23
- export declare function createLegacyReadOperationCapability(proxy: LegacyReadProxy, leaseFor: (exec: Readonly<ToolExecution>) => LegacyReadCompositionLease | undefined): LegacyReadOperationCapability;
24
- export interface LegacyCapabilityCollaborators {
25
- classifyTool(name: string, tools: ToolRuntime, child: Agent): LegacyToolCapability | undefined;
26
- /** Exact direct-parent reporting authority only; read permission is decided by the real parent pipeline. */
27
- assertParentReport?(parent: Agent, child: Agent, arguments_: unknown, definition: ToolDefinition, evidence: LegacyChildEvidence): void;
28
- /** Older report collaborators may use this spelling. It is NEVER consulted for read. */
29
- assertParentTool?(parent: Agent, name: string, arguments_: unknown, definition: ToolDefinition): void;
30
- /** Trusted cold Host inventory of the actual registered child guard; never a permission grant. */
31
- onGuardInstalled?(child: Agent, guard: ToolGuard): void;
32
- }
33
- export interface LegacyToolDenial {
34
- readonly field: ChildEvidenceField;
35
- readonly code: ChildAdmissionLimitation["code"];
36
- }
37
- /** A restrictive current admission, explicitly NOT a reconstruction of the original settings or epoch. */
38
- export declare function createConservativeLegacyAdmission(raw: LegacyChildEvidence, parent: DsmmProfileAdmission, nativeSubstrate: DsmmSettings): DsmmProfileAdmission;
39
- /** Body-before guard for the proven read subset and the native child -> direct-parent report path. */
40
- export declare class LegacyChildToolPolicy {
41
- private readonly evidence;
42
- private readonly parent;
43
- private readonly child;
44
- private readonly collaborators;
45
- constructor(evidence: LegacyChildEvidence, parent: Agent, child: Agent, collaborators: LegacyCapabilityCollaborators);
46
- denial(name: string, arguments_: unknown, tools: ToolRuntime, exec?: Readonly<ToolExecution>): LegacyToolDenial | undefined;
47
- assertTool(name: string, arguments_: unknown, tools: ToolRuntime, exec?: Readonly<ToolExecution>): void;
48
- }
49
- /** Scoped monotonic native guard; denied bodies never execute, including locally registered tools. */
50
- export declare function installLegacyChildToolPolicy(evidence: LegacyChildEvidence, parent: Agent, child: Agent, collaborators: LegacyCapabilityCollaborators): () => void;
51
- //# sourceMappingURL=legacy-child-policy.d.ts.map
@@ -1,123 +0,0 @@
1
- import { randomBytes } from "node:crypto";
2
- import { SubagentError } from "@deepseek-ai/dsh-subagent";
3
- import { parseLegacyChildEvidence } from "./child-capture.js";
4
- import { DSMM_ROLE_IDS } from "./roles.js";
5
- import { copyJson, freezeSettings, resolveConfig } from "./settings.js";
6
- const readOperations = new WeakSet();
7
- /** Process-local glue for the trusted startup adapter, never a permission-query or wire grant. */
8
- export function createLegacyReadOperationCapability(proxy, leaseFor) {
9
- const { parent, child, definition } = proxy;
10
- const capability = Object.freeze({ parent, child, definition, assertLeasedOperation(exec) {
11
- const lease = leaseFor(exec);
12
- if (lease === undefined || definition === proxy.nativeDefinition || exec.agent !== child || exec.name !== "read"
13
- || child.ctx.tools.get("read", child) !== definition || parent.ctx.tools.get("read", parent) !== proxy.nativeDefinition
14
- || lease.bindings.parent !== parent || lease.bindings.child !== child || lease.bindings.definition !== proxy.nativeDefinition
15
- || lease.ticket.parent !== parent)
16
- throw new SubagentError("Legacy read requires the real proxy's leased invocation", "UNAUTHORIZED");
17
- lease.assertActive();
18
- } });
19
- readOperations.add(capability);
20
- return capability;
21
- }
22
- /** A restrictive current admission, explicitly NOT a reconstruction of the original settings or epoch. */
23
- export function createConservativeLegacyAdmission(raw, parent, nativeSubstrate) {
24
- const evidence = parseLegacyChildEvidence(raw);
25
- if (!parent.settings.modules.deepwork.enabled || !parent.settings.roles[evidence.role])
26
- throw new SubagentError("Current parent denies the legacy role", "UNAUTHORIZED");
27
- const { locale: _locale, ...substrate } = copyJson(nativeSubstrate);
28
- const settings = resolveConfig({ ...substrate,
29
- modules: { deepwork: { enabled: true } },
30
- roles: Object.fromEntries(DSMM_ROLE_IDS.map(role => [role, role === evidence.role])),
31
- roleRouting: { [evidence.role]: { primary: evidence.route, fallbackRoutes: [] } },
32
- defaultActive: evidence.active ?? false,
33
- skills: Object.fromEntries(Object.keys(substrate.skills).map(skill => [skill, false])),
34
- deepseekV4ProCalibration: "off", deepseekV4ProDefaultReasoningEffort: "off", deepseekFlashCalibration: "off", deepseekFlashDefaultReasoningEffort: "off",
35
- workflow: { policy: "risk-based", strictGates: true, reviewCap: 0, finalReviewPolicy: "off" },
36
- guards: { scope: "always", shellCommandSafety: true, gitWriteGuard: "deny" },
37
- runtimeRecovery: { enabled: false, fallbackRoutes: [], idleContinuation: { enabled: false } },
38
- subagents: { toolTopology: "per-role", allowRouteOverride: false, enableRunInBackground: false, backgroundMode: "continuable", maxDepth: evidence.depth },
39
- });
40
- return freezeSettings({ settings, profile: null, epoch: randomBytes(32).toString("hex"), scope: "deployment-baseline", childEvidence: {
41
- mode: "legacy-conservative", parentAdmissionEpoch: parent.epoch, provenFields: evidence.provenFields, limitations: evidence.limitations
42
- } });
43
- }
44
- /** Body-before guard for the proven read subset and the native child -> direct-parent report path. */
45
- export class LegacyChildToolPolicy {
46
- evidence;
47
- parent;
48
- child;
49
- collaborators;
50
- constructor(evidence, parent, child, collaborators) {
51
- this.evidence = parseLegacyChildEvidence(evidence);
52
- if (child.id !== evidence.childSessionId || parent.id !== evidence.parentSessionId || child.session.header.parentSession !== parent.id) {
53
- throw new SubagentError("Legacy tools require exact child/direct-parent identity", "UNAUTHORIZED");
54
- }
55
- this.parent = parent;
56
- this.child = child;
57
- this.collaborators = collaborators;
58
- }
59
- denial(name, arguments_, tools, exec) {
60
- const capability = this.collaborators.classifyTool(name, tools, this.child);
61
- if (capability?.kind === "write")
62
- return { field: "runtime-policy", code: "missing-evidence" };
63
- if (capability?.kind === "shell")
64
- return { field: "shell", code: "missing-evidence" };
65
- if (capability?.kind === "delegation")
66
- return { field: "delegation", code: "missing-evidence" };
67
- if (capability === undefined || capability.kind === "other" || tools.get(name, this.child) !== capability.definition)
68
- return { field: "tool-filter", code: "missing-evidence" };
69
- if (capability.kind === "read" && (this.evidence.toolFilter?.allow === undefined || !this.evidence.toolFilter.allow.includes(name)
70
- || this.evidence.toolFilter.deny?.includes(name)))
71
- return { field: "tool-filter", code: "missing-evidence" };
72
- // The report collaborator must check the explicit destination against the exact direct parent.
73
- try {
74
- capability.assertArguments(arguments_);
75
- }
76
- catch {
77
- return { field: "tool-filter", code: "missing-evidence" };
78
- }
79
- if (capability.kind === "read") {
80
- const operation = capability.operation;
81
- if (operation === undefined || !readOperations.has(operation) || operation.parent !== this.parent || operation.child !== this.child
82
- || operation.definition !== capability.definition || exec === undefined || exec.agent !== this.child || exec.name !== name
83
- || exec.arguments !== arguments_)
84
- return { field: "tool-filter", code: "unverified" };
85
- try {
86
- operation.assertLeasedOperation(exec);
87
- }
88
- catch {
89
- return { field: "tool-filter", code: "unverified" };
90
- }
91
- return undefined;
92
- }
93
- try {
94
- if (this.collaborators.assertParentReport !== undefined)
95
- this.collaborators.assertParentReport(this.parent, this.child, arguments_, capability.definition, this.evidence);
96
- else if (this.collaborators.assertParentTool !== undefined)
97
- this.collaborators.assertParentTool(this.parent, name, arguments_, capability.definition);
98
- else
99
- throw new SubagentError("Legacy report requires exact parent authority", "UNAUTHORIZED");
100
- }
101
- catch {
102
- return { field: "tool-filter", code: "parent-denied" };
103
- }
104
- return undefined;
105
- }
106
- assertTool(name, arguments_, tools, exec) {
107
- if (this.denial(name, arguments_, tools, exec) !== undefined)
108
- throw new SubagentError("Legacy evidence does not authorize this tool capability", "UNAUTHORIZED");
109
- }
110
- }
111
- /** Scoped monotonic native guard; denied bodies never execute, including locally registered tools. */
112
- export function installLegacyChildToolPolicy(evidence, parent, child, collaborators) {
113
- const tools = child.ctx.get("tools");
114
- if (tools === undefined)
115
- throw new SubagentError("Legacy execution requires a native tool guard", "UNAUTHORIZED");
116
- const policy = new LegacyChildToolPolicy(evidence, parent, child, collaborators);
117
- const guard = exec => exec.agent !== child || policy.denial(exec.name, exec.arguments, tools, exec) !== undefined
118
- ? "Legacy child capability is not proven by its durable evidence" : undefined;
119
- const release = tools.guard(guard);
120
- collaborators.onGuardInstalled?.(child, guard);
121
- return release;
122
- }
123
- //# sourceMappingURL=legacy-child-policy.js.map
@@ -1,20 +0,0 @@
1
- import type { Agent } from "@deepseek-ai/dsh-agent";
2
- import type { LegacyChildEvidence } from "./child-capture.js";
3
- import type { LegacyReadBindings, LegacyReadClosedSnapshot, LegacyReadCompositionLease, LegacyReadHostOwner } from "./legacy-read-contracts.js";
4
- export interface LegacyReadComposition {
5
- readonly owner: LegacyReadHostOwner;
6
- view(): {
7
- state: "off" | "ready" | "closed" | "disposed";
8
- generation: number;
9
- activeCalls: number;
10
- reason?: string;
11
- };
12
- captureClosedComposition(): LegacyReadClosedSnapshot | undefined;
13
- publishGeneration(snapshot: LegacyReadClosedSnapshot, expectedGeneration: number): void;
14
- acquireLease(parent: Agent, child: Agent, evidence: LegacyChildEvidence, signal: AbortSignal): LegacyReadCompositionLease;
15
- closeForChange(reason: string): Promise<void>;
16
- closeForDispose(reason: string): Promise<void>;
17
- }
18
- export declare function createLegacyReadComposition(owner: LegacyReadHostOwner): LegacyReadComposition;
19
- export declare function assertLegacyReadBindings(lease: LegacyReadCompositionLease, current: LegacyReadBindings): void;
20
- //# sourceMappingURL=legacy-read-composition.d.ts.map
@@ -1,144 +0,0 @@
1
- import { symbols } from "@deepseek-ai/cordis";
2
- import { parseLegacyChildEvidence } from "./child-capture.js";
3
- import { isLegacyReadHostOwner, LegacyReadUnavailable } from "./legacy-read-contracts.js";
4
- function checkSnapshot(owner, snapshot) {
5
- if (snapshot?.owner !== owner || snapshot.coverage !== "host-owned-complete" || snapshot.mutation !== "owner-coordinated"
6
- || snapshot.fidelity !== "canonical-value-content-contexts" || !["never-ask", "coordinated-turn"].includes(snapshot.approval)
7
- || !snapshot.scopes?.length || !snapshot.bindings?.length || !Array.isArray(snapshot.policies))
8
- throw new LegacyReadUnavailable("composition-unavailable");
9
- for (const scope of snapshot.scopes) {
10
- if (!scope.ctx || !scope.key || !Array.isArray(scope.ancestors))
11
- throw new LegacyReadUnavailable("composition-unavailable");
12
- }
13
- for (const policy of snapshot.policies) {
14
- if (policy.semantics !== "audited-zero-or-once" || !policy.reference || !snapshot.scopes.some(scope => scope.ctx === policy.scope)
15
- || !Number.isSafeInteger(policy.order))
16
- throw new LegacyReadUnavailable("composition-unavailable");
17
- }
18
- for (const binding of snapshot.bindings) {
19
- if (!binding.mount || !binding.config || !binding.parentProvider || !binding.childProvider || !binding.parentWorld || !binding.childWorld
20
- || !binding.parentFs || !binding.childFs || binding.definition?.name !== "read"
21
- || !binding.caps || [binding.caps.limit, binding.caps.maxBytes, binding.caps.maxLineLength, binding.caps.streamMinSize].some(cap => !Number.isSafeInteger(cap) || cap < 1)
22
- || !snapshot.scopes.some(scope => scope.key === binding.parent) || !snapshot.scopes.some(scope => scope.key === binding.child)) {
23
- throw new LegacyReadUnavailable("composition-unavailable");
24
- }
25
- }
26
- }
27
- export function createLegacyReadComposition(owner) {
28
- if (!isLegacyReadHostOwner(owner))
29
- throw new LegacyReadUnavailable("composition-unavailable");
30
- let state = "off";
31
- let generation = 0, reason, snapshot;
32
- const lifetime = new AbortController();
33
- const active = new Set();
34
- const waiters = new Set();
35
- let captures = new WeakSet();
36
- const drain = () => active.size === 0 ? Promise.resolve() : new Promise(resolve => waiters.add(resolve));
37
- const composition = {
38
- owner,
39
- view: () => ({ state, generation, activeCalls: active.size, ...(reason === undefined ? {} : { reason }) }),
40
- captureClosedComposition() {
41
- if (state === "ready" || state === "disposed" || active.size)
42
- throw new LegacyReadUnavailable("composition-unavailable");
43
- const captured = owner.captureClosedComposition();
44
- if (captured !== undefined) {
45
- checkSnapshot(owner, captured);
46
- captures.add(captured);
47
- }
48
- return captured;
49
- },
50
- publishGeneration(next, expected) {
51
- if (state === "ready" || state === "disposed" || active.size || generation !== expected || !captures.has(next))
52
- throw new LegacyReadUnavailable("composition-unavailable");
53
- checkSnapshot(owner, next);
54
- // Copy attested inventory, retaining actual definition/service/policy identities.
55
- snapshot = Object.freeze({ ...next, scopes: Object.freeze(next.scopes.map(scope => Object.freeze({ ...scope, ancestors: Object.freeze([...scope.ancestors]) }))),
56
- policies: Object.freeze(next.policies.map(policy => Object.freeze({ ...policy }))), bindings: Object.freeze([...next.bindings]) });
57
- captures.delete(next);
58
- generation++;
59
- state = "ready";
60
- reason = undefined;
61
- },
62
- acquireLease(parent, child, rawEvidence, signal) {
63
- if (state !== "ready" || snapshot === undefined)
64
- throw new LegacyReadUnavailable("composition-unavailable");
65
- signal.throwIfAborted();
66
- const evidence = parseLegacyChildEvidence(rawEvidence);
67
- if (parent === child || parent.id !== evidence.parentSessionId || child.id !== evidence.childSessionId
68
- || child.session.header.parentSession !== parent.id || parent.ctx.agents.get(parent.id) !== parent || child.ctx.agents.get(child.id) !== child
69
- || !child.ctx.agents.isOwnedBy(child.id, parent) || !evidence.toolFilter?.allow?.includes("read") || evidence.toolFilter.deny?.includes("read"))
70
- throw new LegacyReadUnavailable("evidence-unavailable");
71
- const acquiredGeneration = generation, acquiredSnapshot = snapshot;
72
- const ticket = owner.acquireParentTicket(parent);
73
- if (ticket.parent !== parent)
74
- throw new LegacyReadUnavailable("evidence-unavailable");
75
- owner.assertParentTicket(ticket);
76
- const original = owner.resolveChildAdmission(parent, child, rawEvidence, ticket);
77
- if (original.source !== "physical-old" || original.evidence !== rawEvidence || original.originalCapture !== undefined
78
- || !original.physicalRecords.length || !Object.isFrozen(original.admission))
79
- throw new LegacyReadUnavailable("evidence-unavailable");
80
- const bindings = snapshot.bindings.find(binding => binding.parent === parent && binding.child === child);
81
- if (bindings === undefined)
82
- throw new LegacyReadUnavailable("provenance-unavailable");
83
- const merged = AbortSignal.any([signal, ticket.signal, original.childLifetime, lifetime.signal]);
84
- merged.throwIfAborted();
85
- if (state !== "ready" || generation !== acquiredGeneration || snapshot !== acquiredSnapshot)
86
- throw new LegacyReadUnavailable("composition-unavailable");
87
- let released = false;
88
- const lease = Object.freeze({ owner, generation, signal: merged, ticket, bindings, approval: snapshot.approval,
89
- assertActive() {
90
- if (released || !active.has(lease))
91
- throw new LegacyReadUnavailable("lifetime-unavailable");
92
- merged.throwIfAborted();
93
- owner.assertParentTicket(ticket);
94
- },
95
- release() {
96
- if (released)
97
- return;
98
- released = true;
99
- active.delete(lease);
100
- if (!active.size) {
101
- for (const resolve of waiters)
102
- resolve();
103
- waiters.clear();
104
- }
105
- },
106
- });
107
- active.add(lease);
108
- return lease;
109
- },
110
- closeForChange(nextReason) {
111
- captures = new WeakSet();
112
- if (state !== "disposed") {
113
- state = "closed";
114
- reason = nextReason;
115
- }
116
- return drain();
117
- },
118
- closeForDispose(nextReason) {
119
- captures = new WeakSet();
120
- if (state !== "disposed") {
121
- state = "disposed";
122
- reason = nextReason;
123
- try {
124
- owner.revoke(nextReason);
125
- }
126
- finally {
127
- lifetime.abort(nextReason);
128
- }
129
- }
130
- return drain();
131
- },
132
- };
133
- return composition;
134
- }
135
- export function assertLegacyReadBindings(lease, current) {
136
- const expected = lease.bindings;
137
- const original = (value) => value === undefined ? undefined : Reflect.get(value, symbols.original) ?? value;
138
- if (current !== expected || current.parent.ctx.get("tools")?.get("read", current.parent) !== current.definition
139
- || original(current.child.ctx.get("fs")) !== original(current.childFs) || original(current.parent.ctx.get("fs")) !== original(current.parentFs)
140
- || current.parentProvider !== current.childProvider || current.parentWorld !== current.childWorld)
141
- throw new LegacyReadUnavailable("provenance-unavailable");
142
- lease.assertActive();
143
- }
144
- //# sourceMappingURL=legacy-read-composition.js.map