import type { HookRegistry } from "../../contracts/hooks.js";
import type { OpenAiToolCall } from "./tool-call-contracts.js";
import type { AgentLogger, ToolDefinition, ToolInvoker } from "./agent-execution-contracts.js";
export interface RecallCategoryHint {
    preferred: string[];
    deprioritized: string[];
}
export interface RuntimeCompressibleMessage {
    role: string;
    content?: string | unknown;
}
export interface RuntimeCompressionResult {
    messages: RuntimeCompressibleMessage[];
    droppedCount: number;
    tokensFreed?: number;
    strategy: string;
}
export interface ToolExecutionResultPort {
    callId: string;
    toolName: string;
    ok: boolean;
    error?: string;
    blocked?: boolean;
    blockReason?: string;
    durationMs?: number;
    details?: Record<string, unknown>;
    message: unknown;
}
export interface StreamingToolExecutorPort {
    addTool(toolCall: OpenAiToolCall): void;
    getRemainingResults(): AsyncIterable<ToolExecutionResultPort>;
}
export interface StreamingToolExecutorPortConfig {
    toolInvoker: ToolInvoker;
    hooks?: HookRegistry;
    sessionId: string;
    turnId: string;
    log: AgentLogger;
    signal?: AbortSignal;
    maxConcurrentTools?: number;
    maxExecutionMs?: number;
}
export interface ContextCompressionEnginePort {
    compressAsync(messages: RuntimeCompressibleMessage[], budget: number, context: {
        model: string;
        sessionId: string;
    }): Promise<RuntimeCompressionResult>;
}
export interface ToolLoopRuntimePorts {
    createContentReplacementState(): unknown;
    enforceToolResultBudget(messages: Array<{
        role: string;
        content?: string | unknown;
        tool_call_id?: string;
    }>, state: unknown, sessionId: string): Promise<{
        messages: unknown[];
        newlyReplacedCount: number;
    }>;
    getActiveContextCompressionEngine(): ContextCompressionEnginePort | null;
    compressMessages(messages: RuntimeCompressibleMessage[], options: {
        budget: number;
        model: string;
    }): RuntimeCompressionResult;
    getBudgetContinuationMessage(usagePct: number, totalUsed: number, tokenBudget: number): string;
    createStreamingToolExecutor(config: StreamingToolExecutorPortConfig): StreamingToolExecutorPort;
    resolveToolEligibility(tools: ToolDefinition[], context: unknown): {
        eligibleTools: ToolDefinition[];
        blockedTools: Array<{
            toolName: string;
        }>;
    };
}
export interface AgentRuntimePorts {
    toolLoop: ToolLoopRuntimePorts;
    detectRecallCategories(query: string): RecallCategoryHint;
    resolveModelForPurpose(purpose: "smallModel" | string): string | null;
}
