@threadbase-sh/streamer 1.46.0 → 1.46.1
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 +28 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -8424,6 +8424,27 @@ var ConversationWatcher = class {
|
|
|
8424
8424
|
* Watch a directory of conversation JSONL files. Fires
|
|
8425
8425
|
* onConversationChanged for any add/change/unlink event so the caller
|
|
8426
8426
|
* can mark the cache dirty without scanning everything immediately.
|
|
8427
|
+
*
|
|
8428
|
+
* **This costs one OS watch handle per file under `directory`, not one per
|
|
8429
|
+
* directory.** chokidar recurses the tree and registers a separate fs.watch
|
|
8430
|
+
* per entry, because a directory watch alone does not report writes to files
|
|
8431
|
+
* inside it — and per-file `change` events are exactly what the caller needs
|
|
8432
|
+
* (they drive poke()'s tail self-heal and the external-tail attach). So the
|
|
8433
|
+
* handle count tracks the size of the conversation corpus on disk, not the
|
|
8434
|
+
* number of live sessions, and it does not shrink until transcripts are
|
|
8435
|
+
* deleted. `ignoreInitial` suppresses the startup *events*, not the walk.
|
|
8436
|
+
*
|
|
8437
|
+
* Measured 2026-08-09 on the live macOS instance: 2131 open .jsonl fds
|
|
8438
|
+
* against 2133 files under the watched roots — 1:1, ~88% of all fds on the
|
|
8439
|
+
* process, at 2.0% of that box's 122 880 per-process ceiling. Comfortable
|
|
8440
|
+
* there. **Linux is the tight one**: these are inotify watches billed to the
|
|
8441
|
+
* per-user `max_user_watches`, which can be 8192 and is shared with every
|
|
8442
|
+
* other watcher the user runs. Exhaustion surfaces as ENOSPC on the `error`
|
|
8443
|
+
* event — which is why server.ts wires onError rather than leaving it unset.
|
|
8444
|
+
*
|
|
8445
|
+
* Before trading handles for a bound here, note the regression it invites: a
|
|
8446
|
+
* conversation excluded from the walk (by age or by an LRU cap) is one whose
|
|
8447
|
+
* external appends produce no event at all, and that failure is silent.
|
|
8427
8448
|
*/
|
|
8428
8449
|
watchDirectory(directory) {
|
|
8429
8450
|
if (this.directories.has(directory)) return;
|
|
@@ -10720,6 +10741,13 @@ var StreamerServer = class {
|
|
|
10720
10741
|
event: "cache.invalidate_on_unlink"
|
|
10721
10742
|
});
|
|
10722
10743
|
this.cacheMonitor?.recordUnlink(filePath);
|
|
10744
|
+
},
|
|
10745
|
+
onError: (filePath, err) => {
|
|
10746
|
+
const enospc = err.code === "ENOSPC";
|
|
10747
|
+
this.log.error(
|
|
10748
|
+
enospc ? `Watcher hit the OS watch-handle limit on ${filePath} \u2014 raise fs.inotify.max_user_watches (Linux) or the process fd limit; conversation discovery and live tails are degraded until then` : `Watcher error on ${filePath}: ${err.message}`,
|
|
10749
|
+
{ filePath, err, event: enospc ? "watcher.limit_exhausted" : "watcher.error" }
|
|
10750
|
+
);
|
|
10723
10751
|
}
|
|
10724
10752
|
});
|
|
10725
10753
|
this.ptyManager = new LiveSessionManager({
|