import { type PhaseDescriptor } from "./task-phases.js"; import type { TaskRecord } from "./task-record.js"; export declare function actionForRole(role: string): string; export interface OrchestratorEmitContext { /** Entity identifier — required when entityType is "task". */ taskId?: string; /** Entity identifier — required when entityType is "bug". */ bugId?: string; /** Discriminator for entity-keyed event construction. */ entityType: "task" | "bug"; sprintId: string; phase: PhaseDescriptor; iteration: number; startMs: number; endMs: number; model: string; provider: string; usage: { input: number; output: number; cacheRead: number; cacheWrite: number; }; judgement: Record | undefined; storeCli: string; cwd: string; } export declare function isoCompact(ms: number): string; export declare function buildPhaseEvent(ec: OrchestratorEmitContext): Record; export declare function emitEvent(storeCli: string, cwd: string, sprintId: string, event: Record): { ok: boolean; stderr: string; }; /** * Emit a phase event for an INCOMPLETE attempt (cancelled / failed) so its * provider-billed tokens reach the store. Bug B: the cancel and halt-on-failure * branches used to return without emitting, so collate's COST_REPORT * under-counted real spend by exactly the aborted passes (CART-S02-T03 * baseline: 259,950 tokens across two aborted plan attempts, invisible). * * The event is the canonical phase event (schema-unchanged) with * `verdict: "aborted" | "failed"` marking the outcome. * * Zero-token attempts are skipped — there is no spend to account, and a * token-less event would be flagged as a husk by collate's ingestion-quality * pass. Never throws: emission must not perturb the cancel/halt return paths. * * @param opts.decorate Optional event mutation hook applied before emit * (fix-bug uses it for the BUG_TYPE_TOKENS `type` field). * @returns true when the event was emitted and store-cli accepted it. */ export declare function emitIncompletePhaseEvent(opts: { emitCtx: OrchestratorEmitContext; outcome: "aborted" | "failed"; notes?: string; decorate?: (event: Record) => void; onDebug?: (rec: Record) => void; }): boolean; export declare function judgementFromSummary(record: TaskRecord | null, phaseRole: string, summaryKeyByRole?: Record): Record | undefined; export declare function drainFrictionFile(frictionPath: string, ec: OrchestratorEmitContext): { emitted: number; failed: number; };