import { tool } from '@openai/agents';
import type { Emitter } from 'mitt';
import { type MittEvents } from './mitt';
/**
 * Descriptor passed to the customization callbacks on
 * {@link MittAgentToolsOptions}.
 */
export type MittAgentToolDescriptor = {
    /** Method key originally registered on the `PieCard.methods` map. */
    methodName: string;
    /** Value of `data.name` on the target `PieCard`. */
    cardName: string;
    /** Raw mitt event name (`pie{methodName}_{cardName}`). */
    eventName: string;
};
/**
 * Options accepted by {@link getMittAgentTools} and
 * {@link usePieMittAgentTools}.
 */
export type MittAgentToolsOptions = {
    /**
     * Optional predicate invoked for each discovered PieCard method. Return
     * `false` to omit the event from the generated tool list. Defaults to
     * accepting everything.
     */
    filter?: (descriptor: MittAgentToolDescriptor) => boolean;
    /**
     * Optional override for the tool description surfaced to the model.
     * Defaults to a generic string mentioning the card and method.
     */
    describe?: (descriptor: MittAgentToolDescriptor) => string;
    /**
     * Optional override for the public tool name. Defaults to
     * `{cardName}_{methodName}`. The returned value must be unique within the
     * final tool set.
     */
    nameFor?: (descriptor: MittAgentToolDescriptor) => string;
};
/**
 * Return type of {@link getMittAgentTools}. We intentionally keep this loose
 * rather than importing the deeply-parameterized `FunctionTool` generic from
 * `@openai/agents-core` — callers typically feed the result directly into
 * `new Agent({ tools: [...] })` which accepts any tool-shaped value.
 */
export type MittAgentTool = ReturnType<typeof tool>;
/**
 * Scans a mitt emitter for all currently-registered PieCard methods (events
 * matching `pie{methodName}_{cardName}`) and wraps each one as an
 * `@openai/agents` function tool.
 *
 * Calling a returned tool re-emits the matching mitt event with the
 * `payload` argument supplied by the model. Because mitt listeners run
 * synchronously in-process, the tool executes entirely locally with no
 * network hop.
 *
 * This takes a *snapshot* of the emitter at the moment it is called — cards
 * that mount afterwards will not be represented until the function is called
 * again. Prefer {@link usePieMittAgentTools} from inside React components so
 * the snapshot refreshes whenever the surrounding tree re-renders.
 *
 * @param emitter The mitt emitter to scan. Defaults to the global PieUI
 *                singleton returned by {@link getEmitter}.
 * @param options See {@link MittAgentToolsOptions}.
 * @returns An array of `@openai/agents` function tools, one per discovered
 *          PieCard method.
 */
export declare function getMittAgentTools(emitter?: Emitter<MittEvents>, options?: MittAgentToolsOptions): MittAgentTool[];
/**
 * React hook wrapper around {@link getMittAgentTools}. Reads the emitter from
 * {@link MittContext} — falling back to the global singleton returned by
 * {@link getEmitter} when used outside of a PieRoot — and memoizes the
 * resulting tool array by a sorted snapshot of registered event names so the
 * returned reference is stable across renders that don't add or remove
 * PieCard methods.
 *
 * Because mitt does not emit a "handler-added" notification, the hook only
 * refreshes its snapshot when the calling component re-renders. If you need
 * to react to cards mounting at arbitrary times, trigger a re-render from the
 * consumer or call {@link getMittAgentTools} imperatively right before you
 * build the `Agent`.
 *
 * @example
 * ```tsx
 * const tools = usePieMittAgentTools()
 * const agent = useMemo(() => new Agent({ name: 'UI', tools }), [tools])
 * ```
 */
export declare function usePieMittAgentTools(options?: MittAgentToolsOptions): MittAgentTool[];
//# sourceMappingURL=mittAgentTools.d.ts.map