@comfyorg/ingest-types 1.0.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.
@@ -0,0 +1,3926 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ import { z } from 'zod';
3
+ /**
4
+ * Subscription tier (uppercase to match comfy-api)
5
+ */
6
+ export const zSubscriptionTier = z.enum([
7
+ 'FREE',
8
+ 'STANDARD',
9
+ 'CREATOR',
10
+ 'PRO',
11
+ 'FOUNDERS_EDITION',
12
+ 'TEAM',
13
+ 'ENTERPRISE'
14
+ ]);
15
+ /**
16
+ * Workspace entity annotated with the requesting user's role.
17
+ */
18
+ export const zWorkspaceWithRole = z.object({
19
+ created_at: z.string().datetime(),
20
+ id: z.string(),
21
+ joined_at: z.string().datetime(),
22
+ name: z.string(),
23
+ role: z.enum(['owner', 'member']),
24
+ subscription_tier: zSubscriptionTier.optional(),
25
+ type: z.enum(['personal', 'team'])
26
+ });
27
+ /**
28
+ * Abbreviated workspace metadata used in list responses.
29
+ */
30
+ export const zWorkspaceSummary = z.object({
31
+ id: z.string(),
32
+ name: z.string(),
33
+ type: z.enum(['personal', 'team'])
34
+ });
35
+ /**
36
+ * Metadata for a workspace-scoped API key (secret is never returned).
37
+ */
38
+ export const zWorkspaceApiKeyInfo = z.object({
39
+ created_at: z.string().datetime(),
40
+ description: z.string().max(5000),
41
+ expires_at: z.string().datetime().optional(),
42
+ id: z.string().uuid(),
43
+ key_prefix: z.string(),
44
+ last_used_at: z.string().datetime().optional(),
45
+ name: z.string(),
46
+ revoked_at: z.string().datetime().optional(),
47
+ user_id: z.string(),
48
+ workspace_id: z.string()
49
+ });
50
+ /**
51
+ * Full workspace entity with configuration and ownership details.
52
+ */
53
+ export const zWorkspace = z.object({
54
+ created_at: z.string().datetime(),
55
+ id: z.string(),
56
+ name: z.string(),
57
+ type: z.enum(['personal', 'team'])
58
+ });
59
+ /**
60
+ * Metadata for a single workflow version.
61
+ */
62
+ export const zWorkflowVersionResponse = z.object({
63
+ created_at: z.string().datetime(),
64
+ created_by: z.string(),
65
+ id: z.string(),
66
+ latest_version: z.number().int(),
67
+ version: z.number().int()
68
+ });
69
+ /**
70
+ * Full workflow version including the serialized workflow JSON.
71
+ */
72
+ export const zWorkflowVersionContentResponse = z.object({
73
+ created_at: z.string().datetime(),
74
+ created_by: z.string(),
75
+ dependency_asset_ids: z.array(z.string()).optional(),
76
+ id: z.string(),
77
+ version: z.number().int(),
78
+ workflow_json: z.record(z.unknown())
79
+ });
80
+ /**
81
+ * Workflow metadata captured at mint time. The subsequent PUT body is the
82
+ * raw workflow JSON document and nothing else, so everything that would
83
+ * normally accompany workflow_json in POST /api/workflows is declared
84
+ * here instead.
85
+ *
86
+ */
87
+ export const zWorkflowUploadUrlRequest = z.object({
88
+ default_view: z.enum(['workflow', 'app']).optional(),
89
+ description: z.string().max(2000).optional(),
90
+ forked_from_workflow_id: z.string().max(128).optional(),
91
+ forked_from_workflow_version_id: z.string().max(128).optional(),
92
+ name: z.string().max(255).optional()
93
+ });
94
+ /**
95
+ * Reference to the parent workflow from which this workflow was forked.
96
+ */
97
+ export const zWorkflowForkedFrom = z.object({
98
+ workflow_id: z.string().optional(),
99
+ workflow_version_id: z.string().optional()
100
+ });
101
+ /**
102
+ * Full workflow entity including metadata and version history.
103
+ */
104
+ export const zWorkflowResponse = z.object({
105
+ created_at: z.string().datetime(),
106
+ created_by: z.string(),
107
+ default_view: z.enum(['workflow', 'app']).optional(),
108
+ description: z.string().optional(),
109
+ forked_from: zWorkflowForkedFrom.optional(),
110
+ id: z.string(),
111
+ latest_version: z.number().int(),
112
+ name: z.string().optional(),
113
+ updated_at: z.string().datetime()
114
+ });
115
+ /**
116
+ * Lightweight asset reference used in workflow publishing payloads.
117
+ */
118
+ export const zAssetInfo = z.object({
119
+ id: z.string(),
120
+ in_library: z.boolean(),
121
+ model: z.boolean(),
122
+ name: z.string(),
123
+ preview_url: z.string(),
124
+ public: z.boolean(),
125
+ storage_url: z.string()
126
+ });
127
+ /**
128
+ * Publishing metadata for a workflow shared to the Hub.
129
+ */
130
+ export const zWorkflowPublishInfo = z.object({
131
+ assets: z.array(zAssetInfo),
132
+ listed: z.boolean(),
133
+ publish_time: z.string().datetime().nullish(),
134
+ share_id: z.string(),
135
+ workflow_id: z.string()
136
+ });
137
+ /**
138
+ * Pagination metadata included in list responses. Supports both legacy
139
+ * offset/limit pagination and cursor-based pagination. When cursor-based
140
+ * pagination is used, `next_cursor` is the primary pagination token and
141
+ * `offset`/`total` may be zero.
142
+ *
143
+ */
144
+ export const zPaginationInfo = z.object({
145
+ has_more: z.boolean(),
146
+ limit: z.number().int().gte(1),
147
+ next_cursor: z.string().optional(),
148
+ offset: z.number().int().gte(0),
149
+ total: z.number().int().gte(0)
150
+ });
151
+ /**
152
+ * Paginated list of saved workflows.
153
+ */
154
+ export const zWorkflowListResponse = z.object({
155
+ data: z.array(zWorkflowResponse),
156
+ pagination: zPaginationInfo
157
+ });
158
+ /**
159
+ * Response containing assets associated with a workflow.
160
+ */
161
+ export const zWorkflowApiAssetsResponse = z.object({
162
+ assets: z.array(zAssetInfo)
163
+ });
164
+ /**
165
+ * Request body for querying assets associated with a workflow.
166
+ */
167
+ export const zWorkflowApiAssetsRequest = z.object({
168
+ workflow_api_json: z.record(z.unknown())
169
+ });
170
+ /**
171
+ * Details of a single validation error encountered during asset operations.
172
+ */
173
+ export const zValidationError = z.object({
174
+ code: z.string(),
175
+ field: z.string(),
176
+ message: z.string()
177
+ });
178
+ /**
179
+ * Result of validating a set of asset operations.
180
+ */
181
+ export const zValidationResult = z.object({
182
+ errors: z.array(zValidationError).optional(),
183
+ is_valid: z.boolean(),
184
+ warnings: z.array(zValidationError).optional()
185
+ });
186
+ /**
187
+ * User information response
188
+ */
189
+ export const zUserResponse = z.object({
190
+ id: z.string(),
191
+ status: z.string()
192
+ });
193
+ /**
194
+ * User data listing entry with file metadata (path, size, modification time).
195
+ */
196
+ export const zUserDataResponseFull = z.object({
197
+ modified: z.coerce
198
+ .bigint()
199
+ .min(BigInt('-9223372036854775808'), {
200
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
201
+ })
202
+ .max(BigInt('9223372036854775807'), {
203
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
204
+ })
205
+ .optional(),
206
+ path: z.string().optional(),
207
+ size: z.number().int().optional()
208
+ });
209
+ export const zUsageBalance = z.object({
210
+ amount_micros: z.number().optional(),
211
+ cloud_credit_balance_micros: z.number().optional(),
212
+ currency: z.string().optional(),
213
+ prepaid_balance_micros: z.number().optional()
214
+ });
215
+ export const zUsageSummary = z.object({
216
+ balance: zUsageBalance.optional(),
217
+ spend_micros: z.number()
218
+ });
219
+ export const zUsageBucket = z.object({
220
+ cost_micros: z.number(),
221
+ group_key: z.string(),
222
+ period_end: z.string().datetime(),
223
+ period_start: z.string().datetime()
224
+ });
225
+ export const zUsageBreakdownRow = z.object({
226
+ cost_micros: z.number(),
227
+ group_key: z.string(),
228
+ share: z.number()
229
+ });
230
+ export const zUsageTimeSeries = z.object({
231
+ breakdown: z.array(zUsageBreakdownRow),
232
+ buckets: z.array(zUsageBucket),
233
+ ending_before: z.string().datetime(),
234
+ granularity: z.enum(['hour', 'day', 'month']),
235
+ group_by: z.enum(['model', 'endpoint', 'product']),
236
+ groups: z.array(z.string()),
237
+ starting_on: z.string().datetime(),
238
+ summary: zUsageSummary
239
+ });
240
+ /**
241
+ * A minted single-use upload grant.
242
+ */
243
+ export const zUploadGrantResponse = z.object({
244
+ expires_in: z.number().int(),
245
+ upload_path: z.string()
246
+ });
247
+ /**
248
+ * Request body for updating an existing workspace's settings.
249
+ */
250
+ export const zUpdateWorkspaceRequest = z.object({
251
+ name: z.string().min(1).max(100).optional()
252
+ });
253
+ /**
254
+ * Request body for updating an existing saved workflow.
255
+ */
256
+ export const zUpdateWorkflowRequest = z.object({
257
+ default_view: z.enum(['workflow', 'app']).optional(),
258
+ description: z.string().optional(),
259
+ name: z.string().optional()
260
+ });
261
+ /**
262
+ * Request body for updating an existing user secret.
263
+ */
264
+ export const zUpdateSecretRequest = z.object({
265
+ name: z.string().min(1).max(255).optional(),
266
+ secret_value: z.string().min(1).optional()
267
+ });
268
+ /**
269
+ * Request body for changing a workspace member's role.
270
+ */
271
+ export const zUpdateMemberRoleRequest = z.object({
272
+ role: z.enum(['owner', 'member'])
273
+ });
274
+ /**
275
+ * Request body for updating an existing Hub profile.
276
+ */
277
+ export const zUpdateHubProfileRequest = z.object({
278
+ avatar_token: z.string().nullish(),
279
+ description: z.string().optional(),
280
+ display_name: z.string().optional(),
281
+ website_urls: z.array(z.string()).optional()
282
+ });
283
+ /**
284
+ * Pre/post-discount price for a team credit stop, in cents.
285
+ */
286
+ export const zTeamCreditStopPrice = z.object({
287
+ list_price_cents: z.coerce
288
+ .bigint()
289
+ .min(BigInt('-9223372036854775808'), {
290
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
291
+ })
292
+ .max(BigInt('9223372036854775807'), {
293
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
294
+ }),
295
+ price_cents: z.coerce
296
+ .bigint()
297
+ .min(BigInt('-9223372036854775808'), {
298
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
299
+ })
300
+ .max(BigInt('9223372036854775807'), {
301
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
302
+ })
303
+ });
304
+ /**
305
+ * A selectable preset on the team pricing slider. Echoed on subscribe via
306
+ * team_credit_stop_id; the backend owns the resolved amounts. credits is a
307
+ * RAW monthly credit count (not cents). Save% is derived by the FE as
308
+ * (list_price_cents - price_cents) / list_price_cents.
309
+ *
310
+ */
311
+ export const zTeamCreditStop = z.object({
312
+ credits: z.coerce
313
+ .bigint()
314
+ .min(BigInt('-9223372036854775808'), {
315
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
316
+ })
317
+ .max(BigInt('9223372036854775807'), {
318
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
319
+ }),
320
+ id: z.string(),
321
+ monthly: zTeamCreditStopPrice,
322
+ yearly: zTeamCreditStopPrice
323
+ });
324
+ /**
325
+ * Credit-stop ladder for the pricing slider (BE-1254). Returned by GET /api/billing/plans for every workspace regardless of the caller's token or workspace type (the personal/team distinction was removed); omitted only when the catalog defines no stops.
326
+ */
327
+ export const zTeamCreditStops = z.object({
328
+ default_stop_index: z.number().int(),
329
+ stops: z.array(zTeamCreditStop)
330
+ });
331
+ /**
332
+ * The team credit stop a workspace is currently subscribed to: the
333
+ * per-workspace slider choice recorded at subscribe time
334
+ * (workspace_subscriptions.team_credit_stop_id). Amounts are owned by the
335
+ * catalog, not the subscription row. Returned on GET /api/billing/status
336
+ * for per-credit Team plans (BE-1254).
337
+ *
338
+ */
339
+ export const zTeamCreditStopSummary = z.object({
340
+ credits_monthly: z.coerce
341
+ .bigint()
342
+ .min(BigInt('-9223372036854775808'), {
343
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
344
+ })
345
+ .max(BigInt('9223372036854775807'), {
346
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
347
+ }),
348
+ id: z.string(),
349
+ stop_usd: z.coerce
350
+ .bigint()
351
+ .min(BigInt('-9223372036854775808'), {
352
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
353
+ })
354
+ .max(BigInt('9223372036854775807'), {
355
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
356
+ })
357
+ });
358
+ /**
359
+ * Task data for list views
360
+ */
361
+ export const zTaskEntry = z.object({
362
+ completed_at: z.string().datetime().optional(),
363
+ create_time: z.string().datetime(),
364
+ id: z.string().uuid(),
365
+ started_at: z.string().datetime().optional(),
366
+ status: z.enum(['created', 'running', 'completed', 'failed']),
367
+ task_name: z.string()
368
+ });
369
+ /**
370
+ * Paginated list of background tasks for the authenticated user.
371
+ */
372
+ export const zTasksListResponse = z.object({
373
+ pagination: zPaginationInfo,
374
+ tasks: z.array(zTaskEntry)
375
+ });
376
+ /**
377
+ * Full task details including payload and result
378
+ */
379
+ export const zTaskResponse = z.object({
380
+ completed_at: z.string().datetime().optional(),
381
+ create_time: z.string().datetime(),
382
+ error_message: z.string().optional(),
383
+ id: z.string().uuid(),
384
+ idempotency_key: z.string(),
385
+ payload: z.record(z.unknown()),
386
+ result: z.record(z.unknown()).optional(),
387
+ started_at: z.string().datetime().optional(),
388
+ status: z.enum(['created', 'running', 'completed', 'failed']),
389
+ task_name: z.string(),
390
+ update_time: z.string().datetime()
391
+ });
392
+ /**
393
+ * Response after adding, updating, or removing tags on an asset.
394
+ */
395
+ export const zTagsModificationResponse = z.object({
396
+ added: z.array(z.string()).optional(),
397
+ already_present: z.array(z.string()).optional(),
398
+ not_present: z.array(z.string()).optional(),
399
+ removed: z.array(z.string()).optional(),
400
+ total_tags: z.array(z.string())
401
+ });
402
+ /**
403
+ * Metadata for a single tag that can be applied to assets.
404
+ */
405
+ export const zTagInfo = z.object({
406
+ count: z.number().int(),
407
+ name: z.string()
408
+ });
409
+ /**
410
+ * System statistics response
411
+ */
412
+ export const zSystemStatsResponse = z.object({
413
+ devices: z.array(z.object({
414
+ name: z.string(),
415
+ type: z.string(),
416
+ vram_free: z.number().optional(),
417
+ vram_total: z.number().optional()
418
+ })),
419
+ system: z.object({
420
+ argv: z.array(z.string()),
421
+ cloud_version: z.string().optional(),
422
+ comfyui_frontend_version: z.string().optional(),
423
+ comfyui_version: z.string(),
424
+ deploy_environment: z.string().optional(),
425
+ embedded_python: z.boolean(),
426
+ os: z.string(),
427
+ python_version: z.string(),
428
+ pytorch_version: z.string(),
429
+ ram_free: z.number(),
430
+ ram_total: z.number(),
431
+ workflow_templates_version: z.string().optional()
432
+ })
433
+ });
434
+ /**
435
+ * Billing period (uppercase to match comfy-api)
436
+ */
437
+ export const zSubscriptionDuration = z.enum(['MONTHLY', 'ANNUAL']);
438
+ export const zSubscriptionDiscount = z.object({
439
+ amount_off_cents: z.coerce
440
+ .bigint()
441
+ .min(BigInt('-9223372036854775808'), {
442
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
443
+ })
444
+ .max(BigInt('9223372036854775807'), {
445
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
446
+ })
447
+ .optional(),
448
+ code: z.string(),
449
+ kind: z.enum(['plan', 'promotion']),
450
+ name: z.string().optional()
451
+ });
452
+ /**
453
+ * Response after successfully subscribing to a billing plan.
454
+ */
455
+ export const zSubscribeResponse = z.object({
456
+ billing_op_id: z.string(),
457
+ effective_at: z.string().datetime().optional(),
458
+ payment_method_url: z.string().optional(),
459
+ status: z.enum(['subscribed', 'needs_payment_method', 'pending_payment'])
460
+ });
461
+ /**
462
+ * Request body for subscribing a workspace to a billing plan.
463
+ */
464
+ export const zSubscribeRequest = z.object({
465
+ billing_cycle: z.enum(['monthly', 'yearly']).optional(),
466
+ cancel_url: z.string().optional(),
467
+ checkout_attempt_id: z.string().optional(),
468
+ confirm_reactivation: z.boolean().optional(),
469
+ confirmation_token: z.string().optional(),
470
+ idempotency_key: z.string().optional(),
471
+ plan_slug: z.string(),
472
+ promotion_code: z.string().optional(),
473
+ proration_at: z.string().datetime().optional(),
474
+ quote_id: z.string().optional(),
475
+ quote_version: z.number().int().optional(),
476
+ return_url: z.string().optional(),
477
+ saved_payment_method_id: z.string().regex(/^pm_/).optional(),
478
+ team_credit_stop_id: z.string().optional()
479
+ });
480
+ /**
481
+ * The last-changed timestamp every stored setting carries.
482
+ */
483
+ export const zGlobalSettingUpdatedAt = z.object({
484
+ updated_at: z.string().datetime()
485
+ });
486
+ /**
487
+ * Consent to the in-app Agent panel. `true` is the only value that can be written — consent is revoked by DELETE, not by writing `false`, so the audit trail records a revocation rather than a value flip.
488
+ */
489
+ export const zAgentConsentSettingValue = z.object({
490
+ key: z.enum(['Comfy.AgentPanel.ConsentAccepted']),
491
+ value: z.literal(true)
492
+ });
493
+ /**
494
+ * A stored AgentConsentSettingValue with its timestamp. Named apart from the write schema because codegen derives nested property type names from the schema name, and `AgentConsentSetting` would generate an `AgentConsentSettingValue` that collides with the write schema itself.
495
+ */
496
+ export const zStoredAgentConsentSetting = zAgentConsentSettingValue.and(zGlobalSettingUpdatedAt);
497
+ /**
498
+ * First rejected op in an abort-remainder batch.
499
+ */
500
+ export const zDocOpFailure = z.object({
501
+ code: z.string(),
502
+ index: z.number().int(),
503
+ message: z.string(),
504
+ op_id: z.string().max(128).optional()
505
+ });
506
+ export const zDocOpsResultData = z.object({
507
+ applied: z.array(z.string()).optional(),
508
+ code: z.string().optional(),
509
+ failed: zDocOpFailure.optional(),
510
+ message: z.string().optional(),
511
+ ok: z.boolean(),
512
+ seq: z.coerce
513
+ .bigint()
514
+ .min(BigInt('-9223372036854775808'), {
515
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
516
+ })
517
+ .max(BigInt('9223372036854775807'), {
518
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
519
+ })
520
+ .optional(),
521
+ skipped: z.array(z.string()).optional(),
522
+ v: z.number().int().gte(1).lte(1),
523
+ workflow_id: z.string().min(1).max(128)
524
+ });
525
+ /**
526
+ * Host acknowledgement for a doc_ops batch.
527
+ */
528
+ export const zDocOpsResultFrame = z.object({
529
+ data: zDocOpsResultData,
530
+ type: z.enum(['doc_ops_result'])
531
+ });
532
+ export const zDocResetData = z.object({
533
+ actor: z.string().max(256).optional(),
534
+ seq: z.coerce
535
+ .bigint()
536
+ .min(BigInt('-9223372036854775808'), {
537
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
538
+ })
539
+ .max(BigInt('9223372036854775807'), {
540
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
541
+ }),
542
+ v: z.number().int().gte(1).lte(1),
543
+ workflow_id: z.string().min(1).max(128)
544
+ });
545
+ /**
546
+ * Host-to-follower lineage break. The follower must resubscribe for fresh state.
547
+ */
548
+ export const zDocResetFrame = z.object({
549
+ data: zDocResetData,
550
+ type: z.enum(['doc_reset'])
551
+ });
552
+ export const zDocUpdateData = z.object({
553
+ actor: z.string().max(256).optional(),
554
+ seq: z.coerce
555
+ .bigint()
556
+ .min(BigInt('-9223372036854775808'), {
557
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
558
+ })
559
+ .max(BigInt('9223372036854775807'), {
560
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
561
+ }),
562
+ update_b64: z.string(),
563
+ v: z.number().int().gte(1).lte(1),
564
+ workflow_id: z.string().min(1).max(128)
565
+ });
566
+ /**
567
+ * Host-to-follower incremental Yjs document update.
568
+ */
569
+ export const zDocUpdateFrame = z.object({
570
+ data: zDocUpdateData,
571
+ type: z.enum(['doc_update'])
572
+ });
573
+ /**
574
+ * Server-to-client CRDT document frame carried by the /ws envelope.
575
+ */
576
+ export const zServerDocFrame = z.union([
577
+ zDocUpdateFrame,
578
+ zDocResetFrame,
579
+ zDocOpsResultFrame
580
+ ]);
581
+ /**
582
+ * User secret metadata (the secret value itself is never returned after creation).
583
+ */
584
+ export const zSecretResponse = z.object({
585
+ created_at: z.string().datetime(),
586
+ credential_type: z.enum(['api_key', 'gcp_service_account']).optional(),
587
+ id: z.string().uuid(),
588
+ last_used_at: z.string().datetime().optional(),
589
+ name: z.string(),
590
+ provider: z.string().optional(),
591
+ updated_at: z.string().datetime()
592
+ });
593
+ /**
594
+ * One way a provider's credential can be entered. When a provider exposes more than one option, clients present a sub-selection; the selected option's credential_type is sent on CreateSecretRequest.
595
+ */
596
+ export const zCredentialOption = z.object({
597
+ credential_type: z.enum(['api_key', 'gcp_service_account']),
598
+ input_type: z.enum(['text', 'json_file']),
599
+ label: z.string()
600
+ });
601
+ /**
602
+ * A provider the user may configure a secret for, with its display label and credential-entry options.
603
+ */
604
+ export const zSecretProvider = z.object({
605
+ credential_options: z.array(zCredentialOption).optional(),
606
+ id: z.string(),
607
+ label: z.string().optional()
608
+ });
609
+ /**
610
+ * The providers available to the authenticated user in the current workspace.
611
+ */
612
+ export const zSecretProvidersResponse = z.object({
613
+ data: z.array(zSecretProvider)
614
+ });
615
+ /**
616
+ * List of user secrets with metadata only.
617
+ */
618
+ export const zSecretListResponse = z.object({
619
+ data: z.array(zSecretResponse)
620
+ });
621
+ /**
622
+ * A plan change persisted to take effect at a future billing boundary.
623
+ */
624
+ export const zScheduledPlanChange = z.object({
625
+ effective_at: z.string().datetime(),
626
+ plan_slug: z.string(),
627
+ team_credit_stop: zTeamCreditStopSummary.nullable()
628
+ });
629
+ export const zSavedPaymentMethod = z.object({
630
+ brand: z.string().optional(),
631
+ id: z.string().regex(/^pm_/),
632
+ is_default: z.boolean(),
633
+ last4: z
634
+ .string()
635
+ .regex(/^[0-9]{4}$/)
636
+ .optional(),
637
+ type: z.string()
638
+ });
639
+ /**
640
+ * Response after accepting a resubscribe request.
641
+ */
642
+ export const zResubscribeResponse = z.object({
643
+ billing_op_id: z.string(),
644
+ message: z.string().optional(),
645
+ status: z.enum(['active', 'pending'])
646
+ });
647
+ /**
648
+ * Request body for reactivating a previously cancelled subscription.
649
+ */
650
+ export const zResubscribeRequest = z.object({
651
+ idempotency_key: z.string().optional()
652
+ });
653
+ /**
654
+ * Response after a queue management action (delete or clear).
655
+ */
656
+ export const zQueueManageResponse = z.object({
657
+ cleared: z.boolean().optional(),
658
+ deleted: z.array(z.string()).optional()
659
+ });
660
+ /**
661
+ * Request to manage queue operations
662
+ */
663
+ export const zQueueManageRequest = z.object({
664
+ clear: z.boolean().optional(),
665
+ delete: z.array(z.string()).optional()
666
+ });
667
+ /**
668
+ * Queue information with pending and running jobs
669
+ */
670
+ export const zQueueInfo = z.object({
671
+ queue_pending: z
672
+ .array(z.tuple([z.unknown(), z.unknown(), z.unknown(), z.unknown(), z.unknown()]))
673
+ .optional(),
674
+ queue_running: z
675
+ .array(z.tuple([z.unknown(), z.unknown(), z.unknown(), z.unknown(), z.unknown()]))
676
+ .optional()
677
+ });
678
+ /**
679
+ * Full detail of a publicly published workflow on the Hub.
680
+ */
681
+ export const zPublishedWorkflowDetail = z.object({
682
+ assets: z.array(zAssetInfo),
683
+ listed: z.boolean(),
684
+ name: z.string(),
685
+ publish_time: z.string().datetime().nullish(),
686
+ share_id: z.string(),
687
+ workflow_id: z.string(),
688
+ workflow_json: z.record(z.unknown())
689
+ });
690
+ /**
691
+ * Request body for publishing workflow assets to the Hub.
692
+ */
693
+ export const zPublishWorkflowAssetsRequest = z.object({
694
+ asset_ids: z.array(z.string())
695
+ });
696
+ /**
697
+ * Request body for publishing or updating a workflow on the Hub.
698
+ */
699
+ export const zPublishHubWorkflowRequest = z.object({
700
+ asset_ids: z.array(z.string()),
701
+ custom_nodes: z.array(z.string()).optional(),
702
+ description: z.string().optional(),
703
+ metadata: z.record(z.unknown()).optional(),
704
+ models: z.array(z.string()).optional(),
705
+ name: z.string(),
706
+ sample_image_tokens_or_urls: z.array(z.string()).optional(),
707
+ tags: z.array(z.string()).optional(),
708
+ thumbnail_comparison_token_or_url: z.string().optional(),
709
+ thumbnail_token_or_url: z.string().optional(),
710
+ thumbnail_type: z.enum(['image', 'video', 'image_comparison']).optional(),
711
+ tutorial_url: z.string().optional(),
712
+ username: z.string(),
713
+ workflow_filename: z.string()
714
+ });
715
+ /**
716
+ * One provider's policy state.
717
+ */
718
+ export const zProviderPolicyEntry = z.object({
719
+ enabled: z.boolean(),
720
+ provider_id: z.string()
721
+ });
722
+ /**
723
+ * A workspace's partner-provider governance policy document — the exact shape PUT accepts (round-trips; entries come back sorted by provider_id, write order is not significant). Effective rule: enabled(P) = !enforcement_enabled || (the entry for P has enabled=true); absent from the array = unset (deny when enforcing).
724
+ */
725
+ export const zProviderPolicy = z.object({
726
+ enforcement_enabled: z.boolean(),
727
+ providers: z.array(zProviderPolicyEntry)
728
+ });
729
+ /**
730
+ * Display data for one governable partner provider.
731
+ */
732
+ export const zCatalogProvider = z.object({
733
+ display_name: z.string(),
734
+ node_categories: z.array(z.string()),
735
+ provider_id: z.string()
736
+ });
737
+ /**
738
+ * The partner-provider governance catalog: every governable provider, identical for all workspaces. A projection of the curated catalog minus the internal api_names.
739
+ */
740
+ export const zProviderCatalogResponse = z.object({
741
+ providers: z.array(zCatalogProvider)
742
+ });
743
+ /**
744
+ * Response returned after successfully queuing a workflow prompt.
745
+ */
746
+ export const zPromptResponse = z.object({
747
+ node_errors: z.record(z.unknown()).optional(),
748
+ number: z.number().optional(),
749
+ prompt_id: z.string().uuid().optional()
750
+ });
751
+ /**
752
+ * Request body for submitting a ComfyUI workflow prompt for execution.
753
+ */
754
+ export const zPromptRequest = z.object({
755
+ extra_data: z.record(z.unknown()).optional(),
756
+ front: z.boolean().optional(),
757
+ number: z.number().optional(),
758
+ partial_execution_targets: z.array(z.string()).optional(),
759
+ prompt: z.record(z.unknown()),
760
+ workflow_id: z.string().optional(),
761
+ workflow_version_id: z.string().optional()
762
+ });
763
+ /**
764
+ * Metadata about the currently running and queued prompts.
765
+ */
766
+ export const zPromptInfo = z.object({
767
+ exec_info: z
768
+ .object({
769
+ queue_remaining: z.number().int().optional()
770
+ })
771
+ .optional()
772
+ });
773
+ /**
774
+ * Error response for ComfyUI prompt execution.
775
+ */
776
+ export const zPromptErrorResponse = z.record(z.unknown());
777
+ /**
778
+ * Summary of seat costs based on current workspace members
779
+ */
780
+ export const zPlanSeatSummary = z.object({
781
+ seat_count: z.number().int(),
782
+ total_cost_cents: z.coerce
783
+ .bigint()
784
+ .min(BigInt('-9223372036854775808'), {
785
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
786
+ })
787
+ .max(BigInt('9223372036854775807'), {
788
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
789
+ }),
790
+ total_credits_cents: z.coerce
791
+ .bigint()
792
+ .min(BigInt('-9223372036854775808'), {
793
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
794
+ })
795
+ .max(BigInt('9223372036854775807'), {
796
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
797
+ })
798
+ });
799
+ /**
800
+ * Plan information for preview display
801
+ */
802
+ export const zPreviewPlanInfo = z.object({
803
+ credits_cents: z.coerce
804
+ .bigint()
805
+ .min(BigInt('-9223372036854775808'), {
806
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
807
+ })
808
+ .max(BigInt('9223372036854775807'), {
809
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
810
+ }),
811
+ duration: zSubscriptionDuration,
812
+ period_end: z.string().datetime().optional(),
813
+ period_start: z.string().datetime().optional(),
814
+ price_cents: z.coerce
815
+ .bigint()
816
+ .min(BigInt('-9223372036854775808'), {
817
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
818
+ })
819
+ .max(BigInt('9223372036854775807'), {
820
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
821
+ }),
822
+ seat_summary: zPlanSeatSummary,
823
+ slug: z.string(),
824
+ tier: zSubscriptionTier
825
+ });
826
+ /**
827
+ * Itemized cost preview for a pending subscription change.
828
+ */
829
+ export const zPreviewSubscribeResponse = z.object({
830
+ allowed: z.boolean(),
831
+ amount_due_cents: z.coerce
832
+ .bigint()
833
+ .min(BigInt('-9223372036854775808'), {
834
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
835
+ })
836
+ .max(BigInt('9223372036854775807'), {
837
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
838
+ })
839
+ .optional(),
840
+ cost_next_period_cents: z.coerce
841
+ .bigint()
842
+ .min(BigInt('-9223372036854775808'), {
843
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
844
+ })
845
+ .max(BigInt('9223372036854775807'), {
846
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
847
+ }),
848
+ cost_today_cents: z.coerce
849
+ .bigint()
850
+ .min(BigInt('-9223372036854775808'), {
851
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
852
+ })
853
+ .max(BigInt('9223372036854775807'), {
854
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
855
+ }),
856
+ credits_next_period_cents: z.coerce
857
+ .bigint()
858
+ .min(BigInt('-9223372036854775808'), {
859
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
860
+ })
861
+ .max(BigInt('9223372036854775807'), {
862
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
863
+ }),
864
+ credits_today_cents: z.coerce
865
+ .bigint()
866
+ .min(BigInt('-9223372036854775808'), {
867
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
868
+ })
869
+ .max(BigInt('9223372036854775807'), {
870
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
871
+ }),
872
+ currency: z.string().optional(),
873
+ current_plan: zPreviewPlanInfo.optional(),
874
+ discounts: z.array(zSubscriptionDiscount).optional(),
875
+ effective_at: z.string().datetime(),
876
+ is_immediate: z.boolean(),
877
+ new_plan: zPreviewPlanInfo,
878
+ payment_method_configuration_id: z.string().optional(),
879
+ promotion_code: z.string().optional(),
880
+ proration_at: z.string().datetime().optional(),
881
+ quote_id: z.string().optional(),
882
+ quote_version: z.number().int().optional(),
883
+ reason: z.string().optional(),
884
+ renewal_amount_cents: z.coerce
885
+ .bigint()
886
+ .min(BigInt('-9223372036854775808'), {
887
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
888
+ })
889
+ .max(BigInt('9223372036854775807'), {
890
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
891
+ })
892
+ .optional(),
893
+ renewal_at: z.string().datetime().optional(),
894
+ requires_reactivation_confirmation: z.boolean().optional(),
895
+ transition_type: z.enum([
896
+ 'new_subscription',
897
+ 'upgrade',
898
+ 'downgrade',
899
+ 'duration_change'
900
+ ])
901
+ });
902
+ /**
903
+ * Request body for previewing the cost of a plan subscription change.
904
+ */
905
+ export const zPreviewSubscribeRequest = z.object({
906
+ checkout_attempt_id: z.string().optional(),
907
+ plan_slug: z.string(),
908
+ promotion_code: z.string().optional(),
909
+ team_credit_stop_id: z.string().optional()
910
+ });
911
+ /**
912
+ * Reason why a plan is unavailable
913
+ */
914
+ export const zPlanAvailabilityReason = z.enum([
915
+ 'same_plan',
916
+ 'incompatible_transition',
917
+ 'requires_team',
918
+ 'requires_personal',
919
+ 'exceeds_max_seats'
920
+ ]);
921
+ /**
922
+ * Availability and eligibility information for a billing plan.
923
+ */
924
+ export const zPlanAvailability = z.object({
925
+ available: z.boolean(),
926
+ reason: zPlanAvailabilityReason.optional()
927
+ });
928
+ /**
929
+ * Billing plan details including pricing, limits, and features.
930
+ */
931
+ export const zPlan = z.object({
932
+ availability: zPlanAvailability,
933
+ credits_cents: z.coerce
934
+ .bigint()
935
+ .min(BigInt('-9223372036854775808'), {
936
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
937
+ })
938
+ .max(BigInt('9223372036854775807'), {
939
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
940
+ }),
941
+ duration: zSubscriptionDuration,
942
+ max_seats: z.coerce
943
+ .bigint()
944
+ .min(BigInt('-9223372036854775808'), {
945
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
946
+ })
947
+ .max(BigInt('9223372036854775807'), {
948
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
949
+ }),
950
+ price_cents: z.coerce
951
+ .bigint()
952
+ .min(BigInt('-9223372036854775808'), {
953
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
954
+ })
955
+ .max(BigInt('9223372036854775807'), {
956
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
957
+ }),
958
+ seat_summary: zPlanSeatSummary,
959
+ slug: z.string(),
960
+ tier: zSubscriptionTier
961
+ });
962
+ /**
963
+ * An outstanding workspace invitation that has not yet been accepted.
964
+ */
965
+ export const zPendingInvite = z.object({
966
+ email: z.string().email(),
967
+ expires_at: z.string().datetime(),
968
+ id: z.string(),
969
+ invited_at: z.string().datetime(),
970
+ token: z.string().optional()
971
+ });
972
+ /**
973
+ * Response containing a redirect URL to the payment portal.
974
+ */
975
+ export const zPaymentPortalResponse = z.object({
976
+ url: z.string()
977
+ });
978
+ /**
979
+ * Request body for generating a payment portal session URL.
980
+ */
981
+ export const zPaymentPortalRequest = z.object({
982
+ return_url: z.string().optional()
983
+ });
984
+ /**
985
+ * RFC 6749 §5.1 successful token response.
986
+ */
987
+ export const zOAuthTokenResponse = z.object({
988
+ access_token: z.string(),
989
+ expires_in: z.number().int(),
990
+ refresh_token: z.string(),
991
+ scope: z.string(),
992
+ token_type: z.enum(['Bearer'])
993
+ });
994
+ /**
995
+ * RFC 6749 §5.2 error response.
996
+ */
997
+ export const zOAuthTokenError = z.object({
998
+ error: z.string(),
999
+ error_description: z.string().optional()
1000
+ });
1001
+ /**
1002
+ * RFC 7591 §3.2.1 successful registration response.
1003
+ */
1004
+ export const zOAuthRegisterResponse = z.object({
1005
+ application_type: z.enum(['native', 'web']),
1006
+ client_id: z.string(),
1007
+ client_id_issued_at: z.coerce
1008
+ .bigint()
1009
+ .min(BigInt('-9223372036854775808'), {
1010
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1011
+ })
1012
+ .max(BigInt('9223372036854775807'), {
1013
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1014
+ }),
1015
+ client_name: z.string().optional(),
1016
+ grant_types: z.array(z.string()),
1017
+ redirect_uris: z.array(z.string()),
1018
+ response_types: z.array(z.string()),
1019
+ token_endpoint_auth_method: z.enum(['none'])
1020
+ });
1021
+ /**
1022
+ * RFC 7591 §2 client metadata document. Fields fall into three groups: the ones the server honors, the purely informational ones it accepts and ignores (`scope` plus the client-profile fields `client_uri`, `logo_uri`, `tos_uri`, `policy_uri`, `contacts`, `software_id`, `software_version` — parsed, never persisted, never echoed, per RFC 7591 §2's "MAY ignore" allowance), and the ones it rejects with `invalid_client_metadata` (`resource_grants`, because scopes/grants are server-owned for dynamic clients; `jwks`/`jwks_uri`, because they only apply to the JWT client-authentication methods DCR does not offer). `additionalProperties: false` mirrors the runtime middleware that rejects any unknown metadata key.
1023
+ *
1024
+ */
1025
+ export const zOAuthRegisterRequest = z.object({
1026
+ application_type: z.enum(['native', 'web']).optional(),
1027
+ client_name: z.string().max(100).optional(),
1028
+ client_uri: z.string().nullish(),
1029
+ contacts: z.array(z.string()).nullish(),
1030
+ grant_types: z
1031
+ .array(z.enum(['authorization_code', 'refresh_token']))
1032
+ .optional(),
1033
+ jwks: z.record(z.unknown()).nullish(),
1034
+ jwks_uri: z.string().nullish(),
1035
+ logo_uri: z.string().nullish(),
1036
+ policy_uri: z.string().nullish(),
1037
+ redirect_uris: z.array(z.string()).min(1).max(5),
1038
+ resource_grants: z.record(z.array(z.string())).nullish(),
1039
+ response_types: z.array(z.enum(['code'])).optional(),
1040
+ scope: z.string().nullish(),
1041
+ software_id: z.string().nullish(),
1042
+ software_version: z.string().nullish(),
1043
+ token_endpoint_auth_method: z.string().optional(),
1044
+ tos_uri: z.string().nullish()
1045
+ });
1046
+ /**
1047
+ * RFC 7591 §3.2.2 error response.
1048
+ */
1049
+ export const zOAuthRegisterError = z.object({
1050
+ error: z.enum(['invalid_redirect_uri', 'invalid_client_metadata']),
1051
+ error_description: z.string().nullish()
1052
+ });
1053
+ /**
1054
+ * Standard error response with a machine-readable code and human-readable message.
1055
+ */
1056
+ export const zErrorResponse = z.object({
1057
+ code: z.string(),
1058
+ details: z.record(z.unknown()).optional(),
1059
+ message: z.string()
1060
+ });
1061
+ /**
1062
+ * Union of the two 400 shapes /oauth/register can emit. `OAuthRegisterError` is the handler-shaped RFC 7591 §3.2.2 error; `ErrorResponse` is the strict-server binding-layer error fired when the request body fails OpenAPI-schema validation before the handler runs, normalized to the standard {code, message} shape by the custom Echo HTTPErrorHandler (BE-1178).
1063
+ *
1064
+ */
1065
+ export const zOAuthRegisterBadRequestResponse = z.union([
1066
+ zOAuthRegisterError,
1067
+ zErrorResponse
1068
+ ]);
1069
+ /**
1070
+ * OAuth 2.1 protected-resource metadata (RFC 9728).
1071
+ */
1072
+ export const zOAuthProtectedResourceMetadata = z.object({
1073
+ authorization_servers: z.array(z.string().url()),
1074
+ bearer_methods_supported: z.array(z.string()).optional(),
1075
+ resource: z.string().url(),
1076
+ scopes_supported: z.array(z.string())
1077
+ });
1078
+ /**
1079
+ * One workspace option presented in the OAuth consent challenge. Promoted to a named schema so the generated Go type is referenceable in handlers and tests rather than re-declared as an anonymous struct at every callsite.
1080
+ *
1081
+ */
1082
+ export const zOAuthConsentChallengeWorkspace = z.object({
1083
+ id: z.string(),
1084
+ name: z.string(),
1085
+ role: z.enum(['owner', 'member']),
1086
+ type: z.enum(['personal', 'team'])
1087
+ });
1088
+ /**
1089
+ * Server-side state describing the OAuth consent decision the user is being asked to make. Returned by GET /oauth/authorize when a valid Cloud session exists; the frontend renders the consent UI from this payload and POSTs the decision back. Browser never sees the original OAuth params on resume.
1090
+ *
1091
+ */
1092
+ export const zOAuthConsentChallenge = z.object({
1093
+ client_display_name: z.string(),
1094
+ csrf_token: z.string(),
1095
+ oauth_request_id: z.string().uuid(),
1096
+ redirect_uri: z.string().url(),
1097
+ resource_display_name: z.string(),
1098
+ scopes: z.array(z.string()),
1099
+ workspaces: z.array(zOAuthConsentChallengeWorkspace)
1100
+ });
1101
+ /**
1102
+ * Redirect target produced after a JSON consent submission. The frontend must navigate the browser to this URL so custom-scheme client callbacks work without relying on fetch-visible 302 headers.
1103
+ */
1104
+ export const zOAuthAuthorizeRedirectResponse = z.object({
1105
+ redirect_url: z.string().url()
1106
+ });
1107
+ /**
1108
+ * OAuth 2.1 authorization-server metadata (RFC 8414).
1109
+ */
1110
+ export const zOAuthAuthorizationServerMetadata = z.object({
1111
+ authorization_endpoint: z.string().url(),
1112
+ code_challenge_methods_supported: z.array(z.string()),
1113
+ grant_types_supported: z.array(z.string()),
1114
+ issuer: z.string().url(),
1115
+ jwks_uri: z.string().url(),
1116
+ registration_endpoint: z.string().url().optional(),
1117
+ response_types_supported: z.array(z.string()),
1118
+ scopes_supported: z.array(z.string()).optional(),
1119
+ token_endpoint: z.string().url(),
1120
+ token_endpoint_auth_methods_supported: z.array(z.string())
1121
+ });
1122
+ /**
1123
+ * Metadata describing a single ComfyUI node type and its inputs/outputs.
1124
+ */
1125
+ export const zNodeInfo = z.object({
1126
+ api_node: z.boolean().optional(),
1127
+ category: z.string().optional(),
1128
+ deprecated: z.boolean().optional(),
1129
+ description: z.string().optional(),
1130
+ display_name: z.string().optional(),
1131
+ experimental: z.boolean().optional(),
1132
+ input: z.record(z.unknown()).optional(),
1133
+ input_order: z.record(z.array(z.string())).optional(),
1134
+ name: z.string().optional(),
1135
+ output: z.array(z.string()).optional(),
1136
+ output_is_list: z.array(z.boolean()).optional(),
1137
+ output_name: z.array(z.string()).optional(),
1138
+ output_node: z.boolean().optional(),
1139
+ output_tooltips: z.array(z.string()).optional(),
1140
+ python_module: z.string().optional()
1141
+ });
1142
+ /**
1143
+ * Represents a folder containing models
1144
+ */
1145
+ export const zModelFolder = z.object({
1146
+ folders: z.array(z.string()),
1147
+ name: z.string()
1148
+ });
1149
+ /**
1150
+ * Represents a model file with metadata
1151
+ */
1152
+ export const zModelFile = z.object({
1153
+ name: z.string(),
1154
+ pathIndex: z.number().int()
1155
+ });
1156
+ /**
1157
+ * Workspace member with profile and role information.
1158
+ */
1159
+ export const zMember = z.object({
1160
+ email: z.string().email(),
1161
+ id: z.string(),
1162
+ is_original_owner: z.boolean(),
1163
+ joined_at: z.string().datetime(),
1164
+ name: z.string(),
1165
+ role: z.enum(['owner', 'member'])
1166
+ });
1167
+ /**
1168
+ * Paginated list of workspaces the authenticated user belongs to.
1169
+ */
1170
+ export const zListWorkspacesResponse = z.object({
1171
+ workspaces: z.array(zWorkspaceWithRole)
1172
+ });
1173
+ /**
1174
+ * List of API keys associated with the current workspace.
1175
+ */
1176
+ export const zListWorkspaceApiKeysResponse = z.object({
1177
+ api_keys: z.array(zWorkspaceApiKeyInfo)
1178
+ });
1179
+ /**
1180
+ * Paginated list of available asset tags.
1181
+ */
1182
+ export const zListTagsResponse = z.object({
1183
+ has_more: z.boolean(),
1184
+ tags: z.array(zTagInfo),
1185
+ total: z.number().int()
1186
+ });
1187
+ /**
1188
+ * List of members in the current workspace.
1189
+ */
1190
+ export const zListMembersResponse = z.object({
1191
+ members: z.array(zMember),
1192
+ pagination: zPaginationInfo
1193
+ });
1194
+ /**
1195
+ * List of pending invitations for the current workspace.
1196
+ */
1197
+ export const zListInvitesResponse = z.object({
1198
+ invites: z.array(zPendingInvite)
1199
+ });
1200
+ /**
1201
+ * Represents a user-owned asset (image, video, or other generated output).
1202
+ */
1203
+ export const zAsset = z.object({
1204
+ created_at: z.string().datetime(),
1205
+ display_name: z.string().nullish(),
1206
+ file_path: z.string().nullish(),
1207
+ hash: z
1208
+ .string()
1209
+ .regex(/^blake3:[a-f0-9]{64}$/)
1210
+ .optional(),
1211
+ id: z.string().uuid(),
1212
+ is_immutable: z.boolean().optional(),
1213
+ job_id: z.string().uuid().nullish(),
1214
+ last_access_time: z.string().datetime().optional(),
1215
+ loader_path: z.string().nullish(),
1216
+ metadata: z.record(z.unknown()).readonly().optional(),
1217
+ mime_type: z.string().optional(),
1218
+ name: z.string(),
1219
+ preview_id: z.string().uuid().nullish(),
1220
+ preview_url: z.string().url().optional(),
1221
+ short_url: z.string().nullish(),
1222
+ size: z.coerce
1223
+ .bigint()
1224
+ .min(BigInt('-9223372036854775808'), {
1225
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1226
+ })
1227
+ .max(BigInt('9223372036854775807'), {
1228
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1229
+ })
1230
+ .optional(),
1231
+ tags: z.array(z.string()).optional(),
1232
+ updated_at: z.string().datetime(),
1233
+ user_metadata: z.record(z.unknown()).optional()
1234
+ });
1235
+ /**
1236
+ * Paginated list of assets belonging to the authenticated user.
1237
+ */
1238
+ export const zListAssetsResponse = z.object({
1239
+ assets: z.array(zAsset),
1240
+ has_more: z.boolean(),
1241
+ next_cursor: z.string().optional(),
1242
+ total: z.number().int()
1243
+ });
1244
+ /**
1245
+ * Reference to a Hub label by ID.
1246
+ */
1247
+ export const zLabelRef = z.object({
1248
+ display_name: z.string(),
1249
+ name: z.string()
1250
+ });
1251
+ /**
1252
+ * A single JSON Web Key entry within a JWKS response.
1253
+ */
1254
+ export const zJwkKey = z.object({
1255
+ alg: z.string(),
1256
+ crv: z.string(),
1257
+ kid: z.string(),
1258
+ kty: z.string(),
1259
+ use: z.string(),
1260
+ x: z.string(),
1261
+ y: z.string()
1262
+ });
1263
+ /**
1264
+ * JSON Web Key Set containing the public keys used to verify Cloud JWTs.
1265
+ */
1266
+ export const zJwksResponse = z.object({
1267
+ keys: z.array(zJwkKey)
1268
+ });
1269
+ /**
1270
+ * Detailed execution error information from ComfyUI
1271
+ */
1272
+ export const zExecutionError = z.object({
1273
+ current_inputs: z.record(z.unknown()),
1274
+ current_outputs: z.record(z.unknown()),
1275
+ exception_message: z.string(),
1276
+ exception_type: z.string(),
1277
+ node_id: z.string(),
1278
+ node_type: z.string(),
1279
+ traceback: z.array(z.string())
1280
+ });
1281
+ /**
1282
+ * Lightweight job data for list views (workflow and full outputs excluded)
1283
+ */
1284
+ export const zJobEntry = z.object({
1285
+ create_time: z.coerce
1286
+ .bigint()
1287
+ .min(BigInt('-9223372036854775808'), {
1288
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1289
+ })
1290
+ .max(BigInt('9223372036854775807'), {
1291
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1292
+ }),
1293
+ execution_end_time: z.coerce
1294
+ .bigint()
1295
+ .min(BigInt('-9223372036854775808'), {
1296
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1297
+ })
1298
+ .max(BigInt('9223372036854775807'), {
1299
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1300
+ })
1301
+ .optional(),
1302
+ execution_error: zExecutionError.optional(),
1303
+ execution_start_time: z.coerce
1304
+ .bigint()
1305
+ .min(BigInt('-9223372036854775808'), {
1306
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1307
+ })
1308
+ .max(BigInt('9223372036854775807'), {
1309
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1310
+ })
1311
+ .optional(),
1312
+ id: z.string().uuid(),
1313
+ outputs_count: z.number().int().optional(),
1314
+ preview_output: z.record(z.unknown()).optional(),
1315
+ previewable_outputs_count: z.number().int().optional(),
1316
+ status: z.enum([
1317
+ 'pending',
1318
+ 'in_progress',
1319
+ 'completed',
1320
+ 'failed',
1321
+ 'cancelled'
1322
+ ]),
1323
+ workflow_id: z.string().optional()
1324
+ });
1325
+ /**
1326
+ * Paginated list of jobs for the authenticated user.
1327
+ */
1328
+ export const zJobsListResponse = z.object({
1329
+ jobs: z.array(zJobEntry),
1330
+ pagination: zPaginationInfo
1331
+ });
1332
+ /**
1333
+ * Response for POST /api/jobs/cancel.
1334
+ */
1335
+ export const zJobsCancelResponse = z.object({
1336
+ cancelled: z.array(z.string())
1337
+ });
1338
+ /**
1339
+ * Request to cancel multiple jobs by ID.
1340
+ */
1341
+ export const zJobsCancelRequest = z.object({
1342
+ job_ids: z.array(z.string().uuid()).min(1).max(100)
1343
+ });
1344
+ /**
1345
+ * Job status information
1346
+ */
1347
+ export const zJobStatusResponse = z.object({
1348
+ assigned_inference: z.string().nullish(),
1349
+ created_at: z.string().datetime(),
1350
+ error_message: z.string().nullish(),
1351
+ id: z.string().uuid(),
1352
+ last_state_update: z.string().datetime().optional(),
1353
+ status: z.enum([
1354
+ 'waiting_to_dispatch',
1355
+ 'pending',
1356
+ 'in_progress',
1357
+ 'completed',
1358
+ 'error',
1359
+ 'cancelled'
1360
+ ]),
1361
+ updated_at: z.string().datetime()
1362
+ });
1363
+ /**
1364
+ * An asset produced by a job, enriched with the per-output node context
1365
+ * (`node_id`, `output_key`, `output_index`) correlated from the job's
1366
+ * execution outputs by content hash. The node-context fields are null
1367
+ * when the asset cannot be matched to an output entry.
1368
+ *
1369
+ */
1370
+ export const zJobOutputAsset = z.object({
1371
+ created_at: z.string().datetime(),
1372
+ hash: z
1373
+ .string()
1374
+ .regex(/^blake3:[a-f0-9]{64}$/)
1375
+ .optional(),
1376
+ id: z.string().uuid(),
1377
+ mime_type: z.string().optional(),
1378
+ name: z.string(),
1379
+ node_id: z.string().nullish(),
1380
+ output_index: z.number().int().nullish(),
1381
+ output_key: z.string().nullish(),
1382
+ preview_url: z.string().optional(),
1383
+ size: z.coerce
1384
+ .bigint()
1385
+ .min(BigInt('-9223372036854775808'), {
1386
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1387
+ })
1388
+ .max(BigInt('9223372036854775807'), {
1389
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1390
+ })
1391
+ .optional()
1392
+ });
1393
+ /**
1394
+ * Full job details including workflow and outputs
1395
+ */
1396
+ export const zJobDetailResponse = z.object({
1397
+ create_time: z.coerce
1398
+ .bigint()
1399
+ .min(BigInt('-9223372036854775808'), {
1400
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1401
+ })
1402
+ .max(BigInt('9223372036854775807'), {
1403
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1404
+ }),
1405
+ execution_end_time: z.coerce
1406
+ .bigint()
1407
+ .min(BigInt('-9223372036854775808'), {
1408
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1409
+ })
1410
+ .max(BigInt('9223372036854775807'), {
1411
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1412
+ })
1413
+ .optional(),
1414
+ execution_error: zExecutionError.optional(),
1415
+ execution_meta: z.record(z.unknown()).optional(),
1416
+ execution_start_time: z.coerce
1417
+ .bigint()
1418
+ .min(BigInt('-9223372036854775808'), {
1419
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1420
+ })
1421
+ .max(BigInt('9223372036854775807'), {
1422
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1423
+ })
1424
+ .optional(),
1425
+ execution_status: z.record(z.unknown()).optional(),
1426
+ id: z.string().uuid(),
1427
+ outputs: z.record(z.unknown()).optional(),
1428
+ outputs_count: z.number().int().optional(),
1429
+ preview_output: z.record(z.unknown()).optional(),
1430
+ previewable_outputs_count: z.number().int().optional(),
1431
+ status: z.enum([
1432
+ 'pending',
1433
+ 'in_progress',
1434
+ 'completed',
1435
+ 'failed',
1436
+ 'cancelled'
1437
+ ]),
1438
+ update_time: z.coerce
1439
+ .bigint()
1440
+ .min(BigInt('-9223372036854775808'), {
1441
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1442
+ })
1443
+ .max(BigInt('9223372036854775807'), {
1444
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1445
+ }),
1446
+ user_id: z.string().optional(),
1447
+ workflow: z.record(z.unknown()).optional(),
1448
+ workflow_id: z.string().optional(),
1449
+ workflow_version_id: z.string().optional(),
1450
+ workspace_id: z.string().optional()
1451
+ });
1452
+ /**
1453
+ * Response for POST /api/jobs/{job_id}/cancel. Returned on both fresh cancels and idempotent no-ops.
1454
+ */
1455
+ export const zJobCancelResponse = z.object({
1456
+ cancelled: z.boolean()
1457
+ });
1458
+ /**
1459
+ * Paginated list of the assets produced by a single job.
1460
+ */
1461
+ export const zJobAssetsResponse = z.object({
1462
+ assets: z.array(zJobOutputAsset),
1463
+ job_id: z.string().uuid(),
1464
+ pagination: zPaginationInfo
1465
+ });
1466
+ /**
1467
+ * Request body for minting an input-image, input-audio or input-video upload grant.
1468
+ */
1469
+ export const zInputUploadUrlRequest = z.object({
1470
+ content_type: z.string().max(64)
1471
+ });
1472
+ /**
1473
+ * Result of redeeming an input-image upload grant. Identical in shape to
1474
+ * the POST /api/upload/image response.
1475
+ *
1476
+ */
1477
+ export const zInputUploadResponse = z.object({
1478
+ name: z.string(),
1479
+ subfolder: z.string(),
1480
+ type: z.string()
1481
+ });
1482
+ /**
1483
+ * Response after importing published workflow assets.
1484
+ */
1485
+ export const zImportPublishedAssetsResponse = z.object({
1486
+ assets: z.array(zAssetInfo)
1487
+ });
1488
+ /**
1489
+ * Request body for importing assets from a published workflow.
1490
+ */
1491
+ export const zImportPublishedAssetsRequest = z.object({
1492
+ published_asset_ids: z.array(z.string()),
1493
+ share_id: z.string().nullish()
1494
+ });
1495
+ /**
1496
+ * Public workflow status. NULL in the database is represented as pending in API responses.
1497
+ */
1498
+ export const zHubWorkflowStatus = z.enum([
1499
+ 'pending',
1500
+ 'approved',
1501
+ 'rejected',
1502
+ 'deprecated'
1503
+ ]);
1504
+ /**
1505
+ * Abbreviated Hub profile used in workflow listings.
1506
+ */
1507
+ export const zHubProfileSummary = z.object({
1508
+ avatar_url: z.string().optional(),
1509
+ display_name: z.string().optional(),
1510
+ username: z.string()
1511
+ });
1512
+ /**
1513
+ * Entry in the curated workflow template gallery shown on the home page.
1514
+ */
1515
+ export const zHubWorkflowTemplateEntry = z.object({
1516
+ contentTemplate: z.string().optional(),
1517
+ date: z.string().optional(),
1518
+ description: z.string().optional(),
1519
+ extendedDescription: z.string().optional(),
1520
+ faqItems: z
1521
+ .array(z.object({
1522
+ answer: z.string(),
1523
+ question: z.string()
1524
+ }))
1525
+ .optional(),
1526
+ howToUse: z.array(z.string()).optional(),
1527
+ includeOnDistributions: z.array(z.string()).optional(),
1528
+ io: z
1529
+ .object({
1530
+ inputs: z.array(z.record(z.unknown())).optional(),
1531
+ outputs: z.array(z.record(z.unknown())).optional()
1532
+ })
1533
+ .optional(),
1534
+ isApp: z.boolean(),
1535
+ isEssential: z.boolean().optional(),
1536
+ logos: z.array(z.record(z.unknown())).optional(),
1537
+ mediaSubtype: z.string().optional(),
1538
+ mediaType: z.string().optional(),
1539
+ metaDescription: z.string().optional(),
1540
+ models: z.array(z.string()).optional(),
1541
+ name: z.string(),
1542
+ openSource: z.boolean().optional(),
1543
+ profile: zHubProfileSummary.optional(),
1544
+ requiresCustomNodes: z.array(z.string()).optional(),
1545
+ searchRank: z.coerce
1546
+ .bigint()
1547
+ .min(BigInt('-9223372036854775808'), {
1548
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1549
+ })
1550
+ .max(BigInt('9223372036854775807'), {
1551
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1552
+ })
1553
+ .optional(),
1554
+ shareId: z.string().optional(),
1555
+ size: z.coerce
1556
+ .bigint()
1557
+ .min(BigInt('-9223372036854775808'), {
1558
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1559
+ })
1560
+ .max(BigInt('9223372036854775807'), {
1561
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1562
+ })
1563
+ .optional(),
1564
+ status: zHubWorkflowStatus,
1565
+ suggestedUseCases: z.array(z.string()).optional(),
1566
+ tags: z.array(z.string()).optional(),
1567
+ thumbnailComparisonUrl: z.string().optional(),
1568
+ thumbnailUrl: z.string().optional(),
1569
+ thumbnailVariant: z.string().optional(),
1570
+ title: z.string(),
1571
+ tutorialUrl: z.string().optional(),
1572
+ usage: z.coerce
1573
+ .bigint()
1574
+ .min(BigInt('-9223372036854775808'), {
1575
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1576
+ })
1577
+ .max(BigInt('9223372036854775807'), {
1578
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1579
+ })
1580
+ .optional(),
1581
+ vram: z.coerce
1582
+ .bigint()
1583
+ .min(BigInt('-9223372036854775808'), {
1584
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1585
+ })
1586
+ .max(BigInt('9223372036854775807'), {
1587
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1588
+ })
1589
+ .optional()
1590
+ });
1591
+ /**
1592
+ * Abbreviated Hub workflow metadata used in search and listing results.
1593
+ */
1594
+ export const zHubWorkflowSummary = z.object({
1595
+ custom_nodes: z.array(zLabelRef).optional(),
1596
+ description: z.string().optional(),
1597
+ is_app: z.boolean(),
1598
+ metadata: z.record(z.unknown()).optional(),
1599
+ models: z.array(zLabelRef).optional(),
1600
+ name: z.string(),
1601
+ profile: zHubProfileSummary,
1602
+ publish_time: z.string().datetime().nullish(),
1603
+ sample_image_urls: z.array(z.string()).optional(),
1604
+ share_id: z.string(),
1605
+ status: zHubWorkflowStatus,
1606
+ tags: z.array(zLabelRef).optional(),
1607
+ thumbnail_comparison_url: z.string().optional(),
1608
+ thumbnail_type: z.enum(['image', 'video', 'image_comparison']).optional(),
1609
+ thumbnail_url: z.string().optional(),
1610
+ tutorial_url: z.string().optional()
1611
+ });
1612
+ /**
1613
+ * Full Hub workflow detail including versions, assets, and statistics.
1614
+ */
1615
+ export const zHubWorkflowDetail = z.object({
1616
+ assets: z.array(zAssetInfo),
1617
+ custom_nodes: z.array(zLabelRef).optional(),
1618
+ description: z.string().optional(),
1619
+ is_app: z.boolean(),
1620
+ metadata: z.record(z.unknown()).optional(),
1621
+ models: z.array(zLabelRef).optional(),
1622
+ name: z.string(),
1623
+ profile: zHubProfileSummary,
1624
+ publish_time: z.string().datetime().nullish(),
1625
+ sample_image_urls: z.array(z.string()).optional(),
1626
+ share_id: z.string(),
1627
+ status: zHubWorkflowStatus,
1628
+ tags: z.array(zLabelRef).optional(),
1629
+ thumbnail_comparison_url: z.string().optional(),
1630
+ thumbnail_type: z.enum(['image', 'video', 'image_comparison']).optional(),
1631
+ thumbnail_url: z.string().optional(),
1632
+ tutorial_url: z.string().optional(),
1633
+ workflow_id: z.string(),
1634
+ workflow_json: z.record(z.unknown())
1635
+ });
1636
+ /**
1637
+ * Paginated list of Hub workflows matching search criteria.
1638
+ */
1639
+ export const zHubWorkflowListResponse = z.object({
1640
+ next_cursor: z.string().optional(),
1641
+ workflows: z.array(z.union([zHubWorkflowSummary, zHubWorkflowDetail]))
1642
+ });
1643
+ /**
1644
+ * Response indicating whether a Hub username is available.
1645
+ */
1646
+ export const zHubUsernameCheckResponse = z.object({
1647
+ available: z.boolean(),
1648
+ suggestions: z.array(z.string()).optional(),
1649
+ username: z.string(),
1650
+ validation_error: z.string().optional()
1651
+ });
1652
+ /**
1653
+ * Full public profile for a Hub creator.
1654
+ */
1655
+ export const zHubProfile = z.object({
1656
+ avatar_url: z.string().optional(),
1657
+ description: z.string().optional(),
1658
+ display_name: z.string().optional(),
1659
+ username: z.string(),
1660
+ website_urls: z.array(z.string()).optional()
1661
+ });
1662
+ /**
1663
+ * Metadata for a single Hub label.
1664
+ */
1665
+ export const zHubLabelInfo = z.object({
1666
+ description: z.string().optional(),
1667
+ display_name: z.string(),
1668
+ name: z.string(),
1669
+ type: z.enum(['tag', 'model', 'custom_node'])
1670
+ });
1671
+ /**
1672
+ * List of available Hub labels for categorizing workflows.
1673
+ */
1674
+ export const zHubLabelListResponse = z.object({
1675
+ labels: z.array(zHubLabelInfo)
1676
+ });
1677
+ /**
1678
+ * Response containing a signed upload URL and the target asset path.
1679
+ */
1680
+ export const zHubAssetUploadUrlResponse = z.object({
1681
+ public_url: z.string(),
1682
+ token: z.string(),
1683
+ upload_url: z.string()
1684
+ });
1685
+ /**
1686
+ * Request body for requesting a signed upload URL for a Hub asset.
1687
+ */
1688
+ export const zHubAssetUploadUrlRequest = z.object({
1689
+ content_type: z.string(),
1690
+ filename: z.string()
1691
+ });
1692
+ /**
1693
+ * History entry with prompt_id and execution data
1694
+ */
1695
+ export const zHistoryEntry = z.object({
1696
+ create_time: z.coerce
1697
+ .bigint()
1698
+ .min(BigInt('-9223372036854775808'), {
1699
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1700
+ })
1701
+ .max(BigInt('9223372036854775807'), {
1702
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1703
+ })
1704
+ .optional(),
1705
+ meta: z.record(z.unknown()).optional(),
1706
+ outputs: z.record(z.unknown()).optional(),
1707
+ prompt: z
1708
+ .object({
1709
+ extra_data: z.record(z.unknown()).optional(),
1710
+ priority: z.number().optional(),
1711
+ prompt_id: z.string().optional()
1712
+ })
1713
+ .optional(),
1714
+ prompt_id: z.string(),
1715
+ status: z.record(z.unknown()).optional(),
1716
+ workflow_id: z.string().optional()
1717
+ });
1718
+ /**
1719
+ * Execution history response with history array.
1720
+ * Returns an object with a "history" key containing an array of history entries.
1721
+ * Each entry includes prompt_id as a property along with execution data.
1722
+ *
1723
+ */
1724
+ export const zHistoryResponse = z.object({
1725
+ history: z.array(zHistoryEntry)
1726
+ });
1727
+ /**
1728
+ * Request to manage history operations
1729
+ */
1730
+ export const zHistoryManageRequest = z.object({
1731
+ clear: z.boolean().optional(),
1732
+ delete: z.array(z.string()).optional()
1733
+ });
1734
+ /**
1735
+ * History entry with full prompt data
1736
+ */
1737
+ export const zHistoryDetailEntry = z.object({
1738
+ meta: z.record(z.unknown()).optional(),
1739
+ outputs: z.record(z.unknown()).optional(),
1740
+ prompt: z
1741
+ .object({
1742
+ extra_data: z.record(z.unknown()).optional(),
1743
+ outputs_to_execute: z.array(z.string()).optional(),
1744
+ priority: z.number().optional(),
1745
+ prompt: z.record(z.unknown()).optional(),
1746
+ prompt_id: z.string().optional()
1747
+ })
1748
+ .optional(),
1749
+ status: z.record(z.unknown()).optional()
1750
+ });
1751
+ /**
1752
+ * Detailed execution history response for a specific prompt.
1753
+ * Returns a dictionary with prompt_id as key and full history data as value.
1754
+ *
1755
+ */
1756
+ export const zHistoryDetailResponse = z.record(zHistoryDetailEntry);
1757
+ /**
1758
+ * Metadata for a global subgraph blueprint (without full data)
1759
+ */
1760
+ export const zGlobalSubgraphInfo = z.object({
1761
+ data: z.string().optional(),
1762
+ info: z.object({
1763
+ node_pack: z.string()
1764
+ }),
1765
+ name: z.string(),
1766
+ source: z.string()
1767
+ });
1768
+ /**
1769
+ * Full data for a global subgraph blueprint
1770
+ */
1771
+ export const zGlobalSubgraphData = z.object({
1772
+ data: z.string(),
1773
+ info: z.object({
1774
+ node_pack: z.string()
1775
+ }),
1776
+ name: z.string(),
1777
+ source: z.string()
1778
+ });
1779
+ /**
1780
+ * A setting key with its value, discriminated on `key`. Narrowing on the key yields exactly one value schema, which is what gives writes their type safety.
1781
+ */
1782
+ export const zGlobalSettingValue = z
1783
+ .object({
1784
+ key: z.literal('Comfy.AgentPanel.ConsentAccepted')
1785
+ })
1786
+ .and(zAgentConsentSettingValue);
1787
+ /**
1788
+ * The union of setting keys this server accepts. Published as an enum so clients cannot address a key the registry does not know.
1789
+ */
1790
+ export const zGlobalSettingKey = z.enum(['Comfy.AgentPanel.ConsentAccepted']);
1791
+ /**
1792
+ * A stored setting: one GlobalSettingValue member plus when it last changed. Discriminated on `key` like GlobalSettingValue, so narrowing a read yields the same single value schema a write is typed by.
1793
+ */
1794
+ export const zGlobalSetting = z
1795
+ .object({
1796
+ key: z.literal('Comfy.AgentPanel.ConsentAccepted')
1797
+ })
1798
+ .and(zStoredAgentConsentSetting);
1799
+ /**
1800
+ * Individual file entry within a full user data response.
1801
+ */
1802
+ export const zGetUserDataResponseFullFile = z.object({
1803
+ modified: z.coerce
1804
+ .bigint()
1805
+ .min(BigInt('-9223372036854775808'), {
1806
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1807
+ })
1808
+ .max(BigInt('9223372036854775807'), {
1809
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1810
+ })
1811
+ .optional(),
1812
+ path: z.string().optional(),
1813
+ size: z.number().int().optional()
1814
+ });
1815
+ /**
1816
+ * List of user data file entries (each with path, size, and modification time) returned when full_info=true.
1817
+ */
1818
+ export const zGetUserDataResponseFull = z.array(zGetUserDataResponseFullFile);
1819
+ /**
1820
+ * Request body for forking an existing workflow into the user's account.
1821
+ */
1822
+ export const zForkWorkflowRequest = z.object({
1823
+ name: z.string().optional(),
1824
+ source_version: z.number().int()
1825
+ });
1826
+ /**
1827
+ * Response after submitting feedback
1828
+ */
1829
+ export const zFeedbackResponse = z.record(z.unknown());
1830
+ /**
1831
+ * Request to submit user feedback
1832
+ */
1833
+ export const zFeedbackRequest = z.object({
1834
+ content: z.string().optional(),
1835
+ metadata: z.record(z.unknown()).optional(),
1836
+ rating: z.number().int().gte(1).lte(5).optional(),
1837
+ type: z.enum(['missing_nodes', 'general', 'missing_models'])
1838
+ });
1839
+ /**
1840
+ * Response containing a signed download URL for an exported asset archive.
1841
+ */
1842
+ export const zExportDownloadUrlResponse = z.object({
1843
+ expires_at: z.string().datetime().optional(),
1844
+ url: z.string()
1845
+ });
1846
+ /**
1847
+ * Response containing the issued Cloud JWT and its expiry.
1848
+ */
1849
+ export const zExchangeTokenResponse = z.object({
1850
+ expires_at: z.string().datetime(),
1851
+ permissions: z.array(z.string()),
1852
+ role: z.enum(['owner', 'member']),
1853
+ token: z.string(),
1854
+ workspace: zWorkspaceSummary
1855
+ });
1856
+ /**
1857
+ * Optional request body for the token exchange endpoint. The Firebase JWT
1858
+ * being exchanged is supplied via the `Authorization: Bearer` header; this
1859
+ * body only carries workspace-selection input.
1860
+ *
1861
+ */
1862
+ export const zExchangeTokenRequest = z.object({
1863
+ workspace_id: z.string().optional()
1864
+ });
1865
+ /**
1866
+ * Result of redeeming a desktop login code.
1867
+ */
1868
+ export const zDesktopLoginCodeRedeemResponse = z.object({
1869
+ status: z.enum(['redeemed'])
1870
+ });
1871
+ /**
1872
+ * Request to claim a desktop login code for the authenticated user.
1873
+ */
1874
+ export const zDesktopLoginCodeRedeemRequest = z.object({
1875
+ code: z.string()
1876
+ });
1877
+ /**
1878
+ * Exchange poll result. Pending until the code is redeemed in the browser.
1879
+ */
1880
+ export const zDesktopLoginCodeExchangeResponse = z.object({
1881
+ custom_token: z.string().optional(),
1882
+ status: z.enum(['pending', 'complete'])
1883
+ });
1884
+ /**
1885
+ * Request to exchange a redeemed login code for a custom token.
1886
+ */
1887
+ export const zDesktopLoginCodeExchangeRequest = z.object({
1888
+ code: z.string(),
1889
+ code_verifier: z.string().min(43).max(128)
1890
+ });
1891
+ /**
1892
+ * A freshly minted desktop login code and its polling parameters.
1893
+ */
1894
+ export const zDesktopLoginCodeCreateResponse = z.object({
1895
+ code: z.string(),
1896
+ expires_in: z.number().int(),
1897
+ poll_interval: z.number().int()
1898
+ });
1899
+ /**
1900
+ * Request to mint a desktop login code.
1901
+ */
1902
+ export const zDesktopLoginCodeCreateRequest = z.object({
1903
+ app_version: z.string().min(1).max(64),
1904
+ code_challenge: z.string().min(43).max(128),
1905
+ installation_id: z
1906
+ .string()
1907
+ .min(8)
1908
+ .max(128)
1909
+ .regex(/^[A-Za-z0-9._-]+$/)
1910
+ .optional(),
1911
+ platform: z.string().min(1).max(32)
1912
+ });
1913
+ /**
1914
+ * Response after deleting a session cookie
1915
+ */
1916
+ export const zDeleteSessionResponse = z.object({
1917
+ success: z.boolean()
1918
+ });
1919
+ /**
1920
+ * The workspace bound to the presented credential, plus how that credential authenticated. Same shape as Workspace with the caller's role and the auth method added, and without created_at (callers of this endpoint want identity, not provenance).
1921
+ */
1922
+ export const zCurrentWorkspaceResponse = z.object({
1923
+ auth_method: z.string(),
1924
+ id: z.string(),
1925
+ name: z.string(),
1926
+ role: z.enum(['owner', 'member']).optional(),
1927
+ type: z.enum(['personal', 'team'])
1928
+ });
1929
+ /**
1930
+ * Request body for creating a new workspace.
1931
+ */
1932
+ export const zCreateWorkspaceRequest = z.object({
1933
+ name: z.string().min(1).max(100)
1934
+ });
1935
+ /**
1936
+ * Response containing the newly created workspace API key.
1937
+ */
1938
+ export const zCreateWorkspaceApiKeyResponse = z.object({
1939
+ created_at: z.string().datetime(),
1940
+ description: z.string().max(5000),
1941
+ expires_at: z.string().datetime().optional(),
1942
+ id: z.string().uuid(),
1943
+ key: z.string(),
1944
+ key_prefix: z.string(),
1945
+ name: z.string()
1946
+ });
1947
+ /**
1948
+ * Request body for creating a new workspace-scoped API key.
1949
+ */
1950
+ export const zCreateWorkspaceApiKeyRequest = z.object({
1951
+ description: z.string().max(5000).optional(),
1952
+ expires_at: z.string().datetime().optional(),
1953
+ name: z.string()
1954
+ });
1955
+ /**
1956
+ * Request body for creating a new version of a saved workflow.
1957
+ */
1958
+ export const zCreateWorkflowVersionRequest = z.object({
1959
+ base_version: z.number().int(),
1960
+ workflow_json: z.record(z.unknown())
1961
+ });
1962
+ /**
1963
+ * Request body for creating a new saved workflow.
1964
+ */
1965
+ export const zCreateWorkflowRequest = z.object({
1966
+ default_view: z.enum(['workflow', 'app']).optional(),
1967
+ description: z.string().optional(),
1968
+ forked_from_workflow_id: z.string().optional(),
1969
+ forked_from_workflow_version_id: z.string().optional(),
1970
+ name: z.string().optional(),
1971
+ workflow_json: z.record(z.unknown())
1972
+ });
1973
+ /**
1974
+ * Response after successfully purchasing a credit top-up.
1975
+ */
1976
+ export const zCreateTopupResponse = z.object({
1977
+ amount_cents: z.coerce
1978
+ .bigint()
1979
+ .min(BigInt('-9223372036854775808'), {
1980
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1981
+ })
1982
+ .max(BigInt('9223372036854775807'), {
1983
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1984
+ }),
1985
+ billing_op_id: z.string(),
1986
+ status: z.enum(['pending', 'completed', 'failed']),
1987
+ topup_id: z.string()
1988
+ });
1989
+ /**
1990
+ * Request body for purchasing a one-time credit top-up.
1991
+ */
1992
+ export const zCreateTopupRequest = z.object({
1993
+ amount_cents: z.coerce
1994
+ .bigint()
1995
+ .gte(BigInt(500))
1996
+ .max(BigInt('9223372036854775807'), {
1997
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1998
+ }),
1999
+ checkout_attempt_id: z.string().optional(),
2000
+ idempotency_key: z.string().optional()
2001
+ });
2002
+ /**
2003
+ * A hosted Stripe Checkout session for a credit top-up.
2004
+ */
2005
+ export const zCreateTopupCheckoutResponse = z.object({
2006
+ checkout_url: z.string().url(),
2007
+ session_id: z.string().optional()
2008
+ });
2009
+ /**
2010
+ * Request body for creating a hosted credit top-up checkout session.
2011
+ */
2012
+ export const zCreateTopupCheckoutRequest = z.object({
2013
+ amount_cents: z.coerce.bigint().gte(BigInt(500)).lte(BigInt(473900)),
2014
+ idempotency_key: z.string().optional(),
2015
+ return_url: z.string().url()
2016
+ });
2017
+ /**
2018
+ * Response after creating a session cookie
2019
+ */
2020
+ export const zCreateSessionResponse = z.object({
2021
+ expiresIn: z.number().int().optional(),
2022
+ success: z.boolean()
2023
+ });
2024
+ /**
2025
+ * Request body for creating a new user secret.
2026
+ */
2027
+ export const zCreateSecretRequest = z.object({
2028
+ credential_type: z
2029
+ .enum(['api_key', 'gcp_service_account'])
2030
+ .optional()
2031
+ .default('api_key'),
2032
+ name: z.string().min(1).max(255),
2033
+ provider: z.string().max(64).optional(),
2034
+ secret_value: z.string().min(1)
2035
+ });
2036
+ /**
2037
+ * Request body for inviting a user to a workspace.
2038
+ */
2039
+ export const zCreateInviteRequest = z.object({
2040
+ email: z.string().email()
2041
+ });
2042
+ /**
2043
+ * Request body for creating a new Hub profile.
2044
+ */
2045
+ export const zCreateHubProfileRequest = z.object({
2046
+ avatar_token: z.string().optional(),
2047
+ description: z.string().optional(),
2048
+ display_name: z.string().optional(),
2049
+ username: z.string(),
2050
+ website_urls: z.array(z.string()).optional(),
2051
+ workspace_id: z.string()
2052
+ });
2053
+ /**
2054
+ * Credentials the Churnkey embed requires to launch the cancel flow.
2055
+ * `auth_hash` is hex-encoded HMAC-SHA256 of `customer_id` signed with the
2056
+ * server's CHURNKEY_HMAC_SECRET; it is bound to that single customer ID
2057
+ * and must not be reused for other customers.
2058
+ *
2059
+ */
2060
+ export const zChurnkeyAuthResponse = z.object({
2061
+ auth_hash: z.string(),
2062
+ customer_id: z.string(),
2063
+ mode: z.enum(['live', 'test', 'sandbox'])
2064
+ });
2065
+ /**
2066
+ * Response after successfully cancelling a subscription.
2067
+ */
2068
+ export const zCancelSubscriptionResponse = z.object({
2069
+ billing_op_id: z.string(),
2070
+ cancel_at: z.string().datetime()
2071
+ });
2072
+ /**
2073
+ * Request body for cancelling the current subscription.
2074
+ */
2075
+ export const zCancelSubscriptionRequest = z.object({
2076
+ idempotency_key: z.string().optional()
2077
+ });
2078
+ /**
2079
+ * Response when a cancellation is accepted but has not committed yet. Carries no cancel_at: no cancellation time exists to report until the operation settles. The billing operation reports only status, so once it reaches `succeeded` the committed date is read from `cancel_at` on `GET /api/billing/status`.
2080
+ */
2081
+ export const zCancelSubscriptionAcceptedResponse = z.object({
2082
+ billing_op_id: z.string(),
2083
+ status: z.enum(['pending'])
2084
+ });
2085
+ /**
2086
+ * Response after bulk-revoking API keys for a workspace member.
2087
+ */
2088
+ export const zBulkRevokeApiKeysResponse = z.object({
2089
+ revoked_count: z.number().int().gte(0)
2090
+ });
2091
+ /**
2092
+ * A tax identifier for a company Stripe customer. Stripe validates the
2093
+ * type/value combination synchronously and verifies VAT/ABN-style IDs
2094
+ * asynchronously.
2095
+ *
2096
+ */
2097
+ export const zBillingTaxId = z.object({
2098
+ type: z.string(),
2099
+ value: z.string()
2100
+ });
2101
+ /**
2102
+ * Payment lifecycle status
2103
+ */
2104
+ export const zBillingStatus = z.enum([
2105
+ 'awaiting_payment_method',
2106
+ 'pending_payment',
2107
+ 'paid',
2108
+ 'payment_failed',
2109
+ 'paused',
2110
+ 'inactive'
2111
+ ]);
2112
+ /**
2113
+ * Current billing and subscription status for a workspace.
2114
+ */
2115
+ export const zBillingStatusResponse = z.object({
2116
+ action_url: z.string().optional(),
2117
+ billing_rail: z.enum(['legacy_stripe', 'metronome', 'stripe']).optional(),
2118
+ billing_status: zBillingStatus.optional(),
2119
+ cancel_at: z.string().datetime().optional(),
2120
+ has_funds: z.boolean(),
2121
+ is_active: z.boolean(),
2122
+ max_seats: z.number().int(),
2123
+ occupied_seats: z.number().int(),
2124
+ payment_intent_client_secret: z.string().optional(),
2125
+ pending_billing_op_id: z.string().optional(),
2126
+ pending_billing_op_type: z.enum(['subscription', 'topup']).optional(),
2127
+ plan_slug: z.string().optional(),
2128
+ renewal_date: z.string().datetime().optional(),
2129
+ scheduled_change: zScheduledPlanChange.nullable(),
2130
+ subscription_duration: zSubscriptionDuration.optional(),
2131
+ subscription_status: z.enum(['active', 'ended', 'canceled']).optional(),
2132
+ subscription_tier: zSubscriptionTier.optional(),
2133
+ team_credit_stop: zTeamCreditStopSummary.nullable()
2134
+ });
2135
+ /**
2136
+ * List of available billing plans for subscription.
2137
+ */
2138
+ export const zBillingPlansResponse = z.object({
2139
+ current_plan_slug: z.string().optional(),
2140
+ plans: z.array(zPlan),
2141
+ team_credit_stops: zTeamCreditStops.optional()
2142
+ });
2143
+ /**
2144
+ * Status of an asynchronous billing operation.
2145
+ */
2146
+ export const zBillingOpStatusResponse = z.object({
2147
+ action_url: z.string().optional(),
2148
+ authentication_state: z
2149
+ .enum([
2150
+ 'requires_action',
2151
+ 'processing',
2152
+ 'failed_retryable',
2153
+ 'succeeded',
2154
+ 'reconciliation_needed'
2155
+ ])
2156
+ .optional(),
2157
+ completed_at: z.string().datetime().optional(),
2158
+ decline_reason: z
2159
+ .enum([
2160
+ 'card_declined',
2161
+ 'insufficient_funds',
2162
+ 'expired_card',
2163
+ 'incorrect_cvc',
2164
+ 'authentication_required',
2165
+ 'authentication_failed',
2166
+ 'processing_error',
2167
+ 'generic'
2168
+ ])
2169
+ .optional(),
2170
+ error_message: z.string().optional(),
2171
+ id: z.string(),
2172
+ payment_intent_client_secret: z.string().optional(),
2173
+ phase: z
2174
+ .enum([
2175
+ 'awaiting_payment_method',
2176
+ 'awaiting_invoice_payment',
2177
+ 'in_progress'
2178
+ ])
2179
+ .optional(),
2180
+ recovery_action: z
2181
+ .enum([
2182
+ 'retry',
2183
+ 'replace_payment_method',
2184
+ 'authenticate_payment',
2185
+ 'contact_support'
2186
+ ])
2187
+ .optional(),
2188
+ retryable: z.boolean().optional(),
2189
+ started_at: z.string().datetime(),
2190
+ status: z.enum(['pending', 'succeeded', 'failed', 'reconciliation_needed'])
2191
+ });
2192
+ /**
2193
+ * A single history event. The cloud history-events store is the single source of truth for both billing events (charges, credits, adjustments) and user-facing usage events.
2194
+ */
2195
+ export const zBillingEvent = z.object({
2196
+ createdAt: z.string().datetime(),
2197
+ event_id: z.string(),
2198
+ event_type: z.string(),
2199
+ params: z.record(z.unknown()).optional()
2200
+ });
2201
+ /**
2202
+ * Paginated list of billing events for a workspace.
2203
+ */
2204
+ export const zBillingEventsResponse = z.object({
2205
+ events: z.array(zBillingEvent),
2206
+ limit: z.number().int(),
2207
+ page: z.number().int(),
2208
+ total: z.number().int(),
2209
+ totalPages: z.number().int()
2210
+ });
2211
+ /**
2212
+ * A billing address for a company Stripe customer. city and postal_code
2213
+ * are optional because some countries (e.g. Hong Kong, the UAE, Panama)
2214
+ * have no postal code and are not collected for them; Stripe validates
2215
+ * what a given country actually requires.
2216
+ *
2217
+ */
2218
+ export const zBillingAddress = z.object({
2219
+ city: z.string().optional(),
2220
+ country: z.string(),
2221
+ line1: z.string(),
2222
+ line2: z.string().optional(),
2223
+ postal_code: z.string().optional(),
2224
+ state: z.string().optional()
2225
+ });
2226
+ /**
2227
+ * Fields to set on the workspace's Stripe customer. Every group is
2228
+ * optional; omit a group to leave that part of the customer unchanged.
2229
+ *
2230
+ */
2231
+ export const zBillingCompanyDetailsUpdateRequest = z.object({
2232
+ address: zBillingAddress.optional(),
2233
+ company_name: z.string().optional(),
2234
+ tax_id: zBillingTaxId.optional()
2235
+ });
2236
+ /**
2237
+ * Company billing details on file for the workspace's Stripe customer.
2238
+ * A field is absent until the workspace sets it via PATCH
2239
+ * /api/billing/company-details.
2240
+ *
2241
+ */
2242
+ export const zBillingCompanyDetailsResponse = z.object({
2243
+ address: zBillingAddress.optional(),
2244
+ company_name: z.string().optional(),
2245
+ tax_id: zBillingTaxId.optional()
2246
+ });
2247
+ export const zBillingCapabilityScope = z.object({
2248
+ user_id: z.string(),
2249
+ workspace_id: z.string()
2250
+ });
2251
+ /**
2252
+ * Identifies capability values currently using safe rollout defaults
2253
+ * instead of deterministic policy results. A true value is UI guidance,
2254
+ * not evidence that the corresponding write will succeed.
2255
+ *
2256
+ */
2257
+ export const zBillingCapabilityRolloutDefaults = z.object({
2258
+ can_downgrade_to_personal: z.boolean(),
2259
+ can_subscribe_self_serve: z.boolean(),
2260
+ can_top_up: z.boolean()
2261
+ });
2262
+ /**
2263
+ * Conservative UI guidance. These values do not authorize billing writes;
2264
+ * each write endpoint independently enforces its permission policy.
2265
+ *
2266
+ */
2267
+ export const zBillingCapabilities = z.object({
2268
+ can_cancel: z.boolean(),
2269
+ can_change_seats: z.boolean(),
2270
+ can_downgrade_to_personal: z.boolean(),
2271
+ can_invite_members: z.boolean(),
2272
+ can_reactivate: z.boolean(),
2273
+ can_subscribe_self_serve: z.boolean(),
2274
+ can_top_up: z.boolean()
2275
+ });
2276
+ /**
2277
+ * Effective billing UI guidance for one authenticated user and workspace.
2278
+ */
2279
+ export const zBillingCapabilitiesResponse = z.object({
2280
+ capabilities: zBillingCapabilities,
2281
+ expires_at: z.string().datetime(),
2282
+ resolved_for: zBillingCapabilityScope,
2283
+ revision: z.coerce
2284
+ .bigint()
2285
+ .min(BigInt('-9223372036854775808'), {
2286
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2287
+ })
2288
+ .lte(BigInt(9007199254740991)),
2289
+ rollout_defaults_applied: zBillingCapabilityRolloutDefaults
2290
+ });
2291
+ /**
2292
+ * Current credit balance and usage details for a workspace.
2293
+ */
2294
+ export const zBillingBalanceResponse = z.object({
2295
+ amount_micros: z.number(),
2296
+ cloud_credit_balance_micros: z.number().optional(),
2297
+ currency: z.string(),
2298
+ effective_balance_micros: z.number().optional(),
2299
+ pending_charges_micros: z.number().optional(),
2300
+ prepaid_balance_micros: z.number().optional()
2301
+ });
2302
+ /**
2303
+ * Response returned when an existing asset is successfully updated.
2304
+ */
2305
+ export const zAssetUpdated = z.object({
2306
+ display_name: z.string().nullish(),
2307
+ file_path: z.string().nullish(),
2308
+ hash: z
2309
+ .string()
2310
+ .regex(/^blake3:[a-f0-9]{64}$/)
2311
+ .optional(),
2312
+ id: z.string().uuid(),
2313
+ job_id: z.string().uuid().nullish(),
2314
+ loader_path: z.string().nullish(),
2315
+ mime_type: z.string().optional(),
2316
+ name: z.string().optional(),
2317
+ tags: z.array(z.string()).optional(),
2318
+ updated_at: z.string().datetime(),
2319
+ user_metadata: z.record(z.unknown()).optional()
2320
+ });
2321
+ /**
2322
+ * Histogram of tag counts used for refining asset search results.
2323
+ */
2324
+ export const zAssetTagHistogramResponse = z.object({
2325
+ tag_counts: z.record(z.number().int())
2326
+ });
2327
+ /**
2328
+ * Metadata for a remotely hosted asset resolved by URL.
2329
+ */
2330
+ export const zAssetMetadataResponse = z.object({
2331
+ content_length: z.coerce
2332
+ .bigint()
2333
+ .min(BigInt('-9223372036854775808'), {
2334
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2335
+ })
2336
+ .max(BigInt('9223372036854775807'), {
2337
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
2338
+ }),
2339
+ content_type: z.string().optional(),
2340
+ filename: z.string().optional(),
2341
+ name: z.string().optional(),
2342
+ preview_image: z.string().optional(),
2343
+ tags: z.array(z.string()).optional(),
2344
+ validation: zValidationResult.optional()
2345
+ });
2346
+ /**
2347
+ * Acknowledgement of an async asset download task; clients poll GET /api/tasks/{task_id} for status.
2348
+ */
2349
+ export const zAssetDownloadResponse = z.object({
2350
+ message: z.string().optional(),
2351
+ status: z.enum(['created', 'running', 'completed', 'failed']),
2352
+ task_id: z.string().uuid()
2353
+ });
2354
+ /**
2355
+ * Response returned when a new asset is successfully created.
2356
+ */
2357
+ export const zAssetCreated = zAsset.and(z.object({
2358
+ created_new: z.boolean()
2359
+ }));
2360
+ /**
2361
+ * Acknowledgement that a turn was accepted. The agent runs asynchronously; output streams over the WebSocket (agent_message_delta, agent_tool_call, draft_patch, agent_message_done).
2362
+ */
2363
+ export const zAgentTurnAccepted = z.object({
2364
+ message_id: z.string(),
2365
+ thread_id: z.string()
2366
+ });
2367
+ /**
2368
+ * One agent thread row for the history sidebar.
2369
+ */
2370
+ export const zAgentThreadSummary = z.object({
2371
+ created_at: z.string(),
2372
+ id: z.string(),
2373
+ last_message_at: z.string(),
2374
+ message_count: z.number().int().gte(0),
2375
+ preview: z.string(),
2376
+ status: z.enum(['active', 'archived']),
2377
+ title: z.string(),
2378
+ updated_at: z.string(),
2379
+ workflow_id: z.string()
2380
+ });
2381
+ /**
2382
+ * A paginated page of the caller's agent threads.
2383
+ */
2384
+ export const zAgentThreadListResponse = z.object({
2385
+ pagination: zPaginationInfo,
2386
+ threads: z.array(zAgentThreadSummary)
2387
+ });
2388
+ /**
2389
+ * Result of creating an agent thread.
2390
+ */
2391
+ export const zAgentThreadCreated = z.object({
2392
+ thread_id: z.string()
2393
+ });
2394
+ /**
2395
+ * Optional body for creating an agent thread.
2396
+ */
2397
+ export const zAgentThreadCreateRequest = z.object({
2398
+ workflow_id: z.string().optional()
2399
+ });
2400
+ /**
2401
+ * A user-authored skill pack to create or replace. Plain JSON — a pack body is small enough that a signed-URL upload would be pure overhead.
2402
+ */
2403
+ export const zAgentSkillPublishRequest = z.object({
2404
+ always: z.boolean().optional().default(false),
2405
+ body: z.string(),
2406
+ description: z.string().max(1024),
2407
+ name: z
2408
+ .string()
2409
+ .max(64)
2410
+ .regex(/^[A-Za-z0-9._-]*[A-Za-z0-9_-][A-Za-z0-9._-]*$/)
2411
+ });
2412
+ /**
2413
+ * One of the caller's user-authored skill packs.
2414
+ */
2415
+ export const zAgentSkill = z.object({
2416
+ body: z.string(),
2417
+ body_hash: z.string(),
2418
+ created_at: z.string(),
2419
+ description: z.string(),
2420
+ id: z.string(),
2421
+ name: z.string(),
2422
+ updated_at: z.string()
2423
+ });
2424
+ /**
2425
+ * The caller's skill packs, ordered by name.
2426
+ */
2427
+ export const zAgentSkillListResponse = z.object({
2428
+ skills: z.array(zAgentSkill)
2429
+ });
2430
+ /**
2431
+ * The run mode to save.
2432
+ */
2433
+ export const zAgentRunModePutRequest = z.object({
2434
+ credit_limit: z.number().int().gte(1).lte(2147483647).nullish(),
2435
+ mode: z.enum(['ask_approval', 'auto', 'auto_limited'])
2436
+ });
2437
+ /**
2438
+ * How the agent may spend the caller's credits by running workflows from chat. The saved choice, or the default (ask_approval, no limit) for a caller who never chose.
2439
+ */
2440
+ export const zAgentRunMode = z.object({
2441
+ credit_limit: z.number().int().gte(1).lte(2147483647).nullable(),
2442
+ mode: z.enum(['ask_approval', 'auto', 'auto_limited'])
2443
+ });
2444
+ /**
2445
+ * A user turn posted to the agent.
2446
+ */
2447
+ export const zAgentPostMessageRequest = z.object({
2448
+ attachments: z.array(z.string()).optional(),
2449
+ content: z.string(),
2450
+ current_tab: z.string().optional(),
2451
+ draft: z
2452
+ .object({
2453
+ content: z.record(z.unknown()).optional(),
2454
+ version: z.number().int().nullish()
2455
+ })
2456
+ .optional(),
2457
+ open_tabs: z
2458
+ .array(z.object({
2459
+ name: z.string().optional(),
2460
+ workflow_id: z.string()
2461
+ }))
2462
+ .optional(),
2463
+ selection: z.record(z.unknown()).optional(),
2464
+ workflow_id: z.string().optional(),
2465
+ workflow_references: z
2466
+ .array(z.object({
2467
+ name: z.string().optional(),
2468
+ workflow_id: z.string()
2469
+ }))
2470
+ .optional()
2471
+ });
2472
+ /**
2473
+ * An unanswered ask attached to its assistant message, so a reload rehydrates the prompt from the ROW rather than from the agent_ask WebSocket event the client missed. Present only while the ask is pending; answer it via POST /agent/threads/{id}/asks/{ask_id}/answer.
2474
+ */
2475
+ export const zAgentPendingAsk = z.object({
2476
+ allow_other: z.boolean(),
2477
+ ask_id: z.string(),
2478
+ context: z.record(z.unknown()).optional(),
2479
+ kind: z.enum(['ask_user', 'run_approval']),
2480
+ max_selections: z.number().int(),
2481
+ message_id: z.string(),
2482
+ min_selections: z.number().int(),
2483
+ options: z.array(z.record(z.unknown())),
2484
+ prompt: z.string()
2485
+ });
2486
+ /**
2487
+ * A persisted message in an agent thread.
2488
+ */
2489
+ export const zAgentMessage = z.object({
2490
+ content: z.record(z.unknown()).optional(),
2491
+ id: z.string(),
2492
+ pending_ask: zAgentPendingAsk.optional(),
2493
+ role: z.enum(['user', 'assistant', 'tool', 'system']),
2494
+ seq: z.number().int(),
2495
+ status: z.enum(['streaming', 'complete', 'error', 'interrupted']),
2496
+ thread_id: z.string(),
2497
+ turn_id: z.string(),
2498
+ workflow_id: z.string().optional()
2499
+ });
2500
+ /**
2501
+ * Error body authored by the comfy-agent service and proxied verbatim through ingest. Errors raised by ingest itself (authentication, an unreachable agent service) use the standard ErrorResponse shape instead.
2502
+ */
2503
+ export const zAgentError = z.object({
2504
+ error: z.string()
2505
+ });
2506
+ /**
2507
+ * Authoritative snapshot of a workflow's agent draft — the replay-on-reconnect baseline for the draft_patch stream.
2508
+ */
2509
+ export const zAgentDraftSnapshot = z.object({
2510
+ content: z.record(z.unknown()),
2511
+ version: z.number().int()
2512
+ });
2513
+ /**
2514
+ * Acknowledgement that a turn cancellation was requested. Cancellation is asynchronous; the terminal message state (status=error with stop copy) arrives over the WebSocket.
2515
+ */
2516
+ export const zAgentCancelAccepted = z.object({
2517
+ status: z.enum(['cancelling'])
2518
+ });
2519
+ /**
2520
+ * The user's answer to a pending ask_user prompt. `selected` holds the chosen option ids; a permission gate answers with one id (e.g. the Approve/Deny option). `other_text` carries a free-text answer when the ask set allow_other.
2521
+ */
2522
+ export const zAgentAnswerRequest = z.object({
2523
+ other_text: z.string().optional(),
2524
+ selected: z.array(z.string())
2525
+ });
2526
+ /**
2527
+ * Acknowledgement that an ask answer was accepted. The parked turn resumes and its continuation streams over the WebSocket.
2528
+ */
2529
+ export const zAgentAnswerAccepted = z.object({
2530
+ status: z.enum(['answered'])
2531
+ });
2532
+ /**
2533
+ * Returned when a request to run the agent is declined before the turn starts, because of a billing or account condition on the workspace. The `error` object carries a `message` you can show the user, a `type` that matches the HTTP status, and a more specific `reason` you can branch on to offer the right next step.
2534
+ */
2535
+ export const zAgentAdmissionError = z.object({
2536
+ error: z.object({
2537
+ message: z.string(),
2538
+ reason: z.enum(['no_funds', 'manual_block', 'funds_unavailable']),
2539
+ type: z.enum(['PAYMENT_REQUIRED', 'SERVICE_UNAVAILABLE'])
2540
+ })
2541
+ });
2542
+ /**
2543
+ * Response returned after successfully accepting a workspace invitation.
2544
+ */
2545
+ export const zAcceptInviteResponse = z.object({
2546
+ workspace_id: z.string(),
2547
+ workspace_name: z.string()
2548
+ });
2549
+ /**
2550
+ * Represents a user-owned asset (image, video, or other generated output).
2551
+ */
2552
+ export const zAssetWritable = z.object({
2553
+ created_at: z.string().datetime(),
2554
+ display_name: z.string().nullish(),
2555
+ file_path: z.string().nullish(),
2556
+ hash: z
2557
+ .string()
2558
+ .regex(/^blake3:[a-f0-9]{64}$/)
2559
+ .optional(),
2560
+ id: z.string().uuid(),
2561
+ is_immutable: z.boolean().optional(),
2562
+ job_id: z.string().uuid().nullish(),
2563
+ last_access_time: z.string().datetime().optional(),
2564
+ loader_path: z.string().nullish(),
2565
+ mime_type: z.string().optional(),
2566
+ name: z.string(),
2567
+ preview_id: z.string().uuid().nullish(),
2568
+ preview_url: z.string().url().optional(),
2569
+ short_url: z.string().nullish(),
2570
+ size: z.coerce
2571
+ .bigint()
2572
+ .min(BigInt('-9223372036854775808'), {
2573
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2574
+ })
2575
+ .max(BigInt('9223372036854775807'), {
2576
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
2577
+ })
2578
+ .optional(),
2579
+ tags: z.array(z.string()).optional(),
2580
+ updated_at: z.string().datetime(),
2581
+ user_metadata: z.record(z.unknown()).optional()
2582
+ });
2583
+ /**
2584
+ * Paginated list of assets belonging to the authenticated user.
2585
+ */
2586
+ export const zListAssetsResponseWritable = z.object({
2587
+ assets: z.array(zAssetWritable),
2588
+ has_more: z.boolean(),
2589
+ next_cursor: z.string().optional(),
2590
+ total: z.number().int()
2591
+ });
2592
+ /**
2593
+ * Response returned when a new asset is successfully created.
2594
+ */
2595
+ export const zAssetCreatedWritable = zAssetWritable.and(z.object({
2596
+ created_new: z.boolean()
2597
+ }));
2598
+ /**
2599
+ * JWKS response
2600
+ */
2601
+ export const zGetJwksResponse = zJwksResponse;
2602
+ /**
2603
+ * Authorization-server metadata
2604
+ */
2605
+ export const zGetOAuthAuthorizationServerResponse = zOAuthAuthorizationServerMetadata;
2606
+ /**
2607
+ * Protected-resource metadata
2608
+ */
2609
+ export const zGetOAuthProtectedResourceResponse = zOAuthProtectedResourceMetadata;
2610
+ export const zGetOAuthProtectedResourceByPathPath = z.object({
2611
+ resourcePath: z.string().regex(/^[a-zA-Z0-9._-]+$/)
2612
+ });
2613
+ /**
2614
+ * Protected-resource metadata
2615
+ */
2616
+ export const zGetOAuthProtectedResourceByPathResponse = zOAuthProtectedResourceMetadata;
2617
+ export const zGetCustomNodeProxyPath = z.object({
2618
+ path: z.string()
2619
+ });
2620
+ export const zPostCustomNodeProxyPath = z.object({
2621
+ path: z.string()
2622
+ });
2623
+ export const zAgentGetDraftQuery = z.object({
2624
+ workflow_id: z.string()
2625
+ });
2626
+ /**
2627
+ * Current draft snapshot
2628
+ */
2629
+ export const zAgentGetDraftResponse = zAgentDraftSnapshot;
2630
+ export const zAgentLlmAdmitBody = z.object({
2631
+ message_id: z.string().optional(),
2632
+ step: z.number().int().gte(0),
2633
+ turn_id: z.string()
2634
+ });
2635
+ /**
2636
+ * The admission verdict for the round.
2637
+ */
2638
+ export const zAgentLlmAdmitResponse = z.object({
2639
+ after_seconds: z.number().int().optional(),
2640
+ kind: z.enum(['proceed', 'wait', 'pause', 'fail']),
2641
+ message: z.string().optional(),
2642
+ position: z.number().int().optional(),
2643
+ reason: z.string().optional()
2644
+ });
2645
+ /**
2646
+ * Opaque Anthropic Messages request body, passed through to the upstream. Not modeled here — the agent's LLM proxy owns the contract.
2647
+ */
2648
+ export const zAgentLlmMessagesBody = z.record(z.unknown());
2649
+ /**
2650
+ * The upstream LLM response, streamed back as Server-Sent Events (text/event-stream) chunk-by-chunk.
2651
+ */
2652
+ export const zAgentLlmMessagesResponse = z.string();
2653
+ /**
2654
+ * The caller's run mode (the saved choice, or the default).
2655
+ */
2656
+ export const zAgentGetRunModeResponse = zAgentRunMode;
2657
+ export const zAgentPutRunModeBody = zAgentRunModePutRequest;
2658
+ /**
2659
+ * The saved run mode.
2660
+ */
2661
+ export const zAgentPutRunModeResponse = zAgentRunMode;
2662
+ /**
2663
+ * The caller's skill packs.
2664
+ */
2665
+ export const zAgentListSkillsResponse = zAgentSkillListResponse;
2666
+ export const zAgentPublishSkillBody = zAgentSkillPublishRequest;
2667
+ /**
2668
+ * An existing pack of the same name was replaced.
2669
+ */
2670
+ export const zAgentPublishSkillResponse = zAgentSkill;
2671
+ export const zAgentDeleteSkillPath = z.object({
2672
+ name: z
2673
+ .string()
2674
+ .max(64)
2675
+ .regex(/^[A-Za-z0-9._-]*[A-Za-z0-9_-][A-Za-z0-9._-]*$/)
2676
+ });
2677
+ /**
2678
+ * The pack was deleted.
2679
+ */
2680
+ export const zAgentDeleteSkillResponse = z.void();
2681
+ export const zAgentListThreadsQuery = z.object({
2682
+ limit: z.number().int().gte(1).lte(100).optional().default(20),
2683
+ after: z.string().optional()
2684
+ });
2685
+ /**
2686
+ * A page of the caller's agent threads.
2687
+ */
2688
+ export const zAgentListThreadsResponse = zAgentThreadListResponse;
2689
+ export const zAgentCreateThreadBody = zAgentThreadCreateRequest;
2690
+ /**
2691
+ * Thread created
2692
+ */
2693
+ export const zAgentCreateThreadResponse = zAgentThreadCreated;
2694
+ export const zAgentAnswerAskBody = zAgentAnswerRequest;
2695
+ export const zAgentAnswerAskPath = z.object({
2696
+ id: z.string(),
2697
+ ask_id: z.string()
2698
+ });
2699
+ /**
2700
+ * Answer accepted; the turn resumes and streams over the WebSocket
2701
+ */
2702
+ export const zAgentAnswerAskResponse = zAgentAnswerAccepted;
2703
+ export const zAgentGetMessagesPath = z.object({
2704
+ id: z.string()
2705
+ });
2706
+ /**
2707
+ * Messages in the thread, ordered by seq
2708
+ */
2709
+ export const zAgentGetMessagesResponse = z.array(zAgentMessage);
2710
+ export const zAgentPostMessageBody = zAgentPostMessageRequest;
2711
+ export const zAgentPostMessagePath = z.object({
2712
+ id: z.string()
2713
+ });
2714
+ /**
2715
+ * Turn accepted; the agent runs asynchronously and streams output over the WebSocket
2716
+ */
2717
+ export const zAgentPostMessageResponse = zAgentTurnAccepted;
2718
+ export const zAgentCancelMessagePath = z.object({
2719
+ id: z.string(),
2720
+ message_id: z.string()
2721
+ });
2722
+ /**
2723
+ * Cancellation requested; the terminal state arrives over the WebSocket
2724
+ */
2725
+ export const zAgentCancelMessageResponse = zAgentCancelAccepted;
2726
+ export const zListAssetsQuery = z.object({
2727
+ include_tags: z.array(z.string()).optional(),
2728
+ exclude_tags: z.array(z.string()).optional(),
2729
+ tags_all: z.array(z.string()).optional(),
2730
+ tags_any: z.array(z.string()).optional(),
2731
+ tags_none: z.array(z.string()).optional(),
2732
+ name_contains: z.string().optional(),
2733
+ metadata_filter: z.string().optional(),
2734
+ limit: z.number().int().gte(1).lte(500).optional().default(20),
2735
+ offset: z.number().int().gte(0).optional().default(0),
2736
+ sort: z
2737
+ .enum(['name', 'created_at', 'updated_at', 'size', 'last_access_time'])
2738
+ .optional()
2739
+ .default('created_at'),
2740
+ order: z.enum(['asc', 'desc']).optional().default('desc'),
2741
+ include_public: z.boolean().optional().default(true),
2742
+ hash: z.string().optional(),
2743
+ after: z.string().optional()
2744
+ });
2745
+ /**
2746
+ * Success - Assets returned
2747
+ */
2748
+ export const zListAssetsResponse2 = zListAssetsResponse;
2749
+ export const zCreateAssetBody = z.object({
2750
+ file: z.string(),
2751
+ hash: z
2752
+ .string()
2753
+ .regex(/^(blake3|sha256):[a-f0-9]{64}$/)
2754
+ .optional(),
2755
+ id: z.string().uuid().optional(),
2756
+ mime_type: z.string().optional(),
2757
+ name: z.string().optional(),
2758
+ preview_id: z.string().uuid().optional(),
2759
+ tags: z.string().optional(),
2760
+ user_metadata: z.string().optional()
2761
+ });
2762
+ /**
2763
+ * Asset already existed for this user (deduplicated by content hash); the
2764
+ * existing asset is returned with created_new=false.
2765
+ *
2766
+ */
2767
+ export const zCreateAssetResponse = zAssetCreated;
2768
+ export const zDeleteAssetPath = z.object({
2769
+ id: z.string().uuid()
2770
+ });
2771
+ /**
2772
+ * Asset record deleted successfully
2773
+ */
2774
+ export const zDeleteAssetResponse = z.void();
2775
+ export const zGetAssetByIdPath = z.object({
2776
+ id: z.string().uuid()
2777
+ });
2778
+ /**
2779
+ * Asset details retrieved successfully
2780
+ */
2781
+ export const zGetAssetByIdResponse = zAsset;
2782
+ export const zUpdateAssetBody = z.object({
2783
+ mime_type: z.string().optional(),
2784
+ name: z.string().optional(),
2785
+ preview_id: z.string().uuid().optional(),
2786
+ user_metadata: z.record(z.unknown()).optional()
2787
+ });
2788
+ export const zUpdateAssetPath = z.object({
2789
+ id: z.string().uuid()
2790
+ });
2791
+ /**
2792
+ * Asset updated successfully
2793
+ */
2794
+ export const zUpdateAssetResponse = zAssetUpdated;
2795
+ export const zGetAssetContentPath = z.object({
2796
+ id: z.string()
2797
+ });
2798
+ export const zGetAssetContentQuery = z.object({
2799
+ disposition: z.enum(['inline', 'attachment']).optional().default('attachment')
2800
+ });
2801
+ /**
2802
+ * Asset content stream (local runtime streams the bytes directly)
2803
+ */
2804
+ export const zGetAssetContentResponse = z.string();
2805
+ export const zRemoveAssetTagsBody = z.object({
2806
+ tags: z.array(z.string()).min(1)
2807
+ });
2808
+ export const zRemoveAssetTagsPath = z.object({
2809
+ id: z.string().uuid()
2810
+ });
2811
+ /**
2812
+ * Tags removed successfully
2813
+ */
2814
+ export const zRemoveAssetTagsResponse = zTagsModificationResponse;
2815
+ export const zAddAssetTagsBody = z.object({
2816
+ tags: z.array(z.string()).min(1)
2817
+ });
2818
+ export const zAddAssetTagsPath = z.object({
2819
+ id: z.string().uuid()
2820
+ });
2821
+ /**
2822
+ * Tags added successfully
2823
+ */
2824
+ export const zAddAssetTagsResponse = zTagsModificationResponse;
2825
+ export const zCreateAssetDownloadBody = z.object({
2826
+ preview_id: z.string().uuid().optional(),
2827
+ source_url: z.string().url(),
2828
+ tags: z.array(z.string()).optional(),
2829
+ user_metadata: z.record(z.unknown()).optional()
2830
+ });
2831
+ export const zCreateAssetDownloadResponse = z.union([
2832
+ zAssetCreated,
2833
+ zAssetDownloadResponse
2834
+ ]);
2835
+ export const zCreateAssetExportBody = z.object({
2836
+ asset_ids: z.array(z.string()).optional(),
2837
+ include_previews: z.boolean().optional().default(false),
2838
+ job_asset_name_filters: z.record(z.array(z.string()).min(1)).optional(),
2839
+ job_ids: z.array(z.string()).optional(),
2840
+ naming_strategy: z
2841
+ .enum(['group_by_job_id', 'preserve', 'asset_id', 'group_by_job_time'])
2842
+ .optional()
2843
+ .default('group_by_job_time')
2844
+ });
2845
+ /**
2846
+ * Accepted - Export task created and processing in background
2847
+ */
2848
+ export const zCreateAssetExportResponse = zAssetDownloadResponse;
2849
+ export const zDownloadExportPath = z.object({
2850
+ exportName: z.string().regex(/^[a-zA-Z0-9_-]+\.zip$/)
2851
+ });
2852
+ /**
2853
+ * Signed URL for downloading the export
2854
+ */
2855
+ export const zDownloadExportResponse = zExportDownloadUrlResponse;
2856
+ export const zCreateAssetFromHashBody = z.object({
2857
+ hash: z.string().regex(/^blake3:[a-f0-9]{64}$/),
2858
+ mime_type: z.string().optional(),
2859
+ name: z.string().optional(),
2860
+ tags: z.array(z.string()).min(1),
2861
+ user_metadata: z.record(z.unknown()).optional()
2862
+ });
2863
+ /**
2864
+ * Asset reference already existed for this user (deduplicated by content
2865
+ * hash); the existing asset is returned with created_new=false.
2866
+ *
2867
+ */
2868
+ export const zCreateAssetFromHashResponse = zAssetCreated;
2869
+ export const zPostAssetsFromWorkflowBody = zWorkflowApiAssetsRequest;
2870
+ /**
2871
+ * Success
2872
+ */
2873
+ export const zPostAssetsFromWorkflowResponse = zWorkflowApiAssetsResponse;
2874
+ export const zCheckAssetByHashPath = z.object({
2875
+ hash: z.string().regex(/^blake3:[a-f0-9]{64}$/)
2876
+ });
2877
+ export const zImportPublishedAssetsBody = zImportPublishedAssetsRequest;
2878
+ /**
2879
+ * Successfully imported assets
2880
+ */
2881
+ export const zImportPublishedAssetsResponse2 = zImportPublishedAssetsResponse;
2882
+ /**
2883
+ * Prune result
2884
+ */
2885
+ export const zPruneAssetsResponse = z.object({
2886
+ marked: z.number().int().optional(),
2887
+ status: z.string().optional()
2888
+ });
2889
+ export const zGetRemoteAssetMetadataQuery = z.object({
2890
+ url: z.string().url()
2891
+ });
2892
+ /**
2893
+ * Metadata retrieved successfully
2894
+ */
2895
+ export const zGetRemoteAssetMetadataResponse = zAssetMetadataResponse;
2896
+ export const zSeedAssetsBody = z.object({
2897
+ roots: z.array(z.string()).optional()
2898
+ });
2899
+ /**
2900
+ * Seed started
2901
+ */
2902
+ export const zSeedAssetsResponse = z.object({
2903
+ status: z.string().optional()
2904
+ });
2905
+ /**
2906
+ * Scan cancelled
2907
+ */
2908
+ export const zCancelAssetSeedResponse = z.object({
2909
+ status: z.string().optional()
2910
+ });
2911
+ /**
2912
+ * Scan progress details (files scanned, total, status, etc.)
2913
+ */
2914
+ export const zGetAssetSeedStatusResponse = z.record(z.unknown());
2915
+ export const zGetAssetTagHistogramQuery = z.object({
2916
+ include_tags: z.array(z.string()).optional(),
2917
+ exclude_tags: z.array(z.string()).optional(),
2918
+ tags_all: z.array(z.string()).optional(),
2919
+ tags_any: z.array(z.string()).optional(),
2920
+ tags_none: z.array(z.string()).optional(),
2921
+ name_contains: z.string().optional(),
2922
+ metadata_filter: z.string().optional(),
2923
+ limit: z.number().int().gte(1).lte(1000).optional().default(100),
2924
+ include_public: z.boolean().optional().default(true)
2925
+ });
2926
+ /**
2927
+ * Success - Tag histogram returned
2928
+ */
2929
+ export const zGetAssetTagHistogramResponse = zAssetTagHistogramResponse;
2930
+ export const zCreateDesktopLoginCodeBody = zDesktopLoginCodeCreateRequest;
2931
+ /**
2932
+ * Login code created
2933
+ */
2934
+ export const zCreateDesktopLoginCodeResponse = zDesktopLoginCodeCreateResponse;
2935
+ export const zExchangeDesktopLoginCodeBody = zDesktopLoginCodeExchangeRequest;
2936
+ /**
2937
+ * Pending (not yet redeemed) or complete with a custom token
2938
+ */
2939
+ export const zExchangeDesktopLoginCodeResponse = zDesktopLoginCodeExchangeResponse;
2940
+ export const zRedeemDesktopLoginCodeBody = zDesktopLoginCodeRedeemRequest;
2941
+ /**
2942
+ * Code redeemed (or already redeemed by the same user)
2943
+ */
2944
+ export const zRedeemDesktopLoginCodeResponse = zDesktopLoginCodeRedeemResponse;
2945
+ /**
2946
+ * Session deleted successfully
2947
+ */
2948
+ export const zDeleteSessionResponse2 = zDeleteSessionResponse;
2949
+ /**
2950
+ * Session created successfully
2951
+ */
2952
+ export const zCreateSessionResponse2 = zCreateSessionResponse;
2953
+ export const zExchangeTokenBody = zExchangeTokenRequest;
2954
+ /**
2955
+ * Token exchanged successfully
2956
+ */
2957
+ export const zExchangeTokenResponse2 = zExchangeTokenResponse;
2958
+ /**
2959
+ * Credit balance
2960
+ */
2961
+ export const zGetBillingBalanceResponse = zBillingBalanceResponse;
2962
+ /**
2963
+ * Effective billing capabilities
2964
+ */
2965
+ export const zGetBillingCapabilitiesResponse = zBillingCapabilitiesResponse;
2966
+ /**
2967
+ * Success
2968
+ */
2969
+ export const zGetChurnkeyAuthResponse = zChurnkeyAuthResponse;
2970
+ /**
2971
+ * Success
2972
+ */
2973
+ export const zGetBillingCompanyDetailsResponse = zBillingCompanyDetailsResponse;
2974
+ export const zUpdateBillingCompanyDetailsBody = zBillingCompanyDetailsUpdateRequest;
2975
+ /**
2976
+ * Success
2977
+ */
2978
+ export const zUpdateBillingCompanyDetailsResponse = zBillingCompanyDetailsResponse;
2979
+ export const zGetBillingEventsQuery = z.object({
2980
+ page: z.number().int().gte(1).optional().default(1),
2981
+ limit: z.number().int().gte(1).lte(100).optional().default(20),
2982
+ scope: z.enum(['self', 'workspace', 'user']).optional().default('self'),
2983
+ user_id: z.string().optional(),
2984
+ filter: z.string().optional(),
2985
+ start_date: z.string().datetime().optional(),
2986
+ end_date: z.string().datetime().optional()
2987
+ });
2988
+ /**
2989
+ * Paginated billing events
2990
+ */
2991
+ export const zGetBillingEventsResponse = zBillingEventsResponse;
2992
+ export const zGetBillingOpStatusPath = z.object({
2993
+ id: z.string()
2994
+ });
2995
+ /**
2996
+ * Billing operation status
2997
+ */
2998
+ export const zGetBillingOpStatusResponse = zBillingOpStatusResponse;
2999
+ /**
3000
+ * Saved payment methods
3001
+ */
3002
+ export const zListSavedPaymentMethodsResponse = z.array(zSavedPaymentMethod);
3003
+ export const zGetPaymentPortalBody = zPaymentPortalRequest;
3004
+ /**
3005
+ * Success
3006
+ */
3007
+ export const zGetPaymentPortalResponse = zPaymentPortalResponse;
3008
+ /**
3009
+ * Available plans with pricing
3010
+ */
3011
+ export const zGetBillingPlansResponse = zBillingPlansResponse;
3012
+ export const zPreviewSubscribeBody = zPreviewSubscribeRequest;
3013
+ /**
3014
+ * Subscription preview
3015
+ */
3016
+ export const zPreviewSubscribeResponse2 = zPreviewSubscribeResponse;
3017
+ /**
3018
+ * Billing status
3019
+ */
3020
+ export const zGetBillingStatusResponse = zBillingStatusResponse;
3021
+ export const zSubscribeBody = zSubscribeRequest;
3022
+ /**
3023
+ * Subscription created or payment method needed
3024
+ */
3025
+ export const zSubscribeResponse2 = zSubscribeResponse;
3026
+ export const zCancelSubscriptionBody = zCancelSubscriptionRequest;
3027
+ export const zCancelSubscriptionResponse2 = z.union([
3028
+ zCancelSubscriptionResponse,
3029
+ zCancelSubscriptionAcceptedResponse
3030
+ ]);
3031
+ export const zResubscribeBody = zResubscribeRequest;
3032
+ /**
3033
+ * Subscription resumed successfully
3034
+ */
3035
+ export const zResubscribeResponse2 = zResubscribeResponse;
3036
+ export const zCreateTopupBody = zCreateTopupRequest;
3037
+ /**
3038
+ * Top-up initiated successfully
3039
+ */
3040
+ export const zCreateTopupResponse2 = zCreateTopupResponse;
3041
+ export const zCreateTopupCheckoutBody = zCreateTopupCheckoutRequest;
3042
+ /**
3043
+ * Checkout session created
3044
+ */
3045
+ export const zCreateTopupCheckoutResponse2 = zCreateTopupCheckoutResponse;
3046
+ export const zGetBillingUsageTimeSeriesQuery = z.object({
3047
+ group_by: z
3048
+ .enum(['model', 'endpoint', 'product'])
3049
+ .optional()
3050
+ .default('model'),
3051
+ granularity: z.enum(['hour', 'day', 'month']).optional().default('month'),
3052
+ starting_on: z.string().datetime().optional(),
3053
+ ending_before: z.string().datetime().optional(),
3054
+ months: z.number().int().gte(1).lte(24).optional().default(6)
3055
+ });
3056
+ /**
3057
+ * Workspace usage
3058
+ */
3059
+ export const zGetBillingUsageTimeSeriesResponse = zUsageTimeSeries;
3060
+ /**
3061
+ * Embedding names
3062
+ */
3063
+ export const zGetEmbeddingsResponse = z.array(z.string());
3064
+ /**
3065
+ * Success - List of model folders
3066
+ */
3067
+ export const zGetModelFoldersResponse = z.array(zModelFolder);
3068
+ export const zGetModelsInFolderPath = z.object({
3069
+ folder: z.string()
3070
+ });
3071
+ /**
3072
+ * Success - List of models in the folder
3073
+ */
3074
+ export const zGetModelsInFolderResponse = z.array(zModelFile);
3075
+ export const zGetModelPreviewPath = z.object({
3076
+ folder: z.string(),
3077
+ path_index: z.number().int(),
3078
+ filename: z.string()
3079
+ });
3080
+ export const zGetNodeByIdPath = z.object({
3081
+ id: z.string()
3082
+ });
3083
+ /**
3084
+ * URL paths (relative to web root) of available extension JS files
3085
+ */
3086
+ export const zGetExtensionsResponse = z.array(z.string());
3087
+ /**
3088
+ * Success
3089
+ */
3090
+ export const zGetFeaturesResponse = z.object({
3091
+ free_tier_balance: z
3092
+ .object({
3093
+ allowance: z.number().int(),
3094
+ remaining: z.number().int(),
3095
+ used: z.number().int()
3096
+ })
3097
+ .optional(),
3098
+ max_upload_size: z.number().int().optional(),
3099
+ supports_preview_metadata: z.boolean().optional()
3100
+ });
3101
+ export const zSubmitFeedbackBody = zFeedbackRequest;
3102
+ /**
3103
+ * Feedback submitted successfully
3104
+ */
3105
+ export const zSubmitFeedbackResponse = zFeedbackResponse;
3106
+ export const zGetMaskLayersQuery = z.object({
3107
+ filename: z.string()
3108
+ });
3109
+ /**
3110
+ * Success - Related mask layers returned
3111
+ */
3112
+ export const zGetMaskLayersResponse = z.object({
3113
+ mask: z.string().nullish(),
3114
+ paint: z.string().nullish(),
3115
+ painted: z.string().nullish(),
3116
+ painted_masked: z.string().nullish()
3117
+ });
3118
+ export const zFreeMemoryBody = z.object({
3119
+ free_memory: z.boolean().optional(),
3120
+ unload_models: z.boolean().optional()
3121
+ });
3122
+ export const zSetGlobalSettingBody = zGlobalSettingValue;
3123
+ /**
3124
+ * Setting stored
3125
+ */
3126
+ export const zSetGlobalSettingResponse = zGlobalSetting;
3127
+ export const zDeleteGlobalSettingPath = z.object({
3128
+ key: zGlobalSettingKey
3129
+ });
3130
+ /**
3131
+ * Setting unset
3132
+ */
3133
+ export const zDeleteGlobalSettingResponse = z.void();
3134
+ export const zGetGlobalSettingPath = z.object({
3135
+ key: zGlobalSettingKey
3136
+ });
3137
+ /**
3138
+ * Success
3139
+ */
3140
+ export const zGetGlobalSettingResponse = zGlobalSetting;
3141
+ /**
3142
+ * Success - Map of subgraph IDs to their metadata
3143
+ */
3144
+ export const zGetGlobalSubgraphsResponse = z.record(zGlobalSubgraphInfo);
3145
+ export const zGetGlobalSubgraphPath = z.object({
3146
+ id: z.string()
3147
+ });
3148
+ /**
3149
+ * Success - Full subgraph data
3150
+ */
3151
+ export const zGetGlobalSubgraphResponse = zGlobalSubgraphData;
3152
+ export const zManageHistoryBody = zHistoryManageRequest;
3153
+ export const zGetLegacyHistoryByIdPath = z.object({
3154
+ prompt_id: z.string()
3155
+ });
3156
+ export const zGetHistoryQuery = z.object({
3157
+ max_items: z.number().int().optional(),
3158
+ offset: z.number().int().optional().default(0)
3159
+ });
3160
+ /**
3161
+ * Success - Execution history retrieved
3162
+ */
3163
+ export const zGetHistoryResponse = zHistoryResponse;
3164
+ export const zGetHistoryForPromptPath = z.object({
3165
+ prompt_id: z.string()
3166
+ });
3167
+ /**
3168
+ * Success - History for prompt retrieved
3169
+ */
3170
+ export const zGetHistoryForPromptResponse = zHistoryDetailResponse;
3171
+ export const zCreateHubAssetUploadUrlBody = zHubAssetUploadUrlRequest;
3172
+ /**
3173
+ * Presigned upload URL and token
3174
+ */
3175
+ export const zCreateHubAssetUploadUrlResponse = zHubAssetUploadUrlResponse;
3176
+ export const zListHubLabelsQuery = z.object({
3177
+ type: z.enum(['tag', 'model', 'custom_node']).optional()
3178
+ });
3179
+ /**
3180
+ * List of labels
3181
+ */
3182
+ export const zListHubLabelsResponse = zHubLabelListResponse;
3183
+ export const zCreateHubProfileBody = zCreateHubProfileRequest;
3184
+ /**
3185
+ * Hub profile created
3186
+ */
3187
+ export const zCreateHubProfileResponse = zHubProfile;
3188
+ export const zGetHubProfileByUsernamePath = z.object({
3189
+ username: z.string()
3190
+ });
3191
+ /**
3192
+ * Hub profile
3193
+ */
3194
+ export const zGetHubProfileByUsernameResponse = zHubProfile;
3195
+ export const zUpdateHubProfileBody = zUpdateHubProfileRequest;
3196
+ export const zUpdateHubProfilePath = z.object({
3197
+ username: z.string()
3198
+ });
3199
+ /**
3200
+ * Hub profile updated
3201
+ */
3202
+ export const zUpdateHubProfileResponse = zHubProfile;
3203
+ export const zCheckHubUsernameQuery = z.object({
3204
+ username: z.string()
3205
+ });
3206
+ /**
3207
+ * Username availability result
3208
+ */
3209
+ export const zCheckHubUsernameResponse = zHubUsernameCheckResponse;
3210
+ /**
3211
+ * Hub profile
3212
+ */
3213
+ export const zGetMyHubProfileResponse = zHubProfile;
3214
+ export const zListHubWorkflowsQuery = z.object({
3215
+ cursor: z.string().optional(),
3216
+ limit: z.number().int().gte(1).lte(100).optional().default(20),
3217
+ search: z.string().optional(),
3218
+ tag: z.string().optional(),
3219
+ username: z.string().optional(),
3220
+ detail: z.boolean().optional().default(false),
3221
+ status: z.array(zHubWorkflowStatus).optional()
3222
+ });
3223
+ /**
3224
+ * Paginated list of hub workflows
3225
+ */
3226
+ export const zListHubWorkflowsResponse = zHubWorkflowListResponse;
3227
+ export const zPublishHubWorkflowBody = zPublishHubWorkflowRequest;
3228
+ /**
3229
+ * Workflow published to hub
3230
+ */
3231
+ export const zPublishHubWorkflowResponse = zHubWorkflowDetail;
3232
+ export const zDeleteHubWorkflowPath = z.object({
3233
+ share_id: z.string()
3234
+ });
3235
+ /**
3236
+ * Successfully unpublished
3237
+ */
3238
+ export const zDeleteHubWorkflowResponse = z.void();
3239
+ export const zGetHubWorkflowPath = z.object({
3240
+ share_id: z.string()
3241
+ });
3242
+ /**
3243
+ * Hub workflow detail
3244
+ */
3245
+ export const zGetHubWorkflowResponse = zHubWorkflowDetail;
3246
+ export const zListHubWorkflowIndexQuery = z.object({
3247
+ status: z.array(zHubWorkflowStatus).optional()
3248
+ });
3249
+ /**
3250
+ * List of hub workflow template entries
3251
+ */
3252
+ export const zListHubWorkflowIndexResponse = z.array(zHubWorkflowTemplateEntry);
3253
+ /**
3254
+ * Nested map of locale to translation key-value pairs
3255
+ */
3256
+ export const zGetI18nResponse = z.record(z.unknown());
3257
+ export const zCreateInputUploadUrlBody = zInputUploadUrlRequest;
3258
+ /**
3259
+ * Upload grant minted
3260
+ */
3261
+ export const zCreateInputUploadUrlResponse = zUploadGrantResponse;
3262
+ export const zAcceptWorkspaceInvitePath = z.object({
3263
+ token: z.string()
3264
+ });
3265
+ /**
3266
+ * Invite accepted, user is now a member
3267
+ */
3268
+ export const zAcceptWorkspaceInviteResponse = zAcceptInviteResponse;
3269
+ export const zGetLegacyJobByIdPath = z.object({
3270
+ job_id: z.string()
3271
+ });
3272
+ export const zGetLegacyJobOutputsPath = z.object({
3273
+ job_id: z.string()
3274
+ });
3275
+ export const zGetJobStatusPath = z.object({
3276
+ job_id: z.string().uuid()
3277
+ });
3278
+ /**
3279
+ * Success - Job status returned
3280
+ */
3281
+ export const zGetJobStatusResponse = zJobStatusResponse;
3282
+ export const zListJobsQuery = z.object({
3283
+ status: z.string().optional(),
3284
+ workflow_id: z.string().optional(),
3285
+ output_type: z.enum(['image', 'video', 'audio', '3d']).optional(),
3286
+ sort_by: z
3287
+ .enum(['create_time', 'execution_time'])
3288
+ .optional()
3289
+ .default('create_time'),
3290
+ sort_order: z.enum(['asc', 'desc']).optional().default('desc'),
3291
+ after: z.string().optional(),
3292
+ offset: z.number().int().gte(0).optional().default(0),
3293
+ limit: z.number().int().gte(1).lte(1000).optional().default(100)
3294
+ });
3295
+ /**
3296
+ * Success - Jobs retrieved
3297
+ */
3298
+ export const zListJobsResponse = zJobsListResponse;
3299
+ export const zGetJobDetailPath = z.object({
3300
+ job_id: z.string().uuid()
3301
+ });
3302
+ export const zGetJobDetailQuery = z.object({
3303
+ short_link: z.enum(['ephemeral_tool_chain', 'default']).optional()
3304
+ });
3305
+ /**
3306
+ * Success - Job details retrieved
3307
+ */
3308
+ export const zGetJobDetailResponse = zJobDetailResponse;
3309
+ export const zGetJobAssetsPath = z.object({
3310
+ job_id: z.string().uuid()
3311
+ });
3312
+ export const zGetJobAssetsQuery = z.object({
3313
+ limit: z.number().int().gte(1).lte(500).optional().default(20),
3314
+ offset: z.number().int().gte(0).optional().default(0)
3315
+ });
3316
+ /**
3317
+ * Success - Job assets returned
3318
+ */
3319
+ export const zGetJobAssetsResponse = zJobAssetsResponse;
3320
+ export const zCancelJobPath = z.object({
3321
+ job_id: z.string().uuid()
3322
+ });
3323
+ /**
3324
+ * Success - Cancel request accepted (or job was already terminal)
3325
+ */
3326
+ export const zCancelJobResponse = zJobCancelResponse;
3327
+ export const zCancelJobsBody = zJobsCancelRequest;
3328
+ /**
3329
+ * Success - cancel requests dispatched (or jobs were already terminal)
3330
+ */
3331
+ export const zCancelJobsResponse = zJobsCancelResponse;
3332
+ export const zGetLegacyModelsByFolderPath = z.object({
3333
+ folder: z.string()
3334
+ });
3335
+ /**
3336
+ * Success - Node replacement mappings
3337
+ */
3338
+ export const zGetNodeReplacementsResponse = z.record(z.unknown());
3339
+ /**
3340
+ * Success
3341
+ */
3342
+ export const zGetNodeInfoResponse = z.record(zNodeInfo);
3343
+ export const zGetLegacyObjectInfoByNodeClassPath = z.object({
3344
+ node_class: z.string()
3345
+ });
3346
+ /**
3347
+ * Success
3348
+ */
3349
+ export const zGetPromptInfoResponse = zPromptInfo;
3350
+ export const zExecutePromptBody = zPromptRequest;
3351
+ /**
3352
+ * Success - Prompt accepted
3353
+ */
3354
+ export const zExecutePromptResponse = zPromptResponse;
3355
+ export const zGetLegacyPromptByIdPath = z.object({
3356
+ prompt_id: z.string()
3357
+ });
3358
+ /**
3359
+ * The provider catalog
3360
+ */
3361
+ export const zGetProvidersResponse = zProviderCatalogResponse;
3362
+ /**
3363
+ * Success
3364
+ */
3365
+ export const zGetQueueInfoResponse = zQueueInfo;
3366
+ export const zManageQueueBody = zQueueManageRequest;
3367
+ /**
3368
+ * Success
3369
+ */
3370
+ export const zManageQueueResponse = zQueueManageResponse;
3371
+ /**
3372
+ * Success
3373
+ */
3374
+ export const zListSecretsResponse = zSecretListResponse;
3375
+ export const zCreateSecretBody = zCreateSecretRequest;
3376
+ /**
3377
+ * Secret created successfully
3378
+ */
3379
+ export const zCreateSecretResponse = zSecretResponse;
3380
+ export const zDeleteSecretPath = z.object({
3381
+ id: z.string().uuid()
3382
+ });
3383
+ /**
3384
+ * Secret deleted successfully
3385
+ */
3386
+ export const zDeleteSecretResponse = z.void();
3387
+ export const zGetSecretPath = z.object({
3388
+ id: z.string().uuid()
3389
+ });
3390
+ /**
3391
+ * Success
3392
+ */
3393
+ export const zGetSecretResponse = zSecretResponse;
3394
+ export const zUpdateSecretBody = zUpdateSecretRequest;
3395
+ export const zUpdateSecretPath = z.object({
3396
+ id: z.string().uuid()
3397
+ });
3398
+ /**
3399
+ * Secret updated successfully
3400
+ */
3401
+ export const zUpdateSecretResponse = zSecretResponse;
3402
+ /**
3403
+ * Success
3404
+ */
3405
+ export const zListSecretProvidersResponse = zSecretProvidersResponse;
3406
+ /**
3407
+ * User settings as key-value pairs
3408
+ */
3409
+ export const zGetAllSettingsResponse = z.record(z.unknown());
3410
+ /**
3411
+ * Settings to update as key-value pairs
3412
+ */
3413
+ export const zUpdateMultipleSettingsBody = z.record(z.unknown());
3414
+ /**
3415
+ * Updated user settings
3416
+ */
3417
+ export const zUpdateMultipleSettingsResponse = z.record(z.unknown());
3418
+ export const zGetSettingByIdPath = z.object({
3419
+ id: z.string()
3420
+ });
3421
+ /**
3422
+ * Setting value response
3423
+ */
3424
+ export const zGetSettingByIdResponse = z.object({
3425
+ value: z.unknown().optional()
3426
+ });
3427
+ /**
3428
+ * New value for the setting
3429
+ */
3430
+ export const zUpdateSettingByIdBody = z.unknown();
3431
+ export const zUpdateSettingByIdPath = z.object({
3432
+ id: z.string()
3433
+ });
3434
+ /**
3435
+ * Updated setting value response
3436
+ */
3437
+ export const zUpdateSettingByIdResponse = z.object({
3438
+ value: z.unknown().optional()
3439
+ });
3440
+ /**
3441
+ * Success
3442
+ */
3443
+ export const zGetSystemStatsResponse = zSystemStatsResponse;
3444
+ export const zListTagsQuery = z.object({
3445
+ prefix: z.string().optional(),
3446
+ limit: z.number().int().gte(1).lte(1000).optional().default(100),
3447
+ offset: z.number().int().gte(0).optional().default(0),
3448
+ order: z.enum(['count_desc', 'name_asc']).optional().default('count_desc'),
3449
+ include_zero: z.boolean().optional().default(false),
3450
+ include_public: z.boolean().optional().default(true)
3451
+ });
3452
+ /**
3453
+ * Tags retrieved successfully
3454
+ */
3455
+ export const zListTagsResponse2 = zListTagsResponse;
3456
+ export const zListTasksQuery = z.object({
3457
+ task_name: z.string().optional(),
3458
+ idempotency_key: z.string().optional(),
3459
+ status: z.string().optional(),
3460
+ created_after: z.string().datetime().optional(),
3461
+ created_before: z.string().datetime().optional(),
3462
+ sort_order: z.enum(['asc', 'desc']).optional().default('desc'),
3463
+ offset: z.number().int().gte(0).optional().default(0),
3464
+ limit: z.number().int().gte(1).lte(100).optional().default(20)
3465
+ });
3466
+ /**
3467
+ * Success - Tasks retrieved
3468
+ */
3469
+ export const zListTasksResponse = zTasksListResponse;
3470
+ export const zGetTaskPath = z.object({
3471
+ task_id: z.string().uuid()
3472
+ });
3473
+ /**
3474
+ * Success - Task details retrieved
3475
+ */
3476
+ export const zGetTaskResponse = zTaskResponse;
3477
+ export const zUploadImageBody = z.object({
3478
+ image: z.string(),
3479
+ overwrite: z.string().optional(),
3480
+ subfolder: z.string().optional(),
3481
+ type: z.string().optional()
3482
+ });
3483
+ /**
3484
+ * Image uploaded successfully
3485
+ */
3486
+ export const zUploadImageResponse = z.object({
3487
+ name: z.string().optional(),
3488
+ subfolder: z.string().optional(),
3489
+ type: z.string().optional()
3490
+ });
3491
+ export const zUploadMaskBody = z.object({
3492
+ image: z.string(),
3493
+ original_ref: z.string()
3494
+ });
3495
+ /**
3496
+ * Mask uploaded successfully
3497
+ */
3498
+ export const zUploadMaskResponse = z.object({
3499
+ name: z.string().optional(),
3500
+ subfolder: z.string().optional(),
3501
+ type: z.string().optional()
3502
+ });
3503
+ export const zUploadGrantPutBody = z.string();
3504
+ export const zUploadGrantPutPath = z.object({
3505
+ upload_id: z.string()
3506
+ });
3507
+ export const zUploadGrantPutResponse = z.union([
3508
+ zInputUploadResponse,
3509
+ zWorkflowResponse
3510
+ ]);
3511
+ /**
3512
+ * Success
3513
+ */
3514
+ export const zGetUserResponse = zUserResponse;
3515
+ export const zGetUserdataQuery = z.object({
3516
+ dir: z.string().optional(),
3517
+ recurse: z.boolean().optional().default(false),
3518
+ split: z.boolean().optional().default(false),
3519
+ full_info: z.boolean().optional().default(false)
3520
+ });
3521
+ /**
3522
+ * A list of user data files.
3523
+ */
3524
+ export const zGetUserdataResponse = zGetUserDataResponseFull;
3525
+ export const zDeleteUserdataFilePath = z.object({
3526
+ file: z.string()
3527
+ });
3528
+ /**
3529
+ * File deleted successfully (No Content).
3530
+ */
3531
+ export const zDeleteUserdataFileResponse = z.void();
3532
+ export const zGetUserdataFilePath = z.object({
3533
+ file: z.string()
3534
+ });
3535
+ /**
3536
+ * Successfully retrieved the file.
3537
+ */
3538
+ export const zGetUserdataFileResponse = z.string();
3539
+ export const zPostUserdataFileBody = z.string();
3540
+ export const zPostUserdataFilePath = z.object({
3541
+ file: z.string()
3542
+ });
3543
+ export const zPostUserdataFileQuery = z.object({
3544
+ overwrite: z.enum(['true', 'false']).optional().default('true'),
3545
+ full_info: z.enum(['true', 'false']).optional().default('false')
3546
+ });
3547
+ /**
3548
+ * File uploaded successfully.
3549
+ */
3550
+ export const zPostUserdataFileResponse = zUserDataResponseFull;
3551
+ export const zMoveUserdataFilePath = z.object({
3552
+ file: z.string(),
3553
+ dest: z.string()
3554
+ });
3555
+ export const zMoveUserdataFileQuery = z.object({
3556
+ overwrite: z.enum(['true', 'false']).optional().default('true')
3557
+ });
3558
+ /**
3559
+ * File moved successfully.
3560
+ */
3561
+ export const zMoveUserdataFileResponse = zUserDataResponseFull;
3562
+ export const zGetUserdataFilePublishPath = z.object({
3563
+ file: z.string()
3564
+ });
3565
+ /**
3566
+ * Publish info (publish_time is null if never published)
3567
+ */
3568
+ export const zGetUserdataFilePublishResponse = zWorkflowPublishInfo;
3569
+ export const zPostUserdataFilePublishBody = zPublishWorkflowAssetsRequest;
3570
+ export const zPostUserdataFilePublishPath = z.object({
3571
+ file: z.string()
3572
+ });
3573
+ /**
3574
+ * Workflow published
3575
+ */
3576
+ export const zPostUserdataFilePublishResponse = zWorkflowPublishInfo;
3577
+ /**
3578
+ * Userdata storage information
3579
+ */
3580
+ export const zGetUsersInfoResponse = z.object({
3581
+ migrated: z.boolean(),
3582
+ storage: z.string()
3583
+ });
3584
+ export const zGetVhsQueryVideoQuery = z.object({
3585
+ filename: z.string()
3586
+ });
3587
+ /**
3588
+ * Video metadata
3589
+ */
3590
+ export const zGetVhsQueryVideoResponse = z.object({
3591
+ source: z.object({
3592
+ duration: z.number(),
3593
+ fps: z.number(),
3594
+ frames: z.number().int(),
3595
+ size: z.tuple([z.number().int(), z.number().int()])
3596
+ })
3597
+ });
3598
+ export const zGetVhsViewAudioQuery = z.object({
3599
+ filename: z.string(),
3600
+ type: z.string().optional(),
3601
+ subfolder: z.string().optional()
3602
+ });
3603
+ export const zGetVhsViewVideoQuery = z.object({
3604
+ filename: z.string(),
3605
+ type: z.string().optional(),
3606
+ subfolder: z.string().optional()
3607
+ });
3608
+ export const zViewFileQuery = z.object({
3609
+ filename: z.string(),
3610
+ subfolder: z.string().optional(),
3611
+ type: z.string().optional(),
3612
+ fullpath: z.string().optional(),
3613
+ format: z.string().optional(),
3614
+ frame_rate: z.number().int().optional(),
3615
+ workflow: z.string().optional(),
3616
+ timestamp: z.number().int().optional(),
3617
+ channel: z.string().optional(),
3618
+ res: z.number().int().gte(64).lte(1024).optional()
3619
+ });
3620
+ /**
3621
+ * Resized JPEG thumbnail (returned when res parameter is used)
3622
+ */
3623
+ export const zViewFileResponse = z.string();
3624
+ export const zGetLegacyViewMetadataPath = z.object({
3625
+ folder_name: z.string()
3626
+ });
3627
+ export const zGetApiViewVideoAliasQuery = z.object({
3628
+ filename: z.string()
3629
+ });
3630
+ /**
3631
+ * Empty object for workflow templates
3632
+ */
3633
+ export const zGetWorkflowTemplatesResponse = z.record(z.unknown());
3634
+ export const zListWorkflowsQuery = z.object({
3635
+ limit: z.number().int().lte(100).optional().default(20),
3636
+ offset: z.number().int().optional().default(0),
3637
+ name: z.string().optional(),
3638
+ default_view: z.enum(['workflow', 'app']).optional(),
3639
+ sort: z
3640
+ .enum(['create_time', 'update_time', 'name'])
3641
+ .optional()
3642
+ .default('create_time'),
3643
+ order: z.enum(['asc', 'desc']).optional().default('desc')
3644
+ });
3645
+ /**
3646
+ * Success
3647
+ */
3648
+ export const zListWorkflowsResponse = zWorkflowListResponse;
3649
+ export const zCreateWorkflowBody = zCreateWorkflowRequest;
3650
+ /**
3651
+ * Workflow created successfully
3652
+ */
3653
+ export const zCreateWorkflowResponse = zWorkflowResponse;
3654
+ export const zDeleteWorkflowPath = z.object({
3655
+ workflow_id: z.string()
3656
+ });
3657
+ /**
3658
+ * Workflow deleted successfully
3659
+ */
3660
+ export const zDeleteWorkflowResponse = z.void();
3661
+ export const zGetWorkflowPath = z.object({
3662
+ workflow_id: z.string()
3663
+ });
3664
+ /**
3665
+ * Success
3666
+ */
3667
+ export const zGetWorkflowResponse = zWorkflowResponse;
3668
+ export const zUpdateWorkflowBody = zUpdateWorkflowRequest;
3669
+ export const zUpdateWorkflowPath = z.object({
3670
+ workflow_id: z.string()
3671
+ });
3672
+ /**
3673
+ * Success
3674
+ */
3675
+ export const zUpdateWorkflowResponse = zWorkflowResponse;
3676
+ export const zGetWorkflowContentPath = z.object({
3677
+ workflow_id: z.string()
3678
+ });
3679
+ /**
3680
+ * Success
3681
+ */
3682
+ export const zGetWorkflowContentResponse = zWorkflowVersionContentResponse;
3683
+ export const zForkWorkflowBody = zForkWorkflowRequest;
3684
+ export const zForkWorkflowPath = z.object({
3685
+ workflow_id: z.string()
3686
+ });
3687
+ /**
3688
+ * Workflow forked successfully
3689
+ */
3690
+ export const zForkWorkflowResponse = zWorkflowResponse;
3691
+ export const zCreateWorkflowVersionBody = zCreateWorkflowVersionRequest;
3692
+ export const zCreateWorkflowVersionPath = z.object({
3693
+ workflow_id: z.string()
3694
+ });
3695
+ /**
3696
+ * Version created successfully
3697
+ */
3698
+ export const zCreateWorkflowVersionResponse = zWorkflowVersionResponse;
3699
+ export const zGetPublishedWorkflowPath = z.object({
3700
+ share_id: z.string()
3701
+ });
3702
+ /**
3703
+ * Published workflow details with asset statuses
3704
+ */
3705
+ export const zGetPublishedWorkflowResponse = zPublishedWorkflowDetail;
3706
+ export const zCreateWorkflowUploadUrlBody = zWorkflowUploadUrlRequest;
3707
+ /**
3708
+ * Upload grant minted
3709
+ */
3710
+ export const zCreateWorkflowUploadUrlResponse = zUploadGrantResponse;
3711
+ export const zListWorkspaceApiKeysQuery = z.object({
3712
+ include_revoked: z.boolean().optional().default(false)
3713
+ });
3714
+ /**
3715
+ * List of API keys
3716
+ */
3717
+ export const zListWorkspaceApiKeysResponse2 = zListWorkspaceApiKeysResponse;
3718
+ export const zCreateWorkspaceApiKeyBody = zCreateWorkspaceApiKeyRequest;
3719
+ /**
3720
+ * API key created (plaintext returned once)
3721
+ */
3722
+ export const zCreateWorkspaceApiKeyResponse2 = zCreateWorkspaceApiKeyResponse;
3723
+ export const zRevokeWorkspaceApiKeyPath = z.object({
3724
+ id: z.string().uuid()
3725
+ });
3726
+ /**
3727
+ * API key revoked
3728
+ */
3729
+ export const zRevokeWorkspaceApiKeyResponse = z.void();
3730
+ /**
3731
+ * List of pending invites
3732
+ */
3733
+ export const zListWorkspaceInvitesResponse = zListInvitesResponse;
3734
+ export const zCreateWorkspaceInviteBody = zCreateInviteRequest;
3735
+ /**
3736
+ * Invite created
3737
+ */
3738
+ export const zCreateWorkspaceInviteResponse = zPendingInvite;
3739
+ export const zRevokeWorkspaceInvitePath = z.object({
3740
+ inviteId: z.string()
3741
+ });
3742
+ /**
3743
+ * Invite revoked
3744
+ */
3745
+ export const zRevokeWorkspaceInviteResponse = z.void();
3746
+ export const zResendWorkspaceInvitePath = z.object({
3747
+ inviteId: z.string()
3748
+ });
3749
+ /**
3750
+ * Invite refreshed and queued for delivery
3751
+ */
3752
+ export const zResendWorkspaceInviteResponse = zPendingInvite;
3753
+ /**
3754
+ * Successfully left workspace
3755
+ */
3756
+ export const zLeaveWorkspaceResponse = z.void();
3757
+ export const zListWorkspaceMembersQuery = z.object({
3758
+ offset: z.number().int().gte(0).optional().default(0),
3759
+ limit: z.number().int().gte(1).lte(100).optional().default(20)
3760
+ });
3761
+ /**
3762
+ * List of members
3763
+ */
3764
+ export const zListWorkspaceMembersResponse = zListMembersResponse;
3765
+ export const zBulkRevokeWorkspaceMemberApiKeysPath = z.object({
3766
+ user_id: z.string().min(1)
3767
+ });
3768
+ /**
3769
+ * Keys revoked successfully
3770
+ */
3771
+ export const zBulkRevokeWorkspaceMemberApiKeysResponse = zBulkRevokeApiKeysResponse;
3772
+ export const zRemoveWorkspaceMemberPath = z.object({
3773
+ userId: z.string()
3774
+ });
3775
+ /**
3776
+ * Member removed
3777
+ */
3778
+ export const zRemoveWorkspaceMemberResponse = z.void();
3779
+ export const zUpdateWorkspaceMemberRoleBody = zUpdateMemberRoleRequest;
3780
+ export const zUpdateWorkspaceMemberRolePath = z.object({
3781
+ userId: z.string()
3782
+ });
3783
+ /**
3784
+ * Member role updated
3785
+ */
3786
+ export const zUpdateWorkspaceMemberRoleResponse = zMember;
3787
+ /**
3788
+ * The policy document
3789
+ */
3790
+ export const zGetProviderPolicyResponse = zProviderPolicy;
3791
+ export const zPutProviderPolicyBody = zProviderPolicy;
3792
+ /**
3793
+ * Policy replaced
3794
+ */
3795
+ export const zPutProviderPolicyResponse = zProviderPolicy;
3796
+ /**
3797
+ * List of workspaces
3798
+ */
3799
+ export const zListWorkspacesResponse2 = zListWorkspacesResponse;
3800
+ export const zCreateWorkspaceBody = zCreateWorkspaceRequest;
3801
+ /**
3802
+ * Workspace created
3803
+ */
3804
+ export const zCreateWorkspaceResponse = zWorkspace;
3805
+ export const zDeleteWorkspacePath = z.object({
3806
+ id: z.string()
3807
+ });
3808
+ /**
3809
+ * Workspace deleted
3810
+ */
3811
+ export const zDeleteWorkspaceResponse = z.void();
3812
+ export const zGetWorkspacePath = z.object({
3813
+ id: z.string()
3814
+ });
3815
+ /**
3816
+ * Workspace details
3817
+ */
3818
+ export const zGetWorkspaceResponse = zWorkspace;
3819
+ export const zUpdateWorkspaceBody = zUpdateWorkspaceRequest;
3820
+ export const zUpdateWorkspacePath = z.object({
3821
+ id: z.string()
3822
+ });
3823
+ /**
3824
+ * Workspace updated
3825
+ */
3826
+ export const zUpdateWorkspaceResponse = zWorkspace;
3827
+ /**
3828
+ * The credential's workspace
3829
+ */
3830
+ export const zGetCurrentWorkspaceResponse = zCurrentWorkspaceResponse;
3831
+ export const zGetStaticExtensionsPath = z.object({
3832
+ path: z.string()
3833
+ });
3834
+ export const zRedirectExtensionScriptsPath = z.object({
3835
+ file: z.string()
3836
+ });
3837
+ /**
3838
+ * Service is healthy
3839
+ */
3840
+ export const zGetHealthResponse = z.string();
3841
+ /**
3842
+ * Map of folder type name to list of path entries
3843
+ */
3844
+ export const zGetInternalFolderPathsResponse = z.record(z.array(z.array(z.string())));
3845
+ /**
3846
+ * Log text
3847
+ */
3848
+ export const zGetInternalLogsResponse = z.string();
3849
+ /**
3850
+ * Structured log data
3851
+ */
3852
+ export const zGetInternalLogsRawResponse = z.object({
3853
+ entries: z
3854
+ .array(z.object({
3855
+ m: z.string().optional(),
3856
+ t: z.number().optional()
3857
+ }))
3858
+ .optional(),
3859
+ size: z
3860
+ .object({
3861
+ cols: z.number().int().optional(),
3862
+ rows: z.number().int().optional()
3863
+ })
3864
+ .optional()
3865
+ });
3866
+ export const zSubscribeToLogsBody = z.object({
3867
+ clientId: z.string(),
3868
+ enabled: z.boolean()
3869
+ });
3870
+ export const zGetStaticKjwebAsyncPath = z.object({
3871
+ path: z.string()
3872
+ });
3873
+ export const zGetOAuthAuthorizeQuery = z.object({
3874
+ response_type: z.string().optional(),
3875
+ client_id: z.string().optional(),
3876
+ redirect_uri: z.string().optional(),
3877
+ scope: z.string().optional(),
3878
+ state: z.string().optional(),
3879
+ code_challenge: z.string().optional(),
3880
+ code_challenge_method: z.string().optional(),
3881
+ resource: z.string().optional(),
3882
+ oauth_request_id: z.string().optional()
3883
+ });
3884
+ /**
3885
+ * Consent challenge payload (cookie present, email verified). Frontend renders the consent UI from this payload and POSTs back to /oauth/authorize.
3886
+ *
3887
+ */
3888
+ export const zGetOAuthAuthorizeResponse = zOAuthConsentChallenge;
3889
+ export const zPostOAuthAuthorizeBody = z.object({
3890
+ csrf_token: z.string(),
3891
+ decision: z.enum(['allow', 'deny']),
3892
+ oauth_request_id: z.string().uuid(),
3893
+ workspace_id: z.string()
3894
+ });
3895
+ /**
3896
+ * Redirect URL for the frontend to navigate to (allow → with code+state; deny → with error+state)
3897
+ */
3898
+ export const zPostOAuthAuthorizeResponse = zOAuthAuthorizeRedirectResponse;
3899
+ export const zPostOAuthRegisterBody = zOAuthRegisterRequest;
3900
+ /**
3901
+ * Registered. Body echoes the metadata RFC 7591 §3.2.1 requires.
3902
+ */
3903
+ export const zPostOAuthRegisterResponse = zOAuthRegisterResponse;
3904
+ export const zPostOAuthTokenBody = z.object({
3905
+ client_id: z.string(),
3906
+ client_secret: z.string().optional(),
3907
+ code: z.string().optional(),
3908
+ code_verifier: z.string().optional(),
3909
+ grant_type: z.enum(['authorization_code', 'refresh_token']),
3910
+ redirect_uri: z.string().optional(),
3911
+ refresh_token: z.string().optional(),
3912
+ scope: z.string().optional()
3913
+ });
3914
+ /**
3915
+ * New token pair
3916
+ */
3917
+ export const zPostOAuthTokenResponse = zOAuthTokenResponse;
3918
+ export const zGetTemplateProxyPath = z.object({
3919
+ path: z.string()
3920
+ });
3921
+ export const zGetViewCompatAliasQuery = z.object({
3922
+ filename: z.string()
3923
+ });
3924
+ export const zGetWebsocketQuery = z.object({
3925
+ clientId: z.string().optional()
3926
+ });