import type { IMastraLogger } from '../../../logger/index.js';
export type ExecuteToolOutcome = 
/** Execution completed. `result` is the serializable value engines should
 * persist; `rawResult` is the live return value for consumers that need
 * pre-serialization side channels (e.g. the durable engine's in-step
 * `toModelOutput` mapping, which reads symbols the JSON round-trip strips). */
{
    status: 'success';
    result: unknown;
    rawResult: unknown;
}
/** Cancellation won the execution wait, even if the tool never settles.
 * Engines leave the call incomplete rather than publishing a result. */
 | {
    status: 'aborted';
}
/** Execution threw. Engines own error serialization (their persisted error
 * shapes differ), so the raw error is returned. */
 | {
    status: 'error';
    error: unknown;
};
/**
 * Shared synchronous tool execution behavior: run the tool,
 * make the result serialization-safe, fire the `onOutput` lifecycle hook, and
 * classify failures. Both engines' tool-call steps call this after their
 * approval/background ladders have fallen through to direct execution.
 *
 * Unified behaviors (each previously shipped on one engine only):
 * - `onOutput` receives `abortSignal`: previously main-only; tools
 *   observing cancellation in their output hook now work on both engines.
 * - Abort-aware failure classification: previously main-only. A
 *   throw while the request is aborted must not be recorded as an error
 *   result — that would fake-complete the call (its `result` becomes the
 *   abort message) and read as success on resume. Key off the abort signal,
 *   not the error type: CoreToolBuilder wraps the AbortError in a
 *   TOOL_EXECUTION_FAILED MastraError, so isAbortError(error) wouldn't match.
 * - `ensureSerializable` (previously main-only) is a fast-path guard: it
 *   returns the same reference unless the value has cycles/BigInts, so the
 *   durable engine's raw-result consumers are unaffected in the common case
 *   while cyclic results no longer break workflow-state serialization.
 * - FGA authorization denials are re-thrown, never serialized as recoverable
 *   tool errors for the LLM to retry (both engines already agreed).
 *
 * `acquireExecution` is an engine hook (deliberate, not drift): the durable
 * engine brackets live execution with `markRunActive` so run-activity
 * tracking spans the tool call; the main loop has no such bookkeeping.
 */
export declare function executeToolCall(deps: {
    tool: {
        execute: (args: any, options: any) => Promise<unknown> | unknown;
        onOutput?: (params: {
            toolCallId: string;
            toolName: string;
            output: unknown;
            abortSignal?: AbortSignal;
        }) => Promise<void> | void;
    };
    args: unknown;
    toolOptions: unknown;
    toolCallId: string;
    toolName: string;
    abortSignal?: AbortSignal;
    /** Eager attempts are cancelled immediately by their coordinator after the run's grace window. */
    settleSignal?: AbortSignal;
    /** Engine wrapper around live execution (e.g. durable's `markRunActive`); returns a release fn. */
    acquireExecution?: () => () => void;
    /**
     * Engine hook (main loop only): eager tool dispatch may need to hand the
     * call back to the ordinary foreach after the tool body has run (e.g. the
     * tool requested suspension and swallowed the bailout). Called once after
     * `execute` returns (`error` undefined) and once at the top of the failure
     * path with the thrown error; throwing from it propagates out of
     * `executeToolCall` instead of being classified as a tool outcome.
     */
    assertNotBailedOut?: (error?: unknown) => void;
    /**
     * Called once the tool body itself has settled, or right away if it never started. Cancellation can return
     * before that (the tool ignored the abort past its grace), so step accounting that must span the tool's real
     * execution settles here instead of when this function returns.
     */
    onToolSettled?: () => void;
    logger?: IMastraLogger;
}): Promise<ExecuteToolOutcome>;
//# sourceMappingURL=execute-tool-core.d.ts.map