import type { Conclusion } from "~/lib/types";
export type JobMeta = {
jobId: string;
mode: "cloud" | "external";
state: "running" | "finalizing" | "done";
offset: number;
step: number;
artifacts: Array<{ name: string; path: string }>;
conclusion: Conclusion | null;
deadline: number;
outputs?: Record<string, string>;
nonce?: string;
allowedArtifacts?: string[];
allowedOutputs?: string[];
/** `::add-mask::` bookkeeping (see JobMasks). */
addedMasks?: number;
pendingMasks?: string[];
/** Unterminated tail of the last self-hosted log chunk. */
logCarry?: string;
/** Self-hosted runner that claimed the job, so its API calls are authorized without a D1 read. */
runnerId?: string;
/** Set once artifacts and logs were persisted so a retried `settle` only repeats `completeJob`. */
persisted?: boolean;
};
/** A finished job's object keeps its `done` state this long for late log readers and retried runner calls. */
export const PURGE_DELAY_MS = 15 * 60 * 1000;
export type LogRow = { seq: number; step: number; text: string };