import type { VerboseLevel } from "../auto-reply/thinking.js";
export type KoiEventStream = "lifecycle" | "tool" | "assistant" | "error" | (string & {});
export declare function runWithRunId<T>(runId: string, fn: () => T): T;
export declare function getCurrentRunId(): string | undefined;
export type KoiEventPayload = {
    runId: string;
    seq: number;
    stream: KoiEventStream;
    ts: number;
    data: Record<string, unknown>;
    sessionKey?: string;
};
export type KoiRunContext = {
    sessionKey?: string;
    verboseLevel?: VerboseLevel;
    isHeartbeat?: boolean;
    /**
     * Koi id of the speaker actually answering this run. For
     * single-speaker turns this is the session's koi. For multi-koi
     * broadcast turns this is the specific companion driving this run
     * — the gateway uses it to tag chat-final payloads so the UI can
     * render the right name + avatar per assistant message.
     */
    speakerKoiId?: string;
};
export declare function registerKoiRunContext(runId: string, context: KoiRunContext): void;
export declare function getKoiRunContext(runId: string): KoiRunContext | undefined;
export declare function clearKoiRunContext(runId: string): void;
export declare function resetKoiRunContextForTest(): void;
export declare function emitKoiEvent(event: Omit<KoiEventPayload, "seq" | "ts">): void;
export declare function onKoiEvent(listener: (evt: KoiEventPayload) => void): () => boolean;
