@mneme-ai/core 2.65.0 → 2.67.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 +5 -0
- package/dist/agent_manifest.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/protoplasm/auto_wrap.d.ts +33 -0
- package/dist/protoplasm/auto_wrap.d.ts.map +1 -0
- package/dist/protoplasm/auto_wrap.js +72 -0
- package/dist/protoplasm/auto_wrap.js.map +1 -0
- package/dist/protoplasm/crawl_planner.d.ts +14 -0
- package/dist/protoplasm/crawl_planner.d.ts.map +1 -0
- package/dist/protoplasm/crawl_planner.js +50 -0
- package/dist/protoplasm/crawl_planner.js.map +1 -0
- package/dist/protoplasm/findings_ledger.d.ts +19 -0
- package/dist/protoplasm/findings_ledger.d.ts.map +1 -0
- package/dist/protoplasm/findings_ledger.js +81 -0
- package/dist/protoplasm/findings_ledger.js.map +1 -0
- package/dist/protoplasm/ghost_cell.d.ts +30 -0
- package/dist/protoplasm/ghost_cell.d.ts.map +1 -0
- package/dist/protoplasm/ghost_cell.js +95 -0
- package/dist/protoplasm/ghost_cell.js.map +1 -0
- package/dist/protoplasm/immortal.test.d.ts +12 -0
- package/dist/protoplasm/immortal.test.d.ts.map +1 -0
- package/dist/protoplasm/immortal.test.js +118 -0
- package/dist/protoplasm/immortal.test.js.map +1 -0
- package/dist/protoplasm/index.d.ts +42 -0
- package/dist/protoplasm/index.d.ts.map +1 -0
- package/dist/protoplasm/index.js +42 -0
- package/dist/protoplasm/index.js.map +1 -0
- package/dist/protoplasm/orchestrator.d.ts +29 -0
- package/dist/protoplasm/orchestrator.d.ts.map +1 -0
- package/dist/protoplasm/orchestrator.js +60 -0
- package/dist/protoplasm/orchestrator.js.map +1 -0
- package/dist/protoplasm/parasite.d.ts +42 -0
- package/dist/protoplasm/parasite.d.ts.map +1 -0
- package/dist/protoplasm/parasite.js +69 -0
- package/dist/protoplasm/parasite.js.map +1 -0
- package/dist/protoplasm/phoenix_hook.d.ts +49 -0
- package/dist/protoplasm/phoenix_hook.d.ts.map +1 -0
- package/dist/protoplasm/phoenix_hook.js +64 -0
- package/dist/protoplasm/phoenix_hook.js.map +1 -0
- package/dist/protoplasm/protoplasm.test.d.ts +13 -0
- package/dist/protoplasm/protoplasm.test.d.ts.map +1 -0
- package/dist/protoplasm/protoplasm.test.js +142 -0
- package/dist/protoplasm/protoplasm.test.js.map +1 -0
- package/dist/protoplasm/quantum_probe.d.ts +21 -0
- package/dist/protoplasm/quantum_probe.d.ts.map +1 -0
- package/dist/protoplasm/quantum_probe.js +118 -0
- package/dist/protoplasm/quantum_probe.js.map +1 -0
- package/dist/protoplasm/seamless_boot.d.ts +28 -0
- package/dist/protoplasm/seamless_boot.d.ts.map +1 -0
- package/dist/protoplasm/seamless_boot.js +106 -0
- package/dist/protoplasm/seamless_boot.js.map +1 -0
- package/dist/protoplasm/super_quan_probe.d.ts +24 -0
- package/dist/protoplasm/super_quan_probe.d.ts.map +1 -0
- package/dist/protoplasm/super_quan_probe.js +132 -0
- package/dist/protoplasm/super_quan_probe.js.map +1 -0
- package/dist/protoplasm/types.d.ts +84 -0
- package/dist/protoplasm/types.d.ts.map +1 -0
- package/dist/protoplasm/types.js +9 -0
- package/dist/protoplasm/types.js.map +1 -0
- package/dist/protoplasm/wal.d.ts +46 -0
- package/dist/protoplasm/wal.d.ts.map +1 -0
- package/dist/protoplasm/wal.js +145 -0
- package/dist/protoplasm/wal.js.map +1 -0
- package/dist/protoplasm/wisdom_space.d.ts +30 -0
- package/dist/protoplasm/wisdom_space.d.ts.map +1 -0
- package/dist/protoplasm/wisdom_space.js +77 -0
- package/dist/protoplasm/wisdom_space.js.map +1 -0
- package/dist/reflog/index.d.ts +165 -0
- package/dist/reflog/index.d.ts.map +1 -0
- package/dist/reflog/index.js +406 -0
- package/dist/reflog/index.js.map +1 -0
- package/dist/truth_gate/claims.d.ts.map +1 -1
- package/dist/truth_gate/claims.js +37 -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 +103 -0
- package/dist/truth_gate/probes.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🩸 PROTOPLASM — IMMORTAL ATOM tests
|
|
3
|
+
*
|
|
4
|
+
* Pin 5 invariants that make PROTOPLASM survive process death:
|
|
5
|
+
* I-IMMORTAL-1: WAL persists baseline BEFORE RAM update
|
|
6
|
+
* I-IMMORTAL-2: replay reconstructs baselines from WAL
|
|
7
|
+
* I-IMMORTAL-3: tampered WAL row → verify detects
|
|
8
|
+
* I-IMMORTAL-4: seamlessBoot is idempotent (safe to call N times)
|
|
9
|
+
* I-IMMORTAL-5: parasiteTick writes heartbeat
|
|
10
|
+
*/
|
|
11
|
+
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
12
|
+
import { mkdtempSync, rmSync, readFileSync, existsSync, writeFileSync } from "node:fs";
|
|
13
|
+
import { tmpdir } from "node:os";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { Wal } from "./wal.js";
|
|
16
|
+
import { activateParasite, persistBaseline, loadBaseline, _resetParasite } from "./parasite.js";
|
|
17
|
+
import { seamlessBoot, isBooted, _resetBoot } from "./seamless_boot.js";
|
|
18
|
+
let tmpDir;
|
|
19
|
+
let cfg;
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
tmpDir = mkdtempSync(join(tmpdir(), "immortal-test-"));
|
|
22
|
+
cfg = {
|
|
23
|
+
baselineSamplesMin: 5, zScoreWarn: 2, zScoreBroken: 3,
|
|
24
|
+
ledgerDir: tmpDir, hmacKey: "test-immortal-key",
|
|
25
|
+
crawlOnHealthyEvery: 50,
|
|
26
|
+
};
|
|
27
|
+
_resetParasite();
|
|
28
|
+
_resetBoot();
|
|
29
|
+
});
|
|
30
|
+
afterEach(() => { try {
|
|
31
|
+
rmSync(tmpDir, { recursive: true, force: true });
|
|
32
|
+
}
|
|
33
|
+
catch { /* */ } });
|
|
34
|
+
const sampleBaseline = (fnId, mean) => ({
|
|
35
|
+
fnId, samples: 10, durationMean: mean, durationStdev: 1, errorRate: 0,
|
|
36
|
+
argShapeEntropy: 0, outputShapeEntropy: 0, lastUpdate: new Date().toISOString(),
|
|
37
|
+
});
|
|
38
|
+
describe("I-IMMORTAL-1 — WAL persists BEFORE RAM", () => {
|
|
39
|
+
it("append → row on disk, replay returns it", () => {
|
|
40
|
+
const wal = new Wal(tmpDir, cfg.hmacKey);
|
|
41
|
+
const b = sampleBaseline("fn1", 10);
|
|
42
|
+
wal.append("baseline_set", "fn1", b);
|
|
43
|
+
const replayed = wal.replay();
|
|
44
|
+
expect(replayed.get("fn1")?.durationMean).toBe(10);
|
|
45
|
+
});
|
|
46
|
+
it("write succeeds even after process restart sim (new Wal instance reads same file)", () => {
|
|
47
|
+
const wal1 = new Wal(tmpDir, cfg.hmacKey);
|
|
48
|
+
wal1.append("baseline_set", "fnA", sampleBaseline("fnA", 5));
|
|
49
|
+
// simulate process death + restart by creating new Wal instance
|
|
50
|
+
const wal2 = new Wal(tmpDir, cfg.hmacKey);
|
|
51
|
+
const replayed = wal2.replay();
|
|
52
|
+
expect(replayed.get("fnA")?.durationMean).toBe(5);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
describe("I-IMMORTAL-2 — replay reconstructs full baseline map", () => {
|
|
56
|
+
it("3 fns × 2 updates each → replay returns latest each", () => {
|
|
57
|
+
const wal = new Wal(tmpDir, cfg.hmacKey);
|
|
58
|
+
wal.append("baseline_set", "fnA", sampleBaseline("fnA", 1));
|
|
59
|
+
wal.append("baseline_set", "fnB", sampleBaseline("fnB", 2));
|
|
60
|
+
wal.append("baseline_set", "fnC", sampleBaseline("fnC", 3));
|
|
61
|
+
wal.append("baseline_set", "fnA", sampleBaseline("fnA", 100)); // update
|
|
62
|
+
const replayed = wal.replay();
|
|
63
|
+
expect(replayed.size).toBe(3);
|
|
64
|
+
expect(replayed.get("fnA")?.durationMean).toBe(100);
|
|
65
|
+
expect(replayed.get("fnB")?.durationMean).toBe(2);
|
|
66
|
+
expect(replayed.get("fnC")?.durationMean).toBe(3);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe("I-IMMORTAL-3 — tampered WAL detected", () => {
|
|
70
|
+
it("flip a byte in row 1 → verify reports broken", () => {
|
|
71
|
+
const wal = new Wal(tmpDir, cfg.hmacKey);
|
|
72
|
+
wal.append("baseline_set", "fnA", sampleBaseline("fnA", 1));
|
|
73
|
+
wal.append("baseline_set", "fnB", sampleBaseline("fnB", 2));
|
|
74
|
+
wal.append("baseline_set", "fnC", sampleBaseline("fnC", 3));
|
|
75
|
+
const walPath = wal.path_for_test();
|
|
76
|
+
const lines = readFileSync(walPath, "utf8").trim().split("\n");
|
|
77
|
+
const row1 = JSON.parse(lines[1]);
|
|
78
|
+
row1.payload.durationMean = 99999; // tamper
|
|
79
|
+
lines[1] = JSON.stringify(row1);
|
|
80
|
+
writeFileSync(walPath, lines.join("\n") + "\n");
|
|
81
|
+
const v = wal.verify();
|
|
82
|
+
expect(v.ok).toBe(false);
|
|
83
|
+
expect(v.brokenAt).toBe(1);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
describe("I-IMMORTAL-4 — seamlessBoot idempotent", () => {
|
|
87
|
+
it("first call boots, second is no-op", () => {
|
|
88
|
+
const r1 = seamlessBoot(cfg);
|
|
89
|
+
const r2 = seamlessBoot(cfg);
|
|
90
|
+
expect(r1.booted).toBe(true);
|
|
91
|
+
expect(r2.booted).toBe(false);
|
|
92
|
+
expect(isBooted()).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
it("writes heartbeat file", () => {
|
|
95
|
+
seamlessBoot(cfg);
|
|
96
|
+
expect(existsSync(join(tmpDir, "heartbeat.json"))).toBe(true);
|
|
97
|
+
const hb = JSON.parse(readFileSync(join(tmpDir, "heartbeat.json"), "utf8"));
|
|
98
|
+
expect(hb.pid).toBe(process.pid);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
describe("I-IMMORTAL-5 — parasite persists state across calls", () => {
|
|
102
|
+
it("persistBaseline → loadBaseline returns same", () => {
|
|
103
|
+
activateParasite(cfg);
|
|
104
|
+
persistBaseline("fnX", sampleBaseline("fnX", 42));
|
|
105
|
+
const loaded = loadBaseline("fnX");
|
|
106
|
+
expect(loaded?.durationMean).toBe(42);
|
|
107
|
+
});
|
|
108
|
+
it("survives parasite reset (simulating process restart)", () => {
|
|
109
|
+
activateParasite(cfg);
|
|
110
|
+
persistBaseline("fnY", sampleBaseline("fnY", 77));
|
|
111
|
+
_resetParasite();
|
|
112
|
+
// Now simulate fresh process: activate again, should reload from WAL
|
|
113
|
+
activateParasite(cfg);
|
|
114
|
+
const loaded = loadBaseline("fnY");
|
|
115
|
+
expect(loaded?.durationMean).toBe(77);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=immortal.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"immortal.test.js","sourceRoot":"","sources":["../../src/protoplasm/immortal.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,Y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,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🦠 PROTOPLASM — public surface
|
|
3
|
+
*
|
|
4
|
+
* The "live atom" infrastructure. Embed `withSuperQuanProbe` in any function
|
|
5
|
+
* to enable continuous statistical + quantum-inspired health monitoring.
|
|
6
|
+
*
|
|
7
|
+
* Composes with:
|
|
8
|
+
* - LIVING LAB (v2.58) — emit findings as living lab events
|
|
9
|
+
* - SUPERNOVA self-heal (v1.30) — broken verdicts trigger restart cycles
|
|
10
|
+
* - MNEMNET federation (v2.33) — healthy bursts can crawl globally
|
|
11
|
+
* - TRUTH GATE — broken cascades raise release block
|
|
12
|
+
* - HGP — broken patterns become hallucination genome entries
|
|
13
|
+
*
|
|
14
|
+
* Wire example:
|
|
15
|
+
* import { withSuperQuanProbe, startOrchestrator } from "@mneme-ai/core/protoplasm";
|
|
16
|
+
*
|
|
17
|
+
* const safeFn = withSuperQuanProbe("auth.lookupUser", lookupUser, DEFAULT_PROTOPLASM_CONFIG);
|
|
18
|
+
* startOrchestrator({
|
|
19
|
+
* onBroken: (v) => console.warn("broken:", v.diagnosis?.hypothesis),
|
|
20
|
+
* onCrawl: (v) => mnemnetCrawl(v.crawl!.searchTopics),
|
|
21
|
+
* });
|
|
22
|
+
*/
|
|
23
|
+
export type { ProbeOutcome, InvocationSnapshot, FunctionBaseline, SuperQuanFinding, QuantumSignals, WisdomRootCause, HealAction, CrawlPlan, ProtoplasmConfig, } from "./types.js";
|
|
24
|
+
export { withSuperQuanProbe, onFinding, snapshotRegistry, clearRegistry, } from "./super_quan_probe.js";
|
|
25
|
+
export { buildBaseline, computeQuantumSignals, gradeOutcome, runQuantumProbe } from "./quantum_probe.js";
|
|
26
|
+
export { appendFinding, readLedger, verifyChain, lastHmac, canonicalJson } from "./findings_ledger.js";
|
|
27
|
+
export { diagnose, ledgerHealth } from "./wisdom_space.js";
|
|
28
|
+
export { planCrawl } from "./crawl_planner.js";
|
|
29
|
+
export { startOrchestrator, manualProbeReport, DEFAULT_PROTOPLASM_CONFIG } from "./orchestrator.js";
|
|
30
|
+
export type { OrchestratorVerdict, OrchestratorHooks } from "./orchestrator.js";
|
|
31
|
+
export { Wal } from "./wal.js";
|
|
32
|
+
export type { WalRow, WalOp } from "./wal.js";
|
|
33
|
+
export { activateParasite, getParasite, persistBaseline, loadBaseline, parasiteTick } from "./parasite.js";
|
|
34
|
+
export type { ParasiteContext } from "./parasite.js";
|
|
35
|
+
export { spawnGhostCell } from "./ghost_cell.js";
|
|
36
|
+
export type { GhostCellOptions } from "./ghost_cell.js";
|
|
37
|
+
export { seamlessBoot, isBooted, getKeyProvenance } from "./seamless_boot.js";
|
|
38
|
+
export { drainHealQueue, registerWithPhoenix, PROTOPLASM_REVIVABLE } from "./phoenix_hook.js";
|
|
39
|
+
export type { PhoenixHookContext, HealQueueEntry, RevivableSpec } from "./phoenix_hook.js";
|
|
40
|
+
export { autoWrapModule, autoWrapModuleProxy, autoWrapClass } from "./auto_wrap.js";
|
|
41
|
+
export type { AutoWrapOptions } from "./auto_wrap.js";
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protoplasm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,UAAU,EACV,SAAS,EACT,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAChB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvG,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACpG,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAShF,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC3G,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9F,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpF,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🦠 PROTOPLASM — public surface
|
|
3
|
+
*
|
|
4
|
+
* The "live atom" infrastructure. Embed `withSuperQuanProbe` in any function
|
|
5
|
+
* to enable continuous statistical + quantum-inspired health monitoring.
|
|
6
|
+
*
|
|
7
|
+
* Composes with:
|
|
8
|
+
* - LIVING LAB (v2.58) — emit findings as living lab events
|
|
9
|
+
* - SUPERNOVA self-heal (v1.30) — broken verdicts trigger restart cycles
|
|
10
|
+
* - MNEMNET federation (v2.33) — healthy bursts can crawl globally
|
|
11
|
+
* - TRUTH GATE — broken cascades raise release block
|
|
12
|
+
* - HGP — broken patterns become hallucination genome entries
|
|
13
|
+
*
|
|
14
|
+
* Wire example:
|
|
15
|
+
* import { withSuperQuanProbe, startOrchestrator } from "@mneme-ai/core/protoplasm";
|
|
16
|
+
*
|
|
17
|
+
* const safeFn = withSuperQuanProbe("auth.lookupUser", lookupUser, DEFAULT_PROTOPLASM_CONFIG);
|
|
18
|
+
* startOrchestrator({
|
|
19
|
+
* onBroken: (v) => console.warn("broken:", v.diagnosis?.hypothesis),
|
|
20
|
+
* onCrawl: (v) => mnemnetCrawl(v.crawl!.searchTopics),
|
|
21
|
+
* });
|
|
22
|
+
*/
|
|
23
|
+
export { withSuperQuanProbe, onFinding, snapshotRegistry, clearRegistry, } from "./super_quan_probe.js";
|
|
24
|
+
export { buildBaseline, computeQuantumSignals, gradeOutcome, runQuantumProbe } from "./quantum_probe.js";
|
|
25
|
+
export { appendFinding, readLedger, verifyChain, lastHmac, canonicalJson } from "./findings_ledger.js";
|
|
26
|
+
export { diagnose, ledgerHealth } from "./wisdom_space.js";
|
|
27
|
+
export { planCrawl } from "./crawl_planner.js";
|
|
28
|
+
export { startOrchestrator, manualProbeReport, DEFAULT_PROTOPLASM_CONFIG } from "./orchestrator.js";
|
|
29
|
+
// v2.67 — IMMORTAL ATOM layer: 5-strategy fusion that makes PROTOPLASM
|
|
30
|
+
// survive any kill signal up to and including SIGKILL + OS reboot.
|
|
31
|
+
// WAL → state persists to disk BEFORE RAM (uncatchable-kill safe)
|
|
32
|
+
// PARASITE → atom rides on every Mneme tool call (no daemon needed)
|
|
33
|
+
// GHOST CELL → detached watchdog detects abnormal exit + queues heal
|
|
34
|
+
// PHOENIX HOOK → composes with existing SUPERNOVA / nucleus_daemon
|
|
35
|
+
// SEAMLESS → zero-config auto-init; user does nothing
|
|
36
|
+
export { Wal } from "./wal.js";
|
|
37
|
+
export { activateParasite, getParasite, persistBaseline, loadBaseline, parasiteTick } from "./parasite.js";
|
|
38
|
+
export { spawnGhostCell } from "./ghost_cell.js";
|
|
39
|
+
export { seamlessBoot, isBooted, getKeyProvenance } from "./seamless_boot.js";
|
|
40
|
+
export { drainHealQueue, registerWithPhoenix, PROTOPLASM_REVIVABLE } from "./phoenix_hook.js";
|
|
41
|
+
export { autoWrapModule, autoWrapModuleProxy, autoWrapClass } from "./auto_wrap.js";
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/protoplasm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAcH,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAChB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvG,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAGpG,uEAAuE;AACvE,mEAAmE;AACnE,6EAA6E;AAC7E,0EAA0E;AAC1E,yEAAyE;AACzE,qEAAqE;AACrE,4DAA4D;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE3G,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🦠 PROTOPLASM — orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Central brain that:
|
|
5
|
+
* - receives findings via PROBE_LISTENERS
|
|
6
|
+
* - dispatches to wisdom_space when broken
|
|
7
|
+
* - triggers crawl_planner when healthy bursts accumulate
|
|
8
|
+
*
|
|
9
|
+
* Stateless w.r.t. file IO — all chain writes are via findings_ledger.
|
|
10
|
+
*/
|
|
11
|
+
import type { SuperQuanFinding, WisdomRootCause, CrawlPlan, ProtoplasmConfig } from "./types.js";
|
|
12
|
+
import { ledgerHealth } from "./wisdom_space.js";
|
|
13
|
+
export interface OrchestratorVerdict {
|
|
14
|
+
finding: SuperQuanFinding;
|
|
15
|
+
diagnosis?: WisdomRootCause;
|
|
16
|
+
crawl?: CrawlPlan;
|
|
17
|
+
}
|
|
18
|
+
export interface OrchestratorHooks {
|
|
19
|
+
onBroken?: (v: OrchestratorVerdict) => void;
|
|
20
|
+
onCrawl?: (v: OrchestratorVerdict) => void;
|
|
21
|
+
onHealthy?: (v: OrchestratorVerdict) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function startOrchestrator(hooks?: OrchestratorHooks, cfg?: ProtoplasmConfig): () => void;
|
|
24
|
+
export declare function manualProbeReport(cfg?: ProtoplasmConfig): {
|
|
25
|
+
health: ReturnType<typeof ledgerHealth>;
|
|
26
|
+
lastFindings: SuperQuanFinding[];
|
|
27
|
+
};
|
|
28
|
+
export declare const DEFAULT_PROTOPLASM_CONFIG: ProtoplasmConfig;
|
|
29
|
+
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/protoplasm/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEjG,OAAO,EAAY,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI3D,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5C,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,mBAAmB,KAAK,IAAI,CAAC;CAC9C;AAcD,wBAAgB,iBAAiB,CAAC,KAAK,GAAE,iBAAsB,EAAE,GAAG,GAAE,gBAA8B,GAAG,MAAM,IAAI,CAMhH;AAsBD,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,gBAA8B,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IAAC,YAAY,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAGpJ;AAED,eAAO,MAAM,yBAAyB,kBAAc,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🦠 PROTOPLASM — orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Central brain that:
|
|
5
|
+
* - receives findings via PROBE_LISTENERS
|
|
6
|
+
* - dispatches to wisdom_space when broken
|
|
7
|
+
* - triggers crawl_planner when healthy bursts accumulate
|
|
8
|
+
*
|
|
9
|
+
* Stateless w.r.t. file IO — all chain writes are via findings_ledger.
|
|
10
|
+
*/
|
|
11
|
+
import { onFinding } from "./super_quan_probe.js";
|
|
12
|
+
import { diagnose, ledgerHealth } from "./wisdom_space.js";
|
|
13
|
+
import { planCrawl } from "./crawl_planner.js";
|
|
14
|
+
import { readLedger } from "./findings_ledger.js";
|
|
15
|
+
const DEFAULT_CFG = {
|
|
16
|
+
baselineSamplesMin: 5,
|
|
17
|
+
zScoreWarn: 2,
|
|
18
|
+
zScoreBroken: 3,
|
|
19
|
+
ledgerDir: ".mneme/protoplasm",
|
|
20
|
+
hmacKey: process.env.MNEME_PROTOPLASM_KEY ?? "dev-protoplasm-key",
|
|
21
|
+
crawlOnHealthyEvery: 50,
|
|
22
|
+
};
|
|
23
|
+
let healthyBurstCount = 0;
|
|
24
|
+
let activeHooks = {};
|
|
25
|
+
export function startOrchestrator(hooks = {}, cfg = DEFAULT_CFG) {
|
|
26
|
+
activeHooks = hooks;
|
|
27
|
+
const stop = onFinding((finding) => {
|
|
28
|
+
handle(finding, cfg);
|
|
29
|
+
});
|
|
30
|
+
return stop;
|
|
31
|
+
}
|
|
32
|
+
function handle(finding, cfg) {
|
|
33
|
+
const verdict = { finding };
|
|
34
|
+
if (finding.outcome === "broken") {
|
|
35
|
+
const recent = readLedger(cfg.ledgerDir + "/findings.jsonl").slice(-200);
|
|
36
|
+
verdict.diagnosis = diagnose({ brokenFinding: finding, recentLedger: recent });
|
|
37
|
+
healthyBurstCount = 0;
|
|
38
|
+
activeHooks.onBroken?.(verdict);
|
|
39
|
+
}
|
|
40
|
+
else if (finding.outcome === "healthy") {
|
|
41
|
+
healthyBurstCount++;
|
|
42
|
+
activeHooks.onHealthy?.(verdict);
|
|
43
|
+
if (healthyBurstCount >= cfg.crawlOnHealthyEvery) {
|
|
44
|
+
healthyBurstCount = 0;
|
|
45
|
+
const recent = readLedger(cfg.ledgerDir + "/findings.jsonl").slice(-200);
|
|
46
|
+
const crawl = planCrawl(recent);
|
|
47
|
+
if (crawl) {
|
|
48
|
+
verdict.crawl = crawl;
|
|
49
|
+
activeHooks.onCrawl?.(verdict);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return verdict;
|
|
54
|
+
}
|
|
55
|
+
export function manualProbeReport(cfg = DEFAULT_CFG) {
|
|
56
|
+
const recent = readLedger(cfg.ledgerDir + "/findings.jsonl").slice(-100);
|
|
57
|
+
return { health: ledgerHealth(recent), lastFindings: recent.slice(-10) };
|
|
58
|
+
}
|
|
59
|
+
export const DEFAULT_PROTOPLASM_CONFIG = DEFAULT_CFG;
|
|
60
|
+
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/protoplasm/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAiB,MAAM,sBAAsB,CAAC;AAcjE,MAAM,WAAW,GAAqB;IACpC,kBAAkB,EAAE,CAAC;IACrB,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,CAAC;IACf,SAAS,EAAE,mBAAmB;IAC9B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,oBAAoB;IACjE,mBAAmB,EAAE,EAAE;CACxB,CAAC;AAEF,IAAI,iBAAiB,GAAG,CAAC,CAAC;AAC1B,IAAI,WAAW,GAAsB,EAAE,CAAC;AAExC,MAAM,U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OAAO,CAAC,CAAC;YAAC,CAAC;QACvE,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAwB,WAAW;IACnE,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,GAAG,iBAAiB,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;IACzE,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🐍 PROTOPLASM — PARASITE pattern
|
|
3
|
+
*
|
|
4
|
+
* "If the host lives, the atom lives."
|
|
5
|
+
*
|
|
6
|
+
* Why parasite: most resilience strategies need a persistent process.
|
|
7
|
+
* Mneme CLI is one-shot → no persistent process possible by design.
|
|
8
|
+
* Solution: PROTOPLASM rides on EVERY Mneme tool invocation.
|
|
9
|
+
*
|
|
10
|
+
* ANY mneme <cmd> → parasite.activate() runs
|
|
11
|
+
* → loads WAL baselines
|
|
12
|
+
* → ticks orchestrator once
|
|
13
|
+
* → flushes recent findings
|
|
14
|
+
* → exits with parent
|
|
15
|
+
*
|
|
16
|
+
* Cost: ~1-2ms per CLI invocation.
|
|
17
|
+
* Benefit: state survives forever even though no daemon needed.
|
|
18
|
+
*
|
|
19
|
+
* Combined with WAL = TRUE 24/7 monitoring without any daemon process.
|
|
20
|
+
*/
|
|
21
|
+
import { Wal } from "./wal.js";
|
|
22
|
+
import type { FunctionBaseline, ProtoplasmConfig } from "./types.js";
|
|
23
|
+
export interface ParasiteContext {
|
|
24
|
+
wal: Wal;
|
|
25
|
+
baselines: Map<string, FunctionBaseline>;
|
|
26
|
+
loadedAt: string;
|
|
27
|
+
cfg: ProtoplasmConfig;
|
|
28
|
+
}
|
|
29
|
+
/** Idempotent: first call boots, subsequent calls return cached. */
|
|
30
|
+
export declare function activateParasite(cfg: ProtoplasmConfig): ParasiteContext;
|
|
31
|
+
export declare function getParasite(): ParasiteContext | null;
|
|
32
|
+
/** Persist baseline update via WAL BEFORE updating in-memory.
|
|
33
|
+
* This is the critical order: disk first, RAM second.
|
|
34
|
+
* Even SIGKILL between these calls leaves state durable. */
|
|
35
|
+
export declare function persistBaseline(fnId: string, baseline: FunctionBaseline): void;
|
|
36
|
+
/** Load baseline from persistent state (used on first wrap of a fn). */
|
|
37
|
+
export declare function loadBaseline(fnId: string): FunctionBaseline | null;
|
|
38
|
+
/** Called by every Mneme tool invocation as the first line. */
|
|
39
|
+
export declare function parasiteTick(cfg: ProtoplasmConfig): void;
|
|
40
|
+
/** Reset for tests. */
|
|
41
|
+
export declare function _resetParasite(): void;
|
|
42
|
+
//# sourceMappingURL=parasite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parasite.d.ts","sourceRoot":"","sources":["../../src/protoplasm/parasite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAErE,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,GAAG,CAAC;IACT,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,gBAAgB,CAAC;CACvB;AAID,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,eAAe,CAMvE;AAED,wBAAgB,WAAW,IAAI,eAAe,GAAG,IAAI,CAEpD;AAED;;6DAE6D;AAC7D,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAI9E;AAED,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAGlE;AAED,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAWxD;AAED,uBAAuB;AACvB,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🐍 PROTOPLASM — PARASITE pattern
|
|
3
|
+
*
|
|
4
|
+
* "If the host lives, the atom lives."
|
|
5
|
+
*
|
|
6
|
+
* Why parasite: most resilience strategies need a persistent process.
|
|
7
|
+
* Mneme CLI is one-shot → no persistent process possible by design.
|
|
8
|
+
* Solution: PROTOPLASM rides on EVERY Mneme tool invocation.
|
|
9
|
+
*
|
|
10
|
+
* ANY mneme <cmd> → parasite.activate() runs
|
|
11
|
+
* → loads WAL baselines
|
|
12
|
+
* → ticks orchestrator once
|
|
13
|
+
* → flushes recent findings
|
|
14
|
+
* → exits with parent
|
|
15
|
+
*
|
|
16
|
+
* Cost: ~1-2ms per CLI invocation.
|
|
17
|
+
* Benefit: state survives forever even though no daemon needed.
|
|
18
|
+
*
|
|
19
|
+
* Combined with WAL = TRUE 24/7 monitoring without any daemon process.
|
|
20
|
+
*/
|
|
21
|
+
import { writeFileSync } from "node:fs";
|
|
22
|
+
import { Wal } from "./wal.js";
|
|
23
|
+
let GLOBAL_CONTEXT = null;
|
|
24
|
+
/** Idempotent: first call boots, subsequent calls return cached. */
|
|
25
|
+
export function activateParasite(cfg) {
|
|
26
|
+
if (GLOBAL_CONTEXT)
|
|
27
|
+
return GLOBAL_CONTEXT;
|
|
28
|
+
const wal = new Wal(cfg.ledgerDir, cfg.hmacKey);
|
|
29
|
+
const baselines = wal.replay();
|
|
30
|
+
GLOBAL_CONTEXT = { wal, baselines, loadedAt: new Date().toISOString(), cfg };
|
|
31
|
+
return GLOBAL_CONTEXT;
|
|
32
|
+
}
|
|
33
|
+
export function getParasite() {
|
|
34
|
+
return GLOBAL_CONTEXT;
|
|
35
|
+
}
|
|
36
|
+
/** Persist baseline update via WAL BEFORE updating in-memory.
|
|
37
|
+
* This is the critical order: disk first, RAM second.
|
|
38
|
+
* Even SIGKILL between these calls leaves state durable. */
|
|
39
|
+
export function persistBaseline(fnId, baseline) {
|
|
40
|
+
if (!GLOBAL_CONTEXT)
|
|
41
|
+
return;
|
|
42
|
+
GLOBAL_CONTEXT.wal.append("baseline_set", fnId, baseline); // disk first
|
|
43
|
+
GLOBAL_CONTEXT.baselines.set(fnId, baseline); // RAM second
|
|
44
|
+
}
|
|
45
|
+
/** Load baseline from persistent state (used on first wrap of a fn). */
|
|
46
|
+
export function loadBaseline(fnId) {
|
|
47
|
+
if (!GLOBAL_CONTEXT)
|
|
48
|
+
return null;
|
|
49
|
+
return GLOBAL_CONTEXT.baselines.get(fnId) ?? null;
|
|
50
|
+
}
|
|
51
|
+
/** Called by every Mneme tool invocation as the first line. */
|
|
52
|
+
export function parasiteTick(cfg) {
|
|
53
|
+
const ctx = activateParasite(cfg);
|
|
54
|
+
try {
|
|
55
|
+
const heartbeatPath = cfg.ledgerDir + "/heartbeat.json";
|
|
56
|
+
writeFileSync(heartbeatPath, JSON.stringify({
|
|
57
|
+
pid: process.pid,
|
|
58
|
+
ts: new Date().toISOString(),
|
|
59
|
+
baselines: ctx.baselines.size,
|
|
60
|
+
walRows: ctx.wal.verify().rows,
|
|
61
|
+
}), { encoding: "utf8" });
|
|
62
|
+
}
|
|
63
|
+
catch { /* heartbeat best-effort */ }
|
|
64
|
+
}
|
|
65
|
+
/** Reset for tests. */
|
|
66
|
+
export function _resetParasite() {
|
|
67
|
+
GLOBAL_CONTEXT = null;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=parasite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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B;IAChD,MAAM,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,GAAG,CAAC,SAAS,GAAG,iBAAiB,CAAC;QACxD,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC;YAC1C,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAC5B,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,IAAI;YAC7B,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI;SAC/B,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC,CAAC,2BAA2B,CAAC,CAAC;AACzC,CAAC;AAED,uBAAuB;AACvB,MAAM,UAAU,cAAc;IAC5B,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🔥 PROTOPLASM — PHOENIX HOOK
|
|
3
|
+
*
|
|
4
|
+
* Integration with Mneme's existing PHOENIX (v1.21+) resurrection cycle
|
|
5
|
+
* and SUPERNOVA (v1.30+) escalation.
|
|
6
|
+
*
|
|
7
|
+
* What Mneme already has:
|
|
8
|
+
* - PHOENIX: when daemon dies, can be respawned by OS service / cron
|
|
9
|
+
* - SUPERNOVA: factorial backoff supervised cycles for self-heal
|
|
10
|
+
* - heartbeats/ directory in ~/.mneme-global for per-PID heartbeats
|
|
11
|
+
*
|
|
12
|
+
* What PROTOPLASM adds via this hook:
|
|
13
|
+
* - Register PROTOPLASM as a "phoenix-revivable" subsystem
|
|
14
|
+
* - Heal queue (from ghost_cell) feeds SUPERNOVA escalation
|
|
15
|
+
* - PROTOPLASM heartbeat composes into nucleus daemon heartbeat
|
|
16
|
+
*
|
|
17
|
+
* On a fresh Mneme install where PHOENIX/SUPERNOVA may not be configured,
|
|
18
|
+
* we degrade to "advisory mode": write to heal_queue.jsonl, let any
|
|
19
|
+
* supervisor that exists pick it up.
|
|
20
|
+
*/
|
|
21
|
+
export interface PhoenixHookContext {
|
|
22
|
+
ledgerDir: string;
|
|
23
|
+
daemonLedgerDir?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface HealQueueEntry {
|
|
26
|
+
ts: string;
|
|
27
|
+
parentPid: number;
|
|
28
|
+
reason: string;
|
|
29
|
+
hbAge?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface RevivableSpec {
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
livenessCheck: () => boolean;
|
|
35
|
+
reviveCommand: string;
|
|
36
|
+
}
|
|
37
|
+
/** Drain pending heal requests from ghost_cell → SUPERNOVA escalation. */
|
|
38
|
+
export declare function drainHealQueue(ctx: PhoenixHookContext): {
|
|
39
|
+
drained: HealQueueEntry[];
|
|
40
|
+
remaining: number;
|
|
41
|
+
};
|
|
42
|
+
/** Register PROTOPLASM as a phoenix-revivable subsystem. */
|
|
43
|
+
export declare function registerWithPhoenix(ctx: PhoenixHookContext, spec: RevivableSpec): {
|
|
44
|
+
registered: boolean;
|
|
45
|
+
path: string;
|
|
46
|
+
};
|
|
47
|
+
/** Default PROTOPLASM revivable spec. */
|
|
48
|
+
export declare const PROTOPLASM_REVIVABLE: RevivableSpec;
|
|
49
|
+
//# sourceMappingURL=phoenix_hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phoenix_hook.d.ts","sourceRoot":"","sources":["../../src/protoplasm/phoenix_hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,OAAO,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,GAAG,EAAE,kBAAkB,GAAG;IAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAWxG;AAED,4DAA4D;AAC5D,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,aAAa,GAAG;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAcvH;AAED,yCAAyC;AACzC,eAAO,MAAM,oBAAoB,EAAE,aAKlC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🔥 PROTOPLASM — PHOENIX HOOK
|
|
3
|
+
*
|
|
4
|
+
* Integration with Mneme's existing PHOENIX (v1.21+) resurrection cycle
|
|
5
|
+
* and SUPERNOVA (v1.30+) escalation.
|
|
6
|
+
*
|
|
7
|
+
* What Mneme already has:
|
|
8
|
+
* - PHOENIX: when daemon dies, can be respawned by OS service / cron
|
|
9
|
+
* - SUPERNOVA: factorial backoff supervised cycles for self-heal
|
|
10
|
+
* - heartbeats/ directory in ~/.mneme-global for per-PID heartbeats
|
|
11
|
+
*
|
|
12
|
+
* What PROTOPLASM adds via this hook:
|
|
13
|
+
* - Register PROTOPLASM as a "phoenix-revivable" subsystem
|
|
14
|
+
* - Heal queue (from ghost_cell) feeds SUPERNOVA escalation
|
|
15
|
+
* - PROTOPLASM heartbeat composes into nucleus daemon heartbeat
|
|
16
|
+
*
|
|
17
|
+
* On a fresh Mneme install where PHOENIX/SUPERNOVA may not be configured,
|
|
18
|
+
* we degrade to "advisory mode": write to heal_queue.jsonl, let any
|
|
19
|
+
* supervisor that exists pick it up.
|
|
20
|
+
*/
|
|
21
|
+
import { readFileSync, writeFileSync, existsSync, appendFileSync, mkdirSync } from "node:fs";
|
|
22
|
+
import { join } from "node:path";
|
|
23
|
+
/** Drain pending heal requests from ghost_cell → SUPERNOVA escalation. */
|
|
24
|
+
export function drainHealQueue(ctx) {
|
|
25
|
+
const queuePath = join(ctx.ledgerDir, "heal_queue.jsonl");
|
|
26
|
+
if (!existsSync(queuePath))
|
|
27
|
+
return { drained: [], remaining: 0 };
|
|
28
|
+
const lines = readFileSync(queuePath, "utf8").trim().split("\n").filter(Boolean);
|
|
29
|
+
const drained = [];
|
|
30
|
+
for (const line of lines) {
|
|
31
|
+
try {
|
|
32
|
+
drained.push(JSON.parse(line));
|
|
33
|
+
}
|
|
34
|
+
catch { /* */ }
|
|
35
|
+
}
|
|
36
|
+
// Clear queue after drain
|
|
37
|
+
writeFileSync(queuePath, "");
|
|
38
|
+
return { drained, remaining: 0 };
|
|
39
|
+
}
|
|
40
|
+
/** Register PROTOPLASM as a phoenix-revivable subsystem. */
|
|
41
|
+
export function registerWithPhoenix(ctx, spec) {
|
|
42
|
+
const registryPath = join(ctx.daemonLedgerDir ?? ctx.ledgerDir, "phoenix-revivables.jsonl");
|
|
43
|
+
try {
|
|
44
|
+
mkdirSync(join(ctx.daemonLedgerDir ?? ctx.ledgerDir), { recursive: true });
|
|
45
|
+
appendFileSync(registryPath, JSON.stringify({
|
|
46
|
+
ts: new Date().toISOString(),
|
|
47
|
+
name: spec.name,
|
|
48
|
+
description: spec.description,
|
|
49
|
+
reviveCommand: spec.reviveCommand,
|
|
50
|
+
}) + "\n");
|
|
51
|
+
return { registered: true, path: registryPath };
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return { registered: false, path: registryPath };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** Default PROTOPLASM revivable spec. */
|
|
58
|
+
export const PROTOPLASM_REVIVABLE = {
|
|
59
|
+
name: "protoplasm",
|
|
60
|
+
description: "Live atom infrastructure — per-function super_quan probes with HMAC-chained findings ledger",
|
|
61
|
+
livenessCheck: () => existsSync(".mneme/protoplasm/heartbeat.json"),
|
|
62
|
+
reviveCommand: "mneme protoplasm report",
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=phoenix_hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phoenix_hook.js","sourceRoot":"","sources":["../../src/protoplasm/phoenix_hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAqBjC,0EAA0E;AAC1E,MAAM,UAAU,cAAc,CAAC,GAAuB;IACpD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAC1D,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACjE,MAAM,KAAK,GAAG,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjF,MAAM,OAAO,GAAqB,EAAE,CAAC;IACrC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC;YAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAmB,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC;IAC3E,CAAC;IACD,0BAA0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ure must guarantee:
|
|
5
|
+
* I1. Wrapped fn behavior is identical (sync + async, throw + return)
|
|
6
|
+
* I2. Probe runs every N calls; baseline rebuilt every 50
|
|
7
|
+
* I3. HMAC chain integrity holds (tamper one row → verifyChain fails)
|
|
8
|
+
* I4. Diagnose surfaces cascade pattern when upstream broke first
|
|
9
|
+
* I5. Crawl plan only generated when ≥10 healthy findings recent
|
|
10
|
+
* I6. Quantum signals respect bounds (entropy ≥ 0, stability ∈ [0,1])
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=protoplasm.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protoplasm.test.d.ts","sourceRoot":"","sources":["../../src/protoplasm/protoplasm.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|