pi-mega-compact 0.20.26 → 0.20.27

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 (72) hide show
  1. package/dist/config/vector-cortex-vc9a.js +29 -0
  2. package/dist/config/vector-cortex.js +4 -0
  3. package/dist/config.js +1 -1
  4. package/dist/extensions/dashboard-server/api-contracts/endpoints/registry-ext.js +7 -0
  5. package/dist/extensions/dashboard-server/api-contracts/setup-cortex.js +12 -0
  6. package/dist/extensions/dashboard-server/route-dispatch.js +3 -1
  7. package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +1 -0
  8. package/dist/extensions/dashboard-server/routes-setup-cortex.js +143 -0
  9. package/dist/extensions/dashboard-server/routes.js +1 -0
  10. package/dist/extensions/dashboard-server/setup-cortex-blockers.js +53 -0
  11. package/dist/src/config/vector-cortex-vc9a.js +29 -0
  12. package/dist/src/config/vector-cortex.js +4 -0
  13. package/dist/src/config.js +1 -1
  14. package/extensions/dashboard-client/dist/assets/{AreaChart-DRErPez1.js → AreaChart-Bl8FQm-w.js} +2 -2
  15. package/extensions/dashboard-client/dist/assets/{AreaChart-DRErPez1.js.map → AreaChart-Bl8FQm-w.js.map} +1 -1
  16. package/extensions/dashboard-client/dist/assets/{BarChart-Cwxel3M7.js → BarChart-BXn1a_v9.js} +2 -2
  17. package/extensions/dashboard-client/dist/assets/{BarChart-Cwxel3M7.js.map → BarChart-BXn1a_v9.js.map} +1 -1
  18. package/extensions/dashboard-client/dist/assets/{CacheTab-D4j3vwFu.js → CacheTab-DzZpIHkZ.js} +2 -2
  19. package/extensions/dashboard-client/dist/assets/{CacheTab-D4j3vwFu.js.map → CacheTab-DzZpIHkZ.js.map} +1 -1
  20. package/extensions/dashboard-client/dist/assets/{EventsTab-BA7t_fsH.js → EventsTab-rn_Ncwk0.js} +2 -2
  21. package/extensions/dashboard-client/dist/assets/{EventsTab-BA7t_fsH.js.map → EventsTab-rn_Ncwk0.js.map} +1 -1
  22. package/extensions/dashboard-client/dist/assets/{HealthTab-Ci9gtYDP.js → HealthTab-D4d20PFh.js} +2 -2
  23. package/extensions/dashboard-client/dist/assets/{HealthTab-Ci9gtYDP.js.map → HealthTab-D4d20PFh.js.map} +1 -1
  24. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-BeqWn-xu.js → MaintenanceTab-44lwue_H.js} +2 -2
  25. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-BeqWn-xu.js.map → MaintenanceTab-44lwue_H.js.map} +1 -1
  26. package/extensions/dashboard-client/dist/assets/{MemoryMapTab-BreZegCV.js → MemoryMapTab-BPCPyPqp.js} +2 -2
  27. package/extensions/dashboard-client/dist/assets/{MemoryMapTab-BreZegCV.js.map → MemoryMapTab-BPCPyPqp.js.map} +1 -1
  28. package/extensions/dashboard-client/dist/assets/{MetricsTab-DLbgfJT2.js → MetricsTab-B1is6D7F.js} +2 -2
  29. package/extensions/dashboard-client/dist/assets/{MetricsTab-DLbgfJT2.js.map → MetricsTab-B1is6D7F.js.map} +1 -1
  30. package/extensions/dashboard-client/dist/assets/{OverviewTab-BtcXdrnC.js → OverviewTab-DIC_cUjS.js} +2 -2
  31. package/extensions/dashboard-client/dist/assets/{OverviewTab-BtcXdrnC.js.map → OverviewTab-DIC_cUjS.js.map} +1 -1
  32. package/extensions/dashboard-client/dist/assets/{ReposTab-DpDLEzV9.js → ReposTab-KhTQqt5Z.js} +2 -2
  33. package/extensions/dashboard-client/dist/assets/{ReposTab-DpDLEzV9.js.map → ReposTab-KhTQqt5Z.js.map} +1 -1
  34. package/extensions/dashboard-client/dist/assets/{SessionsTab-CMe5jSrZ.js → SessionsTab-CeOUPRIM.js} +2 -2
  35. package/extensions/dashboard-client/dist/assets/{SessionsTab-CMe5jSrZ.js.map → SessionsTab-CeOUPRIM.js.map} +1 -1
  36. package/extensions/dashboard-client/dist/assets/{SetupTab-C3OY8mc7.js → SetupTab-DnN0mX0J.js} +2 -2
  37. package/extensions/dashboard-client/dist/assets/{SetupTab-C3OY8mc7.js.map → SetupTab-DnN0mX0J.js.map} +1 -1
  38. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BFPJUQzs.js → TimeSavedCard-CXmxE5_8.js} +2 -2
  39. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BFPJUQzs.js.map → TimeSavedCard-CXmxE5_8.js.map} +1 -1
  40. package/extensions/dashboard-client/dist/assets/{TurnsTab-Ujt29pKI.js → TurnsTab-Dbx9pZPX.js} +2 -2
  41. package/extensions/dashboard-client/dist/assets/{TurnsTab-Ujt29pKI.js.map → TurnsTab-Dbx9pZPX.js.map} +1 -1
  42. package/extensions/dashboard-client/dist/assets/{VectorCortexTab-CfxZW91A.js → VectorCortexTab-MzqdB6zI.js} +2 -2
  43. package/extensions/dashboard-client/dist/assets/{VectorCortexTab-CfxZW91A.js.map → VectorCortexTab-MzqdB6zI.js.map} +1 -1
  44. package/extensions/dashboard-client/dist/assets/{WikiTab-BiKXVwGT.js → WikiTab-B1mKp1SA.js} +2 -2
  45. package/extensions/dashboard-client/dist/assets/{WikiTab-BiKXVwGT.js.map → WikiTab-B1mKp1SA.js.map} +1 -1
  46. package/extensions/dashboard-client/dist/assets/{button-DJwGcw0u.js → button-BFHPDVb1.js} +2 -2
  47. package/extensions/dashboard-client/dist/assets/{button-DJwGcw0u.js.map → button-BFHPDVb1.js.map} +1 -1
  48. package/extensions/dashboard-client/dist/assets/{card-CgjBf5LZ.js → card-XrbSJiOF.js} +2 -2
  49. package/extensions/dashboard-client/dist/assets/{card-CgjBf5LZ.js.map → card-XrbSJiOF.js.map} +1 -1
  50. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-CTQIl2qs.js → generateCategoricalChart-B9Ba91Tu.js} +2 -2
  51. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-CTQIl2qs.js.map → generateCategoricalChart-B9Ba91Tu.js.map} +1 -1
  52. package/extensions/dashboard-client/dist/assets/{index-Bu8CZUMX.js → index-P13AO5ni.js} +4 -4
  53. package/extensions/dashboard-client/dist/assets/index-P13AO5ni.js.map +1 -0
  54. package/extensions/dashboard-client/dist/assets/{switch-uUiS1Raq.js → switch-jnYDePmb.js} +2 -2
  55. package/extensions/dashboard-client/dist/assets/{switch-uUiS1Raq.js.map → switch-jnYDePmb.js.map} +1 -1
  56. package/extensions/dashboard-client/dist/assets/{toggle-Dv3OEscH.js → toggle-JO-vvubb.js} +2 -2
  57. package/extensions/dashboard-client/dist/assets/{toggle-Dv3OEscH.js.map → toggle-JO-vvubb.js.map} +1 -1
  58. package/extensions/dashboard-client/dist/assets/{useSSE-n6ymAic3.js → useSSE-DAkXqUOy.js} +2 -2
  59. package/extensions/dashboard-client/dist/assets/{useSSE-n6ymAic3.js.map → useSSE-DAkXqUOy.js.map} +1 -1
  60. package/extensions/dashboard-client/dist/index.html +1 -1
  61. package/extensions/dashboard-server/api-contracts/endpoints/registry-ext.ts +11 -0
  62. package/extensions/dashboard-server/api-contracts/setup-cortex.ts +65 -0
  63. package/extensions/dashboard-server/route-dispatch.ts +2 -0
  64. package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +6 -0
  65. package/extensions/dashboard-server/routes-setup-cortex.ts +167 -0
  66. package/extensions/dashboard-server/routes.ts +1 -0
  67. package/extensions/dashboard-server/setup-cortex-blockers.ts +73 -0
  68. package/package.json +1 -1
  69. package/src/config/vector-cortex-vc9a.ts +31 -0
  70. package/src/config/vector-cortex.ts +5 -0
  71. package/src/config.ts +1 -0
  72. package/extensions/dashboard-client/dist/assets/index-Bu8CZUMX.js.map +0 -1
@@ -0,0 +1,29 @@
1
+ /**
2
+ * config/vector-cortex-vc9a.ts — VC9A setup-cortex status-read-path sprint flag.
3
+ *
4
+ * Extracted from vector-cortex.ts so that file stays under the 300-line soft
5
+ * limit (soft-as-hard gate), exactly as vector-cortex-vc8c.ts,
6
+ * vector-cortex-breakers.ts and vector-cortex-early.ts were. This is the
7
+ * SETUP-DASHBOARD reader flag (the dashboard Setup tab cortex status endpoint).
8
+ * vector-cortex.ts re-exports it below and root src/config.ts re-exports it, so
9
+ * no consumer import path changes.
10
+ *
11
+ * The split is purely mechanical: VC9A_ENABLED is byte-identical in name,
12
+ * semantics, and default to the definition it replaces, and vector-cortex.ts
13
+ * re-exports it so every existing `from "./config/vector-cortex.js"` import
14
+ * keeps resolving unchanged.
15
+ *
16
+ * Pi-agnostic, dependency-free (PREVENT-PI-004 / PREVENT-011).
17
+ */
18
+ import { sprintFlag } from "./vector-cortex-flag.js";
19
+ /**
20
+ * VC9A — Setup Cortex status read path (GET /api/setup-cortex-status).
21
+ * Default ON. `MEGACOMPACT_VC9A=0` disables and is byte-identical to the
22
+ * predecessor (VC8C-era shape): the endpoint returns `{enabled:false,
23
+ * mode:"C", status:"off"}` and surfaces no qualification/blocker/health detail —
24
+ * a pure reader-only projection, never a mutation. This flag MUST also be a
25
+ * dashboard SETTINGS toggle (visible in config UI, never in EXCLUDED_SETTINGS),
26
+ * mirroring VC4A..VC8C. The dashboard reader itself performs only local
27
+ * filesystem reads (no network, PREVENT-PI-004).
28
+ */
29
+ export const VC9A_ENABLED = () => sprintFlag("MEGACOMPACT_VC9A");
@@ -244,6 +244,10 @@ export const VC8B_ENABLED = () => sprintFlag("MEGACOMPACT_VC8B");
244
244
  // Re-exported here so every existing `from "./config/vector-cortex.js"`
245
245
  // import keeps resolving unchanged.
246
246
  export { VC8C_ENABLED } from "./vector-cortex-vc8c.js";
247
+ // VC9A (setup-cortex status read path) extracted to vector-cortex-vc9a.ts to
248
+ // keep this file under the 300-line soft limit. Re-exported here so every
249
+ // existing `from "./config/vector-cortex.js"` import keeps resolving unchanged.
250
+ export { VC9A_ENABLED } from "./vector-cortex-vc9a.js";
247
251
  // Breaker state machine constants (TRIAD_RESILIENCE.md §breaker) extracted to
248
252
  // vector-cortex-breakers.ts to keep this file under the 300-line soft limit.
249
253
  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, 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, 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";
@@ -27,4 +27,11 @@ export const EXTRA_ENDPOINTS = {
27
27
  path: "/api/vector-cortex/ledger",
28
28
  description: "Reader-only occurrence-ledger identity view: seq/eventId/kind/digest + high-water (never source payloads).",
29
29
  },
30
+ // ─── VC9A Setup Cortex (dashboard Setup tab cortex status) ─────────
31
+ /** GET /api/setup-cortex-status — reader-only vector-cortex encoder gate. */
32
+ setupCortexStatus: {
33
+ method: "GET",
34
+ path: "/api/setup-cortex-status",
35
+ description: "Reader-only vector-cortex encoder gate: mode A/B/C, qualification verdict, blockers, encoder health — for the dashboard Setup tab. Never closes the ML gate.",
36
+ },
30
37
  };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * api-contracts/setup-cortex.ts — Setup Cortex status API types (VC9A).
3
+ *
4
+ * Types for GET /api/setup-cortex-status, the reader-only aggregate that
5
+ * surfaces the vector-cortex encoder gate (mode A/B/C, qualification verdict,
6
+ * blockers, encoder health) in the dashboard Setup tab WITHOUT closing the ML
7
+ * gate. Reader-only: never payloads/prompts/ledger (EVAL-REDACT-002).
8
+ *
9
+ * PREVENT-PI-004: type definitions only, no network code.
10
+ * PREVENT-011: no `any` type — all types are explicit.
11
+ */
12
+ export {};
@@ -8,7 +8,7 @@
8
8
  * PREVENT-PI-004: local filesystem read only, no network.
9
9
  * PREVENT-011: no `any` type.
10
10
  */
11
- import { handleIndex, handleRepoIndex, handleEvents, handleGameState, handleGameScores, handlePerfSamples, handlePerf, handleAchievements, handleSessions, handleTopics, handleTurns, handleMaintenance, handleProviderCache, handleMemoryStatus, handleCacheStripes, handleSetupStatus, handleSetupDetect, handleSetupConfigure, handleMemoryMap, handleRaptorTree, handleRaptorBuildHistory, handleContextHealth, handleCachePoison, handleHealthSettings, handleEmbedderHealth, handleRagSettings, handleRagMetrics, handleModelThresholds, handleWiki, handleVectorCortexEvaluation, handleVectorCortexHealth, handleVectorCortexBreakersReset, handleVectorCortexLedger, handleVectorCortexTopology, handleVectorCortexQuery, handleVectorCortexShards, handleVectorCortexResidual, handleVectorCortexReconstruct, handleVectorCortexPlans, handleVectorCortexRender, handleVectorCortexRollout, handleVectorCortexClosureProof, handleVectorCortexRestore, } from "./routes.js";
11
+ import { handleIndex, handleRepoIndex, handleEvents, handleGameState, handleGameScores, handlePerfSamples, handlePerf, handleAchievements, handleSessions, handleTopics, handleTurns, handleMaintenance, handleProviderCache, handleMemoryStatus, handleCacheStripes, handleSetupStatus, handleSetupDetect, handleSetupConfigure, handleMemoryMap, handleRaptorTree, handleRaptorBuildHistory, handleContextHealth, handleCachePoison, handleHealthSettings, handleEmbedderHealth, handleRagSettings, handleRagMetrics, handleModelThresholds, handleWiki, handleVectorCortexEvaluation, handleVectorCortexHealth, handleVectorCortexBreakersReset, handleVectorCortexLedger, handleVectorCortexTopology, handleVectorCortexQuery, handleVectorCortexShards, handleVectorCortexResidual, handleVectorCortexReconstruct, handleVectorCortexPlans, handleVectorCortexRender, handleVectorCortexRollout, handleVectorCortexClosureProof, handleVectorCortexRestore, handleSetupCortexStatus, } from "./routes.js";
12
12
  // VC6C repair lives in its own module (routes-vector-cortex-repair.ts) so the
13
13
  // heal route file stays well under the 400-line extension soft limit.
14
14
  import { handleVectorCortexRepair } from "./routes-vector-cortex-repair.js";
@@ -141,5 +141,7 @@ export function dispatchRoutes(req, res, ctx) {
141
141
  return true;
142
142
  if (handleVectorCortexPlatform(req, res, ctx))
143
143
  return true;
144
+ if (handleSetupCortexStatus(req, res, ctx))
145
+ return true;
144
146
  return false;
145
147
  }
@@ -48,5 +48,6 @@ export const VECTOR_CORTEX_SETTINGS = {
48
48
  boolDirect("MEGACOMPACT_VC8A", "VC8A Consent-Bound Outcomes", "Consent-bound outcome ledger and offline learning dataset. Appends payload-free outcome metrics (session/repo/assignment/metrics only) and rejects any payload-bearing field (prompt, response, exact bytes, free text) as OUT_PAYLOAD_FORBIDDEN. Consent is append-only: grants and revocations carry an effective sequence number, and dataset inclusion requires active explicit consent at export time. Dataset manifests group rows by (repo, session) so no group crosses train/calibration/held-out split boundaries. Revocations disappear from future manifests. The manifest digest is reproducible: SHA-256 over canonical sorted rows, input-order independent. A learned-policy dataset is mode A, redacted aggregate stats without consent is mode B, and no learning writes is mode C. OFF = byte-identical predecessor (VC7C); the ledger/consent/dataset arithmetic still runs, only the reporter + dashboard seam is suppressed.", true),
49
49
  boolDirect("MEGACOMPACT_VC8B", "VC8B Shadow Adaptive Policy", "Bounded shadow adaptive policy + M7 pressure-v2 migration. Policy actions are from a finite set (admit/dampen/defer/escalate/reject) chosen deterministically by the canonical pressure level; token budgets are clamped into a configured window after the pressure factor. Unknown pressure labels are rejected as POL_PRESSURE_UNKNOWN, never coerced to a neighbour. The shadow engine is structurally incapable of affecting the live path: inputs are deep-copied, the canonical prompt digest is pinned before and after to prove non-mutation, and liveMutations is always zero. M7 migrates legacy pressure labels to the v2 canonical five by copy/validate/switch; an unknown label blocks the switch and keeps the legacy pointer (M7_PRESSURE_UNKNOWN). A shadow decision is mode A, static calibrated policy is mode B (forced by invalid A), and fixed legacy thresholds is mode C (forced by M7 or B failure). OFF = byte-identical predecessor (VC8A); the policy/shadow/migration arithmetic still runs, only the reporter + dashboard seam is suppressed.", true),
50
50
  boolDirect("MEGACOMPACT_VC8C", "VC8C Canary Platform + Rust Parity", "Canary selection and external Rust parity. The selector admits a qualified external Rust artifact only when ABI version, URL metadata, commit, Cargo.lock digest, and platform all match evidence; a Cargo.lock digest mismatch rejects the artifact (RUST_CARGO_DIGEST_MISMATCH). The cross-conformance runner exchanges length-framed neutral records over a local stdin/stdout channel — a subprocess, never a URL (PREVENT-PI-004). A parity mismatch selects TS mode B. A qualified external artifact is mode A, TS reference is mode B, legacy path is mode C. OFF = byte-identical predecessor (VC8B); the selector and cross-conformance arithmetic still run, only the reporter + dashboard seam is suppressed.", true),
51
+ boolDirect("MEGACOMPACT_VC9A", "VC9A Setup Cortex Status", "Reader-only Setup Cortex status read path (GET /api/setup-cortex-status): surfaces the vector-cortex encoder gate — mode A/B/C, qualification verdict, open blockers, encoder health — to the dashboard Setup tab without closing the ML gate. OFF = byte-identical predecessor (VC8C-era): returns enabled:false / mode:C / status:off.", true),
51
52
  ],
52
53
  };
@@ -0,0 +1,143 @@
1
+ /**
2
+ * dashboard-server/routes-setup-cortex.ts — VC9A Setup Cortex status route.
3
+ *
4
+ * GET /api/setup-cortex-status — reader-only aggregate surfacing the
5
+ * vector-cortex encoder gate (mode A/B/C, qualification verdict,
6
+ * blockers, encoder health) for the dashboard Setup tab. Does NOT close
7
+ * the ML gate: the hard-gate blockers are read-only and stay open.
8
+ *
9
+ * Reuses readEncoderManifest / verifyEncoderAsset / detectPlatform
10
+ * (src/vector-cortex/encoder/asset.ts) and deriveVcStatus (vc-status.ts),
11
+ * plus the memoized encoder-facts pattern from routes-vector-cortex-health.ts
12
+ * (manifest bytes + file size/mtime + platform cache key) so the expensive
13
+ * full-asset hashing is skipped on repeat polls.
14
+ *
15
+ * The blocker rows carry NO string literals here — they come from the static
16
+ * manifest module setup-cortex-blockers.ts (single canonical source).
17
+ *
18
+ * Guardrails: PREVENT-PI-004 (local filesystem read only), PREVENT-011 (no
19
+ * `any`), reader-only aggregate (never payloads/prompts/ledger — EVAL-REDACT-002).
20
+ */
21
+ import { createHash } from "node:crypto";
22
+ import { readFileSync, statSync } from "node:fs";
23
+ import { join, dirname } from "node:path";
24
+ import { fileURLToPath } from "node:url";
25
+ import { VC9A_ENABLED } from "../../src/config.js";
26
+ import { readEncoderManifest, verifyEncoderAsset, detectPlatform } from "../../src/vector-cortex/encoder/asset.js";
27
+ import { sendJson } from "./routes-vector-cortex-shared.js";
28
+ import { deriveVcStatus } from "./vc-status.js";
29
+ import { SETUP_CORTEX_BLOCKERS } from "./setup-cortex-blockers.js";
30
+ /** Resolve the committed encoder-v1 asset dir by walking up to the repo root. */
31
+ function encoderAssetDir() {
32
+ let dir = dirname(fileURLToPath(import.meta.url));
33
+ const rel = join("assets", "vector-cortex", "encoder-v1");
34
+ for (let i = 0; i < 8; i++) {
35
+ const candidate = join(dir, rel);
36
+ try {
37
+ // guardrails-allow PREVENT-PI-004: local asset filesystem read (loopback)
38
+ readFileSync(join(candidate, "manifest.json"));
39
+ return candidate;
40
+ }
41
+ catch {
42
+ /* keep walking */
43
+ }
44
+ const next = dirname(dir);
45
+ if (next === dir)
46
+ break;
47
+ dir = next;
48
+ }
49
+ return null;
50
+ }
51
+ let factCache = null;
52
+ /** Stable cache key: manifest bytes + (size,mtime) of the asset files + platform. */
53
+ function factCacheKey(dir, manifestPath) {
54
+ const platform = detectPlatform();
55
+ if (!platform)
56
+ return null;
57
+ const parts = [platform];
58
+ try {
59
+ for (const p of [manifestPath, join(dir, "model.onnx"), join(dir, "tokenizer.json")]) {
60
+ const s = statSync(p);
61
+ parts.push(`${s.size}:${s.mtimeMs}`);
62
+ }
63
+ // guardrails-allow PREVENT-PI-004: local manifest filesystem read (loopback)
64
+ parts.push(createHash("sha256").update(readFileSync(manifestPath)).digest("hex"));
65
+ }
66
+ catch {
67
+ return null;
68
+ }
69
+ return parts.join("|");
70
+ }
71
+ function computeSetupCortexFacts(dir) {
72
+ const manifest = readEncoderManifest(dir);
73
+ if (manifest === null) {
74
+ return { mode: "C", assetDigestPrefix: null, verdict: "unavailable", thresholdFailures: [] };
75
+ }
76
+ const manifestPath = join(dir, "manifest.json");
77
+ const key = factCacheKey(dir, manifestPath);
78
+ if (key === null)
79
+ return null;
80
+ if (factCache !== null && factCache.key === key)
81
+ return factCache.facts;
82
+ let digest;
83
+ try {
84
+ // guardrails-allow PREVENT-PI-004: local manifest filesystem read (loopback)
85
+ digest = createHash("sha256").update(readFileSync(manifestPath)).digest("hex");
86
+ }
87
+ catch {
88
+ const facts = { mode: "B", assetDigestPrefix: null, verdict: "demoted", thresholdFailures: ["ENC_ASSET_UNREADABLE"] };
89
+ factCache = { key, facts };
90
+ return facts;
91
+ }
92
+ const verify = verifyEncoderAsset(dir, manifest, detectPlatform());
93
+ const prefix = digest.slice(0, 12);
94
+ const facts = verify.ok
95
+ ? { mode: "A", assetDigestPrefix: prefix, verdict: "qualified", thresholdFailures: [] }
96
+ : { mode: "B", assetDigestPrefix: prefix, verdict: "demoted", thresholdFailures: [verify.code] };
97
+ factCache = { key, facts };
98
+ return facts;
99
+ }
100
+ function setupCortexFacts() {
101
+ const dir = encoderAssetDir();
102
+ if (dir === null) {
103
+ return { mode: "C", assetDigestPrefix: null, verdict: "unavailable", thresholdFailures: [] };
104
+ }
105
+ const facts = computeSetupCortexFacts(dir);
106
+ return facts ?? { mode: "C", assetDigestPrefix: null, verdict: "unavailable", thresholdFailures: [] };
107
+ }
108
+ /**
109
+ * Reader-only GET /api/setup-cortex-status (VC9A).
110
+ *
111
+ * Purely read: no mutation, never payloads/prompts/ledger. Flag-off returns the
112
+ * byte-identical VC8C-era shape `{enabled:false, mode:"C", status:"off"}` with
113
+ * the encoder-health mode C and no qualification/blocker detail leaked.
114
+ */
115
+ export function handleSetupCortexStatus(req, res, _ctx) {
116
+ const url = req.url ?? "";
117
+ if (url !== "/api/setup-cortex-status")
118
+ return false;
119
+ if (req.method !== "GET") {
120
+ sendJson(res, 405, { error: "method_not_allowed" });
121
+ return true;
122
+ }
123
+ const enabled = VC9A_ENABLED();
124
+ const facts = enabled ? setupCortexFacts() : null;
125
+ const blocks = enabled ? [...SETUP_CORTEX_BLOCKERS] : [];
126
+ const body = {
127
+ enabled,
128
+ flag: "MEGACOMPACT_VC9A",
129
+ mode: facts ? facts.mode : "C",
130
+ assetDigestPrefix: facts ? facts.assetDigestPrefix : null,
131
+ qualification: facts
132
+ ? { verdict: facts.verdict, thresholdFailures: facts.thresholdFailures }
133
+ : { verdict: "unavailable", thresholdFailures: [] },
134
+ blockers: blocks,
135
+ encoderHealth: facts
136
+ ? { assetDigestPrefix: facts.assetDigestPrefix, mode: facts.mode }
137
+ : { assetDigestPrefix: null, mode: "C" },
138
+ updatedAt: new Date().toISOString(),
139
+ status: deriveVcStatus({ enabled, hasData: !!facts && facts.verdict !== "unavailable", structuralOnly: true }),
140
+ };
141
+ sendJson(res, 200, body);
142
+ return true;
143
+ }
@@ -24,3 +24,4 @@ export { handleRagMetrics } from "./routes-rag-metrics.js";
24
24
  export { handleModelThresholds } from "./routes-model-thresholds.js";
25
25
  export { handleWiki } from "./routes-wiki.js";
26
26
  export { handleVectorCortexEvaluation, handleVectorCortexHealth, handleVectorCortexBreakersReset, handleVectorCortexLedger, handleVectorCortexTopology, handleVectorCortexQuery, handleVectorCortexShards, handleVectorCortexResidual, handleVectorCortexReconstruct, handleVectorCortexPlans, handleVectorCortexRender, handleVectorCortexRollout, handleVectorCortexClosureProof, handleVectorCortexRestore, } from "./routes-vector-cortex.js";
27
+ export { handleSetupCortexStatus } from "./routes-setup-cortex.js";
@@ -0,0 +1,53 @@
1
+ /**
2
+ * dashboard-server/setup-cortex-blockers.ts — canonical blocker manifest for the
3
+ * dashboard Setup Cortex status read path (VC9A).
4
+ *
5
+ * The hard-gate items enumerated in docs/vector-cortex/vc2-model-prep.md §6
6
+ * (per the 2026-08-05 research update: the opset-14→17 re-export blocker is
7
+ * REMOVED because onnx-community exports are now opset 21). This module is the
8
+ * SINGLE canonical source of those blockers — the route file
9
+ * (routes-setup-cortex.ts) carries NO string literals for them; it reads this
10
+ * static manifest so the UI rows and the spec stay in one place.
11
+ *
12
+ * Reader-only, static: zero network, no writes (PREVENT-PI-004), no `any`
13
+ * (PREVENT-011).
14
+ */
15
+ /**
16
+ * The four blockers VC9A reports. Enumerates the vc2-model-prep §6 items that
17
+ * remain per the 2026-08-05 research. The opset re-export blocker (formerly
18
+ * §6 #2) is NOT listed: onnx-community exports are opset 21, so it is removed.
19
+ */
20
+ export const SETUP_CORTEX_BLOCKERS = [
21
+ {
22
+ id: "HG-1",
23
+ title: "Five projection heads do not exist",
24
+ severity: "blocker",
25
+ status: "open",
26
+ resolution: "Supervision transfer onto a frozen bge-small-en-v1.5 trunk (contradiction distilled from cross-encoder/nli-deberta-v3-small; dependency NLI-assisted; cache-stability deterministic; payload-routing small MLP) — VC2B training + export.",
27
+ },
28
+ {
29
+ id: "HG-3",
30
+ title: "onnxruntime-node install exceeds the 80 MiB asset budget",
31
+ severity: "blocker",
32
+ status: "open",
33
+ resolution: "onnxruntime-node bundles ~258 MiB across all platforms. Candidate: transformers.js v4.2.0 (9.5 MiB shell, pure-Node via onnxruntime-web WASM) measured against budget + p95 gate before committing.",
34
+ },
35
+ {
36
+ id: "HG-4",
37
+ title: "No darwin-x64 binary in onnxruntime-node",
38
+ severity: "high",
39
+ status: "open",
40
+ resolution: "Intel-Mac mode-A users demote to the WASM path (if HG-3 resolves that way) or mode B.",
41
+ },
42
+ {
43
+ id: "HG-5",
44
+ title: "RSS margin at 512 tokens is ~0.5%",
45
+ severity: "medium",
46
+ status: "open",
47
+ resolution: "149.2 MiB vs 150 MiB cap with run-to-run variance 119-149 MiB; considers capping mode A at 384 tokens or using the marginal-footprint accounting runtime.ts already implements.",
48
+ },
49
+ ];
50
+ /** Look up one blocker by id; undefined when unknown (defensive). */
51
+ export function setupCortexBlocker(id) {
52
+ return SETUP_CORTEX_BLOCKERS.find((b) => b.id === id);
53
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * config/vector-cortex-vc9a.ts — VC9A setup-cortex status-read-path sprint flag.
3
+ *
4
+ * Extracted from vector-cortex.ts so that file stays under the 300-line soft
5
+ * limit (soft-as-hard gate), exactly as vector-cortex-vc8c.ts,
6
+ * vector-cortex-breakers.ts and vector-cortex-early.ts were. This is the
7
+ * SETUP-DASHBOARD reader flag (the dashboard Setup tab cortex status endpoint).
8
+ * vector-cortex.ts re-exports it below and root src/config.ts re-exports it, so
9
+ * no consumer import path changes.
10
+ *
11
+ * The split is purely mechanical: VC9A_ENABLED is byte-identical in name,
12
+ * semantics, and default to the definition it replaces, and vector-cortex.ts
13
+ * re-exports it so every existing `from "./config/vector-cortex.js"` import
14
+ * keeps resolving unchanged.
15
+ *
16
+ * Pi-agnostic, dependency-free (PREVENT-PI-004 / PREVENT-011).
17
+ */
18
+ import { sprintFlag } from "./vector-cortex-flag.js";
19
+ /**
20
+ * VC9A — Setup Cortex status read path (GET /api/setup-cortex-status).
21
+ * Default ON. `MEGACOMPACT_VC9A=0` disables and is byte-identical to the
22
+ * predecessor (VC8C-era shape): the endpoint returns `{enabled:false,
23
+ * mode:"C", status:"off"}` and surfaces no qualification/blocker/health detail —
24
+ * a pure reader-only projection, never a mutation. This flag MUST also be a
25
+ * dashboard SETTINGS toggle (visible in config UI, never in EXCLUDED_SETTINGS),
26
+ * mirroring VC4A..VC8C. The dashboard reader itself performs only local
27
+ * filesystem reads (no network, PREVENT-PI-004).
28
+ */
29
+ export const VC9A_ENABLED = () => sprintFlag("MEGACOMPACT_VC9A");
@@ -244,6 +244,10 @@ export const VC8B_ENABLED = () => sprintFlag("MEGACOMPACT_VC8B");
244
244
  // Re-exported here so every existing `from "./config/vector-cortex.js"`
245
245
  // import keeps resolving unchanged.
246
246
  export { VC8C_ENABLED } from "./vector-cortex-vc8c.js";
247
+ // VC9A (setup-cortex status read path) extracted to vector-cortex-vc9a.ts to
248
+ // keep this file under the 300-line soft limit. Re-exported here so every
249
+ // existing `from "./config/vector-cortex.js"` import keeps resolving unchanged.
250
+ export { VC9A_ENABLED } from "./vector-cortex-vc9a.js";
247
251
  // Breaker state machine constants (TRIAD_RESILIENCE.md §breaker) extracted to
248
252
  // vector-cortex-breakers.ts to keep this file under the 300-line soft limit.
249
253
  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, 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, 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";
@@ -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-CTQIl2qs.js";import{R as p,F as ee,r as ve}from"./index-Bu8CZUMX.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-DRErPez1.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-B9Ba91Tu.js";import{R as p,F as ee,r as ve}from"./index-P13AO5ni.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-Bl8FQm-w.js.map