import type { AgentToolConfig } from '@contractspec/lib.contracts-spec/agent';
import type { ToolExecutionContext, ToolHandler } from '../../types';
import type { ExternalToolDefinition } from '../types';
/**
 * OpenCode SDK tool definition.
 */
export interface OpenCodeTool {
    /** Tool name */
    name: string;
    /** Tool description */
    description: string;
    /** Input parameters schema */
    parameters: {
        type: 'object';
        properties?: Record<string, OpenCodeParameter>;
        required?: string[];
    };
    /** Tool category */
    category?: string;
    /** Permission level */
    permission?: 'allow' | 'ask' | 'deny';
}
/**
 * OpenCode parameter definition.
 */
export interface OpenCodeParameter {
    type: string;
    description?: string;
    enum?: string[];
    default?: unknown;
}
/**
 * OpenCode tool call from session.
 */
export interface OpenCodeToolCall {
    id: string;
    name: string;
    arguments: Record<string, unknown>;
}
/**
 * OpenCode tool result.
 */
export interface OpenCodeToolResult {
    tool_call_id: string;
    output: string;
    is_error?: boolean;
}
/**
 * Convert a ContractSpec AgentToolConfig to OpenCode tool format.
 */
export declare function specToolToOpenCodeTool(tool: AgentToolConfig): OpenCodeTool;
/**
 * Convert multiple ContractSpec tools to OpenCode format.
 */
export declare function specToolsToOpenCodeTools(tools: AgentToolConfig[]): OpenCodeTool[];
/**
 * Convert an OpenCode tool to ContractSpec AgentToolConfig.
 */
export declare function openCodeToolToSpecTool(openCodeTool: OpenCodeTool): AgentToolConfig;
/**
 * Convert multiple OpenCode tools to ContractSpec format.
 */
export declare function openCodeToolsToSpecTools(openCodeTools: OpenCodeTool[]): AgentToolConfig[];
/**
 * Convert ContractSpec tool to ExternalToolDefinition format for OpenCode.
 */
export declare function specToolToExternalToolForOpenCode(tool: AgentToolConfig, handler?: ToolHandler, context?: Partial<ToolExecutionContext>): ExternalToolDefinition;
/**
 * Create a tool handler map from ExternalToolSet.
 */
export declare function createToolHandlerMap(tools: Record<string, ExternalToolDefinition>): Map<string, (input: unknown) => Promise<unknown>>;
/**
 * Execute a tool call and format the result.
 */
export declare function executeToolCall(toolCall: OpenCodeToolCall, handlers: Map<string, (input: unknown) => Promise<unknown>>): Promise<OpenCodeToolResult>;
