@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/cli.cjs CHANGED
@@ -136996,6 +136996,9 @@ var ConversationCache = class _ConversationCache {
136996
136996
  deleteAll: db.prepare("DELETE FROM conversation_meta"),
136997
136997
  deleteTailAll: db.prepare("DELETE FROM conversation_tail"),
136998
136998
  getIdByFilePath: db.prepare("SELECT id FROM conversation_meta WHERE file_path = ?"),
136999
+ getProviderByFilePath: db.prepare(
137000
+ "SELECT provider FROM conversation_meta WHERE file_path = ?"
137001
+ ),
136999
137002
  allFilePaths: db.prepare("SELECT id, file_path FROM conversation_meta"),
137000
137003
  allFileStats: db.prepare(
137001
137004
  "SELECT file_path, mtime_ms, file_size FROM conversation_meta WHERE mtime_ms IS NOT NULL AND file_size IS NOT NULL"
@@ -137142,6 +137145,17 @@ var ConversationCache = class _ConversationCache {
137142
137145
  static conversationIdForFile(filePath) {
137143
137146
  return filePath.split(/[/\\]/).pop()?.replace(/\.jsonl$/, "") ?? filePath;
137144
137147
  }
137148
+ // The offset index understands only claude-code JSONL: parseJsonlLine is the
137149
+ // claude-code reducer, so a codex file "indexes" as zero messages and the
137150
+ // resulting file_state serves empty windows for a real conversation (the
137151
+ // silent-wrong-data bug hotfixed after 1.28.0). Non-claude providers are
137152
+ // excluded from the index entirely; the scanner serves them (it routes each
137153
+ // provider to its own parser).
137154
+ isIndexableFile(filePath) {
137155
+ const row = this.stmts.getProviderByFilePath.get(filePath);
137156
+ if (!row) return false;
137157
+ return (row.provider ?? CLAUDE_CODE_PROVIDER2) === CLAUDE_CODE_PROVIDER2;
137158
+ }
137145
137159
  /**
137146
137160
  * Incremental offset-index writer: extend the index for a burst of appended
137147
137161
  * lines (one watcher read) using their byte spans. Each line is classified
@@ -137169,6 +137183,7 @@ var ConversationCache = class _ConversationCache {
137169
137183
  * offset and file_state.byte_offset are the same number by construction.
137170
137184
  */
137171
137185
  extendMessageIndex(filePath, spans, stat10, readFrom, endOffset) {
137186
+ if (!this.isIndexableFile(filePath)) return spans.map(() => null);
137172
137187
  const existing = this.getFileState(filePath);
137173
137188
  const expectedStart = existing?.byte_offset ?? 0;
137174
137189
  if (readFrom !== expectedStart) return null;
@@ -137243,6 +137258,7 @@ var ConversationCache = class _ConversationCache {
137243
137258
  const convId = _ConversationCache.conversationIdForFile(filePath);
137244
137259
  this.deleteFileIndex(filePath, convId);
137245
137260
  this.indexParseState.delete(filePath);
137261
+ if (!this.isIndexableFile(filePath)) return;
137246
137262
  const CHUNK = 256 * 1024;
137247
137263
  const YIELD_EVERY = 1e3;
137248
137264
  const state = initialConvState();
@@ -137324,6 +137340,9 @@ var ConversationCache = class _ConversationCache {
137324
137340
  if (fileIdentity(stat10) !== fileState.identity || stat10.size !== fileState.byte_offset) {
137325
137341
  return null;
137326
137342
  }
137343
+ if (fileState.last_message_index < 0 || !this.isIndexableFile(filePath)) {
137344
+ return null;
137345
+ }
137327
137346
  const total = fileState.last_message_index + 1;
137328
137347
  const from = Math.max(0, fromIndex);
137329
137348
  const to2 = Math.min(toIndex, total);