@threadbase-sh/streamer 1.67.1 → 1.67.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 +3 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/conversation-cache.d.ts.map +1 -1
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6769,6 +6769,7 @@ CREATE TABLE IF NOT EXISTS session_names (
|
|
|
6769
6769
|
);
|
|
6770
6770
|
`;
|
|
6771
6771
|
var cacheLog = getLogger("cache");
|
|
6772
|
+
var PARSE_STATE_LOOKBACK = 8;
|
|
6772
6773
|
var ConversationCache = class _ConversationCache {
|
|
6773
6774
|
db;
|
|
6774
6775
|
tailSize;
|
|
@@ -7285,7 +7286,7 @@ var ConversationCache = class _ConversationCache {
|
|
|
7285
7286
|
if (to <= from) return { messages: [], total, fromIndex: from };
|
|
7286
7287
|
const rows = this.getMessageIndexWindow(
|
|
7287
7288
|
_ConversationCache.conversationIdForFile(filePath),
|
|
7288
|
-
from,
|
|
7289
|
+
Math.max(0, from - PARSE_STATE_LOOKBACK),
|
|
7289
7290
|
to
|
|
7290
7291
|
);
|
|
7291
7292
|
if (rows.length === 0) return { messages: [], total, fromIndex: from };
|
|
@@ -7297,7 +7298,7 @@ var ConversationCache = class _ConversationCache {
|
|
|
7297
7298
|
const buf = Buffer.alloc(row.byte_length);
|
|
7298
7299
|
readSync3(fd, buf, 0, row.byte_length, row.byte_offset);
|
|
7299
7300
|
const msg = parseJsonlLine(buf.toString("utf-8"), state);
|
|
7300
|
-
if (msg) messages.push(msg);
|
|
7301
|
+
if (msg && row.message_index >= from) messages.push(msg);
|
|
7301
7302
|
}
|
|
7302
7303
|
} finally {
|
|
7303
7304
|
closeSync3(fd);
|