@playcraft/common 0.1.43-beta → 0.1.45-beta

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.
@@ -0,0 +1,622 @@
1
+ import { z } from 'zod';
2
+ import { batchRunSchema } from './execution-admission.js';
3
+ /** Runtime: unified admission for every directory execution. Off = normal chat does not queue. */
4
+ export declare const EXECUTION_ADMISSION_ENABLED_ENV = "CLOUD_EXECUTION_ADMISSION_ENABLED";
5
+ /** Business + Runtime: new batch entry. Off = old production flow untouched. */
6
+ export declare const BATCH_FLOW_V2_ENABLED_ENV = "CLOUD_BATCH_FLOW_V2_ENABLED";
7
+ export declare const batchSourceFreezeRequestSchema: z.ZodObject<{
8
+ batchId: z.ZodString;
9
+ workspaceId: z.ZodString;
10
+ sourceDirectoryName: z.ZodString;
11
+ initiatorDirectoryName: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"root">]>>;
12
+ initiatorOperationId: z.ZodOptional<z.ZodString>;
13
+ syncId: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strict>;
15
+ export type BatchSourceFreezeRequest = z.infer<typeof batchSourceFreezeRequestSchema>;
16
+ /**
17
+ * `frozen`: snapshot captured and durable.
18
+ * `pending`: source directory busy with another turn — freeze runs after that turn and before the next.
19
+ */
20
+ export declare const batchSourceFreezeResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
21
+ status: z.ZodLiteral<"frozen">;
22
+ snapshot: z.ZodObject<{
23
+ batchId: z.ZodString;
24
+ commitHash: z.ZodString;
25
+ digest: z.ZodString;
26
+ sourceWorkspaceId: z.ZodString;
27
+ sourceDirectoryName: z.ZodString;
28
+ remoteRef: z.ZodOptional<z.ZodString>;
29
+ artifactKey: z.ZodOptional<z.ZodString>;
30
+ frozenAt: z.ZodString;
31
+ }, z.core.$strict>;
32
+ }, z.core.$strict>, z.ZodObject<{
33
+ status: z.ZodLiteral<"pending">;
34
+ batchId: z.ZodString;
35
+ }, z.core.$strict>, z.ZodObject<{
36
+ status: z.ZodLiteral<"failed">;
37
+ batchId: z.ZodString;
38
+ error: z.ZodString;
39
+ }, z.core.$strict>], "status">;
40
+ export type BatchSourceFreezeResult = z.infer<typeof batchSourceFreezeResultSchema>;
41
+ /** Sandbox `POST /runtime/batch-sources/freeze`. Synchronous; idempotent per batchId. */
42
+ export declare const sandboxBatchSourceFreezeRequestSchema: z.ZodObject<{
43
+ batchId: z.ZodString;
44
+ workspaceId: z.ZodString;
45
+ sourceDirectoryName: z.ZodString;
46
+ persist: z.ZodEnum<{
47
+ remote_ref: "remote_ref";
48
+ artifact: "artifact";
49
+ }>;
50
+ }, z.core.$strict>;
51
+ export type SandboxBatchSourceFreezeRequest = z.infer<typeof sandboxBatchSourceFreezeRequestSchema>;
52
+ /** `POST /runtime/batch-members/prepare` — clone/restore from snapshot (or resume commit), install deps. */
53
+ export declare const sandboxBatchMemberPrepareSchema: z.ZodObject<{
54
+ snapshot: z.ZodObject<{
55
+ batchId: z.ZodString;
56
+ commitHash: z.ZodString;
57
+ digest: z.ZodString;
58
+ sourceWorkspaceId: z.ZodString;
59
+ sourceDirectoryName: z.ZodString;
60
+ remoteRef: z.ZodOptional<z.ZodString>;
61
+ artifactKey: z.ZodOptional<z.ZodString>;
62
+ frozenAt: z.ZodString;
63
+ }, z.core.$strict>;
64
+ remixId: z.ZodNullable<z.ZodString>;
65
+ branchName: z.ZodString;
66
+ resumeFromCommit: z.ZodOptional<z.ZodString>;
67
+ runId: z.ZodString;
68
+ ownerFence: z.ZodNumber;
69
+ workspaceId: z.ZodString;
70
+ directoryName: z.ZodString;
71
+ occupancyId: z.ZodString;
72
+ }, z.core.$strict>;
73
+ export type SandboxBatchMemberPrepare = z.infer<typeof sandboxBatchMemberPrepareSchema>;
74
+ /** `POST /runtime/batch-members/generate` — one unattended turn on the shared session base. */
75
+ export declare const sandboxBatchMemberGenerateSchema: z.ZodObject<{
76
+ prompt: z.ZodString;
77
+ model: z.ZodOptional<z.ZodString>;
78
+ sessionId: z.ZodOptional<z.ZodString>;
79
+ runId: z.ZodString;
80
+ ownerFence: z.ZodNumber;
81
+ workspaceId: z.ZodString;
82
+ directoryName: z.ZodString;
83
+ occupancyId: z.ZodString;
84
+ }, z.core.$strict>;
85
+ export type SandboxBatchMemberGenerate = z.infer<typeof sandboxBatchMemberGenerateSchema>;
86
+ /** `POST /runtime/batch-members/deliver` — save exact commit, push, build from it, verify, publish. */
87
+ export declare const sandboxBatchMemberDeliverSchema: z.ZodObject<{
88
+ pushRemote: z.ZodBoolean;
89
+ fromCommit: z.ZodOptional<z.ZodString>;
90
+ runId: z.ZodString;
91
+ ownerFence: z.ZodNumber;
92
+ workspaceId: z.ZodString;
93
+ directoryName: z.ZodString;
94
+ occupancyId: z.ZodString;
95
+ }, z.core.$strict>;
96
+ export type SandboxBatchMemberDeliver = z.infer<typeof sandboxBatchMemberDeliverSchema>;
97
+ /** `POST /runtime/batch-members/:runId/stop`. */
98
+ export declare const sandboxBatchMemberStopSchema: z.ZodObject<{
99
+ runId: z.ZodString;
100
+ ownerFence: z.ZodNumber;
101
+ }, z.core.$strict>;
102
+ export declare const sandboxBatchMemberStateSchema: z.ZodEnum<{
103
+ unknown: "unknown";
104
+ completed: "completed";
105
+ running: "running";
106
+ failed: "failed";
107
+ idle: "idle";
108
+ stopped: "stopped";
109
+ stopping: "stopping";
110
+ needs_user: "needs_user";
111
+ }>;
112
+ export type SandboxBatchMemberState = z.infer<typeof sandboxBatchMemberStateSchema>;
113
+ /** Response of every member command and of `GET /runtime/batch-members/:runId`. Read-only query. */
114
+ export declare const sandboxBatchMemberStatusSchema: z.ZodObject<{
115
+ runId: z.ZodString;
116
+ ownerFence: z.ZodNumber;
117
+ phase: z.ZodEnum<{
118
+ prepare: "prepare";
119
+ generate: "generate";
120
+ deliver: "deliver";
121
+ }>;
122
+ state: z.ZodEnum<{
123
+ unknown: "unknown";
124
+ completed: "completed";
125
+ running: "running";
126
+ failed: "failed";
127
+ idle: "idle";
128
+ stopped: "stopped";
129
+ stopping: "stopping";
130
+ needs_user: "needs_user";
131
+ }>;
132
+ writersStopped: z.ZodBoolean;
133
+ sessionId: z.ZodOptional<z.ZodString>;
134
+ operationId: z.ZodOptional<z.ZodString>;
135
+ headCommit: z.ZodOptional<z.ZodString>;
136
+ evidence: z.ZodOptional<z.ZodObject<{
137
+ savedCommit: z.ZodString;
138
+ pushedCommit: z.ZodOptional<z.ZodString>;
139
+ buildDigest: z.ZodOptional<z.ZodString>;
140
+ verified: z.ZodOptional<z.ZodBoolean>;
141
+ previewRef: z.ZodOptional<z.ZodString>;
142
+ }, z.core.$strict>>;
143
+ error: z.ZodOptional<z.ZodString>;
144
+ updatedAt: z.ZodString;
145
+ }, z.core.$strict>;
146
+ export type SandboxBatchMemberStatus = z.infer<typeof sandboxBatchMemberStatusSchema>;
147
+ export declare const batchRunMemberInputSchema: z.ZodObject<{
148
+ resultVersionId: z.ZodString;
149
+ workspaceId: z.ZodString;
150
+ directoryName: z.ZodString;
151
+ remixId: z.ZodNullable<z.ZodString>;
152
+ branchName: z.ZodString;
153
+ prompt: z.ZodString;
154
+ model: z.ZodOptional<z.ZodString>;
155
+ resumeFromCommit: z.ZodOptional<z.ZodString>;
156
+ syncOfResultVersionId: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$strict>;
158
+ export type BatchRunMemberInput = z.infer<typeof batchRunMemberInputSchema>;
159
+ /** `POST /internal/batch-runs` — idempotent per resultVersionId. */
160
+ export declare const submitBatchRunsRequestSchema: z.ZodObject<{
161
+ batchId: z.ZodString;
162
+ userId: z.ZodString;
163
+ snapshot: z.ZodObject<{
164
+ batchId: z.ZodString;
165
+ commitHash: z.ZodString;
166
+ digest: z.ZodString;
167
+ sourceWorkspaceId: z.ZodString;
168
+ sourceDirectoryName: z.ZodString;
169
+ remoteRef: z.ZodOptional<z.ZodString>;
170
+ artifactKey: z.ZodOptional<z.ZodString>;
171
+ frozenAt: z.ZodString;
172
+ }, z.core.$strict>;
173
+ members: z.ZodArray<z.ZodObject<{
174
+ resultVersionId: z.ZodString;
175
+ workspaceId: z.ZodString;
176
+ directoryName: z.ZodString;
177
+ remixId: z.ZodNullable<z.ZodString>;
178
+ branchName: z.ZodString;
179
+ prompt: z.ZodString;
180
+ model: z.ZodOptional<z.ZodString>;
181
+ resumeFromCommit: z.ZodOptional<z.ZodString>;
182
+ syncOfResultVersionId: z.ZodOptional<z.ZodString>;
183
+ }, z.core.$strict>>;
184
+ }, z.core.$strict>;
185
+ export type SubmitBatchRunsRequest = z.infer<typeof submitBatchRunsRequestSchema>;
186
+ export declare const batchRunViewSchema: z.ZodObject<{
187
+ runId: z.ZodString;
188
+ batchId: z.ZodString;
189
+ resultVersionId: z.ZodString;
190
+ runtimeId: z.ZodString;
191
+ workspaceId: z.ZodString;
192
+ directoryName: z.ZodString;
193
+ occupancyId: z.ZodOptional<z.ZodString>;
194
+ sessionId: z.ZodOptional<z.ZodString>;
195
+ operationId: z.ZodOptional<z.ZodString>;
196
+ status: z.ZodEnum<{
197
+ running: "running";
198
+ failed: "failed";
199
+ cancelled: "cancelled";
200
+ queued: "queued";
201
+ reconciling: "reconciling";
202
+ stopping: "stopping";
203
+ succeeded: "succeeded";
204
+ }>;
205
+ phase: z.ZodEnum<{
206
+ prepare: "prepare";
207
+ generate: "generate";
208
+ deliver: "deliver";
209
+ }>;
210
+ resumeFromCommit: z.ZodOptional<z.ZodString>;
211
+ evidence: z.ZodOptional<z.ZodObject<{
212
+ savedCommit: z.ZodString;
213
+ pushedCommit: z.ZodOptional<z.ZodString>;
214
+ buildDigest: z.ZodOptional<z.ZodString>;
215
+ verified: z.ZodOptional<z.ZodBoolean>;
216
+ previewRef: z.ZodOptional<z.ZodString>;
217
+ }, z.core.$strict>>;
218
+ previousRunId: z.ZodOptional<z.ZodString>;
219
+ autoRecoveryCount: z.ZodNumber;
220
+ cancelRequested: z.ZodBoolean;
221
+ ownerFence: z.ZodNumber;
222
+ revision: z.ZodNumber;
223
+ error: z.ZodOptional<z.ZodString>;
224
+ createdAt: z.ZodString;
225
+ updatedAt: z.ZodString;
226
+ queuePosition: z.ZodOptional<z.ZodNumber>;
227
+ }, z.core.$strict>;
228
+ export type BatchRunView = z.infer<typeof batchRunViewSchema>;
229
+ /** `POST /internal/batch-runs/:runId/sync` — replace input of a not-yet-started Run. */
230
+ export declare const replaceBatchRunSnapshotSchema: z.ZodObject<{
231
+ snapshot: z.ZodObject<{
232
+ batchId: z.ZodString;
233
+ commitHash: z.ZodString;
234
+ digest: z.ZodString;
235
+ sourceWorkspaceId: z.ZodString;
236
+ sourceDirectoryName: z.ZodString;
237
+ remoteRef: z.ZodOptional<z.ZodString>;
238
+ artifactKey: z.ZodOptional<z.ZodString>;
239
+ frozenAt: z.ZodString;
240
+ }, z.core.$strict>;
241
+ }, z.core.$strict>;
242
+ /**
243
+ * Running, stopping, or reconciling members cannot switch snapshot mid-execution.
244
+ * The caller stores `pending_sync` and applies it after the Run ends.
245
+ */
246
+ export declare const replaceBatchRunSnapshotResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
247
+ status: z.ZodLiteral<"replaced">;
248
+ run: z.ZodObject<{
249
+ runId: z.ZodString;
250
+ batchId: z.ZodString;
251
+ resultVersionId: z.ZodString;
252
+ runtimeId: z.ZodString;
253
+ workspaceId: z.ZodString;
254
+ directoryName: z.ZodString;
255
+ occupancyId: z.ZodOptional<z.ZodString>;
256
+ sessionId: z.ZodOptional<z.ZodString>;
257
+ operationId: z.ZodOptional<z.ZodString>;
258
+ status: z.ZodEnum<{
259
+ running: "running";
260
+ failed: "failed";
261
+ cancelled: "cancelled";
262
+ queued: "queued";
263
+ reconciling: "reconciling";
264
+ stopping: "stopping";
265
+ succeeded: "succeeded";
266
+ }>;
267
+ phase: z.ZodEnum<{
268
+ prepare: "prepare";
269
+ generate: "generate";
270
+ deliver: "deliver";
271
+ }>;
272
+ resumeFromCommit: z.ZodOptional<z.ZodString>;
273
+ evidence: z.ZodOptional<z.ZodObject<{
274
+ savedCommit: z.ZodString;
275
+ pushedCommit: z.ZodOptional<z.ZodString>;
276
+ buildDigest: z.ZodOptional<z.ZodString>;
277
+ verified: z.ZodOptional<z.ZodBoolean>;
278
+ previewRef: z.ZodOptional<z.ZodString>;
279
+ }, z.core.$strict>>;
280
+ previousRunId: z.ZodOptional<z.ZodString>;
281
+ autoRecoveryCount: z.ZodNumber;
282
+ cancelRequested: z.ZodBoolean;
283
+ ownerFence: z.ZodNumber;
284
+ revision: z.ZodNumber;
285
+ error: z.ZodOptional<z.ZodString>;
286
+ createdAt: z.ZodString;
287
+ updatedAt: z.ZodString;
288
+ queuePosition: z.ZodOptional<z.ZodNumber>;
289
+ }, z.core.$strict>;
290
+ }, z.core.$strict>, z.ZodObject<{
291
+ status: z.ZodLiteral<"pending_sync">;
292
+ runId: z.ZodString;
293
+ }, z.core.$strict>], "status">;
294
+ export type ReplaceBatchRunSnapshotResult = z.infer<typeof replaceBatchRunSnapshotResultSchema>;
295
+ /** Batch-level source fact. Present when the event is not about a member Run. */
296
+ export declare const batchSourceEventSubjectSchema: z.ZodObject<{
297
+ batchId: z.ZodString;
298
+ workspaceId: z.ZodString;
299
+ status: z.ZodEnum<{
300
+ failed: "failed";
301
+ ready: "ready";
302
+ lost: "lost";
303
+ }>;
304
+ snapshot: z.ZodOptional<z.ZodObject<{
305
+ batchId: z.ZodString;
306
+ commitHash: z.ZodString;
307
+ digest: z.ZodString;
308
+ sourceWorkspaceId: z.ZodString;
309
+ sourceDirectoryName: z.ZodString;
310
+ remoteRef: z.ZodOptional<z.ZodString>;
311
+ artifactKey: z.ZodOptional<z.ZodString>;
312
+ frozenAt: z.ZodString;
313
+ }, z.core.$strict>>;
314
+ error: z.ZodOptional<z.ZodString>;
315
+ }, z.core.$strict>;
316
+ export type BatchSourceEventSubject = z.infer<typeof batchSourceEventSubjectSchema>;
317
+ export declare const batchRunEventReasonSchema: z.ZodEnum<{
318
+ status_changed: "status_changed";
319
+ phase_changed: "phase_changed";
320
+ queue_changed: "queue_changed";
321
+ recovered: "recovered";
322
+ source_lost: "source_lost";
323
+ source_ready: "source_ready";
324
+ source_failed: "source_failed";
325
+ }>;
326
+ /**
327
+ * Runtime → Business `POST /api/internal/cloud-batches/runs/events`; at-least-once, ordered by revision.
328
+ * A member event carries `run`. A source freeze event carries `source` and no run.
329
+ * `source_ready` / `source_failed` are additive reason values.
330
+ */
331
+ export declare const batchRunEventSchema: z.ZodUnion<readonly [z.ZodObject<{
332
+ run: z.ZodObject<{
333
+ runId: z.ZodString;
334
+ batchId: z.ZodString;
335
+ resultVersionId: z.ZodString;
336
+ runtimeId: z.ZodString;
337
+ workspaceId: z.ZodString;
338
+ directoryName: z.ZodString;
339
+ occupancyId: z.ZodOptional<z.ZodString>;
340
+ sessionId: z.ZodOptional<z.ZodString>;
341
+ operationId: z.ZodOptional<z.ZodString>;
342
+ status: z.ZodEnum<{
343
+ running: "running";
344
+ failed: "failed";
345
+ cancelled: "cancelled";
346
+ queued: "queued";
347
+ reconciling: "reconciling";
348
+ stopping: "stopping";
349
+ succeeded: "succeeded";
350
+ }>;
351
+ phase: z.ZodEnum<{
352
+ prepare: "prepare";
353
+ generate: "generate";
354
+ deliver: "deliver";
355
+ }>;
356
+ resumeFromCommit: z.ZodOptional<z.ZodString>;
357
+ evidence: z.ZodOptional<z.ZodObject<{
358
+ savedCommit: z.ZodString;
359
+ pushedCommit: z.ZodOptional<z.ZodString>;
360
+ buildDigest: z.ZodOptional<z.ZodString>;
361
+ verified: z.ZodOptional<z.ZodBoolean>;
362
+ previewRef: z.ZodOptional<z.ZodString>;
363
+ }, z.core.$strict>>;
364
+ previousRunId: z.ZodOptional<z.ZodString>;
365
+ autoRecoveryCount: z.ZodNumber;
366
+ cancelRequested: z.ZodBoolean;
367
+ ownerFence: z.ZodNumber;
368
+ revision: z.ZodNumber;
369
+ error: z.ZodOptional<z.ZodString>;
370
+ createdAt: z.ZodString;
371
+ updatedAt: z.ZodString;
372
+ queuePosition: z.ZodOptional<z.ZodNumber>;
373
+ }, z.core.$strict>;
374
+ reason: z.ZodEnum<{
375
+ status_changed: "status_changed";
376
+ phase_changed: "phase_changed";
377
+ queue_changed: "queue_changed";
378
+ recovered: "recovered";
379
+ source_lost: "source_lost";
380
+ source_ready: "source_ready";
381
+ source_failed: "source_failed";
382
+ }>;
383
+ }, z.core.$strict>, z.ZodObject<{
384
+ source: z.ZodObject<{
385
+ batchId: z.ZodString;
386
+ workspaceId: z.ZodString;
387
+ status: z.ZodEnum<{
388
+ failed: "failed";
389
+ ready: "ready";
390
+ lost: "lost";
391
+ }>;
392
+ snapshot: z.ZodOptional<z.ZodObject<{
393
+ batchId: z.ZodString;
394
+ commitHash: z.ZodString;
395
+ digest: z.ZodString;
396
+ sourceWorkspaceId: z.ZodString;
397
+ sourceDirectoryName: z.ZodString;
398
+ remoteRef: z.ZodOptional<z.ZodString>;
399
+ artifactKey: z.ZodOptional<z.ZodString>;
400
+ frozenAt: z.ZodString;
401
+ }, z.core.$strict>>;
402
+ error: z.ZodOptional<z.ZodString>;
403
+ }, z.core.$strict>;
404
+ reason: z.ZodEnum<{
405
+ source_lost: "source_lost";
406
+ source_ready: "source_ready";
407
+ source_failed: "source_failed";
408
+ }>;
409
+ }, z.core.$strict>]>;
410
+ export type BatchRunEvent = z.infer<typeof batchRunEventSchema>;
411
+ export declare const batchSourceStatusSchema: z.ZodEnum<{
412
+ failed: "failed";
413
+ ready: "ready";
414
+ freezing: "freezing";
415
+ waiting_source_idle: "waiting_source_idle";
416
+ lost: "lost";
417
+ }>;
418
+ export type BatchSourceStatus = z.infer<typeof batchSourceStatusSchema>;
419
+ export declare const batchMemberDisplayStatusSchema: z.ZodEnum<{
420
+ failed: "failed";
421
+ cancelled: "cancelled";
422
+ queued: "queued";
423
+ generating: "generating";
424
+ preparing: "preparing";
425
+ reconciling: "reconciling";
426
+ stopping: "stopping";
427
+ succeeded: "succeeded";
428
+ pending_sync: "pending_sync";
429
+ source_failed: "source_failed";
430
+ waiting_source: "waiting_source";
431
+ delivering: "delivering";
432
+ }>;
433
+ export type BatchMemberDisplayStatus = z.infer<typeof batchMemberDisplayStatusSchema>;
434
+ export declare const batchMemberViewSchema: z.ZodObject<{
435
+ resultVersionId: z.ZodString;
436
+ ordinal: z.ZodNumber;
437
+ prompt: z.ZodString;
438
+ status: z.ZodEnum<{
439
+ failed: "failed";
440
+ cancelled: "cancelled";
441
+ queued: "queued";
442
+ generating: "generating";
443
+ preparing: "preparing";
444
+ reconciling: "reconciling";
445
+ stopping: "stopping";
446
+ succeeded: "succeeded";
447
+ pending_sync: "pending_sync";
448
+ source_failed: "source_failed";
449
+ waiting_source: "waiting_source";
450
+ delivering: "delivering";
451
+ }>;
452
+ queuePosition: z.ZodOptional<z.ZodNumber>;
453
+ directoryName: z.ZodOptional<z.ZodString>;
454
+ remixId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
455
+ sessionId: z.ZodOptional<z.ZodString>;
456
+ runId: z.ZodOptional<z.ZodString>;
457
+ previewRef: z.ZodOptional<z.ZodString>;
458
+ previewStale: z.ZodOptional<z.ZodBoolean>;
459
+ error: z.ZodOptional<z.ZodString>;
460
+ }, z.core.$strict>;
461
+ export type BatchMemberView = z.infer<typeof batchMemberViewSchema>;
462
+ export declare const batchViewSchema: z.ZodObject<{
463
+ batchId: z.ZodString;
464
+ workspaceId: z.ZodString;
465
+ sourceDirectoryName: z.ZodString;
466
+ sourceStatus: z.ZodEnum<{
467
+ failed: "failed";
468
+ ready: "ready";
469
+ freezing: "freezing";
470
+ waiting_source_idle: "waiting_source_idle";
471
+ lost: "lost";
472
+ }>;
473
+ cancelRequested: z.ZodBoolean;
474
+ counts: z.ZodObject<{
475
+ queued: z.ZodNumber;
476
+ running: z.ZodNumber;
477
+ succeeded: z.ZodNumber;
478
+ failed: z.ZodNumber;
479
+ cancelled: z.ZodNumber;
480
+ }, z.core.$strict>;
481
+ members: z.ZodArray<z.ZodObject<{
482
+ resultVersionId: z.ZodString;
483
+ ordinal: z.ZodNumber;
484
+ prompt: z.ZodString;
485
+ status: z.ZodEnum<{
486
+ failed: "failed";
487
+ cancelled: "cancelled";
488
+ queued: "queued";
489
+ generating: "generating";
490
+ preparing: "preparing";
491
+ reconciling: "reconciling";
492
+ stopping: "stopping";
493
+ succeeded: "succeeded";
494
+ pending_sync: "pending_sync";
495
+ source_failed: "source_failed";
496
+ waiting_source: "waiting_source";
497
+ delivering: "delivering";
498
+ }>;
499
+ queuePosition: z.ZodOptional<z.ZodNumber>;
500
+ directoryName: z.ZodOptional<z.ZodString>;
501
+ remixId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
502
+ sessionId: z.ZodOptional<z.ZodString>;
503
+ runId: z.ZodOptional<z.ZodString>;
504
+ previewRef: z.ZodOptional<z.ZodString>;
505
+ previewStale: z.ZodOptional<z.ZodBoolean>;
506
+ error: z.ZodOptional<z.ZodString>;
507
+ }, z.core.$strict>>;
508
+ createdAt: z.ZodString;
509
+ }, z.core.$strict>;
510
+ export type BatchView = z.infer<typeof batchViewSchema>;
511
+ export declare const batchCreateAcceptedSchema: z.ZodObject<{
512
+ flowVersion: z.ZodLiteral<"v2">;
513
+ accepted: z.ZodLiteral<true>;
514
+ batchId: z.ZodString;
515
+ sourceStatus: z.ZodEnum<{
516
+ failed: "failed";
517
+ ready: "ready";
518
+ freezing: "freezing";
519
+ waiting_source_idle: "waiting_source_idle";
520
+ lost: "lost";
521
+ }>;
522
+ view: z.ZodObject<{
523
+ batchId: z.ZodString;
524
+ workspaceId: z.ZodString;
525
+ sourceDirectoryName: z.ZodString;
526
+ sourceStatus: z.ZodEnum<{
527
+ failed: "failed";
528
+ ready: "ready";
529
+ freezing: "freezing";
530
+ waiting_source_idle: "waiting_source_idle";
531
+ lost: "lost";
532
+ }>;
533
+ cancelRequested: z.ZodBoolean;
534
+ counts: z.ZodObject<{
535
+ queued: z.ZodNumber;
536
+ running: z.ZodNumber;
537
+ succeeded: z.ZodNumber;
538
+ failed: z.ZodNumber;
539
+ cancelled: z.ZodNumber;
540
+ }, z.core.$strict>;
541
+ members: z.ZodArray<z.ZodObject<{
542
+ resultVersionId: z.ZodString;
543
+ ordinal: z.ZodNumber;
544
+ prompt: z.ZodString;
545
+ status: z.ZodEnum<{
546
+ failed: "failed";
547
+ cancelled: "cancelled";
548
+ queued: "queued";
549
+ generating: "generating";
550
+ preparing: "preparing";
551
+ reconciling: "reconciling";
552
+ stopping: "stopping";
553
+ succeeded: "succeeded";
554
+ pending_sync: "pending_sync";
555
+ source_failed: "source_failed";
556
+ waiting_source: "waiting_source";
557
+ delivering: "delivering";
558
+ }>;
559
+ queuePosition: z.ZodOptional<z.ZodNumber>;
560
+ directoryName: z.ZodOptional<z.ZodString>;
561
+ remixId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
562
+ sessionId: z.ZodOptional<z.ZodString>;
563
+ runId: z.ZodOptional<z.ZodString>;
564
+ previewRef: z.ZodOptional<z.ZodString>;
565
+ previewStale: z.ZodOptional<z.ZodBoolean>;
566
+ error: z.ZodOptional<z.ZodString>;
567
+ }, z.core.$strict>>;
568
+ createdAt: z.ZodString;
569
+ }, z.core.$strict>;
570
+ }, z.core.$strict>;
571
+ export type BatchCreateAccepted = z.infer<typeof batchCreateAcceptedSchema>;
572
+ export declare function isBatchFlowV2Enabled(env?: NodeJS.ProcessEnv): boolean;
573
+ /** When v2 is enabled, pause new batch intake during cutover (design §11 step 2). */
574
+ export declare const BATCH_FLOW_V2_INTAKE_PAUSED_ENV = "CLOUD_BATCH_V2_INTAKE_PAUSED";
575
+ export declare function isBatchFlowV2IntakePaused(env?: NodeJS.ProcessEnv): boolean;
576
+ export declare function batchMemberDisplayStatus(run: Pick<z.infer<typeof batchRunSchema>, 'status' | 'phase'> | undefined, source: BatchSourceStatus, pendingSync?: boolean): BatchMemberDisplayStatus;
577
+ /** `GET /runtime/workspaces/:workspaceId/execution-queue` — open occupancies of the caller's sandbox. */
578
+ export declare const executionQueueEntrySchema: z.ZodObject<{
579
+ occupancyId: z.ZodString;
580
+ workspaceId: z.ZodString;
581
+ directoryName: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"root">]>;
582
+ source: z.ZodEnum<{
583
+ session_turn: "session_turn";
584
+ preview_build: "preview_build";
585
+ batch_run: "batch_run";
586
+ }>;
587
+ status: z.ZodEnum<{
588
+ queued: "queued";
589
+ active: "active";
590
+ waiting_user: "waiting_user";
591
+ reconciling: "reconciling";
592
+ }>;
593
+ operationId: z.ZodOptional<z.ZodString>;
594
+ runId: z.ZodOptional<z.ZodString>;
595
+ queuePosition: z.ZodOptional<z.ZodNumber>;
596
+ }, z.core.$strict>;
597
+ export type ExecutionQueueEntry = z.infer<typeof executionQueueEntrySchema>;
598
+ export declare const executionQueueViewSchema: z.ZodObject<{
599
+ workspaceMax: z.ZodNumber;
600
+ sandboxMax: z.ZodNumber;
601
+ entries: z.ZodArray<z.ZodObject<{
602
+ occupancyId: z.ZodString;
603
+ workspaceId: z.ZodString;
604
+ directoryName: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"root">]>;
605
+ source: z.ZodEnum<{
606
+ session_turn: "session_turn";
607
+ preview_build: "preview_build";
608
+ batch_run: "batch_run";
609
+ }>;
610
+ status: z.ZodEnum<{
611
+ queued: "queued";
612
+ active: "active";
613
+ waiting_user: "waiting_user";
614
+ reconciling: "reconciling";
615
+ }>;
616
+ operationId: z.ZodOptional<z.ZodString>;
617
+ runId: z.ZodOptional<z.ZodString>;
618
+ queuePosition: z.ZodOptional<z.ZodNumber>;
619
+ }, z.core.$strict>>;
620
+ }, z.core.$strict>;
621
+ export type ExecutionQueueView = z.infer<typeof executionQueueViewSchema>;
622
+ //# sourceMappingURL=batch-runs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-runs.d.ts","sourceRoot":"","sources":["../../../src/cloud-workspace/runtime/batch-runs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAGL,cAAc,EAEf,MA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