doppler-gpu 0.4.14 → 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.
- package/CHANGELOG.md +9 -0
- package/README.md +83 -52
- package/package.json +25 -2
- package/src/cli/doppler-cli.js +253 -94
- package/src/cli/runtime-profiles.js +3 -7
- package/src/client/doppler-api.d.ts +28 -0
- package/src/client/doppler-api.js +2 -0
- package/src/client/inspection.d.ts +122 -0
- package/src/client/inspection.js +343 -0
- package/src/client/runtime/index.d.ts +54 -0
- package/src/client/runtime/index.js +190 -18
- package/src/client/runtime/model-manager.d.ts +0 -4
- package/src/client/runtime/model-manager.js +0 -28
- package/src/client/runtime/model-session.d.ts +116 -1
- package/src/client/runtime/model-session.js +351 -1
- package/src/client/runtime/model-source.d.ts +10 -1
- package/src/client/runtime/scoped-session.d.ts +117 -0
- package/src/client/runtime/scoped-session.js +257 -0
- package/src/client/runtime/types.d.ts +0 -1
- package/src/client/runtime/types.js +0 -1
- package/src/config/evidence/boundary-evidence-policy.json +54 -0
- package/src/config/evidence/source-intake-policy.json +122 -0
- package/src/config/inspection/observation-policies.json +80 -0
- package/src/config/param-validator.js +21 -36
- package/src/config/runtime/compute/f16-activations.json +1 -0
- package/src/config/runtime/compute/f16-batched.json +1 -0
- package/src/config/runtime/default.json +1 -0
- package/src/config/runtime/diagnostics/debug-logits.json +1 -0
- package/src/config/runtime/experiments/bench/gemma3-bench-q4k-alt.json +1 -0
- package/src/config/runtime/experiments/bench/gemma3-bench-q4k-batched.json +1 -0
- package/src/config/runtime/experiments/bench/gemma3-bench-q4k.json +1 -0
- package/src/config/runtime/experiments/bench/gemma4-bench-q4k.json +1 -0
- package/src/config/runtime/experiments/bench/qwen3-bench-q4k-alt.json +1 -0
- package/src/config/runtime/experiments/bench/qwen3-bench-q4k-batched.json +1 -0
- package/src/config/runtime/experiments/debug/gemma3-browser-diagnose-q4k.json +1 -1
- package/src/config/runtime/experiments/debug/gemma3-debug-q4k.json +1 -3
- package/src/config/runtime/experiments/debug/gemma4-e2b-browser-diagnose-q4k.json +1 -1
- package/src/config/runtime/experiments/debug/qwen35-browser-diagnose-q4k.json +1 -1
- package/src/config/runtime/experiments/verify/gemma3-verify.json +1 -3
- package/src/config/runtime/experiments/verify/gemma4-e2b-verify.json +1 -3
- package/src/config/runtime/experiments/verify/lfm2-verify.json +1 -3
- package/src/config/runtime/experiments/verify/translategemma-verify.json +1 -3
- package/src/config/runtime/model/gemma2-debug.json +1 -0
- package/src/config/runtime/model/gemma2-pipeline-debug.json +1 -0
- package/src/config/runtime/model/gemma2-pipeline.json +1 -0
- package/src/config/runtime/model/gemma3-layer-probe.json +1 -0
- package/src/config/runtime/model/qwen3-5-layer-probe.json +1 -0
- package/src/config/runtime/model/qwen3-5-layer3-boundary-probe.json +1 -0
- package/src/config/runtime/model/qwen3-5-linear-attn-debug.json +1 -0
- package/src/config/runtime/optimization-candidates/registry.json +5 -0
- package/src/config/runtime/platform/metal-apple-q4k.json +1 -0
- package/src/config/runtime/profiles/default.json +1 -0
- package/src/config/runtime/profiles/diffusiongemma-26b-a4b-throughput.json +1 -0
- package/src/config/runtime/profiles/gemma3-270m-q4k-throughput-overlapped-probe.json +1 -0
- package/src/config/runtime/profiles/gemma3-270m-q4k-throughput-probe.json +1 -0
- package/src/config/runtime/profiles/gemma4-12b-rdrr-safe-b4.json +1 -3
- package/src/config/runtime/profiles/gemma4-12b-rdrr-safe-single.json +1 -3
- package/src/config/runtime/profiles/gemma4-31b-f16-activations-probe.json +1 -5
- package/src/config/runtime/profiles/gemma4-e2b-baseline-probe.json +1 -3
- package/src/config/runtime/profiles/gemma4-e2b-fused-rmsnorm-probe.json +1 -3
- package/src/config/runtime/profiles/gemma4-e2b-fused-rmsnorm-test.json +1 -0
- package/src/config/runtime/profiles/gemma4-e2b-int4ple-baseline-probe.json +1 -5
- package/src/config/runtime/profiles/gemma4-e2b-int4ple-f16a-probe.json +1 -5
- package/src/config/runtime/profiles/gemma4-e2b-int4ple-reference-export.json +1 -3
- package/src/config/runtime/profiles/gemma4-e2b-int4ple-retain-q4k-probe.json +1 -5
- package/src/config/runtime/profiles/gemma4-e2b-low-memory.json +1 -0
- package/src/config/runtime/profiles/gemma4-e2b-prefill-profile.json +1 -3
- package/src/config/runtime/profiles/gemma4-e2b-throughput-probe.json +1 -0
- package/src/config/runtime/profiles/low-memory.json +1 -0
- package/src/config/runtime/profiles/production.json +1 -3
- package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-attn128-candidate.json +1 -0
- package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-maxbatch64-candidate.json +1 -0
- package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-normed-ffn-candidate.json +1 -0
- package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-overlap-ringtokens1-candidate.json +1 -0
- package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-parity.json +1 -0
- package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-sequential-candidate.json +1 -0
- package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-throughput.json +1 -0
- package/src/config/runtime/profiles/qwen-3-5-0-8b-prefill-profile.json +1 -3
- package/src/config/runtime/profiles/qwen-3-5-0-8b-throughput-probe.json +1 -0
- package/src/config/runtime/profiles/qwen-3-5-2b-f16-primary-throughput.json +1 -5
- package/src/config/runtime/profiles/qwen-3-5-2b-metal-parity.json +1 -0
- package/src/config/runtime/profiles/qwen-3-5-2b-metal-throughput.json +1 -0
- package/src/config/runtime/profiles/qwen-3-5-9b-metal-correctness.json +1 -0
- package/src/config/runtime/profiles/qwen-3-embedding-0-6b-metal-stability.json +1 -3
- package/src/config/runtime/profiles/qwen-3-embedding-0-6b-metal-throughput.json +1 -0
- package/src/config/runtime/profiles/qwen-3-reranker-0-6b-metal-stability.json +1 -0
- package/src/config/runtime/profiles/qwen-3-reranker-0-6b-metal-throughput.json +1 -0
- package/src/config/runtime/profiles/qwen3-6-27b-f16-activations-probe.json +1 -5
- package/src/config/runtime/profiles/rerank-stability.json +1 -3
- package/src/config/runtime/profiles/rerank-throughput.json +1 -3
- package/src/config/runtime/profiles/simulation.json +1 -3
- package/src/config/runtime/profiles/throughput.json +1 -3
- package/src/config/runtime/profiles/trace-layers.json +1 -3
- package/src/config/runtime/profiles/translategemma-1b-nativekd2-q4k-rdna3-throughput-probe.json +1 -0
- package/src/config/runtime/profiles/turboquant-contiguous-prod.json +1 -0
- package/src/config/runtime/profiles/turboquant-contiguous.json +1 -0
- package/src/config/runtime/profiles/turboquant.json +1 -0
- package/src/config/runtime/profiles/vector-stability.json +1 -3
- package/src/config/runtime/profiles/vector-throughput.json +1 -0
- package/src/config/runtime/profiles/verbose-trace.json +1 -3
- package/src/config/runtime/tiers/gemma4-128gb.json +1 -0
- package/src/config/runtime/tiers/gemma4-16gb.json +1 -0
- package/src/config/runtime/tiers/gemma4-24gb.json +1 -0
- package/src/config/runtime/tiers/gemma4-32gb.json +1 -0
- package/src/config/schema/benchmark.schema.d.ts +7 -0
- package/src/config/schema/benchmark.schema.js +5 -0
- package/src/config/schema/index.d.ts +8 -16
- package/src/config/schema/index.js +5 -8
- package/src/config/schema/kernel-thresholds.schema.d.ts +0 -12
- package/src/config/schema/kernel-thresholds.schema.js +0 -12
- package/src/config/schema/kernel-warmup.schema.d.ts +1 -3
- package/src/config/schema/kernel-warmup.schema.js +0 -1
- package/src/config/schema/runtime-profile.schema.d.ts +24 -0
- package/src/config/schema/runtime-profile.schema.js +92 -0
- package/src/config/schema/shared-runtime.schema.d.ts +1 -4
- package/src/config/schema/shared-runtime.schema.js +0 -2
- package/src/config/schema/tooling.schema.d.ts +8 -5
- package/src/config/schema/tooling.schema.js +3 -2
- package/src/debug/tensor.d.ts +2 -0
- package/src/debug/tensor.js +21 -2
- package/src/gpu/command-recorder.d.ts +5 -0
- package/src/gpu/command-recorder.js +17 -0
- package/src/gpu/kernel-runtime.js +2 -10
- package/src/gpu/kernels/index.d.ts +0 -2
- package/src/gpu/kernels/index.js +0 -2
- package/src/gpu/kernels/kernel-prewarm.d.ts +3 -0
- package/src/gpu/kernels/kernel-prewarm.js +60 -0
- package/src/gpu/kernels/utils.d.ts +2 -4
- package/src/gpu/kernels/utils.js +2 -4
- package/src/index.d.ts +13 -1
- package/src/index.js +7 -1
- package/src/inference/browser-harness-model-helpers.js +4 -0
- package/src/inference/browser-harness-runtime-helpers.js +25 -10
- package/src/inference/browser-harness-text-helpers.js +4 -1
- package/src/inference/browser-harness.d.ts +4 -0
- package/src/inference/browser-harness.js +91 -4
- package/src/inference/observation-context.d.ts +22 -0
- package/src/inference/observation-context.js +41 -0
- package/src/inference/pipelines/text/attention/attn-config.js +1 -1
- package/src/inference/pipelines/text/attention/executor-immediate.js +42 -0
- package/src/inference/pipelines/text/attention/executor-recorded.js +29 -0
- package/src/inference/pipelines/text/attention/index.js +7 -0
- package/src/inference/pipelines/text/attention/interpreter.js +1334 -0
- package/src/inference/pipelines/text/attention/plan.d.ts +36 -0
- package/src/inference/pipelines/text/attention/plan.js +328 -0
- package/src/inference/pipelines/text/attention/receipt.js +60 -0
- package/src/inference/pipelines/text/attention/record.js +8 -1278
- package/src/inference/pipelines/text/attention/run.js +8 -1386
- package/src/inference/pipelines/text/generator-decode-policy.js +4 -1
- package/src/inference/pipelines/text/generator-helpers.js +2 -0
- package/src/inference/pipelines/text/generator-steps.js +32 -15
- package/src/inference/pipelines/text/generator.js +10 -5
- package/src/inference/pipelines/text/init.d.ts +3 -0
- package/src/inference/pipelines/text/layer-plan-gpu.js +2 -0
- package/src/inference/pipelines/text/layer.js +2 -0
- package/src/inference/pipelines/text/model-load.d.ts +0 -1
- package/src/inference/pipelines/text/model-load.js +2 -11
- package/src/inference/pipelines/text/probes.js +10 -0
- package/src/inference/pipelines/text/resolved-runtime-session.d.ts +56 -0
- package/src/inference/pipelines/text/resolved-runtime-session.js +175 -0
- package/src/inference/pipelines/text/state.d.ts +6 -0
- package/src/inference/pipelines/text/state.js +3 -0
- package/src/inference/pipelines/text/types.d.ts +6 -0
- package/src/inference/pipelines/text.js +16 -1
- package/src/inference/refactor-receipt.d.ts +49 -0
- package/src/inference/refactor-receipt.js +188 -0
- package/src/inference/resource-scope.d.ts +33 -0
- package/src/inference/resource-scope.js +168 -0
- package/src/inference/test-harness.d.ts +3 -0
- package/src/inference/test-harness.js +1 -0
- package/src/storage/model-cache.d.ts +53 -0
- package/src/storage/model-cache.js +550 -0
- package/src/tooling/boundary-evidence.d.ts +51 -0
- package/src/tooling/boundary-evidence.js +408 -0
- package/src/tooling/browser-command-runner.js +4 -4
- package/src/tooling/command-context.d.ts +25 -0
- package/src/tooling/command-context.js +53 -0
- package/src/tooling/command-runner-shared.js +22 -5
- package/src/tooling/demo-receipts.d.ts +56 -0
- package/src/tooling/demo-receipts.js +113 -0
- package/src/tooling/diagnose-runner.js +2 -2
- package/src/tooling/execution-cost-ledger.d.ts +21 -0
- package/src/tooling/execution-cost-ledger.js +199 -0
- package/src/tooling/node-command-runner.js +2 -2
- package/src/tooling/opfs-cache.d.ts +11 -49
- package/src/tooling/opfs-cache.js +4 -510
- package/src/tooling/precision-replay-math.d.ts +42 -0
- package/src/tooling/precision-replay-math.js +174 -0
- package/src/tooling/program-bundle-parity.d.ts +3 -0
- package/src/tooling/program-bundle-parity.js +8 -0
- package/src/tooling/program-bundle.d.ts +1 -52
- package/src/tooling/program-bundle.js +0 -139
- package/src/tooling/registered-variant-calibration.d.ts +24 -0
- package/src/tooling/registered-variant-calibration.js +286 -0
- package/src/tooling/runtime-input-composition.js +105 -53
- package/src/tooling/runtime-intent.js +41 -0
- package/src/tooling/runtime-optimization-index.d.ts +6 -0
- package/src/tooling/runtime-optimization-index.js +72 -0
- package/src/tooling/runtime-optimization.d.ts +47 -6
- package/src/tooling/runtime-optimization.js +559 -40
- package/src/tooling/source-intake.d.ts +49 -0
- package/src/tooling/source-intake.js +414 -0
- package/src/tooling-exports/evidence.d.ts +34 -0
- package/src/tooling-exports/evidence.js +34 -0
- package/src/tooling-exports/runtime.d.ts +7 -0
- package/src/tooling-exports/runtime.js +7 -0
- package/src/tooling-exports.d.ts +11 -0
- package/src/tooling-exports.js +6 -3
- package/src/tooling-exports.shared.d.ts +32 -0
- package/src/tooling-exports.shared.js +31 -0
- package/src/version.js +1 -1
- package/src/config/schema/tuner.schema.d.ts +0 -39
- package/src/config/schema/tuner.schema.js +0 -13
- package/src/gpu/kernel-tuner/benchmarks.js +0 -902
- package/src/gpu/kernel-tuner/cache.js +0 -145
- package/src/gpu/kernel-tuner/index.js +0 -38
- package/src/gpu/kernel-tuner/tuner.js +0 -247
- package/src/gpu/kernel-tuner.js +0 -12
- package/src/gpu/kernels/kernel-tuning.d.ts +0 -42
- package/src/gpu/kernels/kernel-tuning.js +0 -158
- package/src/gpu/profiler.js +0 -382
- package/src/inference/pipelines/text/attention/output-gate-fusion.js +0 -37
package/src/cli/doppler-cli.js
CHANGED
|
@@ -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
|
|
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
|
|
90
|
-
' doppler
|
|
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
|
|
707
|
-
const
|
|
708
|
-
const
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
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
|
-
|
|
726
|
-
|
|
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
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
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
|
-
|
|
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
|
-
|
|
741
|
-
|
|
742
|
-
|
|
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
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export type DopplerClaimType =
|
|
2
|
+
| 'execution-identity'
|
|
3
|
+
| 'coarse-performance'
|
|
4
|
+
| 'quality-inspection'
|
|
5
|
+
| 'diagnostic';
|
|
6
|
+
|
|
7
|
+
export interface DopplerObservationPolicy {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
modifiesExecution: boolean;
|
|
11
|
+
performanceRepresentative: boolean;
|
|
12
|
+
requiredCaptures: string[];
|
|
13
|
+
allowedClaimTypes: DopplerClaimType[];
|
|
14
|
+
gpuTimestampQueries: boolean;
|
|
15
|
+
perplexity: null | {
|
|
16
|
+
wordSegmentation: 'doppler.word-segmentation/unicode-whitespace-v1';
|
|
17
|
+
aggregation: 'doppler.perplexity/summed-word-surprisal-v1';
|
|
18
|
+
rollingWindow: {
|
|
19
|
+
unit: 'words' | 'tokens';
|
|
20
|
+
size: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface DopplerComparisonFingerprint {
|
|
26
|
+
schema: 'doppler.comparison-fingerprint/v1';
|
|
27
|
+
identity: {
|
|
28
|
+
artifact: {
|
|
29
|
+
modelId: string;
|
|
30
|
+
manifestHash: string;
|
|
31
|
+
};
|
|
32
|
+
tokenizer: {
|
|
33
|
+
contract: unknown;
|
|
34
|
+
digest: string;
|
|
35
|
+
};
|
|
36
|
+
promptTokenIds: number[];
|
|
37
|
+
sampling: Record<string, unknown>;
|
|
38
|
+
observationPolicy: {
|
|
39
|
+
id: string;
|
|
40
|
+
modifiesExecution: boolean;
|
|
41
|
+
performanceRepresentative: boolean;
|
|
42
|
+
requiredCaptures: string[];
|
|
43
|
+
allowedClaimTypes: DopplerClaimType[];
|
|
44
|
+
};
|
|
45
|
+
perplexity: DopplerObservationPolicy['perplexity'];
|
|
46
|
+
execution: Record<string, unknown>;
|
|
47
|
+
browser: Record<string, string>;
|
|
48
|
+
adapter: Record<string, string | null>;
|
|
49
|
+
};
|
|
50
|
+
fullDigest: string;
|
|
51
|
+
qualityDigest: string;
|
|
52
|
+
performanceDigest: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface DopplerInspectionTokenRecord {
|
|
56
|
+
index: number;
|
|
57
|
+
tokenId: number;
|
|
58
|
+
text: string;
|
|
59
|
+
probability: number | null;
|
|
60
|
+
surprisal: number | null;
|
|
61
|
+
topCandidates: Array<{
|
|
62
|
+
tokenId: number;
|
|
63
|
+
logit: number;
|
|
64
|
+
text: string;
|
|
65
|
+
probability: number | null;
|
|
66
|
+
}>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface DopplerWordQualityRecord {
|
|
70
|
+
wordIndex: number;
|
|
71
|
+
text: string;
|
|
72
|
+
tokenIndexes: number[];
|
|
73
|
+
tokenCount: number;
|
|
74
|
+
summedSurprisal: number;
|
|
75
|
+
probabilityAvailable: boolean;
|
|
76
|
+
rollingPerplexity: number | null;
|
|
77
|
+
cumulativePerplexity: number | null;
|
|
78
|
+
rollingWindow: {
|
|
79
|
+
unit: 'words' | 'tokens';
|
|
80
|
+
size: number;
|
|
81
|
+
tokenCount: number;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export declare const OBSERVATION_POLICY_REGISTRY_SCHEMA: 'doppler.observation-policy-registry/v1';
|
|
86
|
+
export declare const COMPARISON_FINGERPRINT_SCHEMA: 'doppler.comparison-fingerprint/v1';
|
|
87
|
+
export declare const MODEL_INSPECTION_RECEIPT_SCHEMA: 'doppler.model-inspection-receipt/v1';
|
|
88
|
+
export declare const WORD_SEGMENTATION_SCHEMA: 'doppler.word-segmentation/unicode-whitespace-v1';
|
|
89
|
+
export declare const PERPLEXITY_AGGREGATION_SCHEMA: 'doppler.perplexity/summed-word-surprisal-v1';
|
|
90
|
+
|
|
91
|
+
export declare function listObservationPolicies(): DopplerObservationPolicy[];
|
|
92
|
+
export declare function resolveObservationPolicy(policyId?: string): DopplerObservationPolicy;
|
|
93
|
+
export declare function buildComparisonFingerprint(input: {
|
|
94
|
+
artifact: { modelId: string; manifestHash: string };
|
|
95
|
+
tokenizer: unknown;
|
|
96
|
+
promptTokenIds: readonly number[];
|
|
97
|
+
sampling?: Record<string, unknown>;
|
|
98
|
+
observationPolicyId: string;
|
|
99
|
+
execution?: Record<string, unknown>;
|
|
100
|
+
browser?: Record<string, unknown>;
|
|
101
|
+
adapter?: Record<string, unknown>;
|
|
102
|
+
}): DopplerComparisonFingerprint;
|
|
103
|
+
export declare function assertComparableFingerprints(
|
|
104
|
+
kind: 'quality' | 'performance',
|
|
105
|
+
left: DopplerComparisonFingerprint,
|
|
106
|
+
right: DopplerComparisonFingerprint
|
|
107
|
+
): true;
|
|
108
|
+
export declare function buildInspectionTokenRecords(
|
|
109
|
+
tokenIds: readonly number[],
|
|
110
|
+
logitsByStep: ArrayLike<number>[],
|
|
111
|
+
tokenizer: { decode(ids: readonly number[], skipSpecialTokens?: boolean, cleanUp?: boolean): string },
|
|
112
|
+
topKSize?: number
|
|
113
|
+
): DopplerInspectionTokenRecord[];
|
|
114
|
+
export declare function aggregateWordPerplexity(
|
|
115
|
+
tokenRecords: DopplerInspectionTokenRecord[],
|
|
116
|
+
options?: { windowUnit?: 'words' | 'tokens'; windowSize?: number }
|
|
117
|
+
): {
|
|
118
|
+
wordSegmentation: 'doppler.word-segmentation/unicode-whitespace-v1';
|
|
119
|
+
aggregation: 'doppler.perplexity/summed-word-surprisal-v1';
|
|
120
|
+
rollingWindow: { unit: 'words' | 'tokens'; size: number };
|
|
121
|
+
words: DopplerWordQualityRecord[];
|
|
122
|
+
};
|