/** * `inputFile` fan-out (Python `Process._create_loop_subtasks`). * * A task with an `inputFile` is a template: each CSV row (or each non-empty * line of a text file) becomes one subtask whose description is the parent * description followed by the row. The subtasks are chained with `nextTasks`, * the first is flagged `isStart`, and the last inherits the parent's * `nextTasks` so the workflow rejoins its original successor. * * The module returns `TaskConfig` values rather than `Task` instances so it * never has to import the `Task` class at run time. */ import type { Task, TaskConfig } from '../types'; /** * Parse a whole CSV document into logical records. `"` quotes a field, a * doubled `""` inside a quoted field is a literal quote (RFC 4180), a `\` escapes * the next character outside quotes (Python's `escapechar='\\'`), and a newline * inside quotes stays part of the field rather than starting a new record. * Returns one string[] per logical record. */ export declare function parseCsv(contents: string): string[][]; /** * Split one CSV line, honouring `"` quoting and `""` doubled-quote escaping. * Kept for callers that already hold a single physical record; prefer * `parseCsv` for whole files so quoted newlines survive. */ export declare function parseCsvLine(line: string): string[]; /** * The row texts an input file contributes. A CSV row of two or more fields * becomes Python's `"Question: \nAnswer: "` pair; a single field, or a * line of a text file, is used verbatim. Empty rows are dropped. */ export declare function inputFileRows(contents: string, extension: string): string[]; /** How the parent task's file is read; injectable so tests need no disk. */ export type FileReader = (filePath: string) => string; /** * Build the subtask configs for `task`'s `inputFile`. * * @param decisionMode - Python's `decision_mode`: subtasks become `decision` * tasks carrying a `done`/`retry`/`exit` condition table, as the workflow * engine does for a start task. * @returns `[]` when the task has no `inputFile`. * @throws when the file cannot be read — the caller marks the task failed, as * Python does. */ export declare function inputFileTaskConfigs(task: Task, options?: { decisionMode?: boolean; readFile?: FileReader; }): TaskConfig[];