import type { TurnMiddleware } from "./turn-middleware.js";
/**
 * Result of a transcript append operation. Mirrors the production
 * `TranscriptAppendResult` shape from chat.ts so adapters can return it
 * verbatim.
 */
export type TranscriptAppendResult = {
    ok: true;
} | {
    ok: false;
    error?: string;
};
export interface TranscriptAppender {
    /**
     * Append the assistant message to the transcript. Implementation
     * decides path resolution, idempotency, and file locking. Errors are
     * returned in the result rather than thrown so the middleware can
     * surface them via `onAppendFailed` without disrupting the turn.
     */
    (info: {
        sessionId: string;
        sessionKey?: string;
        text: string;
        runId?: string;
        /** Optional idempotency key to dedupe repeat appends (e.g. on retries). */
        idempotencyKey?: string;
    }): Promise<TranscriptAppendResult> | TranscriptAppendResult;
}
export interface WithTranscriptUpdateOptions {
    /** The appender — production wraps the gateway's appendAssistantTranscriptMessage. */
    appender: TranscriptAppender;
    /**
     * Optional notification for append failures. Production logs via the
     * gateway's logGateway; this lets callers wire their own logger.
     */
    onAppendFailed?: (info: {
        error: string;
        runId?: string;
    }) => void;
}
/**
 * Returns a TurnMiddleware that appends the AgentTurnResult.text to the
 * session transcript after the inner runner completes.
 *
 * Skip conditions:
 *   - outbound.action === "drop" (NO_REPLY — no message)
 *   - empty / whitespace-only text
 *
 * The middleware does NOT mutate the turn result — the append is a
 * post-turn side effect. The result is returned unchanged regardless of
 * append success/failure.
 */
export declare function withTranscriptUpdate(opts: WithTranscriptUpdateOptions): TurnMiddleware;
