@threadbase-sh/streamer 1.18.5 → 1.19.0
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 +1200 -1129
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +34 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +34 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -281,6 +281,7 @@ interface ServerConfig {
|
|
|
281
281
|
apiKey?: string;
|
|
282
282
|
localNoAuth?: boolean;
|
|
283
283
|
verbose?: boolean;
|
|
284
|
+
logMenubarRequests?: boolean;
|
|
284
285
|
browseRoot?: string;
|
|
285
286
|
publicUrl?: string;
|
|
286
287
|
disableDb?: boolean;
|
|
@@ -629,6 +630,7 @@ declare class WSHub {
|
|
|
629
630
|
type ApiDeps = {
|
|
630
631
|
apiKey: string;
|
|
631
632
|
localNoAuth: boolean;
|
|
633
|
+
logMenubarRequests: boolean;
|
|
632
634
|
publicUrl: string | null;
|
|
633
635
|
browseRoot: string | null;
|
|
634
636
|
ptyManager: PTYManager;
|
|
@@ -746,12 +748,14 @@ declare class StreamerServer {
|
|
|
746
748
|
private pendingQuestionKey;
|
|
747
749
|
private pendingPermission;
|
|
748
750
|
private scanner;
|
|
751
|
+
private allScanners;
|
|
749
752
|
private scannerReady;
|
|
750
753
|
private scannerStale;
|
|
751
754
|
private binding;
|
|
752
755
|
private cacheReady;
|
|
753
756
|
private apiKey;
|
|
754
757
|
private localNoAuth;
|
|
758
|
+
private logMenubarRequests;
|
|
755
759
|
private verbose;
|
|
756
760
|
private scanProfiles;
|
|
757
761
|
private dbPool;
|
package/dist/index.d.ts
CHANGED
|
@@ -281,6 +281,7 @@ interface ServerConfig {
|
|
|
281
281
|
apiKey?: string;
|
|
282
282
|
localNoAuth?: boolean;
|
|
283
283
|
verbose?: boolean;
|
|
284
|
+
logMenubarRequests?: boolean;
|
|
284
285
|
browseRoot?: string;
|
|
285
286
|
publicUrl?: string;
|
|
286
287
|
disableDb?: boolean;
|
|
@@ -629,6 +630,7 @@ declare class WSHub {
|
|
|
629
630
|
type ApiDeps = {
|
|
630
631
|
apiKey: string;
|
|
631
632
|
localNoAuth: boolean;
|
|
633
|
+
logMenubarRequests: boolean;
|
|
632
634
|
publicUrl: string | null;
|
|
633
635
|
browseRoot: string | null;
|
|
634
636
|
ptyManager: PTYManager;
|
|
@@ -746,12 +748,14 @@ declare class StreamerServer {
|
|
|
746
748
|
private pendingQuestionKey;
|
|
747
749
|
private pendingPermission;
|
|
748
750
|
private scanner;
|
|
751
|
+
private allScanners;
|
|
749
752
|
private scannerReady;
|
|
750
753
|
private scannerStale;
|
|
751
754
|
private binding;
|
|
752
755
|
private cacheReady;
|
|
753
756
|
private apiKey;
|
|
754
757
|
private localNoAuth;
|
|
758
|
+
private logMenubarRequests;
|
|
755
759
|
private verbose;
|
|
756
760
|
private scanProfiles;
|
|
757
761
|
private dbPool;
|
package/dist/index.js
CHANGED
|
@@ -1479,14 +1479,19 @@ var POOL_SIZE_MULTIPLIER = 128;
|
|
|
1479
1479
|
var pool;
|
|
1480
1480
|
var poolOffset;
|
|
1481
1481
|
var fillPool = (bytes) => {
|
|
1482
|
-
if (bytes < 0
|
|
1483
|
-
|
|
1484
|
-
pool
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1482
|
+
if (bytes < 0) throw new RangeError("Wrong ID size");
|
|
1483
|
+
try {
|
|
1484
|
+
if (!pool || pool.length < bytes) {
|
|
1485
|
+
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
|
|
1486
|
+
crypto2.randomFillSync(pool);
|
|
1487
|
+
poolOffset = 0;
|
|
1488
|
+
} else if (poolOffset + bytes > pool.length) {
|
|
1489
|
+
crypto2.randomFillSync(pool);
|
|
1490
|
+
poolOffset = 0;
|
|
1491
|
+
}
|
|
1492
|
+
} catch (e) {
|
|
1493
|
+
pool = void 0;
|
|
1494
|
+
throw e;
|
|
1490
1495
|
}
|
|
1491
1496
|
poolOffset += bytes;
|
|
1492
1497
|
};
|
|
@@ -2160,6 +2165,7 @@ var createHonoApp = (deps, upgradeWebSocket) => {
|
|
|
2160
2165
|
const start = Date.now();
|
|
2161
2166
|
const ua = c.req.header("user-agent") ?? "";
|
|
2162
2167
|
await next();
|
|
2168
|
+
if (!deps.logMenubarRequests && c.req.header("x-client") === "menubar") return;
|
|
2163
2169
|
const ms = Date.now() - start;
|
|
2164
2170
|
httpLog.info(`[req] ${c.req.method} ${c.req.path} \u2192 ${c.res.status} ${ms}ms`, {
|
|
2165
2171
|
method: c.req.method,
|
|
@@ -4304,6 +4310,9 @@ var StreamerServer = class {
|
|
|
4304
4310
|
// /input { keys }. Cleared when the gate closes.
|
|
4305
4311
|
pendingPermission = /* @__PURE__ */ new Map();
|
|
4306
4312
|
scanner = null;
|
|
4313
|
+
// Tracks every ConversationScanner ever created so close() can shut them all
|
|
4314
|
+
// down and release SQLite handles (open handles block temp-dir deletion on Windows).
|
|
4315
|
+
allScanners = /* @__PURE__ */ new Set();
|
|
4307
4316
|
scannerReady = null;
|
|
4308
4317
|
// Set by onConversationChanged while a scan is in-flight; getScanner() does
|
|
4309
4318
|
// a single rescan after the current one completes instead of restarting it.
|
|
@@ -4315,6 +4324,7 @@ var StreamerServer = class {
|
|
|
4315
4324
|
cacheReady = false;
|
|
4316
4325
|
apiKey;
|
|
4317
4326
|
localNoAuth;
|
|
4327
|
+
logMenubarRequests;
|
|
4318
4328
|
verbose;
|
|
4319
4329
|
scanProfiles;
|
|
4320
4330
|
dbPool = null;
|
|
@@ -4359,6 +4369,7 @@ var StreamerServer = class {
|
|
|
4359
4369
|
this.sessionStatusBus.setMaxListeners(0);
|
|
4360
4370
|
this.apiKey = config.apiKey;
|
|
4361
4371
|
this.localNoAuth = config.localNoAuth ?? false;
|
|
4372
|
+
this.logMenubarRequests = config.logMenubarRequests ?? false;
|
|
4362
4373
|
this.verbose = config.verbose ?? false;
|
|
4363
4374
|
this.disableDb = config.disableDb ?? false;
|
|
4364
4375
|
this.scanProfiles = config.scanProfiles;
|
|
@@ -4538,6 +4549,7 @@ var StreamerServer = class {
|
|
|
4538
4549
|
const apiDeps = {
|
|
4539
4550
|
apiKey: this.apiKey,
|
|
4540
4551
|
localNoAuth: this.localNoAuth,
|
|
4552
|
+
logMenubarRequests: this.logMenubarRequests,
|
|
4541
4553
|
publicUrl: this.publicUrl,
|
|
4542
4554
|
browseRoot: this.browseRoot,
|
|
4543
4555
|
ptyManager: this.ptyManager,
|
|
@@ -4768,8 +4780,15 @@ var StreamerServer = class {
|
|
|
4768
4780
|
this.conversationsRepo = new ConversationsRepository(this.cache);
|
|
4769
4781
|
this.sessionsRepo = new SessionsRepository(this.sessionStore);
|
|
4770
4782
|
this.cacheMetadataRepo = new CacheMetadataRepository(db);
|
|
4771
|
-
|
|
4772
|
-
|
|
4783
|
+
if (this.scanProfiles && this.scanProfiles.length > 0) {
|
|
4784
|
+
for (const profile of this.scanProfiles) {
|
|
4785
|
+
if (profile.enabled) {
|
|
4786
|
+
this.fileWatcher.watchDirectory(join12(profile.configDir, "projects"));
|
|
4787
|
+
}
|
|
4788
|
+
}
|
|
4789
|
+
} else {
|
|
4790
|
+
this.fileWatcher.watchDirectory(join12(homedir5(), ".claude", "projects"));
|
|
4791
|
+
}
|
|
4773
4792
|
} catch (err) {
|
|
4774
4793
|
const message = err instanceof Error ? err.message : String(err);
|
|
4775
4794
|
this.log.warn(`ConversationCache failed to open (running without cache): ${message}`, {
|
|
@@ -4778,6 +4797,7 @@ var StreamerServer = class {
|
|
|
4778
4797
|
});
|
|
4779
4798
|
}
|
|
4780
4799
|
const warmupScanner = new ConversationScanner();
|
|
4800
|
+
this.allScanners.add(warmupScanner);
|
|
4781
4801
|
const warmupStatCache = this.buildStatCache(null);
|
|
4782
4802
|
const shouldEmitProgress = createScanProgressThrottle();
|
|
4783
4803
|
const scanOpts = {
|
|
@@ -4902,6 +4922,9 @@ var StreamerServer = class {
|
|
|
4902
4922
|
for (const timer of this.ptyGraceTimers.values()) clearTimeout(timer);
|
|
4903
4923
|
this.ptyGraceTimers.clear();
|
|
4904
4924
|
this.markScannerStaleDebounced.cancel();
|
|
4925
|
+
for (const s of this.allScanners) s.close();
|
|
4926
|
+
this.allScanners.clear();
|
|
4927
|
+
this.scanner = null;
|
|
4905
4928
|
this.cache?.close();
|
|
4906
4929
|
this.ptyManager.dispose();
|
|
4907
4930
|
this.fileWatcher.dispose();
|
|
@@ -5230,6 +5253,7 @@ var StreamerServer = class {
|
|
|
5230
5253
|
this.scannerStale = false;
|
|
5231
5254
|
const statCache = this.buildStatCache(this.scanner);
|
|
5232
5255
|
this.scanner = new ConversationScanner();
|
|
5256
|
+
this.allScanners.add(this.scanner);
|
|
5233
5257
|
this.scannerReady = this.scanner.scan({
|
|
5234
5258
|
...this.scanProfiles ? { profiles: this.scanProfiles } : {},
|
|
5235
5259
|
...this.codexScanOpts(),
|