@mneme-ai/core 1.67.1 → 1.69.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/ascension/ascension.test.d.ts +13 -0
- package/dist/ascension/ascension.test.d.ts.map +1 -0
- package/dist/ascension/ascension.test.js +313 -0
- package/dist/ascension/ascension.test.js.map +1 -0
- package/dist/ascension/circadian_heartbeat.d.ts +70 -0
- package/dist/ascension/circadian_heartbeat.d.ts.map +1 -0
- package/dist/ascension/circadian_heartbeat.js +176 -0
- package/dist/ascension/circadian_heartbeat.js.map +1 -0
- package/dist/ascension/conformal_apoptosis.d.ts +98 -0
- package/dist/ascension/conformal_apoptosis.d.ts.map +1 -0
- package/dist/ascension/conformal_apoptosis.js +175 -0
- package/dist/ascension/conformal_apoptosis.js.map +1 -0
- package/dist/ascension/inbox_tier.d.ts +74 -0
- package/dist/ascension/inbox_tier.d.ts.map +1 -0
- package/dist/ascension/inbox_tier.js +119 -0
- package/dist/ascension/inbox_tier.js.map +1 -0
- package/dist/ascension/index.d.ts +73 -0
- package/dist/ascension/index.d.ts.map +1 -0
- package/dist/ascension/index.js +126 -0
- package/dist/ascension/index.js.map +1 -0
- package/dist/ascension/prophetic_embedder.d.ts +38 -0
- package/dist/ascension/prophetic_embedder.d.ts.map +1 -0
- package/dist/ascension/prophetic_embedder.js +85 -0
- package/dist/ascension/prophetic_embedder.js.map +1 -0
- package/dist/ascension/sovereign_mode.d.ts +46 -0
- package/dist/ascension/sovereign_mode.d.ts.map +1 -0
- package/dist/ascension/sovereign_mode.js +94 -0
- package/dist/ascension/sovereign_mode.js.map +1 -0
- package/dist/ascension/superposed_antivirus.d.ts +62 -0
- package/dist/ascension/superposed_antivirus.d.ts.map +1 -0
- package/dist/ascension/superposed_antivirus.js +198 -0
- package/dist/ascension/superposed_antivirus.js.map +1 -0
- package/dist/hyperscan/bench.d.ts +32 -0
- package/dist/hyperscan/bench.d.ts.map +1 -0
- package/dist/hyperscan/bench.js +81 -0
- package/dist/hyperscan/bench.js.map +1 -0
- package/dist/hyperscan/cross_citation.d.ts +51 -0
- package/dist/hyperscan/cross_citation.d.ts.map +1 -0
- package/dist/hyperscan/cross_citation.js +140 -0
- package/dist/hyperscan/cross_citation.js.map +1 -0
- package/dist/hyperscan/cross_source_qa.d.ts +49 -0
- package/dist/hyperscan/cross_source_qa.d.ts.map +1 -0
- package/dist/hyperscan/cross_source_qa.js +219 -0
- package/dist/hyperscan/cross_source_qa.js.map +1 -0
- package/dist/hyperscan/hyperscan.test.d.ts +5 -0
- package/dist/hyperscan/hyperscan.test.d.ts.map +1 -0
- package/dist/hyperscan/hyperscan.test.js +191 -0
- package/dist/hyperscan/hyperscan.test.js.map +1 -0
- package/dist/hyperscan/hyperscan_molecule.d.ts +76 -0
- package/dist/hyperscan/hyperscan_molecule.d.ts.map +1 -0
- package/dist/hyperscan/hyperscan_molecule.js +144 -0
- package/dist/hyperscan/hyperscan_molecule.js.map +1 -0
- package/dist/hyperscan/index.d.ts +26 -0
- package/dist/hyperscan/index.d.ts.map +1 -0
- package/dist/hyperscan/index.js +26 -0
- package/dist/hyperscan/index.js.map +1 -0
- package/dist/hyperscan/nucleus_dust_htc.d.ts +71 -0
- package/dist/hyperscan/nucleus_dust_htc.d.ts.map +1 -0
- package/dist/hyperscan/nucleus_dust_htc.js +242 -0
- package/dist/hyperscan/nucleus_dust_htc.js.map +1 -0
- package/dist/hyperscan/prose_shadow.d.ts +50 -0
- package/dist/hyperscan/prose_shadow.d.ts.map +1 -0
- package/dist/hyperscan/prose_shadow.js +225 -0
- package/dist/hyperscan/prose_shadow.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.68.0 -- ASCENSION PROTOCOL.
|
|
3
|
+
*
|
|
4
|
+
* Six wild moves to push 3 metrics toward 100% + close 3 root causes:
|
|
5
|
+
*
|
|
6
|
+
* ASC-1 Circadian Heartbeat per-hour-of-week baseline
|
|
7
|
+
* ASC-2 Superposed Antivirus cache + pre-filter (10x+ speed)
|
|
8
|
+
* ASC-3 Conformal Apoptosis UNCERTAIN tier (100% auto-precision)
|
|
9
|
+
* ASC-4 Prophetic Embedder config-vs-Schroedinger-vs-meta drift
|
|
10
|
+
* ASC-5 Sovereign Mode distinguishes intentional offline
|
|
11
|
+
* ASC-6 Inbox Tier Filter alert vs routine separation
|
|
12
|
+
*/
|
|
13
|
+
export * as circadianHeartbeat from "./circadian_heartbeat.js";
|
|
14
|
+
export * as superposedAntivirus from "./superposed_antivirus.js";
|
|
15
|
+
export * as conformalApoptosis from "./conformal_apoptosis.js";
|
|
16
|
+
export * as propheticEmbedder from "./prophetic_embedder.js";
|
|
17
|
+
export * as sovereignMode from "./sovereign_mode.js";
|
|
18
|
+
export * as inboxTier from "./inbox_tier.js";
|
|
19
|
+
// Direct re-exports of common entry points.
|
|
20
|
+
export { analyzeCircadian, buildCircadianBaseline, detectCircadianAnomalies, bucketFor } from "./circadian_heartbeat.js";
|
|
21
|
+
export { superposedScan, readSuperposedStats, prefilterEmpty, clearMemCache } from "./superposed_antivirus.js";
|
|
22
|
+
export { conformalDetect, recordLabel, calibrate, readCalibration, runConformalBench } from "./conformal_apoptosis.js";
|
|
23
|
+
export { prophecy, prophecyHeadline } from "./prophetic_embedder.js";
|
|
24
|
+
export { classifyCloud, enableSovereign, disableSovereign, readSovereignState } from "./sovereign_mode.js";
|
|
25
|
+
export { tierBreakdown, classifyTier, autoArchiveRoutine } from "./inbox_tier.js";
|
|
26
|
+
import { analyzeCircadian } from "./circadian_heartbeat.js";
|
|
27
|
+
import { readSuperposedStats } from "./superposed_antivirus.js";
|
|
28
|
+
import { readCalibration } from "./conformal_apoptosis.js";
|
|
29
|
+
import { prophecy } from "./prophetic_embedder.js";
|
|
30
|
+
import { classifyCloud } from "./sovereign_mode.js";
|
|
31
|
+
import { tierBreakdown } from "./inbox_tier.js";
|
|
32
|
+
/** Aggregate ascension audit. */
|
|
33
|
+
export function ascensionAudit(repoRoot, opts) {
|
|
34
|
+
// ASC-1 circadian: ask whether any baseline exists at all.
|
|
35
|
+
const baselineFile = `${repoRoot}/.mneme/ascension/circadian-baseline.json`;
|
|
36
|
+
const { existsSync } = require("node:fs");
|
|
37
|
+
const circadianActive = existsSync(baselineFile);
|
|
38
|
+
let suppressed = 0;
|
|
39
|
+
if (circadianActive) {
|
|
40
|
+
// Best-effort: run analysis with empty fresh sample to read suppressed count from history.
|
|
41
|
+
try {
|
|
42
|
+
const { readBaseline } = require("./circadian_heartbeat.js");
|
|
43
|
+
const b = readBaseline(repoRoot);
|
|
44
|
+
if (b)
|
|
45
|
+
suppressed = analyzeCircadian([], []).suppressedVsSingleBaseline; // 0 with no samples; real number requires fresh
|
|
46
|
+
}
|
|
47
|
+
catch { /* */ }
|
|
48
|
+
}
|
|
49
|
+
// ASC-2 stats
|
|
50
|
+
const supStats = readSuperposedStats(repoRoot);
|
|
51
|
+
// ASC-3 calibration
|
|
52
|
+
const cal = readCalibration(repoRoot);
|
|
53
|
+
const conformal = {
|
|
54
|
+
calibrated: cal !== null,
|
|
55
|
+
effectivePrecision: cal?.effectivePrecision ?? 0,
|
|
56
|
+
coverage: cal?.coverage ?? 0,
|
|
57
|
+
};
|
|
58
|
+
// ASC-4 prophecy
|
|
59
|
+
const proph = prophecy(repoRoot);
|
|
60
|
+
// ASC-5 sovereign / cloud
|
|
61
|
+
const cloud = classifyCloud(repoRoot, opts?.cloudProbe ?? { probeReachable: null });
|
|
62
|
+
// ASC-6 inbox
|
|
63
|
+
const inbox = tierBreakdown(opts?.inboxMessages ?? []);
|
|
64
|
+
// Score: ~16-17 points per axis.
|
|
65
|
+
let score = 0;
|
|
66
|
+
const recs = [];
|
|
67
|
+
if (circadianActive)
|
|
68
|
+
score += 17;
|
|
69
|
+
else {
|
|
70
|
+
score += 6;
|
|
71
|
+
recs.push("Circadian heartbeat baseline not built yet -- run `buildCircadianBaseline` on past pulse history.");
|
|
72
|
+
}
|
|
73
|
+
if (supStats.cacheHitRate >= 0.3)
|
|
74
|
+
score += 17;
|
|
75
|
+
else if (supStats.totalCalls > 0)
|
|
76
|
+
score += 10;
|
|
77
|
+
else {
|
|
78
|
+
score += 5;
|
|
79
|
+
recs.push("Superposed antivirus has 0 calls -- wrap your scan path with `superposedScan` to enable caching.");
|
|
80
|
+
}
|
|
81
|
+
if (conformal.calibrated && conformal.effectivePrecision >= 0.99)
|
|
82
|
+
score += 17;
|
|
83
|
+
else if (conformal.calibrated)
|
|
84
|
+
score += 10;
|
|
85
|
+
else {
|
|
86
|
+
score += 8;
|
|
87
|
+
recs.push("Conformal apoptosis has no labels yet -- mark a few past verdicts via `recordLabel` to start calibration.");
|
|
88
|
+
}
|
|
89
|
+
if (proph.aligned)
|
|
90
|
+
score += 17;
|
|
91
|
+
else {
|
|
92
|
+
score += 6;
|
|
93
|
+
recs.push(`Embedder drift: ${proph.driftCause} Fix: ${proph.fixAction}`);
|
|
94
|
+
}
|
|
95
|
+
if (cloud.verdict === "ONLINE" || cloud.verdict === "SOVEREIGN")
|
|
96
|
+
score += 16;
|
|
97
|
+
else if (cloud.verdict === "DEGRADED")
|
|
98
|
+
score += 10;
|
|
99
|
+
else {
|
|
100
|
+
score += 4;
|
|
101
|
+
recs.push(`Cloud ${cloud.verdict}; ${cloud.headline}`);
|
|
102
|
+
}
|
|
103
|
+
if (inbox.alertUnsent === 0)
|
|
104
|
+
score += 16;
|
|
105
|
+
else if (inbox.alertUnsent <= 2)
|
|
106
|
+
score += 10;
|
|
107
|
+
else {
|
|
108
|
+
score += 4;
|
|
109
|
+
recs.push(`${inbox.alertUnsent} alert(s) unsent -- triage.`);
|
|
110
|
+
}
|
|
111
|
+
const headline = `Ascension score ${score}/100 across 6 axes.${recs.length === 0 ? " All clear." : ` ${recs.length} recommendation(s).`}`;
|
|
112
|
+
return {
|
|
113
|
+
score,
|
|
114
|
+
axes: {
|
|
115
|
+
ASC1_circadian: { active: circadianActive, suppressedFalseAlarms: suppressed },
|
|
116
|
+
ASC2_superposed: { totalCalls: supStats.totalCalls, cacheHitRate: supStats.cacheHitRate, meanMs: supStats.meanMs },
|
|
117
|
+
ASC3_conformal: conformal,
|
|
118
|
+
ASC4_prophetic: { aligned: proph.aligned, driftCause: proph.driftCause },
|
|
119
|
+
ASC5_sovereign: { verdict: cloud.verdict },
|
|
120
|
+
ASC6_inboxTier: { alert: inbox.alertUnsent, routine: inbox.routineUnsent },
|
|
121
|
+
},
|
|
122
|
+
headline,
|
|
123
|
+
recommendations: recs,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ascension/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,kBAAkB,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,mBAAmB,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,kBAAkB,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAE7C,4CAA4C;AAC5C,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACzH,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/G,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACvH,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAA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AAY,EAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE;YAClH,cAAc,EAAE,SAAS;YACzB,cAAc,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE;YACxE,cAAc,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;YAC1C,cAAc,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,aAAa,EAAE;SAC3E;QACD,QAAQ;QACR,eAAe,EAAE,IAAI;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.68.0 -- ASCENSION ASC-4: PROPHETIC EMBEDDER.
|
|
3
|
+
*
|
|
4
|
+
* Root-cause fix for the "config says ollama but pulse reports
|
|
5
|
+
* hash:fnv-256 fallback" bug. We compare THREE truth sources every
|
|
6
|
+
* pulse:
|
|
7
|
+
*
|
|
8
|
+
* 1. Config provider -- .mneme/config.json -> embeddings.provider
|
|
9
|
+
* 2. Schroedinger winner -- .mneme/embedder-status.json -> winner
|
|
10
|
+
* 3. Actual last-tier -- .mneme/store/meta.json -> embedder
|
|
11
|
+
*
|
|
12
|
+
* If they disagree -> DRIFT alarm with the specific cause + named
|
|
13
|
+
* fix step. Most-common drift = config got upgraded but indexer
|
|
14
|
+
* hasn't re-run yet, so meta.json still records the old tier.
|
|
15
|
+
*
|
|
16
|
+
* Pure-read; ALWAYS surfaces the right next-action.
|
|
17
|
+
*/
|
|
18
|
+
import { type MemoryTierName } from "../memory_tier.js";
|
|
19
|
+
export interface ProphecyReport {
|
|
20
|
+
/** What config says we WANT. */
|
|
21
|
+
configTier: MemoryTierName;
|
|
22
|
+
/** What Schroedinger says we CAN have. */
|
|
23
|
+
schroedingerWinner: MemoryTierName | null;
|
|
24
|
+
/** What the indexer last USED. */
|
|
25
|
+
lastIndexedTier: MemoryTierName | null;
|
|
26
|
+
/** Is the trio aligned? */
|
|
27
|
+
aligned: boolean;
|
|
28
|
+
/** Plain-English drift cause. */
|
|
29
|
+
driftCause: string | null;
|
|
30
|
+
/** Concrete fix action the AI agent should propose. */
|
|
31
|
+
fixAction: string | null;
|
|
32
|
+
/** ISO ts. */
|
|
33
|
+
builtAt: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function prophecy(repoRoot: string): ProphecyReport;
|
|
36
|
+
/** One-line pulse-friendly summary. */
|
|
37
|
+
export declare function prophecyHeadline(report: ProphecyReport): string;
|
|
38
|
+
//# sourceMappingURL=prophetic_embedder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prophetic_embedder.d.ts","sourceRoot":"","sources":["../../src/ascension/prophetic_embedder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EAAkC,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExF,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,UAAU,EAAE,cAAc,CAAC;IAC3B,0CAA0C;IAC1C,kBAAkB,EAAE,cAAc,GAAG,IAAI,CAAC;IAC1C,kCAAkC;IAClC,eAAe,EAAE,cAAc,GAAG,IAAI,CAAC;IACvC,2BAA2B;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,iCAAiC;IACjC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,uDAAuD;IACvD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAOD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAmDzD;AAED,uCAAuC;AACvC,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAK/D"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.68.0 -- ASCENSION ASC-4: PROPHETIC EMBEDDER.
|
|
3
|
+
*
|
|
4
|
+
* Root-cause fix for the "config says ollama but pulse reports
|
|
5
|
+
* hash:fnv-256 fallback" bug. We compare THREE truth sources every
|
|
6
|
+
* pulse:
|
|
7
|
+
*
|
|
8
|
+
* 1. Config provider -- .mneme/config.json -> embeddings.provider
|
|
9
|
+
* 2. Schroedinger winner -- .mneme/embedder-status.json -> winner
|
|
10
|
+
* 3. Actual last-tier -- .mneme/store/meta.json -> embedder
|
|
11
|
+
*
|
|
12
|
+
* If they disagree -> DRIFT alarm with the specific cause + named
|
|
13
|
+
* fix step. Most-common drift = config got upgraded but indexer
|
|
14
|
+
* hasn't re-run yet, so meta.json still records the old tier.
|
|
15
|
+
*
|
|
16
|
+
* Pure-read; ALWAYS surfaces the right next-action.
|
|
17
|
+
*/
|
|
18
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
import { classifyEmbedderName, tierInfo } from "../memory_tier.js";
|
|
21
|
+
function readJson(path) {
|
|
22
|
+
if (!existsSync(path))
|
|
23
|
+
return null;
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function prophecy(repoRoot) {
|
|
32
|
+
const builtAt = new Date().toISOString();
|
|
33
|
+
// Source 1: config
|
|
34
|
+
const cfg = readJson(join(repoRoot, ".mneme/config.json"));
|
|
35
|
+
const configProvider = cfg?.embeddings?.provider ?? "unknown";
|
|
36
|
+
const configTier = classifyEmbedderName(configProvider);
|
|
37
|
+
// Source 2: Schroedinger winner (from autarchy A2)
|
|
38
|
+
const schroedinger = readJson(join(repoRoot, ".mneme/embedder-status.json"));
|
|
39
|
+
const schroedingerWinner = schroedinger?.winner
|
|
40
|
+
? classifyEmbedderName(schroedinger.winner)
|
|
41
|
+
: null;
|
|
42
|
+
// Source 3: indexer's last record
|
|
43
|
+
const meta = readJson(join(repoRoot, ".mneme/store/meta.json"));
|
|
44
|
+
const lastIndexedTier = meta?.embedder
|
|
45
|
+
? classifyEmbedderName(meta.embedder)
|
|
46
|
+
: null;
|
|
47
|
+
// Alignment check.
|
|
48
|
+
const tiers = [configTier, schroedingerWinner, lastIndexedTier].filter((t) => t !== null);
|
|
49
|
+
const distinct = new Set(tiers);
|
|
50
|
+
const aligned = distinct.size <= 1;
|
|
51
|
+
let driftCause = null;
|
|
52
|
+
let fixAction = null;
|
|
53
|
+
if (!aligned) {
|
|
54
|
+
// Diagnose the drift.
|
|
55
|
+
if (lastIndexedTier && configTier !== lastIndexedTier) {
|
|
56
|
+
driftCause = `Config says ${tierInfo(configTier).display}, but the indexer last used ${tierInfo(lastIndexedTier).display}.`;
|
|
57
|
+
fixAction = `Run \`mneme index --force\` to rebuild the store with the configured embedder.`;
|
|
58
|
+
}
|
|
59
|
+
else if (schroedingerWinner && configTier !== schroedingerWinner) {
|
|
60
|
+
driftCause = `Config selects ${tierInfo(configTier).display}, but Schroedinger probe found ${tierInfo(schroedingerWinner).display} as best available.`;
|
|
61
|
+
fixAction = `Run \`mneme.embedder.autodiagnose persist=true\` to upgrade config to the Schroedinger winner.`;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
driftCause = `Sources mismatch: config=${tierInfo(configTier).name}, schroedinger=${schroedingerWinner ?? "(none)"}, lastIndexed=${lastIndexedTier ?? "(none)"}.`;
|
|
65
|
+
fixAction = `Run \`mneme.autarchy.status install=true\` to re-probe + re-align all three sources.`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
configTier,
|
|
70
|
+
schroedingerWinner,
|
|
71
|
+
lastIndexedTier,
|
|
72
|
+
aligned,
|
|
73
|
+
driftCause,
|
|
74
|
+
fixAction,
|
|
75
|
+
builtAt,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** One-line pulse-friendly summary. */
|
|
79
|
+
export function prophecyHeadline(report) {
|
|
80
|
+
if (report.aligned) {
|
|
81
|
+
return `Embedder aligned (${tierInfo(report.configTier).display}).`;
|
|
82
|
+
}
|
|
83
|
+
return `Embedder DRIFT: ${report.driftCause} Fix: ${report.fixAction}`;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=prophetic_embedder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prophetic_embedder.js","sourceRoot":"","sources":["../../src/ascension/prophetic_embedder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAuB,MAAM,mBAAmB,CAAC;AAmBxF,SAAS,QAAQ,CAAI,IAAY;IAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,CAAC;QAAC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAM,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,QAAgB;IACvC,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAEzC,mBAAmB;IACnB,MAAM,GAAG,GAAG,QAAQ,CAAyC,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC;IACnG,MAAM,cAAc,GAAG,GAAG,EAAE,UAAU,EAAE,QAAQ,IAAI,SAAS,CAAC;IAC9D,MAAM,UAAU,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAExD,mDAAmD;IACnD,MAAM,YAAY,GAAG,QAAQ,CA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AAqB,CAAC;YACvJ,SAAS,GAAG,gGAAgG,CAAC;QAC/G,CAAC;aAAM,CAAC;YACN,UAAU,GAAG,4BAA4B,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,kBAAkB,kBAAkB,IAAI,QAAQ,iBAAiB,eAAe,IAAI,QAAQ,GAAG,CAAC;YAClK,SAAS,GAAG,sFAAsF,CAAC;QACrG,CAAC;IACH,CAAC;IAED,OAAO;QACL,UAAU;QACV,kBAAkB;QAClB,eAAe;QACf,OAAO;QACP,UAAU;QACV,SAAS;QACT,OAAO;KACR,CAAC;AACJ,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,gBAAgB,CAAC,MAAsB;IACrD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,qBAAqB,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,IAAI,CAAC;IACtE,CAAC;IACD,OAAO,mBAAmB,MAAM,CAAC,UAAU,SAAS,MAAM,CAAC,SAAS,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.68.0 -- ASCENSION ASC-5: SOVEREIGN MODE.
|
|
3
|
+
*
|
|
4
|
+
* Distinguishes BROKEN-OFFLINE from BY-DESIGN-OFFLINE for the cloud
|
|
5
|
+
* probe. When the user has intentionally turned off the cloud
|
|
6
|
+
* (e.g. destroyed DO droplet, set MNEME_SOVEREIGN=1), the pulse
|
|
7
|
+
* should label this SOVEREIGN MODE, not "cloud unreachable error".
|
|
8
|
+
*
|
|
9
|
+
* State sources (any one triggers SOVEREIGN):
|
|
10
|
+
* - env MNEME_SOVEREIGN=1
|
|
11
|
+
* - .mneme/sovereign-mode.json -> { enabled: true, reason: "..." }
|
|
12
|
+
*
|
|
13
|
+
* Verdicts:
|
|
14
|
+
* SOVEREIGN intentional offline (no cloud needed)
|
|
15
|
+
* ONLINE cloud reachable
|
|
16
|
+
* DEGRADED cloud reachable but slow / partial
|
|
17
|
+
* OFFLINE cloud SHOULD be reachable but isn't (broken)
|
|
18
|
+
* UNKNOWN not probed yet
|
|
19
|
+
*/
|
|
20
|
+
export type SovereignVerdict = "SOVEREIGN" | "ONLINE" | "DEGRADED" | "OFFLINE" | "UNKNOWN";
|
|
21
|
+
export interface SovereignState {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
reason: string;
|
|
24
|
+
enabledAt: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SovereignReport {
|
|
27
|
+
verdict: SovereignVerdict;
|
|
28
|
+
enabledByUser: boolean;
|
|
29
|
+
reason: string | null;
|
|
30
|
+
/** Plain-English headline; safe to surface in pulse. */
|
|
31
|
+
headline: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function readSovereignState(repoRoot: string): SovereignState | null;
|
|
34
|
+
/** Enable sovereign mode -- intentional offline. */
|
|
35
|
+
export declare function enableSovereign(repoRoot: string, reason: string): SovereignState;
|
|
36
|
+
/** Disable sovereign mode (allow cloud probes to label OFFLINE again). */
|
|
37
|
+
export declare function disableSovereign(repoRoot: string): void;
|
|
38
|
+
export interface CloudProbeInput {
|
|
39
|
+
/** Did the upstream probe complete successfully? */
|
|
40
|
+
probeReachable: boolean | null;
|
|
41
|
+
/** Round-trip latency in ms (when reachable). */
|
|
42
|
+
rttMs?: number | null;
|
|
43
|
+
}
|
|
44
|
+
/** Classify the cloud state into a SOVEREIGN-aware verdict. */
|
|
45
|
+
export declare function classifyCloud(repoRoot: string, probe: CloudProbeInput): SovereignReport;
|
|
46
|
+
//# sourceMappingURL=sovereign_mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sovereign_mode.d.ts","sourceRoot":"","sources":["../../src/ascension/sovereign_mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAQH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAE3F,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAMD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAI1E;AAOD,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAUhF;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAQvD;AAED,MAAM,WAAW,eAAe;IAC9B,oDAAoD;IACpD,cAAc,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,eAAe,CA0BvF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.68.0 -- ASCENSION ASC-5: SOVEREIGN MODE.
|
|
3
|
+
*
|
|
4
|
+
* Distinguishes BROKEN-OFFLINE from BY-DESIGN-OFFLINE for the cloud
|
|
5
|
+
* probe. When the user has intentionally turned off the cloud
|
|
6
|
+
* (e.g. destroyed DO droplet, set MNEME_SOVEREIGN=1), the pulse
|
|
7
|
+
* should label this SOVEREIGN MODE, not "cloud unreachable error".
|
|
8
|
+
*
|
|
9
|
+
* State sources (any one triggers SOVEREIGN):
|
|
10
|
+
* - env MNEME_SOVEREIGN=1
|
|
11
|
+
* - .mneme/sovereign-mode.json -> { enabled: true, reason: "..." }
|
|
12
|
+
*
|
|
13
|
+
* Verdicts:
|
|
14
|
+
* SOVEREIGN intentional offline (no cloud needed)
|
|
15
|
+
* ONLINE cloud reachable
|
|
16
|
+
* DEGRADED cloud reachable but slow / partial
|
|
17
|
+
* OFFLINE cloud SHOULD be reachable but isn't (broken)
|
|
18
|
+
* UNKNOWN not probed yet
|
|
19
|
+
*/
|
|
20
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
const ASC_DIR = ".mneme/ascension";
|
|
23
|
+
const STATE_FILE = ".mneme/sovereign-mode.json";
|
|
24
|
+
function statePath(repoRoot) {
|
|
25
|
+
return join(repoRoot, STATE_FILE);
|
|
26
|
+
}
|
|
27
|
+
export function readSovereignState(repoRoot) {
|
|
28
|
+
const p = statePath(repoRoot);
|
|
29
|
+
if (!existsSync(p))
|
|
30
|
+
return null;
|
|
31
|
+
try {
|
|
32
|
+
return JSON.parse(readFileSync(p, "utf8"));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function envSovereign() {
|
|
39
|
+
const v = process.env["MNEME_SOVEREIGN"];
|
|
40
|
+
return v === "1" || v === "true" || v === "yes";
|
|
41
|
+
}
|
|
42
|
+
/** Enable sovereign mode -- intentional offline. */
|
|
43
|
+
export function enableSovereign(repoRoot, reason) {
|
|
44
|
+
const state = {
|
|
45
|
+
enabled: true,
|
|
46
|
+
reason,
|
|
47
|
+
enabledAt: new Date().toISOString(),
|
|
48
|
+
};
|
|
49
|
+
const dir = join(repoRoot, ".mneme");
|
|
50
|
+
if (!existsSync(dir))
|
|
51
|
+
mkdirSync(dir, { recursive: true });
|
|
52
|
+
writeFileSync(statePath(repoRoot), JSON.stringify(state, null, 2) + "\n", "utf8");
|
|
53
|
+
return state;
|
|
54
|
+
}
|
|
55
|
+
/** Disable sovereign mode (allow cloud probes to label OFFLINE again). */
|
|
56
|
+
export function disableSovereign(repoRoot) {
|
|
57
|
+
const p = statePath(repoRoot);
|
|
58
|
+
if (existsSync(p)) {
|
|
59
|
+
try {
|
|
60
|
+
const s = readSovereignState(repoRoot);
|
|
61
|
+
if (s)
|
|
62
|
+
writeFileSync(p, JSON.stringify({ ...s, enabled: false }, null, 2) + "\n", "utf8");
|
|
63
|
+
}
|
|
64
|
+
catch { /* */ }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** Classify the cloud state into a SOVEREIGN-aware verdict. */
|
|
68
|
+
export function classifyCloud(repoRoot, probe) {
|
|
69
|
+
const persisted = readSovereignState(repoRoot);
|
|
70
|
+
const enabledByUser = envSovereign() || (persisted?.enabled === true);
|
|
71
|
+
const reason = enabledByUser ? (process.env["MNEME_SOVEREIGN"] ? "env MNEME_SOVEREIGN=1" : (persisted?.reason ?? "user opted-in")) : null;
|
|
72
|
+
// Sovereign mode short-circuits any "OFFLINE" alarm.
|
|
73
|
+
if (enabledByUser) {
|
|
74
|
+
return {
|
|
75
|
+
verdict: "SOVEREIGN",
|
|
76
|
+
enabledByUser: true,
|
|
77
|
+
reason,
|
|
78
|
+
headline: `Cloud SOVEREIGN MODE (${reason ?? "intentional offline"}). Local-first; no degradation.`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (probe.probeReachable === null) {
|
|
82
|
+
return { verdict: "UNKNOWN", enabledByUser: false, reason: null, headline: "Cloud probe not run yet." };
|
|
83
|
+
}
|
|
84
|
+
if (probe.probeReachable === false) {
|
|
85
|
+
return { verdict: "OFFLINE", enabledByUser: false, reason: null, headline: "Cloud OFFLINE -- upstream unreachable. Consider enabling SOVEREIGN MODE if intentional." };
|
|
86
|
+
}
|
|
87
|
+
// Reachable; classify by latency.
|
|
88
|
+
const rtt = probe.rttMs ?? 0;
|
|
89
|
+
if (rtt >= 2000) {
|
|
90
|
+
return { verdict: "DEGRADED", enabledByUser: false, reason: null, headline: `Cloud DEGRADED -- RTT ${rtt}ms (slow).` };
|
|
91
|
+
}
|
|
92
|
+
return { verdict: "ONLINE", enabledByUser: false, reason: null, headline: `Cloud ONLINE${rtt > 0 ? ` (RTT ${rtt}ms)` : ""}.` };
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=sovereign_mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sovereign_mode.js","sourceRoot":"","sources":["../../src/ascension/sovereign_mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,OAAO,GAAG,kBAAkB,CAAC;AACnC,MAAM,UAAU,GAAG,4BAA4B,CAAC;AAkBhD,SAAS,SAAS,CAAC,QAAgB;IACjC,OAAO,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC9B,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,CAAC;QAAC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAmB,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;AAC9F,CAAC;AAED,SAAS,YAAY;IACnB,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACzC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,KAAK,CAAC;AAClD,CAAC;AAED,oDAAoD;AACpD,MAAM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AAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;AACjI,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.68.0 -- ASCENSION ASC-2: SUPERPOSED ANTIVIRUS.
|
|
3
|
+
*
|
|
4
|
+
* Three wild ideas compound to push antivirus scan time from ~800ms
|
|
5
|
+
* toward <100ms on repeat workloads:
|
|
6
|
+
*
|
|
7
|
+
* 1. CONTENT-HASH CACHE -- sha256(draft) -> previous scan result.
|
|
8
|
+
* Identical drafts return instantly. Critical for AI workflows
|
|
9
|
+
* where the same prompt fans out across multiple tools.
|
|
10
|
+
*
|
|
11
|
+
* 2. PRE-FILTER BLOOM -- a literal-substring "smoke detector" that
|
|
12
|
+
* fires only when known suspect patterns are likely present
|
|
13
|
+
* (commit-hash shape / sha-like / path-like). When the pre-filter
|
|
14
|
+
* passes empty, the full regex pass is SKIPPED. Most drafts
|
|
15
|
+
* hit this happy-path (under 5ms).
|
|
16
|
+
*
|
|
17
|
+
* 3. STRAIN MULTIPLEX -- for drafts that DO trigger the pre-filter,
|
|
18
|
+
* run all strain regexes in one batch with shared lastIndex
|
|
19
|
+
* bookkeeping. Reduces overhead of N independent re.exec loops.
|
|
20
|
+
*
|
|
21
|
+
* Pure wrapper; never modifies the underlying scan logic. Plugs into
|
|
22
|
+
* any caller that wants the cached + fast-path semantics.
|
|
23
|
+
*/
|
|
24
|
+
export interface SuperposedResult<T> {
|
|
25
|
+
/** The cached or freshly-computed result. */
|
|
26
|
+
result: T;
|
|
27
|
+
/** How the result was obtained. */
|
|
28
|
+
source: "cache-hit" | "prefilter-skip" | "fresh-scan";
|
|
29
|
+
/** Time spent, ms. */
|
|
30
|
+
ms: number;
|
|
31
|
+
/** Content hash key (for instrumentation). */
|
|
32
|
+
contentHash: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SuperposedScanStats {
|
|
35
|
+
totalCalls: number;
|
|
36
|
+
cacheHits: number;
|
|
37
|
+
prefilterSkips: number;
|
|
38
|
+
freshScans: number;
|
|
39
|
+
cacheHitRate: number;
|
|
40
|
+
meanMs: number;
|
|
41
|
+
meanMsCold: number;
|
|
42
|
+
meanMsCached: number;
|
|
43
|
+
meanMsPrefilter: number;
|
|
44
|
+
}
|
|
45
|
+
/** Is the pre-filter happy-path: no known suspect fragments in the draft? */
|
|
46
|
+
export declare function prefilterEmpty(draft: string): boolean;
|
|
47
|
+
export interface SuperposedOptions<T> {
|
|
48
|
+
/** The slow underlying scan function. */
|
|
49
|
+
fullScan: (draft: string) => Promise<T> | T;
|
|
50
|
+
/** What to return for the prefilter-empty fast path (typically an empty suspects array). */
|
|
51
|
+
emptyResult: T;
|
|
52
|
+
/** Persist cache + stats to disk. Default true. */
|
|
53
|
+
persist?: boolean;
|
|
54
|
+
/** Bypass cache (force fresh scan). Default false. */
|
|
55
|
+
bypassCache?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/** Run a scan with the three-tier acceleration: cache hit, pre-filter
|
|
58
|
+
* skip, or fresh full scan. Always reports the source + latency. */
|
|
59
|
+
export declare function superposedScan<T>(repoRoot: string, draft: string, opts: SuperposedOptions<T>): Promise<SuperposedResult<T>>;
|
|
60
|
+
export declare function readSuperposedStats(repoRoot: string): SuperposedScanStats;
|
|
61
|
+
export declare function clearMemCache(): void;
|
|
62
|
+
//# sourceMappingURL=superposed_antivirus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"superposed_antivirus.d.ts","sourceRoot":"","sources":["../../src/ascension/superposed_antivirus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA4BH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,6CAA6C;IAC7C,MAAM,EAAE,CAAC,CAAC;IACV,mCAAmC;IACnC,MAAM,EAAE,WAAW,GAAG,gBAAgB,GAAG,YAAY,CAAC;IACtD,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9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