/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { ITask, TaskGraph } from "@workglow/task-graph"; import type { CliTaskLine, IterationSlotRow } from "../taskGraphCliSubscriptions"; export interface SubtaskRowsState { /** Owned subtasks in display order (completed → running → pending, then graph order). */ readonly rows: readonly CliTaskLine[]; /** * The live task behind each row, keyed by row id. A row that owns tasks of its * own — an owned workflow wrapping a whole pipeline, say — needs its instance * so the renderer can recurse into that subgraph instead of stopping at the * wrapper row. */ readonly tasks: ReadonlyMap; /** Aggregate progress of the subgraph, once it reports any. */ readonly overallProgress: number | undefined; readonly iterationSlots: ReadonlyMap; } /** * MapTask / ReduceTask / ForEachTask: the subgraph is the idle template, not the * live iteration clones. Those clones arrive via `iteration_start` and are * rendered as ordinary task rows. */ export declare function isIteratorTask(task: ITask): boolean; declare function concurrencyLimitOf(task: ITask): number | undefined; export { concurrencyLimitOf }; /** * Subscribe to an already-populated graph (a Map iteration clone) the same way * {@link useSubtaskRows} subscribes to a task's owned subgraph. */ export declare function useGraphTaskRows(graph: TaskGraph): SubtaskRowsState; /** * Tracks the tasks a running task owns via `context.own()`. * * A task's `subGraph` is usually empty when the row first mounts — children are * added as `execute()` reaches them — so the subgraph is attached lazily, then * subscribed once with the same {@link subscribeTaskGraphForCli} the top-level * graph uses. * * The signal to attach on is the task's OWN `regenerate` event, which `Task` * emits the moment its subgraph gains a task. No graph-level listener sees it, * which is why this used to poll `hasChildren()` instead — but this hook holds * the task, and a poll silently loses any subtask that starts and finishes * inside one interval, which on a fast pipeline is most of them. */ export declare function useSubtaskRows(task: ITask): SubtaskRowsState;