import type { ToolTrace, TraceLevel } from "./tracing.ts"; import type { Logger } from "./tree-types.ts"; import type { BridgeDocument, ToolMap } from "./types.ts"; export type ExecuteBridgeOptions = { /** Parsed bridge document (from `parseBridge` or `parseBridgeDiagnostics`). */ document: BridgeDocument; /** * Which bridge to execute, as `"Type.field"`. * Mirrors the `bridge Type.field { ... }` declaration. * Example: `"Query.searchTrains"` or `"Mutation.sendEmail"`. */ operation: string; /** Input arguments — equivalent to GraphQL field arguments. */ input?: Record; /** * Tool functions available to the engine. * * Supports namespaced nesting: `{ myNamespace: { myTool } }`. * The built-in `std` namespace is always included; user tools are * merged on top (shallow). * * To provide a specific version of std (e.g. when the bridge file * targets an older major), use a versioned namespace key: * ```ts * tools: { "std@1.5": oldStdNamespace } * ``` */ tools?: ToolMap; /** Context available via `with context as ctx` inside the bridge. */ context?: Record; /** * Enable tool-call tracing. * - `"off"` (default) — no collection, zero overhead * - `"basic"` — tool, fn, timing, errors; no input/output * - `"full"` — everything including input and output */ trace?: TraceLevel; /** Structured logger for engine events. */ logger?: Logger; /** External abort signal — cancels execution when triggered. */ signal?: AbortSignal; /** * Hard timeout for tool calls in milliseconds. * Tools that exceed this duration throw a `BridgeTimeoutError`. * Default: 15_000 (15 seconds). Set to `0` to disable. */ toolTimeoutMs?: number; /** * Maximum shadow-tree nesting depth. * Default: 30. Increase for deeply nested array mappings. */ maxDepth?: number; /** * Sparse fieldset filter. * * When provided, only the listed output fields (and their transitive * dependencies) are resolved. Tools that feed exclusively into * unrequested fields are never called. * * Supports dot-separated paths and a trailing wildcard: * `["id", "price", "legs.*"]` * * Omit or pass an empty array to resolve all fields (the default). */ requestedFields?: string[]; /** * Enable partial success (Error Sentinels). * * When `true`, non-fatal errors on individual output fields are planted as * `Error` sentinels in the output tree rather than thrown. A GraphQL * resolver higher in the stack can intercept them to deliver per-field * errors while sibling fields still resolve successfully. * * When `false` (default), the first non-fatal error is re-thrown and * surfaces as a single top-level field error. */ partialSuccess?: boolean; }; export type ExecuteBridgeResult = { data: T; traces: ToolTrace[]; /** Compact bitmask encoding which traversal paths were taken during execution. */ executionTraceId: bigint; }; /** * Execute a bridge operation using the v3 scope-based engine. * * Pull-based: tools are only called when their output is first read. * Tool input wires are evaluated lazily at that point, not eagerly. * Uses `body: Statement[]` directly — no legacy `wires: Wire[]`. */ export declare function executeBridge(options: ExecuteBridgeOptions): Promise>; //# sourceMappingURL=execute-bridge.d.ts.map