import type { AssistantMessage } from "@earendil-works/pi-ai/compat";
import type { AgentSessionInternalSurface as AgentSession } from "./agent-session-methods.ts";
/**
 * Upper bound on consecutive automatic continuations of a response that was
 * truncated at the output-token cap ("length") while the context is still
 * below the compaction budget. Each continuation regenerates the cut-off turn,
 * so a model that insists on emitting more than its per-turn output cap can
 * still terminate instead of looping forever.
 */
export declare const MAX_LENGTH_CONTINUATION_ATTEMPTS = 3;
export declare const MAX_OUTPUT_BUDGET_ERROR_CONTINUATION_ATTEMPTS = 1;
export declare function _checkCompaction(this: AgentSession, assistantMessage: AssistantMessage, skipAbortedCheck?: boolean): Promise<void>;
export declare function _isCopilotServerCapBelowSelectedContextWindow(this: AgentSession, assistantMessage: AssistantMessage): boolean;
export declare function isRetryWorthyLengthStop(assistantMessage: AssistantMessage): boolean;
export declare function isRetryWorthyOutputBudgetError(assistantMessage: AssistantMessage): boolean;
export declare function shouldRetryAfterThresholdCompaction(assistantMessage: AssistantMessage): boolean;
/**
 * Internal: remove an incomplete assistant from retry context before auto-continuing after compaction.
 */
export declare function _dropTrailingAutoCompactionRetryAssistantIfPresent(this: AgentSession): void;
/**
 * Internal: schedule a live post-event continuation probe after compaction_end listeners can flush queues.
 */
export declare function _schedulePostAutoCompactionContinuationProbe(this: AgentSession, _reason: "overflow" | "threshold", willRetry: boolean): void;
export declare function _awaitPendingPostCompactionContinuation(this: AgentSession): Promise<void>;
/**
 * Internal: resume generation after successful auto-compaction only when active work remains.
 */
export declare function _resumeAfterAutoCompaction(this: AgentSession): Promise<void>;
/**
 * Internal: resume a response that was truncated at the output-token cap
 * ("length") when the context does not warrant compaction. The generation is
 * continued directly so the model finishes the work it was cut off from, rather
 * than dead-ending on the truncation. Bounded by MAX_LENGTH_CONTINUATION_ATTEMPTS
 * so a turn that keeps exceeding the per-turn output cap can still terminate.
 */
export declare function _resumeAfterLengthTruncation(this: AgentSession): void;
export declare function _runAutoCompaction(this: AgentSession, reason: "overflow" | "threshold", willRetry: boolean): Promise<void>;
/**
 * Toggle auto-compaction setting.
 */
export declare const agentSessionAutoCompactionMethods: {
    _awaitPendingPostCompactionContinuation: typeof _awaitPendingPostCompactionContinuation;
    _checkCompaction: typeof _checkCompaction;
    _isCopilotServerCapBelowSelectedContextWindow: typeof _isCopilotServerCapBelowSelectedContextWindow;
    _dropTrailingAutoCompactionRetryAssistantIfPresent: typeof _dropTrailingAutoCompactionRetryAssistantIfPresent;
    _schedulePostAutoCompactionContinuationProbe: typeof _schedulePostAutoCompactionContinuationProbe;
    _resumeAfterAutoCompaction: typeof _resumeAfterAutoCompaction;
    _resumeAfterLengthTruncation: typeof _resumeAfterLengthTruncation;
    _runAutoCompaction: typeof _runAutoCompaction;
};
//# sourceMappingURL=agent-session-auto-compaction.d.ts.map