/** * Live-tail external Claude / Codex native session files. * * The daemon already knows how to read a native JSONL file once * (`readHistoryForNativeSession`) and already knows how to stream its own * daemon-spawned session output (`outputStore.ts` + bridge `subscribe`). * * This module fills the gap in the middle: a session that is being driven by * an external `claude` / `codex` process in a separate terminal, where we * need to push new JSONL lines to the webview as they are appended. * * Subscribers get two kinds of events: * - On first subscribe, the full current file content is replayed (so the * webview has the same state as a one-shot `session.history` fetch). * - Every newly appended line is pushed as it's detected (`fs.watch` with a * polling fallback, same pattern as `outputStore.ts`). * * Each emitted event is wrapped in the daemon's standard output-line * envelope `{"t":"o","line":}` so the existing webview * stream parser (`parseOutputLine` in apps/g2/src/domain/output-parser.ts) * handles them alongside daemon-sourced output. */ export type NativeTool = "claude" | "codex" | "gemini"; export interface NativeLiveSubscription { tool: NativeTool; resumeId: string; cwd?: string; } type Listener = (line: string) => void; export declare function subscribeNativeLive(input: NativeLiveSubscription, onLine: Listener): () => void; /** * Parse a bridge-subscribed sessionId like "claude:abc123" into the pieces the * live watcher needs. Returns null if the id is not a native-session id. */ export declare function parseNativeSessionId(sessionId: string): { tool: NativeTool; resumeId: string; } | null; export {};