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.
- package/README.md +9 -0
- 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 +48 -1
- package/src/client/runtime/model-session.js +149 -30
- 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
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { computeCanonicalSha256 } from '../utils/canonical-hash.js';
|
|
2
|
+
|
|
3
|
+
export const SOURCE_BOUNDARY_PACK_SCHEMA = 'doppler.source-boundary-pack/v1';
|
|
4
|
+
export const RUNTIME_BOUNDARY_CAPTURE_SCHEMA = 'doppler.runtime-boundary-capture/v1';
|
|
5
|
+
export const BOUNDARY_COMPARISON_RECEIPT_SCHEMA =
|
|
6
|
+
'doppler.boundary-comparison-receipt/v1';
|
|
7
|
+
export const DETERMINISTIC_TOKEN_EVIDENCE_SCHEMA =
|
|
8
|
+
'doppler.deterministic-token-evidence/v1';
|
|
9
|
+
export const BOUNDARY_PROVIDER_CAPTURE_SCHEMA =
|
|
10
|
+
'doppler.boundary-provider-capture/v1';
|
|
11
|
+
|
|
12
|
+
function isObject(value) {
|
|
13
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function assertEvidencePolicy(policy) {
|
|
17
|
+
if (policy?.schema !== 'doppler.boundary-evidence-policy/v1') {
|
|
18
|
+
throw new Error('boundary evidence: doppler.boundary-evidence-policy/v1 is required');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function assertArtifactDigest(artifact, label) {
|
|
23
|
+
const { digest, ...core } = artifact;
|
|
24
|
+
if (!/^sha256:[0-9a-f]{64}$/.test(digest ?? '')) {
|
|
25
|
+
throw new Error(`boundary evidence: ${label}.digest is required`);
|
|
26
|
+
}
|
|
27
|
+
if (computeCanonicalSha256(core) !== digest) {
|
|
28
|
+
throw new Error(`boundary evidence: ${label}.digest does not match its payload`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function validateSourceIdentity(identity) {
|
|
33
|
+
if (!isObject(identity)) throw new Error('boundary evidence: source-pack identity is required');
|
|
34
|
+
for (const field of ['sourceRevision', 'dtype']) {
|
|
35
|
+
if (typeof identity[field] !== 'string' || !identity[field]) {
|
|
36
|
+
throw new Error(`boundary evidence: source-pack identity.${field} is required`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const field of ['promptDigest', 'modelConfigDigest', 'referenceScriptDigest']) {
|
|
40
|
+
if (!/^sha256:[0-9a-f]{64}$/.test(identity[field] ?? '')) {
|
|
41
|
+
throw new Error(`boundary evidence: source-pack identity.${field} is required`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function buildDeterministicTokenEvidenceFromReferenceTranscript(transcript) {
|
|
47
|
+
if (transcript?.schema !== 'doppler.reference-transcript/v1') {
|
|
48
|
+
throw new Error(
|
|
49
|
+
'boundary evidence: doppler.reference-transcript/v1 is required for token evidence'
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
const tokenIds = transcript.tokens?.ids;
|
|
53
|
+
const tokenCount = transcript.output?.tokensGenerated;
|
|
54
|
+
const completeTokenIds = Array.isArray(tokenIds)
|
|
55
|
+
&& Number.isInteger(tokenCount)
|
|
56
|
+
&& tokenIds.length === tokenCount
|
|
57
|
+
&& tokenIds.every(Number.isInteger)
|
|
58
|
+
&& transcript.tokens?.coverage?.mode === 'full-token-ids'
|
|
59
|
+
&& transcript.tokens?.coverage?.omitted === 0;
|
|
60
|
+
for (const field of ['generatedTokenIdsHash', 'generatedTextHash']) {
|
|
61
|
+
if (!/^sha256:[0-9a-f]{64}$/.test(transcript.tokens?.[field] ?? '')) {
|
|
62
|
+
throw new Error(`boundary evidence: reference transcript tokens.${field} is required`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const core = {
|
|
66
|
+
schema: DETERMINISTIC_TOKEN_EVIDENCE_SCHEMA,
|
|
67
|
+
source: {
|
|
68
|
+
kind: 'reference-transcript',
|
|
69
|
+
transcriptDigest: computeCanonicalSha256(transcript),
|
|
70
|
+
},
|
|
71
|
+
exact: completeTokenIds,
|
|
72
|
+
tokenCount: Number.isInteger(tokenCount) ? tokenCount : 0,
|
|
73
|
+
generatedTokenIdsHash: transcript.tokens.generatedTokenIdsHash,
|
|
74
|
+
generatedTextHash: transcript.tokens.generatedTextHash,
|
|
75
|
+
};
|
|
76
|
+
return { ...core, digest: computeCanonicalSha256(core) };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function resolveTimeline(report) {
|
|
80
|
+
const candidates = [
|
|
81
|
+
report?.result?.metrics?.operatorDiagnostics?.timeline,
|
|
82
|
+
report?.metrics?.operatorDiagnostics?.timeline,
|
|
83
|
+
report?.operatorDiagnostics?.timeline,
|
|
84
|
+
report?.timeline,
|
|
85
|
+
];
|
|
86
|
+
return candidates.find(Array.isArray) ?? null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function resolveTemplate(policy, stageName) {
|
|
90
|
+
for (const boundary of policy.boundaries) {
|
|
91
|
+
const priority = boundary.stages.indexOf(stageName);
|
|
92
|
+
if (priority >= 0) return { boundary, priority };
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function normalizeSamples(capture) {
|
|
98
|
+
const values = Array.isArray(capture.sample) ? capture.sample : [];
|
|
99
|
+
const coordinates = Array.isArray(capture.sampleCoordinates)
|
|
100
|
+
? capture.sampleCoordinates
|
|
101
|
+
: values.map((_, index) => [index]);
|
|
102
|
+
return values.map((value, index) => ({
|
|
103
|
+
coordinate: coordinates[index] ?? [index],
|
|
104
|
+
flatIndex: index,
|
|
105
|
+
value,
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function boundaryFromRecord(record, idTemplate, tolerancePolicyId) {
|
|
110
|
+
const layer = Number.isInteger(record.layerIndex) ? record.layerIndex : null;
|
|
111
|
+
const boundaryId = idTemplate.replace('{L}', String(layer));
|
|
112
|
+
const capture = record.capture;
|
|
113
|
+
if (!isObject(capture) || capture.error) {
|
|
114
|
+
throw new Error(`boundary evidence: ${boundaryId} has no successful tensor capture`);
|
|
115
|
+
}
|
|
116
|
+
if (!capture.fullTensorDigest) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
`boundary evidence: ${boundaryId} capture has no fullTensorDigest; rerun with current probes`
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
boundaryId,
|
|
123
|
+
phase: record.phase ?? null,
|
|
124
|
+
tokenIndex: record.tokenIndex ?? null,
|
|
125
|
+
layerIndex: layer,
|
|
126
|
+
shape: Array.isArray(capture.shape) ? capture.shape : record.shapeSignature,
|
|
127
|
+
dtype: capture.dtype ?? record.dtype ?? null,
|
|
128
|
+
samples: normalizeSamples(capture),
|
|
129
|
+
fullTensorDigest: capture.fullTensorDigest,
|
|
130
|
+
statistics: capture.stats,
|
|
131
|
+
tolerancePolicyId,
|
|
132
|
+
execution: {
|
|
133
|
+
opId: record.opId ?? null,
|
|
134
|
+
stageName: record.stageName,
|
|
135
|
+
kernelDigest: record.kernelDigest ?? null,
|
|
136
|
+
pipelineHash: record.pipelineHash ?? null,
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function addOccurrences(boundaries) {
|
|
142
|
+
const counts = new Map();
|
|
143
|
+
return boundaries.map((boundary) => {
|
|
144
|
+
const key = [
|
|
145
|
+
boundary.phase ?? '',
|
|
146
|
+
boundary.tokenIndex ?? '',
|
|
147
|
+
boundary.boundaryId,
|
|
148
|
+
].join(':');
|
|
149
|
+
const occurrence = counts.get(key) ?? 0;
|
|
150
|
+
counts.set(key, occurrence + 1);
|
|
151
|
+
return { ...boundary, occurrence };
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function buildRuntimeBoundaryCapture({
|
|
156
|
+
report,
|
|
157
|
+
policy,
|
|
158
|
+
tolerancePolicyId = 'doppler.boundary-tolerance/source-f16-v1',
|
|
159
|
+
identity = {},
|
|
160
|
+
}) {
|
|
161
|
+
assertEvidencePolicy(policy);
|
|
162
|
+
if (!policy.tolerancePolicies?.[tolerancePolicyId]) {
|
|
163
|
+
throw new Error(`boundary evidence: unknown tolerance policy "${tolerancePolicyId}"`);
|
|
164
|
+
}
|
|
165
|
+
const timeline = resolveTimeline(report);
|
|
166
|
+
if (!timeline) {
|
|
167
|
+
throw new Error('boundary evidence: report has no operator diagnostics timeline');
|
|
168
|
+
}
|
|
169
|
+
const selected = new Map();
|
|
170
|
+
for (let recordIndex = 0; recordIndex < timeline.length; recordIndex += 1) {
|
|
171
|
+
const record = timeline[recordIndex];
|
|
172
|
+
const resolved = resolveTemplate(policy, record.stageName);
|
|
173
|
+
if (!resolved) continue;
|
|
174
|
+
const layerKey = Number.isInteger(record.layerIndex) ? record.layerIndex : 'model';
|
|
175
|
+
const key = [
|
|
176
|
+
record.phase ?? '',
|
|
177
|
+
record.tokenIndex ?? '',
|
|
178
|
+
layerKey,
|
|
179
|
+
resolved.boundary.idTemplate,
|
|
180
|
+
].join(':');
|
|
181
|
+
const previous = selected.get(key);
|
|
182
|
+
if (!previous || resolved.priority < previous.priority) {
|
|
183
|
+
selected.set(key, { ...resolved, record, recordIndex });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const boundaries = addOccurrences(
|
|
187
|
+
Array.from(selected.values())
|
|
188
|
+
.sort((left, right) => left.recordIndex - right.recordIndex)
|
|
189
|
+
.map(({ record, boundary }) => (
|
|
190
|
+
boundaryFromRecord(record, boundary.idTemplate, tolerancePolicyId)
|
|
191
|
+
))
|
|
192
|
+
);
|
|
193
|
+
const core = {
|
|
194
|
+
schema: RUNTIME_BOUNDARY_CAPTURE_SCHEMA,
|
|
195
|
+
identity: {
|
|
196
|
+
modelDigest: identity.modelDigest ?? timeline[0]?.modelHash ?? null,
|
|
197
|
+
runtimeConfigDigest: identity.runtimeConfigDigest ?? timeline[0]?.runtimeConfigHash ?? null,
|
|
198
|
+
executionGraphDigest: identity.executionGraphDigest ?? timeline[0]?.executionPlanHash ?? null,
|
|
199
|
+
sourceReportDigest: identity.sourceReportDigest ?? computeCanonicalSha256(report),
|
|
200
|
+
promptDigest: identity.promptDigest ?? null,
|
|
201
|
+
},
|
|
202
|
+
boundaries,
|
|
203
|
+
};
|
|
204
|
+
return { ...core, digest: computeCanonicalSha256(core) };
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function buildSourceBoundaryPack({
|
|
208
|
+
identity,
|
|
209
|
+
boundaries,
|
|
210
|
+
}) {
|
|
211
|
+
validateSourceIdentity(identity);
|
|
212
|
+
if (!Array.isArray(boundaries) || boundaries.length === 0) {
|
|
213
|
+
throw new Error('boundary evidence: source pack requires boundaries');
|
|
214
|
+
}
|
|
215
|
+
for (const boundary of boundaries) {
|
|
216
|
+
validateBoundary(boundary, 'source pack');
|
|
217
|
+
}
|
|
218
|
+
const core = {
|
|
219
|
+
schema: SOURCE_BOUNDARY_PACK_SCHEMA,
|
|
220
|
+
identity,
|
|
221
|
+
boundaries,
|
|
222
|
+
};
|
|
223
|
+
return { ...core, digest: computeCanonicalSha256(core) };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function buildSourceBoundaryPackFromProviderCapture(capture) {
|
|
227
|
+
if (capture?.schema !== BOUNDARY_PROVIDER_CAPTURE_SCHEMA) {
|
|
228
|
+
throw new Error(
|
|
229
|
+
`boundary evidence: expected ${BOUNDARY_PROVIDER_CAPTURE_SCHEMA}`
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
if (typeof capture.provider !== 'string' || !capture.provider) {
|
|
233
|
+
throw new Error('boundary evidence: provider capture requires provider');
|
|
234
|
+
}
|
|
235
|
+
return buildSourceBoundaryPack({
|
|
236
|
+
identity: {
|
|
237
|
+
...capture.identity,
|
|
238
|
+
provider: capture.provider,
|
|
239
|
+
providerRuntime: capture.runtime ?? null,
|
|
240
|
+
},
|
|
241
|
+
boundaries: capture.boundaries,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function validateBoundary(boundary, label) {
|
|
246
|
+
if (!isObject(boundary) || typeof boundary.boundaryId !== 'string') {
|
|
247
|
+
throw new Error(`boundary evidence: ${label} contains an invalid boundary`);
|
|
248
|
+
}
|
|
249
|
+
if (!Array.isArray(boundary.shape) || !boundary.shape.every(Number.isInteger)) {
|
|
250
|
+
throw new Error(`boundary evidence: ${boundary.boundaryId} shape is required`);
|
|
251
|
+
}
|
|
252
|
+
if (typeof boundary.dtype !== 'string' || !boundary.dtype) {
|
|
253
|
+
throw new Error(`boundary evidence: ${boundary.boundaryId} dtype is required`);
|
|
254
|
+
}
|
|
255
|
+
if (!Array.isArray(boundary.samples) || boundary.samples.length === 0) {
|
|
256
|
+
throw new Error(`boundary evidence: ${boundary.boundaryId} samples are required`);
|
|
257
|
+
}
|
|
258
|
+
if (!/^sha256:[0-9a-f]{64}$/.test(boundary.fullTensorDigest ?? '')) {
|
|
259
|
+
throw new Error(`boundary evidence: ${boundary.boundaryId} fullTensorDigest is required`);
|
|
260
|
+
}
|
|
261
|
+
if (!isObject(boundary.statistics)) {
|
|
262
|
+
throw new Error(`boundary evidence: ${boundary.boundaryId} statistics are required`);
|
|
263
|
+
}
|
|
264
|
+
if (typeof boundary.tolerancePolicyId !== 'string') {
|
|
265
|
+
throw new Error(`boundary evidence: ${boundary.boundaryId} tolerancePolicyId is required`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function boundaryKey(boundary) {
|
|
270
|
+
return [
|
|
271
|
+
boundary.phase ?? '',
|
|
272
|
+
boundary.tokenIndex ?? '',
|
|
273
|
+
boundary.boundaryId,
|
|
274
|
+
boundary.occurrence ?? 0,
|
|
275
|
+
].join(':');
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function compareSamples(expected, actual, tolerance) {
|
|
279
|
+
const actualByCoordinate = new Map(
|
|
280
|
+
actual.samples.map((sample) => [JSON.stringify(sample.coordinate), sample])
|
|
281
|
+
);
|
|
282
|
+
let maxAbsoluteError = 0;
|
|
283
|
+
let maxRelativeError = 0;
|
|
284
|
+
const failures = [];
|
|
285
|
+
for (const expectedSample of expected.samples) {
|
|
286
|
+
const coordinateKey = JSON.stringify(expectedSample.coordinate);
|
|
287
|
+
const actualSample = actualByCoordinate.get(coordinateKey);
|
|
288
|
+
if (!actualSample) {
|
|
289
|
+
failures.push({ coordinate: expectedSample.coordinate, reason: 'missing_sample' });
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
const absoluteError = Math.abs(actualSample.value - expectedSample.value);
|
|
293
|
+
const scale = Math.max(Math.abs(expectedSample.value), Number.MIN_VALUE);
|
|
294
|
+
const relativeError = absoluteError / scale;
|
|
295
|
+
maxAbsoluteError = Math.max(maxAbsoluteError, absoluteError);
|
|
296
|
+
maxRelativeError = Math.max(maxRelativeError, relativeError);
|
|
297
|
+
if (absoluteError > tolerance.absolute && relativeError > tolerance.relative) {
|
|
298
|
+
failures.push({
|
|
299
|
+
coordinate: expectedSample.coordinate,
|
|
300
|
+
expected: expectedSample.value,
|
|
301
|
+
actual: actualSample.value,
|
|
302
|
+
absoluteError,
|
|
303
|
+
relativeError,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return { maxAbsoluteError, maxRelativeError, failures };
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function compareBoundary(expected, actual, tolerance) {
|
|
311
|
+
const reasons = [];
|
|
312
|
+
if (JSON.stringify(expected.shape) !== JSON.stringify(actual.shape)) reasons.push('shape_mismatch');
|
|
313
|
+
if (tolerance.requireDtypeMatch && expected.dtype !== actual.dtype) reasons.push('dtype_mismatch');
|
|
314
|
+
const samples = compareSamples(expected, actual, tolerance);
|
|
315
|
+
if (samples.failures.length > 0) reasons.push('sample_tolerance_exceeded');
|
|
316
|
+
if (
|
|
317
|
+
tolerance.absolute === 0
|
|
318
|
+
&& tolerance.relative === 0
|
|
319
|
+
&& expected.fullTensorDigest !== actual.fullTensorDigest
|
|
320
|
+
) {
|
|
321
|
+
reasons.push('full_tensor_digest_mismatch');
|
|
322
|
+
}
|
|
323
|
+
return {
|
|
324
|
+
boundaryId: expected.boundaryId,
|
|
325
|
+
key: boundaryKey(expected),
|
|
326
|
+
passed: reasons.length === 0,
|
|
327
|
+
reasons,
|
|
328
|
+
expectedDigest: expected.fullTensorDigest,
|
|
329
|
+
actualDigest: actual.fullTensorDigest,
|
|
330
|
+
sampleComparison: samples,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export function compareBoundaryEvidence({
|
|
335
|
+
sourcePack,
|
|
336
|
+
runtimeCapture,
|
|
337
|
+
policy,
|
|
338
|
+
artifactPrecision = 'source',
|
|
339
|
+
sourcePrecisionControlReceipt = null,
|
|
340
|
+
deterministicTokenEvidence = null,
|
|
341
|
+
}) {
|
|
342
|
+
assertEvidencePolicy(policy);
|
|
343
|
+
if (artifactPrecision !== 'source' && artifactPrecision !== 'quantized') {
|
|
344
|
+
throw new Error('boundary evidence: artifactPrecision must be source or quantized');
|
|
345
|
+
}
|
|
346
|
+
if (sourcePack?.schema !== SOURCE_BOUNDARY_PACK_SCHEMA) {
|
|
347
|
+
throw new Error(`boundary evidence: expected ${SOURCE_BOUNDARY_PACK_SCHEMA}`);
|
|
348
|
+
}
|
|
349
|
+
if (runtimeCapture?.schema !== RUNTIME_BOUNDARY_CAPTURE_SCHEMA) {
|
|
350
|
+
throw new Error(`boundary evidence: expected ${RUNTIME_BOUNDARY_CAPTURE_SCHEMA}`);
|
|
351
|
+
}
|
|
352
|
+
validateSourceIdentity(sourcePack.identity);
|
|
353
|
+
assertArtifactDigest(sourcePack, 'sourcePack');
|
|
354
|
+
assertArtifactDigest(runtimeCapture, 'runtimeCapture');
|
|
355
|
+
const actualByKey = new Map(
|
|
356
|
+
runtimeCapture.boundaries.map((boundary) => [boundaryKey(boundary), boundary])
|
|
357
|
+
);
|
|
358
|
+
const comparisons = [];
|
|
359
|
+
for (const expected of sourcePack.boundaries) {
|
|
360
|
+
validateBoundary(expected, 'source pack');
|
|
361
|
+
const actual = actualByKey.get(boundaryKey(expected));
|
|
362
|
+
if (!actual) {
|
|
363
|
+
comparisons.push({
|
|
364
|
+
boundaryId: expected.boundaryId,
|
|
365
|
+
key: boundaryKey(expected),
|
|
366
|
+
passed: false,
|
|
367
|
+
reasons: ['missing_runtime_boundary'],
|
|
368
|
+
});
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
validateBoundary(actual, 'runtime capture');
|
|
372
|
+
const tolerance = policy.tolerancePolicies[expected.tolerancePolicyId];
|
|
373
|
+
if (!tolerance) {
|
|
374
|
+
throw new Error(
|
|
375
|
+
`boundary evidence: unknown tolerance policy "${expected.tolerancePolicyId}"`
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
const comparison = compareBoundary(expected, actual, tolerance);
|
|
379
|
+
comparisons.push(comparison);
|
|
380
|
+
if (!comparison.passed) break;
|
|
381
|
+
}
|
|
382
|
+
const boundaryCompatible = comparisons.length === sourcePack.boundaries.length
|
|
383
|
+
&& comparisons.every((comparison) => comparison.passed);
|
|
384
|
+
const sourceControlPassed = artifactPrecision !== 'quantized'
|
|
385
|
+
|| (
|
|
386
|
+
sourcePrecisionControlReceipt?.schema === BOUNDARY_COMPARISON_RECEIPT_SCHEMA
|
|
387
|
+
&& sourcePrecisionControlReceipt?.promotionGate?.passed === true
|
|
388
|
+
);
|
|
389
|
+
const tokenParityPassed = deterministicTokenEvidence?.exact === true
|
|
390
|
+
&& deterministicTokenEvidence?.tokenCount >= 128
|
|
391
|
+
&& deterministicTokenEvidence?.schema === DETERMINISTIC_TOKEN_EVIDENCE_SCHEMA;
|
|
392
|
+
const promotionGate = {
|
|
393
|
+
boundaryCompatible,
|
|
394
|
+
sourcePrecisionControlPassed: sourceControlPassed,
|
|
395
|
+
deterministicTokenParityPassed: tokenParityPassed,
|
|
396
|
+
passed: boundaryCompatible && sourceControlPassed && tokenParityPassed,
|
|
397
|
+
};
|
|
398
|
+
const core = {
|
|
399
|
+
schema: BOUNDARY_COMPARISON_RECEIPT_SCHEMA,
|
|
400
|
+
sourcePackDigest: sourcePack.digest ?? computeCanonicalSha256(sourcePack),
|
|
401
|
+
runtimeCaptureDigest: runtimeCapture.digest ?? computeCanonicalSha256(runtimeCapture),
|
|
402
|
+
artifactPrecision,
|
|
403
|
+
comparisons,
|
|
404
|
+
firstDivergence: comparisons.find((comparison) => !comparison.passed) ?? null,
|
|
405
|
+
promotionGate,
|
|
406
|
+
};
|
|
407
|
+
return { ...core, digest: computeCanonicalSha256(core) };
|
|
408
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
applyRuntimeProfile,
|
|
3
|
-
applyRuntimeConfigFromUrl,
|
|
4
2
|
loadRuntimeConfigFromRef,
|
|
3
|
+
loadRuntimeConfigFromUrl,
|
|
4
|
+
loadRuntimeProfile,
|
|
5
5
|
} from '../inference/browser-harness-runtime-helpers.js';
|
|
6
6
|
import {
|
|
7
7
|
getRuntimeConfig,
|
|
@@ -84,8 +84,8 @@ export async function runBrowserCommand(commandRequest, options = {}) {
|
|
|
84
84
|
|
|
85
85
|
const runtimeBridge = {
|
|
86
86
|
loadRuntimeConfigFromRef,
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
loadRuntimeProfile,
|
|
88
|
+
loadRuntimeConfigFromUrl,
|
|
89
89
|
getRuntimeConfig,
|
|
90
90
|
setRuntimeConfig,
|
|
91
91
|
resetRuntimeConfig,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ToolingCommand,
|
|
3
|
+
ToolingCommandRequest,
|
|
4
|
+
ToolingIntent,
|
|
5
|
+
ToolingWorkload,
|
|
6
|
+
} from './command-api.js';
|
|
7
|
+
|
|
8
|
+
export const COMMAND_CONTEXT_SCHEMA_VERSION: 1;
|
|
9
|
+
|
|
10
|
+
export interface CommandContext {
|
|
11
|
+
readonly schemaVersion: typeof COMMAND_CONTEXT_SCHEMA_VERSION;
|
|
12
|
+
readonly command: ToolingCommand;
|
|
13
|
+
readonly workload: ToolingWorkload | null;
|
|
14
|
+
readonly intent: ToolingIntent;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function createCommandContext(request: ToolingCommandRequest): CommandContext;
|
|
18
|
+
export function assertCommandContextMatchesOptions(
|
|
19
|
+
commandContext: CommandContext,
|
|
20
|
+
options?: {
|
|
21
|
+
command?: ToolingCommand;
|
|
22
|
+
workload?: ToolingWorkload | null;
|
|
23
|
+
intent?: ToolingIntent;
|
|
24
|
+
}
|
|
25
|
+
): CommandContext;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const COMMAND_CONTEXT_SCHEMA_VERSION = 1;
|
|
2
|
+
|
|
3
|
+
function freezeContext(context) {
|
|
4
|
+
return Object.freeze(context);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function createCommandContext(request) {
|
|
8
|
+
if (!request || typeof request !== 'object') {
|
|
9
|
+
throw new Error('tooling command context: normalized request must be an object.');
|
|
10
|
+
}
|
|
11
|
+
const command = typeof request.command === 'string' && request.command.trim()
|
|
12
|
+
? request.command.trim()
|
|
13
|
+
: null;
|
|
14
|
+
if (!command) {
|
|
15
|
+
throw new Error('tooling command context: command is required.');
|
|
16
|
+
}
|
|
17
|
+
const workload = request.workload ?? null;
|
|
18
|
+
const intent = request.intent ?? null;
|
|
19
|
+
if (workload !== null && (typeof workload !== 'string' || workload.trim().length === 0)) {
|
|
20
|
+
throw new Error('tooling command context: workload must be a non-empty string or null.');
|
|
21
|
+
}
|
|
22
|
+
if (intent !== null && (typeof intent !== 'string' || intent.trim().length === 0)) {
|
|
23
|
+
throw new Error('tooling command context: intent must be a non-empty string or null.');
|
|
24
|
+
}
|
|
25
|
+
return freezeContext({
|
|
26
|
+
schemaVersion: COMMAND_CONTEXT_SCHEMA_VERSION,
|
|
27
|
+
command,
|
|
28
|
+
workload,
|
|
29
|
+
intent,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function assertCommandContextMatchesOptions(commandContext, options = {}) {
|
|
34
|
+
if (!commandContext || commandContext.schemaVersion !== COMMAND_CONTEXT_SCHEMA_VERSION) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`tooling command context: schemaVersion must be ${COMMAND_CONTEXT_SCHEMA_VERSION}.`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const comparisons = [
|
|
40
|
+
['command', options.command],
|
|
41
|
+
['workload', options.workload],
|
|
42
|
+
['intent', options.intent],
|
|
43
|
+
];
|
|
44
|
+
for (const [field, mirror] of comparisons) {
|
|
45
|
+
if (mirror !== undefined && mirror !== commandContext[field]) {
|
|
46
|
+
throw new Error(
|
|
47
|
+
`tooling command context: ${field} mirror "${mirror}" conflicts with normalized context ` +
|
|
48
|
+
`"${commandContext[field]}".`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return commandContext;
|
|
53
|
+
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveOrderedRuntimeInputs } from './runtime-input-composition.js';
|
|
2
|
+
import { createCommandContext } from './command-context.js';
|
|
3
|
+
import {
|
|
4
|
+
assertRuntimeInputIntentCompatibility,
|
|
5
|
+
stripLegacyRuntimeIntent,
|
|
6
|
+
} from './runtime-intent.js';
|
|
2
7
|
|
|
3
8
|
function cloneRuntimeConfig(runtimeConfig) {
|
|
4
9
|
if (runtimeConfig == null) return runtimeConfig;
|
|
@@ -116,17 +121,26 @@ function resolveExpectedModelType(request) {
|
|
|
116
121
|
|
|
117
122
|
export async function applyRuntimeInputs(request, runtimeBridge, options = {}) {
|
|
118
123
|
resetRuntimeState(runtimeBridge);
|
|
119
|
-
await
|
|
124
|
+
const resolved = await resolveOrderedRuntimeInputs(runtimeBridge.getRuntimeConfig(), {
|
|
120
125
|
configChain: request.configChain ?? null,
|
|
121
126
|
runtimeProfile: request.runtimeProfile ?? null,
|
|
122
127
|
runtimeConfigUrl: request.runtimeConfigUrl ?? null,
|
|
123
128
|
runtimeConfig: request.runtimeConfig ?? null,
|
|
124
129
|
}, {
|
|
125
130
|
loadRuntimeConfigFromRef: runtimeBridge.loadRuntimeConfigFromRef?.bind(runtimeBridge),
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
loadRuntimeProfile: runtimeBridge.loadRuntimeProfile?.bind(runtimeBridge),
|
|
132
|
+
loadRuntimeConfigFromUrl: runtimeBridge.loadRuntimeConfigFromUrl?.bind(runtimeBridge),
|
|
128
133
|
}, options);
|
|
129
|
-
|
|
134
|
+
assertRuntimeInputIntentCompatibility(request.intent, resolved.documents);
|
|
135
|
+
const runtimeConfig = stripLegacyRuntimeIntent(resolved.runtime);
|
|
136
|
+
assertCalibrateRuntimeCompatibility(request, runtimeConfig);
|
|
137
|
+
if (resolved.documents.length > 0) {
|
|
138
|
+
runtimeBridge.setRuntimeConfig(runtimeConfig);
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
runtimeConfig,
|
|
142
|
+
documents: resolved.documents,
|
|
143
|
+
};
|
|
130
144
|
}
|
|
131
145
|
|
|
132
146
|
export async function runWithRuntimeIsolation(runtimeBridge, run) {
|
|
@@ -143,10 +157,13 @@ export function buildSuiteOptions(request, surface = null) {
|
|
|
143
157
|
? surface.trim()
|
|
144
158
|
: null;
|
|
145
159
|
const expectedModelType = resolveExpectedModelType(request);
|
|
160
|
+
const commandContext = createCommandContext(request);
|
|
146
161
|
return {
|
|
147
162
|
mode: resolveExecutionMode(request),
|
|
148
163
|
workload: request.workload,
|
|
149
164
|
command: request.command,
|
|
165
|
+
intent: commandContext.intent,
|
|
166
|
+
commandContext,
|
|
150
167
|
surface: normalizedSurface,
|
|
151
168
|
...(expectedModelType ? { expectedModelType } : {}),
|
|
152
169
|
inferenceInput: request.inferenceInput ?? undefined,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const DEMO_CONTRACT_RECEIPT_SCHEMA: 'doppler.demo-contract-receipt/v1';
|
|
2
|
+
export declare const DEMO_HARDWARE_RECEIPT_SCHEMA: 'doppler.demo-hardware-receipt/v1';
|
|
3
|
+
|
|
4
|
+
export interface DopplerDemoContractReceipt {
|
|
5
|
+
schema: 'doppler.demo-contract-receipt/v1';
|
|
6
|
+
status: 'passed' | 'failed';
|
|
7
|
+
createdAtUtc: string;
|
|
8
|
+
entrypoint: '/demo/index.html';
|
|
9
|
+
executionClass: 'mocked-contract' | 'software-webgpu' | 'hardware-webgpu';
|
|
10
|
+
journey: {
|
|
11
|
+
catalogRendered: boolean;
|
|
12
|
+
modelSelected: boolean;
|
|
13
|
+
modelLoaded: boolean;
|
|
14
|
+
generationCompleted: boolean;
|
|
15
|
+
};
|
|
16
|
+
shellManifestDigest: string;
|
|
17
|
+
fatalConsoleErrors: string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface DopplerDemoHardwareReceipt {
|
|
21
|
+
schema: 'doppler.demo-hardware-receipt/v1';
|
|
22
|
+
status: 'passed' | 'failed' | 'capability-skip';
|
|
23
|
+
createdAtUtc: string;
|
|
24
|
+
executionClass: 'software-webgpu' | 'hardware-webgpu';
|
|
25
|
+
browser: Record<string, unknown>;
|
|
26
|
+
adapter: Record<string, unknown>;
|
|
27
|
+
artifact: {
|
|
28
|
+
modelId: string;
|
|
29
|
+
manifestHash: string;
|
|
30
|
+
};
|
|
31
|
+
online: {
|
|
32
|
+
outputText: string;
|
|
33
|
+
tokenIds: number[];
|
|
34
|
+
transcriptHash: string;
|
|
35
|
+
};
|
|
36
|
+
offline: {
|
|
37
|
+
outputText: string;
|
|
38
|
+
tokenIds: number[];
|
|
39
|
+
transcriptHash: string;
|
|
40
|
+
};
|
|
41
|
+
lifecycle: {
|
|
42
|
+
allPagesClosed: boolean;
|
|
43
|
+
networkDisabled: boolean;
|
|
44
|
+
persistentCacheRestored: boolean;
|
|
45
|
+
upgradeChecked: boolean;
|
|
46
|
+
partialCacheFailureChecked: boolean;
|
|
47
|
+
};
|
|
48
|
+
fingerprint: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export declare function validateDemoContractReceipt(
|
|
52
|
+
receipt: DopplerDemoContractReceipt
|
|
53
|
+
): DopplerDemoContractReceipt;
|
|
54
|
+
export declare function validateDemoHardwareReceipt(
|
|
55
|
+
receipt: DopplerDemoHardwareReceipt
|
|
56
|
+
): DopplerDemoHardwareReceipt;
|