engine7 7.1.15 → 7.1.17
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/cli.mjs +7 -18
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -165,11 +165,10 @@ function collectRecentSessions(agentsDir, _days = 7) {
|
|
|
165
165
|
scanSessionsDir(agentsDir);
|
|
166
166
|
const mainSessionId = readMainSessionId(path.join(agentsDir, "main", "sessions", "platform-map.json"));
|
|
167
167
|
for (const [sessionKey, group] of sessionGroups) {
|
|
168
|
+
if (!mainSessionId || !sessionKey.includes(mainSessionId)) continue;
|
|
168
169
|
if (group.jsonl) files.push(group.jsonl);
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if (group.archived.length > 0) files.push(group.archived[0].file);
|
|
172
|
-
}
|
|
170
|
+
group.archived.sort((a, b) => b.mtime - a.mtime);
|
|
171
|
+
if (group.archived.length > 0) files.push(group.archived[0].file);
|
|
173
172
|
}
|
|
174
173
|
return files;
|
|
175
174
|
}
|
|
@@ -233,13 +232,8 @@ async function doExport(opts) {
|
|
|
233
232
|
const relPath = path.relative(stateDir, srcFile);
|
|
234
233
|
const destFile = path.join(stagingDir, relPath);
|
|
235
234
|
fs.mkdirSync(path.dirname(destFile), { recursive: true });
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
const content = fs.readFileSync(srcFile, "utf-8");
|
|
239
|
-
fs.writeFileSync(destFile, sanitizeContent(content, dirs));
|
|
240
|
-
} else {
|
|
241
|
-
fs.copyFileSync(srcFile, destFile);
|
|
242
|
-
}
|
|
235
|
+
const content = fs.readFileSync(srcFile, "utf-8");
|
|
236
|
+
fs.writeFileSync(destFile, sanitizeContent(content, dirs));
|
|
243
237
|
fileCount++;
|
|
244
238
|
totalSize += fs.statSync(srcFile).size;
|
|
245
239
|
}
|
|
@@ -348,13 +342,8 @@ async function doImport(opts) {
|
|
|
348
342
|
const relPath = path.relative(stagingDir, srcFile);
|
|
349
343
|
const destFile = path.join(stateDir, relPath);
|
|
350
344
|
fs.mkdirSync(path.dirname(destFile), { recursive: true });
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
const content = fs.readFileSync(srcFile, "utf-8");
|
|
354
|
-
fs.writeFileSync(destFile, restoreContent(content, dirs));
|
|
355
|
-
} else {
|
|
356
|
-
fs.copyFileSync(srcFile, destFile);
|
|
357
|
-
}
|
|
345
|
+
const content = fs.readFileSync(srcFile, "utf-8");
|
|
346
|
+
fs.writeFileSync(destFile, restoreContent(content, dirs));
|
|
358
347
|
restoredCount++;
|
|
359
348
|
}
|
|
360
349
|
}
|