mcp-agents-memory 0.9.5 → 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 +25 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -57123,8 +57123,11 @@ 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) {
|
|
57127
|
-
const slug = cwd
|
|
57130
|
+
const slug = cwdToSlug(cwd);
|
|
57128
57131
|
const slugPath = path4.join(PROJECTS_ROOT, slug);
|
|
57129
57132
|
try {
|
|
57130
57133
|
if (fs3.statSync(slugPath).isDirectory()) return slugPath;
|
|
@@ -57179,10 +57182,28 @@ function readCwdFromJsonl(jsonlPath) {
|
|
|
57179
57182
|
}
|
|
57180
57183
|
function captureSessionStart2(cwd) {
|
|
57181
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) {
|
|
57182
57189
|
const projectDir = findProjectDir(cwd);
|
|
57183
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
|
+
}
|
|
57184
57204
|
return;
|
|
57185
57205
|
}
|
|
57206
|
+
if (!_state2 || _state2.cwd !== cwd) return;
|
|
57186
57207
|
_state2.projectDir = projectDir;
|
|
57187
57208
|
let entries;
|
|
57188
57209
|
try {
|
|
@@ -57202,6 +57223,9 @@ function captureSessionStart2(cwd) {
|
|
|
57202
57223
|
const sessionId = entry.name.replace(/\.jsonl$/, "");
|
|
57203
57224
|
_state2.files.set(jsonlPath, { cursorBytes: stat.size, sessionId, contentSeen: /* @__PURE__ */ new Set() });
|
|
57204
57225
|
}
|
|
57226
|
+
if (attempt > 0) {
|
|
57227
|
+
console.error(`\u{1F4DD} [JSONL] project dir found on retry #${attempt}: ${path4.basename(projectDir)}/`);
|
|
57228
|
+
}
|
|
57205
57229
|
console.error(`\u{1F4DD} [JSONL] capture armed: ${_state2.files.size} jsonl(s) in ${path4.basename(projectDir)}/`);
|
|
57206
57230
|
armDirWatcher();
|
|
57207
57231
|
}
|