pi-mega-compact 0.20.63 → 0.20.64

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 (85) hide show
  1. package/dist/config/vector-cortex-enc2a.js +35 -0
  2. package/dist/config/vector-cortex.js +2 -0
  3. package/dist/config.js +1 -1
  4. package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +1 -0
  5. package/dist/extensions/dashboard-server/routes-setup-enc2a.js +119 -0
  6. package/dist/extensions/dashboard-server/routes-setup.js +26 -0
  7. package/dist/src/config/vector-cortex-enc2a.js +35 -0
  8. package/dist/src/config/vector-cortex.js +2 -0
  9. package/dist/src/config.js +1 -1
  10. package/dist/src/vector-cortex/encoder/native-install-artifacts.js +43 -0
  11. package/dist/vector-cortex/encoder/native-install-artifacts.js +43 -0
  12. package/extensions/dashboard-client/dist/assets/{AdminTab-DrJ9VWRu.js → AdminTab-sjV8P5A4.js} +2 -2
  13. package/extensions/dashboard-client/dist/assets/{AdminTab-DrJ9VWRu.js.map → AdminTab-sjV8P5A4.js.map} +1 -1
  14. package/extensions/dashboard-client/dist/assets/{AreaChart-B1OkLRGT.js → AreaChart-C03yuld4.js} +2 -2
  15. package/extensions/dashboard-client/dist/assets/{AreaChart-B1OkLRGT.js.map → AreaChart-C03yuld4.js.map} +1 -1
  16. package/extensions/dashboard-client/dist/assets/{BarChart-IWwm38i0.js → BarChart-B9jtJ7ud.js} +2 -2
  17. package/extensions/dashboard-client/dist/assets/{BarChart-IWwm38i0.js.map → BarChart-B9jtJ7ud.js.map} +1 -1
  18. package/extensions/dashboard-client/dist/assets/{CacheTab-DvNlBxzX.js → CacheTab-B7Eh3qfp.js} +2 -2
  19. package/extensions/dashboard-client/dist/assets/{CacheTab-DvNlBxzX.js.map → CacheTab-B7Eh3qfp.js.map} +1 -1
  20. package/extensions/dashboard-client/dist/assets/{ConfigTab-C1t0EM2H.js → ConfigTab-DDTqosv2.js} +2 -2
  21. package/extensions/dashboard-client/dist/assets/{ConfigTab-C1t0EM2H.js.map → ConfigTab-DDTqosv2.js.map} +1 -1
  22. package/extensions/dashboard-client/dist/assets/{EventsTab-CCexdJjG.js → EventsTab-BmyQGmUa.js} +2 -2
  23. package/extensions/dashboard-client/dist/assets/{EventsTab-CCexdJjG.js.map → EventsTab-BmyQGmUa.js.map} +1 -1
  24. package/extensions/dashboard-client/dist/assets/{HealthTab-BkAKwtxe.js → HealthTab-DzPqNqpm.js} +2 -2
  25. package/extensions/dashboard-client/dist/assets/{HealthTab-BkAKwtxe.js.map → HealthTab-DzPqNqpm.js.map} +1 -1
  26. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-Beb59xuJ.js → MaintenanceTab-6g3d-M1p.js} +2 -2
  27. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-Beb59xuJ.js.map → MaintenanceTab-6g3d-M1p.js.map} +1 -1
  28. package/extensions/dashboard-client/dist/assets/{MemoryMapTab-P04ao17z.js → MemoryMapTab-Nk2yYPMS.js} +2 -2
  29. package/extensions/dashboard-client/dist/assets/{MemoryMapTab-P04ao17z.js.map → MemoryMapTab-Nk2yYPMS.js.map} +1 -1
  30. package/extensions/dashboard-client/dist/assets/{MetricsCards-YlmnUe01.js → MetricsCards-BlIiuZp5.js} +2 -2
  31. package/extensions/dashboard-client/dist/assets/{MetricsCards-YlmnUe01.js.map → MetricsCards-BlIiuZp5.js.map} +1 -1
  32. package/extensions/dashboard-client/dist/assets/MetricsTab-DfRDIAEU.js +2 -0
  33. package/extensions/dashboard-client/dist/assets/{MetricsTab-C2rXqvoD.js.map → MetricsTab-DfRDIAEU.js.map} +1 -1
  34. package/extensions/dashboard-client/dist/assets/{OverviewTab-BBNvmR3X.js → OverviewTab-xkuFE5GV.js} +2 -2
  35. package/extensions/dashboard-client/dist/assets/{OverviewTab-BBNvmR3X.js.map → OverviewTab-xkuFE5GV.js.map} +1 -1
  36. package/extensions/dashboard-client/dist/assets/{ReposTab-CjlumghA.js → ReposTab-C6qZmmgQ.js} +2 -2
  37. package/extensions/dashboard-client/dist/assets/{ReposTab-CjlumghA.js.map → ReposTab-C6qZmmgQ.js.map} +1 -1
  38. package/extensions/dashboard-client/dist/assets/{SessionsTab-D1tWcUn-.js → SessionsTab-Bkd_In3n.js} +2 -2
  39. package/extensions/dashboard-client/dist/assets/{SessionsTab-D1tWcUn-.js.map → SessionsTab-Bkd_In3n.js.map} +1 -1
  40. package/extensions/dashboard-client/dist/assets/SetupTab-CEXL71VP.js +3 -0
  41. package/extensions/dashboard-client/dist/assets/SetupTab-CEXL71VP.js.map +1 -0
  42. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-DzBeE2y4.js → TimeSavedCard-Dr0KNUed.js} +2 -2
  43. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-DzBeE2y4.js.map → TimeSavedCard-Dr0KNUed.js.map} +1 -1
  44. package/extensions/dashboard-client/dist/assets/{TurnMemoryView-DKVIkjot.js → TurnMemoryView-CjmSiRQ_.js} +2 -2
  45. package/extensions/dashboard-client/dist/assets/{TurnMemoryView-DKVIkjot.js.map → TurnMemoryView-CjmSiRQ_.js.map} +1 -1
  46. package/extensions/dashboard-client/dist/assets/TurnsTab-JsDstDDA.js +2 -0
  47. package/extensions/dashboard-client/dist/assets/{TurnsTab-Cqyq6fVe.js.map → TurnsTab-JsDstDDA.js.map} +1 -1
  48. package/extensions/dashboard-client/dist/assets/{VcStatusBadge-CBtRo20h.js → VcStatusBadge-C96wfemg.js} +2 -2
  49. package/extensions/dashboard-client/dist/assets/{VcStatusBadge-CBtRo20h.js.map → VcStatusBadge-C96wfemg.js.map} +1 -1
  50. package/extensions/dashboard-client/dist/assets/{VectorCortexTab-Bk53uJZZ.js → VectorCortexTab-DGV3kA7X.js} +2 -2
  51. package/extensions/dashboard-client/dist/assets/{VectorCortexTab-Bk53uJZZ.js.map → VectorCortexTab-DGV3kA7X.js.map} +1 -1
  52. package/extensions/dashboard-client/dist/assets/{WikiTab-CemxY6Lm.js → WikiTab-EFfy5v-D.js} +2 -2
  53. package/extensions/dashboard-client/dist/assets/{WikiTab-CemxY6Lm.js.map → WikiTab-EFfy5v-D.js.map} +1 -1
  54. package/extensions/dashboard-client/dist/assets/{button-BJiUJyhV.js → button-CvaPx9Bu.js} +2 -2
  55. package/extensions/dashboard-client/dist/assets/{button-BJiUJyhV.js.map → button-CvaPx9Bu.js.map} +1 -1
  56. package/extensions/dashboard-client/dist/assets/{card-Cg_LPWdl.js → card-Crs5SwRQ.js} +2 -2
  57. package/extensions/dashboard-client/dist/assets/{card-Cg_LPWdl.js.map → card-Crs5SwRQ.js.map} +1 -1
  58. package/extensions/dashboard-client/dist/assets/{client-extra-DxQFx7HY.js → client-extra-Bd27WKSo.js} +2 -2
  59. package/extensions/dashboard-client/dist/assets/{client-extra-DxQFx7HY.js.map → client-extra-Bd27WKSo.js.map} +1 -1
  60. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-sE5oI3Ee.js → generateCategoricalChart-qnHql9Es.js} +2 -2
  61. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-sE5oI3Ee.js.map → generateCategoricalChart-qnHql9Es.js.map} +1 -1
  62. package/extensions/dashboard-client/dist/assets/{index-CeBW9Vtt.js → index-B4twCFnn.js} +3 -3
  63. package/extensions/dashboard-client/dist/assets/{index-CeBW9Vtt.js.map → index-B4twCFnn.js.map} +1 -1
  64. package/extensions/dashboard-client/dist/assets/{switch-CmkMKtTG.js → switch-BXutQI5d.js} +2 -2
  65. package/extensions/dashboard-client/dist/assets/{switch-CmkMKtTG.js.map → switch-BXutQI5d.js.map} +1 -1
  66. package/extensions/dashboard-client/dist/assets/{toggle-CqpZacm5.js → toggle-uE-OSaba.js} +2 -2
  67. package/extensions/dashboard-client/dist/assets/{toggle-CqpZacm5.js.map → toggle-uE-OSaba.js.map} +1 -1
  68. package/extensions/dashboard-client/dist/assets/{useSSE-DCKHmvXr.js → useSSE-BRgPAqeS.js} +2 -2
  69. package/extensions/dashboard-client/dist/assets/{useSSE-DCKHmvXr.js.map → useSSE-BRgPAqeS.js.map} +1 -1
  70. package/extensions/dashboard-client/dist/index.html +1 -1
  71. package/extensions/dashboard-client/src/tabs/SetupTab/CortexRuntimeInstallCard.tsx +103 -0
  72. package/extensions/dashboard-client/src/tabs/SetupTab/CortexSetup.tsx +2 -0
  73. package/extensions/dashboard-server/api-contracts/setup.ts +24 -0
  74. package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +6 -0
  75. package/extensions/dashboard-server/routes-setup-enc2a.ts +140 -0
  76. package/extensions/dashboard-server/routes-setup.ts +26 -0
  77. package/package.json +1 -1
  78. package/src/config/vector-cortex-enc2a.ts +37 -0
  79. package/src/config/vector-cortex.ts +2 -0
  80. package/src/config.ts +1 -0
  81. package/src/vector-cortex/encoder/native-install-artifacts.ts +60 -0
  82. package/extensions/dashboard-client/dist/assets/MetricsTab-C2rXqvoD.js +0 -2
  83. package/extensions/dashboard-client/dist/assets/SetupTab-CgC4Rz38.js +0 -3
  84. package/extensions/dashboard-client/dist/assets/SetupTab-CgC4Rz38.js.map +0 -1
  85. package/extensions/dashboard-client/dist/assets/TurnsTab-Cqyq6fVe.js +0 -2
@@ -0,0 +1,35 @@
1
+ /**
2
+ * config/vector-cortex-enc2a.ts — ENC-2a native onnxruntime install-guide flag
3
+ * (operator run-script assist).
4
+ *
5
+ * Sibling of vector-cortex-enc1a.ts / vector-cortex-enc1b.ts /
6
+ * vector-cortex-enc2budget.ts so vector-cortex.ts stays under the 300-line soft
7
+ * limit (soft-as-hard gate). vector-cortex.ts re-exports the flag below and
8
+ * root src/config.ts re-exports it, so no consumer import path changes.
9
+ *
10
+ * ENC-2a, when the operator opted into the native backend
11
+ * (`MEGACOMPACT_ENCODER_NATIVE=1`) but `encoderBackend` is still `"wasm"`
12
+ * (onnxruntime-node absent / not yet installed), surfaces an "Encoder Runtime
13
+ * Install" card on the Cortex sub-tab with copy-paste operator commands: the
14
+ * install + restart + verify steps built ONLY from the artifacts-module
15
+ * constants (`src/vector-cortex/encoder/native-install-artifacts.ts`) — never
16
+ * an inline registry URL or hash in the route (PREVENT-PI-004). The guide
17
+ * renders only on an installable host platform; the ENC-0e darwin-x64 demotion
18
+ * sentinel keeps it absent on an Intel Mac (no native binding upstream).
19
+ *
20
+ * `MEGACOMPACT_ENC_2A=0` disables: no guide fields, no install card, no absent
21
+ * read — byte-identical to the ENC-1b predecessor. The flag MUST also be a
22
+ * dashboard SETTINGS toggle (visible in config UI, never in EXCLUDED_SETTINGS
23
+ * — see `feedback_dashboard-flags-toggleable` memory).
24
+ *
25
+ * Pi-agnostic, dependency-free (PREVENT-PI-004 / PREVENT-011).
26
+ */
27
+ import { sprintFlag } from "./vector-cortex-flag.js";
28
+ /**
29
+ * ENC-2a — operator run-script assist (dashboard install guide for the
30
+ * onnxruntime-node native binding). Default ON. `MEGACOMPACT_ENC_2A=0` disables
31
+ * and is byte-identical to the ENC-1b predecessor: no guide/absent fields, no
32
+ * install card. This flag MUST also be a dashboard SETTINGS toggle (visible in
33
+ * config UI, never in EXCLUDED_SETTINGS).
34
+ */
35
+ export const ENC_2A_ENABLED = () => sprintFlag("MEGACOMPACT_ENC_2A");
@@ -50,5 +50,7 @@ export { DASH_0D_ENABLED } from "./vector-cortex-dash-0d.js";
50
50
  export { ENC_1A_ENABLED } from "./vector-cortex-enc1a.js";
51
51
  export { ENC_1B_ENABLED, ENC_1B_MAX_EMBEDDING_DIM, ENC_1B_EMBEDDING_DIM_ENV, ENC_1B_EMBEDDING_HEADERS_ENV, ENC_1B_ALLOW_REMOTE_EMBEDDER_ENV, ENC_1B_ENCODER_NATIVE_ENV, } from "./vector-cortex-enc1b.js";
52
52
  export { ENC_2BUDGET_ENABLED, ENC_2BUDGET_NATIVE_ORT_BUDGET_ENV, ENC_2BUDGET_MAX_MIB, ENC_2BUDGET_DEFAULT_MIB, } from "./vector-cortex-enc2budget.js";
53
+ // ENC-2a native onnxruntime install-guide flag extracted to vector-cortex-enc2a.ts.
54
+ export { ENC_2A_ENABLED } from "./vector-cortex-enc2a.js";
53
55
  // Breaker constants (TRIAD_RESILIENCE.md §breaker) extracted to vector-cortex-breakers.ts.
54
56
  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, 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, 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";
@@ -70,6 +70,7 @@ export const VECTOR_CORTEX_SETTINGS = {
70
70
  boolDirect("MEGACOMPACT_ENC_1A", "ENC-1a external embedder API key + endpoint Settings fields", "ENC-1a adds a Settings-visible field pair for the external embedder endpoint URL + optional Bearer API key, persisted by the setup-configure writer branch to the per-repo .mega-compact.env (MEGACOMPACT_EMBEDDING_URL / MEGACOMPACT_EMBEDDING_KEY). The GET status route echoes the endpoint URL and reports embeddingApiKeySet as a boolean ONLY — the raw key is never returned. OFF = no new GET fields, no writer branch, no new Settings text rows (byte-identical ENC-0g predecessor).", true),
71
71
  boolDirect("MEGACOMPACT_ENC_1B", "ENC-1b ONNX runtime backend + embedder API settings", "ENC-1b completes the embedder API Settings surface (dim / headers / allow-remote persisted to the per-repo .mega-compact.env) and surfaces the ONNX runtime selection knob (MEGACOMPACT_ENCODER_NATIVE) as a toggle plus the current effective backend + demotion reason. OFF = no new GET fields, no writer branch, no new Settings rows or toggle (byte-identical ENC-1a predecessor).", true),
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
+ 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),
73
74
  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),
74
75
  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),
75
76
  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),
@@ -0,0 +1,119 @@
1
+ /**
2
+ * dashboard-server/routes-setup-enc2a.ts — ENC-2a native onnxruntime install
3
+ * GUIDE (reader-only) + installed-version probe.
4
+ *
5
+ * Extracted out of routes-setup.ts (which hovers at the 300-line source soft
6
+ * cap, mirroring the ENC-1a/ENC-1b/ENC-2budget sibling extracts) so the
7
+ * ENC-2a additive GET fields — the platform-matched native install guide and
8
+ * the installed-version probe — live in a sibling impl file and routes-setup.ts
9
+ * stays a thin host.
10
+ *
11
+ * The guide's job is OPERATOR run-script assist: when the operator opted into
12
+ * the native backend (`MEGACOMPACT_ENCODER_NATIVE=1`) but the effective runtime
13
+ * is still `"wasm"` (onnxruntime-node not yet installed) AND the host platform
14
+ * is installable, the GET status response carries a `nativeOrtInstallGuide`
15
+ * object with the [install, restart, verify] copy-paste commands + the committed
16
+ * operator script path. The commands/URL/hash are built ONLY from the artifacts
17
+ * module constants (`src/vector-cortex/encoder/native-install-artifacts.ts`) —
18
+ * never an inline registry URL or literal hash (PREVENT-PI-004). The installed-
19
+ * version probe reads the local `~/.pi/mega-compact/native-ort/` package.json
20
+ * when present (reader-only filesystem read, zero network).
21
+ *
22
+ * The flag is off (or opt-in off / unsupported platform / non-wasm backend) ->
23
+ * guide `null` and installedVersion `null` -> the host omits both fields,
24
+ * byte-identical to the ENC-1b-era shape.
25
+ *
26
+ * Guardrails: PREVENT-PI-004 (local filesystem reads + in-memory backend
27
+ * selection only, zero network), PREVENT-001 (null-safe JSON), PREVENT-011
28
+ * (no `any`).
29
+ */
30
+ import { readFileSync, existsSync } from "node:fs";
31
+ import { join } from "node:path";
32
+ import { ENC_2A_ENABLED } from "../../src/config/vector-cortex.js";
33
+ import { readEnc1bEnv } from "./routes-setup-enc1b.js";
34
+ import { selectRuntimeBackend } from "../../src/vector-cortex/encoder/runtime-select.js";
35
+ import { detectPlatform } from "../../src/vector-cortex/encoder/asset.js";
36
+ import { NATIVE_ORT_VERSION, NATIVE_ORT_PACKAGE, NATIVE_ORT_INSTALLABLE_PLATFORMS, } from "../../src/vector-cortex/encoder/native-install-artifacts.js";
37
+ /** The committed operator script that performs the install (repo-relative). */
38
+ const ENC_2A_SCRIPT_PATH = "scripts/encoder/install-native-ort.mjs";
39
+ /** Where the operator script installs the native binding (absolute install
40
+ * prefix used verbatim in the guide commands + the version probe). */
41
+ function nativeOrtDir() {
42
+ return join(process.env.HOME ?? "", ".pi", "mega-compact", "native-ort");
43
+ }
44
+ /**
45
+ * True when the payload carries the ENC-2a guide-request key `false`/`true`
46
+ * (flag-gated, additive). `false` -> 400 (operator-driven no-op); `true` -> 200
47
+ * + the guide echoed (still no server execution — the execute path is ENC-2c).
48
+ * Flag-off -> null so the key falls through unrecognized (byte-identical
49
+ * ENC-1b-era predecessor).
50
+ */
51
+ export function enc2aGuideRequest(body) {
52
+ if (!ENC_2A_ENABLED())
53
+ return null;
54
+ if (body.nativeOrtInstallGuide === true)
55
+ return { status: 200 };
56
+ if (body.nativeOrtInstallGuide === false)
57
+ return { status: 400 };
58
+ return null;
59
+ }
60
+ /**
61
+ * Read the ENC-2a native install GUIDE + installed-version, additive GET fields.
62
+ *
63
+ * The guide renders only when EVERY gate passes: flag on, operator opted into
64
+ * native, effective backend is still `"wasm"` (onnxruntime-node absent), and the
65
+ * host platform is installable (darwin-x64 is excluded — no native binding
66
+ * upstream, the ENC-0e demotion sentinel). The effective backend + demotion
67
+ * reason go through the EXISTING `selectRuntimeBackend` (reader-only — never a
68
+ * reimplemented literal). `installedVersion` probes
69
+ * `~/.pi/mega-compact/native-ort/node_modules/onnxruntime-node/package.json`
70
+ * when present; null otherwise. Returns `{ guide: null, installedVersion: null }`
71
+ * when the flag is off (byte-identical predecessor).
72
+ */
73
+ export function readEnc2aGuide(stateDir) {
74
+ if (!ENC_2A_ENABLED())
75
+ return { guide: null, installedVersion: null };
76
+ const env = readEnc1bEnv(stateDir);
77
+ const platform = detectPlatform();
78
+ const chosen = selectRuntimeBackend({
79
+ platform: platform ?? "unsupported",
80
+ benchRecord: null,
81
+ nativeOptIn: env.nativeOptIn,
82
+ });
83
+ const backend = chosen.backend === "native" ? "native" : "wasm";
84
+ let guide = null;
85
+ if (env.nativeOptIn &&
86
+ backend === "wasm" &&
87
+ platform !== null &&
88
+ NATIVE_ORT_INSTALLABLE_PLATFORMS.includes(platform)) {
89
+ guide = {
90
+ platform,
91
+ commands: [
92
+ `npm install --prefix ${nativeOrtDir()} ${NATIVE_ORT_PACKAGE}@${NATIVE_ORT_VERSION}`,
93
+ "pi update --extensions && pi session-start",
94
+ "expect encoderBackend: native on next status poll",
95
+ ],
96
+ scriptPath: ENC_2A_SCRIPT_PATH,
97
+ };
98
+ }
99
+ return { guide, installedVersion: probeInstalledVersion() };
100
+ }
101
+ /** Probe the local native-ort package.json for the installed onnxruntime-node
102
+ * version. Null when the package is absent/unreadable (reader-only, local). */
103
+ function probeInstalledVersion() {
104
+ try {
105
+ const pkgPath = join(nativeOrtDir(), "node_modules", NATIVE_ORT_PACKAGE, "package.json");
106
+ if (!existsSync(pkgPath))
107
+ return null;
108
+ const raw = JSON.parse(readFileSync(pkgPath, "utf8"));
109
+ if (typeof raw === "object" &&
110
+ raw !== null &&
111
+ typeof raw.version === "string") {
112
+ return raw.version;
113
+ }
114
+ return null;
115
+ }
116
+ catch {
117
+ return null;
118
+ }
119
+ }
@@ -14,6 +14,7 @@ import { VC9D_ENABLED } from "../../src/config.js";
14
14
  import { enc1aStatusFields, writeEnc1aEnv, tryEnc1aConfigure, wantsEnc1a } from "./routes-setup-enc1a.js";
15
15
  import { enc1bStatusFields, tryEnc1bConfigure, tryEnc1bInto, enc1bValidateCombined } from "./routes-setup-enc1b.js";
16
16
  import { enc2BudgetStatusFields, tryEnc2BudgetInto, enc2BudgetValidateCombined, } from "./routes-setup-enc2budget.js";
17
+ import { readEnc2aGuide, enc2aGuideRequest } from "./routes-setup-enc2a.js";
17
18
  import { writeEmbedderEnv } from "./routes-setup-env-upsert.js";
18
19
  import { detectOllama, detectLlamaCpp, detectOnnx, memoizedDetectOllama, memoizedDetectLlamaCpp, memoizedDetectOnnx, } from "./routes-setup-detect-cache.js";
19
20
  // ---------------------------------------------------------------------------
@@ -60,6 +61,11 @@ export function handleSetupStatus(req, res, ctx) {
60
61
  }
61
62
  const configured = detectConfiguredEmbedder(ctx.stateDir);
62
63
  const active = detectCurrentEmbedder();
64
+ // ENC-2a (flag-gated, additive): the native install-guide + installed-version
65
+ // fields. Optional fields are added only when present/installable; when the
66
+ // flag is off readEnc2aGuide returns nulls so the body stays byte-identical
67
+ // to the ENC-1b-era shape.
68
+ const enc2a = readEnc2aGuide(ctx.stateDir);
63
69
  // ENC-1a (flag-gated, additive): echo the persisted endpoint URL and an
64
70
  // embeddingApiKeySet boolean ONLY — the raw API key is never returned. When
65
71
  // the flag is off (or neither is set) both fields are simply omitted.
@@ -73,6 +79,8 @@ export function handleSetupStatus(req, res, ctx) {
73
79
  minilm: ["1", "true", "yes"].includes((process.env["MEGACOMPACT_MINILM"] ?? "").trim().toLowerCase()),
74
80
  ...enc1aStatusFields(ctx.stateDir), ...enc1bStatusFields(ctx.stateDir),
75
81
  ...enc2BudgetStatusFields(ctx.stateDir),
82
+ ...(enc2a.guide !== null ? { nativeOrtInstallGuide: enc2a.guide } : {}),
83
+ ...(enc2a.installedVersion !== null ? { nativeOrtInstalledVersion: enc2a.installedVersion } : {}),
76
84
  };
77
85
  // guardrails-allow PREVENT-PI-004: loopback dashboard response (local)
78
86
  res.writeHead(200, { "Content-Type": "application/json" });
@@ -174,10 +182,28 @@ export function handleSetupConfigure(req, res, ctx) {
174
182
  return;
175
183
  }
176
184
  const body = parsed.value;
185
+ // ENC-2a guide-request key (flag-gated, additive): `false` → 400 (an
186
+ // operator-driven no-op — this sprint conveys the GUIDE only, no server
187
+ // execution), `true` → 200 + the guide echoed (still no execution; the
188
+ // execute path is ENC-2c). Flag-off: enc2aGuideRequest returns null so the
189
+ // key falls through unrecognized (byte-identical ENC-1b-era predecessor).
190
+ const guideReq = enc2aGuideRequest(body);
191
+ // guardrails-allow PREVENT-PI-004: loopback dashboard response (local)
192
+ if (guideReq !== null && guideReq.status === 400) {
193
+ res.writeHead(400, { "Content-Type": "application/json" });
194
+ res.end(JSON.stringify({ error: "guide_rejected_false_nothing_to_do" }));
195
+ return;
196
+ }
177
197
  // ENC-1a (flag-gated, additive): a pure external-embedder configure
178
198
  // (new keys, no embedder selection) is handled by the sibling writer.
179
199
  // Flag-off = the keys are simply not recognized, falling through to the
180
200
  // pre-ENC-1a embedder path below (byte-identical predecessor).
201
+ if (guideReq !== null && guideReq.status === 200) {
202
+ // guardrails-allow PREVENT-PI-004: loopback dashboard response (local)
203
+ res.writeHead(200, { "Content-Type": "application/json" });
204
+ res.end(JSON.stringify({ nativeOrtInstallGuide: readEnc2aGuide(ctx.stateDir).guide }));
205
+ return;
206
+ }
181
207
  if (tryEnc1aConfigure(body, res, ctx))
182
208
  return;
183
209
  if (tryEnc1bConfigure(body, res, ctx))
@@ -0,0 +1,35 @@
1
+ /**
2
+ * config/vector-cortex-enc2a.ts — ENC-2a native onnxruntime install-guide flag
3
+ * (operator run-script assist).
4
+ *
5
+ * Sibling of vector-cortex-enc1a.ts / vector-cortex-enc1b.ts /
6
+ * vector-cortex-enc2budget.ts so vector-cortex.ts stays under the 300-line soft
7
+ * limit (soft-as-hard gate). vector-cortex.ts re-exports the flag below and
8
+ * root src/config.ts re-exports it, so no consumer import path changes.
9
+ *
10
+ * ENC-2a, when the operator opted into the native backend
11
+ * (`MEGACOMPACT_ENCODER_NATIVE=1`) but `encoderBackend` is still `"wasm"`
12
+ * (onnxruntime-node absent / not yet installed), surfaces an "Encoder Runtime
13
+ * Install" card on the Cortex sub-tab with copy-paste operator commands: the
14
+ * install + restart + verify steps built ONLY from the artifacts-module
15
+ * constants (`src/vector-cortex/encoder/native-install-artifacts.ts`) — never
16
+ * an inline registry URL or hash in the route (PREVENT-PI-004). The guide
17
+ * renders only on an installable host platform; the ENC-0e darwin-x64 demotion
18
+ * sentinel keeps it absent on an Intel Mac (no native binding upstream).
19
+ *
20
+ * `MEGACOMPACT_ENC_2A=0` disables: no guide fields, no install card, no absent
21
+ * read — byte-identical to the ENC-1b predecessor. The flag MUST also be a
22
+ * dashboard SETTINGS toggle (visible in config UI, never in EXCLUDED_SETTINGS
23
+ * — see `feedback_dashboard-flags-toggleable` memory).
24
+ *
25
+ * Pi-agnostic, dependency-free (PREVENT-PI-004 / PREVENT-011).
26
+ */
27
+ import { sprintFlag } from "./vector-cortex-flag.js";
28
+ /**
29
+ * ENC-2a — operator run-script assist (dashboard install guide for the
30
+ * onnxruntime-node native binding). Default ON. `MEGACOMPACT_ENC_2A=0` disables
31
+ * and is byte-identical to the ENC-1b predecessor: no guide/absent fields, no
32
+ * install card. This flag MUST also be a dashboard SETTINGS toggle (visible in
33
+ * config UI, never in EXCLUDED_SETTINGS).
34
+ */
35
+ export const ENC_2A_ENABLED = () => sprintFlag("MEGACOMPACT_ENC_2A");
@@ -50,5 +50,7 @@ export { DASH_0D_ENABLED } from "./vector-cortex-dash-0d.js";
50
50
  export { ENC_1A_ENABLED } from "./vector-cortex-enc1a.js";
51
51
  export { ENC_1B_ENABLED, ENC_1B_MAX_EMBEDDING_DIM, ENC_1B_EMBEDDING_DIM_ENV, ENC_1B_EMBEDDING_HEADERS_ENV, ENC_1B_ALLOW_REMOTE_EMBEDDER_ENV, ENC_1B_ENCODER_NATIVE_ENV, } from "./vector-cortex-enc1b.js";
52
52
  export { ENC_2BUDGET_ENABLED, ENC_2BUDGET_NATIVE_ORT_BUDGET_ENV, ENC_2BUDGET_MAX_MIB, ENC_2BUDGET_DEFAULT_MIB, } from "./vector-cortex-enc2budget.js";
53
+ // ENC-2a native onnxruntime install-guide flag extracted to vector-cortex-enc2a.ts.
54
+ export { ENC_2A_ENABLED } from "./vector-cortex-enc2a.js";
53
55
  // Breaker constants (TRIAD_RESILIENCE.md §breaker) extracted to vector-cortex-breakers.ts.
54
56
  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";
@@ -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, 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, 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,43 @@
1
+ /**
2
+ * vector-cortex/encoder/native-install-artifacts.ts — ENC-2a native
3
+ * onnxruntime install-guide constants (PURE data module).
4
+ *
5
+ * Single source of truth for the operator's native-backend install guide
6
+ * (`onnxruntime-node`, the sole onnxruntime Node.js binding this extension's
7
+ * native path uses). The guide rendered by
8
+ * `extensions/dashboard-server/routes-setup-enc2a.ts` and the operator script
9
+ * `scripts/encoder/install-native-ort.mjs` build their commands/URLs ONLY from
10
+ * these scalars — never an inline registry URL or literal hash in the route or
11
+ * extension runtime (PREVENT-PI-004: the registry tarball URL is derived by
12
+ * callers from `NATIVE_ORT_PACKAGE` + "@" + `NATIVE_ORT_VERSION`, so no network
13
+ * path and no literal registry URL or scheme appears in src/).
14
+ *
15
+ * Package facts (verified, not invented):
16
+ * - onnxruntime-node publishes ONE monolithic ~100MB npm tarball — not
17
+ * per-platform `optionalDependencies` — so a single
18
+ * `NATIVE_ORT_TARBALL_SHA256` pins the whole artifact for every host.
19
+ * - darwin-x64 has NO native binding (arm64-only upstream since 1.17), so the
20
+ * guide stays absent on an Intel Mac (the ENC-0e demotion sentinel).
21
+ * - `NATIVE_ORT_TARBALL_SHA256` was computed from TWO independent downloads of
22
+ * the 1.27.0 tarball (real, cross-checked, not guessed).
23
+ *
24
+ * Pi-agnostic, dependency-free, pure data — zero I/O, zero network
25
+ * (PREVENT-PI-004 / PREVENT-011).
26
+ */
27
+ /** onnxruntime-node version the guide installs (real published version). */
28
+ export const NATIVE_ORT_VERSION = "1.27.0";
29
+ /** onnxruntime-node npm package name (the native onnxruntime binding). */
30
+ export const NATIVE_ORT_PACKAGE = "onnxruntime-node";
31
+ /** SHA-256 of the onnxruntime-node@1.27.0 npm tarball (one sha for all hosts).
32
+ * Computed from TWO independent tarball downloads; lowercase hex, 64 chars. */
33
+ export const NATIVE_ORT_TARBALL_SHA256 = "c3779c01c59832f8c03e2c392ac3af10bf08579f1822e8b1c63cc451edb302a2";
34
+ /**
35
+ * Platforms for which an operator install-guide can be rendered (native
36
+ * binding exists upstream). darwin-x64 is excluded — it has NO native binding.
37
+ */
38
+ export const NATIVE_ORT_INSTALLABLE_PLATFORMS = [
39
+ "linux-x64",
40
+ "linux-arm64",
41
+ "darwin-arm64",
42
+ "win32-x64",
43
+ ];
@@ -0,0 +1,43 @@
1
+ /**
2
+ * vector-cortex/encoder/native-install-artifacts.ts — ENC-2a native
3
+ * onnxruntime install-guide constants (PURE data module).
4
+ *
5
+ * Single source of truth for the operator's native-backend install guide
6
+ * (`onnxruntime-node`, the sole onnxruntime Node.js binding this extension's
7
+ * native path uses). The guide rendered by
8
+ * `extensions/dashboard-server/routes-setup-enc2a.ts` and the operator script
9
+ * `scripts/encoder/install-native-ort.mjs` build their commands/URLs ONLY from
10
+ * these scalars — never an inline registry URL or literal hash in the route or
11
+ * extension runtime (PREVENT-PI-004: the registry tarball URL is derived by
12
+ * callers from `NATIVE_ORT_PACKAGE` + "@" + `NATIVE_ORT_VERSION`, so no network
13
+ * path and no literal registry URL or scheme appears in src/).
14
+ *
15
+ * Package facts (verified, not invented):
16
+ * - onnxruntime-node publishes ONE monolithic ~100MB npm tarball — not
17
+ * per-platform `optionalDependencies` — so a single
18
+ * `NATIVE_ORT_TARBALL_SHA256` pins the whole artifact for every host.
19
+ * - darwin-x64 has NO native binding (arm64-only upstream since 1.17), so the
20
+ * guide stays absent on an Intel Mac (the ENC-0e demotion sentinel).
21
+ * - `NATIVE_ORT_TARBALL_SHA256` was computed from TWO independent downloads of
22
+ * the 1.27.0 tarball (real, cross-checked, not guessed).
23
+ *
24
+ * Pi-agnostic, dependency-free, pure data — zero I/O, zero network
25
+ * (PREVENT-PI-004 / PREVENT-011).
26
+ */
27
+ /** onnxruntime-node version the guide installs (real published version). */
28
+ export const NATIVE_ORT_VERSION = "1.27.0";
29
+ /** onnxruntime-node npm package name (the native onnxruntime binding). */
30
+ export const NATIVE_ORT_PACKAGE = "onnxruntime-node";
31
+ /** SHA-256 of the onnxruntime-node@1.27.0 npm tarball (one sha for all hosts).
32
+ * Computed from TWO independent tarball downloads; lowercase hex, 64 chars. */
33
+ export const NATIVE_ORT_TARBALL_SHA256 = "c3779c01c59832f8c03e2c392ac3af10bf08579f1822e8b1c63cc451edb302a2";
34
+ /**
35
+ * Platforms for which an operator install-guide can be rendered (native
36
+ * binding exists upstream). darwin-x64 is excluded — it has NO native binding.
37
+ */
38
+ export const NATIVE_ORT_INSTALLABLE_PLATFORMS = [
39
+ "linux-x64",
40
+ "linux-arm64",
41
+ "darwin-arm64",
42
+ "win32-x64",
43
+ ];
@@ -1,2 +1,2 @@
1
- import{r as s,u as o,e as c,j as e}from"./index-CeBW9Vtt.js";import{T as i}from"./toggle-CqpZacm5.js";import r from"./MaintenanceTab-Beb59xuJ.js";import{C as l}from"./ConfigTab-C1t0EM2H.js";import"./card-Cg_LPWdl.js";import"./button-BJiUJyhV.js";import"./switch-CmkMKtTG.js";const f="MEGACOMPACT_DASH_0C";function m(n){if(!n)return!1;for(const t of n.categories)for(const a of t.settings)if(a.key===f&&a.type==="boolean")return a.value===!0;return!1}function h(){const[n,t]=s.useState("maintenance"),{data:a}=o(s.useCallback(()=>c(),[]),{pollInterval:0,maxRetries:0});return m(a)?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",role:"tablist","aria-label":"Admin views",children:[e.jsx(i,{pressed:n==="maintenance",onClick:()=>t("maintenance"),children:"Maintenance"}),e.jsx(i,{pressed:n==="config",onClick:()=>t("config"),children:"Config"})]}),n==="maintenance"?e.jsx(r,{}):e.jsx(l,{})]}):e.jsx(r,{})}export{h as default};
2
- //# sourceMappingURL=AdminTab-DrJ9VWRu.js.map
1
+ import{r as s,u as o,e as c,j as e}from"./index-B4twCFnn.js";import{T as i}from"./toggle-uE-OSaba.js";import r from"./MaintenanceTab-6g3d-M1p.js";import{C as l}from"./ConfigTab-DDTqosv2.js";import"./card-Crs5SwRQ.js";import"./button-CvaPx9Bu.js";import"./switch-BXutQI5d.js";const f="MEGACOMPACT_DASH_0C";function m(n){if(!n)return!1;for(const t of n.categories)for(const a of t.settings)if(a.key===f&&a.type==="boolean")return a.value===!0;return!1}function h(){const[n,t]=s.useState("maintenance"),{data:a}=o(s.useCallback(()=>c(),[]),{pollInterval:0,maxRetries:0});return m(a)?e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",role:"tablist","aria-label":"Admin views",children:[e.jsx(i,{pressed:n==="maintenance",onClick:()=>t("maintenance"),children:"Maintenance"}),e.jsx(i,{pressed:n==="config",onClick:()=>t("config"),children:"Config"})]}),n==="maintenance"?e.jsx(r,{}):e.jsx(l,{})]}):e.jsx(r,{})}export{h as default};
2
+ //# sourceMappingURL=AdminTab-sjV8P5A4.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminTab-DrJ9VWRu.js","sources":["../../src/tabs/AdminTab.tsx"],"sourcesContent":["/**\n * dashboard-client/src/tabs/AdminTab.tsx — Admin tab (DASH-0c delegate-shell).\n *\n * DASH-0c: the Admin surface combines the maintenance actions with the config\n * editor. A `AdminViews` toggle (\"maintenance\" / \"config\") switches between\n * `MaintenanceTab` (the maintenance shell over MaintenanceTab/*) and `ConfigTab`\n * (the config editor). Both bodies are UNCHANGED — only their hosting changes to\n * this new delegate-shell. `MaintenanceTab.tsx` and `ConfigTab.tsx` stay importable\n * from their original hosts (`ConfigTab` also stays wired into SetupTab per the\n * dual-host note). Flag-ON renders the toggle + both views; flag-OFF renders only\n * the maintenance view (the predecessor's `admin → MaintenanceTab` mapping),\n * and App.tsx keeps its current TabId routing this sprint (DASH-0d rewires).\n *\n * Flag: `MEGACOMPACT_DASH_0C` default ON. The dashboard client is a browser\n * bundle with NO `process` global, so the positive sprint flag cannot be read\n * server-side-style (`process.env`) inside the client. Instead the flag is read\n * from the server-authoritative `/api/rag-settings` state: the server resolves\n * `process.env[\"MEGACOMPACT_DASH_0C\"] ?? default` into the `SettingState.value`\n * boolean.\n */\n\nimport type React from \"react\";\nimport { useCallback, useState } from \"react\";\nimport type { SettingsResponse } from \"@contracts\";\nimport { useApi } from \"../hooks/useApi\";\nimport { fetchSettings } from \"../api/client\";\nimport { Toggle } from \"../components/ui/toggle\";\nimport MaintenanceTab from \"./MaintenanceTab\";\nimport ConfigTab from \"./ConfigTab\";\n\nconst DASH_0C_KEY = \"MEGACOMPACT_DASH_0C\";\n\n/** Resolve the DASH-0c consolidation flag from the server settings state.\n * Absent/not-yet-loaded => false (flag-off posture), so flag-off users never\n * see the toggle flash; the toggle appears only once settings confirm it is ON. */\nfunction dash0cEnabled(settings: SettingsResponse | null): boolean {\n\tif (!settings) return false;\n\tfor (const cat of settings.categories) {\n\t\tfor (const s of cat.settings) {\n\t\t\tif (s.key === DASH_0C_KEY && s.type === \"boolean\") return s.value === true;\n\t\t}\n\t}\n\treturn false;\n}\n\ntype AdminViews = \"maintenance\" | \"config\";\n\nexport default function AdminTab(): React.ReactElement {\n\tconst [view, setView] = useState<AdminViews>(\"maintenance\");\n\n\tconst { data: settingsData } = useApi<SettingsResponse>(\n\t\tuseCallback(() => fetchSettings(), []),\n\t\t{ pollInterval: 0, maxRetries: 0 },\n\t);\n\tconst dash0cOn = dash0cEnabled(settingsData);\n\n\tif (!dash0cOn) {\n\t\treturn <MaintenanceTab />;\n\t}\n\n\treturn (\n\t\t<div className=\"flex flex-col gap-4\">\n\t\t\t<div\n\t\t\t\tclassName=\"flex items-center gap-2\"\n\t\t\t\trole=\"tablist\"\n\t\t\t\taria-label=\"Admin views\"\n\t\t\t>\n\t\t\t\t<Toggle\n\t\t\t\t\tpressed={view === \"maintenance\"}\n\t\t\t\t\tonClick={() => setView(\"maintenance\")}\n\t\t\t\t>\n\t\t\t\t\tMaintenance\n\t\t\t\t</Toggle>\n\t\t\t\t<Toggle pressed={view === \"config\"} onClick={() => setView(\"config\")}>\n\t\t\t\t\tConfig\n\t\t\t\t</Toggle>\n\t\t\t</div>\n\t\t\t{view === \"maintenance\" ? <MaintenanceTab /> : <ConfigTab />}\n\t\t</div>\n\t);\n}\n"],"names":["DASH_0C_KEY","dash0cEnabled","settings","cat","s","AdminTab","view","setView","useState","settingsData","useApi","useCallback","fetchSettings","jsxs","jsx","Toggle","MaintenanceTab","ConfigTab"],"mappings":"mRA8BA,MAAMA,EAAc,sBAKpB,SAASC,EAAcC,EAA4C,CAClE,GAAI,CAACA,EAAU,MAAO,GACtB,UAAWC,KAAOD,EAAS,WAC1B,UAAWE,KAAKD,EAAI,SACnB,GAAIC,EAAE,MAAQJ,GAAeI,EAAE,OAAS,UAAW,OAAOA,EAAE,QAAU,GAGxE,MAAO,EACR,CAIA,SAAwBC,GAA+B,CACtD,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAAqB,aAAa,EAEpD,CAAE,KAAMC,CAAA,EAAiBC,EAC9BC,cAAY,IAAMC,EAAA,EAAiB,EAAE,EACrC,CAAE,aAAc,EAAG,WAAY,CAAA,CAAE,EAIlC,OAFiBX,EAAcQ,CAAY,EAO1CI,EAAAA,KAAC,MAAA,CAAI,UAAU,sBACd,SAAA,CAAAA,EAAAA,KAAC,MAAA,CACA,UAAU,0BACV,KAAK,UACL,aAAW,cAEX,SAAA,CAAAC,EAAAA,IAACC,EAAA,CACA,QAAST,IAAS,cAClB,QAAS,IAAMC,EAAQ,aAAa,EACpC,SAAA,aAAA,CAAA,EAGDO,EAAAA,IAACC,EAAA,CAAO,QAAST,IAAS,SAAU,QAAS,IAAMC,EAAQ,QAAQ,EAAG,SAAA,QAAA,CAEtE,CAAA,CAAA,CAAA,EAEAD,IAAS,cAAgBQ,MAACE,EAAA,CAAA,CAAe,QAAMC,EAAA,CAAA,CAAU,CAAA,EAC3D,QArBQD,EAAA,EAAe,CAuBzB"}
1
+ {"version":3,"file":"AdminTab-sjV8P5A4.js","sources":["../../src/tabs/AdminTab.tsx"],"sourcesContent":["/**\n * dashboard-client/src/tabs/AdminTab.tsx — Admin tab (DASH-0c delegate-shell).\n *\n * DASH-0c: the Admin surface combines the maintenance actions with the config\n * editor. A `AdminViews` toggle (\"maintenance\" / \"config\") switches between\n * `MaintenanceTab` (the maintenance shell over MaintenanceTab/*) and `ConfigTab`\n * (the config editor). Both bodies are UNCHANGED — only their hosting changes to\n * this new delegate-shell. `MaintenanceTab.tsx` and `ConfigTab.tsx` stay importable\n * from their original hosts (`ConfigTab` also stays wired into SetupTab per the\n * dual-host note). Flag-ON renders the toggle + both views; flag-OFF renders only\n * the maintenance view (the predecessor's `admin → MaintenanceTab` mapping),\n * and App.tsx keeps its current TabId routing this sprint (DASH-0d rewires).\n *\n * Flag: `MEGACOMPACT_DASH_0C` default ON. The dashboard client is a browser\n * bundle with NO `process` global, so the positive sprint flag cannot be read\n * server-side-style (`process.env`) inside the client. Instead the flag is read\n * from the server-authoritative `/api/rag-settings` state: the server resolves\n * `process.env[\"MEGACOMPACT_DASH_0C\"] ?? default` into the `SettingState.value`\n * boolean.\n */\n\nimport type React from \"react\";\nimport { useCallback, useState } from \"react\";\nimport type { SettingsResponse } from \"@contracts\";\nimport { useApi } from \"../hooks/useApi\";\nimport { fetchSettings } from \"../api/client\";\nimport { Toggle } from \"../components/ui/toggle\";\nimport MaintenanceTab from \"./MaintenanceTab\";\nimport ConfigTab from \"./ConfigTab\";\n\nconst DASH_0C_KEY = \"MEGACOMPACT_DASH_0C\";\n\n/** Resolve the DASH-0c consolidation flag from the server settings state.\n * Absent/not-yet-loaded => false (flag-off posture), so flag-off users never\n * see the toggle flash; the toggle appears only once settings confirm it is ON. */\nfunction dash0cEnabled(settings: SettingsResponse | null): boolean {\n\tif (!settings) return false;\n\tfor (const cat of settings.categories) {\n\t\tfor (const s of cat.settings) {\n\t\t\tif (s.key === DASH_0C_KEY && s.type === \"boolean\") return s.value === true;\n\t\t}\n\t}\n\treturn false;\n}\n\ntype AdminViews = \"maintenance\" | \"config\";\n\nexport default function AdminTab(): React.ReactElement {\n\tconst [view, setView] = useState<AdminViews>(\"maintenance\");\n\n\tconst { data: settingsData } = useApi<SettingsResponse>(\n\t\tuseCallback(() => fetchSettings(), []),\n\t\t{ pollInterval: 0, maxRetries: 0 },\n\t);\n\tconst dash0cOn = dash0cEnabled(settingsData);\n\n\tif (!dash0cOn) {\n\t\treturn <MaintenanceTab />;\n\t}\n\n\treturn (\n\t\t<div className=\"flex flex-col gap-4\">\n\t\t\t<div\n\t\t\t\tclassName=\"flex items-center gap-2\"\n\t\t\t\trole=\"tablist\"\n\t\t\t\taria-label=\"Admin views\"\n\t\t\t>\n\t\t\t\t<Toggle\n\t\t\t\t\tpressed={view === \"maintenance\"}\n\t\t\t\t\tonClick={() => setView(\"maintenance\")}\n\t\t\t\t>\n\t\t\t\t\tMaintenance\n\t\t\t\t</Toggle>\n\t\t\t\t<Toggle pressed={view === \"config\"} onClick={() => setView(\"config\")}>\n\t\t\t\t\tConfig\n\t\t\t\t</Toggle>\n\t\t\t</div>\n\t\t\t{view === \"maintenance\" ? <MaintenanceTab /> : <ConfigTab />}\n\t\t</div>\n\t);\n}\n"],"names":["DASH_0C_KEY","dash0cEnabled","settings","cat","s","AdminTab","view","setView","useState","settingsData","useApi","useCallback","fetchSettings","jsxs","jsx","Toggle","MaintenanceTab","ConfigTab"],"mappings":"mRA8BA,MAAMA,EAAc,sBAKpB,SAASC,EAAcC,EAA4C,CAClE,GAAI,CAACA,EAAU,MAAO,GACtB,UAAWC,KAAOD,EAAS,WAC1B,UAAWE,KAAKD,EAAI,SACnB,GAAIC,EAAE,MAAQJ,GAAeI,EAAE,OAAS,UAAW,OAAOA,EAAE,QAAU,GAGxE,MAAO,EACR,CAIA,SAAwBC,GAA+B,CACtD,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAAqB,aAAa,EAEpD,CAAE,KAAMC,CAAA,EAAiBC,EAC9BC,cAAY,IAAMC,EAAA,EAAiB,EAAE,EACrC,CAAE,aAAc,EAAG,WAAY,CAAA,CAAE,EAIlC,OAFiBX,EAAcQ,CAAY,EAO1CI,EAAAA,KAAC,MAAA,CAAI,UAAU,sBACd,SAAA,CAAAA,EAAAA,KAAC,MAAA,CACA,UAAU,0BACV,KAAK,UACL,aAAW,cAEX,SAAA,CAAAC,EAAAA,IAACC,EAAA,CACA,QAAST,IAAS,cAClB,QAAS,IAAMC,EAAQ,aAAa,EACpC,SAAA,aAAA,CAAA,EAGDO,EAAAA,IAACC,EAAA,CAAO,QAAST,IAAS,SAAU,QAAS,IAAMC,EAAQ,QAAQ,EAAG,SAAA,QAAA,CAEtE,CAAA,CAAA,CAAA,EAEAD,IAAS,cAAgBQ,MAACE,EAAA,CAAA,CAAe,QAAMC,EAAA,CAAA,CAAU,CAAA,EAC3D,QArBQD,EAAA,EAAe,CAuBzB"}
@@ -1,2 +1,2 @@
1
- import{b as R,c as W,m as T,i as C,d as F,A as ie,e as B,h as q,j as oe,k as G,l as se,n as le,u as ue,o as K,G as ce,p as J,q as Q,D as fe,g as pe,X as he,Y as de,f as me}from"./generateCategoricalChart-sE5oI3Ee.js";import{R as p,J as ee,r as ve}from"./index-CeBW9Vtt.js";var ye=["layout","type","stroke","connectNulls","isRange","ref"],be=["key"],te;function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}function ae(e,t){if(e==null)return{};var r=Ae(e,t),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ae(e,t){if(e==null)return{};var r={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;r[a]=e[a]}return r}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},D.apply(this,arguments)}function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(a){E(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,ne(a.key),a)}}function xe(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pe(e,t,r){return t=$(t),Oe(e,re()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}function Oe(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(e)}function Ee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(re=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$(e)}function we(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&X(e,t)}function X(e,t){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},X(e,t)}function E(e,t,r){return t=ne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=_e(e,"string");return M(t)=="symbol"?t:t+""}function _e(e,t){if(M(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(M(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var L=function(e){function t(){var r;ge(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=Pe(this,t,[].concat(n)),E(r,"state",{isAnimationFinished:!0}),E(r,"id",ue("recharts-area-")),E(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),K(o)&&o()}),E(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),K(o)&&o()}),r}return we(t,e),xe(t,[{key:"renderDots",value:function(a,n,i){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var u=this.props,l=u.dot,f=u.points,c=u.dataKey,h=R(this.props,!1),A=R(l,!0),g=f.map(function(v,O){var y=S(S(S({key:"dot-".concat(O),r:3},h),A),{},{index:O,cx:v.x,cy:v.y,dataKey:c,value:v.value,payload:v.payload,points:f});return t.renderDotItem(l,y)}),x={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return p.createElement(W,D({className:"recharts-area-dots"},x),g)}},{key:"renderHorizontalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].x,l=o[o.length-1].x,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.y||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.y||0})),c)),C(c)?p.createElement("rect",{x:u<l?u:u-f,y:0,width:f,height:Math.floor(c+(s?parseInt("".concat(s),10):1))}):null}},{key:"renderVerticalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].y,l=o[o.length-1].y,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.x||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.x||0})),c)),C(c)?p.createElement("rect",{x:0,y:u<l?u:u-f,width:c+(s?parseInt("".concat(s),10):1),height:Math.floor(f)}):null}},{key:"renderClipRect",value:function(a){var n=this.props.layout;return n==="vertical"?this.renderVerticalRect(a):this.renderHorizontalRect(a)}},{key:"renderAreaStatically",value:function(a,n,i,o){var s=this.props,u=s.layout,l=s.type,f=s.stroke,c=s.connectNulls,h=s.isRange;s.ref;var A=ae(s,ye);return p.createElement(W,{clipPath:i?"url(#clipPath-".concat(o,")"):null},p.createElement(F,D({},R(A,!0),{points:a,connectNulls:c,type:l,baseLine:n,layout:u,stroke:"none",className:"recharts-area-area"})),f!=="none"&&p.createElement(F,D({},R(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:c,fill:"none",points:a})),f!=="none"&&h&&p.createElement(F,D({},R(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:c,fill:"none",points:n})))}},{key:"renderAreaWithAnimation",value:function(a,n){var i=this,o=this.props,s=o.points,u=o.baseLine,l=o.isAnimationActive,f=o.animationBegin,c=o.animationDuration,h=o.animationEasing,A=o.animationId,g=this.state,x=g.prevPoints,v=g.prevBaseLine;return p.createElement(ie,{begin:f,duration:c,isActive:l,easing:h,from:{t:0},to:{t:1},key:"area-".concat(A),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(O){var y=O.t;if(x){var _=x.length/s.length,d=s.map(function(P,N){var k=Math.floor(N*_);if(x[k]){var j=x[k],I=B(j.x,P.x),V=B(j.y,P.y);return S(S({},P),{},{x:I(y),y:V(y)})}return P}),m;if(C(u)&&typeof u=="number"){var b=B(v,u);m=b(y)}else if(q(u)||oe(u)){var w=B(v,0);m=w(y)}else m=u.map(function(P,N){var k=Math.floor(N*_);if(v[k]){var j=v[k],I=B(j.x,P.x),V=B(j.y,P.y);return S(S({},P),{},{x:I(y),y:V(y)})}return P});return i.renderAreaStatically(d,m,a,n)}return p.createElement(W,null,p.createElement("defs",null,p.createElement("clipPath",{id:"animationClipPath-".concat(n)},i.renderClipRect(y))),p.createElement(W,{clipPath:"url(#animationClipPath-".concat(n,")")},i.renderAreaStatically(s,u,a,n)))})}},{key:"renderArea",value:function(a,n){var i=this.props,o=i.points,s=i.baseLine,u=i.isAnimationActive,l=this.state,f=l.prevPoints,c=l.prevBaseLine,h=l.totalLength;return u&&o&&o.length&&(!f&&h>0||!G(f,o)||!G(c,s))?this.renderAreaWithAnimation(a,n):this.renderAreaStatically(o,s,a,n)}},{key:"render",value:function(){var a,n=this.props,i=n.hide,o=n.dot,s=n.points,u=n.className,l=n.top,f=n.left,c=n.xAxis,h=n.yAxis,A=n.width,g=n.height,x=n.isAnimationActive,v=n.id;if(i||!s||!s.length)return null;var O=this.state.isAnimationFinished,y=s.length===1,_=ee("recharts-area",u),d=c&&c.allowDataOverflow,m=h&&h.allowDataOverflow,b=d||m,w=q(v)?this.id:v,P=(a=R(o,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},N=P.r,k=N===void 0?3:N,j=P.strokeWidth,I=j===void 0?2:j,V=se(o)?o:{},Y=V.clipDot,H=Y===void 0?!0:Y,z=k*2+I;return p.createElement(W,{className:_},d||m?p.createElement("defs",null,p.createElement("clipPath",{id:"clipPath-".concat(w)},p.createElement("rect",{x:d?f:f-A/2,y:m?l:l-g/2,width:d?A:A*2,height:m?g:g*2})),!H&&p.createElement("clipPath",{id:"clipPath-dots-".concat(w)},p.createElement("rect",{x:f-z/2,y:l-z/2,width:A+z,height:g+z}))):null,y?null:this.renderArea(b,w),(o||y)&&this.renderDots(b,H,w),(!x||O)&&le.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(a,n){return a.animationId!==n.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,curBaseLine:a.baseLine,prevPoints:n.curPoints,prevBaseLine:n.curBaseLine}:a.points!==n.curPoints||a.baseLine!==n.curBaseLine?{curPoints:a.points,curBaseLine:a.baseLine}:null}}])}(ve.PureComponent);te=L;E(L,"displayName","Area");E(L,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ce.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});E(L,"getBaseValue",function(e,t,r,a){var n=e.layout,i=e.baseValue,o=t.props.baseValue,s=o??i;if(C(s)&&typeof s=="number")return s;var u=n==="horizontal"?a:r,l=u.scale.domain();if(u.type==="number"){var f=Math.max(l[0],l[1]),c=Math.min(l[0],l[1]);return s==="dataMin"?c:s==="dataMax"||f<0?f:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]});E(L,"getComposedData",function(e){var t=e.props,r=e.item,a=e.xAxis,n=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,s=e.bandSize,u=e.dataKey,l=e.stackedData,f=e.dataStartIndex,c=e.displayedData,h=e.offset,A=t.layout,g=l&&l.length,x=te.getBaseValue(t,r,a,n),v=A==="horizontal",O=!1,y=c.map(function(d,m){var b;g?b=l[f+m]:(b=J(d,u),Array.isArray(b)?O=!0:b=[x,b]);var w=b[1]==null||g&&J(d,u)==null;return v?{x:Q({axis:a,ticks:i,bandSize:s,entry:d,index:m}),y:w?null:n.scale(b[1]),value:b,payload:d}:{x:w?null:a.scale(b[1]),y:Q({axis:n,ticks:o,bandSize:s,entry:d,index:m}),value:b,payload:d}}),_;return g||O?_=y.map(function(d){var m=Array.isArray(d.value)?d.value[0]:null;return v?{x:d.x,y:m!=null&&d.y!=null?n.scale(m):null}:{x:m!=null?a.scale(m):null,y:d.y}}):_=v?n.scale(x):a.scale(x),S({points:y,baseLine:_,layout:A,isRange:O},h)});E(L,"renderDotItem",function(e,t){var r;if(p.isValidElement(e))r=p.cloneElement(e,t);else if(K(e))r=e(t);else{var a=ee("recharts-area-dot",typeof e!="boolean"?e.className:""),n=t.key,i=ae(t,be);r=p.createElement(fe,D({},i,{key:n,className:a}))}return r});var ke=pe({chartName:"AreaChart",GraphicalChild:L,axisComponents:[{axisType:"xAxis",AxisComp:he},{axisType:"yAxis",AxisComp:de}],formatAxisMap:me});export{ke as A,L as a};
2
- //# sourceMappingURL=AreaChart-B1OkLRGT.js.map
1
+ import{b as R,c as W,m as T,i as C,d as F,A as ie,e as B,h as q,j as oe,k as G,l as se,n as le,u as ue,o as K,G as ce,p as J,q as Q,D as fe,g as pe,X as he,Y as de,f as me}from"./generateCategoricalChart-qnHql9Es.js";import{R as p,J as ee,r as ve}from"./index-B4twCFnn.js";var ye=["layout","type","stroke","connectNulls","isRange","ref"],be=["key"],te;function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}function ae(e,t){if(e==null)return{};var r=Ae(e,t),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ae(e,t){if(e==null)return{};var r={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;r[a]=e[a]}return r}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},D.apply(this,arguments)}function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(a){E(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,ne(a.key),a)}}function xe(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pe(e,t,r){return t=$(t),Oe(e,re()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}function Oe(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(e)}function Ee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(re=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$(e)}function we(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&X(e,t)}function X(e,t){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},X(e,t)}function E(e,t,r){return t=ne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=_e(e,"string");return M(t)=="symbol"?t:t+""}function _e(e,t){if(M(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(M(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var L=function(e){function t(){var r;ge(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=Pe(this,t,[].concat(n)),E(r,"state",{isAnimationFinished:!0}),E(r,"id",ue("recharts-area-")),E(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),K(o)&&o()}),E(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),K(o)&&o()}),r}return we(t,e),xe(t,[{key:"renderDots",value:function(a,n,i){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var u=this.props,l=u.dot,f=u.points,c=u.dataKey,h=R(this.props,!1),A=R(l,!0),g=f.map(function(v,O){var y=S(S(S({key:"dot-".concat(O),r:3},h),A),{},{index:O,cx:v.x,cy:v.y,dataKey:c,value:v.value,payload:v.payload,points:f});return t.renderDotItem(l,y)}),x={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return p.createElement(W,D({className:"recharts-area-dots"},x),g)}},{key:"renderHorizontalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].x,l=o[o.length-1].x,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.y||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.y||0})),c)),C(c)?p.createElement("rect",{x:u<l?u:u-f,y:0,width:f,height:Math.floor(c+(s?parseInt("".concat(s),10):1))}):null}},{key:"renderVerticalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].y,l=o[o.length-1].y,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.x||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.x||0})),c)),C(c)?p.createElement("rect",{x:0,y:u<l?u:u-f,width:c+(s?parseInt("".concat(s),10):1),height:Math.floor(f)}):null}},{key:"renderClipRect",value:function(a){var n=this.props.layout;return n==="vertical"?this.renderVerticalRect(a):this.renderHorizontalRect(a)}},{key:"renderAreaStatically",value:function(a,n,i,o){var s=this.props,u=s.layout,l=s.type,f=s.stroke,c=s.connectNulls,h=s.isRange;s.ref;var A=ae(s,ye);return p.createElement(W,{clipPath:i?"url(#clipPath-".concat(o,")"):null},p.createElement(F,D({},R(A,!0),{points:a,connectNulls:c,type:l,baseLine:n,layout:u,stroke:"none",className:"recharts-area-area"})),f!=="none"&&p.createElement(F,D({},R(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:c,fill:"none",points:a})),f!=="none"&&h&&p.createElement(F,D({},R(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:c,fill:"none",points:n})))}},{key:"renderAreaWithAnimation",value:function(a,n){var i=this,o=this.props,s=o.points,u=o.baseLine,l=o.isAnimationActive,f=o.animationBegin,c=o.animationDuration,h=o.animationEasing,A=o.animationId,g=this.state,x=g.prevPoints,v=g.prevBaseLine;return p.createElement(ie,{begin:f,duration:c,isActive:l,easing:h,from:{t:0},to:{t:1},key:"area-".concat(A),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(O){var y=O.t;if(x){var _=x.length/s.length,d=s.map(function(P,N){var k=Math.floor(N*_);if(x[k]){var j=x[k],I=B(j.x,P.x),V=B(j.y,P.y);return S(S({},P),{},{x:I(y),y:V(y)})}return P}),m;if(C(u)&&typeof u=="number"){var b=B(v,u);m=b(y)}else if(q(u)||oe(u)){var w=B(v,0);m=w(y)}else m=u.map(function(P,N){var k=Math.floor(N*_);if(v[k]){var j=v[k],I=B(j.x,P.x),V=B(j.y,P.y);return S(S({},P),{},{x:I(y),y:V(y)})}return P});return i.renderAreaStatically(d,m,a,n)}return p.createElement(W,null,p.createElement("defs",null,p.createElement("clipPath",{id:"animationClipPath-".concat(n)},i.renderClipRect(y))),p.createElement(W,{clipPath:"url(#animationClipPath-".concat(n,")")},i.renderAreaStatically(s,u,a,n)))})}},{key:"renderArea",value:function(a,n){var i=this.props,o=i.points,s=i.baseLine,u=i.isAnimationActive,l=this.state,f=l.prevPoints,c=l.prevBaseLine,h=l.totalLength;return u&&o&&o.length&&(!f&&h>0||!G(f,o)||!G(c,s))?this.renderAreaWithAnimation(a,n):this.renderAreaStatically(o,s,a,n)}},{key:"render",value:function(){var a,n=this.props,i=n.hide,o=n.dot,s=n.points,u=n.className,l=n.top,f=n.left,c=n.xAxis,h=n.yAxis,A=n.width,g=n.height,x=n.isAnimationActive,v=n.id;if(i||!s||!s.length)return null;var O=this.state.isAnimationFinished,y=s.length===1,_=ee("recharts-area",u),d=c&&c.allowDataOverflow,m=h&&h.allowDataOverflow,b=d||m,w=q(v)?this.id:v,P=(a=R(o,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},N=P.r,k=N===void 0?3:N,j=P.strokeWidth,I=j===void 0?2:j,V=se(o)?o:{},Y=V.clipDot,H=Y===void 0?!0:Y,z=k*2+I;return p.createElement(W,{className:_},d||m?p.createElement("defs",null,p.createElement("clipPath",{id:"clipPath-".concat(w)},p.createElement("rect",{x:d?f:f-A/2,y:m?l:l-g/2,width:d?A:A*2,height:m?g:g*2})),!H&&p.createElement("clipPath",{id:"clipPath-dots-".concat(w)},p.createElement("rect",{x:f-z/2,y:l-z/2,width:A+z,height:g+z}))):null,y?null:this.renderArea(b,w),(o||y)&&this.renderDots(b,H,w),(!x||O)&&le.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(a,n){return a.animationId!==n.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,curBaseLine:a.baseLine,prevPoints:n.curPoints,prevBaseLine:n.curBaseLine}:a.points!==n.curPoints||a.baseLine!==n.curBaseLine?{curPoints:a.points,curBaseLine:a.baseLine}:null}}])}(ve.PureComponent);te=L;E(L,"displayName","Area");E(L,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ce.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});E(L,"getBaseValue",function(e,t,r,a){var n=e.layout,i=e.baseValue,o=t.props.baseValue,s=o??i;if(C(s)&&typeof s=="number")return s;var u=n==="horizontal"?a:r,l=u.scale.domain();if(u.type==="number"){var f=Math.max(l[0],l[1]),c=Math.min(l[0],l[1]);return s==="dataMin"?c:s==="dataMax"||f<0?f:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]});E(L,"getComposedData",function(e){var t=e.props,r=e.item,a=e.xAxis,n=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,s=e.bandSize,u=e.dataKey,l=e.stackedData,f=e.dataStartIndex,c=e.displayedData,h=e.offset,A=t.layout,g=l&&l.length,x=te.getBaseValue(t,r,a,n),v=A==="horizontal",O=!1,y=c.map(function(d,m){var b;g?b=l[f+m]:(b=J(d,u),Array.isArray(b)?O=!0:b=[x,b]);var w=b[1]==null||g&&J(d,u)==null;return v?{x:Q({axis:a,ticks:i,bandSize:s,entry:d,index:m}),y:w?null:n.scale(b[1]),value:b,payload:d}:{x:w?null:a.scale(b[1]),y:Q({axis:n,ticks:o,bandSize:s,entry:d,index:m}),value:b,payload:d}}),_;return g||O?_=y.map(function(d){var m=Array.isArray(d.value)?d.value[0]:null;return v?{x:d.x,y:m!=null&&d.y!=null?n.scale(m):null}:{x:m!=null?a.scale(m):null,y:d.y}}):_=v?n.scale(x):a.scale(x),S({points:y,baseLine:_,layout:A,isRange:O},h)});E(L,"renderDotItem",function(e,t){var r;if(p.isValidElement(e))r=p.cloneElement(e,t);else if(K(e))r=e(t);else{var a=ee("recharts-area-dot",typeof e!="boolean"?e.className:""),n=t.key,i=ae(t,be);r=p.createElement(fe,D({},i,{key:n,className:a}))}return r});var ke=pe({chartName:"AreaChart",GraphicalChild:L,axisComponents:[{axisType:"xAxis",AxisComp:he},{axisType:"yAxis",AxisComp:de}],formatAxisMap:me});export{ke as A,L as a};
2
+ //# sourceMappingURL=AreaChart-C03yuld4.js.map