import type { TNodeTypeAST, TWorkflowAST, TMergeStrategy, TConnectionAST, TDataType } from '../ast/index.js';
/**
 * Get the coercion expression to wrap a value, if coercion is needed.
 * Returns null if no coercion needed.
 *
 * Priority:
 * 1. Explicit coerce on the connection (from `as <type>` annotation)
 * 2. Auto-coercion for safe pairs:
 *    - anything -> STRING (String() never fails)
 *    - BOOLEAN -> NUMBER (well-defined: false->0, true->1)
 */
export declare function getCoercionWrapper(connection: TConnectionAST, sourceDataType: TDataType | undefined, targetDataType: TDataType | undefined): string | null;
/**
 * Sanitize a node ID to be a valid JavaScript identifier.
 * Replaces non-alphanumeric characters (except _ and $) with underscores.
 *
 * @param nodeId - The node ID (may contain slashes, etc.)
 * @returns A valid JavaScript identifier
 */
export declare function toValidIdentifier(nodeId: string): string;
/**
 * Build a JavaScript expression that merges multiple source values based on strategy.
 *
 * @param sources - Array of source variable names
 * @param strategy - Merge strategy to apply
 * @returns JavaScript expression string
 */
export declare function buildMergeExpression(sources: string[], strategy: TMergeStrategy): string;
export type TBuildNodeArgsOptions = {
    node: TNodeTypeAST;
    workflow: TWorkflowAST;
    id: string;
    lines: string[];
    indent?: string;
    getCall?: string;
    isAsync?: boolean;
    instanceParent?: string;
    skipPorts?: Set<string>;
    emitInputEvents?: boolean;
    setCall?: string;
    nodeTypeName?: string;
    bundleMode?: boolean;
    production?: boolean;
};
/**
 * Builds the argument list for a node function call by resolving input port values.
 *
 * This function is central to code generation - it determines where each input port
 * gets its value from: connections, expressions, defaults, or execution strategies.
 *
 * ## Resolution Priority (per port):
 * 1. **Skip Ports**: If port is in skipPorts set, use pre-declared variable
 * 2. **Instance Expression**: Check instance.config.portConfigs for constant expressions
 * 3. **Connection**: Get value from connected output port via ctx.getVariable()
 * 4. **Node Type Expression**: Check nodeType.inputs[port].expression
 * 5. **Default Value**: Use nodeType.inputs[port].default if available
 * 6. **Undefined**: No value source found (may cause runtime error)
 *
 * ## Special Handling:
 * - **execute port**: Always first, handles CONJUNCTION/DISJUNCTION strategies
 * - **Scoped INPUT ports**: Skipped (they're return values from scope functions)
 * - **STEP ports (onSuccess/onFailure)**: Use executionSignal config if present
 * - **Scope functions**: Generated via generateScopeFunctionClosure() for FUNCTION ports
 *
 * ## STEP Port Execution Strategies:
 * - **CONJUNCTION (AND)**: `execute = stepA && stepB && stepC`
 * - **DISJUNCTION (OR)**: `execute = stepA || stepB || stepC`
 * - **CUSTOM**: Uses executionSignal expression
 *
 * @param opts - Configuration object with node, workflow, and generation settings
 * @param opts.node - The node type definition with input/output port specs
 * @param opts.workflow - The workflow AST containing connections and instances
 * @param opts.id - The node instance ID being generated
 * @param opts.lines - Array to push generated code lines into
 * @param opts.indent - Indentation prefix for generated lines (default: "    ")
 * @param opts.getCall - Method to get variables (default: "await ctx.getVariable")
 * @param opts.isAsync - Whether generating async code
 * @param opts.instanceParent - Parent node ID if this node is in a scope
 * @param opts.skipPorts - Ports to skip (already pre-handled)
 * @param opts.emitInputEvents - Whether to emit VARIABLE_SET events for inputs
 * @param opts.setCall - Method to set variables (default: "await ctx.setVariable")
 * @param opts.nodeTypeName - Override for node type name in events
 * @returns Array of argument expressions to pass to the node function
 */
export declare function buildNodeArgumentsWithContext(opts: TBuildNodeArgsOptions): string[];
export declare function generateNodeWithExecutionContext(node: TNodeTypeAST, workflow: TWorkflowAST, lines: string[], isAsync: boolean, indent?: string): void;
export declare function buildExecutionContextReturnForBranch(workflow: TWorkflowAST, lines: string[], isAsync: boolean, branchName: string, indent: string, executedNodes: string[]): string;
//# sourceMappingURL=code-utils.d.ts.map