import type { WorkflowDefinition } from "../../flow/types.ts"; import { type ProgressFor } from "../progress-sink.ts"; import type { RunLock } from "../run-lock.ts"; import type { RunStore } from "../types.ts"; import { type CommandCtx, type StartAgent } from "./context.ts"; /** A parsed `/workflow run` argument line (spec §6.1): the target, plus `--input`'s raw, unparsed payload. */ export interface ParsedRunArgs { readonly target: string | undefined; /** Everything after `--input`, verbatim: either inline JSON or `@`. `undefined` when the flag was absent. */ readonly inputArg: string | undefined; /** Set only when `--input` was typed with nothing after it — a syntax error, not a resolution failure. */ readonly error: string | undefined; } /** * Parse `/workflow run [--input |@]` (spec §6.1). * * `--input`'s own payload is deliberately NOT tokenized the way the rest of `/workflow`'s arguments * are (`extension.ts` splits on `/\s+/` for every other subcommand): a JSON object routinely contains * spaces (`{"branch": "release notes"}`), and re-joining post-split tokens would already have * collapsed repeated whitespace the payload may have meant literally. So the caller hands this the RAW * text after `run` (whitespace-trimmed at the ends only), and everything from `--input` to the end of * the line is taken verbatim as the payload. */ export declare function parseRunArgs(raw: string): ParsedRunArgs; /** What `--input` resolved to (spec §6.1), or why it could not — bad JSON, an unreadable file, or a * schema violation are every one of them reported the same way: a notification, and no run started. */ export type InitialInputResolution = { readonly ok: true; readonly value: unknown; } | { readonly ok: false; readonly error: string; }; /** * Turn `--input`'s raw argument into a validated initial input (spec §6.1). * * Validation reuses {@link describeSchemaViolations} — the SAME TypeBox check the engine itself runs * on a workflow's declared input schema (`engine/run-workflow.ts`) — rather than hand-rolling a second * one that could drift from it. Doing it here, before `startRun` mints a run-id or touches the project * lock, is what makes a malformed payload cost nothing: no run-id is burned, no lock is acquired, and * no `run-meta`/`run-crashed` pair lands in the store. Letting the engine's own (still-present, §orig.) * check catch it would technically be correct too, but only after paying for all three. */ export declare function resolveInitialInput(cwd: string, inputArg: string, workflow: Pick): Promise; /** * `/workflow run [--input |@]` — start a workflow named either by * declared name or by path, optionally seeded with initial input (spec §6.1). * * With no `inputArg`, behaviour is exactly what it was before `--input` existed: `undefined` initial * input, unchanged for every workflow that declares no top-level schema. */ export declare function handleRun(ctx: CommandCtx, store: RunStore, guard: RunLock, startAgent: StartAgent, target: string, inputArg?: string, progressFor?: ProgressFor): Promise; /** * `/workflow create` — run the built-in meta-workflow (src/host/builtin/create.workflow.ts) through * exactly the same machinery as any other run. It differs only in receiving the project root as its * initial input, which its steps use to resolve where the generated file should land. */ export declare function handleCreate(ctx: CommandCtx, store: RunStore, guard: RunLock, startAgent: StartAgent, progressFor?: ProgressFor): Promise; //# sourceMappingURL=run.d.ts.map