@mneme-ai/core 2.54.0 → 2.56.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/agent_manifest.d.ts.map +1 -1
- package/dist/agent_manifest.js +15 -0
- package/dist/agent_manifest.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/nemesis/calibration_corpus.d.ts +3 -2
- package/dist/nemesis/calibration_corpus.d.ts.map +1 -1
- package/dist/nemesis/calibration_corpus.js +26 -2
- package/dist/nemesis/calibration_corpus.js.map +1 -1
- package/dist/nemesis/classifier.d.ts.map +1 -1
- package/dist/nemesis/classifier.js +32 -0
- package/dist/nemesis/classifier.js.map +1 -1
- package/dist/nemesis/env_scan.d.ts.map +1 -1
- package/dist/nemesis/env_scan.js +6 -0
- package/dist/nemesis/env_scan.js.map +1 -1
- package/dist/nemesis/nimbus.d.ts +16 -0
- package/dist/nemesis/nimbus.d.ts.map +1 -1
- package/dist/nemesis/nimbus.js +1 -0
- package/dist/nemesis/nimbus.js.map +1 -1
- package/dist/nemesis/types.d.ts +1 -1
- package/dist/nemesis/types.d.ts.map +1 -1
- package/dist/nemesis/vendor_allowlist.d.ts.map +1 -1
- package/dist/nemesis/vendor_allowlist.js +13 -1
- package/dist/nemesis/vendor_allowlist.js.map +1 -1
- package/dist/perf_budget.d.ts.map +1 -1
- package/dist/perf_budget.js +5 -2
- package/dist/perf_budget.js.map +1 -1
- package/dist/truth_gate/claims.d.ts.map +1 -1
- package/dist/truth_gate/claims.js +47 -0
- package/dist/truth_gate/claims.js.map +1 -1
- package/dist/truth_gate/probes.d.ts.map +1 -1
- package/dist/truth_gate/probes.js +139 -3
- package/dist/truth_gate/probes.js.map +1 -1
- package/dist/xai_alignment/dragon.d.ts +83 -0
- package/dist/xai_alignment/dragon.d.ts.map +1 -0
- package/dist/xai_alignment/dragon.js +178 -0
- package/dist/xai_alignment/dragon.js.map +1 -0
- package/dist/xai_alignment/index.d.ts +16 -0
- package/dist/xai_alignment/index.d.ts.map +1 -0
- package/dist/xai_alignment/index.js +16 -0
- package/dist/xai_alignment/index.js.map +1 -0
- package/dist/xai_alignment/launch_window.d.ts +62 -0
- package/dist/xai_alignment/launch_window.d.ts.map +1 -0
- package/dist/xai_alignment/launch_window.js +168 -0
- package/dist/xai_alignment/launch_window.js.map +1 -0
- package/dist/xai_alignment/stargate.d.ts +69 -0
- package/dist/xai_alignment/stargate.d.ts.map +1 -0
- package/dist/xai_alignment/stargate.js +131 -0
- package/dist/xai_alignment/stargate.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.56.0 — DRAGON EJECT: emergency rollback + GAVEL-grade forensic bundle.
|
|
3
|
+
*
|
|
4
|
+
* Inspired by SpaceX Dragon capsule's launch escape system. When something
|
|
5
|
+
* goes critically wrong, Dragon fires its abort motors + ejects to safety
|
|
6
|
+
* while recording every telemetry point for post-mortem.
|
|
7
|
+
*
|
|
8
|
+
* Mneme analogue:
|
|
9
|
+
* `mneme dragon eject <commit>` does:
|
|
10
|
+
* 1. Snapshot WHY: capture current state (failing TG probes, failing
|
|
11
|
+
* tests, perf budget violations, agent_manifest entries that
|
|
12
|
+
* reference the doomed commit).
|
|
13
|
+
* 2. Eject (best-effort): `git revert <commit> --no-edit` to a new
|
|
14
|
+
* rollback commit.
|
|
15
|
+
* 3. Forensic bundle: emit a HMAC-signed bundle binding (a) WHY
|
|
16
|
+
* snapshot, (b) the diff that was reverted, (c) Merkle proof
|
|
17
|
+
* connecting both — court-admissible post-mortem.
|
|
18
|
+
* 4. Append eject event to the DRAGON LEDGER (HMAC-chained).
|
|
19
|
+
*
|
|
20
|
+
* Defensive: dry-run by default. Real eject requires --confirm. Never
|
|
21
|
+
* destroys uncommitted work.
|
|
22
|
+
*/
|
|
23
|
+
import { existsSync, mkdirSync, appendFileSync, readFileSync } from "node:fs";
|
|
24
|
+
import { join } from "node:path";
|
|
25
|
+
import { createHash, createHmac } from "node:crypto";
|
|
26
|
+
import { execSync } from "node:child_process";
|
|
27
|
+
const DRAGON_DIR = ".mneme/xai_alignment/dragon";
|
|
28
|
+
const EJECT_LEDGER = "eject_events.jsonl";
|
|
29
|
+
const KEY_ENV = "MNEME_DRAGON_KEY";
|
|
30
|
+
const DEFAULT_KEY = "mneme-dragon-v1";
|
|
31
|
+
const SEED = "0".repeat(64);
|
|
32
|
+
function keyOf() { return process.env[KEY_ENV] ?? DEFAULT_KEY; }
|
|
33
|
+
function leafOf(content) {
|
|
34
|
+
return createHash("sha256").update("leaf:").update(content).digest("hex");
|
|
35
|
+
}
|
|
36
|
+
function parentOf(a, b) {
|
|
37
|
+
return createHash("sha256").update("parent:").update(a).update(":").update(b).digest("hex");
|
|
38
|
+
}
|
|
39
|
+
function dirOf(repoRoot) {
|
|
40
|
+
const dir = join(repoRoot, DRAGON_DIR);
|
|
41
|
+
try {
|
|
42
|
+
if (!existsSync(dir))
|
|
43
|
+
mkdirSync(dir, { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
catch { /* */ }
|
|
46
|
+
return dir;
|
|
47
|
+
}
|
|
48
|
+
function lastHmac(repoRoot) {
|
|
49
|
+
const p = join(dirOf(repoRoot), EJECT_LEDGER);
|
|
50
|
+
if (!existsSync(p))
|
|
51
|
+
return SEED;
|
|
52
|
+
try {
|
|
53
|
+
const lines = readFileSync(p, "utf8").split("\n").filter(Boolean);
|
|
54
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
55
|
+
try {
|
|
56
|
+
const ev = JSON.parse(lines[i]);
|
|
57
|
+
if (typeof ev.hmac === "string")
|
|
58
|
+
return ev.hmac;
|
|
59
|
+
}
|
|
60
|
+
catch { /* skip */ }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch { /* */ }
|
|
64
|
+
return SEED;
|
|
65
|
+
}
|
|
66
|
+
function captureRevertDiff(repoRoot, commit) {
|
|
67
|
+
try {
|
|
68
|
+
// Use git show to grab the diff of the doomed commit (what we're undoing)
|
|
69
|
+
return execSync(`git -C "${repoRoot}" show ${commit} --format= --no-color`, { encoding: "utf8", timeout: 8000 });
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build + (optionally) execute the eject. Idempotent in dry-run.
|
|
77
|
+
*/
|
|
78
|
+
export function dragonEject(input) {
|
|
79
|
+
try {
|
|
80
|
+
if (!input || typeof input.commit !== "string" || !/^[0-9a-f]{7,40}$/.test(input.commit)) {
|
|
81
|
+
return { ok: false, reason: "DRAGON: commit must be a 7-40 hex hash" };
|
|
82
|
+
}
|
|
83
|
+
if (!input.reason || typeof input.reason.rationale !== "string" || input.reason.rationale.length === 0) {
|
|
84
|
+
return { ok: false, reason: "DRAGON: reason.rationale required (WHY are we ejecting?)" };
|
|
85
|
+
}
|
|
86
|
+
// Capture the diff we're about to undo (forensic evidence)
|
|
87
|
+
const revertDiff = captureRevertDiff(input.repoRoot, input.commit);
|
|
88
|
+
const reasonJson = JSON.stringify(input.reason);
|
|
89
|
+
const merkleRoot = parentOf(leafOf(reasonJson), leafOf(revertDiff));
|
|
90
|
+
let revertCommit;
|
|
91
|
+
if (!input.dryRun) {
|
|
92
|
+
if (!input.confirm) {
|
|
93
|
+
return { ok: false, reason: "DRAGON: --confirm required for real eject (use dryRun=true to preview)" };
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
execSync(`git -C "${input.repoRoot}" revert ${input.commit} --no-edit`, { encoding: "utf8", timeout: 30_000 });
|
|
97
|
+
revertCommit = execSync(`git -C "${input.repoRoot}" rev-parse HEAD`, { encoding: "utf8", timeout: 8000 }).trim();
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
return { ok: false, reason: `DRAGON: git revert failed — ${e.message}` };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const at = new Date().toISOString();
|
|
104
|
+
const prev = input.dryRun ? SEED : lastHmac(input.repoRoot);
|
|
105
|
+
const bodyForHmac = {
|
|
106
|
+
at,
|
|
107
|
+
commit: input.commit,
|
|
108
|
+
rationale: input.reason.rationale,
|
|
109
|
+
failingProbes: input.reason.failingProbes ?? [],
|
|
110
|
+
failingTests: input.reason.failingTests ?? [],
|
|
111
|
+
perfViolations: input.reason.perfViolations ?? [],
|
|
112
|
+
revertedBy: revertCommit,
|
|
113
|
+
merkleRoot,
|
|
114
|
+
prev,
|
|
115
|
+
};
|
|
116
|
+
const hmac = createHmac("sha256", keyOf()).update(JSON.stringify(bodyForHmac)).digest("hex");
|
|
117
|
+
const event = { ...bodyForHmac, hmac };
|
|
118
|
+
if (!input.dryRun) {
|
|
119
|
+
try {
|
|
120
|
+
appendFileSync(join(dirOf(input.repoRoot), EJECT_LEDGER), JSON.stringify(event) + "\n");
|
|
121
|
+
}
|
|
122
|
+
catch { /* best-effort */ }
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
ok: true,
|
|
126
|
+
reason: input.dryRun
|
|
127
|
+
? `DRAGON: dry-run eject built for ${input.commit.slice(0, 7)} — merkleRoot ${merkleRoot.slice(0, 16)}...`
|
|
128
|
+
: `DRAGON: ejected ${input.commit.slice(0, 7)} via revert ${revertCommit?.slice(0, 7)}, event logged`,
|
|
129
|
+
event,
|
|
130
|
+
revertCommit,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
return { ok: false, reason: `DRAGON failed: ${e.message}` };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** Verify a DRAGON eject event signature offline. */
|
|
138
|
+
export function verifyEjectEvent(ev) {
|
|
139
|
+
if (!ev || typeof ev.hmac !== "string")
|
|
140
|
+
return { ok: false, reason: "missing hmac" };
|
|
141
|
+
const { hmac, ...body } = ev;
|
|
142
|
+
const expected = createHmac("sha256", keyOf()).update(JSON.stringify(body)).digest("hex");
|
|
143
|
+
return expected === hmac
|
|
144
|
+
? { ok: true, reason: "DRAGON eject event verified" }
|
|
145
|
+
: { ok: false, reason: "hmac mismatch" };
|
|
146
|
+
}
|
|
147
|
+
/** Read the DRAGON ledger; useful for post-mortem audit. */
|
|
148
|
+
export function listEjects(repoRoot) {
|
|
149
|
+
const p = join(dirOf(repoRoot), EJECT_LEDGER);
|
|
150
|
+
if (!existsSync(p))
|
|
151
|
+
return [];
|
|
152
|
+
const out = [];
|
|
153
|
+
for (const line of readFileSync(p, "utf8").split("\n")) {
|
|
154
|
+
if (!line.trim())
|
|
155
|
+
continue;
|
|
156
|
+
try {
|
|
157
|
+
out.push(JSON.parse(line));
|
|
158
|
+
}
|
|
159
|
+
catch { /* */ }
|
|
160
|
+
}
|
|
161
|
+
return out;
|
|
162
|
+
}
|
|
163
|
+
/** Verify the entire DRAGON chain. */
|
|
164
|
+
export function verifyDragonChain(repoRoot) {
|
|
165
|
+
const events = listEjects(repoRoot);
|
|
166
|
+
let prev = SEED;
|
|
167
|
+
for (let i = 0; i < events.length; i++) {
|
|
168
|
+
const ev = events[i];
|
|
169
|
+
if (ev.prev !== prev)
|
|
170
|
+
return { ok: false, rows: i, brokenAt: i, reason: "prev mismatch" };
|
|
171
|
+
const v = verifyEjectEvent(ev);
|
|
172
|
+
if (!v.ok)
|
|
173
|
+
return { ok: false, rows: i, brokenAt: i, reason: v.reason };
|
|
174
|
+
prev = ev.hmac;
|
|
175
|
+
}
|
|
176
|
+
return { ok: true, rows: events.length };
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=dragon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dragon.js","sourceRoot":"","sources":["../../src/xai_alignment/dragon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SA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MAAM,EAAE,CAAC;QACxE,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;IACjB,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.56.0 — xAI / GROK / SpaceX ALIGNMENT package.
|
|
3
|
+
*
|
|
4
|
+
* Three primitives positioned to make Musk's team say "YES!!!":
|
|
5
|
+
*
|
|
6
|
+
* 🚀 LAUNCH WINDOW — SpaceX-style GO/NO-GO release verdict aggregator
|
|
7
|
+
* 🔥 DRAGON EJECT — emergency rollback + GAVEL-grade forensic bundle
|
|
8
|
+
* 🛡 STARGATE — open-source publish of augmented calibration corpus
|
|
9
|
+
*
|
|
10
|
+
* Each composes on existing Mneme primitives (TRUTH GATE / PEAK GAUNTLET /
|
|
11
|
+
* NEMESIS / GAVEL / corpus_augmenter) — no logic duplicated.
|
|
12
|
+
*/
|
|
13
|
+
export { evaluateLaunchWindow, verifyLaunchVerdict, renderLaunchBanner, type LaunchStatus, type GateReading, type LaunchWindowVerdict, type LaunchWindowOpts, } from "./launch_window.js";
|
|
14
|
+
export { dragonEject, verifyEjectEvent, listEjects, verifyDragonChain, type EjectReason, type EjectInput, type EjectEvent, type EjectResult, } from "./dragon.js";
|
|
15
|
+
export { buildStargateBundle, verifyStargateBundle, publishStargate, type StargateBundle, type PublishInput, type PublishResult, } from "./stargate.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/xai_alignment/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,oBAAoB,EAAE,mBAAmB,EAAE,kBAAkB,EAC7D,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,KAAK,gBAAgB,GACrF,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAC5D,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,GACrE,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,mBAAmB,EAAE,oBAAoB,EAAE,eAAe,EAC1D,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,GAC3D,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.56.0 — xAI / GROK / SpaceX ALIGNMENT package.
|
|
3
|
+
*
|
|
4
|
+
* Three primitives positioned to make Musk's team say "YES!!!":
|
|
5
|
+
*
|
|
6
|
+
* 🚀 LAUNCH WINDOW — SpaceX-style GO/NO-GO release verdict aggregator
|
|
7
|
+
* 🔥 DRAGON EJECT — emergency rollback + GAVEL-grade forensic bundle
|
|
8
|
+
* 🛡 STARGATE — open-source publish of augmented calibration corpus
|
|
9
|
+
*
|
|
10
|
+
* Each composes on existing Mneme primitives (TRUTH GATE / PEAK GAUNTLET /
|
|
11
|
+
* NEMESIS / GAVEL / corpus_augmenter) — no logic duplicated.
|
|
12
|
+
*/
|
|
13
|
+
export { evaluateLaunchWindow, verifyLaunchVerdict, renderLaunchBanner, } from "./launch_window.js";
|
|
14
|
+
export { dragonEject, verifyEjectEvent, listEjects, verifyDragonChain, } from "./dragon.js";
|
|
15
|
+
export { buildStargateBundle, verifyStargateBundle, publishStargate, } from "./stargate.js";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/xai_alignment/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,oBAAoB,EAAE,mBAAmB,EAAE,kBAAkB,GAE9D,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,GAE7D,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,mBAAmB,EAAE,oBAAoB,EAAE,eAAe,GAE3D,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.56.0 — LAUNCH WINDOW: SpaceX-style GO/NO-GO release verdict.
|
|
3
|
+
*
|
|
4
|
+
* Inspired by SpaceX launch broadcasts. Every release is a "launch" —
|
|
5
|
+
* the question is whether all systems are GO.
|
|
6
|
+
*
|
|
7
|
+
* Aggregates EVERY existing gate into ONE verdict:
|
|
8
|
+
* - TRUTH GATE (does marketing match reality?)
|
|
9
|
+
* - PEAK GAUNTLET (12-axis production-readiness)
|
|
10
|
+
* - PERF BUDGET (5-op latency vs locked budgets)
|
|
11
|
+
* - INDISPENSABILITY (6-criterion weighted score)
|
|
12
|
+
* - WIRING LAG GATE (every commit-claimed verb actually works)
|
|
13
|
+
* - PROBE COVERAGE (configurable threshold; default 50%)
|
|
14
|
+
* - SDK BUILT (@mneme-ai/sdk dist present)
|
|
15
|
+
*
|
|
16
|
+
* Output: single verdict (GO / NO-GO / HOLD) + per-gate breakdown +
|
|
17
|
+
* "T-minus" countdown to next safe-ship window estimate + HMAC-signed
|
|
18
|
+
* LAUNCH CERTIFICATE that becomes a GAVEL artifact for releases.
|
|
19
|
+
*
|
|
20
|
+
* Pure deterministic + defensive; never throws.
|
|
21
|
+
*/
|
|
22
|
+
export type LaunchStatus = "GO" | "NO-GO" | "HOLD";
|
|
23
|
+
export interface GateReading {
|
|
24
|
+
gate: string;
|
|
25
|
+
status: LaunchStatus;
|
|
26
|
+
evidence: string;
|
|
27
|
+
/** Latency to evaluate (ms). */
|
|
28
|
+
latencyMs: number;
|
|
29
|
+
/** Weight in overall verdict (higher = more critical). */
|
|
30
|
+
weight: number;
|
|
31
|
+
}
|
|
32
|
+
export interface LaunchWindowVerdict {
|
|
33
|
+
status: LaunchStatus;
|
|
34
|
+
/** Plain countdown phrase ("T-0 GO" / "T+5min HOLD" / "T-? NO-GO"). */
|
|
35
|
+
countdown: string;
|
|
36
|
+
/** Aggregate go-rate 0..1 (weighted). */
|
|
37
|
+
goRate: number;
|
|
38
|
+
/** Per-gate readings. */
|
|
39
|
+
gates: GateReading[];
|
|
40
|
+
/** Total evaluation latency. */
|
|
41
|
+
totalLatencyMs: number;
|
|
42
|
+
/** HMAC-signed body. */
|
|
43
|
+
hmac: string;
|
|
44
|
+
at: string;
|
|
45
|
+
}
|
|
46
|
+
export interface LaunchWindowOpts {
|
|
47
|
+
cwd?: string;
|
|
48
|
+
/** Skip slow gates (PEAK GAUNTLET) for quick iteration. */
|
|
49
|
+
fast?: boolean;
|
|
50
|
+
/** Override SDK dist path. */
|
|
51
|
+
sdkDistPath?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Run the full launch-window check. Aggregates every gate Mneme knows
|
|
55
|
+
* about into a SpaceX-style verdict.
|
|
56
|
+
*/
|
|
57
|
+
export declare function evaluateLaunchWindow(opts?: LaunchWindowOpts): Promise<LaunchWindowVerdict>;
|
|
58
|
+
/** Verify a launch verdict's HMAC offline. */
|
|
59
|
+
export declare function verifyLaunchVerdict(v: LaunchWindowVerdict): boolean;
|
|
60
|
+
/** Render the verdict as a SpaceX-style ASCII broadcast banner. */
|
|
61
|
+
export declare function renderLaunchBanner(v: LaunchWindowVerdict): string;
|
|
62
|
+
//# sourceMappingURL=launch_window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch_window.d.ts","sourceRoot":"","sources":["../../src/xai_alignment/launch_window.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAWH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,YAAY,CAAC;IACrB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,gCAAgC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AA8BD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAsHpG;AAED,8CAA8C;AAC9C,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAKnE;AAED,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAYjE"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.56.0 — LAUNCH WINDOW: SpaceX-style GO/NO-GO release verdict.
|
|
3
|
+
*
|
|
4
|
+
* Inspired by SpaceX launch broadcasts. Every release is a "launch" —
|
|
5
|
+
* the question is whether all systems are GO.
|
|
6
|
+
*
|
|
7
|
+
* Aggregates EVERY existing gate into ONE verdict:
|
|
8
|
+
* - TRUTH GATE (does marketing match reality?)
|
|
9
|
+
* - PEAK GAUNTLET (12-axis production-readiness)
|
|
10
|
+
* - PERF BUDGET (5-op latency vs locked budgets)
|
|
11
|
+
* - INDISPENSABILITY (6-criterion weighted score)
|
|
12
|
+
* - WIRING LAG GATE (every commit-claimed verb actually works)
|
|
13
|
+
* - PROBE COVERAGE (configurable threshold; default 50%)
|
|
14
|
+
* - SDK BUILT (@mneme-ai/sdk dist present)
|
|
15
|
+
*
|
|
16
|
+
* Output: single verdict (GO / NO-GO / HOLD) + per-gate breakdown +
|
|
17
|
+
* "T-minus" countdown to next safe-ship window estimate + HMAC-signed
|
|
18
|
+
* LAUNCH CERTIFICATE that becomes a GAVEL artifact for releases.
|
|
19
|
+
*
|
|
20
|
+
* Pure deterministic + defensive; never throws.
|
|
21
|
+
*/
|
|
22
|
+
import { createHmac } from "node:crypto";
|
|
23
|
+
const KEY_ENV = "MNEME_LAUNCH_KEY";
|
|
24
|
+
const DEFAULT_KEY = "mneme-launch-window-v1";
|
|
25
|
+
function keyOf() {
|
|
26
|
+
return process.env[KEY_ENV] ?? DEFAULT_KEY;
|
|
27
|
+
}
|
|
28
|
+
function gateFromAggregator(name, weight, fn, predicate) {
|
|
29
|
+
const t0 = performance.now();
|
|
30
|
+
return Promise.resolve()
|
|
31
|
+
.then(() => fn())
|
|
32
|
+
.then((r) => {
|
|
33
|
+
const p = predicate(r);
|
|
34
|
+
return {
|
|
35
|
+
gate: name,
|
|
36
|
+
status: (p.ok ? "GO" : "NO-GO"),
|
|
37
|
+
evidence: p.evidence,
|
|
38
|
+
latencyMs: +(performance.now() - t0).toFixed(2),
|
|
39
|
+
weight,
|
|
40
|
+
};
|
|
41
|
+
})
|
|
42
|
+
.catch((e) => ({
|
|
43
|
+
gate: name,
|
|
44
|
+
status: "HOLD",
|
|
45
|
+
evidence: `gate threw: ${e.message}`,
|
|
46
|
+
latencyMs: +(performance.now() - t0).toFixed(2),
|
|
47
|
+
weight,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Run the full launch-window check. Aggregates every gate Mneme knows
|
|
52
|
+
* about into a SpaceX-style verdict.
|
|
53
|
+
*/
|
|
54
|
+
export async function evaluateLaunchWindow(opts = {}) {
|
|
55
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
56
|
+
const t0 = performance.now();
|
|
57
|
+
const gates = [];
|
|
58
|
+
// Gate 1: PERF BUDGET (in-process, fast)
|
|
59
|
+
gates.push(await gateFromAggregator("perf_budget", 1.5, async () => {
|
|
60
|
+
const m = await import("../perf_budget.js");
|
|
61
|
+
return m.runPerfBudget();
|
|
62
|
+
}, (r) => ({
|
|
63
|
+
ok: r.ok,
|
|
64
|
+
evidence: r.ok ? `5/5 budgets met (${r.measurements.map((m) => `${m.op.split(".").pop()}=${m.warmMeanMs}ms`).join(", ")})` : `BLOCKED: ${r.failing.join("; ")}`,
|
|
65
|
+
})));
|
|
66
|
+
// Gate 2: INDISPENSABILITY (≥ 0.5 score)
|
|
67
|
+
gates.push(await gateFromAggregator("indispensability", 1.0, async () => {
|
|
68
|
+
const m = await import("../indispensability.js");
|
|
69
|
+
return m.evaluateIndispensability(cwd);
|
|
70
|
+
}, (r) => ({
|
|
71
|
+
ok: r.overallScore >= 0.5,
|
|
72
|
+
evidence: `score ${(r.overallScore * 100).toFixed(0)}% (${r.criteria.filter((c) => c.status === "met").length}/${r.criteria.length} criteria met)`,
|
|
73
|
+
})));
|
|
74
|
+
// Gate 3: PROBE COVERAGE
|
|
75
|
+
gates.push(await gateFromAggregator("probe_coverage", 1.0, async () => {
|
|
76
|
+
const m = await import("../release_gate/probe_coverage.js");
|
|
77
|
+
return m.crossCheckFromDisk(cwd, { threshold: 50 });
|
|
78
|
+
}, (r) => ({
|
|
79
|
+
ok: r.ok,
|
|
80
|
+
evidence: `coverage ${r.coveragePercent}% ≥ threshold ${r.threshold}%`,
|
|
81
|
+
})));
|
|
82
|
+
// Gate 4: WIRING LAG (fast subset: 3 commits)
|
|
83
|
+
gates.push(await gateFromAggregator("wiring_lag", 1.0, async () => {
|
|
84
|
+
const m = await import("../release_gate/wiring_lag.js");
|
|
85
|
+
return m.checkWiringLag(cwd, { maxCommits: 3 });
|
|
86
|
+
}, (r) => ({
|
|
87
|
+
ok: r.ok,
|
|
88
|
+
evidence: r.ok ? `${r.workingCount}/${r.totalClaims} verbs work` : `BROKEN: ${r.brokenCount}/${r.totalClaims}`,
|
|
89
|
+
})));
|
|
90
|
+
// Gate 5: SDK BUILT
|
|
91
|
+
gates.push(await gateFromAggregator("sdk_built", 1.0, async () => {
|
|
92
|
+
const { existsSync } = await import("node:fs");
|
|
93
|
+
const { join } = await import("node:path");
|
|
94
|
+
const sdkDir = opts.sdkDistPath ?? join(cwd, "packages", "sdk", "dist");
|
|
95
|
+
const needed = ["index.js", "nemesis.js", "verify.js", "events.js", "lock.js", "benchmark.js"];
|
|
96
|
+
const missing = needed.filter((n) => !existsSync(join(sdkDir, n)));
|
|
97
|
+
return { missing, sdkDir };
|
|
98
|
+
}, (r) => ({
|
|
99
|
+
ok: r.missing.length === 0,
|
|
100
|
+
evidence: r.missing.length === 0 ? `@mneme-ai/sdk dist present at ${r.sdkDir}` : `missing: ${r.missing.join(", ")}`,
|
|
101
|
+
})));
|
|
102
|
+
// Gate 6: TRUTH GATE (subset — load probes + run 3 cheap ones)
|
|
103
|
+
if (!opts.fast) {
|
|
104
|
+
gates.push(await gateFromAggregator("truth_gate", 2.0, async () => {
|
|
105
|
+
const m = await import("../truth_gate/probes.js");
|
|
106
|
+
const cheap = ["probe.audit.open_wounds_patched", "probe.audit.reproduction_suite_passes", "probe.sdk.world_class"];
|
|
107
|
+
const results = await Promise.all(cheap.map(async (id) => {
|
|
108
|
+
const p = m.probeById(id);
|
|
109
|
+
if (!p)
|
|
110
|
+
return { id, value: null };
|
|
111
|
+
try {
|
|
112
|
+
const r = await p.run({ cwd });
|
|
113
|
+
return { id, value: r.value };
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return { id, value: null };
|
|
117
|
+
}
|
|
118
|
+
}));
|
|
119
|
+
return results;
|
|
120
|
+
}, (results) => ({
|
|
121
|
+
ok: results.every((r) => r.value === 1),
|
|
122
|
+
evidence: results.map((r) => `${r.id.split(".").pop()}=${r.value}`).join(", "),
|
|
123
|
+
})));
|
|
124
|
+
}
|
|
125
|
+
// Aggregate
|
|
126
|
+
const totalWeight = gates.reduce((s, g) => s + g.weight, 0);
|
|
127
|
+
const goWeight = gates.filter((g) => g.status === "GO").reduce((s, g) => s + g.weight, 0);
|
|
128
|
+
const holdWeight = gates.filter((g) => g.status === "HOLD").reduce((s, g) => s + g.weight, 0);
|
|
129
|
+
const goRate = totalWeight === 0 ? 0 : goWeight / totalWeight;
|
|
130
|
+
// SpaceX rule: ANY NO-GO → NO-GO. ANY HOLD (and no NO-GO) → HOLD. Else GO.
|
|
131
|
+
let status = "GO";
|
|
132
|
+
if (gates.some((g) => g.status === "NO-GO"))
|
|
133
|
+
status = "NO-GO";
|
|
134
|
+
else if (holdWeight > 0)
|
|
135
|
+
status = "HOLD";
|
|
136
|
+
// Countdown phrase
|
|
137
|
+
const countdown = status === "GO" ? "T-0 GO FOR LAUNCH" :
|
|
138
|
+
status === "HOLD" ? `T+HOLD — ${gates.filter((g) => g.status === "HOLD").length} gate(s) need attention` :
|
|
139
|
+
`T-NO-GO — ${gates.filter((g) => g.status === "NO-GO").length} gate(s) FAIL; abort tag`;
|
|
140
|
+
const totalLatencyMs = +(performance.now() - t0).toFixed(2);
|
|
141
|
+
const at = new Date().toISOString();
|
|
142
|
+
const bodyForHmac = { status, countdown, goRate: +goRate.toFixed(3), gates, totalLatencyMs, at };
|
|
143
|
+
const hmac = createHmac("sha256", keyOf()).update(JSON.stringify(bodyForHmac)).digest("hex");
|
|
144
|
+
return { ...bodyForHmac, hmac };
|
|
145
|
+
}
|
|
146
|
+
/** Verify a launch verdict's HMAC offline. */
|
|
147
|
+
export function verifyLaunchVerdict(v) {
|
|
148
|
+
if (!v || typeof v.hmac !== "string")
|
|
149
|
+
return false;
|
|
150
|
+
const { hmac, ...body } = v;
|
|
151
|
+
const expected = createHmac("sha256", keyOf()).update(JSON.stringify(body)).digest("hex");
|
|
152
|
+
return expected === hmac;
|
|
153
|
+
}
|
|
154
|
+
/** Render the verdict as a SpaceX-style ASCII broadcast banner. */
|
|
155
|
+
export function renderLaunchBanner(v) {
|
|
156
|
+
const symbol = v.status === "GO" ? "🚀" : v.status === "HOLD" ? "⏸" : "🛑";
|
|
157
|
+
const lines = [
|
|
158
|
+
`${symbol} LAUNCH WINDOW · ${v.countdown}`,
|
|
159
|
+
` ${v.gates.length} gates · go-rate ${(v.goRate * 100).toFixed(0)}% · evaluated in ${v.totalLatencyMs}ms`,
|
|
160
|
+
"",
|
|
161
|
+
];
|
|
162
|
+
for (const g of v.gates) {
|
|
163
|
+
const sym = g.status === "GO" ? "✓" : g.status === "HOLD" ? "~" : "✗";
|
|
164
|
+
lines.push(` ${sym} ${g.gate.padEnd(18)} ${g.status.padEnd(6)} ${g.latencyMs.toString().padStart(6)}ms ${g.evidence}`);
|
|
165
|
+
}
|
|
166
|
+
return lines.join("\n");
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=launch_window.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch_window.js","sourceRoot":"","sources":["../../src/xai_alignment/launch_window.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,OAAO,GAAG,kBAAkB,CAAC;AACnC,MAAM,WAAW,GAAG,wBAAwB,CAAC;AAE7C,SAAS,KAAK;IACZ,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC;AAC7C,CAAC;AA6BD,SAAS,kBAAkB,CACzB,IAAY,EACZ,MAAc,EACd,EAAwB,EACxB,SAAsD;IAEtD,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAC7B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G,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QACtE,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5H,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.56.0 — STARGATE: open-source the augmented calibration corpus.
|
|
3
|
+
*
|
|
4
|
+
* Inspired by SpaceX's open-source philosophy ("the patents are stolen
|
|
5
|
+
* anyway; better to share") + xAI's Grok open-weight commitments.
|
|
6
|
+
*
|
|
7
|
+
* Premise: NEMESIS's calibration corpus (seed + augmenter) is the most
|
|
8
|
+
* valuable training-data artifact Mneme owns for AI agent identity
|
|
9
|
+
* verification. By publishing it MIT-licensed, Mneme becomes the
|
|
10
|
+
* "Switzerland of AI vendor fingerprinting" — every vendor (Anthropic /
|
|
11
|
+
* OpenAI / xAI / Google) can train classifiers against the same
|
|
12
|
+
* public ground truth. Result: cross-vendor accountability becomes a
|
|
13
|
+
* commodity that compounds Mneme's protocol position.
|
|
14
|
+
*
|
|
15
|
+
* `mneme stargate publish [--out path] [--format json|jsonl|md]`
|
|
16
|
+
* - Builds the full augmented corpus (15 fixtures × 6 vendors × 6
|
|
17
|
+
* augmentations = 540 fixtures via v2.53 augmenter)
|
|
18
|
+
* - Emits a single bundle file with provenance + license + HMAC seal
|
|
19
|
+
*
|
|
20
|
+
* Pure deterministic + defensive; never throws.
|
|
21
|
+
*/
|
|
22
|
+
import { type AugmentedEntry } from "../nemesis/corpus_augmenter.js";
|
|
23
|
+
export interface StargateBundle {
|
|
24
|
+
/** Bundle identifier: stable per (mneme version, corpus shape). */
|
|
25
|
+
bundleId: string;
|
|
26
|
+
/** Mneme version that built the bundle. */
|
|
27
|
+
mnemeVersion: string;
|
|
28
|
+
/** Total fixtures (originals + augmentations). */
|
|
29
|
+
fixtureCount: number;
|
|
30
|
+
/** Vendors covered. */
|
|
31
|
+
vendors: string[];
|
|
32
|
+
/** Augmentation kinds present. */
|
|
33
|
+
augmentationKinds: string[];
|
|
34
|
+
/** ISO timestamp. */
|
|
35
|
+
at: string;
|
|
36
|
+
/** License (always MIT). */
|
|
37
|
+
license: "MIT";
|
|
38
|
+
/** Per-fixture data. */
|
|
39
|
+
fixtures: AugmentedEntry[];
|
|
40
|
+
/** SHA-256 over the canonical fixtures body (for cross-machine integrity). */
|
|
41
|
+
contentSha256: string;
|
|
42
|
+
/** HMAC over { bundleId, contentSha256, at, mnemeVersion } — Mneme attestation. */
|
|
43
|
+
hmac: string;
|
|
44
|
+
/** Plain-English provenance + usage statement (for downstream re-publishers). */
|
|
45
|
+
citation: string;
|
|
46
|
+
}
|
|
47
|
+
export interface PublishInput {
|
|
48
|
+
/** Where to write the bundle (caller supplies). When absent → returned in-memory only. */
|
|
49
|
+
outPath?: string;
|
|
50
|
+
/** Output format. */
|
|
51
|
+
format?: "json" | "jsonl" | "md";
|
|
52
|
+
/** Mneme version (for the bundle metadata). */
|
|
53
|
+
mnemeVersion?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface PublishResult {
|
|
56
|
+
ok: boolean;
|
|
57
|
+
bundle?: StargateBundle;
|
|
58
|
+
path?: string;
|
|
59
|
+
bytes?: number;
|
|
60
|
+
reason: string;
|
|
61
|
+
}
|
|
62
|
+
export declare function buildStargateBundle(mnemeVersion: string): StargateBundle;
|
|
63
|
+
/** Verify a STARGATE bundle's integrity (offline). */
|
|
64
|
+
export declare function verifyStargateBundle(bundle: StargateBundle): {
|
|
65
|
+
ok: boolean;
|
|
66
|
+
reason: string;
|
|
67
|
+
};
|
|
68
|
+
export declare function publishStargate(input?: PublishInput): PublishResult;
|
|
69
|
+
//# sourceMappingURL=stargate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stargate.d.ts","sourceRoot":"","sources":["../../src/xai_alignment/stargate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAO3F,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,kCAAkC;IAClC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,4BAA4B;IAC5B,OAAO,EAAE,KAAK,CAAC;IACf,wBAAwB;IACxB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,8EAA8E;IAC9E,aAAa,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACjC,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CA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