import { u as RequestOptions } from "./types-C3Egi37J.mjs"; //#region src/domains/cloud-v2/luau-execution-tasks/types.d.ts /** * Caller-supplied input for submitting a Luau Execution task against a * place's head version. Submitting against a specific place version uses * {@link SubmitAtVersionParameters} instead. * * @since 0.1.0 */ interface SubmitAtHeadParameters { /** * Resource path returned by `binaryInputs.create`, passed to the * server to attach a pre-uploaded binary to this task. */ readonly binaryInput?: string | undefined; /** When `true`, the server places the task output into a binary blob. */ readonly enableBinaryOutput?: boolean | undefined; /** Stringified ID of the place to run the script against. */ readonly placeId: string; /** Luau source to execute. */ readonly script: string; /** * Wall-clock limit in seconds. The task fails when the script does not * complete within this duration. Server default is 5 minutes. */ readonly timeoutSeconds?: number; /** Stringified ID of the universe that owns the place. */ readonly universeId: string; } /** * Caller-supplied input for submitting a Luau Execution task against a * specific place version. Submitting against the head version uses * {@link SubmitAtHeadParameters} instead. * * @since 0.1.0 */ interface SubmitAtVersionParameters { /** * Resource path returned by `binaryInputs.create`, passed to the * server to attach a pre-uploaded binary to this task. */ readonly binaryInput?: string | undefined; /** When `true`, the server places the task output into a binary blob. */ readonly enableBinaryOutput?: boolean | undefined; /** Stringified ID of the place to run the script against. */ readonly placeId: string; /** Luau source to execute. */ readonly script: string; /** * Wall-clock limit in seconds. The task fails when the script does not * complete within this duration. Server default is 5 minutes. */ readonly timeoutSeconds?: number; /** Stringified ID of the universe that owns the place. */ readonly universeId: string; /** Stringified ID of the place version the script targets. */ readonly versionId: string; } /** * Five-field reference to a Luau Execution session task. The parser * extracts this from any of the four x-aep-resource `path` formats * returned by the server, and the get builder consumes it to construct * the maximal GET URL. `versionId` and `sessionId` are `undefined` when * the response `path` did not include those segments. * * @since 0.1.0 */ interface LuauExecutionTaskRef { /** Stringified place ID. */ readonly placeId: string; /** Stringified luau-execution-session ID, when carried by the path. */ readonly sessionId?: string | undefined; /** Stringified luau-execution-session-task ID. */ readonly taskId: string; /** Stringified universe ID. */ readonly universeId: string; /** Stringified place version ID, when carried by the path. */ readonly versionId?: string | undefined; } /** * Caller-supplied input for fetching a Luau Execution task's current * state. * * @since 0.1.0 */ interface GetParameters { /** Reference to the task to fetch, typically returned by submit. */ readonly ref: LuauExecutionTaskRef; /** * View controls how much of the task body the server returns. The * server defaults to BASIC (excludes `script`) when no view is sent; * `FULL` includes every field. */ readonly view?: "BASIC" | "FULL"; } /** * Discriminated variant carrying every state in which the task has not * yet produced output or an error: queued for execution, currently * executing, or cancelled by the caller. `STATE_UNSPECIFIED` is the * schema's default enum value, surfaced verbatim when the server sends * it; pollers treat it as non-terminal. * * @since 0.1.0 */ interface InProgressTask extends LuauExecutionTaskBase { /** * Discriminator: the task is unspecified, queued, processing, or * cancelled. */ readonly state: "CANCELLED" | "PROCESSING" | "QUEUED" | "STATE_UNSPECIFIED"; } /** * Discriminated variant carrying the script's return values. The * server populates `output.results` with the Luau `return` values from * the script run, serialized as JSON; entries that were not * JSON-serializable (e.g., Roblox `Instance`s) appear as `null`. * * @since 0.1.0 */ interface CompleteTask extends LuauExecutionTaskBase { /** * JSON projection of the script's return values, in order. The total * serialized size of this array is bounded by the server-enforced * 4 MB output limit. */ readonly output: { readonly results: ReadonlyArray; }; /** Discriminator: the task ran to completion and produced output. */ readonly state: "COMPLETE"; } /** * Discriminated variant carrying the categorical error code and a * human-readable message describing the failure. `code` mirrors the * wire enum verbatim, including the schema's `ERROR_CODE_UNSPECIFIED` * default. * * @since 0.1.0 */ interface FailedTask extends LuauExecutionTaskBase { /** The categorical error code and message that caused the task to fail. */ readonly error: { /** * `SCRIPT_ERROR` for unhandled Luau errors, `DEADLINE_EXCEEDED` * when the script outran its timeout, `OUTPUT_SIZE_LIMIT_EXCEEDED` * when the return values exceeded 4 MB, or `INTERNAL_ERROR` for * server-side faults. `ERROR_CODE_UNSPECIFIED` is the schema's * default value, passed through when the server sends it. */ readonly code: "DEADLINE_EXCEEDED" | "ERROR_CODE_UNSPECIFIED" | "INTERNAL_ERROR" | "OUTPUT_SIZE_LIMIT_EXCEEDED" | "SCRIPT_ERROR"; /** Human-readable description of the failure. */ readonly message: string; }; /** Discriminator: the task ran but failed before producing output. */ readonly state: "FAILED"; } /** * Public, discriminated representation of a Luau Execution session * task. The variants are mutually exclusive on `state`. * * @since 0.1.0 */ type LuauExecutionTask = CompleteTask | FailedTask | InProgressTask; /** * Common fields surfaced on every {@link LuauExecutionTask} variant. * Variant-specific fields (`output` for COMPLETE, `error` for FAILED) * live on the variants themselves. */ interface LuauExecutionTaskBase { /** * Resource path of the binary input attached to this task, when one * was supplied at submit time. */ readonly binaryInput?: string | undefined; /** * Pre-signed URI from which the binary output blob can be downloaded. * Present only after a `COMPLETE` task whose `enableBinaryOutput` was * `true`. */ readonly binaryOutputUri?: string | undefined; /** * Timestamp when the task was created; `undefined` on tasks returned by * `submit`. */ readonly createdAt?: Date | undefined; /** When `true`, the server writes output to a binary blob. */ readonly enableBinaryOutput?: boolean | undefined; /** Round-trip-safe reference to this task. */ readonly ref: LuauExecutionTaskRef; /** * Wall-clock execution limit in seconds, as supplied at submit time. * Surfaces `undefined` when the request did not set a timeout (the * server applies its 5-minute default in that case). */ readonly timeoutSeconds?: number | undefined; /** * Timestamp of the most recent state change; `undefined` on tasks returned * by `submit`. */ readonly updatedAt?: Date | undefined; /** * Identifier of the user that owns the API key used to create this task. */ readonly user: string; } //#endregion //#region src/domains/cloud-v2/luau-execution-task-logs/types.d.ts /** * Caller-supplied input for listing the structured log messages produced * by a previously-submitted Luau execution task. * * @since 0.1.0 */ interface ListLogsParameters { /** * Maximum number of log messages to return per page. The server * clamps this to the range [1, 10000]. When omitted, the server * applies its own default page size. */ readonly pageSize?: number | undefined; /** * Opaque continuation token returned by the previous `listLogs` * call. Pass this to retrieve the next page of results. */ readonly pageToken?: string | undefined; /** Reference to the task whose logs are being listed. */ readonly ref: LuauExecutionTaskRef; } /** * A single structured log message produced by a Luau execution task. * The `createTime` field is a raw ISO timestamp string, not a * {@link Date}, so it can be serialized without conversion. * * @since 0.1.0 */ interface LogMessage { /** ISO timestamp when the log message was produced. */ readonly createTime: string; /** Human-readable log message text. */ readonly message: string; /** * Categorical message type, mirroring the wire enum verbatim. * `MESSAGE_TYPE_UNSPECIFIED` is the schema's default value, passed * through when the server sends it. */ readonly messageType: "ERROR" | "INFO" | "MESSAGE_TYPE_UNSPECIFIED" | "OUTPUT" | "WARNING"; } /** * One page of structured log messages from a Luau execution task. * Chunks are flattened by the parser; consumers see a single ordered * array. When `nextPageToken` is present, pass it to the next * `listLogs` call to retrieve the following page. * * @since 0.1.0 */ interface LogPage { /** Flattened, ordered list of log messages from this page. */ readonly messages: ReadonlyArray; /** * Opaque token for the next page of results. `undefined` when this * is the last page. */ readonly nextPageToken?: string | undefined; } //#endregion //#region src/resources/luau-execution/polling.d.ts /** * Default poll cadence as a function of elapsed wall-clock time since * polling began. Polls quickly while a task is young so short runs resolve * snappily, then eases off so a long run leaves rate-limit headroom for * newer tasks: 0-20s is 500ms, 20-60s is 1000ms, 60s+ is 5000ms. * * @since 0.1.0 * * @example * ```ts * import { defaultPollDelay } from "@bedrock-rbx/ocale/luau-execution"; * * expect(defaultPollDelay(0)).toBe(500); * expect(defaultPollDelay(30_000)).toBe(1000); * expect(defaultPollDelay(120_000)).toBe(5000); * ``` * * @param elapsedMs - Milliseconds elapsed since polling started. * @returns The delay in milliseconds to wait before the next poll. */ declare function defaultPollDelay(elapsedMs: number): number; /** * Public options accepted by `pollUntilDone` and `runUntilDone` on both client * surfaces. * * @since 0.1.0 */ type PollUntilDoneOptions = PollOptions & RequestOptions; /** Caller-supplied polling-loop options; all fields optional. */ interface PollOptions { /** * Consecutive transient transport failures tolerated before the loop gives * up. Defaults to {@link DEFAULT_POLL_FAILURE_CAP}. A successful poll * resets the count. */ readonly maxConsecutivePollFailures?: number; /** * Returns the sleep duration given ms elapsed since polling started. * Defaults to {@link defaultPollDelay}. */ readonly pollDelay?: (elapsedMs: number) => number; /** * When aborted, the loop returns {@link PollAbortedError} rather than * continuing. */ readonly signal?: AbortSignal; /** * Total wall-clock budget in ms before the loop returns {@link * PollTimeoutError}. */ readonly timeoutMs?: number; } /** * Defaults the per-request `timeout` to the effective poll budget when the * caller has not set one. A luau-execution submit and each poll `get` normally * answer in well under a second (the submit endpoint enqueues the task without * waiting for it to run), so the only job of a per-request deadline here is to * bound a black-hole connection. Leaving these requests on the client-wide 30s * default (tuned for snappy CRUD) turns a slow-but-alive backend into a * self-abort, an error the retry layer never retries by construction, before * the loop's wall-clock budget is ever consulted. Deriving the deadline from * `timeoutMs` keeps a single request alive exactly as long as the caller * already agreed to wait for the whole operation, so the backend can answer or * surface a retryable status instead. * * @template TOptions - The concrete polling option shape to preserve. * @param options - The caller's poll and per-request options. * @returns The options with `timeout` filled from the budget when it was unset. */ //#endregion //#region src/resources/luau-execution/capacity-admission.d.ts /** * Per-request options for submitting a Luau execution task. * * @example * * ```ts * import type { LuauExecutionSubmitOptions } from "@bedrock-rbx/ocale/luau-execution"; * * const options: LuauExecutionSubmitOptions = { capacityWaitMs: 60_000 }; * expect(options.capacityWaitMs).toBe(60_000); * ``` * * @since 0.3.2 */ interface LuauExecutionSubmitOptions extends RequestOptions { /** * Maximum milliseconds to spend waiting for occupied place capacity, from 1 * through 2,147,483,647. Supplying this value opts the submission into * capacity-aware admission. */ readonly capacityWaitMs?: number; } /** * Per-request capacity and polling options for submitting and awaiting a Luau * execution task. * * @since 0.3.2 */ type LuauExecutionRunOptions = LuauExecutionSubmitOptions & PollUntilDoneOptions; //#endregion export { ListLogsParameters as a, CompleteTask as c, InProgressTask as d, LuauExecutionTask as f, SubmitAtVersionParameters as h, defaultPollDelay as i, FailedTask as l, SubmitAtHeadParameters as m, LuauExecutionSubmitOptions as n, LogMessage as o, LuauExecutionTaskRef as p, PollUntilDoneOptions as r, LogPage as s, LuauExecutionRunOptions as t, GetParameters as u }; //# sourceMappingURL=capacity-admission-BvnJjY0S.d.mts.map