import { Task } from "smithers-orchestrator";
type TaskProps = {
id: string;
output: z.ZodObject | Table | string;
outputSchema?: z.ZodObject; // inferred when output is a Zod schema
agent?: AgentLike | AgentLike[]; // array = [primary, ...fallbacks]
fallbackAgent?: AgentLike;
dependsOn?: string[];
needs?: Record<string, string>;
deps?: Record<string, OutputTarget>; // typed render-time upstream outputs
allowTools?: string[]; // CLI-agent tool allowlist
key?: string;
skipIf?: boolean;
needsApproval?: boolean; // pause for human before executing
async?: boolean; // with needsApproval: let unrelated flow continue
timeoutMs?: number;
retries?: number; // default Infinity with exponential backoff
noRetry?: boolean;
retryPolicy?: { backoff?: "fixed" | "linear" | "exponential"; initialDelayMs?: number };
continueOnFail?: boolean;
cache?: { by?: (ctx) => unknown; version?: string };
label?: string;
meta?: Record<string, unknown>;
scorers?: ScorersMap;
memory?: {
recall?: { namespace?: string; query?: string; topK?: number };
remember?: { namespace?: string; key?: string };
threadId?: string;
};
heartbeatTimeoutMs?: number; // fail if no heartbeat in window
children:
| string
| Row
| (() => Row | Promise<Row>)
| ReactNode
| ((deps) => Row | ReactNode);
};