import type { AssistantModelMessage, ModelMessage, SystemModelMessage, ToolModelMessage, ToolResultPart, UserModelMessage } from 'ai';
import type { RunResult } from './agent';
export type AgentLayerToolOutput = string | ToolResultPart['output'];
export declare function isToolResultOutput(value: unknown): value is ToolResultPart['output'];
type ToolCallInput = {
    toolCallId: string;
    toolName: string;
    input: unknown;
};
type ToolResultInput = {
    toolCallId: string;
    toolName: string;
    output: string;
    isError?: boolean;
};
export declare function userMessage(content: UserModelMessage['content']): UserModelMessage;
export declare function systemMessage(content: SystemModelMessage['content']): SystemModelMessage;
export declare function assistantMessage(content: AssistantModelMessage['content']): AssistantModelMessage;
export declare function toolCall(input: ToolCallInput): AssistantModelMessage;
export declare function toolResult(input: ToolResultInput): ToolModelMessage;
/**
 * Build a tool-result ModelMessage from execution output.
 * Internal helper used by the agent loop.
 */
export declare function buildToolResultMessage(toolCallId: string, toolName: string, output: AgentLayerToolOutput, isError: boolean): ModelMessage;
/**
 * Build a tool-result message — public API for use in tests and approval flows.
 *
 * Use this to inject synthetic tool results when resuming a stopped run:
 * - After `toolCalled` stop condition: inject the outcome the agent would have produced
 * - After `approvalRequired`: inject the approved result or a denial message
 *
 * @example
 * ```ts
 * const toolCallId = extractToolCallId(result.messages, 'deploy')
 * const syntheticResult = toolResultMessage(toolCallId, 'deploy', 'Deployment approved.')
 * const result2 = await agent.run({ messages: [...result.messages, syntheticResult] }).result
 * ```
 */
export declare function toolResultMessage(toolCallId: string, toolName: string, output: string, isError?: boolean): ToolModelMessage;
/**
 * Extract the last assistant text message from a run result.
 * Falls back to a summary of the finish reason if no text found.
 *
 * @example
 * ```ts
 * const result = await agent.run({ state: startState([userMessage('hello')]) }).result
 * const text = extractLastAssistantText(result)
 * console.log(text)
 * ```
 */
export declare function extractLastAssistantText(result: RunResult): string;
export {};
//# sourceMappingURL=messages.d.ts.map