/**
 * Output binding resolver.
 *
 * Workflow author writes `{ "$ref": "<nodeId>.output.<path>" }` somewhere
 * inside a hostExecutor `input` or a subagent / humanGate `prompt`.  At
 * dispatch time we walk the value, find every `$ref`, and substitute
 * it with the corresponding upstream value.  The substitution happens
 * BEFORE `parseInput` / spawn / wait so consumers see fully-resolved
 * literals.
 *
 * Failure model (codex round 6 tightenings):
 *   - All errors are `BindingError` — caller maps to `activityFailed`
 *     with `errorCode = 'InputBindingFailed'`, `errorClass = 'userFault'`.
 *   - We never silently fall back to the event payload `externalRefs` —
 *     `outputRef` blob is the contract.  Missing blob file ⇒ binding fails
 *     loudly so the operator notices a write-side bug rather than getting
 *     a half-resolved input.
 *   - `{ "$ref": "..." }` is the typed binding primitive: an entire field
 *     value is replaced and objects/arrays/numbers are preserved.
 *   - String interpolation is intentionally narrow: `${...}` may embed the
 *     same ref grammar inside a string, and only scalar values are allowed.
 *     Objects/arrays must use whole-field `$ref`.
 *
 * Reference syntax:
 *   `<nodeId>.output.<segment>(.<segment>)*`
 *   `params.<segment>(.<segment>)*`
 *
 *   - `nodeId` is everything before the FIRST `.output.` occurrence.  We
 *     split on `.output.` rather than the first `.` because `NODE_ID_PATTERN`
 *     allows dots in node ids (e.g. `team.draft`).
 *   - `params.*` reads the immutable run input blob written at runCreated.
 *   - Each path segment must match `[A-Za-z0-9_-]+` or be a non-negative
 *     integer (array index).  `__proto__` / `prototype` / `constructor`
 *     are explicitly rejected to prevent prototype pollution.
 */
import type { WorkflowDefinition } from './definition.js';
import type { EventLog } from './events/append.js';
import type { Snapshot } from './events/replay.js';
export declare class BindingError extends Error {
    constructor(message: string);
}
export type ParsedRef = {
    kind: 'output' | 'params' | 'previous';
    nodeId: string;
    pathSegments: string[];
};
export declare function parseRef(ref: string): ParsedRef;
export type BindingContext = {
    snapshot: Snapshot;
    def: WorkflowDefinition;
    log: EventLog;
    loadParams?: () => Promise<Record<string, unknown>>;
    loopContext?: {
        loopId: string;
        iteration: number;
    };
};
export declare function resolveOutputRef(ref: string, ctx: BindingContext, options?: {
    allowMissingPrevious?: boolean;
}): Promise<unknown>;
/**
 * Recursive walker: every `$ref` form replaced by its resolved value,
 * every other value left as-is.  Arrays/objects are reconstructed
 * fresh so the caller gets a tree it can mutate without aliasing the
 * workflow definition.
 *
 * NOTE: We do not resolve refs nested inside resolved values.  i.e. if
 * upstream `output.x` itself contains a `$ref`-shaped object, that's
 * data, not a ref.  Refs only originate from the workflow definition.
 */
export declare function resolveBindings(value: unknown, ctx: BindingContext): Promise<unknown>;
/**
 * Convenience for fields typed as `BoundString` — guaranteed to resolve
 * to a string.  Throws BindingError if a non-string ref slipped through.
 */
export declare function resolveBoundString(value: unknown, ctx: BindingContext): Promise<string>;
//# sourceMappingURL=output-binding.d.ts.map