@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.cjs
CHANGED
|
@@ -1512,14 +1512,19 @@ var POOL_SIZE_MULTIPLIER = 128;
|
|
|
1512
1512
|
var pool;
|
|
1513
1513
|
var poolOffset;
|
|
1514
1514
|
var fillPool = (bytes) => {
|
|
1515
|
-
if (bytes < 0
|
|
1516
|
-
|
|
1517
|
-
pool
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1515
|
+
if (bytes < 0) throw new RangeError("Wrong ID size");
|
|
1516
|
+
try {
|
|
1517
|
+
if (!pool || pool.length < bytes) {
|
|
1518
|
+
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
|
|
1519
|
+
import_crypto3.default.randomFillSync(pool);
|
|
1520
|
+
poolOffset = 0;
|
|
1521
|
+
} else if (poolOffset + bytes > pool.length) {
|
|
1522
|
+
import_crypto3.default.randomFillSync(pool);
|
|
1523
|
+
poolOffset = 0;
|
|
1524
|
+
}
|
|
1525
|
+
} catch (e) {
|
|
1526
|
+
pool = void 0;
|
|
1527
|
+
throw e;
|
|
1523
1528
|
}
|
|
1524
1529
|
poolOffset += bytes;
|
|
1525
1530
|
};
|
|
@@ -2193,6 +2198,7 @@ var createHonoApp = (deps, upgradeWebSocket) => {
|
|
|
2193
2198
|
const start = Date.now();
|
|
2194
2199
|
const ua = c.req.header("user-agent") ?? "";
|
|
2195
2200
|
await next();
|
|
2201
|
+
if (!deps.logMenubarRequests && c.req.header("x-client") === "menubar") return;
|
|
2196
2202
|
const ms = Date.now() - start;
|
|
2197
2203
|
httpLog.info(`[req] ${c.req.method} ${c.req.path} \u2192 ${c.res.status} ${ms}ms`, {
|
|
2198
2204
|
method: c.req.method,
|
|
@@ -4338,6 +4344,9 @@ var StreamerServer = class {
|
|
|
4338
4344
|
// /input { keys }. Cleared when the gate closes.
|
|
4339
4345
|
pendingPermission = /* @__PURE__ */ new Map();
|
|
4340
4346
|
scanner = null;
|
|
4347
|
+
// Tracks every ConversationScanner ever created so close() can shut them all
|
|
4348
|
+
// down and release SQLite handles (open handles block temp-dir deletion on Windows).
|
|
4349
|
+
allScanners = /* @__PURE__ */ new Set();
|
|
4341
4350
|
scannerReady = null;
|
|
4342
4351
|
// Set by onConversationChanged while a scan is in-flight; getScanner() does
|
|
4343
4352
|
// a single rescan after the current one completes instead of restarting it.
|
|
@@ -4349,6 +4358,7 @@ var StreamerServer = class {
|
|
|
4349
4358
|
cacheReady = false;
|
|
4350
4359
|
apiKey;
|
|
4351
4360
|
localNoAuth;
|
|
4361
|
+
logMenubarRequests;
|
|
4352
4362
|
verbose;
|
|
4353
4363
|
scanProfiles;
|
|
4354
4364
|
dbPool = null;
|
|
@@ -4393,6 +4403,7 @@ var StreamerServer = class {
|
|
|
4393
4403
|
this.sessionStatusBus.setMaxListeners(0);
|
|
4394
4404
|
this.apiKey = config.apiKey;
|
|
4395
4405
|
this.localNoAuth = config.localNoAuth ?? false;
|
|
4406
|
+
this.logMenubarRequests = config.logMenubarRequests ?? false;
|
|
4396
4407
|
this.verbose = config.verbose ?? false;
|
|
4397
4408
|
this.disableDb = config.disableDb ?? false;
|
|
4398
4409
|
this.scanProfiles = config.scanProfiles;
|
|
@@ -4572,6 +4583,7 @@ var StreamerServer = class {
|
|
|
4572
4583
|
const apiDeps = {
|
|
4573
4584
|
apiKey: this.apiKey,
|
|
4574
4585
|
localNoAuth: this.localNoAuth,
|
|
4586
|
+
logMenubarRequests: this.logMenubarRequests,
|
|
4575
4587
|
publicUrl: this.publicUrl,
|
|
4576
4588
|
browseRoot: this.browseRoot,
|
|
4577
4589
|
ptyManager: this.ptyManager,
|
|
@@ -4802,8 +4814,15 @@ var StreamerServer = class {
|
|
|
4802
4814
|
this.conversationsRepo = new ConversationsRepository(this.cache);
|
|
4803
4815
|
this.sessionsRepo = new SessionsRepository(this.sessionStore);
|
|
4804
4816
|
this.cacheMetadataRepo = new CacheMetadataRepository(db);
|
|
4805
|
-
|
|
4806
|
-
|
|
4817
|
+
if (this.scanProfiles && this.scanProfiles.length > 0) {
|
|
4818
|
+
for (const profile of this.scanProfiles) {
|
|
4819
|
+
if (profile.enabled) {
|
|
4820
|
+
this.fileWatcher.watchDirectory((0, import_path11.join)(profile.configDir, "projects"));
|
|
4821
|
+
}
|
|
4822
|
+
}
|
|
4823
|
+
} else {
|
|
4824
|
+
this.fileWatcher.watchDirectory((0, import_path11.join)((0, import_os6.homedir)(), ".claude", "projects"));
|
|
4825
|
+
}
|
|
4807
4826
|
} catch (err) {
|
|
4808
4827
|
const message = err instanceof Error ? err.message : String(err);
|
|
4809
4828
|
this.log.warn(`ConversationCache failed to open (running without cache): ${message}`, {
|
|
@@ -4812,6 +4831,7 @@ var StreamerServer = class {
|
|
|
4812
4831
|
});
|
|
4813
4832
|
}
|
|
4814
4833
|
const warmupScanner = new import_scanner2.ConversationScanner();
|
|
4834
|
+
this.allScanners.add(warmupScanner);
|
|
4815
4835
|
const warmupStatCache = this.buildStatCache(null);
|
|
4816
4836
|
const shouldEmitProgress = createScanProgressThrottle();
|
|
4817
4837
|
const scanOpts = {
|
|
@@ -4936,6 +4956,9 @@ var StreamerServer = class {
|
|
|
4936
4956
|
for (const timer of this.ptyGraceTimers.values()) clearTimeout(timer);
|
|
4937
4957
|
this.ptyGraceTimers.clear();
|
|
4938
4958
|
this.markScannerStaleDebounced.cancel();
|
|
4959
|
+
for (const s of this.allScanners) s.close();
|
|
4960
|
+
this.allScanners.clear();
|
|
4961
|
+
this.scanner = null;
|
|
4939
4962
|
this.cache?.close();
|
|
4940
4963
|
this.ptyManager.dispose();
|
|
4941
4964
|
this.fileWatcher.dispose();
|
|
@@ -5264,6 +5287,7 @@ var StreamerServer = class {
|
|
|
5264
5287
|
this.scannerStale = false;
|
|
5265
5288
|
const statCache = this.buildStatCache(this.scanner);
|
|
5266
5289
|
this.scanner = new import_scanner2.ConversationScanner();
|
|
5290
|
+
this.allScanners.add(this.scanner);
|
|
5267
5291
|
this.scannerReady = this.scanner.scan({
|
|
5268
5292
|
...this.scanProfiles ? { profiles: this.scanProfiles } : {},
|
|
5269
5293
|
...this.codexScanOpts(),
|