import type { AssistantMessage } from "@bastani/pi-ai/compat"; import type { AgentSessionInternalSurface as AgentSession, AutoCompactionRunOutcome } from "./agent-session-methods.ts"; import { type CompactionUrgency } from "./compaction/index.ts"; /** * Upper bound on direct continuations after a response reaches its requested * output cap. Context-limited truncations use one compact-and-retry attempt * instead; this bound preserves Atomic's separate output-cap continuation. */ export declare const MAX_LENGTH_CONTINUATION_ATTEMPTS = 3; export declare const MAX_OUTPUT_BUDGET_ERROR_CONTINUATION_ATTEMPTS = 1; /** Create the settlement boundary for a regular automatic compaction run. */ export declare function createAutoCompactionCompletion(): { promise: Promise; resolve: () => void; }; export declare function _checkCompaction(this: AgentSession, assistantMessage: AssistantMessage, skipAbortedCheck?: boolean): Promise; export declare function isRetryWorthyLengthStop(assistantMessage: AssistantMessage): boolean; export declare function isOutputCappedLengthStop(assistantMessage: AssistantMessage, desiredMaxOutput: number): boolean; export declare function isRetryWorthyOutputBudgetError(assistantMessage: AssistantMessage): boolean; export declare function shouldRetryAfterThresholdCompaction(assistantMessage: AssistantMessage, desiredMaxOutput: number, isLiveTurnCompletion: boolean): boolean; /** * Internal: remove an incomplete assistant from retry context before auto-continuing after compaction. */ export declare function _dropTrailingAutoCompactionRetryAssistantIfPresent(this: AgentSession): Promise; /** * Internal: schedule a live post-event continuation after compaction_end listeners can flush queues. * The grace period preserves listener ordering. Queue-only probes wait for transient work to become * idle, while retry probes remain tied to the turn that scheduled them and are abandoned if another * turn owns the agent when the grace period ends. */ export declare function _schedulePostAutoCompactionContinuationProbe(this: AgentSession, _reason: "overflow" | "threshold", willRetry: boolean): void; export declare function _awaitPendingPostCompactionContinuation(this: AgentSession): Promise; /** * Internal: resume generation after successful auto-compaction only when active work remains. */ export declare function _resumeAfterAutoCompaction(this: AgentSession): Promise; /** * Internal: resume a response that reached its requested output cap when the * context does not warrant compaction. Bounded so a model that repeatedly * stops at that cap can still terminate. */ export declare function _resumeAfterLengthTruncation(this: AgentSession): void; export declare function hasPendingManualCompactionTakeover(this: AgentSession): boolean; export declare function _runAutoCompaction(this: AgentSession, reason: "overflow" | "threshold", willRetry: boolean, urgency?: CompactionUrgency): Promise; /** * Toggle auto-compaction setting. */ export declare const agentSessionAutoCompactionMethods: { _awaitPendingPostCompactionContinuation: typeof _awaitPendingPostCompactionContinuation; _checkCompaction: typeof _checkCompaction; _dropTrailingAutoCompactionRetryAssistantIfPresent: typeof _dropTrailingAutoCompactionRetryAssistantIfPresent; _schedulePostAutoCompactionContinuationProbe: typeof _schedulePostAutoCompactionContinuationProbe; _resumeAfterAutoCompaction: typeof _resumeAfterAutoCompaction; _resumeAfterLengthTruncation: typeof _resumeAfterLengthTruncation; _runAutoCompaction: typeof _runAutoCompaction; }; //# sourceMappingURL=agent-session-auto-compaction.d.ts.map