import type { BulkCancelWorkflowRunsResult, WorkflowRunStatus, World } from '@workflow/world'; export declare const BULK_CANCEL_MIN_LIMIT = 1; /** * Upper bound on `--limit`. * * 100 is what both read paths accept: the analytics runs listing caps there * and rejects more locally, and the storage listing it falls back to caps * there server-side. This advertised 500 and no backend ever served it, so * `--limit 200` failed however the command was routed. * * The bound is per status, and an unpinned `--status` fans out across * {@link CANCELLABLE_STATUSES}, so a batch can still exceed it before the * merged list is truncated to `limit`. */ export declare const BULK_CANCEL_MAX_LIMIT = 100; export declare const CLI_CANCEL_REASON = "Cancelled via Workflow CLI"; /** * Statuses a run can still be cancelled from. When the caller doesn't pin a * `--status`, bulk cancel restricts matching to these so terminal runs * (including the ones a prior batch just cancelled) don't crowd out reachable * active runs. Otherwise, listing every status returns the same newest * terminal page on each rerun and older active runs are never reached. The * list API filters by a single status, so we fan out across these and merge. */ export declare const CANCELLABLE_STATUSES: readonly ["pending", "running"]; /** * Guidance printed when more runs match the filters than were fetched. Bulk * cancel is deliberately single-batch and user-paced (no cursors or async * jobs), so the user re-runs to cancel the next batch. */ export declare const HAS_MORE_GUIDANCE: string; export interface CancelLogger { log(message: string): void; warn(message: string): void; error(message: string): void; } /** * Validate the `--limit` flag. Returns an error message when invalid, or * `undefined` when the value is an integer within * [{@link BULK_CANCEL_MIN_LIMIT}, {@link BULK_CANCEL_MAX_LIMIT}]. */ export declare function validateBulkCancelLimit(limit: number): string | undefined; /** * Build the compact multi-line "Done:" summary block. Lists every outcome * category so the counts add up to the number of runs requested; individual * `not_found`, `not_cancellable`, and `failed` runs are additionally surfaced * per-run via {@link bulkCancelFailureLines}. */ export declare function formatBulkCancelSummary(result: BulkCancelWorkflowRunsResult): string; /** * Per-run lines for outcomes worth calling out individually: `not_found`, * `not_cancellable`, and `failed`. Cancelled and already-cancelled runs are * left to the summary. */ export declare function bulkCancelFailureLines(result: BulkCancelWorkflowRunsResult): string[]; export interface BulkCancelParams { world: World; status?: WorkflowRunStatus; workflowName?: string; /** Max runs to fetch and cancel in this batch (already validated). */ limit: number; /** When true, skip the interactive confirmation prompt. */ confirm: boolean; logger: CancelLogger; /** * Confirmation prompt. Omitted in non-interactive contexts (and tests), * in which case an unconfirmed run aborts. */ promptConfirm?: (message: string) => Promise; } export interface BulkCancelOutcome { /** Process exit code: 1 when any run failed, otherwise 0. */ exitCode: number; /** The structured result, or undefined when nothing matched / aborted. */ result?: BulkCancelWorkflowRunsResult; } /** * Fetch matching runs (up to `limit`), confirm, and cancel them in a single * bulk operation. Prints a table of what will be cancelled, rerun guidance * when more runs match than were fetched, a compact summary, and per-run * lines for surfaced failures. * * Does not traverse pages: exactly one page of at most `limit` runs is * cancelled per invocation. */ export declare function performBulkCancel(params: BulkCancelParams): Promise; //# sourceMappingURL=bulk-cancel.d.ts.map