/** * Batching of tasks for `asyncExecution` (Python `async_execution`). * * Port of the loop in `praisonaiagents/agents/agents.py::arun_all_tasks`: * consecutive tasks marked `async_execution` are collected and gathered * together, and the batch is flushed before any synchronous task runs, so a * sync task never overlaps the async ones queued ahead of it. A task whose * dependency is still pending in the open batch forces an early flush, because * otherwise it would build its prompt from an empty dependency result * (`Agents._depends_on_pending`). */ import type { Task } from '../types'; /** The fields batching reads; a plain object works as well as a Task. */ export interface SchedulableTask { asyncExecution: boolean; /** Tasks whose results this one consumes (`dependencies` on a real Task). */ dependencies?: readonly unknown[]; } /** One step of the run plan: either a parallel fan-out or a single serial task. */ export interface TaskBatch { /** True when every task in `tasks` may run concurrently. */ parallel: boolean; tasks: T[]; } /** * Group `tasks` into the batches a runner should execute in order. * * Without `asyncExecution` every task is its own serial batch (Python's * default). With it, runs of async tasks collapse into one parallel batch. */ export declare function planTaskBatches(tasks: readonly T[]): Array>; /** True when `task` depends on one of the tasks already queued in `pending`. */ export declare function dependsOnPending(task: T, pending: readonly T[]): boolean; /** Narrowing helper so a `Task[]` can be planned without a cast. */ export declare function planTaskRun(tasks: readonly Task[]): Array>;