import type { FailureRecoverability, FailureScope, ThreadEvidenceRecord, ThreadMode, ToolFailureKind, ToolInputValue, Turn } from "@best-agent/protocol";
import type { AgentProfile } from "../agent/profile-registry.js";
import type { PromptPlan } from "../prompt/compiler.js";
export interface AgentLoopProviderTurnOptions {
    phaseInstruction?: string;
    phaseName?: "change" | "inspect" | "plan" | "summarize" | "verify" | "wait";
    toolSelection?: "disabled" | "enabled";
}
export interface AgentLoopCompactionResult {
    budgetTokens?: number;
    didCompact: boolean;
    estimatedTokensAfter: number;
    estimatedTokensBefore: number;
}
export interface AgentLoopCompactionAdvisory {
    autoBudgetOutcome?: string;
    budgetKnown: boolean;
    currentTokenUsage?: number;
    estimatedInputTokens?: number;
    inputBudgetTokens?: number;
    plannedCostEstimate: number;
    projectedTokenUsage?: number;
    reason: string;
    remainingInputTokens?: number;
    shouldCompact: boolean;
    timing: "before-expensive-operation" | "none";
}
export interface AgentLoopContext {
    activeSkillIds: string[];
    compactIfNeeded(): Promise<AgentLoopCompactionResult>;
    executeAdvancedPhaseTurn(): Promise<string>;
    executeProviderTurn(options?: AgentLoopProviderTurnOptions): Promise<string>;
    executeTool(toolName: string, input: ToolInputValue, reasoning?: string): Promise<string>;
    failWithClassification(failureKind: ToolFailureKind, recoverability: FailureRecoverability, message: string, scope?: FailureScope): never;
    hostProfile: AgentProfile;
    /**
     * Returns true when the latest request-budget snapshot indicates low input headroom.
     * Custom loops can call this before large tool invocations to compact preemptively.
     */
    isCompactionAdvisable(): boolean;
    getCompactionAdvisory(plannedCostEstimate?: number): AgentLoopCompactionAdvisory;
    plan: PromptPlan;
    profile: AgentProfile;
    recordEvidence(records: ThreadEvidenceRecord[]): Promise<void>;
    threadMode: ThreadMode;
    turn: Turn;
}
export interface AgentLoop {
    execute(context: AgentLoopContext): Promise<string>;
}
//# sourceMappingURL=agent-loop.d.ts.map