engine7 7.1.14 → 7.1.15
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 +15 -3
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -114,6 +114,15 @@ function collectAllFiles(dir) {
|
|
|
114
114
|
}
|
|
115
115
|
return files;
|
|
116
116
|
}
|
|
117
|
+
function readMainSessionId(platformMapPath) {
|
|
118
|
+
try {
|
|
119
|
+
if (!fs.existsSync(platformMapPath)) return null;
|
|
120
|
+
const map = JSON.parse(fs.readFileSync(platformMapPath, "utf-8"));
|
|
121
|
+
return map["scope:main"] || null;
|
|
122
|
+
} catch {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
117
126
|
function collectRecentSessions(agentsDir, _days = 7) {
|
|
118
127
|
const files = [];
|
|
119
128
|
if (!fs.existsSync(agentsDir)) return files;
|
|
@@ -154,10 +163,13 @@ function collectRecentSessions(agentsDir, _days = 7) {
|
|
|
154
163
|
}
|
|
155
164
|
}
|
|
156
165
|
scanSessionsDir(agentsDir);
|
|
157
|
-
|
|
166
|
+
const mainSessionId = readMainSessionId(path.join(agentsDir, "main", "sessions", "platform-map.json"));
|
|
167
|
+
for (const [sessionKey, group] of sessionGroups) {
|
|
158
168
|
if (group.jsonl) files.push(group.jsonl);
|
|
159
|
-
|
|
160
|
-
|
|
169
|
+
if (mainSessionId && sessionKey.includes(mainSessionId)) {
|
|
170
|
+
group.archived.sort((a, b) => b.mtime - a.mtime);
|
|
171
|
+
if (group.archived.length > 0) files.push(group.archived[0].file);
|
|
172
|
+
}
|
|
161
173
|
}
|
|
162
174
|
return files;
|
|
163
175
|
}
|