@comfyorg/ingest-types 1.1.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
@@ -184,6 +184,7 @@ export const zWebSessionResponse = z.object({
184
184
  absolute_expires_at: z.string().datetime(),
185
185
  csrf_token: z.string(),
186
186
  expires_at: z.string().datetime(),
187
+ has_personal_workspace: z.boolean(),
187
188
  user: zWebSessionUser
188
189
  });
189
190
  /**
@@ -225,16 +226,40 @@ export const zUserDataResponseFull = z.object({
225
226
  path: z.string().optional(),
226
227
  size: z.number().int().optional()
227
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
+ */
228
232
  export const zUsageBalance = z.object({
233
+ amount_cents: z.number().optional(),
229
234
  amount_micros: z.number().optional(),
235
+ cloud_credit_balance_cents: z.number().optional(),
230
236
  cloud_credit_balance_micros: z.number().optional(),
231
237
  currency: z.string().optional(),
238
+ prepaid_balance_cents: z.number().optional(),
232
239
  prepaid_balance_micros: z.number().optional()
233
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
+ */
234
244
  export const zUsageSummary = z.object({
235
245
  balance: zUsageBalance.optional(),
236
246
  spend_micros: z.number()
237
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
+ });
238
263
  export const zUsageBucket = z.object({
239
264
  cost_micros: z.number(),
240
265
  group_key: z.string(),
@@ -251,8 +276,17 @@ export const zUsageTimeSeries = z.object({
251
276
  buckets: z.array(zUsageBucket),
252
277
  ending_before: z.string().datetime(),
253
278
  granularity: z.enum(['hour', 'day', 'month']),
254
- 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(),
255
288
  groups: z.array(z.string()),
289
+ not_available: zUsageNotAvailable.optional(),
256
290
  starting_on: z.string().datetime(),
257
291
  summary: zUsageSummary
258
292
  });
@@ -329,6 +363,7 @@ export const zToolCallSummary = z.object({
329
363
  error_code: z.string().optional(),
330
364
  finished_at: z.string().datetime().optional(),
331
365
  id: z.string(),
366
+ job_id: z.string().optional(),
332
367
  started_at: z.string().datetime().optional(),
333
368
  status: z.enum(['success', 'error']),
334
369
  tool_call_id: z.string(),
@@ -417,7 +452,7 @@ export const zTaskEntry = z.object({
417
452
  create_time: z.string().datetime(),
418
453
  id: z.string().uuid(),
419
454
  started_at: z.string().datetime().optional(),
420
- status: z.enum(['created', 'running', 'completed', 'failed']),
455
+ status: z.enum(['created', 'running', 'completed', 'failed', 'cancelled']),
421
456
  task_name: z.string()
422
457
  });
423
458
  /**
@@ -439,7 +474,7 @@ export const zTaskResponse = z.object({
439
474
  payload: z.record(z.unknown()),
440
475
  result: z.record(z.unknown()).optional(),
441
476
  started_at: z.string().datetime().optional(),
442
- status: z.enum(['created', 'running', 'completed', 'failed']),
477
+ status: z.enum(['created', 'running', 'completed', 'failed', 'cancelled']),
443
478
  task_name: z.string(),
444
479
  update_time: z.string().datetime()
445
480
  });
@@ -511,7 +546,10 @@ export const zSubscriptionDiscount = z.object({
511
546
  })
512
547
  .optional(),
513
548
  kind: z.enum(['plan', 'promotion']),
514
- name: z.string().optional()
549
+ name: z.string().optional(),
550
+ term: z
551
+ .enum(['this_payment', 'first_month', 'first_year', 'months', 'ongoing'])
552
+ .optional()
515
553
  });
516
554
  /**
517
555
  * Response after successfully subscribing to a billing plan.
@@ -717,12 +755,62 @@ export const zSavedPaymentMethod = z.object({
717
755
  .optional(),
718
756
  type: z.string()
719
757
  });
758
+ export const zSsoDiscoverResponse = z.object({
759
+ organization_name: z.string().optional(),
760
+ required: z.boolean().optional(),
761
+ sso: z.boolean()
762
+ });
720
763
  /**
721
764
  * Response after signing out of all devices
722
765
  */
723
766
  export const zRevokeAllSessionsResponse = z.object({
724
767
  revoked: z.number().int()
725
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
+ });
726
814
  /**
727
815
  * Response after accepting a resubscribe request.
728
816
  */
@@ -738,7 +826,7 @@ export const zResubscribeRequest = z.object({
738
826
  idempotency_key: z.string().optional()
739
827
  });
740
828
  /**
741
- * 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, and not while a payment for it is processing. hosted_invoice_url is a bearer payment link.
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.
742
830
  */
743
831
  export const zRenewalInvoice = z.object({
744
832
  amount_due: z.coerce
@@ -921,6 +1009,24 @@ export const zPreviewPlanInfo = z.object({
921
1009
  message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
922
1010
  })
923
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(),
924
1030
  period_end: z.string().datetime().optional(),
925
1031
  period_start: z.string().datetime().optional(),
926
1032
  price_cents: z.coerce
@@ -974,6 +1080,15 @@ export const zPreviewSubscribeResponse = z.object({
974
1080
  .max(BigInt('9223372036854775807'), {
975
1081
  message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
976
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(),
977
1092
  credits_next_period_cents: z.coerce
978
1093
  .bigint()
979
1094
  .min(BigInt('-9223372036854775808'), {
@@ -982,6 +1097,15 @@ export const zPreviewSubscribeResponse = z.object({
982
1097
  .max(BigInt('9223372036854775807'), {
983
1098
  message: 'Invalid value: Expected int64 to be <= 9223372036854775807'
984
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(),
985
1109
  credits_today_cents: z.coerce
986
1110
  .bigint()
987
1111
  .min(BigInt('-9223372036854775808'), {
@@ -999,6 +1123,24 @@ export const zPreviewSubscribeResponse = z.object({
999
1123
  payment_method_configuration_id: z.string().optional(),
1000
1124
  promotion_code: z.string().optional(),
1001
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(),
1002
1144
  quote_id: z.string().optional(),
1003
1145
  quote_version: z.number().int().optional(),
1004
1146
  reason: z.string().optional(),
@@ -1195,7 +1337,8 @@ export const zOAuthRegisterError = z.object({
1195
1337
  export const zErrorResponse = z.object({
1196
1338
  code: z.string(),
1197
1339
  details: z.record(z.unknown()).optional(),
1198
- message: z.string()
1340
+ message: z.string(),
1341
+ organization_id: z.string().optional()
1199
1342
  });
1200
1343
  /**
1201
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).
@@ -1230,6 +1373,7 @@ export const zOAuthConsentChallengeWorkspace = z.object({
1230
1373
  */
1231
1374
  export const zOAuthConsentChallenge = z.object({
1232
1375
  client_display_name: z.string(),
1376
+ client_provenance: z.enum(['first_party', 'dynamic']),
1233
1377
  csrf_token: z.string(),
1234
1378
  oauth_request_id: z.string().uuid(),
1235
1379
  redirect_uri: z.string().url(),
@@ -1296,10 +1440,11 @@ export const zModelFile = z.object({
1296
1440
  * Workspace member with profile and role information.
1297
1441
  */
1298
1442
  export const zMember = z.object({
1299
- email: z.string().email(),
1443
+ email: z.string(),
1300
1444
  id: z.string(),
1301
1445
  is_original_owner: z.boolean(),
1302
1446
  joined_at: z.string().datetime(),
1447
+ managed_by_directory: z.boolean().optional(),
1303
1448
  name: z.string(),
1304
1449
  role: z.enum(['owner', 'member'])
1305
1450
  });
@@ -1317,6 +1462,7 @@ export const zMediaBadRequestError = z.union([zErrorResponse, zMediaQueryError])
1317
1462
  * Paginated list of workspaces the authenticated user belongs to.
1318
1463
  */
1319
1464
  export const zListWorkspacesResponse = z.object({
1465
+ can_create_workspace: z.boolean(),
1320
1466
  workspaces: z.array(zWorkspaceWithRole)
1321
1467
  });
1322
1468
  /**
@@ -1577,6 +1723,8 @@ export const zJobDetailResponse = z.object({
1577
1723
  outputs_count: z.number().int().optional(),
1578
1724
  preview_output: z.record(z.unknown()).optional(),
1579
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(),
1580
1728
  status: z.enum([
1581
1729
  'pending',
1582
1730
  'in_progress',
@@ -1881,7 +2029,7 @@ export const zHistoryManageRequest = z.object({
1881
2029
  delete: z.array(z.string()).optional()
1882
2030
  });
1883
2031
  /**
1884
- * 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.
1885
2033
  */
1886
2034
  export const zHistoryDetailEntry = z.object({
1887
2035
  meta: z.record(z.unknown()).optional(),
@@ -2326,14 +2474,84 @@ export const zBillingPlansResponse = z.object({
2326
2474
  });
2327
2475
  /**
2328
2476
  * Display only. The plan the operation targets; for a scheduled change,
2329
- * the plan it switches to at period end. Present only for succeeded
2330
- * plan changes, initial subscriptions and resubscribes. Visible to any
2331
- * workspace member who can read the operation.
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.
2332
2485
  *
2333
2486
  */
2334
2487
  export const zBillingOpReceiptPlan = z.object({
2488
+ currency: z.string().optional(),
2335
2489
  duration: zSubscriptionDuration,
2336
- slug: z.string()
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)
2337
2555
  });
2338
2556
  /**
2339
2557
  * Status of an asynchronous billing operation.
@@ -2358,6 +2576,8 @@ export const zBillingOpStatusResponse = z.object({
2358
2576
  'reconciliation_needed'
2359
2577
  ])
2360
2578
  .optional(),
2579
+ cancelable: z.boolean().optional(),
2580
+ charge_breakdown: zBillingOpChargeBreakdown.optional(),
2361
2581
  completed_at: z.string().datetime().optional(),
2362
2582
  credits_added: z.coerce
2363
2583
  .bigint()
@@ -2404,6 +2624,10 @@ export const zBillingOpStatusResponse = z.object({
2404
2624
  started_at: z.string().datetime(),
2405
2625
  status: z.enum(['pending', 'succeeded', 'failed', 'reconciliation_needed'])
2406
2626
  });
2627
+ export const zBillingOpCancelResponse = z.object({
2628
+ billing_op_id: z.string(),
2629
+ status: z.enum(['canceled', 'cancel_requested'])
2630
+ });
2407
2631
  /**
2408
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.
2409
2633
  */
@@ -2474,6 +2698,41 @@ export const zBillingCapabilityRolloutDefaults = z.object({
2474
2698
  can_subscribe_self_serve: z.boolean(),
2475
2699
  can_top_up: z.boolean()
2476
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
+ });
2477
2736
  /**
2478
2737
  * Conservative UI guidance. These values do not authorize billing writes;
2479
2738
  * each write endpoint independently enforces its permission policy.
@@ -2485,6 +2744,7 @@ export const zBillingCapabilities = z.object({
2485
2744
  can_downgrade_to_personal: z.boolean(),
2486
2745
  can_invite_members: z.boolean(),
2487
2746
  can_reactivate: z.boolean(),
2747
+ can_revert_scheduled_change: z.boolean(),
2488
2748
  can_subscribe_self_serve: z.boolean(),
2489
2749
  can_top_up: z.boolean()
2490
2750
  });
@@ -2493,6 +2753,7 @@ export const zBillingCapabilities = z.object({
2493
2753
  */
2494
2754
  export const zBillingCapabilitiesResponse = z.object({
2495
2755
  capabilities: zBillingCapabilities,
2756
+ denied_reasons: zBillingCapabilityDenials.optional(),
2496
2757
  expires_at: z.string().datetime(),
2497
2758
  resolved_for: zBillingCapabilityScope,
2498
2759
  revision: z.coerce
@@ -2501,19 +2762,42 @@ export const zBillingCapabilitiesResponse = z.object({
2501
2762
  message: 'Invalid value: Expected int64 to be >= -9223372036854775808'
2502
2763
  })
2503
2764
  .lte(BigInt(9007199254740991)),
2504
- rollout_defaults_applied: zBillingCapabilityRolloutDefaults
2765
+ rollout_defaults_applied: zBillingCapabilityRolloutDefaults,
2766
+ subscription_state_authoritative: z.boolean().optional()
2505
2767
  });
2506
2768
  /**
2507
- * 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.
2508
2770
  */
2509
2771
  export const zBillingBalanceResponse = z.object({
2772
+ amount_cents: z.number().optional(),
2510
2773
  amount_micros: z.number(),
2774
+ cloud_credit_balance_cents: z.number().optional(),
2511
2775
  cloud_credit_balance_micros: z.number().optional(),
2512
2776
  currency: z.string(),
2777
+ effective_balance_authoritative: z.boolean().optional(),
2778
+ effective_balance_cents: z.number().optional(),
2513
2779
  effective_balance_micros: z.number().optional(),
2780
+ pending_charges_cents: z.number().optional(),
2514
2781
  pending_charges_micros: z.number().optional(),
2782
+ prepaid_balance_cents: z.number().optional(),
2515
2783
  prepaid_balance_micros: z.number().optional()
2516
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
+ });
2517
2801
  /**
2518
2802
  * Response returned when an existing asset is successfully updated.
2519
2803
  */
@@ -2563,7 +2847,7 @@ export const zAssetMetadataResponse = z.object({
2563
2847
  */
2564
2848
  export const zAssetDownloadResponse = z.object({
2565
2849
  message: z.string().optional(),
2566
- status: z.enum(['created', 'running', 'completed', 'failed']),
2850
+ status: z.enum(['created', 'running', 'completed', 'failed', 'cancelled']),
2567
2851
  task_id: z.string().uuid()
2568
2852
  });
2569
2853
  /**
@@ -2656,11 +2940,30 @@ export const zAgentRunMode = z.object({
2656
2940
  credit_limit: z.number().int().gte(1).lte(2147483647).nullable(),
2657
2941
  mode: z.enum(['ask_approval', 'auto', 'auto_limited'])
2658
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
+ ]);
2659
2959
  /**
2660
2960
  * A user turn posted to the agent.
2661
2961
  */
2662
2962
  export const zAgentPostMessageRequest = z.object({
2963
+ ask_kinds: z.array(zAgentAskKind).optional(),
2663
2964
  attachments: z.array(z.string()).optional(),
2965
+ client_id: z.string().optional(),
2966
+ client_message_id: z.string().max(128).optional(),
2664
2967
  content: z.string(),
2665
2968
  current_tab: z.string().optional(),
2666
2969
  current_tab_unbound: z.boolean().optional(),
@@ -2684,20 +2987,100 @@ export const zAgentPostMessageRequest = z.object({
2684
2987
  }))
2685
2988
  .optional()
2686
2989
  });
2990
+ export const zAgentAskOption = z.object({
2991
+ description: z.string().optional(),
2992
+ id: z.string(),
2993
+ label: z.string()
2994
+ });
2687
2995
  /**
2688
- * 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.
2689
2997
  */
2690
- export const zAgentPendingAsk = z.object({
2998
+ export const zAgentPendingAskBase = z.object({
2691
2999
  allow_other: z.boolean(),
2692
3000
  ask_id: z.string(),
2693
- context: z.record(z.unknown()).optional(),
2694
- kind: z.enum(['ask_user', 'run_approval']),
3001
+ kind: zAgentAskKind,
2695
3002
  max_selections: z.number().int(),
2696
3003
  message_id: z.string(),
2697
3004
  min_selections: z.number().int(),
2698
- options: z.array(z.record(z.unknown())),
3005
+ options: z.array(zAgentAskOption),
2699
3006
  prompt: z.string()
2700
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
+ ]);
2701
3084
  /**
2702
3085
  * A persisted message in an agent thread.
2703
3086
  */
@@ -2716,6 +3099,13 @@ export const zAgentMessage = z.object({
2716
3099
  turn_id: z.string(),
2717
3100
  workflow_id: z.string().optional()
2718
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
+ });
2719
3109
  /**
2720
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.
2721
3111
  */
@@ -2729,12 +3119,67 @@ export const zAgentDraftSnapshot = z.object({
2729
3119
  content: z.record(z.unknown()),
2730
3120
  version: z.number().int()
2731
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
+ });
2732
3130
  /**
2733
3131
  * Acknowledgement that a turn cancellation was requested. Cancellation is asynchronous; the terminal message state (status=error with stop copy) arrives over the WebSocket.
2734
3132
  */
2735
3133
  export const zAgentCancelAccepted = z.object({
2736
3134
  status: z.enum(['cancelling'])
2737
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
+ });
2738
3183
  /**
2739
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.
2740
3185
  */
@@ -2743,9 +3188,11 @@ export const zAgentAnswerRequest = z.object({
2743
3188
  selected: z.array(z.string())
2744
3189
  });
2745
3190
  /**
2746
- * 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.
2747
3192
  */
2748
3193
  export const zAgentAnswerAccepted = z.object({
3194
+ other_text: z.string().optional(),
3195
+ selected: z.array(z.string()),
2749
3196
  status: z.enum(['answered'])
2750
3197
  });
2751
3198
  /**
@@ -2862,6 +3309,14 @@ export const zAgentGetDraftQuery = z.object({
2862
3309
  * Current draft snapshot
2863
3310
  */
2864
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;
2865
3320
  export const zAgentLlmAdmitBody = z.object({
2866
3321
  message_id: z.string().optional(),
2867
3322
  step: z.number().int().gte(0),
@@ -2885,6 +3340,14 @@ export const zAgentLlmMessagesBody = z.record(z.unknown());
2885
3340
  * The upstream LLM response, streamed back as Server-Sent Events (text/event-stream) chunk-by-chunk.
2886
3341
  */
2887
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();
2888
3351
  /**
2889
3352
  * The caller's run mode (the saved choice, or the default).
2890
3353
  */
@@ -3166,6 +3629,11 @@ export const zGetAssetTagHistogramQuery = z.object({
3166
3629
  * Success - Tag histogram returned
3167
3630
  */
3168
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;
3169
3637
  export const zCreateDesktopLoginCodeBody = zDesktopLoginCodeCreateRequest;
3170
3638
  /**
3171
3639
  * Login code created
@@ -3197,6 +3665,13 @@ export const zCreateSessionResponse2 = zCreateSessionResponse;
3197
3665
  * Every session ended
3198
3666
  */
3199
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;
3200
3675
  export const zExchangeTokenBody = zExchangeTokenRequest;
3201
3676
  /**
3202
3677
  * Token exchanged successfully
@@ -3243,6 +3718,13 @@ export const zGetBillingOpStatusPath = z.object({
3243
3718
  * Billing operation status
3244
3719
  */
3245
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;
3246
3728
  /**
3247
3729
  * Saved payment methods
3248
3730
  */
@@ -3261,6 +3743,20 @@ export const zPreviewSubscribeBody = zPreviewSubscribeRequest;
3261
3743
  * Subscription preview
3262
3744
  */
3263
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;
3264
3760
  /**
3265
3761
  * Billing status
3266
3762
  */
@@ -3280,6 +3776,11 @@ export const zResubscribeBody = zResubscribeRequest;
3280
3776
  * Subscription resumed successfully
3281
3777
  */
3282
3778
  export const zResubscribeResponse2 = zResubscribeResponse;
3779
+ export const zRevertScheduledChangeBody = zRevertScheduledChangeRequest;
3780
+ /**
3781
+ * Revert accepted
3782
+ */
3783
+ export const zRevertScheduledChangeResponse2 = zRevertScheduledChangeResponse;
3283
3784
  export const zCreateTopupBody = zCreateTopupRequest;
3284
3785
  /**
3285
3786
  * Top-up initiated successfully
@@ -3297,7 +3798,7 @@ export const zCreateTopupQuoteBody = zCreateTopupQuoteRequest;
3297
3798
  export const zCreateTopupQuoteResponse = zTopupQuoteResponse;
3298
3799
  export const zGetBillingUsageTimeSeriesQuery = z.object({
3299
3800
  group_by: z
3300
- .enum(['model', 'endpoint', 'product'])
3801
+ .enum(['model', 'endpoint', 'product', 'product_line', 'person', 'source'])
3301
3802
  .optional()
3302
3803
  .default('model'),
3303
3804
  granularity: z.enum(['hour', 'day', 'month']).optional().default('month'),
@@ -3340,7 +3841,21 @@ export const zGetExtensionsResponse = z.array(z.string());
3340
3841
  * Success
3341
3842
  */
3342
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'),
3343
3857
  billing_web_url: z.string().optional(),
3858
+ can_run_partner_nodes: z.boolean().optional(),
3344
3859
  free_tier_balance: z
3345
3860
  .object({
3346
3861
  allowance: z.number().int(),
@@ -3348,7 +3863,15 @@ export const zGetFeaturesResponse = z.object({
3348
3863
  used: z.number().int()
3349
3864
  })
3350
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(),
3351
3872
  max_upload_size: z.number().int().optional(),
3873
+ new_free_tier_subscriptions: z.boolean().optional(),
3874
+ sso_enabled: z.boolean().optional(),
3352
3875
  stripe_publishable_key: z.string().optional(),
3353
3876
  supports_preview_metadata: z.boolean().optional(),
3354
3877
  web_session_probe: z.boolean().optional()
@@ -3591,6 +4114,9 @@ export const zGetLegacyModelsByFolderPath = z.object({
3591
4114
  * Success - Node replacement mappings
3592
4115
  */
3593
4116
  export const zGetNodeReplacementsResponse = z.record(z.unknown());
4117
+ export const zGetNodeInfoQuery = z.object({
4118
+ include_user_models: z.boolean().optional().default(false)
4119
+ });
3594
4120
  /**
3595
4121
  * Success
3596
4122
  */
@@ -3722,6 +4248,13 @@ export const zListTasksQuery = z.object({
3722
4248
  * Success - Tasks retrieved
3723
4249
  */
3724
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();
3725
4258
  export const zGetTaskPath = z.object({
3726
4259
  task_id: z.string().uuid()
3727
4260
  });