@swarmvaultai/engine 3.16.1 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2CH2WWS4.js +1359 -0
- package/dist/chunk-2PN46RDI.js +26846 -0
- package/dist/chunk-333AMRSV.js +1056 -0
- package/dist/chunk-3GVEUYQZ.js +1641 -0
- package/dist/chunk-4MSSM2GH.js +1476 -0
- package/dist/chunk-563TZ4TZ.js +26573 -0
- package/dist/chunk-5GEPTIZE.js +26010 -0
- package/dist/chunk-5HNZ2WQI.js +1341 -0
- package/dist/chunk-5Q4IV4O3.js +1336 -0
- package/dist/chunk-65IRGGXX.js +27576 -0
- package/dist/chunk-6MO57J5C.js +988 -0
- package/dist/chunk-6UPHDGEB.js +1073 -0
- package/dist/chunk-75BU5TQ6.js +1690 -0
- package/dist/chunk-7O2HJSWQ.js +1686 -0
- package/dist/chunk-7QHDATCQ.js +1673 -0
- package/dist/chunk-B3FC4J3P.js +1214 -0
- package/dist/chunk-BTWPJEP2.js +1421 -0
- package/dist/chunk-CG67P2HB.js +1420 -0
- package/dist/chunk-CSPDMCON.js +26846 -0
- package/dist/chunk-CVFY54CF.js +24893 -0
- package/dist/chunk-CWLDFLH2.js +1163 -0
- package/dist/chunk-DAJAZPPO.js +26865 -0
- package/dist/chunk-DCSXDZAF.js +27698 -0
- package/dist/chunk-EEWB4WGH.js +1056 -0
- package/dist/chunk-EXD4RWT3.js +1131 -0
- package/dist/chunk-F7HZZ3VM.js +931 -0
- package/dist/chunk-FD3LJQ4T.js +1216 -0
- package/dist/chunk-G2TH6ZTA.js +1468 -0
- package/dist/chunk-H3CDZYRE.js +1701 -0
- package/dist/chunk-HFU5S5NO.js +838 -0
- package/dist/chunk-HKU2T5JX.js +25213 -0
- package/dist/chunk-HOJ7NSYC.js +937 -0
- package/dist/chunk-HORJDLXV.js +27614 -0
- package/dist/chunk-HRRPWXRZ.js +1335 -0
- package/dist/chunk-HW72C7O2.js +1690 -0
- package/dist/chunk-IAEYFTUS.js +1159 -0
- package/dist/chunk-IHMJCCXR.js +1146 -0
- package/dist/chunk-JEWLYIHN.js +27619 -0
- package/dist/chunk-JJDJF2P3.js +27012 -0
- package/dist/chunk-JTRE7C7P.js +26062 -0
- package/dist/chunk-L7DKPPV4.js +27339 -0
- package/dist/chunk-LEUV6TWJ.js +1131 -0
- package/dist/chunk-MB7HPUTR.js +1364 -0
- package/dist/chunk-MZSUYTSL.js +998 -0
- package/dist/chunk-N56FAH4N.js +1404 -0
- package/dist/chunk-NCSZ4AKP.js +1057 -0
- package/dist/chunk-NECZ4MUE.js +1416 -0
- package/dist/chunk-NHGS4LOI.js +1346 -0
- package/dist/chunk-NUWZUYE7.js +1701 -0
- package/dist/chunk-OK5752AP.js +1325 -0
- package/dist/chunk-PXZGMENW.js +27664 -0
- package/dist/chunk-QMW7OISM.js +1063 -0
- package/dist/chunk-RN56HUXA.js +26972 -0
- package/dist/chunk-RSQRF4FV.js +1424 -0
- package/dist/chunk-S2E65WRI.js +26062 -0
- package/dist/chunk-SRHM3HP4.js +944 -0
- package/dist/chunk-U7JO257M.js +25017 -0
- package/dist/chunk-UQCF65BN.js +1623 -0
- package/dist/chunk-USSP4GVB.js +25064 -0
- package/dist/chunk-V7KX3AQD.js +26010 -0
- package/dist/chunk-VSDBQVSE.js +27584 -0
- package/dist/chunk-WK2JR5H7.js +27694 -0
- package/dist/chunk-WOA5LSNB.js +26559 -0
- package/dist/chunk-WWP3VPEJ.js +26080 -0
- package/dist/chunk-YFKWMXJ6.js +26066 -0
- package/dist/chunk-Z552HHPV.js +26846 -0
- package/dist/chunk-ZQ5T64AR.js +1365 -0
- package/dist/hooks/claude.js +246 -24
- package/dist/hooks/codex.js +144 -11
- package/dist/hooks/copilot.js +95 -3
- package/dist/hooks/gemini.js +153 -5
- package/dist/hooks/opencode.js +4 -2
- package/dist/index.d.ts +36 -4
- package/dist/index.js +252 -12
- package/dist/memory-7OSGN7IU.js +32 -0
- package/dist/memory-A4VPLUBA.js +32 -0
- package/dist/memory-DNSQCDHC.js +32 -0
- package/dist/memory-ECS3TSGC.js +32 -0
- package/dist/memory-FVIBFROA.js +32 -0
- package/dist/memory-G6I3DBW4.js +32 -0
- package/dist/memory-GFOW2QWQ.js +32 -0
- package/dist/memory-GSCQ6F53.js +32 -0
- package/dist/memory-HE6VWUPV.js +32 -0
- package/dist/memory-HEA7XNKB.js +32 -0
- package/dist/memory-HMP3Y4PQ.js +32 -0
- package/dist/memory-JRYTVHNH.js +32 -0
- package/dist/memory-K3NL5E3K.js +32 -0
- package/dist/memory-KANI73CX.js +32 -0
- package/dist/memory-KI5G2A4C.js +32 -0
- package/dist/memory-PK55JUKG.js +32 -0
- package/dist/memory-PK5JJNAG.js +32 -0
- package/dist/memory-PQWSJ4RR.js +32 -0
- package/dist/memory-QCVKS3H4.js +32 -0
- package/dist/memory-QURNHGEZ.js +32 -0
- package/dist/memory-SAQPBIB4.js +32 -0
- package/dist/memory-SVGRP5KS.js +32 -0
- package/dist/memory-TQ46BGCI.js +32 -0
- package/dist/memory-UUPLB6O2.js +32 -0
- package/dist/memory-YKQWWIVY.js +32 -0
- package/dist/memory-Z7BP5OSC.js +32 -0
- package/dist/registry-2QC3VN7M.js +12 -0
- package/dist/registry-2REAPKPO.js +12 -0
- package/dist/registry-2XHXZDGH.js +12 -0
- package/dist/registry-4C55ZCPL.js +12 -0
- package/dist/registry-4QRMVAHX.js +12 -0
- package/dist/registry-5SYH3Y3U.js +12 -0
- package/dist/registry-6KZMA3XM.js +12 -0
- package/dist/registry-7QACDJQQ.js +12 -0
- package/dist/registry-B7UXRBW3.js +12 -0
- package/dist/registry-FKEREVDO.js +12 -0
- package/dist/registry-FLSGGY2R.js +12 -0
- package/dist/registry-G7NSRYCO.js +12 -0
- package/dist/registry-GH4O3A7H.js +12 -0
- package/dist/registry-IBH6K2KK.js +12 -0
- package/dist/registry-ILDEBNCW.js +12 -0
- package/dist/registry-JFEW5RUP.js +12 -0
- package/dist/registry-JQYQOZYN.js +12 -0
- package/dist/registry-JR5WY22P.js +12 -0
- package/dist/registry-KLO5YIHP.js +12 -0
- package/dist/registry-KVJAO5DF.js +12 -0
- package/dist/registry-MYJX6AEE.js +12 -0
- package/dist/registry-NBLIJHZT.js +12 -0
- package/dist/registry-NLRWSN5J.js +12 -0
- package/dist/registry-NMXDBYIZ.js +12 -0
- package/dist/registry-OUB6W3LM.js +12 -0
- package/dist/registry-P5KRT66L.js +12 -0
- package/dist/registry-PGZWRXMD.js +12 -0
- package/dist/registry-QAG2ZYH3.js +12 -0
- package/dist/registry-SUXWCWB4.js +12 -0
- package/dist/registry-SYCRRA65.js +12 -0
- package/dist/registry-TYROWPR5.js +12 -0
- package/dist/registry-U23ML76I.js +12 -0
- package/dist/registry-U76DBOV3.js +12 -0
- package/dist/registry-UA42LQUQ.js +12 -0
- package/dist/registry-W6ZFRI73.js +12 -0
- package/dist/registry-X5PMZTZY.js +12 -0
- package/dist/registry-XIL5F33J.js +12 -0
- package/dist/registry-XOPLQNZY.js +12 -0
- package/dist/registry-YDXVCE4Q.js +12 -0
- package/dist/registry-YGVTLIZH.js +12 -0
- package/dist/registry-ZNW3FDED.js +12 -0
- package/dist/viewer/assets/{index-Cq5HAlrV.js → index-BZE-2FtS.js} +37 -37
- package/dist/viewer/index.html +1 -1
- package/dist/viewer/lib.js +29 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -121,6 +121,7 @@ import {
|
|
|
121
121
|
searchVault,
|
|
122
122
|
stageGeneratedOutputPages,
|
|
123
123
|
startMemoryTask,
|
|
124
|
+
syncTrackedFiles,
|
|
124
125
|
syncTrackedRepos,
|
|
125
126
|
syncTrackedReposForWatch,
|
|
126
127
|
updateMemoryTask,
|
|
@@ -130,7 +131,7 @@ import {
|
|
|
130
131
|
writeGuidedSourceSession,
|
|
131
132
|
writeRetrievalManifest,
|
|
132
133
|
writeWatchStatusArtifact
|
|
133
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-DCSXDZAF.js";
|
|
134
135
|
import {
|
|
135
136
|
LocalWhisperProviderAdapter,
|
|
136
137
|
SWARMVAULT_OUT_ENV,
|
|
@@ -1235,6 +1236,68 @@ async function predictRemovedSourceIdsFromRepoSync(rootDir, options) {
|
|
|
1235
1236
|
)
|
|
1236
1237
|
];
|
|
1237
1238
|
}
|
|
1239
|
+
var REFRESH_LOCK_DIRNAME = "refresh.lock";
|
|
1240
|
+
var REFRESH_QUEUE_FILENAME = "refresh-queue.json";
|
|
1241
|
+
var REFRESH_LOCK_STALE_MS = 10 * 6e4;
|
|
1242
|
+
var MAX_FILE_REFRESH_ROUNDS = 5;
|
|
1243
|
+
function refreshLockDir(watchDir) {
|
|
1244
|
+
return path4.join(watchDir, REFRESH_LOCK_DIRNAME);
|
|
1245
|
+
}
|
|
1246
|
+
async function tryAcquireRefreshLock(watchDir) {
|
|
1247
|
+
const lockDir = refreshLockDir(watchDir);
|
|
1248
|
+
await fs4.mkdir(watchDir, { recursive: true });
|
|
1249
|
+
const writeOwner = () => fs4.writeFile(
|
|
1250
|
+
path4.join(lockDir, "owner.json"),
|
|
1251
|
+
`${JSON.stringify({ pid: process2.pid, acquiredAt: (/* @__PURE__ */ new Date()).toISOString() })}
|
|
1252
|
+
`,
|
|
1253
|
+
"utf8"
|
|
1254
|
+
);
|
|
1255
|
+
try {
|
|
1256
|
+
await fs4.mkdir(lockDir, { recursive: false });
|
|
1257
|
+
await writeOwner();
|
|
1258
|
+
return true;
|
|
1259
|
+
} catch {
|
|
1260
|
+
try {
|
|
1261
|
+
const stat = await fs4.stat(lockDir);
|
|
1262
|
+
if (Date.now() - stat.mtimeMs > REFRESH_LOCK_STALE_MS) {
|
|
1263
|
+
await fs4.rm(lockDir, { recursive: true, force: true });
|
|
1264
|
+
await fs4.mkdir(lockDir, { recursive: false });
|
|
1265
|
+
await writeOwner();
|
|
1266
|
+
return true;
|
|
1267
|
+
}
|
|
1268
|
+
} catch {
|
|
1269
|
+
}
|
|
1270
|
+
return false;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
async function releaseRefreshLock(watchDir) {
|
|
1274
|
+
await fs4.rm(refreshLockDir(watchDir), { recursive: true, force: true });
|
|
1275
|
+
}
|
|
1276
|
+
async function enqueueRefreshFiles(watchDir, files) {
|
|
1277
|
+
await fs4.mkdir(watchDir, { recursive: true });
|
|
1278
|
+
const queuePath = path4.join(watchDir, REFRESH_QUEUE_FILENAME);
|
|
1279
|
+
let existing = [];
|
|
1280
|
+
try {
|
|
1281
|
+
const parsed = JSON.parse(await fs4.readFile(queuePath, "utf8"));
|
|
1282
|
+
if (Array.isArray(parsed)) {
|
|
1283
|
+
existing = parsed.filter((entry) => typeof entry === "string");
|
|
1284
|
+
}
|
|
1285
|
+
} catch {
|
|
1286
|
+
}
|
|
1287
|
+
const merged = [.../* @__PURE__ */ new Set([...existing, ...files])];
|
|
1288
|
+
await fs4.writeFile(queuePath, `${JSON.stringify(merged, null, 2)}
|
|
1289
|
+
`, "utf8");
|
|
1290
|
+
}
|
|
1291
|
+
async function drainRefreshQueue(watchDir) {
|
|
1292
|
+
const queuePath = path4.join(watchDir, REFRESH_QUEUE_FILENAME);
|
|
1293
|
+
try {
|
|
1294
|
+
const parsed = JSON.parse(await fs4.readFile(queuePath, "utf8"));
|
|
1295
|
+
await fs4.rm(queuePath, { force: true });
|
|
1296
|
+
return Array.isArray(parsed) ? parsed.filter((entry) => typeof entry === "string") : [];
|
|
1297
|
+
} catch {
|
|
1298
|
+
return [];
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1238
1301
|
function hasIgnoredRepoSegment(baseDir, targetPath) {
|
|
1239
1302
|
const relativePath = path4.relative(baseDir, targetPath);
|
|
1240
1303
|
if (!relativePath || relativePath.startsWith("..")) {
|
|
@@ -1369,8 +1432,128 @@ async function performWatchCycle(rootDir, paths, options, codeOnly = false) {
|
|
|
1369
1432
|
lintFindingCount
|
|
1370
1433
|
};
|
|
1371
1434
|
}
|
|
1435
|
+
async function runFileRefreshCycle(rootDir, paths, options, files) {
|
|
1436
|
+
const resolvedFiles = [...new Set(files.map((candidate) => path4.resolve(rootDir, candidate)))];
|
|
1437
|
+
const emptyResult = {
|
|
1438
|
+
watchedRepoRoots: [],
|
|
1439
|
+
importedCount: 0,
|
|
1440
|
+
scannedCount: 0,
|
|
1441
|
+
attachmentCount: 0,
|
|
1442
|
+
repoImportedCount: 0,
|
|
1443
|
+
repoUpdatedCount: 0,
|
|
1444
|
+
repoRemovedCount: 0,
|
|
1445
|
+
repoScannedCount: 0,
|
|
1446
|
+
pendingSemanticRefreshCount: 0,
|
|
1447
|
+
pendingSemanticRefreshPaths: [],
|
|
1448
|
+
changedPages: []
|
|
1449
|
+
};
|
|
1450
|
+
if (!await tryAcquireRefreshLock(paths.watchDir)) {
|
|
1451
|
+
await enqueueRefreshFiles(paths.watchDir, resolvedFiles);
|
|
1452
|
+
return { ...emptyResult, queuedFiles: resolvedFiles };
|
|
1453
|
+
}
|
|
1454
|
+
const startedAt = /* @__PURE__ */ new Date();
|
|
1455
|
+
const reasons = resolvedFiles.map((file) => `file:${path4.relative(rootDir, file) || file}`);
|
|
1456
|
+
let success = true;
|
|
1457
|
+
let error;
|
|
1458
|
+
const result = { ...emptyResult };
|
|
1459
|
+
try {
|
|
1460
|
+
const seenRoots = /* @__PURE__ */ new Set();
|
|
1461
|
+
const changedPages = /* @__PURE__ */ new Set();
|
|
1462
|
+
let pendingFiles = resolvedFiles;
|
|
1463
|
+
let rounds = 0;
|
|
1464
|
+
while (pendingFiles.length > 0 && rounds < MAX_FILE_REFRESH_ROUNDS) {
|
|
1465
|
+
rounds += 1;
|
|
1466
|
+
const repoSync = await syncTrackedFiles(rootDir, pendingFiles);
|
|
1467
|
+
const compile = await compileVault(rootDir, { codeOnly: true });
|
|
1468
|
+
const pendingSemanticRefresh = await mergePendingSemanticRefresh(rootDir, repoSync.pendingSemanticRefresh);
|
|
1469
|
+
const stalePagePaths = await markPagesStaleForSources(
|
|
1470
|
+
rootDir,
|
|
1471
|
+
pendingSemanticRefresh.map((entry) => entry.sourceId).filter((sourceId) => Boolean(sourceId))
|
|
1472
|
+
);
|
|
1473
|
+
for (const repoRoot of repoSync.repoRoots) {
|
|
1474
|
+
seenRoots.add(repoRoot);
|
|
1475
|
+
}
|
|
1476
|
+
for (const page of [...compile.changedPages, ...stalePagePaths]) {
|
|
1477
|
+
changedPages.add(page);
|
|
1478
|
+
}
|
|
1479
|
+
result.scannedCount += repoSync.scannedCount;
|
|
1480
|
+
result.repoScannedCount += repoSync.scannedCount;
|
|
1481
|
+
result.repoImportedCount += repoSync.imported.length;
|
|
1482
|
+
result.repoUpdatedCount += repoSync.updated.length;
|
|
1483
|
+
result.repoRemovedCount += repoSync.removed.length;
|
|
1484
|
+
result.pendingSemanticRefreshCount = pendingSemanticRefresh.length;
|
|
1485
|
+
result.pendingSemanticRefreshPaths = pendingSemanticRefresh.map((entry) => entry.path);
|
|
1486
|
+
pendingFiles = await drainRefreshQueue(paths.watchDir);
|
|
1487
|
+
}
|
|
1488
|
+
if (pendingFiles.length > 0) {
|
|
1489
|
+
await enqueueRefreshFiles(paths.watchDir, pendingFiles);
|
|
1490
|
+
result.queuedFiles = pendingFiles;
|
|
1491
|
+
}
|
|
1492
|
+
result.watchedRepoRoots = [...seenRoots].sort((left, right) => left.localeCompare(right));
|
|
1493
|
+
result.changedPages = [...changedPages];
|
|
1494
|
+
if (options.lint) {
|
|
1495
|
+
result.lintFindingCount = (await lintVault(rootDir)).length;
|
|
1496
|
+
}
|
|
1497
|
+
return result;
|
|
1498
|
+
} catch (caught) {
|
|
1499
|
+
success = false;
|
|
1500
|
+
error = caught instanceof Error ? caught.message : String(caught);
|
|
1501
|
+
throw caught;
|
|
1502
|
+
} finally {
|
|
1503
|
+
await releaseRefreshLock(paths.watchDir);
|
|
1504
|
+
const finishedAt = /* @__PURE__ */ new Date();
|
|
1505
|
+
const runSummary = {
|
|
1506
|
+
startedAt: startedAt.toISOString(),
|
|
1507
|
+
finishedAt: finishedAt.toISOString(),
|
|
1508
|
+
durationMs: finishedAt.getTime() - startedAt.getTime(),
|
|
1509
|
+
inputDir: paths.inboxDir,
|
|
1510
|
+
reasons,
|
|
1511
|
+
importedCount: result.repoImportedCount + result.repoUpdatedCount,
|
|
1512
|
+
scannedCount: result.scannedCount,
|
|
1513
|
+
attachmentCount: 0,
|
|
1514
|
+
changedPages: result.changedPages,
|
|
1515
|
+
repoImportedCount: result.repoImportedCount,
|
|
1516
|
+
repoUpdatedCount: result.repoUpdatedCount,
|
|
1517
|
+
repoRemovedCount: result.repoRemovedCount,
|
|
1518
|
+
repoScannedCount: result.repoScannedCount,
|
|
1519
|
+
pendingSemanticRefreshCount: result.pendingSemanticRefreshCount,
|
|
1520
|
+
pendingSemanticRefreshPaths: result.pendingSemanticRefreshPaths,
|
|
1521
|
+
lintFindingCount: result.lintFindingCount,
|
|
1522
|
+
success,
|
|
1523
|
+
error
|
|
1524
|
+
};
|
|
1525
|
+
await recordSession(rootDir, {
|
|
1526
|
+
operation: "watch",
|
|
1527
|
+
title: `File refresh for ${reasons.join(", ")}`,
|
|
1528
|
+
startedAt: startedAt.toISOString(),
|
|
1529
|
+
finishedAt: finishedAt.toISOString(),
|
|
1530
|
+
success,
|
|
1531
|
+
error,
|
|
1532
|
+
changedPages: result.changedPages,
|
|
1533
|
+
lintFindingCount: result.lintFindingCount,
|
|
1534
|
+
lines: [
|
|
1535
|
+
`reasons=${reasons.join(",")}`,
|
|
1536
|
+
`repo_imported=${result.repoImportedCount}`,
|
|
1537
|
+
`repo_updated=${result.repoUpdatedCount}`,
|
|
1538
|
+
`repo_removed=${result.repoRemovedCount}`,
|
|
1539
|
+
`pending_semantic_refresh=${result.pendingSemanticRefreshCount}`,
|
|
1540
|
+
`lint=${result.lintFindingCount ?? 0}`
|
|
1541
|
+
]
|
|
1542
|
+
});
|
|
1543
|
+
await appendWatchRun(rootDir, runSummary);
|
|
1544
|
+
await writeWatchStatusArtifact(rootDir, {
|
|
1545
|
+
generatedAt: finishedAt.toISOString(),
|
|
1546
|
+
watchedRepoRoots: result.watchedRepoRoots,
|
|
1547
|
+
lastRun: runSummary,
|
|
1548
|
+
pendingSemanticRefresh: await readPendingSemanticRefresh(rootDir)
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1372
1552
|
async function runWatchCycle(rootDir, options = {}) {
|
|
1373
1553
|
const { paths } = await initWorkspace(rootDir);
|
|
1554
|
+
if (options.files && options.files.length > 0) {
|
|
1555
|
+
return runFileRefreshCycle(rootDir, paths, options, options.files);
|
|
1556
|
+
}
|
|
1374
1557
|
const previousGraph = await readJsonFile(paths.graphPath);
|
|
1375
1558
|
const startedAt = /* @__PURE__ */ new Date();
|
|
1376
1559
|
let success = true;
|
|
@@ -3509,8 +3692,26 @@ function renderHtmlStandalone(graph) {
|
|
|
3509
3692
|
var seedPageIds = coreUnique(matches.filter(function(m) { return m.type === "page"; }).map(function(m) { return m.id; }));
|
|
3510
3693
|
var visitedEdgeIdList = Object.keys(visitedEdgeIds);
|
|
3511
3694
|
|
|
3695
|
+
var topMatchParts = matches.slice(0, 8).map(function(m) {
|
|
3696
|
+
var pagePath;
|
|
3697
|
+
if (m.type === "page") {
|
|
3698
|
+
pagePath = (CORE_PAGE_BY_ID[m.id] && CORE_PAGE_BY_ID[m.id].path) || m.id;
|
|
3699
|
+
} else if (m.type === "node") {
|
|
3700
|
+
var matchNode = CORE_NODE_BY_ID[m.id];
|
|
3701
|
+
var matchPageId = matchNode && matchNode.pageId;
|
|
3702
|
+
if (matchPageId) pagePath = (CORE_PAGE_BY_ID[matchPageId] && CORE_PAGE_BY_ID[matchPageId].path) || matchPageId;
|
|
3703
|
+
}
|
|
3704
|
+
return (m.label || m.id) + " (" + m.type + ", score " + m.score + (pagePath ? ", page " + pagePath : "") + ")";
|
|
3705
|
+
});
|
|
3706
|
+
var topMatchesLine = matches.length
|
|
3707
|
+
? "Top matches: " + topMatchParts.join("; ") + (matches.length > 8 ? " (+" + (matches.length - 8) + " more)" : "")
|
|
3708
|
+
: "Top matches: none";
|
|
3709
|
+
var seedsLine = seeds.length
|
|
3710
|
+
? "Seeds: " + seeds.slice(0, 15).join(", ") + (seeds.length > 15 ? " (+" + (seeds.length - 15) + " more)" : "")
|
|
3711
|
+
: "Seeds: none";
|
|
3512
3712
|
var summary = [
|
|
3513
|
-
|
|
3713
|
+
topMatchesLine,
|
|
3714
|
+
seedsLine,
|
|
3514
3715
|
"Visited nodes: " + visitedNodeIds.length,
|
|
3515
3716
|
"Visited edges: " + visitedEdgeIdList.length,
|
|
3516
3717
|
"Touched group patterns: " + hyperedgeIds.length,
|
|
@@ -5465,8 +5666,12 @@ async function removeHookBlock(filePath) {
|
|
|
5465
5666
|
await fs9.writeFile(filePath, `${next}
|
|
5466
5667
|
`, "utf8");
|
|
5467
5668
|
}
|
|
5468
|
-
async function
|
|
5469
|
-
const
|
|
5669
|
+
async function resolveHookRepoRoot(rootDir, options = {}) {
|
|
5670
|
+
const start = options.repoPath ? path11.resolve(rootDir, options.repoPath) : rootDir;
|
|
5671
|
+
return findNearestGitRoot(start);
|
|
5672
|
+
}
|
|
5673
|
+
async function getGitHookStatus(rootDir, options = {}) {
|
|
5674
|
+
const repoRoot = await resolveHookRepoRoot(rootDir, options);
|
|
5470
5675
|
if (!repoRoot) {
|
|
5471
5676
|
return {
|
|
5472
5677
|
repoRoot: null,
|
|
@@ -5480,18 +5685,20 @@ async function getGitHookStatus(rootDir) {
|
|
|
5480
5685
|
postCheckout: await readHookStatus(hookPath(repoRoot, "post-checkout"))
|
|
5481
5686
|
};
|
|
5482
5687
|
}
|
|
5483
|
-
async function installGitHooks(rootDir) {
|
|
5484
|
-
const repoRoot = await
|
|
5688
|
+
async function installGitHooks(rootDir, options = {}) {
|
|
5689
|
+
const repoRoot = await resolveHookRepoRoot(rootDir, options);
|
|
5485
5690
|
if (!repoRoot) {
|
|
5486
|
-
throw new Error(
|
|
5691
|
+
throw new Error(
|
|
5692
|
+
options.repoPath ? `No git repository found at or above ${options.repoPath}.` : "No git repository found above the current vault. Pass a repo path (swarmvault hook install <repo>) when the tracked repo lives below the vault root."
|
|
5693
|
+
);
|
|
5487
5694
|
}
|
|
5488
5695
|
const block = managedHookBlock(path11.resolve(rootDir));
|
|
5489
5696
|
await upsertHookFile(hookPath(repoRoot, "post-commit"), block);
|
|
5490
5697
|
await upsertHookFile(hookPath(repoRoot, "post-checkout"), block);
|
|
5491
|
-
return getGitHookStatus(rootDir);
|
|
5698
|
+
return getGitHookStatus(rootDir, options);
|
|
5492
5699
|
}
|
|
5493
|
-
async function uninstallGitHooks(rootDir) {
|
|
5494
|
-
const repoRoot = await
|
|
5700
|
+
async function uninstallGitHooks(rootDir, options = {}) {
|
|
5701
|
+
const repoRoot = await resolveHookRepoRoot(rootDir, options);
|
|
5495
5702
|
if (!repoRoot) {
|
|
5496
5703
|
return {
|
|
5497
5704
|
repoRoot: null,
|
|
@@ -5501,7 +5708,7 @@ async function uninstallGitHooks(rootDir) {
|
|
|
5501
5708
|
}
|
|
5502
5709
|
await removeHookBlock(hookPath(repoRoot, "post-commit"));
|
|
5503
5710
|
await removeHookBlock(hookPath(repoRoot, "post-checkout"));
|
|
5504
|
-
return getGitHookStatus(rootDir);
|
|
5711
|
+
return getGitHookStatus(rootDir, options);
|
|
5505
5712
|
}
|
|
5506
5713
|
|
|
5507
5714
|
// src/mcp.ts
|
|
@@ -5510,7 +5717,7 @@ import path12 from "path";
|
|
|
5510
5717
|
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5511
5718
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5512
5719
|
import { z } from "zod";
|
|
5513
|
-
var SERVER_VERSION = "3.
|
|
5720
|
+
var SERVER_VERSION = "3.18.0";
|
|
5514
5721
|
var codeLanguageSchema = z.enum([
|
|
5515
5722
|
"javascript",
|
|
5516
5723
|
"jsx",
|
|
@@ -6175,6 +6382,38 @@ async function createMcpServer(rootDir) {
|
|
|
6175
6382
|
return asToolText(status);
|
|
6176
6383
|
})
|
|
6177
6384
|
);
|
|
6385
|
+
server.registerTool(
|
|
6386
|
+
"graph_status",
|
|
6387
|
+
{
|
|
6388
|
+
description: "Read-only graph freshness check: graph/report presence, tracked repo changes since the last refresh, and the recommended refresh command.",
|
|
6389
|
+
inputSchema: {
|
|
6390
|
+
repoRoots: z.array(z.string()).optional().describe("Optional repo roots to check instead of configured/tracked roots")
|
|
6391
|
+
}
|
|
6392
|
+
},
|
|
6393
|
+
safeHandler(async ({ repoRoots }) => {
|
|
6394
|
+
const status = await getGraphStatus(rootDir, { repoRoots });
|
|
6395
|
+
return asToolText(status);
|
|
6396
|
+
})
|
|
6397
|
+
);
|
|
6398
|
+
server.registerTool(
|
|
6399
|
+
"update_graph",
|
|
6400
|
+
{
|
|
6401
|
+
description: "Code-only graph refresh. With files, refreshes just those files (fast path used after edits); otherwise walks tracked repo roots.",
|
|
6402
|
+
inputSchema: {
|
|
6403
|
+
files: z.array(z.string()).optional().describe("Refresh only these files instead of walking every tracked repo root"),
|
|
6404
|
+
force: z.boolean().optional().describe("Allow updates even when node or edge counts shrink sharply")
|
|
6405
|
+
}
|
|
6406
|
+
},
|
|
6407
|
+
safeHandler(async ({ files, force }) => {
|
|
6408
|
+
const result = await runWatchCycle(rootDir, {
|
|
6409
|
+
repo: true,
|
|
6410
|
+
codeOnly: true,
|
|
6411
|
+
force: force ?? false,
|
|
6412
|
+
files: files?.length ? files : void 0
|
|
6413
|
+
});
|
|
6414
|
+
return asToolText(result);
|
|
6415
|
+
})
|
|
6416
|
+
);
|
|
6178
6417
|
server.registerTool(
|
|
6179
6418
|
"consolidate",
|
|
6180
6419
|
{
|
|
@@ -9929,6 +10168,7 @@ export {
|
|
|
9929
10168
|
startMcpServer,
|
|
9930
10169
|
startMemoryTask,
|
|
9931
10170
|
summarizeLocalWhisperSetup,
|
|
10171
|
+
syncTrackedFiles,
|
|
9932
10172
|
syncTrackedRepos,
|
|
9933
10173
|
syncTrackedReposForWatch,
|
|
9934
10174
|
synthesizeHyperedgeHubs,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMemoryGraphElements,
|
|
3
|
+
ensureMemoryLedger,
|
|
4
|
+
estimateMemoryTaskTokens,
|
|
5
|
+
finishMemoryTask,
|
|
6
|
+
listMemoryTasks,
|
|
7
|
+
loadMemoryTaskPages,
|
|
8
|
+
memoryTaskHashes,
|
|
9
|
+
memoryTaskPageRecord,
|
|
10
|
+
readMemoryTask,
|
|
11
|
+
renderMemoryTaskMarkdown,
|
|
12
|
+
resumeMemoryTask,
|
|
13
|
+
startMemoryTask,
|
|
14
|
+
updateMemoryTask
|
|
15
|
+
} from "./chunk-DCSXDZAF.js";
|
|
16
|
+
import "./chunk-NON6BVEI.js";
|
|
17
|
+
import "./chunk-NAIERP4C.js";
|
|
18
|
+
export {
|
|
19
|
+
buildMemoryGraphElements,
|
|
20
|
+
ensureMemoryLedger,
|
|
21
|
+
estimateMemoryTaskTokens,
|
|
22
|
+
finishMemoryTask,
|
|
23
|
+
listMemoryTasks,
|
|
24
|
+
loadMemoryTaskPages,
|
|
25
|
+
memoryTaskHashes,
|
|
26
|
+
memoryTaskPageRecord,
|
|
27
|
+
readMemoryTask,
|
|
28
|
+
renderMemoryTaskMarkdown,
|
|
29
|
+
resumeMemoryTask,
|
|
30
|
+
startMemoryTask,
|
|
31
|
+
updateMemoryTask
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMemoryGraphElements,
|
|
3
|
+
ensureMemoryLedger,
|
|
4
|
+
estimateMemoryTaskTokens,
|
|
5
|
+
finishMemoryTask,
|
|
6
|
+
listMemoryTasks,
|
|
7
|
+
loadMemoryTaskPages,
|
|
8
|
+
memoryTaskHashes,
|
|
9
|
+
memoryTaskPageRecord,
|
|
10
|
+
readMemoryTask,
|
|
11
|
+
renderMemoryTaskMarkdown,
|
|
12
|
+
resumeMemoryTask,
|
|
13
|
+
startMemoryTask,
|
|
14
|
+
updateMemoryTask
|
|
15
|
+
} from "./chunk-CSPDMCON.js";
|
|
16
|
+
import "./chunk-75BU5TQ6.js";
|
|
17
|
+
import "./chunk-NAIERP4C.js";
|
|
18
|
+
export {
|
|
19
|
+
buildMemoryGraphElements,
|
|
20
|
+
ensureMemoryLedger,
|
|
21
|
+
estimateMemoryTaskTokens,
|
|
22
|
+
finishMemoryTask,
|
|
23
|
+
listMemoryTasks,
|
|
24
|
+
loadMemoryTaskPages,
|
|
25
|
+
memoryTaskHashes,
|
|
26
|
+
memoryTaskPageRecord,
|
|
27
|
+
readMemoryTask,
|
|
28
|
+
renderMemoryTaskMarkdown,
|
|
29
|
+
resumeMemoryTask,
|
|
30
|
+
startMemoryTask,
|
|
31
|
+
updateMemoryTask
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMemoryGraphElements,
|
|
3
|
+
ensureMemoryLedger,
|
|
4
|
+
estimateMemoryTaskTokens,
|
|
5
|
+
finishMemoryTask,
|
|
6
|
+
listMemoryTasks,
|
|
7
|
+
loadMemoryTaskPages,
|
|
8
|
+
memoryTaskHashes,
|
|
9
|
+
memoryTaskPageRecord,
|
|
10
|
+
readMemoryTask,
|
|
11
|
+
renderMemoryTaskMarkdown,
|
|
12
|
+
resumeMemoryTask,
|
|
13
|
+
startMemoryTask,
|
|
14
|
+
updateMemoryTask
|
|
15
|
+
} from "./chunk-S2E65WRI.js";
|
|
16
|
+
import "./chunk-7O2HJSWQ.js";
|
|
17
|
+
import "./chunk-NAIERP4C.js";
|
|
18
|
+
export {
|
|
19
|
+
buildMemoryGraphElements,
|
|
20
|
+
ensureMemoryLedger,
|
|
21
|
+
estimateMemoryTaskTokens,
|
|
22
|
+
finishMemoryTask,
|
|
23
|
+
listMemoryTasks,
|
|
24
|
+
loadMemoryTaskPages,
|
|
25
|
+
memoryTaskHashes,
|
|
26
|
+
memoryTaskPageRecord,
|
|
27
|
+
readMemoryTask,
|
|
28
|
+
renderMemoryTaskMarkdown,
|
|
29
|
+
resumeMemoryTask,
|
|
30
|
+
startMemoryTask,
|
|
31
|
+
updateMemoryTask
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMemoryGraphElements,
|
|
3
|
+
ensureMemoryLedger,
|
|
4
|
+
estimateMemoryTaskTokens,
|
|
5
|
+
finishMemoryTask,
|
|
6
|
+
listMemoryTasks,
|
|
7
|
+
loadMemoryTaskPages,
|
|
8
|
+
memoryTaskHashes,
|
|
9
|
+
memoryTaskPageRecord,
|
|
10
|
+
readMemoryTask,
|
|
11
|
+
renderMemoryTaskMarkdown,
|
|
12
|
+
resumeMemoryTask,
|
|
13
|
+
startMemoryTask,
|
|
14
|
+
updateMemoryTask
|
|
15
|
+
} from "./chunk-CVFY54CF.js";
|
|
16
|
+
import "./chunk-UQCF65BN.js";
|
|
17
|
+
import "./chunk-NAIERP4C.js";
|
|
18
|
+
export {
|
|
19
|
+
buildMemoryGraphElements,
|
|
20
|
+
ensureMemoryLedger,
|
|
21
|
+
estimateMemoryTaskTokens,
|
|
22
|
+
finishMemoryTask,
|
|
23
|
+
listMemoryTasks,
|
|
24
|
+
loadMemoryTaskPages,
|
|
25
|
+
memoryTaskHashes,
|
|
26
|
+
memoryTaskPageRecord,
|
|
27
|
+
readMemoryTask,
|
|
28
|
+
renderMemoryTaskMarkdown,
|
|
29
|
+
resumeMemoryTask,
|
|
30
|
+
startMemoryTask,
|
|
31
|
+
updateMemoryTask
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMemoryGraphElements,
|
|
3
|
+
ensureMemoryLedger,
|
|
4
|
+
estimateMemoryTaskTokens,
|
|
5
|
+
finishMemoryTask,
|
|
6
|
+
listMemoryTasks,
|
|
7
|
+
loadMemoryTaskPages,
|
|
8
|
+
memoryTaskHashes,
|
|
9
|
+
memoryTaskPageRecord,
|
|
10
|
+
readMemoryTask,
|
|
11
|
+
renderMemoryTaskMarkdown,
|
|
12
|
+
resumeMemoryTask,
|
|
13
|
+
startMemoryTask,
|
|
14
|
+
updateMemoryTask
|
|
15
|
+
} from "./chunk-5GEPTIZE.js";
|
|
16
|
+
import "./chunk-7O2HJSWQ.js";
|
|
17
|
+
import "./chunk-NAIERP4C.js";
|
|
18
|
+
export {
|
|
19
|
+
buildMemoryGraphElements,
|
|
20
|
+
ensureMemoryLedger,
|
|
21
|
+
estimateMemoryTaskTokens,
|
|
22
|
+
finishMemoryTask,
|
|
23
|
+
listMemoryTasks,
|
|
24
|
+
loadMemoryTaskPages,
|
|
25
|
+
memoryTaskHashes,
|
|
26
|
+
memoryTaskPageRecord,
|
|
27
|
+
readMemoryTask,
|
|
28
|
+
renderMemoryTaskMarkdown,
|
|
29
|
+
resumeMemoryTask,
|
|
30
|
+
startMemoryTask,
|
|
31
|
+
updateMemoryTask
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMemoryGraphElements,
|
|
3
|
+
ensureMemoryLedger,
|
|
4
|
+
estimateMemoryTaskTokens,
|
|
5
|
+
finishMemoryTask,
|
|
6
|
+
listMemoryTasks,
|
|
7
|
+
loadMemoryTaskPages,
|
|
8
|
+
memoryTaskHashes,
|
|
9
|
+
memoryTaskPageRecord,
|
|
10
|
+
readMemoryTask,
|
|
11
|
+
renderMemoryTaskMarkdown,
|
|
12
|
+
resumeMemoryTask,
|
|
13
|
+
startMemoryTask,
|
|
14
|
+
updateMemoryTask
|
|
15
|
+
} from "./chunk-JTRE7C7P.js";
|
|
16
|
+
import "./chunk-7O2HJSWQ.js";
|
|
17
|
+
import "./chunk-NAIERP4C.js";
|
|
18
|
+
export {
|
|
19
|
+
buildMemoryGraphElements,
|
|
20
|
+
ensureMemoryLedger,
|
|
21
|
+
estimateMemoryTaskTokens,
|
|
22
|
+
finishMemoryTask,
|
|
23
|
+
listMemoryTasks,
|
|
24
|
+
loadMemoryTaskPages,
|
|
25
|
+
memoryTaskHashes,
|
|
26
|
+
memoryTaskPageRecord,
|
|
27
|
+
readMemoryTask,
|
|
28
|
+
renderMemoryTaskMarkdown,
|
|
29
|
+
resumeMemoryTask,
|
|
30
|
+
startMemoryTask,
|
|
31
|
+
updateMemoryTask
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMemoryGraphElements,
|
|
3
|
+
ensureMemoryLedger,
|
|
4
|
+
estimateMemoryTaskTokens,
|
|
5
|
+
finishMemoryTask,
|
|
6
|
+
listMemoryTasks,
|
|
7
|
+
loadMemoryTaskPages,
|
|
8
|
+
memoryTaskHashes,
|
|
9
|
+
memoryTaskPageRecord,
|
|
10
|
+
readMemoryTask,
|
|
11
|
+
renderMemoryTaskMarkdown,
|
|
12
|
+
resumeMemoryTask,
|
|
13
|
+
startMemoryTask,
|
|
14
|
+
updateMemoryTask
|
|
15
|
+
} from "./chunk-VSDBQVSE.js";
|
|
16
|
+
import "./chunk-NON6BVEI.js";
|
|
17
|
+
import "./chunk-NAIERP4C.js";
|
|
18
|
+
export {
|
|
19
|
+
buildMemoryGraphElements,
|
|
20
|
+
ensureMemoryLedger,
|
|
21
|
+
estimateMemoryTaskTokens,
|
|
22
|
+
finishMemoryTask,
|
|
23
|
+
listMemoryTasks,
|
|
24
|
+
loadMemoryTaskPages,
|
|
25
|
+
memoryTaskHashes,
|
|
26
|
+
memoryTaskPageRecord,
|
|
27
|
+
readMemoryTask,
|
|
28
|
+
renderMemoryTaskMarkdown,
|
|
29
|
+
resumeMemoryTask,
|
|
30
|
+
startMemoryTask,
|
|
31
|
+
updateMemoryTask
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMemoryGraphElements,
|
|
3
|
+
ensureMemoryLedger,
|
|
4
|
+
estimateMemoryTaskTokens,
|
|
5
|
+
finishMemoryTask,
|
|
6
|
+
listMemoryTasks,
|
|
7
|
+
loadMemoryTaskPages,
|
|
8
|
+
memoryTaskHashes,
|
|
9
|
+
memoryTaskPageRecord,
|
|
10
|
+
readMemoryTask,
|
|
11
|
+
renderMemoryTaskMarkdown,
|
|
12
|
+
resumeMemoryTask,
|
|
13
|
+
startMemoryTask,
|
|
14
|
+
updateMemoryTask
|
|
15
|
+
} from "./chunk-HORJDLXV.js";
|
|
16
|
+
import "./chunk-NON6BVEI.js";
|
|
17
|
+
import "./chunk-NAIERP4C.js";
|
|
18
|
+
export {
|
|
19
|
+
buildMemoryGraphElements,
|
|
20
|
+
ensureMemoryLedger,
|
|
21
|
+
estimateMemoryTaskTokens,
|
|
22
|
+
finishMemoryTask,
|
|
23
|
+
listMemoryTasks,
|
|
24
|
+
loadMemoryTaskPages,
|
|
25
|
+
memoryTaskHashes,
|
|
26
|
+
memoryTaskPageRecord,
|
|
27
|
+
readMemoryTask,
|
|
28
|
+
renderMemoryTaskMarkdown,
|
|
29
|
+
resumeMemoryTask,
|
|
30
|
+
startMemoryTask,
|
|
31
|
+
updateMemoryTask
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMemoryGraphElements,
|
|
3
|
+
ensureMemoryLedger,
|
|
4
|
+
estimateMemoryTaskTokens,
|
|
5
|
+
finishMemoryTask,
|
|
6
|
+
listMemoryTasks,
|
|
7
|
+
loadMemoryTaskPages,
|
|
8
|
+
memoryTaskHashes,
|
|
9
|
+
memoryTaskPageRecord,
|
|
10
|
+
readMemoryTask,
|
|
11
|
+
renderMemoryTaskMarkdown,
|
|
12
|
+
resumeMemoryTask,
|
|
13
|
+
startMemoryTask,
|
|
14
|
+
updateMemoryTask
|
|
15
|
+
} from "./chunk-V7KX3AQD.js";
|
|
16
|
+
import "./chunk-7O2HJSWQ.js";
|
|
17
|
+
import "./chunk-NAIERP4C.js";
|
|
18
|
+
export {
|
|
19
|
+
buildMemoryGraphElements,
|
|
20
|
+
ensureMemoryLedger,
|
|
21
|
+
estimateMemoryTaskTokens,
|
|
22
|
+
finishMemoryTask,
|
|
23
|
+
listMemoryTasks,
|
|
24
|
+
loadMemoryTaskPages,
|
|
25
|
+
memoryTaskHashes,
|
|
26
|
+
memoryTaskPageRecord,
|
|
27
|
+
readMemoryTask,
|
|
28
|
+
renderMemoryTaskMarkdown,
|
|
29
|
+
resumeMemoryTask,
|
|
30
|
+
startMemoryTask,
|
|
31
|
+
updateMemoryTask
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildMemoryGraphElements,
|
|
3
|
+
ensureMemoryLedger,
|
|
4
|
+
estimateMemoryTaskTokens,
|
|
5
|
+
finishMemoryTask,
|
|
6
|
+
listMemoryTasks,
|
|
7
|
+
loadMemoryTaskPages,
|
|
8
|
+
memoryTaskHashes,
|
|
9
|
+
memoryTaskPageRecord,
|
|
10
|
+
readMemoryTask,
|
|
11
|
+
renderMemoryTaskMarkdown,
|
|
12
|
+
resumeMemoryTask,
|
|
13
|
+
startMemoryTask,
|
|
14
|
+
updateMemoryTask
|
|
15
|
+
} from "./chunk-2PN46RDI.js";
|
|
16
|
+
import "./chunk-75BU5TQ6.js";
|
|
17
|
+
import "./chunk-NAIERP4C.js";
|
|
18
|
+
export {
|
|
19
|
+
buildMemoryGraphElements,
|
|
20
|
+
ensureMemoryLedger,
|
|
21
|
+
estimateMemoryTaskTokens,
|
|
22
|
+
finishMemoryTask,
|
|
23
|
+
listMemoryTasks,
|
|
24
|
+
loadMemoryTaskPages,
|
|
25
|
+
memoryTaskHashes,
|
|
26
|
+
memoryTaskPageRecord,
|
|
27
|
+
readMemoryTask,
|
|
28
|
+
renderMemoryTaskMarkdown,
|
|
29
|
+
resumeMemoryTask,
|
|
30
|
+
startMemoryTask,
|
|
31
|
+
updateMemoryTask
|
|
32
|
+
};
|