doppler-gpu 0.4.15 → 0.5.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 (221) hide show
  1. package/README.md +9 -0
  2. package/package.json +25 -2
  3. package/src/cli/doppler-cli.js +253 -94
  4. package/src/cli/runtime-profiles.js +3 -7
  5. package/src/client/doppler-api.d.ts +28 -0
  6. package/src/client/doppler-api.js +2 -0
  7. package/src/client/inspection.d.ts +122 -0
  8. package/src/client/inspection.js +343 -0
  9. package/src/client/runtime/index.d.ts +54 -0
  10. package/src/client/runtime/index.js +190 -18
  11. package/src/client/runtime/model-manager.d.ts +0 -4
  12. package/src/client/runtime/model-manager.js +0 -28
  13. package/src/client/runtime/model-session.d.ts +48 -1
  14. package/src/client/runtime/model-session.js +149 -30
  15. package/src/client/runtime/model-source.d.ts +10 -1
  16. package/src/client/runtime/scoped-session.d.ts +117 -0
  17. package/src/client/runtime/scoped-session.js +257 -0
  18. package/src/client/runtime/types.d.ts +0 -1
  19. package/src/client/runtime/types.js +0 -1
  20. package/src/config/evidence/boundary-evidence-policy.json +54 -0
  21. package/src/config/evidence/source-intake-policy.json +122 -0
  22. package/src/config/inspection/observation-policies.json +80 -0
  23. package/src/config/param-validator.js +21 -36
  24. package/src/config/runtime/compute/f16-activations.json +1 -0
  25. package/src/config/runtime/compute/f16-batched.json +1 -0
  26. package/src/config/runtime/default.json +1 -0
  27. package/src/config/runtime/diagnostics/debug-logits.json +1 -0
  28. package/src/config/runtime/experiments/bench/gemma3-bench-q4k-alt.json +1 -0
  29. package/src/config/runtime/experiments/bench/gemma3-bench-q4k-batched.json +1 -0
  30. package/src/config/runtime/experiments/bench/gemma3-bench-q4k.json +1 -0
  31. package/src/config/runtime/experiments/bench/gemma4-bench-q4k.json +1 -0
  32. package/src/config/runtime/experiments/bench/qwen3-bench-q4k-alt.json +1 -0
  33. package/src/config/runtime/experiments/bench/qwen3-bench-q4k-batched.json +1 -0
  34. package/src/config/runtime/experiments/debug/gemma3-browser-diagnose-q4k.json +1 -1
  35. package/src/config/runtime/experiments/debug/gemma3-debug-q4k.json +1 -3
  36. package/src/config/runtime/experiments/debug/gemma4-e2b-browser-diagnose-q4k.json +1 -1
  37. package/src/config/runtime/experiments/debug/qwen35-browser-diagnose-q4k.json +1 -1
  38. package/src/config/runtime/experiments/verify/gemma3-verify.json +1 -3
  39. package/src/config/runtime/experiments/verify/gemma4-e2b-verify.json +1 -3
  40. package/src/config/runtime/experiments/verify/lfm2-verify.json +1 -3
  41. package/src/config/runtime/experiments/verify/translategemma-verify.json +1 -3
  42. package/src/config/runtime/model/gemma2-debug.json +1 -0
  43. package/src/config/runtime/model/gemma2-pipeline-debug.json +1 -0
  44. package/src/config/runtime/model/gemma2-pipeline.json +1 -0
  45. package/src/config/runtime/model/gemma3-layer-probe.json +1 -0
  46. package/src/config/runtime/model/qwen3-5-layer-probe.json +1 -0
  47. package/src/config/runtime/model/qwen3-5-layer3-boundary-probe.json +1 -0
  48. package/src/config/runtime/model/qwen3-5-linear-attn-debug.json +1 -0
  49. package/src/config/runtime/optimization-candidates/registry.json +5 -0
  50. package/src/config/runtime/platform/metal-apple-q4k.json +1 -0
  51. package/src/config/runtime/profiles/default.json +1 -0
  52. package/src/config/runtime/profiles/diffusiongemma-26b-a4b-throughput.json +1 -0
  53. package/src/config/runtime/profiles/gemma3-270m-q4k-throughput-overlapped-probe.json +1 -0
  54. package/src/config/runtime/profiles/gemma3-270m-q4k-throughput-probe.json +1 -0
  55. package/src/config/runtime/profiles/gemma4-12b-rdrr-safe-b4.json +1 -3
  56. package/src/config/runtime/profiles/gemma4-12b-rdrr-safe-single.json +1 -3
  57. package/src/config/runtime/profiles/gemma4-31b-f16-activations-probe.json +1 -5
  58. package/src/config/runtime/profiles/gemma4-e2b-baseline-probe.json +1 -3
  59. package/src/config/runtime/profiles/gemma4-e2b-fused-rmsnorm-probe.json +1 -3
  60. package/src/config/runtime/profiles/gemma4-e2b-fused-rmsnorm-test.json +1 -0
  61. package/src/config/runtime/profiles/gemma4-e2b-int4ple-baseline-probe.json +1 -5
  62. package/src/config/runtime/profiles/gemma4-e2b-int4ple-f16a-probe.json +1 -5
  63. package/src/config/runtime/profiles/gemma4-e2b-int4ple-reference-export.json +1 -3
  64. package/src/config/runtime/profiles/gemma4-e2b-int4ple-retain-q4k-probe.json +1 -5
  65. package/src/config/runtime/profiles/gemma4-e2b-low-memory.json +1 -0
  66. package/src/config/runtime/profiles/gemma4-e2b-prefill-profile.json +1 -3
  67. package/src/config/runtime/profiles/gemma4-e2b-throughput-probe.json +1 -0
  68. package/src/config/runtime/profiles/low-memory.json +1 -0
  69. package/src/config/runtime/profiles/production.json +1 -3
  70. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-attn128-candidate.json +1 -0
  71. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-maxbatch64-candidate.json +1 -0
  72. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-normed-ffn-candidate.json +1 -0
  73. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-overlap-ringtokens1-candidate.json +1 -0
  74. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-parity.json +1 -0
  75. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-sequential-candidate.json +1 -0
  76. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-throughput.json +1 -0
  77. package/src/config/runtime/profiles/qwen-3-5-0-8b-prefill-profile.json +1 -3
  78. package/src/config/runtime/profiles/qwen-3-5-0-8b-throughput-probe.json +1 -0
  79. package/src/config/runtime/profiles/qwen-3-5-2b-f16-primary-throughput.json +1 -5
  80. package/src/config/runtime/profiles/qwen-3-5-2b-metal-parity.json +1 -0
  81. package/src/config/runtime/profiles/qwen-3-5-2b-metal-throughput.json +1 -0
  82. package/src/config/runtime/profiles/qwen-3-5-9b-metal-correctness.json +1 -0
  83. package/src/config/runtime/profiles/qwen-3-embedding-0-6b-metal-stability.json +1 -3
  84. package/src/config/runtime/profiles/qwen-3-embedding-0-6b-metal-throughput.json +1 -0
  85. package/src/config/runtime/profiles/qwen-3-reranker-0-6b-metal-stability.json +1 -0
  86. package/src/config/runtime/profiles/qwen-3-reranker-0-6b-metal-throughput.json +1 -0
  87. package/src/config/runtime/profiles/qwen3-6-27b-f16-activations-probe.json +1 -5
  88. package/src/config/runtime/profiles/rerank-stability.json +1 -3
  89. package/src/config/runtime/profiles/rerank-throughput.json +1 -3
  90. package/src/config/runtime/profiles/simulation.json +1 -3
  91. package/src/config/runtime/profiles/throughput.json +1 -3
  92. package/src/config/runtime/profiles/trace-layers.json +1 -3
  93. package/src/config/runtime/profiles/translategemma-1b-nativekd2-q4k-rdna3-throughput-probe.json +1 -0
  94. package/src/config/runtime/profiles/turboquant-contiguous-prod.json +1 -0
  95. package/src/config/runtime/profiles/turboquant-contiguous.json +1 -0
  96. package/src/config/runtime/profiles/turboquant.json +1 -0
  97. package/src/config/runtime/profiles/vector-stability.json +1 -3
  98. package/src/config/runtime/profiles/vector-throughput.json +1 -0
  99. package/src/config/runtime/profiles/verbose-trace.json +1 -3
  100. package/src/config/runtime/tiers/gemma4-128gb.json +1 -0
  101. package/src/config/runtime/tiers/gemma4-16gb.json +1 -0
  102. package/src/config/runtime/tiers/gemma4-24gb.json +1 -0
  103. package/src/config/runtime/tiers/gemma4-32gb.json +1 -0
  104. package/src/config/schema/benchmark.schema.d.ts +7 -0
  105. package/src/config/schema/benchmark.schema.js +5 -0
  106. package/src/config/schema/index.d.ts +8 -16
  107. package/src/config/schema/index.js +5 -8
  108. package/src/config/schema/kernel-thresholds.schema.d.ts +0 -12
  109. package/src/config/schema/kernel-thresholds.schema.js +0 -12
  110. package/src/config/schema/kernel-warmup.schema.d.ts +1 -3
  111. package/src/config/schema/kernel-warmup.schema.js +0 -1
  112. package/src/config/schema/runtime-profile.schema.d.ts +24 -0
  113. package/src/config/schema/runtime-profile.schema.js +92 -0
  114. package/src/config/schema/shared-runtime.schema.d.ts +1 -4
  115. package/src/config/schema/shared-runtime.schema.js +0 -2
  116. package/src/config/schema/tooling.schema.d.ts +8 -5
  117. package/src/config/schema/tooling.schema.js +3 -2
  118. package/src/debug/tensor.d.ts +2 -0
  119. package/src/debug/tensor.js +21 -2
  120. package/src/gpu/command-recorder.d.ts +5 -0
  121. package/src/gpu/command-recorder.js +17 -0
  122. package/src/gpu/kernel-runtime.js +2 -10
  123. package/src/gpu/kernels/index.d.ts +0 -2
  124. package/src/gpu/kernels/index.js +0 -2
  125. package/src/gpu/kernels/kernel-prewarm.d.ts +3 -0
  126. package/src/gpu/kernels/kernel-prewarm.js +60 -0
  127. package/src/gpu/kernels/utils.d.ts +2 -4
  128. package/src/gpu/kernels/utils.js +2 -4
  129. package/src/index.d.ts +13 -1
  130. package/src/index.js +7 -1
  131. package/src/inference/browser-harness-model-helpers.js +4 -0
  132. package/src/inference/browser-harness-runtime-helpers.js +25 -10
  133. package/src/inference/browser-harness-text-helpers.js +4 -1
  134. package/src/inference/browser-harness.d.ts +4 -0
  135. package/src/inference/browser-harness.js +91 -4
  136. package/src/inference/observation-context.d.ts +22 -0
  137. package/src/inference/observation-context.js +41 -0
  138. package/src/inference/pipelines/text/attention/attn-config.js +1 -1
  139. package/src/inference/pipelines/text/attention/executor-immediate.js +42 -0
  140. package/src/inference/pipelines/text/attention/executor-recorded.js +29 -0
  141. package/src/inference/pipelines/text/attention/index.js +7 -0
  142. package/src/inference/pipelines/text/attention/interpreter.js +1334 -0
  143. package/src/inference/pipelines/text/attention/plan.d.ts +36 -0
  144. package/src/inference/pipelines/text/attention/plan.js +328 -0
  145. package/src/inference/pipelines/text/attention/receipt.js +60 -0
  146. package/src/inference/pipelines/text/attention/record.js +8 -1278
  147. package/src/inference/pipelines/text/attention/run.js +8 -1386
  148. package/src/inference/pipelines/text/generator-decode-policy.js +4 -1
  149. package/src/inference/pipelines/text/generator-helpers.js +2 -0
  150. package/src/inference/pipelines/text/generator-steps.js +32 -15
  151. package/src/inference/pipelines/text/generator.js +10 -5
  152. package/src/inference/pipelines/text/init.d.ts +3 -0
  153. package/src/inference/pipelines/text/layer-plan-gpu.js +2 -0
  154. package/src/inference/pipelines/text/layer.js +2 -0
  155. package/src/inference/pipelines/text/model-load.d.ts +0 -1
  156. package/src/inference/pipelines/text/model-load.js +2 -11
  157. package/src/inference/pipelines/text/probes.js +10 -0
  158. package/src/inference/pipelines/text/resolved-runtime-session.d.ts +56 -0
  159. package/src/inference/pipelines/text/resolved-runtime-session.js +175 -0
  160. package/src/inference/pipelines/text/state.d.ts +6 -0
  161. package/src/inference/pipelines/text/state.js +3 -0
  162. package/src/inference/pipelines/text/types.d.ts +6 -0
  163. package/src/inference/pipelines/text.js +16 -1
  164. package/src/inference/refactor-receipt.d.ts +49 -0
  165. package/src/inference/refactor-receipt.js +188 -0
  166. package/src/inference/resource-scope.d.ts +33 -0
  167. package/src/inference/resource-scope.js +168 -0
  168. package/src/inference/test-harness.d.ts +3 -0
  169. package/src/inference/test-harness.js +1 -0
  170. package/src/storage/model-cache.d.ts +53 -0
  171. package/src/storage/model-cache.js +550 -0
  172. package/src/tooling/boundary-evidence.d.ts +51 -0
  173. package/src/tooling/boundary-evidence.js +408 -0
  174. package/src/tooling/browser-command-runner.js +4 -4
  175. package/src/tooling/command-context.d.ts +25 -0
  176. package/src/tooling/command-context.js +53 -0
  177. package/src/tooling/command-runner-shared.js +22 -5
  178. package/src/tooling/demo-receipts.d.ts +56 -0
  179. package/src/tooling/demo-receipts.js +113 -0
  180. package/src/tooling/diagnose-runner.js +2 -2
  181. package/src/tooling/execution-cost-ledger.d.ts +21 -0
  182. package/src/tooling/execution-cost-ledger.js +199 -0
  183. package/src/tooling/node-command-runner.js +2 -2
  184. package/src/tooling/opfs-cache.d.ts +11 -49
  185. package/src/tooling/opfs-cache.js +4 -510
  186. package/src/tooling/precision-replay-math.d.ts +42 -0
  187. package/src/tooling/precision-replay-math.js +174 -0
  188. package/src/tooling/program-bundle-parity.d.ts +3 -0
  189. package/src/tooling/program-bundle-parity.js +8 -0
  190. package/src/tooling/program-bundle.d.ts +1 -52
  191. package/src/tooling/program-bundle.js +0 -139
  192. package/src/tooling/registered-variant-calibration.d.ts +24 -0
  193. package/src/tooling/registered-variant-calibration.js +286 -0
  194. package/src/tooling/runtime-input-composition.js +105 -53
  195. package/src/tooling/runtime-intent.js +41 -0
  196. package/src/tooling/runtime-optimization-index.d.ts +6 -0
  197. package/src/tooling/runtime-optimization-index.js +72 -0
  198. package/src/tooling/runtime-optimization.d.ts +47 -6
  199. package/src/tooling/runtime-optimization.js +559 -40
  200. package/src/tooling/source-intake.d.ts +49 -0
  201. package/src/tooling/source-intake.js +414 -0
  202. package/src/tooling-exports/evidence.d.ts +34 -0
  203. package/src/tooling-exports/evidence.js +34 -0
  204. package/src/tooling-exports/runtime.d.ts +7 -0
  205. package/src/tooling-exports/runtime.js +7 -0
  206. package/src/tooling-exports.d.ts +11 -0
  207. package/src/tooling-exports.js +6 -3
  208. package/src/tooling-exports.shared.d.ts +32 -0
  209. package/src/tooling-exports.shared.js +31 -0
  210. package/src/version.js +1 -1
  211. package/src/config/schema/tuner.schema.d.ts +0 -39
  212. package/src/config/schema/tuner.schema.js +0 -13
  213. package/src/gpu/kernel-tuner/benchmarks.js +0 -902
  214. package/src/gpu/kernel-tuner/cache.js +0 -145
  215. package/src/gpu/kernel-tuner/index.js +0 -38
  216. package/src/gpu/kernel-tuner/tuner.js +0 -247
  217. package/src/gpu/kernel-tuner.js +0 -12
  218. package/src/gpu/kernels/kernel-tuning.d.ts +0 -42
  219. package/src/gpu/kernels/kernel-tuning.js +0 -158
  220. package/src/gpu/profiler.js +0 -382
  221. package/src/inference/pipelines/text/attention/output-gate-fusion.js +0 -37
package/README.md CHANGED
@@ -193,6 +193,9 @@ preserve program identity for downstream backends.
193
193
  ### Browser
194
194
 
195
195
  The live demo runs locally and works offline after its first model download.
196
+ Its public API boundary, observation tiers, generated PWA shell, and independent
197
+ contract/hardware smoke receipts are documented in
198
+ [demo/README.md](demo/README.md).
196
199
 
197
200
  ### CLI
198
201
 
@@ -209,6 +212,12 @@ The `dr` facade is the primary app API. Advanced APIs use package subpaths.
209
212
  ```js
210
213
  import { dr } from 'doppler-gpu';
211
214
 
215
+ // Explicit scoped API with a stable result envelope
216
+ const session = await dr.open('qwen3-0.8b');
217
+ const result = await session.generate('Describe WebGPU briefly');
218
+ console.log(result.outputText, result.fingerprint);
219
+ await session.close();
220
+
212
221
  // Stream tokens
213
222
  const model = await dr.load('qwen3-0.8b');
214
223
  for await (const token of model.generate('Describe WebGPU briefly')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doppler-gpu",
3
- "version": "0.4.15",
3
+ "version": "0.5.1",
4
4
  "description": "Browser-native WebGPU inference engine for local intent and inference loops",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -71,11 +71,18 @@
71
71
  "test:coverage": "node tools/run-node-coverage.js",
72
72
  "test:coverage:report": "node tools/run-node-coverage.js --no-threshold",
73
73
  "test:gpu:browser": "node src/cli/doppler-cli.js verify --config '{\"request\":{\"workload\":\"kernels\"},\"run\":{\"surface\":\"browser\",\"browser\":{\"opfsCache\":false,\"headless\":true,\"channel\":\"chromium\",\"browserArgs\":[\"--use-angle=swiftshader\",\"--disable-vulkan-surface\"],\"console\":true}}}'",
74
+ "demo:shell:generate": "node tools/generate-demo-shell-manifest.js",
75
+ "demo:shell:check": "node tools/generate-demo-shell-manifest.js --check",
76
+ "demo:reachability:check": "node tools/check-demo-reachability.js",
77
+ "test:demo:contract": "node tools/demo-contract-smoke.js",
78
+ "test:demo:hardware": "node tools/demo-hardware-smoke.js",
74
79
  "agents:verify": "node tools/verify-agent-parity.js",
75
80
  "agents:freshness": "node tools/verify-agent-freshness.js",
76
81
  "agents:freshness:strict": "node tools/verify-agent-freshness.js --strict",
77
82
  "conflicts:check": "node tools/check-merge-markers.js",
78
83
  "config:single-source:check": "node tools/check-config-single-source.js",
84
+ "evidence:workflows:check": "node tools/check-evidence-workflow-ownership.js",
85
+ "inference:boundaries:check": "node tools/check-inference-boundaries.js",
79
86
  "capability-policy:check": "node tools/check-capability-transform-policy.js",
80
87
  "imports:check:browser": "node tools/check-browser-import-graph.js",
81
88
  "api:docs:sync": "node tools/sync-api-docs.js",
@@ -89,7 +96,7 @@
89
96
  "goals:check": "node tools/check-goal-completion.js",
90
97
  "goals:report": "node tools/render-goal-completion-summary.js",
91
98
  "commands:surface:check": "node tools/check-command-surface-contract.js",
92
- "check:green": "npm run agents:verify && npm run goals:check && npm run public:boundaries:check && npm run package:smoke && npm run commands:surface:check && npm run api:docs:check && npm run config:single-source:check && npm run capability-policy:check && npm run imports:check:browser && npm run pending:check && npm run exports:parity:check && npm run artifact:contract:check && npm run adapter-artifacts:check && npm run claims:evidence:check && npm run support:subsystems:check && npm run policy:schemas:check",
99
+ "check:green": "npm run agents:verify && npm run goals:check && npm run public:boundaries:check && npm run package:smoke && npm run commands:surface:check && npm run api:docs:check && npm run config:single-source:check && npm run evidence:workflows:check && npm run inference:boundaries:check && npm run capability-policy:check && npm run imports:check:browser && npm run pending:check && npm run exports:parity:check && npm run artifact:contract:check && npm run adapter-artifacts:check && npm run claims:evidence:check && npm run support:subsystems:check && npm run policy:schemas:check",
93
100
  "verify:model": "node src/cli/doppler-cli.js verify",
94
101
  "quickstart:sync": "node tools/sync-quickstart-registry.js",
95
102
  "quickstart:check": "node tools/sync-quickstart-registry.js --check",
@@ -100,6 +107,7 @@
100
107
  "bench:vendors:validate": "node tools/vendor-bench.js validate",
101
108
  "bench:local-gpu:challengers": "node tools/local-gpu-challengers.js",
102
109
  "bench:local-gpu:challengers:check": "node tools/local-gpu-challengers.js --check",
110
+ "optimization:index": "node tools/build-runtime-optimization-index.js",
103
111
  "bench:embeddings:compare": "node tools/compare-embeddings.js",
104
112
  "bench:rerank:compare": "node tools/compare-rerankers.js",
105
113
  "bench:rerank:compare:hf": "node tools/compare-rerankers-hf.js",
@@ -242,6 +250,14 @@
242
250
  "types": "./src/tooling-exports/manifest.d.ts",
243
251
  "import": "./src/tooling-exports/manifest.js"
244
252
  },
253
+ "./tooling/runtime": {
254
+ "types": "./src/tooling-exports/runtime.d.ts",
255
+ "import": "./src/tooling-exports/runtime.js"
256
+ },
257
+ "./tooling/evidence": {
258
+ "types": "./src/tooling-exports/evidence.d.ts",
259
+ "import": "./src/tooling-exports/evidence.js"
260
+ },
245
261
  "./structured": {
246
262
  "types": "./src/tooling-exports/structured.d.ts",
247
263
  "import": "./src/tooling-exports/structured.js"
@@ -359,6 +375,13 @@
359
375
  "playwright": "^1.58.2",
360
376
  "typescript": "^6.0.2"
361
377
  },
378
+ "overrides": {
379
+ "adm-zip": "^0.6.0",
380
+ "brace-expansion": "^5.0.8",
381
+ "glob": "^13.0.6",
382
+ "minimatch": "^10.2.5",
383
+ "sharp": "^0.35.3"
384
+ },
362
385
  "optionalDependencies": {
363
386
  "doe-gpu": "^0.4.2",
364
387
  "webgpu": "^0.4.0"
@@ -5,7 +5,7 @@ import path from 'node:path';
5
5
  import { fileURLToPath, pathToFileURL } from 'node:url';
6
6
  import { runNodeCommand } from '../tooling/node-command-runner.js';
7
7
  import { runBrowserCommandInNode } from '../tooling/node-browser-command-runner.js';
8
- import { writeProgramBundle, writeReferenceReceipt } from '../tooling/program-bundle.js';
8
+ import { writeProgramBundle } from '../tooling/program-bundle.js';
9
9
  import {
10
10
  TOOLING_COMMANDS,
11
11
  normalizeToolingCommandRequest,
@@ -86,8 +86,11 @@ function usage() {
86
86
  ' doppler distill --config <path|url|json> [--surface auto|node]',
87
87
  ' doppler program-bundle --config <path|json>',
88
88
  ' doppler program-bundle --manifest <path> --reference-report <path> --out <path> [--conversion-config <path>]',
89
- ' doppler reference-receipt --config <path|json>',
90
- ' doppler reference-receipt --manifest <path> --reference-transcript <path> --out <path>',
89
+ ' doppler onboard inspect --source <checkpoint-dir> --out <dir> [--family-intake <source-intake.json>]',
90
+ ' doppler boundary capture --report <diagnose-report.json> --out <runtime-boundaries.json>',
91
+ ' doppler boundary source-pack --provider-capture <provider-capture.json> --out <source-boundaries.json>',
92
+ ' doppler boundary token-evidence --reference-transcript <reference-transcript.json> --out <token-evidence.json>',
93
+ ' doppler boundary compare --source-pack <source-boundaries.json> --runtime-capture <runtime-boundaries.json> --token-evidence <json> --out <receipt.json>',
91
94
  ' doppler intake --convert-config <path|json> [--manifest <path>] [--out <intake-report.json>]',
92
95
  ' doppler bundle --manifest <path> --out <dir> [--prompt <text>] [--max-tokens <n>] [--surface node|browser]',
93
96
  ' doppler bundle --convert-config <path|json> --out <dir>',
@@ -123,6 +126,7 @@ function usage() {
123
126
  function parseArgs(argv) {
124
127
  const out = {
125
128
  command: null,
129
+ action: null,
126
130
  flags: {},
127
131
  };
128
132
 
@@ -139,6 +143,10 @@ function parseArgs(argv) {
139
143
  throw new Error(`Unsupported short flag "${token}". Use long-form flags (for example --help).`);
140
144
  }
141
145
  if (!token.startsWith('--')) {
146
+ if ((out.command === 'onboard' || out.command === 'boundary') && out.action === null) {
147
+ out.action = token;
148
+ continue;
149
+ }
142
150
  throw new Error('Positional arguments are not supported. Use --config for command payloads.');
143
151
  }
144
152
 
@@ -280,6 +288,120 @@ function validateIntakeFlags(parsed) {
280
288
  }
281
289
  }
282
290
 
291
+ function validateOnboardFlags(parsed) {
292
+ if (parsed.action !== 'inspect') {
293
+ throw new Error('onboard: expected the action "inspect".');
294
+ }
295
+ const allowedFlags = new Set([
296
+ 'source',
297
+ 'out',
298
+ 'family-intake',
299
+ 'pretty',
300
+ 'json',
301
+ 'help',
302
+ 'h',
303
+ ]);
304
+ for (const key of Object.keys(parsed.flags || {})) {
305
+ if (allowedFlags.has(key)) continue;
306
+ throw new Error(`Unknown flag --${key} for "onboard inspect".`);
307
+ }
308
+ if (!asStringOrNull(parsed.flags.source)) {
309
+ throw new Error('onboard inspect: --source <checkpoint-dir> is required.');
310
+ }
311
+ if (!asStringOrNull(parsed.flags.out)) {
312
+ throw new Error('onboard inspect: --out <dir> is required.');
313
+ }
314
+ }
315
+
316
+ function validateBoundaryFlags(parsed) {
317
+ const captureFlags = new Set([
318
+ 'report',
319
+ 'out',
320
+ 'tolerance-policy',
321
+ 'pretty',
322
+ 'json',
323
+ 'help',
324
+ 'h',
325
+ ]);
326
+ const compareFlags = new Set([
327
+ 'source-pack',
328
+ 'runtime-capture',
329
+ 'source-control',
330
+ 'token-evidence',
331
+ 'artifact-precision',
332
+ 'out',
333
+ 'pretty',
334
+ 'json',
335
+ 'help',
336
+ 'h',
337
+ ]);
338
+ const tokenEvidenceFlags = new Set([
339
+ 'reference-transcript',
340
+ 'out',
341
+ 'pretty',
342
+ 'json',
343
+ 'help',
344
+ 'h',
345
+ ]);
346
+ const sourcePackFlags = new Set([
347
+ 'provider-capture',
348
+ 'out',
349
+ 'pretty',
350
+ 'json',
351
+ 'help',
352
+ 'h',
353
+ ]);
354
+ const allowedFlags = parsed.action === 'capture'
355
+ ? captureFlags
356
+ : (
357
+ parsed.action === 'compare'
358
+ ? compareFlags
359
+ : (
360
+ parsed.action === 'token-evidence'
361
+ ? tokenEvidenceFlags
362
+ : (parsed.action === 'source-pack' ? sourcePackFlags : null)
363
+ )
364
+ );
365
+ if (!allowedFlags) {
366
+ throw new Error(
367
+ 'boundary: expected "capture", "source-pack", "token-evidence", or "compare".'
368
+ );
369
+ }
370
+ for (const key of Object.keys(parsed.flags || {})) {
371
+ if (allowedFlags.has(key)) continue;
372
+ throw new Error(`Unknown flag --${key} for "boundary ${parsed.action}".`);
373
+ }
374
+ if (!asStringOrNull(parsed.flags.out)) {
375
+ throw new Error(`boundary ${parsed.action}: --out <path> is required.`);
376
+ }
377
+ if (parsed.action === 'capture' && !asStringOrNull(parsed.flags.report)) {
378
+ throw new Error('boundary capture: --report <diagnose-report.json> is required.');
379
+ }
380
+ if (
381
+ parsed.action === 'source-pack'
382
+ && !asStringOrNull(parsed.flags['provider-capture'])
383
+ ) {
384
+ throw new Error(
385
+ 'boundary source-pack: --provider-capture <provider-capture.json> is required.'
386
+ );
387
+ }
388
+ if (
389
+ parsed.action === 'token-evidence'
390
+ && !asStringOrNull(parsed.flags['reference-transcript'])
391
+ ) {
392
+ throw new Error(
393
+ 'boundary token-evidence: --reference-transcript <reference-transcript.json> is required.'
394
+ );
395
+ }
396
+ if (parsed.action === 'compare') {
397
+ for (const key of ['source-pack', 'runtime-capture', 'token-evidence']) {
398
+ if (!asStringOrNull(parsed.flags[key])) {
399
+ throw new Error(`boundary compare: --${key} <path> is required.`);
400
+ }
401
+ }
402
+ }
403
+ }
404
+
283
405
  function validateBundleFlags(parsed) {
284
406
  const allowedFlags = new Set([
285
407
  'convert-config',
@@ -293,7 +415,6 @@ function validateBundleFlags(parsed) {
293
415
  'runtime-config',
294
416
  'out',
295
417
  'bundle-id',
296
- 'receipt-id',
297
418
  'created-at',
298
419
  'skip-convert',
299
420
  'skip-capture',
@@ -310,26 +431,6 @@ function validateBundleFlags(parsed) {
310
431
  }
311
432
  }
312
433
 
313
- function validateReferenceReceiptFlags(parsed) {
314
- const allowedFlags = new Set([
315
- 'config',
316
- 'manifest',
317
- 'model-dir',
318
- 'reference-transcript',
319
- 'out',
320
- 'receipt-id',
321
- 'created-at',
322
- 'pretty',
323
- 'json',
324
- 'help',
325
- 'h',
326
- ]);
327
- for (const key of Object.keys(parsed.flags || {})) {
328
- if (allowedFlags.has(key)) continue;
329
- throw new Error(`Unknown flag --${key} for "reference-receipt".`);
330
- }
331
- }
332
-
333
434
  function validateProfilesFlags(parsed) {
334
435
  const allowedFlags = new Set([
335
436
  'pretty',
@@ -703,44 +804,130 @@ async function runIntakeCommand(parsed, jsonOutput) {
703
804
  }
704
805
  }
705
806
 
706
- async function buildReferenceReceiptOptions(parsed) {
707
- const repoRoot = path.resolve(fileURLToPath(new URL('../..', import.meta.url)));
708
- const configValue = asStringOrNull(parsed.flags.config);
709
- const config = configValue
710
- ? await readJsonObjectInput(configValue, '--config')
711
- : {};
712
- return {
713
- repoRoot,
714
- ...config,
715
- manifestPath: parsed.flags.manifest ?? config.manifestPath ?? null,
716
- modelDir: parsed.flags['model-dir'] ?? config.modelDir ?? null,
717
- referenceTranscriptPath:
718
- parsed.flags['reference-transcript'] ?? config.referenceTranscriptPath ?? null,
719
- outputPath: parsed.flags.out ?? config.outputPath ?? config.out ?? null,
720
- receiptId: parsed.flags['receipt-id'] ?? config.receiptId ?? null,
721
- createdAtUtc: parsed.flags['created-at'] ?? config.createdAtUtc ?? null,
807
+ async function runOnboardInspectCommand(parsed, jsonOutput) {
808
+ const { inspectSourceModel } = await import('../tooling/source-intake.js');
809
+ const policyPath = fileURLToPath(
810
+ new URL('../config/evidence/source-intake-policy.json', import.meta.url)
811
+ );
812
+ const policy = await readJsonObjectFile(policyPath, 'source intake policy');
813
+ const familyIntakePath = asStringOrNull(parsed.flags['family-intake']);
814
+ const familyIntake = familyIntakePath
815
+ ? await readJsonObjectFile(path.resolve(familyIntakePath), '--family-intake')
816
+ : null;
817
+ const result = await inspectSourceModel({
818
+ sourceDir: path.resolve(parsed.flags.source),
819
+ policy,
820
+ familyIntake,
821
+ });
822
+ const outputDir = path.resolve(parsed.flags.out);
823
+ await fs.mkdir(outputDir, { recursive: true });
824
+ const outputs = {
825
+ intake: path.join(outputDir, 'source-intake.json'),
826
+ conversion: path.join(outputDir, 'conversion-config.skeleton.json'),
827
+ contractTests: path.join(outputDir, 'contract-tests.plan.json'),
722
828
  };
723
- }
724
-
725
- async function runReferenceReceiptCommand(parsed, jsonOutput) {
726
- const result = await writeReferenceReceipt(await buildReferenceReceiptOptions(parsed));
829
+ await Promise.all([
830
+ fs.writeFile(outputs.intake, `${JSON.stringify(result.report, null, 2)}\n`, 'utf8'),
831
+ fs.writeFile(outputs.conversion, `${JSON.stringify(result.artifacts.conversion, null, 2)}\n`, 'utf8'),
832
+ fs.writeFile(outputs.contractTests, `${JSON.stringify(result.artifacts.contractTests, null, 2)}\n`, 'utf8'),
833
+ ]);
727
834
  const summary = {
728
- ok: true,
729
- outputPath: path.relative(process.cwd(), result.outputPath),
730
- modelId: result.receipt.modelId,
731
- receiptId: result.receipt.receiptId,
732
- executionGraphHash: result.receipt.sources.executionGraph.hash,
733
- tokensGenerated: result.receipt.referenceTranscript?.output?.tokensGenerated ?? null,
734
- stopReason: result.receipt.referenceTranscript?.output?.stopReason ?? null,
835
+ ...result.report,
836
+ outputPaths: Object.fromEntries(
837
+ Object.entries(outputs).map(([key, value]) => [key, path.relative(process.cwd(), value)])
838
+ ),
735
839
  };
736
840
  if (jsonOutput) {
737
841
  console.log(JSON.stringify(summary, null, 2));
738
- return;
842
+ } else {
843
+ const status = result.report.ok ? 'ok' : 'review';
844
+ console.log(
845
+ `[${status}] source intake wrote ${path.relative(process.cwd(), outputDir)} ` +
846
+ `(${result.report.summary.accepted} accepted, ${result.report.summary.unresolved} unresolved)`
847
+ );
739
848
  }
740
- console.log(
741
- `[ok] wrote ${summary.outputPath} ` +
742
- `(modelId=${summary.modelId}, tokens=${summary.tokensGenerated}, stopReason=${summary.stopReason})`
849
+ if (!result.report.ok) process.exitCode = 1;
850
+ }
851
+
852
+ async function runBoundaryCommand(parsed, jsonOutput) {
853
+ const {
854
+ buildDeterministicTokenEvidenceFromReferenceTranscript,
855
+ buildRuntimeBoundaryCapture,
856
+ buildSourceBoundaryPackFromProviderCapture,
857
+ compareBoundaryEvidence,
858
+ } = await import('../tooling/boundary-evidence.js');
859
+ const policyPath = fileURLToPath(
860
+ new URL('../config/evidence/boundary-evidence-policy.json', import.meta.url)
743
861
  );
862
+ const policy = await readJsonObjectFile(policyPath, 'boundary evidence policy');
863
+ let result;
864
+ if (parsed.action === 'capture') {
865
+ const report = await readJsonObjectFile(
866
+ path.resolve(parsed.flags.report),
867
+ '--report'
868
+ );
869
+ result = buildRuntimeBoundaryCapture({
870
+ report,
871
+ policy,
872
+ tolerancePolicyId: asStringOrNull(parsed.flags['tolerance-policy'])
873
+ ?? 'doppler.boundary-tolerance/source-f16-v1',
874
+ });
875
+ } else if (parsed.action === 'source-pack') {
876
+ const providerCapture = await readJsonObjectFile(
877
+ path.resolve(parsed.flags['provider-capture']),
878
+ '--provider-capture'
879
+ );
880
+ result = buildSourceBoundaryPackFromProviderCapture(providerCapture);
881
+ } else if (parsed.action === 'token-evidence') {
882
+ const transcript = await readJsonObjectFile(
883
+ path.resolve(parsed.flags['reference-transcript']),
884
+ '--reference-transcript'
885
+ );
886
+ result = buildDeterministicTokenEvidenceFromReferenceTranscript(transcript);
887
+ } else {
888
+ const [sourcePack, runtimeCapture, tokenEvidence] = await Promise.all([
889
+ readJsonObjectFile(path.resolve(parsed.flags['source-pack']), '--source-pack'),
890
+ readJsonObjectFile(path.resolve(parsed.flags['runtime-capture']), '--runtime-capture'),
891
+ readJsonObjectFile(path.resolve(parsed.flags['token-evidence']), '--token-evidence'),
892
+ ]);
893
+ const sourceControlPath = asStringOrNull(parsed.flags['source-control']);
894
+ const sourcePrecisionControlReceipt = sourceControlPath
895
+ ? await readJsonObjectFile(path.resolve(sourceControlPath), '--source-control')
896
+ : null;
897
+ result = compareBoundaryEvidence({
898
+ sourcePack,
899
+ runtimeCapture,
900
+ policy,
901
+ artifactPrecision: asStringOrNull(parsed.flags['artifact-precision']) ?? 'source',
902
+ sourcePrecisionControlReceipt,
903
+ deterministicTokenEvidence: tokenEvidence,
904
+ });
905
+ }
906
+ const outputPath = path.resolve(parsed.flags.out);
907
+ await fs.mkdir(path.dirname(outputPath), { recursive: true });
908
+ await fs.writeFile(outputPath, `${JSON.stringify(result, null, 2)}\n`, 'utf8');
909
+ if (jsonOutput) {
910
+ console.log(JSON.stringify({ ...result, outputPath: path.relative(process.cwd(), outputPath) }, null, 2));
911
+ } else if (parsed.action === 'capture') {
912
+ console.log(`[ok] captured ${result.boundaries.length} semantic boundaries`);
913
+ } else if (parsed.action === 'source-pack') {
914
+ console.log(`[ok] source pack contains ${result.boundaries.length} semantic boundaries`);
915
+ } else if (parsed.action === 'token-evidence') {
916
+ const status = result.exact ? 'ok' : 'fail';
917
+ console.log(`[${status}] token evidence covers ${result.tokenCount} tokens`);
918
+ } else {
919
+ const status = result.promotionGate.passed ? 'ok' : 'fail';
920
+ console.log(
921
+ `[${status}] boundary comparison ` +
922
+ `(first divergence: ${result.firstDivergence?.boundaryId ?? 'none'})`
923
+ );
924
+ }
925
+ if (
926
+ (parsed.action === 'compare' && !result.promotionGate.passed)
927
+ || (parsed.action === 'token-evidence' && !result.exact)
928
+ ) {
929
+ process.exitCode = 1;
930
+ }
744
931
  }
745
932
 
746
933
  async function runProfilesCommand(jsonOutput) {
@@ -845,7 +1032,7 @@ async function runBundleCommand(parsed, jsonOutput) {
845
1032
  writeReferenceTranscript,
846
1033
  normalizeModelUrl,
847
1034
  } = await import('../tooling/reference-verify.js');
848
- const { writeProgramBundle, writeReferenceReceipt } = await import('../tooling/program-bundle.js');
1035
+ const { writeProgramBundle } = await import('../tooling/program-bundle.js');
849
1036
  const fsMod = await import('node:fs/promises');
850
1037
 
851
1038
  const outDir = asStringOrNull(parsed.flags.out);
@@ -1013,39 +1200,6 @@ async function runBundleCommand(parsed, jsonOutput) {
1013
1200
  return emitBundleSummary({ ok: false, stages, blockers, artifactPaths, jsonOutput, resolvedOut });
1014
1201
  }
1015
1202
 
1016
- stages.push({ stage: 'receipt', status: 'starting' });
1017
- try {
1018
- const receiptOutputPath = path.join(resolvedOut, 'reference-receipt.json');
1019
- const receiptResult = await writeReferenceReceipt({
1020
- repoRoot,
1021
- manifestPath,
1022
- modelDir: modelDirResolved,
1023
- referenceTranscriptPath: artifactPaths.referenceTranscript
1024
- ? path.resolve(artifactPaths.referenceTranscript)
1025
- : referenceTranscriptPath,
1026
- outputPath: receiptOutputPath,
1027
- receiptId: asStringOrNull(parsed.flags['receipt-id']),
1028
- createdAtUtc: asStringOrNull(parsed.flags['created-at']),
1029
- });
1030
- artifactPaths.referenceReceipt = path.relative(process.cwd(), receiptResult.outputPath);
1031
- stages[stages.length - 1] = {
1032
- stage: 'receipt',
1033
- status: 'succeeded',
1034
- receiptId: receiptResult.receipt.receiptId,
1035
- executionGraphHash: receiptResult.receipt.sources.executionGraph.hash,
1036
- tokensGenerated: receiptResult.receipt.referenceTranscript?.output?.tokensGenerated ?? null,
1037
- stopReason: receiptResult.receipt.referenceTranscript?.output?.stopReason ?? null,
1038
- };
1039
- } catch (error) {
1040
- stages[stages.length - 1] = {
1041
- stage: 'receipt',
1042
- status: 'failed',
1043
- error: error?.message || String(error),
1044
- };
1045
- blockers.push({ stage: 'receipt', code: 'receipt_write_failed', message: error?.message || String(error) });
1046
- return emitBundleSummary({ ok: false, stages, blockers, artifactPaths, jsonOutput, resolvedOut });
1047
- }
1048
-
1049
1203
  stages.push({ stage: 'parity', status: 'starting' });
1050
1204
  try {
1051
1205
  const { checkProgramBundleParity } = await import('../tooling/program-bundle-parity.js');
@@ -1715,16 +1869,21 @@ async function main() {
1715
1869
  await runProgramBundleCommand(parsed, parsed.flags.pretty !== true);
1716
1870
  return;
1717
1871
  }
1718
- if (parsed.command === 'reference-receipt') {
1719
- validateReferenceReceiptFlags(parsed);
1720
- await runReferenceReceiptCommand(parsed, parsed.flags.pretty !== true);
1721
- return;
1722
- }
1723
1872
  if (parsed.command === 'profiles') {
1724
1873
  validateProfilesFlags(parsed);
1725
1874
  await runProfilesCommand(parsed.flags.pretty !== true);
1726
1875
  return;
1727
1876
  }
1877
+ if (parsed.command === 'onboard') {
1878
+ validateOnboardFlags(parsed);
1879
+ await runOnboardInspectCommand(parsed, parsed.flags.pretty !== true);
1880
+ return;
1881
+ }
1882
+ if (parsed.command === 'boundary') {
1883
+ validateBoundaryFlags(parsed);
1884
+ await runBoundaryCommand(parsed, parsed.flags.pretty !== true);
1885
+ return;
1886
+ }
1728
1887
  if (parsed.command === 'intake') {
1729
1888
  validateIntakeFlags(parsed);
1730
1889
  await runIntakeCommand(parsed, parsed.flags.pretty !== true);
@@ -95,8 +95,6 @@ function compareProfiles(a, b) {
95
95
 
96
96
  function toProfileSummary(profile, filePath, rootDir) {
97
97
  const runtime = profile.runtime;
98
- const shared = isPlainObject(runtime?.shared) ? runtime.shared : {};
99
- const tooling = isPlainObject(shared.tooling) ? shared.tooling : {};
100
98
  const relativePath = path.relative(process.cwd(), filePath).split(path.sep).join('/');
101
99
  const rootRelativePath = path.relative(rootDir, filePath).split(path.sep).join('/');
102
100
  const signals = summarizeSignals(runtime);
@@ -109,11 +107,9 @@ function toProfileSummary(profile, filePath, rootDir) {
109
107
  : null
110
108
  ),
111
109
  intent: typeof profile.intent === 'string' && profile.intent.trim() ? profile.intent.trim() : null,
112
- toolingIntent: (
113
- typeof tooling.intent === 'string' && tooling.intent.trim()
114
- ? tooling.intent.trim()
115
- : null
116
- ),
110
+ compatibleIntents: Array.isArray(profile.compatibleIntents)
111
+ ? profile.compatibleIntents.filter((intent) => typeof intent === 'string' && intent.trim())
112
+ : [],
117
113
  stability: (
118
114
  typeof profile.stability === 'string' && profile.stability.trim()
119
115
  ? profile.stability.trim()
@@ -8,6 +8,10 @@ import type {
8
8
  DopplerLoadProgress,
9
9
  DopplerModelHandle,
10
10
  DopplerModelSource,
11
+ DopplerGenerationResult,
12
+ DopplerPromptInput,
13
+ DopplerScopedGenerateOptions,
14
+ DopplerScopedModelSession,
11
15
  LoRAManifest,
12
16
  } from './runtime/index.js';
13
17
 
@@ -23,12 +27,21 @@ export type DopplerModel = DopplerModelHandle;
23
27
  export interface DopplerNamespace {
24
28
  (prompt: string, options: DopplerCallOptions): AsyncGenerator<string, void, void>;
25
29
  load(model: DopplerModelSource, options?: DopplerLoadOptions): Promise<DopplerModel>;
30
+ open(model: DopplerModelSource, options?: DopplerLoadOptions): Promise<DopplerScopedModelSession>;
31
+ generate(
32
+ model: DopplerModelSource,
33
+ input: DopplerPromptInput,
34
+ options?: DopplerLoadOptions & DopplerScopedGenerateOptions
35
+ ): Promise<DopplerGenerationResult>;
26
36
  text(prompt: string, options: DopplerCallOptions): Promise<string>;
27
37
  chat(messages: ChatMessage[], options: DopplerCallOptions): AsyncGenerator<string, void, void>;
28
38
  chatText(messages: ChatMessage[], options: DopplerCallOptions): Promise<DopplerChatResponse>;
29
39
  evict(model: DopplerModelSource): Promise<boolean>;
30
40
  evictAll(): Promise<void>;
31
41
  listModels(): Promise<string[]>;
42
+ listModelDetails(): Promise<Array<Record<string, unknown> & { modelId: string }>>;
43
+ listPersistentModels(): Promise<Array<Record<string, unknown> & { modelId: string }>>;
44
+ removePersistentModel(model: DopplerModelSource): Promise<boolean>;
32
45
  }
33
46
 
34
47
  export declare function load(
@@ -36,6 +49,17 @@ export declare function load(
36
49
  options?: DopplerLoadOptions
37
50
  ): Promise<DopplerModel>;
38
51
 
52
+ export declare function open(
53
+ model: DopplerModelSource,
54
+ options?: DopplerLoadOptions
55
+ ): Promise<DopplerScopedModelSession>;
56
+
57
+ export declare function generate(
58
+ model: DopplerModelSource,
59
+ input: DopplerPromptInput,
60
+ options?: DopplerLoadOptions & DopplerScopedGenerateOptions
61
+ ): Promise<DopplerGenerationResult>;
62
+
39
63
  export declare function createDefaultNodeLoadProgressLogger(): (event: DopplerLoadProgress) => void;
40
64
 
41
65
  export declare function resolveLoadProgressHandlers(options?: DopplerLoadOptions): {
@@ -52,6 +76,10 @@ export type {
52
76
  DopplerLoadOptions,
53
77
  DopplerLoadProgress,
54
78
  DopplerModelSource,
79
+ DopplerGenerationResult,
80
+ DopplerPromptInput,
81
+ DopplerScopedGenerateOptions,
82
+ DopplerScopedModelSession,
55
83
  };
56
84
 
57
85
  export type {
@@ -23,6 +23,8 @@ const runtime = createDopplerRuntimeService({
23
23
 
24
24
  export const doppler = runtime.doppler;
25
25
  export const load = runtime.load;
26
+ export const open = runtime.open;
27
+ export const generate = runtime.generate;
26
28
  export const clearModelCache = runtime.clearModelCache;
27
29
  export { createDefaultNodeLoadProgressLogger };
28
30