@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 CHANGED
@@ -139407,20 +139407,29 @@ var StreamerServer = class {
139407
139407
  cleanup();
139408
139408
  return;
139409
139409
  }
139410
- if (!(0, import_fs14.existsSync)(filePath)) return;
139410
+ let resolvedFilePath = (0, import_fs14.existsSync)(filePath) ? filePath : null;
139411
+ if (!resolvedFilePath && (0, import_fs14.existsSync)(projectsDir)) {
139412
+ try {
139413
+ const now = Date.now();
139414
+ const recent = (0, import_fs14.readdirSync)(projectsDir).filter((f2) => f2.endsWith(".jsonl")).map((f2) => ({ f: f2, mtime: (0, import_fs14.statSync)((0, import_path14.join)(projectsDir, f2)).mtimeMs })).filter(({ mtime }) => now - mtime < 5e3).sort((a, b2) => b2.mtime - a.mtime)[0];
139415
+ if (recent) resolvedFilePath = (0, import_path14.join)(projectsDir, recent.f);
139416
+ } catch {
139417
+ }
139418
+ }
139419
+ if (!resolvedFilePath) return;
139411
139420
  cleanup();
139412
- this.sessionFileMap.set(sessionId, filePath);
139413
- this.fileWatcher.watch(filePath);
139421
+ this.sessionFileMap.set(sessionId, resolvedFilePath);
139422
+ this.fileWatcher.watch(resolvedFilePath);
139414
139423
  if (this.scannerReady) {
139415
139424
  this.scannerStale = true;
139416
139425
  } else {
139417
139426
  this.scanner = null;
139418
139427
  }
139419
- this.linkSessionToProject(sessionId, projectPath, filePath);
139428
+ this.linkSessionToProject(sessionId, projectPath, resolvedFilePath);
139420
139429
  this.cache?.markAsStreamer(sessionId);
139421
139430
  this.log.info(
139422
139431
  `[startFresh] wired JSONL for ${sessionId}`,
139423
- { event: "session.jsonl_wired", sessionId, filePath },
139432
+ { event: "session.jsonl_wired", sessionId, filePath: resolvedFilePath },
139424
139433
  "pino"
139425
139434
  );
139426
139435
  };