/** * Unified CSV utilities for LLM response parsing. * Consolidates duplicate CSV parsing logic from flows.ts, interactions.ts, and other files. * Implements RFC 4180 compliant parsing. */ /** * Extract CSV content from LLM response (removes code fences). */ export declare function extractCsvContent(content: string): string; /** * Split CSV content into logical lines, handling multi-line quoted values. * RFC 4180 compliant - handles escaped quotes and multi-line values. */ export declare function splitCsvLines(csv: string): string[]; /** * Parse a single CSV row into columns. * Handles quoted fields and escaped quotes (RFC 4180). * Returns null if the row has unclosed quotes. */ export declare function parseRow(line: string): string[] | null; /** * Safely parse an integer from a CSV field, pushing an error if invalid. */ export declare function safeParseInt(value: string, fieldName: string, lineNum: number, errors: string[]): number | null; /** * Format a value for CSV output. * Quotes fields that contain commas, quotes, or newlines. */ export declare function formatCsvValue(value: string): string; /** * Parse CSV content with header validation. * Returns parsed rows as arrays of strings. */ export interface GenericCsvParseResult { header: string[]; rows: string[][]; errors: string[]; } export declare function parseCsvWithHeader(content: string, expectedColumns: number, headerValidator?: (header: string[]) => boolean): GenericCsvParseResult; /** * Generic mapper-based CSV parser. Handles shared boilerplate (extract content, * split lines, validate header, iterate rows, validate column count) and * delegates row-level logic to a callback. */ export interface CsvParseOptions { /** Exact column count(s) accepted. Rows with other counts are rejected. */ expectedColumns?: number | number[]; /** Minimum column count accepted. Rows with fewer columns are rejected. */ minColumns?: number; /** Optional header validation (receives raw header fields). */ headerValidator?: (header: string[]) => boolean; /** Map trimmed columns to a domain object, or return null to skip the row. */ rowMapper: (columns: string[], lineNum: number, errors: string[]) => T | null; /** Whether to skip the first row as a header (default: true). */ skipHeader?: boolean; } export declare function parseCsvWithMapper(content: string, options: CsvParseOptions): { items: T[]; errors: string[]; }; /** * Skip header row if present and filter empty lines. */ export declare function getDataLines(lines: string[], headerPrefix?: string): string[]; //# sourceMappingURL=csv-utils.d.ts.map