import type { Duration } from './types.ts'; import { WeftError } from './weft-error.ts'; export declare const MAX_WORKFLOW_TAGS = 32; export declare const MAX_WORKFLOW_TAG_BYTES = 128; /** * Upper bound on a start `idempotencyKey`, in UTF-8 bytes. `startOrSignal` * derives a signal id of `start-idem:${key}` (an 11-byte prefix) from the key, * and `validateSignalId` caps a signal id at 128 bytes — so the raw key must fit * in `128 - 11 = 117` bytes for the derived id to stay within that ceiling. */ export declare const MAX_IDEMPOTENCY_KEY_BYTES = 117; export declare class StartWorkflowValidationError extends WeftError<'StartWorkflowValidationError'> { constructor(message: string); } export declare const assertExclusiveStartWorkflowOptions: (startAt: unknown, startAfter: unknown) => void; export declare const coerceStartWorkflowId: (value: unknown, fieldName: string) => string; /** * Coerce a caller-supplied `options.id` for an internal REPLAY of a start * that was already accepted once before (WFT-95). Deliberately uses the * decode-compatible {@link assertDecodableWorkflowId}, not the strict * `.`/`..`-rejecting {@link assertValidWorkflowId} that * {@link coerceStartWorkflowId} enforces: this path exists only for the three * internal callers that replay an id which was already durably admitted * before strict admission existed (a drained schedule queued-run, a bulk * failed-workflow retry rebuilding from persisted input, or a child-workflow * crash-reattach) — see `startWorkflow`'s `skipAdmissionIdCheck` parameter. * It must never be reachable from a public start surface (REST, JSON-RPC, * `engine.start`, `ctx.startChild`), because that would let a genuinely * fresh caller admit `.`/`..` again. */ export declare const coerceReplayWorkflowId: (value: unknown, fieldName: string) => string; /** * Coerce a transport-supplied idempotency key to a non-empty string. The key is * a caller-chosen dedup token (it becomes part of a `start-idem:` storage key), * so an empty string — which would collide across unrelated starts — is rejected. */ export declare const coerceStartWorkflowIdempotencyKey: (value: unknown, fieldName: string) => string; /** * Validate an already-string `idempotencyKey`: non-empty (an empty key would * collide across unrelated starts under the shared `start-idem:` mapping) and at * most {@link MAX_IDEMPOTENCY_KEY_BYTES} UTF-8 bytes (so the derived * `start-idem:${key}` signal id stays within the signal-id ceiling). Shared by * the transport coercion and the engine boundary so a direct `engine.start` * caller gets the same guarantees as an HTTP caller. */ export declare const assertValidIdempotencyKey: (value: string, fieldName: string) => string; /** * Validate the `onTerminalConflict` start policy against the rest of the start * options. `'error'` (the default) and `'start-new'` are the only accepted * values. `'start-new'` (Temporal's `ALLOW_DUPLICATE` for terminal runs) requires * an explicit, caller-chosen `id` and is mutually exclusive with `idempotencyKey`: * idempotency is a permanent at-most-once mapping that survives terminal state, so * restarting under it would contradict that contract. A generated UUID is never a * meaningful restart target, hence the explicit-`id` requirement. */ export declare function assertValidOnTerminalConflict(options: { onTerminalConflict?: unknown; id?: unknown; idempotencyKey?: unknown; } | undefined): void; /** * `options.id` and `options.idempotencyKey` are mutually exclusive: idempotency * assigns its own generated workflow id and dedups through the key, so pinning a * caller id alongside it conflates "id already taken" with "lost the idempotency * race". Reject the combination so each concern stays separable. Shared by the * plain idempotent-start path and `startOrSignal` convergence validation. */ export declare function assertIdAndIdempotencyKeyExclusive(options: { id?: unknown; idempotencyKey?: unknown; }): void; /** * Reject `onTerminalConflict` on a start surface that does not support it * (`ctx.startChild`). The option is type-absent from those surfaces, but a * transport or untyped JS caller could still smuggle the field into the options * object — this is the runtime backstop. Child starts reattach by id during * parent replay, so purging a terminal child mid-replay would break determinism. */ export declare function assertOnTerminalConflictUnsupported(options: object | undefined, surface: string): void; export declare function coerceStartWorkflowTimestamp(value: unknown, fieldName: string): number; export declare function parseStartWorkflowDuration(duration: Duration, fieldName: string): number; export declare function coerceStartWorkflowDuration(value: unknown, fieldName: string): Duration; export declare function assertWorkflowTagCount(tags: readonly unknown[], fieldName: string): void; export declare function coerceStartWorkflowTags(value: unknown, fieldName: string): string[];