import type { WorkflowNode } from './workflows.ts' export type PortSelector = | { branch: number } | { branch: 'default' } | 'subgraph' export type NodeRef = WorkflowNode | string export type Connection = | [from: NodeRef, to: NodeRef] | [from: NodeRef, to: NodeRef, sourcePort: PortSelector] export interface ConditionCase { name: string condition: string /** * `'selector'` — pipe-delimited format: `step://stepId?path=attr|operator|value` * Operators: contains, not_contains, equals, not_equals, starts_with, ends_with, * greater_than, less_than, greater_than_or_equal, less_than_or_equal, is_true, is_false * Logical: join multiple with ` && ` (AND) or ` || ` (OR) * * `'code'` — raw JavaScript: `input["Step Name"].attr === "value"` * The runtime wraps it in `function execute(input) { return !!(expr) }`. * `input` contains all previous step outputs keyed by step name. */ type?: 'selector' | 'code' } export interface WorkflowSpecInput { id?: string name: string type: 'text' | 'file' required?: boolean description?: string multimodal?: boolean } /** * One field of a workflow's declared output. Both fields are required by the API. * * `source` is a reference to the value, normally `{{step://step-id?path=field}}`. */ export interface WorkflowSpecOutput { type: string source: string } export interface WorkflowSpecSettings { /** Run independent steps concurrently. This is the only supported form of parallelism. */ parallelExecution?: boolean }