pi-mega-compact 0.20.69 → 0.20.71

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 (123) hide show
  1. package/dist/config/vector-cortex-enc2c.js +38 -0
  2. package/dist/config/vector-cortex.js +2 -0
  3. package/dist/config.js +1 -1
  4. package/dist/extensions/dashboard-server/api-contracts/setup-cortex-native-ort.js +22 -0
  5. package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +1 -0
  6. package/dist/extensions/dashboard-server/routes-setup-cortex-actions.js +17 -11
  7. package/dist/extensions/dashboard-server/routes-vector-cortex-crystals.js +45 -30
  8. package/dist/extensions/dashboard-server/routes-vector-cortex-diagnostics.js +50 -29
  9. package/dist/extensions/dashboard-server/routes-vector-cortex-economics.js +33 -20
  10. package/dist/extensions/dashboard-server/routes-vector-cortex-helpers.js +54 -0
  11. package/dist/extensions/dashboard-server/routes-vector-cortex-policy.js +33 -16
  12. package/dist/extensions/dashboard-server/setup-cortex-actions-native-ort.js +107 -0
  13. package/dist/extensions/dashboard-server/setup-cortex-actions.js +9 -2
  14. package/dist/src/config/vector-cortex-enc2c.js +38 -0
  15. package/dist/src/config/vector-cortex.js +2 -0
  16. package/dist/src/config.js +1 -1
  17. package/dist/src/vector-cortex/cache/store.js +25 -2
  18. package/dist/src/vector-cortex/encoder/asset.js +34 -2
  19. package/dist/src/vector-cortex/encoder/router.js +31 -3
  20. package/dist/src/vector-cortex/livewire/livewire-live.js +163 -0
  21. package/dist/src/vector-cortex/livewire/livewire-registry.js +73 -0
  22. package/dist/src/vector-cortex/livewire/livewire-runtime.js +107 -0
  23. package/dist/src/vector-cortex/livewire/livewire-snapshot.js +101 -0
  24. package/dist/src/vector-cortex/livewire/livewire-types.js +19 -0
  25. package/dist/src/vector-cortex/provider/registry.js +44 -12
  26. package/dist/src/vector-cortex/setup-cortex-blockers-compute.js +3 -0
  27. package/dist/vector-cortex/cache/store.js +25 -2
  28. package/dist/vector-cortex/encoder/asset.js +34 -2
  29. package/dist/vector-cortex/encoder/router.js +31 -3
  30. package/dist/vector-cortex/provider/registry.js +44 -12
  31. package/dist/vector-cortex/setup-cortex-blockers-compute.js +3 -0
  32. package/extensions/dashboard-client/dist/assets/{AdminTab-BUl1fyQ-.js → AdminTab-ZyVtgYrZ.js} +2 -2
  33. package/extensions/dashboard-client/dist/assets/{AdminTab-BUl1fyQ-.js.map → AdminTab-ZyVtgYrZ.js.map} +1 -1
  34. package/extensions/dashboard-client/dist/assets/{AreaChart-CumzbAON.js → AreaChart-7ms8Hk1m.js} +2 -2
  35. package/extensions/dashboard-client/dist/assets/{AreaChart-CumzbAON.js.map → AreaChart-7ms8Hk1m.js.map} +1 -1
  36. package/extensions/dashboard-client/dist/assets/{BarChart-MvUf2UYv.js → BarChart-DeTE0NXA.js} +2 -2
  37. package/extensions/dashboard-client/dist/assets/{BarChart-MvUf2UYv.js.map → BarChart-DeTE0NXA.js.map} +1 -1
  38. package/extensions/dashboard-client/dist/assets/{CacheTab-CqpJZ5Ok.js → CacheTab-CpIrpr_X.js} +2 -2
  39. package/extensions/dashboard-client/dist/assets/{CacheTab-CqpJZ5Ok.js.map → CacheTab-CpIrpr_X.js.map} +1 -1
  40. package/extensions/dashboard-client/dist/assets/{ConfigTab-Cr0pKYGK.js → ConfigTab-BNMrO7uz.js} +2 -2
  41. package/extensions/dashboard-client/dist/assets/{ConfigTab-Cr0pKYGK.js.map → ConfigTab-BNMrO7uz.js.map} +1 -1
  42. package/extensions/dashboard-client/dist/assets/{EventsTab-FTQ4nJae.js → EventsTab-j42vDTjs.js} +2 -2
  43. package/extensions/dashboard-client/dist/assets/{EventsTab-FTQ4nJae.js.map → EventsTab-j42vDTjs.js.map} +1 -1
  44. package/extensions/dashboard-client/dist/assets/{HealthTab-D7s5lCB0.js → HealthTab-D0Tf8XM_.js} +2 -2
  45. package/extensions/dashboard-client/dist/assets/{HealthTab-D7s5lCB0.js.map → HealthTab-D0Tf8XM_.js.map} +1 -1
  46. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DW5c0ngt.js → MaintenanceTab-CleWX_RM.js} +2 -2
  47. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DW5c0ngt.js.map → MaintenanceTab-CleWX_RM.js.map} +1 -1
  48. package/extensions/dashboard-client/dist/assets/{MemoryMapTab-ocR07fD7.js → MemoryMapTab-LUpPJzNP.js} +2 -2
  49. package/extensions/dashboard-client/dist/assets/{MemoryMapTab-ocR07fD7.js.map → MemoryMapTab-LUpPJzNP.js.map} +1 -1
  50. package/extensions/dashboard-client/dist/assets/{MetricsCards-CNBlWLoU.js → MetricsCards-G4_uynTE.js} +2 -2
  51. package/extensions/dashboard-client/dist/assets/{MetricsCards-CNBlWLoU.js.map → MetricsCards-G4_uynTE.js.map} +1 -1
  52. package/extensions/dashboard-client/dist/assets/MetricsTab-yypKMQXf.js +2 -0
  53. package/extensions/dashboard-client/dist/assets/{MetricsTab-sks9wzZr.js.map → MetricsTab-yypKMQXf.js.map} +1 -1
  54. package/extensions/dashboard-client/dist/assets/{OverviewTab-Duu9zseZ.js → OverviewTab-M47NMRaT.js} +2 -2
  55. package/extensions/dashboard-client/dist/assets/{OverviewTab-Duu9zseZ.js.map → OverviewTab-M47NMRaT.js.map} +1 -1
  56. package/extensions/dashboard-client/dist/assets/{ReposTab-CMd5NYjk.js → ReposTab-BX3ZxrAI.js} +2 -2
  57. package/extensions/dashboard-client/dist/assets/{ReposTab-CMd5NYjk.js.map → ReposTab-BX3ZxrAI.js.map} +1 -1
  58. package/extensions/dashboard-client/dist/assets/{SessionsTab-Ht-k4LKk.js → SessionsTab-CSUmsNeZ.js} +2 -2
  59. package/extensions/dashboard-client/dist/assets/{SessionsTab-Ht-k4LKk.js.map → SessionsTab-CSUmsNeZ.js.map} +1 -1
  60. package/extensions/dashboard-client/dist/assets/{SetupTab-BCfBdL-1.js → SetupTab-jF9BsQjw.js} +3 -3
  61. package/extensions/dashboard-client/dist/assets/SetupTab-jF9BsQjw.js.map +1 -0
  62. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-B3CAK2FZ.js → TimeSavedCard-qfwO1WJ3.js} +2 -2
  63. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-B3CAK2FZ.js.map → TimeSavedCard-qfwO1WJ3.js.map} +1 -1
  64. package/extensions/dashboard-client/dist/assets/{TurnMemoryView-7SRtcvZF.js → TurnMemoryView-C7NQo_xi.js} +2 -2
  65. package/extensions/dashboard-client/dist/assets/{TurnMemoryView-7SRtcvZF.js.map → TurnMemoryView-C7NQo_xi.js.map} +1 -1
  66. package/extensions/dashboard-client/dist/assets/TurnsTab-D-19giqQ.js +2 -0
  67. package/extensions/dashboard-client/dist/assets/{TurnsTab-Djd-nzlT.js.map → TurnsTab-D-19giqQ.js.map} +1 -1
  68. package/extensions/dashboard-client/dist/assets/{VcStatusBadge-BzvdQnVq.js → VcStatusBadge-DTHlwuUJ.js} +2 -2
  69. package/extensions/dashboard-client/dist/assets/{VcStatusBadge-BzvdQnVq.js.map → VcStatusBadge-DTHlwuUJ.js.map} +1 -1
  70. package/extensions/dashboard-client/dist/assets/{VectorCortexTab-qmY0a0E-.js → VectorCortexTab-Dvgdcwvs.js} +2 -2
  71. package/extensions/dashboard-client/dist/assets/{VectorCortexTab-qmY0a0E-.js.map → VectorCortexTab-Dvgdcwvs.js.map} +1 -1
  72. package/extensions/dashboard-client/dist/assets/{WikiTab-DMmc36Xi.js → WikiTab-CYUEAQmZ.js} +2 -2
  73. package/extensions/dashboard-client/dist/assets/{WikiTab-DMmc36Xi.js.map → WikiTab-CYUEAQmZ.js.map} +1 -1
  74. package/extensions/dashboard-client/dist/assets/{button-DcRndiuf.js → button-DPOwTRN8.js} +2 -2
  75. package/extensions/dashboard-client/dist/assets/{button-DcRndiuf.js.map → button-DPOwTRN8.js.map} +1 -1
  76. package/extensions/dashboard-client/dist/assets/{card-CwWLYigw.js → card-CUipkgi9.js} +2 -2
  77. package/extensions/dashboard-client/dist/assets/{card-CwWLYigw.js.map → card-CUipkgi9.js.map} +1 -1
  78. package/extensions/dashboard-client/dist/assets/{client-extra-NQXJNKNj.js → client-extra-9lcKX-iO.js} +2 -2
  79. package/extensions/dashboard-client/dist/assets/{client-extra-NQXJNKNj.js.map → client-extra-9lcKX-iO.js.map} +1 -1
  80. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-BX9n_-am.js → generateCategoricalChart-_WpiJebf.js} +2 -2
  81. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-BX9n_-am.js.map → generateCategoricalChart-_WpiJebf.js.map} +1 -1
  82. package/extensions/dashboard-client/dist/assets/{index-DgKI8jwx.js → index-DlHJ7LBL.js} +3 -3
  83. package/extensions/dashboard-client/dist/assets/{index-DgKI8jwx.js.map → index-DlHJ7LBL.js.map} +1 -1
  84. package/extensions/dashboard-client/dist/assets/{switch-C_xzN77s.js → switch-Cx6-1wnT.js} +2 -2
  85. package/extensions/dashboard-client/dist/assets/{switch-C_xzN77s.js.map → switch-Cx6-1wnT.js.map} +1 -1
  86. package/extensions/dashboard-client/dist/assets/{toggle-807R1-Th.js → toggle-Y3vbE0NG.js} +2 -2
  87. package/extensions/dashboard-client/dist/assets/{toggle-807R1-Th.js.map → toggle-Y3vbE0NG.js.map} +1 -1
  88. package/extensions/dashboard-client/dist/assets/{useSSE-BNG39O7p.js → useSSE-CnJdk56R.js} +2 -2
  89. package/extensions/dashboard-client/dist/assets/{useSSE-BNG39O7p.js.map → useSSE-CnJdk56R.js.map} +1 -1
  90. package/extensions/dashboard-client/dist/index.html +1 -1
  91. package/extensions/dashboard-client/src/tabs/SetupTab/CortexActionsCard.tsx +89 -5
  92. package/extensions/dashboard-client/src/types/setup-cortex.ts +22 -1
  93. package/extensions/dashboard-server/api-contracts/setup-cortex-native-ort.ts +52 -0
  94. package/extensions/dashboard-server/api-contracts/setup-cortex.ts +8 -2
  95. package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +6 -0
  96. package/extensions/dashboard-server/routes-setup-cortex-actions.ts +22 -11
  97. package/extensions/dashboard-server/routes-vector-cortex-crystals.ts +46 -30
  98. package/extensions/dashboard-server/routes-vector-cortex-diagnostics.ts +52 -29
  99. package/extensions/dashboard-server/routes-vector-cortex-economics.ts +35 -20
  100. package/extensions/dashboard-server/routes-vector-cortex-helpers.ts +84 -0
  101. package/extensions/dashboard-server/routes-vector-cortex-policy.ts +35 -16
  102. package/extensions/dashboard-server/setup-cortex-actions-native-ort.ts +121 -0
  103. package/extensions/dashboard-server/setup-cortex-actions.ts +9 -3
  104. package/package.json +1 -1
  105. package/src/config/vector-cortex-enc2c.ts +40 -0
  106. package/src/config/vector-cortex.ts +2 -0
  107. package/src/config.ts +1 -0
  108. package/src/vector-cortex/cache/store.ts +26 -2
  109. package/src/vector-cortex/encoder/asset.ts +46 -3
  110. package/src/vector-cortex/encoder/router.ts +56 -2
  111. package/src/vector-cortex/encoder/types.ts +3 -0
  112. package/src/vector-cortex/livewire/livewire-live.ts +223 -0
  113. package/src/vector-cortex/livewire/livewire-registry.ts +91 -0
  114. package/src/vector-cortex/livewire/livewire-runtime.ts +117 -0
  115. package/src/vector-cortex/livewire/livewire-snapshot.ts +108 -0
  116. package/src/vector-cortex/livewire/livewire-types.ts +84 -0
  117. package/src/vector-cortex/provider/economics.ts +9 -31
  118. package/src/vector-cortex/provider/registry.ts +82 -11
  119. package/src/vector-cortex/provider/types.ts +37 -0
  120. package/src/vector-cortex/setup-cortex-blockers-compute.ts +8 -1
  121. package/extensions/dashboard-client/dist/assets/MetricsTab-sks9wzZr.js +0 -2
  122. package/extensions/dashboard-client/dist/assets/SetupTab-BCfBdL-1.js.map +0 -1
  123. package/extensions/dashboard-client/dist/assets/TurnsTab-Djd-nzlT.js +0 -2
@@ -0,0 +1,121 @@
1
+ /**
2
+ * dashboard-server/setup-cortex-actions-native-ort.ts — ENC-2c native onnxruntime
3
+ * lazy-download INSTALL action driver (actor surface for install-native-ort).
4
+ *
5
+ * Sibling of setup-cortex-actions.ts (which stays under the 300-line source soft
6
+ * cap). Implements the mechanics behind the VC9B `install-native-ort` action:
7
+ *
8
+ * 1. locate the committed scripts/encoder/install-native-ort.mjs by walking up
9
+ * to the repo root (mirroring setup-cortex-actions.ts vc2ScriptDir);
10
+ * 2. spawn `node <script>` locally with a 60s timeout (npm-delegated,
11
+ * sha256-verified install — the registry URL + sha256 live ONLY in
12
+ * src/vector-cortex/encoder/native-install-artifacts.ts, never here);
13
+ * 3. capture output to <stateDir>/logs/vc9b/install-native-ort-<ts>.log;
14
+ * 4. REGARDLESS of the install exit code, re-qualify the binding via the ENC-2b
15
+ * retest path (`runNativeRetest`) and surface the fresh result +
16
+ * effective backend.
17
+ *
18
+ * PREVENT-PI-004 banner: this is an OPT-IN, confirm-gated, npm-delegated local
19
+ * subprocess of a committed repo script. It performs no network I/O in this
20
+ * module and carries NO URL literals (the codebase-wide no-URL-literal scan
21
+ * covers src/ + extensions/).
22
+ *
23
+ * Guardrails: PREVENT-011 (no `any`); the subprocess is a committed local script,
24
+ * never fetched (PREVENT-PI-004, guardrails-allow below).
25
+ */
26
+
27
+ import { spawnSync } from "node:child_process"; // guardrails-allow PREVENT-PI-004: opt-in, confirm-gated, npm-delegated install subprocess (local spawn of committed repo script; no URL literals)
28
+ import { mkdirSync, writeFileSync, existsSync } from "node:fs";
29
+ import { join, dirname } from "node:path";
30
+ import { fileURLToPath } from "node:url";
31
+ import { runNativeRetest } from "../../src/vector-cortex/encoder/native-qualify-retest.js";
32
+ import type {
33
+ SetupCortexActionResultWithNativeOrt,
34
+ NativeOrtRetestResult,
35
+ } from "./api-contracts/setup-cortex-native-ort.js";
36
+
37
+ /** Locate scripts/encoder/install-native-ort.mjs by walking up to the repo root. */
38
+ export function installScriptPath(): string | null {
39
+ let dir = dirname(fileURLToPath(import.meta.url));
40
+ const rel = join("scripts", "encoder", "install-native-ort.mjs");
41
+ for (let i = 0; i < 8; i++) {
42
+ const candidate = join(dir, rel);
43
+ // guardrails-allow PREVENT-PI-004: local repo filesystem read (loopback)
44
+ if (existsSync(candidate)) return candidate;
45
+ const next = dirname(dir);
46
+ if (next === dir) break;
47
+ dir = next;
48
+ }
49
+ return null;
50
+ }
51
+
52
+ /** Ensure the vc9b log dir exists (mirrors setup-cortex-actions.ts). */
53
+ function ensureLogDir(stateDir: string): string {
54
+ const dir = join(stateDir, "logs", "vc9b");
55
+ // guardrails-allow PREVENT-PI-004: local state-dir filesystem write (loopback)
56
+ mkdirSync(dir, { recursive: true });
57
+ return dir;
58
+ }
59
+
60
+ function writeLog(logPath: string, body: string): void {
61
+ // guardrails-allow PREVENT-PI-004: local state-dir filesystem write (loopback)
62
+ writeFileSync(logPath, body, "utf8");
63
+ }
64
+
65
+ /**
66
+ * Run the ENC-2c lazy-download native onnxruntime INSTALL action. Locates and
67
+ * spawns the committed install script (npm-delegated, sha256-verified), logs the
68
+ * captured output, then ALWAYS runs the ENC-2b retest to re-qualify the binding
69
+ * (regardless of install exit code) and surfaces the fresh result.
70
+ *
71
+ * Never throws: a missing script or non-zero exit is surfaced as ok=false on the
72
+ * result; the retest runs even on install failure so the operator sees the
73
+ * post-install qualification state. Returns a combined SetupCortexActionResult
74
+ * with the ENC-2c additive fields (present only for pendant actions).
75
+ */
76
+ // guardrails-allow PREVENT-PI-004: opt-in, confirm-gated, npm-delegated install action (subprocess of committed repo script; no URL literals)
77
+ export async function runInstallNativeOrt(
78
+ stateDir: string,
79
+ ): Promise<SetupCortexActionResultWithNativeOrt> {
80
+ const ts = Date.now();
81
+ const logName = `install-native-ort-${ts}.log`;
82
+ const logPath = join(ensureLogDir(stateDir), logName);
83
+
84
+ const scriptPath = installScriptPath();
85
+ if (scriptPath === null) {
86
+ writeLog(logPath, "install-native-ort.mjs not found in this checkout\n");
87
+ return {
88
+ action: "install-native-ort",
89
+ ok: false,
90
+ exitCode: null,
91
+ logPath,
92
+ logName,
93
+ spawned: true,
94
+ };
95
+ }
96
+
97
+ // guardrails-allow PREVENT-PI-004: opt-in, confirm-gated, npm-delegated
98
+ // install subprocess (local spawn of committed repo script; no URL literals)
99
+ const result = spawnSync(process.execPath, [scriptPath], {
100
+ encoding: "utf8",
101
+ timeout: 60_000,
102
+ });
103
+
104
+ const out = `${result.stdout ?? ""}${result.stderr ?? ""}`;
105
+ writeLog(logPath, out || "(no output)\n");
106
+
107
+ // Re-qualify AFTER install regardless of exit code (the retest is the source of
108
+ // truth for whether the binding is actually usable).
109
+ const retest: NativeOrtRetestResult | null = await runNativeRetest(stateDir);
110
+
111
+ return {
112
+ action: "install-native-ort",
113
+ ok: result.status === 0,
114
+ exitCode: result.status === null ? null : result.status,
115
+ logPath,
116
+ logName,
117
+ spawned: true,
118
+ nativeOrtRetestResult: retest,
119
+ nativeOrtBackendEffective: retest !== null && retest.verdict === "qualified" ? "native" : "wasm",
120
+ };
121
+ }
@@ -6,7 +6,9 @@
6
6
  * vc2-model-prep scripts (fetch-model.sh, bench-onnx.mjs), capturing their
7
7
  * output to <stateDir>/logs/vc9b/<action>-<ts>.log, re-running the committed
8
8
  * encoder asset verification seam for verify-asset (NO subprocess), and serving
9
- * a bounded + redacted log tail.
9
+ * a bounded + redacted log tail. ENC-2c adds the `install-native-ort` action,
10
+ * delegated to the sibling setup-cortex-actions-native-ort.ts (the confirm-gated,
11
+ * npm-delegated local install + ENC-2b re-qualification).
10
12
  *
11
13
  * This module is the ONLY place that touches the filesystem for VC9B actions.
12
14
  * The route file (routes-setup-cortex-actions.ts) carries NO path/script/blocker
@@ -41,6 +43,7 @@ import {
41
43
  readQualificationRecord,
42
44
  encoderStateDir,
43
45
  } from "./qualification-record.js";
46
+ import { runInstallNativeOrt } from "./setup-cortex-actions-native-ort.js";
44
47
 
45
48
  /** Cap applied to every log tail served by the action-log route. */
46
49
  export const ACTION_LOG_TAIL_BYTES = 8192;
@@ -251,11 +254,14 @@ function writeLog(logPath: string, body: string): void {
251
254
  * result on success; throws nothing — every failure is surfaced as a result with
252
255
  * ok=false so the route can shape the HTTP response. Never touches the network;
253
256
  * the subprocesses it may spawn are the committed local vc2-model-prep scripts.
257
+ * Async (ENC-2c): install-native-ort runs the npm-delegated local install then
258
+ * re-qualifies via the ENC-2b retest path.
254
259
  */
255
- export function runSetupCortexAction(
260
+ export async function runSetupCortexAction(
256
261
  action: SetupCortexActionKind,
257
262
  stateDir: string,
258
- ): SetupCortexActionResult {
263
+ ): Promise<SetupCortexActionResult> {
259
264
  if (action === "verify-asset") return runVerifyAsset(stateDir);
265
+ if (action === "install-native-ort") return runInstallNativeOrt(stateDir);
260
266
  return runSpawnedAction(action, stateDir);
261
267
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-mega-compact",
3
- "version": "0.20.69",
3
+ "version": "0.20.71",
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",
@@ -0,0 +1,40 @@
1
+ /**
2
+ * config/vector-cortex-enc2c.ts — ENC-2c native onnxruntime lazy-download
3
+ * install-action flag (dashboard-triggered install).
4
+ *
5
+ * Sibling of vector-cortex-enc2a.ts / vector-cortex-enc2b.ts so vector-cortex.ts
6
+ * stays under the 300-line soft limit (soft-as-hard gate). vector-cortex.ts
7
+ * re-exports the flag below and root src/config.ts re-exports it, so no consumer
8
+ * import path changes.
9
+ *
10
+ * ENC-2c turns ENC-2a's operator run-script assist into a dashboard action: the
11
+ * Setup Cortex sub-tab gains an "Install Native ORT" button that, when confirmed
12
+ * by the operator, runs the committed `scripts/encoder/install-native-ort.mjs`
13
+ * subprocess locally (npm-delegated, sha256-verified) and then re-qualifies the
14
+ * binding via the ENC-2b retest path. This is a PREVENT-PI-004 opt-in exemption:
15
+ * it is confirm-gated (never automatic), delegated to a local subprocess of a
16
+ * committed repo script, and carries NO URL literals in src/ or extensions/
17
+ * (the registry URL + sha256 live only in the artifacts-module constants).
18
+ *
19
+ * `MEGACOMPACT_ENC_2C=0` disables: no install action branch, no UI button, no
20
+ * install-related result fields — byte-identical to the ENC-2b predecessor. The
21
+ * flag MUST also be a dashboard SETTINGS toggle (visible in config UI, never in
22
+ * EXCLUDED_SETTINGS — see `feedback_dashboard-flags-toggleable` memory).
23
+ *
24
+ * Pi-agnostic, dependency-free (PREVENT-PI-004 / PREVENT-011).
25
+ *
26
+ * guardrails-allow PREVENT-PI-004: opt-in confirm-gated install action;
27
+ * delegates to local npm install subprocess, no URL literals (registry URL +
28
+ * sha256 live only in native-install-artifacts.ts)
29
+ */
30
+
31
+ import { sprintFlag } from "./vector-cortex-flag.js";
32
+
33
+ /**
34
+ * ENC-2c — lazy-download native onnxruntime install action (dashboard-triggered,
35
+ * npm-delegated, confirm-gated). Default ON. `MEGACOMPACT_ENC_2C=0` disables and
36
+ * is byte-identical to the ENC-2b predecessor: no install action POST branch, no
37
+ * UI button, no install result fields. This flag MUST also be a dashboard SETTINGS
38
+ * toggle (visible in config UI, never in EXCLUDED_SETTINGS).
39
+ */
40
+ export const ENC_2C_ENABLED = (): boolean => sprintFlag("MEGACOMPACT_ENC_2C");
@@ -96,6 +96,8 @@ export {
96
96
  export { ENC_2A_ENABLED } from "./vector-cortex-enc2a.js";
97
97
  // ENC-2b native onnxruntime qualification-retest flag extracted to vector-cortex-enc2b.ts.
98
98
  export { ENC_2B_ENABLED } from "./vector-cortex-enc2b.js";
99
+ // ENC-2c native onnxruntime lazy-download install-action flag extracted to vector-cortex-enc2c.ts.
100
+ export { ENC_2C_ENABLED } from "./vector-cortex-enc2c.js";
99
101
  // Breaker constants (TRIAD_RESILIENCE.md §breaker) extracted to vector-cortex-breakers.ts.
100
102
  export {
101
103
  BREAKER_WINDOW_MS,
package/src/config.ts CHANGED
@@ -204,6 +204,7 @@ export {
204
204
  ENC_2BUDGET_DEFAULT_MIB,
205
205
  ENC_2A_ENABLED,
206
206
  ENC_2B_ENABLED,
207
+ ENC_2C_ENABLED,
207
208
  COSINE_FP_BENCH_ENABLED,
208
209
  COSINE_FP_REAL_ENABLED,
209
210
  REPO_CORPUS_ENABLED,
@@ -78,6 +78,11 @@ export class CrystalStore {
78
78
  private writes = 0;
79
79
  private duplicateWrites = 0;
80
80
  private collisions = 0;
81
+ /** Restart-survival crystal count/bytes (LIVEWIRE rehydrate). The `committed`
82
+ * map is empty in a fresh process; these offsets carry the persisted totals
83
+ * so the dashboard does not reset to zero on restart. */
84
+ private rehydratedCrystalCount = 0;
85
+ private rehydratedTotalBytes = 0;
81
86
 
82
87
  /** Freeze a crystal object for a key/bytes pair (digest computed here). */
83
88
  static freeze(keyDigest: string, bytes: Uint8Array, key: CrystalV1["key"]): CrystalV1 {
@@ -196,11 +201,11 @@ export class CrystalStore {
196
201
 
197
202
  /** Reader-only aggregate for the dashboard seam — counts and bytes only. */
198
203
  stats(): CrystalStoreStats {
199
- let totalBytes = 0;
204
+ let totalBytes = this.rehydratedTotalBytes;
200
205
  for (const c of this.committed.values()) totalBytes += c.byteCount;
201
206
  return {
202
207
  mode: this.mode(),
203
- crystalCount: this.committed.size,
208
+ crystalCount: this.rehydratedCrystalCount + this.committed.size,
204
209
  totalBytes,
205
210
  hits: this.hits,
206
211
  misses: this.misses,
@@ -210,4 +215,23 @@ export class CrystalStore {
210
215
  collisions: this.collisions,
211
216
  };
212
217
  }
218
+
219
+ /**
220
+ * Restart survival: seed the CUMULATIVE counters from a previously-persisted
221
+ * aggregate (LIVEWIRE). The in-memory `committed` map is naturally empty in a
222
+ * fresh process — this only restores the running totals the dashboard reports,
223
+ * so a process restart does not reset the dashboard to zero. It deliberately
224
+ * does NOT reconstruct crystals: frozen bytes are never persisted to the
225
+ * reader aggregate, only the counts.
226
+ */
227
+ rehydrate(stats: CrystalStoreStats): void {
228
+ this.rehydratedCrystalCount = stats.crystalCount;
229
+ this.rehydratedTotalBytes = stats.totalBytes;
230
+ this.hits = stats.hits;
231
+ this.misses = stats.misses;
232
+ this.hitBytes = stats.hitBytes;
233
+ this.writes = stats.writes;
234
+ this.duplicateWrites = stats.duplicateWrites;
235
+ this.collisions = stats.collisions;
236
+ }
213
237
  }
@@ -26,7 +26,19 @@ import {
26
26
  } from "./types.js";
27
27
 
28
28
  export type AssetVerifyResult =
29
- | { ok: true; embeddedBytes: number; maxTokens: number; onnxDigest: string; tokenizerDigest: string }
29
+ | {
30
+ ok: true;
31
+ embeddedBytes: number;
32
+ maxTokens: number;
33
+ onnxDigest: string;
34
+ tokenizerDigest: string;
35
+ /**
36
+ * ML5-A (VC2B-2): digest of the manifest-pinned `trained-heads.json`
37
+ * sibling when the manifest declares `headWeights`; null when the
38
+ * manifest ships no head weights (the committed placeholder bundle).
39
+ */
40
+ headWeightsDigest: string | null;
41
+ }
30
42
  | { ok: false; code: string };
31
43
 
32
44
  /** True when `p` is a single basename: non-empty, no path separators, no "..",
@@ -80,7 +92,14 @@ function isManifest(m: unknown): m is ModelManifestV1 {
80
92
  typeof o.onnx.path === "string" &&
81
93
  typeof o.onnx.sha256 === "string" &&
82
94
  typeof o.tokenizer.path === "string" &&
83
- typeof o.tokenizer.sha256 === "string"
95
+ typeof o.tokenizer.sha256 === "string" &&
96
+ // ML5-A (VC2B-2): optional headWeights must, when present, be a valid
97
+ // ManifestAssetFile (path basename + sha256 + bytes).
98
+ (o.headWeights === undefined ||
99
+ (!!o.headWeights &&
100
+ typeof o.headWeights.path === "string" &&
101
+ typeof o.headWeights.sha256 === "string" &&
102
+ typeof o.headWeights.bytes === "number"))
84
103
  );
85
104
  }
86
105
 
@@ -122,6 +141,11 @@ export function verifyEncoderAsset(
122
141
  if (!isBasename(manifest.onnx.path) || !isBasename(manifest.tokenizer.path)) {
123
142
  return { ok: false, code: ENC_FAIL.MANIFEST_INVALID };
124
143
  }
144
+ // ML5-A (VC2B-2): a manifest-declared headWeights path must also be a bare
145
+ // basename (no traversal into arbitrary paths off the asset dir).
146
+ if (manifest.headWeights !== undefined && !isBasename(manifest.headWeights.path)) {
147
+ return { ok: false, code: ENC_FAIL.MANIFEST_INVALID };
148
+ }
125
149
 
126
150
  const onnxPath = join(assetDir, manifest.onnx.path);
127
151
  const onnxDigest = digestFile(onnxPath);
@@ -133,13 +157,32 @@ export function verifyEncoderAsset(
133
157
  if (tokDigest === null) return { ok: false, code: ENC_FAIL.ASSET_UNREADABLE };
134
158
  if (tokDigest !== manifest.tokenizer.sha256) return { ok: false, code: ENC_FAIL.DIGEST_MISMATCH };
135
159
 
160
+ // ML5-A (VC2B-2): verify the manifest-pinned trained-heads sibling when the
161
+ // manifest declares it. Absent declaration -> headWeightsDigest: null and no
162
+ // failure (committed placeholder bundle ships no trained weights).
163
+ let headWeightsDigest: string | null = null;
164
+ if (manifest.headWeights !== undefined) {
165
+ const hwPath = join(assetDir, manifest.headWeights.path);
166
+ const hwDigest = digestFile(hwPath);
167
+ if (hwDigest === null) return { ok: false, code: ENC_FAIL.ASSET_UNREADABLE };
168
+ if (hwDigest !== manifest.headWeights.sha256) return { ok: false, code: ENC_FAIL.DIGEST_MISMATCH };
169
+ headWeightsDigest = hwDigest;
170
+ }
171
+
136
172
  let embeddedBytes = 0;
137
173
  try {
138
174
  embeddedBytes = statSync(onnxPath).size + statSync(tokPath).size;
139
175
  } catch {
140
176
  return { ok: false, code: ENC_FAIL.ASSET_UNREADABLE };
141
177
  }
142
- return { ok: true, embeddedBytes, maxTokens: manifest.maxTokens, onnxDigest, tokenizerDigest: tokDigest };
178
+ return {
179
+ ok: true,
180
+ embeddedBytes,
181
+ maxTokens: manifest.maxTokens,
182
+ onnxDigest,
183
+ tokenizerDigest: tokDigest,
184
+ headWeightsDigest,
185
+ };
143
186
  }
144
187
 
145
188
  /**
@@ -26,15 +26,24 @@
26
26
  */
27
27
 
28
28
  import { createEncoderRuntime } from "./runtime.js";
29
- import { encodeVectorSet, type HeadProjectionOptions } from "./heads.js";
29
+ import {
30
+ encodeVectorSet,
31
+ loadHeadProjections,
32
+ projectHeadFromTrunk,
33
+ type HeadProjectionOptions,
34
+ type HeadProjectionTable,
35
+ } from "./heads.js";
30
36
  import { embedTrigram512, selectTrigramBFallback } from "./trigram.js";
31
37
  import { embedLexical, selectLexicalC } from "./lexical.js";
32
38
  import { createEncoderHeadsReporter, type EncoderHeadsReporter } from "./emit-vc2b.js";
39
+ import { ML5A_ENABLED } from "../../config/vector-cortex.js";
33
40
  import {
34
41
  ENC_FAIL,
42
+ ENCODER_HEAD_ORDER,
35
43
  type EncoderInput,
36
44
  type EncoderLoadResult,
37
45
  type EncoderRuntime,
46
+ type HeadVector,
38
47
  type VectorSetV1,
39
48
  } from "./types.js";
40
49
 
@@ -61,6 +70,15 @@ export interface RouterOptions extends HeadProjectionOptions {
61
70
  /** Forced fallback: skips the A load and selects the named VC2B fallback
62
71
  * (used to exercise C when A and B are both disabled). Optional. */
63
72
  readonly forceFallback?: "B" | "C";
73
+ /**
74
+ * ML5-A (VC2B-2): path to the `trained-heads-v1` artifact. When supplied AND
75
+ * the MEGACOMPACT_ML5_A gate is on AND the artifact loads (correct seed +
76
+ * shape), the mode-A VectorSet is produced by projecting the real trained head
77
+ * matrices over the trunk embedding (`projectHeadFromTrunk`). When absent /
78
+ * flag-off / unloadable, the mode-A producer falls back to the deterministic
79
+ * LCG placeholder `encodeVectorSet` (byte-identical predecessor).
80
+ */
81
+ readonly trainedHeadsPath?: string;
64
82
  }
65
83
 
66
84
  /** Deterministic text derived from an int token sequence so the asset-free
@@ -133,10 +151,46 @@ export function encodeOrFallback(
133
151
  if (!inferred.ok) {
134
152
  return fallbackFromLoad({ ok: false, mode: "B", code: inferred.code }, reporter, tokens);
135
153
  }
136
- const vectorSet = encodeVectorSet(tokens, { reporter, seed: options.seed });
154
+ const vectorSet = produceVectorSet(inferred.semantic, tokens, options, reporter);
137
155
  return { ok: true, mode: "A", vectorSet, code: null };
138
156
  }
139
157
 
158
+ /**
159
+ * Produce a mode-A `VectorSetV1` from the [1,384] trunk embedding (the
160
+ * `runtime.infer` result). VC2B-2 ML5-A: when real trained heads are loaded
161
+ * (`MEGACOMPACT_ML5_A` on + a `trainedHeadsPath` that loads), the multi-head
162
+ * output is projected through the real trained projection matrices via
163
+ * `projectHeadFromTrunk`. Otherwise (flag-off / absent / unloadable artifact)
164
+ * the deterministic LCG placeholder `encodeVectorSet` serves mode A —
165
+ * byte-identical to the VC2B predecessor. Non-fatal: an unloadable artifact
166
+ * degrades to the placeholder, never a throw.
167
+ */
168
+ function produceVectorSet(
169
+ trunkEmbedding: Float32Array,
170
+ tokens: readonly number[],
171
+ options: RouterOptions,
172
+ reporter: EncoderHeadsReporter,
173
+ ): VectorSetV1 {
174
+ const table: HeadProjectionTable | null =
175
+ ML5A_ENABLED() && options.trainedHeadsPath !== undefined
176
+ ? loadHeadProjections(options.trainedHeadsPath)
177
+ : null;
178
+ if (table !== null) {
179
+ const heads: HeadVector[] = ENCODER_HEAD_ORDER.map((h) =>
180
+ projectHeadFromTrunk(h, trunkEmbedding, table),
181
+ );
182
+ reporter.headsEmitted({
183
+ heads: heads.length,
184
+ dims: heads.map((h) => h.dim).join("/"),
185
+ normalized: true,
186
+ tokens: tokens.length,
187
+ });
188
+ return { schema: "vector-set-v1", inputTokens: [...tokens], heads, normalized: true };
189
+ }
190
+ // ML5-A placeholder fallback (byte-identical predecessor).
191
+ return encodeVectorSet(tokens, { reporter, seed: options.seed });
192
+ }
193
+
140
194
  /**
141
195
  * Catch a (real or forced) A load failure (ok === false only) and select the
142
196
  * B/C fallback that emits `vector_cortex_encoder_fallback_selected` from the
@@ -92,6 +92,9 @@ export interface ModelManifestV1 {
92
92
  readonly heads: EncoderHeads;
93
93
  readonly onnx: ManifestAssetFile;
94
94
  readonly tokenizer: ManifestAssetFile;
95
+ /** ML5-A (VC2B-2): optional sibling `trained-heads.json` (`trained-heads-v1`) shipping
96
+ * REAL trained head weights; absent in the placeholder bundle, non-fatal when missing. */
97
+ readonly headWeights?: ManifestAssetFile;
95
98
  readonly totalBytes: number;
96
99
  readonly trainingManifestDigest: string;
97
100
  }
@@ -0,0 +1,223 @@
1
+ /**
2
+ * vector-cortex/livewire/livewire-live.ts — LIVEWIRE in-process live state.
3
+ *
4
+ * Holds the LIVE subsystem objects for ONE stateDir: the VC7A `CrystalStore`,
5
+ * the VC7C cache breaker, the per-miss-class tallies, the VC8B shadow metrics,
6
+ * and the VC7B economics computed bit. This is the object the RUNTIME accumulates
7
+ * into (`recordMiss`, `recordServeBlocked`, `recordShadowRun`, ...) and that the
8
+ * reader-only dashboard routes snapshot out of. Kept separate from the registry
9
+ * (which owns the per-stateDir `Map` + persistence) so neither file crosses the
10
+ * 300-line soft-as-hard gate.
11
+ *
12
+ * AGGREGATE-FIRST, COUNTS ONLY. `snapshotOf` projects the live objects down to
13
+ * the SECURITY_PRIVACY-safe `LivewireSnapshot` (counts + codes + triad mode) that
14
+ * gets persisted and rendered. No session id, digest, range, profile id, bytes,
15
+ * or prompt text can pass through ANY of these fields.
16
+ *
17
+ * PREVENT-PI-004: no network. PREVENT-011: no `any`. Non-fatal: every derive is
18
+ * a pure read.
19
+ */
20
+
21
+ import { CrystalStore } from "../cache/store.js";
22
+ import { createCacheBreaker } from "../cache/breaker.js";
23
+ import type { MissClass } from "../cache/diagnostics-types.js";
24
+ import { validateProfileEconomics } from "../provider/economics.js";
25
+ import { BASE_PROVIDER_PROFILES } from "../provider/registry.js";
26
+ import type {
27
+ LivewireDiagnosticsAggregate,
28
+ LivewireEconomicsAggregate,
29
+ LivewirePolicyAggregate,
30
+ LivewireSnapshot,
31
+ } from "./livewire-types.js";
32
+
33
+ /** One VC7C miss classification tally (in-process, counts only). */
34
+ export interface LivewireDiagnosticsRecord {
35
+ readonly tallies: { [K in MissClass]: number };
36
+ serveBlocked: number;
37
+ /**
38
+ * Observable breaker state (CLOSED_A / OPEN_B / ... / MANUAL_HALT). Tracked as
39
+ * a field so it survives process restart: the runtime syncs it from the live
40
+ * breaker when persisting, and a reader process restores it from the snapshot
41
+ * (a fresh in-process breaker is always CLOSED_A, which would be misleading).
42
+ */
43
+ breakerState: string;
44
+ lastFailure: string | null;
45
+ }
46
+
47
+ /** One VC7B economics record (computed bit + profile tallies + last failure). */
48
+ export interface LivewireEconomicsRecord {
49
+ computed: boolean;
50
+ /** Provider profiles that declare cache economics (static from BASE_PROFILES). */
51
+ profileCount: number;
52
+ /** Exclusions that carry a proving fixture id (static from BASE_PROFILES). */
53
+ provenExclusions: number;
54
+ /** Exclusions rejected for lacking a fixture id (static from BASE_PROFILES). */
55
+ unprovenExclusions: number;
56
+ lastFailure: string | null;
57
+ }
58
+
59
+ /**
60
+ * Static VC7B economics profile tallies derived from the base provider registry.
61
+ * `profileCount` counts profiles that declare economics; `provenExclusions` /
62
+ * `unprovenExclusions` tally the exclusion sets validated against the fixture
63
+ * rule. This is PURE (no storage/clock/network) and identical regardless of the
64
+ * `MEGACOMPACT_VC7B` flag — only the emission/route seam is flag-gated.
65
+ */
66
+ function baseEconomicsTallies(): {
67
+ profileCount: number;
68
+ provenExclusions: number;
69
+ unprovenExclusions: number;
70
+ } {
71
+ let profileCount = 0;
72
+ let provenExclusions = 0;
73
+ let unprovenExclusions = 0;
74
+ for (const bundle of BASE_PROVIDER_PROFILES) {
75
+ const econ = bundle.profile.economics;
76
+ if (econ === null) continue;
77
+ profileCount += 1;
78
+ const codes = validateProfileEconomics(bundle.profile, econ);
79
+ const failed = new Set(codes);
80
+ for (const _ex of bundle.profile.excludedJsonPointers) {
81
+ if (failed.has("ECON_EXCLUSION_UNPROVEN")) {
82
+ unprovenExclusions += 1;
83
+ } else {
84
+ provenExclusions += 1;
85
+ }
86
+ }
87
+ }
88
+ return { profileCount, provenExclusions, unprovenExclusions };
89
+ }
90
+
91
+ /** One VC8B shadow-policy record (metrics + active pressure version). */
92
+ export interface LivewireShadowRecord {
93
+ shadowDecisions: number;
94
+ clampedDecisions: number;
95
+ rejectedInputs: number;
96
+ liveMutations: number;
97
+ pressureVersion: 1 | 2;
98
+ lastFailure: string | null;
99
+ }
100
+
101
+ /** The live, in-process state for one stateDir. */
102
+ export interface LivewireLiveState {
103
+ readonly crystalStore: CrystalStore;
104
+ readonly breaker: ReturnType<typeof createCacheBreaker>;
105
+ readonly diagnostics: LivewireDiagnosticsRecord;
106
+ readonly economics: LivewireEconomicsRecord;
107
+ readonly shadow: LivewireShadowRecord;
108
+ }
109
+
110
+ /** A zeroed per-class tally map. */
111
+ function zeroTallies(): LivewireDiagnosticsRecord["tallies"] {
112
+ return {
113
+ profile: 0,
114
+ range: 0,
115
+ dependency: 0,
116
+ request: 0,
117
+ generation: 0,
118
+ unknown: 0,
119
+ };
120
+ }
121
+
122
+ /** Build a fresh (empty) live state with real subsystem objects. */
123
+ export function createLiveState(): LivewireLiveState {
124
+ const econTallies = baseEconomicsTallies();
125
+ return {
126
+ crystalStore: new CrystalStore(),
127
+ breaker: createCacheBreaker(),
128
+ diagnostics: {
129
+ tallies: zeroTallies(),
130
+ serveBlocked: 0,
131
+ breakerState: "CLOSED_A",
132
+ lastFailure: null,
133
+ },
134
+ economics: {
135
+ computed: false,
136
+ profileCount: econTallies.profileCount,
137
+ provenExclusions: econTallies.provenExclusions,
138
+ unprovenExclusions: econTallies.unprovenExclusions,
139
+ lastFailure: null,
140
+ },
141
+ shadow: {
142
+ shadowDecisions: 0,
143
+ clampedDecisions: 0,
144
+ rejectedInputs: 0,
145
+ liveMutations: 0,
146
+ pressureVersion: 1,
147
+ lastFailure: null,
148
+ },
149
+ };
150
+ }
151
+
152
+ /** Project the live state down to the persisted, reader-only aggregate. */
153
+ export function snapshotOf(state: LivewireLiveState): LivewireSnapshot {
154
+ const crystals = state.crystalStore.stats();
155
+ const diag: LivewireDiagnosticsAggregate = {
156
+ profileMisses: state.diagnostics.tallies.profile,
157
+ rangeMisses: state.diagnostics.tallies.range,
158
+ dependencyMisses: state.diagnostics.tallies.dependency,
159
+ requestMisses: state.diagnostics.tallies.request,
160
+ generationMisses: state.diagnostics.tallies.generation,
161
+ unknownMisses: state.diagnostics.tallies.unknown,
162
+ serveBlocked: state.diagnostics.serveBlocked,
163
+ breakerState: state.diagnostics.breakerState,
164
+ lastFailure: state.diagnostics.lastFailure,
165
+ };
166
+ const econ: LivewireEconomicsAggregate = {
167
+ profileCount: state.economics.profileCount,
168
+ provenExclusions: state.economics.provenExclusions,
169
+ unprovenExclusions: state.economics.unprovenExclusions,
170
+ computed: state.economics.computed,
171
+ lastFailure: state.economics.lastFailure,
172
+ };
173
+ const policy: LivewirePolicyAggregate = {
174
+ shadowDecisions: state.shadow.shadowDecisions,
175
+ clampedDecisions: state.shadow.clampedDecisions,
176
+ rejectedInputs: state.shadow.rejectedInputs,
177
+ liveMutations: state.shadow.liveMutations,
178
+ pressureVersion: state.shadow.pressureVersion,
179
+ lastFailure: state.shadow.lastFailure,
180
+ };
181
+ return {
182
+ schema: "vector-cortex-livewire-v1",
183
+ crystals: {
184
+ mode: crystals.mode,
185
+ crystalCount: crystals.crystalCount,
186
+ totalBytes: crystals.totalBytes,
187
+ hits: crystals.hits,
188
+ misses: crystals.misses,
189
+ hitBytes: crystals.hitBytes,
190
+ writes: crystals.writes,
191
+ duplicateWrites: crystals.duplicateWrites,
192
+ collisions: crystals.collisions,
193
+ },
194
+ diagnostics: diag,
195
+ economics: econ,
196
+ policy,
197
+ };
198
+ }
199
+
200
+ /** Seed a fresh live state's CUMULATIVE counters from a persisted snapshot. */
201
+ export function rehydrateLive(state: LivewireLiveState, snap: LivewireSnapshot): void {
202
+ state.crystalStore.rehydrate(snap.crystals);
203
+ state.diagnostics.tallies.profile = snap.diagnostics.profileMisses;
204
+ state.diagnostics.tallies.range = snap.diagnostics.rangeMisses;
205
+ state.diagnostics.tallies.dependency = snap.diagnostics.dependencyMisses;
206
+ state.diagnostics.tallies.request = snap.diagnostics.requestMisses;
207
+ state.diagnostics.tallies.generation = snap.diagnostics.generationMisses;
208
+ state.diagnostics.tallies.unknown = snap.diagnostics.unknownMisses;
209
+ state.diagnostics.serveBlocked = snap.diagnostics.serveBlocked;
210
+ state.diagnostics.breakerState = snap.diagnostics.breakerState;
211
+ state.diagnostics.lastFailure = snap.diagnostics.lastFailure;
212
+ state.economics.computed = snap.economics.computed;
213
+ state.economics.profileCount = snap.economics.profileCount;
214
+ state.economics.provenExclusions = snap.economics.provenExclusions;
215
+ state.economics.unprovenExclusions = snap.economics.unprovenExclusions;
216
+ state.economics.lastFailure = snap.economics.lastFailure;
217
+ state.shadow.shadowDecisions = snap.policy.shadowDecisions;
218
+ state.shadow.clampedDecisions = snap.policy.clampedDecisions;
219
+ state.shadow.rejectedInputs = snap.policy.rejectedInputs;
220
+ state.shadow.liveMutations = snap.policy.liveMutations;
221
+ state.shadow.pressureVersion = snap.policy.pressureVersion;
222
+ state.shadow.lastFailure = snap.policy.lastFailure;
223
+ }