/**
 * Cursor request admission: what the transport is allowed to send in one turn.
 *
 * Cursor rebuilds the whole conversation on every hop and rejects large
 * verbatim tool payloads, so a turn is bounded twice - each tool result is
 * capped on its own, and the aggregate model input is held under the model's
 * context window. Admission NEVER deletes a turn (senpi#1603): dropping the
 * oldest turns to reach a byte cap silently amputated the conversation, and a
 * history that still exceeds the budget after blanking is admitted as-is so the
 * existing Cursor overflow path (a 0-token `resource_exhausted` surfaced to the
 * session layer) compacts it with the session's own policy.
 */
import type { AgentMessage } from "@earendil-works/pi-agent-core";
import type { Message } from "@earendil-works/pi-ai/compat";
/** Cursor ingest rejects large verbatim tool payloads. The bound is graphemes. */
export declare const CURSOR_TOOL_RESULT_MAX_CHARS = 2000;
/** Aggregate admission budget for a model whose window is `contextWindowTokens`. */
export declare function cursorAdmissionBudgetBytes(contextWindowTokens: number): number;
export type CursorAdmissionRequest = {
    readonly messages: AgentMessage[] | undefined;
    /** Serialized model-input bytes this turn may occupy. */
    readonly budgetBytes: number;
    readonly maxChars?: number;
    readonly convert?: (candidate: AgentMessage[]) => Message[];
};
export type CursorAdmissionResult = {
    readonly messages: AgentMessage[] | undefined;
    readonly changed: boolean;
    readonly blankedToolResults: number;
    readonly bytesBefore: number;
    readonly bytesAfter: number;
    /** True when the history still exceeds the budget; the request is still sent. */
    readonly overBudget: boolean;
};
/**
 * Bounds one Cursor request: per-result caps first, then blanking the oldest
 * tool result bodies while the model input exceeds `budgetBytes`. Conversation
 * turns are never removed.
 */
export declare function admitCursorHistory(request: CursorAdmissionRequest): CursorAdmissionResult;
/**
 * Positional entry point kept for existing callers. An omitted `maxBytes`
 * applies the per-result cap only; the aggregate budget belongs to the caller
 * that knows the model window.
 */
export declare function truncateToolResultBodies(messages: AgentMessage[] | undefined, maxChars?: number, maxBytes?: number, convert?: (candidate: AgentMessage[]) => Message[]): {
    messages: AgentMessage[] | undefined;
    changed: boolean;
};
//# sourceMappingURL=cursor-history-admission.d.ts.map