export interface SessionFrame { stream: 'stdout' | 'stderr'; text: string; at: string; } export interface SessionMeta { sessionId: string; agentId: string; projectId?: string; taskId?: string; mode: 'run' | 'chat' | 'build'; model?: string | null; } export declare function sessionsDir(): string; /** Generates a session id (`session_`), shared by spawn/daemon. */ export declare function newSessionId(): string; export declare class SessionStream { readonly sessionId: string; readonly meta: SessionMeta; private readonly startedAtISO; private socket; private lines; private pending; private timer; private ended; private started; constructor(meta: SessionMeta); /** Best-effort connect + emit session:start. Never throws. */ connect(wsBase: string, apiKey: string): void; /** Tees a console line into the stream buffer (batched upstream). */ line(text: string, stream?: 'stdout' | 'stderr'): void; private emitFrame; private flush; /** Flushes and emits session:end (waits briefly for the ack). */ end(exitCode: number | null): Promise; /** Writes the transcript tail to ~/.teamshare/sessions/.json. */ private persist; }