pi-mega-compact 0.20.24 → 0.20.26
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/extensions/dashboard-server/routes-vector-cortex-crystals.js +6 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-diagnostics.js +6 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-economics.js +6 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-eval.js +2 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-heal.js +9 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-health.js +4 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-ledger.js +2 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-outcomes.js +10 -2
- package/dist/extensions/dashboard-server/routes-vector-cortex-plans.js +2 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-platform.js +13 -2
- package/dist/extensions/dashboard-server/routes-vector-cortex-policy.js +6 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-query.js +2 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-reconstruct.js +5 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-render.js +2 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-repair.js +5 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-residual.js +2 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-rollout.js +56 -3
- package/dist/extensions/dashboard-server/routes-vector-cortex-shards.js +5 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-topology.js +2 -0
- package/dist/extensions/dashboard-server/server.js +4 -2
- package/dist/extensions/dashboard-server/vc-status.js +17 -0
- package/dist/extensions/mega-dashboard-bounce.js +79 -0
- package/dist/extensions/mega-dashboard-cmds.js +57 -24
- package/dist/extensions/mega-events/context-handler/afterCompact.js +2 -2
- package/dist/extensions/mega-events/context-handler/pipelineRun.js +17 -2
- package/dist/extensions/mega-events/register.js +17 -0
- package/dist/extensions/mega-pipeline/recall.js +11 -0
- package/extensions/dashboard-client/dist/assets/{AreaChart-BzEedilo.js → AreaChart-DRErPez1.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-BzEedilo.js.map → AreaChart-DRErPez1.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-CzAVg1_J.js → BarChart-Cwxel3M7.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-CzAVg1_J.js.map → BarChart-Cwxel3M7.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-D2-rzTuX.js → CacheTab-D4j3vwFu.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-D2-rzTuX.js.map → CacheTab-D4j3vwFu.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-DB7g1Szy.js → EventsTab-BA7t_fsH.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-DB7g1Szy.js.map → EventsTab-BA7t_fsH.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-Cvkmi-R3.js → HealthTab-Ci9gtYDP.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-Cvkmi-R3.js.map → HealthTab-Ci9gtYDP.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-g_udcOO7.js → MaintenanceTab-BeqWn-xu.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-g_udcOO7.js.map → MaintenanceTab-BeqWn-xu.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-DAjBaf8P.js → MemoryMapTab-BreZegCV.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-DAjBaf8P.js.map → MemoryMapTab-BreZegCV.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsTab-13dYYocB.js → MetricsTab-DLbgfJT2.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-13dYYocB.js.map → MetricsTab-DLbgfJT2.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-CLpCyLvx.js → OverviewTab-BtcXdrnC.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-CLpCyLvx.js.map → OverviewTab-BtcXdrnC.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-EdAqUrwG.js → ReposTab-DpDLEzV9.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-EdAqUrwG.js.map → ReposTab-DpDLEzV9.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-C21ZuOL_.js → SessionsTab-CMe5jSrZ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-C21ZuOL_.js.map → SessionsTab-CMe5jSrZ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-CP7lE3L_.js → SetupTab-C3OY8mc7.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-CP7lE3L_.js.map → SetupTab-C3OY8mc7.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-DZ3QR8qt.js → TimeSavedCard-BFPJUQzs.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-DZ3QR8qt.js.map → TimeSavedCard-BFPJUQzs.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-CNchE5rD.js → TurnsTab-Ujt29pKI.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnsTab-CNchE5rD.js.map → TurnsTab-Ujt29pKI.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-CfxZW91A.js +2 -0
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-CfxZW91A.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{WikiTab-BIe5Z9Nc.js → WikiTab-BiKXVwGT.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-BIe5Z9Nc.js.map → WikiTab-BiKXVwGT.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-BrVreSt5.js → button-DJwGcw0u.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-BrVreSt5.js.map → button-DJwGcw0u.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-D9F4wbqs.js → card-CgjBf5LZ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-D9F4wbqs.js.map → card-CgjBf5LZ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-mkdzCnMP.js → generateCategoricalChart-CTQIl2qs.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-mkdzCnMP.js.map → generateCategoricalChart-CTQIl2qs.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-CtlmOlj1.js → index-Bu8CZUMX.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{index-CtlmOlj1.js.map → index-Bu8CZUMX.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{switch-BXmp5iwA.js → switch-uUiS1Raq.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-BXmp5iwA.js.map → switch-uUiS1Raq.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-BgawNwW9.js → toggle-Dv3OEscH.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-BgawNwW9.js.map → toggle-Dv3OEscH.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-DZKX73Ea.js → useSSE-n6ymAic3.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-DZKX73Ea.js.map → useSSE-n6ymAic3.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/tabs/VcStatusBadge.tsx +24 -0
- package/extensions/dashboard-client/src/tabs/VectorCortexClosureCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexCrystalsCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexDiagnosticsCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexEconomicsCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexLedgerCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexOutcomesCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexPlansCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexPlatformCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexPolicyCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexRenderCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexRepairCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexRestoreCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexRolloutCard.tsx +12 -6
- package/extensions/dashboard-client/src/tabs/VectorCortexShardsCard.tsx +23 -11
- package/extensions/dashboard-client/src/tabs/VectorCortexTab.tsx +5 -7
- package/extensions/dashboard-client/src/tabs/VectorCortexTopologyCard.tsx +28 -14
- package/extensions/dashboard-client/src/types/vector-cortex-vc7.ts +6 -0
- package/extensions/dashboard-client/src/types/vector-cortex-vc8.ts +6 -0
- package/extensions/dashboard-client/src/types/vector-cortex.ts +26 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex-cache.ts +2 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex-diagnostics.ts +2 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex-economics.ts +2 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex-heal.ts +6 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex-outcomes.ts +2 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex-platform.ts +2 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex-policy.ts +2 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex.ts +19 -0
- package/extensions/dashboard-server/routes-vector-cortex-crystals.ts +6 -0
- package/extensions/dashboard-server/routes-vector-cortex-diagnostics.ts +6 -0
- package/extensions/dashboard-server/routes-vector-cortex-economics.ts +6 -0
- package/extensions/dashboard-server/routes-vector-cortex-eval.ts +2 -0
- package/extensions/dashboard-server/routes-vector-cortex-heal.ts +9 -0
- package/extensions/dashboard-server/routes-vector-cortex-health.ts +4 -0
- package/extensions/dashboard-server/routes-vector-cortex-ledger.ts +2 -0
- package/extensions/dashboard-server/routes-vector-cortex-outcomes.ts +11 -2
- package/extensions/dashboard-server/routes-vector-cortex-plans.ts +2 -0
- package/extensions/dashboard-server/routes-vector-cortex-platform.ts +14 -2
- package/extensions/dashboard-server/routes-vector-cortex-policy.ts +6 -0
- package/extensions/dashboard-server/routes-vector-cortex-query.ts +2 -0
- package/extensions/dashboard-server/routes-vector-cortex-reconstruct.ts +5 -0
- package/extensions/dashboard-server/routes-vector-cortex-render.ts +2 -0
- package/extensions/dashboard-server/routes-vector-cortex-repair.ts +5 -0
- package/extensions/dashboard-server/routes-vector-cortex-residual.ts +2 -0
- package/extensions/dashboard-server/routes-vector-cortex-rollout.ts +58 -3
- package/extensions/dashboard-server/routes-vector-cortex-shards.ts +5 -0
- package/extensions/dashboard-server/routes-vector-cortex-topology.ts +2 -0
- package/extensions/dashboard-server/server.ts +4 -2
- package/extensions/dashboard-server/vc-status.ts +22 -0
- package/extensions/mega-dashboard-bounce.ts +97 -0
- package/extensions/mega-dashboard-cmds.ts +63 -24
- package/extensions/mega-events/context-handler/afterCompact.ts +2 -2
- package/extensions/mega-events/context-handler/pipelineRun.ts +18 -3
- package/extensions/mega-events/register.ts +14 -1
- package/extensions/mega-pipeline/recall.ts +10 -0
- package/package.json +1 -1
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-B3WuPeyn.js +0 -2
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-B3WuPeyn.js.map +0 -1
|
@@ -24,6 +24,7 @@ import type { RouteContext } from "./routes-core.js";
|
|
|
24
24
|
import { VC4B_ENABLED } from "../../src/config.js";
|
|
25
25
|
import { sendJson } from "./routes-vector-cortex-shared.js";
|
|
26
26
|
import type { VectorCortexResidualView } from "./api-contracts/vector-cortex.js";
|
|
27
|
+
import { deriveVcStatus } from "./vc-status.js";
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Reader-only GET /api/vector-cortex/residual (VC4B).
|
|
@@ -54,6 +55,7 @@ export function handleVectorCortexResidual(
|
|
|
54
55
|
encodedByteTotal: 0,
|
|
55
56
|
exactByteTotal: 0,
|
|
56
57
|
updatedAt: new Date().toISOString(),
|
|
58
|
+
status: deriveVcStatus({ enabled, hasData: false, structuralOnly: true }),
|
|
57
59
|
};
|
|
58
60
|
sendJson(res, 200, body);
|
|
59
61
|
return true;
|
|
@@ -13,17 +13,29 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
16
|
+
import { readFileSync } from "node:fs";
|
|
17
|
+
import { join } from "node:path";
|
|
16
18
|
import type { RouteContext } from "./routes-core.js";
|
|
17
19
|
import { VC5C_ENABLED } from "../../src/config.js";
|
|
18
20
|
import { ROLLOUT_GATES, ROLLOUT_BUCKETS } from "../../src/vector-cortex/rollout/types.js";
|
|
19
21
|
import { sendJson } from "./routes-vector-cortex-shared.js";
|
|
22
|
+
import { countVcEvents, vcCount } from "./vc-event-counts.js";
|
|
23
|
+
import { deriveVcStatus } from "./vc-status.js";
|
|
20
24
|
import type { VectorCortexRolloutView } from "./api-contracts/vector-cortex.js";
|
|
21
25
|
|
|
26
|
+
// Rollout events: assigned/promotion-blocked from rollout/emit.ts, plus the
|
|
27
|
+
// explicit decision event appended by pipelineRun.ts:79 after decideLivePath.
|
|
28
|
+
const ROLLOUT_EVENTS = [
|
|
29
|
+
"vector_cortex_rollout_assigned",
|
|
30
|
+
"vector_cortex_rollout_promotion_blocked",
|
|
31
|
+
"vector_cortex_rollout_decision",
|
|
32
|
+
] as const;
|
|
33
|
+
|
|
22
34
|
/** Reader-only GET /api/vector-cortex/rollout (VC5C). */
|
|
23
35
|
export function handleVectorCortexRollout(
|
|
24
36
|
req: IncomingMessage,
|
|
25
37
|
res: ServerResponse,
|
|
26
|
-
|
|
38
|
+
ctx: RouteContext,
|
|
27
39
|
): boolean {
|
|
28
40
|
const url = req.url ?? "";
|
|
29
41
|
const path = url.split("?")[0] ?? url;
|
|
@@ -34,6 +46,12 @@ export function handleVectorCortexRollout(
|
|
|
34
46
|
}
|
|
35
47
|
|
|
36
48
|
const enabled = VC5C_ENABLED();
|
|
49
|
+
const counts = countVcEvents(ctx.stateDir, ROLLOUT_EVENTS);
|
|
50
|
+
const eventCount =
|
|
51
|
+
vcCount(counts, "vector_cortex_rollout_assigned") +
|
|
52
|
+
vcCount(counts, "vector_cortex_rollout_promotion_blocked") +
|
|
53
|
+
vcCount(counts, "vector_cortex_rollout_decision");
|
|
54
|
+
const sessionCount = enabled ? distinctRolloutSessions(ctx.stateDir) : 0;
|
|
37
55
|
const gateIndex = 0; // Ephemeral rollout state: no durable gate in this sprint.
|
|
38
56
|
const gatePct = ROLLOUT_GATES[gateIndex]!;
|
|
39
57
|
const body: VectorCortexRolloutView = {
|
|
@@ -42,11 +60,48 @@ export function handleVectorCortexRollout(
|
|
|
42
60
|
gatePct: enabled ? gatePct : 0,
|
|
43
61
|
buckets: ROLLOUT_BUCKETS,
|
|
44
62
|
bucketCount: enabled ? gatePct * 100 : 0,
|
|
45
|
-
events: 0,
|
|
46
|
-
sessions: 0,
|
|
63
|
+
events: enabled ? eventCount : 0,
|
|
64
|
+
sessions: enabled ? sessionCount : 0,
|
|
47
65
|
promotionBlocked: false,
|
|
48
66
|
updatedAt: new Date().toISOString(),
|
|
67
|
+
status: deriveVcStatus({ enabled, hasData: eventCount > 0 }),
|
|
49
68
|
};
|
|
50
69
|
sendJson(res, 200, body);
|
|
51
70
|
return true;
|
|
52
71
|
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Count distinct session ids among rollout_assigned events in the tail of
|
|
75
|
+
* events.log. Best-effort: a missing/unreadable log or malformed lines yield 0.
|
|
76
|
+
* Only the `sessionId` field of rollout_assigned lines is inspected (aggregate
|
|
77
|
+
* only, never session payloads/prompts).
|
|
78
|
+
*/
|
|
79
|
+
function distinctRolloutSessions(stateDir: string): number {
|
|
80
|
+
const seen = new Set<string>();
|
|
81
|
+
let raw: string;
|
|
82
|
+
try {
|
|
83
|
+
raw = readFileSync(join(stateDir, "events.log"), "utf-8");
|
|
84
|
+
} catch {
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
const lines = raw.split("\n");
|
|
88
|
+
const start = Math.max(0, lines.length - 10000);
|
|
89
|
+
for (let i = start; i < lines.length; i++) {
|
|
90
|
+
const line = lines[i] as string;
|
|
91
|
+
if (line.length === 0) continue;
|
|
92
|
+
let ev: { event?: unknown; sessionId?: unknown } | null = null;
|
|
93
|
+
try {
|
|
94
|
+
ev = JSON.parse(line) as { event?: unknown; sessionId?: unknown };
|
|
95
|
+
} catch {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (
|
|
99
|
+
ev?.event === "vector_cortex_rollout_assigned" &&
|
|
100
|
+
typeof ev.sessionId === "string" &&
|
|
101
|
+
ev.sessionId.length > 0
|
|
102
|
+
) {
|
|
103
|
+
seen.add(ev.sessionId);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return seen.size;
|
|
107
|
+
}
|
|
@@ -24,6 +24,7 @@ import { VC4A_ENABLED } from "../../src/config.js";
|
|
|
24
24
|
import { sendJson } from "./routes-vector-cortex-shared.js";
|
|
25
25
|
import { countVcEvents, vcCount } from "./vc-event-counts.js";
|
|
26
26
|
import type { VectorCortexShardsView } from "./api-contracts/vector-cortex.js";
|
|
27
|
+
import { deriveVcStatus } from "./vc-status.js";
|
|
27
28
|
|
|
28
29
|
// Actual events emitted by src/vector-cortex/shards/manifest.ts. VC4A has no
|
|
29
30
|
// per-tier (semantic/exact) write event — the manifest build is the single
|
|
@@ -60,6 +61,10 @@ export function handleVectorCortexShards(
|
|
|
60
61
|
byteTotal: 0,
|
|
61
62
|
protectedByteTotal: 0,
|
|
62
63
|
updatedAt: new Date().toISOString(),
|
|
64
|
+
status: deriveVcStatus({
|
|
65
|
+
enabled,
|
|
66
|
+
hasData: vcCount(counts, "vector_cortex_shard_manifest_built") > 0,
|
|
67
|
+
}),
|
|
63
68
|
};
|
|
64
69
|
sendJson(res, 200, body);
|
|
65
70
|
return true;
|
|
@@ -32,6 +32,7 @@ import type { TopologyCandidate, TopologyEmit } from "../../src/vector-cortex/to
|
|
|
32
32
|
import type { CortexRecordV1 } from "../../src/vector-cortex/cortex/types.js";
|
|
33
33
|
import { sendJson } from "./routes-vector-cortex-shared.js";
|
|
34
34
|
import type { VectorCortexTopologyView } from "./api-contracts/vector-cortex.js";
|
|
35
|
+
import { deriveVcStatus } from "./vc-status.js";
|
|
35
36
|
|
|
36
37
|
/** Well-known cortex record kind that carries a canonical candidate payload. */
|
|
37
38
|
const TOPOLOGY_RECORD_KIND = "topology";
|
|
@@ -112,6 +113,7 @@ export function handleVectorCortexTopology(
|
|
|
112
113
|
? { nodes, edges, generationDigest }
|
|
113
114
|
: {}),
|
|
114
115
|
updatedAt: new Date().toISOString(),
|
|
116
|
+
status: deriveVcStatus({ enabled: active, hasData: summary.recordCount > 0 }),
|
|
115
117
|
};
|
|
116
118
|
sendJson(res, 200, body);
|
|
117
119
|
return true;
|
|
@@ -302,9 +302,11 @@ export async function launchDashboardServer(
|
|
|
302
302
|
v6.listen(port, "::1", () => log("ipv6 loopback bound", { port })); // guardrails-allow PREVENT-PI-004: IPv6 loopback (::1) mirror of the dashboard server
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
// Write port.pid
|
|
305
|
+
// Write port.pid (VC0F B2: stamp `version` so the launcher can detect
|
|
306
|
+
// a stale runner by comparing the marker against its own version
|
|
307
|
+
// without an HTTP probe — closes the orphan case for pre-B2 servers).
|
|
306
308
|
try {
|
|
307
|
-
writeFileSync(portFile, JSON.stringify({ port, pid: process.pid }));
|
|
309
|
+
writeFileSync(portFile, JSON.stringify({ port, pid: process.pid, version: SERVER_VERSION }));
|
|
308
310
|
} catch (e) {
|
|
309
311
|
log("could not write port.pid", { error: String(e) });
|
|
310
312
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dashboard-server/vc-status.ts — shared status derivation for Vector Cortex
|
|
3
|
+
* dashboard routes. Every VC route computes a status field so the client can
|
|
4
|
+
* show meaningful state (live / awaiting data / deferred / structural) instead
|
|
5
|
+
* of bare zeros.
|
|
6
|
+
*
|
|
7
|
+
* Guardrails: PREVENT-011 (no `any`).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type VcStatus = "live" | "awaiting_data" | "deferred" | "structural" | "off";
|
|
11
|
+
|
|
12
|
+
export function deriveVcStatus(opts: {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
deferredReason?: string;
|
|
15
|
+
hasData: boolean;
|
|
16
|
+
structuralOnly?: boolean;
|
|
17
|
+
}): VcStatus {
|
|
18
|
+
if (!opts.enabled) return "off";
|
|
19
|
+
if (opts.deferredReason) return "deferred";
|
|
20
|
+
if (opts.structuralOnly) return "structural";
|
|
21
|
+
return opts.hasData ? "live" : "awaiting_data";
|
|
22
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mega-dashboard-bounce.ts — VC0F stale-runner detection + bounce.
|
|
3
|
+
*
|
|
4
|
+
* Delegate of `mega-dashboard-cmds.ts` (kept under the extensions/ soft limit):
|
|
5
|
+
* owns the once-per-process staleness gate and the pure
|
|
6
|
+
* `bounceStaleRunnerIfAny` decision, which is the durable restart-on-upgrade
|
|
7
|
+
* seam — after `pi update --extensions` replaces the on-disk package, the next
|
|
8
|
+
* `session_start` probes the running dashboard, sees the version mismatch, and
|
|
9
|
+
* kills + respawns the stale runner so it serves the current code.
|
|
10
|
+
*
|
|
11
|
+
* The function is dependency-injected so unit tests (VC0F C1–C3) can stub every
|
|
12
|
+
* primitive; the production wiring (live discovery / version / kill) lives in
|
|
13
|
+
* `mega-dashboard-cmds.ts` and is passed in. No network here — the localhost
|
|
14
|
+
* HTTP probes live behind the injected `isServerRunning`/`serverVersion` deps
|
|
15
|
+
* (already audited PREVENT-PI-004 in the parent file).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Once-per-process staleness gate (VC0F A2). After the FIRST successful probe
|
|
20
|
+
* we skip re-probing on later /mega-dashboard invocations or session-start
|
|
21
|
+
* events within the same extension process — the probe is cheap but the
|
|
22
|
+
* kill+respawn it triggers is disruptive. Set regardless of outcome.
|
|
23
|
+
*/
|
|
24
|
+
let stalenessCheckedThisProcess = false;
|
|
25
|
+
|
|
26
|
+
/** Test-only seam: clear the once-per-process gate between unit tests. */
|
|
27
|
+
export function resetStalenessGateForTests(): void {
|
|
28
|
+
stalenessCheckedThisProcess = false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Injectables `bounceStaleRunnerIfAny` needs from the current repo's dashboard
|
|
32
|
+
* lifecycle. Injected so the unit tests (VC0F C1–C3) can stub each primitive
|
|
33
|
+
* independently. */
|
|
34
|
+
export interface BounceStaleDeps {
|
|
35
|
+
/** Discover a live dashboard server for the current repo, or null. */
|
|
36
|
+
isServerRunning(): Promise<{ port: number; url: string; hasPidFile: boolean } | null>;
|
|
37
|
+
/** Version the running server reports via HTTP (/api/version), or null. */
|
|
38
|
+
serverVersion(port: number): Promise<string | null>;
|
|
39
|
+
/** Version stamped in the current repo's port.pid marker, or null. */
|
|
40
|
+
markerVersion(): string | null;
|
|
41
|
+
/** Version of THIS extension package (from its own package.json). */
|
|
42
|
+
ownVersion(): string | null;
|
|
43
|
+
/** Kill the server on `port` and clear its marker (best-effort). */
|
|
44
|
+
killServerOnPort(port: number): void;
|
|
45
|
+
/** User notification; a no-op on the silent session-start path (VC0F A3). */
|
|
46
|
+
notify(message: string): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Detect + replace a STALE dashboard runner for the current repo (VC0F A1).
|
|
51
|
+
*
|
|
52
|
+
* A runner is stale when it is an orphan (live but missing its port.pid
|
|
53
|
+
* marker), when its marker's stamped `version` differs from this extension's
|
|
54
|
+
* own version (VC0F B2 — avoids the HTTP probe), or when the version it
|
|
55
|
+
* reports over HTTP differs from our own (fallback for pre-B2 servers whose
|
|
56
|
+
* marker has no `version` field). A stale runner is killed so the next launch
|
|
57
|
+
* serves the current on-disk code.
|
|
58
|
+
*
|
|
59
|
+
* Best-effort and non-fatal (Goal 4): any failure returns `{bounced:false}`
|
|
60
|
+
* and never throws. Runs at most once per extension process (A2).
|
|
61
|
+
*/
|
|
62
|
+
export async function bounceStaleRunnerIfAny(deps: BounceStaleDeps): Promise<{ bounced: boolean }> {
|
|
63
|
+
if (stalenessCheckedThisProcess) return { bounced: false };
|
|
64
|
+
try {
|
|
65
|
+
stalenessCheckedThisProcess = true; // once per process, regardless of outcome
|
|
66
|
+
const info = await deps.isServerRunning();
|
|
67
|
+
if (!info) return { bounced: false };
|
|
68
|
+
const orphan = !info.hasPidFile;
|
|
69
|
+
const want = deps.ownVersion();
|
|
70
|
+
const marker = deps.markerVersion();
|
|
71
|
+
let stale: boolean;
|
|
72
|
+
let from: string | null = null;
|
|
73
|
+
if (orphan) {
|
|
74
|
+
stale = true; // live server with no marker → orphan by definition
|
|
75
|
+
} else if (want != null && marker != null) {
|
|
76
|
+
stale = marker !== want; // B2: compare the stamped marker, skip the HTTP probe
|
|
77
|
+
from = marker;
|
|
78
|
+
} else {
|
|
79
|
+
const running = await deps.serverVersion(info.port);
|
|
80
|
+
from = running;
|
|
81
|
+
stale = want != null && running != null && running !== want;
|
|
82
|
+
}
|
|
83
|
+
if (stale) {
|
|
84
|
+
deps.notify(
|
|
85
|
+
orphan
|
|
86
|
+
? "[mega-compact] replacing orphaned dashboard server…"
|
|
87
|
+
: `[mega-compact] replacing stale dashboard (${from ?? "?"} → ${want ?? "?"})…`,
|
|
88
|
+
);
|
|
89
|
+
deps.killServerOnPort(info.port);
|
|
90
|
+
return { bounced: true };
|
|
91
|
+
}
|
|
92
|
+
return { bounced: false };
|
|
93
|
+
} catch {
|
|
94
|
+
// Best-effort, non-fatal — a failed probe/kill never breaks the caller.
|
|
95
|
+
return { bounced: false };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -12,6 +12,15 @@ import { fileURLToPath } from "node:url";
|
|
|
12
12
|
import { existsSync, writeFileSync, readFileSync, unlinkSync, openSync, closeSync } from "node:fs";
|
|
13
13
|
import { spawn, execSync } from "node:child_process"; // guardrails-allow PREVENT-PI-004: spawns the optional, user-triggered localhost dashboard server only
|
|
14
14
|
import type { MegaRuntime } from "./mega-runtime.js";
|
|
15
|
+
import {
|
|
16
|
+
bounceStaleRunnerIfAny,
|
|
17
|
+
type BounceStaleDeps,
|
|
18
|
+
} from "./mega-dashboard-bounce.js";
|
|
19
|
+
|
|
20
|
+
// Re-export the VC0F bounce seam for the unit tests, which import the parent
|
|
21
|
+
// module. The implementation + once-per-process gate live in the sibling
|
|
22
|
+
// delegate file to keep this module under the extensions/ soft limit (400).
|
|
23
|
+
export { bounceStaleRunnerIfAny, resetStalenessGateForTests, type BounceStaleDeps } from "./mega-dashboard-bounce.js";
|
|
15
24
|
|
|
16
25
|
/** Register the dashboard server lifecycle commands. */
|
|
17
26
|
export function registerDashboardCommands(pi: ExtensionAPI, runtime: MegaRuntime): void {
|
|
@@ -111,6 +120,28 @@ export function registerDashboardCommands(pi: ExtensionAPI, runtime: MegaRuntime
|
|
|
111
120
|
try { unlinkSync(portFile()); } catch { /* ignore */ }
|
|
112
121
|
}
|
|
113
122
|
|
|
123
|
+
/** Version stamped in the current repo's port.pid marker (VC0F B2), or null
|
|
124
|
+
* when the marker is absent or predates the stamped `version` field. */
|
|
125
|
+
function markerVersion(): string | null {
|
|
126
|
+
try {
|
|
127
|
+
const info = JSON.parse(readFileSync(portFile(), "utf-8")) as { version?: unknown };
|
|
128
|
+
return typeof info.version === "string" ? info.version : null;
|
|
129
|
+
} catch {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Build the dependency set `bounceStaleRunnerIfAny` needs for the CURRENT
|
|
136
|
+
* repo's dashboard lifecycle (port.pid / runner / launch-log all resolve via
|
|
137
|
+
* `runtime.currentStateDir`, so a repo switch re-targets the bounce).
|
|
138
|
+
* `notify` is threaded here so the interactive /mega-dashboard path surfaces
|
|
139
|
+
* the replace messages while the silent session-start path is a no-op.
|
|
140
|
+
*/
|
|
141
|
+
function staleBounceDeps(notify: (msg: string) => void): BounceStaleDeps {
|
|
142
|
+
return { isServerRunning, serverVersion, markerVersion, ownVersion, killServerOnPort, notify };
|
|
143
|
+
}
|
|
144
|
+
|
|
114
145
|
/**
|
|
115
146
|
* Resolve the launchable dashboard-server module.
|
|
116
147
|
*
|
|
@@ -148,9 +179,14 @@ export function registerDashboardCommands(pi: ExtensionAPI, runtime: MegaRuntime
|
|
|
148
179
|
const resolved = resolveDashboardEntry();
|
|
149
180
|
if (!resolved) return false;
|
|
150
181
|
dashboardNeedsStrip = resolved.needsStripTypes;
|
|
182
|
+
// VC0F B1: stamp the extension version in the generated script at WRITE time
|
|
183
|
+
// so a future probe can compare it against ownVersion() without a live HTTP
|
|
184
|
+
// round-trip (useful when the server is hung and /api/version times out).
|
|
185
|
+
const stampedVersion = ownVersion() ?? "0.0.0";
|
|
151
186
|
const script = [
|
|
152
187
|
`import { appendFileSync } from "node:fs";`,
|
|
153
188
|
`const __log = ${JSON.stringify(launchLog())};`,
|
|
189
|
+
`const __VERSION = ${JSON.stringify(stampedVersion)}; // mega-compact bundle version stamped at write time (VC0F B1)`,
|
|
154
190
|
`function __fail(err) {`,
|
|
155
191
|
` const msg = "[mega-compact] dashboard failed: " + (err && err.stack ? err.stack : String(err));`,
|
|
156
192
|
` try { appendFileSync(__log, msg + "\\n"); } catch { /* ignore */ }`,
|
|
@@ -181,32 +217,18 @@ export function registerDashboardCommands(pi: ExtensionAPI, runtime: MegaRuntime
|
|
|
181
217
|
description: "Start the local web dashboard and optionally open it in the default browser.",
|
|
182
218
|
handler: async (_args: string, ctx: ExtensionContext) => {
|
|
183
219
|
runtime.bindRepo(ctx.cwd);
|
|
184
|
-
|
|
220
|
+
// VC0F A1: lift the stale-replace decision out of the handler. Interactive
|
|
221
|
+
// path is unchanged — the user is still notified before a stale runner is
|
|
222
|
+
// killed. When a stale server is bounced, we fall straight through to a
|
|
223
|
+
// fresh spawn; otherwise reuse the live current server if there is one.
|
|
224
|
+
const { bounced } = await bounceStaleRunnerIfAny(staleBounceDeps((msg) => ctx.ui.notify(msg)));
|
|
225
|
+
const info = bounced ? null : await isServerRunning();
|
|
185
226
|
|
|
186
227
|
if (info) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
// build). A live server WITH a matching pid file and version is reused.
|
|
192
|
-
const orphan = !info.hasPidFile;
|
|
193
|
-
const running = await serverVersion(info.port);
|
|
194
|
-
const want = ownVersion();
|
|
195
|
-
const stale = orphan || (want != null && running != null && running !== want);
|
|
196
|
-
if (stale) {
|
|
197
|
-
ctx.ui.notify(
|
|
198
|
-
orphan
|
|
199
|
-
? "[mega-compact] replacing orphaned dashboard server…"
|
|
200
|
-
: `[mega-compact] replacing stale dashboard (${running} → ${want})…`,
|
|
201
|
-
);
|
|
202
|
-
killServerOnPort(info.port);
|
|
203
|
-
info = null;
|
|
204
|
-
} else {
|
|
205
|
-
ctx.ui.notify(`[mega-compact] dashboard already running at ${info.url}`);
|
|
206
|
-
const open = await ctx.ui.confirm("mega-compact dashboard", `Open ${info.url} in browser?`);
|
|
207
|
-
if (open) openBrowser(info.url);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
228
|
+
ctx.ui.notify(`[mega-compact] dashboard already running at ${info.url}`);
|
|
229
|
+
const open = await ctx.ui.confirm("mega-compact dashboard", `Open ${info.url} in browser?`);
|
|
230
|
+
if (open) openBrowser(info.url);
|
|
231
|
+
return;
|
|
210
232
|
}
|
|
211
233
|
|
|
212
234
|
// Start the server
|
|
@@ -310,4 +332,21 @@ export function registerDashboardCommands(pi: ExtensionAPI, runtime: MegaRuntime
|
|
|
310
332
|
}
|
|
311
333
|
},
|
|
312
334
|
});
|
|
335
|
+
|
|
336
|
+
// VC0F A3 — durable restart-on-upgrade: after `pi update --extensions`
|
|
337
|
+
// replaces the on-disk package, the next pi session probes the running
|
|
338
|
+
// dashboard, sees the version mismatch, and kills + respawns the stale runner
|
|
339
|
+
// automatically. SILENT — no ctx.ui.notify on this session-start path (unlike
|
|
340
|
+
// the explicit /mega-dashboard path). Best-effort and non-fatal: a probe or
|
|
341
|
+
// kill failure here never breaks session startup.
|
|
342
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
343
|
+
runtime.bindRepo(ctx.cwd);
|
|
344
|
+
try {
|
|
345
|
+
await bounceStaleRunnerIfAny(
|
|
346
|
+
staleBounceDeps(() => { /* session-start path stays silent (VC0F A3) */ }),
|
|
347
|
+
);
|
|
348
|
+
} catch {
|
|
349
|
+
/* best-effort — never break the session */
|
|
350
|
+
}
|
|
351
|
+
});
|
|
313
352
|
}
|
|
@@ -309,9 +309,9 @@ export async function persistEpochAndMaintain(
|
|
|
309
309
|
runtime.appendEvent(name, payload as Record<string, unknown>),
|
|
310
310
|
{
|
|
311
311
|
subsystem: "post_compact",
|
|
312
|
-
generation:
|
|
312
|
+
generation: runtime.rt.compactCount,
|
|
313
313
|
backoffMs: 0,
|
|
314
|
-
gapSize:
|
|
314
|
+
gapSize: ran.result.compactedFrom,
|
|
315
315
|
},
|
|
316
316
|
);
|
|
317
317
|
} catch {
|
|
@@ -21,6 +21,7 @@ import type { MegaConfig } from "../../mega-config.js";
|
|
|
21
21
|
import type { TailResultFn } from "./gateCheck.js";
|
|
22
22
|
import { recordCompactLatency } from "../../mega-runtime/vc-observer.js";
|
|
23
23
|
import { decideLivePath } from "../../mega-runtime/vector-cortex-live.js";
|
|
24
|
+
import { defaultClock, type RolloutEvidence } from "../../../src/vector-cortex/rollout/gate.js";
|
|
24
25
|
import { VC5C_ENABLED } from "../../../src/config/vector-cortex.js";
|
|
25
26
|
|
|
26
27
|
/** The non-skipped variant of the runCompact result. */
|
|
@@ -53,13 +54,27 @@ export function invokePipeline(
|
|
|
53
54
|
// rollout shapes. Best-effort + non-fatal; decision does NOT gate behavior yet.
|
|
54
55
|
if (VC5C_ENABLED()) {
|
|
55
56
|
try {
|
|
57
|
+
const clock = defaultClock();
|
|
58
|
+
// Conservative evidence: fresh in-memory window (elapsed=0), not
|
|
59
|
+
// powered, so the gate can't advance — but events/sessions carry real
|
|
60
|
+
// values so the decision events reflect actual runtime activity rather
|
|
61
|
+
// than degrading every epoch to an empty mode-C read.
|
|
62
|
+
const evidence: RolloutEvidence = {
|
|
63
|
+
windowStartMs: clock.now(),
|
|
64
|
+
powered: false,
|
|
65
|
+
events: runtime.rt.compactCount,
|
|
66
|
+
sessions: 1,
|
|
67
|
+
hardFaults:
|
|
68
|
+
(runtime.rt as { vcHardFaults?: import("../../../src/vector-cortex/rollout/types.js").RolloutHardFault[] })
|
|
69
|
+
.vcHardFaults ?? [],
|
|
70
|
+
};
|
|
56
71
|
const decision = decideLivePath(runtime.rt.sessionId, {
|
|
57
72
|
emit: runtime.appendEvent.bind(runtime),
|
|
73
|
+
clock,
|
|
58
74
|
currentGate:
|
|
59
75
|
(runtime.rt as { vcGate?: 0 | 1 | 2 | 3 | 4 }).vcGate ?? 0,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.vcHardFaults ?? [],
|
|
76
|
+
evidence,
|
|
77
|
+
hardFaults: evidence.hardFaults,
|
|
63
78
|
});
|
|
64
79
|
runtime.appendEvent("vector_cortex_rollout_decision", {
|
|
65
80
|
sessionId: runtime.rt.sessionId,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* `registerEventHandlers` which delegates to the focused sub-registration
|
|
6
6
|
* functions in session/agent/context/compact handlers.
|
|
7
7
|
*/
|
|
8
|
-
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
9
9
|
import type { MegaRuntime } from "../mega-runtime.js";
|
|
10
10
|
import type { MegaConfig } from "../mega-config.js";
|
|
11
11
|
import { registerSessionHandlers } from "./session-handlers.js";
|
|
@@ -13,6 +13,7 @@ import { registerAgentHandlers } from "./agent-handlers.js";
|
|
|
13
13
|
import { registerContextHandler } from "./context-handler.js";
|
|
14
14
|
import { registerCompactHandlers } from "./compact-handlers.js";
|
|
15
15
|
import { registerPerfHandler } from "./perf-handler.js";
|
|
16
|
+
import { registerVectorCortexRender } from "../mega-context/vector-cortex.js";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* DIAG accessor for the headless test harness: the most recently constructed
|
|
@@ -30,6 +31,18 @@ export function registerEventHandlers(
|
|
|
30
31
|
config: MegaConfig,
|
|
31
32
|
): void {
|
|
32
33
|
lastRuntime = runtime;
|
|
34
|
+
// VC5B: wire the render+validate seam into the before_agent_start lifecycle.
|
|
35
|
+
// Registered FIRST so its no-op return (no render input on ctx) doesn't
|
|
36
|
+
// clobber a systemPrompt that a later before_agent_start handler (e.g. the
|
|
37
|
+
// legacy recall prepend in session-handlers) returns. When VC5B does
|
|
38
|
+
// prepend, it returns a new systemPrompt; the later handlers run on the
|
|
39
|
+
// recallTailInject=ON path and return undefined, so VC5B's return survives.
|
|
40
|
+
// The _ctx param is unused by the seam; pass empty for the registered seam.
|
|
41
|
+
try {
|
|
42
|
+
registerVectorCortexRender(pi, undefined as unknown as ExtensionContext, (event, fields) => {
|
|
43
|
+
try { runtime.appendEvent(event, fields); } catch { /* non-fatal */ }
|
|
44
|
+
});
|
|
45
|
+
} catch { /* non-fatal: VC5B registration never breaks startup */ }
|
|
33
46
|
// ---- Session lifecycle (state reset points) -------------------------------
|
|
34
47
|
registerSessionHandlers(pi, runtime, config);
|
|
35
48
|
registerAgentHandlers(pi, runtime, config);
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
recordRecallWrite,
|
|
27
27
|
} from "../mega-turn-store.js";
|
|
28
28
|
import { type MegaRuntime, C } from "../mega-runtime.js";
|
|
29
|
+
import { recordRecallLatency } from "../mega-runtime/vc-observer.js";
|
|
29
30
|
import type { MegaConfig } from "../mega-config.js";
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -46,6 +47,7 @@ export function doRecall(
|
|
|
46
47
|
// are already resident in the session, so recall never re-injects context the
|
|
47
48
|
// model can already see. Best-effort — an empty window just skips dedupe.
|
|
48
49
|
const liveWindow = config.windowDedupe ? extractLiveWindow(ctx) : undefined;
|
|
50
|
+
const recallStartMs = Date.now();
|
|
49
51
|
const result = recallAndInline(
|
|
50
52
|
{
|
|
51
53
|
sessionId: sid,
|
|
@@ -165,6 +167,14 @@ export function doRecall(
|
|
|
165
167
|
/* non-fatal: recall provenance never breaks the recall path */
|
|
166
168
|
}
|
|
167
169
|
}
|
|
170
|
+
// VC0A: record recall latency on the eval observer (mode A) so the dashboard
|
|
171
|
+
// histogram reflects real data. No-op when the observer is absent (flag off /
|
|
172
|
+
// construction failure).
|
|
173
|
+
try {
|
|
174
|
+
recordRecallLatency(runtime, Date.now() - recallStartMs, sid, 0);
|
|
175
|
+
} catch {
|
|
176
|
+
/* non-fatal: latency recording never breaks recall */
|
|
177
|
+
}
|
|
168
178
|
return result;
|
|
169
179
|
}
|
|
170
180
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-mega-compact",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.26",
|
|
4
4
|
"description": "Layered, local, vector-backed context compressor for pi — supersede/collapse/cluster compaction with deduped inline recall.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e,r as m,B as l}from"./index-CtlmOlj1.js";import{C as o,a as c,b as i,c as d}from"./card-D9F4wbqs.js";async function N(){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 R(){const s=await fetch("/api/vector-cortex/reconstruct");if(!s.ok)throw new Error(`vector-cortex reconstruct: ${s.status}`);return s.json()}async function F(){const s=await fetch("/api/vector-cortex/plans");if(!s.ok)throw new Error(`vector-cortex plans: ${s.status}`);return s.json()}async function k(){const s=await fetch("/api/vector-cortex/render");if(!s.ok)throw new Error(`vector-cortex render: ${s.status}`);return s.json()}async function A(){const s=await fetch("/api/vector-cortex/rollout");if(!s.ok)throw new Error(`vector-cortex rollout: ${s.status}`);return s.json()}async function T(){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 P(){const s=await fetch("/api/vector-cortex/restore");if(!s.ok)throw new Error(`vector-cortex restore: ${s.status}`);return s.json()}async function M(){const s=await fetch("/api/vector-cortex/repair");if(!s.ok)throw new Error(`vector-cortex repair: ${s.status}`);return s.json()}async function O(s="default"){const a=await fetch(`/api/vector-cortex/ledger?session=${encodeURIComponent(s)}`);if(!a.ok)throw new Error(`vector-cortex ledger: ${a.status}`);return a.json()}async function I(s){const a=await fetch("/api/vector-cortex/breakers/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subsystem:s})});if(!a.ok)throw new Error(`vector-cortex reset: ${a.status}`);return a.json()}async function B(){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 $(){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 w(){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 L(){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 D(){const s=await fetch("/api/vector-cortex/platform");if(!s.ok)throw new Error(`vector-cortex platform: ${s.status}`);return s.json()}function r({label:s,value:a}){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:a})]})}function _(){const[s,a]=m.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=m.useCallback(()=>{a(t=>({...t,loading:!0})),N().then(t=>a(n=>({...n,data:t,loading:!1,error:null}))).catch(t=>a(n=>({...n,loading:!1,error:t instanceof Error?t.message:String(t)}))),b().then(t=>a(n=>({...n,health:t}))).catch(()=>{}),O().then(t=>a(n=>({...n,ledger:t}))).catch(()=>{}),S().then(t=>a(n=>({...n,topology:t}))).catch(()=>{}),V().then(t=>a(n=>({...n,query:t}))).catch(()=>{}),E().then(t=>a(n=>({...n,shards:t}))).catch(()=>{}),R().then(t=>a(n=>({...n,reconstruct:t}))).catch(()=>{}),F().then(t=>a(n=>({...n,plans:t}))).catch(()=>{}),k().then(t=>a(n=>({...n,render:t}))).catch(()=>{}),A().then(t=>a(n=>({...n,rollout:t}))).catch(()=>{}),T().then(t=>a(n=>({...n,closureProof:t}))).catch(()=>{}),P().then(t=>a(n=>({...n,restore:t}))).catch(()=>{}),M().then(t=>a(n=>({...n,repair:t}))).catch(()=>{}),B().then(t=>a(n=>({...n,crystals:t}))).catch(()=>{}),$().then(t=>a(n=>({...n,economics:t}))).catch(()=>{}),w().then(t=>a(n=>({...n,diagnostics:t}))).catch(()=>{}),L().then(t=>a(n=>({...n,outcomes:t}))).catch(()=>{}),U().then(t=>a(n=>({...n,policy:t}))).catch(()=>{}),D().then(t=>a(n=>({...n,platform:t}))).catch(()=>{})},[]);return m.useEffect(()=>{u();const t=setInterval(u,5e3);return()=>clearInterval(t)},[u]),[s,u]}function q({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Validated Prompt Renderer (VC5B)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Render fixtures",value:String(s.renderCount)}),e.jsx(r,{label:"Provider profiles",value:String(s.providerCount)}),e.jsx(r,{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."})]}):e.jsx("div",{className:"vc-empty",children:"Renderer disabled (VC5B off)."})})]})}function H({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Live Graduated Rollout (VC5C)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Gate",value:`${s.gatePct}%`}),e.jsx(r,{label:"Exposed buckets",value:String(s.bucketCount)}),e.jsx(r,{label:"Total buckets",value:String(s.buckets)}),e.jsx(r,{label:"Promotion",value:s.promotionBlocked?"FROZEN":"OPEN"}),e.jsx(r,{label:"Events",value:String(s.events)}),e.jsx(r,{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."})]}):e.jsx("div",{className:"vc-empty",children:"Rollout disabled (VC5C off)."})})]})}function z({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Closure Optimization (VC6A)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Mode",value:s.mode}),e.jsx(r,{label:"Optimizations",value:String(s.optimizations)}),e.jsx(r,{label:"Proof rejections",value:String(s.proofRejections)}),e.jsx(r,{label:"Last rejection",value:s.lastRejection??"none"}),e.jsx(r,{label:"Retained edges",value:String(s.retainedEdgeTotal)}),e.jsx(r,{label:"Removed edges",value:String(s.removedEdgeTotal)}),e.jsx(r,{label:"Conservative walks",value:String(s.conservativeTraversalTotal)}),e.jsx(r,{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)."})]}):e.jsx("div",{className:"vc-empty",children:"Closure optimization disabled (VC6A off) — conservative VC4C closure used directly (mode B)."})})]})}function Y({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Exact Source Restoration (VC6B)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Mode",value:s.mode}),e.jsx(r,{label:"Restore attempts",value:String(s.restoreAttempts)}),e.jsx(r,{label:"Restored",value:String(s.restoredCount)}),e.jsx(r,{label:"Missing source",value:String(s.missingCount)}),e.jsx(r,{label:"Digest rejections",value:String(s.digestRejections)}),e.jsx(r,{label:"Last rejection",value:s.lastRejection??"none"}),e.jsx(r,{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)."})]}):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 W({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Self-Healing Derived State (VC6C)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Mode",value:s.mode}),e.jsx(r,{label:"Repair attempts",value:String(s.repairAttempts)}),e.jsx(r,{label:"Repairs planned",value:String(s.repairsPlanned)}),e.jsx(r,{label:"Pointers switched",value:String(s.pointersSwitched)}),e.jsx(r,{label:"Backoffs",value:String(s.backoffs)}),e.jsx(r,{label:"Last backoff",value:s.lastBackoffMs===null?"none":`${s.lastBackoffMs}ms`}),e.jsx(r,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(r,{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)."})]}):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 G({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Frozen Range Crystals (VC7A)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Mode",value:s.mode}),e.jsx(r,{label:"Crystals",value:String(s.crystalCount)}),e.jsx(r,{label:"Frozen bytes",value:String(s.totalBytes)}),e.jsx(r,{label:"Hits",value:String(s.hits)}),e.jsx(r,{label:"Misses",value:String(s.misses)}),e.jsx(r,{label:"Hit bytes",value:String(s.hitBytes)}),e.jsx(r,{label:"Writes",value:String(s.writes)}),e.jsx(r,{label:"Duplicate writes",value:String(s.duplicateWrites)}),e.jsx(r,{label:"Collisions",value:String(s.collisions)}),e.jsx(r,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(r,{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."})]}):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 K({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Cache Economics (VC7B)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Mode",value:s.mode}),e.jsx(r,{label:"Profiles",value:String(s.profileCount)}),e.jsx(r,{label:"Proven exclusions",value:String(s.provenExclusions)}),e.jsx(r,{label:"Unproven exclusions",value:String(s.unprovenExclusions)}),e.jsx(r,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(r,{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."})]}):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 Q({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Cache Diagnostics & Breakers (VC7C)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Mode",value:s.mode}),e.jsx(r,{label:"Profile misses",value:String(s.profileMisses)}),e.jsx(r,{label:"Range misses",value:String(s.rangeMisses)}),e.jsx(r,{label:"Dependency misses",value:String(s.dependencyMisses)}),e.jsx(r,{label:"Request misses",value:String(s.requestMisses)}),e.jsx(r,{label:"Generation misses",value:String(s.generationMisses)}),e.jsx(r,{label:"Unknown misses",value:String(s.unknownMisses)}),e.jsx(r,{label:"Serves blocked",value:String(s.serveBlocked)}),e.jsx(r,{label:"Breaker",value:s.breakerState}),e.jsx(r,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(r,{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."})]}):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 Z({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Consent-Bound Outcomes (VC8A)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Mode",value:s.mode}),e.jsx(r,{label:"Outcomes",value:String(s.outcomeCount)}),e.jsx(r,{label:"Consented sessions",value:String(s.consentedSessions)}),e.jsx(r,{label:"Revoked sessions",value:String(s.revokedSessions)}),e.jsx(r,{label:"Manifests",value:String(s.manifestCount)}),e.jsx(r,{label:"Excluded records",value:String(s.excludedCount)}),e.jsx(r,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(r,{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."})]}):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 J({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Shadow Adaptive Policy (VC8B)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Mode",value:s.mode}),e.jsx(r,{label:"Shadow decisions",value:String(s.shadowDecisions)}),e.jsx(r,{label:"Clamped",value:String(s.clampedDecisions)}),e.jsx(r,{label:"Rejected inputs",value:String(s.rejectedInputs)}),e.jsx(r,{label:"Live mutations",value:String(s.liveMutations)}),e.jsx(r,{label:"Pressure version",value:String(s.pressureVersion)}),e.jsx(r,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(r,{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."})]}):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 X({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Canary Platform + Rust Parity (VC8C)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Mode",value:s.mode}),e.jsx(r,{label:"Fixtures",value:String(s.fixtureCount)}),e.jsx(r,{label:"Passed",value:String(s.passed)}),e.jsx(r,{label:"Failed",value:String(s.failed)}),e.jsx(r,{label:"External runner",value:s.externalRunnerConfigured?"configured":"none"}),e.jsx(r,{label:"Last failure",value:s.lastFailure??"none"}),e.jsx(r,{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."})]}):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 ee({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Dual-Tier Shards (VC4A)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Semantic shards",value:String(s.semanticCount)}),e.jsx(r,{label:"Exact shards",value:String(s.exactCount)}),e.jsx(r,{label:"Byte total",value:String(s.byteTotal)}),e.jsx(r,{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."})]}):e.jsx("div",{className:"vc-empty",children:"Dual-tier shards disabled (VC4A off)."})})]})}function se({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Reconstruction Fidelity (VC4C)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Closure attempts",value:String(s.closureAttempts)}),e.jsx(r,{label:"Closure rejections",value:String(s.closureRejections)}),e.jsx(r,{label:"Validated",value:String(s.validatedCount)}),e.jsx(r,{label:"Invalidated",value:String(s.invalidatedCount)}),e.jsx(r,{label:"Span total",value:String(s.spanTotal)}),e.jsx(r,{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."})]}):e.jsx("div",{className:"vc-empty",children:"Reconstruction fidelity disabled (VC4C off)."})})]})}function re({view:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Plan Manifests (VC5A)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"DAG fixtures",value:String(s.dagCount)}),e.jsx(r,{label:"Plan fixtures",value:String(s.plannerCount)}),e.jsx(r,{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."})]}):e.jsx("div",{className:"vc-empty",children:"PromptDagV1 + budgeted planner disabled (VC5A off)."})})]})}function te({topology:s,query:a}){return e.jsxs(e.Fragment,{children:[e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Derived Cortex Store (VC3A)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Generation",value:s.generationId??"—"}),e.jsx(r,{label:"Ordinal",value:s.ordinal??"—"}),e.jsx(r,{label:"Records",value:String(s.recordCount)}),e.jsx(r,{label:"Frontier (HW)",value:s.sourceHighWater}),e.jsx(r,{label:"Root digest",value:s.rootDigest?s.rootDigest.slice(0,16):"—"}),s.nodes!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx(r,{label:"Nodes",value:String(s.nodes?.length??0)}),e.jsx(r,{label:"Edges",value:String(s.edges?.length??0)}),e.jsx(r,{label:"Graph digest",value:s.generationDigest?s.generationDigest.slice(0,16):"—"})]})]}),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,t)=>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}-${t}`))})]})]})]}):e.jsx("div",{className:"vc-empty",children:"Cortex store disabled (VC3A off)."})})]}),e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Topology Query Diagnostics (VC3C)"}),a?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{children:a?.enabled?e.jsx("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:e.jsx(r,{label:"Router version",value:String(a.routerVersion)})}):e.jsx("div",{className:"vc-empty",children:"Query diagnostics unavailable (VC3C off)."})})]})]})}function ae({ledger:s}){return e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Occurrence Ledger (VC1B)"}),s?.enabled?e.jsx(l,{variant:"success",children:"ACTIVE"}):e.jsx(l,{variant:"danger",children:"OFF"})]})}),e.jsx(d,{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(r,{label:"Session",value:s.session}),e.jsx(r,{label:"High-water",value:s.highWater}),e.jsx(r,{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(a=>e.jsxs("tr",{className:"border-b border-border/30",children:[e.jsx("td",{className:"py-1 pr-2 font-mono",children:a.seq}),e.jsx("td",{className:"py-1 pr-2 font-mono",children:a.eventId}),e.jsx("td",{className:"py-1 pr-2",children:a.kind}),e.jsx("td",{className:"py-1 pr-2 font-mono",children:a.toolCallId??"—"}),e.jsx("td",{className:"max-w-[180px] truncate font-mono text-muted-foreground",children:a.digest})]},`${a.seq}-${a.eventId}`))})]})})]}):e.jsx("div",{className:"vc-empty",children:"Ledger disabled (VC1B off)."})})]})}function g({mode:s,count:a}){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:a})]})}function oe(){const[s,a]=_(),[u,t]=m.useState(null),{loading:n,error:f,data:x,health:h}=s,y=()=>{I("provider").then(j=>(t(`Breaker "${j.subsystem}" ${j.state}; evidence retained: ${j.failures} failures / ${j.attempts} attempts`),b())).then(j=>{a()}).catch(j=>t(j instanceof Error?j.message:String(j)))};if(n&&!x)return e.jsx("div",{className:"vc-loading",children:"Loading vector-cortex evaluation…"});if(f&&!x)return e.jsxs("div",{className:"vc-error",children:["Error: ",f]});if(!x)return e.jsx("div",{className:"vc-empty",children:"No evaluation data available."});const p=Math.max(1,...x.histogram.cells,x.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"}),x.enabled?x.samples===0?e.jsx(l,{variant:"warning",children:"OBSERVER (A) — NO SAMPLES YET"}):e.jsxs(l,{variant:"success",children:["OBSERVER (A) — ",x.samples," SAMPLES"]}):e.jsx(l,{variant:"danger",children:"MODE C (OFF)"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[e.jsxs(o,{children:[e.jsx(c,{children:e.jsx(i,{children:"Samples"})}),e.jsxs(d,{children:[e.jsx("div",{className:"text-3xl font-bold",children:x.samples}),e.jsxs("div",{className:"mt-2 flex flex-col",children:[e.jsx(g,{mode:"A",count:x.byMode.A}),e.jsx(g,{mode:"B",count:x.byMode.B}),e.jsx(g,{mode:"C",count:x.byMode.C})]})]})]}),e.jsxs(o,{className:"md:col-span-2",children:[e.jsx(c,{children:e.jsx(i,{children:"Latency Histogram (ms, inclusive edges)"})}),e.jsxs(d,{children:[e.jsxs("div",{className:"flex items-end gap-2",style:{height:160},children:[x.histogram.edges.map((j,v)=>{const C=x.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:x.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:["≤",j]})]},j)}),e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:x.histogram.overflow}),e.jsx("div",{className:"w-full rounded-t",style:{height:Math.max(2,x.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: ",x.histogram.total," · Rejects: ",x.rejects.length]})]})]})]}),e.jsxs(o,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(i,{children:"Live Safety Envelope (VC0C)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[h?.stateSource==="ephemeral"&&e.jsx(l,{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(d,{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(r,{label:"State",value:h.state}),e.jsx(r,{label:"Mode",value:h.mode}),e.jsx(r,{label:"Window",value:`${h.windowMs}ms`}),e.jsx(r,{label:"Probes",value:String(h.probeCount)}),e.jsx(r,{label:"Backoff",value:`${h.backoffDelayMs}ms`}),e.jsx(r,{label:"Failures",value:`${h.failures}/${h.attempts}`}),e.jsx(r,{label:"Frontier",value:h.stateSource==="ephemeral"?"non-live":h.frontierFrozen?"FROZEN":"LIVE"}),e.jsx(r,{label:"Spool lag",value:String(h.spoolLag)}),e.jsx(r,{label:"Encoder mode",value:h.encoderMode}),e.jsx(r,{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(te,{topology:s.topology,query:s.query}),e.jsx(ee,{view:s.shards}),e.jsx(se,{view:s.reconstruct}),e.jsx(re,{view:s.plans}),e.jsx(q,{view:s.render}),e.jsx(H,{view:s.rollout}),e.jsx(z,{view:s.closureProof}),e.jsx(Y,{view:s.restore}),e.jsx(W,{view:s.repair}),e.jsx(G,{view:s.crystals}),e.jsx(K,{view:s.economics}),e.jsx(Q,{view:s.diagnostics}),e.jsx(Z,{view:s.outcomes}),e.jsx(J,{view:s.policy}),e.jsx(X,{view:s.platform}),e.jsx(ae,{ledger:s.ledger})]})}export{oe as default};
|
|
2
|
-
//# sourceMappingURL=VectorCortexTab-B3WuPeyn.js.map
|