import type { ContextOperationRequest } from '../context.ts'; import type { EngineInternals } from './internals.ts'; type ActivityOperation = Extract; /** * Resolve the per-attempt `timeout` setup for an activity attempt (#494). * * The cap is INLINE-only: worker-mode per-attempt bounds are governed by * `visibilityTimeout`, and racing the engine's await against a deadline while a * remote worker keeps running would orphan its result and risk double-execution on * the next visibility-timeout re-dispatch. When a cap is configured, a fresh * per-attempt `AbortController` drives cooperative cancellation; its signal is * composited with the workflow-wide signal so the activity's `ctx.signal` aborts on * EITHER workflow cancellation OR a per-attempt timeout — without the timeout * reaching back to cancel the whole workflow (which would also poison the next * retry's signal). * * An optional `coordinatorSignal` (from a `ctx.race` or `ctx.all` coordinator) * is also composed in (#584): when a sibling branch wins the race, the coordinator * aborts its controller, propagating to the activity's `ctx.signal` for * cooperative cancellation of losing activity branches. */ export declare function resolvePerAttemptTimeout(internals: EngineInternals, workflowId: string, operation: ActivityOperation, coordinatorSignal?: AbortSignal): { perAttemptTimeoutMs: number | undefined; attemptAbortController: AbortController | undefined; activitySignal: AbortSignal; }; /** * Bound a single inline activity attempt by its per-attempt `timeout` (#494). * * When `timeoutMs` is set and the attempt does not settle first, the returned * promise rejects with {@link ActivityPerAttemptTimeoutError} and the per-attempt * `AbortController` is aborted with that same error — so the activity's composite * `ctx.signal` flips, letting a cooperating activity stop promptly. Weft cannot * forcibly preempt the activity function: a non-cooperating activity keeps running * in the background until it returns; only the workflow stops awaiting it. The * abandoned invocation's eventual settlement is swallowed so it never surfaces as * an unhandled rejection after the race has moved on. The timed-out rejection * flows through the normal retry path, so a retry policy gets a fresh attempt with * a fresh cap (and a fresh per-attempt controller). * * Returns the invocation unchanged (no timer armed) when no cap is configured. */ export declare function withPerAttemptTimeout(invocation: unknown, timeoutMs: number | undefined, activityName: string, attempt: number, attemptAbortController: AbortController | undefined): Promise; export {};