import type { AgentOptions, BashResult, RunLimits, SubagentResult } from "../types.js"; import type { AgentSpec } from "./agents.js"; import type { AskOptions, BashOptions } from "./bash-ask.js"; export interface WorkflowRuntimeApi { cwd: string; runId: string; runDir: string; input: unknown; limits: Readonly; log(message: string, details?: unknown): Promise; phase(label: string): Promise; agent(prompt: string, options?: AgentOptions): Promise; agents( items: (string | AgentSpec)[], options?: AgentOptions & { concurrency?: number; settle?: false }, ): Promise; agents( items: (string | AgentSpec)[], options: AgentOptions & { concurrency?: number; settle: true }, ): Promise<(SubagentResult | null)[]>; workflow(name: string, input?: unknown): Promise; ask(question: string, options?: AskOptions): Promise; bash(command: string, options?: BashOptions): Promise; readFile(filePath: string, encoding?: BufferEncoding): Promise; writeFile(filePath: string, data: string | Uint8Array): Promise<{ path: string }>; appendFile(filePath: string, data: string | Uint8Array): Promise<{ path: string }>; listFiles(dir?: string, options?: { maxFiles?: number }): Promise; writeArtifact(name: string, data: unknown): Promise<{ path: string }>; appendArtifact(name: string, data: string | Uint8Array): Promise<{ path: string }>; sleep(ms: number): Promise; json(value: unknown, maxChars?: number): string; compact(value: unknown, maxChars?: number): string; }