@threadbase-sh/streamer 1.31.0 → 1.31.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/index.cjs CHANGED
@@ -6580,14 +6580,8 @@ var StreamerServer = class {
6580
6580
  this.conversationsRepo = new ConversationsRepository(this.cache);
6581
6581
  this.sessionsRepo = new SessionsRepository(this.sessionStore);
6582
6582
  this.cacheMetadataRepo = new CacheMetadataRepository(db);
6583
- if (this.scanProfiles && this.scanProfiles.length > 0) {
6584
- for (const profile of this.scanProfiles) {
6585
- if (profile.enabled) {
6586
- this.fileWatcher.watchDirectory((0, import_path14.join)(profile.configDir, "projects"));
6587
- }
6588
- }
6589
- } else {
6590
- this.fileWatcher.watchDirectory((0, import_path14.join)((0, import_os7.homedir)(), ".claude", "projects"));
6583
+ for (const dir of this.projectsDirs()) {
6584
+ this.fileWatcher.watchDirectory(dir);
6591
6585
  }
6592
6586
  } catch (err) {
6593
6587
  const message = err instanceof Error ? err.message : String(err);
@@ -7168,20 +7162,35 @@ var StreamerServer = class {
7168
7162
  await this.scannerReady;
7169
7163
  return scanner;
7170
7164
  }
7165
+ /**
7166
+ * The projects dirs disk discovery should walk — the single source of truth
7167
+ * for "where do this server's JSONLs live", mirroring the warm-up watcher
7168
+ * (see listen()). Derived from the enabled scanProfiles' configDirs, or the
7169
+ * real ~/.claude/projects when no profiles are configured. An all-disabled
7170
+ * profile set intentionally yields [] (nothing to discover), matching the
7171
+ * watcher — it does NOT fall back to home in that case.
7172
+ */
7173
+ projectsDirs() {
7174
+ if (this.scanProfiles && this.scanProfiles.length > 0) {
7175
+ return this.scanProfiles.filter((p) => p.enabled).map((p) => (0, import_path14.join)(p.configDir, "projects"));
7176
+ }
7177
+ return [(0, import_path14.join)((0, import_os7.homedir)(), ".claude", "projects")];
7178
+ }
7171
7179
  findJsonlPath(uuid) {
7172
- const projectsDir = (0, import_path14.join)((0, import_os7.homedir)(), ".claude", "projects");
7173
- if (!(0, import_fs13.existsSync)(projectsDir)) return null;
7174
7180
  const filename = `${uuid}.jsonl`;
7175
- for (const dir of (0, import_fs13.readdirSync)(projectsDir)) {
7176
- const fp = (0, import_path14.join)(projectsDir, dir, filename);
7177
- if ((0, import_fs13.existsSync)(fp)) return fp;
7178
- const projectDir = (0, import_path14.join)(projectsDir, dir);
7179
- try {
7180
- for (const sub of (0, import_fs13.readdirSync)(projectDir)) {
7181
- const subagentPath = (0, import_path14.join)(projectDir, sub, "subagents", filename);
7182
- if ((0, import_fs13.existsSync)(subagentPath)) return subagentPath;
7181
+ for (const projectsDir of this.projectsDirs()) {
7182
+ if (!(0, import_fs13.existsSync)(projectsDir)) continue;
7183
+ for (const dir of (0, import_fs13.readdirSync)(projectsDir)) {
7184
+ const fp = (0, import_path14.join)(projectsDir, dir, filename);
7185
+ if ((0, import_fs13.existsSync)(fp)) return fp;
7186
+ const projectDir = (0, import_path14.join)(projectsDir, dir);
7187
+ try {
7188
+ for (const sub of (0, import_fs13.readdirSync)(projectDir)) {
7189
+ const subagentPath = (0, import_path14.join)(projectDir, sub, "subagents", filename);
7190
+ if ((0, import_fs13.existsSync)(subagentPath)) return subagentPath;
7191
+ }
7192
+ } catch {
7183
7193
  }
7184
- } catch {
7185
7194
  }
7186
7195
  }
7187
7196
  return null;
@@ -7728,7 +7737,10 @@ var StreamerServer = class {
7728
7737
  const projectPath = jsonlCwd ?? conv?.projectPath;
7729
7738
  if (!projectPath) {
7730
7739
  if (!conv && !jsonlPath) {
7731
- json(res, 404, { error: "Conversation not found" });
7740
+ json(res, 404, {
7741
+ error: "Conversation history file is missing; it can no longer be resumed",
7742
+ code: "history_file_missing"
7743
+ });
7732
7744
  return;
7733
7745
  }
7734
7746
  json(res, 400, { error: "Could not determine project path" });