@threadbase-sh/streamer 1.38.0 → 1.39.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 +276 -35
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +273 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -4
- package/dist/index.d.ts +49 -4
- package/dist/index.js +273 -31
- package/dist/index.js.map +1 -1
- package/dist/migrations/014_add_conversation_meta_file_path_index.sql +5 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -81,6 +81,9 @@ interface Logger {
|
|
|
81
81
|
/** Claude Code `--permission-mode` values, as accepted by CLI v2.1.x. */
|
|
82
82
|
declare const PERMISSION_MODES: readonly ["acceptEdits", "auto", "bypassPermissions", "manual", "dontAsk", "plan"];
|
|
83
83
|
type PermissionMode = (typeof PERMISSION_MODES)[number];
|
|
84
|
+
/** Claude Code `--effort` levels, as accepted by CLI v2.1.x. */
|
|
85
|
+
declare const EFFORT_LEVELS: readonly ["low", "medium", "high", "xhigh", "max"];
|
|
86
|
+
type EffortLevel = (typeof EFFORT_LEVELS)[number];
|
|
84
87
|
type FlagValueType = "boolean" | "string" | "enum" | "list";
|
|
85
88
|
/** How risky enabling a flag is. Drives the client's confirmation UX. */
|
|
86
89
|
type FlagRisk = "low" | "elevated" | "dangerous";
|
|
@@ -245,6 +248,7 @@ type WSMessage = {
|
|
|
245
248
|
type: "terminal_output";
|
|
246
249
|
sessionId: string;
|
|
247
250
|
data: string;
|
|
251
|
+
seq?: number;
|
|
248
252
|
} | {
|
|
249
253
|
type: "session_update";
|
|
250
254
|
session?: SessionResponse;
|
|
@@ -303,6 +307,7 @@ type WSMessage = {
|
|
|
303
307
|
sessionId: string;
|
|
304
308
|
lines: string[];
|
|
305
309
|
userMessages?: UserMessage[];
|
|
310
|
+
seq?: number;
|
|
306
311
|
} | {
|
|
307
312
|
type: "session_ready";
|
|
308
313
|
session: SessionResponse;
|
|
@@ -493,6 +498,7 @@ interface ServerConfig {
|
|
|
493
498
|
}>;
|
|
494
499
|
codexRoots?: string[];
|
|
495
500
|
scannerPersistent?: boolean;
|
|
501
|
+
skipStartupWarmup?: boolean;
|
|
496
502
|
ptyGracePeriodMs?: number;
|
|
497
503
|
cacheDir?: string;
|
|
498
504
|
tailSize?: number;
|
|
@@ -502,7 +508,7 @@ interface ServerConfig {
|
|
|
502
508
|
featureFlags?: FeatureFlagValues;
|
|
503
509
|
defaultPermissionMode?: PermissionMode;
|
|
504
510
|
defaultModel?: string;
|
|
505
|
-
defaultEffort?:
|
|
511
|
+
defaultEffort?: EffortLevel;
|
|
506
512
|
claudeFlags?: ClaudeFlagValues;
|
|
507
513
|
claudeExtraArgs?: string;
|
|
508
514
|
}
|
|
@@ -527,7 +533,7 @@ interface StartSessionOptions {
|
|
|
527
533
|
branch?: string;
|
|
528
534
|
permissionMode?: PermissionMode;
|
|
529
535
|
model?: string;
|
|
530
|
-
effort?:
|
|
536
|
+
effort?: EffortLevel;
|
|
531
537
|
claudeFlags?: ClaudeFlagValues;
|
|
532
538
|
claudeExtraArgs?: string;
|
|
533
539
|
}
|
|
@@ -537,7 +543,7 @@ interface StartFreshSessionOptions {
|
|
|
537
543
|
systemPrompt?: string;
|
|
538
544
|
permissionMode?: PermissionMode;
|
|
539
545
|
model?: string;
|
|
540
|
-
effort?:
|
|
546
|
+
effort?: EffortLevel;
|
|
541
547
|
claudeFlags?: ClaudeFlagValues;
|
|
542
548
|
claudeExtraArgs?: string;
|
|
543
549
|
}
|
|
@@ -1277,6 +1283,7 @@ declare class WSHub {
|
|
|
1277
1283
|
private pongTimers;
|
|
1278
1284
|
addClient(ws: WebSocket): void;
|
|
1279
1285
|
broadcast(message: WSMessage): void;
|
|
1286
|
+
broadcastToClients(clients: Iterable<WebSocket>, message: WSMessage): void;
|
|
1280
1287
|
unicast(ws: WebSocket, message: WSMessage): void;
|
|
1281
1288
|
get connectionCount(): number;
|
|
1282
1289
|
dispose(): void;
|
|
@@ -1418,6 +1425,8 @@ type ApiDeps = {
|
|
|
1418
1425
|
handleCancel: (sessionId: string, res: ServerResponse) => void;
|
|
1419
1426
|
handleStopSession: (sessionId: string, res: ServerResponse) => Promise<void>;
|
|
1420
1427
|
handleSetSessionName: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1428
|
+
handleSetSessionModel: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1429
|
+
handleSetSessionEffort: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1421
1430
|
handleUploadFile: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1422
1431
|
handleAdopt: (sessionId: string, res: ServerResponse) => Promise<void>;
|
|
1423
1432
|
handleResume: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
@@ -1573,6 +1582,7 @@ declare class StreamerServer {
|
|
|
1573
1582
|
private allScanners;
|
|
1574
1583
|
private scannerReady;
|
|
1575
1584
|
private scannerStale;
|
|
1585
|
+
private staleFiles;
|
|
1576
1586
|
private conversationReconcileInFlight;
|
|
1577
1587
|
private refreshInFlight;
|
|
1578
1588
|
private binding;
|
|
@@ -1588,6 +1598,7 @@ declare class StreamerServer {
|
|
|
1588
1598
|
private dbPool;
|
|
1589
1599
|
private dbInstanceId;
|
|
1590
1600
|
private disableDb;
|
|
1601
|
+
private skipStartupWarmup;
|
|
1591
1602
|
private browseRoot;
|
|
1592
1603
|
private publicUrl;
|
|
1593
1604
|
private browserCors;
|
|
@@ -1609,6 +1620,7 @@ declare class StreamerServer {
|
|
|
1609
1620
|
private ptyGraceDeferCounts;
|
|
1610
1621
|
private sessionSubscribers;
|
|
1611
1622
|
private lastAgentChunkAt;
|
|
1623
|
+
private terminalSeq;
|
|
1612
1624
|
private idempotency;
|
|
1613
1625
|
private sessionLifecycles;
|
|
1614
1626
|
private idleReaperTimer;
|
|
@@ -1782,6 +1794,21 @@ declare class StreamerServer {
|
|
|
1782
1794
|
* permission prompts entirely, so it needs a forensic trail.
|
|
1783
1795
|
*/
|
|
1784
1796
|
private setClaudeFlagsConfig;
|
|
1797
|
+
/**
|
|
1798
|
+
* The three spawn options that a configured claude-flag can override, with
|
|
1799
|
+
* the boot-time CLI/yaml default as the fallback. Spread into every
|
|
1800
|
+
* start/resume/adopt call so all three paths agree.
|
|
1801
|
+
*
|
|
1802
|
+
* These ids are excluded from buildFlagArgs (SPAWN_POSITIONAL_FLAG_IDS)
|
|
1803
|
+
* precisely because they arrive here instead — the PTY spawn paths pass them
|
|
1804
|
+
* as explicit positionals, so emitting them from the allowlist too would
|
|
1805
|
+
* duplicate the flag.
|
|
1806
|
+
*
|
|
1807
|
+
* Narrowed with the type guards rather than cast: ClaudeFlagValues is a loose
|
|
1808
|
+
* Record by design, and while validateFlagValues already guarantees the shape
|
|
1809
|
+
* on the way in, TypeScript cannot see that through the record.
|
|
1810
|
+
*/
|
|
1811
|
+
private spawnFlagOverrides;
|
|
1785
1812
|
private checkRateLimit;
|
|
1786
1813
|
private checkExchangeRateLimit;
|
|
1787
1814
|
private checkSessionStartRateLimit;
|
|
@@ -1795,7 +1822,8 @@ declare class StreamerServer {
|
|
|
1795
1822
|
*/
|
|
1796
1823
|
private reconcileConversationsCacheFromDisk;
|
|
1797
1824
|
private startBackgroundConversationReconcile;
|
|
1798
|
-
private
|
|
1825
|
+
private conversationReconcileMode;
|
|
1826
|
+
private reconcileStaleFilesFromDisk;
|
|
1799
1827
|
private handleListConversations;
|
|
1800
1828
|
private handleConversationsCount;
|
|
1801
1829
|
private refreshCountInBackground;
|
|
@@ -1805,6 +1833,8 @@ declare class StreamerServer {
|
|
|
1805
1833
|
private buildStatCache;
|
|
1806
1834
|
private codexScanOpts;
|
|
1807
1835
|
private newScanner;
|
|
1836
|
+
private takeStaleFiles;
|
|
1837
|
+
private refreshStaleFiles;
|
|
1808
1838
|
private getScanner;
|
|
1809
1839
|
private getFreshScanner;
|
|
1810
1840
|
private rescanForRefresh;
|
|
@@ -1902,6 +1932,21 @@ declare class StreamerServer {
|
|
|
1902
1932
|
private handleBrowse;
|
|
1903
1933
|
private handleMkdir;
|
|
1904
1934
|
private handleSetSessionName;
|
|
1935
|
+
/**
|
|
1936
|
+
* Retarget a LIVE session's model or effort by typing the corresponding
|
|
1937
|
+
* Claude Code slash command into its PTY.
|
|
1938
|
+
*
|
|
1939
|
+
* There is no CLI or IPC channel for this — `--model`/`--effort` are spawn
|
|
1940
|
+
* arguments — so the interactive `/model <x>` / `/effort <y>` commands are the
|
|
1941
|
+
* only way to change a session already running. Both accept an argument and
|
|
1942
|
+
* apply it without opening the picker (verified against Claude Code v2.1.220).
|
|
1943
|
+
*
|
|
1944
|
+
* Answers 202, not 200: the value is applied by the TUI on its next render, so
|
|
1945
|
+
* there is nothing truthful to echo back synchronously. Clients confirm with
|
|
1946
|
+
* `GET /api/sessions/:id`, which scrapes the applied value off the live status
|
|
1947
|
+
* line.
|
|
1948
|
+
*/
|
|
1949
|
+
private applyLiveSessionSetting;
|
|
1905
1950
|
private handleGetSessionNames;
|
|
1906
1951
|
}
|
|
1907
1952
|
|
package/dist/index.d.ts
CHANGED
|
@@ -81,6 +81,9 @@ interface Logger {
|
|
|
81
81
|
/** Claude Code `--permission-mode` values, as accepted by CLI v2.1.x. */
|
|
82
82
|
declare const PERMISSION_MODES: readonly ["acceptEdits", "auto", "bypassPermissions", "manual", "dontAsk", "plan"];
|
|
83
83
|
type PermissionMode = (typeof PERMISSION_MODES)[number];
|
|
84
|
+
/** Claude Code `--effort` levels, as accepted by CLI v2.1.x. */
|
|
85
|
+
declare const EFFORT_LEVELS: readonly ["low", "medium", "high", "xhigh", "max"];
|
|
86
|
+
type EffortLevel = (typeof EFFORT_LEVELS)[number];
|
|
84
87
|
type FlagValueType = "boolean" | "string" | "enum" | "list";
|
|
85
88
|
/** How risky enabling a flag is. Drives the client's confirmation UX. */
|
|
86
89
|
type FlagRisk = "low" | "elevated" | "dangerous";
|
|
@@ -245,6 +248,7 @@ type WSMessage = {
|
|
|
245
248
|
type: "terminal_output";
|
|
246
249
|
sessionId: string;
|
|
247
250
|
data: string;
|
|
251
|
+
seq?: number;
|
|
248
252
|
} | {
|
|
249
253
|
type: "session_update";
|
|
250
254
|
session?: SessionResponse;
|
|
@@ -303,6 +307,7 @@ type WSMessage = {
|
|
|
303
307
|
sessionId: string;
|
|
304
308
|
lines: string[];
|
|
305
309
|
userMessages?: UserMessage[];
|
|
310
|
+
seq?: number;
|
|
306
311
|
} | {
|
|
307
312
|
type: "session_ready";
|
|
308
313
|
session: SessionResponse;
|
|
@@ -493,6 +498,7 @@ interface ServerConfig {
|
|
|
493
498
|
}>;
|
|
494
499
|
codexRoots?: string[];
|
|
495
500
|
scannerPersistent?: boolean;
|
|
501
|
+
skipStartupWarmup?: boolean;
|
|
496
502
|
ptyGracePeriodMs?: number;
|
|
497
503
|
cacheDir?: string;
|
|
498
504
|
tailSize?: number;
|
|
@@ -502,7 +508,7 @@ interface ServerConfig {
|
|
|
502
508
|
featureFlags?: FeatureFlagValues;
|
|
503
509
|
defaultPermissionMode?: PermissionMode;
|
|
504
510
|
defaultModel?: string;
|
|
505
|
-
defaultEffort?:
|
|
511
|
+
defaultEffort?: EffortLevel;
|
|
506
512
|
claudeFlags?: ClaudeFlagValues;
|
|
507
513
|
claudeExtraArgs?: string;
|
|
508
514
|
}
|
|
@@ -527,7 +533,7 @@ interface StartSessionOptions {
|
|
|
527
533
|
branch?: string;
|
|
528
534
|
permissionMode?: PermissionMode;
|
|
529
535
|
model?: string;
|
|
530
|
-
effort?:
|
|
536
|
+
effort?: EffortLevel;
|
|
531
537
|
claudeFlags?: ClaudeFlagValues;
|
|
532
538
|
claudeExtraArgs?: string;
|
|
533
539
|
}
|
|
@@ -537,7 +543,7 @@ interface StartFreshSessionOptions {
|
|
|
537
543
|
systemPrompt?: string;
|
|
538
544
|
permissionMode?: PermissionMode;
|
|
539
545
|
model?: string;
|
|
540
|
-
effort?:
|
|
546
|
+
effort?: EffortLevel;
|
|
541
547
|
claudeFlags?: ClaudeFlagValues;
|
|
542
548
|
claudeExtraArgs?: string;
|
|
543
549
|
}
|
|
@@ -1277,6 +1283,7 @@ declare class WSHub {
|
|
|
1277
1283
|
private pongTimers;
|
|
1278
1284
|
addClient(ws: WebSocket): void;
|
|
1279
1285
|
broadcast(message: WSMessage): void;
|
|
1286
|
+
broadcastToClients(clients: Iterable<WebSocket>, message: WSMessage): void;
|
|
1280
1287
|
unicast(ws: WebSocket, message: WSMessage): void;
|
|
1281
1288
|
get connectionCount(): number;
|
|
1282
1289
|
dispose(): void;
|
|
@@ -1418,6 +1425,8 @@ type ApiDeps = {
|
|
|
1418
1425
|
handleCancel: (sessionId: string, res: ServerResponse) => void;
|
|
1419
1426
|
handleStopSession: (sessionId: string, res: ServerResponse) => Promise<void>;
|
|
1420
1427
|
handleSetSessionName: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1428
|
+
handleSetSessionModel: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1429
|
+
handleSetSessionEffort: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1421
1430
|
handleUploadFile: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1422
1431
|
handleAdopt: (sessionId: string, res: ServerResponse) => Promise<void>;
|
|
1423
1432
|
handleResume: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
@@ -1573,6 +1582,7 @@ declare class StreamerServer {
|
|
|
1573
1582
|
private allScanners;
|
|
1574
1583
|
private scannerReady;
|
|
1575
1584
|
private scannerStale;
|
|
1585
|
+
private staleFiles;
|
|
1576
1586
|
private conversationReconcileInFlight;
|
|
1577
1587
|
private refreshInFlight;
|
|
1578
1588
|
private binding;
|
|
@@ -1588,6 +1598,7 @@ declare class StreamerServer {
|
|
|
1588
1598
|
private dbPool;
|
|
1589
1599
|
private dbInstanceId;
|
|
1590
1600
|
private disableDb;
|
|
1601
|
+
private skipStartupWarmup;
|
|
1591
1602
|
private browseRoot;
|
|
1592
1603
|
private publicUrl;
|
|
1593
1604
|
private browserCors;
|
|
@@ -1609,6 +1620,7 @@ declare class StreamerServer {
|
|
|
1609
1620
|
private ptyGraceDeferCounts;
|
|
1610
1621
|
private sessionSubscribers;
|
|
1611
1622
|
private lastAgentChunkAt;
|
|
1623
|
+
private terminalSeq;
|
|
1612
1624
|
private idempotency;
|
|
1613
1625
|
private sessionLifecycles;
|
|
1614
1626
|
private idleReaperTimer;
|
|
@@ -1782,6 +1794,21 @@ declare class StreamerServer {
|
|
|
1782
1794
|
* permission prompts entirely, so it needs a forensic trail.
|
|
1783
1795
|
*/
|
|
1784
1796
|
private setClaudeFlagsConfig;
|
|
1797
|
+
/**
|
|
1798
|
+
* The three spawn options that a configured claude-flag can override, with
|
|
1799
|
+
* the boot-time CLI/yaml default as the fallback. Spread into every
|
|
1800
|
+
* start/resume/adopt call so all three paths agree.
|
|
1801
|
+
*
|
|
1802
|
+
* These ids are excluded from buildFlagArgs (SPAWN_POSITIONAL_FLAG_IDS)
|
|
1803
|
+
* precisely because they arrive here instead — the PTY spawn paths pass them
|
|
1804
|
+
* as explicit positionals, so emitting them from the allowlist too would
|
|
1805
|
+
* duplicate the flag.
|
|
1806
|
+
*
|
|
1807
|
+
* Narrowed with the type guards rather than cast: ClaudeFlagValues is a loose
|
|
1808
|
+
* Record by design, and while validateFlagValues already guarantees the shape
|
|
1809
|
+
* on the way in, TypeScript cannot see that through the record.
|
|
1810
|
+
*/
|
|
1811
|
+
private spawnFlagOverrides;
|
|
1785
1812
|
private checkRateLimit;
|
|
1786
1813
|
private checkExchangeRateLimit;
|
|
1787
1814
|
private checkSessionStartRateLimit;
|
|
@@ -1795,7 +1822,8 @@ declare class StreamerServer {
|
|
|
1795
1822
|
*/
|
|
1796
1823
|
private reconcileConversationsCacheFromDisk;
|
|
1797
1824
|
private startBackgroundConversationReconcile;
|
|
1798
|
-
private
|
|
1825
|
+
private conversationReconcileMode;
|
|
1826
|
+
private reconcileStaleFilesFromDisk;
|
|
1799
1827
|
private handleListConversations;
|
|
1800
1828
|
private handleConversationsCount;
|
|
1801
1829
|
private refreshCountInBackground;
|
|
@@ -1805,6 +1833,8 @@ declare class StreamerServer {
|
|
|
1805
1833
|
private buildStatCache;
|
|
1806
1834
|
private codexScanOpts;
|
|
1807
1835
|
private newScanner;
|
|
1836
|
+
private takeStaleFiles;
|
|
1837
|
+
private refreshStaleFiles;
|
|
1808
1838
|
private getScanner;
|
|
1809
1839
|
private getFreshScanner;
|
|
1810
1840
|
private rescanForRefresh;
|
|
@@ -1902,6 +1932,21 @@ declare class StreamerServer {
|
|
|
1902
1932
|
private handleBrowse;
|
|
1903
1933
|
private handleMkdir;
|
|
1904
1934
|
private handleSetSessionName;
|
|
1935
|
+
/**
|
|
1936
|
+
* Retarget a LIVE session's model or effort by typing the corresponding
|
|
1937
|
+
* Claude Code slash command into its PTY.
|
|
1938
|
+
*
|
|
1939
|
+
* There is no CLI or IPC channel for this — `--model`/`--effort` are spawn
|
|
1940
|
+
* arguments — so the interactive `/model <x>` / `/effort <y>` commands are the
|
|
1941
|
+
* only way to change a session already running. Both accept an argument and
|
|
1942
|
+
* apply it without opening the picker (verified against Claude Code v2.1.220).
|
|
1943
|
+
*
|
|
1944
|
+
* Answers 202, not 200: the value is applied by the TUI on its next render, so
|
|
1945
|
+
* there is nothing truthful to echo back synchronously. Clients confirm with
|
|
1946
|
+
* `GET /api/sessions/:id`, which scrapes the applied value off the live status
|
|
1947
|
+
* line.
|
|
1948
|
+
*/
|
|
1949
|
+
private applyLiveSessionSetting;
|
|
1905
1950
|
private handleGetSessionNames;
|
|
1906
1951
|
}
|
|
1907
1952
|
|