pi-mega-compact 0.18.0 → 0.19.0
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 -0
- package/assets/vector-cortex/encoder-v1/model-card.json +1 -0
- package/assets/vector-cortex/encoder-v1/model.onnx +0 -0
- package/assets/vector-cortex/encoder-v1/tokenizer.json +1 -0
- package/dist/config/vector-cortex.js +18 -0
- package/dist/config.js +117 -0
- package/dist/extensions/dashboard-server/routes-rag-settings-helpers.js +4 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex.js +89 -1
- package/dist/log.js +47 -0
- package/dist/src/config/vector-cortex.js +18 -0
- package/dist/src/config.js +1 -1
- package/dist/src/vector-cortex/encoder/calibrate.js +174 -0
- package/dist/src/vector-cortex/encoder/emit-vc2b.js +63 -0
- package/dist/src/vector-cortex/encoder/emit-vc2c.js +59 -0
- package/dist/src/vector-cortex/encoder/fallback.js +62 -0
- package/dist/src/vector-cortex/encoder/heads.js +113 -0
- package/dist/src/vector-cortex/encoder/lexical.js +104 -0
- package/dist/src/vector-cortex/encoder/router.js +115 -0
- package/dist/src/vector-cortex/encoder/select.js +172 -0
- package/dist/src/vector-cortex/encoder/trigram.js +75 -0
- package/dist/src/vector-cortex/encoder/types.js +84 -0
- package/dist/vector-cortex/encoder/calibrate.js +174 -0
- package/dist/vector-cortex/encoder/emit-vc2b.js +63 -0
- package/dist/vector-cortex/encoder/emit-vc2c.js +59 -0
- package/dist/vector-cortex/encoder/fallback.js +62 -0
- package/dist/vector-cortex/encoder/heads.js +113 -0
- package/dist/vector-cortex/encoder/lexical.js +104 -0
- package/dist/vector-cortex/encoder/router.js +115 -0
- package/dist/vector-cortex/encoder/select.js +172 -0
- package/dist/vector-cortex/encoder/trigram.js +75 -0
- package/dist/vector-cortex/encoder/types.js +84 -0
- package/extensions/dashboard-client/dist/assets/{AreaChart-BQXFF7UI.js → AreaChart-DywU5SSt.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-BQXFF7UI.js.map → AreaChart-DywU5SSt.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-BVtoz9Eg.js → BarChart-But7WN6K.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-BVtoz9Eg.js.map → BarChart-But7WN6K.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-trI2TIGy.js → CacheTab-7aZWa1DR.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-trI2TIGy.js.map → CacheTab-7aZWa1DR.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-CNUbk9__.js → EventsTab-Bf_boNG2.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-CNUbk9__.js.map → EventsTab-Bf_boNG2.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-K-bd_CM-.js → HealthTab-AbGc1nXP.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-K-bd_CM-.js.map → HealthTab-AbGc1nXP.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-CoEioKzx.js → MaintenanceTab-BfHHhn5F.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-CoEioKzx.js.map → MaintenanceTab-BfHHhn5F.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-CJo24ulv.js → MemoryMapTab-DrcWti0-.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-CJo24ulv.js.map → MemoryMapTab-DrcWti0-.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsTab-DCNlQWWP.js → MetricsTab-ALiglXQq.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-DCNlQWWP.js.map → MetricsTab-ALiglXQq.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-CQQlyIQ6.js → OverviewTab-nnaJdNyR.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-CQQlyIQ6.js.map → OverviewTab-nnaJdNyR.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-Cqm82_yn.js → ReposTab-BTK0nofM.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-Cqm82_yn.js.map → ReposTab-BTK0nofM.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-A8xTAdET.js → SessionsTab-RXPNqO6x.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-A8xTAdET.js.map → SessionsTab-RXPNqO6x.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-CqaSgaZl.js → SetupTab-Dab0AVfs.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-CqaSgaZl.js.map → SetupTab-Dab0AVfs.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-C_f3q8GR.js → TimeSavedCard-DIVG8hdt.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-C_f3q8GR.js.map → TimeSavedCard-DIVG8hdt.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-BEsafACo.js → TurnsTab-9uz2fBwx.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnsTab-BEsafACo.js.map → TurnsTab-9uz2fBwx.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-DD1CMK80.js → VectorCortexTab-DnKY61EJ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-DnKY61EJ.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{WikiTab-Bf01M2_Z.js → WikiTab-CpcgaggS.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-Bf01M2_Z.js.map → WikiTab-CpcgaggS.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-BEJPTk_E.js → button-B0Q2fuKY.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-BEJPTk_E.js.map → button-B0Q2fuKY.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-DK1V382s.js → card-Cnik3TFr.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-DK1V382s.js.map → card-Cnik3TFr.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-CRtaPphL.js → generateCategoricalChart-DrSwgn1V.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-CRtaPphL.js.map → generateCategoricalChart-DrSwgn1V.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-CB6BslE4.js → index-DraytcOY.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{index-CB6BslE4.js.map → index-DraytcOY.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{switch-C4FV6B9k.js → switch-DVQ1aB9b.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-C4FV6B9k.js.map → switch-DVQ1aB9b.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-GBmeENMd.js → toggle-Dkppx-49.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-GBmeENMd.js.map → toggle-Dkppx-49.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-BOKZGSn1.js → useSSE-CPkjU4Gx.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-BOKZGSn1.js.map → useSSE-CPkjU4Gx.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/tabs/VectorCortexTab.tsx +2 -0
- package/extensions/dashboard-client/src/types/vector-cortex.ts +11 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex.ts +11 -0
- package/extensions/dashboard-server/routes-rag-settings-helpers.ts +14 -0
- package/extensions/dashboard-server/routes-vector-cortex.ts +108 -1
- package/package.json +2 -1
- package/src/config/vector-cortex.ts +20 -0
- package/src/config.ts +2 -0
- package/src/vector-cortex/encoder/calibrate.ts +225 -0
- package/src/vector-cortex/encoder/emit-vc2b.ts +82 -0
- package/src/vector-cortex/encoder/emit-vc2c.ts +70 -0
- package/src/vector-cortex/encoder/fallback.ts +99 -0
- package/src/vector-cortex/encoder/heads.ts +142 -0
- package/src/vector-cortex/encoder/lexical.ts +123 -0
- package/src/vector-cortex/encoder/router.ts +163 -0
- package/src/vector-cortex/encoder/select.ts +237 -0
- package/src/vector-cortex/encoder/trigram.ts +85 -0
- package/src/vector-cortex/encoder/types.ts +226 -0
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-DD1CMK80.js.map +0 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex/encoder/trigram.ts — VC2B mode B: asset-free trigram encoder.
|
|
3
|
+
*
|
|
4
|
+
* Trigram B is a deterministic, asset-free (no learned model, no manifest, no
|
|
5
|
+
* calibration) 512-dim fixed feature encoding of a token/phrase sequence. It is
|
|
6
|
+
* the mode-B fallback selected when the learned asset (mode A) is removed,
|
|
7
|
+
* missing, unsupported, or digest-bad — and it never imports the learned asset
|
|
8
|
+
* or learned calibration (task 4). It derives directly from textual authority:
|
|
9
|
+
* the same document hashed via its byte-level trigrams yields the same 512-dim
|
|
10
|
+
* vector regardless of the asset state.
|
|
11
|
+
*
|
|
12
|
+
* Width is fixed at `ENCODER_TRIGRAM_WIDTH = 512` (VC2B task 4 "trigram B at 512
|
|
13
|
+
* dimensions"). The vector is L2-normalized; a zero-norm (empty) input maps to
|
|
14
|
+
* the all-zero vector, matching the heads convention of the VectorSet.
|
|
15
|
+
*
|
|
16
|
+
* Failure-triad independence: B's algorithm/index is distinct from A (learned
|
|
17
|
+
* projections) and C (token/phrase lexical) — it is a deterministic hashed
|
|
18
|
+
* n-gram bag-of-hashes, computed purely in-process with no external asset.
|
|
19
|
+
*
|
|
20
|
+
* Pi-agnostic, zero network (PREVENT-PI-004), no `any` (PREVENT-011).
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { createHash } from "node:crypto";
|
|
24
|
+
import { l2Normalize } from "./heads.js";
|
|
25
|
+
import {
|
|
26
|
+
createEncoderHeadsReporter,
|
|
27
|
+
type EncoderHeadsReporter,
|
|
28
|
+
} from "./emit-vc2b.js";
|
|
29
|
+
|
|
30
|
+
/** Fixed output width of trigram B (VC2B task 4). */
|
|
31
|
+
export const ENCODER_TRIGRAM_WIDTH = 512;
|
|
32
|
+
|
|
33
|
+
/** Tokenize a phrase into byte-level trigrams (3-byte sliding windows). For a
|
|
34
|
+
* short phrase with fewer than 3 bytes we still emit the available shingles. */
|
|
35
|
+
function trigrams(text: string): string[] {
|
|
36
|
+
const bytes = Buffer.from(text, "utf8");
|
|
37
|
+
if (bytes.length === 0) return [];
|
|
38
|
+
const out: string[] = [];
|
|
39
|
+
const n = bytes.length;
|
|
40
|
+
// `Math.max(1, n - 2)` already emits a single whole-string shingle for 1- and
|
|
41
|
+
// 2-byte phrases (slice(0,3) covers the whole buffer), so there is NO separate
|
|
42
|
+
// short-phrase block — adding one would hash the same shingle twice (Q05).
|
|
43
|
+
for (let i = 0; i < Math.max(1, n - 2); i++) {
|
|
44
|
+
const chunk = bytes.slice(i, i + 3);
|
|
45
|
+
out.push(chunk.toString("hex"));
|
|
46
|
+
}
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Encode a phrase into a 512-dim L2-normalized trigram vector (all-zero on
|
|
52
|
+
* empty input). Deterministic: the same text always yields the same vector
|
|
53
|
+
* (repeat drift == 0) — no asset, no calibration, no network.
|
|
54
|
+
*/
|
|
55
|
+
export function embedTrigram512(text: string): Float32Array {
|
|
56
|
+
const width = ENCODER_TRIGRAM_WIDTH;
|
|
57
|
+
const out = new Float32Array(width);
|
|
58
|
+
// Feistel-style double hashing of each trigram into a bucket index + weight.
|
|
59
|
+
for (const tg of trigrams(text)) {
|
|
60
|
+
const h1 = createHash("sha256").update(tg).digest();
|
|
61
|
+
const bucket = h1.readUInt32BE(0) % width;
|
|
62
|
+
const weight = (h1.readUInt32BE(4) / 4294967295) * 2 - 1;
|
|
63
|
+
out[bucket] += weight;
|
|
64
|
+
}
|
|
65
|
+
return l2Normalize(out);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The 512-dim vector is produced even when the learned asset is absent: this is
|
|
70
|
+
* the mode-B selection point. Returns `{ ok: true, dim, width }` always — there
|
|
71
|
+
* is no asset to consult (task 4 + ENC-FALLBACK-003). Selecting mode B also
|
|
72
|
+
* emits `vector_cortex_encoder_fallback_selected` via the flag-gated reporter
|
|
73
|
+
* (task 5) — the production seam that makes the fallback event live in the
|
|
74
|
+
* runtime, not dead test-only wiring.
|
|
75
|
+
*/
|
|
76
|
+
export function selectTrigramBFallback(
|
|
77
|
+
options: { readonly reporter?: EncoderHeadsReporter } = {},
|
|
78
|
+
): { ok: true; dim: number; width: number; mode: "B" } {
|
|
79
|
+
const reporter = options.reporter ?? createEncoderHeadsReporter();
|
|
80
|
+
const selection = { ok: true as const, mode: "B" as const, dim: ENCODER_TRIGRAM_WIDTH, width: ENCODER_TRIGRAM_WIDTH };
|
|
81
|
+
reporter.fallbackSelected({ mode: selection.mode, dim: selection.dim, width: selection.width });
|
|
82
|
+
return selection;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { l2Normalize };
|
|
@@ -163,3 +163,229 @@ export const ENC_IDS: readonly string[] = [
|
|
|
163
163
|
"ENC-007",
|
|
164
164
|
"ENC-008",
|
|
165
165
|
];
|
|
166
|
+
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
// VC2B — multi-head encoder (VectorSetV1 / HeadCalibrationDraft).
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
|
|
171
|
+
/** The five independent projection heads in STABLE order (MODEL_ASSET
|
|
172
|
+
* §decision record; VC2B task 2 "stable order"). The array order is the
|
|
173
|
+
* normative ordering consumed by consumers: semantic, dependency,
|
|
174
|
+
* contradiction, cache-stability, payload-routing. */
|
|
175
|
+
export const ENCODER_HEAD_ORDER = [
|
|
176
|
+
"semantic",
|
|
177
|
+
"dependency",
|
|
178
|
+
"contradiction",
|
|
179
|
+
"cacheStability",
|
|
180
|
+
"payloadRouting",
|
|
181
|
+
] as const;
|
|
182
|
+
|
|
183
|
+
/** Five head names (stable, matching ENCODER_HEAD_ORDER). */
|
|
184
|
+
export type EncoderHeadName = (typeof ENCODER_HEAD_ORDER)[number];
|
|
185
|
+
|
|
186
|
+
/** The ordered per-head output dimensions: semantic 384, dependency 128,
|
|
187
|
+
* contradiction 128, cacheStability 64, payloadRouting 32 (VC2B task 2). */
|
|
188
|
+
export const ENCODER_HEAD_DIMS: Readonly<Record<EncoderHeadName, number>> = {
|
|
189
|
+
semantic: 384,
|
|
190
|
+
dependency: 128,
|
|
191
|
+
contradiction: 128,
|
|
192
|
+
cacheStability: 64,
|
|
193
|
+
payloadRouting: 32,
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/** Ordered dimension list matching ENCODER_HEAD_ORDER (384/128/128/64/32). */
|
|
197
|
+
export const ENCODER_HEAD_DIM_ORDER: readonly number[] = ENCODER_HEAD_ORDER.map(
|
|
198
|
+
(h) => ENCODER_HEAD_DIMS[h],
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Weighted training losses per head (MODEL_ASSET §data/losses/calibration):
|
|
203
|
+
* semantic .35, dependency .20, contradiction .20, cache .15, payload .10.
|
|
204
|
+
* These are normative (VC2B task 3: "losses exactly .35/.20/.20/.15/.10").
|
|
205
|
+
*/
|
|
206
|
+
export const ENCODER_HEAD_LOSS_WEIGHTS: Readonly<Record<EncoderHeadName, number>> = {
|
|
207
|
+
semantic: 0.35,
|
|
208
|
+
dependency: 0.2,
|
|
209
|
+
contradiction: 0.2,
|
|
210
|
+
cacheStability: 0.15,
|
|
211
|
+
payloadRouting: 0.1,
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/** Sum of the five loss weights must be exactly 1.0 (asserted in tests). */
|
|
215
|
+
export const ENCODER_HEAD_LOSS_SUM = 1.0;
|
|
216
|
+
|
|
217
|
+
/** Deterministic seed shared by Python/NumPy training and ONNX export (VC2B
|
|
218
|
+
* task 3: "seed ... at 1729"). */
|
|
219
|
+
export const ENCODER_SEED = 1729;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* A single produced per-head vector. `head` names the head (stable order),
|
|
223
|
+
* `dim` is that head's declared dimension, `values` is the L2-normalized
|
|
224
|
+
* Float32Array (all-zero when the raw projection had zero norm — VC2B task 2).
|
|
225
|
+
*/
|
|
226
|
+
export interface HeadVector {
|
|
227
|
+
readonly head: EncoderHeadName;
|
|
228
|
+
readonly dim: number;
|
|
229
|
+
readonly values: Float32Array;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* VectorSetV1 — the produced multi-head encoded vectors for one input slice,
|
|
234
|
+
* in STABLE order (semantic → payloadRouting). This is the VC2B-owned contract
|
|
235
|
+
* handed to VC3A ("VC3A receives qualified VectorSet or explicit B/C mode").
|
|
236
|
+
*/
|
|
237
|
+
export interface VectorSetV1 {
|
|
238
|
+
readonly schema: "vector-set-v1";
|
|
239
|
+
readonly inputTokens: readonly number[];
|
|
240
|
+
readonly heads: readonly HeadVector[];
|
|
241
|
+
/** True when every head was L2-normalized (or all-zero on zero norm). */
|
|
242
|
+
readonly normalized: boolean;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* HeadCalibrationDraft — the VC2B-owned calibration draft produced BEFORE
|
|
247
|
+
* training/export logic (task 1). Calibration is FITTED on the calibration
|
|
248
|
+
* split only in VC2C (CalibrationV1); this draft records the frozen per-head
|
|
249
|
+
* losses, seed, dimension order, and the corpus/split digests that training
|
|
250
|
+
* must reproduce (task 3).
|
|
251
|
+
*/
|
|
252
|
+
export interface HeadCalibrationDraft {
|
|
253
|
+
readonly schema: "head-calibration-draft-v1";
|
|
254
|
+
readonly headOrder: readonly EncoderHeadName[];
|
|
255
|
+
readonly dims: Readonly<Record<EncoderHeadName, number>>;
|
|
256
|
+
readonly losses: Readonly<Record<EncoderHeadName, number>>;
|
|
257
|
+
readonly seed: number;
|
|
258
|
+
/** SHA-256 of the training corpus manifest (task 3, persisted). */
|
|
259
|
+
readonly corpusDigest: string;
|
|
260
|
+
/** SHA-256 of the split assignment (train/calibration/test) by
|
|
261
|
+
* repository+session group (EVALUATION.md §corpus). */
|
|
262
|
+
readonly splitDigest: string;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** The 16 registered VC2B conformance IDs (task 1: "register ENC-009..016"). */
|
|
266
|
+
export const ENC2B_IDS: readonly string[] = [
|
|
267
|
+
"ENC-009",
|
|
268
|
+
"ENC-010",
|
|
269
|
+
"ENC-011",
|
|
270
|
+
"ENC-012",
|
|
271
|
+
"ENC-013",
|
|
272
|
+
"ENC-014",
|
|
273
|
+
"ENC-015",
|
|
274
|
+
"ENC-016",
|
|
275
|
+
];
|
|
276
|
+
|
|
277
|
+
// ---------------------------------------------------------------------------
|
|
278
|
+
// VC2C — encoder qualification + calibration (QualifiedEncoderV1 / CalibrationV1).
|
|
279
|
+
// ---------------------------------------------------------------------------
|
|
280
|
+
|
|
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
|
+
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VectorCortexTab-DD1CMK80.js","sources":["../../src/api/vector-cortex.ts","../../src/tabs/VectorCortexTab.tsx"],"sourcesContent":["/**\n * dashboard-client/src/api/vector-cortex.ts — vector-cortex API client.\n * PREVENT-PI-004: relative path only (loopback dashboard).\n */\n\nimport type {\n\tVectorCortexEvaluationSummary,\n\tVectorCortexHealthCard,\n\tVectorCortexLedgerView,\n\tVectorCortexResetResult,\n} from \"../types/vector-cortex\";\n\nexport type {\n\tVectorCortexEvaluationSummary,\n\tVectorCortexHealthCard,\n\tVectorCortexLedgerView,\n\tVectorCortexResetResult,\n};\n\nexport async function fetchVectorCortexEvaluation(): Promise<VectorCortexEvaluationSummary> {\n\tconst r = await fetch(\"/api/vector-cortex/evaluation\");\n\tif (!r.ok) throw new Error(`vector-cortex evaluation: ${r.status}`);\n\treturn r.json() as Promise<VectorCortexEvaluationSummary>;\n}\n\nexport async function fetchVectorCortexHealth(): Promise<VectorCortexHealthCard> {\n\tconst r = await fetch(\"/api/vector-cortex/health\");\n\tif (!r.ok) throw new Error(`vector-cortex health: ${r.status}`);\n\treturn r.json() as Promise<VectorCortexHealthCard>;\n}\n\n/** Reader-only occurrence-ledger identity view (VC1B). */\nexport async function fetchVectorCortexLedger(\n\tsession = \"default\",\n): Promise<VectorCortexLedgerView> {\n\tconst r = await fetch(\n\t\t`/api/vector-cortex/ledger?session=${encodeURIComponent(session)}`,\n\t);\n\tif (!r.ok) throw new Error(`vector-cortex ledger: ${r.status}`);\n\treturn r.json() as Promise<VectorCortexLedgerView>;\n}\n\n/** Admin capability: reset a breaker's cooldown (never evidence). */\nexport async function resetVectorCortexBreaker(\n\tsubsystem: string,\n): Promise<VectorCortexResetResult> {\n\tconst r = await fetch(\"/api/vector-cortex/breakers/reset\", {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\tbody: JSON.stringify({ subsystem }),\n\t});\n\tif (!r.ok) throw new Error(`vector-cortex reset: ${r.status}`);\n\treturn r.json() as Promise<VectorCortexResetResult>;\n}\n","/**\n * VectorCortexTab.tsx — vector-cortex dashboard tab.\n * VC0A: reader-only aggregate latency histogram + per-mode sample counts from\n * GET /api/vector-cortex/evaluation. VC0C (task 5): live safety envelope health\n * card (breaker state, window/probe/backoff, durable spool frontier/lag) from\n * GET /api/vector-cortex/health plus an admin \"reset cooldown\" action. Polls\n * every 5s.\n */\n\nimport { useState, useEffect, useCallback } from \"react\";\nimport {\n\tfetchVectorCortexEvaluation,\n\tfetchVectorCortexHealth,\n\tfetchVectorCortexLedger,\n\tresetVectorCortexBreaker,\n\ttype VectorCortexEvaluationSummary,\n\ttype VectorCortexHealthCard,\n\ttype VectorCortexLedgerView,\n} from \"../api/vector-cortex\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"../components/ui/card\";\nimport { Badge } from \"../components/ui/badge\";\n\nfunction ModeChip({ mode, count }: { mode: string; count: number }): React.ReactElement {\n\treturn (\n\t\t<div className=\"flex items-center justify-between border-b border-border/50 py-1 text-sm\">\n\t\t\t<span className=\"text-muted-foreground\">Mode {mode}</span>\n\t\t\t<span className=\"font-mono\">{count}</span>\n\t\t</div>\n\t);\n}\n\nfunction Metric({ label, value }: { label: string; value: string }): React.ReactElement {\n\treturn (\n\t\t<div>\n\t\t\t<div className=\"text-xs text-muted-foreground\">{label}</div>\n\t\t\t<div className=\"font-mono text-sm\">{value}</div>\n\t\t</div>\n\t);\n}\n\nexport default function VectorCortexTab(): React.ReactElement {\n\tconst [data, setData] = useState<VectorCortexEvaluationSummary | null>(null);\n\tconst [err, setError] = useState<string | null>(null);\n\tconst [loading, setLoading] = useState(true);\n\tconst [health, setHealth] = useState<VectorCortexHealthCard | null>(null);\n\tconst [resetMsg, setResetMsg] = useState<string | null>(null);\n\tconst [ledger, setLedger] = useState<VectorCortexLedgerView | null>(null);\n\n\tconst poll = useCallback(() => {\n\t\tfetchVectorCortexEvaluation()\n\t\t\t.then(setData)\n\t\t\t.catch((e: unknown) =>\n\t\t\t\tsetError(e instanceof Error ? e.message : String(e)),\n\t\t\t)\n\t\t\t.finally(() => setLoading(false));\n\t\tfetchVectorCortexHealth().then(setHealth).catch(() => {\n\t\t\t/* health card is best-effort (VC0C) */\n\t\t});\n\t\tfetchVectorCortexLedger().then(setLedger).catch(() => {\n\t\t\t/* ledger card is best-effort (VC1B) */\n\t\t});\n\t}, []);\n\n\tuseEffect(() => {\n\t\tpoll();\n\t\tconst id = setInterval(poll, 5000);\n\t\treturn () => clearInterval(id);\n\t}, [poll]);\n\n\tconst onReset = () => {\n\t\tresetVectorCortexBreaker(\"provider\")\n\t\t\t.then((r) => {\n\t\t\t\tsetResetMsg(\n\t\t\t\t\t`Breaker \"${r.subsystem}\" ${r.state}; evidence retained: ${r.failures} failures / ${r.attempts} attempts`,\n\t\t\t\t);\n\t\t\t\treturn fetchVectorCortexHealth();\n\t\t\t})\n\t\t\t.then(setHealth)\n\t\t\t.catch((e: unknown) =>\n\t\t\t\tsetResetMsg(e instanceof Error ? e.message : String(e)),\n\t\t\t);\n\t};\n\n\tif (loading && !data)\n\t\treturn <div className=\"vc-loading\">Loading vector-cortex evaluation…</div>;\n\tif (err && !data)\n\t\treturn <div className=\"vc-error\">Error: {err}</div>;\n\tif (!data)\n\t\treturn <div className=\"vc-empty\">No evaluation data available.</div>;\n\n\tconst max = Math.max(1, ...data.histogram.cells, data.histogram.overflow);\n\treturn (\n\t\t<div className=\"flex flex-col gap-4\">\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t<h2 className=\"text-lg font-semibold\">Vector Cortex Evaluation</h2>\n\t\t\t\t{data.enabled ? (\n\t\t\t\t\t<Badge variant=\"warning\">OBSERVER PENDING (A)</Badge>\n\t\t\t\t) : (\n\t\t\t\t\t<Badge variant=\"danger\">MODE C (OFF)</Badge>\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t<div className=\"grid grid-cols-1 gap-4 md:grid-cols-3\">\n\t\t\t\t<Card>\n\t\t\t\t\t<CardHeader>\n\t\t\t\t\t\t<CardTitle>Samples</CardTitle>\n\t\t\t\t\t</CardHeader>\n\t\t\t\t\t<CardContent>\n\t\t\t\t\t\t<div className=\"text-3xl font-bold\">{data.samples}</div>\n\t\t\t\t\t\t<div className=\"mt-2 flex flex-col\">\n\t\t\t\t\t\t\t<ModeChip mode=\"A\" count={data.byMode.A} />\n\t\t\t\t\t\t\t<ModeChip mode=\"B\" count={data.byMode.B} />\n\t\t\t\t\t\t\t<ModeChip mode=\"C\" count={data.byMode.C} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</CardContent>\n\t\t\t\t</Card>\n\n\t\t\t\t<Card className=\"md:col-span-2\">\n\t\t\t\t\t<CardHeader>\n\t\t\t\t\t\t<CardTitle>Latency Histogram (ms, inclusive edges)</CardTitle>\n\t\t\t\t\t</CardHeader>\n\t\t\t\t\t<CardContent>\n\t\t\t\t\t\t<div className=\"flex items-end gap-2\" style={{ height: 160 }}>\n\t\t\t\t\t\t\t{data.histogram.edges.map((edge, i) => {\n\t\t\t\t\t\t\t\tconst h = (data.histogram.cells[i] / max) * 140;\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<div key={edge} className=\"flex flex-1 flex-col items-center gap-1\">\n\t\t\t\t\t\t\t\t\t\t<span className=\"text-xs text-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t\t{data.histogram.cells[i]}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"w-full rounded-t\"\n\t\t\t\t\t\t\t\t\t\t\tstyle={{ height: Math.max(2, h), background: \"#6366f1\" }}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<span className=\"text-[10px] text-muted-foreground\">≤{edge}</span>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t<div className=\"flex flex-1 flex-col items-center gap-1\">\n\t\t\t\t\t\t\t\t<span className=\"text-xs text-muted-foreground\">\n\t\t\t\t\t\t\t\t\t{data.histogram.overflow}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName=\"w-full rounded-t\"\n\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\theight: Math.max(2, (data.histogram.overflow / max) * 140),\n\t\t\t\t\t\t\t\t\t\tbackground: \"#f87171\",\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<span className=\"text-[10px] text-muted-foreground\">>250</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"mt-1 text-xs text-muted-foreground\">\n\t\t\t\t\t\t\tTotal: {data.histogram.total} · Rejects: {data.rejects.length}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</CardContent>\n\t\t\t\t</Card>\n\t\t\t</div>\n\n\t\t\t<Card>\n\t\t\t\t<CardHeader>\n\t\t\t\t\t<div className=\"flex items-center justify-between\">\n\t\t\t\t\t\t<CardTitle>Live Safety Envelope (VC0C)</CardTitle>\n\t\t\t\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t{health?.stateSource === \"ephemeral\" && (\n\t\t\t\t\t\t\t\t<Badge variant=\"outline\">EPHEMERAL (non-live)</Badge>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tonClick={onReset}\n\t\t\t\t\t\t\t\tdisabled={!health?.enabled}\n\t\t\t\t\t\t\t\tclassName=\"rounded border border-border px-2 py-1 text-xs disabled:opacity-50\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tReset Cooldown\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</CardHeader>\n\t\t\t\t<CardContent>\n\t\t\t\t\t{resetMsg && (\n\t\t\t\t\t\t<div className=\"mb-2 text-xs text-muted-foreground\">{resetMsg}</div>\n\t\t\t\t\t)}\n\t\t\t\t\t{!health ? (\n\t\t\t\t\t\t<div className=\"vc-empty\">Health unavailable (VC0C off).</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div className=\"grid grid-cols-2 gap-4 md:grid-cols-4\">\n\t\t\t\t\t\t\t<Metric label=\"State\" value={health.state} />\n\t\t\t\t\t\t\t<Metric label=\"Mode\" value={health.mode} />\n\t\t\t\t\t\t\t<Metric label=\"Window\" value={`${health.windowMs}ms`} />\n\t\t\t\t\t\t\t<Metric label=\"Probes\" value={String(health.probeCount)} />\n\t\t\t\t\t\t\t<Metric label=\"Backoff\" value={`${health.backoffDelayMs}ms`} />\n\t\t\t\t\t\t\t<Metric\n\t\t\t\t\t\t\t\tlabel=\"Failures\"\n\t\t\t\t\t\t\t\tvalue={`${health.failures}/${health.attempts}`}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Metric\n\t\t\t\t\t\t\t\tlabel=\"Frontier\"\n\t\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\t\thealth.stateSource === \"ephemeral\"\n\t\t\t\t\t\t\t\t\t\t? \"non-live\"\n\t\t\t\t\t\t\t\t\t\t: health.frontierFrozen\n\t\t\t\t\t\t\t\t\t\t\t? \"FROZEN\"\n\t\t\t\t\t\t\t\t\t\t\t: \"LIVE\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Metric label=\"Spool lag\" value={String(health.spoolLag)} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</CardContent>\n\t\t\t</Card>\n\t\t\t<Card>\n\t\t\t\t<CardHeader>\n\t\t\t\t\t<div className=\"flex items-center justify-between\">\n\t\t\t\t\t\t<CardTitle>Occurrence Ledger (VC1B)</CardTitle>\n\t\t\t\t\t\t{ledger?.enabled ? (\n\t\t\t\t\t\t\t<Badge variant=\"success\">ACTIVE</Badge>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Badge variant=\"danger\">OFF</Badge>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</CardHeader>\n\t\t\t\t<CardContent>\n\t\t\t\t\t{!ledger?.enabled ? (\n\t\t\t\t\t\t<div className=\"vc-empty\">Ledger disabled (VC1B off).</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"mb-3 grid grid-cols-2 gap-4 md:grid-cols-3\">\n\t\t\t\t\t\t\t\t<Metric label=\"Session\" value={ledger.session} />\n\t\t\t\t\t\t\t\t<Metric label=\"High-water\" value={ledger.highWater} />\n\t\t\t\t\t\t\t\t<Metric label=\"Occurrences\" value={String(ledger.count)} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{ledger.occurrences.length === 0 ? (\n\t\t\t\t\t\t\t\t<div className=\"vc-empty\">No occurrences recorded.</div>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<div className=\"max-h-64 overflow-y-auto\">\n\t\t\t\t\t\t\t\t\t<table className=\"w-full text-left text-xs\">\n\t\t\t\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t\t\t\t<tr className=\"border-b border-border/50 text-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t\t\t<th className=\"py-1 pr-2\">seq</th>\n\t\t\t\t\t\t\t\t\t\t\t\t<th className=\"py-1 pr-2\">eventId</th>\n\t\t\t\t\t\t\t\t\t\t\t\t<th className=\"py-1 pr-2\">kind</th>\n\t\t\t\t\t\t\t\t\t\t\t\t<th className=\"py-1 pr-2\">toolCall</th>\n\t\t\t\t\t\t\t\t\t\t\t\t<th className=\"py-1\">digest</th>\n\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t\t\t\t\t{ledger.occurrences.map((o) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<tr\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={`${o.seq}-${o.eventId}`}\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"border-b border-border/30\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td className=\"py-1 pr-2 font-mono\">{o.seq}</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td className=\"py-1 pr-2 font-mono\">{o.eventId}</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td className=\"py-1 pr-2\">{o.kind}</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td className=\"py-1 pr-2 font-mono\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{o.toolCallId ?? \"\\u2014\"}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td className=\"max-w-[180px] truncate font-mono text-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{o.digest}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\t\t\t\t</CardContent>\n\t\t\t</Card>\n\t\t</div>\n\t);\n}\n"],"names":["fetchVectorCortexEvaluation","r","fetchVectorCortexHealth","fetchVectorCortexLedger","session","resetVectorCortexBreaker","subsystem","ModeChip","mode","count","jsxs","jsx","Metric","label","value","VectorCortexTab","data","setData","useState","err","setError","loading","setLoading","health","setHealth","resetMsg","setResetMsg","ledger","setLedger","poll","useCallback","e","useEffect","id","onReset","max","Badge","Card","CardHeader","CardTitle","CardContent","edge","i","h","Fragment","o"],"mappings":"kHAmBA,eAAsBA,GAAsE,CAC3F,MAAMC,EAAI,MAAM,MAAM,+BAA+B,EACrD,GAAI,CAACA,EAAE,GAAI,MAAM,IAAI,MAAM,6BAA6BA,EAAE,MAAM,EAAE,EAClE,OAAOA,EAAE,KAAA,CACV,CAEA,eAAsBC,GAA2D,CAChF,MAAMD,EAAI,MAAM,MAAM,2BAA2B,EACjD,GAAI,CAACA,EAAE,GAAI,MAAM,IAAI,MAAM,yBAAyBA,EAAE,MAAM,EAAE,EAC9D,OAAOA,EAAE,KAAA,CACV,CAGA,eAAsBE,EACrBC,EAAU,UACwB,CAClC,MAAM,EAAI,MAAM,MACf,qCAAqC,mBAAmBA,CAAO,CAAC,EAAA,EAEjE,GAAI,CAAC,EAAE,GAAI,MAAM,IAAI,MAAM,yBAAyB,EAAE,MAAM,EAAE,EAC9D,OAAO,EAAE,KAAA,CACV,CAGA,eAAsBC,EACrBC,EACmC,CACnC,MAAM,EAAI,MAAM,MAAM,oCAAqC,CAC1D,OAAQ,OACR,QAAS,CAAE,eAAgB,kBAAA,EAC3B,KAAM,KAAK,UAAU,CAAE,UAAAA,EAAW,CAAA,CAClC,EACD,GAAI,CAAC,EAAE,GAAI,MAAM,IAAI,MAAM,wBAAwB,EAAE,MAAM,EAAE,EAC7D,OAAO,EAAE,KAAA,CACV,CC/BA,SAASC,EAAS,CAAE,KAAAC,EAAM,MAAAC,GAA8D,CACvF,OACCC,EAAAA,KAAC,MAAA,CAAI,UAAU,2EACd,SAAA,CAAAA,EAAAA,KAAC,OAAA,CAAK,UAAU,wBAAwB,SAAA,CAAA,QAAMF,CAAA,EAAK,EACnDG,EAAAA,IAAC,OAAA,CAAK,UAAU,YAAa,SAAAF,CAAA,CAAM,CA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