pi-mega-compact 0.20.20 → 0.20.22

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * dashboard-server/routes-rag-settings-vector-cortex.ts — Vector Cortex SETTINGS.
3
3
  *
4
- * The VC0A..VC5C chain flag inventory, split out of routes-rag-settings-helpers.ts
4
+ * The VC0A..VC8C chain flag inventory, split out of routes-rag-settings-helpers.ts
5
5
  * to keep that file under the 400-line extensions/ soft limit. Every VC flag is a
6
6
  * user-visible dashboard toggle (never in EXCLUDED_SETTINGS) per the chain spec,
7
7
  * and each carries the long description the Setup panel renders as help text.
@@ -142,7 +142,7 @@ export function evaluatePolicy(input) {
142
142
  action: PRESSURE_ACTION[pressure],
143
143
  budget,
144
144
  pressure,
145
- reason: reasonFor(pressure, input.requestedBudget, budget, bounds),
145
+ reason: reasonFor(pressure, adjusted, budget, bounds),
146
146
  ts: input.ts,
147
147
  };
148
148
  }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * platform/_cross-language-fixture.ts — VC8C cross-language fixture I/O.
3
+ *
4
+ * Reads conformance fixtures from the v2 `cross-language/` domain and decodes
5
+ * them into the REAL production types (`ParityReportV1`, `EngineAbiV1`,
6
+ * `NeutralRecord`) so `selectEngine` and the framing round-trip run against
7
+ * the committed corpus — no mocks, no stubs.
8
+ *
9
+ * Mirrors `_diagnostics-fixture.ts` (VC7C) and `_adaptive-fixture.ts` (VC8B).
10
+ */
11
+ import { readFileSync, existsSync } from "node:fs";
12
+ import { join, dirname } from "node:path";
13
+ import { fileURLToPath } from "node:url";
14
+ const here = dirname(fileURLToPath(import.meta.url));
15
+ function repoRoot(from) {
16
+ let dir = from;
17
+ for (let i = 0; i < 8; i++) {
18
+ if (existsSync(join(dir, "conformance", "vector-cortex")))
19
+ return dir;
20
+ const next = dirname(dir);
21
+ if (next === dir)
22
+ break;
23
+ dir = next;
24
+ }
25
+ throw new Error("conformance corpus not found above " + from);
26
+ }
27
+ const DIR = join(repoRoot(here), "conformance", "vector-cortex", "v2", "cross-language");
28
+ /** Read + parse one cross-language conformance fixture by ID. */
29
+ export function crossLanguageFixture(id) {
30
+ const raw = readFileSync(join(DIR, `${id}.json`), "utf8");
31
+ return JSON.parse(raw);
32
+ }
33
+ /** Read a numbered or named cross-language fixture as a typed CrossLangFx. */
34
+ export function xlangFx(id) {
35
+ return crossLanguageFixture(id);
36
+ }
37
+ /** Build a ParityReportV1 whose matrix has exactly one failing row at `badIndex`. */
38
+ export function reportWithMatrixFailure(badIndex, code, digest, platform) {
39
+ const matrix = Array.from({ length: 30 }, (_, i) => ({
40
+ fixtureId: `RUST-${String(i + 1).padStart(3, "0")}`,
41
+ ok: i === badIndex ? false : true,
42
+ code: i === badIndex ? code : null,
43
+ }));
44
+ return {
45
+ schema: "parity-report-v1",
46
+ artifactUrl: "file:///local/rad",
47
+ commit: "0".repeat(40),
48
+ cargoLockDigest: "a".repeat(64),
49
+ artifactCargoLockDigest: digest,
50
+ platform,
51
+ matrix,
52
+ };
53
+ }
54
+ /** Build a fully-qualified ParityReportV1 (all matrix rows ok). */
55
+ export function okReport(digest, platform) {
56
+ return reportWithMatrixFailure(-1, "", digest, platform);
57
+ }
@@ -142,7 +142,7 @@ export function evaluatePolicy(input) {
142
142
  action: PRESSURE_ACTION[pressure],
143
143
  budget,
144
144
  pressure,
145
- reason: reasonFor(pressure, input.requestedBudget, budget, bounds),
145
+ reason: reasonFor(pressure, adjusted, budget, bounds),
146
146
  ts: input.ts,
147
147
  };
148
148
  }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * platform/_cross-language-fixture.ts — VC8C cross-language fixture I/O.
3
+ *
4
+ * Reads conformance fixtures from the v2 `cross-language/` domain and decodes
5
+ * them into the REAL production types (`ParityReportV1`, `EngineAbiV1`,
6
+ * `NeutralRecord`) so `selectEngine` and the framing round-trip run against
7
+ * the committed corpus — no mocks, no stubs.
8
+ *
9
+ * Mirrors `_diagnostics-fixture.ts` (VC7C) and `_adaptive-fixture.ts` (VC8B).
10
+ */
11
+ import { readFileSync, existsSync } from "node:fs";
12
+ import { join, dirname } from "node:path";
13
+ import { fileURLToPath } from "node:url";
14
+ const here = dirname(fileURLToPath(import.meta.url));
15
+ function repoRoot(from) {
16
+ let dir = from;
17
+ for (let i = 0; i < 8; i++) {
18
+ if (existsSync(join(dir, "conformance", "vector-cortex")))
19
+ return dir;
20
+ const next = dirname(dir);
21
+ if (next === dir)
22
+ break;
23
+ dir = next;
24
+ }
25
+ throw new Error("conformance corpus not found above " + from);
26
+ }
27
+ const DIR = join(repoRoot(here), "conformance", "vector-cortex", "v2", "cross-language");
28
+ /** Read + parse one cross-language conformance fixture by ID. */
29
+ export function crossLanguageFixture(id) {
30
+ const raw = readFileSync(join(DIR, `${id}.json`), "utf8");
31
+ return JSON.parse(raw);
32
+ }
33
+ /** Read a numbered or named cross-language fixture as a typed CrossLangFx. */
34
+ export function xlangFx(id) {
35
+ return crossLanguageFixture(id);
36
+ }
37
+ /** Build a ParityReportV1 whose matrix has exactly one failing row at `badIndex`. */
38
+ export function reportWithMatrixFailure(badIndex, code, digest, platform) {
39
+ const matrix = Array.from({ length: 30 }, (_, i) => ({
40
+ fixtureId: `RUST-${String(i + 1).padStart(3, "0")}`,
41
+ ok: i === badIndex ? false : true,
42
+ code: i === badIndex ? code : null,
43
+ }));
44
+ return {
45
+ schema: "parity-report-v1",
46
+ artifactUrl: "file:///local/rad",
47
+ commit: "0".repeat(40),
48
+ cargoLockDigest: "a".repeat(64),
49
+ artifactCargoLockDigest: digest,
50
+ platform,
51
+ matrix,
52
+ };
53
+ }
54
+ /** Build a fully-qualified ParityReportV1 (all matrix rows ok). */
55
+ export function okReport(digest, platform) {
56
+ return reportWithMatrixFailure(-1, "", digest, platform);
57
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * dashboard-server/routes-rag-settings-vector-cortex.ts — Vector Cortex SETTINGS.
3
3
  *
4
- * The VC0A..VC5C chain flag inventory, split out of routes-rag-settings-helpers.ts
4
+ * The VC0A..VC8C chain flag inventory, split out of routes-rag-settings-helpers.ts
5
5
  * to keep that file under the 400-line extensions/ soft limit. Every VC flag is a
6
6
  * user-visible dashboard toggle (never in EXCLUDED_SETTINGS) per the chain spec,
7
7
  * and each carries the long description the Setup panel renders as help text.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-mega-compact",
3
- "version": "0.20.20",
3
+ "version": "0.20.22",
4
4
  "description": "Layered, local, vector-backed context compressor for pi — supersede/collapse/cluster compaction with deduped inline recall.",
5
5
  "type": "module",
6
6
  "license": "BSD-3-Clause",
@@ -176,7 +176,7 @@ export function evaluatePolicy(input: PolicyInput): PolicyDecisionV1 {
176
176
  action: PRESSURE_ACTION[pressure],
177
177
  budget,
178
178
  pressure,
179
- reason: reasonFor(pressure, input.requestedBudget, budget, bounds),
179
+ reason: reasonFor(pressure, adjusted, budget, bounds),
180
180
  ts: input.ts,
181
181
  };
182
182
  }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * platform/_cross-language-fixture.ts — VC8C cross-language fixture I/O.
3
+ *
4
+ * Reads conformance fixtures from the v2 `cross-language/` domain and decodes
5
+ * them into the REAL production types (`ParityReportV1`, `EngineAbiV1`,
6
+ * `NeutralRecord`) so `selectEngine` and the framing round-trip run against
7
+ * the committed corpus — no mocks, no stubs.
8
+ *
9
+ * Mirrors `_diagnostics-fixture.ts` (VC7C) and `_adaptive-fixture.ts` (VC8B).
10
+ */
11
+
12
+ import { readFileSync, existsSync } from "node:fs";
13
+ import { join, dirname } from "node:path";
14
+ import { fileURLToPath } from "node:url";
15
+
16
+ import type { ParityReportV1 } from "./types.js";
17
+
18
+ const here = dirname(fileURLToPath(import.meta.url));
19
+
20
+ function repoRoot(from: string): string {
21
+ let dir = from;
22
+ for (let i = 0; i < 8; i++) {
23
+ if (existsSync(join(dir, "conformance", "vector-cortex"))) return dir;
24
+ const next = dirname(dir);
25
+ if (next === dir) break;
26
+ dir = next;
27
+ }
28
+ throw new Error("conformance corpus not found above " + from);
29
+ }
30
+
31
+ const DIR = join(repoRoot(here), "conformance", "vector-cortex", "v2", "cross-language");
32
+
33
+ /** Read + parse one cross-language conformance fixture by ID. */
34
+ export function crossLanguageFixture(id: string): Record<string, unknown> {
35
+ const raw = readFileSync(join(DIR, `${id}.json`), "utf8");
36
+ return JSON.parse(raw);
37
+ }
38
+
39
+ // ── Cross-language golden / error fixture shape ───────────────────────────────
40
+
41
+ interface CrossLangFx {
42
+ id: string;
43
+ fixtureId: string;
44
+ kind: string;
45
+ assertion: string;
46
+ inputHex: string;
47
+ expected: { ok: boolean; code?: string };
48
+ expectedFailureCode: string | null;
49
+ expectedOutputHex: string;
50
+ }
51
+
52
+ /** Read a numbered or named cross-language fixture as a typed CrossLangFx. */
53
+ export function xlangFx(id: string): CrossLangFx {
54
+ return crossLanguageFixture(id) as unknown as CrossLangFx;
55
+ }
56
+
57
+ /** Build a ParityReportV1 whose matrix has exactly one failing row at `badIndex`. */
58
+ export function reportWithMatrixFailure(
59
+ badIndex: number,
60
+ code: string,
61
+ digest: string,
62
+ platform: string,
63
+ ): ParityReportV1 {
64
+ const matrix = Array.from({ length: 30 }, (_, i) => ({
65
+ fixtureId: `RUST-${String(i + 1).padStart(3, "0")}`,
66
+ ok: i === badIndex ? false : true,
67
+ code: i === badIndex ? code : null,
68
+ }));
69
+ return {
70
+ schema: "parity-report-v1",
71
+ artifactUrl: "file:///local/rad",
72
+ commit: "0".repeat(40),
73
+ cargoLockDigest: "a".repeat(64),
74
+ artifactCargoLockDigest: digest,
75
+ platform,
76
+ matrix,
77
+ };
78
+ }
79
+
80
+ /** Build a fully-qualified ParityReportV1 (all matrix rows ok). */
81
+ export function okReport(digest: string, platform: string): ParityReportV1 {
82
+ return reportWithMatrixFailure(-1, "", digest, platform);
83
+ }