pi-mega-compact 0.20.7 → 0.20.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/config/vector-cortex.js +25 -0
  2. package/dist/config.js +1 -1
  3. package/dist/extensions/dashboard-server/api-contracts/vector-cortex-heal.js +11 -0
  4. package/dist/extensions/dashboard-server/route-dispatch.js +104 -0
  5. package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +2 -0
  6. package/dist/extensions/dashboard-server/routes-vector-cortex-heal.js +86 -0
  7. package/dist/extensions/dashboard-server/routes-vector-cortex.js +3 -0
  8. package/dist/extensions/dashboard-server/routes.js +1 -1
  9. package/dist/extensions/dashboard-server/server.js +3 -82
  10. package/dist/src/config/vector-cortex.js +25 -0
  11. package/dist/src/config.js +1 -1
  12. package/dist/src/vector-cortex/heal/_acceptance-fixture.js +56 -0
  13. package/dist/src/vector-cortex/heal/_restore-fixture.js +96 -0
  14. package/dist/src/vector-cortex/heal/_vc6b-helpers.js +35 -0
  15. package/dist/src/vector-cortex/heal/closure-metrics.js +66 -0
  16. package/dist/src/vector-cortex/heal/closure-opt.js +242 -0
  17. package/dist/src/vector-cortex/heal/emit.js +69 -0
  18. package/dist/src/vector-cortex/heal/proof.js +210 -0
  19. package/dist/src/vector-cortex/heal/restore-emit.js +70 -0
  20. package/dist/src/vector-cortex/heal/restore-readers.js +114 -0
  21. package/dist/src/vector-cortex/heal/restore-types.js +66 -0
  22. package/dist/src/vector-cortex/heal/restore.js +140 -0
  23. package/dist/src/vector-cortex/heal/types.js +43 -0
  24. package/dist/src/vector-cortex/heal/verify.js +75 -0
  25. package/dist/vector-cortex/heal/_acceptance-fixture.js +56 -0
  26. package/dist/vector-cortex/heal/_restore-fixture.js +96 -0
  27. package/dist/vector-cortex/heal/_vc6b-helpers.js +35 -0
  28. package/dist/vector-cortex/heal/closure-metrics.js +66 -0
  29. package/dist/vector-cortex/heal/closure-opt.js +242 -0
  30. package/dist/vector-cortex/heal/emit.js +69 -0
  31. package/dist/vector-cortex/heal/proof.js +210 -0
  32. package/dist/vector-cortex/heal/restore-emit.js +70 -0
  33. package/dist/vector-cortex/heal/restore-readers.js +114 -0
  34. package/dist/vector-cortex/heal/restore-types.js +66 -0
  35. package/dist/vector-cortex/heal/restore.js +140 -0
  36. package/dist/vector-cortex/heal/types.js +43 -0
  37. package/dist/vector-cortex/heal/verify.js +75 -0
  38. package/extensions/dashboard-client/dist/assets/{AreaChart-DqTbaSRA.js → AreaChart-fxyq2KaH.js} +2 -2
  39. package/extensions/dashboard-client/dist/assets/{AreaChart-DqTbaSRA.js.map → AreaChart-fxyq2KaH.js.map} +1 -1
  40. package/extensions/dashboard-client/dist/assets/{BarChart-BfNBeOvF.js → BarChart-D5EqAINP.js} +2 -2
  41. package/extensions/dashboard-client/dist/assets/{BarChart-BfNBeOvF.js.map → BarChart-D5EqAINP.js.map} +1 -1
  42. package/extensions/dashboard-client/dist/assets/{CacheTab-C9SOMYB5.js → CacheTab-D4UWbzLo.js} +2 -2
  43. package/extensions/dashboard-client/dist/assets/{CacheTab-C9SOMYB5.js.map → CacheTab-D4UWbzLo.js.map} +1 -1
  44. package/extensions/dashboard-client/dist/assets/{EventsTab-GsMKP10_.js → EventsTab-BiXquGrX.js} +2 -2
  45. package/extensions/dashboard-client/dist/assets/{EventsTab-GsMKP10_.js.map → EventsTab-BiXquGrX.js.map} +1 -1
  46. package/extensions/dashboard-client/dist/assets/{HealthTab-DAOCXwRP.js → HealthTab-D5QvoTjy.js} +2 -2
  47. package/extensions/dashboard-client/dist/assets/{HealthTab-DAOCXwRP.js.map → HealthTab-D5QvoTjy.js.map} +1 -1
  48. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-BtBeMkB5.js → MaintenanceTab-Cy_-CWgM.js} +2 -2
  49. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-BtBeMkB5.js.map → MaintenanceTab-Cy_-CWgM.js.map} +1 -1
  50. package/extensions/dashboard-client/dist/assets/{MemoryMapTab-DzndtgkZ.js → MemoryMapTab-DrAjgGOR.js} +2 -2
  51. package/extensions/dashboard-client/dist/assets/{MemoryMapTab-DzndtgkZ.js.map → MemoryMapTab-DrAjgGOR.js.map} +1 -1
  52. package/extensions/dashboard-client/dist/assets/{MetricsTab-DyxJ4eb8.js → MetricsTab-BvPHcuFN.js} +2 -2
  53. package/extensions/dashboard-client/dist/assets/{MetricsTab-DyxJ4eb8.js.map → MetricsTab-BvPHcuFN.js.map} +1 -1
  54. package/extensions/dashboard-client/dist/assets/{OverviewTab-DCiEdVWR.js → OverviewTab-DsbIigOQ.js} +2 -2
  55. package/extensions/dashboard-client/dist/assets/{OverviewTab-DCiEdVWR.js.map → OverviewTab-DsbIigOQ.js.map} +1 -1
  56. package/extensions/dashboard-client/dist/assets/{ReposTab-B5SIqVHA.js → ReposTab-7v_uZX_a.js} +2 -2
  57. package/extensions/dashboard-client/dist/assets/{ReposTab-B5SIqVHA.js.map → ReposTab-7v_uZX_a.js.map} +1 -1
  58. package/extensions/dashboard-client/dist/assets/{SessionsTab-DLWFJ9xI.js → SessionsTab-BXGrv-6C.js} +2 -2
  59. package/extensions/dashboard-client/dist/assets/{SessionsTab-DLWFJ9xI.js.map → SessionsTab-BXGrv-6C.js.map} +1 -1
  60. package/extensions/dashboard-client/dist/assets/{SetupTab-CvGXZyej.js → SetupTab-QRUXa65y.js} +2 -2
  61. package/extensions/dashboard-client/dist/assets/{SetupTab-CvGXZyej.js.map → SetupTab-QRUXa65y.js.map} +1 -1
  62. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-wZuQGxLS.js → TimeSavedCard-p327ZZKT.js} +2 -2
  63. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-wZuQGxLS.js.map → TimeSavedCard-p327ZZKT.js.map} +1 -1
  64. package/extensions/dashboard-client/dist/assets/{TurnsTab-B7aOejch.js → TurnsTab-BcmBSlik.js} +2 -2
  65. package/extensions/dashboard-client/dist/assets/{TurnsTab-B7aOejch.js.map → TurnsTab-BcmBSlik.js.map} +1 -1
  66. package/extensions/dashboard-client/dist/assets/VectorCortexTab-D2fjKNyT.js +2 -0
  67. package/extensions/dashboard-client/dist/assets/VectorCortexTab-D2fjKNyT.js.map +1 -0
  68. package/extensions/dashboard-client/dist/assets/{WikiTab-DhWHjAtt.js → WikiTab-DLXFMuNy.js} +2 -2
  69. package/extensions/dashboard-client/dist/assets/{WikiTab-DhWHjAtt.js.map → WikiTab-DLXFMuNy.js.map} +1 -1
  70. package/extensions/dashboard-client/dist/assets/{button-BrC-W87h.js → button-C9CghmRx.js} +2 -2
  71. package/extensions/dashboard-client/dist/assets/{button-BrC-W87h.js.map → button-C9CghmRx.js.map} +1 -1
  72. package/extensions/dashboard-client/dist/assets/{card-0rgfRgr3.js → card-DWU-1y3t.js} +2 -2
  73. package/extensions/dashboard-client/dist/assets/{card-0rgfRgr3.js.map → card-DWU-1y3t.js.map} +1 -1
  74. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-DRresOQF.js → generateCategoricalChart-Dayy9dGn.js} +2 -2
  75. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-DRresOQF.js.map → generateCategoricalChart-Dayy9dGn.js.map} +1 -1
  76. package/extensions/dashboard-client/dist/assets/{index-DohmtZWL.js → index-D9PsW3VZ.js} +3 -3
  77. package/extensions/dashboard-client/dist/assets/{index-DohmtZWL.js.map → index-D9PsW3VZ.js.map} +1 -1
  78. package/extensions/dashboard-client/dist/assets/{switch-Bs8g_zB5.js → switch-CnLFAmVT.js} +2 -2
  79. package/extensions/dashboard-client/dist/assets/{switch-Bs8g_zB5.js.map → switch-CnLFAmVT.js.map} +1 -1
  80. package/extensions/dashboard-client/dist/assets/{toggle-DVVauIo8.js → toggle-HN5C7_vy.js} +2 -2
  81. package/extensions/dashboard-client/dist/assets/{toggle-DVVauIo8.js.map → toggle-HN5C7_vy.js.map} +1 -1
  82. package/extensions/dashboard-client/dist/assets/{useSSE-DxH1PTAR.js → useSSE-DoJfk3Ce.js} +2 -2
  83. package/extensions/dashboard-client/dist/assets/{useSSE-DxH1PTAR.js.map → useSSE-DoJfk3Ce.js.map} +1 -1
  84. package/extensions/dashboard-client/dist/index.html +1 -1
  85. package/extensions/dashboard-client/src/api/vector-cortex.ts +18 -0
  86. package/extensions/dashboard-client/src/tabs/VectorCortexClosureCard.tsx +46 -0
  87. package/extensions/dashboard-client/src/tabs/VectorCortexLedgerCard.tsx +80 -0
  88. package/extensions/dashboard-client/src/tabs/VectorCortexRestoreCard.tsx +42 -0
  89. package/extensions/dashboard-client/src/tabs/VectorCortexTab.tsx +20 -164
  90. package/extensions/dashboard-client/src/tabs/VectorCortexTopologyCard.tsx +131 -0
  91. package/extensions/dashboard-client/src/types/vector-cortex.ts +30 -0
  92. package/extensions/dashboard-server/api-contracts/vector-cortex-heal.ts +73 -0
  93. package/extensions/dashboard-server/api-contracts/vector-cortex.ts +5 -0
  94. package/extensions/dashboard-server/route-dispatch.ts +114 -0
  95. package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +12 -0
  96. package/extensions/dashboard-server/routes-vector-cortex-heal.ts +103 -0
  97. package/extensions/dashboard-server/routes-vector-cortex.ts +6 -0
  98. package/extensions/dashboard-server/routes.ts +2 -0
  99. package/extensions/dashboard-server/server.ts +3 -86
  100. package/package.json +1 -1
  101. package/src/config/vector-cortex.ts +27 -0
  102. package/src/config.ts +2 -0
  103. package/src/vector-cortex/heal/_acceptance-fixture.ts +108 -0
  104. package/src/vector-cortex/heal/_restore-fixture.ts +163 -0
  105. package/src/vector-cortex/heal/_vc6b-helpers.ts +55 -0
  106. package/src/vector-cortex/heal/closure-metrics.ts +73 -0
  107. package/src/vector-cortex/heal/closure-opt.ts +266 -0
  108. package/src/vector-cortex/heal/emit.ts +93 -0
  109. package/src/vector-cortex/heal/proof.ts +234 -0
  110. package/src/vector-cortex/heal/restore-emit.ts +94 -0
  111. package/src/vector-cortex/heal/restore-readers.ts +145 -0
  112. package/src/vector-cortex/heal/restore-types.ts +185 -0
  113. package/src/vector-cortex/heal/restore.ts +165 -0
  114. package/src/vector-cortex/heal/types.ts +248 -0
  115. package/src/vector-cortex/heal/verify.ts +93 -0
  116. package/extensions/dashboard-client/dist/assets/VectorCortexTab-eHVt9yDx.js +0 -2
  117. package/extensions/dashboard-client/dist/assets/VectorCortexTab-eHVt9yDx.js.map +0 -1
@@ -0,0 +1,42 @@
1
+ import type React from "react";
2
+ import type { VectorCortexRestoreView } from "../api/vector-cortex";
3
+ import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card";
4
+ import { Badge } from "../components/ui/badge";
5
+ import { Metric } from "./VectorCortexMetric";
6
+
7
+ export function VectorCortexRestoreCard({ view }: { view: VectorCortexRestoreView | null }): React.ReactElement {
8
+ return (
9
+ <Card>
10
+ <CardHeader>
11
+ <div className="flex items-center justify-between">
12
+ <CardTitle>Exact Source Restoration (VC6B)</CardTitle>
13
+ {view?.enabled ? (
14
+ <Badge variant="success">ACTIVE</Badge>
15
+ ) : (
16
+ <Badge variant="danger">OFF</Badge>
17
+ )}
18
+ </div>
19
+ </CardHeader>
20
+ <CardContent>
21
+ {!view?.enabled ? (
22
+ <div className="vc-empty">Exact source restoration disabled (VC6B off) — no exact source is restored; omitted context is disclosed as loss (mode C).</div>
23
+ ) : (
24
+ <>
25
+ <div className="grid grid-cols-2 gap-4 md:grid-cols-4">
26
+ <Metric label="Mode" value={view.mode} />
27
+ <Metric label="Restore attempts" value={String(view.restoreAttempts)} />
28
+ <Metric label="Restored" value={String(view.restoredCount)} />
29
+ <Metric label="Missing source" value={String(view.missingCount)} />
30
+ <Metric label="Digest rejections" value={String(view.digestRejections)} />
31
+ <Metric label="Last rejection" value={view.lastRejection ?? "none"} />
32
+ <Metric label="Updated" value={view.updatedAt} />
33
+ </div>
34
+ <div className="mt-3 text-xs text-muted-foreground">
35
+ 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).
36
+ </div>
37
+ </>
38
+ )}
39
+ </CardContent>
40
+ </Card>
41
+ );
42
+ }
@@ -17,6 +17,8 @@ import {
17
17
  fetchVectorCortexPlans,
18
18
  fetchVectorCortexRender,
19
19
  fetchVectorCortexRollout,
20
+ fetchVectorCortexClosureProof,
21
+ fetchVectorCortexRestore,
20
22
  fetchVectorCortexShards,
21
23
  fetchVectorCortexTopology,
22
24
  resetVectorCortexBreaker,
@@ -28,6 +30,8 @@ import {
28
30
  type VectorCortexPlansView,
29
31
  type VectorCortexRenderView,
30
32
  type VectorCortexRolloutView,
33
+ type VectorCortexClosureProofView,
34
+ type VectorCortexRestoreView,
31
35
  type VectorCortexShardsView,
32
36
  type VectorCortexTopologyView,
33
37
  } from "../api/vector-cortex";
@@ -36,7 +40,11 @@ import { Badge } from "../components/ui/badge";
36
40
  import { Metric } from "./VectorCortexMetric";
37
41
  import { VectorCortexRenderCard } from "./VectorCortexRenderCard";
38
42
  import { VectorCortexRolloutCard } from "./VectorCortexRolloutCard";
43
+ import { VectorCortexClosureCard } from "./VectorCortexClosureCard";
44
+ import { VectorCortexRestoreCard } from "./VectorCortexRestoreCard";
39
45
  import { VectorCortexPlansCard } from "./VectorCortexPlansCard";
46
+ import { VectorCortexTopologyCard } from "./VectorCortexTopologyCard";
47
+ import { VectorCortexLedgerCard } from "./VectorCortexLedgerCard";
40
48
 
41
49
  function ModeChip({ mode, count }: { mode: string; count: number }): React.ReactElement {
42
50
  return (
@@ -61,6 +69,8 @@ export default function VectorCortexTab(): React.ReactElement {
61
69
  const [plans, setPlans] = useState<VectorCortexPlansView | null>(null);
62
70
  const [render, setRender] = useState<VectorCortexRenderView | null>(null);
63
71
  const [rollout, setRollout] = useState<VectorCortexRolloutView | null>(null);
72
+ const [closureProof, setClosureProof] = useState<VectorCortexClosureProofView | null>(null);
73
+ const [restore, setRestore] = useState<VectorCortexRestoreView | null>(null);
64
74
 
65
75
  const poll = useCallback(() => {
66
76
  fetchVectorCortexEvaluation()
@@ -96,6 +106,12 @@ export default function VectorCortexTab(): React.ReactElement {
96
106
  fetchVectorCortexRollout().then(setRollout).catch(() => {
97
107
  /* rollout card is best-effort (VC5C) */
98
108
  });
109
+ fetchVectorCortexClosureProof().then(setClosureProof).catch(() => {
110
+ /* closure-optimization card is best-effort (VC6A) */
111
+ });
112
+ fetchVectorCortexRestore().then(setRestore).catch(() => {
113
+ /* exact-source-restoration card is best-effort (VC6B) */
114
+ });
99
115
  }, []);
100
116
 
101
117
  useEffect(() => {
@@ -246,110 +262,7 @@ export default function VectorCortexTab(): React.ReactElement {
246
262
  )}
247
263
  </CardContent>
248
264
  </Card>
249
- <Card>
250
- <CardHeader>
251
- <div className="flex items-center justify-between">
252
- <CardTitle>Derived Cortex Store (VC3A)</CardTitle>
253
- {topology?.enabled ? (
254
- <Badge variant="success">ACTIVE</Badge>
255
- ) : (
256
- <Badge variant="danger">OFF</Badge>
257
- )}
258
- </div>
259
- </CardHeader>
260
- <CardContent>
261
- {!topology?.enabled ? (
262
- <div className="vc-empty">Cortex store disabled (VC3A off).</div>
263
- ) : (
264
- <>
265
- <div className="grid grid-cols-2 gap-4 md:grid-cols-3">
266
- <Metric label="Generation" value={topology.generationId ?? "—"} />
267
- <Metric label="Ordinal" value={topology.ordinal ?? "—"} />
268
- <Metric label="Records" value={String(topology.recordCount)} />
269
- <Metric label="Frontier (HW)" value={topology.sourceHighWater} />
270
- <Metric
271
- label="Root digest"
272
- value={topology.rootDigest ? topology.rootDigest.slice(0, 16) : "—"}
273
- />
274
- {topology.nodes !== undefined && (
275
- <>
276
- <Metric
277
- label="Nodes"
278
- value={String(topology.nodes?.length ?? 0)}
279
- />
280
- <Metric
281
- label="Edges"
282
- value={String(topology.edges?.length ?? 0)}
283
- />
284
- <Metric
285
- label="Graph digest"
286
- value={
287
- topology.generationDigest
288
- ? topology.generationDigest.slice(0, 16)
289
- : "—"
290
- }
291
- />
292
- </>
293
- )}
294
- </div>
295
- {topology.nodes !== undefined &&
296
- (topology.edges?.length ?? 0) > 0 && (
297
- <div className="mt-4 max-h-56 overflow-y-auto">
298
- <div className="mb-1 text-xs font-medium text-muted-foreground">
299
- Topology edges (VC3B)
300
- </div>
301
- <table className="w-full text-left text-xs">
302
- <thead>
303
- <tr className="border-b border-border/50 text-muted-foreground">
304
- <th className="py-1 pr-2">source</th>
305
- <th className="py-1 pr-2">target</th>
306
- <th className="py-1 pr-2">head</th>
307
- <th className="py-1 pr-2">dir</th>
308
- <th className="py-1">score</th>
309
- </tr>
310
- </thead>
311
- <tbody>
312
- {topology.edges?.map((e, i) => (
313
- <tr
314
- key={`${e.source}-${e.target}-${e.head}-${i}`}
315
- className="border-b border-border/30"
316
- >
317
- <td className="py-1 pr-2 font-mono">{e.source}</td>
318
- <td className="py-1 pr-2 font-mono">{e.target}</td>
319
- <td className="py-1 pr-2 font-mono">{e.head}</td>
320
- <td className="py-1 pr-2">{e.direction}</td>
321
- <td className="py-1 font-mono">{e.score}</td>
322
- </tr>
323
- ))}
324
- </tbody>
325
- </table>
326
- </div>
327
- )}
328
- </>
329
- )}
330
- </CardContent>
331
- </Card>
332
- <Card>
333
- <CardHeader>
334
- <div className="flex items-center justify-between">
335
- <CardTitle>Topology Query Diagnostics (VC3C)</CardTitle>
336
- {query?.enabled ? (
337
- <Badge variant="success">ACTIVE</Badge>
338
- ) : (
339
- <Badge variant="danger">OFF</Badge>
340
- )}
341
- </div>
342
- </CardHeader>
343
- <CardContent>
344
- {!query?.enabled ? (
345
- <div className="vc-empty">Query diagnostics unavailable (VC3C off).</div>
346
- ) : (
347
- <div className="grid grid-cols-2 gap-4 md:grid-cols-3">
348
- <Metric label="Router version" value={String(query.routerVersion)} />
349
- </div>
350
- )}
351
- </CardContent>
352
- </Card>
265
+ <VectorCortexTopologyCard topology={topology} query={query} />
353
266
  <Card>
354
267
  <CardHeader>
355
268
  <div className="flex items-center justify-between">
@@ -413,66 +326,9 @@ export default function VectorCortexTab(): React.ReactElement {
413
326
  <VectorCortexPlansCard view={plans} />
414
327
  <VectorCortexRenderCard view={render} />
415
328
  <VectorCortexRolloutCard view={rollout} />
416
- <Card>
417
- <CardHeader>
418
- <div className="flex items-center justify-between">
419
- <CardTitle>Occurrence Ledger (VC1B)</CardTitle>
420
- {ledger?.enabled ? (
421
- <Badge variant="success">ACTIVE</Badge>
422
- ) : (
423
- <Badge variant="danger">OFF</Badge>
424
- )}
425
- </div>
426
- </CardHeader>
427
- <CardContent>
428
- {!ledger?.enabled ? (
429
- <div className="vc-empty">Ledger disabled (VC1B off).</div>
430
- ) : (
431
- <>
432
- <div className="mb-3 grid grid-cols-2 gap-4 md:grid-cols-3">
433
- <Metric label="Session" value={ledger.session} />
434
- <Metric label="High-water" value={ledger.highWater} />
435
- <Metric label="Occurrences" value={String(ledger.count)} />
436
- </div>
437
- {ledger.occurrences.length === 0 ? (
438
- <div className="vc-empty">No occurrences recorded.</div>
439
- ) : (
440
- <div className="max-h-64 overflow-y-auto">
441
- <table className="w-full text-left text-xs">
442
- <thead>
443
- <tr className="border-b border-border/50 text-muted-foreground">
444
- <th className="py-1 pr-2">seq</th>
445
- <th className="py-1 pr-2">eventId</th>
446
- <th className="py-1 pr-2">kind</th>
447
- <th className="py-1 pr-2">toolCall</th>
448
- <th className="py-1">digest</th>
449
- </tr>
450
- </thead>
451
- <tbody>
452
- {ledger.occurrences.map((o) => (
453
- <tr
454
- key={`${o.seq}-${o.eventId}`}
455
- className="border-b border-border/30"
456
- >
457
- <td className="py-1 pr-2 font-mono">{o.seq}</td>
458
- <td className="py-1 pr-2 font-mono">{o.eventId}</td>
459
- <td className="py-1 pr-2">{o.kind}</td>
460
- <td className="py-1 pr-2 font-mono">
461
- {o.toolCallId ?? "\u2014"}
462
- </td>
463
- <td className="max-w-[180px] truncate font-mono text-muted-foreground">
464
- {o.digest}
465
- </td>
466
- </tr>
467
- ))}
468
- </tbody>
469
- </table>
470
- </div>
471
- )}
472
- </>
473
- )}
474
- </CardContent>
475
- </Card>
329
+ <VectorCortexClosureCard view={closureProof} />
330
+ <VectorCortexRestoreCard view={restore} />
331
+ <VectorCortexLedgerCard ledger={ledger} />
476
332
  </div>
477
333
  );
478
334
  }
@@ -0,0 +1,131 @@
1
+ /**
2
+ * VectorCortexTopologyCard.tsx — VC3A/VC3B topology + VC3C query diagnostics cards.
3
+ *
4
+ * Extracted from VectorCortexTab.tsx to keep the parent tab under the 400-line
5
+ * extension soft limit (delegate-shell + impl-card pattern).
6
+ */
7
+
8
+ import type {
9
+ VectorCortexTopologyView,
10
+ VectorCortexQueryView,
11
+ } from "../api/vector-cortex";
12
+ import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card";
13
+ import { Badge } from "../components/ui/badge";
14
+ import { Metric } from "./VectorCortexMetric";
15
+
16
+ export function VectorCortexTopologyCard({
17
+ topology,
18
+ query,
19
+ }: {
20
+ topology: VectorCortexTopologyView | null;
21
+ query: VectorCortexQueryView | null;
22
+ }): React.ReactElement {
23
+ return (
24
+ <>
25
+ <Card>
26
+ <CardHeader>
27
+ <div className="flex items-center justify-between">
28
+ <CardTitle>Derived Cortex Store (VC3A)</CardTitle>
29
+ {topology?.enabled ? (
30
+ <Badge variant="success">ACTIVE</Badge>
31
+ ) : (
32
+ <Badge variant="danger">OFF</Badge>
33
+ )}
34
+ </div>
35
+ </CardHeader>
36
+ <CardContent>
37
+ {!topology?.enabled ? (
38
+ <div className="vc-empty">Cortex store disabled (VC3A off).</div>
39
+ ) : (
40
+ <>
41
+ <div className="grid grid-cols-2 gap-4 md:grid-cols-3">
42
+ <Metric label="Generation" value={topology.generationId ?? "—"} />
43
+ <Metric label="Ordinal" value={topology.ordinal ?? "—"} />
44
+ <Metric label="Records" value={String(topology.recordCount)} />
45
+ <Metric label="Frontier (HW)" value={topology.sourceHighWater} />
46
+ <Metric
47
+ label="Root digest"
48
+ value={topology.rootDigest ? topology.rootDigest.slice(0, 16) : "—"}
49
+ />
50
+ {topology.nodes !== undefined && (
51
+ <>
52
+ <Metric
53
+ label="Nodes"
54
+ value={String(topology.nodes?.length ?? 0)}
55
+ />
56
+ <Metric
57
+ label="Edges"
58
+ value={String(topology.edges?.length ?? 0)}
59
+ />
60
+ <Metric
61
+ label="Graph digest"
62
+ value={
63
+ topology.generationDigest
64
+ ? topology.generationDigest.slice(0, 16)
65
+ : "—"
66
+ }
67
+ />
68
+ </>
69
+ )}
70
+ </div>
71
+ {topology.nodes !== undefined &&
72
+ (topology.edges?.length ?? 0) > 0 && (
73
+ <div className="mt-4 max-h-56 overflow-y-auto">
74
+ <div className="mb-1 text-xs font-medium text-muted-foreground">
75
+ Topology edges (VC3B)
76
+ </div>
77
+ <table className="w-full text-left text-xs">
78
+ <thead>
79
+ <tr className="border-b border-border/50 text-muted-foreground">
80
+ <th className="py-1 pr-2">source</th>
81
+ <th className="py-1 pr-2">target</th>
82
+ <th className="py-1 pr-2">head</th>
83
+ <th className="py-1 pr-2">dir</th>
84
+ <th className="py-1">score</th>
85
+ </tr>
86
+ </thead>
87
+ <tbody>
88
+ {topology.edges?.map((e, i) => (
89
+ <tr
90
+ key={`${e.source}-${e.target}-${e.head}-${i}`}
91
+ className="border-b border-border/30"
92
+ >
93
+ <td className="py-1 pr-2 font-mono">{e.source}</td>
94
+ <td className="py-1 pr-2 font-mono">{e.target}</td>
95
+ <td className="py-1 pr-2 font-mono">{e.head}</td>
96
+ <td className="py-1 pr-2">{e.direction}</td>
97
+ <td className="py-1 font-mono">{e.score}</td>
98
+ </tr>
99
+ ))}
100
+ </tbody>
101
+ </table>
102
+ </div>
103
+ )}
104
+ </>
105
+ )}
106
+ </CardContent>
107
+ </Card>
108
+ <Card>
109
+ <CardHeader>
110
+ <div className="flex items-center justify-between">
111
+ <CardTitle>Topology Query Diagnostics (VC3C)</CardTitle>
112
+ {query?.enabled ? (
113
+ <Badge variant="success">ACTIVE</Badge>
114
+ ) : (
115
+ <Badge variant="danger">OFF</Badge>
116
+ )}
117
+ </div>
118
+ </CardHeader>
119
+ <CardContent>
120
+ {!query?.enabled ? (
121
+ <div className="vc-empty">Query diagnostics unavailable (VC3C off).</div>
122
+ ) : (
123
+ <div className="grid grid-cols-2 gap-4 md:grid-cols-3">
124
+ <Metric label="Router version" value={String(query.routerVersion)} />
125
+ </div>
126
+ )}
127
+ </CardContent>
128
+ </Card>
129
+ </>
130
+ );
131
+ }
@@ -208,3 +208,33 @@ export interface VectorCortexRolloutView {
208
208
  promotionBlocked: boolean;
209
209
  updatedAt: string;
210
210
  }
211
+
212
+ /**
213
+ * Reader-only exact-source-restoration view (VC6B). Counts + HEAL_RESTORE_*
214
+ * codes only — there is no payload endpoint, so no restored bytes, span ids,
215
+ * node ids, or ledger text ever reach the client.
216
+ */
217
+ export interface VectorCortexRestoreView {
218
+ enabled: boolean;
219
+ mode: "A" | "B" | "C";
220
+ restoreAttempts: number;
221
+ restoredCount: number;
222
+ missingCount: number;
223
+ digestRejections: number;
224
+ lastRejection: string | null;
225
+ updatedAt: string;
226
+ }
227
+
228
+ /** Reader-only closure-optimization diagnostics view (VC6A). Aggregate only. */
229
+ export interface VectorCortexClosureProofView {
230
+ enabled: boolean;
231
+ mode: "A" | "B" | "C";
232
+ optimizations: number;
233
+ proofRejections: number;
234
+ retainedEdgeTotal: number;
235
+ removedEdgeTotal: number;
236
+ conservativeTraversalTotal: number;
237
+ optimizedTraversalTotal: number;
238
+ lastRejection: string | null;
239
+ updatedAt: string;
240
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * api-contracts/vector-cortex-heal.ts — VC6A+ heal API contracts.
3
+ *
4
+ * Extracted from vector-cortex.ts to keep both files under the 400-line
5
+ * extension soft limit. Owns the reader-only closure-optimization and
6
+ * restoration diagnostic views emitted by the heal sprint handlers.
7
+ *
8
+ * PREVENT-PI-004: type definitions only, no network code.
9
+ * PREVENT-011: no `any` type.
10
+ */
11
+
12
+ /**
13
+ * Reader-only closure-optimization diagnostics view for
14
+ * GET /api/vector-cortex/closure-proof (VC6A).
15
+ *
16
+ * AGGREGATE + IDENTITY ONLY: counts and the runtime mode. It deliberately does
17
+ * NOT carry the per-edge proof rows, node ids, the closed selection, or any
18
+ * source payload (SECURITY_PRIVACY — reader-only, no ledger text rendered through
19
+ * a diagnostic surface). The detailed proof lives in the structured event log,
20
+ * not the dashboard.
21
+ */
22
+ export interface VectorCortexClosureProofView {
23
+ /** Whether the VC6A advanced-closure-optimization flag is enabled. */
24
+ readonly enabled: boolean;
25
+ /** Runtime triad mode of the most recent closure: "A" | "B" | "C". */
26
+ readonly mode: "A" | "B" | "C";
27
+ /** Total optimizations produced (event counter). */
28
+ readonly optimizations: number;
29
+ /** Total proofs rejected by the verifier (event counter). */
30
+ readonly proofRejections: number;
31
+ /** Cumulative retained edges across observed optimizations. */
32
+ readonly retainedEdgeTotal: number;
33
+ /** Cumulative removed edges across observed optimizations. */
34
+ readonly removedEdgeTotal: number;
35
+ /** Cumulative conservative traversal-walk count. */
36
+ readonly conservativeTraversalTotal: number;
37
+ /** Cumulative optimized traversal-walk count. */
38
+ readonly optimizedTraversalTotal: number;
39
+ /** Last rejection reason (a HEAL_* code), or null if none yet. */
40
+ readonly lastRejection: string | null;
41
+ /** ISO timestamp of the snapshot. */
42
+ readonly updatedAt: string;
43
+ }
44
+
45
+ /**
46
+ * Reader-only exact-source-restoration diagnostics view for
47
+ * GET /api/vector-cortex/restore (VC6B).
48
+ *
49
+ * COUNTS + ERROR CODES ONLY. There is NO payload endpoint for restoration, ever:
50
+ * this view deliberately carries no restored bytes, span ids, node ids, byte
51
+ * ranges, shard identifiers, or ledger text (SECURITY_PRIVACY — the exact ledger
52
+ * is never rendered through a diagnostic surface). Only the restore counters and
53
+ * the last HEAL_RESTORE_* failure code are exposed; the per-span detail lives in
54
+ * the structured event log, not the dashboard.
55
+ */
56
+ export interface VectorCortexRestoreView {
57
+ /** Whether the VC6B exact-source-restoration flag is enabled. */
58
+ readonly enabled: boolean;
59
+ /** Runtime triad mode: "A" exact shard, "B" ledger range scan, "C" loss disclosed. */
60
+ readonly mode: "A" | "B" | "C";
61
+ /** Total restore attempts observed (event counter). */
62
+ readonly restoreAttempts: number;
63
+ /** Spans restored with a verified SHA-256 digest (event counter). */
64
+ readonly restoredCount: number;
65
+ /** Spans with no exact source available (HEAL_RESTORE_SOURCE_MISSING). */
66
+ readonly missingCount: number;
67
+ /** Restores rejected by digest verification (HEAL_RESTORE_DIGEST_MISMATCH). */
68
+ readonly digestRejections: number;
69
+ /** Last rejection reason (a HEAL_RESTORE_* code), or null if none yet. */
70
+ readonly lastRejection: string | null;
71
+ /** ISO timestamp of the snapshot. */
72
+ readonly updatedAt: string;
73
+ }
@@ -373,3 +373,8 @@ export interface VectorCortexLedgerView {
373
373
  /** ISO timestamp of the snapshot. */
374
374
  readonly updatedAt: string;
375
375
  }
376
+
377
+ export type {
378
+ VectorCortexClosureProofView,
379
+ VectorCortexRestoreView,
380
+ } from "./vector-cortex-heal.js";
@@ -0,0 +1,114 @@
1
+ /**
2
+ * dashboard-server/route-dispatch.ts — extracted from server.ts.
3
+ *
4
+ * The dispatch chain: each handler returns true if it ended the response.
5
+ * Extracted to keep server.ts under the 400-line extension soft limit
6
+ * (delegate-shell pattern: server.ts calls this and handles the static fallback).
7
+ *
8
+ * PREVENT-PI-004: local filesystem read only, no network.
9
+ * PREVENT-011: no `any` type.
10
+ */
11
+
12
+ import type { IncomingMessage, ServerResponse } from "node:http";
13
+ import type { RouteContext } from "./routes-core.js";
14
+
15
+ import {
16
+ handleIndex,
17
+ handleRepoIndex,
18
+ handleEvents,
19
+ handleGameState,
20
+ handleGameScores,
21
+ handlePerfSamples,
22
+ handlePerf,
23
+ handleAchievements,
24
+ handleSessions,
25
+ handleTopics,
26
+ handleTurns,
27
+ handleMaintenance,
28
+ handleProviderCache,
29
+ handleMemoryStatus,
30
+ handleCacheStripes,
31
+ handleSetupStatus,
32
+ handleSetupDetect,
33
+ handleSetupConfigure,
34
+ handleMemoryMap,
35
+ handleRaptorTree,
36
+ handleRaptorBuildHistory,
37
+ handleContextHealth,
38
+ handleCachePoison,
39
+ handleHealthSettings,
40
+ handleEmbedderHealth,
41
+ handleRagSettings,
42
+ handleRagMetrics,
43
+ handleModelThresholds,
44
+ handleWiki,
45
+ handleVectorCortexEvaluation,
46
+ handleVectorCortexHealth,
47
+ handleVectorCortexBreakersReset,
48
+ handleVectorCortexLedger,
49
+ handleVectorCortexTopology,
50
+ handleVectorCortexQuery,
51
+ handleVectorCortexShards,
52
+ handleVectorCortexResidual,
53
+ handleVectorCortexReconstruct,
54
+ handleVectorCortexPlans,
55
+ handleVectorCortexRender,
56
+ handleVectorCortexRollout,
57
+ handleVectorCortexClosureProof,
58
+ handleVectorCortexRestore,
59
+ } from "./routes.js";
60
+
61
+ /**
62
+ * Dispatch a request through every registered route handler.
63
+ * Returns true if a handler claimed the request (ended the response).
64
+ */
65
+ export function dispatchRoutes(
66
+ req: IncomingMessage,
67
+ res: ServerResponse,
68
+ ctx: RouteContext,
69
+ ): boolean {
70
+ if (handleIndex(req, res, ctx)) return true;
71
+ if (handleRepoIndex(req, res, ctx)) return true;
72
+ if (handleEvents(req, res, ctx)) return true;
73
+ if (handleGameState(req, res, ctx)) return true;
74
+ if (handleGameScores(req, res, ctx)) return true;
75
+ if (handlePerfSamples(req, res, ctx)) return true;
76
+ if (handlePerf(req, res, ctx)) return true;
77
+ if (handleAchievements(req, res, ctx)) return true;
78
+ if (handleSessions(req, res, ctx)) return true;
79
+ if (handleTopics(req, res, ctx)) return true;
80
+ if (handleTurns(req, res, ctx)) return true;
81
+ if (handleMaintenance(req, res, ctx)) return true;
82
+ if (handleProviderCache(req, res, ctx)) return true;
83
+ if (handleMemoryStatus(req, res, ctx)) return true;
84
+ if (handleCacheStripes(req, res, ctx)) return true;
85
+ if (handleSetupStatus(req, res, ctx)) return true;
86
+ if (handleSetupDetect(req, res, ctx)) return true;
87
+ if (handleSetupConfigure(req, res, ctx)) return true;
88
+ if (handleMemoryMap(req, res, ctx)) return true;
89
+ if (handleRaptorTree(req, res, ctx)) return true;
90
+ if (handleRaptorBuildHistory(req, res, ctx)) return true;
91
+ if (handleContextHealth(req, res, ctx)) return true;
92
+ if (handleCachePoison(req, res, ctx)) return true;
93
+ if (handleHealthSettings(req, res, ctx)) return true;
94
+ if (handleEmbedderHealth(req, res, ctx)) return true;
95
+ if (handleRagSettings(req, res, ctx)) return true;
96
+ if (handleRagMetrics(req, res, ctx)) return true;
97
+ if (handleModelThresholds(req, res, ctx)) return true;
98
+ if (handleWiki(req, res, ctx)) return true;
99
+ if (handleVectorCortexEvaluation(req, res, ctx)) return true;
100
+ if (handleVectorCortexHealth(req, res, ctx)) return true;
101
+ if (handleVectorCortexBreakersReset(req, res, ctx)) return true;
102
+ if (handleVectorCortexLedger(req, res, ctx)) return true;
103
+ if (handleVectorCortexTopology(req, res, ctx)) return true;
104
+ if (handleVectorCortexQuery(req, res, ctx)) return true;
105
+ if (handleVectorCortexShards(req, res, ctx)) return true;
106
+ if (handleVectorCortexResidual(req, res, ctx)) return true;
107
+ if (handleVectorCortexReconstruct(req, res, ctx)) return true;
108
+ if (handleVectorCortexPlans(req, res, ctx)) return true;
109
+ if (handleVectorCortexRender(req, res, ctx)) return true;
110
+ if (handleVectorCortexRollout(req, res, ctx)) return true;
111
+ if (handleVectorCortexClosureProof(req, res, ctx)) return true;
112
+ if (handleVectorCortexRestore(req, res, ctx)) return true;
113
+ return false;
114
+ }
@@ -138,5 +138,17 @@ export const VECTOR_CORTEX_SETTINGS: SettingGroup = {
138
138
  "Live graduated rollout: deterministically hashes each session into a stable 10,000-bucket cohort and advances the exposure gate (1/5/25/50/100%) only after a 72h monotonic residency, a powered sample, >=10,000 events, and >=200 sessions — advancing ONE gate at a time. A hard causal/tool/anchor/exact failure freezes promotion and selects the pre-VC path. OFF = byte-identical predecessor (VC5B).",
139
139
  true,
140
140
  ),
141
+ boolDirect(
142
+ "MEGACOMPACT_VC6A",
143
+ "VC6A Advanced Closure Optimization",
144
+ "Advanced closure optimization: deterministically reduces the already-mandatory VC4C closure by transitive reduction over depends edges, emitting a ClosureProofV2 receipt per closure and a verifier that replays reductions against the conservative oracle (HEAL_PROOF_SET_MISMATCH on selected-set divergence). Protected edges (tool-pair / anchor / contradiction / sole-dependency) are never removed. The optimized selected set is byte-identical to the conservative closure. OFF = byte-identical predecessor (VC5C); arithmetic runs, only the reporter + dashboard seam is suppressed.",
145
+ true,
146
+ ),
147
+ boolDirect(
148
+ "MEGACOMPACT_VC6B",
149
+ "VC6B Exact Source Restoration",
150
+ "Exact source restoration: restores the original bytes of closure spans ONLY from an exact shard (mode A) or a verified ledger range scan (mode B) — never inferred, reconstructed, or paraphrased from embeddings or semantic text. Requests are hard-bounded at 64 spans / 4MiB (HEAL_RESTORE_LIMIT); every span's SHA-256 is recomputed and bytes are inserted only after all requested span metadata validates, so a single bad span fails the whole request closed (HEAL_RESTORE_DIGEST_MISMATCH, HEAL_RESTORE_RANGE_MISMATCH). When no exact source exists (HEAL_RESTORE_SOURCE_MISSING) the old context is omitted and the loss is disclosed (mode C) rather than filled in. OFF = byte-identical predecessor (VC6A).",
151
+ true,
152
+ ),
141
153
  ],
142
154
  };