/** * Build the durable task-ledger envelope a fresh dispatch would create if no * ledger record exists yet, and the fresh-dispatch admission checks * `dispatchTaskImpl` runs before that — split out of `task-dispatch.ts` * purely to stay under this repository's 500-line-per-file ceiling, matching * the existing `task-dispatch-revision.ts` precedent. There is no behavioral * reason to import this module directly instead of `task-dispatch.ts`, which * calls `buildCreateQueuedInput` from both `selectAndReserveWorker` and * `enqueueTaskForLongPoll`, and calls the admission helpers from * `dispatchTaskImpl` itself. * * @module server/runtime/task-dispatch-envelope */ import type { TaskDispatch } from '../index.ts'; import type { CreateQueuedInput } from '../task-ledger-transitions.ts'; import type { ServerContext } from './context.ts'; /** * Wait for startup task-ledger recovery (WFT-23) — covers both the public * `WeftServer.dispatchTask` entry point and `scheduleDelayedDispatch`'s timer * callback, which also calls `dispatchTaskImpl` directly. A rejected gate * means the recovery scan itself failed; propagate that failure loudly * rather than silently returning false, which callers would read as an * ordinary "no worker available" outcome. */ export declare function awaitTaskLedgerRecoveryReady(context: ServerContext, task: TaskDispatch): Promise; /** * Reject an invalid caller-supplied operationId before it reaches a ledger * write (WFT-95). `dispatchTask()` is a public same-process API taking a * caller-controlled operationId; an id equal to the exact string "." or * ".." can never be addressed again over REST (a single trailing * `:operationId` path segment is collapsed away by WHATWG URL path * normalization before the route matcher ever sees it), so fresh-dispatch * admission rejects it up front instead of writing a ledger record that * becomes unreachable by id. Skipped for `redispatch` — reconstructing and * redispatching an already-decoded, previously persisted ledger record * (`scheduleDelayedDispatch`/`taskDispatchFromLedgerRecord`) must not * re-apply an admission-only check to data that was valid when written. */ export declare function assertFreshDispatchOperationIdAdmissible(task: TaskDispatch, redispatch: boolean): void; /** The durable envelope every fresh dispatch would create if no ledger record exists yet. */ export declare function buildCreateQueuedInput(task: TaskDispatch, queue: string, visibilityTimeout: number): CreateQueuedInput;