@threadbase-sh/streamer 1.28.1 → 1.29.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 +36 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1557,6 +1557,15 @@ function loadTailSize() {
|
|
|
1557
1557
|
}
|
|
1558
1558
|
return void 0;
|
|
1559
1559
|
}
|
|
1560
|
+
function loadPtyGracePeriodMs() {
|
|
1561
|
+
try {
|
|
1562
|
+
const content = (0, import_fs.readFileSync)(configFile(), "utf-8");
|
|
1563
|
+
const match2 = content.match(/pty_grace_period_ms:\s*(\d+)/);
|
|
1564
|
+
if (match2?.[1]) return Number.parseInt(match2[1], 10);
|
|
1565
|
+
} catch {
|
|
1566
|
+
}
|
|
1567
|
+
return void 0;
|
|
1568
|
+
}
|
|
1560
1569
|
function loadDefaultPermissionMode() {
|
|
1561
1570
|
try {
|
|
1562
1571
|
const content = (0, import_fs.readFileSync)(configFile(), "utf-8");
|
|
@@ -136996,6 +137005,9 @@ var ConversationCache = class _ConversationCache {
|
|
|
136996
137005
|
deleteAll: db.prepare("DELETE FROM conversation_meta"),
|
|
136997
137006
|
deleteTailAll: db.prepare("DELETE FROM conversation_tail"),
|
|
136998
137007
|
getIdByFilePath: db.prepare("SELECT id FROM conversation_meta WHERE file_path = ?"),
|
|
137008
|
+
getProviderByFilePath: db.prepare(
|
|
137009
|
+
"SELECT provider FROM conversation_meta WHERE file_path = ?"
|
|
137010
|
+
),
|
|
136999
137011
|
allFilePaths: db.prepare("SELECT id, file_path FROM conversation_meta"),
|
|
137000
137012
|
allFileStats: db.prepare(
|
|
137001
137013
|
"SELECT file_path, mtime_ms, file_size FROM conversation_meta WHERE mtime_ms IS NOT NULL AND file_size IS NOT NULL"
|
|
@@ -137149,8 +137161,9 @@ var ConversationCache = class _ConversationCache {
|
|
|
137149
137161
|
// excluded from the index entirely; the scanner serves them (it routes each
|
|
137150
137162
|
// provider to its own parser).
|
|
137151
137163
|
isIndexableFile(filePath) {
|
|
137152
|
-
const
|
|
137153
|
-
|
|
137164
|
+
const row = this.stmts.getProviderByFilePath.get(filePath);
|
|
137165
|
+
if (!row) return false;
|
|
137166
|
+
return (row.provider ?? CLAUDE_CODE_PROVIDER2) === CLAUDE_CODE_PROVIDER2;
|
|
137154
137167
|
}
|
|
137155
137168
|
/**
|
|
137156
137169
|
* Incremental offset-index writer: extend the index for a burst of appended
|
|
@@ -143216,7 +143229,7 @@ var StreamerServer = class {
|
|
|
143216
143229
|
}
|
|
143217
143230
|
for (const [sessionId, subscribers] of this.sessionSubscribers) {
|
|
143218
143231
|
subscribers.delete(ws2);
|
|
143219
|
-
if (subscribers.size === 0) {
|
|
143232
|
+
if (subscribers.size === 0 && this.ptyGracePeriodMs > 0) {
|
|
143220
143233
|
this.startGraceTimer(sessionId, this.ptyGracePeriodMs);
|
|
143221
143234
|
}
|
|
143222
143235
|
}
|
|
@@ -149079,6 +149092,9 @@ program2.command("serve").description("Start the streamer server").option("-p, -
|
|
|
149079
149092
|
).option(
|
|
149080
149093
|
"--default-permission-mode <mode>",
|
|
149081
149094
|
"Claude Code permission mode for spawned sessions: acceptEdits (auto-approve file edits, default) or manual (prompt for everything). Falls back to default_permission_mode: in ~/.threadbase/server.yaml, or a first-run interactive prompt on a human TTY invocation (skip with THREADBASE_SKIP_PERMISSION_MODE_PROMPT=true)."
|
|
149095
|
+
).option(
|
|
149096
|
+
"--pty-grace-period-ms <ms>",
|
|
149097
|
+
"Ms to keep a PTY alive after the last WebSocket subscriber disconnects before auto-holding it (default 270000, 4.5 min). 0 disables auto-hold entirely (an explicit hold_session still works). Falls back to pty_grace_period_ms: in ~/.threadbase/server.yaml."
|
|
149082
149098
|
).option("--no-pair-qr", "Skip the pairing QR on startup").option("--replace-prod", "Stop the launchd-supervised prod streamer and bind its port", false).option("--forget", "Clear this repo's remembered dev-vs-prod choice and re-prompt", false).option("--forget-all", "Clear every repo's remembered dev-vs-prod choice", false).option(
|
|
149083
149099
|
"--prod",
|
|
149084
149100
|
"Run as if invoked by launchd: skip the dev-takeover prompt and signal handlers",
|
|
@@ -149106,6 +149122,21 @@ program2.command("serve").description("Start the streamer server").option("-p, -
|
|
|
149106
149122
|
);
|
|
149107
149123
|
process.exit(1);
|
|
149108
149124
|
}
|
|
149125
|
+
let ptyGracePeriodMs;
|
|
149126
|
+
if (opts.ptyGracePeriodMs !== void 0) {
|
|
149127
|
+
const parsed = Number(opts.ptyGracePeriodMs);
|
|
149128
|
+
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
149129
|
+
log7.error(
|
|
149130
|
+
`Invalid --pty-grace-period-ms: ${opts.ptyGracePeriodMs} (expected a non-negative integer; 0 disables auto-hold)`,
|
|
149131
|
+
void 0,
|
|
149132
|
+
"console"
|
|
149133
|
+
);
|
|
149134
|
+
process.exit(1);
|
|
149135
|
+
}
|
|
149136
|
+
ptyGracePeriodMs = parsed;
|
|
149137
|
+
} else {
|
|
149138
|
+
ptyGracePeriodMs = loadPtyGracePeriodMs();
|
|
149139
|
+
}
|
|
149109
149140
|
const requestedPort = Number.parseInt(opts.port, 10);
|
|
149110
149141
|
const apiKey = opts.apiKey ?? loadOrCreateApiKey();
|
|
149111
149142
|
const publicUrl = opts.publicUrl ?? loadPublicUrl() ?? null;
|
|
@@ -149149,7 +149180,8 @@ program2.command("serve").description("Start the streamer server").option("-p, -
|
|
|
149149
149180
|
logMenubarRequests: opts.logMenubarRequests,
|
|
149150
149181
|
browseRoot: opts.browseRoot,
|
|
149151
149182
|
publicUrl: opts.publicUrl,
|
|
149152
|
-
defaultPermissionMode: resolvedDefaultPermissionMode
|
|
149183
|
+
defaultPermissionMode: resolvedDefaultPermissionMode,
|
|
149184
|
+
ptyGracePeriodMs
|
|
149153
149185
|
});
|
|
149154
149186
|
await server.listen(resolvedPort);
|
|
149155
149187
|
{
|