import type { ServeOptions } from '../index.ts'; import { type Principal } from '../principal.ts'; import type { PendingTask } from '../task-queue-types.ts'; import type { ServerContext } from './context.ts'; /** The worker-facing identity of a long-poll claim: the synthetic worker id and its per-claim token. */ export interface LongPollClaim { workerId: string; attemptToken: string; } /** * Conditionally claim the durable `queued` ledger record for a task the * in-memory `TaskQueue` matched to a long-poll waiter. Returns `null` when * the claim loses — the ledger disagrees with the in-memory match hint, * meaning another actor already claimed or cancelled this operationId — in * which case the caller treats the poll as if nothing matched, per "index * disagreement never authorizes a state transition". * * Long-poll workers never call `WorkerRegistry.register()`, so there is no * manifest to build a `WorkerExecutionIdentity` from; the claim always omits * `executionIdentity` (see `RemoteTaskLeased.executionIdentity`'s doc * comment) rather than fabricate one. */ export declare function markTaskClaimedByLongPollWorker(context: ServerContext, options: ServeOptions, task: PendingTask): Promise; export declare function handleTaskPollRequest(context: ServerContext, options: ServeOptions, request: Request, url: URL, principal?: Principal): Promise; export declare function handleTaskResultRequest(context: ServerContext, options: ServeOptions, request: Request, url: URL, principal?: Principal): Promise;