import { z } from 'zod';

export interface Command {
    action: string;
    params: unknown;
    call_id?: number;
    runId?: string;
}
export type AsyncError = {
    message: string;
    code: string;
    category?: string;
};
export type AsyncResponse<T = unknown> = {
    ok: true;
    value: T;
} | {
    ok: false;
    error: AsyncError;
};
export interface ToolDocParam {
    name: string;
    type: string;
    required: boolean;
    description: string;
}
export interface ToolDoc {
    action: string;
    namespace: string;
    description: string;
    params: ToolDocParam[];
    returns: {
        type: string;
        description: string;
    };
    errorCode: string;
    errorCategory?: string;
}
export interface ToolDefinition<P, R> {
    action: string;
    namespace: string;
    description: string;
    params: z.ZodSchema<P>;
    returns: z.ZodSchema<R>;
    handler: (params: P) => Promise<R>;
    paramTypes: ToolDocParam[];
    returnType?: string;
    returnDoc: string;
    errorCode: string;
    errorCategory?: string;
}
export declare function setRunnerAbortController(controller: AbortController | null): void;
export declare function throwIfAborted(): void;
export declare function registerTool<P, R>(tool: ToolDefinition<P, R>): void;
export declare function getTool(action: string): ToolDefinition<unknown, unknown> | undefined;
export declare function clearRegistry(): void;
export declare function dispatchTool(action: string, params: unknown): Promise<AsyncResponse>;
export declare function listTools(): ToolDoc[];
