@threadbase-sh/streamer 1.15.2 → 1.15.4
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 +17 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +17 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1189,7 +1189,14 @@ import {
|
|
|
1189
1189
|
ConversationScanner,
|
|
1190
1190
|
search
|
|
1191
1191
|
} from "@threadbase-sh/scanner";
|
|
1192
|
-
import {
|
|
1192
|
+
import {
|
|
1193
|
+
createReadStream,
|
|
1194
|
+
existsSync as existsSync6,
|
|
1195
|
+
watch as fsWatch,
|
|
1196
|
+
readdirSync as readdirSync3,
|
|
1197
|
+
readFileSync as readFileSync6,
|
|
1198
|
+
statSync as statSync5
|
|
1199
|
+
} from "fs";
|
|
1193
1200
|
import { realpath as realpath2 } from "fs/promises";
|
|
1194
1201
|
import { createServer } from "http";
|
|
1195
1202
|
import { homedir as homedir5 } from "os";
|
|
@@ -1554,7 +1561,7 @@ var createConversationRoutes = (deps) => {
|
|
|
1554
1561
|
import { Hono as Hono4 } from "hono";
|
|
1555
1562
|
|
|
1556
1563
|
// src/version.ts
|
|
1557
|
-
import { readFileSync as readFileSync3 } from "fs";
|
|
1564
|
+
import { readFileSync as readFileSync3, realpathSync } from "fs";
|
|
1558
1565
|
import { dirname as dirname4, join as join6 } from "path";
|
|
1559
1566
|
var cached;
|
|
1560
1567
|
function getVersion() {
|
|
@@ -1565,7 +1572,13 @@ function getVersion() {
|
|
|
1565
1572
|
function resolveVersion() {
|
|
1566
1573
|
const scriptPath = process.argv[1] ?? "";
|
|
1567
1574
|
const here = scriptPath ? dirname4(scriptPath) : process.cwd();
|
|
1568
|
-
|
|
1575
|
+
let realHere = here;
|
|
1576
|
+
try {
|
|
1577
|
+
realHere = dirname4(realpathSync(scriptPath));
|
|
1578
|
+
} catch {
|
|
1579
|
+
}
|
|
1580
|
+
const searchDirs = realHere === here ? [here, join6(here, "..")] : [here, join6(here, ".."), realHere, join6(realHere, "..")];
|
|
1581
|
+
for (const dir of searchDirs) {
|
|
1569
1582
|
try {
|
|
1570
1583
|
const v = readFileSync3(join6(dir, "version.txt"), "utf8").trim();
|
|
1571
1584
|
if (v) return v;
|
|
@@ -5423,6 +5436,16 @@ var StreamerServer = class {
|
|
|
5423
5436
|
cleanup();
|
|
5424
5437
|
this.sessionFileMap.set(sessionId, resolvedFilePath);
|
|
5425
5438
|
this.fileWatcher.watch(resolvedFilePath);
|
|
5439
|
+
try {
|
|
5440
|
+
const existing = readFileSync6(resolvedFilePath, "utf8").split("\n").filter(Boolean);
|
|
5441
|
+
if (existing.length > 0) {
|
|
5442
|
+
this.wsHub.broadcast({ type: "conversation_events", sessionId, lines: existing });
|
|
5443
|
+
for (const line of existing) {
|
|
5444
|
+
this.wsHub.broadcast({ type: "conversation_event", sessionId, line });
|
|
5445
|
+
}
|
|
5446
|
+
}
|
|
5447
|
+
} catch {
|
|
5448
|
+
}
|
|
5426
5449
|
if (this.scannerReady) {
|
|
5427
5450
|
this.scannerStale = true;
|
|
5428
5451
|
} else {
|