import { ChatCompletionTool } from 'openai/resources/chat/completions.mjs';
import { BrowserTaskInput, BrowserConfig, BrowserTaskResult } from './tools/browser/types.js';

/**
 * OpenAI SDK adapter for browser automation tool
 */

/**
 * OpenAI tool definition for browser automation
 */
declare const browserTool: ChatCompletionTool;
/**
 * Execute a browser task (for use in tool call handling)
 *
 * @param input - Tool input parameters (may be JSON string)
 * @param config - Optional browser worker configuration
 * @returns Task execution result
 */
declare function execute(input: BrowserTaskInput | string, config?: BrowserConfig): Promise<BrowserTaskResult>;
/**
 * Format browser task result for OpenAI tool result
 *
 * Returns a concise summary suitable for agent context. The full result object
 * (with urls, errors, action_history, judgement, etc.) is available when calling
 * execute() directly, but this formatted string omits those details to save tokens.
 *
 * @param result - Browser task result with full history data
 * @returns Formatted string summary for tool result
 */
declare function formatResult(result: BrowserTaskResult): string;
/**
 * Get system prompt for browser automation
 */
declare function getSystemPrompt(): string;
/**
 * Create a configured browser tool with execute and formatResult methods
 *
 * @param config - Browser worker configuration
 * @returns Tool definition with execute and formatResult methods
 *
 * @example
 * ```typescript
 * import OpenAI from 'openai';
 * import { createBrowserTool } from 'morphsdk/tools/browser/openai';
 *
 * const tool = createBrowserTool({
 *   apiUrl: 'https://browser-worker.example.com'
 * });
 *
 * const client = new OpenAI();
 *
 * const response = await client.chat.completions.create({
 *   model: 'gpt-4o',
 *   tools: [tool], // tool itself is the ChatCompletionTool
 *   messages: [{
 *     role: 'user',
 *     content: 'Test the checkout at https://3000-abc.e2b.dev'
 *   }]
 * });
 *
 * // Execute and format
 * const result = await tool.execute(toolCallArgs);
 * const formatted = tool.formatResult(result);
 * ```
 */
declare function createBrowserTool(config?: BrowserConfig): ChatCompletionTool & {
    execute: (input: BrowserTaskInput | string) => Promise<BrowserTaskResult>;
    formatResult: (result: BrowserTaskResult) => string;
    getSystemPrompt: () => string;
};

declare const openai_browserTool: typeof browserTool;
declare const openai_createBrowserTool: typeof createBrowserTool;
declare const openai_execute: typeof execute;
declare const openai_formatResult: typeof formatResult;
declare const openai_getSystemPrompt: typeof getSystemPrompt;
declare namespace openai {
  export { openai_browserTool as browserTool, openai_createBrowserTool as createBrowserTool, openai_execute as execute, openai_formatResult as formatResult, openai_getSystemPrompt as getSystemPrompt };
}

export { browserTool as b, createBrowserTool as c, execute as e, formatResult as f, getSystemPrompt as g, openai as o };
