@comfyorg/ingest-types 1.0.0 → 1.2.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.
package/dist/zod.gen.js CHANGED
@@ -167,6 +167,26 @@ export const zWorkflowApiAssetsResponse = z.object({
167
167
  export const zWorkflowApiAssetsRequest = z.object({
168
168
  workflow_api_json: z.record(z.unknown())
169
169
  });
170
+ /**
171
+ * The user a web session belongs to
172
+ */
173
+ export const zWebSessionUser = z.object({
174
+ email: z.string(),
175
+ email_verified: z.boolean(),
176
+ id: z.string(),
177
+ name: z.string().optional(),
178
+ sign_in_provider: z.string().optional()
179
+ });
180
+ /**
181
+ * The live web session and the user it belongs to
182
+ */
183
+ export const zWebSessionResponse = z.object({
184
+ absolute_expires_at: z.string().datetime(),
185
+ csrf_token: z.string(),
186
+ expires_at: z.string().datetime(),
187
+ has_personal_workspace: z.boolean(),
188
+ user: zWebSessionUser
189
+ });
170
190
  /**
171
191
  * Details of a single validation error encountered during asset operations.
172
192
  */
@@ -206,16 +226,40 @@ export const zUserDataResponseFull = z.object({
206
226
  path: z.string().optional(),
207
227
  size: z.number().int().optional()
208
228
  });
229
+ /**
230
+ * Current remaining balance, mirroring /billing/balance. Every amount is CENTS of `currency`; the `*_micros` names are a misnomer kept for wire compatibility.
231
+ */
209
232
  export const zUsageBalance = z.object({
233
+ amount_cents: z.number().optional(),
210
234
  amount_micros: z.number().optional(),
235
+ cloud_credit_balance_cents: z.number().optional(),
211
236
  cloud_credit_balance_micros: z.number().optional(),
212
237
  currency: z.string().optional(),
238
+ prepaid_balance_cents: z.number().optional(),
213
239
  prepaid_balance_micros: z.number().optional()
214
240
  });
241
+ /**
242
+ * Mixed units, deliberately. `spend_micros` here (and `cost_micros` on UsageBucket / UsageBreakdownRow) is genuinely MICROS -- 1/1,000,000 of the currency unit -- because it comes from Metronome's usage figures. The `balance` breakdown below is CENTS, and its `*_micros` names are a misnomer; use its `*_cents` fields.
243
+ */
215
244
  export const zUsageSummary = z.object({
216
245
  balance: zUsageBalance.optional(),
217
246
  spend_micros: z.number()
218
247
  });
248
+ /**
249
+ * Present, with empty groups, buckets and breakdown, when the requested grouping is not served for this workspace. Render as unavailable, not as zero spend.
250
+ */
251
+ export const zUsageNotAvailable = z.object({
252
+ reason: z.enum(['no_attribution_source'])
253
+ });
254
+ export const zUsageGroupLabel = z.object({
255
+ display_name: z.string().optional(),
256
+ key: z.string(),
257
+ key_name: z.string().optional(),
258
+ key_prefix: z.string().optional(),
259
+ kind: z.enum(['api_key', 'session', 'deployment']).optional(),
260
+ owner_display_name: z.string().optional(),
261
+ owner_user_id: z.string().optional()
262
+ });
219
263
  export const zUsageBucket = z.object({
220
264
  cost_micros: z.number(),
221
265
  group_key: z.string(),
@@ -232,8 +276,17 @@ export const zUsageTimeSeries = z.object({
232
276
  buckets: z.array(zUsageBucket),
233
277
  ending_before: z.string().datetime(),
234
278
  granularity: z.enum(['hour', 'day', 'month']),
235
- group_by: z.enum(['model', 'endpoint', 'product']),
279
+ group_by: z.enum([
280
+ 'model',
281
+ 'endpoint',
282
+ 'product',
283
+ 'product_line',
284
+ 'person',
285
+ 'source'
286
+ ]),
287
+ group_labels: z.array(zUsageGroupLabel).optional(),
236
288
  groups: z.array(z.string()),
289
+ not_available: zUsageNotAvailable.optional(),
237
290
  starting_on: z.string().datetime(),
238
291
  summary: zUsageSummary
239
292
  });
@@ -280,6 +333,42 @@ export const zUpdateHubProfileRequest = z.object({
280
333
  display_name: z.string().optional(),
281
334
  website_urls: z.array(z.string()).optional()
282
335
  });
336
+ /**
337
+ * What a credit top-up of the requested amount would grant.
338
+ */
339
+ export const zTopupQuoteResponse = z.object({
340
+ amount_cents: 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
+ credits: z.coerce
349
+ .bigint()
350
+ .min(BigInt('-9223372036854775808'), {
351
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
352
+ })
353
+ .max(BigInt('9223372036854775807'), {
354
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
355
+ }),
356
+ expires_at: z.string().datetime()
357
+ });
358
+ /**
359
+ * One persisted tool call attached to an assistant message's content.tool_calls (services/agent/internal/persist.ToolCallSummary), so a chat reload can render the tool-call history a turn produced. Display data only — raw arguments/results are never projected here. Only terminal rows (status ok/error) are ever surfaced; a row a dead turn left in pending/running has no wire-status mapping and is dropped rather than shown as a perpetual-progress chip.
360
+ */
361
+ export const zToolCallSummary = z.object({
362
+ duration_ms: z.number().int().optional(),
363
+ error_code: z.string().optional(),
364
+ finished_at: z.string().datetime().optional(),
365
+ id: z.string(),
366
+ job_id: z.string().optional(),
367
+ started_at: z.string().datetime().optional(),
368
+ status: z.enum(['success', 'error']),
369
+ tool_call_id: z.string(),
370
+ tool_name: z.string()
371
+ });
283
372
  /**
284
373
  * Pre/post-discount price for a team credit stop, in cents.
285
374
  */
@@ -363,7 +452,7 @@ export const zTaskEntry = z.object({
363
452
  create_time: z.string().datetime(),
364
453
  id: z.string().uuid(),
365
454
  started_at: z.string().datetime().optional(),
366
- status: z.enum(['created', 'running', 'completed', 'failed']),
455
+ status: z.enum(['created', 'running', 'completed', 'failed', 'cancelled']),
367
456
  task_name: z.string()
368
457
  });
369
458
  /**
@@ -385,7 +474,7 @@ export const zTaskResponse = z.object({
385
474
  payload: z.record(z.unknown()),
386
475
  result: z.record(z.unknown()).optional(),
387
476
  started_at: z.string().datetime().optional(),
388
- status: z.enum(['created', 'running', 'completed', 'failed']),
477
+ status: z.enum(['created', 'running', 'completed', 'failed', 'cancelled']),
389
478
  task_name: z.string(),
390
479
  update_time: z.string().datetime()
391
480
  });
@@ -446,8 +535,21 @@ export const zSubscriptionDiscount = z.object({
446
535
  })
447
536
  .optional(),
448
537
  code: z.string(),
538
+ duration: z.enum(['once', 'repeating', 'forever']).optional(),
539
+ duration_in_months: z.coerce
540
+ .bigint()
541
+ .min(BigInt('-9223372036854775808'), {
542
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
543
+ })
544
+ .max(BigInt('9223372036854775807'), {
545
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
546
+ })
547
+ .optional(),
449
548
  kind: z.enum(['plan', 'promotion']),
450
- name: z.string().optional()
549
+ name: z.string().optional(),
550
+ term: z
551
+ .enum(['this_payment', 'first_month', 'first_year', 'months', 'ongoing'])
552
+ .optional()
451
553
  });
452
554
  /**
453
555
  * Response after successfully subscribing to a billing plan.
@@ -531,6 +633,14 @@ export const zDocOpsResultFrame = z.object({
531
633
  });
532
634
  export const zDocResetData = z.object({
533
635
  actor: z.string().max(256).optional(),
636
+ lineage_seq: z.coerce
637
+ .bigint()
638
+ .min(BigInt('-9223372036854775808'), {
639
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
640
+ })
641
+ .max(BigInt('9223372036854775807'), {
642
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
643
+ }),
534
644
  seq: z.coerce
535
645
  .bigint()
536
646
  .min(BigInt('-9223372036854775808'), {
@@ -551,6 +661,15 @@ export const zDocResetFrame = z.object({
551
661
  });
552
662
  export const zDocUpdateData = z.object({
553
663
  actor: z.string().max(256).optional(),
664
+ lineage_seq: z.coerce
665
+ .bigint()
666
+ .min(BigInt('-9223372036854775808'), {
667
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
668
+ })
669
+ .max(BigInt('9223372036854775807'), {
670
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
671
+ }),
672
+ op_ids: z.array(z.string().min(1).max(128)).max(256).optional(),
554
673
  seq: z.coerce
555
674
  .bigint()
556
675
  .min(BigInt('-9223372036854775808'), {
@@ -636,6 +755,62 @@ export const zSavedPaymentMethod = z.object({
636
755
  .optional(),
637
756
  type: z.string()
638
757
  });
758
+ export const zSsoDiscoverResponse = z.object({
759
+ organization_name: z.string().optional(),
760
+ required: z.boolean().optional(),
761
+ sso: z.boolean()
762
+ });
763
+ /**
764
+ * Response after signing out of all devices
765
+ */
766
+ export const zRevokeAllSessionsResponse = z.object({
767
+ revoked: z.number().int()
768
+ });
769
+ /**
770
+ * Response after accepting a scheduled-change revert.
771
+ */
772
+ export const zRevertScheduledChangeResponse = z.object({
773
+ billing_op_id: z.string(),
774
+ status: z.enum(['reverted', 'pending'])
775
+ });
776
+ /**
777
+ * Request body for undoing a pending scheduled plan change.
778
+ */
779
+ export const zRevertScheduledChangeRequest = z.object({
780
+ idempotency_key: z.string().optional()
781
+ });
782
+ /**
783
+ * Present only when the session's arm is an offer. Terms come from the server catalog.
784
+ */
785
+ export const zRetentionOffer = z.object({
786
+ duration_in_months: z.number().int().lte(9007199254740991),
787
+ id: z.string(),
788
+ percent_off: z.number().int().lte(9007199254740991)
789
+ });
790
+ export const zRetentionFlowSubscription = z.object({
791
+ currency: z.string(),
792
+ period_end: z.number().int().lte(9007199254740991),
793
+ quantity: z.number().int().lte(9007199254740991),
794
+ unit_amount: z.number().int().lte(9007199254740991)
795
+ });
796
+ export const zRetentionFlowResponse = z.object({
797
+ experiment_variant: z.string().optional(),
798
+ expires_at: z.number().int().lte(9007199254740991),
799
+ offer: zRetentionOffer.optional(),
800
+ session_id: z.string().uuid(),
801
+ subscription: zRetentionFlowSubscription
802
+ });
803
+ export const zRetentionFlowEventRequest = z.object({
804
+ event: z.enum(['flow_opened', 'offer_shown']),
805
+ session_id: z.string().uuid()
806
+ });
807
+ export const zRetentionAcceptance = z.object({
808
+ billing_op_id: z.string(),
809
+ status: z.enum(['pending', 'succeeded'])
810
+ });
811
+ export const zRetentionAcceptRequest = z.object({
812
+ session_id: z.string().uuid()
813
+ });
639
814
  /**
640
815
  * Response after accepting a resubscribe request.
641
816
  */
@@ -650,6 +825,22 @@ export const zResubscribeResponse = z.object({
650
825
  export const zResubscribeRequest = z.object({
651
826
  idempotency_key: z.string().optional()
652
827
  });
828
+ /**
829
+ * The newest open renewal invoice of the workspace's Stripe subscription (active, or canceled but not yet ended). Returned only to workspace owners on the stripe billing rail while billing_status is payment_failed or paused, or on the legacy_stripe billing rail while billing_status is payment_failed and its legacy subscription is past_due or unpaid, and not while a payment for it is processing. hosted_invoice_url is a bearer payment link.
830
+ */
831
+ export const zRenewalInvoice = z.object({
832
+ amount_due: z.coerce
833
+ .bigint()
834
+ .min(BigInt('-9223372036854775808'), {
835
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
836
+ })
837
+ .max(BigInt('9223372036854775807'), {
838
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
839
+ }),
840
+ currency: z.string(),
841
+ hosted_invoice_url: z.string(),
842
+ next_payment_attempt: z.string().datetime().optional()
843
+ });
653
844
  /**
654
845
  * Response after a queue management action (delete or clear).
655
846
  */
@@ -809,6 +1000,33 @@ export const zPreviewPlanInfo = z.object({
809
1000
  message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
810
1001
  }),
811
1002
  duration: zSubscriptionDuration,
1003
+ list_price_cents: z.coerce
1004
+ .bigint()
1005
+ .min(BigInt('-9223372036854775808'), {
1006
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1007
+ })
1008
+ .max(BigInt('9223372036854775807'), {
1009
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1010
+ })
1011
+ .optional(),
1012
+ monthly_list_price_cents: z.coerce
1013
+ .bigint()
1014
+ .min(BigInt('-9223372036854775808'), {
1015
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1016
+ })
1017
+ .max(BigInt('9223372036854775807'), {
1018
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1019
+ })
1020
+ .optional(),
1021
+ monthly_price_cents: z.coerce
1022
+ .bigint()
1023
+ .min(BigInt('-9223372036854775808'), {
1024
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1025
+ })
1026
+ .max(BigInt('9223372036854775807'), {
1027
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1028
+ })
1029
+ .optional(),
812
1030
  period_end: z.string().datetime().optional(),
813
1031
  period_start: z.string().datetime().optional(),
814
1032
  price_cents: z.coerce
@@ -837,6 +1055,15 @@ export const zPreviewSubscribeResponse = z.object({
837
1055
  message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
838
1056
  })
839
1057
  .optional(),
1058
+ balance_applied_cents: z.coerce
1059
+ .bigint()
1060
+ .min(BigInt('-9223372036854775808'), {
1061
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1062
+ })
1063
+ .max(BigInt('9223372036854775807'), {
1064
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1065
+ })
1066
+ .optional(),
840
1067
  cost_next_period_cents: z.coerce
841
1068
  .bigint()
842
1069
  .min(BigInt('-9223372036854775808'), {
@@ -853,6 +1080,15 @@ export const zPreviewSubscribeResponse = z.object({
853
1080
  .max(BigInt('9223372036854775807'), {
854
1081
  message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
855
1082
  }),
1083
+ credits_next_period: z.coerce
1084
+ .bigint()
1085
+ .min(BigInt('-9223372036854775808'), {
1086
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1087
+ })
1088
+ .max(BigInt('9223372036854775807'), {
1089
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1090
+ })
1091
+ .optional(),
856
1092
  credits_next_period_cents: z.coerce
857
1093
  .bigint()
858
1094
  .min(BigInt('-9223372036854775808'), {
@@ -861,6 +1097,15 @@ export const zPreviewSubscribeResponse = z.object({
861
1097
  .max(BigInt('9223372036854775807'), {
862
1098
  message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
863
1099
  }),
1100
+ credits_today: z.coerce
1101
+ .bigint()
1102
+ .min(BigInt('-9223372036854775808'), {
1103
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1104
+ })
1105
+ .max(BigInt('9223372036854775807'), {
1106
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1107
+ })
1108
+ .optional(),
864
1109
  credits_today_cents: z.coerce
865
1110
  .bigint()
866
1111
  .min(BigInt('-9223372036854775808'), {
@@ -878,6 +1123,24 @@ export const zPreviewSubscribeResponse = z.object({
878
1123
  payment_method_configuration_id: z.string().optional(),
879
1124
  promotion_code: z.string().optional(),
880
1125
  proration_at: z.string().datetime().optional(),
1126
+ proration_remaining_cents: z.coerce
1127
+ .bigint()
1128
+ .min(BigInt('-9223372036854775808'), {
1129
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1130
+ })
1131
+ .max(BigInt('9223372036854775807'), {
1132
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1133
+ })
1134
+ .optional(),
1135
+ proration_unused_cents: z.coerce
1136
+ .bigint()
1137
+ .min(BigInt('-9223372036854775808'), {
1138
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1139
+ })
1140
+ .max(BigInt('9223372036854775807'), {
1141
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1142
+ })
1143
+ .optional(),
881
1144
  quote_id: z.string().optional(),
882
1145
  quote_version: z.number().int().optional(),
883
1146
  reason: z.string().optional(),
@@ -892,6 +1155,15 @@ export const zPreviewSubscribeResponse = z.object({
892
1155
  .optional(),
893
1156
  renewal_at: z.string().datetime().optional(),
894
1157
  requires_reactivation_confirmation: z.boolean().optional(),
1158
+ subtotal_cents: z.coerce
1159
+ .bigint()
1160
+ .min(BigInt('-9223372036854775808'), {
1161
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1162
+ })
1163
+ .max(BigInt('9223372036854775807'), {
1164
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1165
+ })
1166
+ .optional(),
895
1167
  transition_type: z.enum([
896
1168
  'new_subscription',
897
1169
  'upgrade',
@@ -930,6 +1202,15 @@ export const zPlanAvailability = z.object({
930
1202
  */
931
1203
  export const zPlan = z.object({
932
1204
  availability: zPlanAvailability,
1205
+ credits: z.coerce
1206
+ .bigint()
1207
+ .min(BigInt('-9223372036854775808'), {
1208
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
1209
+ })
1210
+ .max(BigInt('9223372036854775807'), {
1211
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
1212
+ })
1213
+ .optional(),
933
1214
  credits_cents: z.coerce
934
1215
  .bigint()
935
1216
  .min(BigInt('-9223372036854775808'), {
@@ -1056,7 +1337,8 @@ export const zOAuthRegisterError = z.object({
1056
1337
  export const zErrorResponse = z.object({
1057
1338
  code: z.string(),
1058
1339
  details: z.record(z.unknown()).optional(),
1059
- message: z.string()
1340
+ message: z.string(),
1341
+ organization_id: z.string().optional()
1060
1342
  });
1061
1343
  /**
1062
1344
  * 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).
@@ -1091,6 +1373,7 @@ export const zOAuthConsentChallengeWorkspace = z.object({
1091
1373
  */
1092
1374
  export const zOAuthConsentChallenge = z.object({
1093
1375
  client_display_name: z.string(),
1376
+ client_provenance: z.enum(['first_party', 'dynamic']),
1094
1377
  csrf_token: z.string(),
1095
1378
  oauth_request_id: z.string().uuid(),
1096
1379
  redirect_uri: z.string().url(),
@@ -1157,17 +1440,29 @@ export const zModelFile = z.object({
1157
1440
  * Workspace member with profile and role information.
1158
1441
  */
1159
1442
  export const zMember = z.object({
1160
- email: z.string().email(),
1443
+ email: z.string(),
1161
1444
  id: z.string(),
1162
1445
  is_original_owner: z.boolean(),
1163
1446
  joined_at: z.string().datetime(),
1447
+ managed_by_directory: z.boolean().optional(),
1164
1448
  name: z.string(),
1165
1449
  role: z.enum(['owner', 'member'])
1166
1450
  });
1451
+ /**
1452
+ * 400 for a missing `filename` or a `res` that is not a number, on the media routes served outside the generated wrapper.
1453
+ */
1454
+ export const zMediaQueryError = z.object({
1455
+ error: z.string()
1456
+ });
1457
+ /**
1458
+ * A 400 from a media route served outside the generated wrapper: ErrorResponse, or MediaQueryError for a bad query parameter.
1459
+ */
1460
+ export const zMediaBadRequestError = z.union([zErrorResponse, zMediaQueryError]);
1167
1461
  /**
1168
1462
  * Paginated list of workspaces the authenticated user belongs to.
1169
1463
  */
1170
1464
  export const zListWorkspacesResponse = z.object({
1465
+ can_create_workspace: z.boolean(),
1171
1466
  workspaces: z.array(zWorkspaceWithRole)
1172
1467
  });
1173
1468
  /**
@@ -1428,6 +1723,8 @@ export const zJobDetailResponse = z.object({
1428
1723
  outputs_count: z.number().int().optional(),
1429
1724
  preview_output: z.record(z.unknown()).optional(),
1430
1725
  previewable_outputs_count: z.number().int().optional(),
1726
+ queue_position: z.number().int().gte(1).nullish(),
1727
+ queue_reason: z.enum(['concurrency_limit', 'capacity']).optional(),
1431
1728
  status: z.enum([
1432
1729
  'pending',
1433
1730
  'in_progress',
@@ -1732,7 +2029,7 @@ export const zHistoryManageRequest = z.object({
1732
2029
  delete: z.array(z.string()).optional()
1733
2030
  });
1734
2031
  /**
1735
- * History entry with full prompt data
2032
+ * History entry with full prompt data. The workflow graph (extra_data.extra_pnginfo) is omitted from records persisted after it stopped being stored; older records may still contain it.
1736
2033
  */
1737
2034
  export const zHistoryDetailEntry = z.object({
1738
2035
  meta: z.record(z.unknown()).optional(),
@@ -1823,6 +2120,23 @@ export const zForkWorkflowRequest = z.object({
1823
2120
  name: z.string().optional(),
1824
2121
  source_version: z.number().int()
1825
2122
  });
2123
+ /**
2124
+ * 403 for a credential the route does not take. `accepted` names the ones it does, as `WWW-Authenticate` does.
2125
+ */
2126
+ export const zAuthTypeNotAllowedError = z.object({
2127
+ accepted: z.array(z.string()),
2128
+ error: z.object({
2129
+ message: z.string(),
2130
+ type: z.enum(['auth_type_not_allowed'])
2131
+ })
2132
+ });
2133
+ /**
2134
+ * A 403 body: ErrorResponse, or AuthTypeNotAllowedError for a credential the route does not take.
2135
+ */
2136
+ export const zForbiddenError = z.union([
2137
+ zErrorResponse,
2138
+ zAuthTypeNotAllowedError
2139
+ ]);
1826
2140
  /**
1827
2141
  * Response after submitting feedback
1828
2142
  */
@@ -1923,6 +2237,7 @@ export const zCurrentWorkspaceResponse = z.object({
1923
2237
  auth_method: z.string(),
1924
2238
  id: z.string(),
1925
2239
  name: z.string(),
2240
+ permissions: z.array(z.string()).optional(),
1926
2241
  role: z.enum(['owner', 'member']).optional(),
1927
2242
  type: z.enum(['personal', 'team'])
1928
2243
  });
@@ -1999,6 +2314,19 @@ export const zCreateTopupRequest = z.object({
1999
2314
  checkout_attempt_id: z.string().optional(),
2000
2315
  idempotency_key: z.string().optional()
2001
2316
  });
2317
+ /**
2318
+ * Request body for previewing a credit top-up.
2319
+ */
2320
+ export const zCreateTopupQuoteRequest = z.object({
2321
+ amount_cents: z.coerce
2322
+ .bigint()
2323
+ .min(BigInt('-9223372036854775808'), {
2324
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2325
+ })
2326
+ .max(BigInt('9223372036854775807'), {
2327
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
2328
+ })
2329
+ });
2002
2330
  /**
2003
2331
  * A hosted Stripe Checkout session for a credit top-up.
2004
2332
  */
@@ -2010,7 +2338,7 @@ export const zCreateTopupCheckoutResponse = z.object({
2010
2338
  * Request body for creating a hosted credit top-up checkout session.
2011
2339
  */
2012
2340
  export const zCreateTopupCheckoutRequest = z.object({
2013
- amount_cents: z.coerce.bigint().gte(BigInt(500)).lte(BigInt(473900)),
2341
+ amount_cents: z.coerce.bigint().gte(BigInt(500)).lte(BigInt(1600000)),
2014
2342
  idempotency_key: z.string().optional(),
2015
2343
  return_url: z.string().url()
2016
2344
  });
@@ -2060,7 +2388,8 @@ export const zCreateHubProfileRequest = z.object({
2060
2388
  export const zChurnkeyAuthResponse = z.object({
2061
2389
  auth_hash: z.string(),
2062
2390
  customer_id: z.string(),
2063
- mode: z.enum(['live', 'test', 'sandbox'])
2391
+ mode: z.enum(['live', 'test', 'sandbox']),
2392
+ offer_subscription_id: z.string().min(1).optional()
2064
2393
  });
2065
2394
  /**
2066
2395
  * Response after successfully cancelling a subscription.
@@ -2126,7 +2455,10 @@ export const zBillingStatusResponse = z.object({
2126
2455
  pending_billing_op_type: z.enum(['subscription', 'topup']).optional(),
2127
2456
  plan_slug: z.string().optional(),
2128
2457
  renewal_date: z.string().datetime().optional(),
2458
+ renewal_invoice: zRenewalInvoice.optional(),
2129
2459
  scheduled_change: zScheduledPlanChange.nullable(),
2460
+ scoped_effective_has_funds: z.record(z.boolean()).optional(),
2461
+ scoped_has_funds: z.record(z.boolean()).optional(),
2130
2462
  subscription_duration: zSubscriptionDuration.optional(),
2131
2463
  subscription_status: z.enum(['active', 'ended', 'canceled']).optional(),
2132
2464
  subscription_tier: zSubscriptionTier.optional(),
@@ -2140,11 +2472,101 @@ export const zBillingPlansResponse = z.object({
2140
2472
  plans: z.array(zPlan),
2141
2473
  team_credit_stops: zTeamCreditStops.optional()
2142
2474
  });
2475
+ /**
2476
+ * Display only. The plan the operation targets; for a scheduled change,
2477
+ * the plan it switches to at period end. Present for plan changes,
2478
+ * initial subscriptions and resubscribes in every status (pending,
2479
+ * failed and succeeded alike), so a recovered pending operation can be
2480
+ * labelled with its own plan. Absent when the target plan could not be
2481
+ * resolved. Visible to any workspace member who can read the operation.
2482
+ * tier and the price fields are absent when the server cannot describe
2483
+ * the plan, as for the retired seat-based Team plans, whose rows carry a
2484
+ * personal tier and whose price depends on the workspace's seats.
2485
+ *
2486
+ */
2487
+ export const zBillingOpReceiptPlan = z.object({
2488
+ currency: z.string().optional(),
2489
+ duration: zSubscriptionDuration,
2490
+ monthly_price_cents: z.coerce
2491
+ .bigint()
2492
+ .min(BigInt('-9223372036854775808'), {
2493
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2494
+ })
2495
+ .max(BigInt('9223372036854775807'), {
2496
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
2497
+ })
2498
+ .optional(),
2499
+ price_cents: z.coerce
2500
+ .bigint()
2501
+ .min(BigInt('-9223372036854775808'), {
2502
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2503
+ })
2504
+ .max(BigInt('9223372036854775807'), {
2505
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
2506
+ })
2507
+ .optional(),
2508
+ slug: z.string(),
2509
+ team_credit_stop_id: z.string().optional(),
2510
+ tier: zSubscriptionTier.optional()
2511
+ });
2512
+ /**
2513
+ * One deduction from today's charge. discount is the promotion in the
2514
+ * quote's discount shape (kind promotion, without amount_off_cents; the
2515
+ * amount is amount_cents), present exactly for promo_code and
2516
+ * subscription_discount. Its duration_in_months is set only for
2517
+ * promo_code: a carried promotion's remaining term is not the coupon's.
2518
+ *
2519
+ */
2520
+ export const zBillingOpChargeReason = z.object({
2521
+ amount_cents: z.coerce
2522
+ .bigint()
2523
+ .min(BigInt('-9223372036854775808'), {
2524
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2525
+ })
2526
+ .max(BigInt('9223372036854775807'), {
2527
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
2528
+ }),
2529
+ discount: zSubscriptionDiscount.optional(),
2530
+ kind: z.enum(['promo_code', 'subscription_discount', 'account_balance'])
2531
+ });
2532
+ /**
2533
+ * Display only. Why a succeeded subscription operation charged other
2534
+ * than its plan rate, read from the operation's paid Stripe invoice.
2535
+ * Present only when that invoice collected more than zero and a
2536
+ * promotion, the account balance or proration moved the charge off the
2537
+ * plan rate; absent means no rows. Plan coupons (the annual or team
2538
+ * commitment rate) are part of the rate and are never a reason. Never
2539
+ * present for top-ups. Returned only to workspace billing managers,
2540
+ * like amount_charged_cents.
2541
+ *
2542
+ */
2543
+ export const zBillingOpChargeBreakdown = z.object({
2544
+ amount_charged_cents: z.coerce
2545
+ .bigint()
2546
+ .min(BigInt('-9223372036854775808'), {
2547
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2548
+ })
2549
+ .max(BigInt('9223372036854775807'), {
2550
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
2551
+ }),
2552
+ currency: z.string(),
2553
+ prorated: z.boolean(),
2554
+ reasons: z.array(zBillingOpChargeReason)
2555
+ });
2143
2556
  /**
2144
2557
  * Status of an asynchronous billing operation.
2145
2558
  */
2146
2559
  export const zBillingOpStatusResponse = z.object({
2147
2560
  action_url: z.string().optional(),
2561
+ amount_charged_cents: z.coerce
2562
+ .bigint()
2563
+ .min(BigInt('-9223372036854775808'), {
2564
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2565
+ })
2566
+ .max(BigInt('9223372036854775807'), {
2567
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
2568
+ })
2569
+ .optional(),
2148
2570
  authentication_state: z
2149
2571
  .enum([
2150
2572
  'requires_action',
@@ -2154,7 +2576,18 @@ export const zBillingOpStatusResponse = z.object({
2154
2576
  'reconciliation_needed'
2155
2577
  ])
2156
2578
  .optional(),
2579
+ cancelable: z.boolean().optional(),
2580
+ charge_breakdown: zBillingOpChargeBreakdown.optional(),
2157
2581
  completed_at: z.string().datetime().optional(),
2582
+ credits_added: z.coerce
2583
+ .bigint()
2584
+ .min(BigInt('-9223372036854775808'), {
2585
+ message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2586
+ })
2587
+ .max(BigInt('9223372036854775807'), {
2588
+ message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
2589
+ })
2590
+ .optional(),
2158
2591
  decline_reason: z
2159
2592
  .enum([
2160
2593
  'card_declined',
@@ -2164,6 +2597,7 @@ export const zBillingOpStatusResponse = z.object({
2164
2597
  'authentication_required',
2165
2598
  'authentication_failed',
2166
2599
  'processing_error',
2600
+ 'payment_not_completed',
2167
2601
  'generic'
2168
2602
  ])
2169
2603
  .optional(),
@@ -2177,6 +2611,7 @@ export const zBillingOpStatusResponse = z.object({
2177
2611
  'in_progress'
2178
2612
  ])
2179
2613
  .optional(),
2614
+ plan: zBillingOpReceiptPlan.optional(),
2180
2615
  recovery_action: z
2181
2616
  .enum([
2182
2617
  'retry',
@@ -2189,6 +2624,10 @@ export const zBillingOpStatusResponse = z.object({
2189
2624
  started_at: z.string().datetime(),
2190
2625
  status: z.enum(['pending', 'succeeded', 'failed', 'reconciliation_needed'])
2191
2626
  });
2627
+ export const zBillingOpCancelResponse = z.object({
2628
+ billing_op_id: z.string(),
2629
+ status: z.enum(['canceled', 'cancel_requested'])
2630
+ });
2192
2631
  /**
2193
2632
  * 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
2633
  */
@@ -2259,6 +2698,41 @@ export const zBillingCapabilityRolloutDefaults = z.object({
2259
2698
  can_subscribe_self_serve: z.boolean(),
2260
2699
  can_top_up: z.boolean()
2261
2700
  });
2701
+ /**
2702
+ * Why a capability resolved false, keyed by the capability. The value
2703
+ * names the policy branch that decided, not customer-facing wording: the
2704
+ * client owns the message.
2705
+ *
2706
+ * The invariant runs one way only. **Presence implies refusal**: a key is
2707
+ * present only alongside `capabilities.<key> == false`, reconciled before
2708
+ * the response is built, so a reason never accompanies a granted
2709
+ * capability. **Absence implies nothing** -- it means no recognised
2710
+ * explanation, not that the capability was granted. Consult
2711
+ * `capabilities`, which stays authoritative for what the client may offer.
2712
+ *
2713
+ * A key is absent for a refused capability whenever this service is
2714
+ * talking to a billing-api that predates the field, and whenever it drops
2715
+ * a reason it does not recognise rather than forwarding a value outside
2716
+ * the enum below. Both are supported states, so a client must never infer
2717
+ * a capability's value from a missing reason -- only from `capabilities`.
2718
+ *
2719
+ * This endpoint omits the entire `denied_reasons` object when no recognised
2720
+ * reason survives. The billing-api endpoint may emit `{}` for the same
2721
+ * logical state, so object presence must not be used to detect support.
2722
+ *
2723
+ */
2724
+ export const zBillingCapabilityDenials = z.object({
2725
+ can_subscribe_self_serve: z
2726
+ .enum([
2727
+ 'not_a_member',
2728
+ 'not_workspace_owner',
2729
+ 'tier_not_self_serve',
2730
+ 'subscription_not_started',
2731
+ 'subscription_change_in_progress',
2732
+ 'subscription_status_unrecognized'
2733
+ ])
2734
+ .optional()
2735
+ });
2262
2736
  /**
2263
2737
  * Conservative UI guidance. These values do not authorize billing writes;
2264
2738
  * each write endpoint independently enforces its permission policy.
@@ -2270,6 +2744,7 @@ export const zBillingCapabilities = z.object({
2270
2744
  can_downgrade_to_personal: z.boolean(),
2271
2745
  can_invite_members: z.boolean(),
2272
2746
  can_reactivate: z.boolean(),
2747
+ can_revert_scheduled_change: z.boolean(),
2273
2748
  can_subscribe_self_serve: z.boolean(),
2274
2749
  can_top_up: z.boolean()
2275
2750
  });
@@ -2278,6 +2753,7 @@ export const zBillingCapabilities = z.object({
2278
2753
  */
2279
2754
  export const zBillingCapabilitiesResponse = z.object({
2280
2755
  capabilities: zBillingCapabilities,
2756
+ denied_reasons: zBillingCapabilityDenials.optional(),
2281
2757
  expires_at: z.string().datetime(),
2282
2758
  resolved_for: zBillingCapabilityScope,
2283
2759
  revision: z.coerce
@@ -2286,19 +2762,42 @@ export const zBillingCapabilitiesResponse = z.object({
2286
2762
  message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2287
2763
  })
2288
2764
  .lte(BigInt(9007199254740991)),
2289
- rollout_defaults_applied: zBillingCapabilityRolloutDefaults
2765
+ rollout_defaults_applied: zBillingCapabilityRolloutDefaults,
2766
+ subscription_state_authoritative: z.boolean().optional()
2290
2767
  });
2291
2768
  /**
2292
- * Current credit balance and usage details for a workspace.
2769
+ * Current credit balance and usage details for a workspace. Every amount here is CENTS of `currency`. The `*_micros` fields are a misnamed legacy set kept for wire compatibility; the `*_cents` fields beside them carry the identical values under honest names. `amount_micros` stays required and `amount_cents` is optional so existing strict clients are unaffected.
2293
2770
  */
2294
2771
  export const zBillingBalanceResponse = z.object({
2772
+ amount_cents: z.number().optional(),
2295
2773
  amount_micros: z.number(),
2774
+ cloud_credit_balance_cents: z.number().optional(),
2296
2775
  cloud_credit_balance_micros: z.number().optional(),
2297
2776
  currency: z.string(),
2777
+ effective_balance_authoritative: z.boolean().optional(),
2778
+ effective_balance_cents: z.number().optional(),
2298
2779
  effective_balance_micros: z.number().optional(),
2780
+ pending_charges_cents: z.number().optional(),
2299
2781
  pending_charges_micros: z.number().optional(),
2782
+ prepaid_balance_cents: z.number().optional(),
2300
2783
  prepaid_balance_micros: z.number().optional()
2301
2784
  });
2785
+ export const zAuthenticateResponse = z.object({
2786
+ expires_in: z.number().int().optional(),
2787
+ method: z.enum(['sso', 'password', 'session', 'firebase']),
2788
+ organization_name: z.string().optional(),
2789
+ start_url: z.string().optional()
2790
+ });
2791
+ export const zAuthenticateRequest = z.object({
2792
+ email: z.string().max(320),
2793
+ password: z.string().max(4096).optional()
2794
+ });
2795
+ export const zAuthenticateRefusal = z.object({
2796
+ code: z.string(),
2797
+ message: z.string(),
2798
+ organization_id: z.string().optional(),
2799
+ start_url: z.string().optional()
2800
+ });
2302
2801
  /**
2303
2802
  * Response returned when an existing asset is successfully updated.
2304
2803
  */
@@ -2348,7 +2847,7 @@ export const zAssetMetadataResponse = z.object({
2348
2847
  */
2349
2848
  export const zAssetDownloadResponse = z.object({
2350
2849
  message: z.string().optional(),
2351
- status: z.enum(['created', 'running', 'completed', 'failed']),
2850
+ status: z.enum(['created', 'running', 'completed', 'failed', 'cancelled']),
2352
2851
  task_id: z.string().uuid()
2353
2852
  });
2354
2853
  /**
@@ -2441,17 +2940,36 @@ export const zAgentRunMode = z.object({
2441
2940
  credit_limit: z.number().int().gte(1).lte(2147483647).nullable(),
2442
2941
  mode: z.enum(['ask_approval', 'auto', 'auto_limited'])
2443
2942
  });
2943
+ /**
2944
+ * The `context` of a `run_approval` ask. Ids and a display name, never the user's prose.
2945
+ */
2946
+ export const zAgentRunApprovalContext = z.object({
2947
+ workflow_id: z.string(),
2948
+ workflow_name: z.string().optional()
2949
+ });
2950
+ /**
2951
+ * Which card renders an ask. `ask_user` is the generic prompt raised by the ask_user tool. `run_approval` is the run consent card raised when the caller's ask_approval run mode gates a run: exactly the Run and Cancel options, never free text. `paused` is the admission pause card: one Resume option, never free text. `delete_approval` is the delete consent card for nodes the user made: exactly the Delete and Keep options, never free text. The same value is the agent_ask event's `kind`, the message list's `pending_ask.kind`, and an entry of `ask_kinds` on the message POST.
2952
+ */
2953
+ export const zAgentAskKind = z.enum([
2954
+ 'ask_user',
2955
+ 'run_approval',
2956
+ 'paused',
2957
+ 'delete_approval'
2958
+ ]);
2444
2959
  /**
2445
2960
  * A user turn posted to the agent.
2446
2961
  */
2447
2962
  export const zAgentPostMessageRequest = z.object({
2963
+ ask_kinds: z.array(zAgentAskKind).optional(),
2448
2964
  attachments: z.array(z.string()).optional(),
2965
+ client_id: z.string().optional(),
2966
+ client_message_id: z.string().max(128).optional(),
2449
2967
  content: z.string(),
2450
2968
  current_tab: z.string().optional(),
2969
+ current_tab_unbound: z.boolean().optional(),
2451
2970
  draft: z
2452
2971
  .object({
2453
- content: z.record(z.unknown()).optional(),
2454
- version: z.number().int().nullish()
2972
+ content: z.record(z.unknown()).optional()
2455
2973
  })
2456
2974
  .optional(),
2457
2975
  open_tabs: z
@@ -2469,25 +2987,109 @@ export const zAgentPostMessageRequest = z.object({
2469
2987
  }))
2470
2988
  .optional()
2471
2989
  });
2990
+ export const zAgentAskOption = z.object({
2991
+ description: z.string().optional(),
2992
+ id: z.string(),
2993
+ label: z.string()
2994
+ });
2472
2995
  /**
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.
2996
+ * The fields every pending ask carries, whatever its kind.
2474
2997
  */
2475
- export const zAgentPendingAsk = z.object({
2998
+ export const zAgentPendingAskBase = z.object({
2476
2999
  allow_other: z.boolean(),
2477
3000
  ask_id: z.string(),
2478
- context: z.record(z.unknown()).optional(),
2479
- kind: z.enum(['ask_user', 'run_approval']),
3001
+ kind: zAgentAskKind,
2480
3002
  max_selections: z.number().int(),
2481
3003
  message_id: z.string(),
2482
3004
  min_selections: z.number().int(),
2483
- options: z.array(z.record(z.unknown())),
3005
+ options: z.array(zAgentAskOption),
2484
3006
  prompt: z.string()
2485
3007
  });
3008
+ /**
3009
+ * A pending `run_approval` consent card.
3010
+ */
3011
+ export const zAgentPendingRunApproval = zAgentPendingAskBase.and(z.object({
3012
+ context: zAgentRunApprovalContext,
3013
+ kind: z.enum(['run_approval'])
3014
+ }));
3015
+ /**
3016
+ * The `context` of a `paused` ask.
3017
+ */
3018
+ export const zAgentPausedContext = z.object({
3019
+ message: z.string(),
3020
+ reason: z.string(),
3021
+ recheck_after_seconds: z.number().int()
3022
+ });
3023
+ /**
3024
+ * A pending `paused` admission card.
3025
+ */
3026
+ export const zAgentPendingPaused = zAgentPendingAskBase.and(z.object({
3027
+ context: zAgentPausedContext,
3028
+ kind: z.enum(['paused'])
3029
+ }));
3030
+ /**
3031
+ * One node a `delete_approval` ask names, read from the turn's workflow.
3032
+ */
3033
+ export const zAgentAskNodeRef = z.object({
3034
+ id: z.string(),
3035
+ title: z.string().optional(),
3036
+ type: z.string().optional()
3037
+ });
3038
+ /**
3039
+ * The `context` of a `delete_approval` ask: the user-made nodes the agent's delete would remove. The server always lists at least one node, and lists at most 50; any more are counted in `hidden_node_count`, so the card can say how many it did not list.
3040
+ */
3041
+ export const zAgentDeleteApprovalContext = z.object({
3042
+ action: z.enum(['delete_nodes']),
3043
+ hidden_node_count: z.number().int().gte(1).optional(),
3044
+ nodes: z.array(zAgentAskNodeRef).min(1).max(50)
3045
+ });
3046
+ /**
3047
+ * A pending `delete_approval` consent card.
3048
+ */
3049
+ export const zAgentPendingDeleteApproval = zAgentPendingAskBase.and(z.object({
3050
+ context: zAgentDeleteApprovalContext,
3051
+ kind: z.enum(['delete_approval'])
3052
+ }));
3053
+ /**
3054
+ * A pending `ask_user` prompt. It carries no context.
3055
+ */
3056
+ export const zAgentPendingAskUser = zAgentPendingAskBase.and(z.object({
3057
+ kind: z.enum(['ask_user'])
3058
+ }));
3059
+ /**
3060
+ * 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. Discriminated on `kind`: narrowing on it gives the kind's `context` schema. The agent_ask WebSocket event's `data` is this same shape plus `thread_id`.
3061
+ */
3062
+ export const zAgentPendingAsk = z.union([
3063
+ z
3064
+ .object({
3065
+ kind: z.literal('ask_user')
3066
+ })
3067
+ .and(zAgentPendingAskUser),
3068
+ z
3069
+ .object({
3070
+ kind: z.literal('run_approval')
3071
+ })
3072
+ .and(zAgentPendingRunApproval),
3073
+ z
3074
+ .object({
3075
+ kind: z.literal('paused')
3076
+ })
3077
+ .and(zAgentPendingPaused),
3078
+ z
3079
+ .object({
3080
+ kind: z.literal('delete_approval')
3081
+ })
3082
+ .and(zAgentPendingDeleteApproval)
3083
+ ]);
2486
3084
  /**
2487
3085
  * A persisted message in an agent thread.
2488
3086
  */
2489
3087
  export const zAgentMessage = z.object({
2490
- content: z.record(z.unknown()).optional(),
3088
+ content: z
3089
+ .object({
3090
+ tool_calls: z.array(zToolCallSummary).optional()
3091
+ })
3092
+ .optional(),
2491
3093
  id: z.string(),
2492
3094
  pending_ask: zAgentPendingAsk.optional(),
2493
3095
  role: z.enum(['user', 'assistant', 'tool', 'system']),
@@ -2497,6 +3099,13 @@ export const zAgentMessage = z.object({
2497
3099
  turn_id: z.string(),
2498
3100
  workflow_id: z.string().optional()
2499
3101
  });
3102
+ /**
3103
+ * The (workspace, user) the agent service attributes the caller's requests to.
3104
+ */
3105
+ export const zAgentIdentity = z.object({
3106
+ user_id: z.string(),
3107
+ workspace_id: z.string()
3108
+ });
2500
3109
  /**
2501
3110
  * 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
3111
  */
@@ -2510,12 +3119,67 @@ export const zAgentDraftSnapshot = z.object({
2510
3119
  content: z.record(z.unknown()),
2511
3120
  version: z.number().int()
2512
3121
  });
3122
+ /**
3123
+ * A stop whose cancellation request did not land, or could not be confirmed as landed, on the durable engine. The turn is unaffected and still streaming, so the same request may be retried; cancellation is idempotent per turn. Distinct from the 500, which means the failure was one the service could not classify and a retry may never work.
3124
+ */
3125
+ export const zAgentCancelUnconfirmed = z.object({
3126
+ code: z.enum(['cancel_not_requested', 'cancel_outcome_unknown']),
3127
+ error: z.string(),
3128
+ retryable: z.boolean()
3129
+ });
2513
3130
  /**
2514
3131
  * Acknowledgement that a turn cancellation was requested. Cancellation is asynchronous; the terminal message state (status=error with stop copy) arrives over the WebSocket.
2515
3132
  */
2516
3133
  export const zAgentCancelAccepted = z.object({
2517
3134
  status: z.enum(['cancelling'])
2518
3135
  });
3136
+ /**
3137
+ * How an ask left pending, as stored on the ask row. `answered` means an answer was committed and delivered to the turn; `cancelled` means the turn ended, was stopped, or could not take the answer; `expired` means the ask timed out. There is no "unknown" status: when an answer request fails with a 5xx the client does not know the outcome and should wait for agent_ask_resolved or refetch the thread.
3138
+ */
3139
+ export const zAgentAskStatus = z.enum(['answered', 'cancelled', 'expired']);
3140
+ /**
3141
+ * The `data` of an agent_ask_resolved WebSocket event: the outcome the server committed to the ask row. Every open tab gets the same frame, including tabs that did not send the answer, so a client reads the answer that won from here and never infers it from what it sent.
3142
+ */
3143
+ export const zAgentAskResolvedData = z.object({
3144
+ ask_id: z.string(),
3145
+ message_id: z.string(),
3146
+ other_text: z.string().optional(),
3147
+ selected: z.array(z.string()).nullable(),
3148
+ status: zAgentAskStatus,
3149
+ thread_id: z.string()
3150
+ });
3151
+ /**
3152
+ * Server-to-client agent_ask_resolved frame on /ws. An ask left pending.
3153
+ */
3154
+ export const zAgentAskResolvedFrame = z.object({
3155
+ data: zAgentAskResolvedData,
3156
+ type: z.enum(['agent_ask_resolved'])
3157
+ });
3158
+ /**
3159
+ * Server-to-client agent_ask frame on /ws. A turn is parked on this ask.
3160
+ */
3161
+ export const zAgentAskFrame = z.object({
3162
+ data: zAgentPendingAsk.and(z.object({
3163
+ thread_id: z.string()
3164
+ })),
3165
+ type: z.enum(['agent_ask'])
3166
+ });
3167
+ /**
3168
+ * The ask frames the server sends on /ws, discriminated on `type`.
3169
+ */
3170
+ export const zAgentAskServerFrame = z.union([
3171
+ zAgentAskFrame,
3172
+ zAgentAskResolvedFrame
3173
+ ]);
3174
+ /**
3175
+ * 409 from the answer route: the ask is no longer pending, or its turn is gone so the answer can never be delivered. `status`, `selected` and `other_text` report the outcome stored on the ask row when the server knows it, with the same rules as the agent_ask_resolved event.
3176
+ */
3177
+ export const zAgentAskConflict = z.object({
3178
+ error: z.string(),
3179
+ other_text: z.string().optional(),
3180
+ selected: z.array(z.string()).nullish(),
3181
+ status: zAgentAskStatus.optional()
3182
+ });
2519
3183
  /**
2520
3184
  * 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
3185
  */
@@ -2524,9 +3188,11 @@ export const zAgentAnswerRequest = z.object({
2524
3188
  selected: z.array(z.string())
2525
3189
  });
2526
3190
  /**
2527
- * Acknowledgement that an ask answer was accepted. The parked turn resumes and its continuation streams over the WebSocket.
3191
+ * Acknowledgement that the ask is answered and the parked turn was woken; its continuation streams over the WebSocket. `selected` and `other_text` are the answer committed to the ask row. The first answer wins: when an earlier request already committed one (a retry, or another tab), this carries THAT answer, not the request body, so compare it with what you sent before showing it as the user's choice.
2528
3192
  */
2529
3193
  export const zAgentAnswerAccepted = z.object({
3194
+ other_text: z.string().optional(),
3195
+ selected: z.array(z.string()),
2530
3196
  status: z.enum(['answered'])
2531
3197
  });
2532
3198
  /**
@@ -2595,6 +3261,22 @@ export const zListAssetsResponseWritable = z.object({
2595
3261
  export const zAssetCreatedWritable = zAssetWritable.and(z.object({
2596
3262
  created_new: z.boolean()
2597
3263
  }));
3264
+ /**
3265
+ * The workspace a media request reads from, where a media tag cannot
3266
+ * send `X-Comfy-Workspace-ID`. It applies only while
3267
+ * `web_session_enabled` is on for the user; with it off, and always on
3268
+ * the `CookieAuth` cookie, it is ignored.
3269
+ *
3270
+ * On a `WebSessionAuth` request it selects the workspace: a workspace
3271
+ * the user cannot access is 403 `workspace_access_denied`, and a
3272
+ * malformed value, or one that disagrees with `X-Comfy-Workspace-ID`,
3273
+ * is 400 `workspace_id_invalid`. A token or API key keeps its own
3274
+ * workspace, and naming another is 400 `workspace_id_invalid`. A cookie
3275
+ * request that names no workspace looks a filename up across all of the
3276
+ * user's workspaces, and an asset id up in the personal one.
3277
+ *
3278
+ */
3279
+ export const zMediaWorkspaceId = z.string();
2598
3280
  /**
2599
3281
  * JWKS response
2600
3282
  */
@@ -2627,6 +3309,14 @@ export const zAgentGetDraftQuery = z.object({
2627
3309
  * Current draft snapshot
2628
3310
  */
2629
3311
  export const zAgentGetDraftResponse = zAgentDraftSnapshot;
3312
+ export const zGetAgentEventsQuery = z.object({
3313
+ token: z.string().optional(),
3314
+ workspace_id: z.string().optional()
3315
+ });
3316
+ /**
3317
+ * The caller's agent identity.
3318
+ */
3319
+ export const zAgentGetIdentityResponse = zAgentIdentity;
2630
3320
  export const zAgentLlmAdmitBody = z.object({
2631
3321
  message_id: z.string().optional(),
2632
3322
  step: z.number().int().gte(0),
@@ -2650,6 +3340,14 @@ export const zAgentLlmMessagesBody = z.record(z.unknown());
2650
3340
  * The upstream LLM response, streamed back as Server-Sent Events (text/event-stream) chunk-by-chunk.
2651
3341
  */
2652
3342
  export const zAgentLlmMessagesResponse = z.string();
3343
+ /**
3344
+ * An OTLP ExportTraceServiceRequest, optionally gzip-encoded (Content-Encoding gzip); at most 4 MiB encoded and decoded, and 4096 spans.
3345
+ */
3346
+ export const zAgentLlmTracesBody = z.string();
3347
+ /**
3348
+ * Accepted; the body is an empty OTLP ExportTraceServiceResponse.
3349
+ */
3350
+ export const zAgentLlmTracesResponse = z.string();
2653
3351
  /**
2654
3352
  * The caller's run mode (the saved choice, or the default).
2655
3353
  */
@@ -2796,7 +3494,11 @@ export const zGetAssetContentPath = z.object({
2796
3494
  id: z.string()
2797
3495
  });
2798
3496
  export const zGetAssetContentQuery = z.object({
2799
- disposition: z.enum(['inline', 'attachment']).optional().default('attachment')
3497
+ disposition: z
3498
+ .enum(['inline', 'attachment'])
3499
+ .optional()
3500
+ .default('attachment'),
3501
+ workspace_id: z.string().optional()
2800
3502
  });
2801
3503
  /**
2802
3504
  * Asset content stream (local runtime streams the bytes directly)
@@ -2927,6 +3629,11 @@ export const zGetAssetTagHistogramQuery = z.object({
2927
3629
  * Success - Tag histogram returned
2928
3630
  */
2929
3631
  export const zGetAssetTagHistogramResponse = zAssetTagHistogramResponse;
3632
+ export const zAuthenticateBody = zAuthenticateRequest;
3633
+ /**
3634
+ * Where the email signs in, or a signed-in session
3635
+ */
3636
+ export const zAuthenticateResponse2 = zAuthenticateResponse;
2930
3637
  export const zCreateDesktopLoginCodeBody = zDesktopLoginCodeCreateRequest;
2931
3638
  /**
2932
3639
  * Login code created
@@ -2946,10 +3653,25 @@ export const zRedeemDesktopLoginCodeResponse = zDesktopLoginCodeRedeemResponse;
2946
3653
  * Session deleted successfully
2947
3654
  */
2948
3655
  export const zDeleteSessionResponse2 = zDeleteSessionResponse;
3656
+ /**
3657
+ * The live session
3658
+ */
3659
+ export const zGetSessionResponse = zWebSessionResponse;
2949
3660
  /**
2950
3661
  * Session created successfully
2951
3662
  */
2952
3663
  export const zCreateSessionResponse2 = zCreateSessionResponse;
3664
+ /**
3665
+ * Every session ended
3666
+ */
3667
+ export const zRevokeAllSessionsResponse2 = zRevokeAllSessionsResponse;
3668
+ export const zDiscoverSsoBody = z.object({
3669
+ email: z.string().max(320)
3670
+ });
3671
+ /**
3672
+ * Whether the email's domain belongs to an SSO organization
3673
+ */
3674
+ export const zDiscoverSsoResponse = zSsoDiscoverResponse;
2953
3675
  export const zExchangeTokenBody = zExchangeTokenRequest;
2954
3676
  /**
2955
3677
  * Token exchanged successfully
@@ -2996,6 +3718,13 @@ export const zGetBillingOpStatusPath = z.object({
2996
3718
  * Billing operation status
2997
3719
  */
2998
3720
  export const zGetBillingOpStatusResponse = zBillingOpStatusResponse;
3721
+ export const zCancelBillingOpPath = z.object({
3722
+ id: z.string()
3723
+ });
3724
+ /**
3725
+ * Canceled; nothing was charged. Also returned for an operation already discarded or expired without authentication, so a repeat is safe.
3726
+ */
3727
+ export const zCancelBillingOpResponse = zBillingOpCancelResponse;
2999
3728
  /**
3000
3729
  * Saved payment methods
3001
3730
  */
@@ -3014,6 +3743,20 @@ export const zPreviewSubscribeBody = zPreviewSubscribeRequest;
3014
3743
  * Subscription preview
3015
3744
  */
3016
3745
  export const zPreviewSubscribeResponse2 = zPreviewSubscribeResponse;
3746
+ export const zAcceptRetentionOfferBody = zRetentionAcceptRequest;
3747
+ /**
3748
+ * Success
3749
+ */
3750
+ export const zAcceptRetentionOfferResponse = zRetentionAcceptance;
3751
+ export const zRecordRetentionFlowEventBody = zRetentionFlowEventRequest;
3752
+ /**
3753
+ * Success
3754
+ */
3755
+ export const zRecordRetentionFlowEventResponse = z.void();
3756
+ /**
3757
+ * Success
3758
+ */
3759
+ export const zPrepareRetentionFlowResponse = zRetentionFlowResponse;
3017
3760
  /**
3018
3761
  * Billing status
3019
3762
  */
@@ -3033,6 +3776,11 @@ export const zResubscribeBody = zResubscribeRequest;
3033
3776
  * Subscription resumed successfully
3034
3777
  */
3035
3778
  export const zResubscribeResponse2 = zResubscribeResponse;
3779
+ export const zRevertScheduledChangeBody = zRevertScheduledChangeRequest;
3780
+ /**
3781
+ * Revert accepted
3782
+ */
3783
+ export const zRevertScheduledChangeResponse2 = zRevertScheduledChangeResponse;
3036
3784
  export const zCreateTopupBody = zCreateTopupRequest;
3037
3785
  /**
3038
3786
  * Top-up initiated successfully
@@ -3043,9 +3791,14 @@ export const zCreateTopupCheckoutBody = zCreateTopupCheckoutRequest;
3043
3791
  * Checkout session created
3044
3792
  */
3045
3793
  export const zCreateTopupCheckoutResponse2 = zCreateTopupCheckoutResponse;
3794
+ export const zCreateTopupQuoteBody = zCreateTopupQuoteRequest;
3795
+ /**
3796
+ * Top-up quote
3797
+ */
3798
+ export const zCreateTopupQuoteResponse = zTopupQuoteResponse;
3046
3799
  export const zGetBillingUsageTimeSeriesQuery = z.object({
3047
3800
  group_by: z
3048
- .enum(['model', 'endpoint', 'product'])
3801
+ .enum(['model', 'endpoint', 'product', 'product_line', 'person', 'source'])
3049
3802
  .optional()
3050
3803
  .default('model'),
3051
3804
  granularity: z.enum(['hour', 'day', 'month']).optional().default('month'),
@@ -3088,6 +3841,21 @@ export const zGetExtensionsResponse = z.array(z.string());
3088
3841
  * Success
3089
3842
  */
3090
3843
  export const zGetFeaturesResponse = z.object({
3844
+ 'agent-free-use-message-placement': z
3845
+ .enum([
3846
+ 'control',
3847
+ 'top-banner',
3848
+ 'near-composer',
3849
+ 'above-input',
3850
+ 'inside-input'
3851
+ ])
3852
+ .default('control'),
3853
+ 'agent-starter-prompt-set': z
3854
+ .enum(['control', 'test'])
3855
+ .optional()
3856
+ .default('control'),
3857
+ billing_web_url: z.string().optional(),
3858
+ can_run_partner_nodes: z.boolean().optional(),
3091
3859
  free_tier_balance: z
3092
3860
  .object({
3093
3861
  allowance: z.number().int(),
@@ -3095,8 +3863,18 @@ export const zGetFeaturesResponse = z.object({
3095
3863
  used: z.number().int()
3096
3864
  })
3097
3865
  .optional(),
3866
+ free_tier_offer: z
3867
+ .object({
3868
+ job_allowance: z.number().int(),
3869
+ requires_google_sign_in: z.boolean()
3870
+ })
3871
+ .optional(),
3098
3872
  max_upload_size: z.number().int().optional(),
3099
- supports_preview_metadata: z.boolean().optional()
3873
+ new_free_tier_subscriptions: z.boolean().optional(),
3874
+ sso_enabled: z.boolean().optional(),
3875
+ stripe_publishable_key: z.string().optional(),
3876
+ supports_preview_metadata: z.boolean().optional(),
3877
+ web_session_probe: z.boolean().optional()
3100
3878
  });
3101
3879
  export const zSubmitFeedbackBody = zFeedbackRequest;
3102
3880
  /**
@@ -3336,6 +4114,9 @@ export const zGetLegacyModelsByFolderPath = z.object({
3336
4114
  * Success - Node replacement mappings
3337
4115
  */
3338
4116
  export const zGetNodeReplacementsResponse = z.record(z.unknown());
4117
+ export const zGetNodeInfoQuery = z.object({
4118
+ include_user_models: z.boolean().optional().default(false)
4119
+ });
3339
4120
  /**
3340
4121
  * Success
3341
4122
  */
@@ -3467,6 +4248,13 @@ export const zListTasksQuery = z.object({
3467
4248
  * Success - Tasks retrieved
3468
4249
  */
3469
4250
  export const zListTasksResponse = zTasksListResponse;
4251
+ export const zCancelTaskPath = z.object({
4252
+ task_id: z.string().uuid()
4253
+ });
4254
+ /**
4255
+ * Cancellation accepted
4256
+ */
4257
+ export const zCancelTaskResponse = z.void();
3470
4258
  export const zGetTaskPath = z.object({
3471
4259
  task_id: z.string().uuid()
3472
4260
  });
@@ -3582,7 +4370,8 @@ export const zGetUsersInfoResponse = z.object({
3582
4370
  storage: z.string()
3583
4371
  });
3584
4372
  export const zGetVhsQueryVideoQuery = z.object({
3585
- filename: z.string()
4373
+ filename: z.string(),
4374
+ workspace_id: z.string().optional()
3586
4375
  });
3587
4376
  /**
3588
4377
  * Video metadata
@@ -3598,13 +4387,27 @@ export const zGetVhsQueryVideoResponse = z.object({
3598
4387
  export const zGetVhsViewAudioQuery = z.object({
3599
4388
  filename: z.string(),
3600
4389
  type: z.string().optional(),
3601
- subfolder: z.string().optional()
4390
+ subfolder: z.string().optional(),
4391
+ channel: z.string().optional(),
4392
+ res: z.number().int().gte(64).lte(1024).optional(),
4393
+ workspace_id: z.string().optional()
3602
4394
  });
4395
+ /**
4396
+ * JPEG thumbnail for `res`
4397
+ */
4398
+ export const zGetVhsViewAudioResponse = z.string();
3603
4399
  export const zGetVhsViewVideoQuery = z.object({
3604
4400
  filename: z.string(),
3605
4401
  type: z.string().optional(),
3606
- subfolder: z.string().optional()
4402
+ subfolder: z.string().optional(),
4403
+ channel: z.string().optional(),
4404
+ res: z.number().int().gte(64).lte(1024).optional(),
4405
+ workspace_id: z.string().optional()
3607
4406
  });
4407
+ /**
4408
+ * JPEG thumbnail for `res`
4409
+ */
4410
+ export const zGetVhsViewVideoResponse = z.string();
3608
4411
  export const zViewFileQuery = z.object({
3609
4412
  filename: z.string(),
3610
4413
  subfolder: z.string().optional(),
@@ -3615,7 +4418,8 @@ export const zViewFileQuery = z.object({
3615
4418
  workflow: z.string().optional(),
3616
4419
  timestamp: z.number().int().optional(),
3617
4420
  channel: z.string().optional(),
3618
- res: z.number().int().gte(64).lte(1024).optional()
4421
+ res: z.number().int().gte(64).lte(1024).optional(),
4422
+ workspace_id: z.string().optional()
3619
4423
  });
3620
4424
  /**
3621
4425
  * Resized JPEG thumbnail (returned when res parameter is used)
@@ -3625,8 +4429,15 @@ export const zGetLegacyViewMetadataPath = z.object({
3625
4429
  folder_name: z.string()
3626
4430
  });
3627
4431
  export const zGetApiViewVideoAliasQuery = z.object({
3628
- filename: z.string()
4432
+ filename: z.string(),
4433
+ channel: z.string().optional(),
4434
+ res: z.number().int().gte(64).lte(1024).optional(),
4435
+ workspace_id: z.string().optional()
3629
4436
  });
4437
+ /**
4438
+ * JPEG thumbnail for `res`
4439
+ */
4440
+ export const zGetApiViewVideoAliasResponse = z.string();
3630
4441
  /**
3631
4442
  * Empty object for workflow templates
3632
4443
  */
@@ -3919,8 +4730,17 @@ export const zGetTemplateProxyPath = z.object({
3919
4730
  path: z.string()
3920
4731
  });
3921
4732
  export const zGetViewCompatAliasQuery = z.object({
3922
- filename: z.string()
4733
+ filename: z.string(),
4734
+ channel: z.string().optional(),
4735
+ res: z.number().int().gte(64).lte(1024).optional(),
4736
+ workspace_id: z.string().optional()
3923
4737
  });
4738
+ /**
4739
+ * JPEG thumbnail for `res`
4740
+ */
4741
+ export const zGetViewCompatAliasResponse = z.string();
3924
4742
  export const zGetWebsocketQuery = z.object({
4743
+ token: z.string().optional(),
4744
+ workspace_id: z.string().optional(),
3925
4745
  clientId: z.string().optional()
3926
4746
  });