@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.d.cts CHANGED
@@ -483,6 +483,7 @@ declare class ConversationCache {
483
483
  * offset index keys on this so the window select and the cursor agree.
484
484
  */
485
485
  static conversationIdForFile(filePath: string): string;
486
+ private isIndexableFile;
486
487
  /**
487
488
  * Incremental offset-index writer: extend the index for a burst of appended
488
489
  * lines (one watcher read) using their byte spans. Each line is classified
package/dist/index.d.ts CHANGED
@@ -483,6 +483,7 @@ declare class ConversationCache {
483
483
  * offset index keys on this so the window select and the cursor agree.
484
484
  */
485
485
  static conversationIdForFile(filePath: string): string;
486
+ private isIndexableFile;
486
487
  /**
487
488
  * Incremental offset-index writer: extend the index for a burst of appended
488
489
  * lines (one watcher read) using their byte spans. Each line is classified
package/dist/index.js CHANGED
@@ -3435,6 +3435,9 @@ var ConversationCache = class _ConversationCache {
3435
3435
  deleteAll: db.prepare("DELETE FROM conversation_meta"),
3436
3436
  deleteTailAll: db.prepare("DELETE FROM conversation_tail"),
3437
3437
  getIdByFilePath: db.prepare("SELECT id FROM conversation_meta WHERE file_path = ?"),
3438
+ getProviderByFilePath: db.prepare(
3439
+ "SELECT provider FROM conversation_meta WHERE file_path = ?"
3440
+ ),
3438
3441
  allFilePaths: db.prepare("SELECT id, file_path FROM conversation_meta"),
3439
3442
  allFileStats: db.prepare(
3440
3443
  "SELECT file_path, mtime_ms, file_size FROM conversation_meta WHERE mtime_ms IS NOT NULL AND file_size IS NOT NULL"
@@ -3581,6 +3584,17 @@ var ConversationCache = class _ConversationCache {
3581
3584
  static conversationIdForFile(filePath) {
3582
3585
  return filePath.split(/[/\\]/).pop()?.replace(/\.jsonl$/, "") ?? filePath;
3583
3586
  }
3587
+ // The offset index understands only claude-code JSONL: parseJsonlLine is the
3588
+ // claude-code reducer, so a codex file "indexes" as zero messages and the
3589
+ // resulting file_state serves empty windows for a real conversation (the
3590
+ // silent-wrong-data bug hotfixed after 1.28.0). Non-claude providers are
3591
+ // excluded from the index entirely; the scanner serves them (it routes each
3592
+ // provider to its own parser).
3593
+ isIndexableFile(filePath) {
3594
+ const row = this.stmts.getProviderByFilePath.get(filePath);
3595
+ if (!row) return false;
3596
+ return (row.provider ?? CLAUDE_CODE_PROVIDER) === CLAUDE_CODE_PROVIDER;
3597
+ }
3584
3598
  /**
3585
3599
  * Incremental offset-index writer: extend the index for a burst of appended
3586
3600
  * lines (one watcher read) using their byte spans. Each line is classified
@@ -3608,6 +3622,7 @@ var ConversationCache = class _ConversationCache {
3608
3622
  * offset and file_state.byte_offset are the same number by construction.
3609
3623
  */
3610
3624
  extendMessageIndex(filePath, spans, stat3, readFrom, endOffset) {
3625
+ if (!this.isIndexableFile(filePath)) return spans.map(() => null);
3611
3626
  const existing = this.getFileState(filePath);
3612
3627
  const expectedStart = existing?.byte_offset ?? 0;
3613
3628
  if (readFrom !== expectedStart) return null;
@@ -3682,6 +3697,7 @@ var ConversationCache = class _ConversationCache {
3682
3697
  const convId = _ConversationCache.conversationIdForFile(filePath);
3683
3698
  this.deleteFileIndex(filePath, convId);
3684
3699
  this.indexParseState.delete(filePath);
3700
+ if (!this.isIndexableFile(filePath)) return;
3685
3701
  const CHUNK = 256 * 1024;
3686
3702
  const YIELD_EVERY = 1e3;
3687
3703
  const state = createJsonlParseState();
@@ -3763,6 +3779,9 @@ var ConversationCache = class _ConversationCache {
3763
3779
  if (fileIdentity(stat3) !== fileState.identity || stat3.size !== fileState.byte_offset) {
3764
3780
  return null;
3765
3781
  }
3782
+ if (fileState.last_message_index < 0 || !this.isIndexableFile(filePath)) {
3783
+ return null;
3784
+ }
3766
3785
  const total = fileState.last_message_index + 1;
3767
3786
  const from = Math.max(0, fromIndex);
3768
3787
  const to = Math.min(toIndex, total);