mneme-ai 2.138.0 โ†’ 2.139.0

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.
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `mneme pce` (v2.139.0) โ€” Proof-Carrying Edit (๐Ÿ’Ž2). Attach a SIGNED certificate
3
+ * to an AI's diff that statically proves what it touches + introduces, so a
4
+ * reviewer/CI trusts the analysis offline without re-running it or trusting the
5
+ * author. Tampering with the diff OR the cert is caught.
6
+ *
7
+ * git diff | mneme pce --scope "src/**" --forbid network,childProcess
8
+ * mneme pce --diff change.patch --json > passport.json
9
+ * git diff | mneme pce verify --passport passport.json --scope "src/**"
10
+ *
11
+ * Exit 2 on BLOCK (out-of-scope ยท secret added ยท forbidden primitive) โ€” CI-gate.
12
+ */
13
+ import type { Command } from "commander";
14
+ export declare function registerPceCommands(program: Command): void;
15
+ //# sourceMappingURL=pce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pce.d.ts","sourceRoot":"","sources":["../../src/commands/pce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAazC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0C1D"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * `mneme pce` (v2.139.0) โ€” Proof-Carrying Edit (๐Ÿ’Ž2). Attach a SIGNED certificate
3
+ * to an AI's diff that statically proves what it touches + introduces, so a
4
+ * reviewer/CI trusts the analysis offline without re-running it or trusting the
5
+ * author. Tampering with the diff OR the cert is caught.
6
+ *
7
+ * git diff | mneme pce --scope "src/**" --forbid network,childProcess
8
+ * mneme pce --diff change.patch --json > passport.json
9
+ * git diff | mneme pce verify --passport passport.json --scope "src/**"
10
+ *
11
+ * Exit 2 on BLOCK (out-of-scope ยท secret added ยท forbidden primitive) โ€” CI-gate.
12
+ */
13
+ import { existsSync, readFileSync } from "node:fs";
14
+ import { pce, notary } from "@mneme-ai/core";
15
+ function out(s) { process.stdout.write(s + "\n"); }
16
+ function readDiff(file) {
17
+ try {
18
+ if (file && file !== "-" && existsSync(file))
19
+ return readFileSync(file, "utf8");
20
+ return readFileSync(0, "utf8"); // stdin
21
+ }
22
+ catch {
23
+ return "";
24
+ }
25
+ }
26
+ function splitList(v) { return typeof v === "string" && v.trim() ? v.split(",").map((s) => s.trim()).filter(Boolean) : []; }
27
+ export function registerPceCommands(program) {
28
+ const cmd = program
29
+ .command("pce")
30
+ .description("๐Ÿ’Ž PCE โ€” Proof-Carrying Edit. Attach a SIGNED certificate to an AI's diff that statically PROVES what it does/doesn't do โ€” which paths it touches, whether it stays inside a declared --scope, the dangerous primitives it introduces (eval/childProcess/fsDelete/network/dynamicImport), add/delete balance, and secret literals. A reviewer/CI verifies it OFFLINE (trusts the analysis, not the author); tampering with the diff OR the cert is caught. Exit 2 on BLOCK. HONEST: static lexical+structural analysis โ€” proves declared checkable properties, NOT total runtime safety.")
31
+ .argument("[action]", "omit to certify; 'verify' to check a passport")
32
+ .option("--diff <file>", "unified diff file (default: stdin)")
33
+ .option("--scope <globs>", "comma-separated allowed path globs (e.g. \"src/**,test/**\")")
34
+ .option("--forbid <names>", "comma-separated primitives to BLOCK: eval,childProcess,fsDelete,network,dynamicImport")
35
+ .option("--passport <file>", "(verify) the passport JSON to check against the diff")
36
+ .option("--json", "JSON output")
37
+ .action((action, opts) => {
38
+ const diff = readDiff(opts.diff);
39
+ const analysisOpts = { declaredScope: splitList(opts.scope), forbidPrimitives: splitList(opts.forbid) };
40
+ if (action === "verify") {
41
+ if (!opts.passport || !existsSync(opts.passport)) {
42
+ out("โœ— --passport <file> required for verify");
43
+ process.exitCode = 2;
44
+ return;
45
+ }
46
+ let passport;
47
+ try {
48
+ const j = JSON.parse(readFileSync(opts.passport, "utf8"));
49
+ passport = (j.passport ?? j);
50
+ }
51
+ catch {
52
+ out("โœ— could not parse passport JSON");
53
+ process.exitCode = 2;
54
+ return;
55
+ }
56
+ const v = pce.verifyPassport(diff, passport, analysisOpts);
57
+ if (opts.json) {
58
+ out(JSON.stringify(v, null, 2));
59
+ }
60
+ else {
61
+ out(`${v.ok ? "โœ“ VERIFIED" : "๐Ÿ›‘ INVALID"} โ€” ${v.reason}`);
62
+ }
63
+ process.exitCode = v.ok ? 0 : 2;
64
+ return;
65
+ }
66
+ const passport = pce.buildPassport(diff, analysisOpts);
67
+ const cwd = process.cwd();
68
+ let receipt = null;
69
+ try {
70
+ receipt = notary.issueReceipt(cwd, { kind: "claim-verdict", subject: `pce:${passport.verdict}:${passport.diffHash.slice(0, 12)}`, payload: { diffHash: passport.diffHash, verdict: passport.verdict, propsHash: undefined }, includePayload: true });
71
+ }
72
+ catch { /* */ }
73
+ if (opts.json) {
74
+ out(JSON.stringify({ passport, signed: receipt }, null, 2));
75
+ process.exitCode = passport.verdict === "BLOCK" ? 2 : 0;
76
+ return;
77
+ }
78
+ const icon = passport.verdict === "PASS" ? "๐ŸŸข" : passport.verdict === "REVIEW" ? "๐ŸŸก" : "๐Ÿ›‘";
79
+ const p = passport.properties;
80
+ out(`${icon} PCE ${passport.verdict} โ€” ${p.touchedPaths.length} file(s), net ${p.netLines >= 0 ? "+" : ""}${p.netLines} lines`);
81
+ for (const path of p.touchedPaths.slice(0, 20))
82
+ out(` โ€ข ${path}`);
83
+ const intro = Object.entries(p.introducedPrimitives).filter(([, v]) => v).map(([k]) => k);
84
+ if (intro.length)
85
+ out(` primitives introduced: ${intro.join(", ")}`);
86
+ if (p.secretsAdded)
87
+ out(` โš  secret-looking literal added`);
88
+ if (!p.inScope)
89
+ out(` โš  out of scope: ${p.outOfScopePaths.join(", ")}`);
90
+ for (const r of passport.reasons)
91
+ out(` โ†’ ${r}`);
92
+ out(` diffHash ${passport.diffHash.slice(0, 16)}โ€ฆ ${receipt ? "ยท signed (verify offline with the NOTARY public key)" : ""}`);
93
+ process.exitCode = passport.verdict === "BLOCK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C1E,KAAK,MAAM,CAAC,IAAI,QAAQ,CAAC,OAAO;YAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACnD,GAAG,CAAC,eAAe,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,sDAAsD,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/H,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IACL,KAAK,GAAG,CAAC;AACX,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgKA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAshNvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiKA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuhNvD"}
package/dist/index.js CHANGED
@@ -93,6 +93,7 @@ import { registerBootCommands } from "./commands/boot.js";
93
93
  import { registerElleipsisCommands } from "./commands/elleipsis.js";
94
94
  import { registerSteleCommands } from "./commands/stele.js";
95
95
  import { registerAxiaCommands } from "./commands/axia.js";
96
+ import { registerPceCommands } from "./commands/pce.js";
96
97
  import { registerTrustCommands } from "./commands/trust.js";
97
98
  import { registerNuclearCommands } from "./commands/nuclear-cli.js";
98
99
  import { registerOvernightCommand } from "./commands/overnight.js";
@@ -4735,6 +4736,7 @@ export async function run(argv) {
4735
4736
  registerElleipsisCommands(program);
4736
4737
  registerSteleCommands(program);
4737
4738
  registerAxiaCommands(program);
4739
+ registerPceCommands(program);
4738
4740
  // โ”€โ”€โ”€ Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
4739
4741
  registerTrustCommands(program);
4740
4742
  // โ”€โ”€โ”€ Wisdom reactor (v1.33.0) -- five nuclear-physics formulas as Mneme metrics