@threadbase-sh/streamer 1.42.0 → 1.44.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 +1516 -491
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +990 -117
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -4
- package/dist/index.d.ts +48 -4
- package/dist/index.js +1031 -158
- package/dist/index.js.map +1 -1
- package/dist/launchd-entry.cjs +8 -5
- package/dist/launchd-entry.cjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -192,6 +192,11 @@ interface ManagedSession {
|
|
|
192
192
|
* Cleared implicitly when a resume overwrites the stub with a real session.
|
|
193
193
|
*/
|
|
194
194
|
rehydrated?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* This live session was re-adopted from the pty-host during boot rather than
|
|
197
|
+
* spawned by this streamer process. Internal lifecycle provenance only.
|
|
198
|
+
*/
|
|
199
|
+
reconciled?: boolean;
|
|
195
200
|
/**
|
|
196
201
|
* What this session was doing when the streamer stopped it, for a stub whose
|
|
197
202
|
* `status` had to flatten to `idle`. Only ever set from a registry row whose
|
|
@@ -276,7 +281,7 @@ type WSMessage = {
|
|
|
276
281
|
reworkAttempt?: number;
|
|
277
282
|
} | {
|
|
278
283
|
type: "session_list";
|
|
279
|
-
sessions: SessionResponse[];
|
|
284
|
+
sessions: readonly SessionResponse[];
|
|
280
285
|
} | {
|
|
281
286
|
type: "conversation_event";
|
|
282
287
|
sessionId: string;
|
|
@@ -488,7 +493,8 @@ interface ConversationListResponse {
|
|
|
488
493
|
type SessionSortKey = "startedAt" | "lastActivityAt" | "projectName" | "status";
|
|
489
494
|
type SortOrder = "asc" | "desc";
|
|
490
495
|
interface SessionListPage {
|
|
491
|
-
|
|
496
|
+
/** Response copies, like `SessionStore.list()` — see the note there. */
|
|
497
|
+
sessions: readonly Readonly<SessionResponse>[];
|
|
492
498
|
nextCursor: string | null;
|
|
493
499
|
total: number;
|
|
494
500
|
}
|
|
@@ -1392,11 +1398,21 @@ declare class SessionStore {
|
|
|
1392
1398
|
initAgentSession(sessionId: string, dedupeCapacity: number): void;
|
|
1393
1399
|
updateManaged(sessionId: string, updates: Partial<ManagedSession>): ManagedSession | null;
|
|
1394
1400
|
removeManaged(sessionId: string): boolean;
|
|
1401
|
+
/**
|
|
1402
|
+
* The **live** stored record — mutating it mutates the store. Paired with
|
|
1403
|
+
* `get()`, which hands back a throwaway response copy. Prefer
|
|
1404
|
+
* `updateManaged()` for writes; this is for readers that need the internal
|
|
1405
|
+
* shape (Date fields, `rehydrated`, …) rather than the wire shape.
|
|
1406
|
+
*/
|
|
1395
1407
|
getManaged(sessionId: string): ManagedSession | null;
|
|
1396
1408
|
setDiscovered(processes: DiscoveredProcess[]): void;
|
|
1409
|
+
/**
|
|
1410
|
+
* The **live** stored records — mutating an element mutates the store. Paired
|
|
1411
|
+
* with `list()`, which hands back throwaway response copies.
|
|
1412
|
+
*/
|
|
1397
1413
|
listManaged(): ManagedSession[];
|
|
1398
|
-
list(ptyAttachedIds: Set<string>): SessionResponse[];
|
|
1399
|
-
get(sessionId: string, ptyAttachedIds: Set<string>): SessionResponse | null;
|
|
1414
|
+
list(ptyAttachedIds: Set<string>): readonly Readonly<SessionResponse>[];
|
|
1415
|
+
get(sessionId: string, ptyAttachedIds: Set<string>): Readonly<SessionResponse> | null;
|
|
1400
1416
|
paginate(ptyAttachedIds: Set<string>, query: SessionListQuery): SessionListPage;
|
|
1401
1417
|
}
|
|
1402
1418
|
|
|
@@ -1450,9 +1466,30 @@ declare class RuntimeStore {
|
|
|
1450
1466
|
close(): void;
|
|
1451
1467
|
}
|
|
1452
1468
|
|
|
1469
|
+
interface HostHeartbeatState {
|
|
1470
|
+
registryState: "known" | "unknown";
|
|
1471
|
+
referencedSessionIds: string[];
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* A duplex line channel. Deliberately not a socket: the runner is tested
|
|
1475
|
+
* against an in-memory pair, and PR 7 supplies the real one over a unix socket
|
|
1476
|
+
* (POSIX) or named pipe (Windows).
|
|
1477
|
+
*/
|
|
1478
|
+
interface HostTransport {
|
|
1479
|
+
send(line: string): void;
|
|
1480
|
+
onLine(handler: (line: string) => void): void;
|
|
1481
|
+
onClose(handler: () => void): void;
|
|
1482
|
+
close(): void;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1453
1485
|
declare class LiveSessionManager {
|
|
1454
1486
|
private runners;
|
|
1487
|
+
private remoteRunner;
|
|
1488
|
+
private options;
|
|
1455
1489
|
constructor(options?: PTYManagerOptions);
|
|
1490
|
+
useRemoteRunner(transport: HostTransport): Promise<ManagedSession[]>;
|
|
1491
|
+
isRemote(): boolean;
|
|
1492
|
+
startRemoteHeartbeat(getState: () => HostHeartbeatState): void;
|
|
1456
1493
|
start(sessionId: string, options: StartSessionOptions & {
|
|
1457
1494
|
provider?: ProviderName;
|
|
1458
1495
|
}): Promise<ManagedSession>;
|
|
@@ -1474,6 +1511,7 @@ declare class LiveSessionManager {
|
|
|
1474
1511
|
dispose(): void;
|
|
1475
1512
|
private runnerFor;
|
|
1476
1513
|
private assertSupportedProvider;
|
|
1514
|
+
private activeRunners;
|
|
1477
1515
|
}
|
|
1478
1516
|
|
|
1479
1517
|
declare class WSHub {
|
|
@@ -1815,6 +1853,7 @@ declare class StreamerServer {
|
|
|
1815
1853
|
private dbInstanceId;
|
|
1816
1854
|
private disableDb;
|
|
1817
1855
|
private skipStartupWarmup;
|
|
1856
|
+
private autoResumeOnBoot;
|
|
1818
1857
|
private browseRoot;
|
|
1819
1858
|
private publicUrl;
|
|
1820
1859
|
private browserCors;
|
|
@@ -1881,6 +1920,7 @@ declare class StreamerServer {
|
|
|
1881
1920
|
* a full broadcast if no match exists (old clients, or no WS registered yet).
|
|
1882
1921
|
*/
|
|
1883
1922
|
private broadcastOrUnicastSessionList;
|
|
1923
|
+
private sessionListPayload;
|
|
1884
1924
|
/**
|
|
1885
1925
|
* Overlay boot-reconciliation verdicts onto session responses.
|
|
1886
1926
|
*
|
|
@@ -1944,6 +1984,8 @@ declare class StreamerServer {
|
|
|
1944
1984
|
* by id rather than duplicating it.
|
|
1945
1985
|
*/
|
|
1946
1986
|
private rehydratePreviousSessions;
|
|
1987
|
+
/** Resume only the recent sessions the user explicitly allowed us to start at boot. */
|
|
1988
|
+
private autoResumePreviousSessions;
|
|
1947
1989
|
/**
|
|
1948
1990
|
* Pick a token guaranteed to appear in the spawned process's argv, for the
|
|
1949
1991
|
* reconciler's pid-reuse guard.
|
|
@@ -1956,6 +1998,8 @@ declare class StreamerServer {
|
|
|
1956
1998
|
* it is set once that rollout has been discovered.
|
|
1957
1999
|
*/
|
|
1958
2000
|
private spawnArgvToken;
|
|
2001
|
+
/** Restore registry-only metadata after the host mirror has been adopted. */
|
|
2002
|
+
private refreshHostedSessionsFromRegistry;
|
|
1959
2003
|
/**
|
|
1960
2004
|
* Mirror a freshly-spawned session into the durable registry (C1 Phase 2).
|
|
1961
2005
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -192,6 +192,11 @@ interface ManagedSession {
|
|
|
192
192
|
* Cleared implicitly when a resume overwrites the stub with a real session.
|
|
193
193
|
*/
|
|
194
194
|
rehydrated?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* This live session was re-adopted from the pty-host during boot rather than
|
|
197
|
+
* spawned by this streamer process. Internal lifecycle provenance only.
|
|
198
|
+
*/
|
|
199
|
+
reconciled?: boolean;
|
|
195
200
|
/**
|
|
196
201
|
* What this session was doing when the streamer stopped it, for a stub whose
|
|
197
202
|
* `status` had to flatten to `idle`. Only ever set from a registry row whose
|
|
@@ -276,7 +281,7 @@ type WSMessage = {
|
|
|
276
281
|
reworkAttempt?: number;
|
|
277
282
|
} | {
|
|
278
283
|
type: "session_list";
|
|
279
|
-
sessions: SessionResponse[];
|
|
284
|
+
sessions: readonly SessionResponse[];
|
|
280
285
|
} | {
|
|
281
286
|
type: "conversation_event";
|
|
282
287
|
sessionId: string;
|
|
@@ -488,7 +493,8 @@ interface ConversationListResponse {
|
|
|
488
493
|
type SessionSortKey = "startedAt" | "lastActivityAt" | "projectName" | "status";
|
|
489
494
|
type SortOrder = "asc" | "desc";
|
|
490
495
|
interface SessionListPage {
|
|
491
|
-
|
|
496
|
+
/** Response copies, like `SessionStore.list()` — see the note there. */
|
|
497
|
+
sessions: readonly Readonly<SessionResponse>[];
|
|
492
498
|
nextCursor: string | null;
|
|
493
499
|
total: number;
|
|
494
500
|
}
|
|
@@ -1392,11 +1398,21 @@ declare class SessionStore {
|
|
|
1392
1398
|
initAgentSession(sessionId: string, dedupeCapacity: number): void;
|
|
1393
1399
|
updateManaged(sessionId: string, updates: Partial<ManagedSession>): ManagedSession | null;
|
|
1394
1400
|
removeManaged(sessionId: string): boolean;
|
|
1401
|
+
/**
|
|
1402
|
+
* The **live** stored record — mutating it mutates the store. Paired with
|
|
1403
|
+
* `get()`, which hands back a throwaway response copy. Prefer
|
|
1404
|
+
* `updateManaged()` for writes; this is for readers that need the internal
|
|
1405
|
+
* shape (Date fields, `rehydrated`, …) rather than the wire shape.
|
|
1406
|
+
*/
|
|
1395
1407
|
getManaged(sessionId: string): ManagedSession | null;
|
|
1396
1408
|
setDiscovered(processes: DiscoveredProcess[]): void;
|
|
1409
|
+
/**
|
|
1410
|
+
* The **live** stored records — mutating an element mutates the store. Paired
|
|
1411
|
+
* with `list()`, which hands back throwaway response copies.
|
|
1412
|
+
*/
|
|
1397
1413
|
listManaged(): ManagedSession[];
|
|
1398
|
-
list(ptyAttachedIds: Set<string>): SessionResponse[];
|
|
1399
|
-
get(sessionId: string, ptyAttachedIds: Set<string>): SessionResponse | null;
|
|
1414
|
+
list(ptyAttachedIds: Set<string>): readonly Readonly<SessionResponse>[];
|
|
1415
|
+
get(sessionId: string, ptyAttachedIds: Set<string>): Readonly<SessionResponse> | null;
|
|
1400
1416
|
paginate(ptyAttachedIds: Set<string>, query: SessionListQuery): SessionListPage;
|
|
1401
1417
|
}
|
|
1402
1418
|
|
|
@@ -1450,9 +1466,30 @@ declare class RuntimeStore {
|
|
|
1450
1466
|
close(): void;
|
|
1451
1467
|
}
|
|
1452
1468
|
|
|
1469
|
+
interface HostHeartbeatState {
|
|
1470
|
+
registryState: "known" | "unknown";
|
|
1471
|
+
referencedSessionIds: string[];
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* A duplex line channel. Deliberately not a socket: the runner is tested
|
|
1475
|
+
* against an in-memory pair, and PR 7 supplies the real one over a unix socket
|
|
1476
|
+
* (POSIX) or named pipe (Windows).
|
|
1477
|
+
*/
|
|
1478
|
+
interface HostTransport {
|
|
1479
|
+
send(line: string): void;
|
|
1480
|
+
onLine(handler: (line: string) => void): void;
|
|
1481
|
+
onClose(handler: () => void): void;
|
|
1482
|
+
close(): void;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1453
1485
|
declare class LiveSessionManager {
|
|
1454
1486
|
private runners;
|
|
1487
|
+
private remoteRunner;
|
|
1488
|
+
private options;
|
|
1455
1489
|
constructor(options?: PTYManagerOptions);
|
|
1490
|
+
useRemoteRunner(transport: HostTransport): Promise<ManagedSession[]>;
|
|
1491
|
+
isRemote(): boolean;
|
|
1492
|
+
startRemoteHeartbeat(getState: () => HostHeartbeatState): void;
|
|
1456
1493
|
start(sessionId: string, options: StartSessionOptions & {
|
|
1457
1494
|
provider?: ProviderName;
|
|
1458
1495
|
}): Promise<ManagedSession>;
|
|
@@ -1474,6 +1511,7 @@ declare class LiveSessionManager {
|
|
|
1474
1511
|
dispose(): void;
|
|
1475
1512
|
private runnerFor;
|
|
1476
1513
|
private assertSupportedProvider;
|
|
1514
|
+
private activeRunners;
|
|
1477
1515
|
}
|
|
1478
1516
|
|
|
1479
1517
|
declare class WSHub {
|
|
@@ -1815,6 +1853,7 @@ declare class StreamerServer {
|
|
|
1815
1853
|
private dbInstanceId;
|
|
1816
1854
|
private disableDb;
|
|
1817
1855
|
private skipStartupWarmup;
|
|
1856
|
+
private autoResumeOnBoot;
|
|
1818
1857
|
private browseRoot;
|
|
1819
1858
|
private publicUrl;
|
|
1820
1859
|
private browserCors;
|
|
@@ -1881,6 +1920,7 @@ declare class StreamerServer {
|
|
|
1881
1920
|
* a full broadcast if no match exists (old clients, or no WS registered yet).
|
|
1882
1921
|
*/
|
|
1883
1922
|
private broadcastOrUnicastSessionList;
|
|
1923
|
+
private sessionListPayload;
|
|
1884
1924
|
/**
|
|
1885
1925
|
* Overlay boot-reconciliation verdicts onto session responses.
|
|
1886
1926
|
*
|
|
@@ -1944,6 +1984,8 @@ declare class StreamerServer {
|
|
|
1944
1984
|
* by id rather than duplicating it.
|
|
1945
1985
|
*/
|
|
1946
1986
|
private rehydratePreviousSessions;
|
|
1987
|
+
/** Resume only the recent sessions the user explicitly allowed us to start at boot. */
|
|
1988
|
+
private autoResumePreviousSessions;
|
|
1947
1989
|
/**
|
|
1948
1990
|
* Pick a token guaranteed to appear in the spawned process's argv, for the
|
|
1949
1991
|
* reconciler's pid-reuse guard.
|
|
@@ -1956,6 +1998,8 @@ declare class StreamerServer {
|
|
|
1956
1998
|
* it is set once that rollout has been discovered.
|
|
1957
1999
|
*/
|
|
1958
2000
|
private spawnArgvToken;
|
|
2001
|
+
/** Restore registry-only metadata after the host mirror has been adopted. */
|
|
2002
|
+
private refreshHostedSessionsFromRegistry;
|
|
1959
2003
|
/**
|
|
1960
2004
|
* Mirror a freshly-spawned session into the durable registry (C1 Phase 2).
|
|
1961
2005
|
*
|