/**
 * In-memory execution tracker for worker nodes.
 *
 * Workers have no database access. This lightweight implementation
 * satisfies the same interface subset that the dispatcher and processor
 * call (onExecutionStarted, onJobStatus, onStepStatus, getRunStatus),
 * allowing those subsystems to work unchanged on workers.
 *
 * Optionally forwards status updates via a callback for coordinator relay,
 * and maintains a ring buffer of recently completed jobs for /status.
 */
import type { ObserverRegistry } from '../ws/observer-registry.js';
/** A status update forwarded to the coordinator. */
export interface StatusUpdate {
    type: 'job' | 'step';
    runId: string;
    jobId: string;
    status: string;
    stepIndex?: number;
    stepName?: string;
    timestamp: number;
    data?: Record<string, unknown>;
}
/** A completed job entry in the ring buffer. */
interface CompletedJobInfo {
    runId: string;
    jobId: string;
    jobName: string;
    status: string;
    startedAt: number;
    completedAt: number;
    durationMs: number;
}
interface InMemoryExecutionTrackerOptions {
    /** Callback to forward status updates to coordinator via P2P. */
    onStatusForward?: (update: StatusUpdate) => void;
    /** Maximum number of recent completed jobs to keep. Default: 50. */
    recentJobsLimit?: number;
    /** Optional observer registry for broadcasting to CLI observers. */
    observerRegistry?: ObserverRegistry;
}
/** In-memory state for a single job within a run. */
interface JobState {
    name: string;
    status: string;
    startedAt?: number;
    completedAt?: number;
}
/** In-memory state for a single execution run. */
interface RunState {
    workflowName: string;
    provider: string;
    repoIdentifier: string;
    sha: string;
    ref: string;
    startedAt: number;
    jobs: Map<string, JobState>;
}
export declare class InMemoryExecutionTracker {
    private readonly onStatusForward?;
    private readonly recentJobsLimit;
    private readonly observerRegistry?;
    private readonly runs;
    private readonly recentJobs;
    constructor(options: InMemoryExecutionTrackerOptions);
    /**
     * Record a new execution run with its initial jobs.
     * Signature matches ExecutionTracker.onExecutionStarted (positional args).
     */
    onExecutionStarted(runId: string, workflowName: string, provider: string, repoIdentifier: string, ref: string, sha: string, _deliveryId: string | null, _providerContext: Record<string, unknown>, _triggerDecision: Record<string, unknown> | null, jobs: Array<{
        jobId: string;
        jobName: string;
        matrixValues?: Record<string, unknown>;
    }>): Promise<void>;
    /**
     * Update job status. Forwards to coordinator callback if configured.
     */
    onJobStatus(runId: string, jobId: string, status: string, timestamp: number, agentId?: string, data?: Record<string, unknown>): Promise<void>;
    /**
     * Update step status. Forwards to coordinator callback if configured.
     */
    onStepStatus(runId: string, jobId: string, stepIndex: number, stepName: string, status: string, timestamp: number, data?: Record<string, unknown>): Promise<void>;
    /**
     * Get the current status of a run.
     */
    getRunStatus(runId: string): RunState | null;
    /**
     * Get recent completed jobs (most recent first).
     */
    getRecentJobs(): CompletedJobInfo[];
    private addToRecentJobs;
}
export {};
//# sourceMappingURL=in-memory-execution-tracker.d.ts.map