mneme-ai 2.173.0 → 2.175.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.
- package/dist/commands/goldilocks.d.ts +13 -0
- package/dist/commands/goldilocks.d.ts.map +1 -0
- package/dist/commands/goldilocks.js +52 -0
- package/dist/commands/goldilocks.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme goldilocks` (v2.174) — config-fragility / "habitable-zone" analyzer.
|
|
3
|
+
* The honest core of the cosmic fine-tuning idea: find the band of values where
|
|
4
|
+
* a config still works + how close your current value is to the nearest cliff.
|
|
5
|
+
*
|
|
6
|
+
* mneme goldilocks # self-test (gauntlet 100)
|
|
7
|
+
* mneme goldilocks scan --cmd "node bench.js {v}" --param max_tokens --lo 256 --hi 16000 --current 4000
|
|
8
|
+
* → runs the command with {v} substituted (exit 0 = pass), bisects the cliffs,
|
|
9
|
+
* and reports ROBUST / TIGHT / KNIFE-EDGE / UNSTABLE + the margin.
|
|
10
|
+
*/
|
|
11
|
+
import type { Command } from "commander";
|
|
12
|
+
export declare function registerGoldilocksCommands(program: Command): void;
|
|
13
|
+
//# sourceMappingURL=goldilocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goldilocks.d.ts","sourceRoot":"","sources":["../../src/commands/goldilocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkCjE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { goldilocks, notary } from "@mneme-ai/core";
|
|
3
|
+
function out(s) { process.stdout.write(s + "\n"); }
|
|
4
|
+
export function registerGoldilocksCommands(program) {
|
|
5
|
+
const g = program
|
|
6
|
+
.command("goldilocks")
|
|
7
|
+
.description("🌗 GOLDILOCKS — config-fragility analyzer. Given a numeric config value, a range, and a pass/fail command, it finds the 'habitable zone' (the band where the system still works) by bisecting to each cliff, and tells you how close your value sits to breaking: ROBUST / TIGHT / KNIFE-EDGE / UNSTABLE. The honest engineering core of 'fine-tuning' — sensitivity analysis on an oracle you supply, not cosmology.")
|
|
8
|
+
.action(() => {
|
|
9
|
+
const r = goldilocks.goldilocksGauntlet();
|
|
10
|
+
out(`🌗 GOLDILOCKS — habitable-zone analyzer self-test (gauntlet ${r.score}/100)`);
|
|
11
|
+
for (const c of r.checks)
|
|
12
|
+
out(` ${c.pass ? "✓" : "✗"} ${c.name.padEnd(18)} ${c.detail}`);
|
|
13
|
+
process.exitCode = r.score === 100 ? 0 : 2;
|
|
14
|
+
});
|
|
15
|
+
g.command("scan")
|
|
16
|
+
.description("find the habitable zone of a config value via a pass/fail command (exit 0 = pass). exit 2 if TIGHT/KNIFE-EDGE/UNSTABLE.")
|
|
17
|
+
.requiredOption("--cmd <cmd>", "shell command with {v} substituted for the candidate value; exit 0 = pass")
|
|
18
|
+
.requiredOption("--lo <n>", "low end of the search range", parseFloat)
|
|
19
|
+
.requiredOption("--hi <n>", "high end of the search range", parseFloat)
|
|
20
|
+
.requiredOption("--current <n>", "the current/configured value", parseFloat)
|
|
21
|
+
.option("--param <name>", "a label for the parameter", "value")
|
|
22
|
+
.option("--json", "JSON output")
|
|
23
|
+
.action((opts) => {
|
|
24
|
+
const oracle = (v) => {
|
|
25
|
+
const cmd = opts.cmd.replace(/\{v\}/g, String(v));
|
|
26
|
+
try {
|
|
27
|
+
return spawnSync(cmd, { shell: true, stdio: "ignore", timeout: 120_000 }).status === 0;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const z = goldilocks.habitableZone(oracle, { lo: opts.lo, hi: opts.hi, current: opts.current });
|
|
34
|
+
let signed = { param: opts.param, ...z };
|
|
35
|
+
try {
|
|
36
|
+
signed = { ...signed, _proof: notary.issueReceipt(process.cwd(), { kind: "claim-verdict", subject: `goldilocks:${opts.param}`, payload: { verdict: z.verdict, margin: z.margin }, includePayload: true }) };
|
|
37
|
+
}
|
|
38
|
+
catch { /* unsigned */ }
|
|
39
|
+
if (opts.json) {
|
|
40
|
+
out(JSON.stringify(signed, null, 2));
|
|
41
|
+
process.exitCode = z.verdict === "ROBUST" ? 0 : 2;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const icon = z.verdict === "ROBUST" ? "✓" : z.verdict === "UNSTABLE" ? "🛑" : "⚠";
|
|
45
|
+
out(`${icon} ${opts.param} = ${opts.current} → ${z.verdict}`);
|
|
46
|
+
if (z.passesNow)
|
|
47
|
+
out(` habitable zone: [${z.lowOpen ? "≤" : ""}${z.lowEdge.toPrecision(5)}, ${z.highEdge.toPrecision(5)}${z.highOpen ? "+" : ""}] · nearest cliff ${z.margin.toPrecision(4)} away (${(z.marginPct * 100).toFixed(1)}% of range)`);
|
|
48
|
+
out(` ${z.reason}`);
|
|
49
|
+
process.exitCode = z.verdict === "ROBUST" ? 0 : 2;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=goldilocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goldilocks.js","sourceRoot":"","sources":["../../src/commands/goldilocks.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEpD,SAAS,GAAG,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAEjE,MAAM,UAAU,0BAA0B,CAA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AAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;QAClF,GAAG,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,OAAO,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,CAAC,SAAS;YAAE,GAAG,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QACpP,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACtB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiLA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAilNvD"}
|
package/dist/index.js
CHANGED
|
@@ -97,6 +97,7 @@ import { registerTrustlessCommands } from "./commands/trustless.js";
|
|
|
97
97
|
import { registerMatrixCommands } from "./commands/matrix.js";
|
|
98
98
|
import { registerAdamasCommands } from "./commands/adamas.js";
|
|
99
99
|
import { registerPrismCommands } from "./commands/prism.js";
|
|
100
|
+
import { registerGoldilocksCommands } from "./commands/goldilocks.js";
|
|
100
101
|
import { registerAxiaCommands } from "./commands/axia.js";
|
|
101
102
|
import { registerPceCommands } from "./commands/pce.js";
|
|
102
103
|
import { registerHauntCommands } from "./commands/haunt.js";
|
|
@@ -4758,6 +4759,7 @@ export async function run(argv) {
|
|
|
4758
4759
|
registerMatrixCommands(program);
|
|
4759
4760
|
registerAdamasCommands(program);
|
|
4760
4761
|
registerPrismCommands(program);
|
|
4762
|
+
registerGoldilocksCommands(program);
|
|
4761
4763
|
registerAxiaCommands(program);
|
|
4762
4764
|
registerPceCommands(program);
|
|
4763
4765
|
registerHauntCommands(program);
|