@threadbase-sh/streamer 1.24.1 → 1.24.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 +26 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +26 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +26 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -142609,6 +142609,11 @@ var StreamerServer = class {
|
|
|
142609
142609
|
// /input { keys }. Cleared when the gate closes.
|
|
142610
142610
|
pendingPermission = /* @__PURE__ */ new Map();
|
|
142611
142611
|
scanner = null;
|
|
142612
|
+
// Set when better-sqlite3 is unusable (e.g. node ABI mismatch made
|
|
142613
|
+
// ConversationCache.open throw). All scanners are then built with
|
|
142614
|
+
// persistent: false so requests serve from disk instead of 500ing on
|
|
142615
|
+
// every touch of the scanner's own SQLite index.
|
|
142616
|
+
scannerPersistenceDisabled = false;
|
|
142612
142617
|
// Tracks every ConversationScanner ever created so close() can shut them all
|
|
142613
142618
|
// down and release SQLite handles (open handles block temp-dir deletion on Windows).
|
|
142614
142619
|
allScanners = /* @__PURE__ */ new Set();
|
|
@@ -143108,11 +143113,12 @@ var StreamerServer = class {
|
|
|
143108
143113
|
const message = err instanceof Error ? err.message : String(err);
|
|
143109
143114
|
const abiMismatch = message.includes("NODE_MODULE_VERSION") || message.includes("was compiled against a different Node.js version");
|
|
143110
143115
|
this.log.error(
|
|
143111
|
-
`ConversationCache failed to open \u2014 running WITHOUT cache; /api/conversations, /api/conversations/count and /project-chats
|
|
143116
|
+
`ConversationCache failed to open \u2014 running WITHOUT cache; /api/conversations, /api/conversations/count and /project-chats serve from disk (degraded).` + (abiMismatch ? ` Fix: npm rebuild better-sqlite3` : "") + ` (${message})`,
|
|
143112
143117
|
{ error: message, abiMismatch, event: "cache.open_failed" }
|
|
143113
143118
|
);
|
|
143119
|
+
this.scannerPersistenceDisabled = true;
|
|
143114
143120
|
}
|
|
143115
|
-
const warmupScanner =
|
|
143121
|
+
const warmupScanner = this.newScanner();
|
|
143116
143122
|
this.allScanners.add(warmupScanner);
|
|
143117
143123
|
const warmupStatCache = this.buildStatCache(null);
|
|
143118
143124
|
const shouldEmitProgress = createScanProgressThrottle();
|
|
@@ -143129,6 +143135,10 @@ var StreamerServer = class {
|
|
|
143129
143135
|
}
|
|
143130
143136
|
}
|
|
143131
143137
|
}).then(async () => {
|
|
143138
|
+
if (!this.scannerReady && !this.scanner) {
|
|
143139
|
+
this.scanner = warmupScanner;
|
|
143140
|
+
this.scannerReady = Promise.resolve();
|
|
143141
|
+
}
|
|
143132
143142
|
if (!this.cache) return;
|
|
143133
143143
|
const metas = [...warmupScanner.getMetadataCache().values()];
|
|
143134
143144
|
const upsertedIds = new Set(this.cache.upsertFromScannerMeta(metas));
|
|
@@ -143177,10 +143187,6 @@ var StreamerServer = class {
|
|
|
143177
143187
|
event: "cache.warmup_failed"
|
|
143178
143188
|
});
|
|
143179
143189
|
}).finally(() => {
|
|
143180
|
-
if (!this.scannerReady && !this.scanner) {
|
|
143181
|
-
this.scanner = warmupScanner;
|
|
143182
|
-
this.scannerReady = Promise.resolve();
|
|
143183
|
-
}
|
|
143184
143190
|
this.cacheReady = true;
|
|
143185
143191
|
this.wsHub.broadcast({ type: "cache_ready" });
|
|
143186
143192
|
resolveWarm();
|
|
@@ -143563,6 +143569,11 @@ var StreamerServer = class {
|
|
|
143563
143569
|
// this — its per-file refreshFile (in findConversationByUuid) already
|
|
143564
143570
|
// reconciles the one conversation being requested, so paying a full-tree
|
|
143565
143571
|
// rescan just because some OTHER file changed is the stall this avoids.
|
|
143572
|
+
newScanner() {
|
|
143573
|
+
return new ConversationScanner(
|
|
143574
|
+
this.scannerPersistenceDisabled ? { persistent: false } : void 0
|
|
143575
|
+
);
|
|
143576
|
+
}
|
|
143566
143577
|
async getScanner(skipStaleRescan = false) {
|
|
143567
143578
|
if (this.scannerReady) {
|
|
143568
143579
|
await this.scannerReady;
|
|
@@ -143579,14 +143590,20 @@ var StreamerServer = class {
|
|
|
143579
143590
|
}
|
|
143580
143591
|
this.scannerStale = false;
|
|
143581
143592
|
const statCache = this.buildStatCache(this.scanner);
|
|
143582
|
-
this.scanner =
|
|
143593
|
+
this.scanner = this.newScanner();
|
|
143583
143594
|
this.allScanners.add(this.scanner);
|
|
143584
143595
|
this.scannerReady = this.scanner.scan({
|
|
143585
143596
|
...this.scanProfiles ? { profiles: this.scanProfiles } : {},
|
|
143586
143597
|
...this.codexScanOpts(),
|
|
143587
143598
|
...statCache ? { statCache } : {}
|
|
143588
143599
|
});
|
|
143589
|
-
|
|
143600
|
+
try {
|
|
143601
|
+
await this.scannerReady;
|
|
143602
|
+
} catch (err) {
|
|
143603
|
+
this.scanner = null;
|
|
143604
|
+
this.scannerReady = null;
|
|
143605
|
+
throw err;
|
|
143606
|
+
}
|
|
143590
143607
|
const scanner = this.scanner;
|
|
143591
143608
|
if (!scanner) return this.getScanner();
|
|
143592
143609
|
return scanner;
|
|
@@ -143641,7 +143658,7 @@ var StreamerServer = class {
|
|
|
143641
143658
|
const filePath2 = this.findJsonlPath(uuid3);
|
|
143642
143659
|
if (filePath2) {
|
|
143643
143660
|
const account = this.cache?.getMetaById(uuid3)?.account ?? void 0;
|
|
143644
|
-
const coldScanner = this.scanner ??
|
|
143661
|
+
const coldScanner = this.scanner ?? this.newScanner();
|
|
143645
143662
|
const page = await coldScanner.parseSingleFilePage(filePath2, account, {
|
|
143646
143663
|
limit: Number.MAX_SAFE_INTEGER
|
|
143647
143664
|
});
|