/** * Task Engine Converters — Core Task Record Conversion Utilities * * Provides converter functions that map between the core Task domain type * and the backward-compatible TaskRecord format used by the dispatch layer, * as well as interface types for lifecycle and IVTR history entries. * * Moved from packages/cleo/src/dispatch/engines/task-engine.ts as part of * the T1566 engine-migration epic (ADR-057, ADR-058). * * @task T1568 * @epic T1566 * @adr ADR-057 * @adr ADR-058 */ import type { Task, TaskRecord } from '@cleocode/contracts'; import type { IvtrPhase, IvtrPhaseEntry } from '../lifecycle/ivtr-loop.js'; /** * A single lifecycle stage transition entry returned by taskShowWithHistory. * Maps the `getLifecycleStatus` stage shape into a stable, typed record. * * @task T1568 * @epic T1566 */ export interface LifecycleStageEntry { /** Canonical stage name (e.g. "research", "implementation"). */ stage: string; /** Current status of this stage. */ status: 'not_started' | 'in_progress' | 'completed' | 'skipped' | 'failed'; /** ISO timestamp when the stage was started, or null. */ startedAt: string | null; /** ISO timestamp when the stage was completed, or null. */ completedAt: string | null; /** Output file path recorded for this stage, or null. */ outputFile: string | null; } /** * A single IVTR phase entry returned by taskCompleteStrict and taskShowIvtrHistory. * Surface-safe projection of IvtrPhaseEntry with renamed agentIdentity → agent. * * @task T1568 * @epic T1566 */ export interface IvtrHistoryEntry { /** Phase name (implement | validate | test | released). */ phase: IvtrPhase; /** Agent identity string, or null if unknown. */ agent: string | null; /** ISO timestamp when this phase was started. */ startedAt: string; /** ISO timestamp when this phase was completed, or null if still active. */ completedAt: string | null; /** Whether this phase passed. null = in-progress. */ passed: boolean | null; /** sha256 hashes of evidence attachments for this phase. */ evidenceRefs: string[]; } /** * Convert a core Task to a TaskRecord for backward compatibility. * TaskRecord has string-typed status/priority; Task has union types. * * @param task - The core Task domain object to convert * @returns TaskRecord compatible with the dispatch layer's response format * * @task T1568 * @epic T1566 */ export declare function taskToRecord(task: Task): TaskRecord; /** * Convert an array of core Tasks to TaskRecords. * * @param tasks - Array of core Task domain objects to convert * @returns Array of TaskRecords compatible with the dispatch layer * * @task T1568 * @epic T1566 */ export declare function tasksToRecords(tasks: Task[]): TaskRecord[]; /** * Project IvtrPhaseEntry to the surface-safe IvtrHistoryEntry shape. * * @param e - The IVTR phase entry from the core lifecycle module * @returns Surface-safe projection with renamed agentIdentity → agent * * @task T1568 * @epic T1566 */ export declare function toHistoryEntry(e: IvtrPhaseEntry): IvtrHistoryEntry; //# sourceMappingURL=engine-converters.d.ts.map