/**
 * runHandler — MCP tool handler wrapper.
 *
 * Provides three invariants every handler needs:
 *   1. Bounded execution time — timeout → structured envelope, not a hang.
 *   2. Labeled failures    — { ok, error: { code, message, retriable, hint } }
 *   3. Transient retries   — SQLite-busy / cold runtime → one retry with backoff.
 *
 * Per-client timeouts (AI Lead refinement):
 *   Codex 90 s · Claude Code 60 s · Cursor 30 s · MCP clients 60 s · default 60 s
 *
 * Types and `envelopeToMcpResponse` are canonical in ./envelope.ts;
 * re-exported from here for backward compatibility.
 */
import type { RunHandlerOptions } from './envelope.js';
import type { HandlerEnvelope } from './envelope.js';
export type { HandlerErrorCode, HandlerEnvelope, RunHandlerOptions } from './envelope.js';
export { envelopeToMcpResponse } from './envelope.js';
export declare function resolveHandlerTimeoutForTest(opts?: RunHandlerOptions): number;
/**
 * Run a handler function with timeout, retry, and structured envelope.
 *
 * @example
 * return runHandler('nexus_orchestrate', async () => {
 *     const result = await nexus.orchestrate(goal);
 *     return result;
 * }, { callerName: hctx.adapterName });
 */
export declare function runHandler<T>(toolName: string, fn: () => Promise<T>, opts?: RunHandlerOptions): Promise<HandlerEnvelope<T>>;
