@threadbase-sh/streamer 1.29.2 → 1.31.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 +886 -517
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +649 -283
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -7
- package/dist/index.d.ts +18 -7
- package/dist/index.js +632 -266
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -168,6 +168,10 @@ interface PermissionOption {
|
|
|
168
168
|
label: string;
|
|
169
169
|
answerKeys?: string;
|
|
170
170
|
}
|
|
171
|
+
interface UserMessage {
|
|
172
|
+
text: string;
|
|
173
|
+
ts: number;
|
|
174
|
+
}
|
|
171
175
|
type WSMessage = {
|
|
172
176
|
type: "terminal_output";
|
|
173
177
|
sessionId: string;
|
|
@@ -214,10 +218,16 @@ type WSMessage = {
|
|
|
214
218
|
} | {
|
|
215
219
|
type: "ping";
|
|
216
220
|
ts: number;
|
|
221
|
+
} | {
|
|
222
|
+
type: "user_message";
|
|
223
|
+
sessionId: string;
|
|
224
|
+
text: string;
|
|
225
|
+
ts: number;
|
|
217
226
|
} | {
|
|
218
227
|
type: "terminal_replay";
|
|
219
228
|
sessionId: string;
|
|
220
229
|
lines: string[];
|
|
230
|
+
userMessages?: UserMessage[];
|
|
221
231
|
} | {
|
|
222
232
|
type: "session_ready";
|
|
223
233
|
session: SessionResponse;
|
|
@@ -321,7 +331,6 @@ interface ServerConfig {
|
|
|
321
331
|
codexRoots?: string[];
|
|
322
332
|
scannerPersistent?: boolean;
|
|
323
333
|
ptyGracePeriodMs?: number;
|
|
324
|
-
wsAuthTimeoutMs?: number;
|
|
325
334
|
cacheDir?: string;
|
|
326
335
|
tailSize?: number;
|
|
327
336
|
directoryScanDebounceMs?: number;
|
|
@@ -340,6 +349,7 @@ interface PTYManagerOptions {
|
|
|
340
349
|
} | null) => void;
|
|
341
350
|
onLiveQuestion?: (sessionId: string, questions: AskQuestion[]) => void;
|
|
342
351
|
onLiveQuestionGone?: (sessionId: string) => void;
|
|
352
|
+
onUserMessage?: (sessionId: string, text: string, ts: number) => void;
|
|
343
353
|
logger?: Logger;
|
|
344
354
|
}
|
|
345
355
|
interface StartSessionOptions {
|
|
@@ -364,6 +374,7 @@ interface SessionRunner {
|
|
|
364
374
|
putOnHold(sessionId: string): void;
|
|
365
375
|
getOutput(sessionId: string): string;
|
|
366
376
|
getOutputLines(sessionId: string, maxLines: number): Promise<string[]>;
|
|
377
|
+
getInputHistory(sessionId: string): UserMessage[];
|
|
367
378
|
getSession(sessionId: string): ManagedSession | null;
|
|
368
379
|
hasSession(sessionId: string): boolean;
|
|
369
380
|
listSessions(): ManagedSession[];
|
|
@@ -794,6 +805,7 @@ declare class LiveSessionManager {
|
|
|
794
805
|
putOnHold(sessionId: string): void;
|
|
795
806
|
getOutput(sessionId: string): string;
|
|
796
807
|
getOutputLines(sessionId: string, maxLines: number): Promise<string[]>;
|
|
808
|
+
getInputHistory(sessionId: string): UserMessage[];
|
|
797
809
|
getSession(sessionId: string): ManagedSession | null;
|
|
798
810
|
hasSession(sessionId: string): boolean;
|
|
799
811
|
listSessions(): ManagedSession[];
|
|
@@ -860,7 +872,7 @@ type ApiDeps = {
|
|
|
860
872
|
handlePairExchange: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
861
873
|
handleBrowse: (url: URL, res: ServerResponse) => Promise<void>;
|
|
862
874
|
handleMkdir: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
863
|
-
handleWsOpen: (ws: WebSocket
|
|
875
|
+
handleWsOpen: (ws: WebSocket) => void;
|
|
864
876
|
handleWsMessage: (ws: WebSocket, raw: unknown) => void;
|
|
865
877
|
handleWsClose: (ws: WebSocket) => void;
|
|
866
878
|
agentClient: AgentClient | null;
|
|
@@ -938,6 +950,7 @@ declare class PTYManager implements SessionRunner {
|
|
|
938
950
|
private onPermissionChange;
|
|
939
951
|
private onLiveQuestion;
|
|
940
952
|
private onLiveQuestionGone;
|
|
953
|
+
private onUserMessage;
|
|
941
954
|
private permissionOpen;
|
|
942
955
|
private lastScreenQuestionKey;
|
|
943
956
|
private shellPromptOpen;
|
|
@@ -962,6 +975,8 @@ declare class PTYManager implements SessionRunner {
|
|
|
962
975
|
putOnHold(sessionId: string): void;
|
|
963
976
|
getOutput(sessionId: string): string;
|
|
964
977
|
getOutputLines(sessionId: string, maxLines: number): Promise<string[]>;
|
|
978
|
+
getInputHistory(sessionId: string): UserMessage[];
|
|
979
|
+
private recordUserMessage;
|
|
965
980
|
getSession(sessionId: string): ManagedSession | null;
|
|
966
981
|
hasSession(sessionId: string): boolean;
|
|
967
982
|
listSessions(): ManagedSession[];
|
|
@@ -1016,9 +1031,6 @@ declare class StreamerServer {
|
|
|
1016
1031
|
private sessionSubscribers;
|
|
1017
1032
|
private clientIdToWs;
|
|
1018
1033
|
private wsToClientId;
|
|
1019
|
-
private wsAuthed;
|
|
1020
|
-
private wsAuthPending;
|
|
1021
|
-
private wsAuthTimeoutMs;
|
|
1022
1034
|
private cache;
|
|
1023
1035
|
private projectsRepo;
|
|
1024
1036
|
private conversationsRepo;
|
|
@@ -1047,7 +1059,6 @@ declare class StreamerServer {
|
|
|
1047
1059
|
* a full broadcast if no match exists (old clients, or no WS registered yet).
|
|
1048
1060
|
*/
|
|
1049
1061
|
private broadcastOrUnicastSessionList;
|
|
1050
|
-
private completeWsAuth;
|
|
1051
1062
|
private addSessionSubscriber;
|
|
1052
1063
|
private startGraceTimer;
|
|
1053
1064
|
get port(): number;
|
|
@@ -1197,4 +1208,4 @@ declare class ConversationWatcher {
|
|
|
1197
1208
|
private readNewLines;
|
|
1198
1209
|
}
|
|
1199
1210
|
|
|
1200
|
-
export { type AgentClient, type AgentClientOpts, type AgentConfig, type AppendArgs, type AskOption, type AskQuestion, CLAUDE_CODE_PROVIDER, CODEX_CLI_PROVIDER, type ConversationListResponse, ConversationWatcher, type ConversationWriter, type DbConfig, type DiscoveredProcess, LiveSessionManager, type ManagedSession, PTYManager, type PTYManagerOptions, type PermissionOption, type ProgressDedupeLRU, type ProviderName, type ServerConfig, type SessionCursor, type SessionListPage, type SessionListQuery, type SessionResponse, type SessionRunner, type SessionSortKey, type SessionStatus, SessionStore, type SortOrder, type StartFreshSessionOptions, type StartSessionOptions, StreamerServer, WSHub, type WSMessage, createAgentClient, createConversationWriter, createPool, createProgressDedupeLRU, createProgressRoutes, discoverClaudeProcesses, generateApiKey, getDbConfig, isDbEnabled, isProviderName, isProviderResumable, loadOrCreateApiKey, maskConnectionString, readAgentConfig, validateApiKey };
|
|
1211
|
+
export { type AgentClient, type AgentClientOpts, type AgentConfig, type AppendArgs, type AskOption, type AskQuestion, CLAUDE_CODE_PROVIDER, CODEX_CLI_PROVIDER, type ConversationListResponse, ConversationWatcher, type ConversationWriter, type DbConfig, type DiscoveredProcess, LiveSessionManager, type ManagedSession, PTYManager, type PTYManagerOptions, type PermissionOption, type ProgressDedupeLRU, type ProviderName, type ServerConfig, type SessionCursor, type SessionListPage, type SessionListQuery, type SessionResponse, type SessionRunner, type SessionSortKey, type SessionStatus, SessionStore, type SortOrder, type StartFreshSessionOptions, type StartSessionOptions, StreamerServer, type UserMessage, WSHub, type WSMessage, createAgentClient, createConversationWriter, createPool, createProgressDedupeLRU, createProgressRoutes, discoverClaudeProcesses, generateApiKey, getDbConfig, isDbEnabled, isProviderName, isProviderResumable, loadOrCreateApiKey, maskConnectionString, readAgentConfig, validateApiKey };
|
package/dist/index.d.ts
CHANGED
|
@@ -168,6 +168,10 @@ interface PermissionOption {
|
|
|
168
168
|
label: string;
|
|
169
169
|
answerKeys?: string;
|
|
170
170
|
}
|
|
171
|
+
interface UserMessage {
|
|
172
|
+
text: string;
|
|
173
|
+
ts: number;
|
|
174
|
+
}
|
|
171
175
|
type WSMessage = {
|
|
172
176
|
type: "terminal_output";
|
|
173
177
|
sessionId: string;
|
|
@@ -214,10 +218,16 @@ type WSMessage = {
|
|
|
214
218
|
} | {
|
|
215
219
|
type: "ping";
|
|
216
220
|
ts: number;
|
|
221
|
+
} | {
|
|
222
|
+
type: "user_message";
|
|
223
|
+
sessionId: string;
|
|
224
|
+
text: string;
|
|
225
|
+
ts: number;
|
|
217
226
|
} | {
|
|
218
227
|
type: "terminal_replay";
|
|
219
228
|
sessionId: string;
|
|
220
229
|
lines: string[];
|
|
230
|
+
userMessages?: UserMessage[];
|
|
221
231
|
} | {
|
|
222
232
|
type: "session_ready";
|
|
223
233
|
session: SessionResponse;
|
|
@@ -321,7 +331,6 @@ interface ServerConfig {
|
|
|
321
331
|
codexRoots?: string[];
|
|
322
332
|
scannerPersistent?: boolean;
|
|
323
333
|
ptyGracePeriodMs?: number;
|
|
324
|
-
wsAuthTimeoutMs?: number;
|
|
325
334
|
cacheDir?: string;
|
|
326
335
|
tailSize?: number;
|
|
327
336
|
directoryScanDebounceMs?: number;
|
|
@@ -340,6 +349,7 @@ interface PTYManagerOptions {
|
|
|
340
349
|
} | null) => void;
|
|
341
350
|
onLiveQuestion?: (sessionId: string, questions: AskQuestion[]) => void;
|
|
342
351
|
onLiveQuestionGone?: (sessionId: string) => void;
|
|
352
|
+
onUserMessage?: (sessionId: string, text: string, ts: number) => void;
|
|
343
353
|
logger?: Logger;
|
|
344
354
|
}
|
|
345
355
|
interface StartSessionOptions {
|
|
@@ -364,6 +374,7 @@ interface SessionRunner {
|
|
|
364
374
|
putOnHold(sessionId: string): void;
|
|
365
375
|
getOutput(sessionId: string): string;
|
|
366
376
|
getOutputLines(sessionId: string, maxLines: number): Promise<string[]>;
|
|
377
|
+
getInputHistory(sessionId: string): UserMessage[];
|
|
367
378
|
getSession(sessionId: string): ManagedSession | null;
|
|
368
379
|
hasSession(sessionId: string): boolean;
|
|
369
380
|
listSessions(): ManagedSession[];
|
|
@@ -794,6 +805,7 @@ declare class LiveSessionManager {
|
|
|
794
805
|
putOnHold(sessionId: string): void;
|
|
795
806
|
getOutput(sessionId: string): string;
|
|
796
807
|
getOutputLines(sessionId: string, maxLines: number): Promise<string[]>;
|
|
808
|
+
getInputHistory(sessionId: string): UserMessage[];
|
|
797
809
|
getSession(sessionId: string): ManagedSession | null;
|
|
798
810
|
hasSession(sessionId: string): boolean;
|
|
799
811
|
listSessions(): ManagedSession[];
|
|
@@ -860,7 +872,7 @@ type ApiDeps = {
|
|
|
860
872
|
handlePairExchange: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
861
873
|
handleBrowse: (url: URL, res: ServerResponse) => Promise<void>;
|
|
862
874
|
handleMkdir: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
863
|
-
handleWsOpen: (ws: WebSocket
|
|
875
|
+
handleWsOpen: (ws: WebSocket) => void;
|
|
864
876
|
handleWsMessage: (ws: WebSocket, raw: unknown) => void;
|
|
865
877
|
handleWsClose: (ws: WebSocket) => void;
|
|
866
878
|
agentClient: AgentClient | null;
|
|
@@ -938,6 +950,7 @@ declare class PTYManager implements SessionRunner {
|
|
|
938
950
|
private onPermissionChange;
|
|
939
951
|
private onLiveQuestion;
|
|
940
952
|
private onLiveQuestionGone;
|
|
953
|
+
private onUserMessage;
|
|
941
954
|
private permissionOpen;
|
|
942
955
|
private lastScreenQuestionKey;
|
|
943
956
|
private shellPromptOpen;
|
|
@@ -962,6 +975,8 @@ declare class PTYManager implements SessionRunner {
|
|
|
962
975
|
putOnHold(sessionId: string): void;
|
|
963
976
|
getOutput(sessionId: string): string;
|
|
964
977
|
getOutputLines(sessionId: string, maxLines: number): Promise<string[]>;
|
|
978
|
+
getInputHistory(sessionId: string): UserMessage[];
|
|
979
|
+
private recordUserMessage;
|
|
965
980
|
getSession(sessionId: string): ManagedSession | null;
|
|
966
981
|
hasSession(sessionId: string): boolean;
|
|
967
982
|
listSessions(): ManagedSession[];
|
|
@@ -1016,9 +1031,6 @@ declare class StreamerServer {
|
|
|
1016
1031
|
private sessionSubscribers;
|
|
1017
1032
|
private clientIdToWs;
|
|
1018
1033
|
private wsToClientId;
|
|
1019
|
-
private wsAuthed;
|
|
1020
|
-
private wsAuthPending;
|
|
1021
|
-
private wsAuthTimeoutMs;
|
|
1022
1034
|
private cache;
|
|
1023
1035
|
private projectsRepo;
|
|
1024
1036
|
private conversationsRepo;
|
|
@@ -1047,7 +1059,6 @@ declare class StreamerServer {
|
|
|
1047
1059
|
* a full broadcast if no match exists (old clients, or no WS registered yet).
|
|
1048
1060
|
*/
|
|
1049
1061
|
private broadcastOrUnicastSessionList;
|
|
1050
|
-
private completeWsAuth;
|
|
1051
1062
|
private addSessionSubscriber;
|
|
1052
1063
|
private startGraceTimer;
|
|
1053
1064
|
get port(): number;
|
|
@@ -1197,4 +1208,4 @@ declare class ConversationWatcher {
|
|
|
1197
1208
|
private readNewLines;
|
|
1198
1209
|
}
|
|
1199
1210
|
|
|
1200
|
-
export { type AgentClient, type AgentClientOpts, type AgentConfig, type AppendArgs, type AskOption, type AskQuestion, CLAUDE_CODE_PROVIDER, CODEX_CLI_PROVIDER, type ConversationListResponse, ConversationWatcher, type ConversationWriter, type DbConfig, type DiscoveredProcess, LiveSessionManager, type ManagedSession, PTYManager, type PTYManagerOptions, type PermissionOption, type ProgressDedupeLRU, type ProviderName, type ServerConfig, type SessionCursor, type SessionListPage, type SessionListQuery, type SessionResponse, type SessionRunner, type SessionSortKey, type SessionStatus, SessionStore, type SortOrder, type StartFreshSessionOptions, type StartSessionOptions, StreamerServer, WSHub, type WSMessage, createAgentClient, createConversationWriter, createPool, createProgressDedupeLRU, createProgressRoutes, discoverClaudeProcesses, generateApiKey, getDbConfig, isDbEnabled, isProviderName, isProviderResumable, loadOrCreateApiKey, maskConnectionString, readAgentConfig, validateApiKey };
|
|
1211
|
+
export { type AgentClient, type AgentClientOpts, type AgentConfig, type AppendArgs, type AskOption, type AskQuestion, CLAUDE_CODE_PROVIDER, CODEX_CLI_PROVIDER, type ConversationListResponse, ConversationWatcher, type ConversationWriter, type DbConfig, type DiscoveredProcess, LiveSessionManager, type ManagedSession, PTYManager, type PTYManagerOptions, type PermissionOption, type ProgressDedupeLRU, type ProviderName, type ServerConfig, type SessionCursor, type SessionListPage, type SessionListQuery, type SessionResponse, type SessionRunner, type SessionSortKey, type SessionStatus, SessionStore, type SortOrder, type StartFreshSessionOptions, type StartSessionOptions, StreamerServer, type UserMessage, WSHub, type WSMessage, createAgentClient, createConversationWriter, createPool, createProgressDedupeLRU, createProgressRoutes, discoverClaudeProcesses, generateApiKey, getDbConfig, isDbEnabled, isProviderName, isProviderResumable, loadOrCreateApiKey, maskConnectionString, readAgentConfig, validateApiKey };
|