@gabrihhh/jarvis 2.6.1 → 2.6.2
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/package.json +1 -1
- package/src/reader.js +1 -23
package/package.json
CHANGED
package/src/reader.js
CHANGED
|
@@ -135,29 +135,7 @@ export function getCurrentSessionFile() {
|
|
|
135
135
|
pid = getParentPid(pid);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
const sessionFiles = readdirSync(sessionsDir)
|
|
140
|
-
.map(f => {
|
|
141
|
-
try { return JSON.parse(readFileSync(join(sessionsDir, f), 'utf-8')); }
|
|
142
|
-
catch { return null; }
|
|
143
|
-
})
|
|
144
|
-
.filter(Boolean);
|
|
145
|
-
|
|
146
|
-
if (!sessionFiles.length) return null;
|
|
147
|
-
|
|
148
|
-
const allFiles = getAllSessionFiles();
|
|
149
|
-
const sessionIdSet = new Set();
|
|
150
|
-
for (const file of allFiles) {
|
|
151
|
-
try {
|
|
152
|
-
const lines = readFileSync(file, 'utf-8').split('\n').filter(l => l.trim());
|
|
153
|
-
for (const line of lines.slice(-5)) {
|
|
154
|
-
try { const obj = JSON.parse(line); if (obj.sessionId) sessionIdSet.add(obj.sessionId); }
|
|
155
|
-
catch { /* skip */ }
|
|
156
|
-
}
|
|
157
|
-
} catch { /* skip */ }
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return sessionFiles.find(s => sessionIdSet.has(s.sessionId)) || sessionFiles[0];
|
|
138
|
+
return null;
|
|
161
139
|
} catch {
|
|
162
140
|
return null;
|
|
163
141
|
}
|