/**
 * Phase Timing Context
 *
 * Module-level singleton that provides phase timing recording
 * to executeNode() without changing its public API.
 *
 * The worker calls setPhaseTimingContext() once after DI init.
 * Node helpers call recordPhaseStart/End() during graph execution.
 * Errors are swallowed so timing never blocks graph execution.
 */
import type { IPhaseTimingRepository } from '../../../../application/ports/output/agents/phase-timing-repository.interface.js';
/**
 * Get the last phase timing ID. Used by the worker to record approval wait start.
 */
export declare function getLastTimingId(): string | null;
/**
 * Set the phase timing context. Called once by the worker after DI init.
 */
export declare function setPhaseTimingContext(runId: string, repository: IPhaseTimingRepository): void;
/**
 * Clear the phase timing context. Useful for testing.
 */
export declare function clearPhaseTimingContext(): void;
/** Pre-execution metadata recorded at phase start. */
export interface PhaseStartMetadata {
    prompt?: string;
    modelId?: string;
    agentType?: string;
}
/**
 * Record the start of a phase. Returns the timing record ID (for later update)
 * or null if context is not set or save fails.
 *
 * Automatically appends an iteration suffix (`:2`, `:3`, …) when the same
 * phase has already been recorded for this run (e.g. after a rejection loop).
 */
export declare function recordPhaseStart(phase: string, metadata?: PhaseStartMetadata): Promise<string | null>;
/** Post-execution metadata recorded at phase end. */
export interface PhaseEndMetadata {
    inputTokens?: number;
    outputTokens?: number;
    cacheCreationInputTokens?: number;
    cacheReadInputTokens?: number;
    costUsd?: number;
    numTurns?: number;
    durationApiMs?: number;
    exitCode?: string;
    errorMessage?: string;
    /** Prompt can be recorded at end time when it's built after recordPhaseStart */
    prompt?: string;
}
/**
 * Record the end of a phase. Updates the timing record with completedAt, durationMs,
 * and optional execution metadata (token usage, exit code, error).
 * No-op if timingId is null (phase start was skipped or failed).
 */
export declare function recordPhaseEnd(timingId: string | null, durationMs: number, metadata?: PhaseEndMetadata): Promise<void>;
/**
 * Record an instant lifecycle event (e.g., run:started, run:stopped, run:crashed).
 * These are phase timing records with zero duration, used to mark events in the timeline.
 *
 * Can be called with explicit runId and repository (for use outside the worker context,
 * e.g., from use cases like StopAgentRunUseCase or ResumeFeatureUseCase).
 */
export declare function recordLifecycleEvent(phase: string, explicitRunId?: string, explicitRepo?: IPhaseTimingRepository): Promise<void>;
/**
 * Update a phase timing record with the prompt text.
 * Useful when the prompt is built after recordPhaseStart (e.g. merge node).
 * No-op if timingId is null or context is not set.
 */
export declare function updatePhasePrompt(timingId: string | null, prompt: string): Promise<void>;
/**
 * Record the start of an approval wait. Sets waitingApprovalAt on the timing record.
 * No-op if timingId is null or context is not set.
 */
export declare function recordApprovalWaitStart(timingId: string | null): Promise<void>;
//# sourceMappingURL=phase-timing-context.d.ts.map