@mneme-ai/core 2.62.0 → 2.63.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.
@@ -0,0 +1,289 @@
1
+ /**
2
+ * v2.63.0 — TIME-CRYSTAL: federated agent wisdom.
3
+ *
4
+ * User-roadmap (continuing from v2.60-v2.62): conscience + **memory** +
5
+ * diplomat + bodyguard + time machine. v2.63 ships the **memory**
6
+ * primitive.
7
+ *
8
+ * When agent A encounters problem P (e.g. "Cannot find module
9
+ * @types/node"), Mneme replies "342 agents saw this same problem in
10
+ * the last 7 days. 89% used `npm i -D @types/node` (304 trials, Wilson
11
+ * lower-bound 0.85). 11% tried `delete node_modules` (38 trials, but
12
+ * 17 failed on pnpm projects)."
13
+ *
14
+ * Pre-MIRROR data sources for AI tooling are static (Stack Overflow,
15
+ * GitHub Issues, docs). TIME-CRYSTAL aggregates **actual AI agent
16
+ * behavior** — every contribution = a real agent ran a real fix and
17
+ * got a real outcome. Every agent using Mneme MCP contributes back.
18
+ *
19
+ * 5 wild innovations:
20
+ *
21
+ * 1. CANONICAL PROBLEM FINGERPRINTING — entity slotting (`<PKG>`,
22
+ * `<VER>`, `<PATH>`, `<HASH>`, `<TSERR>`) + stop-word filter +
23
+ * token sort + SHA-256 = stable 16-hex cluster key. Two agents
24
+ * typing "Cannot find module '@types/node'" and "TypeScript Error
25
+ * TS2307: Cannot find module @types/node" cluster to ONE bucket.
26
+ *
27
+ * 2. WILSON LOWER-BOUND RANKING — small-sample approaches don't
28
+ * dominate. 2/2 success looks great until Wilson LB says 0.20.
29
+ * Surfaces statistically credible recommendations.
30
+ *
31
+ * 3. RECENCY DECAY — exponential half-life (30 days default).
32
+ * Old wisdom may be stale (package versions move, framework
33
+ * defaults change). Recent wins weigh more.
34
+ *
35
+ * 4. ENVIRONMENT-AWARE GROUNDING — caller passes current env
36
+ * (`{ node: "22.13.0", pnpm: "10" }`); ranking boosts approaches
37
+ * tested on matching env. Prevents "this works on Yarn but you're
38
+ * on pnpm" mismatches.
39
+ *
40
+ * 5. GOTCHA AUTO-DETECTION — when an approach has mixed outcomes,
41
+ * compute the env-key/value where failure-rate gain ≥ 30%.
42
+ * Auto-extracts "X fails on Y" patterns without anyone writing them.
43
+ * Plus folds free-text failure notes ("ฟังก์ชั่น break ถ้ามี
44
+ * pnpm-lock.yaml").
45
+ *
46
+ * Plus HMAC-chained ledger (same convention as PASSPORT + MIRRAGE)
47
+ * for tamper-evident contribution history; opt-in cross-host gossip
48
+ * via CONSENT FABRIC (wire pending v2.64+).
49
+ *
50
+ * Pure ESM. Defensive — never throws.
51
+ */
52
+ import { createHmac, randomBytes } from "node:crypto";
53
+ import { appendFileSync, mkdirSync, readFileSync } from "node:fs";
54
+ import { dirname, join } from "node:path";
55
+ import { normalizeProblem, similarity } from "./problem_fingerprint.js";
56
+ import { rankApproaches } from "./ranking.js";
57
+ import { detectGotchas } from "./gotcha_detector.js";
58
+ const KEY_ENV = "MNEME_TIME_CRYSTAL_KEY";
59
+ const DEFAULT_KEY = "mneme-time-crystal-v1";
60
+ function keyOf() { return process.env[KEY_ENV] ?? DEFAULT_KEY; }
61
+ /* ── Canonical JSON HMAC ────────────────────────────────────────── */
62
+ function canonicalJson(o) {
63
+ if (o === undefined)
64
+ return "null";
65
+ if (o === null || typeof o !== "object")
66
+ return JSON.stringify(o);
67
+ if (Array.isArray(o))
68
+ return "[" + o.map((x) => canonicalJson(x === undefined ? null : x)).join(",") + "]";
69
+ const entries = Object.entries(o).filter(([, v]) => v !== undefined);
70
+ entries.sort(([a], [b]) => a.localeCompare(b));
71
+ return "{" + entries.map(([k, v]) => JSON.stringify(k) + ":" + canonicalJson(v)).join(",") + "}";
72
+ }
73
+ function signHmac(body) {
74
+ return createHmac("sha256", keyOf()).update(canonicalJson(body)).digest("hex");
75
+ }
76
+ function ledgerPath(cwd) {
77
+ return join(cwd, ".mneme", "time_crystal", "wisdom.jsonl");
78
+ }
79
+ function readLedgerLines(cwd) {
80
+ try {
81
+ return readFileSync(ledgerPath(cwd), "utf8").trim().split(/\n/).filter((l) => l.trim().length > 0);
82
+ }
83
+ catch {
84
+ return [];
85
+ }
86
+ }
87
+ function lastLedgerHmac(cwd) {
88
+ const lines = readLedgerLines(cwd);
89
+ if (lines.length === 0)
90
+ return "";
91
+ try {
92
+ return JSON.parse(lines[lines.length - 1]).hmac;
93
+ }
94
+ catch {
95
+ return "";
96
+ }
97
+ }
98
+ export function readLedger(cwd) {
99
+ return readLedgerLines(cwd).map((l) => {
100
+ try {
101
+ return JSON.parse(l);
102
+ }
103
+ catch {
104
+ return null;
105
+ }
106
+ }).filter((x) => x !== null);
107
+ }
108
+ export function verifyLedgerChain(cwd) {
109
+ const lines = readLedger(cwd);
110
+ let prevHmac = "";
111
+ for (let i = 0; i < lines.length; i++) {
112
+ const row = lines[i];
113
+ if (row.prevHmac !== prevHmac)
114
+ return { ok: false, rows: i, brokenAt: i };
115
+ const { hmac, ...body } = row;
116
+ const expected = createHmac("sha256", keyOf()).update(prevHmac).update(canonicalJson(body)).digest("hex");
117
+ if (expected !== hmac)
118
+ return { ok: false, rows: i, brokenAt: i };
119
+ prevHmac = hmac;
120
+ }
121
+ return { ok: true, rows: lines.length };
122
+ }
123
+ /* ── Contribute ─────────────────────────────────────────────────── */
124
+ export function contribute(input) {
125
+ const cwd = input.cwd ?? process.cwd();
126
+ const norm = normalizeProblem(input.problem);
127
+ const recordId = randomBytes(8).toString("hex");
128
+ const at = new Date().toISOString();
129
+ const prevHmac = lastLedgerHmac(cwd);
130
+ const body = {
131
+ kind: "contribution",
132
+ at, recordId, agent: input.agent,
133
+ problemFingerprint: norm.fingerprint,
134
+ canonical: norm.canonical,
135
+ approach: input.approach,
136
+ outcome: input.outcome,
137
+ env: input.env,
138
+ note: input.note,
139
+ prevHmac,
140
+ };
141
+ const hmac = createHmac("sha256", keyOf()).update(prevHmac).update(canonicalJson(body)).digest("hex");
142
+ const entry = { ...body, hmac };
143
+ try {
144
+ mkdirSync(dirname(ledgerPath(cwd)), { recursive: true });
145
+ appendFileSync(ledgerPath(cwd), JSON.stringify(entry) + "\n");
146
+ }
147
+ catch { /* noop */ }
148
+ return {
149
+ ok: true,
150
+ recordId,
151
+ problemFingerprint: norm.fingerprint,
152
+ hmac,
153
+ hint: `contributed: agent=${input.agent} outcome=${input.outcome} fingerprint=${norm.fingerprint}`,
154
+ };
155
+ }
156
+ /* ── Lookup ─────────────────────────────────────────────────────── */
157
+ export function lookupWisdom(input) {
158
+ const cwd = input.cwd ?? process.cwd();
159
+ const norm = normalizeProblem(input.problem);
160
+ const all = readLedger(cwd);
161
+ const exact = all.filter((e) => e.problemFingerprint === norm.fingerprint);
162
+ // Build records for ranking.
163
+ const records = exact.map((e) => ({
164
+ approach: e.approach,
165
+ outcome: e.outcome,
166
+ at: e.at,
167
+ env: e.env,
168
+ note: e.note,
169
+ }));
170
+ const approaches = rankApproaches(records, {
171
+ env: input.env,
172
+ halfLifeMs: input.halfLifeMs,
173
+ now: input.now,
174
+ }).slice(0, input.topN ?? 5);
175
+ const gotchas = detectGotchas(records);
176
+ // Related: distinct fingerprints with >0.30 token-set similarity.
177
+ const byFingerprint = new Map();
178
+ for (const e of all) {
179
+ if (e.problemFingerprint === norm.fingerprint)
180
+ continue;
181
+ const list = byFingerprint.get(e.problemFingerprint) ?? [];
182
+ list.push(e);
183
+ byFingerprint.set(e.problemFingerprint, list);
184
+ }
185
+ const related = [];
186
+ for (const [fp, list] of byFingerprint) {
187
+ const sim = similarity(norm.canonical, list[0].canonical);
188
+ if (sim >= 0.30) {
189
+ related.push({ fingerprint: fp, canonical: list[0].canonical, similarity: +sim.toFixed(3), sampleSize: list.length });
190
+ }
191
+ }
192
+ related.sort((a, b) => b.similarity - a.similarity);
193
+ const distinctAgents = new Set(exact.map((e) => e.agent)).size;
194
+ const at = new Date().toISOString();
195
+ // Plain-English summary suitable for the agent to read inline.
196
+ const summaryLines = [];
197
+ if (exact.length === 0) {
198
+ summaryLines.push(`No prior wisdom on this exact problem fingerprint (${norm.fingerprint}).`);
199
+ if (related.length > 0)
200
+ summaryLines.push(`But ${related.length} similar bucket(s) exist — top: "${related[0].canonical.slice(0, 80)}".`);
201
+ }
202
+ else {
203
+ summaryLines.push(`${exact.length} contribution(s) from ${distinctAgents} distinct agent(s) on this problem.`);
204
+ for (const a of approaches.slice(0, 3)) {
205
+ const pct = (a.successRate * 100).toFixed(0);
206
+ const lb = (a.wilsonLB * 100).toFixed(0);
207
+ summaryLines.push(` • ${a.approach}: ${pct}% success (n=${a.sampleSize}, Wilson-LB ${lb}%)`);
208
+ }
209
+ if (gotchas.length > 0) {
210
+ summaryLines.push(`gotchas: ${gotchas.slice(0, 2).map((g) => g.approach + (g.triggerConditions.length > 0 ? ` (fails on ${g.triggerConditions[0].key}=${g.triggerConditions[0].value})` : "")).join("; ")}`);
211
+ }
212
+ }
213
+ const summary = summaryLines.join("\n");
214
+ const bodyForHmac = {
215
+ problem: input.problem,
216
+ problemFingerprint: norm.fingerprint,
217
+ totalContributors: exact.length,
218
+ distinctAgents,
219
+ approaches, gotchas, related, summary, at,
220
+ };
221
+ const hmac = signHmac(bodyForHmac);
222
+ return { ...bodyForHmac, hmac };
223
+ }
224
+ export function verifyLookup(r) {
225
+ if (!r || typeof r.hmac !== "string")
226
+ return false;
227
+ const { hmac, ...body } = r;
228
+ return signHmac(body) === hmac;
229
+ }
230
+ export function contributorStats(cwd) {
231
+ const rows = readLedger(cwd);
232
+ const agentCount = new Map();
233
+ const problemCount = new Map();
234
+ const outcomes = { success: 0, failure: 0, partial: 0 };
235
+ for (const r of rows) {
236
+ agentCount.set(r.agent, (agentCount.get(r.agent) ?? 0) + 1);
237
+ const p = problemCount.get(r.problemFingerprint) ?? { canonical: r.canonical, count: 0 };
238
+ p.count++;
239
+ problemCount.set(r.problemFingerprint, p);
240
+ outcomes[r.outcome]++;
241
+ }
242
+ return {
243
+ totalContributions: rows.length,
244
+ distinctAgents: agentCount.size,
245
+ distinctProblems: problemCount.size,
246
+ topAgents: Array.from(agentCount.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([agent, count]) => ({ agent, count })),
247
+ topProblems: Array.from(problemCount.entries()).sort((a, b) => b[1].count - a[1].count).slice(0, 10).map(([fingerprint, { canonical, count }]) => ({ fingerprint, canonical, count })),
248
+ outcomes,
249
+ };
250
+ }
251
+ /* ── Render ─────────────────────────────────────────────────────── */
252
+ export function renderLookupBanner(r) {
253
+ const lines = [
254
+ `🌌 TIME-CRYSTAL · fingerprint ${r.problemFingerprint}`,
255
+ ` ${r.totalContributors} contribution(s) · ${r.distinctAgents} distinct agent(s)`,
256
+ "",
257
+ ];
258
+ for (const a of r.approaches) {
259
+ const pct = (a.successRate * 100).toFixed(0);
260
+ const lb = (a.wilsonLB * 100).toFixed(0);
261
+ lines.push(` ★ rank=${a.rankScore.toFixed(3)} ${pct}% success Wilson-LB ${lb}% n=${a.sampleSize}`);
262
+ lines.push(` ${a.approach}`);
263
+ if (a.notes.length > 0)
264
+ lines.push(` note: ${a.notes[0]}`);
265
+ }
266
+ if (r.gotchas.length > 0) {
267
+ lines.push("");
268
+ lines.push(` GOTCHAS (${r.gotchas.length}):`);
269
+ for (const g of r.gotchas.slice(0, 3)) {
270
+ const cond = g.triggerConditions.length > 0
271
+ ? `fails on ${g.triggerConditions.map((t) => `${t.key}=${t.value}`).join(", ")}`
272
+ : g.notes.join("; ");
273
+ lines.push(` ⚠ ${g.approach} — ${cond} (severity ${(g.severity * 100).toFixed(0)}%)`);
274
+ }
275
+ }
276
+ if (r.related.length > 0) {
277
+ lines.push("");
278
+ lines.push(` RELATED (${r.related.length}):`);
279
+ for (const rel of r.related.slice(0, 3)) {
280
+ lines.push(` ~ ${(rel.similarity * 100).toFixed(0)}% match ${rel.canonical.slice(0, 80)} (n=${rel.sampleSize})`);
281
+ }
282
+ }
283
+ return lines.join("\n");
284
+ }
285
+ /* ── Re-exports ─────────────────────────────────────────────────── */
286
+ export { normalizeProblem, similarity } from "./problem_fingerprint.js";
287
+ export { rankApproaches, approachKey } from "./ranking.js";
288
+ export { detectGotchas } from "./gotcha_detector.js";
289
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/time_crystal/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,cAAc,EAAc,SAAS,EAAE,YAAY,EAAiB,MAAM,SAAS,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,cAAc,EAAsE,MAAM,cAAc,CAAC;AAClH,OAAO,EAAE,aAAa,EAAe,MAAM,sBAAsB,CAAC;AAElE,MAAM,OAAO,GAAG,wBAAwB,CAAC;AACzC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAC5C,SAAS,KAAK,KAAa,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC;AA0DxE,uEAAuE;AAEvE,SAAS,aAAa,CAAC,CAAU;IAC/B,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACnC,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;QAChD,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACxC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC;QACzH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,uEAAuE;AAEvE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * v2.63.0 — TIME-CRYSTAL problem fingerprinting.
3
+ *
4
+ * Two agents hitting the same problem will type it slightly differently:
5
+ * "Cannot find module '@types/node'"
6
+ * "TypeScript Error TS2307: Cannot find module @types/node"
7
+ * "error: cannot find module @types/node when building"
8
+ *
9
+ * All three should cluster to ONE wisdom bucket. The fingerprint is a
10
+ * canonical hash of the SHAPE of the problem after normalization.
11
+ *
12
+ * Pipeline:
13
+ * 1. Lowercase
14
+ * 2. Strip stack-trace prefixes (file:line:col, "at Function.foo (path)")
15
+ * 3. Normalize entities to slot tokens:
16
+ * "@types/node" → "<PKG>"
17
+ * "5.6.3" → "<VER>"
18
+ * "src/file.ts" → "<PATH>"
19
+ * "2026-05-26" → "<DATE>"
20
+ * "abc1234" → "<HASH>"
21
+ * numbers 3+ digits → "<N>"
22
+ * 4. Strip filler / TypeScript error codes (TS2307 etc.)
23
+ * 5. Tokenize, remove common stop-words, sort, join
24
+ * 6. SHA-256 → 16 hex char fingerprint
25
+ *
26
+ * The slot tokens are KEPT in the fingerprint (just normalized) so
27
+ * "Cannot find module @types/node" and "Cannot find module foo" share
28
+ * structure but NOT specifically — they collapse to the same shape.
29
+ *
30
+ * Pure deterministic.
31
+ */
32
+ export interface NormalizationResult {
33
+ /** Canonical text after entity slotting + stop-word removal. */
34
+ canonical: string;
35
+ /** Stable 16-hex fingerprint hash. */
36
+ fingerprint: string;
37
+ /** Slot counts (informational). */
38
+ slots: Record<string, number>;
39
+ }
40
+ export declare function normalizeProblem(text: string): NormalizationResult;
41
+ /** Jaccard similarity between two canonical-tokens sets. */
42
+ export declare function similarity(a: string, b: string): number;
43
+ //# sourceMappingURL=problem_fingerprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"problem_fingerprint.d.ts","sourceRoot":"","sources":["../../src/time_crystal/problem_fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AA2BH,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAkClE;AAED,4DAA4D;AAC5D,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAQvD"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * v2.63.0 — TIME-CRYSTAL problem fingerprinting.
3
+ *
4
+ * Two agents hitting the same problem will type it slightly differently:
5
+ * "Cannot find module '@types/node'"
6
+ * "TypeScript Error TS2307: Cannot find module @types/node"
7
+ * "error: cannot find module @types/node when building"
8
+ *
9
+ * All three should cluster to ONE wisdom bucket. The fingerprint is a
10
+ * canonical hash of the SHAPE of the problem after normalization.
11
+ *
12
+ * Pipeline:
13
+ * 1. Lowercase
14
+ * 2. Strip stack-trace prefixes (file:line:col, "at Function.foo (path)")
15
+ * 3. Normalize entities to slot tokens:
16
+ * "@types/node" → "<PKG>"
17
+ * "5.6.3" → "<VER>"
18
+ * "src/file.ts" → "<PATH>"
19
+ * "2026-05-26" → "<DATE>"
20
+ * "abc1234" → "<HASH>"
21
+ * numbers 3+ digits → "<N>"
22
+ * 4. Strip filler / TypeScript error codes (TS2307 etc.)
23
+ * 5. Tokenize, remove common stop-words, sort, join
24
+ * 6. SHA-256 → 16 hex char fingerprint
25
+ *
26
+ * The slot tokens are KEPT in the fingerprint (just normalized) so
27
+ * "Cannot find module @types/node" and "Cannot find module foo" share
28
+ * structure but NOT specifically — they collapse to the same shape.
29
+ *
30
+ * Pure deterministic.
31
+ */
32
+ import { createHash } from "node:crypto";
33
+ const STOP_WORDS = new Set([
34
+ "a", "an", "the", "and", "or", "but", "of", "to", "in", "on", "at", "by",
35
+ "for", "with", "from", "is", "was", "are", "were", "be", "been", "being",
36
+ "do", "does", "did", "doing", "have", "has", "had", "having", "will",
37
+ "would", "should", "could", "may", "might", "must", "this", "that",
38
+ "these", "those", "it", "its", "as", "if", "then", "than", "so", "such",
39
+ "very", "just", "only", "also", "again", "ever", "still", "yet",
40
+ "error", "warning", "exception", "failure", "problem", "issue",
41
+ ]);
42
+ const TS_ERROR_CODE = /\bTS\d{4,5}\b/g;
43
+ const STACK_LINE = /^\s*at\s.+(\(.+\))?$/gm;
44
+ const FILE_LINE_COL = /\b[A-Za-z_][A-Za-z0-9_./\\-]*:\d+(:\d+)?\b/g;
45
+ const PKG_SCOPED = /@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*/gi;
46
+ const PKG_BARE = /\b[a-z][a-z0-9_-]*(?:-[a-z0-9_-]+){0,3}\b(?=@\d)/gi; // pkg before @version
47
+ const SEMVER = /\bv?\d+\.\d+(?:\.\d+)?(?:-[a-z0-9.]+)?(?:\+[a-z0-9.]+)?\b/gi;
48
+ const PATH_RX = /\b[A-Za-z_][A-Za-z0-9_/\\.-]*\.(?:ts|tsx|js|jsx|cjs|mjs|py|rs|go|java|kt|swift|md|json|yaml|yml|toml|sh|sql|html|css|tex)\b/g;
49
+ const ISO_DATE = /\b\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?)?\b/g;
50
+ const SHA_HASH = /\b[a-f0-9]{7,40}\b/g;
51
+ const URL_RX = /https?:\/\/\S+/g;
52
+ const BIG_NUM = /\b\d{3,}(?:,\d{3})*\b/g;
53
+ const QUOTES = /[`'"]/g;
54
+ export function normalizeProblem(text) {
55
+ if (typeof text !== "string" || text.length === 0) {
56
+ return { canonical: "", fingerprint: "0".repeat(16), slots: {} };
57
+ }
58
+ let s = text.toLowerCase();
59
+ // Strip stack-trace + file:line:col patterns first.
60
+ s = s.replace(STACK_LINE, " ");
61
+ s = s.replace(URL_RX, " <URL> ");
62
+ s = s.replace(ISO_DATE, " <DATE> ");
63
+ // Order matters: scoped packages BEFORE bare-pkg-before-version BEFORE semver.
64
+ s = s.replace(PKG_SCOPED, " <PKG> ");
65
+ s = s.replace(SEMVER, " <VER> ");
66
+ s = s.replace(PATH_RX, " <PATH> ");
67
+ s = s.replace(SHA_HASH, " <HASH> ");
68
+ s = s.replace(FILE_LINE_COL, " <LOC> ");
69
+ s = s.replace(TS_ERROR_CODE, " <TSERR> ");
70
+ s = s.replace(BIG_NUM, " <N> ");
71
+ s = s.replace(QUOTES, " ");
72
+ // Tokenize on non-word boundaries (but keep angle brackets for slots).
73
+ const tokens = s.split(/[^a-z0-9_<>]+/i).map((t) => t.trim()).filter((t) => t.length > 0);
74
+ const filtered = tokens.filter((t) => !STOP_WORDS.has(t) && t.length >= 2);
75
+ // Sort for canonical form so order doesn't matter.
76
+ filtered.sort();
77
+ const canonical = filtered.join(" ");
78
+ // Slot counts.
79
+ const slots = {};
80
+ for (const t of filtered) {
81
+ if (/^<.+>$/.test(t))
82
+ slots[t] = (slots[t] ?? 0) + 1;
83
+ }
84
+ const fingerprint = createHash("sha256").update(canonical).digest("hex").slice(0, 16);
85
+ return { canonical, fingerprint, slots };
86
+ }
87
+ /** Jaccard similarity between two canonical-tokens sets. */
88
+ export function similarity(a, b) {
89
+ if (!a || !b)
90
+ return 0;
91
+ const sa = new Set(a.split(/\s+/).filter(Boolean));
92
+ const sb = new Set(b.split(/\s+/).filter(Boolean));
93
+ if (sa.size === 0 || sb.size === 0)
94
+ return 0;
95
+ let intersect = 0;
96
+ for (const t of sa)
97
+ if (sb.has(t))
98
+ intersect++;
99
+ return intersect / (sa.size + sb.size - intersect);
100
+ }
101
+ //# sourceMappingURL=problem_fingerprint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"problem_fingerprint.js","sourceRoot":"","sources":["../../src/time_crystal/problem_fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACxE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO;IACxE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM;IACpE,OAAO,EAAE,QAAQ,EAAE,OAAO,E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GAAG,EAAE,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * v2.63.0 — TIME-CRYSTAL approach ranking.
3
+ *
4
+ * Given N raw wisdom records for the same problem fingerprint, group by
5
+ * approach + score each group. Output is the ranked solution list.
6
+ *
7
+ * Three scoring factors fused:
8
+ * 1. Wilson lower-bound on success rate (small samples don't dominate)
9
+ * 2. Recency boost (exponential decay; half-life 30 days)
10
+ * 3. Environment match (if caller's env supplied, prefer approaches
11
+ * tested on matching env)
12
+ *
13
+ * Pure deterministic.
14
+ */
15
+ export type Outcome = "success" | "failure" | "partial";
16
+ export interface WisdomRecord {
17
+ approach: string;
18
+ outcome: Outcome;
19
+ /** When this record was contributed (ISO 8601). */
20
+ at: string;
21
+ /** Optional environment fingerprint (node version etc). */
22
+ env?: Record<string, string>;
23
+ /** Optional free-text note (gotcha hint). */
24
+ note?: string;
25
+ }
26
+ export interface ApproachGroup {
27
+ approach: string;
28
+ sampleSize: number;
29
+ successCount: number;
30
+ partialCount: number;
31
+ failureCount: number;
32
+ /** Mean success rate (success + 0.5*partial) / total. */
33
+ successRate: number;
34
+ /** Wilson lower bound at 95% — credible lower bound. */
35
+ wilsonLB: number;
36
+ /** Most recent contribution timestamp. */
37
+ lastSeenAt: string;
38
+ /** Records' env-match count (when grounding env provided). */
39
+ envMatches?: number;
40
+ /** Aggregated notes (gotcha hints). */
41
+ notes: string[];
42
+ /** Composite rank score 0..1. */
43
+ rankScore: number;
44
+ }
45
+ /**
46
+ * Normalize approach text so similar phrasing groups. We don't deeply
47
+ * understand the approach — just trim + lowercase + collapse whitespace.
48
+ * Future: cluster via embedding distance (deep mode).
49
+ */
50
+ export declare function approachKey(text: string): string;
51
+ export interface RankOpts {
52
+ /** Current environment to match (e.g. { node: "22.13.0", pnpm: "10" }). */
53
+ env?: Record<string, string>;
54
+ /** Half-life in milliseconds for recency boost. Default 30 days. */
55
+ halfLifeMs?: number;
56
+ /** Reference "now" for recency calculation (default Date.now). */
57
+ now?: number;
58
+ }
59
+ export declare function rankApproaches(records: WisdomRecord[], opts?: RankOpts): ApproachGroup[];
60
+ //# sourceMappingURL=ranking.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ranking.d.ts","sourceRoot":"","sources":["../../src/time_crystal/ranking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB;AAYD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,MAAM,WAAW,QAAQ;IACvB,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,IAAI,GAAE,QAAa,GAAG,aAAa,EAAE,CA2C5F"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * v2.63.0 — TIME-CRYSTAL approach ranking.
3
+ *
4
+ * Given N raw wisdom records for the same problem fingerprint, group by
5
+ * approach + score each group. Output is the ranked solution list.
6
+ *
7
+ * Three scoring factors fused:
8
+ * 1. Wilson lower-bound on success rate (small samples don't dominate)
9
+ * 2. Recency boost (exponential decay; half-life 30 days)
10
+ * 3. Environment match (if caller's env supplied, prefer approaches
11
+ * tested on matching env)
12
+ *
13
+ * Pure deterministic.
14
+ */
15
+ /** Wilson score lower bound for a binomial proportion. */
16
+ function wilsonLB(success, total, z = 1.96) {
17
+ if (total === 0)
18
+ return 0;
19
+ const phat = success / total;
20
+ const denom = 1 + z * z / total;
21
+ const center = phat + z * z / (2 * total);
22
+ const margin = z * Math.sqrt(phat * (1 - phat) / total + z * z / (4 * total * total));
23
+ return Math.max(0, (center - margin) / denom);
24
+ }
25
+ /**
26
+ * Normalize approach text so similar phrasing groups. We don't deeply
27
+ * understand the approach — just trim + lowercase + collapse whitespace.
28
+ * Future: cluster via embedding distance (deep mode).
29
+ */
30
+ export function approachKey(text) {
31
+ return text.replace(/\s+/g, " ").trim().toLowerCase();
32
+ }
33
+ export function rankApproaches(records, opts = {}) {
34
+ const now = opts.now ?? Date.now();
35
+ const halfLifeMs = opts.halfLifeMs ?? 30 * 24 * 60 * 60 * 1000;
36
+ const groups = new Map();
37
+ for (const r of records) {
38
+ const key = approachKey(r.approach);
39
+ if (!key)
40
+ continue;
41
+ const g = groups.get(key) ?? {
42
+ approach: r.approach,
43
+ sampleSize: 0,
44
+ successCount: 0,
45
+ partialCount: 0,
46
+ failureCount: 0,
47
+ successRate: 0,
48
+ wilsonLB: 0,
49
+ lastSeenAt: r.at,
50
+ envMatches: opts.env ? 0 : undefined,
51
+ notes: [],
52
+ rankScore: 0,
53
+ };
54
+ g.sampleSize++;
55
+ if (r.outcome === "success")
56
+ g.successCount++;
57
+ else if (r.outcome === "partial")
58
+ g.partialCount++;
59
+ else
60
+ g.failureCount++;
61
+ if (new Date(r.at).getTime() > new Date(g.lastSeenAt).getTime())
62
+ g.lastSeenAt = r.at;
63
+ if (opts.env && r.env && envMatch(opts.env, r.env))
64
+ g.envMatches = (g.envMatches ?? 0) + 1;
65
+ if (r.note && r.note.length > 0 && !g.notes.includes(r.note))
66
+ g.notes.push(r.note);
67
+ groups.set(key, g);
68
+ }
69
+ for (const g of groups.values()) {
70
+ const effectiveSuccess = g.successCount + 0.5 * g.partialCount;
71
+ g.successRate = g.sampleSize === 0 ? 0 : effectiveSuccess / g.sampleSize;
72
+ g.wilsonLB = wilsonLB(effectiveSuccess, g.sampleSize);
73
+ const ageMs = Math.max(0, now - new Date(g.lastSeenAt).getTime());
74
+ const recency = Math.pow(0.5, ageMs / halfLifeMs);
75
+ const envBoost = opts.env && g.envMatches !== undefined && g.sampleSize > 0
76
+ ? 0.5 + 0.5 * (g.envMatches / g.sampleSize)
77
+ : 1.0;
78
+ g.rankScore = +(g.wilsonLB * recency * envBoost).toFixed(4);
79
+ }
80
+ return Array.from(groups.values()).sort((a, b) => b.rankScore - a.rankScore);
81
+ }
82
+ /** True iff target env contains all key/value pairs from required. */
83
+ function envMatch(required, candidate) {
84
+ for (const [k, v] of Object.entries(required)) {
85
+ if (candidate[k] !== v)
86
+ return false;
87
+ }
88
+ return true;
89
+ }
90
+ //# sourceMappingURL=ranking.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ranking.js","sourceRoot":"","sources":["../../src/time_crystal/ranking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAmCH,0DAA0D;AAC1D,SAAS,QAAQ,CAAC,OA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,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;AAC/E,CAAC;AAED,sEAAsE;AACtE,SAAS,QAAQ,CAAC,QAAgC,EAAE,SAAiC;IACnF,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9C,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../../src/truth_gate/claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,KAAK,CA4f9C,CAAC"}
1
+ {"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../../src/truth_gate/claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,KAAK,CAghB9C,CAAC"}