mcp-agents-memory 0.9.4 → 0.9.6
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 +35 -4
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -57123,7 +57123,16 @@ var _watcher = null;
|
|
|
57123
57123
|
var _flushInProgress2 = false;
|
|
57124
57124
|
var _flushPending2 = false;
|
|
57125
57125
|
var _flushDebounceTimer2 = null;
|
|
57126
|
+
function cwdToSlug(cwd) {
|
|
57127
|
+
return cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
57128
|
+
}
|
|
57126
57129
|
function findProjectDir(cwd) {
|
|
57130
|
+
const slug = cwdToSlug(cwd);
|
|
57131
|
+
const slugPath = path4.join(PROJECTS_ROOT, slug);
|
|
57132
|
+
try {
|
|
57133
|
+
if (fs3.statSync(slugPath).isDirectory()) return slugPath;
|
|
57134
|
+
} catch {
|
|
57135
|
+
}
|
|
57127
57136
|
let subdirs;
|
|
57128
57137
|
try {
|
|
57129
57138
|
subdirs = fs3.readdirSync(PROJECTS_ROOT, { withFileTypes: true });
|
|
@@ -57139,10 +57148,11 @@ function findProjectDir(cwd) {
|
|
|
57139
57148
|
} catch {
|
|
57140
57149
|
continue;
|
|
57141
57150
|
}
|
|
57142
|
-
const
|
|
57143
|
-
|
|
57144
|
-
|
|
57145
|
-
|
|
57151
|
+
for (const f of files) {
|
|
57152
|
+
if (!f.isFile() || !f.name.endsWith(".jsonl")) continue;
|
|
57153
|
+
const foundCwd = readCwdFromJsonl(path4.join(dirPath, f.name));
|
|
57154
|
+
if (foundCwd === cwd) return dirPath;
|
|
57155
|
+
}
|
|
57146
57156
|
}
|
|
57147
57157
|
return null;
|
|
57148
57158
|
}
|
|
@@ -57172,10 +57182,28 @@ function readCwdFromJsonl(jsonlPath) {
|
|
|
57172
57182
|
}
|
|
57173
57183
|
function captureSessionStart2(cwd) {
|
|
57174
57184
|
_state2 = { cwd, projectDir: null, files: /* @__PURE__ */ new Map() };
|
|
57185
|
+
_tryArm(cwd, 0);
|
|
57186
|
+
}
|
|
57187
|
+
var _MAX_ARM_RETRIES = 20;
|
|
57188
|
+
function _tryArm(cwd, attempt) {
|
|
57175
57189
|
const projectDir = findProjectDir(cwd);
|
|
57176
57190
|
if (!projectDir) {
|
|
57191
|
+
if (attempt < _MAX_ARM_RETRIES) {
|
|
57192
|
+
setTimeout(() => {
|
|
57193
|
+
if (!_state2 || _state2.cwd !== cwd) return;
|
|
57194
|
+
_tryArm(cwd, attempt + 1);
|
|
57195
|
+
}, 500);
|
|
57196
|
+
} else {
|
|
57197
|
+
console.error(
|
|
57198
|
+
`\u26A0\uFE0F [JSONL] project dir not found after ${_MAX_ARM_RETRIES} retries \u2014 capture \uAC74\uB108\uB700.
|
|
57199
|
+
cwd="${cwd}"
|
|
57200
|
+
PROJECTS_ROOT="${PROJECTS_ROOT}"
|
|
57201
|
+
expected slug="${cwdToSlug(cwd)}"`
|
|
57202
|
+
);
|
|
57203
|
+
}
|
|
57177
57204
|
return;
|
|
57178
57205
|
}
|
|
57206
|
+
if (!_state2 || _state2.cwd !== cwd) return;
|
|
57179
57207
|
_state2.projectDir = projectDir;
|
|
57180
57208
|
let entries;
|
|
57181
57209
|
try {
|
|
@@ -57195,6 +57223,9 @@ function captureSessionStart2(cwd) {
|
|
|
57195
57223
|
const sessionId = entry.name.replace(/\.jsonl$/, "");
|
|
57196
57224
|
_state2.files.set(jsonlPath, { cursorBytes: stat.size, sessionId, contentSeen: /* @__PURE__ */ new Set() });
|
|
57197
57225
|
}
|
|
57226
|
+
if (attempt > 0) {
|
|
57227
|
+
console.error(`\u{1F4DD} [JSONL] project dir found on retry #${attempt}: ${path4.basename(projectDir)}/`);
|
|
57228
|
+
}
|
|
57198
57229
|
console.error(`\u{1F4DD} [JSONL] capture armed: ${_state2.files.size} jsonl(s) in ${path4.basename(projectDir)}/`);
|
|
57199
57230
|
armDirWatcher();
|
|
57200
57231
|
}
|