@bedrock-rbx/ocale 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +9 -5
  2. package/dist/badge-cost-mismatch-DrlvhlQc.mjs +47 -0
  3. package/dist/badge-cost-mismatch-DrlvhlQc.mjs.map +1 -0
  4. package/dist/badges.d.mts +228 -184
  5. package/dist/badges.d.mts.map +1 -1
  6. package/dist/badges.mjs +176 -18
  7. package/dist/badges.mjs.map +1 -1
  8. package/dist/capacity-admission-hycCFkTo.d.mts +355 -0
  9. package/dist/capacity-admission-hycCFkTo.d.mts.map +1 -0
  10. package/dist/{data.generated-B2ceLfSn.d.mts → data.generated-D_vpa5-g.d.mts} +23 -23
  11. package/dist/data.generated-D_vpa5-g.d.mts.map +1 -0
  12. package/dist/developer-products.d.mts +181 -186
  13. package/dist/developer-products.d.mts.map +1 -1
  14. package/dist/developer-products.mjs +24 -24
  15. package/dist/developer-products.mjs.map +1 -1
  16. package/dist/game-passes.d.mts +206 -203
  17. package/dist/game-passes.d.mts.map +1 -1
  18. package/dist/game-passes.mjs +26 -21
  19. package/dist/game-passes.mjs.map +1 -1
  20. package/dist/index.d.mts +905 -343
  21. package/dist/index.d.mts.map +1 -1
  22. package/dist/index.mjs +325 -10
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/locales.d.mts +30 -2
  25. package/dist/locales.d.mts.map +1 -0
  26. package/dist/locales.mjs +24 -1
  27. package/dist/locales.mjs.map +1 -1
  28. package/dist/luau-execution.d.mts +154 -151
  29. package/dist/luau-execution.d.mts.map +1 -1
  30. package/dist/luau-execution.mjs +11 -8
  31. package/dist/luau-execution.mjs.map +1 -1
  32. package/dist/{network-error-DR9FX5hb.mjs → network-error-iVSng5MT.mjs} +44 -6
  33. package/dist/network-error-iVSng5MT.mjs.map +1 -0
  34. package/dist/places.d.mts +204 -180
  35. package/dist/places.d.mts.map +1 -1
  36. package/dist/places.mjs +66 -20
  37. package/dist/places.mjs.map +1 -1
  38. package/dist/{poll-timeout-3PXLsabj.mjs → poll-timeout-DzztDymd.mjs} +2 -2
  39. package/dist/{poll-timeout-3PXLsabj.mjs.map → poll-timeout-DzztDymd.mjs.map} +1 -1
  40. package/dist/{polling-helpers-CoVhsC33.mjs → polling-helpers-DfF5dspc.mjs} +249 -83
  41. package/dist/polling-helpers-DfF5dspc.mjs.map +1 -0
  42. package/dist/{price-information-B0tkOoAX.mjs → price-information-DEkEQ8Pq.mjs} +2 -2
  43. package/dist/{price-information-B0tkOoAX.mjs.map → price-information-DEkEQ8Pq.mjs.map} +1 -1
  44. package/dist/resource-client-BCKukheG.d.mts +168 -0
  45. package/dist/resource-client-BCKukheG.d.mts.map +1 -0
  46. package/dist/{resource-client-rqTMkBeR.mjs → resource-client-CaIVr-go.mjs} +586 -158
  47. package/dist/resource-client-CaIVr-go.mjs.map +1 -0
  48. package/dist/retry-C2oHesDx.d.mts +229 -0
  49. package/dist/retry-C2oHesDx.d.mts.map +1 -0
  50. package/dist/{retry-BlX4tUnT.mjs → retry-CMRDvAR4.mjs} +278 -18
  51. package/dist/retry-CMRDvAR4.mjs.map +1 -0
  52. package/dist/storage.d.mts +333 -334
  53. package/dist/storage.d.mts.map +1 -1
  54. package/dist/storage.mjs +29 -22
  55. package/dist/storage.mjs.map +1 -1
  56. package/dist/testing.d.mts +347 -360
  57. package/dist/testing.d.mts.map +1 -1
  58. package/dist/testing.mjs +3 -4
  59. package/dist/testing.mjs.map +1 -1
  60. package/dist/types-CdMr_J1M.d.mts +509 -0
  61. package/dist/types-CdMr_J1M.d.mts.map +1 -0
  62. package/dist/universes.d.mts +619 -422
  63. package/dist/universes.d.mts.map +1 -1
  64. package/dist/universes.mjs +421 -48
  65. package/dist/universes.mjs.map +1 -1
  66. package/dist/{validation-B_Zs1So2.mjs → validation-964VNlbp.mjs} +2 -2
  67. package/dist/{validation-B_Zs1So2.mjs.map → validation-964VNlbp.mjs.map} +1 -1
  68. package/dist/wire-DJqupefn.d.mts +41 -0
  69. package/dist/wire-DJqupefn.d.mts.map +1 -0
  70. package/package.json +14 -14
  71. package/dist/capacity-admission-IDO3fcUC.d.mts +0 -369
  72. package/dist/capacity-admission-IDO3fcUC.d.mts.map +0 -1
  73. package/dist/data.generated-B2ceLfSn.d.mts.map +0 -1
  74. package/dist/network-error-DR9FX5hb.mjs.map +0 -1
  75. package/dist/polling-helpers-CoVhsC33.mjs.map +0 -1
  76. package/dist/resource-client-B6NeFXUv.d.mts +0 -164
  77. package/dist/resource-client-B6NeFXUv.d.mts.map +0 -1
  78. package/dist/resource-client-rqTMkBeR.mjs.map +0 -1
  79. package/dist/retry-BlX4tUnT.mjs.map +0 -1
  80. package/dist/retry-war_-9tb.d.mts +0 -373
  81. package/dist/retry-war_-9tb.d.mts.map +0 -1
  82. package/dist/types-CvYh4SPC.d.mts +0 -386
  83. package/dist/types-CvYh4SPC.d.mts.map +0 -1
  84. package/dist/wire-D3K-a-UP.d.mts +0 -37
  85. package/dist/wire-D3K-a-UP.d.mts.map +0 -1
@@ -1,369 +0,0 @@
1
- import { u as RequestOptions } from "./types-CvYh4SPC.mjs";
2
-
3
- //#region src/domains/cloud-v2/luau-execution-tasks/types.d.ts
4
- /**
5
- * Caller-supplied input for submitting a Luau Execution task against a
6
- * place's head version. Submitting against a specific place version uses
7
- * {@link SubmitAtVersionParameters} instead.
8
- *
9
- * @since 0.1.0
10
- */
11
- interface SubmitAtHeadParameters {
12
- /**
13
- * Resource path returned by `binaryInputs.create`, passed to the
14
- * server to attach a pre-uploaded binary to this task.
15
- */
16
- readonly binaryInput?: string | undefined;
17
- /** When `true`, the server places the task output into a binary blob. */
18
- readonly enableBinaryOutput?: boolean | undefined;
19
- /** Stringified ID of the place to run the script against. */
20
- readonly placeId: string;
21
- /** Luau source to execute. */
22
- readonly script: string;
23
- /**
24
- * Wall-clock limit in seconds. The task fails when the script does not
25
- * complete within this duration. Server default is 5 minutes.
26
- */
27
- readonly timeoutSeconds?: number;
28
- /** Stringified ID of the universe that owns the place. */
29
- readonly universeId: string;
30
- }
31
- /**
32
- * Caller-supplied input for submitting a Luau Execution task against a
33
- * specific place version. Submitting against the head version uses
34
- * {@link SubmitAtHeadParameters} instead.
35
- *
36
- * @since 0.1.0
37
- */
38
- interface SubmitAtVersionParameters {
39
- /**
40
- * Resource path returned by `binaryInputs.create`, passed to the
41
- * server to attach a pre-uploaded binary to this task.
42
- */
43
- readonly binaryInput?: string | undefined;
44
- /** When `true`, the server places the task output into a binary blob. */
45
- readonly enableBinaryOutput?: boolean | undefined;
46
- /** Stringified ID of the place to run the script against. */
47
- readonly placeId: string;
48
- /** Luau source to execute. */
49
- readonly script: string;
50
- /**
51
- * Wall-clock limit in seconds. The task fails when the script does not
52
- * complete within this duration. Server default is 5 minutes.
53
- */
54
- readonly timeoutSeconds?: number;
55
- /** Stringified ID of the universe that owns the place. */
56
- readonly universeId: string;
57
- /** Stringified ID of the place version the script targets. */
58
- readonly versionId: string;
59
- }
60
- /**
61
- * Five-field reference to a Luau Execution session task. The parser
62
- * extracts this from any of the four x-aep-resource `path` formats
63
- * returned by the server, and the get builder consumes it to construct
64
- * the maximal GET URL. `versionId` and `sessionId` are `undefined` when
65
- * the response `path` did not include those segments.
66
- *
67
- * @since 0.1.0
68
- */
69
- interface LuauExecutionTaskRef {
70
- /** Stringified place ID. */
71
- readonly placeId: string;
72
- /** Stringified luau-execution-session ID, when carried by the path. */
73
- readonly sessionId?: string | undefined;
74
- /** Stringified luau-execution-session-task ID. */
75
- readonly taskId: string;
76
- /** Stringified universe ID. */
77
- readonly universeId: string;
78
- /** Stringified place version ID, when carried by the path. */
79
- readonly versionId?: string | undefined;
80
- }
81
- /**
82
- * Caller-supplied input for fetching a Luau Execution task's current
83
- * state.
84
- *
85
- * @since 0.1.0
86
- */
87
- interface GetParameters {
88
- /** Reference to the task to fetch, typically returned by submit. */
89
- readonly ref: LuauExecutionTaskRef;
90
- /**
91
- * View controls how much of the task body the server returns. The
92
- * server defaults to BASIC (excludes `script`) when no view is sent;
93
- * `FULL` includes every field.
94
- */
95
- readonly view?: "BASIC" | "FULL";
96
- }
97
- /**
98
- * Discriminated variant carrying every state in which the task has not
99
- * yet produced output or an error: queued for execution, currently
100
- * executing, or cancelled by the caller. `STATE_UNSPECIFIED` is the
101
- * schema's default enum value, surfaced verbatim when the server sends
102
- * it; pollers treat it as non-terminal.
103
- *
104
- * @since 0.1.0
105
- */
106
- interface InProgressTask extends LuauExecutionTaskBase {
107
- /**
108
- * Discriminator: the task is unspecified, queued, processing, or
109
- * cancelled.
110
- */
111
- readonly state: "CANCELLED" | "PROCESSING" | "QUEUED" | "STATE_UNSPECIFIED";
112
- }
113
- /**
114
- * Discriminated variant carrying the script's return values. The
115
- * server populates `output.results` with the Luau `return` values from
116
- * the script run, serialized as JSON; entries that were not
117
- * JSON-serializable (e.g., Roblox `Instance`s) appear as `null`.
118
- *
119
- * @since 0.1.0
120
- */
121
- interface CompleteTask extends LuauExecutionTaskBase {
122
- /**
123
- * JSON projection of the script's return values, in order. The total
124
- * serialized size of this array is bounded by the server-enforced
125
- * 4 MB output limit.
126
- */
127
- readonly output: {
128
- readonly results: ReadonlyArray<JSONValue>;
129
- };
130
- /** Discriminator: the task ran to completion and produced output. */
131
- readonly state: "COMPLETE";
132
- }
133
- /**
134
- * Discriminated variant carrying the categorical error code and a
135
- * human-readable message describing the failure. `code` mirrors the
136
- * wire enum verbatim, including the schema's `ERROR_CODE_UNSPECIFIED`
137
- * default.
138
- *
139
- * @since 0.1.0
140
- */
141
- interface FailedTask extends LuauExecutionTaskBase {
142
- /** The categorical error code and message that caused the task to fail. */
143
- readonly error: {
144
- /**
145
- * `SCRIPT_ERROR` for unhandled Luau errors, `DEADLINE_EXCEEDED`
146
- * when the script outran its timeout, `OUTPUT_SIZE_LIMIT_EXCEEDED`
147
- * when the return values exceeded 4 MB, or `INTERNAL_ERROR` for
148
- * server-side faults. `ERROR_CODE_UNSPECIFIED` is the schema's
149
- * default value, passed through when the server sends it.
150
- */
151
- readonly code: "DEADLINE_EXCEEDED" | "ERROR_CODE_UNSPECIFIED" | "INTERNAL_ERROR" | "OUTPUT_SIZE_LIMIT_EXCEEDED" | "SCRIPT_ERROR"; /** Human-readable description of the failure. */
152
- readonly message: string;
153
- };
154
- /** Discriminator: the task ran but failed before producing output. */
155
- readonly state: "FAILED";
156
- }
157
- /**
158
- * Public, discriminated representation of a Luau Execution session
159
- * task. The variants are mutually exclusive on `state`.
160
- *
161
- * @since 0.1.0
162
- */
163
- type LuauExecutionTask = CompleteTask | FailedTask | InProgressTask;
164
- /**
165
- * Common fields surfaced on every {@link LuauExecutionTask} variant.
166
- * Variant-specific fields (`output` for COMPLETE, `error` for FAILED)
167
- * live on the variants themselves.
168
- */
169
- interface LuauExecutionTaskBase {
170
- /**
171
- * Resource path of the binary input attached to this task, when one
172
- * was supplied at submit time.
173
- */
174
- readonly binaryInput?: string | undefined;
175
- /**
176
- * Pre-signed URI from which the binary output blob can be downloaded.
177
- * Present only after a `COMPLETE` task whose `enableBinaryOutput` was
178
- * `true`.
179
- */
180
- readonly binaryOutputUri?: string | undefined;
181
- /**
182
- * Timestamp when the task was created; `undefined` on tasks returned by
183
- * `submit`.
184
- */
185
- readonly createdAt?: Date | undefined;
186
- /** When `true`, the server writes output to a binary blob. */
187
- readonly enableBinaryOutput?: boolean | undefined;
188
- /** Round-trip-safe reference to this task. */
189
- readonly ref: LuauExecutionTaskRef;
190
- /**
191
- * Wall-clock execution limit in seconds, as supplied at submit time.
192
- * Surfaces `undefined` when the request did not set a timeout (the
193
- * server applies its 5-minute default in that case).
194
- */
195
- readonly timeoutSeconds?: number | undefined;
196
- /**
197
- * Timestamp of the most recent state change; `undefined` on tasks returned
198
- * by `submit`.
199
- */
200
- readonly updatedAt?: Date | undefined;
201
- /**
202
- * Identifier of the user that owns the API key used to create this task.
203
- */
204
- readonly user: string;
205
- }
206
- //#endregion
207
- //#region src/domains/cloud-v2/luau-execution-task-logs/types.d.ts
208
- /**
209
- * Caller-supplied input for listing the structured log messages produced
210
- * by a previously-submitted Luau execution task.
211
- *
212
- * @since 0.1.0
213
- */
214
- interface ListLogsParameters {
215
- /**
216
- * Maximum number of log messages to return per page. The server
217
- * clamps this to the range [1, 10000]. When omitted, the server
218
- * applies its own default page size.
219
- */
220
- readonly pageSize?: number | undefined;
221
- /**
222
- * Opaque continuation token returned by the previous `listLogs`
223
- * call. Pass this to retrieve the next page of results.
224
- */
225
- readonly pageToken?: string | undefined;
226
- /** Reference to the task whose logs are being listed. */
227
- readonly ref: LuauExecutionTaskRef;
228
- }
229
- /**
230
- * A single structured log message produced by a Luau execution task.
231
- * The `createTime` field is a raw ISO timestamp string, not a
232
- * {@link Date}, so it can be serialized without conversion.
233
- *
234
- * @since 0.1.0
235
- */
236
- interface LogMessage {
237
- /** ISO timestamp when the log message was produced. */
238
- readonly createTime: string;
239
- /** Human-readable log message text. */
240
- readonly message: string;
241
- /**
242
- * Categorical message type, mirroring the wire enum verbatim.
243
- * `MESSAGE_TYPE_UNSPECIFIED` is the schema's default value, passed
244
- * through when the server sends it.
245
- */
246
- readonly messageType: "ERROR" | "INFO" | "MESSAGE_TYPE_UNSPECIFIED" | "OUTPUT" | "WARNING";
247
- }
248
- /**
249
- * One page of structured log messages from a Luau execution task.
250
- * Chunks are flattened by the parser; consumers see a single ordered
251
- * array. When `nextPageToken` is present, pass it to the next
252
- * `listLogs` call to retrieve the following page.
253
- *
254
- * @since 0.1.0
255
- */
256
- interface LogPage {
257
- /** Flattened, ordered list of log messages from this page. */
258
- readonly messages: ReadonlyArray<LogMessage>;
259
- /**
260
- * Opaque token for the next page of results. `undefined` when this
261
- * is the last page.
262
- */
263
- readonly nextPageToken?: string | undefined;
264
- }
265
- //#endregion
266
- //#region src/resources/luau-execution/polling.d.ts
267
- /**
268
- * Default poll cadence as a function of elapsed wall-clock time since
269
- * polling began. Polls quickly while a task is young so short runs resolve
270
- * snappily, then eases off so a long run leaves rate-limit headroom for
271
- * newer tasks: 0-20s is 500ms, 20-60s is 1000ms, 60s+ is 5000ms.
272
- *
273
- * @since 0.1.0
274
- *
275
- * @example
276
- * ```ts
277
- * import { defaultPollDelay } from "@bedrock-rbx/ocale/luau-execution";
278
- *
279
- * expect(defaultPollDelay(0)).toBe(500);
280
- * expect(defaultPollDelay(30_000)).toBe(1000);
281
- * expect(defaultPollDelay(120_000)).toBe(5000);
282
- * ```
283
- *
284
- * @param elapsedMs - Milliseconds elapsed since polling started.
285
- * @returns The delay in milliseconds to wait before the next poll.
286
- */
287
- declare function defaultPollDelay(elapsedMs: number): number;
288
- /**
289
- * Public options accepted by `pollUntilDone` and `runUntilDone` on both client
290
- * surfaces.
291
- *
292
- * @since 0.1.0
293
- */
294
- type PollUntilDoneOptions = PollOptions & RequestOptions;
295
- /** Caller-supplied polling-loop options; all fields optional. */
296
- interface PollOptions {
297
- /**
298
- * Consecutive transient transport failures tolerated before the loop gives
299
- * up. Defaults to {@link DEFAULT_POLL_FAILURE_CAP}. A successful poll
300
- * resets the count.
301
- */
302
- readonly maxConsecutivePollFailures?: number;
303
- /**
304
- * Returns the sleep duration given ms elapsed since polling started.
305
- * Defaults to {@link defaultPollDelay}.
306
- */
307
- readonly pollDelay?: (elapsedMs: number) => number;
308
- /**
309
- * When aborted, the loop returns {@link PollAbortedError} rather than
310
- * continuing.
311
- */
312
- readonly signal?: AbortSignal;
313
- /**
314
- * Total wall-clock budget in ms before the loop returns {@link
315
- * PollTimeoutError}.
316
- */
317
- readonly timeoutMs?: number;
318
- }
319
- /**
320
- * Defaults the per-request `timeout` to the effective poll budget when the
321
- * caller has not set one. A luau-execution submit and each poll `get` normally
322
- * answer in well under a second (the submit endpoint enqueues the task without
323
- * waiting for it to run), so the only job of a per-request deadline here is to
324
- * bound a black-hole connection. Leaving these requests on the client-wide 30s
325
- * default (tuned for snappy CRUD) turns a slow-but-alive backend into a
326
- * self-abort, an error the retry layer never retries by construction, before
327
- * the loop's wall-clock budget is ever consulted. Deriving the deadline from
328
- * `timeoutMs` keeps a single request alive exactly as long as the caller
329
- * already agreed to wait for the whole operation, so the backend can answer or
330
- * surface a retryable status instead.
331
- *
332
- * @template TOptions - The concrete polling option shape to preserve.
333
- * @param options - The caller's poll and per-request options.
334
- * @returns The options with `timeout` filled from the budget when it was unset.
335
- */
336
- //#endregion
337
- //#region src/resources/luau-execution/capacity-admission.d.ts
338
- /**
339
- * Per-request options for submitting a Luau execution task.
340
- *
341
- * @example
342
- *
343
- * ```ts
344
- * import type { LuauExecutionSubmitOptions } from "@bedrock-rbx/ocale/luau-execution";
345
- *
346
- * const options: LuauExecutionSubmitOptions = { capacityWaitMs: 60_000 };
347
- * expect(options.capacityWaitMs).toBe(60_000);
348
- * ```
349
- *
350
- * @since 0.3.2
351
- */
352
- interface LuauExecutionSubmitOptions extends RequestOptions {
353
- /**
354
- * Maximum milliseconds to spend waiting for occupied place capacity, from 1
355
- * through 2,147,483,647. Supplying this value opts the submission into
356
- * capacity-aware admission.
357
- */
358
- readonly capacityWaitMs?: number;
359
- }
360
- /**
361
- * Per-request capacity and polling options for submitting and awaiting a Luau
362
- * execution task.
363
- *
364
- * @since 0.3.2
365
- */
366
- type LuauExecutionRunOptions = LuauExecutionSubmitOptions & PollUntilDoneOptions;
367
- //#endregion
368
- 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 };
369
- //# sourceMappingURL=capacity-admission-IDO3fcUC.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capacity-admission-IDO3fcUC.d.mts","names":[],"sources":["../src/domains/cloud-v2/luau-execution-tasks/types.ts","../src/domains/cloud-v2/luau-execution-task-logs/types.ts","../src/resources/luau-execution/polling.ts","../src/resources/luau-execution/capacity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AAA;EAAA,SACA,0BAAA;AAAA;EAAA,SAGA,MAAA;EAAA,SACA,YAAA;EAAA,SACA,IAAA;EAAA,SACA,UAAA;EAAA,SACA,aAAA;EAAA,SACA,0BAAA;EAAA,SACA,qBAAA;EAAA,SACA,0BAAA;AAAA;EAAA,SAGA,MAAA;EAAA,SACA,YAAA;EAAA,SACA,IAAA;EAAA,SACA,UAAA;EAAA,SACA,aAAA;EAAA,SACA,0BAAA;EAAA,SACA,qBAAA;EAAA,SACA,0BAAA;AAAA;EAAA,SAGA,MAAA;EAAA,SACA,YAAA;EAAA,SACA,IAAA;EAAA,SACA,UAAA;EAAA,SACA,aAAA;EAAA,SACA,0BAAA;EAAA,SACA,qBAAA;EAAA,SACA,0BAAA;AAAA;EAAA,SAGA,MAAA;EAAA,SACA,YAAA;EAAA,SACA,IAAA;EAAA,SACA,UAAA;EAAA,SACA,aAAA;EAAA,SACA,0BAAA;EAAA,SACA,qBAAA;EAAA,SACA,0BAAA;AAAA;EAAA,SAGA,MAAA;EAAA,SACA,YAAA;EAAA,SACA,IAAA;EAAA,SACA,UAAA;EAAA,SACA,aAAA;EAAA,SACA,0BAAA;EAAA,SACA,qBAAA;EAAA,SACA,0BAAA;AAAA;EAAA,SAGA,MAAA;EAAA,SACA,YAAA;EAAA,SACA,IAAA;EAAA,SACA,UAAA;EAAA,SACA,aAAA;EAAA,SACA,0BAAA;EAAA,SACA,qBAAA;EAAA,SACA,0BAAA;AAAA;EAAA,SAGA,MAAA;EAAA,SACA,YAAA;EAAA,SACA,IAAA;EAAA,SACA,UAAA;EAAA,SACA,aAAA;EAAA,SACA,0BAAA;EAAA,SACA,qBAAA;EAAA,SACA,0BAAA;AAAA;;;;;;;;KAWU,YAAA,WAAuB,sBAAA;;;;;;;;KASvB,kBAAA,WAA6B,sBAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"network-error-DR9FX5hb.mjs","names":[],"sources":["../src/errors/base.ts","../src/errors/api-error.ts","../src/errors/rate-limit.ts","../src/errors/network-error.ts"],"sourcesContent":["/**\n * Options for constructing an {@link OpenCloudError}.\n *\n * @since 0.3.0\n */\nexport interface OpenCloudErrorOptions extends ErrorOptions {\n\t/**\n\t * Machine-readable classifier for the failure, when the error has one. An\n\t * `ApiError` and `RateLimitError` fill it from the response body; a\n\t * `ValidationError` narrows it to its own closed union. Errors with nothing\n\t * to classify (transport failures and poll timeouts) leave it `undefined`.\n\t */\n\treadonly code?: string | undefined;\n}\n\n/**\n * Base error class for all Open Cloud SDK errors.\n *\n * All specific error types (RateLimitError, ApiError, NetworkError)\n * extend this class, enabling `instanceof OpenCloudError` checks.\n *\n * `code` is declared here rather than on the subclasses that populate it, so a\n * caller holding the `OpenCloudError` that `Result.err` is typed as can branch\n * on it without first narrowing to a subclass.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { ApiError, OpenCloudError } from \"@bedrock-rbx/ocale\";\n *\n * // `Result.err` is typed as OpenCloudError, so a caller draining a queue\n * // branches on the canonical status without narrowing to a subclass first.\n * const err: OpenCloudError = new ApiError(\"HTTP 404: Queue items not found.\", {\n * code: \"NOT_FOUND\",\n * statusCode: 404,\n * });\n *\n * expect(err.code).toBe(\"NOT_FOUND\");\n * expect(new OpenCloudError(\"no classifier\").code).toBeUndefined();\n * ```\n */\nexport class OpenCloudError extends Error {\n\t/** Machine-readable classifier, or `undefined` when the error has none. */\n\tpublic readonly code: string | undefined;\n\tpublic override readonly name: string = \"OpenCloudError\";\n\n\t/**\n\t * Creates a new OpenCloudError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the optional `cause` and the\n\t * machine-readable `code`.\n\t */\n\tconstructor(message?: string, options?: OpenCloudErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.code = options?.code;\n\t}\n}\n","import { OpenCloudError, type OpenCloudErrorOptions } from \"./base.ts\";\n\n/**\n * Options for constructing an {@link ApiError}.\n *\n * @since 0.1.0\n */\nexport interface ApiErrorOptions extends OpenCloudErrorOptions {\n\t/** Parsed response body, when present. */\n\tdetails?: JSONValue | undefined;\n\t/**\n\t * Wall-clock time the request was in flight before this error, in\n\t * milliseconds. Present for errors built by the transport; a long elapsed\n\t * time on an intermittent failure points at a load or timeout correlation.\n\t */\n\telapsedMs?: number | undefined;\n\t/**\n\t * Human-readable summary extracted from an HTML gateway error page, set\n\t * when the error body was such a page (an HAProxy-style load-balancer\n\t * rejection) rather than an Open Cloud response. When present, the raw HTML\n\t * is not retained on {@link ApiError.details}.\n\t */\n\tgatewaySummary?: string | undefined;\n\t/** HTTP method of the request that produced this error. */\n\tmethod?: string | undefined;\n\t/**\n\t * Allowlisted response headers useful for diagnosis and escalation (request\n\t * ids, edge/server identifiers). The full header set is never retained, to\n\t * avoid surfacing anything sensitive and to keep errors light.\n\t */\n\tresponseHeaders?: Readonly<Record<string, string>> | undefined;\n\t/** HTTP status code from the API response. */\n\tstatusCode: number;\n\t/**\n\t * Length, in decoded characters, of a 2xx body that could not be parsed as\n\t * JSON. Set only by the transport, and only for that failure — nothing else\n\t * builds an {@link ApiError} over a successful status — so its presence is\n\t * also how a body-parse failure is told apart from an API rejection. The\n\t * number is the diagnostic one: a body that stops mid-token at exactly the\n\t * length the edge delivered is a truncated read, not malformed JSON.\n\t */\n\tunparsedBodyLength?: number | undefined;\n\t/** Fully-qualified URL of the request that produced this error. */\n\turl?: string | undefined;\n}\n\n/**\n * Everything in {@link ApiErrorOptions} except what the API answered ({@link\n * ApiErrorOptions.code}, {@link ApiErrorOptions.details}, and {@link\n * ApiErrorOptions.statusCode}): the request the transport made, how long it was\n * in flight, and what the response carried alongside its body. Every field is\n * required, and every one accepts `undefined` for a field the transport did not\n * capture.\n *\n * @since 0.2.0\n */\nexport type ApiRequestContext = {\n\t[K in Exclude<keyof ApiErrorOptions, \"cause\" | \"code\" | \"details\" | \"statusCode\">]-?:\n\t\t| ApiErrorOptions[K]\n\t\t| undefined;\n};\n\n/**\n * Thrown when the Roblox Open Cloud API returns a non-2xx response\n * that is not a rate limit (429).\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { ApiError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new ApiError(\"HTTP 404: Pass not found (code NotFound)\", {\n * code: \"NotFound\",\n * details: { errorCode: \"NotFound\", message: \"Pass not found\" },\n * statusCode: 404,\n * });\n *\n * expect(error).toBeInstanceOf(ApiError);\n * expect(error.statusCode).toBe(404);\n * expect(error.code).toBe(\"NotFound\");\n * expect(error.details).toEqual({\n * errorCode: \"NotFound\",\n * message: \"Pass not found\",\n * });\n * ```\n */\nexport class ApiError extends OpenCloudError {\n\tpublic readonly details: JSONValue | undefined;\n\tpublic readonly elapsedMs: number | undefined;\n\tpublic readonly gatewaySummary: string | undefined;\n\tpublic readonly method: string | undefined;\n\tpublic override readonly name: string = \"ApiError\";\n\tpublic readonly responseHeaders: Readonly<Record<string, string>> | undefined;\n\tpublic readonly statusCode: number;\n\tpublic readonly unparsedBodyLength: number | undefined;\n\tpublic readonly url: string | undefined;\n\n\t/**\n\t * Creates a new ApiError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including status code, optional error\n\t * code, the parsed response body when present, and the request context\n\t * (method, url, elapsed time, allowlisted response headers) when built by\n\t * the transport.\n\t */\n\tconstructor(message: string, options: ApiErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.statusCode = options.statusCode;\n\t\tthis.details = options.details;\n\t\tthis.method = options.method;\n\t\tthis.url = options.url;\n\t\tthis.elapsedMs = options.elapsedMs;\n\t\tthis.responseHeaders = options.responseHeaders;\n\t\tthis.gatewaySummary = options.gatewaySummary;\n\t\tthis.unparsedBodyLength = options.unparsedBodyLength;\n\t}\n}\n\n/**\n * Reads the request context off an {@link ApiError} so a replacement error can\n * carry it. Spread the result into the options of the new error. {@link\n * OpenCloudError.code}, {@link ApiError.details}, and {@link\n * ApiError.statusCode} describe the API's answer and are left to the caller.\n *\n * @since 0.2.0\n *\n * @param err - The error to read the request context from.\n * @returns The transport-captured fields, each undefined when unset.\n *\n * @example\n *\n * ```ts\n * import { ApiError, requestContextOf } from \"@bedrock-rbx/ocale\";\n *\n * const original = new ApiError(\"HTTP 404\", {\n * elapsedMs: 512,\n * method: \"GET\",\n * statusCode: 404,\n * url: \"https://apis.roblox.com/cloud/v2/universes/1\",\n * });\n *\n * const rewrapped = new ApiError(\"Universe 1 was not found; adoption failed\", {\n * ...requestContextOf(original),\n * statusCode: 404,\n * });\n *\n * expect(rewrapped.method).toBe(\"GET\");\n * expect(rewrapped.url).toBe(\"https://apis.roblox.com/cloud/v2/universes/1\");\n * expect(rewrapped.elapsedMs).toBe(512);\n * ```\n */\nexport function requestContextOf(err: ApiError): ApiRequestContext {\n\treturn {\n\t\telapsedMs: err.elapsedMs,\n\t\tgatewaySummary: err.gatewaySummary,\n\t\tmethod: err.method,\n\t\tresponseHeaders: err.responseHeaders,\n\t\tunparsedBodyLength: err.unparsedBodyLength,\n\t\turl: err.url,\n\t};\n}\n","import { OpenCloudError, type OpenCloudErrorOptions } from \"./base.ts\";\n\n/**\n * Options for constructing a {@link RateLimitError}.\n *\n * @since 0.1.0\n */\nexport interface RateLimitErrorOptions extends OpenCloudErrorOptions {\n\t/**\n\t * Parsed 429 response body, when present. Holds the server's 429\n\t * explanation (JSON when the body parses, otherwise the truncated raw\n\t * text) so a rate limit stays diagnosable from the error alone. A literal\n\t * JSON `null` remains `null`; an absent body is `undefined`.\n\t */\n\tdetails?: JSONValue | undefined;\n\t/**\n\t * Requests left in the reported rate-limit window. Read from\n\t * `x-ratelimit-remaining` using the smallest valid token.\n\t *\n\t * `undefined` when the header has no valid non-negative integer token.\n\t *\n\t * Parsed separately from `x-ratelimit-reset`; a valid value survives an\n\t * invalid reset.\n\t *\n\t * This is one budget reading, not a classifier for the cause of the 429.\n\t */\n\tremaining?: number | undefined;\n\t/**\n\t * Allowlisted response headers useful for diagnosing the 429. Values are\n\t * preserved exactly as the Fetch API presents them, including comma-joined\n\t * multi-window values. The full header set is never retained.\n\t */\n\tresponseHeaders?: Readonly<Record<string, string>> | undefined;\n\t/** Seconds to wait before retrying the request. */\n\tretryAfterSeconds: number;\n\t/**\n\t * HTTP status code that produced the error. Always `429` when minted by the\n\t * SDK transport; `undefined` when constructed without one.\n\t */\n\tstatusCode?: number | undefined;\n}\n\n/**\n * Thrown when the Roblox Open Cloud API returns a 429 Too Many Requests\n * response. Contains the server-suggested retry delay and safe,\n * machine-readable response evidence. Generic 429 evidence can be ambiguous:\n * no individual header, body code, or remaining-budget value guarantees the\n * upstream cause.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { RateLimitError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new RateLimitError(\"Too many requests\", {\n * code: \"RESOURCE_EXHAUSTED\",\n * remaining: 3,\n * responseHeaders: {\n * \"retry-after\": \"1856\",\n * \"x-ratelimit-limit\": \"5, 5;w=60, 5;w=60\",\n * },\n * retryAfterSeconds: 1856,\n * });\n *\n * // Inspect the available evidence without assuming it identifies the cause.\n * const evidence = {\n * code: error.code,\n * limit: error.responseHeaders?.[\"x-ratelimit-limit\"],\n * retryAfter: error.responseHeaders?.[\"retry-after\"],\n * };\n *\n * expect(evidence).toEqual({\n * code: \"RESOURCE_EXHAUSTED\",\n * limit: \"5, 5;w=60, 5;w=60\",\n * retryAfter: \"1856\",\n * });\n * ```\n */\nexport class RateLimitError extends OpenCloudError {\n\t/**\n\t * Parsed 429 response body. A literal JSON `null` remains `null`; an absent\n\t * body is `undefined`.\n\t */\n\tpublic readonly details: JSONValue | undefined;\n\tpublic override readonly name = \"RateLimitError\";\n\t/**\n\t * Requests left in the reported window, or `undefined` if not reported.\n\t */\n\tpublic readonly remaining: number | undefined;\n\t/** Allowlisted raw response headers, or `undefined` if not set. */\n\tpublic readonly responseHeaders: Readonly<Record<string, string>> | undefined;\n\tpublic readonly retryAfterSeconds: number;\n\t/** HTTP status code that produced the error, or `undefined` if not set. */\n\tpublic readonly statusCode: number | undefined;\n\n\t/**\n\t * Creates a new RateLimitError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the retry delay.\n\t */\n\tconstructor(message: string, options: RateLimitErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.retryAfterSeconds = options.retryAfterSeconds;\n\t\tthis.remaining = options.remaining;\n\t\tthis.responseHeaders = options.responseHeaders;\n\t\tthis.details = options.details;\n\t\tthis.statusCode = options.statusCode;\n\t}\n}\n\nconst GUIDED_ERRORS = new WeakSet<RateLimitError>();\n\n/**\n * Marks a transport-minted error whose zero-second delay is explicit guidance.\n *\n * @param error - The classified rate-limit failure.\n * @returns The same error, marked for retry orchestration.\n */\nexport function markServerRetryGuidance(error: RateLimitError): RateLimitError {\n\tGUIDED_ERRORS.add(error);\n\treturn error;\n}\n\n/**\n * Checks whether an error carries applicable server retry guidance.\n *\n * @param error - The rate-limit failure to inspect.\n * @returns Whether its delay should override caller backoff.\n */\nexport function hasServerRetryGuidance(error: RateLimitError): boolean {\n\treturn error.retryAfterSeconds > 0 || GUIDED_ERRORS.has(error);\n}\n","import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Options for constructing a {@link NetworkError}.\n *\n * @since 0.1.0\n */\nexport interface NetworkErrorOptions extends ErrorOptions {\n\t/** HTTP method of the request that failed. */\n\tmethod?: string | undefined;\n\t/** Fully-qualified URL of the request that failed. */\n\turl?: string | undefined;\n}\n\n/**\n * Thrown when a network-level failure prevents the request from reaching\n * the Roblox Open Cloud API (e.g., DNS resolution failure, connection reset).\n * The `method` and `url` name the failing call so a transport failure that\n * survives every retry can be diagnosed; the underlying transport error is\n * carried on `cause`.\n *\n * @since 0.1.0\n */\nexport class NetworkError extends OpenCloudError {\n\tpublic readonly method: string | undefined;\n\tpublic override readonly name: string = \"NetworkError\";\n\tpublic readonly url: string | undefined;\n\n\t/**\n\t * Creates a new NetworkError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the optional `cause` and the\n\t * `method` / `url` of the request that failed.\n\t */\n\tconstructor(message: string, options?: NetworkErr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AAgB,IAAI,QAAwB;;;;;;;AAQlD,SAAgB,wBAAwB,OAAuC;CAC9E,cAAc,IAAI,KAAK;CACvB,OAAO;AACR;;;;;;;AAQA,SAAgB,uBAAuB,OAAgC;CACtE,OAAO,MAAM,oBAAoB,KAAK,cAAc,IAAI,KAAK;AAC9D;;;;;;;;;;;;AC/GA,IAAa,eAAb,cAAkC,eAAe;CAChD;CACA,OAAwC;CACxC;;;;;;;;CASA,YAAY,SAAiB,SAA+B;EAC3D,MAAM,SAAS,OAAO;EACtB,KAAK,SAAS,SAAS;EACvB,KAAK,MAAM,SAAS;CACrB;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"polling-helpers-CoVhsC33.mjs","names":["SECONDS_PER_MINUTE","malformed","makeSpec"],"sources":["../src/resources/luau-execution/capacity-error.ts","../src/domains/cloud-v2/luau-execution-task-logs/builders.ts","../src/domains/cloud-v2/luau-execution-task-logs/operations.ts","../src/domains/cloud-v2/luau-execution-task-logs/parsers.ts","../src/domains/cloud-v2/luau-execution-task-logs/specs.ts","../src/domains/cloud-v2/luau-execution-tasks/builders.ts","../src/domains/cloud-v2/luau-execution-tasks/operations.ts","../src/domains/cloud-v2/luau-execution-tasks/parsers.ts","../src/domains/cloud-v2/luau-execution-tasks/specs.ts","../src/resources/luau-execution/polling.ts","../src/resources/luau-execution/capacity-admission.ts","../src/resources/luau-execution/polling-helpers.ts"],"sourcesContent":["import type {\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport { OpenCloudError } from \"../../errors/base.ts\";\nimport { RateLimitError } from \"../../errors/rate-limit.ts\";\n\nconst UUID_PATTERN = \"[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\";\n\n/**\n * A Luau task submission refused because validated tasks occupy the target\n * place's execution capacity.\n *\n * @example\n *\n * ```ts\n * import { LuauExecutionCapacityError } from \"@bedrock-rbx/ocale/luau-execution\";\n *\n * const error = new LuauExecutionCapacityError([{\n * placeId: \"456\",\n * sessionId: \"11111111-1111-4111-8111-111111111111\",\n * taskId: \"22222222-2222-4222-8222-222222222222\",\n * universeId: \"123\",\n * versionId: \"789\",\n * }]);\n * expect(error.blockers).toHaveLength(1);\n * ```\n *\n * @since 0.3.2\n */\nexport class LuauExecutionCapacityError extends OpenCloudError {\n\t/** Validated task references reported as occupying the target place. */\n\tpublic readonly blockers: ReadonlyArray<LuauExecutionTaskRef>;\n\tpublic override readonly name = \"LuauExecutionCapacityError\";\n\n\t/**\n\t * Creates a capacity failure from validated blocker references.\n\t *\n\t * @param blockers - Tasks reported as occupying the submitted place.\n\t */\n\tconstructor(blockers: ReadonlyArray<LuauExecutionTaskRef>) {\n\t\tsuper(\"Luau execution capacity is occupied\", { code: \"RESOURCE_EXHAUSTED\" });\n\t\tthis.blockers = Object.freeze(blockers.map((blocker) => Object.freeze({ ...blocker })));\n\t}\n}\n\n/**\n * Builds the identity key shared by capacity blocker collections.\n *\n * @param ref - Luau task reference to identify.\n * @returns The version, session, and task identity components.\n */\nexport function luauTaskRefKey(ref: LuauExecutionTaskRef): string {\n\treturn `${ref.versionId}/${ref.sessionId}/${ref.taskId}`;\n}\n\n/**\n * Converts a positively identified Luau capacity response into its typed\n * error.\n *\n * @param error - The response error to inspect.\n * @param parameters - The submitted target used to validate blocker refs.\n * @returns A typed capacity error, or `undefined` without positive evidence.\n */\nexport function capacityErrorFrom(\n\terror: OpenCloudError,\n\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n): LuauExecutionCapacityError | undefined {\n\tif (!(error instanceof RateLimitError) || error.code !== \"RESOURCE_EXHAUSTED\") {\n\t\treturn undefined;\n\t}\n\n\tconst message = capacityMessage(error.details);\n\tif (message === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst blockers = blockerRefsFrom(message, parameters);\n\treturn blockers.length === 0 ? undefined : new LuauExecutionCapacityError(blockers);\n}\n\nfunction capacityMessage(details: JSONValue | undefined): string | undefined {\n\tif (details === null || typeof details !== \"object\" || Array.isArray(details)) {\n\t\treturn undefined;\n\t}\n\n\tconst code = Reflect.get(details, \"code\");\n\tconst message = Reflect.get(details, \"message\");\n\treturn code === \"RESOURCE_EXHAUSTED\" && typeof message === \"string\" ? message : undefined;\n}\n\nfunction escapeRegExp(value: string): string {\n\treturn value.replace(/[.*+?^${}()|[\\]\\\\]/gu, \"\\\\$&\");\n}\n\nfunction compareTaskRefs(left: LuauExecutionTaskRef, right: LuauExecutionTaskRef): number {\n\treturn luauTaskRefKey(left).localeCompare(luauTaskRefKey(right));\n}\n\nfunction blockerRefsFrom(\n\tmessage: string,\n\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n): ReadonlyArray<LuauExecutionTaskRef> {\n\tconst universeId = escapeRegExp(parameters.universeId);\n\tconst placeId = escapeRegExp(parameters.placeId);\n\tconst pattern = new RegExp(\n\t\t`universes/(${universeId})/places/(${placeId})/versions/([1-9][0-9]*)/luau-execution-sessions/(${UUID_PATTERN})/tasks/(${UUID_PATTERN})(?=$|[^A-Za-z0-9_-])`,\n\t\t\"giu\",\n\t);\n\tconst unique = new Map<string, LuauExecutionTaskRef>();\n\tfor (const match of message.matchAll(pattern)) {\n\t\tconst matchedUniverseId = String(match[1]);\n\t\tconst matchedPlaceId = String(match[2]);\n\t\tconst versionId = String(match[3]);\n\t\tconst sessionId = String(match[4]);\n\t\tconst taskId = String(match[5]);\n\n\t\tconst ref = Object.freeze({\n\t\t\tplaceId: matchedPlaceId,\n\t\t\tsessionId,\n\t\t\ttaskId,\n\t\t\tuniverseId: matchedUniverseId,\n\t\t\tversionId,\n\t\t});\n\t\tunique.set(luauTaskRefKey(ref), ref);\n\t}\n\n\treturn Object.freeze([...unique.values()].toSorted(compareTaskRefs));\n}\n","import type { HttpRequest } from \"../../../client/types.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { ListLogsParameters } from \"./types.ts\";\n\n/**\n * Builds a `GET` request for the Open Cloud \"list Luau execution session\n * task logs\" endpoint. The endpoint requires the maximal x-aep-resource\n * path shape (universe, place, version, session, task), so the supplied\n * ref must include `versionId` and `sessionId`; refs extracted from the\n * narrower path formats are rejected with a {@link ValidationError}.\n *\n * The `view` query parameter is hard-coded to `STRUCTURED` so callers\n * always receive typed structured messages. No public `view` parameter\n * is exposed.\n *\n * @param parameters - Task ref, and optional `pageSize` and `pageToken`\n * pagination controls.\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when the ref is missing `versionId` or\n * `sessionId`.\n */\nexport function buildListLogsRequest({\n\tpageSize,\n\tpageToken,\n\tref,\n}: ListLogsParameters): Result<HttpRequest, ValidationError> {\n\tconst { placeId, sessionId, taskId, universeId, versionId } = ref;\n\n\tif (versionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing versionId; cannot list logs\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tif (sessionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing sessionId; cannot list logs\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst base = `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-sessions/${sessionId}/tasks/${taskId}/logs`;\n\tconst url = `${base}?${buildQuery(pageSize, pageToken).toString()}`;\n\treturn { data: { method: \"GET\", url }, success: true };\n}\n\nfunction buildQuery(pageSize: number | undefined, pageToken: string | undefined): URLSearchParams {\n\tconst query = new URLSearchParams({ view: \"STRUCTURED\" });\n\n\tif (pageSize !== undefined) {\n\t\tquery.append(\"maxPageSize\", String(pageSize));\n\t}\n\n\tif (pageToken !== undefined) {\n\t\tquery.append(\"pageToken\", pageToken);\n\t}\n\n\treturn query;\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst LIST_LOGS_PER_MINUTE = 45;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for listing Luau execution task logs,\n * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_ListLuauExecutionSessionTaskLogs` operation (45 requests per\n * minute per API key owner), which is also the burst the server allows.\n */\nexport const LIST_LOGS_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: LIST_LOGS_PER_MINUTE,\n\tmaxPerSecond: LIST_LOGS_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-task-logs.list\",\n});\n\n/**\n * Scopes required to list Luau execution task logs, sourced from\n * `x-roblox-scopes` on the list-logs operation in the vendored OpenAPI\n * schema. Surfaced via the `requiredScopes` field of the per-method\n * spec so a 401 or 403 ApiError is upgraded to a `PermissionError`\n * naming the missing scope. Only `:read` is required as the\n * minimum-privilege scope for this read-only operation.\n */\nexport const LIST_LOGS_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:read\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { LogMessage, LogPage } from \"./types.ts\";\nimport type { LogChunkWire, LogMessageWire } from \"./wire.ts\";\n\nconst MALFORMED_LOGS_MESSAGE = \"Malformed list-luau-execution-task-logs response\";\n\n/**\n * Parses a successful Open Cloud list-luau-execution-task-logs response\n * body into the public {@link LogPage} shape. Chunks are flattened into\n * a single ordered array of {@link LogMessage} values.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link LogPage}, or an\n * {@link ApiError} when the body does not match a supported shape.\n */\nexport function parseListLogsResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<LogPage, ApiError> {\n\tif (!isRecord(body)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst rawChunks = body[\"luauExecutionSessionTaskLogs\"] ?? undefined;\n\tif (!isOptionalLogChunks(rawChunks)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst rawToken = body[\"nextPageToken\"] ?? undefined;\n\tif (rawToken !== undefined && typeof rawToken !== \"string\") {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst messages: Array<LogMessage> = [];\n\tconst chunks = rawChunks ?? [];\n\tfor (const chunk of chunks) {\n\t\tconst wireMessages = chunk.structuredMessages ?? [];\n\t\tfor (const wireMessage of wireMessages) {\n\t\t\tmessages.push({\n\t\t\t\tcreateTime: wireMessage.createTime,\n\t\t\t\tmessage: wireMessage.message,\n\t\t\t\tmessageType: wireMessage.messageType,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn {\n\t\tdata: { messages, nextPageToken: rawToken },\n\t\tsuccess: true,\n\t};\n}\n\nfunction isAcceptedMessageType(value: unknown): value is LogMessageWire[\"messageType\"] {\n\treturn (\n\t\tvalue === \"MESSAGE_TYPE_UNSPECIFIED\" ||\n\t\tvalue === \"OUTPUT\" ||\n\t\tvalue === \"INFO\" ||\n\t\tvalue === \"WARNING\" ||\n\t\tvalue === \"ERROR\"\n\t);\n}\n\nfunction isLogMessageWire(value: unknown): value is LogMessageWire {\n\treturn (\n\t\tisRecord(value) &&\n\t\ttypeof value[\"createTime\"] === \"string\" &&\n\t\ttypeof value[\"message\"] === \"string\" &&\n\t\tisAcceptedMessageType(value[\"messageType\"])\n\t);\n}\n\nfunction isOptionalStructuredMessages(\n\tvalue: unknown,\n): value is ReadonlyArray<LogMessageWire> | undefined {\n\treturn (\n\t\tvalue === undefined ||\n\t\t(Array.isArray(value) && value.every((item: unknown) => isLogMessageWire(item)))\n\t);\n}\n\nfunction isLogChunkWire(value: unknown): value is LogChunkWire {\n\treturn isRecord(value) && isOptionalStructuredMessages(value[\"structuredMessages\"]);\n}\n\nfunction isOptionalLogChunks(value: unknown): value is ReadonlyArray<LogChunkWire> | undefined {\n\treturn (\n\t\tvalue === undefined ||\n\t\t(Array.isArray(value) && value.every((item: unknown) => isLogChunkWire(item)))\n\t);\n}\n\nfunction malformed(statusCode: number, body: unknown): Result<LogPage, ApiError> {\n\treturn {\n\t\terr: new ApiError(MALFORMED_LOGS_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n","import { IDEMPOTENT_METHOD_DEFAULTS } from \"../../../internal/http/retry.ts\";\nimport type { ResourceMethodSpec } from \"../../../internal/resource-client.ts\";\nimport { buildListLogsRequest } from \"./builders.ts\";\nimport { LIST_LOGS_OPERATION_LIMIT, LIST_LOGS_REQUIRED_SCOPES } from \"./operations.ts\";\nimport { parseListLogsResponse } from \"./parsers.ts\";\nimport type { ListLogsParameters, LogPage } from \"./types.ts\";\n\nfunction makeSpec<P>(spec: ResourceMethodSpec<P, LogPage>): ResourceMethodSpec<P, LogPage> {\n\treturn Object.freeze(spec);\n}\n\n/**\n * Per-method dispatch spec for listing the structured log messages\n * produced by a Luau execution task. Frozen at module scope so both\n * the top-level `LuauExecutionClient` and the `luauExecution` Operation\n * Group on `PlacesClient` share the same instance reference.\n */\nexport const LIST_LOGS_SPEC = makeSpec<ListLogsParameters>({\n\tbuildRequest: buildListLogsRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: LIST_LOGS_OPERATION_LIMIT,\n\tparse: parseListLogsResponse,\n\trequiredScopes: LIST_LOGS_REQUIRED_SCOPES,\n});\n","import type { HttpRequest } from \"../../../client/types.ts\";\nimport { ValidationError } from \"../../../errors/validation.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { GetParameters, SubmitAtHeadParameters, SubmitAtVersionParameters } from \"./types.ts\";\n\ninterface SubmitBodyInput {\n\treadonly binaryInput?: string | undefined;\n\treadonly enableBinaryOutput?: boolean | undefined;\n\treadonly script: string;\n\treadonly timeoutSeconds?: number;\n}\n\nconst JSON_HEADERS: Readonly<Record<string, string>> = { \"content-type\": \"application/json\" };\n\n/**\n * Builds a `POST` request for the Open Cloud \"create Luau execution\n * session task\" endpoint, targeting the place's head version. Serializes\n * `timeoutSeconds` into the wire's duration string format (`\"<n>s\"`)\n * when supplied.\n *\n * @param parameters - Universe and place identifiers, the script body,\n * and an optional `timeoutSeconds`.\n * @returns A pure {@link HttpRequest} describing the submit call.\n */\nexport function buildSubmitAtHeadRequest(parameters: SubmitAtHeadParameters): HttpRequest {\n\tconst { placeId, universeId } = parameters;\n\treturn {\n\t\tbody: buildSubmitBody(parameters),\n\t\theaders: JSON_HEADERS,\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}/luau-execution-session-tasks`,\n\t};\n}\n\n/**\n * Builds a `POST` request for the Open Cloud \"create Luau execution\n * session task\" endpoint, targeting a specific place version. Differs\n * from {@link buildSubmitAtHeadRequest} only in URL shape: the path\n * includes the `versions/{versionId}` segment so the script runs\n * against that exact place version instead of the live head.\n *\n * @param parameters - Universe, place, and version identifiers, the\n * script body, and an optional `timeoutSeconds`.\n * @returns A pure {@link HttpRequest} describing the submit call.\n */\nexport function buildSubmitAtVersionRequest(parameters: SubmitAtVersionParameters): HttpRequest {\n\tconst { placeId, universeId, versionId } = parameters;\n\treturn {\n\t\tbody: buildSubmitBody(parameters),\n\t\theaders: JSON_HEADERS,\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-session-tasks`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the Open Cloud \"read Luau execution session\n * task\" endpoint. The endpoint accepts only the maximal x-aep-resource\n * path shape (universe, place, version, session, task), so the supplied\n * ref must include `versionId` and `sessionId`; refs extracted from the\n * narrower path formats are rejected with a {@link ValidationError}.\n *\n * @param parameters - Task ref and optional view selector. When `view`\n * is omitted, no `?view=` query is sent and the server applies its\n * own default (`BASIC`).\n * @returns A success result wrapping the request, or a\n * {@link ValidationError} when the ref is missing `versionId` or\n * `sessionId`.\n */\nexport function buildGetRequest({\n\tref,\n\tview,\n}: GetParameters): Result<HttpRequest, ValidationError> {\n\tconst { placeId, sessionId, taskId, universeId, versionId } = ref;\n\n\tif (versionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing versionId; cannot GET\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tif (sessionId === undefined) {\n\t\treturn {\n\t\t\terr: new ValidationError(\"Task ref is missing sessionId; cannot GET\", {\n\t\t\t\tcode: \"incomplete_ref\",\n\t\t\t}),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\tconst base = `/cloud/v2/universes/${universeId}/places/${placeId}/versions/${versionId}/luau-execution-sessions/${sessionId}/tasks/${taskId}`;\n\tconst url = view === undefined ? base : `${base}?view=${view}`;\n\treturn { data: { method: \"GET\", url }, success: true };\n}\n\nfunction buildSubmitBody({\n\tbinaryInput,\n\tenableBinaryOutput: shouldEnableBinaryOutput,\n\tscript,\n\ttimeoutSeconds,\n}: SubmitBodyInput): Record<string, unknown> {\n\tconst body: Record<string, unknown> = { script };\n\tif (timeoutSeconds !== undefined) {\n\t\tbody[\"timeout\"] = `${timeoutSeconds}s`;\n\t}\n\n\tif (binaryInput !== undefined) {\n\t\tbody[\"binaryInput\"] = binaryInput;\n\t}\n\n\tif (shouldEnableBinaryOutput !== undefined) {\n\t\tbody[\"enableBinaryOutput\"] = shouldEnableBinaryOutput;\n\t}\n\n\treturn body;\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst SUBMIT_AT_HEAD_PER_MINUTE = 5;\nconst SUBMIT_AT_VERSION_PER_MINUTE = 5;\nconst GET_PER_MINUTE = 200;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for submitting a Luau execution task at a\n * place's head version, sourced from\n * `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_CreateLuauExecutionSessionTask__Using_Universes` operation\n * (5 requests per minute per API key owner), which is also the burst\n * the server allows.\n */\nexport const SUBMIT_HEAD_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: SUBMIT_AT_HEAD_PER_MINUTE,\n\tmaxPerSecond: SUBMIT_AT_HEAD_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-tasks.submit\",\n});\n\n/**\n * Per-second request ceiling for submitting a Luau execution task at a\n * specific place version, sourced from\n * `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_CreateLuauExecutionSessionTask__Using_Universes_Places`\n * operation (5 requests per minute per API key owner), which is also\n * the burst the server allows. Carries its own operation key so the\n * version-pinned URL shape is paced from its own quota: the server\n * meters the two shapes in separate buckets whose ceilings are\n * additive, and pinned traffic does not consume head budget. The two\n * ceilings are equal (5 each), but equal is not shared.\n */\nexport const SUBMIT_VERSION_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: SUBMIT_AT_VERSION_PER_MINUTE,\n\tmaxPerSecond: SUBMIT_AT_VERSION_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-tasks.submit-at-version\",\n});\n\n/**\n * Per-second request ceiling for fetching a Luau execution task,\n * sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_GetLuauExecutionSessionTask` operation (200 requests per\n * minute per API key owner).\n */\nexport const GET_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: GET_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-tasks.get\",\n});\n\n/**\n * Scopes required to submit a Luau execution task, sourced from\n * `x-roblox-scopes` on the create operation in the vendored OpenAPI\n * schema. Surfaced via the `requiredScopes` field of the per-method\n * spec so a 401 or 403 ApiError is upgraded to a `PermissionError`\n * naming the missing scope.\n */\nexport const SUBMIT_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:write\",\n]);\n\n/**\n * Scopes required to fetch a Luau execution task, sourced from\n * `x-roblox-scopes` on the get operation. The `:write` scope also\n * grants read in upstream auth, but we surface only `:read` here as\n * the minimum-privilege requirement for this method.\n */\nexport const GET_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:read\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isDateTimeString } from \"../../../internal/utils/is-date-time-string.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { LuauExecutionTask, LuauExecutionTaskRef } from \"./types.ts\";\nimport type {\n\tLuauExecutionTaskErrorWire,\n\tLuauExecutionTaskOutputWire,\n\tLuauExecutionTaskWire,\n} from \"./wire.ts\";\n\nconst MALFORMED_TASK_MESSAGE = \"Malformed luau-execution-session-task response\";\n\n// Matches any of the four x-aep-resource path formats for a luau\n// execution session task.\n//\n// Capture groups:\n// 1. universeId\n// 2. placeId\n// 3. versionId (when `/versions/{v}/` segment is present, else undefined)\n// 4. sessionId (when `/luau-execution-sessions/{s}/tasks/...` branch matched)\n// 5. taskId (when `/luau-execution-sessions/.../tasks/{t}` branch matched)\n// 6. taskId (when `/luau-execution-session-tasks/{t}` branch matched)\nconst PATH_PATTERN =\n\t/^universes\\/(\\d+)\\/places\\/(\\d+)(?:\\/versions\\/(\\d+))?(?:\\/luau-execution-sessions\\/([^/]+)\\/tasks\\/([^/]+)|\\/luau-execution-session-tasks\\/([^/]+))$/;\n\ntype InProgressWireState = Exclude<LuauExecutionTaskWire[\"state\"], \"COMPLETE\" | \"FAILED\">;\n\ninterface ParseVariantArgs {\n\treadonly body: LuauExecutionTaskWire;\n\treadonly createdAt: Date | undefined;\n\treadonly ref: LuauExecutionTaskRef;\n\treadonly statusCode: number;\n\treadonly timeoutSeconds: number | undefined;\n\treadonly updatedAt: Date | undefined;\n}\n\n/**\n * Parses a successful Open Cloud `LuauExecutionSessionTask` response\n * body into the public {@link LuauExecutionTask} discriminated union.\n * Handles every supported task state (in-progress, COMPLETE, FAILED)\n * across all four x-aep-resource path shapes the server returns.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud\n * API.\n * @returns A success result wrapping the parsed task, or an\n * {@link ApiError} when the body or path do not match a supported\n * shape.\n */\nexport function parseLuauExecutionTaskResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<LuauExecutionTask, ApiError> {\n\tif (!isLuauExecutionTaskWire(body)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst ref = parseTaskRef(body.path);\n\tif (ref === undefined) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tconst timeoutSeconds = parseTimeoutSeconds(body.timeout);\n\tconst createdAt = parseOptionalDate(body.createTime);\n\tconst updatedAt = parseOptionalDate(body.updateTime);\n\n\tif (body.state === \"COMPLETE\") {\n\t\treturn parseCompleteTask({ body, createdAt, ref, statusCode, timeoutSeconds, updatedAt });\n\t}\n\n\tif (body.state === \"FAILED\") {\n\t\treturn parseFailedTask({ body, createdAt, ref, statusCode, timeoutSeconds, updatedAt });\n\t}\n\n\treturn parseInProgressTask({\n\t\tbody,\n\t\tcreatedAt,\n\t\tref,\n\t\tstate: body.state,\n\t\tstatusCode,\n\t\ttimeoutSeconds,\n\t\tupdatedAt,\n\t});\n}\n\nfunction isAcceptedWireState(state: unknown): state is LuauExecutionTaskWire[\"state\"] {\n\treturn (\n\t\tstate === \"STATE_UNSPECIFIED\" ||\n\t\tstate === \"QUEUED\" ||\n\t\tstate === \"PROCESSING\" ||\n\t\tstate === \"CANCELLED\" ||\n\t\tstate === \"COMPLETE\" ||\n\t\tstate === \"FAILED\"\n\t);\n}\n\nfunction isErrorWireCode(code: unknown): code is LuauExecutionTaskErrorWire[\"code\"] {\n\treturn (\n\t\tcode === \"ERROR_CODE_UNSPECIFIED\" ||\n\t\tcode === \"SCRIPT_ERROR\" ||\n\t\tcode === \"DEADLINE_EXCEEDED\" ||\n\t\tcode === \"OUTPUT_SIZE_LIMIT_EXCEEDED\" ||\n\t\tcode === \"INTERNAL_ERROR\"\n\t);\n}\n\nfunction isErrorWire(value: unknown): value is LuauExecutionTaskErrorWire {\n\treturn (\n\t\tisRecord(value) && isErrorWireCode(value[\"code\"]) && typeof value[\"message\"] === \"string\"\n\t);\n}\n\nfunction isOptionalErrorWire(value: unknown): value is LuauExecutionTaskErrorWire | undefined {\n\treturn value === undefined || isErrorWire(value);\n}\n\nfunction isOutputWire(value: unknown): value is LuauExecutionTaskOutputWire {\n\treturn isRecord(value) && Array.isArray(value[\"results\"]);\n}\n\nfunction isOptionalOutputWire(value: unknown): value is LuauExecutionTaskOutputWire | undefined {\n\treturn value === undefined || isOutputWire(value);\n}\n\nfunction isOptionalString(value: unknown): value is string | undefined {\n\treturn value === undefined || typeof value === \"string\";\n}\n\nfunction isOptionalBoolean(value: unknown): value is boolean | undefined {\n\treturn value === undefined || typeof value === \"boolean\";\n}\n\nfunction isOptionalDateTimeString(value: unknown): value is string | undefined {\n\treturn value === undefined || isDateTimeString(value);\n}\n\nfunction isLuauExecutionTaskWire(body: unknown): body is LuauExecutionTaskWire {\n\treturn (\n\t\tisRecord(body) &&\n\t\ttypeof body[\"path\"] === \"string\" &&\n\t\tisOptionalDateTimeString(body[\"createTime\"]) &&\n\t\tisOptionalDateTimeString(body[\"updateTime\"]) &&\n\t\tisAcceptedWireState(body[\"state\"]) &&\n\t\ttypeof body[\"user\"] === \"string\" &&\n\t\tisOptionalOutputWire(body[\"output\"]) &&\n\t\tisOptionalErrorWire(body[\"error\"]) &&\n\t\tisOptionalDurationWire(body[\"timeout\"]) &&\n\t\tisOptionalString(body[\"binaryInput\"]) &&\n\t\tisOptionalBoolean(body[\"enableBinaryOutput\"]) &&\n\t\tisOptionalString(body[\"binaryOutputUri\"])\n\t);\n}\n\nfunction parseOptionalDate(value: string | undefined): Date | undefined {\n\treturn value === undefined ? undefined : new Date(value);\n}\n\nconst DURATION_PATTERN = /^(\\d+)s$/;\n\nfunction isOptionalDurationWire(value: unknown): value is string | undefined {\n\treturn value === undefined || (typeof value === \"string\" && DURATION_PATTERN.test(value));\n}\n\nfunction parseTimeoutSeconds(value: string | undefined): number | undefined {\n\tif (value === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst match = DURATION_PATTERN.exec(value);\n\tconst seconds = match?.[1];\n\tif (seconds === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn Number.parseInt(seconds, 10);\n}\n\nfunction malformed(statusCode: number, body: unknown): Result<LuauExecutionTask, ApiError> {\n\treturn {\n\t\terr: new ApiError(MALFORMED_TASK_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n\nfunction parseInProgressTask({\n\tbody,\n\tcreatedAt,\n\tref,\n\tstate,\n\ttimeoutSeconds,\n\tupdatedAt,\n}: ParseVariantArgs & { readonly state: InProgressWireState }): Result<\n\tLuauExecutionTask,\n\tApiError\n> {\n\treturn {\n\t\tdata: {\n\t\t\tbinaryInput: body.binaryInput,\n\t\t\tbinaryOutputUri: body.binaryOutputUri,\n\t\t\tcreatedAt,\n\t\t\tenableBinaryOutput: body.enableBinaryOutput,\n\t\t\tref,\n\t\t\tstate,\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt,\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseCompleteTask({\n\tbody,\n\tcreatedAt,\n\tref,\n\tstatusCode,\n\ttimeoutSeconds,\n\tupdatedAt,\n}: ParseVariantArgs): Result<LuauExecutionTask, ApiError> {\n\tif (body.output === undefined) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbinaryInput: body.binaryInput,\n\t\t\tbinaryOutputUri: body.binaryOutputUri,\n\t\t\tcreatedAt,\n\t\t\tenableBinaryOutput: body.enableBinaryOutput,\n\t\t\toutput: { results: body.output.results },\n\t\t\tref,\n\t\t\tstate: \"COMPLETE\",\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt,\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseFailedTask({\n\tbody,\n\tcreatedAt,\n\tref,\n\tstatusCode,\n\ttimeoutSeconds,\n\tupdatedAt,\n}: ParseVariantArgs): Result<LuauExecutionTask, ApiError> {\n\tif (body.error === undefined) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\tbinaryInput: body.binaryInput,\n\t\t\tbinaryOutputUri: body.binaryOutputUri,\n\t\t\tcreatedAt,\n\t\t\tenableBinaryOutput: body.enableBinaryOutput,\n\t\t\terror: { code: body.error.code, message: body.error.message },\n\t\t\tref,\n\t\t\tstate: \"FAILED\",\n\t\t\ttimeoutSeconds,\n\t\t\tupdatedAt,\n\t\t\tuser: body.user,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction parseTaskRef(path: string): LuauExecutionTaskRef | undefined {\n\tconst match = PATH_PATTERN.exec(path);\n\tif (match === null) {\n\t\treturn undefined;\n\t}\n\n\tconst [, universeId, placeId, versionId, sessionId, sessionTaskId, plainTaskId] = match;\n\tconst taskId = sessionTaskId ?? plainTaskId;\n\tif (universeId === undefined || placeId === undefined || taskId === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn { placeId, sessionId, taskId, universeId, versionId };\n}\n","import {\n\tCREATE_METHOD_DEFAULTS,\n\tIDEMPOTENT_METHOD_DEFAULTS,\n} from \"../../../internal/http/retry.ts\";\nimport { okRequest, type ResourceMethodSpec } from \"../../../internal/resource-client.ts\";\nimport {\n\tbuildGetRequest,\n\tbuildSubmitAtHeadRequest,\n\tbuildSubmitAtVersionRequest,\n} from \"./builders.ts\";\nimport {\n\tGET_OPERATION_LIMIT,\n\tGET_REQUIRED_SCOPES,\n\tSUBMIT_HEAD_OPERATION_LIMIT,\n\tSUBMIT_REQUIRED_SCOPES,\n\tSUBMIT_VERSION_OPERATION_LIMIT,\n} from \"./operations.ts\";\nimport { parseLuauExecutionTaskResponse } from \"./parsers.ts\";\nimport type {\n\tGetParameters,\n\tLuauExecutionTask,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"./types.ts\";\n\nfunction makeSpec<P>(\n\tspec: ResourceMethodSpec<P, LuauExecutionTask>,\n): ResourceMethodSpec<P, LuauExecutionTask> {\n\treturn Object.freeze(spec);\n}\n\n/**\n * Per-method dispatch spec for submitting a Luau execution task at a\n * place's head version. Frozen at module scope so both the top-level\n * `LuauExecutionClient` and the `luauExecution` Operation Group on\n * `PlacesClient` share the same instance reference.\n */\nexport const SUBMIT_HEAD_SPEC = makeSpec<SubmitAtHeadParameters>({\n\tbuildRequest: (parameters) => okRequest(buildSubmitAtHeadRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: SUBMIT_HEAD_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: SUBMIT_REQUIRED_SCOPES,\n});\n\n/**\n * Per-method dispatch spec for submitting a Luau execution task at a\n * specific place version. Shares the required scope set with {@link\n * SUBMIT_HEAD_SPEC} but carries its own rate-limit queue: the server\n * meters the version-pinned URL shape in a bucket separate from the\n * head shape's.\n */\nexport const SUBMIT_VERSION_SPEC = makeSpec<SubmitAtVersionParameters>({\n\tbuildRequest: (parameters) => okRequest(buildSubmitAtVersionRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: SUBMIT_VERSION_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: SUBMIT_REQUIRED_SCOPES,\n});\n\n/**\n * Per-method dispatch spec for fetching a Luau execution task. Uses\n * idempotent retry semantics (429 and 5xx both retried) so reads\n * recover transparently from transient server errors.\n */\nexport const GET_SPEC = makeSpec<GetParameters>({\n\tbuildRequest: buildGetRequest,\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parseLuauExecutionTaskResponse,\n\trequiredScopes: GET_REQUIRED_SCOPES,\n});\n","import type { RequestOptions } from \"../../client/types.ts\";\nimport type { LuauExecutionTask } from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { NetworkError } from \"../../errors/network-error.ts\";\nimport { PollAbortedError } from \"../../errors/poll-aborted.ts\";\nimport { PollTimeoutError } from \"../../errors/poll-timeout.ts\";\nimport { TRANSIENT_TRANSPORT_CODES } from \"../../internal/http/retry.ts\";\nimport { ABORTED, raceWithAbortAsync } from \"../../internal/utils/abort.ts\";\nimport { findErrorCode } from \"../../internal/utils/find-error-code.ts\";\nimport type { SleepFunc } from \"../../internal/utils/sleep.ts\";\nimport type { Result } from \"../../types.ts\";\n\n/** Default total polling budget in milliseconds (5 minutes). */\nexport const DEFAULT_POLL_TIMEOUT_MS = 300_000;\n\n/** One step of the default poll-cadence schedule. */\ninterface PollDelayTier {\n\t/** Delay in ms to wait between polls while within this tier. */\n\treadonly delayMs: number;\n\t/**\n\t * Upper elapsed-time bound (exclusive) at which this tier stops applying.\n\t */\n\treadonly untilMs: number;\n}\n\n/** Steady-state delay once elapsed time reaches the final tier bound. */\nconst STEADY_POLL_DELAY_MS = 5_000;\n\n/**\n * Fast-to-slow poll-cadence tiers keyed on elapsed wall-clock time. Elapsed\n * times at or beyond the last `untilMs` fall through to\n * {@link STEADY_POLL_DELAY_MS}.\n */\nconst DEFAULT_POLL_TIERS: ReadonlyArray<PollDelayTier> = [\n\t{ delayMs: 500, untilMs: 20_000 },\n\t{ delayMs: 1_000, untilMs: 60_000 },\n];\n\n/**\n * Default poll cadence as a function of elapsed wall-clock time since\n * polling began. Polls quickly while a task is young so short runs resolve\n * snappily, then eases off so a long run leaves rate-limit headroom for\n * newer tasks: 0-20s is 500ms, 20-60s is 1000ms, 60s+ is 5000ms.\n *\n * @since 0.1.0\n *\n * @example\n * ```ts\n * import { defaultPollDelay } from \"@bedrock-rbx/ocale/luau-execution\";\n *\n * expect(defaultPollDelay(0)).toBe(500);\n * expect(defaultPollDelay(30_000)).toBe(1000);\n * expect(defaultPollDelay(120_000)).toBe(5000);\n * ```\n *\n * @param elapsedMs - Milliseconds elapsed since polling started.\n * @returns The delay in milliseconds to wait before the next poll.\n */\nexport function defaultPollDelay(elapsedMs: number): number {\n\tconst tier = DEFAULT_POLL_TIERS.find((candidate) => elapsedMs < candidate.untilMs);\n\treturn tier?.delayMs ?? STEADY_POLL_DELAY_MS;\n}\n\n/**\n * Default number of consecutive transport failures tolerated before the poll\n * loop gives up. With per-request retries already absorbing isolated blips,\n * three consecutive loop-level failures signals a genuinely unreachable\n * endpoint, so it bails in seconds rather than spinning out the wall-clock\n * budget.\n */\nexport const DEFAULT_POLL_FAILURE_CAP = 3;\n\n/**\n * Injected dependencies for the deep-module polling loop. The `fetch`\n * callback is pre-bound by the wiring layer and closes over the task ref\n * and request options, keeping the core loop narrow.\n */\nexport interface PollDependencies {\n\t/** Returns the current task or an error. Called on each loop iteration. */\n\treadonly fetch: () => Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/** Returns the current wall-clock time in ms. */\n\treadonly now: () => number;\n\t/** Injectable sleep for deterministic tests. */\n\treadonly sleep: SleepFunc;\n}\n\n/**\n * Public options accepted by `pollUntilDone` and `runUntilDone` on both client\n * surfaces.\n *\n * @since 0.1.0\n */\nexport type PollUntilDoneOptions = PollOptions & RequestOptions;\n\n/** Caller-supplied polling-loop options; all fields optional. */\ninterface PollOptions {\n\t/**\n\t * Consecutive transient transport failures tolerated before the loop gives\n\t * up. Defaults to {@link DEFAULT_POLL_FAILURE_CAP}. A successful poll\n\t * resets the count.\n\t */\n\treadonly maxConsecutivePollFailures?: number;\n\t/**\n\t * Returns the sleep duration given ms elapsed since polling started.\n\t * Defaults to {@link defaultPollDelay}.\n\t */\n\treadonly pollDelay?: (elapsedMs: number) => number;\n\t/**\n\t * When aborted, the loop returns {@link PollAbortedError} rather than\n\t * continuing.\n\t */\n\treadonly signal?: AbortSignal;\n\t/**\n\t * Total wall-clock budget in ms before the loop returns {@link\n\t * PollTimeoutError}.\n\t */\n\treadonly timeoutMs?: number;\n}\n\ninterface ResolvedPollOptions {\n\treadonly maxFailures: number;\n\treadonly pollDelay: (elapsedMs: number) => number;\n\treadonly signal: AbortSignal | undefined;\n\treadonly timeoutMs: number;\n}\n\ninterface SleepWithAbortOptions {\n\treadonly ms: number;\n\treadonly signal: AbortSignal | undefined;\n\treadonly sleep: SleepFunc;\n}\n\ntype FetchOutcome =\n\t| { readonly error: NetworkError; readonly kind: \"transient\" }\n\t| { readonly error: OpenCloudError; readonly kind: \"failed\" }\n\t| { readonly kind: \"aborted\" }\n\t| { readonly kind: \"pending\"; readonly task: LuauExecutionTask }\n\t| { readonly kind: \"terminal\"; readonly task: LuauExecutionTask };\n\n/** Mutable-per-iteration loop state threaded through {@link applyOutcome}. */\ninterface LoopState {\n\treadonly consecutiveFailures: number;\n\treadonly lastTask: LuauExecutionTask | undefined;\n}\n\ntype LoopAction =\n\t| { readonly kind: \"continue\"; readonly state: LoopState }\n\t| { readonly kind: \"return\"; readonly result: Result<LuauExecutionTask, OpenCloudError> };\n\n/** Per-iteration inputs to {@link applyOutcome}. */\ninterface OutcomeContext {\n\treadonly maxFailures: number;\n\treadonly signal: AbortSignal | undefined;\n\treadonly state: LoopState;\n}\n\n/**\n * Defaults the per-request `timeout` to the effective poll budget when the\n * caller has not set one. A luau-execution submit and each poll `get` normally\n * answer in well under a second (the submit endpoint enqueues the task without\n * waiting for it to run), so the only job of a per-request deadline here is to\n * bound a black-hole connection. Leaving these requests on the client-wide 30s\n * default (tuned for snappy CRUD) turns a slow-but-alive backend into a\n * self-abort, an error the retry layer never retries by construction, before\n * the loop's wall-clock budget is ever consulted. Deriving the deadline from\n * `timeoutMs` keeps a single request alive exactly as long as the caller\n * already agreed to wait for the whole operation, so the backend can answer or\n * surface a retryable status instead.\n *\n * @template TOptions - The concrete polling option shape to preserve.\n * @param options - The caller's poll and per-request options.\n * @returns The options with `timeout` filled from the budget when it was unset.\n */\nexport function withBudgetRequestTimeout<TOptions extends PollUntilDoneOptions>(\n\toptions: TOptions,\n): TOptions & { readonly timeout: number } {\n\tconst timeout = options.timeout ?? options.timeoutMs ?? DEFAULT_POLL_TIMEOUT_MS;\n\treturn { ...options, timeout };\n}\n\n/**\n * Reports whether a Luau task can no longer change execution state.\n *\n * @param task - Task whose state should be classified.\n * @returns Whether the task is complete, failed, or cancelled.\n */\nexport function isTerminalTask(task: LuauExecutionTask): boolean {\n\treturn task.state === \"COMPLETE\" || task.state === \"FAILED\" || task.state === \"CANCELLED\";\n}\n\n/**\n * Core polling loop. Calls `deps.fetch()` repeatedly, sleeping\n * `pollDelay(elapsedMs)` ms between iterations, until a terminal state\n * is observed, the wall-clock budget is exhausted, or an `AbortSignal`\n * fires. A transient transport failure ({@link NetworkError}) is tolerated\n * and the loop continues, giving up only after `maxConsecutivePollFailures`\n * consecutive failures; any other failure aborts immediately, since an API\n * response (a 404 for a vanished task, a 403) means there is nothing left to\n * poll. A successful poll resets the failure count.\n *\n * @param deps - Injected fetch, now, and sleep callbacks.\n * @param options - Optional poll delay, timeout, failure cap, and abort signal.\n * @returns The terminal task, or an error if aborted, timed out, or the transport keeps failing.\n */\nexport async function pollUntilDoneCoreAsync(\n\tdeps: PollDependencies,\n\toptions: PollOptions = {},\n): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst { maxFailures, pollDelay, signal, timeoutMs } = resolvePollOptions(options);\n\tif (signal?.aborted === true) {\n\t\treturn abortedResult(signal);\n\t}\n\n\tconst startedAt = deps.now();\n\tlet state: LoopState = { consecutiveFailures: 0, lastTask: undefined };\n\tfor (;;) {\n\t\tconst elapsedMs = deps.now() - startedAt;\n\t\tif (elapsedMs >= timeoutMs) {\n\t\t\treturn { err: makeTimeout(state.lastTask, timeoutMs), success: false };\n\t\t}\n\n\t\tconst outcome = await fetchOnceAsync(deps, signal);\n\t\tconst action = applyOutcome(outcome, { maxFailures, signal, state });\n\t\tif (action.kind === \"return\") {\n\t\t\treturn action.result;\n\t\t}\n\n\t\t({ state } = action);\n\t\tconst sleepWasAborted = await sleepWithAbortAsync({\n\t\t\tms: pollDelay(elapsedMs),\n\t\t\tsignal,\n\t\t\tsleep: deps.sleep,\n\t\t});\n\t\tif (sleepWasAborted) {\n\t\t\treturn abortedResult(signal);\n\t\t}\n\t}\n}\n\nfunction resolvePollOptions(options: PollOptions): ResolvedPollOptions {\n\treturn {\n\t\tmaxFailures: options.maxConsecutivePollFailures ?? DEFAULT_POLL_FAILURE_CAP,\n\t\tpollDelay: options.pollDelay ?? defaultPollDelay,\n\t\tsignal: options.signal,\n\t\ttimeoutMs: options.timeoutMs ?? DEFAULT_POLL_TIMEOUT_MS,\n\t};\n}\n\nfunction makeAborted(signal: AbortSignal | undefined): PollAbortedError {\n\treturn new PollAbortedError(\"Polling was aborted\", { reason: signal?.reason });\n}\n\nfunction abortedResult(signal: AbortSignal | undefined): Result<LuauExecutionTask, OpenCloudError> {\n\treturn { err: makeAborted(signal), success: false };\n}\n\n/**\n * Maps a single fetch outcome to the next loop action. Terminal, failed, and\n * aborted outcomes return immediately; a transient transport failure advances\n * the consecutive-failure count and returns once it reaches `maxFailures`; a\n * pending task resets the count and continues.\n *\n * @param outcome - The classified result of one poll fetch.\n * @param context - The loop state, failure cap, and abort signal.\n * @returns Whether to return a final Result or continue with updated state.\n */\nfunction applyOutcome(\n\toutcome: FetchOutcome,\n\t{ maxFailures, signal, state }: OutcomeContext,\n): LoopAction {\n\tswitch (outcome.kind) {\n\t\tcase \"aborted\": {\n\t\t\treturn { kind: \"return\", result: abortedResult(signal) };\n\t\t}\n\t\tcase \"failed\": {\n\t\t\treturn { kind: \"return\", result: { err: outcome.error, success: false } };\n\t\t}\n\t\tcase \"pending\": {\n\t\t\treturn { kind: \"continue\", state: { consecutiveFailures: 0, lastTask: outcome.task } };\n\t\t}\n\t\tcase \"terminal\": {\n\t\t\treturn { kind: \"return\", result: { data: outcome.task, success: true } };\n\t\t}\n\t\tcase \"transient\": {\n\t\t\tconst consecutiveFailures = state.consecutiveFailures + 1;\n\t\t\tif (consecutiveFailures >= maxFailures) {\n\t\t\t\treturn { kind: \"return\", result: { err: outcome.error, success: false } };\n\t\t\t}\n\n\t\t\treturn { kind: \"continue\", state: { consecutiveFailures, lastTask: state.lastTask } };\n\t\t}\n\t}\n}\n\nasync function sleepWithAbortAsync({ ms, signal, sleep }: SleepWithAbortOptions): Promise<boolean> {\n\treturn (await raceWithAbortAsync(async () => sleep(ms, signal), signal)) === ABORTED;\n}\n\nfunction makeTimeout(\n\ttask: LuauExecutionTask | undefined,\n\ttimeoutMs: number,\n): PollTimeoutError<LuauExecutionTask> {\n\treturn new PollTimeoutError(`Polling timed out after ${timeoutMs} ms`, {\n\t\tlastObservedTask: task,\n\t\ttimeoutMs,\n\t});\n}\n\n/**\n * A failed poll is worth re-polling only when it is a `NetworkError` carrying a\n * known transient transport code. A self-aborted request timeout has no\n * `code`, and an API response (4xx/5xx) is authoritative, so both abort the\n * loop rather than being re-polled. Transient-ness is classified against the\n * canonical `TRANSIENT_TRANSPORT_CODES` set; this is the loop's own tolerance\n * dimension, distinct from the per-request `retryableTransportCodes` override\n * (which governs request-level retries inside each poll). Loop tolerance is\n * bounded separately by `maxConsecutivePollFailures`.\n *\n * A 2xx whose body would not parse is deliberately not re-polled here: it is\n * recovered a layer down, by the request-level retry that\n * `RESPONSE_UNPARSEABLE` puts in every idempotent policy. Reaching this\n * function means that retry budget is already spent, and a fourth read of the\n * same body is not a different answer.\n *\n * @param error - The error returned by a failed poll.\n * @returns `true` when the loop should tolerate and re-poll.\n */\nfunction isTransientTransport(error: OpenCloudError): error is NetworkError {\n\tif (!(error instanceof NetworkError)) {\n\t\treturn false;\n\t}\n\n\tconst code = findErrorCode(error);\n\treturn code !== undefined && TRANSIENT_TRANSPORT_CODES.includes(code);\n}\n\nasync function fetchOnceAsync(\n\tdependencies: PollDependencies,\n\tsignal: AbortSignal | undefined,\n): Promise<FetchOutcome> {\n\tconst fetchResult = await raceWithAbortAsync(dependencies.fetch, signal);\n\tif (fetchResult === ABORTED) {\n\t\treturn { kind: \"aborted\" };\n\t}\n\n\tif (!fetchResult.success) {\n\t\treturn isTransientTransport(fetchResult.err)\n\t\t\t? { error: fetchResult.err, kind: \"transient\" }\n\t\t\t: { error: fetchResult.err, kind: \"failed\" };\n\t}\n\n\treturn isTerminalTask(fetchResult.data)\n\t\t? { kind: \"terminal\", task: fetchResult.data }\n\t\t: { kind: \"pending\", task: fetchResult.data };\n}\n","import type { RequestOptions } from \"../../client/types.ts\";\nimport {\n\tGET_SPEC,\n\tSUBMIT_HEAD_SPEC,\n\tSUBMIT_VERSION_SPEC,\n} from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { observeAdmissionWaitAsync } from \"../../internal/http/admission-wait.ts\";\nimport { waitDeadlineFailure } from \"../../internal/http/request-deadline.ts\";\nimport type { ResourceClient } from \"../../internal/resource-client.ts\";\nimport { raceWithAbortAsync } from \"../../internal/utils/abort.ts\";\nimport type { Result } from \"../../types.ts\";\nimport { capacityErrorFrom, LuauExecutionCapacityError, luauTaskRefKey } from \"./capacity-error.ts\";\nimport { defaultPollDelay, isTerminalTask, type PollUntilDoneOptions } from \"./polling.ts\";\n\nconst MAX_CAPACITY_WAIT_MS = 2_147_483_647;\n\n/**\n * Per-request options for submitting a Luau execution task.\n *\n * @example\n *\n * ```ts\n * import type { LuauExecutionSubmitOptions } from \"@bedrock-rbx/ocale/luau-execution\";\n *\n * const options: LuauExecutionSubmitOptions = { capacityWaitMs: 60_000 };\n * expect(options.capacityWaitMs).toBe(60_000);\n * ```\n *\n * @since 0.3.2\n */\nexport interface LuauExecutionSubmitOptions extends RequestOptions {\n\t/**\n\t * Maximum milliseconds to spend waiting for occupied place capacity, from 1\n\t * through 2,147,483,647. Supplying this value opts the submission into\n\t * capacity-aware admission.\n\t */\n\treadonly capacityWaitMs?: number;\n}\n\n/**\n * Per-request capacity and polling options for submitting and awaiting a Luau\n * execution task.\n *\n * @since 0.3.2\n */\nexport type LuauExecutionRunOptions = LuauExecutionSubmitOptions & PollUntilDoneOptions;\n\ninterface CapacitySubmitCall {\n\treadonly inner: ResourceClient;\n\treadonly options: LuauExecutionSubmitOptions | undefined;\n\treadonly parameters: SubmitAtHeadParameters | SubmitAtVersionParameters;\n}\n\ninterface SubmitOnceCall extends CapacitySubmitCall {\n\treadonly options: RequestOptions;\n\treadonly refineError?: ((error: OpenCloudError) => OpenCloudError) | undefined;\n}\n\ninterface ObserveBlockersCall {\n\treadonly blockers: ReadonlyArray<LuauExecutionTaskRef>;\n\treadonly inner: ResourceClient;\n\treadonly options: RequestOptions;\n}\n\ninterface CapacityWaitCall extends ObserveBlockersCall {\n\treadonly capacityError: LuauExecutionCapacityError;\n\treadonly deadlineAt: number;\n\treadonly startedAt: number;\n}\n\ninterface CapacityAdmissionCall {\n\treadonly callerSignal: AbortSignal | undefined;\n\treadonly capacityError: LuauExecutionCapacityError;\n\treadonly deadlineAt: number;\n\treadonly options: RequestOptions;\n\treadonly startedAt: number;\n\treadonly submitCall: SubmitOnceCall;\n}\n\ninterface CapacitySleepCall {\n\treadonly inner: ResourceClient;\n\treadonly options: RequestOptions;\n\treadonly waitMs: number;\n}\n\ninterface CapacityRetryCall {\n\treadonly callerSignal: AbortSignal | undefined;\n\treadonly current: LuauExecutionCapacityError;\n\treadonly options: RequestOptions;\n\treadonly submitCall: SubmitOnceCall;\n}\n\ntype CapacityRetryDecision =\n\t| { readonly capacityError: LuauExecutionCapacityError; readonly continue: true }\n\t| {\n\t\t\treadonly continue: false;\n\t\t\treadonly result: Result<LuauExecutionTask, OpenCloudError>;\n\t };\n\n/**\n * Submits through capacity admission when the caller opts in.\n *\n * @param call - Resource client, submit parameters, and per-request options.\n * @returns The submitted task or the failure that stopped admission.\n */\nexport async function submitWithCapacityAsync({\n\tinner,\n\toptions,\n\tparameters,\n}: CapacitySubmitCall): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst { capacityWaitMs, ...requestOptions } = options ?? {};\n\tif (capacityWaitMs === undefined) {\n\t\treturn submitOnceAsync({ inner, options: requestOptions, parameters });\n\t}\n\n\tfunction refineError(error: OpenCloudError): OpenCloudError {\n\t\treturn capacityErrorFrom(error, parameters) ?? error;\n\t}\n\n\tconst submitCall = { inner, options: requestOptions, parameters, refineError };\n\tconst first = await submitOnceAsync(submitCall);\n\tif (!isCapacityFailure(first)) {\n\t\treturn first;\n\t}\n\n\tif (\n\t\t!Number.isFinite(capacityWaitMs) ||\n\t\tcapacityWaitMs < 1 ||\n\t\tcapacityWaitMs > MAX_CAPACITY_WAIT_MS\n\t) {\n\t\treturn first;\n\t}\n\n\treturn admitWithinCapacityAsync({\n\t\tcapacityError: first.err,\n\t\toptions: requestOptions,\n\t\tsubmitCall,\n\t\twaitMs: capacityWaitMs,\n\t});\n}\n\nfunction isCapacityFailure(\n\tresult: Result<LuauExecutionTask, OpenCloudError>,\n): result is { readonly err: LuauExecutionCapacityError; readonly success: false } {\n\treturn !result.success && result.err instanceof LuauExecutionCapacityError;\n}\n\nasync function submitOnceAsync({\n\tinner,\n\toptions,\n\tparameters,\n\trefineError,\n}: SubmitOnceCall): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\treturn \"versionId\" in parameters\n\t\t? inner.executeAsync({ options, parameters, refineError, spec: SUBMIT_VERSION_SPEC })\n\t\t: inner.executeAsync({ options, parameters, refineError, spec: SUBMIT_HEAD_SPEC });\n}\n\nfunction capacityBoundAborted(\n\toptions: RequestOptions,\n\tcallerSignal: AbortSignal | undefined,\n): boolean {\n\treturn options.signal?.aborted === true && callerSignal?.aborted !== true;\n}\n\nasync function observeBlockersAsync({\n\tblockers,\n\tinner,\n\toptions,\n}: ObserveBlockersCall): Promise<Result<LuauExecutionTaskRef | undefined, OpenCloudError>> {\n\tfor (const blocker of blockers) {\n\t\tconst observed = await inner.executeAsync({\n\t\t\toptions,\n\t\t\tparameters: { ref: blocker, view: \"BASIC\" as const },\n\t\t\tspec: GET_SPEC,\n\t\t});\n\t\tif (!observed.success) {\n\t\t\treturn observed;\n\t\t}\n\n\t\tif (isTerminalTask(observed.data)) {\n\t\t\treturn { data: blocker, success: true };\n\t\t}\n\t}\n\n\treturn { data: undefined, success: true };\n}\n\nasync function sleepForCapacityAsync({ inner, options, waitMs }: CapacitySleepCall): Promise<void> {\n\tawait observeAdmissionWaitAsync({\n\t\tdurationMs: waitMs,\n\t\tobserver: options.onAdmissionWait,\n\t\treason: \"operation-capacity\",\n\t\twaitAsync: async () => {\n\t\t\treturn raceWithAbortAsync(\n\t\t\t\tasync () => inner.sleep(waitMs, options.signal),\n\t\t\t\toptions.signal,\n\t\t\t);\n\t\t},\n\t});\n}\n\nasync function observeWithinCapacityAsync({\n\tblockers,\n\tcapacityError,\n\tdeadlineAt,\n\tinner,\n\toptions,\n\tstartedAt,\n}: CapacityWaitCall): Promise<Result<LuauExecutionTaskRef, OpenCloudError>> {\n\twhile (Date.now() < deadlineAt) {\n\t\tconst observed = await observeBlockersAsync({ blockers, inner, options });\n\t\tif (!observed.success) {\n\t\t\treturn observed;\n\t\t}\n\n\t\tif (observed.data !== undefined) {\n\t\t\treturn { data: observed.data, success: true };\n\t\t}\n\n\t\tconst elapsedMs = Date.now() - startedAt;\n\t\tconst pollWaitMs = defaultPollDelay(elapsedMs);\n\t\tconst deadlineFailure = waitDeadlineFailure({\n\t\t\tcause: capacityError,\n\t\t\tdeadlineMs: options.deadlineMs,\n\t\t\twaitMs: pollWaitMs,\n\t\t\twaitReason: \"operation-capacity\",\n\t\t});\n\t\tif (deadlineFailure !== undefined) {\n\t\t\treturn { err: deadlineFailure, success: false };\n\t\t}\n\n\t\tconst waitMs = Math.min(pollWaitMs, deadlineAt - Date.now());\n\t\tawait sleepForCapacityAsync({ inner, options, waitMs });\n\t}\n\n\treturn { err: capacityError, success: false };\n}\n\nfunction hasSameBlockers(\n\tleft: LuauExecutionCapacityError,\n\tright: LuauExecutionCapacityError,\n): boolean {\n\tif (left.blockers.length !== right.blockers.length) {\n\t\treturn false;\n\t}\n\n\tconst rightKeys = new Set(right.blockers.map(luauTaskRefKey));\n\treturn left.blockers.every((blocker) => rightKeys.has(luauTaskRefKey(blocker)));\n}\n\nasync function retryAfterCapacityAsync({\n\tcallerSignal,\n\tcurrent,\n\toptions,\n\tsubmitCall,\n}: CapacityRetryCall): Promise<CapacityRetryDecision> {\n\tconst retried = await submitOnceAsync(submitCall);\n\tif (!retried.success && capacityBoundAborted(options, callerSignal)) {\n\t\treturn { continue: false, result: { err: current, success: false } };\n\t}\n\n\tif (!isCapacityFailure(retried) || hasSameBlockers(current, retried.err)) {\n\t\treturn { continue: false, result: retried };\n\t}\n\n\treturn { capacityError: retried.err, continue: true };\n}\n\nasync function runCapacityAdmissionAsync({\n\tcallerSignal,\n\tcapacityError,\n\tdeadlineAt,\n\toptions,\n\tstartedAt,\n\tsubmitCall,\n}: CapacityAdmissionCall): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst cleared = new Set<string>();\n\tlet current = capacityError;\n\twhile (true) {\n\t\tconst pending = current.blockers.filter((blocker) => !cleared.has(luauTaskRefKey(blocker)));\n\t\tif (pending.length === 0) {\n\t\t\treturn { err: current, success: false };\n\t\t}\n\n\t\tconst observed = await observeWithinCapacityAsync({\n\t\t\tblockers: pending,\n\t\t\tcapacityError: current,\n\t\t\tdeadlineAt,\n\t\t\tinner: submitCall.inner,\n\t\t\toptions,\n\t\t\tstartedAt,\n\t\t});\n\t\tif (!observed.success) {\n\t\t\treturn capacityBoundAborted(options, callerSignal)\n\t\t\t\t? { err: current, success: false }\n\t\t\t\t: observed;\n\t\t}\n\n\t\tcleared.add(luauTaskRefKey(observed.data));\n\t\tconst retry = await retryAfterCapacityAsync({ callerSignal, current, options, submitCall });\n\t\tif (!retry.continue) {\n\t\t\treturn retry.result;\n\t\t}\n\n\t\tcurrent = retry.capacityError;\n\t}\n}\n\nasync function admitWithinCapacityAsync({\n\tcapacityError,\n\toptions,\n\tsubmitCall,\n\twaitMs,\n}: {\n\treadonly capacityError: LuauExecutionCapacityError;\n\treadonly options: RequestOptions;\n\treadonly submitCall: SubmitOnceCall;\n\treadonly waitMs: number;\n}): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst deadline = new AbortController();\n\tconst timer = setTimeout(() => {\n\t\tdeadline.abort();\n\t}, waitMs);\n\tconst signal =\n\t\toptions.signal === undefined\n\t\t\t? deadline.signal\n\t\t\t: AbortSignal.any([options.signal, deadline.signal]);\n\tconst startedAt = Date.now();\n\ttry {\n\t\treturn await runCapacityAdmissionAsync({\n\t\t\tcallerSignal: options.signal,\n\t\t\tcapacityError,\n\t\t\tdeadlineAt: startedAt + waitMs,\n\t\t\toptions: { ...options, signal },\n\t\t\tstartedAt,\n\t\t\tsubmitCall: { ...submitCall, options: { ...submitCall.options, signal } },\n\t\t});\n\t} finally {\n\t\tclearTimeout(timer);\n\t}\n}\n","import { GET_SPEC } from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport type { ResourceClient } from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\nimport { type LuauExecutionRunOptions, submitWithCapacityAsync } from \"./capacity-admission.ts\";\nimport {\n\ttype PollDependencies,\n\tpollUntilDoneCoreAsync,\n\ttype PollUntilDoneOptions,\n} from \"./polling.ts\";\n\n/**\n * Builds the {@link PollDependencies} bundle used by {@link\n * pollUntilDoneCoreAsync}, closing over the supplied {@link ResourceClient},\n * task ref, and per-request options so the core loop stays narrow.\n *\n * @param inner - The {@link ResourceClient} that issues each `tasks.get` call.\n * @param args - The polling options and the task ref to fetch on every iteration.\n * @returns A {@link PollDependencies} bundle wiring `fetch`, `now`, and `sleep`.\n */\nexport function buildPollDependencies(\n\tinner: ResourceClient,\n\targs: { options: PollUntilDoneOptions; ref: LuauExecutionTaskRef },\n): PollDependencies {\n\treturn {\n\t\tfetch: async () => {\n\t\t\treturn inner.executeAsync({\n\t\t\t\toptions: args.options,\n\t\t\t\tparameters: { ref: args.ref, view: \"BASIC\" },\n\t\t\t\tspec: GET_SPEC,\n\t\t\t});\n\t\t},\n\t\tnow: Date.now,\n\t\tsleep: inner.sleep,\n\t};\n}\n\n/**\n * Submits a Luau execution task and polls it to a terminal state. Dispatches\n * to the head-version or specific-version submit spec based on the presence of\n * `versionId`, then delegates to {@link pollUntilDoneCoreAsync}.\n *\n * @param inner - The {@link ResourceClient} that issues submit and poll calls.\n * @param args - The polling options and submit parameters.\n * @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask}, or\n * the {@link OpenCloudError} that caused submit or polling to fail.\n */\nexport async function submitAndPollAsync(\n\tinner: ResourceClient,\n\t{\n\t\toptions,\n\t\tparameters,\n\t}: {\n\t\toptions: LuauExecutionRunOptions;\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters;\n\t},\n): Promise<Result<LuauExecutionTask, OpenCloudError>> {\n\tconst submitResult = await submitWithCapacityAsync({ inner, options, parameters });\n\tif (!submitResult.success) {\n\t\treturn submitResult;\n\t}\n\n\treturn pollUntilDoneCoreAsync(\n\t\tbuildPollDependencies(inner, { options, ref: submitResult.data.ref }),\n\t\toptions,\n\t);\n}\n"],"mappings":";;;;;;AAQA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;AAuBrB,IAAa,6BAAb,cAAgD,eAAe;;CAE9D;CACA,OAAgC;;;;;;CAOhC,YAAY,UAA+C;EAC1D,MAAM,uCAAuC,EAAE,MAAM,qBAAqB,CAAC;EAC3E,KAAK,WAAW,OAAO,OAAO,SAAS,KAAK,YAAY,OAAO,OAAO,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC;CACvF;AACD;;;;;;;AAQA,SAAgB,eAAe,KAAmC;CACjE,OAAO,GAAG,IAAI,UAAU,GAAG,IAAI,UAAU,GAAG,IAAI;AACjD;;;;;;;;;AAUA,SAAgB,kBACf,OACA,YACyC;CACzC,IAAI,EAAE,iBAAiB,mBAAmB,MAAM,SAAS,sBACxD;CAGD,MAAM,UAAU,gBAAgB,MAAM,OAAO;CAC7C,IAAI,YAAY,KAAA,GACf;CAGD,MAAM,WAAW,gBAAgB,SAAS,UAAU;CACpD,OAAO,SAAS,WAAW,IAAI,KAAA,IAAY,IAAI,2BAA2B,QAAQ;AACnF;AAEA,SAAS,gBAAgB,SAAoD;CAC5E,IAAI,YAAY,QAAQ,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAC3E;CAGD,MAAM,OAAO,QAAQ,IAAI,SAAS,MAAM;CACxC,MAAM,UAAU,QAAQ,IAAI,SAAS,SAAS;CAC9C,OAAO,SAAS,wBAAwB,OAAO,YAAY,WAAW,UAAU,KAAA;AACjF;AAEA,SAAS,aAAa,OAAuB;CAC5C,OAAO,MAAM,QAAQ,wBAAwB,MAAM;AACpD;AAEA,SAAS,gBAAgB,MAA4B,OAAqC;CACzF,OAAO,eAAe,IAAI,CAAC,CAAC,cAAc,eAAe,KAAK,CA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