pi-mega-compact 0.20.2 → 0.20.4
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.js +13 -0
- package/dist/config.js +1 -1
- package/dist/extensions/dashboard-server/routes-rag-settings-helpers.js +1 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-plans.js +49 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex.js +1 -0
- package/dist/extensions/dashboard-server/routes.js +1 -1
- package/dist/extensions/dashboard-server/server.js +29 -22
- package/dist/src/config/vector-cortex.js +13 -0
- package/dist/src/config.js +1 -1
- package/dist/src/vector-cortex/planner/manifest.js +66 -0
- package/dist/src/vector-cortex/planner/portfolio.js +0 -0
- package/dist/src/vector-cortex/planner/types.js +41 -0
- package/dist/src/vector-cortex/prompt-dag/_acceptance-dag.js +347 -0
- package/dist/src/vector-cortex/prompt-dag/_acceptance-fixture.js +59 -0
- package/dist/src/vector-cortex/prompt-dag/_acceptance-helpers.js +17 -0
- package/dist/src/vector-cortex/prompt-dag/_acceptance-planner.js +153 -0
- package/dist/src/vector-cortex/prompt-dag/_acceptance-shuffle.js +24 -0
- package/dist/src/vector-cortex/prompt-dag/builder.js +171 -0
- package/dist/src/vector-cortex/prompt-dag/types.js +33 -0
- package/dist/src/vector-cortex/prompt-dag/validator.js +0 -0
- package/dist/vector-cortex/planner/manifest.js +66 -0
- package/dist/vector-cortex/planner/portfolio.js +0 -0
- package/dist/vector-cortex/planner/types.js +41 -0
- package/dist/vector-cortex/prompt-dag/_acceptance-dag.js +347 -0
- package/dist/vector-cortex/prompt-dag/_acceptance-fixture.js +59 -0
- package/dist/vector-cortex/prompt-dag/_acceptance-helpers.js +17 -0
- package/dist/vector-cortex/prompt-dag/_acceptance-planner.js +153 -0
- package/dist/vector-cortex/prompt-dag/_acceptance-shuffle.js +24 -0
- package/dist/vector-cortex/prompt-dag/builder.js +171 -0
- package/dist/vector-cortex/prompt-dag/types.js +33 -0
- package/dist/vector-cortex/prompt-dag/validator.js +0 -0
- package/extensions/dashboard-client/dist/assets/{AreaChart-XF3jPpvn.js → AreaChart-Cam9-nhT.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-XF3jPpvn.js.map → AreaChart-Cam9-nhT.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-DnYYn0GF.js → BarChart-DzIY8aM1.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-DnYYn0GF.js.map → BarChart-DzIY8aM1.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-D3bVskCL.js → CacheTab-CKIiYsG_.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-D3bVskCL.js.map → CacheTab-CKIiYsG_.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-CX_8myfc.js → EventsTab-xaaBJLiK.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-CX_8myfc.js.map → EventsTab-xaaBJLiK.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-CnVzBQvN.js → HealthTab-BGtUKOqG.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-CnVzBQvN.js.map → HealthTab-BGtUKOqG.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-Cao--dtV.js → MaintenanceTab-ABgQnTZ9.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-Cao--dtV.js.map → MaintenanceTab-ABgQnTZ9.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-DZdI-9ig.js → MemoryMapTab-ChR2GAN-.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-DZdI-9ig.js.map → MemoryMapTab-ChR2GAN-.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsTab-SlpSmNU4.js → MetricsTab-DdCLAgcR.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-SlpSmNU4.js.map → MetricsTab-DdCLAgcR.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-C_-_4au9.js → OverviewTab-DtemzJt6.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-C_-_4au9.js.map → OverviewTab-DtemzJt6.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-CyWedWZC.js → ReposTab-B9mvD9Ep.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-CyWedWZC.js.map → ReposTab-B9mvD9Ep.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-wqPBMIJZ.js → SessionsTab-BcO38XLS.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-wqPBMIJZ.js.map → SessionsTab-BcO38XLS.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-MojXmuUf.js → SetupTab-D_TBNP09.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-MojXmuUf.js.map → SetupTab-D_TBNP09.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BxcplEOJ.js → TimeSavedCard-TjHpbUOo.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BxcplEOJ.js.map → TimeSavedCard-TjHpbUOo.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-D8_qWbjY.js → TurnsTab-DprxndCF.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnsTab-D8_qWbjY.js.map → TurnsTab-DprxndCF.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-Bym21yVQ.js +2 -0
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-Bym21yVQ.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{WikiTab-Cfd-QZYz.js → WikiTab-OKgSo15G.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-Cfd-QZYz.js.map → WikiTab-OKgSo15G.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-tX5ht0bb.js → button-D_Qz4q7L.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-tX5ht0bb.js.map → button-D_Qz4q7L.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-BT3Z5dDg.js → card-CsI6Jm3p.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-BT3Z5dDg.js.map → card-CsI6Jm3p.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-B6p2WnkY.js → generateCategoricalChart-CvHKUdhX.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-B6p2WnkY.js.map → generateCategoricalChart-CvHKUdhX.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-CFLekP12.js → index-0Ye_un22.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{index-CFLekP12.js.map → index-0Ye_un22.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{switch-B52oAMSw.js → switch-VQEoJl8Q.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-B52oAMSw.js.map → switch-VQEoJl8Q.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-VxxVc5Tp.js → toggle-CAPm4HJo.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-VxxVc5Tp.js.map → toggle-CAPm4HJo.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-DAVdZnG7.js → useSSE-pxsNTVkh.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-DAVdZnG7.js.map → useSSE-pxsNTVkh.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/api/vector-cortex.ts +9 -0
- package/extensions/dashboard-client/src/tabs/VectorCortexTab.tsx +35 -0
- package/extensions/dashboard-client/src/types/vector-cortex.ts +20 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex.ts +38 -0
- package/extensions/dashboard-server/routes-rag-settings-helpers.ts +6 -0
- package/extensions/dashboard-server/routes-vector-cortex-plans.ts +58 -0
- package/extensions/dashboard-server/routes-vector-cortex.ts +1 -0
- package/extensions/dashboard-server/routes.ts +1 -0
- package/extensions/dashboard-server/server.ts +31 -22
- package/package.json +1 -1
- package/src/config/vector-cortex.ts +14 -0
- package/src/config.ts +1 -0
- package/src/vector-cortex/planner/manifest.ts +83 -0
- package/src/vector-cortex/planner/portfolio.ts +0 -0
- package/src/vector-cortex/planner/types.ts +190 -0
- package/src/vector-cortex/prompt-dag/_acceptance-dag.ts +392 -0
- package/src/vector-cortex/prompt-dag/_acceptance-fixture.ts +132 -0
- package/src/vector-cortex/prompt-dag/_acceptance-helpers.ts +39 -0
- package/src/vector-cortex/prompt-dag/_acceptance-planner.ts +188 -0
- package/src/vector-cortex/prompt-dag/_acceptance-shuffle.ts +26 -0
- package/src/vector-cortex/prompt-dag/builder.ts +189 -0
- package/src/vector-cortex/prompt-dag/types.ts +151 -0
- package/src/vector-cortex/prompt-dag/validator.ts +0 -0
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-B3yisAyB.js +0 -2
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-B3yisAyB.js.map +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prompt-dag/_acceptance-fixture.ts — conformance fixture I/O for VC5A DAG +
|
|
3
|
+
* planner acceptance rows.
|
|
4
|
+
*
|
|
5
|
+
* Reads the v2 conformance manifest + the per-sprint fixture files, and exposes
|
|
6
|
+
* the `DagFixture` / `PlnFixture` shapes the acceptance aggregator drives. No
|
|
7
|
+
* mocks/stubs: the fixtures are the committed canonical corpus.
|
|
8
|
+
*/
|
|
9
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
10
|
+
import { join, dirname } from "node:path";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
12
|
+
import assert from "node:assert/strict";
|
|
13
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
function repoRoot(from) {
|
|
15
|
+
let dir = from;
|
|
16
|
+
for (let i = 0; i < 8; i++) {
|
|
17
|
+
if (existsSync(join(dir, "conformance", "vector-cortex")))
|
|
18
|
+
return dir;
|
|
19
|
+
const next = dirname(dir);
|
|
20
|
+
if (next === dir)
|
|
21
|
+
break;
|
|
22
|
+
dir = next;
|
|
23
|
+
}
|
|
24
|
+
throw new Error("conformance corpus not found above " + from);
|
|
25
|
+
}
|
|
26
|
+
export const REPO_ROOT = repoRoot(HERE);
|
|
27
|
+
export const V2 = join(REPO_ROOT, "conformance", "vector-cortex", "v2");
|
|
28
|
+
export function readManifest() {
|
|
29
|
+
return JSON.parse(readFileSync(join(V2, "manifest.json"), "utf8"));
|
|
30
|
+
}
|
|
31
|
+
/** Resolve a fixture row by ID, restricting to one of this sprint's two roots. */
|
|
32
|
+
function readFixture(id, prefix) {
|
|
33
|
+
const m = readManifest();
|
|
34
|
+
const row = m.fixtures.find((f) => f.id === id && f.path.startsWith(`${prefix}/`));
|
|
35
|
+
assert.ok(row, `fixture ${id} registered under ${prefix}/ in manifest`);
|
|
36
|
+
return JSON.parse(readFileSync(join(V2, row.path), "utf8"));
|
|
37
|
+
}
|
|
38
|
+
export function dagFixture(id) {
|
|
39
|
+
return readFixture(id, "prompt-dag");
|
|
40
|
+
}
|
|
41
|
+
export function plnFixture(id) {
|
|
42
|
+
return readFixture(id, "planner");
|
|
43
|
+
}
|
|
44
|
+
/** Flag-pinned wrapper: VC5A gated by MEGACOMPACT_VC5A (defaults ON). */
|
|
45
|
+
export function withFlagsOn(fn) {
|
|
46
|
+
return () => {
|
|
47
|
+
const saved = process.env.MEGACOMPACT_VC5A;
|
|
48
|
+
process.env.MEGACOMPACT_VC5A = "1";
|
|
49
|
+
try {
|
|
50
|
+
fn();
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
if (saved === undefined)
|
|
54
|
+
delete process.env.MEGACOMPACT_VC5A;
|
|
55
|
+
else
|
|
56
|
+
process.env.MEGACOMPACT_VC5A = saved;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prompt-dag/_acceptance-helpers.ts — barrel re-export for the VC5A DAG +
|
|
3
|
+
* planner acceptance rows.
|
|
4
|
+
*
|
|
5
|
+
* The implementation is split across focused sibling files to keep each under
|
|
6
|
+
* the src/ 500-line hard limit; this file is the single import surface the
|
|
7
|
+
* acceptance aggregator uses:
|
|
8
|
+
* - `_acceptance-fixture.ts` — manifest I/O + DagFixture/PlnFixture shapes + withFlagsOn
|
|
9
|
+
* - `_acceptance-dag.ts` — declarative DAG materialization + runDagScenario
|
|
10
|
+
* - `_acceptance-planner.ts` — candidate-set materialization + runPlannerScenario
|
|
11
|
+
* - `_acceptance-shuffle.ts` — deterministic eq/shuffle helpers
|
|
12
|
+
*
|
|
13
|
+
* Every function drives the REAL prompt-dag / planner logic — no mocks, no stubs.
|
|
14
|
+
*/
|
|
15
|
+
export { REPO_ROOT, V2, readManifest, dagFixture, plnFixture, withFlagsOn, } from "./_acceptance-fixture.js";
|
|
16
|
+
export { materializeDag, runDagScenario } from "./_acceptance-dag.js";
|
|
17
|
+
export { materializeCandidates, runPlannerScenario } from "./_acceptance-planner.js";
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prompt-dag/_acceptance-planner.ts — declarative candidate-set materialization
|
|
3
|
+
* + scenario driver for VC5A planner acceptance rows.
|
|
4
|
+
*
|
|
5
|
+
* Turns named candidate-set scenarios into real `PlanCandidate[]` values and
|
|
6
|
+
* drives them through the REAL portfolio planner (planPortfolio). The
|
|
7
|
+
* `mandatoryTokenEstimate` is the VC4C content-only figure = sum of mandatory
|
|
8
|
+
* content tokens (zero-framing fixtures pin this exactly).
|
|
9
|
+
*/
|
|
10
|
+
import assert from "node:assert/strict";
|
|
11
|
+
import { planPortfolio, planManifestDigest, validatePlanManifest, } from "../planner/portfolio.js";
|
|
12
|
+
import { DEFAULT_FRAMING } from "../planner/types.js";
|
|
13
|
+
import { shuffle } from "./_acceptance-shuffle.js";
|
|
14
|
+
export function materializeCandidates(name) {
|
|
15
|
+
const sets = {
|
|
16
|
+
// m1=10, m2=20 mandatory → 30 content tokens (zero-framing fixtures pin this).
|
|
17
|
+
"mandatory-only": [
|
|
18
|
+
{ nodeId: "m1", tokenEstimate: 10, utility: 100, sourceSeq: 1n, mandatory: true },
|
|
19
|
+
{ nodeId: "m2", tokenEstimate: 20, utility: 200, sourceSeq: 2n, mandatory: true },
|
|
20
|
+
],
|
|
21
|
+
// Two mandatory nodes totalling 101 content tokens → over budget at 100.
|
|
22
|
+
"mandatory-101": [
|
|
23
|
+
{ nodeId: "m1", tokenEstimate: 50, utility: 100, sourceSeq: 1n, mandatory: true },
|
|
24
|
+
{ nodeId: "m2", tokenEstimate: 51, utility: 200, sourceSeq: 2n, mandatory: true },
|
|
25
|
+
],
|
|
26
|
+
// Optional candidates: hi=10t/20u (ratio 2.0), mid=10t/10u (ratio 1.0), lo=10t/5u.
|
|
27
|
+
ratio: [
|
|
28
|
+
{ nodeId: "hi", tokenEstimate: 10, utility: 20, sourceSeq: 1n, mandatory: false },
|
|
29
|
+
{ nodeId: "mid", tokenEstimate: 10, utility: 10, sourceSeq: 2n, mandatory: false },
|
|
30
|
+
{ nodeId: "lo", tokenEstimate: 10, utility: 5, sourceSeq: 3n, mandatory: false },
|
|
31
|
+
],
|
|
32
|
+
// Equal ratios (1.0) → source seq tie-break (early=seq1 wins).
|
|
33
|
+
"tie-seq": [
|
|
34
|
+
{ nodeId: "early", tokenEstimate: 10, utility: 10, sourceSeq: 1n, mandatory: false },
|
|
35
|
+
{ nodeId: "late", tokenEstimate: 10, utility: 10, sourceSeq: 2n, mandatory: false },
|
|
36
|
+
],
|
|
37
|
+
// Equal ratios AND equal source seq → lower ID bytes wins.
|
|
38
|
+
"tie-id": [
|
|
39
|
+
{ nodeId: "bbb", tokenEstimate: 10, utility: 10, sourceSeq: 1n, mandatory: false },
|
|
40
|
+
{ nodeId: "aaa", tokenEstimate: 10, utility: 10, sourceSeq: 1n, mandatory: false },
|
|
41
|
+
],
|
|
42
|
+
// One indivisible optional node of 10t/10u: 0/1 means it is taken whole.
|
|
43
|
+
indivisible: [
|
|
44
|
+
{ nodeId: "one", tokenEstimate: 10, utility: 10, sourceSeq: 1n, mandatory: false },
|
|
45
|
+
],
|
|
46
|
+
// A zero-utility optional node must be omitted.
|
|
47
|
+
"zero-utility": [
|
|
48
|
+
{ nodeId: "zero", tokenEstimate: 5, utility: 0, sourceSeq: 1n, mandatory: false },
|
|
49
|
+
],
|
|
50
|
+
// An optional node incompatible with a mandatory node is omitted (the planner
|
|
51
|
+
// enforces `incompatiblePairs`; here `bad` is mutually exclusive with `m1`).
|
|
52
|
+
incompatible: [
|
|
53
|
+
{ nodeId: "m1", tokenEstimate: 10, utility: 100, sourceSeq: 1n, mandatory: true },
|
|
54
|
+
{ nodeId: "bad", tokenEstimate: 5, utility: 50, sourceSeq: 2n, mandatory: false },
|
|
55
|
+
],
|
|
56
|
+
// Mixed: 2 mandatory + optional candidates exercising closure + selection.
|
|
57
|
+
mixed: [
|
|
58
|
+
{ nodeId: "m1", tokenEstimate: 10, utility: 100, sourceSeq: 1n, mandatory: true },
|
|
59
|
+
{ nodeId: "m2", tokenEstimate: 20, utility: 200, sourceSeq: 2n, mandatory: true },
|
|
60
|
+
{ nodeId: "opt", tokenEstimate: 30, utility: 90, sourceSeq: 3n, mandatory: false },
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
const set = sets[name];
|
|
64
|
+
assert.ok(set, `candidate-set materializer missing for "${name}"`);
|
|
65
|
+
return set;
|
|
66
|
+
}
|
|
67
|
+
function framing(zero) {
|
|
68
|
+
return zero ? { perNode: 0, overhead: 0 } : DEFAULT_FRAMING;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Drive a planner fixture scenario through the REAL portfolio planner. The
|
|
72
|
+
* `mandatoryTokenEstimate` is the VC4C CONTENT-ONLY figure = sum of mandatory
|
|
73
|
+
* content tokens (zero-framing fixtures make that the exact candidate sum).
|
|
74
|
+
*/
|
|
75
|
+
export function runPlannerScenario(fx) {
|
|
76
|
+
const { candidates: setName, tokenBudget, zeroFraming, permute, mutateTokensAfterPlan } = fx.input;
|
|
77
|
+
const cands = materializeCandidates(setName);
|
|
78
|
+
// VC4C content-only mandatory estimate = sum of mandatory content tokens.
|
|
79
|
+
const mandatoryTokenEstimate = cands
|
|
80
|
+
.filter((c) => c.mandatory)
|
|
81
|
+
.reduce((s, c) => s + c.tokenEstimate, 0);
|
|
82
|
+
const dagDigest = "deadbeef".repeat(8);
|
|
83
|
+
// The `incompatible` set wires an explicit mutual-exclusion pair (bad ⊥ m1) so
|
|
84
|
+
// the planner's incompatibility gate is exercised end-to-end.
|
|
85
|
+
const incompatiblePairs = setName === "incompatible" ? [["bad", "m1"]] : undefined;
|
|
86
|
+
const input = {
|
|
87
|
+
dagDigest,
|
|
88
|
+
candidates: permute ? shuffle([...cands]) : cands,
|
|
89
|
+
mandatoryTokenEstimate,
|
|
90
|
+
tokenBudget,
|
|
91
|
+
dependencyHighWater: 100n,
|
|
92
|
+
framing: framing(zeroFraming),
|
|
93
|
+
...(incompatiblePairs ? { incompatiblePairs } : {}),
|
|
94
|
+
};
|
|
95
|
+
const res = planPortfolio(input);
|
|
96
|
+
if (fx.expected.permutationInvariant) {
|
|
97
|
+
const a = planPortfolio(input);
|
|
98
|
+
const b = planPortfolio({ ...input, candidates: shuffle([...cands]) });
|
|
99
|
+
const ids = (ok) => (ok.ok ? [...ok.plan.selectedNodeIds] : []);
|
|
100
|
+
return { ok: true, permutationInvariant: JSON.stringify(ids(a)) === JSON.stringify(ids(b)) };
|
|
101
|
+
}
|
|
102
|
+
if (!res.ok) {
|
|
103
|
+
// Over-budget failure: mandatory set preserved intact, demotes to C.
|
|
104
|
+
const mandatoryIds = cands.filter((c) => c.mandatory).map((c) => c.nodeId).sort();
|
|
105
|
+
const preserved = res.mandatory.slice().sort().join(",") === mandatoryIds.join(",");
|
|
106
|
+
return {
|
|
107
|
+
ok: false,
|
|
108
|
+
code: res.code,
|
|
109
|
+
mandatoryPreserved: preserved,
|
|
110
|
+
demotesToC: res.code === "MANDATORY_CLOSURE_OVER_BUDGET",
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
// ── Accepted-plan assertions ──
|
|
114
|
+
const plan = res.plan;
|
|
115
|
+
const selected = [...plan.selectedNodeIds];
|
|
116
|
+
const out = { ok: true, selected, tokenTotal: plan.tokenTotal };
|
|
117
|
+
if (fx.expected.firstSelected !== undefined)
|
|
118
|
+
out.firstSelected = selected[0];
|
|
119
|
+
if (fx.expected.withinBudget)
|
|
120
|
+
out.withinBudget = plan.tokenTotal <= tokenBudget;
|
|
121
|
+
if (fx.expected.noPartialSelection) {
|
|
122
|
+
out.noPartialSelection = cands.every((c) => !c.mandatory || selected.includes(c.nodeId));
|
|
123
|
+
}
|
|
124
|
+
if (fx.expected.planIsClosed) {
|
|
125
|
+
const mandatoryIds = cands.filter((c) => c.mandatory).map((c) => c.nodeId).sort();
|
|
126
|
+
out.planIsClosed = mandatoryIds.every((id) => selected.includes(id));
|
|
127
|
+
}
|
|
128
|
+
if (fx.expected.omittedOverBudget) {
|
|
129
|
+
const omit = plan.omissions.some((o) => o.reason === "over-budget");
|
|
130
|
+
out.omittedOverBudget = omit;
|
|
131
|
+
}
|
|
132
|
+
if (fx.expected.omittedZeroUtility) {
|
|
133
|
+
out.omittedZeroUtility = plan.omissions.some((o) => o.reason === "zero-utility");
|
|
134
|
+
}
|
|
135
|
+
if (fx.expected.omittedIncompatible) {
|
|
136
|
+
out.omittedIncompatible = plan.omissions.some((o) => o.reason === "incompatible");
|
|
137
|
+
}
|
|
138
|
+
// Manifest identity: a post-plan token mutation must fail revalidation.
|
|
139
|
+
if (mutateTokensAfterPlan) {
|
|
140
|
+
const pinned = planManifestDigest(plan, cands);
|
|
141
|
+
const mutated = cands.map((c, i) => (i === 0 ? { ...c, tokenEstimate: c.tokenEstimate + 1 } : c));
|
|
142
|
+
const check = validatePlanManifest(plan, mutated, pinned);
|
|
143
|
+
out.ok = check.ok; // false → plan rejected, never reaches provider
|
|
144
|
+
out.code = check.ok ? undefined : check.code;
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
if (fx.expected.manifestStable) {
|
|
148
|
+
const pinned = planManifestDigest(plan, cands);
|
|
149
|
+
const check = validatePlanManifest(plan, cands, pinned);
|
|
150
|
+
out.manifestStable = check.ok;
|
|
151
|
+
}
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prompt-dag/_acceptance-shuffle.ts — small deterministic helpers shared by the
|
|
3
|
+
* VC5A acceptance DAG/planner materializers.
|
|
4
|
+
*/
|
|
5
|
+
/** Array element equality (length + pairwise). */
|
|
6
|
+
export function eq(a, b) {
|
|
7
|
+
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Fisher–Yates with a FIXED seed so permutation tests are reproducible across
|
|
11
|
+
* runs and machines (no Math.random in tests).
|
|
12
|
+
*/
|
|
13
|
+
export function shuffle(arr) {
|
|
14
|
+
const a = [...arr];
|
|
15
|
+
let seed = 0x9e3779b9;
|
|
16
|
+
for (let i = a.length - 1; i > 0; i--) {
|
|
17
|
+
seed = (seed * 1664525 + 1013904223) >>> 0;
|
|
18
|
+
const j = seed % (i + 1);
|
|
19
|
+
const t = a[i];
|
|
20
|
+
a[i] = a[j];
|
|
21
|
+
a[j] = t;
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex/prompt-dag/builder.ts — single-session PromptDagV1 construction
|
|
3
|
+
* (VC5A, task 2).
|
|
4
|
+
*
|
|
5
|
+
* The builder is the STRUCTURAL gate: it rejects a graph that could never be
|
|
6
|
+
* planned safely, before any ordering or selection is attempted. Rejections are
|
|
7
|
+
* hard and total (the sprint bar: "cycles/incompatibilities rejected 100%"):
|
|
8
|
+
*
|
|
9
|
+
* - `DAG_MIXED_SESSION` — a span whose sessionId differs from the DAG's.
|
|
10
|
+
* Cross-session evidence MUST be a synthetic
|
|
11
|
+
* node citing a separately validated manifest,
|
|
12
|
+
* never a foreign span (CONTRACTS §PromptDagV1).
|
|
13
|
+
* - `DAG_DUPLICATE_ID` — two nodes sharing an id.
|
|
14
|
+
* - `DAG_MISSING_ENDPOINT` — an edge naming an absent node.
|
|
15
|
+
* - `DAG_INVALID_SPAN` — reversed/negative range, or a synthetic node
|
|
16
|
+
* carrying a span (synthetics have no source
|
|
17
|
+
* position by definition).
|
|
18
|
+
* - `DAG_SPAN_DIGEST_CONFLICT` — two overlapping spans pinning DIFFERENT
|
|
19
|
+
* digests for the same bytes: a corrupted or
|
|
20
|
+
* forged source claim, not a legal overlap.
|
|
21
|
+
* - `DAG_UNKNOWN_INCOMPATIBLE` — `incompatibleWith` naming an absent node.
|
|
22
|
+
* - `DAG_TOOL_PAIR_SPLIT` — a tool-pair edge whose endpoints are not both
|
|
23
|
+
* present (PREVENT-PI-002).
|
|
24
|
+
*
|
|
25
|
+
* Cycle and reversed-`precedes` detection belong to the VALIDATOR, which owns
|
|
26
|
+
* the topological order; the builder only guarantees the graph is structurally
|
|
27
|
+
* well-formed and single-session.
|
|
28
|
+
*
|
|
29
|
+
* Determinism: nodes and edges are emitted in a canonical sorted order so the
|
|
30
|
+
* same inputs always produce byte-identical DAG bytes, whatever order the caller
|
|
31
|
+
* supplied them in. Pure: no storage, no console, no network (PREVENT-PI-004).
|
|
32
|
+
*/
|
|
33
|
+
/** Bytewise string comparison — the universal deterministic tie-break. */
|
|
34
|
+
function byBytes(a, b) {
|
|
35
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Canonical node order: source position first (`startSeq`, then `startByte`),
|
|
39
|
+
* synthetics last (they have no span), then `syntheticOrdinal`, then id bytes.
|
|
40
|
+
* This mirrors the validator's queue key so the emitted DAG and its topological
|
|
41
|
+
* order agree on what "earlier" means.
|
|
42
|
+
*/
|
|
43
|
+
export function compareNodes(a, b) {
|
|
44
|
+
const aSeq = a.span?.startSeq;
|
|
45
|
+
const bSeq = b.span?.startSeq;
|
|
46
|
+
if (aSeq !== undefined && bSeq !== undefined) {
|
|
47
|
+
if (aSeq !== bSeq)
|
|
48
|
+
return aSeq < bSeq ? -1 : 1;
|
|
49
|
+
}
|
|
50
|
+
else if (aSeq !== undefined) {
|
|
51
|
+
return -1; // spanned nodes precede synthetics
|
|
52
|
+
}
|
|
53
|
+
else if (bSeq !== undefined) {
|
|
54
|
+
return 1;
|
|
55
|
+
}
|
|
56
|
+
// Contract key: (startSeq, syntheticOrdinal, id bytes) — byte offset is NOT a
|
|
57
|
+
// tie-break, so the emitted DAG and its topological order agree exactly.
|
|
58
|
+
const aOrd = a.syntheticOrdinal ?? 0;
|
|
59
|
+
const bOrd = b.syntheticOrdinal ?? 0;
|
|
60
|
+
if (aOrd !== bOrd)
|
|
61
|
+
return aOrd < bOrd ? -1 : 1;
|
|
62
|
+
return byBytes(a.id, b.id);
|
|
63
|
+
}
|
|
64
|
+
/** Canonical edge order: from, then to, then kind — a total order. */
|
|
65
|
+
export function compareEdges(a, b) {
|
|
66
|
+
const f = byBytes(a.from, b.from);
|
|
67
|
+
if (f !== 0)
|
|
68
|
+
return f;
|
|
69
|
+
const t = byBytes(a.to, b.to);
|
|
70
|
+
if (t !== 0)
|
|
71
|
+
return t;
|
|
72
|
+
return byBytes(a.kind, b.kind);
|
|
73
|
+
}
|
|
74
|
+
/** Whether two half-open byte ranges in the same session intersect. */
|
|
75
|
+
function spansOverlap(a, b) {
|
|
76
|
+
if (a.sessionId !== b.sessionId)
|
|
77
|
+
return false;
|
|
78
|
+
return a.startByte < b.endByte && b.startByte < a.endByte;
|
|
79
|
+
}
|
|
80
|
+
/** A span is well-formed when both its seq and byte ranges are non-decreasing. */
|
|
81
|
+
function spanIsValid(span) {
|
|
82
|
+
if (span.startSeq > span.endSeq)
|
|
83
|
+
return false;
|
|
84
|
+
if (span.startByte < 0 || span.endByte < 0)
|
|
85
|
+
return false;
|
|
86
|
+
return span.startByte <= span.endByte;
|
|
87
|
+
}
|
|
88
|
+
/** Push a failure code once (codes are a SET, reported in discovery order). */
|
|
89
|
+
function pushCode(codes, code) {
|
|
90
|
+
if (!codes.includes(code))
|
|
91
|
+
codes.push(code);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Build a canonical single-session `PromptDagV1`, or reject with the exact
|
|
95
|
+
* structural failure codes (task 2).
|
|
96
|
+
*
|
|
97
|
+
* Every check runs before returning so a caller sees ALL structural problems at
|
|
98
|
+
* once rather than fixing them one round-trip at a time; the codes array is
|
|
99
|
+
* deduplicated and ordered by discovery.
|
|
100
|
+
*/
|
|
101
|
+
export function buildPromptDag(input) {
|
|
102
|
+
const codes = [];
|
|
103
|
+
// ── Node identity + span validity + single-session enforcement ─────────────
|
|
104
|
+
const byId = new Map();
|
|
105
|
+
for (const n of input.nodes) {
|
|
106
|
+
if (byId.has(n.id))
|
|
107
|
+
pushCode(codes, "DAG_DUPLICATE_ID");
|
|
108
|
+
else
|
|
109
|
+
byId.set(n.id, n);
|
|
110
|
+
if (n.kind === "synthetic") {
|
|
111
|
+
// A synthetic node has no source position by definition; carrying a span
|
|
112
|
+
// would make its ordering ambiguous against real source nodes.
|
|
113
|
+
if (n.span !== undefined)
|
|
114
|
+
pushCode(codes, "DAG_INVALID_SPAN");
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (n.span === undefined)
|
|
118
|
+
continue; // a spanless non-synthetic orders last
|
|
119
|
+
if (!spanIsValid(n.span))
|
|
120
|
+
pushCode(codes, "DAG_INVALID_SPAN");
|
|
121
|
+
// Single-session: cross-session evidence must be a synthetic citation.
|
|
122
|
+
if (n.span.sessionId !== input.sessionId)
|
|
123
|
+
pushCode(codes, "DAG_MIXED_SESSION");
|
|
124
|
+
}
|
|
125
|
+
// ── Overlapping spans must agree on the digest of the shared bytes ─────────
|
|
126
|
+
const spanned = input.nodes.filter((n) => n.span !== undefined);
|
|
127
|
+
for (let i = 0; i < spanned.length; i++) {
|
|
128
|
+
for (let j = i + 1; j < spanned.length; j++) {
|
|
129
|
+
const a = spanned[i];
|
|
130
|
+
const b = spanned[j];
|
|
131
|
+
if (!spansOverlap(a.span, b.span))
|
|
132
|
+
continue;
|
|
133
|
+
if (a.span.digest !== b.span.digest) {
|
|
134
|
+
pushCode(codes, "DAG_SPAN_DIGEST_CONFLICT");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// ── Incompatibility targets must exist ────────────────────────────────────
|
|
139
|
+
for (const n of input.nodes) {
|
|
140
|
+
for (const other of n.incompatibleWith) {
|
|
141
|
+
if (!byId.has(other))
|
|
142
|
+
pushCode(codes, "DAG_UNKNOWN_INCOMPATIBLE");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// ── Edge endpoints must exist; tool pairs must be whole ───────────────────
|
|
146
|
+
for (const e of input.edges) {
|
|
147
|
+
const hasFrom = byId.has(e.from);
|
|
148
|
+
const hasTo = byId.has(e.to);
|
|
149
|
+
if (!hasFrom || !hasTo) {
|
|
150
|
+
pushCode(codes, "DAG_MISSING_ENDPOINT");
|
|
151
|
+
// A tool pair missing an endpoint is ALSO a split pair (PREVENT-PI-002):
|
|
152
|
+
// the atomic unit cannot be represented, let alone selected whole.
|
|
153
|
+
if (e.kind === "tool-pair")
|
|
154
|
+
pushCode(codes, "DAG_TOOL_PAIR_SPLIT");
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (codes.length > 0)
|
|
158
|
+
return { ok: false, codes };
|
|
159
|
+
const nodes = [...input.nodes].sort(compareNodes);
|
|
160
|
+
const edges = [...input.edges].sort(compareEdges);
|
|
161
|
+
return {
|
|
162
|
+
ok: true,
|
|
163
|
+
dag: {
|
|
164
|
+
schema: "prompt-dag-v1",
|
|
165
|
+
sessionId: input.sessionId,
|
|
166
|
+
sourceHighWater: input.sourceHighWater,
|
|
167
|
+
nodes,
|
|
168
|
+
edges,
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex/prompt-dag/types.ts — the exact single-session `PromptDagV1`
|
|
3
|
+
* schema (VC5A, task 1).
|
|
4
|
+
*
|
|
5
|
+
* A PromptDagV1 is the STRUCTURE a plan is selected over: nodes are prompt
|
|
6
|
+
* candidates (events, exact spans, semantic renderings, synthetic citations) and
|
|
7
|
+
* edges are the ordering/atomicity/exclusivity constraints among them. It is
|
|
8
|
+
* strictly SINGLE-SESSION (CONTRACTS §PromptDagV1): every node span MUST carry
|
|
9
|
+
* `dag.sessionId`; cross-session evidence is represented by a SYNTHETIC node
|
|
10
|
+
* whose payload cites a separately validated source manifest, never by a foreign
|
|
11
|
+
* span.
|
|
12
|
+
*
|
|
13
|
+
* Ordering is a total order by construction so the same DAG always yields the
|
|
14
|
+
* same Kahn sequence:
|
|
15
|
+
*
|
|
16
|
+
* - event/exact/semantic nodes order by their source span (`startSeq`, then
|
|
17
|
+
* `startByte`);
|
|
18
|
+
* - synthetic nodes have NO span and sort after every prerequisite, then by
|
|
19
|
+
* `syntheticOrdinal`, then by node-ID bytes;
|
|
20
|
+
* - the zero-indegree queue key is `(span.startSeq ?? MAX, syntheticOrdinal ??
|
|
21
|
+
* 0, id bytes)` — never object/map iteration order.
|
|
22
|
+
*
|
|
23
|
+
* Pure types + registered conformance IDs: no storage, no console, no network
|
|
24
|
+
* (PREVENT-PI-004 / PREVENT-011).
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Registered DAG conformance ID range (DAG-001..030). The acceptance aggregator
|
|
28
|
+
* reads these rows from the v2 manifest and asserts each returns its manifest
|
|
29
|
+
* `ok`/`code`.
|
|
30
|
+
*/
|
|
31
|
+
export const DAG_IDS = Array.from({ length: 30 }, (_v, i) => `DAG-${String(i + 1).padStart(3, "0")}`);
|
|
32
|
+
/** Named VC5A DAG conformance assertion (the sprint's headline DAG row). */
|
|
33
|
+
export const DAG_NAMED_IDS = ["DAG-CYCLE-001"];
|
|
Binary file
|
package/extensions/dashboard-client/dist/assets/{AreaChart-XF3jPpvn.js → AreaChart-Cam9-nhT.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-B6p2WnkY.js";import{R as p,F as ee,r as ve}from"./index-CFLekP12.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-CvHKUdhX.js";import{R as p,F as ee,r as ve}from"./index-0Ye_un22.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-Cam9-nhT.js.map
|