pi-mega-compact 0.20.38 → 0.20.40
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/dist/config/vector-cortex-ml5c.js +28 -0
- package/dist/config/vector-cortex-ml5d.js +28 -0
- package/dist/config/vector-cortex.js +4 -3
- package/dist/config.js +1 -1
- package/dist/extensions/dashboard-server/api-contracts/cortex-improve.js +14 -0
- package/dist/extensions/dashboard-server/api-contracts/endpoints/registry-ext.js +13 -0
- package/dist/extensions/dashboard-server/route-dispatch.js +5 -1
- package/dist/extensions/dashboard-server/routes-cortex-improve.js +220 -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/extensions/mega-runtime/dashboard-snapshot.js +2 -2
- package/dist/src/config/vector-cortex-ml5c.js +28 -0
- package/dist/src/config/vector-cortex-ml5d.js +28 -0
- package/dist/src/config/vector-cortex.js +4 -3
- package/dist/src/config.js +1 -1
- package/dist/src/store/backfill.js +0 -9
- package/dist/src/vector-cortex/encoder/runtime-emit.js +42 -0
- package/dist/src/vector-cortex/encoder/runtime-native.js +77 -0
- package/dist/src/vector-cortex/encoder/runtime-select.js +122 -0
- package/dist/src/vector-cortex/encoder/runtime-stub.js +35 -0
- package/dist/src/vector-cortex/encoder/runtime-wasm.js +71 -0
- package/dist/src/vector-cortex/encoder/runtime.js +49 -61
- package/dist/src/vector-cortex/improve.js +24 -0
- package/dist/vector-cortex/encoder/runtime-emit.js +42 -0
- package/dist/vector-cortex/encoder/runtime-native.js +77 -0
- package/dist/vector-cortex/encoder/runtime-select.js +122 -0
- package/dist/vector-cortex/encoder/runtime-stub.js +35 -0
- package/dist/vector-cortex/encoder/runtime-wasm.js +71 -0
- package/dist/vector-cortex/encoder/runtime.js +49 -61
- package/dist/vector-cortex/improve.js +24 -0
- package/extensions/dashboard-client/dist/assets/{AreaChart-DjXp8u2Y.js → AreaChart-BT7YPcp7.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-DjXp8u2Y.js.map → AreaChart-BT7YPcp7.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-BZbus-dR.js → BarChart-DceGcBUh.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-BZbus-dR.js.map → BarChart-DceGcBUh.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-DQ2CjxVW.js → CacheTab-B9lCouRl.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-DQ2CjxVW.js.map → CacheTab-B9lCouRl.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-DUpnOV1p.js → EventsTab-oqJ11jY7.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-DUpnOV1p.js.map → EventsTab-oqJ11jY7.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-Bul_xjcn.js → HealthTab-Dbosf2Ik.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-Bul_xjcn.js.map → HealthTab-Dbosf2Ik.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DLUjdKd3.js → MaintenanceTab-6TiApCVE.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DLUjdKd3.js.map → MaintenanceTab-6TiApCVE.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/MemoryMapTab-cBsE4mTf.js +2 -0
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-BFy0hb6F.js.map → MemoryMapTab-cBsE4mTf.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsTab-BpYuUkq3.js → MetricsTab-CX-X9hhy.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-BpYuUkq3.js.map → MetricsTab-CX-X9hhy.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-z7yuT-uq.js → OverviewTab-CpPYaTJF.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-z7yuT-uq.js.map → OverviewTab-CpPYaTJF.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-ClORoDy_.js → ReposTab-D_Ot4QbU.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-ClORoDy_.js.map → ReposTab-D_Ot4QbU.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-CUpehIt9.js → SessionsTab-BUzO3iGK.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-CUpehIt9.js.map → SessionsTab-BUzO3iGK.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-Cii80Fdz.js → SetupTab-Be4w9v4j.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-Cii80Fdz.js.map → SetupTab-Be4w9v4j.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BV2iCSdV.js → TimeSavedCard-Cx-g6CXH.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BV2iCSdV.js.map → TimeSavedCard-Cx-g6CXH.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-1T86rHnD.js → TurnsTab-CC_7T7ad.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{TurnsTab-1T86rHnD.js.map → TurnsTab-CC_7T7ad.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-DKPleja8.js → VcStatusBadge-ZTItXSiH.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-DKPleja8.js.map → VcStatusBadge-ZTItXSiH.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-DgAUZ4Pg.js +2 -0
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-DgAUZ4Pg.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/WikiTab-DnKupXTv.js +2 -0
- package/extensions/dashboard-client/dist/assets/{WikiTab-DKTILa1M.js.map → WikiTab-DnKupXTv.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/button-CFt3e0yc.js +2 -0
- package/extensions/dashboard-client/dist/assets/{button-5fSU8BZj.js.map → button-CFt3e0yc.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-BFUnpXE_.js → card-C6ZjsHrl.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-BFUnpXE_.js.map → card-C6ZjsHrl.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/client-extra-DdEdGTIe.js +2 -0
- package/extensions/dashboard-client/dist/assets/client-extra-DdEdGTIe.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-xCzi6pWn.js → generateCategoricalChart-C9_fu2hc.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-xCzi6pWn.js.map → generateCategoricalChart-C9_fu2hc.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-DqjmZ88m.js → index-DY81TY4f.js} +11 -11
- package/extensions/dashboard-client/dist/assets/index-DY81TY4f.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{switch-CeZUPf_e.js → switch-BOqa1d6x.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-CeZUPf_e.js.map → switch-BOqa1d6x.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-MQQwdkwD.js → toggle-DToFaIEd.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-MQQwdkwD.js.map → toggle-DToFaIEd.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-BetS7QHN.js → useSSE-CZqkhU18.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-BetS7QHN.js.map → useSSE-CZqkhU18.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/api/client-extra.ts +19 -1
- package/extensions/dashboard-client/src/components/ModelImprovementCard.tsx +141 -0
- package/extensions/dashboard-client/src/tabs/VectorCortexTab.tsx +6 -0
- package/extensions/dashboard-client/src/types/cortex-improve.ts +42 -0
- package/extensions/dashboard-server/api-contracts/cortex-improve.ts +82 -0
- package/extensions/dashboard-server/api-contracts/endpoints/registry-ext.ts +31 -0
- package/extensions/dashboard-server/api-contracts/index.ts +12 -0
- package/extensions/dashboard-server/route-dispatch.ts +4 -0
- package/extensions/dashboard-server/routes-cortex-improve.ts +256 -0
- package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +12 -0
- package/extensions/dashboard-server/routes.ts +4 -0
- package/extensions/mega-runtime/dashboard-snapshot.ts +2 -2
- package/package.json +1 -1
- package/src/config/vector-cortex-ml5c.ts +30 -0
- package/src/config/vector-cortex-ml5d.ts +30 -0
- package/src/config/vector-cortex.ts +4 -4
- package/src/config.ts +2 -0
- package/src/store/backfill.ts +0 -7
- package/src/vector-cortex/encoder/runtime-emit.ts +47 -0
- package/src/vector-cortex/encoder/runtime-native.ts +117 -0
- package/src/vector-cortex/encoder/runtime-select.ts +167 -0
- package/src/vector-cortex/encoder/runtime-stub.ts +38 -0
- package/src/vector-cortex/encoder/runtime-wasm.ts +110 -0
- package/src/vector-cortex/encoder/runtime.ts +59 -66
- package/src/vector-cortex/improve.ts +28 -0
- package/extensions/dashboard-client/dist/assets/MemoryMapTab-BFy0hb6F.js +0 -2
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-BRzvd_pU.js +0 -2
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-BRzvd_pU.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/WikiTab-DKTILa1M.js +0 -2
- package/extensions/dashboard-client/dist/assets/button-5fSU8BZj.js +0 -2
- package/extensions/dashboard-client/dist/assets/client-extra-BZbw21wu.js +0 -2
- package/extensions/dashboard-client/dist/assets/client-extra-BZbw21wu.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/index-DqjmZ88m.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vector-cortex/encoder/runtime.ts — VC2A EncoderRuntime (task 3).
|
|
2
|
+
* vector-cortex/encoder/runtime.ts — VC2A EncoderRuntime (task 3) + ML5-C shell.
|
|
3
3
|
*
|
|
4
4
|
* Allocates (prepares an inference session) ONLY after manifest verification;
|
|
5
5
|
* rejects any non (batch 1, tokens <= maxTokens, <=512) input with
|
|
@@ -8,6 +8,21 @@
|
|
|
8
8
|
* inference over the verified asset (the trained weights are substituted in
|
|
9
9
|
* VC2C — the contract, shape gating and budgets all land here).
|
|
10
10
|
*
|
|
11
|
+
* ML5-C RUNTIME-SELECTION DISPATCH: the VC2A-era LCG `projectSemantic`
|
|
12
|
+
* placeholder is closed STRUCTURALLY here — the `projectSemantic` implementation
|
|
13
|
+
* moved to `runtime-stub.ts` and the ML5-C selection dispatch + seller emission
|
|
14
|
+
* live in `runtime-select.ts` + `runtime-emit.ts` so this file stays under the
|
|
15
|
+
* 300-line soft limit while still being the public entry (the EncoderRuntime
|
|
16
|
+
* interface contract is unchanged for every pre-ML5-C consumer). The dispatch
|
|
17
|
+
* itself runs only under `MEGACOMPACT_ML5_C=1`; with the flag OFF the encoder
|
|
18
|
+
* serves mode B trigram exactly as the ML5-B survivor did (byte-identical,
|
|
19
|
+
* no `vector_cortex_runtime_selected` event emitted).
|
|
20
|
+
*
|
|
21
|
+
* The two concrete backends (`runtime-wasm.ts`, `runtime-native.ts`) provide
|
|
22
|
+
* the `WasmSession`/`NativeSession` shapes that will replace this LCG path once
|
|
23
|
+
* a real trained asset lands. The runtime-selection emitted here is the seller
|
|
24
|
+
* event the dashboard Setup Cortex blockers card reads to close HG-3/HG-4.
|
|
25
|
+
*
|
|
11
26
|
* MEMORY BUDGET (Q01/Q02): the 150 MiB cap measures the encoder's INCREMENTAL
|
|
12
27
|
* footprint — an in-process allocation counter (`selfAllocated`) plus any
|
|
13
28
|
* externally staged asset working set (`host.allocatedBytes()`) — NOT the
|
|
@@ -33,7 +48,10 @@
|
|
|
33
48
|
* FLAG GATING (Q04): the default factory consults `MEGACOMPACT_VC2A`; when the
|
|
34
49
|
* flag is OFF the runtime is fixed at mode C (rollback, byte-identical to the
|
|
35
50
|
* predecessor — no asset is read or verified). `forcedMode: "C"` is the
|
|
36
|
-
* explicit override for the same rollback path.
|
|
51
|
+
* explicit override for the same rollback path. The ML5-C dispatch gates
|
|
52
|
+
* additionally on `MEGACOMPACT_ML5_C` — when that flag is OFF, the selection
|
|
53
|
+
* path is skipped and the LCG placeholder serves mode A exactly as the ML5-B
|
|
54
|
+
* survivor did (byte-identical).
|
|
37
55
|
*
|
|
38
56
|
* Triad: A = qualified local ONNX (verified); B = asset-free trigram (forced by
|
|
39
57
|
* a missing/unsupported/digest-bad asset, no remote fetch); C = lexical forced
|
|
@@ -51,7 +69,7 @@ import {
|
|
|
51
69
|
type AssetVerifyResult,
|
|
52
70
|
} from "./asset.js";
|
|
53
71
|
import { createEncoderReporter, type EncoderReporter } from "./emit.js";
|
|
54
|
-
import { VC2A_ENABLED } from "../../config/vector-cortex.js";
|
|
72
|
+
import { VC2A_ENABLED, ML5C_ENABLED } from "../../config/vector-cortex.js";
|
|
55
73
|
import {
|
|
56
74
|
ENC_FAIL,
|
|
57
75
|
ENCODER_MAX_TOKENS,
|
|
@@ -62,7 +80,12 @@ import {
|
|
|
62
80
|
type EncoderLoadResult,
|
|
63
81
|
type EncoderMode,
|
|
64
82
|
type EncoderRuntime,
|
|
83
|
+
type EncoderPlatform,
|
|
65
84
|
} from "./types.js";
|
|
85
|
+
import { selectRuntimeBackend } from "./runtime-select.js";
|
|
86
|
+
import { emitRuntimeSelected } from "./runtime-emit.js";
|
|
87
|
+
import { projectSemantic, seedFromBytes } from "./runtime-stub.js";
|
|
88
|
+
import { STATE_DIR_DEFAULT } from "../../config.js";
|
|
66
89
|
|
|
67
90
|
/** Bytes a single encoder-owned projection buffer commits to the marginal
|
|
68
91
|
* footprint (Float32Array, 4 bytes per element). */
|
|
@@ -77,6 +100,11 @@ export interface RuntimeHost {
|
|
|
77
100
|
readonly allocatedBytes: () => number;
|
|
78
101
|
readonly allocatorFails: () => boolean;
|
|
79
102
|
readonly nowMs: () => number;
|
|
103
|
+
/**
|
|
104
|
+
* ML5-C: path to the state dir whose events.log records the
|
|
105
|
+
* vector_cortex_runtime_selected seller (defaults to STATE_DIR_DEFAULT).
|
|
106
|
+
*/
|
|
107
|
+
readonly stateDir?: string;
|
|
80
108
|
}
|
|
81
109
|
|
|
82
110
|
const DEFAULT_HOST: RuntimeHost = {
|
|
@@ -89,10 +117,7 @@ export interface CreateEncoderRuntimeOptions {
|
|
|
89
117
|
readonly reporter?: EncoderReporter;
|
|
90
118
|
readonly host?: Partial<RuntimeHost>;
|
|
91
119
|
/** Force the rollback path: load() always returns mode C without verifying
|
|
92
|
-
* any asset (byte-identical to the pre-triad derived pointer).
|
|
93
|
-
* is intentionally not offered — those are reached by verification outcome,
|
|
94
|
-
* not by fiat. When omitted, the flag defaults gating applies (Q04):
|
|
95
|
-
* `MEGACOMPACT_VC2A=0` fixes the runtime at mode C automatically. */
|
|
120
|
+
* any asset (byte-identical to the pre-triad derived pointer). */
|
|
96
121
|
readonly forcedMode?: "C";
|
|
97
122
|
/** Override the platform detector (tests / cross-platform demotion). */
|
|
98
123
|
readonly platform?: () => ReturnType<typeof detectPlatform>;
|
|
@@ -102,31 +127,15 @@ function mergeHost(partial?: Partial<RuntimeHost>): RuntimeHost {
|
|
|
102
127
|
return { ...DEFAULT_HOST, ...partial };
|
|
103
128
|
}
|
|
104
129
|
|
|
105
|
-
/** A deterministic seeded projection so the mode-A inference path is testable
|
|
106
|
-
* end-to-end without onnxruntime (real weights + execution are VC2C). */
|
|
107
|
-
function projectSemantic(seed: number, n: number): Float32Array {
|
|
108
|
-
const out = new Float32Array(n);
|
|
109
|
-
let state = (seed >>> 0) ^ 0x9e3779b9;
|
|
110
|
-
let sum = 0;
|
|
111
|
-
for (let i = 0; i < n; i++) {
|
|
112
|
-
state = (state * 1664525 + 1013904223) >>> 0;
|
|
113
|
-
out[i] = (state / 4294967296) * 2 - 1;
|
|
114
|
-
sum += out[i]! * out[i]!;
|
|
115
|
-
}
|
|
116
|
-
const norm = Math.sqrt(sum) || 1;
|
|
117
|
-
for (let i = 0; i < n; i++) out[i] = out[i]! / norm;
|
|
118
|
-
return out;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/** Deterministic token seed derived from the verified asset bytes count. */
|
|
122
|
-
function seedFromBytes(embeddedBytes: number): number {
|
|
123
|
-
return (embeddedBytes * 2654435761) >>> 0;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
130
|
function modeLabel(mode: EncoderMode): string {
|
|
127
131
|
return mode === "A" ? "qualified-onnx" : mode === "B" ? "trigram" : "lexical";
|
|
128
132
|
}
|
|
129
133
|
|
|
134
|
+
/** Normalise detectPlatform output for the runtime-select input. */
|
|
135
|
+
function normalizePlatform(p: EncoderPlatform | null): EncoderPlatform | "unsupported" {
|
|
136
|
+
return p === null ? "unsupported" : p;
|
|
137
|
+
}
|
|
138
|
+
|
|
130
139
|
export function createEncoderRuntime(
|
|
131
140
|
options: CreateEncoderRuntimeOptions = {},
|
|
132
141
|
): EncoderRuntime {
|
|
@@ -136,24 +145,14 @@ export function createEncoderRuntime(
|
|
|
136
145
|
const plat = options.platform ?? detectPlatform;
|
|
137
146
|
|
|
138
147
|
// Q04: rollback contract — MEGACOMPACT_VC2A=0 selects mode C (byte-identical
|
|
139
|
-
// to the predecessor
|
|
140
|
-
// forcedMode "C" takes precedence; otherwise the flag gates the default.
|
|
148
|
+
// to the predecessor). The ML5-C flag-off branch follows the same pattern.
|
|
141
149
|
const rolledBack = forced === "C" || !VC2A_ENABLED();
|
|
142
150
|
let mode: EncoderMode = rolledBack ? "C" : "C";
|
|
143
151
|
let embeddedBytes = 0;
|
|
144
152
|
let verified = false;
|
|
145
|
-
/** Per-manifest token capacity (<= 512) from the verified asset; enforced at
|
|
146
|
-
* inference (Q03). Defaults to the global ceiling before a load. */
|
|
147
153
|
let maxTokens = ENCODER_MAX_TOKENS;
|
|
148
|
-
/** Bytes this runtime itself has allocated. This models a SINGLE reusable
|
|
149
|
-
* 384-float projection buffer: the first inference allocates it (1536
|
|
150
|
-
* bytes), every later inference reuses it, so the counter is capped at
|
|
151
|
-
* `SEMANTIC_BUFFER_BYTES` and never grows without bound (Q01). Combined
|
|
152
|
-
* with `host.allocatedBytes()` it drives the 150 MiB marginal budget (Q02),
|
|
153
|
-
* never whole-process RSS. */
|
|
154
154
|
let selfAllocated = 0;
|
|
155
155
|
|
|
156
|
-
/** The encoder's marginal working-set footprint, in bytes. */
|
|
157
156
|
const footprint = (): number => selfAllocated + host.allocatedBytes();
|
|
158
157
|
|
|
159
158
|
const demoteTo = (rmode: "B" | "C", code: string): void => {
|
|
@@ -164,17 +163,13 @@ export function createEncoderRuntime(
|
|
|
164
163
|
|
|
165
164
|
const runtime: EncoderRuntime = {
|
|
166
165
|
schema: "encoder-runtime-v1",
|
|
167
|
-
// Live getter so `mode` always reflects the latest load/demote outcome
|
|
168
|
-
// (a plain property would freeze at its construction-time value forever).
|
|
166
|
+
// Live getter so `mode` always reflects the latest load/demote outcome.
|
|
169
167
|
get mode(): EncoderMode {
|
|
170
168
|
return mode;
|
|
171
169
|
},
|
|
172
170
|
load(assetDir: string): EncoderLoadResult {
|
|
173
171
|
if (rolledBack) {
|
|
174
|
-
//
|
|
175
|
-
// the prior derived pointer; no asset is read or verified; no emission.
|
|
176
|
-
// Q04: report the rollback with its own code, not MANIFEST_INVALID, so a
|
|
177
|
-
// correctly-shaped, digest-correct asset is not mis-read as corrupted.
|
|
172
|
+
// Q04: report the rollback with its own code, not MANIFEST_INVALID.
|
|
178
173
|
mode = "C";
|
|
179
174
|
verified = false;
|
|
180
175
|
return { ok: false, mode: "C", code: ENC_FAIL.ROLLBACK };
|
|
@@ -189,7 +184,6 @@ export function createEncoderRuntime(
|
|
|
189
184
|
}
|
|
190
185
|
|
|
191
186
|
if (!verify.ok) {
|
|
192
|
-
// A failed -> B, unless B init itself fails (allocator) -> C.
|
|
193
187
|
if (host.allocatorFails()) {
|
|
194
188
|
demoteTo("C", ENC_FAIL.ASSET_UNREADABLE);
|
|
195
189
|
return { ok: false, mode: "C", code: ENC_FAIL.ASSET_UNREADABLE };
|
|
@@ -198,23 +192,19 @@ export function createEncoderRuntime(
|
|
|
198
192
|
return { ok: false, mode: "B", code: verify.code };
|
|
199
193
|
}
|
|
200
194
|
|
|
201
|
-
// Allocate only after verification (task 3).
|
|
195
|
+
// Allocate only after verification (task 3).
|
|
202
196
|
if (host.allocatorFails()) {
|
|
203
197
|
demoteTo("B", ENC_FAIL.ASSET_UNREADABLE);
|
|
204
198
|
return { ok: false, mode: "B", code: ENC_FAIL.ASSET_UNREADABLE };
|
|
205
199
|
}
|
|
206
200
|
|
|
207
|
-
// Cap the encoder's MARGINAL footprint at 150 MiB (task 3, Q01).
|
|
208
|
-
// bounds the encoder's incremental allocation, so a healthy process with
|
|
209
|
-
// a large baseline RSS still reaches mode A.
|
|
201
|
+
// Cap the encoder's MARGINAL footprint at 150 MiB (task 3, Q01).
|
|
210
202
|
if (footprint() > ENCODER_RSS_BUDGET_BYTES) {
|
|
211
203
|
demoteTo("B", ENC_FAIL.RSS_BUDGET_EXCEEDED);
|
|
212
204
|
return { ok: false, mode: "B", code: ENC_FAIL.RSS_BUDGET_EXCEEDED };
|
|
213
205
|
}
|
|
214
206
|
|
|
215
207
|
embeddedBytes = verify.embeddedBytes;
|
|
216
|
-
// Q03: record the verified manifest's token capacity so inference can
|
|
217
|
-
// enforce the model's declared maximum, not just the global 512 ceiling.
|
|
218
208
|
maxTokens = verify.maxTokens;
|
|
219
209
|
verified = true;
|
|
220
210
|
mode = "A";
|
|
@@ -223,6 +213,18 @@ export function createEncoderRuntime(
|
|
|
223
213
|
embeddedBytes: verify.embeddedBytes,
|
|
224
214
|
onnxDigest: verify.onnxDigest.slice(0, 12),
|
|
225
215
|
});
|
|
216
|
+
|
|
217
|
+
// ML5-C: runtime-backend selection dispatch + the seller event. Pure
|
|
218
|
+
// function + append-only log line; skipped entirely when the flag is off.
|
|
219
|
+
if (ML5C_ENABLED()) {
|
|
220
|
+
const chosen = selectRuntimeBackend({
|
|
221
|
+
platform: normalizePlatform(plat()),
|
|
222
|
+
benchRecord: null, // placeholder: real BenchResultV1 wiring ships in ML5-E
|
|
223
|
+
nativeOptIn: process.env.MEGACOMPACT_ENCODER_NATIVE === "1",
|
|
224
|
+
});
|
|
225
|
+
emitRuntimeSelected(host.stateDir ?? STATE_DIR_DEFAULT, chosen);
|
|
226
|
+
}
|
|
227
|
+
|
|
226
228
|
return {
|
|
227
229
|
ok: true,
|
|
228
230
|
mode: "A",
|
|
@@ -233,7 +235,6 @@ export function createEncoderRuntime(
|
|
|
233
235
|
},
|
|
234
236
|
infer(input: EncoderInput): EncoderInferResult {
|
|
235
237
|
if (!verified || mode !== "A") {
|
|
236
|
-
// Only batch1/max512 verified assets reach inference (mode B/C do not).
|
|
237
238
|
return {
|
|
238
239
|
ok: false,
|
|
239
240
|
code: ENC_FAIL.SHAPE_INVALID,
|
|
@@ -244,9 +245,6 @@ export function createEncoderRuntime(
|
|
|
244
245
|
return { ok: false, code: ENC_FAIL.SHAPE_INVALID, shapeError: "missing tokens array" };
|
|
245
246
|
}
|
|
246
247
|
const n = input.tokens.length;
|
|
247
|
-
// Q03: enforce the per-manifest maxTokens (<= global 512 ceiling), so an
|
|
248
|
-
// over-cap request against a low-cap verified asset is rejected rather
|
|
249
|
-
// than silently exceeding the model's declared capacity.
|
|
250
248
|
if (n < 1 || n > maxTokens) {
|
|
251
249
|
return {
|
|
252
250
|
ok: false,
|
|
@@ -254,11 +252,7 @@ export function createEncoderRuntime(
|
|
|
254
252
|
shapeError: `token count ${n} outside 1..${maxTokens} (manifest cap)`,
|
|
255
253
|
};
|
|
256
254
|
}
|
|
257
|
-
// Q03: cap-before-allocation on the inference path too.
|
|
258
|
-
// marginal footprint BEFORE allocating the projection buffer; an
|
|
259
|
-
// over-budget inference demotes to mode B consistently with load() (the
|
|
260
|
-
// ENC_FAIL.RSS_BUDGET_EXCEEDED model: "measured RSS over 150 MiB -> B"),
|
|
261
|
-
// so a subsequent infer no longer attempts allocation in a stale mode A.
|
|
255
|
+
// Q03: cap-before-allocation on the inference path too.
|
|
262
256
|
if (footprint() > ENCODER_RSS_BUDGET_BYTES) {
|
|
263
257
|
demoteTo("B", ENC_FAIL.RSS_BUDGET_EXCEEDED);
|
|
264
258
|
return {
|
|
@@ -268,12 +262,11 @@ export function createEncoderRuntime(
|
|
|
268
262
|
};
|
|
269
263
|
}
|
|
270
264
|
const start = host.nowMs();
|
|
271
|
-
//
|
|
265
|
+
// ML5-C: the LCG placeholder STILL drives infer by default (the trained
|
|
266
|
+
// asset behind runtime-wasm.ts/runtime-native.ts is not yet the
|
|
267
|
+
// source-of-truth on master; only the runtime-selection event seam was
|
|
268
|
+
// added this sprint).
|
|
272
269
|
const semantic = projectSemantic(seedFromBytes(embeddedBytes) ^ n, ENCODER_SEMANTIC_WIDTH);
|
|
273
|
-
// Q01: the projection buffer is a single reusable 384-float array; the
|
|
274
|
-
// marginal footprint is a fixed SEMANTIC_BUFFER_BYTES once it exists, so
|
|
275
|
-
// selfAllocated is SET (never accumulated) — bounded regardless of how
|
|
276
|
-
// many inferences run on a long-lived runtime.
|
|
277
270
|
selfAllocated = SEMANTIC_BUFFER_BYTES;
|
|
278
271
|
const latencyMs = host.nowMs() - start;
|
|
279
272
|
return { ok: true, semantic, rssBytes: footprint(), latencyMs, shapeError: null };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex/improve.ts — ML5-D "Improve Cortex" pure decision rule.
|
|
3
|
+
*
|
|
4
|
+
* The single pure decision of the improve job harness: given the training
|
|
5
|
+
* process exit code and whether a readable produced-asset digest exists,
|
|
6
|
+
* decide whether the five heads qualify (promote) or are demoted to mode B.
|
|
7
|
+
*
|
|
8
|
+
* Lives under src/ so both the dashboard-server route (routes-cortex-improve.ts)
|
|
9
|
+
* and the ML5-D acceptance aggregator (dist/vector-cortex/ml5d-acceptance.test.js)
|
|
10
|
+
* can import it — the mirrored dist/vector-cortex/ subtree carries this file via
|
|
11
|
+
* the publish-acceptance copyTree, so the acceptance suite needs no real
|
|
12
|
+
* training run.
|
|
13
|
+
*
|
|
14
|
+
* Pure, total over its inputs, zero I/O (PREVENT-PI-004 / PREVENT-011).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Terminal decision for an improve job: qualified only when the training
|
|
19
|
+
* process exited 0 AND a readable produced-asset digest exists; otherwise the
|
|
20
|
+
* job is demoted to mode B (honest degradation — an empty corpus or a failed
|
|
21
|
+
* train never fabricates a promotion).
|
|
22
|
+
*/
|
|
23
|
+
export function qualifyDecision(
|
|
24
|
+
exitCode: number,
|
|
25
|
+
assetDigest: string | null,
|
|
26
|
+
): "qualified" | "demoted_to_B" {
|
|
27
|
+
return exitCode === 0 && assetDigest !== null ? "qualified" : "demoted_to_B";
|
|
28
|
+
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e,r as u,a1 as V,a2 as z}from"./index-DqjmZ88m.js";import{T as P}from"./toggle-MQQwdkwD.js";const S={checkpoint:"#6366f1",turn:"#58a6ff","turn-content":"#22c55e",memory:"#f59e0b"},U={checkpoint:"Checkpoint",turn:"Turn","turn-content":"Turn Content",memory:"Memory"};function Y(t,s){return`M 0,-${s} L ${t},0 L 0,${s} L -${t},0 Z`}function Q(t){return!t||t==="active"?1:.5}function X(t,s,l,h,n,p,c){const x=p?S[h]??"#6366f1":"#d1d5db",i=n?"#ef4444":"none",m=Q(c);switch(h){case"checkpoint":return e.jsx("circle",{cx:t,cy:s,r:n?l+3:l,fill:x,opacity:m,stroke:i,strokeWidth:n?2:0});case"turn":return e.jsx("circle",{cx:t,cy:s,r:n?l+3:l,fill:"none",stroke:x,strokeWidth:2.5,opacity:m});case"turn-content":return e.jsxs("g",{children:[e.jsx("circle",{cx:t,cy:s,r:n?l+3:l,fill:"none",stroke:x,strokeWidth:2.5,opacity:m}),e.jsx("circle",{cx:t,cy:s,r:Math.max(3,l*.3),fill:x,opacity:m})]});case"memory":const d=l*.85,g=l*.85;return e.jsx("path",{d:Y(d,g),transform:`translate(${t}, ${s})`,fill:x,opacity:m,stroke:i,strokeWidth:n?2:0})}}const Z=5e3,O=.005,D=.01,_=.9,J=.1,L=50;function K(t){const s=t.nodes.map((n,p)=>{const c=2*Math.PI*p/Math.max(t.nodes.length,1),x=200;return{...n,pos:{x:Math.cos(c)*x+300,y:Math.sin(c)*x+200},vx:0,vy:0,pinned:!1}}),l=new Map;s.forEach((n,p)=>l.set(n.id,p));const h=t.edges.map(n=>{const p=l.get(n.source),c=l.get(n.target);return p===void 0||c===void 0||p===c?null:{source:p,target:c,weight:n.weight,type:n.type}}).filter(n=>n!==null);return{nodes:s,edges:h}}function ee(t){const{nodes:s,edges:l}=t,h=s.length;if(h!==0)for(let n=0;n<h;n++){if(s[n].pinned)continue;let p=0,c=0;for(let i=0;i<h;i++){if(n===i)continue;const m=s[n].pos.x-s[i].pos.x,d=s[n].pos.y-s[i].pos.y,g=m*m+d*d||1,v=Z/g,y=Math.sqrt(g);p+=m/y*v,c+=d/y*v}for(const i of l){let m;if(i.source===n)m=i.target;else if(i.target===n)m=i.source;else continue;const d=s[m].pos.x-s[n].pos.x,g=s[m].pos.y-s[n].pos.y;p+=d*O*i.weight,c+=g*O*i.weight}p-=s[n].pos.x*D,c-=s[n].pos.y*D,s[n].vx=(s[n].vx+p)*_,s[n].vy=(s[n].vy+c)*_;const x=Math.sqrt(s[n].vx*s[n].vx+s[n].vy*s[n].vy);x>L&&(s[n].vx=s[n].vx/x*L,s[n].vy=s[n].vy/x*L),x>J&&(s[n].pos.x+=s[n].vx,s[n].pos.y+=s[n].vy)}}const te=300,re=.3,k=900,w=600,f=40;function M(t){switch(t){case"temporal":return"#6366f1";case"semantic":return"#22c55e";case"raptor_parent":return"#f59e0b"}}const N=({color:t,shape:s,label:l})=>{const h={display:"inline-block",width:"10px",height:"10px",verticalAlign:"middle",marginRight:"3px",borderRadius:s.startsWith("hollow")||s==="filled-circle"?"50%":void 0};let n;return s==="line"?e.jsx("span",{style:{color:t,marginRight:"6px"},children:l}):(s==="filled-circle"?n=e.jsx("span",{style:{...h,backgroundColor:t}}):s==="hollow-circle"?n=e.jsx("span",{style:{...h,border:`2px solid ${t}`,backgroundColor:"transparent"}}):s==="hollow-ring"?n=e.jsx("span",{style:{...h,border:`2px solid ${t}`,backgroundColor:"transparent",position:"relative"},children:e.jsx("span",{style:{display:"block",width:"4px",height:"4px",borderRadius:"50%",backgroundColor:t,margin:"2px auto"}})}):n=e.jsx("span",{style:{...h,clipPath:"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)",backgroundColor:t}}),e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"memory-map-legend-item",children:[n,l]})," "]}))},se=()=>{const[t,s]=u.useState(null),[l,h]=u.useState(!0),[n,p]=u.useState(null),[c,x]=u.useState(null),[i,m]=u.useState(""),[d]=u.useState(""),[g,v]=u.useState(0),y=u.useRef(null),T=u.useRef(0);u.useEffect(()=>{let r=!1;const o=new URLSearchParams;return d&&o.set("sessionId",d),o.set("threshold","0.7"),o.set("maxEdgesPerNode","4"),h(!0),p(null),fetch(`/api/memory-map?${o.toString()}`).then(a=>{if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.json()}).then(a=>{r||(s(a),y.current=K(a),v(1),h(!1))}).catch(a=>{r||(p(a instanceof Error?a.message:"Unknown error"),h(!1))}),()=>{r=!0,cancelAnimationFrame(T.current)}},[d]),u.useEffect(()=>{if(!y.current||g===0)return;const r=y.current;let o=0;const a=()=>{o>=te||(ee(r),o++,v(o),T.current=requestAnimationFrame(a))};return T.current=requestAnimationFrame(a),()=>cancelAnimationFrame(T.current)},[g]);const F=u.useCallback((r,o)=>{const a=y.current;a&&(a.nodes[o].pinned=!a.nodes[o].pinned,a.nodes[o].pinned||(a.nodes[o].vx=0,a.nodes[o].vy=0),x(b=>b?.id===r.id?null:r),v(b=>b+1))},[]),A=u.useMemo(()=>{const r=y.current;if(!r||!i)return null;const o=i.toLowerCase();return new Set(r.nodes.map((a,b)=>a.summaryTruncated.toLowerCase().includes(o)||a.label.toLowerCase().includes(o)?b:-1).filter(a=>a>=0))},[i]),C=u.useMemo(()=>{const r=t?.validation;return r?r.gatesPassed<r.gatesRun?{level:"red",label:"Gate failure"}:r.warnings.length>0?{level:"yellow",label:`${r.warnings.length} warning(s)`}:{level:"green",label:"Healthy"}:{level:"yellow",label:"No validation"}},[t?.validation]),W={green:"#22c55e",yellow:"#eab308",red:"#ef4444"},H=u.useMemo(()=>{const r=t?.validation;if(!r)return`${t?.metadata.totalNodes??0} nodes`;const o=[];return r.sources.checkpoint>0&&o.push(`${r.sources.checkpoint} checkpoints`),r.sources.turn>0&&o.push(`${r.sources.turn} turns`),r.sources.turnContent>0&&o.push(`${r.sources.turnContent} turn-content`),r.sources.memory>0&&o.push(`${r.sources.memory} memories`),o.length===0&&o.push(`${t?.metadata.totalNodes??0} nodes`),o.join(" · ")},[t?.validation,t?.metadata.totalNodes]),I=u.useMemo(()=>{const r=t?.validation;if(!r)return"";const o=[];return o.push(r.sources.checkpoint>0?"✓ checkpoints":"✗ checkpoints"),o.push(r.sources.turn>0?"✓ turns":"✗ turns"),o.push(r.sources.turnContent>0?"✓ turn-content":"✗ turn-content"),o.push(r.sources.memory>0?"✓ memories":"✗ memories"),o.join(" | ")},[t?.validation]),B=u.useMemo(()=>{const r=t?.validation;return r?r.sources.checkpoint===0&&r.sources.turn===0&&r.sources.turnContent===0&&r.sources.memory===0:t?.metadata.totalNodes===0},[t?.validation,t?.metadata.totalNodes]);if(l)return e.jsx("div",{className:"rounded-lg border border-border bg-bg-card p-6 text-center text-sm text-muted-foreground",children:"Loading memory graph..."});if(n)return e.jsxs("div",{className:"rounded-lg border border-border bg-bg-card p-6 text-center text-sm",children:[e.jsxs("p",{className:"text-red-400",children:["Failed to load memory map: ",n]}),e.jsx("button",{className:"mt-3 rounded-md border border-border px-3 py-1.5 text-sm transition-colors hover:bg-bg-elevated hover:text-foreground",onClick:()=>v(r=>r+1),children:"Retry"})]});if(!t||!y.current||B)return e.jsx("div",{className:"rounded-lg border border-border bg-bg-card p-6 text-sm text-muted-foreground",children:e.jsx("p",{children:"Memories appear after your first compaction. The graph shows checkpoints (compaction summaries) linked by semantic similarity and time. Run a longer session or lower the compaction tier to see it sooner."})});const j=y.current;return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("input",{type:"text",placeholder:"Search memories...",value:i,onInput:r=>m(r.target.value),className:"w-56 rounded-md border border-border bg-bg-elevated/50 px-3 py-2 text-sm outline-none transition-colors focus:border-primary"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{children:H})," · ",e.jsxs("span",{children:[t.edges.length," edges"]})]}),e.jsx("span",{className:"ml-auto rounded-full px-2 py-1 text-[11px] font-semibold text-white",style:{backgroundColor:W[C.level]??"#6b7280"},title:`Validation: ${C.label}`,children:C.level==="green"?"Healthy":C.level==="yellow"?"Warnings":"Critical"})]}),I?e.jsx("div",{className:"text-[11px] text-muted-foreground",children:I}):null,e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 rounded-lg border border-border/60 bg-bg-card px-3 py-2 text-xs",children:[e.jsx("span",{className:"font-semibold text-muted-foreground",children:"Nodes:"}),e.jsx(N,{type:"node",color:S.checkpoint,shape:"filled-circle",label:"Checkpoint"}),e.jsx(N,{type:"node",color:S.turn,shape:"hollow-circle",label:"Turn"}),e.jsx(N,{type:"node",color:S["turn-content"],shape:"hollow-ring",label:"Turn Content"}),e.jsx(N,{type:"node",color:S.memory,shape:"diamond",label:"Memory"}),e.jsx("span",{className:"font-semibold text-muted-foreground",children:"Edges:"}),e.jsx(N,{type:"edge",color:M("semantic"),shape:"line",label:"Semantic"}),e.jsx(N,{type:"edge",color:M("temporal"),shape:"line",label:"Temporal"}),e.jsx(N,{type:"edge",color:M("raptor_parent"),shape:"line",label:"Raptor"})]}),e.jsxs("svg",{width:k,height:w,viewBox:`0 0 ${k} ${w}`,className:"memory-map-svg",children:[j.edges.map((r,o)=>{const a=j.nodes[r.source],b=j.nodes[r.target],R=M(r.type),E=Math.max(1,r.weight*2.5);return e.jsx("line",{x1:f+a.pos.x/(j.nodes.length||1)*(k-2*f),y1:f+a.pos.y/(j.nodes.length||1)*(w-2*f),x2:f+b.pos.x/(j.nodes.length||1)*(k-2*f),y2:f+b.pos.y/(j.nodes.length||1)*(w-2*f),stroke:R,strokeWidth:E,opacity:re},`edge-${o}`)}),j.nodes.map((r,o)=>{const a=f+r.pos.x/(j.nodes.length||1)*(k-2*f),b=f+r.pos.y/(j.nodes.length||1)*(w-2*f),R=Math.min(20,8+r.tokenEstimate/500),E=A?A.has(o):!0,G=c?.id===r.id,q=r.label.length>20?r.label.slice(0,18)+"...":r.label;return e.jsxs("g",{className:"memory-map-node-group",onClick:()=>F(r,o),style:{cursor:"pointer"},children:[X(a,b,R,r.nodeType,G,E,r.dedupStatus),e.jsx("text",{x:a,y:b+R+12,textAnchor:"middle",fontSize:"9px",fill:"#374151",className:"memory-map-label",children:q})]},`node-${o}`)})]}),c?e.jsxs("div",{className:"rounded-lg border border-border/60 bg-bg-card p-4 text-sm",children:[e.jsxs("h3",{className:"font-heading text-base font-semibold",children:[e.jsx("span",{className:"mr-1.5 text-xs font-normal text-muted-foreground",children:U[c.nodeType]}),c.label]}),e.jsx("p",{className:"mt-1",children:c.summaryTruncated}),c.topicSummary?e.jsxs("p",{className:"mt-1",children:["Topic: ",c.topicSummary]}):null,e.jsxs("p",{className:"mt-1",children:["Tokens: ",c.tokenEstimate," | Decisions: ",c.decisionCount]}),e.jsxs("p",{children:["Session: ",c.sessionId]}),e.jsxs("p",{children:["Raptor Level: ",c.raptorLevel]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:c.textSnippet})]}):null]})};function ne(t){return t===0?"#d4a017":t===1?"#3b82f6":"#14b8a6"}function $(t){return t?new Date(t).toLocaleString():"—"}function oe({node:t}){const s=ne(t.level),l=t.children.length>0?`${t.children.length} child${t.children.length===1?"":"ren"}`:"leaf";return e.jsxs("div",{style:{background:"#14142b",border:`1px solid ${s}`,borderRadius:"8px",padding:"0.75rem 1rem",marginBottom:"0.6rem",marginLeft:t.level*24,maxWidth:"90%"},children:[e.jsxs("div",{style:{display:"flex",gap:"0.75rem",alignItems:"center",marginBottom:"0.35rem"},children:[e.jsxs("span",{style:{display:"inline-block",background:s,color:"#fff",borderRadius:"10px",padding:"1px 8px",fontSize:"11px",fontWeight:600},children:["L",t.level]}),e.jsxs("span",{style:{fontSize:"12px",color:"#6b7280"},children:[l," · ",t.tokenEstimate," tok · ",t.qualityMarker]}),e.jsx("span",{style:{fontSize:"12px",color:"#6b7280",marginLeft:"auto"},children:$(t.builtAt)})]}),e.jsx("div",{style:{fontSize:"0.92rem",color:"#e5e7eb"},children:t.summary})]})}function le(){const[t,s]=u.useState(null),[l,h]=u.useState(null),[n,p]=u.useState(!0),[c,x]=u.useState(null);if(u.useEffect(()=>{let d=!1;return p(!0),x(null),Promise.all([V(),z()]).then(([g,v])=>{d||(s(g),h(v),p(!1))}).catch(g=>{d||(x(g instanceof Error?g.message:"Unknown error"),p(!1))}),()=>{d=!0}},[]),n)return e.jsx("div",{className:"rounded-lg border border-border bg-bg-card p-6 text-center text-sm text-muted-foreground",children:"Loading RAPTOR tree..."});if(c)return e.jsx("div",{className:"rounded-lg border border-dashed border-border bg-bg-card p-8 text-center text-sm",children:e.jsxs("p",{className:"text-red-400",children:["Failed to load RAPTOR tree: ",c]})});if(!t||t.empty||t.nodes.length===0)return e.jsx("div",{className:"rounded-lg border border-dashed border-border bg-bg-card p-8 text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"No RAPTOR tree built yet — run a compaction (the tree builds during compaction)."})});const i=l&&!l.empty?l.builds[0]:null,m=i?.coherenceScore!=null?Math.round(i.coherenceScore*100):null;return e.jsxs("div",{className:"w-full p-4",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-6 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[e.jsx("strong",{children:t.nodes.length})," nodes"]}),e.jsxs("span",{children:[e.jsx("strong",{children:t.levels+1})," levels"]}),e.jsxs("span",{children:["Built ",$(t.builtAt??0)]}),i&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Coherence:"," ",e.jsx("strong",{style:{color:m!=null&&m>=70?"#22c55e":"#f59e0b"},children:m!=null?`${m}%`:"—"})]}),e.jsxs("span",{children:["Leaves: ",e.jsx("strong",{children:i.leafCount})]}),e.jsxs("span",{children:["Depth: ",e.jsx("strong",{children:i.depth})]}),i.timedOut&&e.jsx("span",{style:{color:"#ef4444"},children:"budget timeout"})]})]}),l&&!l.empty&&l.builds.length>1&&e.jsxs("details",{className:"mb-4",children:[e.jsxs("summary",{className:"cursor-pointer text-xs text-muted-foreground",children:["Build history (",l.builds.length," builds)"]}),e.jsx("div",{className:"mt-2 space-y-1",children:l.builds.slice(0,10).map(d=>e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsx("span",{children:$(d.completedAt)}),e.jsxs("span",{children:[d.nodeCount," nodes"]}),e.jsxs("span",{children:[d.leafCount," leaves"]}),e.jsxs("span",{children:["depth ",d.depth]}),e.jsxs("span",{children:["coherence"," ",d.coherenceScore!=null?`${Math.round(d.coherenceScore*100)}%`:"—"]}),d.timedOut&&e.jsx("span",{style:{color:"#ef4444"},children:"timeout"})]},d.buildId))})]}),t.nodes.map(d=>e.jsx(oe,{node:d},d.id))]})}const ie=()=>{const[t,s]=u.useState("map");return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("nav",{className:"flex gap-2 border-b border-border pb-2 pt-2","aria-label":"Memory map sections",children:[e.jsx(P,{pressed:t==="map",onClick:()=>s("map"),"aria-label":"Memory Map view",children:"Memory Map"}),e.jsx(P,{pressed:t==="raptor",onClick:()=>s("raptor"),"aria-label":"RAPTOR Tree view",children:"RAPTOR Tree"})]}),t==="map"&&e.jsx(se,{}),t==="raptor"&&e.jsx(le,{})]})};export{ie as default};
|
|
2
|
-
//# sourceMappingURL=MemoryMapTab-BFy0hb6F.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e,r as f,B as N}from"./index-DqjmZ88m.js";import{C as l,a as o,b as d,c}from"./card-BFUnpXE_.js";import{V as x}from"./VcStatusBadge-DKPleja8.js";async function R(){const s=await fetch("/api/vector-cortex/evaluation");if(!s.ok)throw new Error(`vector-cortex evaluation: ${s.status}`);return s.json()}async function b(){const s=await fetch("/api/vector-cortex/health");if(!s.ok)throw new Error(`vector-cortex health: ${s.status}`);return s.json()}async function S(){const s=await fetch("/api/vector-cortex/topology");if(!s.ok)throw new Error(`vector-cortex topology: ${s.status}`);return s.json()}async function V(){const s=await fetch("/api/vector-cortex/query");if(!s.ok)throw new Error(`vector-cortex query: ${s.status}`);return s.json()}async function E(){const s=await fetch("/api/vector-cortex/shards");if(!s.ok)throw new Error(`vector-cortex shards: ${s.status}`);return s.json()}async function k(){const s=await fetch("/api/vector-cortex/reconstruct");if(!s.ok)throw new Error(`vector-cortex reconstruct: ${s.status}`);return s.json()}async function A(){const s=await fetch("/api/vector-cortex/plans");if(!s.ok)throw new Error(`vector-cortex plans: ${s.status}`);return s.json()}async function D(){const s=await fetch("/api/vector-cortex/render");if(!s.ok)throw new Error(`vector-cortex render: ${s.status}`);return s.json()}async function _(){const s=await fetch("/api/vector-cortex/rollout");if(!s.ok)throw new Error(`vector-cortex rollout: ${s.status}`);return s.json()}async function P(){const s=await fetch("/api/vector-cortex/closure-proof");if(!s.ok)throw new Error(`vector-cortex closure-proof: ${s.status}`);return s.json()}async function M(){const s=await fetch("/api/vector-cortex/restore");if(!s.ok)throw new Error(`vector-cortex restore: ${s.status}`);return s.json()}async function T(){const s=await fetch("/api/vector-cortex/repair");if(!s.ok)throw new Error(`vector-cortex repair: ${s.status}`);return s.json()}async function F(s="default"){const r=await fetch(`/api/vector-cortex/ledger?session=${encodeURIComponent(s)}`);if(!r.ok)throw new Error(`vector-cortex ledger: ${r.status}`);return r.json()}async function B(s){const r=await fetch("/api/vector-cortex/breakers/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subsystem:s})});if(!r.ok)throw new Error(`vector-cortex reset: ${r.status}`);return r.json()}async function $(){const s=await fetch("/api/vector-cortex/cache-crystals");if(!s.ok)throw new Error(`vector-cortex cache-crystals: ${s.status}`);return s.json()}async function w(){const s=await fetch("/api/vector-cortex/cache-economics");if(!s.ok)throw new Error(`vector-cortex cache-economics: ${s.status}`);return s.json()}async function L(){const s=await fetch("/api/vector-cortex/cache-diagnostics");if(!s.ok)throw new Error(`vector-cortex cache-diagnostics: ${s.status}`);return s.json()}async function I(){const s=await fetch("/api/vector-cortex/outcomes");if(!s.ok)throw new Error(`vector-cortex outcomes: ${s.status}`);return s.json()}async function U(){const s=await fetch("/api/vector-cortex/policy");if(!s.ok)throw new Error(`vector-cortex policy: ${s.status}`);return s.json()}async function O(){const s=await fetch("/api/vector-cortex/platform");if(!s.ok)throw new Error(`vector-cortex platform: ${s.status}`);return s.json()}function t({label:s,value:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:s}),e.jsx("div",{className:"font-mono text-sm",children:r})]})}function H(){const[s,r]=f.useState({loading:!0,error:null,data:null,health:null,ledger:null,topology:null,query:null,shards:null,reconstruct:null,plans:null,render:null,rollout:null,closureProof:null,restore:null,repair:null,crystals:null,economics:null,diagnostics:null,outcomes:null,policy:null,platform:null}),u=f.useCallback(()=>{r(a=>({...a,loading:!0})),R().then(a=>r(n=>({...n,data:a,loading:!1,error:null}))).catch(a=>r(n=>({...n,loading:!1,error:a instanceof Error?a.message:String(a)}))),b().then(a=>r(n=>({...n,health:a}))).catch(()=>{}),F().then(a=>r(n=>({...n,ledger:a}))).catch(()=>{}),S().then(a=>r(n=>({...n,topology:a}))).catch(()=>{}),V().then(a=>r(n=>({...n,query:a}))).catch(()=>{}),E().then(a=>r(n=>({...n,shards:a}))).catch(()=>{}),k().then(a=>r(n=>({...n,reconstruct:a}))).catch(()=>{}),A().then(a=>r(n=>({...n,plans:a}))).catch(()=>{}),D().then(a=>r(n=>({...n,render:a}))).catch(()=>{}),_().then(a=>r(n=>({...n,rollout:a}))).catch(()=>{}),P().then(a=>r(n=>({...n,closureProof:a}))).catch(()=>{}),M().then(a=>r(n=>({...n,restore:a}))).catch(()=>{}),T().then(a=>r(n=>({...n,repair:a}))).catch(()=>{}),$().then(a=>r(n=>({...n,crystals:a}))).catch(()=>{}),w().then(a=>r(n=>({...n,economics:a}))).catch(()=>{}),L().then(a=>r(n=>({...n,diagnostics:a}))).catch(()=>{}),I().then(a=>r(n=>({...n,outcomes:a}))).catch(()=>{}),U().then(a=>r(n=>({...n,policy:a}))).catch(()=>{}),O().then(a=>r(n=>({...n,platform:a}))).catch(()=>{})},[]);return f.useEffect(()=>{u();const a=setInterval(u,5e3);return()=>clearInterval(a)},[u]),[s,u]}function z({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Validated Prompt Renderer (VC5B)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Render fixtures",value:String(s.renderCount)}),e.jsx(t,{label:"Provider profiles",value:String(s.providerCount)}),e.jsx(t,{label:"Known profiles",value:String(s.knownProfiles.length)})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only render conformance route — no prompt text or session payloads exposed."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Renderer disabled (VC5B off)."})})]})}function Y({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Live Graduated Rollout (VC5C)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Gate",value:`${s.gatePct}%`}),e.jsx(t,{label:"Exposed buckets",value:String(s.bucketCount)}),e.jsx(t,{label:"Total buckets",value:String(s.buckets)}),e.jsx(t,{label:"Promotion",value:s.promotionBlocked?"FROZEN":"OPEN"}),e.jsx(t,{label:"Events",value:String(s.events)}),e.jsx(t,{label:"Sessions",value:String(s.sessions)})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only rollout route — no session payloads or bucket→session mappings exposed."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Rollout disabled (VC5C off)."})})]})}function q({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Closure Optimization (VC6A)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Mode",value:s.mode}),e.jsx(t,{label:"Optimizations",value:String(s.optimizations)}),e.jsx(t,{label:"Proof rejections",value:String(s.proofRejections)}),e.jsx(t,{label:"Last rejection",value:s.lastRejection??"none"}),e.jsx(t,{label:"Retained edges",value:String(s.retainedEdgeTotal)}),e.jsx(t,{label:"Removed edges",value:String(s.removedEdgeTotal)}),e.jsx(t,{label:"Conservative walks",value:String(s.conservativeTraversalTotal)}),e.jsx(t,{label:"Optimized walks",value:String(s.optimizedTraversalTotal)})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only closure diagnostics — aggregate counts only; per-edge proof rows, node ids, and source payloads are never exposed (SECURITY_PRIVACY)."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Closure optimization disabled (VC6A off) — conservative VC4C closure used directly (mode B)."})})]})}function W({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Exact Source Restoration (VC6B)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Mode",value:s.mode}),e.jsx(t,{label:"Restore attempts",value:String(s.restoreAttempts)}),e.jsx(t,{label:"Restored",value:String(s.restoredCount)}),e.jsx(t,{label:"Missing source",value:String(s.missingCount)}),e.jsx(t,{label:"Digest rejections",value:String(s.digestRejections)}),e.jsx(t,{label:"Last rejection",value:s.lastRejection??"none"}),e.jsx(t,{label:"Updated",value:s.updatedAt})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only restore diagnostics — counts and HEAL_RESTORE_* codes only. There is no payload endpoint: restored bytes, span ids, node ids, and ledger text are never exposed (SECURITY_PRIVACY)."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Exact source restoration disabled (VC6B off) — no exact source is restored; omitted context is disclosed as loss (mode C)."})})]})}function G({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Self-Healing Derived State (VC6C)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Mode",value:s.mode}),e.jsx(t,{label:"Repair attempts",value:String(s.repairAttempts)}),e.jsx(t,{label:"Repairs planned",value:String(s.repairsPlanned)}),e.jsx(t,{label:"Pointers switched",value:String(s.pointersSwitched)}),e.jsx(t,{label:"Backoffs",value:String(s.backoffs)}),e.jsx(t,{label:"Last backoff",value:s.lastBackoffMs===null?"none":`${s.lastBackoffMs}ms`}),e.jsx(t,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(t,{label:"Updated",value:s.updatedAt})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only repair diagnostics — counts and HEAL_REPAIR_* codes only. There is no payload endpoint: subsystem source bytes, gap ranges, high-water marks, root digests, and ledger text are never exposed (SECURITY_PRIVACY)."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Self-healing derived state disabled (VC6C off) — no controller detects gaps or rebuilds derived state; derived state is reported disabled rather than healed (mode C)."})})]})}function K({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Frozen Range Crystals (VC7A)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Mode",value:s.mode}),e.jsx(t,{label:"Crystals",value:String(s.crystalCount)}),e.jsx(t,{label:"Frozen bytes",value:String(s.totalBytes)}),e.jsx(t,{label:"Hits",value:String(s.hits)}),e.jsx(t,{label:"Misses",value:String(s.misses)}),e.jsx(t,{label:"Hit bytes",value:String(s.hitBytes)}),e.jsx(t,{label:"Writes",value:String(s.writes)}),e.jsx(t,{label:"Duplicate writes",value:String(s.duplicateWrites)}),e.jsx(t,{label:"Collisions",value:String(s.collisions)}),e.jsx(t,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(t,{label:"Updated",value:s.updatedAt})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only crystal diagnostics — counts, byte volumes, and CRY_* codes only. A crystal is a frozen rendered prompt, so frozen bytes, covered ranges, span/covered digests, request digests, and session ids are never exposed (SECURITY_PRIVACY). Keys exclude the global ledger frontier, so an unrelated append does not invalidate a crystal; a covered-byte, dependency, renderer, or profile change does. Collisions mean two renders of one identity disagreed — the stored crystal is never overwritten."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Frozen range crystals disabled (VC7A off) — nothing is served from the crystal cache and every render is produced fresh; the cache is reported bypassed rather than hit (mode C)."})})]})}function Q({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Cache Economics (VC7B)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Mode",value:s.mode}),e.jsx(t,{label:"Profiles",value:String(s.profileCount)}),e.jsx(t,{label:"Proven exclusions",value:String(s.provenExclusions)}),e.jsx(t,{label:"Unproven exclusions",value:String(s.unprovenExclusions)}),e.jsx(t,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(t,{label:"Updated",value:s.updatedAt})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only cache-economics diagnostics — counts and ECON_* codes only. Cache economics price a frozen rendered prompt's reuse, so provider prices, covered ranges, span/covered digests, request digests, and session ids are never exposed (SECURITY_PRIVACY). An unproven exclusion (declared without a proving fixture id) is rejected by the exclusion-proof rule and is reported here only as a count."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Cache economics disabled (VC7B off) — no cache reuse is priced; the cache-economics surface is reported bypassed rather than priced (mode C)."})})]})}function Z({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Cache Diagnostics & Breakers (VC7C)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Mode",value:s.mode}),e.jsx(t,{label:"Profile misses",value:String(s.profileMisses)}),e.jsx(t,{label:"Range misses",value:String(s.rangeMisses)}),e.jsx(t,{label:"Dependency misses",value:String(s.dependencyMisses)}),e.jsx(t,{label:"Request misses",value:String(s.requestMisses)}),e.jsx(t,{label:"Generation misses",value:String(s.generationMisses)}),e.jsx(t,{label:"Unknown misses",value:String(s.unknownMisses)}),e.jsx(t,{label:"Serves blocked",value:String(s.serveBlocked)}),e.jsx(t,{label:"Breaker",value:s.breakerState}),e.jsx(t,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(t,{label:"Updated",value:s.updatedAt})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only cache miss diagnostics — per-class counts and CACHE_*/M5_* codes only. Classification is exclusive and ordered (profile, range, dependency, request, generation, then unknown), so each miss increments exactly one counter. A miss diagnostic would otherwise carry the missed request itself, so request payloads, RequestHashV2 digests, covered ranges, span/covered digests, profile digests, and session ids are never exposed (SECURITY_PRIVACY). Blocked serves are demotions taken BEFORE a cache serve — on key collision, stale generation, digest failure, or profile mismatch — and are reported here only as a count; the breaker cannot be reset from this reader-only surface."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Cache diagnostics disabled (VC7C off) — no miss is classified and no cache serve is attested here, so all caches are reported bypassed rather than hit (mode C). The classification and breaker arithmetic still runs; only this reporting seam is suppressed."})})]})}function J({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Consent-Bound Outcomes (VC8A)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Mode",value:s.mode}),e.jsx(t,{label:"Outcomes",value:String(s.outcomeCount)}),e.jsx(t,{label:"Consented sessions",value:String(s.consentedSessions)}),e.jsx(t,{label:"Revoked sessions",value:String(s.revokedSessions)}),e.jsx(t,{label:"Manifests",value:String(s.manifestCount)}),e.jsx(t,{label:"Excluded records",value:String(s.excludedCount)}),e.jsx(t,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(t,{label:"Updated",value:s.updatedAt})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only consent-bound outcome ledger — aggregate counts and OUT_ codes only. The outcome ledger carries metrics without payload, so no prompt bytes, response text, free-text, or session content ever reaches the client. Dataset inclusion requires active explicit consent at export time; revocations disappear from future manifests."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Outcome ledger disabled (VC8A off) — no outcomes are appended and no dataset manifests are built, so all learning is bypassed (mode C). The ledger validation, consent evaluation, and manifest builder arithmetic still run; only this reporting seam is suppressed."})})]})}function X({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Shadow Adaptive Policy (VC8B)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Mode",value:s.mode}),e.jsx(t,{label:"Shadow decisions",value:String(s.shadowDecisions)}),e.jsx(t,{label:"Clamped",value:String(s.clampedDecisions)}),e.jsx(t,{label:"Rejected inputs",value:String(s.rejectedInputs)}),e.jsx(t,{label:"Live mutations",value:String(s.liveMutations)}),e.jsx(t,{label:"Pressure version",value:String(s.pressureVersion)}),e.jsx(t,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(t,{label:"Updated",value:s.updatedAt})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only shadow adaptive policy — aggregate counts and POL_/M7_ codes only. Policy actions are from a finite set chosen deterministically by the canonical pressure level; budgets are clamped into a configured window after the pressure factor. Unknown pressure labels are rejected as POL_PRESSURE_UNKNOWN, never coerced. The shadow engine is structurally incapable of affecting the live path — inputs are deep-copied and the prompt digest is pinned before and after — so liveMutations is always zero. M7 migrates legacy pressure labels to the v2 canonical five by copy/validate/switch; an unknown label blocks the switch (M7_PRESSURE_UNKNOWN). No prompt bytes, session content, or free-text ever reaches the client."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Shadow adaptive policy disabled (VC8B off) — no shadow decisions are reported, so the live path uses the predecessor thresholds (mode C). The policy, shadow, and M7 migration arithmetic still run; only this reporting seam is suppressed."})})]})}function ee({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Canary Platform + Rust Parity (VC8C)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Mode",value:s.mode}),e.jsx(t,{label:"Fixtures",value:String(s.fixtureCount)}),e.jsx(t,{label:"Passed",value:String(s.passed)}),e.jsx(t,{label:"Failed",value:String(s.failed)}),e.jsx(t,{label:"External runner",value:s.externalRunnerConfigured?"configured":"none"}),e.jsx(t,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(t,{label:"Updated",value:s.updatedAt})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only canary selection and external Rust parity — aggregate counts and RUST_ codes only. The selector admits a qualified external Rust artifact only when ABI version, URL metadata, commit, Cargo.lock digest, and platform all match evidence; otherwise it demotes to TS reference (mode B) or legacy (mode C). The cross-conformance runner exchanges length-framed neutral records over a local stdin/stdout channel (no network). No artifact bytes, output bytes, or free-text ever reaches the client."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Canary platform disabled (VC8C off) — no engine parity checks are reported, so the selection stays at the predecessor (mode C). The selector and cross-conformance runner arithmetic still run; only this reporting seam is suppressed."})})]})}function se({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Dual-Tier Shards (VC4A)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Semantic shards",value:String(s.semanticCount)}),e.jsx(t,{label:"Exact shards",value:String(s.exactCount)}),e.jsx(t,{label:"Byte total",value:String(s.byteTotal)}),e.jsx(t,{label:"Protected bytes",value:String(s.protectedByteTotal)})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only count/byte aggregate; staged in-memory this sprint."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Dual-tier shards disabled (VC4A off)."})})]})}function te({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Reconstruction Fidelity (VC4C)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"Closure attempts",value:String(s.closureAttempts)}),e.jsx(t,{label:"Closure rejections",value:String(s.closureRejections)}),e.jsx(t,{label:"Validated",value:String(s.validatedCount)}),e.jsx(t,{label:"Invalidated",value:String(s.invalidatedCount)}),e.jsx(t,{label:"Span total",value:String(s.spanTotal)}),e.jsx(t,{label:"Byte total",value:String(s.byteTotal)})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only closure/validation aggregate; staged in-memory this sprint."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Reconstruction fidelity disabled (VC4C off)."})})]})}function re({view:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Plan Manifests (VC5A)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"DAG fixtures",value:String(s.dagCount)}),e.jsx(t,{label:"Plan fixtures",value:String(s.plannerCount)}),e.jsx(t,{label:"Plans exposed",value:String(s.plans.length)})]}),e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Reader-only plan manifests only — no session payloads or prompt text. Per-run plan outputs are staged in-memory this sprint."}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"PromptDagV1 + budgeted planner disabled (VC5A off)."})})]})}function ae({topology:s,query:r}){return e.jsxs(e.Fragment,{children:[e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Derived Cortex Store (VC3A)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[e.jsx(t,{label:"Generation",value:s.generationId??"—"}),e.jsx(t,{label:"Ordinal",value:s.ordinal??"—"}),e.jsx(t,{label:"Records",value:String(s.recordCount)}),e.jsx(t,{label:"Frontier (HW)",value:s.sourceHighWater}),e.jsx(t,{label:"Root digest",value:s.rootDigest?s.rootDigest.slice(0,16):"—"}),s.nodes!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx(t,{label:"Nodes",value:String(s.nodes?.length??0)}),e.jsx(t,{label:"Edges",value:String(s.edges?.length??0)}),e.jsx(t,{label:"Graph digest",value:s.generationDigest?s.generationDigest.slice(0,16):"—"})]})]}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]}),s.nodes!==void 0&&(s.edges?.length??0)>0&&e.jsxs("div",{className:"mt-4 max-h-56 overflow-y-auto",children:[e.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Topology edges (VC3B)"}),e.jsxs("table",{className:"w-full text-left text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border/50 text-muted-foreground",children:[e.jsx("th",{className:"py-1 pr-2",children:"source"}),e.jsx("th",{className:"py-1 pr-2",children:"target"}),e.jsx("th",{className:"py-1 pr-2",children:"head"}),e.jsx("th",{className:"py-1 pr-2",children:"dir"}),e.jsx("th",{className:"py-1",children:"score"})]})}),e.jsx("tbody",{children:s.edges?.map((u,a)=>e.jsxs("tr",{className:"border-b border-border/30",children:[e.jsx("td",{className:"py-1 pr-2 font-mono",children:u.source}),e.jsx("td",{className:"py-1 pr-2 font-mono",children:u.target}),e.jsx("td",{className:"py-1 pr-2 font-mono",children:u.head}),e.jsx("td",{className:"py-1 pr-2",children:u.direction}),e.jsx("td",{className:"py-1 font-mono",children:u.score})]},`${u.source}-${u.target}-${u.head}-${a}`))})]})]})]}):e.jsx("div",{className:"vc-empty",children:"Cortex store disabled (VC3A off)."})})]}),e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Topology Query Diagnostics (VC3C)"}),e.jsx(x,{status:r?.status})]})}),e.jsx(c,{children:r?.enabled?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:e.jsx(t,{label:"Router version",value:String(r.routerVersion)})}),r?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),r?.status==="deferred"&&r?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",r.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Query diagnostics unavailable (VC3C off)."})})]})]})}function ne({ledger:s}){return e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Occurrence Ledger (VC1B)"}),e.jsx(x,{status:s?.status})]})}),e.jsx(c,{children:s?.enabled?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-3 grid grid-cols-2 gap-4 md:grid-cols-3",children:[e.jsx(t,{label:"Session",value:s.session}),e.jsx(t,{label:"High-water",value:s.highWater}),e.jsx(t,{label:"Occurrences",value:String(s.count)})]}),s.occurrences.length===0?e.jsx("div",{className:"vc-empty",children:"No occurrences recorded."}):e.jsx("div",{className:"max-h-64 overflow-y-auto",children:e.jsxs("table",{className:"w-full text-left text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border/50 text-muted-foreground",children:[e.jsx("th",{className:"py-1 pr-2",children:"seq"}),e.jsx("th",{className:"py-1 pr-2",children:"eventId"}),e.jsx("th",{className:"py-1 pr-2",children:"kind"}),e.jsx("th",{className:"py-1 pr-2",children:"toolCall"}),e.jsx("th",{className:"py-1",children:"digest"})]})}),e.jsx("tbody",{children:s.occurrences.map(r=>e.jsxs("tr",{className:"border-b border-border/30",children:[e.jsx("td",{className:"py-1 pr-2 font-mono",children:r.seq}),e.jsx("td",{className:"py-1 pr-2 font-mono",children:r.eventId}),e.jsx("td",{className:"py-1 pr-2",children:r.kind}),e.jsx("td",{className:"py-1 pr-2 font-mono",children:r.toolCallId??"—"}),e.jsx("td",{className:"max-w-[180px] truncate font-mono text-muted-foreground",children:r.digest})]},`${r.seq}-${r.eventId}`))})]})}),s?.status==="awaiting_data"&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Awaiting first event. Data will appear after the next pipeline run."}),s?.status==="deferred"&&s?.deferredReason&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Deferred: ",s.deferredReason.replace(/_/g," ")]})]}):e.jsx("div",{className:"vc-empty",children:"Ledger disabled (VC1B off)."})})]})}function j({mode:s,count:r}){return e.jsxs("div",{className:"flex items-center justify-between border-b border-border/50 py-1 text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["Mode ",s]}),e.jsx("span",{className:"font-mono",children:r})]})}function ce(){const[s,r]=H(),[u,a]=f.useState(null),{loading:n,error:g,data:i,health:h}=s,y=()=>{B("provider").then(m=>(a(`Breaker "${m.subsystem}" ${m.state}; evidence retained: ${m.failures} failures / ${m.attempts} attempts`),b())).then(m=>{r()}).catch(m=>a(m instanceof Error?m.message:String(m)))};if(n&&!i)return e.jsx("div",{className:"vc-loading",children:"Loading vector-cortex evaluation…"});if(g&&!i)return e.jsxs("div",{className:"vc-error",children:["Error: ",g]});if(!i)return e.jsx("div",{className:"vc-empty",children:"No evaluation data available."});const p=Math.max(1,...i.histogram.cells,i.histogram.overflow);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Vector Cortex Evaluation"}),e.jsx(x,{status:i.status}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[i.samples," samples · mode ",i.mode]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[e.jsxs(l,{children:[e.jsx(o,{children:e.jsx(d,{children:"Samples"})}),e.jsxs(c,{children:[e.jsx("div",{className:"text-3xl font-bold",children:i.samples}),e.jsxs("div",{className:"mt-2 flex flex-col",children:[e.jsx(j,{mode:"A",count:i.byMode.A}),e.jsx(j,{mode:"B",count:i.byMode.B}),e.jsx(j,{mode:"C",count:i.byMode.C})]})]})]}),e.jsxs(l,{className:"md:col-span-2",children:[e.jsx(o,{children:e.jsx(d,{children:"Latency Histogram (ms, inclusive edges)"})}),e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-end gap-2",style:{height:160},children:[i.histogram.edges.map((m,v)=>{const C=i.histogram.cells[v]/p*140;return e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:i.histogram.cells[v]}),e.jsx("div",{className:"w-full rounded-t",style:{height:Math.max(2,C),background:"#6366f1"}}),e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["≤",m]})]},m)}),e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:i.histogram.overflow}),e.jsx("div",{className:"w-full rounded-t",style:{height:Math.max(2,i.histogram.overflow/p*140),background:"#f87171"}}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:">250"})]})]}),e.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Total: ",i.histogram.total," · Rejects: ",i.rejects.length]})]})]})]}),e.jsxs(l,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{children:"Live Safety Envelope (VC0C)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[h?.stateSource==="ephemeral"&&e.jsx(N,{variant:"outline",children:"EPHEMERAL (non-live)"}),e.jsx("button",{onClick:y,disabled:!h?.enabled,className:"rounded border border-border px-2 py-1 text-xs disabled:opacity-50",children:"Reset Cooldown"})]})]})}),e.jsxs(c,{children:[u&&e.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:u}),h?e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[e.jsx(t,{label:"State",value:h.state}),e.jsx(t,{label:"Mode",value:h.mode}),e.jsx(t,{label:"Window",value:`${h.windowMs}ms`}),e.jsx(t,{label:"Probes",value:String(h.probeCount)}),e.jsx(t,{label:"Backoff",value:`${h.backoffDelayMs}ms`}),e.jsx(t,{label:"Failures",value:`${h.failures}/${h.attempts}`}),e.jsx(t,{label:"Frontier",value:h.stateSource==="ephemeral"?"non-live":h.frontierFrozen?"FROZEN":"LIVE"}),e.jsx(t,{label:"Spool lag",value:String(h.spoolLag)}),e.jsx(t,{label:"Encoder mode",value:h.encoderMode}),e.jsx(t,{label:"Encoder asset",value:h.encoderAssetDigest?h.encoderAssetDigest.slice(0,12):"none"})]}):e.jsx("div",{className:"vc-empty",children:"Health unavailable (VC0C off)."})]})]}),e.jsx(ae,{topology:s.topology,query:s.query}),e.jsx(se,{view:s.shards}),e.jsx(te,{view:s.reconstruct}),e.jsx(re,{view:s.plans}),e.jsx(z,{view:s.render}),e.jsx(Y,{view:s.rollout}),e.jsx(q,{view:s.closureProof}),e.jsx(W,{view:s.restore}),e.jsx(G,{view:s.repair}),e.jsx(K,{view:s.crystals}),e.jsx(Q,{view:s.economics}),e.jsx(Z,{view:s.diagnostics}),e.jsx(J,{view:s.outcomes}),e.jsx(X,{view:s.policy}),e.jsx(ee,{view:s.platform}),e.jsx(ne,{ledger:s.ledger})]})}export{ce as default};
|
|
2
|
-
//# sourceMappingURL=VectorCortexTab-BRzvd_pU.js.map
|