@threadbase-sh/streamer 1.67.1 → 1.67.3

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
@@ -144612,6 +144612,7 @@ CREATE TABLE IF NOT EXISTS session_names (
144612
144612
  );
144613
144613
  `;
144614
144614
  var cacheLog = getLogger("cache");
144615
+ var PARSE_STATE_LOOKBACK = 8;
144615
144616
  var ConversationCache = class _ConversationCache {
144616
144617
  db;
144617
144618
  tailSize;
@@ -145128,7 +145129,7 @@ var ConversationCache = class _ConversationCache {
145128
145129
  if (to2 <= from) return { messages: [], total, fromIndex: from };
145129
145130
  const rows = this.getMessageIndexWindow(
145130
145131
  _ConversationCache.conversationIdForFile(filePath),
145131
- from,
145132
+ Math.max(0, from - PARSE_STATE_LOOKBACK),
145132
145133
  to2
145133
145134
  );
145134
145135
  if (rows.length === 0) return { messages: [], total, fromIndex: from };
@@ -145140,7 +145141,7 @@ var ConversationCache = class _ConversationCache {
145140
145141
  const buf = Buffer.alloc(row.byte_length);
145141
145142
  (0, import_fs18.readSync)(fd, buf, 0, row.byte_length, row.byte_offset);
145142
145143
  const msg = parseJsonlLine(buf.toString("utf-8"), state);
145143
- if (msg) messages.push(msg);
145144
+ if (msg && row.message_index >= from) messages.push(msg);
145144
145145
  }
145145
145146
  } finally {
145146
145147
  (0, import_fs18.closeSync)(fd);