@threadbase-sh/streamer 1.18.5 → 1.18.6

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/index.cjs CHANGED
@@ -4338,6 +4338,9 @@ var StreamerServer = class {
4338
4338
  // /input { keys }. Cleared when the gate closes.
4339
4339
  pendingPermission = /* @__PURE__ */ new Map();
4340
4340
  scanner = null;
4341
+ // Tracks every ConversationScanner ever created so close() can shut them all
4342
+ // down and release SQLite handles (open handles block temp-dir deletion on Windows).
4343
+ allScanners = /* @__PURE__ */ new Set();
4341
4344
  scannerReady = null;
4342
4345
  // Set by onConversationChanged while a scan is in-flight; getScanner() does
4343
4346
  // a single rescan after the current one completes instead of restarting it.
@@ -4802,8 +4805,15 @@ var StreamerServer = class {
4802
4805
  this.conversationsRepo = new ConversationsRepository(this.cache);
4803
4806
  this.sessionsRepo = new SessionsRepository(this.sessionStore);
4804
4807
  this.cacheMetadataRepo = new CacheMetadataRepository(db);
4805
- const projectsDir = (0, import_path11.join)((0, import_os6.homedir)(), ".claude", "projects");
4806
- this.fileWatcher.watchDirectory(projectsDir);
4808
+ if (this.scanProfiles && this.scanProfiles.length > 0) {
4809
+ for (const profile of this.scanProfiles) {
4810
+ if (profile.enabled) {
4811
+ this.fileWatcher.watchDirectory((0, import_path11.join)(profile.configDir, "projects"));
4812
+ }
4813
+ }
4814
+ } else {
4815
+ this.fileWatcher.watchDirectory((0, import_path11.join)((0, import_os6.homedir)(), ".claude", "projects"));
4816
+ }
4807
4817
  } catch (err) {
4808
4818
  const message = err instanceof Error ? err.message : String(err);
4809
4819
  this.log.warn(`ConversationCache failed to open (running without cache): ${message}`, {
@@ -4812,6 +4822,7 @@ var StreamerServer = class {
4812
4822
  });
4813
4823
  }
4814
4824
  const warmupScanner = new import_scanner2.ConversationScanner();
4825
+ this.allScanners.add(warmupScanner);
4815
4826
  const warmupStatCache = this.buildStatCache(null);
4816
4827
  const shouldEmitProgress = createScanProgressThrottle();
4817
4828
  const scanOpts = {
@@ -4936,6 +4947,9 @@ var StreamerServer = class {
4936
4947
  for (const timer of this.ptyGraceTimers.values()) clearTimeout(timer);
4937
4948
  this.ptyGraceTimers.clear();
4938
4949
  this.markScannerStaleDebounced.cancel();
4950
+ for (const s of this.allScanners) s.close();
4951
+ this.allScanners.clear();
4952
+ this.scanner = null;
4939
4953
  this.cache?.close();
4940
4954
  this.ptyManager.dispose();
4941
4955
  this.fileWatcher.dispose();
@@ -5264,6 +5278,7 @@ var StreamerServer = class {
5264
5278
  this.scannerStale = false;
5265
5279
  const statCache = this.buildStatCache(this.scanner);
5266
5280
  this.scanner = new import_scanner2.ConversationScanner();
5281
+ this.allScanners.add(this.scanner);
5267
5282
  this.scannerReady = this.scanner.scan({
5268
5283
  ...this.scanProfiles ? { profiles: this.scanProfiles } : {},
5269
5284
  ...this.codexScanOpts(),