pi-mega-compact 0.20.54 → 0.20.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/vector-cortex-cosfp-real.js +34 -0
- package/dist/config/vector-cortex-cosfp.js +31 -0
- package/dist/config/vector-cortex.js +4 -0
- package/dist/config.js +1 -1
- package/dist/extensions/dashboard-server/api-contracts/cosine-fp.js +8 -0
- package/dist/extensions/dashboard-server/api-contracts/endpoints/registry-ext.js +7 -0
- package/dist/extensions/dashboard-server/route-dispatch.js +3 -1
- package/dist/extensions/dashboard-server/routes-cosine-fp.js +261 -0
- package/dist/extensions/dashboard-server/routes-rag-settings-helpers.js +8 -0
- package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +2 -0
- package/dist/extensions/dashboard-server/routes.js +1 -0
- package/dist/src/config/dedup.js +11 -0
- package/dist/src/config/vector-cortex-cosfp-real.js +34 -0
- package/dist/src/config/vector-cortex-cosfp.js +31 -0
- package/dist/src/config/vector-cortex.js +4 -0
- package/dist/src/config.js +1 -1
- package/extensions/dashboard-client/dist/assets/{AreaChart-COjQ_jJm.js → AreaChart-DlndN0p2.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-COjQ_jJm.js.map → AreaChart-DlndN0p2.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-eAIpwb8c.js → BarChart-DH6rZ60s.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-eAIpwb8c.js.map → BarChart-DH6rZ60s.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/CacheTab-Qj_NYKw3.js +2 -0
- package/extensions/dashboard-client/dist/assets/{CacheTab-BS_G9_YV.js.map → CacheTab-Qj_NYKw3.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-CDFk5d3P.js → EventsTab-3QlIPMFj.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-CDFk5d3P.js.map → EventsTab-3QlIPMFj.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-zFyPJb5b.js → HealthTab-DTwitpIb.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-zFyPJb5b.js.map → HealthTab-DTwitpIb.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DxJX4lXh.js → MaintenanceTab-DkVlBnp7.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DxJX4lXh.js.map → MaintenanceTab-DkVlBnp7.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/MemoryMapTab-B-pHH85r.js +2 -0
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-CRy5I6mg.js.map → MemoryMapTab-B-pHH85r.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsTab-K4kPea0Q.js → MetricsTab-C8VpwhJN.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-K4kPea0Q.js.map → MetricsTab-C8VpwhJN.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-BZoJ1oOv.js → OverviewTab-C_JZlM_Q.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-BZoJ1oOv.js.map → OverviewTab-C_JZlM_Q.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-uMFKxT0a.js → ReposTab-rRMlub-E.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-uMFKxT0a.js.map → ReposTab-rRMlub-E.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-DDzmcCuH.js → SessionsTab-CL6S094G.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-DDzmcCuH.js.map → SessionsTab-CL6S094G.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/SetupTab-C6b8YuBK.js +3 -0
- package/extensions/dashboard-client/dist/assets/SetupTab-C6b8YuBK.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-D_mBYAzE.js → TimeSavedCard-B-8NCvzd.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-D_mBYAzE.js.map → TimeSavedCard-B-8NCvzd.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-C6xr2lsO.js → TurnsTab-C2MVgG4N.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{TurnsTab-C6xr2lsO.js.map → TurnsTab-C2MVgG4N.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-J0DVlxH0.js → VcStatusBadge-CvlS_fvh.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-J0DVlxH0.js.map → VcStatusBadge-CvlS_fvh.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-AvL73DpJ.js → VectorCortexTab-BXCAzwQm.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-AvL73DpJ.js.map → VectorCortexTab-BXCAzwQm.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{WikiTab-DVcIWjLT.js → WikiTab-DUivYmJ5.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-DVcIWjLT.js.map → WikiTab-DUivYmJ5.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-Cl_gFaIf.js → button-dTpuinxr.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-Cl_gFaIf.js.map → button-dTpuinxr.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-DMzHffVs.js → card-DNwZ7dSg.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-DMzHffVs.js.map → card-DNwZ7dSg.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/client-extra-CQuCpjyO.js +2 -0
- package/extensions/dashboard-client/dist/assets/{client-extra-Dkkppa5C.js.map → client-extra-CQuCpjyO.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-Bi8zQmZN.js → generateCategoricalChart-D1HV4d79.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-Bi8zQmZN.js.map → generateCategoricalChart-D1HV4d79.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-mZRDesSq.js → index-Bi5YNsLx.js} +11 -11
- package/extensions/dashboard-client/dist/assets/index-Bi5YNsLx.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{switch-K_lsOl6x.js → switch-DiKc2q4n.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-K_lsOl6x.js.map → switch-DiKc2q4n.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-67IU2JLn.js → toggle-BBYD10JO.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-67IU2JLn.js.map → toggle-BBYD10JO.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-DiLgyP7C.js → useSSE-CWUSDhIb.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-DiLgyP7C.js.map → useSSE-CWUSDhIb.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/tabs/SetupTab/CortexSetup.tsx +2 -0
- package/extensions/dashboard-client/src/tabs/SetupTab/VectorCortexCosineFpCard.tsx +130 -0
- package/extensions/dashboard-server/api-contracts/cosine-fp.ts +81 -0
- package/extensions/dashboard-server/api-contracts/endpoints/registry-ext.ts +11 -0
- package/extensions/dashboard-server/api-contracts/index.ts +14 -0
- package/extensions/dashboard-server/assets/cosine-fp-report.json +1 -0
- package/extensions/dashboard-server/route-dispatch.ts +2 -0
- package/extensions/dashboard-server/routes-cosine-fp.ts +288 -0
- package/extensions/dashboard-server/routes-rag-settings-helpers.ts +8 -0
- package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +12 -0
- package/extensions/dashboard-server/routes.ts +1 -0
- package/package.json +1 -1
- package/src/config/dedup.ts +17 -0
- package/src/config/vector-cortex-cosfp-real.ts +37 -0
- package/src/config/vector-cortex-cosfp.ts +34 -0
- package/src/config/vector-cortex.ts +4 -0
- package/src/config.ts +2 -0
- package/extensions/dashboard-client/dist/assets/CacheTab-BS_G9_YV.js +0 -2
- package/extensions/dashboard-client/dist/assets/MemoryMapTab-CRy5I6mg.js +0 -2
- package/extensions/dashboard-client/dist/assets/SetupTab-KLTE-VKV.js +0 -3
- package/extensions/dashboard-client/dist/assets/SetupTab-KLTE-VKV.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/client-extra-Dkkppa5C.js +0 -2
- package/extensions/dashboard-client/dist/assets/index-mZRDesSq.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* config/vector-cortex-cosfp-real.ts — COS-FP-R real-corpus FP validation flag.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from vector-cortex.ts so that barrel stays under the 300-line soft
|
|
5
|
+
* limit (soft-as-hard gate), exactly as vector-cortex-cosfp.ts and the other
|
|
6
|
+
* per-sprint flag siblings were. Gating the real-corpus L2 cosine false-positive
|
|
7
|
+
* validation: the `scripts/cosine-fp/real-bench.mjs` execution harness that runs
|
|
8
|
+
* only when a consented donated corpus exists, the execution-time report rows,
|
|
9
|
+
* and the evidence record. A pure-local, consent-gated tool (SECURITY_PRIVACY
|
|
10
|
+
* §Lifecycle/§Consent + EVAL-REDACT-002) — it never reads real session/ledger
|
|
11
|
+
* bytes without an explicit per-session consent record.
|
|
12
|
+
*
|
|
13
|
+
* The split is mechanical: COSINE_FP_REAL_ENABLED is byte-identical in name,
|
|
14
|
+
* semantics, and default to the sibling flag convention (positive, default ON),
|
|
15
|
+
* and vector-cortex.ts re-exports it so every existing
|
|
16
|
+
* `from "./config/vector-cortex.js"` import keeps resolving unchanged.
|
|
17
|
+
*
|
|
18
|
+
* Pi-agnostic, dependency-free (PREVENT-PI-004 / PREVENT-011).
|
|
19
|
+
*/
|
|
20
|
+
import { sprintFlag } from "./vector-cortex-flag.js";
|
|
21
|
+
/**
|
|
22
|
+
* COS-FP-R — real-corpus L2 cosine FP validation against donated sessions.
|
|
23
|
+
* Default ON. `MEGACOMPACT_COSINE_FP_REAL=0` disables and is byte-identical to
|
|
24
|
+
* the predecessor: `scripts/cosine-fp/real-bench.mjs` is inert (nothing
|
|
25
|
+
* executes, no writes), no real-corpus report rows or evidence are written, and
|
|
26
|
+
* no threshold is adopted. When ON (default), execution still only proceeds when
|
|
27
|
+
* a valid consented corpus exists under `scripts/cosine-fp/corpus/` — absent
|
|
28
|
+
* corpus is the normative `no_corpus` pre-donation state, not a failure. Corpus
|
|
29
|
+
* bytes are read only for sessions with an explicit, append-only, revocable
|
|
30
|
+
* consent record (SECURITY_PRIVACY §Lifecycle/§Consent). This flag MUST also be
|
|
31
|
+
* a dashboard SETTINGS toggle (visible in config UI, never in EXCLUDED_SETTINGS).
|
|
32
|
+
* The harness performs only local filesystem reads (PREVENT-PI-004).
|
|
33
|
+
*/
|
|
34
|
+
export const COSINE_FP_REAL_ENABLED = () => sprintFlag("MEGACOMPACT_COSINE_FP_REAL");
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* config/vector-cortex-cosfp.ts — COS-FP-A synthetic FP harness sprint flag.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from vector-cortex.ts so that barrel stays under the 300-line soft
|
|
5
|
+
* limit (soft-as-hard gate), exactly as vector-cortex-vc9a.ts and the other
|
|
6
|
+
* per-sprint flag siblings were. Gating the synthetic cosine false-positive
|
|
7
|
+
* harness: the corpus/bench scripts, the derived report, and the reader-only
|
|
8
|
+
* GET /api/cosine-fp-report endpoint. A pure-local, synthetic-corpus-only tool
|
|
9
|
+
* (EVAL-REDACT-002) — it never reads real session/ledger bytes.
|
|
10
|
+
*
|
|
11
|
+
* The split is mechanical: COSINE_FP_BENCH_ENABLED is byte-identical in name,
|
|
12
|
+
* semantics, and default to the sibling flag convention (positive, default ON),
|
|
13
|
+
* and vector-cortex.ts re-exports it so every existing
|
|
14
|
+
* `from "./config/vector-cortex.js"` import 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
|
+
* COS-FP-A — synthetic FP harness + L2 cosine threshold calibration.
|
|
21
|
+
* Default ON. `MEGACOMPACT_COSINE_FP_BENCH=0` disables and is byte-identical to
|
|
22
|
+
* the predecessor: `scripts/cosine-fp/bench.mjs` is inert (gates report
|
|
23
|
+
* emission + the endpoint to 404/absent), no report is (re)written, and
|
|
24
|
+
* `L2_COSINE` continues to be plain `MEGACOMPACT_L2_THRESHOLD`. The two
|
|
25
|
+
* content-type override fields added to config/dedup.ts are null when unset and
|
|
26
|
+
* are NOT wired into the live L2 decision this sprint (a declared landing slot
|
|
27
|
+
* for the report's per-content-type recommendation). This flag MUST also be a
|
|
28
|
+
* dashboard SETTINGS toggle (visible in config UI, never in EXCLUDED_SETTINGS).
|
|
29
|
+
* The harness + endpoint perform only local filesystem reads (PREVENT-PI-004).
|
|
30
|
+
*/
|
|
31
|
+
export const COSINE_FP_BENCH_ENABLED = () => sprintFlag("MEGACOMPACT_COSINE_FP_BENCH");
|
|
@@ -32,6 +32,10 @@ export { ENC_0D_ENABLED } from "./vector-cortex-enc0d.js";
|
|
|
32
32
|
export { ENC_0E_ENABLED } from "./vector-cortex-enc0e.js";
|
|
33
33
|
export { ENC_0F_ENABLED } from "./vector-cortex-enc0f.js";
|
|
34
34
|
export { ENC_0G_ENABLED } from "./vector-cortex-enc0g.js";
|
|
35
|
+
// COS-FP-A synthetic FP harness flag extracted to vector-cortex-cosfp.ts.
|
|
36
|
+
export { COSINE_FP_BENCH_ENABLED } from "./vector-cortex-cosfp.js";
|
|
37
|
+
// COS-FP-R real-corpus FP validation flag extracted to vector-cortex-cosfp-real.ts.
|
|
38
|
+
export { COSINE_FP_REAL_ENABLED } from "./vector-cortex-cosfp-real.js";
|
|
35
39
|
export { ENC_1A_ENABLED } from "./vector-cortex-enc1a.js";
|
|
36
40
|
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";
|
|
37
41
|
export { ENC_2BUDGET_ENABLED, ENC_2BUDGET_NATIVE_ORT_BUDGET_ENV, ENC_2BUDGET_MAX_MIB, ENC_2BUDGET_DEFAULT_MIB, } from "./vector-cortex-enc2budget.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, 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, COSINE_FP_BENCH_ENABLED, COSINE_FP_REAL_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,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* api-contracts/cosine-fp.ts — cosine-FP report API contract (COS-FP-A).
|
|
3
|
+
*
|
|
4
|
+
* Reader-only shape for GET /api/cosine-fp-report: the last written synthetic
|
|
5
|
+
* bench aggregate + report digest + recommendation. The bench emits counts +
|
|
6
|
+
* fractions + digests ONLY (EVAL-REDACT-002) — never template text. No `any`.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
@@ -74,4 +74,11 @@ export const EXTRA_ENDPOINTS = {
|
|
|
74
74
|
path: "/api/dedup-tier-attribution",
|
|
75
75
|
description: "Reader-only dedup tier-attribution rollup (DEDUP-ATTR): L0/L1/L2/new percent of dedup decisions in a query window (default 24h, ?windowMs=, capped 30d). Counts + shares only, never matched checkpoint contents or raw query text. Flag-off returns 404.",
|
|
76
76
|
},
|
|
77
|
+
// ─── COS-FP-A cosine threshold report ────────────────────────────
|
|
78
|
+
/** GET /api/cosine-fp-report — reader-only synthetic FP bench recommendation. */
|
|
79
|
+
cosineFpReport: {
|
|
80
|
+
method: "GET",
|
|
81
|
+
path: "/api/cosine-fp-report",
|
|
82
|
+
description: "Reader-only cosine-FP report (COS-FP-A): the last written synthetic bench aggregate — grid summary, per-content-type FP/FN/F1, recommended default, report digest. Counts + fractions + digests only, never template text. Missing report → awaiting_data; flag-off returns 404.",
|
|
83
|
+
},
|
|
77
84
|
};
|
|
@@ -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, handlePrefixStability, 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, handleSetupCortexAction, handleSetupCortexActionLog, handleImproveCortex, handleImproveCortexStatus, handleDedupTierAttribution, } from "./routes.js";
|
|
11
|
+
import { handleIndex, handleRepoIndex, handleEvents, handleGameState, handleGameScores, handlePerfSamples, handlePerf, handleAchievements, handleSessions, handleTopics, handleTurns, handleMaintenance, handleProviderCache, handleMemoryStatus, handleCacheStripes, handlePrefixStability, 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, handleSetupCortexAction, handleSetupCortexActionLog, handleImproveCortex, handleImproveCortexStatus, handleDedupTierAttribution, handleCosineFpReport, } 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";
|
|
@@ -155,5 +155,7 @@ export function dispatchRoutes(req, res, ctx) {
|
|
|
155
155
|
return true;
|
|
156
156
|
if (handleDedupTierAttribution(req, res, ctx))
|
|
157
157
|
return true;
|
|
158
|
+
if (handleCosineFpReport(req, res, ctx))
|
|
159
|
+
return true;
|
|
158
160
|
return false;
|
|
159
161
|
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dashboard-server/routes-cosine-fp.ts — COS-FP-A cosine-FP report route.
|
|
3
|
+
*
|
|
4
|
+
* GET /api/cosine-fp-report — reader-only aggregate answering "what did the last
|
|
5
|
+
* synthetic bench recommend for the L2 cosine threshold?". Reads the last
|
|
6
|
+
* written bench-run aggregate (scripts/cosine-fp/bench-run/cosine-fp-report.json,
|
|
7
|
+
* located by walking up to the repo root) + its mtime, memoized by
|
|
8
|
+
* {mtime,size} (mirrors routes-vector-cortex-health.ts memoized-facts), and
|
|
9
|
+
* serves the report digest + recommendation + grid summary. Reader-only: emits
|
|
10
|
+
* counts + fractions + digests, never template text (EVAL-REDACT-002).
|
|
11
|
+
*
|
|
12
|
+
* Flag-off (MEGACOMPACT_COSINE_FP_BENCH=0) returns 404 — byte-identical
|
|
13
|
+
* predecessor. Missing report file is reported as `awaiting_data` with
|
|
14
|
+
* benchStatus awaiting_data — never a fabricated zero row (COS-FP-A-003).
|
|
15
|
+
*
|
|
16
|
+
* Guardrails: PREVENT-PI-004 (local filesystem read only), PREVENT-001
|
|
17
|
+
* (JSON.parse guarded), PREVENT-011 (no `any`).
|
|
18
|
+
*/
|
|
19
|
+
import { readFileSync, statSync } from "node:fs";
|
|
20
|
+
import { join, dirname } from "node:path";
|
|
21
|
+
import { fileURLToPath } from "node:url";
|
|
22
|
+
import { sendJson } from "./routes-vector-cortex-shared.js";
|
|
23
|
+
import { COSINE_FP_BENCH_ENABLED } from "../../src/config.js";
|
|
24
|
+
import { deriveVcStatus } from "./vc-status.js";
|
|
25
|
+
const MEMO_TTL_MS = 5000; // ≤5s per file state
|
|
26
|
+
const REPORT_FILENAME = "cosine-fp-report.json";
|
|
27
|
+
let memo = null;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the dir containing the cosine-fp-report.json aggregate. Two locations
|
|
30
|
+
* are probed in order:
|
|
31
|
+
*
|
|
32
|
+
* 1. The bundled asset `extensions/dashboard-server/assets/cosine-fp-report.json`.
|
|
33
|
+
* This is the PRODUCTION path: the `extensions/` source tree ships at the
|
|
34
|
+
* npm package root, so `/api/cosine-fp-report` serves the recommendation on
|
|
35
|
+
* an installed package (PREVENT-DIST-001). tsc does NOT copy `.json` assets
|
|
36
|
+
* into `dist/`, so the compiled module probes both the co-located
|
|
37
|
+
* `assets/` (source tree) and the repo-root `extensions/.../assets/`
|
|
38
|
+
* (reached from `dist/extensions/dashboard-server/`). Without the bundled
|
|
39
|
+
* asset the endpoint would always return `awaiting_data` on devices,
|
|
40
|
+
* because `scripts/` (the bench-run path) is NOT shipped.
|
|
41
|
+
*
|
|
42
|
+
* 2. The git-checkout bench-run dir (`scripts/cosine-fp/bench-run/`) for dev
|
|
43
|
+
* use, walked up to from this module — this is where `bench.mjs` writes the
|
|
44
|
+
* report.
|
|
45
|
+
*
|
|
46
|
+
* The test seam MEGACOMPACT_COSINE_FP_BENCH_RUN_DIR (read lazily so a test can
|
|
47
|
+
* set it post-import) overrides BOTH so route tests can point at a temp dir
|
|
48
|
+
* without touching the repo or the bundled asset.
|
|
49
|
+
*/
|
|
50
|
+
export function benchRunDir() {
|
|
51
|
+
const testRunDir = process.env.MEGACOMPACT_COSINE_FP_BENCH_RUN_DIR;
|
|
52
|
+
if (testRunDir)
|
|
53
|
+
return testRunDir;
|
|
54
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
55
|
+
// 1. Bundled asset candidates — the PRODUCTION path (PREVENT-DIST-001). tsc
|
|
56
|
+
// does NOT copy `.json` assets into dist/, and the `extensions/` source
|
|
57
|
+
// tree ships at the package root next to `dist/`. Probe both relative to
|
|
58
|
+
// this module's location (mirrors server.ts clientDist candidates):
|
|
59
|
+
// here = extensions/dashboard-server (source tree, dev run)
|
|
60
|
+
// here = dist/extensions/dashboard-server (compiled, published)
|
|
61
|
+
const bundledCandidates = [
|
|
62
|
+
join(here, "assets"), // source tree / co-located
|
|
63
|
+
join(here, "..", "..", "..", "extensions", "dashboard-server", "assets"), // repo-root source from compiled dist/
|
|
64
|
+
];
|
|
65
|
+
for (const bundled of bundledCandidates) {
|
|
66
|
+
try {
|
|
67
|
+
// guardrails-allow PREVENT-PI-004: local bundled report stat (loopback)
|
|
68
|
+
statSync(join(bundled, REPORT_FILENAME));
|
|
69
|
+
return bundled;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
/* try next candidate, then fall through to git-checkout walk */
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// 2. Git-checkout bench-run dir — dev path only.
|
|
76
|
+
let dir = here;
|
|
77
|
+
const rel = join("scripts", "cosine-fp", "bench-run");
|
|
78
|
+
for (let i = 0; i < 8; i++) {
|
|
79
|
+
const candidate = join(dir, rel);
|
|
80
|
+
try {
|
|
81
|
+
// guardrails-allow PREVENT-PI-004: local bench-run dir stat (loopback)
|
|
82
|
+
statSync(candidate);
|
|
83
|
+
return candidate;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
/* keep walking */
|
|
87
|
+
}
|
|
88
|
+
const next = dirname(dir);
|
|
89
|
+
if (next === dir)
|
|
90
|
+
break;
|
|
91
|
+
dir = next;
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
/** Read + minimally validate the aggregate JSON (PREVENT-001). Returns null on
|
|
96
|
+
* any parse/shape failure — the caller treats that as awaiting_data, never as
|
|
97
|
+
* a fabricated zero row. */
|
|
98
|
+
function readAggregate(runDir) {
|
|
99
|
+
const p = join(runDir, "cosine-fp-report.json");
|
|
100
|
+
let raw;
|
|
101
|
+
try {
|
|
102
|
+
raw = readFileSync(p, "utf8"); // guardrails-allow PREVENT-PI-004: local bench-run report read (loopback)
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
let parsed;
|
|
108
|
+
try {
|
|
109
|
+
parsed = JSON.parse(raw);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
115
|
+
return null;
|
|
116
|
+
return parsed;
|
|
117
|
+
}
|
|
118
|
+
function toNum(v) {
|
|
119
|
+
return typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
120
|
+
}
|
|
121
|
+
/** Project per-content-type count entries into the contract shape (PREVENT-011). */
|
|
122
|
+
function projectPerType(raw) {
|
|
123
|
+
const out = {};
|
|
124
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
125
|
+
return out;
|
|
126
|
+
for (const [key, v] of Object.entries(raw)) {
|
|
127
|
+
if (!v || typeof v !== "object" || Array.isArray(v))
|
|
128
|
+
continue;
|
|
129
|
+
const o = v;
|
|
130
|
+
out[key] = {
|
|
131
|
+
items: toNum(o.items) ?? 0,
|
|
132
|
+
dup: toNum(o.dup) ?? 0,
|
|
133
|
+
near: toNum(o.near) ?? 0,
|
|
134
|
+
clean: toNum(o.clean) ?? 0,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return out;
|
|
138
|
+
}
|
|
139
|
+
/** Project the raw aggregate into the full CosineFpReportV1 (reader-only). */
|
|
140
|
+
function buildBody(runDir, aggregate) {
|
|
141
|
+
let mtime = null;
|
|
142
|
+
try {
|
|
143
|
+
const s = statSync(join(runDir, "cosine-fp-report.json")); // guardrails-allow PREVENT-PI-004: local stat (loopback)
|
|
144
|
+
mtime = s.mtimeMs;
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
mtime = null;
|
|
148
|
+
}
|
|
149
|
+
const benchStatus = aggregate.status === "ok" ? "ok" : "no_data";
|
|
150
|
+
const hasData = benchStatus === "ok";
|
|
151
|
+
const status = deriveVcStatus({ enabled: true, hasData, structuralOnly: false });
|
|
152
|
+
const grid = aggregate.grid;
|
|
153
|
+
const overrides = aggregate.overrides;
|
|
154
|
+
const corpus = aggregate.corpusSummary;
|
|
155
|
+
const rows = aggregate.rows;
|
|
156
|
+
return {
|
|
157
|
+
status,
|
|
158
|
+
benchStatus,
|
|
159
|
+
seed: toNum(aggregate.seed),
|
|
160
|
+
grid: grid && typeof grid === "object"
|
|
161
|
+
? {
|
|
162
|
+
lo: toNum(grid.lo) ?? 0,
|
|
163
|
+
hi: toNum(grid.hi) ?? 0,
|
|
164
|
+
step: toNum(grid.step) ?? 0,
|
|
165
|
+
points: toNum(grid.points) ?? 0,
|
|
166
|
+
}
|
|
167
|
+
: null,
|
|
168
|
+
corpusSummary: corpus && typeof corpus === "object"
|
|
169
|
+
? {
|
|
170
|
+
items: toNum(corpus.items) ?? 0,
|
|
171
|
+
pairs: toNum(corpus.pairs) ?? 0,
|
|
172
|
+
types: Array.isArray(corpus.types)
|
|
173
|
+
? corpus.types
|
|
174
|
+
: [],
|
|
175
|
+
perType: projectPerType(corpus.perType),
|
|
176
|
+
digest: typeof corpus.digest === "string"
|
|
177
|
+
? corpus.digest
|
|
178
|
+
: null,
|
|
179
|
+
}
|
|
180
|
+
: null,
|
|
181
|
+
rows: Array.isArray(rows) ? rows : null,
|
|
182
|
+
recommendedDefault: toNum(aggregate.recommendedDefault),
|
|
183
|
+
shippedDefault: toNum(aggregate.shippedDefault) ?? 0.85,
|
|
184
|
+
overrides: overrides && typeof overrides === "object"
|
|
185
|
+
? {
|
|
186
|
+
code: toNum(overrides.code),
|
|
187
|
+
prose: toNum(overrides.prose),
|
|
188
|
+
mixed: toNum(overrides.mixed),
|
|
189
|
+
}
|
|
190
|
+
: null,
|
|
191
|
+
fpBudget: toNum(aggregate.fpBudget),
|
|
192
|
+
digest: typeof aggregate.digest === "string" ? aggregate.digest : null,
|
|
193
|
+
reportFileMtime: mtime,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function awaitingDataBody(reason) {
|
|
197
|
+
const status = deriveVcStatus({
|
|
198
|
+
enabled: reason !== "flag",
|
|
199
|
+
hasData: false,
|
|
200
|
+
structuralOnly: false,
|
|
201
|
+
});
|
|
202
|
+
return {
|
|
203
|
+
status,
|
|
204
|
+
benchStatus: reason === "flag" ? "off" : "awaiting_data",
|
|
205
|
+
seed: null,
|
|
206
|
+
grid: null,
|
|
207
|
+
corpusSummary: null,
|
|
208
|
+
rows: null,
|
|
209
|
+
recommendedDefault: null,
|
|
210
|
+
shippedDefault: 0.85,
|
|
211
|
+
overrides: null,
|
|
212
|
+
fpBudget: null,
|
|
213
|
+
digest: null,
|
|
214
|
+
reportFileMtime: null,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
export function handleCosineFpReport(req, res, _ctx) {
|
|
218
|
+
const url = req.url ?? "";
|
|
219
|
+
if (url !== "/api/cosine-fp-report")
|
|
220
|
+
return false;
|
|
221
|
+
if (req.method !== "GET") {
|
|
222
|
+
sendJson(res, 405, { error: "method_not_allowed" });
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
if (!COSINE_FP_BENCH_ENABLED()) {
|
|
226
|
+
// Flag-off: 404 — byte-identical predecessor.
|
|
227
|
+
sendJson(res, 404, { error: "not_found" });
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
const runDir = benchRunDir();
|
|
231
|
+
if (runDir === null) {
|
|
232
|
+
sendJson(res, 200, awaitingDataBody("missing"));
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
// Memoized-facts pattern: serve a still-fresh entry keyed on {mtime,size}.
|
|
236
|
+
let size = 0;
|
|
237
|
+
let mtime = 0;
|
|
238
|
+
try {
|
|
239
|
+
const s = statSync(join(runDir, "cosine-fp-report.json")); // guardrails-allow PREVENT-PI-004: local stat (loopback)
|
|
240
|
+
size = s.size;
|
|
241
|
+
mtime = s.mtimeMs;
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
// no report on disk yet
|
|
245
|
+
}
|
|
246
|
+
if (size === 0 && mtime === 0) {
|
|
247
|
+
sendJson(res, 200, awaitingDataBody("missing"));
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
const key = `${mtime}:${size}`;
|
|
251
|
+
const now = Date.now();
|
|
252
|
+
if (memo !== null && memo.key === key && now - memo.at <= MEMO_TTL_MS) {
|
|
253
|
+
sendJson(res, 200, memo.body);
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
const aggregate = readAggregate(runDir);
|
|
257
|
+
const body = aggregate === null ? awaitingDataBody("missing") : buildBody(runDir, aggregate);
|
|
258
|
+
memo = { key, at: now, body };
|
|
259
|
+
sendJson(res, 200, body);
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
@@ -169,4 +169,12 @@ export const EXCLUDED_SETTINGS = [
|
|
|
169
169
|
"MEGACOMPACT_RAPTOR_LEVEL_WEIGHTS",
|
|
170
170
|
// Internal calibration, not user-facing.
|
|
171
171
|
"MEGACOMPACT_FTS5_MAX_BM25",
|
|
172
|
+
// COS-FP-A: per-content-type L2 override landing slots. Null/unset by
|
|
173
|
+
// default and NOT wired into the live L2 decision this sprint — the
|
|
174
|
+
// top-level MEGACOMPACT_L2_THRESHOLD is the single runtime firing point. A
|
|
175
|
+
// default-OFF numeric slot is not yet an adjustable firing knob, so it is
|
|
176
|
+
// excluded (the report carries the recommendation; adoption is a separate
|
|
177
|
+
// gated sprint).
|
|
178
|
+
"MEGACOMPACT_L2_THRESHOLD_CODE",
|
|
179
|
+
"MEGACOMPACT_L2_THRESHOLD_PROSE",
|
|
172
180
|
];
|
|
@@ -68,5 +68,7 @@ export const VECTOR_CORTEX_SETTINGS = {
|
|
|
68
68
|
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),
|
|
69
69
|
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),
|
|
70
70
|
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),
|
|
71
|
+
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),
|
|
72
|
+
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),
|
|
71
73
|
],
|
|
72
74
|
};
|
|
@@ -29,3 +29,4 @@ export { handleSetupCortexStatus } from "./routes-setup-cortex.js";
|
|
|
29
29
|
export { handleSetupCortexAction, handleSetupCortexActionLog, } from "./routes-setup-cortex-actions.js";
|
|
30
30
|
export { handleImproveCortex, handleImproveCortexStatus, } from "./routes-cortex-improve.js";
|
|
31
31
|
export { handleDedupTierAttribution } from "./routes-dedup-attribution.js";
|
|
32
|
+
export { handleCosineFpReport } from "./routes-cosine-fp.js";
|
package/dist/src/config/dedup.js
CHANGED
|
@@ -27,6 +27,15 @@ function envNum(name, def) {
|
|
|
27
27
|
const n = Number(v);
|
|
28
28
|
return Number.isFinite(n) ? n : def;
|
|
29
29
|
}
|
|
30
|
+
/** COS-FP-A: numeric env var that is `null` when unset ("off") — a dormant
|
|
31
|
+
* override whose absence must mean "no behavior change". */
|
|
32
|
+
function envNumOrNull(name) {
|
|
33
|
+
const v = process.env[name];
|
|
34
|
+
if (v === undefined || v === "off" || v === "")
|
|
35
|
+
return null;
|
|
36
|
+
const n = Number(v);
|
|
37
|
+
return Number.isFinite(n) ? n : null;
|
|
38
|
+
}
|
|
30
39
|
/** S42B: parse a comma-separated numeric env var (e.g. "1.0,0.9,0.8"). */
|
|
31
40
|
function envNumArray(name, def) {
|
|
32
41
|
const v = process.env[name];
|
|
@@ -51,6 +60,8 @@ export function loadDedupConfig() {
|
|
|
51
60
|
MARK_ONLY_L2: envBool("MEGACOMPACT_MARK_ONLY_L2", false),
|
|
52
61
|
MINILM_EMBEDDER: envBool("MEGACOMPACT_MINILM", false),
|
|
53
62
|
L2_COSINE: envNum("MEGACOMPACT_L2_THRESHOLD", 0.85),
|
|
63
|
+
L2_COSINE_CODE: envNumOrNull("MEGACOMPACT_L2_THRESHOLD_CODE"),
|
|
64
|
+
L2_COSINE_PROSE: envNumOrNull("MEGACOMPACT_L2_THRESHOLD_PROSE"),
|
|
54
65
|
L1_JACCARD: envNum("MEGACOMPACT_L1_JACCARD", 0.8),
|
|
55
66
|
DEDUP_SIM: envNum("MEGACOMPACT_DEDUP_SIM", 0.9),
|
|
56
67
|
MMR_LAMBDA: envNum("MEGACOMPACT_MMR_LAMBDA", 0.5),
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* config/vector-cortex-cosfp-real.ts — COS-FP-R real-corpus FP validation flag.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from vector-cortex.ts so that barrel stays under the 300-line soft
|
|
5
|
+
* limit (soft-as-hard gate), exactly as vector-cortex-cosfp.ts and the other
|
|
6
|
+
* per-sprint flag siblings were. Gating the real-corpus L2 cosine false-positive
|
|
7
|
+
* validation: the `scripts/cosine-fp/real-bench.mjs` execution harness that runs
|
|
8
|
+
* only when a consented donated corpus exists, the execution-time report rows,
|
|
9
|
+
* and the evidence record. A pure-local, consent-gated tool (SECURITY_PRIVACY
|
|
10
|
+
* §Lifecycle/§Consent + EVAL-REDACT-002) — it never reads real session/ledger
|
|
11
|
+
* bytes without an explicit per-session consent record.
|
|
12
|
+
*
|
|
13
|
+
* The split is mechanical: COSINE_FP_REAL_ENABLED is byte-identical in name,
|
|
14
|
+
* semantics, and default to the sibling flag convention (positive, default ON),
|
|
15
|
+
* and vector-cortex.ts re-exports it so every existing
|
|
16
|
+
* `from "./config/vector-cortex.js"` import keeps resolving unchanged.
|
|
17
|
+
*
|
|
18
|
+
* Pi-agnostic, dependency-free (PREVENT-PI-004 / PREVENT-011).
|
|
19
|
+
*/
|
|
20
|
+
import { sprintFlag } from "./vector-cortex-flag.js";
|
|
21
|
+
/**
|
|
22
|
+
* COS-FP-R — real-corpus L2 cosine FP validation against donated sessions.
|
|
23
|
+
* Default ON. `MEGACOMPACT_COSINE_FP_REAL=0` disables and is byte-identical to
|
|
24
|
+
* the predecessor: `scripts/cosine-fp/real-bench.mjs` is inert (nothing
|
|
25
|
+
* executes, no writes), no real-corpus report rows or evidence are written, and
|
|
26
|
+
* no threshold is adopted. When ON (default), execution still only proceeds when
|
|
27
|
+
* a valid consented corpus exists under `scripts/cosine-fp/corpus/` — absent
|
|
28
|
+
* corpus is the normative `no_corpus` pre-donation state, not a failure. Corpus
|
|
29
|
+
* bytes are read only for sessions with an explicit, append-only, revocable
|
|
30
|
+
* consent record (SECURITY_PRIVACY §Lifecycle/§Consent). This flag MUST also be
|
|
31
|
+
* a dashboard SETTINGS toggle (visible in config UI, never in EXCLUDED_SETTINGS).
|
|
32
|
+
* The harness performs only local filesystem reads (PREVENT-PI-004).
|
|
33
|
+
*/
|
|
34
|
+
export const COSINE_FP_REAL_ENABLED = () => sprintFlag("MEGACOMPACT_COSINE_FP_REAL");
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* config/vector-cortex-cosfp.ts — COS-FP-A synthetic FP harness sprint flag.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from vector-cortex.ts so that barrel stays under the 300-line soft
|
|
5
|
+
* limit (soft-as-hard gate), exactly as vector-cortex-vc9a.ts and the other
|
|
6
|
+
* per-sprint flag siblings were. Gating the synthetic cosine false-positive
|
|
7
|
+
* harness: the corpus/bench scripts, the derived report, and the reader-only
|
|
8
|
+
* GET /api/cosine-fp-report endpoint. A pure-local, synthetic-corpus-only tool
|
|
9
|
+
* (EVAL-REDACT-002) — it never reads real session/ledger bytes.
|
|
10
|
+
*
|
|
11
|
+
* The split is mechanical: COSINE_FP_BENCH_ENABLED is byte-identical in name,
|
|
12
|
+
* semantics, and default to the sibling flag convention (positive, default ON),
|
|
13
|
+
* and vector-cortex.ts re-exports it so every existing
|
|
14
|
+
* `from "./config/vector-cortex.js"` import 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
|
+
* COS-FP-A — synthetic FP harness + L2 cosine threshold calibration.
|
|
21
|
+
* Default ON. `MEGACOMPACT_COSINE_FP_BENCH=0` disables and is byte-identical to
|
|
22
|
+
* the predecessor: `scripts/cosine-fp/bench.mjs` is inert (gates report
|
|
23
|
+
* emission + the endpoint to 404/absent), no report is (re)written, and
|
|
24
|
+
* `L2_COSINE` continues to be plain `MEGACOMPACT_L2_THRESHOLD`. The two
|
|
25
|
+
* content-type override fields added to config/dedup.ts are null when unset and
|
|
26
|
+
* are NOT wired into the live L2 decision this sprint (a declared landing slot
|
|
27
|
+
* for the report's per-content-type recommendation). This flag MUST also be a
|
|
28
|
+
* dashboard SETTINGS toggle (visible in config UI, never in EXCLUDED_SETTINGS).
|
|
29
|
+
* The harness + endpoint perform only local filesystem reads (PREVENT-PI-004).
|
|
30
|
+
*/
|
|
31
|
+
export const COSINE_FP_BENCH_ENABLED = () => sprintFlag("MEGACOMPACT_COSINE_FP_BENCH");
|
|
@@ -32,6 +32,10 @@ export { ENC_0D_ENABLED } from "./vector-cortex-enc0d.js";
|
|
|
32
32
|
export { ENC_0E_ENABLED } from "./vector-cortex-enc0e.js";
|
|
33
33
|
export { ENC_0F_ENABLED } from "./vector-cortex-enc0f.js";
|
|
34
34
|
export { ENC_0G_ENABLED } from "./vector-cortex-enc0g.js";
|
|
35
|
+
// COS-FP-A synthetic FP harness flag extracted to vector-cortex-cosfp.ts.
|
|
36
|
+
export { COSINE_FP_BENCH_ENABLED } from "./vector-cortex-cosfp.js";
|
|
37
|
+
// COS-FP-R real-corpus FP validation flag extracted to vector-cortex-cosfp-real.ts.
|
|
38
|
+
export { COSINE_FP_REAL_ENABLED } from "./vector-cortex-cosfp-real.js";
|
|
35
39
|
export { ENC_1A_ENABLED } from "./vector-cortex-enc1a.js";
|
|
36
40
|
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";
|
|
37
41
|
export { ENC_2BUDGET_ENABLED, ENC_2BUDGET_NATIVE_ORT_BUDGET_ENV, ENC_2BUDGET_MAX_MIB, ENC_2BUDGET_DEFAULT_MIB, } from "./vector-cortex-enc2budget.js";
|
package/dist/src/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, 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, COSINE_FP_BENCH_ENABLED, COSINE_FP_REAL_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";
|
package/extensions/dashboard-client/dist/assets/{AreaChart-COjQ_jJm.js → AreaChart-DlndN0p2.js}
RENAMED
|
@@ -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-Bi8zQmZN.js";import{R as p,A as ee,r as ve}from"./index-mZRDesSq.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-
|
|
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-D1HV4d79.js";import{R as p,E as ee,r as ve}from"./index-Bi5YNsLx.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-DlndN0p2.js.map
|