import { type RawMessageOrdinalAnchor } from "./read-session-raw";
import type { MessageLike } from "./transform-operations";
/** The maximum request page size accepted by the module facade. */
export declare const MODULE_PAGE_MAX_BYTES: number;
/** Large individual values are split so one message cannot exceed a page. */
export declare const MODULE_ITEM_CONTINUATION_CHUNK_BYTES: number;
export declare const MODULE_ITEM_CONTINUATION_KEY = "__shadow_item_continuation";
export declare const MODULE_ORDINAL_PAGE_SIZE = 500;
export interface ModuleNormalizationRecord {
    kind: "tag_prefix" | "ctx_search_hint" | "summary_message";
    message_id: string | null;
    part_index: number;
    field: string;
    tag_number?: number;
    removed: string;
}
/**
 * Resolve OpenCode message ids to the absolute ordinals used by the module.
 * The module and shadow lanes must see the same provisional suffix behavior, so
 * this is shared rather than reimplemented by the authority adapter.
 */
export declare function resolveOrdinalsForModule(args: {
    sessionId: string;
    messages: MessageLike[];
    generation: number;
    memoGeneration: number;
    memo: Map<string, number>;
    memoAnchor?: RawMessageOrdinalAnchor | null;
    memoStoredCount?: number | null;
    memoCanonicalCount?: number;
}): Promise<{
    ok: true;
    annotatedInput: unknown[];
    memoGeneration: number;
    memoAnchor: RawMessageOrdinalAnchor | null;
    memoStoredCount: number;
    memoCanonicalCount: number;
    normalizations: ModuleNormalizationRecord[];
} | {
    ok: false;
    reason: "unresolved" | "mismatch";
    messageId?: string;
    messageIndex?: number;
    messageRole?: string;
}>;
/** Flatten the typed builder shape to the module's top-level wire envelope. */
export declare function toFlatModuleWireBody(payload: {
    method: string;
    params: Record<string, unknown>;
}): Record<string, unknown>;
export declare function moduleWireBodyBytes(payload: {
    method: string;
    params: Record<string, unknown>;
}): number;
/**
 * Page a transform request without changing any message value. Continuation
 * markers are understood by the module and are only used when a single item is
 * larger than the normal page envelope.
 */
export declare function buildPagedModuleTransformPayloads(body: Record<string, unknown>): Record<string, unknown>[];
export declare const __moduleWireTest: {
    buildPagedModuleTransformPayloads: typeof buildPagedModuleTransformPayloads;
    encodeOpenCodeMessagesToCk: typeof encodeOpenCodeMessagesToCk;
    moduleWireBodyBytes: typeof moduleWireBodyBytes;
    resolveOrdinalsForModule: typeof resolveOrdinalsForModule;
    toFlatModuleWireBody: typeof toFlatModuleWireBody;
};
export declare function encodeOpenCodeMessagesToCk(messages: unknown[]): Array<{
    mid: string;
    ordinal: number;
    ck: Record<string, unknown>;
}>;
//# sourceMappingURL=module-wire.d.ts.map