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.
- package/dist/config/vector-cortex-enc2c.js +38 -0
- package/dist/config/vector-cortex.js +2 -0
- package/dist/config.js +1 -1
- package/dist/extensions/dashboard-server/api-contracts/setup-cortex-native-ort.js +22 -0
- package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +1 -0
- package/dist/extensions/dashboard-server/routes-setup-cortex-actions.js +17 -11
- package/dist/extensions/dashboard-server/routes-vector-cortex-crystals.js +45 -30
- package/dist/extensions/dashboard-server/routes-vector-cortex-diagnostics.js +50 -29
- package/dist/extensions/dashboard-server/routes-vector-cortex-economics.js +33 -20
- package/dist/extensions/dashboard-server/routes-vector-cortex-helpers.js +54 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-policy.js +33 -16
- package/dist/extensions/dashboard-server/setup-cortex-actions-native-ort.js +107 -0
- package/dist/extensions/dashboard-server/setup-cortex-actions.js +9 -2
- package/dist/src/config/vector-cortex-enc2c.js +38 -0
- package/dist/src/config/vector-cortex.js +2 -0
- package/dist/src/config.js +1 -1
- package/dist/src/vector-cortex/cache/store.js +25 -2
- package/dist/src/vector-cortex/encoder/asset.js +34 -2
- package/dist/src/vector-cortex/encoder/router.js +31 -3
- package/dist/src/vector-cortex/livewire/livewire-live.js +163 -0
- package/dist/src/vector-cortex/livewire/livewire-registry.js +73 -0
- package/dist/src/vector-cortex/livewire/livewire-runtime.js +107 -0
- package/dist/src/vector-cortex/livewire/livewire-snapshot.js +101 -0
- package/dist/src/vector-cortex/livewire/livewire-types.js +19 -0
- package/dist/src/vector-cortex/provider/registry.js +44 -12
- package/dist/src/vector-cortex/setup-cortex-blockers-compute.js +3 -0
- package/dist/vector-cortex/cache/store.js +25 -2
- package/dist/vector-cortex/encoder/asset.js +34 -2
- package/dist/vector-cortex/encoder/router.js +31 -3
- package/dist/vector-cortex/provider/registry.js +44 -12
- package/dist/vector-cortex/setup-cortex-blockers-compute.js +3 -0
- package/extensions/dashboard-client/dist/assets/{AdminTab-BUl1fyQ-.js → AdminTab-ZyVtgYrZ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AdminTab-BUl1fyQ-.js.map → AdminTab-ZyVtgYrZ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{AreaChart-CumzbAON.js → AreaChart-7ms8Hk1m.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-CumzbAON.js.map → AreaChart-7ms8Hk1m.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-MvUf2UYv.js → BarChart-DeTE0NXA.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-MvUf2UYv.js.map → BarChart-DeTE0NXA.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-CqpJZ5Ok.js → CacheTab-CpIrpr_X.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-CqpJZ5Ok.js.map → CacheTab-CpIrpr_X.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ConfigTab-Cr0pKYGK.js → ConfigTab-BNMrO7uz.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ConfigTab-Cr0pKYGK.js.map → ConfigTab-BNMrO7uz.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-FTQ4nJae.js → EventsTab-j42vDTjs.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-FTQ4nJae.js.map → EventsTab-j42vDTjs.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-D7s5lCB0.js → HealthTab-D0Tf8XM_.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-D7s5lCB0.js.map → HealthTab-D0Tf8XM_.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DW5c0ngt.js → MaintenanceTab-CleWX_RM.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DW5c0ngt.js.map → MaintenanceTab-CleWX_RM.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-ocR07fD7.js → MemoryMapTab-LUpPJzNP.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-ocR07fD7.js.map → MemoryMapTab-LUpPJzNP.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsCards-CNBlWLoU.js → MetricsCards-G4_uynTE.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsCards-CNBlWLoU.js.map → MetricsCards-G4_uynTE.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/MetricsTab-yypKMQXf.js +2 -0
- package/extensions/dashboard-client/dist/assets/{MetricsTab-sks9wzZr.js.map → MetricsTab-yypKMQXf.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-Duu9zseZ.js → OverviewTab-M47NMRaT.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-Duu9zseZ.js.map → OverviewTab-M47NMRaT.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-CMd5NYjk.js → ReposTab-BX3ZxrAI.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-CMd5NYjk.js.map → ReposTab-BX3ZxrAI.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-Ht-k4LKk.js → SessionsTab-CSUmsNeZ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-Ht-k4LKk.js.map → SessionsTab-CSUmsNeZ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-BCfBdL-1.js → SetupTab-jF9BsQjw.js} +3 -3
- package/extensions/dashboard-client/dist/assets/SetupTab-jF9BsQjw.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-B3CAK2FZ.js → TimeSavedCard-qfwO1WJ3.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-B3CAK2FZ.js.map → TimeSavedCard-qfwO1WJ3.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnMemoryView-7SRtcvZF.js → TurnMemoryView-C7NQo_xi.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnMemoryView-7SRtcvZF.js.map → TurnMemoryView-C7NQo_xi.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/TurnsTab-D-19giqQ.js +2 -0
- package/extensions/dashboard-client/dist/assets/{TurnsTab-Djd-nzlT.js.map → TurnsTab-D-19giqQ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-BzvdQnVq.js → VcStatusBadge-DTHlwuUJ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-BzvdQnVq.js.map → VcStatusBadge-DTHlwuUJ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-qmY0a0E-.js → VectorCortexTab-Dvgdcwvs.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-qmY0a0E-.js.map → VectorCortexTab-Dvgdcwvs.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{WikiTab-DMmc36Xi.js → WikiTab-CYUEAQmZ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-DMmc36Xi.js.map → WikiTab-CYUEAQmZ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-DcRndiuf.js → button-DPOwTRN8.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-DcRndiuf.js.map → button-DPOwTRN8.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-CwWLYigw.js → card-CUipkgi9.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-CwWLYigw.js.map → card-CUipkgi9.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{client-extra-NQXJNKNj.js → client-extra-9lcKX-iO.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{client-extra-NQXJNKNj.js.map → client-extra-9lcKX-iO.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-BX9n_-am.js → generateCategoricalChart-_WpiJebf.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-BX9n_-am.js.map → generateCategoricalChart-_WpiJebf.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-DgKI8jwx.js → index-DlHJ7LBL.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{index-DgKI8jwx.js.map → index-DlHJ7LBL.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{switch-C_xzN77s.js → switch-Cx6-1wnT.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-C_xzN77s.js.map → switch-Cx6-1wnT.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-807R1-Th.js → toggle-Y3vbE0NG.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-807R1-Th.js.map → toggle-Y3vbE0NG.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-BNG39O7p.js → useSSE-CnJdk56R.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-BNG39O7p.js.map → useSSE-CnJdk56R.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/tabs/SetupTab/CortexActionsCard.tsx +89 -5
- package/extensions/dashboard-client/src/types/setup-cortex.ts +22 -1
- package/extensions/dashboard-server/api-contracts/setup-cortex-native-ort.ts +52 -0
- package/extensions/dashboard-server/api-contracts/setup-cortex.ts +8 -2
- package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +6 -0
- package/extensions/dashboard-server/routes-setup-cortex-actions.ts +22 -11
- package/extensions/dashboard-server/routes-vector-cortex-crystals.ts +46 -30
- package/extensions/dashboard-server/routes-vector-cortex-diagnostics.ts +52 -29
- package/extensions/dashboard-server/routes-vector-cortex-economics.ts +35 -20
- package/extensions/dashboard-server/routes-vector-cortex-helpers.ts +84 -0
- package/extensions/dashboard-server/routes-vector-cortex-policy.ts +35 -16
- package/extensions/dashboard-server/setup-cortex-actions-native-ort.ts +121 -0
- package/extensions/dashboard-server/setup-cortex-actions.ts +9 -3
- package/package.json +1 -1
- package/src/config/vector-cortex-enc2c.ts +40 -0
- package/src/config/vector-cortex.ts +2 -0
- package/src/config.ts +1 -0
- package/src/vector-cortex/cache/store.ts +26 -2
- package/src/vector-cortex/encoder/asset.ts +46 -3
- package/src/vector-cortex/encoder/router.ts +56 -2
- package/src/vector-cortex/encoder/types.ts +3 -0
- package/src/vector-cortex/livewire/livewire-live.ts +223 -0
- package/src/vector-cortex/livewire/livewire-registry.ts +91 -0
- package/src/vector-cortex/livewire/livewire-runtime.ts +117 -0
- package/src/vector-cortex/livewire/livewire-snapshot.ts +108 -0
- package/src/vector-cortex/livewire/livewire-types.ts +84 -0
- package/src/vector-cortex/provider/economics.ts +9 -31
- package/src/vector-cortex/provider/registry.ts +82 -11
- package/src/vector-cortex/provider/types.ts +37 -0
- package/src/vector-cortex/setup-cortex-blockers-compute.ts +8 -1
- package/extensions/dashboard-client/dist/assets/MetricsTab-sks9wzZr.js +0 -2
- package/extensions/dashboard-client/dist/assets/SetupTab-BCfBdL-1.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/TurnsTab-Djd-nzlT.js +0 -2
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
import { sprintFlag } from "./vector-cortex-flag.js";
|
|
31
|
+
/**
|
|
32
|
+
* ENC-2c — lazy-download native onnxruntime install action (dashboard-triggered,
|
|
33
|
+
* npm-delegated, confirm-gated). Default ON. `MEGACOMPACT_ENC_2C=0` disables and
|
|
34
|
+
* is byte-identical to the ENC-2b predecessor: no install action POST branch, no
|
|
35
|
+
* UI button, no install result fields. This flag MUST also be a dashboard SETTINGS
|
|
36
|
+
* toggle (visible in config UI, never in EXCLUDED_SETTINGS).
|
|
37
|
+
*/
|
|
38
|
+
export const ENC_2C_ENABLED = () => sprintFlag("MEGACOMPACT_ENC_2C");
|
|
@@ -54,5 +54,7 @@ export { ENC_2BUDGET_ENABLED, ENC_2BUDGET_NATIVE_ORT_BUDGET_ENV, ENC_2BUDGET_MAX
|
|
|
54
54
|
export { ENC_2A_ENABLED } from "./vector-cortex-enc2a.js";
|
|
55
55
|
// ENC-2b native onnxruntime qualification-retest flag extracted to vector-cortex-enc2b.ts.
|
|
56
56
|
export { ENC_2B_ENABLED } from "./vector-cortex-enc2b.js";
|
|
57
|
+
// ENC-2c native onnxruntime lazy-download install-action flag extracted to vector-cortex-enc2c.ts.
|
|
58
|
+
export { ENC_2C_ENABLED } from "./vector-cortex-enc2c.js";
|
|
57
59
|
// Breaker constants (TRIAD_RESILIENCE.md §breaker) extracted to vector-cortex-breakers.ts.
|
|
58
60
|
export { BREAKER_WINDOW_MS, BREAKER_MIN_ATTEMPTS, BREAKER_PERF_FAILURES, BREAKER_PERF_FAILURE_RATE, BREAKER_CORRECTNESS_FAILURES, BREAKER_COOLDOWN_MS, BREAKER_PROBE_COUNT, BREAKER_RETRY_BASE_MS, BREAKER_RETRY_CAP_MS, BREAKER_RETRY_JITTER, BREAKER_HYSTERESIS_FAILURE_RATE, BREAKER_HYSTERESIS_BUDGET_P95_MS, BREAKER_MIN_HEALTHY_RESIDENCE_MS, } from "./vector-cortex-breakers.js";
|
package/dist/config.js
CHANGED
|
@@ -114,4 +114,4 @@ export const NEW_UI = () => ragEnabled("MEGACOMPACT_NEW_UI");
|
|
|
114
114
|
// default ON, `=0`/`_DISABLED` off. Re-exported from src/config/vector-cortex.ts
|
|
115
115
|
// so root consumers share one source of truth.
|
|
116
116
|
// ---------------------------------------------------------------------------
|
|
117
|
-
export { VC0A_ENABLED, VC0B_ENABLED, VC1A_ENABLED, VC0C_ENABLED, VC1B_ENABLED, VC1C_ENABLED, VC2A_ENABLED, VC2B_ENABLED, VC2C_ENABLED, VC3A_ENABLED, VC3B_ENABLED, VC3C_ENABLED, VC4A_ENABLED, VC4B_ENABLED, VC4C_ENABLED, VC5A_ENABLED, VC5B_ENABLED, VC5C_ENABLED, VC6A_ENABLED, VC6B_ENABLED, VC6C_ENABLED, VC7A_ENABLED, VC7B_ENABLED, VC7C_ENABLED, VC8A_ENABLED, VC8B_ENABLED, VC8C_ENABLED, VC9A_ENABLED, VC9B_ENABLED, VC9C_ENABLED, VC9D_ENABLED, PCC_ENABLED, ML5A_ENABLED, ML5B_ENABLED, ML5C_ENABLED, ML5D_ENABLED, ML5E_ENABLED, DEDUP_ATTR_ENABLED, ENC_0A_ENABLED, ENC_0B_ENABLED, ENC_0C_ENABLED, ENC_0D_ENABLED, ENC_0E_ENABLED, ENC_0F_ENABLED, ENC_0G_ENABLED, ENC_1A_ENABLED, ENC_1B_ENABLED, ENC_2BUDGET_ENABLED, ENC_2BUDGET_NATIVE_ORT_BUDGET_ENV, ENC_2BUDGET_MAX_MIB, ENC_2BUDGET_DEFAULT_MIB, ENC_2A_ENABLED, ENC_2B_ENABLED, COSINE_FP_BENCH_ENABLED, COSINE_FP_REAL_ENABLED, REPO_CORPUS_ENABLED, DASH_0A_ENABLED, DASH_0B_ENABLED, DASH_0C_ENABLED, DASH_0D_ENABLED, BREAKER_WINDOW_MS, BREAKER_MIN_ATTEMPTS, BREAKER_PERF_FAILURES, BREAKER_PERF_FAILURE_RATE, BREAKER_CORRECTNESS_FAILURES, BREAKER_COOLDOWN_MS, BREAKER_PROBE_COUNT, BREAKER_RETRY_BASE_MS, BREAKER_RETRY_CAP_MS, BREAKER_RETRY_JITTER, BREAKER_HYSTERESIS_FAILURE_RATE, BREAKER_HYSTERESIS_BUDGET_P95_MS, BREAKER_MIN_HEALTHY_RESIDENCE_MS, } from "./config/vector-cortex.js";
|
|
117
|
+
export { VC0A_ENABLED, VC0B_ENABLED, VC1A_ENABLED, VC0C_ENABLED, VC1B_ENABLED, VC1C_ENABLED, VC2A_ENABLED, VC2B_ENABLED, VC2C_ENABLED, VC3A_ENABLED, VC3B_ENABLED, VC3C_ENABLED, VC4A_ENABLED, VC4B_ENABLED, VC4C_ENABLED, VC5A_ENABLED, VC5B_ENABLED, VC5C_ENABLED, VC6A_ENABLED, VC6B_ENABLED, VC6C_ENABLED, VC7A_ENABLED, VC7B_ENABLED, VC7C_ENABLED, VC8A_ENABLED, VC8B_ENABLED, VC8C_ENABLED, VC9A_ENABLED, VC9B_ENABLED, VC9C_ENABLED, VC9D_ENABLED, PCC_ENABLED, ML5A_ENABLED, ML5B_ENABLED, ML5C_ENABLED, ML5D_ENABLED, ML5E_ENABLED, DEDUP_ATTR_ENABLED, ENC_0A_ENABLED, ENC_0B_ENABLED, ENC_0C_ENABLED, ENC_0D_ENABLED, ENC_0E_ENABLED, ENC_0F_ENABLED, ENC_0G_ENABLED, ENC_1A_ENABLED, ENC_1B_ENABLED, ENC_2BUDGET_ENABLED, ENC_2BUDGET_NATIVE_ORT_BUDGET_ENV, ENC_2BUDGET_MAX_MIB, ENC_2BUDGET_DEFAULT_MIB, ENC_2A_ENABLED, ENC_2B_ENABLED, ENC_2C_ENABLED, COSINE_FP_BENCH_ENABLED, COSINE_FP_REAL_ENABLED, REPO_CORPUS_ENABLED, DASH_0A_ENABLED, DASH_0B_ENABLED, DASH_0C_ENABLED, DASH_0D_ENABLED, BREAKER_WINDOW_MS, BREAKER_MIN_ATTEMPTS, BREAKER_PERF_FAILURES, BREAKER_PERF_FAILURE_RATE, BREAKER_CORRECTNESS_FAILURES, BREAKER_COOLDOWN_MS, BREAKER_PROBE_COUNT, BREAKER_RETRY_BASE_MS, BREAKER_RETRY_CAP_MS, BREAKER_RETRY_JITTER, BREAKER_HYSTERESIS_FAILURE_RATE, BREAKER_HYSTERESIS_BUDGET_P95_MS, BREAKER_MIN_HEALTHY_RESIDENCE_MS, } from "./config/vector-cortex.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* api-contracts/setup-cortex-native-ort.ts — ENC-2c native onnxruntime
|
|
3
|
+
* lazy-download INSTALL action contract types.
|
|
4
|
+
*
|
|
5
|
+
* Sibling additive types for the VC9B action driver: POST /api/setup-cortex-action
|
|
6
|
+
* gains the `install-native-ort` action that, when confirmed, runs the committed
|
|
7
|
+
* scripts/encoder/install-native-ort.mjs subprocess locally (npm-delegated,
|
|
8
|
+
* sha256-verified) and then re-qualifies the binding via the ENC-2b retest path.
|
|
9
|
+
*
|
|
10
|
+
* The retest result shape mirrors `RetestResult` from
|
|
11
|
+
* extensions/dashboard-server/api-contracts/setup.ts (and
|
|
12
|
+
* src/vector-cortex/encoder/native-qualify-retest.ts): { platform, version,
|
|
13
|
+
* verdict, p95Ms, rssMiB, testedAt }. It is declared here rather than imported
|
|
14
|
+
* from src/ so the contract lives wholly in the extensions layer (PREVENT-PI —
|
|
15
|
+
* extensions never import impl internals) and stays self-contained.
|
|
16
|
+
*
|
|
17
|
+
* PREVENT-PI-004: type definitions only, no network code. The install action is
|
|
18
|
+
* a confirm-gated, npm-delegated local subprocess with NO URL literals (registry
|
|
19
|
+
* URL + sha256 live only in native-install-artifacts.ts).
|
|
20
|
+
* PREVENT-011: no `any` type — all types explicit.
|
|
21
|
+
*/
|
|
22
|
+
export {};
|
|
@@ -72,6 +72,7 @@ export const VECTOR_CORTEX_SETTINGS = {
|
|
|
72
72
|
boolDirect("MEGACOMPACT_ENC_2BUDGET", "ENC-2a operator-configurable native install-budget knob", "ENC-2a exposes the runtime operator knob MEGACOMPACT_NATIVE_ORT_BUDGET_MIB (default 300 MiB, clamp 8192) as a dashboard Settings field. The knob gates budgetOk in the encoder runtime decision (decision.ts installBudgetMib + runtime-select.ts selectRuntimeBackend). Persisted to the per-repo .mega-compact.env via the setup-configure writer branch; the GET status route surfaces the persisted value AND the effective integer installBudgetMib() resolves to (so the dashboard shows the runtime's actual operand). OFF = no new GET fields, no writer branch, no new Settings rows (byte-identical ENC-1b predecessor).", true),
|
|
73
73
|
boolDirect("MEGACOMPACT_ENC_2A", "ENC-2a native onnxruntime install GUIDE (detect + copy-paste)", "ENC-2a surfaces the platform-matched native onnxruntime install-guide (three copy-paste steps + script path) on the Setup Cortex sub-tab when the operator opted into the native backend but the effective runtime is still wasm (onnxruntime-node absent). Pure guidance — the extension NEVER executes or fetches (PREVENT-PI-004 unchanged); the committed operator script scripts/encoder/install-native-ort.mjs runs in the USER's shell. OFF = no guide GET fields, no guide-request POST branch, no install card (byte-identical ENC-1b predecessor).", true),
|
|
74
74
|
boolDirect("MEGACOMPACT_ENC_2B", "ENC-2b native ONNX runtime qualification retest (detect + re-qualify)", "ENC-2b re-probes and re-qualifies the installed native onnxruntime binding (onnxruntime-node in ~/.pi/mega-compact/native-ort/, operator-installed via the ENC-2a guide): loads the LOCAL on-disk binding, runs a bounded warmup + p95 probe, measures RSS, and computes a fresh qualification verdict against the ENC-0f p95 budget + the operator install-budget. Never downloads or trains (PREVENT-PI-004 / HG-1 unchanged); surfaces nativeOrtRetestResult + nativeOrtBackendEffective on the GET /api/setup-status. OFF = no retest GET fields, no retest POST branch, no retest card (byte-identical ENC-2a predecessor).", true),
|
|
75
|
+
boolDirect("MEGACOMPACT_ENC_2C", "ENC-2c native ONNX runtime lazy-download INSTALL action (dashboard-triggered)", "ENC-2c turns ENC-2a's operator run-script assist into a confirm-gated dashboard action: the Setup Cortex sub-tab gains an Install Native ORT button that, when the operator confirms, runs the committed scripts/encoder/install-native-ort.mjs subprocess locally (npm-delegated, sha256-verified) and then re-qualifies the binding via the ENC-2b retest path, exposing nativeOrtRetestResult / nativeOrtBackendEffective on the completion. PREVENT-PI-004 opt-in exemption: confirm-gated, npm-delegated, no URL literals (registry URL + sha256 live only in native-install-artifacts.ts). OFF = no install action POST branch, no UI button, no install result fields (byte-identical ENC-2b predecessor).", true),
|
|
75
76
|
boolDirect("MEGACOMPACT_COSINE_FP_BENCH", "COS-FP-A Synthetic FP Bench", "Synthetic FP harness + L2 cosine threshold calibration (COS-FP-A): drives the deterministic synthetic-corpus grid sweep (scripts/cosine-fp/bench.mjs) that measures L2 cosine false-positive rates and emits a recommended default, and serves the reader-only GET /api/cosine-fp-report. Synthetic-corpus-only — never reads real session/ledger bytes. OFF = bench inert, endpoint 404s, no report write, L2_COSINE plain MEGACOMPACT_L2_THRESHOLD (byte-identical predecessor).", true),
|
|
76
77
|
boolDirect("MEGACOMPACT_COSINE_FP_REAL", "COS-FP-R Real-Corpus Validation", "Real-corpus L2 cosine FP validation (COS-FP-R): runs the real-corpus grid sweep (scripts/cosine-fp/real-bench.mjs) against donated, consent-approved sessions only (SECURITY_PRIVACY Lifecycle/Consent), scoring FP/FN with Wilson intervals + session-grouped bootstrap, and appends CI-backed per-content-type recommendations to the cosine-threshold report. Runs only when a valid consented corpus exists; absent corpus = no_corpus (normative pre-donation state, nothing written). OFF = script inert, nothing executes, no writes (byte-identical predecessor).", true),
|
|
77
78
|
boolDirect("MEGACOMPACT_REPO_CORPUS", "Cross-Repo Corpus (REPO-A)", "Cross-repo corpus preparation (REPO-A): the governed, consent-gated reader-only path that builds a pseudonymous corpus manifest from per-repo events.log slices and serves GET /api/repo-corpus answering which pseudonymous repos/sessions are in the corpus, what cross-repo overlap exists, and whether consent is active for each — counts + IDs + status only, never payload content. Consent is append-only (consent.mjs, CLI/ops-only); revocation freezes the builder + route. OFF = builder refuses to run, reader route 404s, single-repo recall untouched (byte-identical predecessor).", true),
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
* GET /api/setup-cortex-action-log — bounded, redacted log tail
|
|
6
6
|
*
|
|
7
7
|
* Reader/actor-only: NEVER exposes payload bytes, prompts, or ledger. Actions
|
|
8
|
-
* only spawn the committed local vc2-model-prep scripts
|
|
9
|
-
* encoder assets (verify-asset) —
|
|
10
|
-
* (
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
8
|
+
* only spawn the committed local vc2-model-prep scripts, re-read the committed
|
|
9
|
+
* encoder assets (verify-asset), or — ENC-2c — run the confirm-gated npm-delegated
|
|
10
|
+
* native onnxruntime install (install-native-ort) + re-qualify — no network in
|
|
11
|
+
* this layer (PREVENT-PI-004). A hard gate (HG-1/HG-3) blocking the requested
|
|
12
|
+
* action yields 423 action_blocked_by_open_item with the blocker ids and NO
|
|
13
|
+
* subprocess is spawned. Missing confirm:true yields 400 confirmation_required.
|
|
14
|
+
* Flag-off (MEGACOMPACT_VC9B=0) is byte-identical to the VC9A-era predecessor:
|
|
15
|
+
* the routes are absent, so they return the 404 disabled shape and no action runs.
|
|
15
16
|
*
|
|
16
17
|
* Guardrails: PREVENT-011 (no `any`), PREVENT-001 (guarded JSON.parse via
|
|
17
18
|
* readJsonBody), no string literals for scripts/blockers (delegated to
|
|
@@ -21,7 +22,7 @@ import { existsSync } from "node:fs";
|
|
|
21
22
|
import { join, dirname } from "node:path";
|
|
22
23
|
import { fileURLToPath } from "node:url";
|
|
23
24
|
import { sendJson, readJsonBody } from "./routes-vector-cortex-shared.js";
|
|
24
|
-
import { VC9B_ENABLED, ENC_0G_ENABLED, ENC_0F_ENABLED } from "../../src/config.js";
|
|
25
|
+
import { VC9B_ENABLED, ENC_0G_ENABLED, ENC_0F_ENABLED, ENC_2C_ENABLED, } from "../../src/config.js";
|
|
25
26
|
import { setupCortexActionBlockers, computeSetupCortexBlockers } from "./setup-cortex-blockers.js";
|
|
26
27
|
import { readEncoderManifest, detectPlatform } from "../../src/vector-cortex/encoder/asset.js";
|
|
27
28
|
import { readQualificationRecord, encoderStateDir, } from "./qualification-record.js";
|
|
@@ -30,6 +31,7 @@ const ACTION_KINDS = new Set([
|
|
|
30
31
|
"fetch-model",
|
|
31
32
|
"bench",
|
|
32
33
|
"verify-asset",
|
|
34
|
+
"install-native-ort",
|
|
33
35
|
]);
|
|
34
36
|
function isActionKind(v) {
|
|
35
37
|
return typeof v === "string" && ACTION_KINDS.has(v);
|
|
@@ -98,7 +100,9 @@ export function handleSetupCortexAction(req, res, ctx) {
|
|
|
98
100
|
}
|
|
99
101
|
const value = parsed.value;
|
|
100
102
|
const action = value.action;
|
|
101
|
-
|
|
103
|
+
// ENC-2c: install-native-ort is recognized ONLY while ENC_2C is on —
|
|
104
|
+
// flag-off is byte-identical to the ENC-2b predecessor (invalid_action).
|
|
105
|
+
if (!isActionKind(action) || (action === "install-native-ort" && !ENC_2C_ENABLED())) {
|
|
102
106
|
sendJson(res, 400, { error: "invalid_action" });
|
|
103
107
|
return;
|
|
104
108
|
}
|
|
@@ -119,8 +123,10 @@ export function handleSetupCortexAction(req, res, ctx) {
|
|
|
119
123
|
});
|
|
120
124
|
return;
|
|
121
125
|
}
|
|
122
|
-
|
|
123
|
-
|
|
126
|
+
void (async () => {
|
|
127
|
+
const result = await runSetupCortexAction(action, ctx.stateDir);
|
|
128
|
+
sendJson(res, result.ok ? 200 : 500, result);
|
|
129
|
+
})();
|
|
124
130
|
});
|
|
125
131
|
return true;
|
|
126
132
|
}
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import { VC7A_ENABLED } from "../../src/config.js";
|
|
27
27
|
import { sendJson } from "./routes-vector-cortex-shared.js";
|
|
28
|
-
import { countVcEvents, vcCount } from "./vc-event-counts.js";
|
|
29
28
|
import { deriveVcStatus } from "./vc-status.js";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
];
|
|
29
|
+
import { readLivewireSnapshot } from "../../src/vector-cortex/livewire/livewire-registry.js";
|
|
30
|
+
// The flag-off deferred reason, kept byte-identical to the pre-LIVEWIRE
|
|
31
|
+
// predecessor (VC7A: `crystal_store_not_instantiated_v0_20_23`).
|
|
32
|
+
const DEFERRED_REASON = "crystal_store_not_instantiated_v0_20_23";
|
|
35
33
|
/**
|
|
36
34
|
* Reader-only GET /api/vector-cortex/cache-crystals (VC7A).
|
|
37
35
|
*
|
|
38
|
-
* Counts, byte volumes, and CRY_* codes only
|
|
39
|
-
*
|
|
36
|
+
* Counts, byte volumes, and CRY_* codes only. With the flag ON it surfaces the
|
|
37
|
+
* LIVEWIRE `CrystalStore` aggregate (live reads/writes/collisions accumulated at
|
|
38
|
+
* runtime); with the flag OFF it returns the byte-identical legacy deferred view
|
|
39
|
+
* (mode C, deferredReason present) so flag-off parity holds.
|
|
40
40
|
*/
|
|
41
41
|
export function handleVectorCortexCrystals(req, res, ctx) {
|
|
42
42
|
const url = req.url ?? "";
|
|
@@ -48,31 +48,46 @@ export function handleVectorCortexCrystals(req, res, ctx) {
|
|
|
48
48
|
return true;
|
|
49
49
|
}
|
|
50
50
|
const enabled = VC7A_ENABLED();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
if (!enabled) {
|
|
52
|
+
// Flag-off parity: byte-identical to the predecessor (mode C + deferred).
|
|
53
|
+
const body = {
|
|
54
|
+
enabled: false,
|
|
55
|
+
mode: "C",
|
|
56
|
+
crystalCount: 0,
|
|
57
|
+
totalBytes: 0,
|
|
58
|
+
hits: 0,
|
|
59
|
+
misses: 0,
|
|
60
|
+
hitBytes: 0,
|
|
61
|
+
writes: 0,
|
|
62
|
+
duplicateWrites: 0,
|
|
63
|
+
collisions: 0,
|
|
64
|
+
lastFailure: null,
|
|
65
|
+
updatedAt: new Date().toISOString(),
|
|
66
|
+
deferredReason: DEFERRED_REASON,
|
|
67
|
+
status: deriveVcStatus({ enabled: false, hasData: false }),
|
|
68
|
+
};
|
|
69
|
+
sendJson(res, 200, body);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
const snap = readLivewireSnapshot(ctx.stateDir);
|
|
73
|
+
const crystal = snap.crystals;
|
|
74
|
+
const hasData = crystal.crystalCount > 0;
|
|
57
75
|
const body = {
|
|
58
|
-
enabled,
|
|
59
|
-
mode,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
76
|
+
enabled: true,
|
|
77
|
+
// Surface the store's honest triad mode (B until a hit, A after, C when the
|
|
78
|
+
// store was set unavailable) rather than a hardcoded A.
|
|
79
|
+
mode: crystal.mode,
|
|
80
|
+
crystalCount: crystal.crystalCount,
|
|
81
|
+
totalBytes: crystal.totalBytes,
|
|
82
|
+
hits: crystal.hits,
|
|
83
|
+
misses: crystal.misses,
|
|
84
|
+
hitBytes: crystal.hitBytes,
|
|
85
|
+
writes: crystal.writes,
|
|
86
|
+
duplicateWrites: crystal.duplicateWrites,
|
|
87
|
+
collisions: crystal.collisions,
|
|
68
88
|
lastFailure: null,
|
|
69
89
|
updatedAt: new Date().toISOString(),
|
|
70
|
-
|
|
71
|
-
status: deriveVcStatus({
|
|
72
|
-
enabled,
|
|
73
|
-
deferredReason: "crystal_store_not_instantiated_v0_20_23",
|
|
74
|
-
hasData: vcCount(counts, "vector_cortex_crystal_written") > 0,
|
|
75
|
-
}),
|
|
90
|
+
status: deriveVcStatus({ enabled: true, hasData }),
|
|
76
91
|
};
|
|
77
92
|
sendJson(res, 200, body);
|
|
78
93
|
return true;
|
|
@@ -27,15 +27,18 @@
|
|
|
27
27
|
*/
|
|
28
28
|
import { VC7C_ENABLED } from "../../src/config.js";
|
|
29
29
|
import { sendJson } from "./routes-vector-cortex-shared.js";
|
|
30
|
-
import { countVcEvents, vcCount } from "./vc-event-counts.js";
|
|
31
30
|
import { deriveVcStatus } from "./vc-status.js";
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
import { readLivewireSnapshot } from "../../src/vector-cortex/livewire/livewire-registry.js";
|
|
32
|
+
// The flag-off deferred reason, kept byte-identical to the pre-LIVEWIRE
|
|
33
|
+
// predecessor (VC7C: `cache_classifier_not_wired_v0_20_23`).
|
|
34
|
+
const DEFERRED_REASON = "cache_classifier_not_wired_v0_20_23";
|
|
34
35
|
/**
|
|
35
36
|
* Reader-only GET /api/vector-cortex/cache-diagnostics (VC7C).
|
|
36
37
|
*
|
|
37
|
-
* Per-miss-class counts, breaker state, and CACHE
|
|
38
|
-
*
|
|
38
|
+
* Per-miss-class counts, serveBlocked, breaker state, and CACHE/M5 codes only.
|
|
39
|
+
* With the flag ON it surfaces the LIVEWIRE classifier/breaker tallies
|
|
40
|
+
* accumulated at runtime; with the flag OFF it returns the byte-identical legacy
|
|
41
|
+
* deferred view (mode C, deferredReason present).
|
|
39
42
|
*/
|
|
40
43
|
export function handleVectorCortexDiagnostics(req, res, ctx) {
|
|
41
44
|
const url = req.url ?? "";
|
|
@@ -47,32 +50,50 @@ export function handleVectorCortexDiagnostics(req, res, ctx) {
|
|
|
47
50
|
return true;
|
|
48
51
|
}
|
|
49
52
|
const enabled = VC7C_ENABLED();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
if (!enabled) {
|
|
54
|
+
// Flag-off parity: byte-identical to the predecessor (mode C + deferred).
|
|
55
|
+
const body = {
|
|
56
|
+
enabled: false,
|
|
57
|
+
mode: "C",
|
|
58
|
+
profileMisses: 0,
|
|
59
|
+
rangeMisses: 0,
|
|
60
|
+
dependencyMisses: 0,
|
|
61
|
+
requestMisses: 0,
|
|
62
|
+
generationMisses: 0,
|
|
63
|
+
unknownMisses: 0,
|
|
64
|
+
serveBlocked: 0,
|
|
65
|
+
breakerState: "closed",
|
|
66
|
+
lastFailure: null,
|
|
67
|
+
updatedAt: new Date().toISOString(),
|
|
68
|
+
deferredReason: DEFERRED_REASON,
|
|
69
|
+
status: deriveVcStatus({ enabled: false, hasData: false }),
|
|
70
|
+
};
|
|
71
|
+
sendJson(res, 200, body);
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
const diag = readLivewireSnapshot(ctx.stateDir).diagnostics;
|
|
75
|
+
const hasData = diag.profileMisses +
|
|
76
|
+
diag.rangeMisses +
|
|
77
|
+
diag.dependencyMisses +
|
|
78
|
+
diag.requestMisses +
|
|
79
|
+
diag.generationMisses +
|
|
80
|
+
diag.unknownMisses +
|
|
81
|
+
diag.serveBlocked >
|
|
82
|
+
0;
|
|
57
83
|
const body = {
|
|
58
|
-
enabled,
|
|
59
|
-
mode,
|
|
60
|
-
profileMisses:
|
|
61
|
-
rangeMisses:
|
|
62
|
-
dependencyMisses:
|
|
63
|
-
requestMisses:
|
|
64
|
-
generationMisses:
|
|
65
|
-
unknownMisses:
|
|
66
|
-
serveBlocked:
|
|
67
|
-
breakerState:
|
|
68
|
-
lastFailure:
|
|
84
|
+
enabled: true,
|
|
85
|
+
mode: "A",
|
|
86
|
+
profileMisses: diag.profileMisses,
|
|
87
|
+
rangeMisses: diag.rangeMisses,
|
|
88
|
+
dependencyMisses: diag.dependencyMisses,
|
|
89
|
+
requestMisses: diag.requestMisses,
|
|
90
|
+
generationMisses: diag.generationMisses,
|
|
91
|
+
unknownMisses: diag.unknownMisses,
|
|
92
|
+
serveBlocked: diag.serveBlocked,
|
|
93
|
+
breakerState: diag.breakerState,
|
|
94
|
+
lastFailure: diag.lastFailure,
|
|
69
95
|
updatedAt: new Date().toISOString(),
|
|
70
|
-
|
|
71
|
-
status: deriveVcStatus({
|
|
72
|
-
enabled,
|
|
73
|
-
deferredReason: "cache_classifier_not_wired_v0_20_23",
|
|
74
|
-
hasData: vcCount(counts, "vector_cortex_cache_serve_blocked") > 0,
|
|
75
|
-
}),
|
|
96
|
+
status: deriveVcStatus({ enabled: true, hasData }),
|
|
76
97
|
};
|
|
77
98
|
sendJson(res, 200, body);
|
|
78
99
|
return true;
|
|
@@ -25,13 +25,19 @@
|
|
|
25
25
|
import { VC7B_ENABLED } from "../../src/config.js";
|
|
26
26
|
import { sendJson } from "./routes-vector-cortex-shared.js";
|
|
27
27
|
import { deriveVcStatus } from "./vc-status.js";
|
|
28
|
+
import { readLivewireSnapshot } from "../../src/vector-cortex/livewire/livewire-registry.js";
|
|
29
|
+
// The flag-off deferred reason, kept byte-identical to the pre-LIVEWIRE
|
|
30
|
+
// predecessor (VC7B: `economics_not_computed_v0_20_23`).
|
|
31
|
+
const DEFERRED_REASON = "economics_not_computed_v0_20_23";
|
|
28
32
|
/**
|
|
29
33
|
* Reader-only GET /api/vector-cortex/cache-economics (VC7B).
|
|
30
34
|
*
|
|
31
|
-
* Counts, profile tallies, and ECON_* codes only
|
|
32
|
-
*
|
|
35
|
+
* Counts, profile tallies, and ECON_* codes only. With the flag ON it surfaces
|
|
36
|
+
* the LIVEWIRE-provided profile economics tallies + the runtime `computed` bit;
|
|
37
|
+
* with the flag OFF it returns the byte-identical legacy deferred view (mode C,
|
|
38
|
+
* deferredReason present).
|
|
33
39
|
*/
|
|
34
|
-
export function handleVectorCortexEconomics(req, res,
|
|
40
|
+
export function handleVectorCortexEconomics(req, res, ctx) {
|
|
35
41
|
const url = req.url ?? "";
|
|
36
42
|
const path = url.split("?")[0] ?? url;
|
|
37
43
|
if (path !== "/api/vector-cortex/cache-economics")
|
|
@@ -41,25 +47,32 @@ export function handleVectorCortexEconomics(req, res, _ctx) {
|
|
|
41
47
|
return true;
|
|
42
48
|
}
|
|
43
49
|
const enabled = VC7B_ENABLED();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
if (!enabled) {
|
|
51
|
+
// Flag-off parity: byte-identical to the predecessor (mode C + deferred).
|
|
52
|
+
const body = {
|
|
53
|
+
enabled: false,
|
|
54
|
+
mode: "C",
|
|
55
|
+
profileCount: 0,
|
|
56
|
+
provenExclusions: 0,
|
|
57
|
+
unprovenExclusions: 0,
|
|
58
|
+
lastFailure: null,
|
|
59
|
+
updatedAt: new Date().toISOString(),
|
|
60
|
+
deferredReason: DEFERRED_REASON,
|
|
61
|
+
status: deriveVcStatus({ enabled: false, hasData: false }),
|
|
62
|
+
};
|
|
63
|
+
sendJson(res, 200, body);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
const econ = readLivewireSnapshot(ctx.stateDir).economics;
|
|
49
67
|
const body = {
|
|
50
|
-
enabled,
|
|
51
|
-
mode,
|
|
52
|
-
profileCount:
|
|
53
|
-
provenExclusions:
|
|
54
|
-
unprovenExclusions:
|
|
55
|
-
lastFailure:
|
|
68
|
+
enabled: true,
|
|
69
|
+
mode: "A",
|
|
70
|
+
profileCount: econ.profileCount,
|
|
71
|
+
provenExclusions: econ.provenExclusions,
|
|
72
|
+
unprovenExclusions: econ.unprovenExclusions,
|
|
73
|
+
lastFailure: econ.lastFailure,
|
|
56
74
|
updatedAt: new Date().toISOString(),
|
|
57
|
-
|
|
58
|
-
status: deriveVcStatus({
|
|
59
|
-
enabled,
|
|
60
|
-
deferredReason: "economics_not_computed_v0_20_23",
|
|
61
|
-
hasData: false,
|
|
62
|
-
}),
|
|
75
|
+
status: deriveVcStatus({ enabled: true, hasData: econ.computed }),
|
|
63
76
|
};
|
|
64
77
|
sendJson(res, 200, body);
|
|
65
78
|
return true;
|
|
@@ -98,3 +98,57 @@ export async function seedEval(dir) {
|
|
|
98
98
|
{ session: "s1", seq: 4, event: "encode", value: 12, unit: "ms", mode: "A" },
|
|
99
99
|
]);
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Seed a LIVEWIRE aggregate snapshot directly on disk so the spawned dashboard
|
|
103
|
+
* server (a separate process) rehydrates real subsystem counts and its reader-only
|
|
104
|
+
* routes report LIVE (non-deferred) data. This is how the LIVEWIRE route tests
|
|
105
|
+
* prove the wiring: the runtimes' persisted counts are exactly what a reader
|
|
106
|
+
* process reconstructs. Counts + codes + triad mode only (SECURITY_PRIVACY).
|
|
107
|
+
*/
|
|
108
|
+
export async function seedLivewireSnapshot(dir, overrides) {
|
|
109
|
+
const { saveLivewireSnapshot } = await import("../../src/vector-cortex/livewire/livewire-snapshot.js");
|
|
110
|
+
const c = overrides?.crystals ?? {};
|
|
111
|
+
const d = overrides?.diagnostics ?? {};
|
|
112
|
+
const e = overrides?.economics ?? {};
|
|
113
|
+
const p = overrides?.policy ?? {};
|
|
114
|
+
saveLivewireSnapshot(dir, {
|
|
115
|
+
schema: "vector-cortex-livewire-v1",
|
|
116
|
+
crystals: {
|
|
117
|
+
mode: "A",
|
|
118
|
+
crystalCount: c.crystalCount ?? 3,
|
|
119
|
+
totalBytes: c.totalBytes ?? 1024,
|
|
120
|
+
hits: c.hits ?? 0,
|
|
121
|
+
misses: c.misses ?? 0,
|
|
122
|
+
hitBytes: c.hitBytes ?? 0,
|
|
123
|
+
writes: c.writes ?? 0,
|
|
124
|
+
duplicateWrites: c.duplicateWrites ?? 0,
|
|
125
|
+
collisions: c.collisions ?? 0,
|
|
126
|
+
},
|
|
127
|
+
diagnostics: {
|
|
128
|
+
profileMisses: d.profileMisses ?? 0,
|
|
129
|
+
rangeMisses: d.rangeMisses ?? 0,
|
|
130
|
+
dependencyMisses: d.dependencyMisses ?? 0,
|
|
131
|
+
requestMisses: d.requestMisses ?? 0,
|
|
132
|
+
generationMisses: d.generationMisses ?? 0,
|
|
133
|
+
unknownMisses: d.unknownMisses ?? 0,
|
|
134
|
+
serveBlocked: d.serveBlocked ?? 0,
|
|
135
|
+
breakerState: d.breakerState ?? "CLOSED_A",
|
|
136
|
+
lastFailure: null,
|
|
137
|
+
},
|
|
138
|
+
economics: {
|
|
139
|
+
profileCount: e.profileCount ?? 4,
|
|
140
|
+
provenExclusions: e.provenExclusions ?? 1,
|
|
141
|
+
unprovenExclusions: e.unprovenExclusions ?? 0,
|
|
142
|
+
computed: e.computed ?? true,
|
|
143
|
+
lastFailure: null,
|
|
144
|
+
},
|
|
145
|
+
policy: {
|
|
146
|
+
shadowDecisions: p.shadowDecisions ?? 0,
|
|
147
|
+
clampedDecisions: p.clampedDecisions ?? 0,
|
|
148
|
+
rejectedInputs: p.rejectedInputs ?? 0,
|
|
149
|
+
liveMutations: p.liveMutations ?? 0,
|
|
150
|
+
pressureVersion: (p.pressureVersion ?? 1),
|
|
151
|
+
lastFailure: null,
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
}
|
|
@@ -18,8 +18,12 @@
|
|
|
18
18
|
import { VC8B_ENABLED } from "../../src/config.js";
|
|
19
19
|
import { sendJson } from "./routes-vector-cortex-shared.js";
|
|
20
20
|
import { deriveVcStatus } from "./vc-status.js";
|
|
21
|
+
import { readLivewireSnapshot } from "../../src/vector-cortex/livewire/livewire-registry.js";
|
|
22
|
+
// The flag-off deferred reason, kept byte-identical to the pre-LIVEWIRE
|
|
23
|
+
// predecessor (VC8B: `shadow_controller_not_instantiated_v0_20_23`).
|
|
24
|
+
const DEFERRED_REASON = "shadow_controller_not_instantiated_v0_20_23";
|
|
21
25
|
/** GET /api/vector-cortex/policy — reader-only policy + shadow aggregate (VC8B). */
|
|
22
|
-
export function handleVectorCortexPolicy(req, res,
|
|
26
|
+
export function handleVectorCortexPolicy(req, res, ctx) {
|
|
23
27
|
const url = req.url ?? "";
|
|
24
28
|
const path = url.split("?")[0] ?? url;
|
|
25
29
|
if (path !== "/api/vector-cortex/policy")
|
|
@@ -29,23 +33,36 @@ export function handleVectorCortexPolicy(req, res, _ctx) {
|
|
|
29
33
|
return true;
|
|
30
34
|
}
|
|
31
35
|
const enabled = VC8B_ENABLED();
|
|
32
|
-
|
|
36
|
+
if (!enabled) {
|
|
37
|
+
// Flag-off parity: byte-identical to the predecessor (mode C + deferred).
|
|
38
|
+
const body = {
|
|
39
|
+
enabled: false,
|
|
40
|
+
mode: "C",
|
|
41
|
+
shadowDecisions: 0,
|
|
42
|
+
clampedDecisions: 0,
|
|
43
|
+
rejectedInputs: 0,
|
|
44
|
+
liveMutations: 0,
|
|
45
|
+
pressureVersion: 1,
|
|
46
|
+
lastFailure: null,
|
|
47
|
+
updatedAt: new Date().toISOString(),
|
|
48
|
+
deferredReason: DEFERRED_REASON,
|
|
49
|
+
status: deriveVcStatus({ enabled: false, hasData: false }),
|
|
50
|
+
};
|
|
51
|
+
sendJson(res, 200, body);
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
const policy = readLivewireSnapshot(ctx.stateDir).policy;
|
|
33
55
|
const body = {
|
|
34
|
-
enabled,
|
|
35
|
-
mode,
|
|
36
|
-
shadowDecisions:
|
|
37
|
-
clampedDecisions:
|
|
38
|
-
rejectedInputs:
|
|
39
|
-
liveMutations:
|
|
40
|
-
pressureVersion:
|
|
41
|
-
lastFailure:
|
|
56
|
+
enabled: true,
|
|
57
|
+
mode: "A",
|
|
58
|
+
shadowDecisions: policy.shadowDecisions,
|
|
59
|
+
clampedDecisions: policy.clampedDecisions,
|
|
60
|
+
rejectedInputs: policy.rejectedInputs,
|
|
61
|
+
liveMutations: policy.liveMutations,
|
|
62
|
+
pressureVersion: policy.pressureVersion,
|
|
63
|
+
lastFailure: policy.lastFailure,
|
|
42
64
|
updatedAt: new Date().toISOString(),
|
|
43
|
-
|
|
44
|
-
status: deriveVcStatus({
|
|
45
|
-
enabled,
|
|
46
|
-
deferredReason: "shadow_controller_not_instantiated_v0_20_23",
|
|
47
|
-
hasData: false,
|
|
48
|
-
}),
|
|
65
|
+
status: deriveVcStatus({ enabled: true, hasData: policy.shadowDecisions > 0 }),
|
|
49
66
|
};
|
|
50
67
|
sendJson(res, 200, body);
|
|
51
68
|
return true;
|