engine7 7.1.18 → 7.1.19
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 +21 -8
- package/dist/engine-startup.mjs +915 -561
- package/dist/main.mjs +918 -564
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -115,11 +115,19 @@ function collectAllFiles(dir) {
|
|
|
115
115
|
}
|
|
116
116
|
return files;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function readMainEngineUuid(agentsDir) {
|
|
119
119
|
try {
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
|
|
120
|
+
const platformMapPath = path.join(agentsDir, "main", "sessions", "platform-map.json");
|
|
121
|
+
const indexMapPath = path.join(agentsDir, "main", "sessions", "session-index.json");
|
|
122
|
+
if (!fs.existsSync(platformMapPath) || !fs.existsSync(indexMapPath)) return null;
|
|
123
|
+
const platformMap = JSON.parse(fs.readFileSync(platformMapPath, "utf-8"));
|
|
124
|
+
const mainPlatformId = platformMap["scope:main"] || platformMap["main"];
|
|
125
|
+
if (!mainPlatformId) return null;
|
|
126
|
+
const indexMap = JSON.parse(fs.readFileSync(indexMapPath, "utf-8"));
|
|
127
|
+
const entry = indexMap[mainPlatformId];
|
|
128
|
+
if (!entry || !entry.file) return null;
|
|
129
|
+
const basename3 = path.basename(entry.file).replace(/\.jsonl$/, "");
|
|
130
|
+
return basename3;
|
|
123
131
|
} catch {
|
|
124
132
|
return null;
|
|
125
133
|
}
|
|
@@ -164,9 +172,9 @@ function collectRecentSessions(agentsDir, _days = 7) {
|
|
|
164
172
|
}
|
|
165
173
|
}
|
|
166
174
|
scanSessionsDir(agentsDir);
|
|
167
|
-
const
|
|
175
|
+
const mainEngineUuid = readMainEngineUuid(agentsDir);
|
|
168
176
|
for (const [sessionKey, group] of sessionGroups) {
|
|
169
|
-
if (!
|
|
177
|
+
if (!mainEngineUuid || !sessionKey.startsWith(mainEngineUuid)) continue;
|
|
170
178
|
if (group.jsonl) files.push(group.jsonl);
|
|
171
179
|
group.archived.sort((a, b) => b.mtime - a.mtime);
|
|
172
180
|
if (group.archived.length > 0) files.push(group.archived[0].file);
|
|
@@ -233,8 +241,13 @@ async function doExport(opts) {
|
|
|
233
241
|
const relPath = path.relative(stateDir, srcFile);
|
|
234
242
|
const destFile = path.join(stagingDir, relPath);
|
|
235
243
|
fs.mkdirSync(path.dirname(destFile), { recursive: true });
|
|
236
|
-
|
|
237
|
-
|
|
244
|
+
let content = fs.readFileSync(srcFile, "utf-8");
|
|
245
|
+
content = sanitizeContent(content, dirs);
|
|
246
|
+
const baseName = path.basename(srcFile);
|
|
247
|
+
if (baseName === "session-index.json" || baseName === "platform-map.json") {
|
|
248
|
+
content = content.split("\\\\").join("/");
|
|
249
|
+
}
|
|
250
|
+
fs.writeFileSync(destFile, content);
|
|
238
251
|
fileCount++;
|
|
239
252
|
totalSize += fs.statSync(srcFile).size;
|
|
240
253
|
}
|