import type { ModelMessage } from 'ai';
import type { AgentRun } from './agent-run';
import type { Tool } from './define-tool';
import type { StopOptions } from './hooks';
import { type AgentLayerToolOutput } from './messages';
import type { AgentState } from './state';
export interface ToolCallRef {
    toolCallId: string;
    toolName: string;
    input: unknown;
}
export interface ExecuteToolCallContext {
    tools: Record<string, Tool<any, any>>;
    messages: ReadonlyArray<ModelMessage>;
    signal: AbortSignal;
    /** Current tool state map, keyed by each stateful tool's stateKey. */
    toolState?: Record<string, unknown>;
    /** Parent's sub-agent states — used by getSubAgentState on ToolContext. */
    subAgents?: Record<string, AgentState>;
    /** The parent AgentRun — used for wiring awaitSubAgent (event forwarding + activeChildren). */
    agentRun?: AgentRun;
    /** Returns the current estimated context window tokens. */
    getContextWindowTokens?: () => number;
    /** Returns the context window token limit for the current model. */
    getContextWindowLimit?: () => number | undefined;
}
export interface ToolCallResult {
    toolCallId: string;
    toolName: string;
    message: ModelMessage;
    output: AgentLayerToolOutput;
    /** The raw, unserialised TOutput value returned by the tool. */
    rawOutput: unknown;
    isError: boolean;
    pendingUpdates: Array<(messages: ModelMessage[]) => ModelMessage[]>;
    /** Set when the tool called ctx.stop() — controls loop stop behaviour. */
    stopRequested?: StopOptions;
    /** Set when a stateful tool called ctx.updateToolState() during execution. */
    toolStateUpdate?: {
        key: string;
        value: unknown;
    };
    /** Set when the tool returned a SubAgentPauseResult — the child agent needs approval. */
    subAgentPause?: {
        agentId: string;
        childState: AgentState;
    };
}
/**
 * Execute a single tool call and return the result message.
 *
 * Tools are resolved from the provided context, making it easy to
 * swap or filter the available tool set per-call.
 */
export declare function executeToolCall(tc: ToolCallRef, ctx: ExecuteToolCallContext): Promise<ToolCallResult>;
//# sourceMappingURL=execute-tool-call.d.ts.map