import type { ApiPrincipal, ServerArtifact, ServerRunRecord, SkillsProductStore } from "../server/types.js"; import type { GovernanceStore, LifecycleReceipt } from "./governance-store.js"; import type { RunObjectStore } from "./outputs.js"; export interface CancelOutcome { run: ServerRunRecord; /** The generation the cancellation fenced. */ fencedGeneration: number; /** Artifacts moved to the quarantine prefix (or recorded for quarantine). */ quarantined: ServerArtifact[]; receipt: LifecycleReceipt; /** True when the run was already terminal and cancellation was a no-op. */ alreadyTerminal: boolean; } export interface CancelServiceOptions { store: SkillsProductStore; governanceStore: GovernanceStore; storage?: RunObjectStore; } export interface CancelService { cancel(principal: ApiPrincipal, runId: string, requestedBy: string): Promise; } /** * Build the cancel service. * * Requires a store that implements transitionRun (generation fencing). A store * without one cannot cancel safely - an unfenced cancel would let the worker's * late write move a cancelled run back to succeeded - so the service refuses * with FENCING_UNSUPPORTED rather than pretending. */ export declare function createCancelService(options: CancelServiceOptions): CancelService;