@mneme-ai/core 2.102.0 → 2.103.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 +2 -0
- package/dist/agent_manifest.js.map +1 -1
- package/dist/branch_oracle/branch_oracle.test.d.ts +2 -0
- package/dist/branch_oracle/branch_oracle.test.d.ts.map +1 -0
- package/dist/branch_oracle/branch_oracle.test.js +52 -0
- package/dist/branch_oracle/branch_oracle.test.js.map +1 -0
- package/dist/branch_oracle/index.d.ts +82 -0
- package/dist/branch_oracle/index.d.ts.map +1 -0
- package/dist/branch_oracle/index.js +113 -0
- package/dist/branch_oracle/index.js.map +1 -0
- package/dist/cognitive_gate/cognitive_gate.test.d.ts +2 -0
- package/dist/cognitive_gate/cognitive_gate.test.d.ts.map +1 -0
- package/dist/cognitive_gate/cognitive_gate.test.js +71 -0
- package/dist/cognitive_gate/cognitive_gate.test.js.map +1 -0
- package/dist/cognitive_gate/index.d.ts +83 -0
- package/dist/cognitive_gate/index.d.ts.map +1 -0
- package/dist/cognitive_gate/index.js +172 -0
- package/dist/cognitive_gate/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/truth_gate/probes.d.ts.map +1 -1
- package/dist/truth_gate/probes.js +44 -0
- package/dist/truth_gate/probes.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.103.0 — BRANCH ORACLE (multi-branch real-signal analysis).
|
|
3
|
+
*
|
|
4
|
+
* The image's "Multi-Timeline Reasoning" — made HONEST. We do NOT predict
|
|
5
|
+
* the future ("this branch WILL fix the bug" is unfalsifiable fortune-
|
|
6
|
+
* telling). We compute, per branch, DETERMINISTIC signals from the real
|
|
7
|
+
* git state right now, and emit a signed snapshot:
|
|
8
|
+
*
|
|
9
|
+
* - conflict overlap : files this branch changed that the base ALSO
|
|
10
|
+
* changed since the fork → a real, measurable merge-conflict-likelihood
|
|
11
|
+
* signal (not a prophecy).
|
|
12
|
+
* - decay touched : how many of the branch's changed files are stale
|
|
13
|
+
* per the atrophy clock (touching cold code).
|
|
14
|
+
* - divergence : commits ahead/behind the base.
|
|
15
|
+
* - staleness : how old the branch's last commit is.
|
|
16
|
+
*
|
|
17
|
+
* Each branch gets a band (healthy / caution / risky) computed purely from
|
|
18
|
+
* those signals — a present-tense health read, Ed25519-signed so any agent
|
|
19
|
+
* verifies it offline. Same git state → same bands (reproducible). The CLI
|
|
20
|
+
* gathers the git facts; this core stays pure + total (108-error rule):
|
|
21
|
+
* garbage in → the safest, smallest snapshot, never a throw.
|
|
22
|
+
*/
|
|
23
|
+
import { type NotaryReceipt } from "../notary/receipt.js";
|
|
24
|
+
export interface BranchInput {
|
|
25
|
+
name: string;
|
|
26
|
+
ahead: number;
|
|
27
|
+
behind: number;
|
|
28
|
+
/** files this branch changed since the merge-base. */
|
|
29
|
+
changedFiles: string[];
|
|
30
|
+
/** files the base changed since the merge-base (for overlap). */
|
|
31
|
+
baseChangedFiles: string[];
|
|
32
|
+
/** number of this branch's changed files that are stale (atrophy). */
|
|
33
|
+
staleFiles?: number;
|
|
34
|
+
/** age of the branch's last commit, in days. */
|
|
35
|
+
ageDays?: number;
|
|
36
|
+
}
|
|
37
|
+
export type Band = "healthy" | "caution" | "risky";
|
|
38
|
+
export interface BranchSignal {
|
|
39
|
+
name: string;
|
|
40
|
+
ahead: number;
|
|
41
|
+
behind: number;
|
|
42
|
+
/** count of files changed on BOTH this branch and the base since fork. */
|
|
43
|
+
conflictOverlap: number;
|
|
44
|
+
conflictRisk: "low" | "medium" | "high";
|
|
45
|
+
decayTouched: number;
|
|
46
|
+
staleness: "fresh" | "aging" | "stale";
|
|
47
|
+
band: Band;
|
|
48
|
+
reasons: string[];
|
|
49
|
+
}
|
|
50
|
+
/** Compute the deterministic signals for one branch. Total; never throws. */
|
|
51
|
+
export declare function analyzeBranch(b: BranchInput): BranchSignal;
|
|
52
|
+
export interface BranchReport {
|
|
53
|
+
signals: BranchSignal[];
|
|
54
|
+
summary: {
|
|
55
|
+
branches: number;
|
|
56
|
+
healthy: number;
|
|
57
|
+
caution: number;
|
|
58
|
+
risky: number;
|
|
59
|
+
safestBranch: string | null;
|
|
60
|
+
};
|
|
61
|
+
receipt: NotaryReceipt;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Analyze every branch + emit a signed snapshot. `safestBranch` is just the
|
|
65
|
+
* lowest-risk branch by signals — a ranked read, never a claim about the
|
|
66
|
+
* future. Total.
|
|
67
|
+
*/
|
|
68
|
+
export declare function analyzeBranches(repoRoot: string, branches: BranchInput[], at: number): BranchReport;
|
|
69
|
+
export interface BranchOracleGauntlet {
|
|
70
|
+
/** conflict risk is monotonic in overlap (more shared files ⇒ ≥ risk). */
|
|
71
|
+
monotonicConflict: boolean;
|
|
72
|
+
/** the snapshot is deterministic (same input ⇒ same bands). */
|
|
73
|
+
deterministic: boolean;
|
|
74
|
+
/** signed report verifies. */
|
|
75
|
+
signed: boolean;
|
|
76
|
+
/** total on garbage. */
|
|
77
|
+
stable: boolean;
|
|
78
|
+
score: number;
|
|
79
|
+
}
|
|
80
|
+
/** Prove the oracle's invariants. Total. */
|
|
81
|
+
export declare function branchOracleGauntlet(repoRoot: string, at: number): BranchOracleGauntlet;
|
|
82
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/branch_oracle/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAA+B,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEvF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM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OAAO,CAAC;IAC3B,+DAA+D;IAC/D,aAAa,EAAE,OAAO,CAAC;IACvB,8BAA8B;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,wBAAwB;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,4CAA4C;AAC5C,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,oBAAoB,CAiBvF"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.103.0 — BRANCH ORACLE (multi-branch real-signal analysis).
|
|
3
|
+
*
|
|
4
|
+
* The image's "Multi-Timeline Reasoning" — made HONEST. We do NOT predict
|
|
5
|
+
* the future ("this branch WILL fix the bug" is unfalsifiable fortune-
|
|
6
|
+
* telling). We compute, per branch, DETERMINISTIC signals from the real
|
|
7
|
+
* git state right now, and emit a signed snapshot:
|
|
8
|
+
*
|
|
9
|
+
* - conflict overlap : files this branch changed that the base ALSO
|
|
10
|
+
* changed since the fork → a real, measurable merge-conflict-likelihood
|
|
11
|
+
* signal (not a prophecy).
|
|
12
|
+
* - decay touched : how many of the branch's changed files are stale
|
|
13
|
+
* per the atrophy clock (touching cold code).
|
|
14
|
+
* - divergence : commits ahead/behind the base.
|
|
15
|
+
* - staleness : how old the branch's last commit is.
|
|
16
|
+
*
|
|
17
|
+
* Each branch gets a band (healthy / caution / risky) computed purely from
|
|
18
|
+
* those signals — a present-tense health read, Ed25519-signed so any agent
|
|
19
|
+
* verifies it offline. Same git state → same bands (reproducible). The CLI
|
|
20
|
+
* gathers the git facts; this core stays pure + total (108-error rule):
|
|
21
|
+
* garbage in → the safest, smallest snapshot, never a throw.
|
|
22
|
+
*/
|
|
23
|
+
import { issueReceipt, verifyReceipt } from "../notary/receipt.js";
|
|
24
|
+
function n(x, d = 0) { return typeof x === "number" && Number.isFinite(x) ? x : d; }
|
|
25
|
+
function arr(x) { return Array.isArray(x) ? x.filter((s) => typeof s === "string") : []; }
|
|
26
|
+
/** Compute the deterministic signals for one branch. Total; never throws. */
|
|
27
|
+
export function analyzeBranch(b) {
|
|
28
|
+
const name = String(b?.name ?? "?");
|
|
29
|
+
const ahead = n(b?.ahead), behind = n(b?.behind);
|
|
30
|
+
const changed = new Set(arr(b?.changedFiles));
|
|
31
|
+
const baseChanged = arr(b?.baseChangedFiles);
|
|
32
|
+
let overlap = 0;
|
|
33
|
+
for (const f of baseChanged)
|
|
34
|
+
if (changed.has(f))
|
|
35
|
+
overlap++;
|
|
36
|
+
const conflictRisk = overlap === 0 ? "low" : overlap <= 2 ? "medium" : "high";
|
|
37
|
+
const decayTouched = n(b?.staleFiles);
|
|
38
|
+
const ageDays = n(b?.ageDays);
|
|
39
|
+
const staleness = ageDays <= 7 ? "fresh" : ageDays <= 30 ? "aging" : "stale";
|
|
40
|
+
const reasons = [];
|
|
41
|
+
if (overlap > 0)
|
|
42
|
+
reasons.push(`${overlap} file(s) also changed on base since fork → merge-conflict risk ${conflictRisk}`);
|
|
43
|
+
if (behind > 0)
|
|
44
|
+
reasons.push(`${behind} commit(s) behind base — rebase recommended`);
|
|
45
|
+
if (decayTouched > 0)
|
|
46
|
+
reasons.push(`${decayTouched} touched file(s) are stale (cold code)`);
|
|
47
|
+
if (staleness === "stale")
|
|
48
|
+
reasons.push(`branch last touched ${ageDays}d ago`);
|
|
49
|
+
if (reasons.length === 0)
|
|
50
|
+
reasons.push("no elevated signals — clean divergence");
|
|
51
|
+
// Composite band from real signals (NOT a prediction).
|
|
52
|
+
let band = "healthy";
|
|
53
|
+
if (conflictRisk === "high" || (staleness === "stale" && behind > 0))
|
|
54
|
+
band = "risky";
|
|
55
|
+
else if (conflictRisk === "medium" || behind > 0 || decayTouched > 0 || staleness !== "fresh")
|
|
56
|
+
band = "caution";
|
|
57
|
+
return { name, ahead, behind, conflictOverlap: overlap, conflictRisk, decayTouched, staleness, band, reasons };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Analyze every branch + emit a signed snapshot. `safestBranch` is just the
|
|
61
|
+
* lowest-risk branch by signals — a ranked read, never a claim about the
|
|
62
|
+
* future. Total.
|
|
63
|
+
*/
|
|
64
|
+
export function analyzeBranches(repoRoot, branches, at) {
|
|
65
|
+
const list = Array.isArray(branches) ? branches : [];
|
|
66
|
+
const signals = list.map(analyzeBranch);
|
|
67
|
+
const rank = { healthy: 0, caution: 1, risky: 2 };
|
|
68
|
+
const sorted = [...signals].sort((a, b) => rank[a.band] - rank[b.band] || a.conflictOverlap - b.conflictOverlap || a.behind - b.behind);
|
|
69
|
+
const summary = {
|
|
70
|
+
branches: signals.length,
|
|
71
|
+
healthy: signals.filter((s) => s.band === "healthy").length,
|
|
72
|
+
caution: signals.filter((s) => s.band === "caution").length,
|
|
73
|
+
risky: signals.filter((s) => s.band === "risky").length,
|
|
74
|
+
safestBranch: sorted[0]?.name ?? null,
|
|
75
|
+
};
|
|
76
|
+
const receipt = issueReceipt(repoRoot, {
|
|
77
|
+
kind: "reasoning-trace",
|
|
78
|
+
subject: `branch-oracle:${summary.branches}`,
|
|
79
|
+
payload: { summary, bands: signals.map((s) => ({ name: s.name, band: s.band, conflictRisk: s.conflictRisk })) },
|
|
80
|
+
includePayload: true,
|
|
81
|
+
issuedAt: at,
|
|
82
|
+
});
|
|
83
|
+
return { signals, summary, receipt };
|
|
84
|
+
}
|
|
85
|
+
/** Prove the oracle's invariants. Total. */
|
|
86
|
+
export function branchOracleGauntlet(repoRoot, at) {
|
|
87
|
+
try {
|
|
88
|
+
const mk = (overlap) => ({ name: `b${overlap}`, ahead: 1, behind: 0, changedFiles: ["a", "b", "c", "d"], baseChangedFiles: ["a", "b", "c", "d"].slice(0, overlap), ageDays: 1 });
|
|
89
|
+
const low = analyzeBranch(mk(0)).conflictRisk;
|
|
90
|
+
const med = analyzeBranch(mk(2)).conflictRisk;
|
|
91
|
+
const high = analyzeBranch(mk(4)).conflictRisk;
|
|
92
|
+
const order = { low: 0, medium: 1, high: 2 };
|
|
93
|
+
const monotonicConflict = order[low] <= order[med] && order[med] <= order[high];
|
|
94
|
+
const r1 = analyzeBranches(repoRoot, [mk(2), mk(4)], at);
|
|
95
|
+
const r2 = analyzeBranches(repoRoot, [mk(2), mk(4)], at);
|
|
96
|
+
const deterministic = JSON.stringify(r1.signals) === JSON.stringify(r2.signals);
|
|
97
|
+
const signed = verifyReceipt(r1.receipt).valid;
|
|
98
|
+
let stable = true;
|
|
99
|
+
try {
|
|
100
|
+
analyzeBranch(null);
|
|
101
|
+
analyzeBranches(repoRoot, null, at);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
stable = false;
|
|
105
|
+
}
|
|
106
|
+
const perfect = monotonicConflict && deterministic && signed && stable;
|
|
107
|
+
return { monotonicConflict, deterministic, signed, stable, score: perfect ? 100 : 0 };
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return { monotonicConflict: false, deterministic: false, signed: false, stable: false, score: 0 };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/branch_oracle/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAsB,MAAM,sBAAsB,CAAC;AA+BvF,SAAS,CAAC,CAAC,CAAU,EAAE,CAAC,GAAG,CAAC,IAAY,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrG,SAAS,GAAG,CAAC,CAAU,IAAc,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OA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E,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACzD,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;QAChF,MAAM,MAAM,GAAG,aAAa,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;QAC/C,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC;YAAC,aAAa,CAAC,IAAa,CAAC,CAAC;YAAC,eAAe,CAAC,QAAQ,EAAE,IAAa,EAAE,EAAE,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,MAAM,GAAG,KAAK,CAAC;QAAC,CAAC;QAC7G,MAAM,OAAO,GAAG,iBAAiB,IAAI,aAAa,IAAI,MAAM,IAAI,MAAM,CAAC;QACvE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxF,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,CAAC;AAChH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitive_gate.test.d.ts","sourceRoot":"","sources":["../../src/cognitive_gate/cognitive_gate.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { buildCognitiveSignature, judgeDiff, measureSeparability, wisdomGate, cognitiveGauntlet } from "./index.js";
|
|
3
|
+
// Author style: 2-space indent, single quotes, arrow fns, const, no semicolons-before-paren.
|
|
4
|
+
const A = (i) => `diff --git a/f${i}.ts b/f${i}.ts
|
|
5
|
+
+const x${i} = () => {
|
|
6
|
+
+ const y = 'hello'
|
|
7
|
+
+ return y.length
|
|
8
|
+
+}`;
|
|
9
|
+
// Foreign style: 4-space indent (tabs), double quotes, function keyword, var.
|
|
10
|
+
const FOREIGN = `diff --git a/g.ts b/g.ts
|
|
11
|
+
+function bigThing(input) {
|
|
12
|
+
+\tvar result = "WAITING";
|
|
13
|
+
+\tif (input == null) { return "NOPE"; }
|
|
14
|
+
+\treturn result;
|
|
15
|
+
+}`;
|
|
16
|
+
const authorDiffs = [A(1), A(2), A(3), A(4)];
|
|
17
|
+
const authorHeldout = A(5);
|
|
18
|
+
describe("v2.103 COGNITIVE WISDOM GATE (NEMESIS × HYDRA)", () => {
|
|
19
|
+
it("builds a signature with intra-author spread from ≥3 samples", () => {
|
|
20
|
+
const sig = buildCognitiveSignature("shinn", authorDiffs);
|
|
21
|
+
expect(sig.sampleCount).toBe(4);
|
|
22
|
+
expect(sig.intraVariance).toBeGreaterThanOrEqual(0);
|
|
23
|
+
expect(Object.keys(sig.baseline.features).length).toBeGreaterThan(0);
|
|
24
|
+
});
|
|
25
|
+
it("UNKNOWN when the signature is too thin (< 3 samples)", () => {
|
|
26
|
+
const sig = buildCognitiveSignature("x", [A(1)]);
|
|
27
|
+
expect(judgeDiff(sig, A(2)).verdict).toBe("UNKNOWN");
|
|
28
|
+
});
|
|
29
|
+
it("allows the author's own held-out style; flags a clearly-foreign style", () => {
|
|
30
|
+
const sig = buildCognitiveSignature("shinn", authorDiffs);
|
|
31
|
+
const own = judgeDiff(sig, authorHeldout);
|
|
32
|
+
const foreign = judgeDiff(sig, FOREIGN);
|
|
33
|
+
expect(["ALLOW", "REVIEW"]).toContain(own.verdict); // own style not flagged
|
|
34
|
+
expect(foreign.deviation).toBeGreaterThan(own.deviation); // foreign is farther
|
|
35
|
+
});
|
|
36
|
+
it("THE HONESTY MECHANISM — refuses to flag when not separable (UNKNOWN)", () => {
|
|
37
|
+
const sig = buildCognitiveSignature("shinn", authorDiffs);
|
|
38
|
+
// benchmark where 'other' is actually the author's own style → not separable
|
|
39
|
+
const sep = measureSeparability(sig, [authorHeldout], [A(6)]);
|
|
40
|
+
expect(sep.separable).toBe(false);
|
|
41
|
+
const v = wisdomGate(process.cwd(), sig, A(7), 1700000000000, { authorHeldout: [authorHeldout], otherDiffs: [A(6)] });
|
|
42
|
+
expect(v.verdict).not.toBe("FLAG"); // never flags on noise
|
|
43
|
+
});
|
|
44
|
+
it("measures separability against a genuinely foreign style", () => {
|
|
45
|
+
const sig = buildCognitiveSignature("shinn", authorDiffs);
|
|
46
|
+
const sep = measureSeparability(sig, [authorHeldout], [FOREIGN]);
|
|
47
|
+
expect(sep.otherMeanDist).toBeGreaterThan(sep.authorMeanDist);
|
|
48
|
+
});
|
|
49
|
+
it("signs every verdict (offline-verifiable) + deterministic", () => {
|
|
50
|
+
const sig = buildCognitiveSignature("shinn", authorDiffs);
|
|
51
|
+
const a = wisdomGate(process.cwd(), sig, FOREIGN, 1700000000000);
|
|
52
|
+
const b = wisdomGate(process.cwd(), sig, FOREIGN, 1700000000000);
|
|
53
|
+
expect(a.receipt.payloadHash).toBe(b.receipt.payloadHash);
|
|
54
|
+
expect(typeof a.receipt.sig).toBe("string");
|
|
55
|
+
});
|
|
56
|
+
it("cognitive gauntlet scores 100 (catch ∧ allow ∧ unknown-when-unseparable ∧ deterministic ∧ stable)", () => {
|
|
57
|
+
const g = cognitiveGauntlet(process.cwd(), authorDiffs, FOREIGN, authorHeldout, 1700000000000);
|
|
58
|
+
expect(g.allowsAuthor).toBe(true);
|
|
59
|
+
expect(g.unknownWhenUnseparable).toBe(true);
|
|
60
|
+
expect(g.deterministic).toBe(true);
|
|
61
|
+
expect(g.stable).toBe(true);
|
|
62
|
+
expect(g.score).toBe(100);
|
|
63
|
+
});
|
|
64
|
+
it("STABILITY — total on garbage", () => {
|
|
65
|
+
expect(judgeDiff(null, "").verdict).toBe("UNKNOWN");
|
|
66
|
+
expect(buildCognitiveSignature("x", null).sampleCount).toBe(0);
|
|
67
|
+
expect(measureSeparability(null, [], []).separable).toBe(false);
|
|
68
|
+
expect(cognitiveGauntlet(process.cwd(), [], "", "", 0).score).toBe(0);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=cognitive_gate.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitive_gate.test.js","sourceRoot":"","sources":["../../src/cognitive_gate/cognitive_gate.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpH,6FAA6F;AAC7F,MAAM,CAAC,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC;UAC5C,CAAC;;;GAGR,CAAC;AACJ,8EAA8E;AAC9E,MAAM,OAAO,GAAG;;;;;GAKb,CAAC;AAEJ,MAAM,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3B,QAAQ,CAAC,gDAAgD,EAAE,GAAG,EAAE;IAC9D,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACrE,MAAM,GAAG,GAAG,uBAAuB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC1D,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,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AAC,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.103.0 — COGNITIVE WISDOM GATE (NEMESIS × HYDRA × NOTARY).
|
|
3
|
+
*
|
|
4
|
+
* The honest core of the image's "Cognitive Entanglement" — WITHOUT the
|
|
5
|
+
* quantum-mysticism. We do NOT claim to read a soul. We measure one real,
|
|
6
|
+
* falsifiable thing: how far a diff's coding STYLE (NEMESIS micro-tells —
|
|
7
|
+
* whitespace, quotes, brace style, naming; 50+ features) sits from an
|
|
8
|
+
* author's own historical baseline. A large, well-separated deviation is a
|
|
9
|
+
* signal worth a human's eyes (a stolen key pushing foreign-style code, or
|
|
10
|
+
* just an unusual change) — NEVER an automatic block.
|
|
11
|
+
*
|
|
12
|
+
* What makes it a WISDOM gate, not security-theatre: it measures its OWN
|
|
13
|
+
* reliability. If the author's style cannot be separated from other styles
|
|
14
|
+
* on a held-out benchmark, the gate returns UNKNOWN and refuses to flag
|
|
15
|
+
* (prove-or-unknown; the Padgett rule — never auto-reject on uncertainty).
|
|
16
|
+
* Every verdict is Ed25519-signed, so any AI agent — Claude / GPT / Gemini —
|
|
17
|
+
* can verify it offline before trusting a diff. That is how it empowers
|
|
18
|
+
* every agent: a portable, self-aware, signed second opinion on authorship.
|
|
19
|
+
*
|
|
20
|
+
* STABILITY (108-error rule): every function is total — empty samples,
|
|
21
|
+
* garbage diffs, a thrown extractor → the safest verdict (UNKNOWN), never a
|
|
22
|
+
* throw, never a false FLAG.
|
|
23
|
+
*/
|
|
24
|
+
import { type MicroProfile } from "../nemesis/capillary.js";
|
|
25
|
+
import { type NotaryReceipt } from "../notary/receipt.js";
|
|
26
|
+
export interface CognitiveSignature {
|
|
27
|
+
author: string;
|
|
28
|
+
baseline: MicroProfile;
|
|
29
|
+
/** mean pairwise micro-distance among the author's own diffs (their
|
|
30
|
+
* natural style spread — the denominator for "how unusual is this?"). */
|
|
31
|
+
intraVariance: number;
|
|
32
|
+
sampleCount: number;
|
|
33
|
+
}
|
|
34
|
+
/** Build an author's cognitive signature from their historical diffs. Total. */
|
|
35
|
+
export declare function buildCognitiveSignature(author: string, diffs: string[]): CognitiveSignature;
|
|
36
|
+
export type GateVerdict = "ALLOW" | "REVIEW" | "FLAG" | "UNKNOWN";
|
|
37
|
+
export interface CognitiveJudgement {
|
|
38
|
+
verdict: GateVerdict;
|
|
39
|
+
deviation: number;
|
|
40
|
+
ratio: number;
|
|
41
|
+
confidence: "high" | "medium" | "low";
|
|
42
|
+
reason: string;
|
|
43
|
+
}
|
|
44
|
+
/** Judge a new diff vs an author's signature. ADVISORY (FLAG = "review",
|
|
45
|
+
* never "reject"); UNKNOWN when the signature is too thin. Total. */
|
|
46
|
+
export declare function judgeDiff(sig: CognitiveSignature, newDiff: string): CognitiveJudgement;
|
|
47
|
+
export interface Separability {
|
|
48
|
+
separable: boolean;
|
|
49
|
+
authorMeanDist: number;
|
|
50
|
+
otherMeanDist: number;
|
|
51
|
+
margin: number;
|
|
52
|
+
reason: string;
|
|
53
|
+
}
|
|
54
|
+
/** THE HONESTY MECHANISM — can this signature actually tell the author apart
|
|
55
|
+
* from others on held-out samples? If not, the gate downgrades to UNKNOWN
|
|
56
|
+
* rather than flag on noise. Total. */
|
|
57
|
+
export declare function measureSeparability(sig: CognitiveSignature, authorHeldout: string[], otherDiffs: string[]): Separability;
|
|
58
|
+
export interface WisdomVerdict {
|
|
59
|
+
verdict: GateVerdict;
|
|
60
|
+
judgement: CognitiveJudgement;
|
|
61
|
+
separability?: Separability;
|
|
62
|
+
receipt: NotaryReceipt;
|
|
63
|
+
}
|
|
64
|
+
/** THE WISDOM GATE — the capstone an AI agent calls before trusting a diff's
|
|
65
|
+
* authorship. Refuses to FLAG/REVIEW unless the signature is proven
|
|
66
|
+
* separable (downgrades to UNKNOWN). Signs the verdict for offline trust. */
|
|
67
|
+
export declare function wisdomGate(repoRoot: string, sig: CognitiveSignature, newDiff: string, at: number, benchmark?: {
|
|
68
|
+
authorHeldout: string[];
|
|
69
|
+
otherDiffs: string[];
|
|
70
|
+
}): WisdomVerdict;
|
|
71
|
+
export interface CognitiveGauntlet {
|
|
72
|
+
catchesForeign: boolean;
|
|
73
|
+
allowsAuthor: boolean;
|
|
74
|
+
unknownWhenUnseparable: boolean;
|
|
75
|
+
deterministic: boolean;
|
|
76
|
+
stable: boolean;
|
|
77
|
+
separable: boolean;
|
|
78
|
+
score: number;
|
|
79
|
+
}
|
|
80
|
+
/** Prove the gate on labelled synthetic data: catch a foreign style, allow
|
|
81
|
+
* the author's own, stay silent (UNKNOWN) when it can't separate. Total. */
|
|
82
|
+
export declare function cognitiveGauntlet(repoRoot: string, authorDiffs: string[], foreignDiff: string, authorHeldout: string, at: number): CognitiveGauntlet;
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cognitive_gate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAsC,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAExE,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB;8EAC0E;IAC1E,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAkBD,gFAAgF;AAChF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,kBAAkB,CAO3F;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAElE,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,WAAW,CAAC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AC;CACf;AAED;6EAC6E;AAC7E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,iBAAiB,CAwBpJ"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.103.0 — COGNITIVE WISDOM GATE (NEMESIS × HYDRA × NOTARY).
|
|
3
|
+
*
|
|
4
|
+
* The honest core of the image's "Cognitive Entanglement" — WITHOUT the
|
|
5
|
+
* quantum-mysticism. We do NOT claim to read a soul. We measure one real,
|
|
6
|
+
* falsifiable thing: how far a diff's coding STYLE (NEMESIS micro-tells —
|
|
7
|
+
* whitespace, quotes, brace style, naming; 50+ features) sits from an
|
|
8
|
+
* author's own historical baseline. A large, well-separated deviation is a
|
|
9
|
+
* signal worth a human's eyes (a stolen key pushing foreign-style code, or
|
|
10
|
+
* just an unusual change) — NEVER an automatic block.
|
|
11
|
+
*
|
|
12
|
+
* What makes it a WISDOM gate, not security-theatre: it measures its OWN
|
|
13
|
+
* reliability. If the author's style cannot be separated from other styles
|
|
14
|
+
* on a held-out benchmark, the gate returns UNKNOWN and refuses to flag
|
|
15
|
+
* (prove-or-unknown; the Padgett rule — never auto-reject on uncertainty).
|
|
16
|
+
* Every verdict is Ed25519-signed, so any AI agent — Claude / GPT / Gemini —
|
|
17
|
+
* can verify it offline before trusting a diff. That is how it empowers
|
|
18
|
+
* every agent: a portable, self-aware, signed second opinion on authorship.
|
|
19
|
+
*
|
|
20
|
+
* STABILITY (108-error rule): every function is total — empty samples,
|
|
21
|
+
* garbage diffs, a thrown extractor → the safest verdict (UNKNOWN), never a
|
|
22
|
+
* throw, never a false FLAG.
|
|
23
|
+
*/
|
|
24
|
+
import { extractMicroProfile, microDistance } from "../nemesis/capillary.js";
|
|
25
|
+
import { issueReceipt } from "../notary/receipt.js";
|
|
26
|
+
const MIN_SAMPLES = 3;
|
|
27
|
+
const EPS = 1e-3;
|
|
28
|
+
function safeProfile(diff) {
|
|
29
|
+
try {
|
|
30
|
+
if (typeof diff !== "string" || diff.length === 0)
|
|
31
|
+
return null;
|
|
32
|
+
return extractMicroProfile(diff);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function averageProfiles(profiles) {
|
|
39
|
+
const keys = new Set();
|
|
40
|
+
for (const p of profiles)
|
|
41
|
+
for (const k of Object.keys(p.features))
|
|
42
|
+
keys.add(k);
|
|
43
|
+
const features = {};
|
|
44
|
+
for (const k of keys) {
|
|
45
|
+
let s = 0;
|
|
46
|
+
for (const p of profiles)
|
|
47
|
+
s += p.features[k] ?? 0;
|
|
48
|
+
features[k] = s / profiles.length;
|
|
49
|
+
}
|
|
50
|
+
const totalLines = Math.round(profiles.reduce((a, p) => a + p.totalLines, 0) / profiles.length);
|
|
51
|
+
return { features, totalLines, language: profiles[0]?.language ?? "unknown" };
|
|
52
|
+
}
|
|
53
|
+
/** Build an author's cognitive signature from their historical diffs. Total. */
|
|
54
|
+
export function buildCognitiveSignature(author, diffs) {
|
|
55
|
+
const profiles = (Array.isArray(diffs) ? diffs : []).map(safeProfile).filter((p) => p !== null);
|
|
56
|
+
if (profiles.length === 0)
|
|
57
|
+
return { author: String(author ?? "unknown"), baseline: { features: {}, totalLines: 0, language: "unknown" }, intraVariance: 0, sampleCount: 0 };
|
|
58
|
+
const baseline = averageProfiles(profiles);
|
|
59
|
+
let sum = 0, n = 0;
|
|
60
|
+
for (let i = 0; i < profiles.length; i++)
|
|
61
|
+
for (let j = i + 1; j < profiles.length; j++) {
|
|
62
|
+
sum += microDistance(profiles[i], profiles[j]);
|
|
63
|
+
n++;
|
|
64
|
+
}
|
|
65
|
+
return { author: String(author ?? "unknown"), baseline, intraVariance: n > 0 ? sum / n : 0, sampleCount: profiles.length };
|
|
66
|
+
}
|
|
67
|
+
/** Judge a new diff vs an author's signature. ADVISORY (FLAG = "review",
|
|
68
|
+
* never "reject"); UNKNOWN when the signature is too thin. Total. */
|
|
69
|
+
export function judgeDiff(sig, newDiff) {
|
|
70
|
+
try {
|
|
71
|
+
if (!sig || sig.sampleCount < MIN_SAMPLES)
|
|
72
|
+
return { verdict: "UNKNOWN", deviation: 0, ratio: 0, confidence: "low", reason: `signature too thin (${sig?.sampleCount ?? 0} < ${MIN_SAMPLES}) — cannot judge` };
|
|
73
|
+
const p = safeProfile(newDiff);
|
|
74
|
+
if (!p)
|
|
75
|
+
return { verdict: "UNKNOWN", deviation: 0, ratio: 0, confidence: "low", reason: "empty/unparseable diff" };
|
|
76
|
+
const deviation = microDistance(p, sig.baseline);
|
|
77
|
+
const ratio = deviation / (sig.intraVariance + EPS);
|
|
78
|
+
let verdict;
|
|
79
|
+
let confidence;
|
|
80
|
+
if (ratio <= 1.5) {
|
|
81
|
+
verdict = "ALLOW";
|
|
82
|
+
confidence = "high";
|
|
83
|
+
}
|
|
84
|
+
else if (ratio <= 3) {
|
|
85
|
+
verdict = "REVIEW";
|
|
86
|
+
confidence = "medium";
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
verdict = "FLAG";
|
|
90
|
+
confidence = "medium";
|
|
91
|
+
}
|
|
92
|
+
return { verdict, deviation, ratio, confidence, reason: `style deviation ${deviation.toFixed(3)} = ${ratio.toFixed(1)}× the author's own spread` };
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
return { verdict: "UNKNOWN", deviation: 0, ratio: 0, confidence: "low", reason: `threw: ${e.message}` };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** THE HONESTY MECHANISM — can this signature actually tell the author apart
|
|
99
|
+
* from others on held-out samples? If not, the gate downgrades to UNKNOWN
|
|
100
|
+
* rather than flag on noise. Total. */
|
|
101
|
+
export function measureSeparability(sig, authorHeldout, otherDiffs) {
|
|
102
|
+
const aProfiles = (authorHeldout ?? []).map(safeProfile).filter((p) => p !== null);
|
|
103
|
+
const oProfiles = (otherDiffs ?? []).map(safeProfile).filter((p) => p !== null);
|
|
104
|
+
if (!sig || sig.sampleCount < MIN_SAMPLES || aProfiles.length === 0 || oProfiles.length === 0) {
|
|
105
|
+
return { separable: false, authorMeanDist: 0, otherMeanDist: 0, margin: 0, reason: "insufficient held-out samples to measure separability" };
|
|
106
|
+
}
|
|
107
|
+
const mean = (ps) => ps.reduce((a, p) => a + microDistance(p, sig.baseline), 0) / ps.length;
|
|
108
|
+
const authorMeanDist = mean(aProfiles);
|
|
109
|
+
const otherMeanDist = mean(oProfiles);
|
|
110
|
+
const margin = otherMeanDist - authorMeanDist;
|
|
111
|
+
const separable = margin > Math.max(EPS, sig.intraVariance * 0.5) && otherMeanDist > authorMeanDist * 1.3;
|
|
112
|
+
return { separable, authorMeanDist, otherMeanDist, margin, reason: separable ? "author style is separable from others" : "author style NOT reliably separable — gate will not flag" };
|
|
113
|
+
}
|
|
114
|
+
/** THE WISDOM GATE — the capstone an AI agent calls before trusting a diff's
|
|
115
|
+
* authorship. Refuses to FLAG/REVIEW unless the signature is proven
|
|
116
|
+
* separable (downgrades to UNKNOWN). Signs the verdict for offline trust. */
|
|
117
|
+
export function wisdomGate(repoRoot, sig, newDiff, at, benchmark) {
|
|
118
|
+
const judgement = judgeDiff(sig, newDiff);
|
|
119
|
+
let verdict = judgement.verdict;
|
|
120
|
+
let separability;
|
|
121
|
+
if (benchmark) {
|
|
122
|
+
separability = measureSeparability(sig, benchmark.authorHeldout, benchmark.otherDiffs);
|
|
123
|
+
if ((verdict === "FLAG" || verdict === "REVIEW") && !separability.separable)
|
|
124
|
+
verdict = "UNKNOWN";
|
|
125
|
+
}
|
|
126
|
+
const receipt = issueReceipt(repoRoot, {
|
|
127
|
+
kind: "reasoning-trace",
|
|
128
|
+
subject: `cognitive-gate:${sig?.author ?? "unknown"}`,
|
|
129
|
+
payload: { author: sig?.author ?? "unknown", verdict, deviation: Number(judgement.deviation.toFixed(4)), ratio: Number(judgement.ratio.toFixed(3)), separable: separability?.separable ?? null, sampleCount: sig?.sampleCount ?? 0 },
|
|
130
|
+
includePayload: true,
|
|
131
|
+
issuedAt: at,
|
|
132
|
+
});
|
|
133
|
+
return { verdict, judgement, separability, receipt };
|
|
134
|
+
}
|
|
135
|
+
/** Prove the gate on labelled synthetic data: catch a foreign style, allow
|
|
136
|
+
* the author's own, stay silent (UNKNOWN) when it can't separate. Total. */
|
|
137
|
+
export function cognitiveGauntlet(repoRoot, authorDiffs, foreignDiff, authorHeldout, at) {
|
|
138
|
+
try {
|
|
139
|
+
const sig = buildCognitiveSignature("author", authorDiffs);
|
|
140
|
+
// Nothing to prove without a real signature + samples → score 0.
|
|
141
|
+
if (sig.sampleCount < MIN_SAMPLES || typeof foreignDiff !== "string" || foreignDiff.length === 0 || typeof authorHeldout !== "string" || authorHeldout.length === 0) {
|
|
142
|
+
return { catchesForeign: false, allowsAuthor: false, unknownWhenUnseparable: false, deterministic: false, stable: true, separable: false, score: 0 };
|
|
143
|
+
}
|
|
144
|
+
const bench = { authorHeldout: [authorHeldout], otherDiffs: [foreignDiff] };
|
|
145
|
+
const sep = measureSeparability(sig, bench.authorHeldout, bench.otherDiffs);
|
|
146
|
+
const foreignV = wisdomGate(repoRoot, sig, foreignDiff, at, bench).verdict;
|
|
147
|
+
const authorV = wisdomGate(repoRoot, sig, authorHeldout, at, bench).verdict;
|
|
148
|
+
const catchesForeign = sep.separable ? (foreignV === "FLAG" || foreignV === "REVIEW") : true;
|
|
149
|
+
const allowsAuthor = authorV === "ALLOW" || authorV === "UNKNOWN";
|
|
150
|
+
// Unseparable case: author vs author (same dist) must NOT flag.
|
|
151
|
+
const flatV = wisdomGate(repoRoot, sig, authorHeldout, at, { authorHeldout: [authorHeldout], otherDiffs: [authorHeldout] }).verdict;
|
|
152
|
+
const unknownWhenUnseparable = flatV !== "FLAG";
|
|
153
|
+
const a = wisdomGate(repoRoot, sig, foreignDiff, at, bench).receipt.payloadHash;
|
|
154
|
+
const b = wisdomGate(repoRoot, sig, foreignDiff, at, bench).receipt.payloadHash;
|
|
155
|
+
const deterministic = a === b;
|
|
156
|
+
let stable = true;
|
|
157
|
+
try {
|
|
158
|
+
judgeDiff(null, "");
|
|
159
|
+
buildCognitiveSignature("x", null);
|
|
160
|
+
measureSeparability(null, [], []);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
stable = false;
|
|
164
|
+
}
|
|
165
|
+
const perfect = catchesForeign && allowsAuthor && unknownWhenUnseparable && deterministic && stable;
|
|
166
|
+
return { catchesForeign, allowsAuthor, unknownWhenUnseparable, deterministic, stable, separable: sep.separable, score: perfect ? 100 : 0 };
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
return { catchesForeign: false, allowsAuthor: false, unknownWhenUnseparable: false, deterministic: false, stable: false, separable: false, score: 0 };
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cognitive_gate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAqB,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,YAAY,EAAsB,MAAM,sBAAsB,CAAC;AAWxE,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,GAAG,GAAG,IAAI,CAAC;AAEjB,SAAS,WAAW,CAAC,IAAY;IAC/B,IAAI,CAAC;QAAC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;AAClI,CAAC;AAED,SAAS,eAAe,CA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AE,CAAC;IAC7I,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,CAAC;AACpK,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -115,6 +115,8 @@ export * as interstellar from "./interstellar/index.js";
|
|
|
115
115
|
export * as gladiator from "./gladiator/index.js";
|
|
116
116
|
export * as lexicon from "./lexicon/index.js";
|
|
117
117
|
export * as hydra from "./hydra/index.js";
|
|
118
|
+
export * as cognitiveGate from "./cognitive_gate/index.js";
|
|
119
|
+
export * as branchOracle from "./branch_oracle/index.js";
|
|
118
120
|
export * as symbiosis from "./symbiosis/index.js";
|
|
119
121
|
export * as truthKernel from "./truth_kernel/index.js";
|
|
120
122
|
export * as aletheiaSpine from "./truth_kernel/aletheia.js";
|