@threadbase-sh/streamer 1.15.1 → 1.15.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/dist/cli.cjs +14 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +14 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5451,20 +5451,29 @@ var StreamerServer = class {
|
|
|
5451
5451
|
cleanup();
|
|
5452
5452
|
return;
|
|
5453
5453
|
}
|
|
5454
|
-
|
|
5454
|
+
let resolvedFilePath = (0, import_fs11.existsSync)(filePath) ? filePath : null;
|
|
5455
|
+
if (!resolvedFilePath && (0, import_fs11.existsSync)(projectsDir)) {
|
|
5456
|
+
try {
|
|
5457
|
+
const now = Date.now();
|
|
5458
|
+
const recent = (0, import_fs11.readdirSync)(projectsDir).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, mtime: (0, import_fs11.statSync)((0, import_path11.join)(projectsDir, f)).mtimeMs })).filter(({ mtime }) => now - mtime < 5e3).sort((a, b) => b.mtime - a.mtime)[0];
|
|
5459
|
+
if (recent) resolvedFilePath = (0, import_path11.join)(projectsDir, recent.f);
|
|
5460
|
+
} catch {
|
|
5461
|
+
}
|
|
5462
|
+
}
|
|
5463
|
+
if (!resolvedFilePath) return;
|
|
5455
5464
|
cleanup();
|
|
5456
|
-
this.sessionFileMap.set(sessionId,
|
|
5457
|
-
this.fileWatcher.watch(
|
|
5465
|
+
this.sessionFileMap.set(sessionId, resolvedFilePath);
|
|
5466
|
+
this.fileWatcher.watch(resolvedFilePath);
|
|
5458
5467
|
if (this.scannerReady) {
|
|
5459
5468
|
this.scannerStale = true;
|
|
5460
5469
|
} else {
|
|
5461
5470
|
this.scanner = null;
|
|
5462
5471
|
}
|
|
5463
|
-
this.linkSessionToProject(sessionId, projectPath,
|
|
5472
|
+
this.linkSessionToProject(sessionId, projectPath, resolvedFilePath);
|
|
5464
5473
|
this.cache?.markAsStreamer(sessionId);
|
|
5465
5474
|
this.log.info(
|
|
5466
5475
|
`[startFresh] wired JSONL for ${sessionId}`,
|
|
5467
|
-
{ event: "session.jsonl_wired", sessionId, filePath },
|
|
5476
|
+
{ event: "session.jsonl_wired", sessionId, filePath: resolvedFilePath },
|
|
5468
5477
|
"pino"
|
|
5469
5478
|
);
|
|
5470
5479
|
};
|