@vibecheck-ai/mcp 24.6.8 → 24.6.9

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 (2) hide show
  1. package/dist/index.js +552 -152
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import { createRequire } from 'module';
3
3
  import { fileURLToPath, pathToFileURL } from 'url';
4
4
  import * as path2 from 'path';
5
- import path2__default, { dirname, win32, posix, join, extname, resolve, normalize } from 'path';
5
+ import path2__default, { dirname, win32, posix, join, extname, resolve, basename, normalize } from 'path';
6
6
  import { recordFeedback, evolve } from './chunk-J52EUKKW.js';
7
7
  import { require_braces, require_picomatch, require_utils, require_glob_parent } from './chunk-QGPX6H6L.js';
8
- import { external_exports, SCAN_ENGINE_FOCUS_PRESET_NAMES, FEATURE_NAMES, DAILY_SCAN_LIMIT_UPGRADE_URL, formatDailyScanLimitMessage, dashboardFindingUrl, gateCanonicalScanReportFindings, getTrustScoreStatus, formatTrustScoreMcp, buildGatedScanResponse, formatFindingSeverityBreakdown, ENGINE_FOCUS_PRESETS, computeTrustScore, normalizeCanonicalScanReport, planHasApiSurface, canAccessFeature, getMinPlanForApiSurface, buildCliUpgradeBlock, getMinimumPlanForFeature, getQuotas, normalizePlanId, fetchCanonicalAccess } from './chunk-VFEPD4LT.js';
8
+ import { external_exports, SCAN_ENGINE_FOCUS_PRESET_NAMES, FEATURE_NAMES, DAILY_SCAN_LIMIT_UPGRADE_URL, formatDailyScanLimitMessage, dashboardFindingUrl, gateCanonicalScanReportFindings, getTrustScoreStatus, formatTrustScoreMcp, buildGatedScanResponse, formatFindingSeverityBreakdown, ENGINE_FOCUS_PRESETS, computeTrustScore, normalizeCanonicalScanReport, planHasApiSurface, canAccessFeature, getMinPlanForApiSurface, buildCliUpgradeBlock, getMinimumPlanForFeature, getQuotas, normalizePlanId, fetchCanonicalAccess } from './chunk-MGNS53UI.js';
9
9
  import './chunk-MUP4JXOF.js';
10
10
  import './chunk-DDTUTWRY.js';
11
11
  import { require_typescript } from './chunk-FRK2XZX5.js';
@@ -21,7 +21,7 @@ import './chunk-43XAAYST.js';
21
21
  import './chunk-F34MHA6A.js';
22
22
  import { __commonJS, __require, __toESM } from './chunk-YWUMPN4Z.js';
23
23
  import * as fs6 from 'fs';
24
- import { realpathSync as realpathSync$1, readlinkSync, readdirSync, readdir as readdir$1, lstatSync, mkdirSync, accessSync } from 'fs';
24
+ import { realpathSync as realpathSync$1, readlinkSync, readdirSync, readdir as readdir$1, lstatSync, existsSync, mkdirSync, accessSync, statSync, readFileSync } from 'fs';
25
25
  import { execFile, spawn } from 'child_process';
26
26
  import { promisify } from 'util';
27
27
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
@@ -35,9 +35,10 @@ import { createHash } from 'crypto';
35
35
  import { Buffer as Buffer$1 } from 'buffer';
36
36
  import { EventEmitter } from 'events';
37
37
  import Database from 'better-sqlite3';
38
+ import * as os2 from 'os';
39
+ import { homedir } from 'os';
38
40
  import Stream from 'stream';
39
41
  import { StringDecoder } from 'string_decoder';
40
- import * as os2 from 'os';
41
42
  import { x402Gate, coinbaseFacilitatorVerifier } from '@vibecheck/x402-gate';
42
43
 
43
44
  createRequire(import.meta.url);
@@ -112,7 +113,7 @@ var require_path = __commonJS({
112
113
  Object.defineProperty(exports$1, "__esModule", { value: true });
113
114
  exports$1.convertPosixPathToPattern = exports$1.convertWindowsPathToPattern = exports$1.convertPathToPattern = exports$1.escapePosixPath = exports$1.escapeWindowsPath = exports$1.escape = exports$1.removeLeadingDotSegment = exports$1.makeAbsolute = exports$1.unixify = void 0;
114
115
  var os3 = __require("os");
115
- var path12 = __require("path");
116
+ var path13 = __require("path");
116
117
  var IS_WINDOWS_PLATFORM = os3.platform() === "win32";
117
118
  var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
118
119
  var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
@@ -124,7 +125,7 @@ var require_path = __commonJS({
124
125
  }
125
126
  exports$1.unixify = unixify;
126
127
  function makeAbsolute(cwd, filepath) {
127
- return path12.resolve(cwd, filepath);
128
+ return path13.resolve(cwd, filepath);
128
129
  }
129
130
  exports$1.makeAbsolute = makeAbsolute;
130
131
  function removeLeadingDotSegment(entry) {
@@ -323,7 +324,7 @@ var require_pattern = __commonJS({
323
324
  "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/pattern.js"(exports$1) {
324
325
  Object.defineProperty(exports$1, "__esModule", { value: true });
325
326
  exports$1.isAbsolute = exports$1.partitionAbsoluteAndRelative = exports$1.removeDuplicateSlashes = exports$1.matchAny = exports$1.convertPatternsToRe = exports$1.makeRe = exports$1.getPatternParts = exports$1.expandBraceExpansion = exports$1.expandPatternsWithBraceExpansion = exports$1.isAffectDepthOfReadingPattern = exports$1.endsWithSlashGlobStar = exports$1.hasGlobStar = exports$1.getBaseDirectory = exports$1.isPatternRelatedToParentDirectory = exports$1.getPatternsOutsideCurrentDirectory = exports$1.getPatternsInsideCurrentDirectory = exports$1.getPositivePatterns = exports$1.getNegativePatterns = exports$1.isPositivePattern = exports$1.isNegativePattern = exports$1.convertToNegativePattern = exports$1.convertToPositivePattern = exports$1.isDynamicPattern = exports$1.isStaticPattern = void 0;
326
- var path12 = __require("path");
327
+ var path13 = __require("path");
327
328
  var globParent = require_glob_parent();
328
329
  var micromatch = require_micromatch();
329
330
  var GLOBSTAR2 = "**";
@@ -418,8 +419,8 @@ var require_pattern = __commonJS({
418
419
  }
419
420
  exports$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
420
421
  function isAffectDepthOfReadingPattern(pattern) {
421
- const basename7 = path12.basename(pattern);
422
- return endsWithSlashGlobStar(pattern) || isStaticPattern(basename7);
422
+ const basename8 = path13.basename(pattern);
423
+ return endsWithSlashGlobStar(pattern) || isStaticPattern(basename8);
423
424
  }
424
425
  exports$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
425
426
  function expandPatternsWithBraceExpansion(patterns) {
@@ -476,7 +477,7 @@ var require_pattern = __commonJS({
476
477
  }
477
478
  exports$1.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
478
479
  function isAbsolute5(pattern) {
479
- return path12.isAbsolute(pattern);
480
+ return path13.isAbsolute(pattern);
480
481
  }
481
482
  exports$1.isAbsolute = isAbsolute5;
482
483
  }
@@ -649,8 +650,8 @@ var require_utils2 = __commonJS({
649
650
  exports$1.errno = errno;
650
651
  var fs7 = require_fs();
651
652
  exports$1.fs = fs7;
652
- var path12 = require_path();
653
- exports$1.path = path12;
653
+ var path13 = require_path();
654
+ exports$1.path = path13;
654
655
  var pattern = require_pattern();
655
656
  exports$1.pattern = pattern;
656
657
  var stream2 = require_stream();
@@ -760,8 +761,8 @@ var require_async = __commonJS({
760
761
  "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.js"(exports$1) {
761
762
  Object.defineProperty(exports$1, "__esModule", { value: true });
762
763
  exports$1.read = void 0;
763
- function read(path12, settings, callback) {
764
- settings.fs.lstat(path12, (lstatError, lstat2) => {
764
+ function read(path13, settings, callback) {
765
+ settings.fs.lstat(path13, (lstatError, lstat2) => {
765
766
  if (lstatError !== null) {
766
767
  callFailureCallback(callback, lstatError);
767
768
  return;
@@ -770,7 +771,7 @@ var require_async = __commonJS({
770
771
  callSuccessCallback(callback, lstat2);
771
772
  return;
772
773
  }
773
- settings.fs.stat(path12, (statError, stat3) => {
774
+ settings.fs.stat(path13, (statError, stat3) => {
774
775
  if (statError !== null) {
775
776
  if (settings.throwErrorOnBrokenSymbolicLink) {
776
777
  callFailureCallback(callback, statError);
@@ -801,13 +802,13 @@ var require_sync = __commonJS({
801
802
  "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports$1) {
802
803
  Object.defineProperty(exports$1, "__esModule", { value: true });
803
804
  exports$1.read = void 0;
804
- function read(path12, settings) {
805
- const lstat2 = settings.fs.lstatSync(path12);
805
+ function read(path13, settings) {
806
+ const lstat2 = settings.fs.lstatSync(path13);
806
807
  if (!lstat2.isSymbolicLink() || !settings.followSymbolicLink) {
807
808
  return lstat2;
808
809
  }
809
810
  try {
810
- const stat3 = settings.fs.statSync(path12);
811
+ const stat3 = settings.fs.statSync(path13);
811
812
  if (settings.markSymbolicLink) {
812
813
  stat3.isSymbolicLink = () => true;
813
814
  }
@@ -875,19 +876,19 @@ var require_out = __commonJS({
875
876
  var sync2 = require_sync();
876
877
  var settings_1 = require_settings();
877
878
  exports$1.Settings = settings_1.default;
878
- function stat3(path12, optionsOrSettingsOrCallback, callback) {
879
+ function stat3(path13, optionsOrSettingsOrCallback, callback) {
879
880
  if (typeof optionsOrSettingsOrCallback === "function") {
880
- async.read(path12, getSettings(), optionsOrSettingsOrCallback);
881
+ async.read(path13, getSettings(), optionsOrSettingsOrCallback);
881
882
  return;
882
883
  }
883
- async.read(path12, getSettings(optionsOrSettingsOrCallback), callback);
884
+ async.read(path13, getSettings(optionsOrSettingsOrCallback), callback);
884
885
  }
885
886
  exports$1.stat = stat3;
886
- function statSync2(path12, optionsOrSettings) {
887
+ function statSync3(path13, optionsOrSettings) {
887
888
  const settings = getSettings(optionsOrSettings);
888
- return sync2.read(path12, settings);
889
+ return sync2.read(path13, settings);
889
890
  }
890
- exports$1.statSync = statSync2;
891
+ exports$1.statSync = statSync3;
891
892
  function getSettings(settingsOrOptions = {}) {
892
893
  if (settingsOrOptions instanceof settings_1.default) {
893
894
  return settingsOrOptions;
@@ -1096,16 +1097,16 @@ var require_async2 = __commonJS({
1096
1097
  return;
1097
1098
  }
1098
1099
  const tasks = names.map((name) => {
1099
- const path12 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
1100
+ const path13 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
1100
1101
  return (done) => {
1101
- fsStat.stat(path12, settings.fsStatSettings, (error, stats) => {
1102
+ fsStat.stat(path13, settings.fsStatSettings, (error, stats) => {
1102
1103
  if (error !== null) {
1103
1104
  done(error);
1104
1105
  return;
1105
1106
  }
1106
1107
  const entry = {
1107
1108
  name,
1108
- path: path12,
1109
+ path: path13,
1109
1110
  dirent: utils.fs.createDirentFromStats(name, stats)
1110
1111
  };
1111
1112
  if (settings.stats) {
@@ -1220,7 +1221,7 @@ var require_fs4 = __commonJS({
1220
1221
  var require_settings2 = __commonJS({
1221
1222
  "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js"(exports$1) {
1222
1223
  Object.defineProperty(exports$1, "__esModule", { value: true });
1223
- var path12 = __require("path");
1224
+ var path13 = __require("path");
1224
1225
  var fsStat = require_out();
1225
1226
  var fs7 = require_fs4();
1226
1227
  var Settings = class {
@@ -1228,7 +1229,7 @@ var require_settings2 = __commonJS({
1228
1229
  this._options = _options;
1229
1230
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
1230
1231
  this.fs = fs7.createFileSystemAdapter(this._options.fs);
1231
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path12.sep);
1232
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path13.sep);
1232
1233
  this.stats = this._getValue(this._options.stats, false);
1233
1234
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
1234
1235
  this.fsStatSettings = new fsStat.Settings({
@@ -1254,17 +1255,17 @@ var require_out2 = __commonJS({
1254
1255
  var sync2 = require_sync2();
1255
1256
  var settings_1 = require_settings2();
1256
1257
  exports$1.Settings = settings_1.default;
1257
- function scandir(path12, optionsOrSettingsOrCallback, callback) {
1258
+ function scandir(path13, optionsOrSettingsOrCallback, callback) {
1258
1259
  if (typeof optionsOrSettingsOrCallback === "function") {
1259
- async.read(path12, getSettings(), optionsOrSettingsOrCallback);
1260
+ async.read(path13, getSettings(), optionsOrSettingsOrCallback);
1260
1261
  return;
1261
1262
  }
1262
- async.read(path12, getSettings(optionsOrSettingsOrCallback), callback);
1263
+ async.read(path13, getSettings(optionsOrSettingsOrCallback), callback);
1263
1264
  }
1264
1265
  exports$1.scandir = scandir;
1265
- function scandirSync(path12, optionsOrSettings) {
1266
+ function scandirSync(path13, optionsOrSettings) {
1266
1267
  const settings = getSettings(optionsOrSettings);
1267
- return sync2.read(path12, settings);
1268
+ return sync2.read(path13, settings);
1268
1269
  }
1269
1270
  exports$1.scandirSync = scandirSync;
1270
1271
  function getSettings(settingsOrOptions = {}) {
@@ -1541,41 +1542,41 @@ var require_queue = __commonJS({
1541
1542
  queue.drained = drained;
1542
1543
  return queue;
1543
1544
  function push(value) {
1544
- var p = new Promise(function(resolve4, reject) {
1545
+ var p = new Promise(function(resolve5, reject) {
1545
1546
  pushCb(value, function(err, result) {
1546
1547
  if (err) {
1547
1548
  reject(err);
1548
1549
  return;
1549
1550
  }
1550
- resolve4(result);
1551
+ resolve5(result);
1551
1552
  });
1552
1553
  });
1553
1554
  p.catch(noop);
1554
1555
  return p;
1555
1556
  }
1556
1557
  function unshift(value) {
1557
- var p = new Promise(function(resolve4, reject) {
1558
+ var p = new Promise(function(resolve5, reject) {
1558
1559
  unshiftCb(value, function(err, result) {
1559
1560
  if (err) {
1560
1561
  reject(err);
1561
1562
  return;
1562
1563
  }
1563
- resolve4(result);
1564
+ resolve5(result);
1564
1565
  });
1565
1566
  });
1566
1567
  p.catch(noop);
1567
1568
  return p;
1568
1569
  }
1569
1570
  function drained() {
1570
- var p = new Promise(function(resolve4) {
1571
+ var p = new Promise(function(resolve5) {
1571
1572
  process.nextTick(function() {
1572
1573
  if (queue.idle()) {
1573
- resolve4();
1574
+ resolve5();
1574
1575
  } else {
1575
1576
  var previousDrain = queue.drain;
1576
1577
  queue.drain = function() {
1577
1578
  if (typeof previousDrain === "function") previousDrain();
1578
- resolve4();
1579
+ resolve5();
1579
1580
  queue.drain = previousDrain;
1580
1581
  };
1581
1582
  }
@@ -1901,7 +1902,7 @@ var require_sync4 = __commonJS({
1901
1902
  var require_settings3 = __commonJS({
1902
1903
  "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js"(exports$1) {
1903
1904
  Object.defineProperty(exports$1, "__esModule", { value: true });
1904
- var path12 = __require("path");
1905
+ var path13 = __require("path");
1905
1906
  var fsScandir = require_out2();
1906
1907
  var Settings = class {
1907
1908
  constructor(_options = {}) {
@@ -1911,7 +1912,7 @@ var require_settings3 = __commonJS({
1911
1912
  this.deepFilter = this._getValue(this._options.deepFilter, null);
1912
1913
  this.entryFilter = this._getValue(this._options.entryFilter, null);
1913
1914
  this.errorFilter = this._getValue(this._options.errorFilter, null);
1914
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path12.sep);
1915
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path13.sep);
1915
1916
  this.fsScandirSettings = new fsScandir.Settings({
1916
1917
  followSymbolicLinks: this._options.followSymbolicLinks,
1917
1918
  fs: this._options.fs,
@@ -1971,7 +1972,7 @@ var require_out3 = __commonJS({
1971
1972
  var require_reader2 = __commonJS({
1972
1973
  "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/reader.js"(exports$1) {
1973
1974
  Object.defineProperty(exports$1, "__esModule", { value: true });
1974
- var path12 = __require("path");
1975
+ var path13 = __require("path");
1975
1976
  var fsStat = require_out();
1976
1977
  var utils = require_utils2();
1977
1978
  var Reader = class {
@@ -1984,7 +1985,7 @@ var require_reader2 = __commonJS({
1984
1985
  });
1985
1986
  }
1986
1987
  _getFullEntryPath(filepath) {
1987
- return path12.resolve(this._settings.cwd, filepath);
1988
+ return path13.resolve(this._settings.cwd, filepath);
1988
1989
  }
1989
1990
  _makeEntry(stats, pattern) {
1990
1991
  const entry = {
@@ -2050,9 +2051,9 @@ var require_stream3 = __commonJS({
2050
2051
  });
2051
2052
  }
2052
2053
  _getStat(filepath) {
2053
- return new Promise((resolve4, reject) => {
2054
+ return new Promise((resolve5, reject) => {
2054
2055
  this._stat(filepath, this._fsStatSettings, (error, stats) => {
2055
- return error === null ? resolve4(stats) : reject(error);
2056
+ return error === null ? resolve5(stats) : reject(error);
2056
2057
  });
2057
2058
  });
2058
2059
  }
@@ -2075,10 +2076,10 @@ var require_async5 = __commonJS({
2075
2076
  this._readerStream = new stream_1.default(this._settings);
2076
2077
  }
2077
2078
  dynamic(root, options) {
2078
- return new Promise((resolve4, reject) => {
2079
+ return new Promise((resolve5, reject) => {
2079
2080
  this._walkAsync(root, options, (error, entries) => {
2080
2081
  if (error === null) {
2081
- resolve4(entries);
2082
+ resolve5(entries);
2082
2083
  } else {
2083
2084
  reject(error);
2084
2085
  }
@@ -2088,10 +2089,10 @@ var require_async5 = __commonJS({
2088
2089
  async static(patterns, options) {
2089
2090
  const entries = [];
2090
2091
  const stream2 = this._readerStream.static(patterns, options);
2091
- return new Promise((resolve4, reject) => {
2092
+ return new Promise((resolve5, reject) => {
2092
2093
  stream2.once("error", reject);
2093
2094
  stream2.on("data", (entry) => entries.push(entry));
2094
- stream2.once("end", () => resolve4(entries));
2095
+ stream2.once("end", () => resolve5(entries));
2095
2096
  });
2096
2097
  }
2097
2098
  };
@@ -2391,7 +2392,7 @@ var require_entry2 = __commonJS({
2391
2392
  var require_provider = __commonJS({
2392
2393
  "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/provider.js"(exports$1) {
2393
2394
  Object.defineProperty(exports$1, "__esModule", { value: true });
2394
- var path12 = __require("path");
2395
+ var path13 = __require("path");
2395
2396
  var deep_1 = require_deep();
2396
2397
  var entry_1 = require_entry();
2397
2398
  var error_1 = require_error();
@@ -2405,7 +2406,7 @@ var require_provider = __commonJS({
2405
2406
  this.entryTransformer = new entry_2.default(this._settings);
2406
2407
  }
2407
2408
  _getRootDirectory(task) {
2408
- return path12.resolve(this._settings.cwd, task.base);
2409
+ return path13.resolve(this._settings.cwd, task.base);
2409
2410
  }
2410
2411
  _getReaderOptions(task) {
2411
2412
  const basePath = task.base === "." ? "" : task.base;
@@ -3516,10 +3517,10 @@ var require_src2 = __commonJS({
3516
3517
  var fs_1 = __require("fs");
3517
3518
  var debug_1 = __importDefault(require_src());
3518
3519
  var log = debug_1.default("@kwsites/file-exists");
3519
- function check(path12, isFile, isDirectory) {
3520
- log(`checking %s`, path12);
3520
+ function check(path13, isFile, isDirectory) {
3521
+ log(`checking %s`, path13);
3521
3522
  try {
3522
- const stat3 = fs_1.statSync(path12);
3523
+ const stat3 = fs_1.statSync(path13);
3523
3524
  if (stat3.isFile() && isFile) {
3524
3525
  log(`[OK] path represents a file`);
3525
3526
  return true;
@@ -3539,8 +3540,8 @@ var require_src2 = __commonJS({
3539
3540
  throw e;
3540
3541
  }
3541
3542
  }
3542
- function exists2(path12, type = exports$1.READABLE) {
3543
- return check(path12, (type & exports$1.FILE) > 0, (type & exports$1.FOLDER) > 0);
3543
+ function exists2(path13, type = exports$1.READABLE) {
3544
+ return check(path13, (type & exports$1.FILE) > 0, (type & exports$1.FOLDER) > 0);
3544
3545
  }
3545
3546
  exports$1.exists = exists2;
3546
3547
  exports$1.FILE = 1;
@@ -7901,8 +7902,8 @@ function pathspec(...paths) {
7901
7902
  cache.set(key, paths);
7902
7903
  return key;
7903
7904
  }
7904
- function isPathSpec(path12) {
7905
- return path12 instanceof String && cache.has(path12);
7905
+ function isPathSpec(path13) {
7906
+ return path13 instanceof String && cache.has(path13);
7906
7907
  }
7907
7908
  function toPaths(pathSpec) {
7908
7909
  return cache.get(pathSpec) || [];
@@ -7987,8 +7988,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
7987
7988
  function forEachLineWithContent(input, callback) {
7988
7989
  return toLinesWithContent(input, true).map((line) => callback(line));
7989
7990
  }
7990
- function folderExists(path12) {
7991
- return (0, import_file_exists.exists)(path12, import_file_exists.FOLDER);
7991
+ function folderExists(path13) {
7992
+ return (0, import_file_exists.exists)(path13, import_file_exists.FOLDER);
7992
7993
  }
7993
7994
  function append(target, item) {
7994
7995
  if (Array.isArray(target)) {
@@ -8383,8 +8384,8 @@ function checkIsRepoRootTask() {
8383
8384
  commands,
8384
8385
  format: "utf-8",
8385
8386
  onError,
8386
- parser(path12) {
8387
- return /^\.(git)?$/.test(path12.trim());
8387
+ parser(path13) {
8388
+ return /^\.(git)?$/.test(path13.trim());
8388
8389
  }
8389
8390
  };
8390
8391
  }
@@ -8811,11 +8812,11 @@ function parseGrep(grep) {
8811
8812
  const paths = /* @__PURE__ */ new Set();
8812
8813
  const results = {};
8813
8814
  forEachLineWithContent(grep, (input) => {
8814
- const [path12, line, preview] = input.split(NULL);
8815
- paths.add(path12);
8816
- (results[path12] = results[path12] || []).push({
8815
+ const [path13, line, preview] = input.split(NULL);
8816
+ paths.add(path13);
8817
+ (results[path13] = results[path13] || []).push({
8817
8818
  line: asNumber(line),
8818
- path: path12,
8819
+ path: path13,
8819
8820
  preview
8820
8821
  });
8821
8822
  });
@@ -9566,14 +9567,14 @@ var init_hash_object = __esm({
9566
9567
  init_task();
9567
9568
  }
9568
9569
  });
9569
- function parseInit(bare, path12, text) {
9570
+ function parseInit(bare, path13, text) {
9570
9571
  const response = String(text).trim();
9571
9572
  let result;
9572
9573
  if (result = initResponseRegex.exec(response)) {
9573
- return new InitSummary(bare, path12, false, result[1]);
9574
+ return new InitSummary(bare, path13, false, result[1]);
9574
9575
  }
9575
9576
  if (result = reInitResponseRegex.exec(response)) {
9576
- return new InitSummary(bare, path12, true, result[1]);
9577
+ return new InitSummary(bare, path13, true, result[1]);
9577
9578
  }
9578
9579
  let gitDir = "";
9579
9580
  const tokens = response.split(" ");
@@ -9584,7 +9585,7 @@ function parseInit(bare, path12, text) {
9584
9585
  break;
9585
9586
  }
9586
9587
  }
9587
- return new InitSummary(bare, path12, /^re/i.test(response), gitDir);
9588
+ return new InitSummary(bare, path13, /^re/i.test(response), gitDir);
9588
9589
  }
9589
9590
  var InitSummary;
9590
9591
  var initResponseRegex;
@@ -9592,9 +9593,9 @@ var reInitResponseRegex;
9592
9593
  var init_InitSummary = __esm({
9593
9594
  "src/lib/responses/InitSummary.ts"() {
9594
9595
  InitSummary = class {
9595
- constructor(bare, path12, existing, gitDir) {
9596
+ constructor(bare, path13, existing, gitDir) {
9596
9597
  this.bare = bare;
9597
- this.path = path12;
9598
+ this.path = path13;
9598
9599
  this.existing = existing;
9599
9600
  this.gitDir = gitDir;
9600
9601
  }
@@ -9606,7 +9607,7 @@ var init_InitSummary = __esm({
9606
9607
  function hasBareCommand(command) {
9607
9608
  return command.includes(bareCommand);
9608
9609
  }
9609
- function initTask(bare = false, path12, customArgs) {
9610
+ function initTask(bare = false, path13, customArgs) {
9610
9611
  const commands = ["init", ...customArgs];
9611
9612
  if (bare && !hasBareCommand(commands)) {
9612
9613
  commands.splice(1, 0, bareCommand);
@@ -9615,7 +9616,7 @@ function initTask(bare = false, path12, customArgs) {
9615
9616
  commands,
9616
9617
  format: "utf-8",
9617
9618
  parser(text) {
9618
- return parseInit(commands.includes("--bare"), path12, text);
9619
+ return parseInit(commands.includes("--bare"), path13, text);
9619
9620
  }
9620
9621
  };
9621
9622
  }
@@ -10413,12 +10414,12 @@ var init_FileStatusSummary = __esm({
10413
10414
  "src/lib/responses/FileStatusSummary.ts"() {
10414
10415
  fromPathRegex = /^(.+)\0(.+)$/;
10415
10416
  FileStatusSummary = class {
10416
- constructor(path12, index, working_dir) {
10417
- this.path = path12;
10417
+ constructor(path13, index, working_dir) {
10418
+ this.path = path13;
10418
10419
  this.index = index;
10419
10420
  this.working_dir = working_dir;
10420
10421
  if (index === "R" || working_dir === "R") {
10421
- const detail = fromPathRegex.exec(path12) || [null, path12, path12];
10422
+ const detail = fromPathRegex.exec(path13) || [null, path13, path13];
10422
10423
  this.from = detail[2] || "";
10423
10424
  this.path = detail[1] || "";
10424
10425
  }
@@ -10449,14 +10450,14 @@ function splitLine(result, lineStr) {
10449
10450
  default:
10450
10451
  return;
10451
10452
  }
10452
- function data(index, workingDir, path12) {
10453
+ function data(index, workingDir, path13) {
10453
10454
  const raw = `${index}${workingDir}`;
10454
10455
  const handler = parsers6.get(raw);
10455
10456
  if (handler) {
10456
- handler(result, path12);
10457
+ handler(result, path13);
10457
10458
  }
10458
10459
  if (raw !== "##" && raw !== "!!") {
10459
- result.files.push(new FileStatusSummary(path12, index, workingDir));
10460
+ result.files.push(new FileStatusSummary(path13, index, workingDir));
10460
10461
  }
10461
10462
  }
10462
10463
  }
@@ -10803,9 +10804,9 @@ var init_simple_git_api = __esm({
10803
10804
  next
10804
10805
  );
10805
10806
  }
10806
- hashObject(path12, write) {
10807
+ hashObject(path13, write) {
10807
10808
  return this._runTask(
10808
- hashObjectTask(path12, write === true),
10809
+ hashObjectTask(path13, write === true),
10809
10810
  trailingFunctionArgument(arguments)
10810
10811
  );
10811
10812
  }
@@ -11152,8 +11153,8 @@ var init_branch = __esm({
11152
11153
  }
11153
11154
  });
11154
11155
  function toPath(input) {
11155
- const path12 = input.trim().replace(/^["']|["']$/g, "");
11156
- return path12 && normalize(path12);
11156
+ const path13 = input.trim().replace(/^["']|["']$/g, "");
11157
+ return path13 && normalize(path13);
11157
11158
  }
11158
11159
  var parseCheckIgnore;
11159
11160
  var init_CheckIgnore = __esm({
@@ -11428,8 +11429,8 @@ __export(sub_module_exports, {
11428
11429
  subModuleTask: () => subModuleTask,
11429
11430
  updateSubModuleTask: () => updateSubModuleTask
11430
11431
  });
11431
- function addSubModuleTask(repo, path12) {
11432
- return subModuleTask(["add", repo, path12]);
11432
+ function addSubModuleTask(repo, path13) {
11433
+ return subModuleTask(["add", repo, path13]);
11433
11434
  }
11434
11435
  function initSubModuleTask(customArgs) {
11435
11436
  return subModuleTask(["init", ...customArgs]);
@@ -11739,8 +11740,8 @@ var require_git = __commonJS2({
11739
11740
  }
11740
11741
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
11741
11742
  };
11742
- Git2.prototype.submoduleAdd = function(repo, path12, then) {
11743
- return this._runTask(addSubModuleTask2(repo, path12), trailingFunctionArgument2(arguments));
11743
+ Git2.prototype.submoduleAdd = function(repo, path13, then) {
11744
+ return this._runTask(addSubModuleTask2(repo, path13), trailingFunctionArgument2(arguments));
11744
11745
  };
11745
11746
  Git2.prototype.submoduleUpdate = function(args, then) {
11746
11747
  return this._runTask(
@@ -15142,7 +15143,7 @@ rules:
15142
15143
  match: "src/repositories/**"
15143
15144
  `;
15144
15145
 
15145
- // ../context-engine/dist/chunk-OAPIWXZ3.js
15146
+ // ../context-engine/dist/chunk-DANXPKDJ.js
15146
15147
  var import_fast_glob2 = __toESM(require_out4(), 1);
15147
15148
  var SCHEMA_VERSION = 1;
15148
15149
  var PersistentIndex = class {
@@ -15454,24 +15455,24 @@ var PersistentIndex = class {
15454
15455
  /**
15455
15456
  * Store a chunk embedding (file-level, function-level, etc.)
15456
15457
  */
15457
- storeEmbedding(path12, chunkId, chunkType, contentHash, vector, metadata) {
15458
+ storeEmbedding(path13, chunkId, chunkType, contentHash, vector, metadata) {
15458
15459
  const vectorBuf = Buffer.from(new Float32Array(vector).buffer);
15459
15460
  this.db.prepare(`
15460
15461
  INSERT OR REPLACE INTO embeddings (path, chunk_id, chunk_type, content_hash, vector, metadata)
15461
15462
  VALUES (?, ?, ?, ?, ?, ?)
15462
- `).run(path12, chunkId, chunkType, contentHash, vectorBuf, JSON.stringify(metadata ?? {}));
15463
+ `).run(path13, chunkId, chunkType, contentHash, vectorBuf, JSON.stringify(metadata ?? {}));
15463
15464
  }
15464
15465
  /**
15465
15466
  * Load embedding for a specific chunk.
15466
15467
  */
15467
- loadEmbedding(path12, chunkId) {
15468
- const row = this.db.prepare("SELECT vector, content_hash, metadata FROM embeddings WHERE path = ? AND chunk_id = ?").get(path12, chunkId);
15468
+ loadEmbedding(path13, chunkId) {
15469
+ const row = this.db.prepare("SELECT vector, content_hash, metadata FROM embeddings WHERE path = ? AND chunk_id = ?").get(path13, chunkId);
15469
15470
  if (!row) return null;
15470
15471
  let metadata;
15471
15472
  try {
15472
15473
  metadata = JSON.parse(row.metadata);
15473
15474
  } catch {
15474
- console.warn(`[PersistentIndex] Corrupted metadata JSON for embedding ${path12}:${chunkId} \u2014 returning null`);
15475
+ console.warn(`[PersistentIndex] Corrupted metadata JSON for embedding ${path13}:${chunkId} \u2014 returning null`);
15475
15476
  return null;
15476
15477
  }
15477
15478
  return {
@@ -15785,15 +15786,24 @@ var PersistentIndex = class {
15785
15786
  }
15786
15787
  loadRoutes() {
15787
15788
  const rows = this.db.prepare("SELECT path, method, handler, file, line, middleware, auth FROM routes").all();
15788
- return rows.map((row) => ({
15789
- path: row.path,
15790
- method: row.method,
15791
- handler: row.handler,
15792
- file: row.file,
15793
- line: row.line,
15794
- middleware: JSON.parse(row.middleware),
15795
- auth: row.auth === null ? void 0 : row.auth === 1
15796
- }));
15789
+ return rows.map((row) => {
15790
+ let middleware = [];
15791
+ try {
15792
+ const parsed = JSON.parse(row.middleware);
15793
+ middleware = Array.isArray(parsed) ? parsed.filter((m) => typeof m === "string") : [];
15794
+ } catch {
15795
+ middleware = [];
15796
+ }
15797
+ return {
15798
+ path: row.path,
15799
+ method: row.method,
15800
+ handler: row.handler,
15801
+ file: row.file,
15802
+ line: row.line,
15803
+ middleware,
15804
+ auth: row.auth === null ? void 0 : row.auth === 1
15805
+ };
15806
+ });
15797
15807
  }
15798
15808
  loadServices() {
15799
15809
  const rows = this.db.prepare("SELECT id, name, root_path FROM services").all();
@@ -17022,6 +17032,342 @@ function shortName(filePath2) {
17022
17032
  const parts = filePath2.split("/");
17023
17033
  return parts[parts.length - 1] ?? filePath2;
17024
17034
  }
17035
+ function discoverSessions(projectDir) {
17036
+ const files = readdirSync(projectDir);
17037
+ return files.filter(
17038
+ (f) => f.endsWith(".jsonl") && !f.startsWith("agent-") && // UUID format: 8-4-4-4-12 hex chars
17039
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.jsonl$/.test(f)
17040
+ ).map((f) => join(projectDir, f)).sort((a, b) => {
17041
+ const aStat = statSync(a);
17042
+ const bStat = statSync(b);
17043
+ return bStat.mtimeMs - aStat.mtimeMs;
17044
+ });
17045
+ }
17046
+ function parseJSONL(filePath2) {
17047
+ const content = readFileSync(filePath2, "utf-8");
17048
+ const lines = content.trim().split("\n");
17049
+ const records = [];
17050
+ for (const line of lines) {
17051
+ if (!line.trim()) continue;
17052
+ try {
17053
+ const record = JSON.parse(line);
17054
+ if ("isSidechain" in record && record.isSidechain) continue;
17055
+ if ("isApiErrorMessage" in record && record.isApiErrorMessage) continue;
17056
+ records.push(record);
17057
+ } catch {
17058
+ continue;
17059
+ }
17060
+ }
17061
+ return records;
17062
+ }
17063
+ var CORRECTION_PATTERNS = [
17064
+ /\bno\b[,.]?\s*(try|use|do|check|look|instead|don't|stop|wait)/i,
17065
+ /\bthat's not (right|correct|what I)/i,
17066
+ /\bwrong (file|approach|direction|way)\b/i,
17067
+ /\bforget that\b/i,
17068
+ /\bdon't do that\b/i,
17069
+ /\bnot what I (asked|wanted|meant)\b/i,
17070
+ /\bgo back to\b/i,
17071
+ /\brevert (that|this|the)\b/i,
17072
+ /\bundo (that|this|the)\b/i,
17073
+ /\bthat broke\b/i,
17074
+ /\btry .+ instead/i,
17075
+ /\blook at .+ instead/i,
17076
+ /\bthe (issue|problem|bug) (is|is actually) in\b/i,
17077
+ /\bstop (doing|changing|modifying|editing)\b/i
17078
+ ];
17079
+ var BACKTRACK_PATTERNS = [
17080
+ /\blet me try a different/i,
17081
+ /\bthat didn't work/i,
17082
+ /\bI see the( real)? (issue|problem|error)/i,
17083
+ /\bactually,? (I think|let me|the issue)/i,
17084
+ /\bapproach (isn't|didn't|wasn't) working/i,
17085
+ /\blet me reconsider/i,
17086
+ /\bI was wrong/i,
17087
+ /\bprevious approach/i,
17088
+ /\bgoing back to/i,
17089
+ /\binstead,? let me/i,
17090
+ /\berror (suggests|indicates|means)/i
17091
+ ];
17092
+ function getUserText(content) {
17093
+ if (typeof content === "string") return content;
17094
+ return content.filter((c3) => c3.type === "text").map((c3) => c3.text).join("\n");
17095
+ }
17096
+ function getAssistantText(content) {
17097
+ return content.filter((c3) => c3.type === "text").map((c3) => c3.text).join("\n");
17098
+ }
17099
+ function getToolUses(content) {
17100
+ return content.filter((c3) => c3.type === "tool_use");
17101
+ }
17102
+ function classifyUserMessage(text, previousNodeType) {
17103
+ if (previousNodeType && ["action", "observation", "hypothesis"].includes(previousNodeType)) {
17104
+ for (const pattern of CORRECTION_PATTERNS) {
17105
+ if (pattern.test(text)) return "correction";
17106
+ }
17107
+ }
17108
+ if (text.trim().endsWith("?") && text.length < 200) {
17109
+ return "escalation";
17110
+ }
17111
+ return "user_request";
17112
+ }
17113
+ function classifyAssistantMessage(text, toolUses, isLastAssistant) {
17114
+ for (const pattern of BACKTRACK_PATTERNS) {
17115
+ if (pattern.test(text)) return "backtrack";
17116
+ }
17117
+ if (toolUses.length > 0) return "action";
17118
+ if (isLastAssistant) return "resolution";
17119
+ return text.length > 300 ? "hypothesis" : "observation";
17120
+ }
17121
+ function extractFilesFromToolCall(toolUse) {
17122
+ const files = [];
17123
+ const input = toolUse.input;
17124
+ switch (toolUse.name) {
17125
+ case "Read":
17126
+ case "Write":
17127
+ case "Edit":
17128
+ case "MultiEdit":
17129
+ if (typeof input.file_path === "string") files.push(input.file_path);
17130
+ if (typeof input.path === "string") files.push(input.path);
17131
+ break;
17132
+ case "Bash": {
17133
+ const cmd = String(input.command || "");
17134
+ const fileMatches = cmd.match(/(?:cat|vim|nano|code|less|head|tail|grep -[a-z]*\s+\S+\s+|sed\s+\S+\s+)(\S+\.(ts|js|tsx|jsx|py|rs|go|md|json|yaml|yml|toml|css|html|sql))/g);
17135
+ if (fileMatches) {
17136
+ for (const match2 of fileMatches) {
17137
+ const parts = match2.split(/\s+/);
17138
+ const filePart = parts[parts.length - 1];
17139
+ if (filePart && !filePart.startsWith("-")) files.push(filePart);
17140
+ }
17141
+ }
17142
+ break;
17143
+ }
17144
+ case "Glob":
17145
+ case "Grep":
17146
+ if (typeof input.pattern === "string") files.push(input.pattern);
17147
+ break;
17148
+ }
17149
+ return files;
17150
+ }
17151
+ function buildDecisionGraph(records, projectName) {
17152
+ const nodes = [];
17153
+ const edges = [];
17154
+ let sessionId = "";
17155
+ let gitBranch = "";
17156
+ let summary;
17157
+ let startTime = "";
17158
+ let endTime = "";
17159
+ let totalToolCalls = 0;
17160
+ const toolsUsed = /* @__PURE__ */ new Set();
17161
+ let backtrackCount = 0;
17162
+ let userCorrectionCount = 0;
17163
+ let userPromptCount = 0;
17164
+ const allFilesTouched = /* @__PURE__ */ new Set();
17165
+ const resolutionFiles = /* @__PURE__ */ new Set();
17166
+ let inputTokens = 0;
17167
+ let outputTokens = 0;
17168
+ let cacheReadTokens = 0;
17169
+ let cacheCreationTokens = 0;
17170
+ let previousNodeId = null;
17171
+ let previousNodeType;
17172
+ let nodeIndex = 0;
17173
+ for (let i = 0; i < records.length; i++) {
17174
+ const record = records[i];
17175
+ if (record.type === "summary") {
17176
+ summary = record.summary;
17177
+ continue;
17178
+ }
17179
+ if (record.type !== "user" && record.type !== "assistant") continue;
17180
+ if ("sessionId" in record && record.sessionId && !sessionId) {
17181
+ sessionId = record.sessionId;
17182
+ gitBranch = record.gitBranch || "";
17183
+ record.cwd || "";
17184
+ record.version || "";
17185
+ }
17186
+ if ("timestamp" in record && record.timestamp) {
17187
+ if (!startTime) startTime = record.timestamp;
17188
+ endTime = record.timestamp;
17189
+ }
17190
+ const nodeId = `node_${nodeIndex++}`;
17191
+ if (record.type === "user" && "message" in record) {
17192
+ const userRecord = record;
17193
+ const text = getUserText(userRecord.message.content);
17194
+ if (!text.trim()) continue;
17195
+ const classification = classifyUserMessage(text, previousNodeType);
17196
+ userPromptCount++;
17197
+ if (classification === "correction") {
17198
+ userCorrectionCount++;
17199
+ }
17200
+ const node = {
17201
+ id: nodeId,
17202
+ type: classification,
17203
+ timestamp: record.timestamp,
17204
+ reasoning: text.slice(0, 500),
17205
+ // Truncate for storage efficiency
17206
+ filesTouched: [],
17207
+ sourceUuids: [record.uuid]
17208
+ };
17209
+ nodes.push(node);
17210
+ if (previousNodeId) {
17211
+ const edgeType = classification === "correction" ? "correction_forced" : "user_initiated";
17212
+ edges.push({ from: previousNodeId, to: nodeId, type: edgeType });
17213
+ }
17214
+ previousNodeId = nodeId;
17215
+ previousNodeType = classification;
17216
+ }
17217
+ if (record.type === "assistant" && "message" in record) {
17218
+ const assistantRecord = record;
17219
+ const content = assistantRecord.message.content;
17220
+ const text = getAssistantText(content);
17221
+ const toolUses = getToolUses(content);
17222
+ const isLastAssistant = !records.slice(i + 1).some((r) => r.type === "assistant");
17223
+ const classification = classifyAssistantMessage(text, toolUses, isLastAssistant);
17224
+ if (classification === "backtrack") backtrackCount++;
17225
+ const filesTouched = [];
17226
+ for (const tu of toolUses) {
17227
+ totalToolCalls++;
17228
+ toolsUsed.add(tu.name);
17229
+ const files = extractFilesFromToolCall(tu);
17230
+ filesTouched.push(...files);
17231
+ files.forEach((f) => allFilesTouched.add(f));
17232
+ if (["Write", "Edit", "MultiEdit"].includes(tu.name)) {
17233
+ files.forEach((f) => resolutionFiles.add(f));
17234
+ }
17235
+ }
17236
+ if (assistantRecord.message.usage) {
17237
+ const u = assistantRecord.message.usage;
17238
+ inputTokens = Math.max(inputTokens, u.input_tokens || 0);
17239
+ outputTokens += u.output_tokens || 0;
17240
+ cacheReadTokens = Math.max(cacheReadTokens, u.cache_read_input_tokens || 0);
17241
+ cacheCreationTokens += u.cache_creation_input_tokens || 0;
17242
+ }
17243
+ const node = {
17244
+ id: nodeId,
17245
+ type: classification,
17246
+ timestamp: record.timestamp,
17247
+ reasoning: text.slice(0, 500),
17248
+ toolCall: toolUses.length > 0 ? {
17249
+ name: toolUses[0].name,
17250
+ input: toolUses[0].input,
17251
+ outputSummary: "",
17252
+ // Filled from next tool_result record
17253
+ succeeded: true
17254
+ // Updated if error in tool_result
17255
+ } : void 0,
17256
+ filesTouched,
17257
+ sourceUuids: [record.uuid]
17258
+ };
17259
+ nodes.push(node);
17260
+ if (previousNodeId) {
17261
+ let edgeType;
17262
+ if (classification === "backtrack" && previousNodeType === "correction") {
17263
+ edgeType = "correction_forced";
17264
+ } else if (classification === "backtrack") {
17265
+ edgeType = "self_correction";
17266
+ } else if (previousNodeType === "backtrack") {
17267
+ edgeType = "retry";
17268
+ } else if (previousNodeType === "user_request" || previousNodeType === "correction") {
17269
+ edgeType = "user_initiated";
17270
+ } else if (classification === "action" && previousNodeType === "hypothesis") {
17271
+ edgeType = "hypothesis_driven";
17272
+ } else if (classification === "hypothesis" && previousNodeType === "observation") {
17273
+ edgeType = "evidence_based";
17274
+ } else {
17275
+ edgeType = "sequential";
17276
+ }
17277
+ edges.push({ from: previousNodeId, to: nodeId, type: edgeType });
17278
+ }
17279
+ previousNodeId = nodeId;
17280
+ previousNodeType = classification;
17281
+ }
17282
+ }
17283
+ const durationSeconds = startTime && endTime ? (new Date(endTime).getTime() - new Date(startTime).getTime()) / 1e3 : 0;
17284
+ const investigatedNotResolution = [...allFilesTouched].filter((f) => !resolutionFiles.has(f));
17285
+ const metrics = {
17286
+ totalToolCalls,
17287
+ toolsUsed: [...toolsUsed],
17288
+ backtrackCount,
17289
+ userCorrectionCount,
17290
+ userPromptCount,
17291
+ durationSeconds,
17292
+ filesModifiedAsResolution: [...resolutionFiles],
17293
+ filesInvestigatedNotResolution: investigatedNotResolution,
17294
+ toolCallsToResolution: totalToolCalls,
17295
+ // Refined later with better analysis
17296
+ apparentSuccess: userCorrectionCount < 3 && backtrackCount < 5,
17297
+ tokenUsage: { inputTokens, outputTokens, cacheReadTokens, cacheCreationTokens }
17298
+ };
17299
+ return {
17300
+ sessionId,
17301
+ project: projectName,
17302
+ gitBranch,
17303
+ startTime,
17304
+ endTime,
17305
+ summary,
17306
+ nodes,
17307
+ edges,
17308
+ metrics
17309
+ };
17310
+ }
17311
+ function parseSession(filePath2, projectName) {
17312
+ const project = basename(filePath2, ".jsonl");
17313
+ const records = parseJSONL(filePath2);
17314
+ return buildDecisionGraph(records, project);
17315
+ }
17316
+ function sessionSummary(graph) {
17317
+ const m = graph.metrics;
17318
+ const duration = m.durationSeconds > 60 ? `${Math.round(m.durationSeconds / 60)}m` : `${Math.round(m.durationSeconds)}s`;
17319
+ return [
17320
+ `Session: ${graph.sessionId.slice(0, 8)}...`,
17321
+ `Project: ${graph.project}`,
17322
+ `Duration: ${duration}`,
17323
+ `Tool calls: ${m.totalToolCalls}`,
17324
+ `Backtracks: ${m.backtrackCount}`,
17325
+ `User corrections: ${m.userCorrectionCount}`,
17326
+ `Files modified: ${m.filesModifiedAsResolution.length}`,
17327
+ `False leads: ${m.filesInvestigatedNotResolution.length}`,
17328
+ `Success: ${m.apparentSuccess ? "\u2713" : "\u2717"}`,
17329
+ graph.summary ? `Summary: ${graph.summary.slice(0, 100)}...` : ""
17330
+ ].filter(Boolean).join("\n");
17331
+ }
17332
+ function encodeClaudeProjectDirName(workspaceRoot) {
17333
+ const norm2 = path2.resolve(workspaceRoot).replace(/\\/g, "/");
17334
+ const tail = norm2.startsWith("/") ? norm2.slice(1) : norm2;
17335
+ return `-${tail.replace(/\//g, "-")}`;
17336
+ }
17337
+ var DEFAULT_MAX_SESSIONS = 5;
17338
+ function buildProceduralMemoryNexus(workspaceRoot, opts) {
17339
+ const maxSessions = opts?.maxSessions ?? DEFAULT_MAX_SESSIONS;
17340
+ const claudeDir = opts?.claudeDir ?? path2.join(homedir(), ".claude");
17341
+ const subdir = encodeClaudeProjectDirName(workspaceRoot);
17342
+ const projectDir = path2.join(claudeDir, "projects", subdir);
17343
+ if (!existsSync(projectDir)) {
17344
+ return null;
17345
+ }
17346
+ const sessionFiles = discoverSessions(projectDir).slice(0, maxSessions);
17347
+ if (sessionFiles.length === 0) {
17348
+ return null;
17349
+ }
17350
+ const blocks = [
17351
+ "### Procedural memory (Claude Code)",
17352
+ "",
17353
+ `_Transcripts: \`${projectDir}\`_`,
17354
+ "",
17355
+ "Recent sessions (newest first):",
17356
+ ""
17357
+ ];
17358
+ for (const file of sessionFiles) {
17359
+ try {
17360
+ const graph = parseSession(file);
17361
+ blocks.push("```", sessionSummary(graph), "```", "");
17362
+ } catch {
17363
+ }
17364
+ }
17365
+ return {
17366
+ claudeProjectDir: projectDir,
17367
+ sessionsSampled: sessionFiles.length,
17368
+ digestMarkdown: blocks.join("\n").trimEnd()
17369
+ };
17370
+ }
17025
17371
  var SYMBOL_KIND_MAP = {
17026
17372
  function: "function",
17027
17373
  class: "class",
@@ -18469,8 +18815,21 @@ var ContextEngine = class {
18469
18815
  * in the synthesized context. Returns null when no codegraph is attached.
18470
18816
  */
18471
18817
  buildNexusSummary() {
18818
+ const proceduralMemory = buildProceduralMemoryNexus(this.config.rootPath);
18472
18819
  const graph = this.codeGraph;
18473
- if (!graph) return null;
18820
+ if (!graph) {
18821
+ if (!proceduralMemory) return null;
18822
+ return {
18823
+ clusterCount: 0,
18824
+ clusters: [],
18825
+ processCount: 0,
18826
+ topProcesses: [],
18827
+ hotspotSymbols: [],
18828
+ runtimeTraceCount: 0,
18829
+ hasSearchIndex: false,
18830
+ proceduralMemory
18831
+ };
18832
+ }
18474
18833
  const callCounts = /* @__PURE__ */ new Map();
18475
18834
  for (const edge of graph.edges) {
18476
18835
  if (edge.type === "calls" || edge.type === "references") {
@@ -18507,14 +18866,14 @@ var ContextEngine = class {
18507
18866
  })) ?? [],
18508
18867
  hotspotSymbols,
18509
18868
  runtimeTraceCount: graph.runtimeTraces?.length ?? this.runtimeTraces?.length ?? 0,
18510
- hasSearchIndex: !!graph.searchIndex
18869
+ hasSearchIndex: !!graph.searchIndex,
18870
+ proceduralMemory: proceduralMemory ?? void 0
18511
18871
  };
18512
18872
  }
18513
18873
  };
18514
18874
  async function loadOptionalModule(spec) {
18515
18875
  try {
18516
- const dynamicImport = new Function("s", "return import(s)");
18517
- return await dynamicImport(spec);
18876
+ return await import(spec);
18518
18877
  } catch {
18519
18878
  return null;
18520
18879
  }
@@ -20807,10 +21166,10 @@ var Minipass = class extends EventEmitter {
20807
21166
  * Return a void Promise that resolves once the stream ends.
20808
21167
  */
20809
21168
  async promise() {
20810
- return new Promise((resolve4, reject) => {
21169
+ return new Promise((resolve5, reject) => {
20811
21170
  this.on(DESTROYED, () => reject(new Error("stream destroyed")));
20812
21171
  this.on("error", (er) => reject(er));
20813
- this.on("end", () => resolve4());
21172
+ this.on("end", () => resolve5());
20814
21173
  });
20815
21174
  }
20816
21175
  /**
@@ -20834,7 +21193,7 @@ var Minipass = class extends EventEmitter {
20834
21193
  return Promise.resolve({ done: false, value: res });
20835
21194
  if (this[EOF])
20836
21195
  return stop();
20837
- let resolve4;
21196
+ let resolve5;
20838
21197
  let reject;
20839
21198
  const onerr = (er) => {
20840
21199
  this.off("data", ondata);
@@ -20848,19 +21207,19 @@ var Minipass = class extends EventEmitter {
20848
21207
  this.off("end", onend);
20849
21208
  this.off(DESTROYED, ondestroy);
20850
21209
  this.pause();
20851
- resolve4({ value, done: !!this[EOF] });
21210
+ resolve5({ value, done: !!this[EOF] });
20852
21211
  };
20853
21212
  const onend = () => {
20854
21213
  this.off("error", onerr);
20855
21214
  this.off("data", ondata);
20856
21215
  this.off(DESTROYED, ondestroy);
20857
21216
  stop();
20858
- resolve4({ done: true, value: void 0 });
21217
+ resolve5({ done: true, value: void 0 });
20859
21218
  };
20860
21219
  const ondestroy = () => onerr(new Error("stream destroyed"));
20861
21220
  return new Promise((res2, rej) => {
20862
21221
  reject = rej;
20863
- resolve4 = res2;
21222
+ resolve5 = res2;
20864
21223
  this.once(DESTROYED, ondestroy);
20865
21224
  this.once("error", onerr);
20866
21225
  this.once("end", onend);
@@ -20965,7 +21324,7 @@ var realpathSync = realpathSync$1.native;
20965
21324
  var defaultFS = {
20966
21325
  lstatSync,
20967
21326
  readdir: readdir$1,
20968
- readdirSync,
21327
+ readdirSync: readdirSync,
20969
21328
  readlinkSync,
20970
21329
  realpathSync,
20971
21330
  promises: {
@@ -21227,12 +21586,12 @@ var PathBase = class {
21227
21586
  /**
21228
21587
  * Get the Path object referenced by the string path, resolved from this Path
21229
21588
  */
21230
- resolve(path12) {
21231
- if (!path12) {
21589
+ resolve(path13) {
21590
+ if (!path13) {
21232
21591
  return this;
21233
21592
  }
21234
- const rootPath = this.getRootString(path12);
21235
- const dir = path12.substring(rootPath.length);
21593
+ const rootPath = this.getRootString(path13);
21594
+ const dir = path13.substring(rootPath.length);
21236
21595
  const dirParts = dir.split(this.splitSep);
21237
21596
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
21238
21597
  return result;
@@ -21836,9 +22195,9 @@ var PathBase = class {
21836
22195
  if (this.#asyncReaddirInFlight) {
21837
22196
  await this.#asyncReaddirInFlight;
21838
22197
  } else {
21839
- let resolve4 = () => {
22198
+ let resolve5 = () => {
21840
22199
  };
21841
- this.#asyncReaddirInFlight = new Promise((res) => resolve4 = res);
22200
+ this.#asyncReaddirInFlight = new Promise((res) => resolve5 = res);
21842
22201
  try {
21843
22202
  for (const e of await this.#fs.promises.readdir(fullpath, {
21844
22203
  withFileTypes: true
@@ -21851,7 +22210,7 @@ var PathBase = class {
21851
22210
  children.provisional = 0;
21852
22211
  }
21853
22212
  this.#asyncReaddirInFlight = void 0;
21854
- resolve4();
22213
+ resolve5();
21855
22214
  }
21856
22215
  return children.slice(0, children.provisional);
21857
22216
  }
@@ -21984,8 +22343,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
21984
22343
  /**
21985
22344
  * @internal
21986
22345
  */
21987
- getRootString(path12) {
21988
- return win32.parse(path12).root;
22346
+ getRootString(path13) {
22347
+ return win32.parse(path13).root;
21989
22348
  }
21990
22349
  /**
21991
22350
  * @internal
@@ -22031,8 +22390,8 @@ var PathPosix = class _PathPosix extends PathBase {
22031
22390
  /**
22032
22391
  * @internal
22033
22392
  */
22034
- getRootString(path12) {
22035
- return path12.startsWith("/") ? "/" : "";
22393
+ getRootString(path13) {
22394
+ return path13.startsWith("/") ? "/" : "";
22036
22395
  }
22037
22396
  /**
22038
22397
  * @internal
@@ -22121,11 +22480,11 @@ var PathScurryBase = class {
22121
22480
  /**
22122
22481
  * Get the depth of a provided path, string, or the cwd
22123
22482
  */
22124
- depth(path12 = this.cwd) {
22125
- if (typeof path12 === "string") {
22126
- path12 = this.cwd.resolve(path12);
22483
+ depth(path13 = this.cwd) {
22484
+ if (typeof path13 === "string") {
22485
+ path13 = this.cwd.resolve(path13);
22127
22486
  }
22128
- return path12.depth();
22487
+ return path13.depth();
22129
22488
  }
22130
22489
  /**
22131
22490
  * Return the cache of child entries. Exposed so subclasses can create
@@ -22612,9 +22971,9 @@ var PathScurryBase = class {
22612
22971
  process2();
22613
22972
  return results;
22614
22973
  }
22615
- chdir(path12 = this.cwd) {
22974
+ chdir(path13 = this.cwd) {
22616
22975
  const oldCwd = this.cwd;
22617
- this.cwd = typeof path12 === "string" ? this.cwd.resolve(path12) : path12;
22976
+ this.cwd = typeof path13 === "string" ? this.cwd.resolve(path13) : path13;
22618
22977
  this.cwd[setAsCwd](oldCwd);
22619
22978
  }
22620
22979
  };
@@ -22970,8 +23329,8 @@ var MatchRecord = class {
22970
23329
  }
22971
23330
  // match, absolute, ifdir
22972
23331
  entries() {
22973
- return [...this.store.entries()].map(([path12, n]) => [
22974
- path12,
23332
+ return [...this.store.entries()].map(([path13, n]) => [
23333
+ path13,
22975
23334
  !!(n & 2),
22976
23335
  !!(n & 1)
22977
23336
  ]);
@@ -23176,9 +23535,9 @@ var GlobUtil = class {
23176
23535
  signal;
23177
23536
  maxDepth;
23178
23537
  includeChildMatches;
23179
- constructor(patterns, path12, opts) {
23538
+ constructor(patterns, path13, opts) {
23180
23539
  this.patterns = patterns;
23181
- this.path = path12;
23540
+ this.path = path13;
23182
23541
  this.opts = opts;
23183
23542
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
23184
23543
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -23197,11 +23556,11 @@ var GlobUtil = class {
23197
23556
  });
23198
23557
  }
23199
23558
  }
23200
- #ignored(path12) {
23201
- return this.seen.has(path12) || !!this.#ignore?.ignored?.(path12);
23559
+ #ignored(path13) {
23560
+ return this.seen.has(path13) || !!this.#ignore?.ignored?.(path13);
23202
23561
  }
23203
- #childrenIgnored(path12) {
23204
- return !!this.#ignore?.childrenIgnored?.(path12);
23562
+ #childrenIgnored(path13) {
23563
+ return !!this.#ignore?.childrenIgnored?.(path13);
23205
23564
  }
23206
23565
  // backpressure mechanism
23207
23566
  pause() {
@@ -23416,8 +23775,8 @@ var GlobUtil = class {
23416
23775
  };
23417
23776
  var GlobWalker = class extends GlobUtil {
23418
23777
  matches = /* @__PURE__ */ new Set();
23419
- constructor(patterns, path12, opts) {
23420
- super(patterns, path12, opts);
23778
+ constructor(patterns, path13, opts) {
23779
+ super(patterns, path13, opts);
23421
23780
  }
23422
23781
  matchEmit(e) {
23423
23782
  this.matches.add(e);
@@ -23454,8 +23813,8 @@ var GlobWalker = class extends GlobUtil {
23454
23813
  };
23455
23814
  var GlobStream = class extends GlobUtil {
23456
23815
  results;
23457
- constructor(patterns, path12, opts) {
23458
- super(patterns, path12, opts);
23816
+ constructor(patterns, path13, opts) {
23817
+ super(patterns, path13, opts);
23459
23818
  this.results = new Minipass({
23460
23819
  signal: this.signal,
23461
23820
  objectMode: true
@@ -24628,6 +24987,17 @@ var InputValidator = class {
24628
24987
  }
24629
24988
  break;
24630
24989
  }
24990
+ case "nexus_procedural_memory": {
24991
+ if (args.maxSessions !== void 0) {
24992
+ const r = this.validateNumber(args.maxSessions, { min: 1, max: 50, integer: true });
24993
+ if (!r.valid) errors.push(...r.errors.map((e) => `maxSessions: ${e}`));
24994
+ }
24995
+ if (args.path !== void 0) {
24996
+ const r = this.validatePath(args.path);
24997
+ if (!r.valid) errors.push(...r.errors.map((e) => `path: ${e}`));
24998
+ }
24999
+ break;
25000
+ }
24631
25001
  case "nexus_orchestrate": {
24632
25002
  const r = this.validateEnum(args.agent, ["refactor", "debug", "test", "review"]);
24633
25003
  if (!r.valid) errors.push(...r.errors.map((e) => `agent: ${e}`));
@@ -24678,6 +25048,7 @@ var X402_TOOL_PRICES_USDC = {
24678
25048
  nexus_impact: 1e3,
24679
25049
  nexus_processes: 1e3,
24680
25050
  nexus_clusters: 1e3,
25051
+ nexus_procedural_memory: 1e3,
24681
25052
  nexus_orchestrate: 5e3
24682
25053
  };
24683
25054
  var VALID_CHAINS = ["base", "ethereum", "polygon", "solana"];
@@ -25368,6 +25739,20 @@ var MCP_TOOLS = [
25368
25739
  path: { type: "string", description: "Workspace root. Defaults to cwd." }
25369
25740
  }
25370
25741
  }
25742
+ },
25743
+ {
25744
+ name: "nexus_procedural_memory",
25745
+ description: "Claude Code procedural memory for this workspace: compact markdown digest of recent session transcripts from ~/.claude/projects/<encoded-root>. Summarizes what was tried, tools used, and outcomes.",
25746
+ inputSchema: {
25747
+ type: "object",
25748
+ properties: {
25749
+ path: { type: "string", description: "Workspace root. Defaults to cwd." },
25750
+ maxSessions: {
25751
+ type: "number",
25752
+ description: "Max recent sessions to include (newest first). Default 5, max 50."
25753
+ }
25754
+ }
25755
+ }
25371
25756
  }
25372
25757
  ];
25373
25758
  function isKnownToolName(toolName) {
@@ -25538,7 +25923,7 @@ function createScanIdempotencyKey(prefix) {
25538
25923
  // src/mcp-scan-meter-client.ts
25539
25924
  var MCP_SCAN_METER_CLIENT = {
25540
25925
  type: "mcp",
25541
- version: "24.6.8"
25926
+ version: "24.6.9"
25542
25927
  };
25543
25928
 
25544
25929
  // ../shared/dist/chunk-YYSV5CG4.js
@@ -25613,14 +25998,14 @@ async function uploadScanToApi(report, options) {
25613
25998
  }
25614
25999
  if (attempt < maxRetries) {
25615
26000
  const delay2 = calculateNextRetry(attempt, { baseMs: 2e3, maxMs: 1e4 });
25616
- await new Promise((resolve4) => setTimeout(resolve4, delay2));
26001
+ await new Promise((resolve5) => setTimeout(resolve5, delay2));
25617
26002
  continue;
25618
26003
  }
25619
26004
  return { ok: false, error: `Upload failed (HTTP ${res.status})`, code: "UPLOAD_FAILED" };
25620
26005
  } catch (err) {
25621
26006
  if (attempt < maxRetries) {
25622
26007
  const delay2 = calculateNextRetry(attempt, { baseMs: 2e3, maxMs: 1e4 });
25623
- await new Promise((resolve4) => setTimeout(resolve4, delay2));
26008
+ await new Promise((resolve5) => setTimeout(resolve5, delay2));
25624
26009
  continue;
25625
26010
  }
25626
26011
  const message = err instanceof Error ? err.message : String(err);
@@ -25781,12 +26166,12 @@ async function runGuard(targetPath) {
25781
26166
  }
25782
26167
  var MCP_TOOL_TIMEOUT_MS = 18e4;
25783
26168
  function withTimeout(promise, ms, label) {
25784
- return new Promise((resolve4, reject) => {
26169
+ return new Promise((resolve5, reject) => {
25785
26170
  const timer = setTimeout(() => reject(new Error(`${label} timed out after ${ms / 1e3}s`)), ms);
25786
26171
  promise.then(
25787
26172
  (value) => {
25788
26173
  clearTimeout(timer);
25789
- resolve4(value);
26174
+ resolve5(value);
25790
26175
  },
25791
26176
  (error) => {
25792
26177
  clearTimeout(timer);
@@ -26600,7 +26985,7 @@ ${validation.errors.join("\n")}`);
26600
26985
  if (!fs6.existsSync(absFile) || !fs6.statSync(absFile).isFile()) {
26601
26986
  return buildErrorResponse(`Not a file: ${relFile}`);
26602
26987
  }
26603
- const { runGhostTrace } = await import('./dist-YMC7QNSZ.js');
26988
+ const { runGhostTrace } = await import('./dist-WFQ36UNZ.js');
26604
26989
  const trace = await withTimeout(
26605
26990
  runGhostTrace({ workspaceRoot: targetPath, filePath: absFile }),
26606
26991
  MCP_TOOL_TIMEOUT_MS,
@@ -27067,6 +27452,21 @@ This change is synced across all surfaces.`
27067
27452
  const status = sentinel.status();
27068
27453
  return { content: [{ type: "text", text: formatSentinelStatus(status) }] };
27069
27454
  }
27455
+ case "nexus_procedural_memory": {
27456
+ const maxSessions = typeof args.maxSessions === "number" ? args.maxSessions : 5;
27457
+ const pm = buildProceduralMemoryNexus(targetPath, { maxSessions });
27458
+ if (!pm) {
27459
+ return {
27460
+ content: [
27461
+ {
27462
+ type: "text",
27463
+ text: `nexus_procedural_memory: no Claude Code session transcripts found for this workspace under ~/.claude/projects/ (expected encoded dir for "${targetPath}").`
27464
+ }
27465
+ ]
27466
+ };
27467
+ }
27468
+ return { content: [{ type: "text", text: pm.digestMarkdown }] };
27469
+ }
27070
27470
  default:
27071
27471
  return buildErrorResponse(`Unknown tool: ${name}`);
27072
27472
  }
@@ -27080,7 +27480,7 @@ function createMcpServer(runtimeOverrides = {}) {
27080
27480
  const server = new Server(
27081
27481
  {
27082
27482
  name: "vibecheck-mcp",
27083
- version: "24.6.8"
27483
+ version: "24.6.9"
27084
27484
  },
27085
27485
  {
27086
27486
  capabilities: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecheck-ai/mcp",
3
- "version": "24.6.8",
3
+ "version": "24.6.9",
4
4
  "description": "VibeCheck MCP — the code intelligence layer for AI-built software, wired into your agent. Truth-grounded, runtime-aware, multi-agent. 16+ verification engines, runtime probes, and live truthpack context for Cursor, Claude, Windsurf, and any MCP-compatible client.",
5
5
  "mcpName": "io.github.guardiavault-oss/vibecheck-mcp",
6
6
  "type": "module",
@@ -51,7 +51,7 @@
51
51
  "@repo/shared": "^0.1.0",
52
52
  "@repo/shared-types": "^1.1.0",
53
53
  "@repo/subscriptions": "^1.0.0",
54
- "@vibecheck-ai/cli": "^25.0.3",
54
+ "@vibecheck-ai/cli": "^25.0.4",
55
55
  "@vibecheck/engines": "^2.0.0-beta.1",
56
56
  "@vibecheck/roast": "^1.0.0",
57
57
  "@vibecheck/x402-gate": "^0.1.0"