type Fetcher = (url: string, options?: RequestInit) => Promise; export interface JobCheckpoint { step: number; source: "local" | "hub"; ref: string; } export interface PolicyConfigSummary { policy_type: string | null; image_features: Record; requires_task: boolean; } export async function listJobCheckpoints( baseUrl: string, fetcher: Fetcher, jobId: string, ): Promise { const r = await fetcher(`${baseUrl}/jobs/${jobId}/checkpoints`); if (!r.ok) { throw new Error(`List checkpoints failed: ${r.status}`); } const body = await r.json(); return body.checkpoints; } export async function getCheckpointPolicyConfig( baseUrl: string, fetcher: Fetcher, jobId: string, step: number, ): Promise { const r = await fetcher( `${baseUrl}/jobs/${jobId}/checkpoints/${step}/policy-config`, ); if (!r.ok) { throw new Error(`Load policy config failed: ${r.status}`); } return r.json(); }