import type { AuthorizationSubject, SignedGrant } from './authorization.js'; export type WorkloadState = 'CREATED' | 'READY' | 'CLAIMED' | 'RUNNING' | 'CHECKPOINTED' | 'RECOVERING' | 'CANCELLATION_REQUESTED' | 'SUCCEEDED' | 'FAILED' | 'CANCELLED' | 'TIMED_OUT' | 'DEAD_LETTER'; export interface WorkloadRetryPolicy { max_attempts: number; initial_delay_ms: number; max_delay_ms: number; backoff: 'fixed' | 'exponential'; retry_on: string[]; } export interface CreateWorkloadInput { tenant_id: string; application_id: string; environment: string; definition_id: string; definition_revision: string; trigger: string; input: unknown; requested_by: AuthorizationSubject; authorization_snapshot: SignedGrant; capability_snapshot: string[]; connection_scopes?: string[]; priority?: number; idempotency_key: string; retry_policy?: WorkloadRetryPolicy; timeouts?: Record; dependencies?: Array<{ workload_id: string; required_state?: WorkloadState; }>; /** Unix seconds before which no worker may claim this workload. Omit for work that is claimable as soon as it is READY. */ not_before?: number; created_at?: number; } export interface Workload { workload_id: string; tenant_id: string; application_id: string; definition_id: string; input: unknown; input_hash: string; priority: number; state: WorkloadState; attempt_count: number; retry_count: number; next_attempt_at?: number; last_failure?: string; current_claim?: WorkloadClaim; execution_history: unknown[]; attempts: unknown[]; checkpoints: unknown[]; result?: WorkloadResult; } export interface WorkloadClaim { claim_id: string; workload_id: string; worker_id: string; lease_id: string; fencing_token: number; claimed_at: number; expires_at: number; } export interface WorkloadResult { result_id: string; workload_id: string; attempt_id: string; status: string; output: unknown; output_hash: string; artifacts: string[]; produced_by: string; created_at: number; } export declare class WorkloadClient { private baseUrl; private fetcher; constructor(baseUrl?: string, fetcher?: typeof fetch); private json; create(input: CreateWorkloadInput): Promise; list(applicationId: string): Promise<{ workloads: Workload[]; }>; inspect(id: string): Promise; claim(id: string, input: { worker_id: string; lease_ms: number; grant: SignedGrant; }): Promise; start(id: string, fence: unknown): Promise; heartbeat(id: string, input: unknown): Promise; checkpoint(id: string, input: unknown): Promise; complete(id: string, input: unknown): Promise; fail(id: string, input: unknown): Promise<{ state: WorkloadState; }>; confirmCancelled(id: string, fence: unknown): Promise; executionContext(id: string, input: unknown): Promise; cancel(id: string, grant: SignedGrant): Promise<{ state: WorkloadState; }>; retry(id: string, grant: SignedGrant): Promise; history(id: string): Promise; result(id: string): Promise; } //# sourceMappingURL=workload.d.ts.map