pi-mega-compact 0.20.41 → 0.20.43
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/assets/vector-cortex/encoder-v1/manifest.json +1 -1
- package/dist/config/vector-cortex-dedup-attr.js +14 -0
- package/dist/config/vector-cortex-enc0a.js +32 -0
- package/dist/config/vector-cortex.js +3 -3
- package/dist/config.js +1 -1
- package/dist/extensions/dashboard-server/api-contracts/dedup-attribution.js +13 -0
- package/dist/extensions/dashboard-server/api-contracts/endpoints/registry-ext.js +7 -0
- package/dist/extensions/dashboard-server/route-dispatch.js +3 -1
- package/dist/extensions/dashboard-server/routes-dedup-attribution.js +150 -0
- package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +2 -0
- package/dist/extensions/dashboard-server/routes.js +1 -0
- package/dist/src/config/vector-cortex-dedup-attr.js +14 -0
- package/dist/src/config/vector-cortex-enc0a.js +32 -0
- package/dist/src/config/vector-cortex.js +3 -3
- package/dist/src/config.js +1 -1
- package/dist/src/vector-cortex/_acceptance-enc0a-contract.js +60 -0
- package/dist/src/vector-cortex/_acceptance-vc2a-conformance.js +90 -0
- package/dist/src/vector-cortex/_acceptance-vc2a-runtime.js +285 -0
- package/dist/src/vector-cortex/_acceptance-vc2b-conformance.js +92 -0
- package/dist/src/vector-cortex/_acceptance-vc2b-heads.js +221 -0
- package/dist/src/vector-cortex/dedup-attr/rollup.js +97 -0
- package/dist/src/vector-cortex/encoder/asset.js +3 -2
- package/dist/src/vector-cortex/encoder/decision.js +75 -0
- package/dist/src/vector-cortex/encoder/types-vc2c.js +41 -0
- package/dist/src/vector-cortex/encoder/types.js +13 -34
- package/dist/vector-cortex/_acceptance-enc0a-contract.js +60 -0
- package/dist/vector-cortex/_acceptance-vc2a-conformance.js +90 -0
- package/dist/vector-cortex/_acceptance-vc2a-runtime.js +285 -0
- package/dist/vector-cortex/_acceptance-vc2b-conformance.js +92 -0
- package/dist/vector-cortex/_acceptance-vc2b-heads.js +221 -0
- package/dist/vector-cortex/dedup-attr/rollup.js +97 -0
- package/dist/vector-cortex/encoder/asset.js +3 -2
- package/dist/vector-cortex/encoder/decision.js +75 -0
- package/dist/vector-cortex/encoder/types-vc2c.js +41 -0
- package/dist/vector-cortex/encoder/types.js +13 -34
- package/extensions/dashboard-client/dist/assets/{AreaChart-BT7YPcp7.js → AreaChart-Cn6X7epL.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-BT7YPcp7.js.map → AreaChart-Cn6X7epL.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-DceGcBUh.js → BarChart-APy1Wc7z.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-DceGcBUh.js.map → BarChart-APy1Wc7z.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-B9lCouRl.js → CacheTab-CEv_Ss9O.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-B9lCouRl.js.map → CacheTab-CEv_Ss9O.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-oqJ11jY7.js → EventsTab-8jV1Pr0C.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-oqJ11jY7.js.map → EventsTab-8jV1Pr0C.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-Dbosf2Ik.js → HealthTab-B2VgEz1j.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-Dbosf2Ik.js.map → HealthTab-B2VgEz1j.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-6TiApCVE.js → MaintenanceTab-m37AlTbg.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-6TiApCVE.js.map → MaintenanceTab-m37AlTbg.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-cBsE4mTf.js → MemoryMapTab-Co2jbqdT.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-cBsE4mTf.js.map → MemoryMapTab-Co2jbqdT.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsTab-CX-X9hhy.js → MetricsTab-D0yV9X6D.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-CX-X9hhy.js.map → MetricsTab-D0yV9X6D.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-CpPYaTJF.js → OverviewTab-J5TjXB14.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-CpPYaTJF.js.map → OverviewTab-J5TjXB14.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-D_Ot4QbU.js → ReposTab-BadNIkWu.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-D_Ot4QbU.js.map → ReposTab-BadNIkWu.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-BUzO3iGK.js → SessionsTab-CdKShJuR.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-BUzO3iGK.js.map → SessionsTab-CdKShJuR.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-Be4w9v4j.js → SetupTab-CPemizDx.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-Be4w9v4j.js.map → SetupTab-CPemizDx.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-Cx-g6CXH.js → TimeSavedCard-TvULibwW.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-Cx-g6CXH.js.map → TimeSavedCard-TvULibwW.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-CC_7T7ad.js → TurnsTab-CglFIcYy.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnsTab-CC_7T7ad.js.map → TurnsTab-CglFIcYy.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-ZTItXSiH.js → VcStatusBadge-H2bBNhrR.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-ZTItXSiH.js.map → VcStatusBadge-H2bBNhrR.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-DgAUZ4Pg.js → VectorCortexTab-CXPv3sYQ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-DgAUZ4Pg.js.map → VectorCortexTab-CXPv3sYQ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{WikiTab-DnKupXTv.js → WikiTab-BNfN175_.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-DnKupXTv.js.map → WikiTab-BNfN175_.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-CFt3e0yc.js → button-DjN7aqD2.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-CFt3e0yc.js.map → button-DjN7aqD2.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-C6ZjsHrl.js → card-DLHA5XP8.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-C6ZjsHrl.js.map → card-DLHA5XP8.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{client-extra-DdEdGTIe.js → client-extra-ZT6mIQZS.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{client-extra-DdEdGTIe.js.map → client-extra-ZT6mIQZS.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-C9_fu2hc.js → generateCategoricalChart-DAl4dRVG.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-C9_fu2hc.js.map → generateCategoricalChart-DAl4dRVG.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-DY81TY4f.js → index-H-sfROoW.js} +16 -16
- package/extensions/dashboard-client/dist/assets/index-H-sfROoW.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{switch-BOqa1d6x.js → switch-BCxvJYon.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-BOqa1d6x.js.map → switch-BCxvJYon.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-DToFaIEd.js → toggle-DviUMYeg.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-DToFaIEd.js.map → toggle-DviUMYeg.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-CZqkhU18.js → useSSE-DP2O8vHY.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-CZqkhU18.js.map → useSSE-DP2O8vHY.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-server/api-contracts/dedup-attribution.ts +69 -0
- package/extensions/dashboard-server/api-contracts/endpoints/registry-ext.ts +15 -0
- package/extensions/dashboard-server/api-contracts/index.ts +8 -0
- package/extensions/dashboard-server/route-dispatch.ts +2 -0
- package/extensions/dashboard-server/routes-dedup-attribution.ts +166 -0
- package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +12 -0
- package/extensions/dashboard-server/routes.ts +1 -0
- package/package.json +1 -1
- package/src/config/vector-cortex-dedup-attr.ts +16 -0
- package/src/config/vector-cortex-enc0a.ts +34 -0
- package/src/config/vector-cortex.ts +3 -3
- package/src/config.ts +2 -0
- package/src/vector-cortex/_acceptance-enc0a-contract.ts +71 -0
- package/src/vector-cortex/_acceptance-vc2a-conformance.ts +119 -0
- package/src/vector-cortex/_acceptance-vc2a-runtime.ts +300 -0
- package/src/vector-cortex/_acceptance-vc2b-conformance.ts +121 -0
- package/src/vector-cortex/_acceptance-vc2b-heads.ts +234 -0
- package/src/vector-cortex/dedup-attr/rollup.ts +136 -0
- package/src/vector-cortex/encoder/asset.ts +3 -2
- package/src/vector-cortex/encoder/bench-export.ts +2 -2
- package/src/vector-cortex/encoder/decision.ts +125 -0
- package/src/vector-cortex/encoder/runtime-native.ts +1 -1
- package/src/vector-cortex/encoder/runtime-wasm.ts +1 -1
- package/src/vector-cortex/encoder/types-vc2c.ts +124 -0
- package/src/vector-cortex/encoder/types.ts +18 -115
- package/extensions/dashboard-client/dist/assets/index-DY81TY4f.js.map +0 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex/dedup-attr/rollup.ts — DEDUP-ATTR pure tier-attribution rollup.
|
|
3
|
+
*
|
|
4
|
+
* Pure function: reads an array of parsed dedup-audit events, buckets them by
|
|
5
|
+
* tier over a query window, and returns the per-tier catch shares. No I/O, no
|
|
6
|
+
* clock — the route passes `now: Date` (new Date()) at request time, so this
|
|
7
|
+
* module is deterministically reproducible and trivially testable (DEDUP-ATTR-004).
|
|
8
|
+
*
|
|
9
|
+
* Missing `similarity` is fine here: L0/L1 are hash/verify tiers and emit no
|
|
10
|
+
* score, and the rollup never consults it. Malformed lines (non-object, wrong
|
|
11
|
+
* type) are skipped silently — the route's events.log reader already guards its
|
|
12
|
+
* JSON.parse (PREVENT-001), and this layer defends against a hostile/mixed
|
|
13
|
+
* `dedup_audit` array as well.
|
|
14
|
+
*
|
|
15
|
+
* The returned shape is structurally identical to the authoritative contract in
|
|
16
|
+
* `extensions/dashboard-server/api-contracts/dedup-attribution.ts` (the existing
|
|
17
|
+
* src-mirrors-dashboard-contract pattern); src/ stays pi-agnostic and never
|
|
18
|
+
* imports dashboard types. Status here is computed from the pure signal the
|
|
19
|
+
* rollup owns (a non-empty window) — the route additionally derives the sent
|
|
20
|
+
* `status` via `deriveVcStatus` from the shared vc-status module.
|
|
21
|
+
*
|
|
22
|
+
* Guardrails: PREVENT-PI-004 (zero I/O/network), PREVENT-011 (no `any`).
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { DedupAuditEvent } from "../../vectorStore/dedup-audit.js";
|
|
26
|
+
|
|
27
|
+
/** Per-tier dedup/passed counts (same shape as the api-contract DedupTierCounts). */
|
|
28
|
+
export interface DedupTierRollupCounts {
|
|
29
|
+
/** Decisions this tier collapsed onto a matched checkpoint. */
|
|
30
|
+
readonly deduped: number;
|
|
31
|
+
/** Decisions this tier scored a candidate but did not collapse. */
|
|
32
|
+
readonly passed: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The status the rollup can produce from its pure signal. */
|
|
36
|
+
export type RollupStatus = "live" | "awaiting_data";
|
|
37
|
+
|
|
38
|
+
/** Purely-computed tier attribution for one window (mirrors DedupTierRollupV1). */
|
|
39
|
+
export interface DedupTierRollup {
|
|
40
|
+
readonly schema: "dedup-tier-rollup-v1";
|
|
41
|
+
readonly windowStart: string;
|
|
42
|
+
readonly windowEnd: string;
|
|
43
|
+
readonly totalDecisions: number;
|
|
44
|
+
readonly byTier: {
|
|
45
|
+
readonly l0: DedupTierRollupCounts;
|
|
46
|
+
readonly l1: DedupTierRollupCounts;
|
|
47
|
+
readonly l2: DedupTierRollupCounts;
|
|
48
|
+
readonly new: number;
|
|
49
|
+
};
|
|
50
|
+
readonly l0Share: number;
|
|
51
|
+
readonly l1Share: number;
|
|
52
|
+
readonly l2Share: number;
|
|
53
|
+
readonly status: RollupStatus;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface Accumulator {
|
|
57
|
+
l0: { deduped: number; passed: number };
|
|
58
|
+
l1: { deduped: number; passed: number };
|
|
59
|
+
l2: { deduped: number; passed: number };
|
|
60
|
+
storedNew: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Roll up dedup-audit events over [now - windowMs, now] into per-tier shares.
|
|
65
|
+
*
|
|
66
|
+
* Only events whose ISO-8601 `ts` falls inside the window are counted; events of
|
|
67
|
+
* any other `type` (or a missing/unparseable `ts`) are skipped silently. Shares
|
|
68
|
+
* are fractions of the window's total decisions, each in [0, 1]; an empty window
|
|
69
|
+
* yields all-zero shares with `status:"awaiting_data"` — never a fabricated
|
|
70
|
+
* zero-share table presented as real.
|
|
71
|
+
*/
|
|
72
|
+
export function computeDedupTierRollup(
|
|
73
|
+
events: readonly DedupAuditEvent[],
|
|
74
|
+
windowMs: number,
|
|
75
|
+
now: Date,
|
|
76
|
+
): DedupTierRollup {
|
|
77
|
+
const winMs = windowMs > 0 ? windowMs : 24 * 60 * 60 * 1000;
|
|
78
|
+
const windowStart = now.getTime() - winMs;
|
|
79
|
+
const windowEnd = now.getTime();
|
|
80
|
+
|
|
81
|
+
const acc: Accumulator = {
|
|
82
|
+
l0: { deduped: 0, passed: 0 },
|
|
83
|
+
l1: { deduped: 0, passed: 0 },
|
|
84
|
+
l2: { deduped: 0, passed: 0 },
|
|
85
|
+
storedNew: 0,
|
|
86
|
+
};
|
|
87
|
+
let total = 0;
|
|
88
|
+
|
|
89
|
+
for (const ev of events) {
|
|
90
|
+
if (!ev || typeof ev !== "object") continue;
|
|
91
|
+
if (ev.type !== "dedup_audit") continue;
|
|
92
|
+
const ts = Date.parse(ev.ts);
|
|
93
|
+
if (Number.isNaN(ts) || ts < windowStart || ts > windowEnd) continue;
|
|
94
|
+
total += 1;
|
|
95
|
+
switch (ev.tier) {
|
|
96
|
+
case "L0":
|
|
97
|
+
if (ev.status === "deduped") acc.l0.deduped += 1;
|
|
98
|
+
else if (ev.status === "passed") acc.l0.passed += 1;
|
|
99
|
+
break;
|
|
100
|
+
case "L1":
|
|
101
|
+
if (ev.status === "deduped") acc.l1.deduped += 1;
|
|
102
|
+
else if (ev.status === "passed") acc.l1.passed += 1;
|
|
103
|
+
break;
|
|
104
|
+
case "L2":
|
|
105
|
+
if (ev.status === "deduped") acc.l2.deduped += 1;
|
|
106
|
+
else if (ev.status === "passed") acc.l2.passed += 1;
|
|
107
|
+
break;
|
|
108
|
+
case "new":
|
|
109
|
+
acc.storedNew += 1;
|
|
110
|
+
break;
|
|
111
|
+
default:
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const byTier = {
|
|
117
|
+
l0: { deduped: acc.l0.deduped, passed: acc.l0.passed },
|
|
118
|
+
l1: { deduped: acc.l1.deduped, passed: acc.l1.passed },
|
|
119
|
+
l2: { deduped: acc.l2.deduped, passed: acc.l2.passed },
|
|
120
|
+
new: acc.storedNew,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const shareOf = (n: number): number => (total > 0 ? n / total : 0);
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
schema: "dedup-tier-rollup-v1",
|
|
127
|
+
windowStart: new Date(windowStart).toISOString(),
|
|
128
|
+
windowEnd: now.toISOString(),
|
|
129
|
+
totalDecisions: total,
|
|
130
|
+
byTier,
|
|
131
|
+
l0Share: shareOf(acc.l0.deduped + acc.l0.passed),
|
|
132
|
+
l1Share: shareOf(acc.l1.deduped + acc.l1.passed),
|
|
133
|
+
l2Share: shareOf(acc.l2.deduped + acc.l2.passed),
|
|
134
|
+
status: total > 0 ? "live" : "awaiting_data",
|
|
135
|
+
};
|
|
136
|
+
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* vector-cortex/encoder/asset.ts — VC2A asset verification (task 2).
|
|
3
3
|
*
|
|
4
4
|
* Verifies a ModelManifestV1 before any allocation: SHA-256 the ONNX and
|
|
5
|
-
* tokenizer against the manifest digests, require opset
|
|
5
|
+
* tokenizer against the manifest digests, require opset 21 (ENC-0a re-baseline),
|
|
6
|
+
* batch exactly 1 and
|
|
6
7
|
* maximum 512 tokens, and confirm the current platform is in the supported
|
|
7
8
|
* matrix. On ANY of these the caller demotes to mode B (asset-free trigram) —
|
|
8
9
|
* never a remote fetch (PREVENT-PI-004). A truncated/unreadable asset during
|
|
@@ -88,7 +89,7 @@ function isManifest(m: unknown): m is ModelManifestV1 {
|
|
|
88
89
|
*
|
|
89
90
|
* - manifest parse/shape failure -> ENC_MANIFEST_INVALID -> mode B
|
|
90
91
|
* - unsupported platform -> ENC_PLATFORM_UNSUPPORTED -> mode B
|
|
91
|
-
* - opset !=
|
|
92
|
+
* - opset != 21 -> ENC_OPSET_INVALID -> mode B
|
|
92
93
|
* - batch != 1 -> ENC_BATCH_INVALID -> mode B
|
|
93
94
|
* - maxTokens > 512 -> ENC_TOKENS_EXCEEDED -> mode B
|
|
94
95
|
* - on-disk digest != manifest digest -> ENC_DIGEST_MISMATCH (one-byte mutation)
|
|
@@ -17,7 +17,7 @@ export interface BenchGatesV1 {
|
|
|
17
17
|
readonly latency: boolean;
|
|
18
18
|
/** steady-state marginal RSS over the process baseline <= 150 MiB. */
|
|
19
19
|
readonly rss: boolean;
|
|
20
|
-
/** the loaded model's declared opset_import equals
|
|
20
|
+
/** the loaded model's declared opset_import equals ENCODER_OPSET (21, ENC-0a re-baseline). */
|
|
21
21
|
readonly opset: boolean;
|
|
22
22
|
/** SHA-256 of the embedding output identical across 3 runs (maxAbsDelta=0). */
|
|
23
23
|
readonly determinism: boolean;
|
|
@@ -53,7 +53,7 @@ export interface BenchResultV1 {
|
|
|
53
53
|
readonly rssBaselineMib: number | null;
|
|
54
54
|
/** rssMib - rssBaselineMib: the encoder's marginal footprint. */
|
|
55
55
|
readonly rssMarginalMib: number | null;
|
|
56
|
-
/** declared opset_import (
|
|
56
|
+
/** declared opset_import (21, ENC-0a re-baseline); null when no asset manifest is readable. */
|
|
57
57
|
readonly opset: number | null;
|
|
58
58
|
/** true when the output SHA-256 is identical across 3 runs. */
|
|
59
59
|
readonly deterministic: boolean;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex/encoder/decision.ts — ENC-0a backend-decision contract.
|
|
3
|
+
*
|
|
4
|
+
* The durable EncoderBackendDecisionV1 record: which ONNX runtime backend the
|
|
5
|
+
* real learned encoder ships on (transformers.js/WASM vs onnxruntime-node
|
|
6
|
+
* native), whether the 80 MiB install budget holds, the per-platform install
|
|
7
|
+
* matrix, the opset baseline (locked 21 by ENC-0a), the license verdict, and
|
|
8
|
+
* the pinned model/tokenizer sha256 digests.
|
|
9
|
+
*
|
|
10
|
+
* ENC-0a is the DECISION + MEASUREMENT sprint: this contract is what the
|
|
11
|
+
* deterministic resolver (`scripts/encoder/resolve-backend-decision.mjs`) and
|
|
12
|
+
* the durable record (`docs/vector-cortex/encoder-backend-decision.md`) both
|
|
13
|
+
* consume. ENC-0a also owns the opset flip: ENCODER_OPSET is re-baselined to 21
|
|
14
|
+
* in `types.ts` alongside the placeholder manifest (the 2026-08-05 trunk
|
|
15
|
+
* research dropped the earlier Xenova opset-17 requirement). ENC-0b asserts the
|
|
16
|
+
* staged real asset is opset 21 — no further constant change.
|
|
17
|
+
*
|
|
18
|
+
* Contract-first (ENGINEERING_PRACTICES §3). Pi-agnostic, dependency-free
|
|
19
|
+
* (PREVENT-PI-004 — local computation only, never a fetch). No `any`
|
|
20
|
+
* (PREVENT-011).
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import type { EncoderPlatform } from "./types.js";
|
|
24
|
+
|
|
25
|
+
/** Backend demotion disposition for a platform row. */
|
|
26
|
+
export type BackendDemotion = "none" | "wasm" | "modeB";
|
|
27
|
+
|
|
28
|
+
/** One platform row: the concrete runtime + install size + demotion disposition. */
|
|
29
|
+
export interface EncoderPlatformRow {
|
|
30
|
+
readonly runtime: string;
|
|
31
|
+
readonly installMiB: number;
|
|
32
|
+
readonly demotion: BackendDemotion;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* EncoderBackendDecisionV1 — the locked learned-encoder runtime-backend decision.
|
|
37
|
+
*
|
|
38
|
+
* `opset` is pinned to the literal 21 (the ENC-0a re-baseline); `artifacts`
|
|
39
|
+
* carries only aggregate digests/sizes — never message content (EVAL-REDACT-002);
|
|
40
|
+
* `blockedBy` names the open hard-gate items that DEFER part of the decision
|
|
41
|
+
* (e.g. HG-4 — the darwin-x64 demotion is ENC-0e's job).
|
|
42
|
+
*/
|
|
43
|
+
export interface EncoderBackendDecisionV1 {
|
|
44
|
+
readonly schema: "encoder-backend-decision-v1";
|
|
45
|
+
readonly backend: "wasm" | "native";
|
|
46
|
+
readonly budgetOk: boolean;
|
|
47
|
+
readonly opset: 21;
|
|
48
|
+
readonly platformMatrix: Readonly<Record<EncoderPlatform, EncoderPlatformRow>>;
|
|
49
|
+
readonly license: { readonly spdx: "MIT"; readonly redistribution: true };
|
|
50
|
+
readonly artifacts: {
|
|
51
|
+
readonly model: { readonly path: string; readonly bytes: number; readonly sha256: string };
|
|
52
|
+
readonly tokenizer: { readonly path: string; readonly bytes: number; readonly sha256: string };
|
|
53
|
+
};
|
|
54
|
+
readonly p95Ms: number | null;
|
|
55
|
+
readonly blockedBy: readonly string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The normative ENC-0a budget: the 80 MiB install/asset cap (MODEL_ASSET.md
|
|
60
|
+
* §Qualification). Backend qualifies (budgetOk) iff the shipped byte-count fits.
|
|
61
|
+
*/
|
|
62
|
+
export const ENCODER_INSTALL_BUDGET_MIB = 80;
|
|
63
|
+
|
|
64
|
+
/** The p95 latency gate at 512 tokens / 4 threads on linux-x64 (ms). */
|
|
65
|
+
export const ENCODER_DECISION_P95_MS = 40;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* buildDecision — assemble a valid, platform-complete EncoderBackendDecisionV1.
|
|
69
|
+
*
|
|
70
|
+
* Pure helper consumed by the acceptance aggregator (and any TS consumer of the
|
|
71
|
+
* decision). Every EncoderPlatform must resolve to a row, and the passed
|
|
72
|
+
* per-platform rows must be complete (no row omitted) — a partial matrix is a
|
|
73
|
+
* contract violation, not a valid decision. All fields are passed in; this is a
|
|
74
|
+
* structural constructor, not a rules engine (the resolver owns the decision
|
|
75
|
+
* rule).
|
|
76
|
+
*/
|
|
77
|
+
export function buildDecision(input: {
|
|
78
|
+
readonly backend: "wasm" | "native";
|
|
79
|
+
readonly budgetOk: boolean;
|
|
80
|
+
readonly p95Ms: number | null;
|
|
81
|
+
readonly platformMatrix: Readonly<Record<EncoderPlatform, EncoderPlatformRow>>;
|
|
82
|
+
readonly modelPath: string;
|
|
83
|
+
readonly modelBytes: number;
|
|
84
|
+
readonly modelSha256: string;
|
|
85
|
+
readonly tokenizerPath: string;
|
|
86
|
+
readonly tokenizerBytes: number;
|
|
87
|
+
readonly tokenizerSha256: string;
|
|
88
|
+
readonly blockedBy: readonly string[];
|
|
89
|
+
}): EncoderBackendDecisionV1 {
|
|
90
|
+
const { platformMatrix } = input;
|
|
91
|
+
const platforms: readonly EncoderPlatform[] = [
|
|
92
|
+
"linux-x64",
|
|
93
|
+
"linux-arm64",
|
|
94
|
+
"darwin-x64",
|
|
95
|
+
"darwin-arm64",
|
|
96
|
+
"win32-x64",
|
|
97
|
+
];
|
|
98
|
+
for (const p of platforms) {
|
|
99
|
+
if (!Object.prototype.hasOwnProperty.call(platformMatrix, p)) {
|
|
100
|
+
throw new Error(`platform matrix is incomplete: missing row for ${p}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
schema: "encoder-backend-decision-v1",
|
|
105
|
+
backend: input.backend,
|
|
106
|
+
budgetOk: input.budgetOk,
|
|
107
|
+
opset: 21,
|
|
108
|
+
platformMatrix,
|
|
109
|
+
license: { spdx: "MIT", redistribution: true },
|
|
110
|
+
artifacts: {
|
|
111
|
+
model: {
|
|
112
|
+
path: input.modelPath,
|
|
113
|
+
bytes: input.modelBytes,
|
|
114
|
+
sha256: input.modelSha256,
|
|
115
|
+
},
|
|
116
|
+
tokenizer: {
|
|
117
|
+
path: input.tokenizerPath,
|
|
118
|
+
bytes: input.tokenizerBytes,
|
|
119
|
+
sha256: input.tokenizerSha256,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
p95Ms: input.p95Ms,
|
|
123
|
+
blockedBy: input.blockedBy,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -45,7 +45,7 @@ export interface OrtNativeModule {
|
|
|
45
45
|
|
|
46
46
|
/** The backend's inference session — a thin wrapper over the real native session. */
|
|
47
47
|
export interface NativeSession {
|
|
48
|
-
/** The declared ONNX opset in the loaded manifest (normative
|
|
48
|
+
/** The declared ONNX opset in the loaded manifest (normative 21). */
|
|
49
49
|
readonly opset: number;
|
|
50
50
|
/** The semantic embedding width (normative 384). */
|
|
51
51
|
readonly semanticWidth: number;
|
|
@@ -45,7 +45,7 @@ export interface OrtWasmModule {
|
|
|
45
45
|
|
|
46
46
|
/** The backend's inference session — a thin wrapper over the real WASM session. */
|
|
47
47
|
export interface WasmSession {
|
|
48
|
-
/** The declared ONNX opset in the loaded manifest (normative
|
|
48
|
+
/** The declared ONNX opset in the loaded manifest (normative 21). */
|
|
49
49
|
readonly opset: number;
|
|
50
50
|
/** The semantic embedding width (normative 384). */
|
|
51
51
|
readonly semanticWidth: number;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex/encoder/types-vc2c.ts — VC2C qualification + calibration
|
|
3
|
+
* contracts (QualifiedEncoderV1 / CalibrationV1 / EVALUATION_THRESHOLDS).
|
|
4
|
+
*
|
|
5
|
+
* Extracted from types.ts (delegate-shell split) when types.ts crossed the
|
|
6
|
+
* 300-line soft limit. types.ts re-exports everything here; consumers import
|
|
7
|
+
* from types.ts unchanged.
|
|
8
|
+
*
|
|
9
|
+
* Pi-agnostic and dependency-free (PREVENT-PI-004). No `any` (PREVENT-011).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { EncoderHeadName } from "./types.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Held-out metrics recorded as qualification evidence for a candidate asset
|
|
16
|
+
* (EVALUATION.md §metrics). Semantic metrics are Spearman rho + recall@10;
|
|
17
|
+
* dependency directed precision/recall; contradiction precision/recall/ECE;
|
|
18
|
+
* cache precision/recall; payload-routing macro-F1 + exact/anchor recall;
|
|
19
|
+
* reconstruction is the binary causality/exact/closure/task-success set. The
|
|
20
|
+
* qualification decision (task 3 `select.ts`) consumes ONLY the per-head rows
|
|
21
|
+
* this record carries; the true EVALUATION thresholds are the normative
|
|
22
|
+
* constants in MODEL_ASSET (mirrored in `EVALUATION_THRESHOLDS` below).
|
|
23
|
+
*/
|
|
24
|
+
export interface EncoderHeldOutMetrics {
|
|
25
|
+
/** Semantic: Spearman rho (>= .75) and recall@10 (>= .90). */
|
|
26
|
+
readonly semantic: { readonly spearman: number; readonly recallAt10: number };
|
|
27
|
+
/** Dependency: directed precision (>= .97) and recall (>= .95). */
|
|
28
|
+
readonly dependency: { readonly precision: number; readonly recall: number };
|
|
29
|
+
/** Contradiction: precision (>= .98), recall (>= .90), ECE (<= .05). */
|
|
30
|
+
readonly contradiction: { readonly precision: number; readonly recall: number; readonly ece: number };
|
|
31
|
+
/** Cache: precision (>= .999, zero false-stable) and recall (>= .90). */
|
|
32
|
+
readonly cacheStability: { readonly precision: number; readonly recall: number };
|
|
33
|
+
/** Payload routing: macro-F1 (>= .97) and exact/anchor recall (1.0). */
|
|
34
|
+
readonly payloadRouting: { readonly macroF1: number; readonly exactAnchorRecall: number };
|
|
35
|
+
/** Reconstruction: binary gates — zero causal/tool/anchor/exact violations. */
|
|
36
|
+
readonly reconstruction: {
|
|
37
|
+
readonly votesOk: boolean;
|
|
38
|
+
readonly dependencyClosureRecall: number;
|
|
39
|
+
readonly taskSuccessNonInferior: boolean;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Normative per-head + asset qualification thresholds (MODEL_ASSET §qualification
|
|
44
|
+
* + EVALUATION.md §metrics). These are the constants `select.ts` evaluates the
|
|
45
|
+
* candidate's held-out metrics against (task 3 atomic check). */
|
|
46
|
+
export const EVALUATION_THRESHOLDS = {
|
|
47
|
+
semantic: { spearman: 0.75, recallAt10: 0.9 },
|
|
48
|
+
dependency: { precision: 0.97, recall: 0.95 },
|
|
49
|
+
contradiction: { precision: 0.98, recall: 0.9, ece: 0.05 },
|
|
50
|
+
cacheStability: { precision: 0.999, recall: 0.9 },
|
|
51
|
+
payloadRouting: { macroF1: 0.97, exactAnchorRecall: 1.0 },
|
|
52
|
+
reconstruction: { dependencyClosureRecall: 1.0 },
|
|
53
|
+
asset: { maxTokens: 512, maxLatencyP95Ms: 40, maxRssDeltaMib: 150 },
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* CalibrationV1 — fitted temperature/isotonic calibration, frozen on the
|
|
58
|
+
* CALIBRATION split only (VC2C task 2). Held-out test labels NEVER enter the
|
|
59
|
+
* fit inputs (calibration-fit prohibition). The split digest proves the exact
|
|
60
|
+
* calibration assignment (grouped by repository+session); the frozen temp/threshold
|
|
61
|
+
* values are what `select.ts` stamps into a `QualifiedEncoderV1`.
|
|
62
|
+
*/
|
|
63
|
+
export interface CalibrationV1 {
|
|
64
|
+
readonly schema: "calibration-v1";
|
|
65
|
+
readonly headOrder: readonly EncoderHeadName[];
|
|
66
|
+
/** SHA-256 of the calibration split assignment (grouped repository+session). */
|
|
67
|
+
readonly calibrationSplitDigest: string;
|
|
68
|
+
/** Fitted on the calibration split only; held-out labels excluded from fit. */
|
|
69
|
+
readonly fittedOnCalibrationOnly: true;
|
|
70
|
+
/** Frozen per-head temperature (isotonic calibration reference points). */
|
|
71
|
+
readonly temperatures: Readonly<Record<EncoderHeadName, number>>;
|
|
72
|
+
/** Frozen per-head decision thresholds for the qualified decision. */
|
|
73
|
+
readonly thresholds: Readonly<Record<EncoderHeadName, number>>;
|
|
74
|
+
/** Seed of the deterministic calibration fit. */
|
|
75
|
+
readonly seed: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* QualifiedEncoderV1 — the VC2C-owned eligibility record (mode A). Produced by
|
|
80
|
+
* `select.ts` ONLY when EVERY MODEL_ASSET + per-head EVALUATION threshold
|
|
81
|
+
* passes (atomic — one failed field demotes all of A). Pins the asset digest,
|
|
82
|
+
* the calibration digest, the held-out metrics that justified eligibility, and
|
|
83
|
+
* the calibration reference, so VC3A receives a fully self-describing candidate.
|
|
84
|
+
*/
|
|
85
|
+
export interface QualifiedEncoderV1 {
|
|
86
|
+
readonly schema: "qualified-encoder-v1";
|
|
87
|
+
readonly modelVersion: string;
|
|
88
|
+
readonly mode: "A";
|
|
89
|
+
/** SHA-256 of the asset manifest bytes (ModelManifestV1) that qualified.
|
|
90
|
+
* Identical semantics to the dashboard health card's `encoderAssetDigest`
|
|
91
|
+
* (both hash the committed manifest.json ModelManifestV1 bytes), so
|
|
92
|
+
* downstream consumers (VC3A) pin the same digest across the seam. */
|
|
93
|
+
readonly assetDigest: string;
|
|
94
|
+
/** SHA-256 of the calibration split assignment (grouped repository+session)
|
|
95
|
+
* that the CalibrationV1 was fitted on — the calibration's core identity. */
|
|
96
|
+
readonly calibrationDigest: string;
|
|
97
|
+
/** SHA-256 of the qualified asset's verified ONNX bytes (digest-pinned). */
|
|
98
|
+
readonly onnxDigest: string;
|
|
99
|
+
/** Held-out metrics recorded as the eligibility evidence. */
|
|
100
|
+
readonly heldOut: EncoderHeldOutMetrics;
|
|
101
|
+
/** Calibration reference this qualification is grounded in. */
|
|
102
|
+
readonly calibration: CalibrationV1;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** VC2C-specific qualification failure codes (returned, never thrown). */
|
|
106
|
+
export const ENC_QUALIFICATION_FAIL = {
|
|
107
|
+
/** The qualification manifest hash does not match the calibration that was fit
|
|
108
|
+
* (corrupt qualification manifest after calibration before selection). */
|
|
109
|
+
DIGEST_MISMATCH: "ENC_QUALIFICATION_DIGEST_MISMATCH",
|
|
110
|
+
/** One or more per-head EVALUATION thresholds failed (demotes all of A). */
|
|
111
|
+
THRESHOLD_FAILED: "ENC_QUALIFICATION_THRESHOLD_FAILED",
|
|
112
|
+
/** An asset-field qualification check (asset/latency/RSS) failed. */
|
|
113
|
+
ASSET_FAILED: "ENC_QUALIFICATION_ASSET_FAILED",
|
|
114
|
+
/** Calibration was attempted using held-out labels (fit prohibition). */
|
|
115
|
+
HELD_OUT_IN_FIT: "ENC_QUALIFICATION_HELD_OUT_IN_FIT",
|
|
116
|
+
} as const;
|
|
117
|
+
|
|
118
|
+
/** The 4 registered VC2C conformance IDs (task 1: "register ENC-017..020"). */
|
|
119
|
+
export const ENC2C_IDS: readonly string[] = [
|
|
120
|
+
"ENC-017",
|
|
121
|
+
"ENC-018",
|
|
122
|
+
"ENC-019",
|
|
123
|
+
"ENC-020",
|
|
124
|
+
];
|
|
@@ -34,8 +34,13 @@ export const ENCODER_SUPPORTED_PLATFORMS: readonly EncoderPlatform[] = [
|
|
|
34
34
|
"win32-x64",
|
|
35
35
|
];
|
|
36
36
|
|
|
37
|
-
/** ONNX opset required by the normative v1 target
|
|
38
|
-
|
|
37
|
+
/** ONNX opset required by the normative v1 target. ENC-0a re-baselines from 17
|
|
38
|
+
* to 21: the committed placeholder asset (assets/vector-cortex/encoder-v1/)
|
|
39
|
+
* declares opset 21 in its manifest (the 2026-08-05 BAAI/bge-small-en-v1.5
|
|
40
|
+
* upstream export is opset 21; the earlier Xenova opset-17 requirement was
|
|
41
|
+
* dropped). The locked decision is recorded in
|
|
42
|
+
* docs/vector-cortex/encoder-backend-decision.md. */
|
|
43
|
+
export const ENCODER_OPSET = 21;
|
|
39
44
|
/** Batch must be exactly 1 (single-request inference). */
|
|
40
45
|
export const ENCODER_BATCH = 1;
|
|
41
46
|
/** Maximum accepted token count (WordPiece, deterministic truncation). */
|
|
@@ -124,7 +129,7 @@ export type EncoderMode = "A" | "B" | "C";
|
|
|
124
129
|
|
|
125
130
|
/** Exact VC2A failure codes (returned, never thrown across the boundary). */
|
|
126
131
|
export const ENC_FAIL = {
|
|
127
|
-
/** opset !=
|
|
132
|
+
/** opset != 21 (ENC-0a re-baseline applied; placeholder manifest updated alongside). */
|
|
128
133
|
OPSET_INVALID: "ENC_OPSET_INVALID",
|
|
129
134
|
/** batch != 1. */
|
|
130
135
|
BATCH_INVALID: "ENC_BATCH_INVALID",
|
|
@@ -275,117 +280,15 @@ export const ENC2B_IDS: readonly string[] = [
|
|
|
275
280
|
];
|
|
276
281
|
|
|
277
282
|
// ---------------------------------------------------------------------------
|
|
278
|
-
// VC2C — encoder qualification + calibration
|
|
283
|
+
// VC2C — encoder qualification + calibration: extracted to types-vc2c.ts
|
|
284
|
+
// (delegate-shell split, soft-limit compliance). Re-exported here.
|
|
279
285
|
// ---------------------------------------------------------------------------
|
|
280
286
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
* constants in MODEL_ASSET (mirrored in `EVALUATION_THRESHOLDS` below).
|
|
290
|
-
*/
|
|
291
|
-
export interface EncoderHeldOutMetrics {
|
|
292
|
-
/** Semantic: Spearman rho (>= .75) and recall@10 (>= .90). */
|
|
293
|
-
readonly semantic: { readonly spearman: number; readonly recallAt10: number };
|
|
294
|
-
/** Dependency: directed precision (>= .97) and recall (>= .95). */
|
|
295
|
-
readonly dependency: { readonly precision: number; readonly recall: number };
|
|
296
|
-
/** Contradiction: precision (>= .98), recall (>= .90), ECE (<= .05). */
|
|
297
|
-
readonly contradiction: { readonly precision: number; readonly recall: number; readonly ece: number };
|
|
298
|
-
/** Cache: precision (>= .999, zero false-stable) and recall (>= .90). */
|
|
299
|
-
readonly cacheStability: { readonly precision: number; readonly recall: number };
|
|
300
|
-
/** Payload routing: macro-F1 (>= .97) and exact/anchor recall (1.0). */
|
|
301
|
-
readonly payloadRouting: { readonly macroF1: number; readonly exactAnchorRecall: number };
|
|
302
|
-
/** Reconstruction: binary gates — zero causal/tool/anchor/exact violations. */
|
|
303
|
-
readonly reconstruction: {
|
|
304
|
-
readonly votesOk: boolean;
|
|
305
|
-
readonly dependencyClosureRecall: number;
|
|
306
|
-
readonly taskSuccessNonInferior: boolean;
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/** Normative per-head + asset qualification thresholds (MODEL_ASSET §qualification
|
|
311
|
-
* + EVALUATION.md §metrics). These are the constants `select.ts` evaluates the
|
|
312
|
-
* candidate's held-out metrics against (task 3 atomic check). */
|
|
313
|
-
export const EVALUATION_THRESHOLDS = {
|
|
314
|
-
semantic: { spearman: 0.75, recallAt10: 0.9 },
|
|
315
|
-
dependency: { precision: 0.97, recall: 0.95 },
|
|
316
|
-
contradiction: { precision: 0.98, recall: 0.9, ece: 0.05 },
|
|
317
|
-
cacheStability: { precision: 0.999, recall: 0.9 },
|
|
318
|
-
payloadRouting: { macroF1: 0.97, exactAnchorRecall: 1.0 },
|
|
319
|
-
reconstruction: { dependencyClosureRecall: 1.0 },
|
|
320
|
-
asset: { maxTokens: 512, maxLatencyP95Ms: 40, maxRssDeltaMib: 150 },
|
|
321
|
-
} as const;
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* CalibrationV1 — fitted temperature/isotonic calibration, frozen on the
|
|
325
|
-
* CALIBRATION split only (VC2C task 2). Held-out test labels NEVER enter the
|
|
326
|
-
* fit inputs (calibration-fit prohibition). The split digest proves the exact
|
|
327
|
-
* calibration assignment (grouped by repository+session); the frozen temp/threshold
|
|
328
|
-
* values are what `select.ts` stamps into a `QualifiedEncoderV1`.
|
|
329
|
-
*/
|
|
330
|
-
export interface CalibrationV1 {
|
|
331
|
-
readonly schema: "calibration-v1";
|
|
332
|
-
readonly headOrder: readonly EncoderHeadName[];
|
|
333
|
-
/** SHA-256 of the calibration split assignment (grouped repository+session). */
|
|
334
|
-
readonly calibrationSplitDigest: string;
|
|
335
|
-
/** Fitted on the calibration split only; held-out labels excluded from fit. */
|
|
336
|
-
readonly fittedOnCalibrationOnly: true;
|
|
337
|
-
/** Frozen per-head temperature (isotonic calibration reference points). */
|
|
338
|
-
readonly temperatures: Readonly<Record<EncoderHeadName, number>>;
|
|
339
|
-
/** Frozen per-head decision thresholds for the qualified decision. */
|
|
340
|
-
readonly thresholds: Readonly<Record<EncoderHeadName, number>>;
|
|
341
|
-
/** Seed of the deterministic calibration fit. */
|
|
342
|
-
readonly seed: number;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* QualifiedEncoderV1 — the VC2C-owned eligibility record (mode A). Produced by
|
|
347
|
-
* `select.ts` ONLY when EVERY MODEL_ASSET + per-head EVALUATION threshold
|
|
348
|
-
* passes (atomic — one failed field demotes all of A). Pins the asset digest,
|
|
349
|
-
* the calibration digest, the held-out metrics that justified eligibility, and
|
|
350
|
-
* the calibration reference, so VC3A receives a fully self-describing candidate.
|
|
351
|
-
*/
|
|
352
|
-
export interface QualifiedEncoderV1 {
|
|
353
|
-
readonly schema: "qualified-encoder-v1";
|
|
354
|
-
readonly modelVersion: string;
|
|
355
|
-
readonly mode: "A";
|
|
356
|
-
/** SHA-256 of the asset manifest bytes (ModelManifestV1) that qualified.
|
|
357
|
-
* Identical semantics to the dashboard health card's `encoderAssetDigest`
|
|
358
|
-
* (both hash the committed manifest.json ModelManifestV1 bytes), so
|
|
359
|
-
* downstream consumers (VC3A) pin the same digest across the seam. */
|
|
360
|
-
readonly assetDigest: string;
|
|
361
|
-
/** SHA-256 of the calibration split assignment (grouped repository+session)
|
|
362
|
-
* that the CalibrationV1 was fitted on — the calibration's core identity. */
|
|
363
|
-
readonly calibrationDigest: string;
|
|
364
|
-
/** SHA-256 of the qualified asset's verified ONNX bytes (digest-pinned). */
|
|
365
|
-
readonly onnxDigest: string;
|
|
366
|
-
/** Held-out metrics recorded as the eligibility evidence. */
|
|
367
|
-
readonly heldOut: EncoderHeldOutMetrics;
|
|
368
|
-
/** Calibration reference this qualification is grounded in. */
|
|
369
|
-
readonly calibration: CalibrationV1;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/** VC2C-specific qualification failure codes (returned, never thrown). */
|
|
373
|
-
export const ENC_QUALIFICATION_FAIL = {
|
|
374
|
-
/** The qualification manifest hash does not match the calibration that was fit
|
|
375
|
-
* (corrupt qualification manifest after calibration before selection). */
|
|
376
|
-
DIGEST_MISMATCH: "ENC_QUALIFICATION_DIGEST_MISMATCH",
|
|
377
|
-
/** One or more per-head EVALUATION thresholds failed (demotes all of A). */
|
|
378
|
-
THRESHOLD_FAILED: "ENC_QUALIFICATION_THRESHOLD_FAILED",
|
|
379
|
-
/** An asset-field qualification check (asset/latency/RSS) failed. */
|
|
380
|
-
ASSET_FAILED: "ENC_QUALIFICATION_ASSET_FAILED",
|
|
381
|
-
/** Calibration was attempted using held-out labels (fit prohibition). */
|
|
382
|
-
HELD_OUT_IN_FIT: "ENC_QUALIFICATION_HELD_OUT_IN_FIT",
|
|
383
|
-
} as const;
|
|
384
|
-
|
|
385
|
-
/** The 4 registered VC2C conformance IDs (task 1: "register ENC-017..020"). */
|
|
386
|
-
export const ENC2C_IDS: readonly string[] = [
|
|
387
|
-
"ENC-017",
|
|
388
|
-
"ENC-018",
|
|
389
|
-
"ENC-019",
|
|
390
|
-
"ENC-020",
|
|
391
|
-
];
|
|
287
|
+
export {
|
|
288
|
+
EVALUATION_THRESHOLDS,
|
|
289
|
+
ENC_QUALIFICATION_FAIL,
|
|
290
|
+
ENC2C_IDS,
|
|
291
|
+
type EncoderHeldOutMetrics,
|
|
292
|
+
type CalibrationV1,
|
|
293
|
+
type QualifiedEncoderV1,
|
|
294
|
+
} from "./types-vc2c.js";
|