/**
 * Programmatic local runner for `.ts` / `.tsx` / `.py` workflow scripts.
 *
 * This is the body of the `agent-relay run <script>` command extracted into
 * the SDK so other tools (e.g. `ricky run`) can drive the same execution
 * flow without shelling out to the `agent-relay` binary.
 *
 * Behavior is preserved exactly — the relay CLI's `run` command now
 * delegates to `runScriptWorkflow()` with no semantic change.
 */
import { execFileSync } from 'node:child_process';
export type ExecFileSyncLike = typeof execFileSync;
export interface RunScriptWorkflowOptions {
    /** Validate without running. Sets `DRY_RUN=true` in the child env. */
    dryRun?: boolean;
    /** Resume a previously failed workflow run by id. */
    resume?: string;
    /** Start from the given step name, skipping predecessors. */
    startFrom?: string;
    /** Use cached outputs from this previous run id. Pairs with `startFrom`. */
    previousRunId?: string;
}
/**
 * Parsed workflow parse error, normalized from whatever shape the tsx/esbuild
 * subprocess produced on stderr. Decoupling this from any specific error class
 * means the formatter is testable in isolation and works regardless of how
 * the error surfaced (TransformError from tsx, Bun-bundled esbuild error, etc.).
 */
export interface ParsedWorkflowError {
    file: string;
    line?: number;
    column?: number;
    message: string;
    lineText?: string;
}
export interface LocalSdkWorkspace {
    rootDir: string;
    sdkDir: string;
}
/**
 * Walk upward from `startDir` looking for a workspace where the root
 * `package.json` is `agent-relay` and `packages/sdk/package.json` is
 * `@agent-relay/sdk`. Returns the matched paths or `null`.
 */
export declare function findLocalSdkWorkspace(startDir: string): LocalSdkWorkspace | null;
/**
 * When running inside the relay monorepo, ensure `packages/sdk/dist/workflows`
 * is built so the script can resolve `@agent-relay/sdk/workflows`. No-op
 * outside the monorepo or when the build is already present.
 */
export declare function ensureLocalSdkWorkflowRuntime(startDir: string, execRunner?: ExecFileSyncLike): void;
/**
 * Parse tsx's stderr for the esbuild parse-error fingerprint and extract a
 * normalized {@link ParsedWorkflowError}. Returns null if nothing looks like
 * a parse error — runtime errors, module-not-found, etc. pass through.
 *
 * We match two common esbuild output formats:
 *   1. `/path/file.ts:LINE:COL: ERROR: message` (most common, one-liner)
 *   2. `✘ [ERROR] message\n\n    /path/file.ts:LINE:COL:\n      LINE │ text\n           ╵ pointer`
 *      (pretty-printed, multi-line)
 */
export declare function parseTsxStderr(stderr: string): ParsedWorkflowError | null;
export declare function shouldSkipNodeStripTypesPreflight(filePath: string, seen?: Set<string>, isEntry?: boolean): boolean;
/**
 * Format a {@link ParsedWorkflowError} as an actionable workflow-author error
 * message with hints keyed off the most common mistakes in `command:` /
 * `task:` template literals.
 */
export declare function formatWorkflowParseError(parsed: ParsedWorkflowError): Error;
/**
 * Run a `.ts`, `.tsx`, or `.py` workflow script locally.
 *
 * For TypeScript files, tries Node's `--experimental-strip-types` first
 * (Node 22.6+), then falls back to `tsx`, `ts-node`, and finally `npx tsx`.
 * For Python files, tries `python3` then `python`.
 *
 * Throws on non-zero exit. The error message includes the run id (when
 * the script wrote one to `AGENT_RELAY_RUN_ID_FILE`) so callers can resume
 * with `--start-from <step> --previous-run-id <id>`.
 */
export declare function runScriptWorkflow(filePath: string, options?: RunScriptWorkflowOptions): Promise<void>;
//# sourceMappingURL=run-script.d.ts.map