/**
 * Platform Tool Proxy (Worker Side)
 *
 * Provides platform.call() for external developers to invoke platform tools
 * from within worker threads. Communicates with the parent process via
 * postMessage() -- the parent dispatches to the real service layer.
 */
/** Token usage metadata returned for tool calls with cost accounting. */
interface TokenUsage {
    inputTokens: number;
    outputTokens: number;
    cost?: number;
}
/** Inbound tool-result from parent */
export interface ToolCallResponse {
    type: 'tool-result';
    id: string;
    result?: unknown;
    error?: string;
    code?: string;
    usage?: TokenUsage;
}
/** Inbound credential-result from parent */
export interface CredentialResultMessage {
    type: 'credential-result';
    id: string;
    provider?: string;
    credentials?: Record<string, string>;
    error?: string;
    code?: string;
}
/** Resolved credential returned by platform.getCredential() */
export interface PlatformCredential {
    provider: string;
    credentials: Record<string, string>;
}
export declare class PlatformToolError extends Error {
    /** ToolingErrorType code from the platform */
    readonly code: string;
    /** Whether the error is retryable */
    readonly retryable: boolean;
    constructor(message: string, 
    /** ToolingErrorType code from the platform */
    code: string, 
    /** Whether the error is retryable */
    retryable: boolean);
}
/**
 * Handle a tool-result message from the parent process.
 * Called from the parentPort.on('message') handler in index.ts.
 */
export declare function handleToolResult(msg: ToolCallResponse): void;
/**
 * Handle a credential-result message from the parent process.
 * Called from the parentPort.on('message') handler in index.ts.
 */
export declare function handleCredentialResult(msg: CredentialResultMessage): void;
export declare const platform: {
    /**
     * Call a platform tool from the worker thread.
     *
     * @param options.tool - Tool name (e.g., 'gmail', 'storage', 'attio')
     * @param options.method - Method name (e.g., 'sendEmail', 'upload')
     * @param options.params - Method parameters
     * @param options.credential - Credential name (required for integration tools)
     * @returns Promise resolving to the tool result
     * @throws PlatformToolError on failure (with code and retryable fields)
     */
    call(options: {
        tool: string;
        method: string;
        params?: unknown;
        credential?: string;
    }): Promise<unknown>;
    /**
     * Request raw credential access from the platform.
     *
     * This is an explicit opt-in that causes the credential's secret values
     * to enter worker memory. Use only when you need to initialise a
     * third-party SDK (e.g. `new Stripe(key)`). Prefer `platform.call()`
     * with the `http` tool for server-side credential injection.
     *
     * @param name - Credential name as configured in the command center
     * @returns Promise resolving to { provider, credentials }
     * @throws PlatformToolError on failure (credential not found, raw access denied, etc.)
     */
    getCredential(name: string): Promise<PlatformCredential>;
};
export {};
