@threadbase-sh/streamer 1.28.0 → 1.28.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
@@ -3471,6 +3471,9 @@ var ConversationCache = class _ConversationCache {
3471
3471
  deleteAll: db.prepare("DELETE FROM conversation_meta"),
3472
3472
  deleteTailAll: db.prepare("DELETE FROM conversation_tail"),
3473
3473
  getIdByFilePath: db.prepare("SELECT id FROM conversation_meta WHERE file_path = ?"),
3474
+ getProviderByFilePath: db.prepare(
3475
+ "SELECT provider FROM conversation_meta WHERE file_path = ?"
3476
+ ),
3474
3477
  allFilePaths: db.prepare("SELECT id, file_path FROM conversation_meta"),
3475
3478
  allFileStats: db.prepare(
3476
3479
  "SELECT file_path, mtime_ms, file_size FROM conversation_meta WHERE mtime_ms IS NOT NULL AND file_size IS NOT NULL"
@@ -3617,6 +3620,17 @@ var ConversationCache = class _ConversationCache {
3617
3620
  static conversationIdForFile(filePath) {
3618
3621
  return filePath.split(/[/\\]/).pop()?.replace(/\.jsonl$/, "") ?? filePath;
3619
3622
  }
3623
+ // The offset index understands only claude-code JSONL: parseJsonlLine is the
3624
+ // claude-code reducer, so a codex file "indexes" as zero messages and the
3625
+ // resulting file_state serves empty windows for a real conversation (the
3626
+ // silent-wrong-data bug hotfixed after 1.28.0). Non-claude providers are
3627
+ // excluded from the index entirely; the scanner serves them (it routes each
3628
+ // provider to its own parser).
3629
+ isIndexableFile(filePath) {
3630
+ const row = this.stmts.getProviderByFilePath.get(filePath);
3631
+ if (!row) return false;
3632
+ return (row.provider ?? CLAUDE_CODE_PROVIDER) === CLAUDE_CODE_PROVIDER;
3633
+ }
3620
3634
  /**
3621
3635
  * Incremental offset-index writer: extend the index for a burst of appended
3622
3636
  * lines (one watcher read) using their byte spans. Each line is classified
@@ -3644,6 +3658,7 @@ var ConversationCache = class _ConversationCache {
3644
3658
  * offset and file_state.byte_offset are the same number by construction.
3645
3659
  */
3646
3660
  extendMessageIndex(filePath, spans, stat3, readFrom, endOffset) {
3661
+ if (!this.isIndexableFile(filePath)) return spans.map(() => null);
3647
3662
  const existing = this.getFileState(filePath);
3648
3663
  const expectedStart = existing?.byte_offset ?? 0;
3649
3664
  if (readFrom !== expectedStart) return null;
@@ -3718,6 +3733,7 @@ var ConversationCache = class _ConversationCache {
3718
3733
  const convId = _ConversationCache.conversationIdForFile(filePath);
3719
3734
  this.deleteFileIndex(filePath, convId);
3720
3735
  this.indexParseState.delete(filePath);
3736
+ if (!this.isIndexableFile(filePath)) return;
3721
3737
  const CHUNK = 256 * 1024;
3722
3738
  const YIELD_EVERY = 1e3;
3723
3739
  const state = (0, import_scanner2.createJsonlParseState)();
@@ -3799,6 +3815,9 @@ var ConversationCache = class _ConversationCache {
3799
3815
  if (fileIdentity(stat3) !== fileState.identity || stat3.size !== fileState.byte_offset) {
3800
3816
  return null;
3801
3817
  }
3818
+ if (fileState.last_message_index < 0 || !this.isIndexableFile(filePath)) {
3819
+ return null;
3820
+ }
3802
3821
  const total = fileState.last_message_index + 1;
3803
3822
  const from = Math.max(0, fromIndex);
3804
3823
  const to = Math.min(toIndex, total);