/** * Field parsers for the dispatch-record upgrade path. * C wave 1 / slice c1 (leaf c1w1-record-upgrade): extracted from * `dispatch-record-upgrade.ts`'s `upgradeRecord` body into cohesive helpers * with identical control flow — same predicates, same branch order, same * error handling, same return shape. The throwing field reads * (`role` / `requestId` / `sessionId` / `prompt`, then `toolCall`, then * `createdAt`) still run in exactly that order before any pure defaulting; * everything after them is a pure read of `obj`. */ import type { DispatchRecord } from './dispatch-record-types.js'; import type { SubAgentToolCall } from './sub-agent-dispatcher.js'; /** * Parse the v1..v3.2 core fields of a legacy dispatch record. * PRD-002b slice 6: extracted from `upgradeRecord` so the reader * stays under the `max-lines-per-function: 50` ESLint ceiling. * Behavior is byte-identical to the previous inline block. */ export declare function parseUpgradeRecordLegacyFields(obj: Record): { role: string; requestId: string; sessionId: string; prompt: string; toolCall: SubAgentToolCall; createdAt: string; }; /** * Parse the post-v3 migration fields of a legacy dispatch record. * PRD-002b slice 6: extracted from `upgradeRecord` so the reader * stays under the `max-lines-per-function: 50` ESLint ceiling. * Behavior is byte-identical to the previous inline block; the `vendor` * field is NOT parsed here — it stays in `dispatch-record-upgrade.ts` * because the vendor-neutral identity census pins that decision by path. */ export declare function parseUpgradeRecordMigrationFields(obj: Record): { stage: string | null; leaseId: string | null; isolationStartedAt: string | null; serviceKill: { readonly pid: number; readonly name: string; readonly signal: string; readonly exitCode: number | null; readonly skipped?: boolean; readonly reason?: string; }[]; mergeBackAttempts: number; workflowId: string | null; graphNodeId: string | null; graphRef: string | null; mode: "in-process" | "detached"; autoCompactEvents: { readonly at: number; readonly threshold: "0.85" | "0.95"; readonly tokensBefore: number; readonly tokensAfter: number; readonly scratchFile?: string; }[]; tokenUsage: { totalCostUsd?: number; promptTokens: number; completionTokens: number; } | null; }; /** * Assemble the normalized 4.1.0 record from the two parse passes. The * returned object literal is byte-for-byte the previous `upgradeRecord` * return literal (same key order) so a record re-serialized by the writer * keeps its on-disk shape. `vendor` is threaded in from the upgrade module * (see `parseUpgradeRecordMigrationFields` for why). */ export declare function buildUpgradedRecord(obj: Record, vendor: DispatchRecord['vendor']): DispatchRecord;