@vibecheck-ai/mcp 24.6.8 → 24.6.11

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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/APITruthEngine-IZRR3NT5-LPFUOMLD.js +9 -0
  3. package/dist/CredentialsEngine-B66ANCBB-HY5ZQTSX.js +9 -0
  4. package/dist/EnvVarEngine-ZFNW2XKP-6HRTZULP.js +9 -0
  5. package/dist/ErrorHandlingEngine-VAHVDVFG-3GDGRN3U.js +11 -0
  6. package/dist/FrameworkPackEngine-RRBJW4MC-KH7WRXXS.js +12 -0
  7. package/dist/GhostRouteEngine-UMYBCOCL-MSZOPVZY.js +9 -0
  8. package/dist/LogicGapEngine-OK5UKZQ5-YGXZDERB.js +11 -0
  9. package/dist/PhantomDepEngine-HQEXAS25-TRVEXBMF.js +10 -0
  10. package/dist/SecurityEngine-MVMRPKLH-BNP7IC46.js +9 -0
  11. package/dist/VersionHallucinationEngine-673DJ26J-BD4SK6JX.js +9 -0
  12. package/dist/chokidar-CI5VJY5M.js +2414 -0
  13. package/dist/chunk-43XAAYST.js +863 -0
  14. package/dist/chunk-5DADZJ3D.js +650 -0
  15. package/dist/chunk-DDTUTWRY.js +605 -0
  16. package/dist/chunk-DGNNNAVK.js +304 -0
  17. package/dist/chunk-F34MHA6A.js +772 -0
  18. package/dist/chunk-FGMVY5QW.js +42 -0
  19. package/dist/chunk-G3FQJC2H.js +1968 -0
  20. package/dist/chunk-J52EUKKW.js +196 -0
  21. package/dist/chunk-JZSHXEYP.js +915 -0
  22. package/dist/chunk-LQSBUKYZ.js +551 -0
  23. package/dist/chunk-MUP4JXOF.js +219 -0
  24. package/dist/chunk-NR36RTVO.js +152 -0
  25. package/dist/chunk-QFDZMUGO.js +213300 -0
  26. package/dist/chunk-QGPX6H6L.js +3044 -0
  27. package/dist/chunk-QYXENOVK.js +499 -0
  28. package/dist/chunk-RNFMO5GH.js +8861 -0
  29. package/dist/chunk-RR5ETBSV.js +66 -0
  30. package/dist/chunk-YWUMPN4Z.js +53 -0
  31. package/dist/dist-HFMJ3GIR.js +1091 -0
  32. package/dist/dist-JUOVMQEA.js +9 -0
  33. package/dist/dist-NXITTS32-O3XLWR6T.js +386 -0
  34. package/dist/dist-OUJKMVTB.js +22 -0
  35. package/dist/fingerprint-NOJ7TDB6-K6SB7LCZ.js +9 -0
  36. package/dist/index.js +4735 -3577
  37. package/dist/semantic-WW6XVII4.js +8544 -0
  38. package/dist/transformers.node-K4WKH4PR.js +45809 -0
  39. package/dist/tree-sitter-AGICL65I.js +1412 -0
  40. package/dist/tree-sitter-H5E7LKR4-MKO3NNLJ.js +9 -0
  41. package/package.json +7 -6
@@ -0,0 +1,196 @@
1
+ import { createRequire } from 'module';
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname, join } from 'path';
4
+ import { readFile, mkdir, writeFile, stat } from 'fs/promises';
5
+
6
+ createRequire(import.meta.url);
7
+ const __filename$1 = fileURLToPath(import.meta.url);
8
+ dirname(__filename$1);
9
+ var PROVENANCE_PATH = ".vibecheck/provenance/edits.jsonl";
10
+ var MS_PER_MIN = 6e4;
11
+ async function readProvenance(rootDir) {
12
+ const p = join(rootDir, PROVENANCE_PATH);
13
+ try {
14
+ const raw = await readFile(p, "utf-8");
15
+ return raw.trim().split("\n").filter(Boolean).map((line) => {
16
+ try {
17
+ return JSON.parse(line);
18
+ } catch {
19
+ return null;
20
+ }
21
+ }).filter((e) => e !== null);
22
+ } catch {
23
+ return [];
24
+ }
25
+ }
26
+ function extractCoEdits(edits, sessionWindowMinutes = 30) {
27
+ const windowMs = sessionWindowMinutes * MS_PER_MIN;
28
+ const pairCounts = /* @__PURE__ */ new Map();
29
+ const sorted = [...edits].sort(
30
+ (a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
31
+ );
32
+ for (let i = 0; i < sorted.length; i++) {
33
+ const t1 = new Date(sorted[i].timestamp).getTime();
34
+ for (let j = i + 1; j < sorted.length; j++) {
35
+ const t2 = new Date(sorted[j].timestamp).getTime();
36
+ if (t2 - t1 > windowMs) break;
37
+ const [f1, f2] = [sorted[i].file, sorted[j].file].sort();
38
+ if (f1 === f2) continue;
39
+ const key = `${f1}\0${f2}`;
40
+ const cur = pairCounts.get(key) ?? { count: 0, lastSeen: 0 };
41
+ pairCounts.set(key, { count: cur.count + 1, lastSeen: Math.max(cur.lastSeen, t2) });
42
+ }
43
+ }
44
+ const pairs = [];
45
+ for (const [key, { count, lastSeen }] of pairCounts) {
46
+ const [f1, f2] = key.split("\0");
47
+ const weight = Math.min(1, count / 10);
48
+ pairs.push({ files: [f1, f2], weight, count, lastSeen: new Date(lastSeen).toISOString() });
49
+ }
50
+ return pairs.sort((a, b) => b.count - a.count);
51
+ }
52
+ function extractSequences(edits, sessionWindowMinutes = 30) {
53
+ const windowMs = sessionWindowMinutes * MS_PER_MIN;
54
+ const sequenceCounts = /* @__PURE__ */ new Map();
55
+ const sorted = [...edits].sort(
56
+ (a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
57
+ );
58
+ let sessionFiles = [];
59
+ let sessionLastTs = 0;
60
+ for (const e of sorted) {
61
+ const t = new Date(e.timestamp).getTime();
62
+ if (sessionFiles.length > 0 && t - sessionLastTs > windowMs) {
63
+ if (sessionFiles.length >= 3) {
64
+ const key = sessionFiles.join("\0");
65
+ const cur = sequenceCounts.get(key) ?? { count: 0 };
66
+ sequenceCounts.set(key, { count: cur.count + 1 });
67
+ }
68
+ sessionFiles = [];
69
+ }
70
+ if (!sessionFiles.includes(e.file)) {
71
+ sessionFiles.push(e.file);
72
+ }
73
+ sessionLastTs = t;
74
+ }
75
+ if (sessionFiles.length >= 3) {
76
+ const key = sessionFiles.join("\0");
77
+ const cur = sequenceCounts.get(key) ?? { count: 0 };
78
+ sequenceCounts.set(key, { count: cur.count + 1 });
79
+ }
80
+ const sequences = [];
81
+ for (const [key, { count }] of sequenceCounts) {
82
+ const files = key.split("\0");
83
+ const weight = Math.min(1, count / 5);
84
+ sequences.push({ files, weight, count });
85
+ }
86
+ return sequences.sort((a, b) => b.count - a.count);
87
+ }
88
+ var LEARNED_FILE = "learned.json";
89
+ var STALE_MS = 60 * 60 * 1e3;
90
+ function computeOutcomeScores(edits) {
91
+ const byFile = /* @__PURE__ */ new Map();
92
+ const isAiEdit = (e) => e.editSource === "ai-completion" || e.editSource === "ai-chat-insert";
93
+ for (const e of edits) {
94
+ const cur = byFile.get(e.file) ?? { total: 0, ai: 0 };
95
+ cur.total++;
96
+ if (isAiEdit(e)) cur.ai++;
97
+ byFile.set(e.file, cur);
98
+ }
99
+ const scores = {};
100
+ for (const [file, { total, ai }] of byFile) {
101
+ scores[file] = total > 0 ? 0.5 + 0.5 * (ai / total) : 0.5;
102
+ }
103
+ return scores;
104
+ }
105
+ async function evolve(rootPath) {
106
+ const existing = await loadLearned(rootPath);
107
+ const edits = await readProvenance(rootPath);
108
+ const coEdits = extractCoEdits(edits, 30);
109
+ const sequences = extractSequences(edits, 30);
110
+ const outcomeScores = computeOutcomeScores(edits);
111
+ const data = {
112
+ version: 1,
113
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
114
+ coEdits,
115
+ sequences,
116
+ outcomeScores,
117
+ explicitFeedback: existing?.explicitFeedback ?? []
118
+ };
119
+ const outDir = join(rootPath, ".vibecheck", "context-evolution");
120
+ await mkdir(outDir, { recursive: true });
121
+ await writeFile(join(outDir, LEARNED_FILE), JSON.stringify(data, null, 2), "utf-8");
122
+ return data;
123
+ }
124
+ async function loadLearned(rootPath) {
125
+ const p = join(rootPath, ".vibecheck", "context-evolution", LEARNED_FILE);
126
+ try {
127
+ const raw = await readFile(p, "utf-8");
128
+ return JSON.parse(raw);
129
+ } catch {
130
+ return null;
131
+ }
132
+ }
133
+ async function loadLearnedOrEvolveIfStale(rootPath, maxAgeMs = STALE_MS) {
134
+ const p = join(rootPath, ".vibecheck", "context-evolution", LEARNED_FILE);
135
+ try {
136
+ const st = await stat(p);
137
+ const age = Date.now() - st.mtimeMs;
138
+ if (age > maxAgeMs) {
139
+ return evolve(rootPath);
140
+ }
141
+ return loadLearned(rootPath);
142
+ } catch {
143
+ return evolve(rootPath);
144
+ }
145
+ }
146
+ async function getBoostedFiles(rootPath, focusedFile) {
147
+ const learned = await loadLearnedOrEvolveIfStale(rootPath);
148
+ if (!learned) return [];
149
+ const results = [];
150
+ for (const pair of learned.coEdits) {
151
+ if (pair.files[0] === focusedFile) results.push({ file: pair.files[1], weight: pair.weight });
152
+ else if (pair.files[1] === focusedFile) results.push({ file: pair.files[0], weight: pair.weight });
153
+ }
154
+ return results.sort((a, b) => b.weight - a.weight);
155
+ }
156
+ async function getSequentialFiles(rootPath, focusedFile) {
157
+ const learned = await loadLearnedOrEvolveIfStale(rootPath);
158
+ if (!learned || learned.sequences.length === 0) return [];
159
+ const scored = /* @__PURE__ */ new Map();
160
+ for (const seq of learned.sequences) {
161
+ const idx = seq.files.indexOf(focusedFile);
162
+ if (idx < 0 || idx >= seq.files.length - 1) continue;
163
+ for (let i = idx + 1; i < seq.files.length; i++) {
164
+ const f = seq.files[i];
165
+ scored.set(f, Math.max(scored.get(f) ?? 0, seq.weight));
166
+ }
167
+ }
168
+ return [...scored.entries()].map(([file, weight]) => ({ file, weight })).sort((a, b) => b.weight - a.weight);
169
+ }
170
+ async function getOutcomeBoost(rootPath, file) {
171
+ const learned = await loadLearned(rootPath);
172
+ if (!learned) return 0.5;
173
+ return learned.outcomeScores[file] ?? 0.5;
174
+ }
175
+ async function recordFeedback(rootPath, file, outcome) {
176
+ const learned = await loadLearned(rootPath);
177
+ const outDir = join(rootPath, ".vibecheck", "context-evolution");
178
+ await mkdir(outDir, { recursive: true });
179
+ const data = learned ?? {
180
+ version: 1,
181
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
182
+ coEdits: [],
183
+ sequences: [],
184
+ outcomeScores: {},
185
+ explicitFeedback: []
186
+ };
187
+ data.explicitFeedback.push({
188
+ file,
189
+ outcome,
190
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
191
+ });
192
+ await writeFile(join(outDir, LEARNED_FILE), JSON.stringify(data, null, 2), "utf-8");
193
+ }
194
+ var VERSION = "0.1.0";
195
+
196
+ export { VERSION, evolve, extractCoEdits, extractSequences, getBoostedFiles, getOutcomeBoost, getSequentialFiles, loadLearned, loadLearnedOrEvolveIfStale, readProvenance, recordFeedback };