pi-mega-compact 0.20.42 → 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.
Files changed (43) hide show
  1. package/assets/vector-cortex/encoder-v1/manifest.json +1 -1
  2. package/dist/config/vector-cortex-enc0a.js +32 -0
  3. package/dist/config/vector-cortex.js +2 -2
  4. package/dist/config.js +1 -1
  5. package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +1 -0
  6. package/dist/src/config/vector-cortex-enc0a.js +32 -0
  7. package/dist/src/config/vector-cortex.js +2 -2
  8. package/dist/src/config.js +1 -1
  9. package/dist/src/vector-cortex/_acceptance-enc0a-contract.js +60 -0
  10. package/dist/src/vector-cortex/_acceptance-vc2a-conformance.js +90 -0
  11. package/dist/src/vector-cortex/_acceptance-vc2a-runtime.js +285 -0
  12. package/dist/src/vector-cortex/_acceptance-vc2b-conformance.js +92 -0
  13. package/dist/src/vector-cortex/_acceptance-vc2b-heads.js +221 -0
  14. package/dist/src/vector-cortex/encoder/asset.js +3 -2
  15. package/dist/src/vector-cortex/encoder/decision.js +75 -0
  16. package/dist/src/vector-cortex/encoder/types-vc2c.js +41 -0
  17. package/dist/src/vector-cortex/encoder/types.js +13 -34
  18. package/dist/vector-cortex/_acceptance-enc0a-contract.js +60 -0
  19. package/dist/vector-cortex/_acceptance-vc2a-conformance.js +90 -0
  20. package/dist/vector-cortex/_acceptance-vc2a-runtime.js +285 -0
  21. package/dist/vector-cortex/_acceptance-vc2b-conformance.js +92 -0
  22. package/dist/vector-cortex/_acceptance-vc2b-heads.js +221 -0
  23. package/dist/vector-cortex/encoder/asset.js +3 -2
  24. package/dist/vector-cortex/encoder/decision.js +75 -0
  25. package/dist/vector-cortex/encoder/types-vc2c.js +41 -0
  26. package/dist/vector-cortex/encoder/types.js +13 -34
  27. package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +6 -0
  28. package/package.json +1 -1
  29. package/src/config/vector-cortex-enc0a.ts +34 -0
  30. package/src/config/vector-cortex.ts +2 -2
  31. package/src/config.ts +1 -0
  32. package/src/vector-cortex/_acceptance-enc0a-contract.ts +71 -0
  33. package/src/vector-cortex/_acceptance-vc2a-conformance.ts +119 -0
  34. package/src/vector-cortex/_acceptance-vc2a-runtime.ts +300 -0
  35. package/src/vector-cortex/_acceptance-vc2b-conformance.ts +121 -0
  36. package/src/vector-cortex/_acceptance-vc2b-heads.ts +234 -0
  37. package/src/vector-cortex/encoder/asset.ts +3 -2
  38. package/src/vector-cortex/encoder/bench-export.ts +2 -2
  39. package/src/vector-cortex/encoder/decision.ts +125 -0
  40. package/src/vector-cortex/encoder/runtime-native.ts +1 -1
  41. package/src/vector-cortex/encoder/runtime-wasm.ts +1 -1
  42. package/src/vector-cortex/encoder/types-vc2c.ts +124 -0
  43. package/src/vector-cortex/encoder/types.ts +18 -115
@@ -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 (opset 17). */
38
- export const ENCODER_OPSET = 17;
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 != 17. */
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 (QualifiedEncoderV1 / CalibrationV1).
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
- * Held-out metrics recorded as qualification evidence for a candidate asset
283
- * (EVALUATION.md §metrics). Semantic metrics are Spearman rho + recall@10;
284
- * dependency directed precision/recall; contradiction precision/recall/ECE;
285
- * cache precision/recall; payload-routing macro-F1 + exact/anchor recall;
286
- * reconstruction is the binary causality/exact/closure/task-success set. The
287
- * qualification decision (task 3 `select.ts`) consumes ONLY the per-head rows
288
- * this record carries; the true EVALUATION thresholds are the normative
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";