@threadbase-sh/streamer 1.46.1 → 1.47.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 +11410 -10660
- package/dist/cli.cjs.map +1 -1
- package/dist/ensure-demo-project-dirs.cjs +105 -0
- package/dist/ensure-demo-project-dirs.cjs.map +1 -0
- package/dist/index.cjs +936 -194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -4
- package/dist/index.d.ts +100 -4
- package/dist/index.js +937 -195
- package/dist/index.js.map +1 -1
- package/dist/merge-server-yaml.cjs +97 -0
- package/dist/merge-server-yaml.cjs.map +1 -0
- package/dist/migrations/015_drop_projects_message_count.sql +8 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -128,7 +128,7 @@ type SessionStatus = "running" | "waiting_input" | "idle";
|
|
|
128
128
|
* Orthogonal to SessionStatus — see SessionResponse.lifecycle for why the two
|
|
129
129
|
* are separate, and docs/architecture/2026-07-24-durable-session-runtime.md.
|
|
130
130
|
*/
|
|
131
|
-
type SessionLifecycle = "attached" | "detached" | "orphaned" | "resumable" | "completed" | "failed";
|
|
131
|
+
type SessionLifecycle = "attached" | "starting" | "detached" | "orphaned" | "resumable" | "completed" | "failed";
|
|
132
132
|
/**
|
|
133
133
|
* How a SessionStatus was derived (C3).
|
|
134
134
|
* See docs/architecture/2026-07-24-session-state-confidence.md.
|
|
@@ -164,6 +164,13 @@ interface ManagedSession {
|
|
|
164
164
|
promptCount: number;
|
|
165
165
|
lastOutput: string;
|
|
166
166
|
failureReason?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Machine-readable companion to `failureReason`, set only when the runner
|
|
169
|
+
* recognised the failure. Currently just `codex_active_writer` (Codex's
|
|
170
|
+
* single-writer lock), which the resume path maps to a structured 409 rather
|
|
171
|
+
* than reporting a spawn as successful. Absent for every other failure.
|
|
172
|
+
*/
|
|
173
|
+
failureCode?: string;
|
|
167
174
|
sessionName?: string;
|
|
168
175
|
model?: string;
|
|
169
176
|
account?: string;
|
|
@@ -213,6 +220,13 @@ interface ManagedSession {
|
|
|
213
220
|
* lifetime of a live PTY) — must never be written into either of those.
|
|
214
221
|
*/
|
|
215
222
|
boundConversationId?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Source conversation this session was FORKED from (`codex fork`). Distinct
|
|
225
|
+
* from `resumedFromConversationId`: a resume continues one conversation, a
|
|
226
|
+
* fork starts a second one whose history diverges from the source at the fork
|
|
227
|
+
* point — and the source keeps its own owner, which is the entire point.
|
|
228
|
+
*/
|
|
229
|
+
forkedFromConversationId?: string;
|
|
216
230
|
/**
|
|
217
231
|
* Multi-agent mode only. Per-session in-memory LRU of progress event ids
|
|
218
232
|
* seen by the webhook receiver. Used to drop Temporal-replay duplicates
|
|
@@ -403,7 +417,10 @@ interface SessionResponse {
|
|
|
403
417
|
* tell a completed session from one we terminated.
|
|
404
418
|
*
|
|
405
419
|
* Additive and optional — `ptyAttached` keeps its meaning (=== "attached"),
|
|
406
|
-
* so a client that ignores this behaves exactly as it did before.
|
|
420
|
+
* so a client that ignores this behaves exactly as it did before. `"starting"`
|
|
421
|
+
* is additive in the same way: a session we hold no PTY for and have observed
|
|
422
|
+
* no exit for reports it instead of the `"completed"` it used to, so a client
|
|
423
|
+
* can tell "not attached yet" from "ended" (tb-mobile #508).
|
|
407
424
|
*/
|
|
408
425
|
/**
|
|
409
426
|
* How `status` was derived and how far to trust it (C3). Additive: `status`
|
|
@@ -451,6 +468,8 @@ interface SessionResponse {
|
|
|
451
468
|
lastActivityAt?: string;
|
|
452
469
|
filePath?: string;
|
|
453
470
|
resumedFromConversationId?: string;
|
|
471
|
+
/** See `ManagedSession.forkedFromConversationId`. Additive; older clients ignore it. */
|
|
472
|
+
forkedFromConversationId?: string;
|
|
454
473
|
/** See `ManagedSession.boundConversationId` — never repurposes `conversationId`. */
|
|
455
474
|
boundConversationId?: string;
|
|
456
475
|
/**
|
|
@@ -588,6 +607,17 @@ interface StartSessionOptions {
|
|
|
588
607
|
claudeFlags?: ClaudeFlagValues;
|
|
589
608
|
claudeExtraArgs?: string;
|
|
590
609
|
}
|
|
610
|
+
interface StartForkSessionOptions {
|
|
611
|
+
/**
|
|
612
|
+
* Provider-side id of the conversation to fork FROM (for Codex, the rollout
|
|
613
|
+
* id — never a local placeholder). The forked session gets its own id; the
|
|
614
|
+
* two identities are deliberately kept distinct.
|
|
615
|
+
*/
|
|
616
|
+
forkFromId: string;
|
|
617
|
+
projectPath: string;
|
|
618
|
+
projectName?: string;
|
|
619
|
+
branch?: string;
|
|
620
|
+
}
|
|
591
621
|
interface StartFreshSessionOptions {
|
|
592
622
|
projectPath: string;
|
|
593
623
|
projectName?: string;
|
|
@@ -1218,7 +1248,6 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
1218
1248
|
lastIndexedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1219
1249
|
latestMessageAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1220
1250
|
latestMessageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1221
|
-
messageCount: z.ZodOptional<z.ZodNumber>;
|
|
1222
1251
|
createdAt: z.ZodString;
|
|
1223
1252
|
updatedAt: z.ZodString;
|
|
1224
1253
|
}, z.core.$strip>;
|
|
@@ -1512,6 +1541,15 @@ declare class LiveSessionManager {
|
|
|
1512
1541
|
startFresh(options: StartFreshSessionOptions & {
|
|
1513
1542
|
provider?: ProviderName;
|
|
1514
1543
|
}): Promise<ManagedSession>;
|
|
1544
|
+
/**
|
|
1545
|
+
* Fork an existing conversation into a new session. Codex-only: `codex fork`
|
|
1546
|
+
* has no Claude Code equivalent, and there is no safe generic fallback — a
|
|
1547
|
+
* silent downgrade to resume would attach to the very writer the caller is
|
|
1548
|
+
* trying to leave alone.
|
|
1549
|
+
*/
|
|
1550
|
+
startFork(options: StartForkSessionOptions & {
|
|
1551
|
+
provider?: ProviderName;
|
|
1552
|
+
}): Promise<ManagedSession>;
|
|
1515
1553
|
sendInput(sessionId: string, input: string): number;
|
|
1516
1554
|
sendKeys(sessionId: string, keys: string): void;
|
|
1517
1555
|
cancel(sessionId: string): void;
|
|
@@ -1696,6 +1734,7 @@ type ApiDeps = {
|
|
|
1696
1734
|
handleSetSessionEffort: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1697
1735
|
handleUploadFile: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1698
1736
|
handleAdopt: (sessionId: string, res: ServerResponse) => Promise<void>;
|
|
1737
|
+
handleFork: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1699
1738
|
handleResume: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1700
1739
|
handleStartSession: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1701
1740
|
handleListConversations: (url: URL, res: ServerResponse) => Promise<void>;
|
|
@@ -1916,6 +1955,7 @@ declare class StreamerServer {
|
|
|
1916
1955
|
private liveActivityNotifier;
|
|
1917
1956
|
private liveActivityRenewal;
|
|
1918
1957
|
private discoveryCache;
|
|
1958
|
+
private discoveryInFlight;
|
|
1919
1959
|
private cacheDir;
|
|
1920
1960
|
private runtimeDbPath;
|
|
1921
1961
|
private tailSize;
|
|
@@ -2183,6 +2223,12 @@ declare class StreamerServer {
|
|
|
2183
2223
|
private maybeAttachExternalTail;
|
|
2184
2224
|
/** Stop tailing an external file and drop its bookkeeping. */
|
|
2185
2225
|
private detachExternalTail;
|
|
2226
|
+
/**
|
|
2227
|
+
* Shared unlink path for the per-file watcher and the directory watcher.
|
|
2228
|
+
* Detaches any external tail and drops the cache row (unless an integrity
|
|
2229
|
+
* alert is freezing deletes).
|
|
2230
|
+
*/
|
|
2231
|
+
private handleJsonlDeleted;
|
|
2186
2232
|
/** Make room for one more tail by evicting the least recently active ones. */
|
|
2187
2233
|
private evictExternalTailsIfNeeded;
|
|
2188
2234
|
/**
|
|
@@ -2216,8 +2262,28 @@ declare class StreamerServer {
|
|
|
2216
2262
|
private handleSearchTarget;
|
|
2217
2263
|
private handleSearch;
|
|
2218
2264
|
private handleListSessions;
|
|
2265
|
+
/**
|
|
2266
|
+
* Refresh the discovered-process list, sharing one in-flight enumeration
|
|
2267
|
+
* across concurrent callers and honouring the 15s TTL cache.
|
|
2268
|
+
*/
|
|
2269
|
+
private refreshDiscovery;
|
|
2219
2270
|
private handleGetSession;
|
|
2220
2271
|
private handleResume;
|
|
2272
|
+
/**
|
|
2273
|
+
* `POST /api/sessions/:id/fork` — continue a conversation this streamer is
|
|
2274
|
+
* not allowed to resume, without touching whoever owns it.
|
|
2275
|
+
*
|
|
2276
|
+
* Codex only (`codex fork <id>`): Claude Code has no equivalent, and there is
|
|
2277
|
+
* no safe generic fallback — quietly resuming instead would attach to the
|
|
2278
|
+
* exact writer the caller is trying to leave alone, which is the failure this
|
|
2279
|
+
* endpoint exists to avoid.
|
|
2280
|
+
*
|
|
2281
|
+
* NOT idempotent by default: every accepted call starts another Codex
|
|
2282
|
+
* process and another rollout. Clients that retry on timeout must send
|
|
2283
|
+
* `idempotencyKey`, which replays the first outcome for 10 minutes (same
|
|
2284
|
+
* store and semantics as `POST /:id/input`).
|
|
2285
|
+
*/
|
|
2286
|
+
private handleFork;
|
|
2221
2287
|
/**
|
|
2222
2288
|
* Resume a session, from an HTTP request or from the boot path.
|
|
2223
2289
|
*
|
|
@@ -2231,6 +2297,36 @@ declare class StreamerServer {
|
|
|
2231
2297
|
* maps it to a status code and the boot caller logs it.
|
|
2232
2298
|
*/
|
|
2233
2299
|
private resumeSession;
|
|
2300
|
+
/**
|
|
2301
|
+
* Resolve a client-supplied session/conversation id into everything needed to
|
|
2302
|
+
* launch against it: the id the PROVIDER filed the history under, that
|
|
2303
|
+
* history's path, the project cwd, and which CLI owns it.
|
|
2304
|
+
*
|
|
2305
|
+
* Shared by resume and fork so the two can never disagree about identity —
|
|
2306
|
+
* which for Codex is the whole difficulty: the id a client navigated to may
|
|
2307
|
+
* be a local placeholder, and only the registry knows the rollout id behind
|
|
2308
|
+
* it.
|
|
2309
|
+
*/
|
|
2310
|
+
private resolveConversationTarget;
|
|
2311
|
+
/**
|
|
2312
|
+
* Block until a freshly spawned session reaches `waiting_input` (ready) or
|
|
2313
|
+
* `idle` (failed), or until `timeoutMs` elapses with the process still alive.
|
|
2314
|
+
*
|
|
2315
|
+
* "timeout" is not an error: it is the pre-existing asynchronous contract —
|
|
2316
|
+
* the session keeps booting and the caller answers with a pending shape.
|
|
2317
|
+
*/
|
|
2318
|
+
private waitForStartupOutcome;
|
|
2319
|
+
/**
|
|
2320
|
+
* Drop every trace of a session that never became usable, and hand back what
|
|
2321
|
+
* it failed with.
|
|
2322
|
+
*
|
|
2323
|
+
* The runner has already torn itself down (failStartup / handleExit); what
|
|
2324
|
+
* remains is server-side bookkeeping that would otherwise leave a dead
|
|
2325
|
+
* session in the list, a registry row claiming a spawn, and a `selfPtyEndedAt`
|
|
2326
|
+
* marker that would suppress the mtime collision signal on the NEXT resume —
|
|
2327
|
+
* i.e. it would help hide the very owner we just collided with.
|
|
2328
|
+
*/
|
|
2329
|
+
private abandonFailedStart;
|
|
2234
2330
|
private enrichResumedSessionAsync;
|
|
2235
2331
|
private handleSendInput;
|
|
2236
2332
|
private processJsonlQuestions;
|
|
@@ -2368,4 +2464,4 @@ declare class ConversationWatcher {
|
|
|
2368
2464
|
private readNewLines;
|
|
2369
2465
|
}
|
|
2370
2466
|
|
|
2371
|
-
export { type AgentClient, type AgentClientOpts, type AgentConfig, type AppendArgs, type AskOption, type AskQuestion, CLAUDE_CODE_PROVIDER, CODEX_CLI_PROVIDER, type CacheAlertResolveAction, type ConversationListResponse, ConversationWatcher, type ConversationWriter, type DbConfig, type DiscoveredProcess, LiveSessionManager, type ManagedSession, PTYManager, type PTYManagerOptions, type PermissionOption, type ProcessLiveness, type ProgressDedupeLRU, type ProviderName, type ServerConfig, type ServerWarmingUpResponse, type ServerWarmupState, type SessionActivity, type SessionCursor, type SessionLifecycle, type SessionListPage, type SessionListQuery, type SessionOwnership, type SessionResponse, type SessionRunner, type SessionSortKey, type SessionStatus, SessionStore, type SortOrder, type StartFreshSessionOptions, type StartSessionOptions, type StatusConfidence, type StatusSource$1 as StatusSource, StreamerServer, type UserMessage, WSHub, type WSMessage, confidenceForSource, createAgentClient, createConversationWriter, createPool, createProgressDedupeLRU, createProgressRoutes, discoverClaudeProcesses, generateApiKey, getDbConfig, isDbEnabled, isProviderName, isProviderResumable, loadOrCreateApiKey, maskConnectionString, readAgentConfig, validateApiKey };
|
|
2467
|
+
export { type AgentClient, type AgentClientOpts, type AgentConfig, type AppendArgs, type AskOption, type AskQuestion, CLAUDE_CODE_PROVIDER, CODEX_CLI_PROVIDER, type CacheAlertResolveAction, type ConversationListResponse, ConversationWatcher, type ConversationWriter, type DbConfig, type DiscoveredProcess, LiveSessionManager, type ManagedSession, PTYManager, type PTYManagerOptions, type PermissionOption, type ProcessLiveness, type ProgressDedupeLRU, type ProviderName, type ServerConfig, type ServerWarmingUpResponse, type ServerWarmupState, type SessionActivity, type SessionCursor, type SessionLifecycle, type SessionListPage, type SessionListQuery, type SessionOwnership, type SessionResponse, type SessionRunner, type SessionSortKey, type SessionStatus, SessionStore, type SortOrder, type StartForkSessionOptions, type StartFreshSessionOptions, type StartSessionOptions, type StatusConfidence, type StatusSource$1 as StatusSource, StreamerServer, type UserMessage, WSHub, type WSMessage, confidenceForSource, createAgentClient, createConversationWriter, createPool, createProgressDedupeLRU, createProgressRoutes, discoverClaudeProcesses, generateApiKey, getDbConfig, isDbEnabled, isProviderName, isProviderResumable, loadOrCreateApiKey, maskConnectionString, readAgentConfig, validateApiKey };
|
package/dist/index.d.ts
CHANGED
|
@@ -128,7 +128,7 @@ type SessionStatus = "running" | "waiting_input" | "idle";
|
|
|
128
128
|
* Orthogonal to SessionStatus — see SessionResponse.lifecycle for why the two
|
|
129
129
|
* are separate, and docs/architecture/2026-07-24-durable-session-runtime.md.
|
|
130
130
|
*/
|
|
131
|
-
type SessionLifecycle = "attached" | "detached" | "orphaned" | "resumable" | "completed" | "failed";
|
|
131
|
+
type SessionLifecycle = "attached" | "starting" | "detached" | "orphaned" | "resumable" | "completed" | "failed";
|
|
132
132
|
/**
|
|
133
133
|
* How a SessionStatus was derived (C3).
|
|
134
134
|
* See docs/architecture/2026-07-24-session-state-confidence.md.
|
|
@@ -164,6 +164,13 @@ interface ManagedSession {
|
|
|
164
164
|
promptCount: number;
|
|
165
165
|
lastOutput: string;
|
|
166
166
|
failureReason?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Machine-readable companion to `failureReason`, set only when the runner
|
|
169
|
+
* recognised the failure. Currently just `codex_active_writer` (Codex's
|
|
170
|
+
* single-writer lock), which the resume path maps to a structured 409 rather
|
|
171
|
+
* than reporting a spawn as successful. Absent for every other failure.
|
|
172
|
+
*/
|
|
173
|
+
failureCode?: string;
|
|
167
174
|
sessionName?: string;
|
|
168
175
|
model?: string;
|
|
169
176
|
account?: string;
|
|
@@ -213,6 +220,13 @@ interface ManagedSession {
|
|
|
213
220
|
* lifetime of a live PTY) — must never be written into either of those.
|
|
214
221
|
*/
|
|
215
222
|
boundConversationId?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Source conversation this session was FORKED from (`codex fork`). Distinct
|
|
225
|
+
* from `resumedFromConversationId`: a resume continues one conversation, a
|
|
226
|
+
* fork starts a second one whose history diverges from the source at the fork
|
|
227
|
+
* point — and the source keeps its own owner, which is the entire point.
|
|
228
|
+
*/
|
|
229
|
+
forkedFromConversationId?: string;
|
|
216
230
|
/**
|
|
217
231
|
* Multi-agent mode only. Per-session in-memory LRU of progress event ids
|
|
218
232
|
* seen by the webhook receiver. Used to drop Temporal-replay duplicates
|
|
@@ -403,7 +417,10 @@ interface SessionResponse {
|
|
|
403
417
|
* tell a completed session from one we terminated.
|
|
404
418
|
*
|
|
405
419
|
* Additive and optional — `ptyAttached` keeps its meaning (=== "attached"),
|
|
406
|
-
* so a client that ignores this behaves exactly as it did before.
|
|
420
|
+
* so a client that ignores this behaves exactly as it did before. `"starting"`
|
|
421
|
+
* is additive in the same way: a session we hold no PTY for and have observed
|
|
422
|
+
* no exit for reports it instead of the `"completed"` it used to, so a client
|
|
423
|
+
* can tell "not attached yet" from "ended" (tb-mobile #508).
|
|
407
424
|
*/
|
|
408
425
|
/**
|
|
409
426
|
* How `status` was derived and how far to trust it (C3). Additive: `status`
|
|
@@ -451,6 +468,8 @@ interface SessionResponse {
|
|
|
451
468
|
lastActivityAt?: string;
|
|
452
469
|
filePath?: string;
|
|
453
470
|
resumedFromConversationId?: string;
|
|
471
|
+
/** See `ManagedSession.forkedFromConversationId`. Additive; older clients ignore it. */
|
|
472
|
+
forkedFromConversationId?: string;
|
|
454
473
|
/** See `ManagedSession.boundConversationId` — never repurposes `conversationId`. */
|
|
455
474
|
boundConversationId?: string;
|
|
456
475
|
/**
|
|
@@ -588,6 +607,17 @@ interface StartSessionOptions {
|
|
|
588
607
|
claudeFlags?: ClaudeFlagValues;
|
|
589
608
|
claudeExtraArgs?: string;
|
|
590
609
|
}
|
|
610
|
+
interface StartForkSessionOptions {
|
|
611
|
+
/**
|
|
612
|
+
* Provider-side id of the conversation to fork FROM (for Codex, the rollout
|
|
613
|
+
* id — never a local placeholder). The forked session gets its own id; the
|
|
614
|
+
* two identities are deliberately kept distinct.
|
|
615
|
+
*/
|
|
616
|
+
forkFromId: string;
|
|
617
|
+
projectPath: string;
|
|
618
|
+
projectName?: string;
|
|
619
|
+
branch?: string;
|
|
620
|
+
}
|
|
591
621
|
interface StartFreshSessionOptions {
|
|
592
622
|
projectPath: string;
|
|
593
623
|
projectName?: string;
|
|
@@ -1218,7 +1248,6 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
1218
1248
|
lastIndexedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1219
1249
|
latestMessageAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1220
1250
|
latestMessageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1221
|
-
messageCount: z.ZodOptional<z.ZodNumber>;
|
|
1222
1251
|
createdAt: z.ZodString;
|
|
1223
1252
|
updatedAt: z.ZodString;
|
|
1224
1253
|
}, z.core.$strip>;
|
|
@@ -1512,6 +1541,15 @@ declare class LiveSessionManager {
|
|
|
1512
1541
|
startFresh(options: StartFreshSessionOptions & {
|
|
1513
1542
|
provider?: ProviderName;
|
|
1514
1543
|
}): Promise<ManagedSession>;
|
|
1544
|
+
/**
|
|
1545
|
+
* Fork an existing conversation into a new session. Codex-only: `codex fork`
|
|
1546
|
+
* has no Claude Code equivalent, and there is no safe generic fallback — a
|
|
1547
|
+
* silent downgrade to resume would attach to the very writer the caller is
|
|
1548
|
+
* trying to leave alone.
|
|
1549
|
+
*/
|
|
1550
|
+
startFork(options: StartForkSessionOptions & {
|
|
1551
|
+
provider?: ProviderName;
|
|
1552
|
+
}): Promise<ManagedSession>;
|
|
1515
1553
|
sendInput(sessionId: string, input: string): number;
|
|
1516
1554
|
sendKeys(sessionId: string, keys: string): void;
|
|
1517
1555
|
cancel(sessionId: string): void;
|
|
@@ -1696,6 +1734,7 @@ type ApiDeps = {
|
|
|
1696
1734
|
handleSetSessionEffort: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1697
1735
|
handleUploadFile: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1698
1736
|
handleAdopt: (sessionId: string, res: ServerResponse) => Promise<void>;
|
|
1737
|
+
handleFork: (sessionId: string, req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1699
1738
|
handleResume: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1700
1739
|
handleStartSession: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
1701
1740
|
handleListConversations: (url: URL, res: ServerResponse) => Promise<void>;
|
|
@@ -1916,6 +1955,7 @@ declare class StreamerServer {
|
|
|
1916
1955
|
private liveActivityNotifier;
|
|
1917
1956
|
private liveActivityRenewal;
|
|
1918
1957
|
private discoveryCache;
|
|
1958
|
+
private discoveryInFlight;
|
|
1919
1959
|
private cacheDir;
|
|
1920
1960
|
private runtimeDbPath;
|
|
1921
1961
|
private tailSize;
|
|
@@ -2183,6 +2223,12 @@ declare class StreamerServer {
|
|
|
2183
2223
|
private maybeAttachExternalTail;
|
|
2184
2224
|
/** Stop tailing an external file and drop its bookkeeping. */
|
|
2185
2225
|
private detachExternalTail;
|
|
2226
|
+
/**
|
|
2227
|
+
* Shared unlink path for the per-file watcher and the directory watcher.
|
|
2228
|
+
* Detaches any external tail and drops the cache row (unless an integrity
|
|
2229
|
+
* alert is freezing deletes).
|
|
2230
|
+
*/
|
|
2231
|
+
private handleJsonlDeleted;
|
|
2186
2232
|
/** Make room for one more tail by evicting the least recently active ones. */
|
|
2187
2233
|
private evictExternalTailsIfNeeded;
|
|
2188
2234
|
/**
|
|
@@ -2216,8 +2262,28 @@ declare class StreamerServer {
|
|
|
2216
2262
|
private handleSearchTarget;
|
|
2217
2263
|
private handleSearch;
|
|
2218
2264
|
private handleListSessions;
|
|
2265
|
+
/**
|
|
2266
|
+
* Refresh the discovered-process list, sharing one in-flight enumeration
|
|
2267
|
+
* across concurrent callers and honouring the 15s TTL cache.
|
|
2268
|
+
*/
|
|
2269
|
+
private refreshDiscovery;
|
|
2219
2270
|
private handleGetSession;
|
|
2220
2271
|
private handleResume;
|
|
2272
|
+
/**
|
|
2273
|
+
* `POST /api/sessions/:id/fork` — continue a conversation this streamer is
|
|
2274
|
+
* not allowed to resume, without touching whoever owns it.
|
|
2275
|
+
*
|
|
2276
|
+
* Codex only (`codex fork <id>`): Claude Code has no equivalent, and there is
|
|
2277
|
+
* no safe generic fallback — quietly resuming instead would attach to the
|
|
2278
|
+
* exact writer the caller is trying to leave alone, which is the failure this
|
|
2279
|
+
* endpoint exists to avoid.
|
|
2280
|
+
*
|
|
2281
|
+
* NOT idempotent by default: every accepted call starts another Codex
|
|
2282
|
+
* process and another rollout. Clients that retry on timeout must send
|
|
2283
|
+
* `idempotencyKey`, which replays the first outcome for 10 minutes (same
|
|
2284
|
+
* store and semantics as `POST /:id/input`).
|
|
2285
|
+
*/
|
|
2286
|
+
private handleFork;
|
|
2221
2287
|
/**
|
|
2222
2288
|
* Resume a session, from an HTTP request or from the boot path.
|
|
2223
2289
|
*
|
|
@@ -2231,6 +2297,36 @@ declare class StreamerServer {
|
|
|
2231
2297
|
* maps it to a status code and the boot caller logs it.
|
|
2232
2298
|
*/
|
|
2233
2299
|
private resumeSession;
|
|
2300
|
+
/**
|
|
2301
|
+
* Resolve a client-supplied session/conversation id into everything needed to
|
|
2302
|
+
* launch against it: the id the PROVIDER filed the history under, that
|
|
2303
|
+
* history's path, the project cwd, and which CLI owns it.
|
|
2304
|
+
*
|
|
2305
|
+
* Shared by resume and fork so the two can never disagree about identity —
|
|
2306
|
+
* which for Codex is the whole difficulty: the id a client navigated to may
|
|
2307
|
+
* be a local placeholder, and only the registry knows the rollout id behind
|
|
2308
|
+
* it.
|
|
2309
|
+
*/
|
|
2310
|
+
private resolveConversationTarget;
|
|
2311
|
+
/**
|
|
2312
|
+
* Block until a freshly spawned session reaches `waiting_input` (ready) or
|
|
2313
|
+
* `idle` (failed), or until `timeoutMs` elapses with the process still alive.
|
|
2314
|
+
*
|
|
2315
|
+
* "timeout" is not an error: it is the pre-existing asynchronous contract —
|
|
2316
|
+
* the session keeps booting and the caller answers with a pending shape.
|
|
2317
|
+
*/
|
|
2318
|
+
private waitForStartupOutcome;
|
|
2319
|
+
/**
|
|
2320
|
+
* Drop every trace of a session that never became usable, and hand back what
|
|
2321
|
+
* it failed with.
|
|
2322
|
+
*
|
|
2323
|
+
* The runner has already torn itself down (failStartup / handleExit); what
|
|
2324
|
+
* remains is server-side bookkeeping that would otherwise leave a dead
|
|
2325
|
+
* session in the list, a registry row claiming a spawn, and a `selfPtyEndedAt`
|
|
2326
|
+
* marker that would suppress the mtime collision signal on the NEXT resume —
|
|
2327
|
+
* i.e. it would help hide the very owner we just collided with.
|
|
2328
|
+
*/
|
|
2329
|
+
private abandonFailedStart;
|
|
2234
2330
|
private enrichResumedSessionAsync;
|
|
2235
2331
|
private handleSendInput;
|
|
2236
2332
|
private processJsonlQuestions;
|
|
@@ -2368,4 +2464,4 @@ declare class ConversationWatcher {
|
|
|
2368
2464
|
private readNewLines;
|
|
2369
2465
|
}
|
|
2370
2466
|
|
|
2371
|
-
export { type AgentClient, type AgentClientOpts, type AgentConfig, type AppendArgs, type AskOption, type AskQuestion, CLAUDE_CODE_PROVIDER, CODEX_CLI_PROVIDER, type CacheAlertResolveAction, type ConversationListResponse, ConversationWatcher, type ConversationWriter, type DbConfig, type DiscoveredProcess, LiveSessionManager, type ManagedSession, PTYManager, type PTYManagerOptions, type PermissionOption, type ProcessLiveness, type ProgressDedupeLRU, type ProviderName, type ServerConfig, type ServerWarmingUpResponse, type ServerWarmupState, type SessionActivity, type SessionCursor, type SessionLifecycle, type SessionListPage, type SessionListQuery, type SessionOwnership, type SessionResponse, type SessionRunner, type SessionSortKey, type SessionStatus, SessionStore, type SortOrder, type StartFreshSessionOptions, type StartSessionOptions, type StatusConfidence, type StatusSource$1 as StatusSource, StreamerServer, type UserMessage, WSHub, type WSMessage, confidenceForSource, createAgentClient, createConversationWriter, createPool, createProgressDedupeLRU, createProgressRoutes, discoverClaudeProcesses, generateApiKey, getDbConfig, isDbEnabled, isProviderName, isProviderResumable, loadOrCreateApiKey, maskConnectionString, readAgentConfig, validateApiKey };
|
|
2467
|
+
export { type AgentClient, type AgentClientOpts, type AgentConfig, type AppendArgs, type AskOption, type AskQuestion, CLAUDE_CODE_PROVIDER, CODEX_CLI_PROVIDER, type CacheAlertResolveAction, type ConversationListResponse, ConversationWatcher, type ConversationWriter, type DbConfig, type DiscoveredProcess, LiveSessionManager, type ManagedSession, PTYManager, type PTYManagerOptions, type PermissionOption, type ProcessLiveness, type ProgressDedupeLRU, type ProviderName, type ServerConfig, type ServerWarmingUpResponse, type ServerWarmupState, type SessionActivity, type SessionCursor, type SessionLifecycle, type SessionListPage, type SessionListQuery, type SessionOwnership, type SessionResponse, type SessionRunner, type SessionSortKey, type SessionStatus, SessionStore, type SortOrder, type StartForkSessionOptions, type StartFreshSessionOptions, type StartSessionOptions, type StatusConfidence, type StatusSource$1 as StatusSource, StreamerServer, type UserMessage, WSHub, type WSMessage, confidenceForSource, createAgentClient, createConversationWriter, createPool, createProgressDedupeLRU, createProgressRoutes, discoverClaudeProcesses, generateApiKey, getDbConfig, isDbEnabled, isProviderName, isProviderResumable, loadOrCreateApiKey, maskConnectionString, readAgentConfig, validateApiKey };
|