/** A minimal live hook event in the unified schema pixel-office consumes. */ export interface LiveHookEvent { hook_event_name: string; event_type: string; provider: string; cwd: string; message: string; title: string; tool_name: string; timestamp: string; [k: string]: unknown; } /** * Build a `Notification` hook event carrying a chunk of streamed assistant text. * event_type is resolved through the shared map (→ 'notification') so downstream * consumers never have to re-derive it per provider. */ export declare function buildNotificationEvent(provider: string, root: string, message: string): LiveHookEvent; /** * Append a live hook event to `/.autodev/hooks-events.jsonl` — the same * sink grok and the SDK providers use and the task-loop's WS poller tails. This * is the default emit sink for {@link LiveNarrationStreamer}; tests inject their * own emit callback instead. */ export declare function appendHookEventLine(root: string, ev: LiveHookEvent): void; /** Remove ANSI escape codes and carriage returns from a chunk of terminal output. */ export declare function stripAnsi(s: string): string; export interface LiveNarrationOptions { /** Flush as soon as the buffer reaches this many chars (default 400). */ flushChars?: number; /** Otherwise flush this many ms after the last push (default 1200). */ flushMs?: number; /** Cap an emitted message at this length, adding an ellipsis (default 280). */ previewLen?: number; } /** * Coalesces a stream of assistant-text chunks and emits periodic `Notification` * hook events — frequently enough to feel live, coarsely enough to avoid one * event per token. Emits when the buffer grows past `flushChars`, or `flushMs` * after the latest chunk, whichever comes first. Call {@link flush} at the turn * boundary to push the trailing text, or {@link dispose} to drop it on abort. */ export declare class LiveNarrationStreamer { private readonly provider; private readonly root; private readonly emit; private _buf; private _timer; private readonly _flushChars; private readonly _flushMs; private readonly _previewLen; private _chunks; private _bytes; private readonly _decoder; private _pending; private _splits; constructor(provider: string, root: string, emit: (ev: LiveHookEvent) => void, opts?: LiveNarrationOptions); /** * Feed newly-produced assistant text. Accepts an already-decoded `string` * (the normal path — pushed verbatim) OR raw bytes (`Buffer`/`Uint8Array`), * which are run through a `StringDecoder` so a UTF-8 code point split across * chunk boundaries is buffered instead of emitted as mojibake. Emits when the * coalesced buffer grows past `flushChars`. */ push(input: string | Uint8Array): void; /** Emit whatever is buffered now (call at turn end). No-op when empty/whitespace. */ flush(): void; /** Drop buffered text and clear the timer WITHOUT emitting (call on abort/close). */ dispose(): void; }