import type { getOrCreateSessionMeta } from "../../features/magic-context/storage";
import { type ModuleCompartmentMirrorResponse, type ModuleStateSyncClient, type ModuleStateSyncState } from "./module-state-sync";
import type { RawMessageOrdinalAnchor } from "./read-session-raw";
import type { TransformDeps } from "./transform";
import type { MessageLike } from "./transform-operations";
export interface RustModeModuleClient extends ModuleStateSyncClient {
    closeSession?(sessionId: string): void;
    getCompartmentsAfter?(sessionId: string, afterSequence: number): Promise<ModuleCompartmentMirrorResponse>;
}
interface RustSessionState extends ModuleStateSyncState {
    initialized: boolean;
    consecutiveFailures: number;
    passCount: number;
    parked: boolean;
    passesSincePark: number;
    warningSent: boolean;
    ordinalMemoAnchor: RawMessageOrdinalAnchor | null;
    ordinalMemoStoredCount: number | null;
    ordinalMemoCanonicalCount: number;
    failureCount: number;
    parkCount: number;
    syntheticTurnCount: number;
    lastObservedUserMessageId: string | null;
    syntheticLoopBreakerLogged: boolean;
}
export interface RustModeTransformOptions {
    moduleClient: RustModeModuleClient;
    hostClient?: unknown;
    projectRoot?: string;
    notifyParked?: (sessionId: string, message: string) => void;
    moduleTimeoutMs?: number;
    memorySyncRequestedSessions?: Set<string>;
}
declare function directiveTextOf(response: Record<string, unknown>): string | undefined;
/** Single response-field seam for the parallel module encode-back contract. */
export declare function applyNativeMessagesVerbatim(output: {
    messages: unknown[];
}, response: Record<string, unknown>): unknown[];
declare function buildTransformBody(args: {
    sessionId: string;
    input: unknown[];
    nativeMessages: unknown[];
    passInputs: Record<string, unknown>;
    usage: Record<string, number>;
    modelKey: string | null;
    providerId: string | null;
    midTurn: boolean;
    declaredTrim?: unknown;
}): Record<string, unknown>;
export declare function createRustModeTransform(deps: TransformDeps, options: RustModeTransformOptions): {
    run: (sessionId: string, messages: MessageLike[], output: {
        messages: unknown[];
    }, sessionMeta: ReturnType<typeof getOrCreateSessionMeta>) => Promise<void>;
    clearSession: (sessionId: string) => void;
    getState: (sessionId: string) => Readonly<RustSessionState>;
};
export declare function runRustModeTransform(transform: ReturnType<typeof createRustModeTransform>, sessionId: string, messages: MessageLike[], output: {
    messages: unknown[];
}, sessionMeta: ReturnType<typeof getOrCreateSessionMeta>): Promise<void>;
export declare const __rustModeTransformTest: {
    applyNativeMessagesVerbatim: typeof applyNativeMessagesVerbatim;
    buildTransformBody: typeof buildTransformBody;
    createRustModeTransform: typeof createRustModeTransform;
    directiveTextOf: typeof directiveTextOf;
};
export {};
//# sourceMappingURL=rust-mode-transform.d.ts.map