mcp-agents-memory 0.9.0 → 0.9.1
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/build/index.js +48 -5
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -56567,14 +56567,57 @@ var _watcher = null;
|
|
|
56567
56567
|
var _flushInProgress = false;
|
|
56568
56568
|
var _flushPending = false;
|
|
56569
56569
|
var _flushDebounceTimer = null;
|
|
56570
|
-
function
|
|
56571
|
-
|
|
56572
|
-
|
|
56570
|
+
function findProjectDir(cwd) {
|
|
56571
|
+
let subdirs;
|
|
56572
|
+
try {
|
|
56573
|
+
subdirs = fs2.readdirSync(PROJECTS_ROOT, { withFileTypes: true });
|
|
56574
|
+
} catch {
|
|
56575
|
+
return null;
|
|
56576
|
+
}
|
|
56577
|
+
for (const subdir of subdirs) {
|
|
56578
|
+
if (!subdir.isDirectory()) continue;
|
|
56579
|
+
const dirPath = path3.join(PROJECTS_ROOT, subdir.name);
|
|
56580
|
+
let files;
|
|
56581
|
+
try {
|
|
56582
|
+
files = fs2.readdirSync(dirPath, { withFileTypes: true });
|
|
56583
|
+
} catch {
|
|
56584
|
+
continue;
|
|
56585
|
+
}
|
|
56586
|
+
const jsonlFile = files.find((f) => f.isFile() && f.name.endsWith(".jsonl"));
|
|
56587
|
+
if (!jsonlFile) continue;
|
|
56588
|
+
const foundCwd = readCwdFromJsonl(path3.join(dirPath, jsonlFile.name));
|
|
56589
|
+
if (foundCwd === cwd) return dirPath;
|
|
56590
|
+
}
|
|
56591
|
+
return null;
|
|
56592
|
+
}
|
|
56593
|
+
function readCwdFromJsonl(jsonlPath) {
|
|
56594
|
+
let fd;
|
|
56595
|
+
try {
|
|
56596
|
+
fd = fs2.openSync(jsonlPath, "r");
|
|
56597
|
+
} catch {
|
|
56598
|
+
return null;
|
|
56599
|
+
}
|
|
56600
|
+
try {
|
|
56601
|
+
const buf = Buffer.alloc(2048);
|
|
56602
|
+
const bytesRead = fs2.readSync(fd, buf, 0, 2048, 0);
|
|
56603
|
+
const raw = buf.slice(0, bytesRead).toString("utf-8");
|
|
56604
|
+
for (const line of raw.split("\n")) {
|
|
56605
|
+
if (!line.trim()) continue;
|
|
56606
|
+
try {
|
|
56607
|
+
const entry = JSON.parse(line);
|
|
56608
|
+
if (typeof entry.cwd === "string") return entry.cwd;
|
|
56609
|
+
} catch {
|
|
56610
|
+
}
|
|
56611
|
+
}
|
|
56612
|
+
return null;
|
|
56613
|
+
} finally {
|
|
56614
|
+
fs2.closeSync(fd);
|
|
56615
|
+
}
|
|
56573
56616
|
}
|
|
56574
56617
|
function captureSessionStart(cwd) {
|
|
56575
|
-
const projectDir = deriveProjectDir(cwd);
|
|
56576
56618
|
_state = { cwd, projectDir: null, files: /* @__PURE__ */ new Map() };
|
|
56577
|
-
|
|
56619
|
+
const projectDir = findProjectDir(cwd);
|
|
56620
|
+
if (!projectDir) {
|
|
56578
56621
|
return;
|
|
56579
56622
|
}
|
|
56580
56623
|
_state.projectDir = projectDir;
|