@melius-ai/cli 0.15.2 → 0.15.4

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.
@@ -12,7 +12,11 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
12
12
  throw Error('Dynamic require of "' + x + '" is not supported');
13
13
  });
14
14
  var __commonJS = (cb, mod) => function __require2() {
15
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ try {
16
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
+ } catch (e) {
18
+ throw mod = 0, e;
19
+ }
16
20
  };
17
21
  var __export = (target, all) => {
18
22
  for (var name in all)
@@ -8200,6 +8204,16 @@ var ImportUploadcareFileBodySchema = external_exports.object({
8200
8204
  var ImportUploadcareFileResponseSchema = external_exports.object({
8201
8205
  file: FileCardSchema
8202
8206
  });
8207
+ var MAX_GOOGLE_DRIVE_FILE_ID_LENGTH = 512;
8208
+ var MAX_GOOGLE_DRIVE_ACCESS_TOKEN_LENGTH = 4096;
8209
+ var ImportGoogleDriveFileBodySchema = external_exports.object({
8210
+ driveFileId: external_exports.string().min(1).max(MAX_GOOGLE_DRIVE_FILE_ID_LENGTH),
8211
+ accessToken: external_exports.string().min(1).max(MAX_GOOGLE_DRIVE_ACCESS_TOKEN_LENGTH).optional(),
8212
+ folderId: external_exports.string().uuid().nullable().optional()
8213
+ });
8214
+ var ImportGoogleDriveFileResponseSchema = external_exports.object({
8215
+ file: FileCardSchema
8216
+ });
8203
8217
  var UploadcareUploadSignatureResponseSchema = external_exports.object({
8204
8218
  signature: external_exports.string(),
8205
8219
  /** Unix seconds, as a string — the exact bytes that were signed. */
@@ -11146,7 +11160,16 @@ var CanvasResponseSchema = external_exports.object({
11146
11160
  createdByUserId: external_exports.string().uuid().nullable(),
11147
11161
  previewAssets: external_exports.array(PreviewAssetSchema),
11148
11162
  createdAt: external_exports.string().datetime(),
11149
- updatedAt: external_exports.string().datetime()
11163
+ updatedAt: external_exports.string().datetime(),
11164
+ /**
11165
+ * Present and `true` only for a canvas the product owns rather than the
11166
+ * member — Cast's generation canvases. Ordinary canvases omit it, so a
11167
+ * client built before this field reads every canvas the way it always did.
11168
+ *
11169
+ * Only a Melius account is ever shown one at all; this is what lets the
11170
+ * surface say so rather than passing it off as the member's own work.
11171
+ */
11172
+ isSystem: external_exports.boolean().optional()
11150
11173
  });
11151
11174
  var CanvasVersionFavoriteSchema = external_exports.object({
11152
11175
  nodeId: external_exports.string().uuid(),
@@ -11472,13 +11495,17 @@ var EdgeResponseSchema = external_exports.object({
11472
11495
  });
11473
11496
  var PinnedModelSchema = external_exports.object({
11474
11497
  model: external_exports.string(),
11475
- mode: external_exports.string().optional()
11498
+ mode: external_exports.string().optional(),
11499
+ /** Speed tier of the pinned row; absent names the model's standard speed. */
11500
+ tier: external_exports.string().nullable().optional()
11476
11501
  });
11477
11502
  var pinnedModelsField = external_exports.array(PinnedModelSchema).max(MAX_PINNED_MODELS).optional();
11478
11503
  var CanvasMediaPresetSchema = external_exports.object({
11479
11504
  image: external_exports.object({
11480
11505
  model: external_exports.string().optional(),
11481
11506
  mode: external_exports.string().optional(),
11507
+ /** Speed tier of the default row; absent names the standard speed. */
11508
+ tier: external_exports.string().nullable().optional(),
11482
11509
  pinnedModels: pinnedModelsField,
11483
11510
  aspectRatio: OutputAspectRatioSchema.optional(),
11484
11511
  resolution: OutputResolutionSchema.optional(),
@@ -11488,6 +11515,8 @@ var CanvasMediaPresetSchema = external_exports.object({
11488
11515
  video: external_exports.object({
11489
11516
  model: external_exports.string().optional(),
11490
11517
  mode: external_exports.string().optional(),
11518
+ /** Speed tier of the default row; absent names the standard speed. */
11519
+ tier: external_exports.string().nullable().optional(),
11491
11520
  pinnedModels: pinnedModelsField,
11492
11521
  aspectRatio: OutputAspectRatioSchema.optional(),
11493
11522
  resolution: OutputResolutionSchema.optional(),
@@ -11498,6 +11527,8 @@ var CanvasMediaPresetSchema = external_exports.object({
11498
11527
  text: external_exports.object({
11499
11528
  model: external_exports.string().optional(),
11500
11529
  mode: external_exports.string().optional(),
11530
+ /** Speed tier of the default row; absent names the standard speed. */
11531
+ tier: external_exports.string().nullable().optional(),
11501
11532
  pinnedModels: pinnedModelsField,
11502
11533
  fast: external_exports.boolean().optional(),
11503
11534
  numVariations: external_exports.number().int().min(1).max(MAX_VARIATIONS).optional()
@@ -11505,6 +11536,8 @@ var CanvasMediaPresetSchema = external_exports.object({
11505
11536
  audio: external_exports.object({
11506
11537
  model: external_exports.string().optional(),
11507
11538
  mode: external_exports.string().optional(),
11539
+ /** Speed tier of the default row; absent names the standard speed. */
11540
+ tier: external_exports.string().nullable().optional(),
11508
11541
  pinnedModels: pinnedModelsField,
11509
11542
  /** Default ElevenLabs stock voice id (text-to-speech / voice changer). */
11510
11543
  voiceId: external_exports.string().optional(),
@@ -13408,250 +13441,568 @@ var AssetDownloadResponseSchema = external_exports.object({
13408
13441
  filename: external_exports.string()
13409
13442
  });
13410
13443
 
13411
- // ../api-contract/src/files/routes.ts
13412
- var c6 = initContract();
13413
- var filesContract = c6.router({
13414
- createFileFolder: {
13415
- method: "POST",
13416
- path: "/files/folders",
13417
- body: CreateFileFolderBodySchema,
13418
- responses: {
13419
- 201: FileFolderResponseSchema,
13420
- 403: ErrorBodySchema,
13421
- 404: ErrorBodySchema
13422
- },
13423
- summary: "Create a Files folder"
13424
- },
13425
- listFileFolders: {
13426
- method: "GET",
13427
- path: "/files/folders",
13428
- responses: {
13429
- 200: FileFolderListResponseSchema,
13430
- 403: ErrorBodySchema
13431
- },
13432
- summary: "List team Files folders"
13433
- },
13434
- updateFileFolder: {
13435
- method: "PATCH",
13436
- path: "/files/folders/:folderId",
13437
- pathParams: FileFolderIdParamsSchema,
13438
- body: UpdateFileFolderBodySchema,
13439
- responses: {
13440
- 200: FileFolderResponseSchema,
13441
- 403: ErrorBodySchema,
13442
- 404: ErrorBodySchema,
13443
- 409: ErrorBodySchema
13444
- },
13445
- summary: "Update a Files folder"
13446
- },
13447
- deleteFileFolder: {
13448
- method: "DELETE",
13449
- path: "/files/folders/:folderId",
13450
- pathParams: FileFolderIdParamsSchema,
13451
- body: null,
13452
- responses: {
13453
- 204: c6.noBody(),
13454
- 403: ErrorBodySchema
13455
- },
13456
- summary: "Delete a Files folder"
13457
- },
13458
- listAssetTags: {
13459
- method: "GET",
13460
- path: "/files/tags",
13461
- responses: {
13462
- 200: AssetTagListResponseSchema,
13463
- 403: ErrorBodySchema
13464
- },
13465
- summary: "List team asset tags"
13466
- },
13467
- createAssetTag: {
13468
- method: "POST",
13469
- path: "/files/tags",
13470
- body: CreateAssetTagBodySchema,
13471
- responses: {
13472
- 201: AssetTagResponseSchema,
13473
- 403: ErrorBodySchema,
13474
- 409: ErrorBodySchema
13475
- },
13476
- summary: "Create an asset tag"
13477
- },
13478
- updateAssetTag: {
13479
- method: "PATCH",
13480
- path: "/files/tags/:tagId",
13481
- pathParams: AssetTagIdParamsSchema,
13482
- body: UpdateAssetTagBodySchema,
13483
- responses: {
13484
- 200: AssetTagResponseSchema,
13485
- 403: ErrorBodySchema,
13486
- 404: ErrorBodySchema,
13487
- 409: ErrorBodySchema
13488
- },
13489
- summary: "Rename or recolor an asset tag"
13490
- },
13491
- deleteAssetTag: {
13492
- method: "DELETE",
13493
- path: "/files/tags/:tagId",
13494
- pathParams: AssetTagIdParamsSchema,
13495
- body: null,
13496
- responses: {
13497
- 204: c6.noBody(),
13498
- 403: ErrorBodySchema,
13499
- 404: ErrorBodySchema
13500
- },
13501
- summary: "Delete an asset tag"
13502
- },
13503
- addAssetTag: {
13504
- method: "POST",
13505
- path: "/files/:assetId/tags",
13506
- pathParams: FileAssetIdParamsSchema,
13507
- body: AssetTagAssignmentBodySchema,
13508
- responses: {
13509
- 200: FileCardSchema,
13510
- 403: ErrorBodySchema,
13511
- 404: ErrorBodySchema
13512
- },
13513
- summary: "Add a tag to a file"
13514
- },
13515
- removeAssetTag: {
13516
- method: "DELETE",
13517
- path: "/files/:assetId/tags/:tagId",
13518
- pathParams: FileAssetTagParamsSchema,
13519
- body: null,
13520
- responses: {
13521
- 200: FileCardSchema,
13522
- 403: ErrorBodySchema,
13523
- 404: ErrorBodySchema
13524
- },
13525
- summary: "Remove a tag from a file"
13526
- },
13527
- bulkAddAssetTag: {
13528
- method: "POST",
13529
- path: "/files/bulk/tag",
13530
- body: BulkAssetTagBodySchema,
13531
- responses: {
13532
- 200: BulkFileActionResponseSchema,
13533
- 403: ErrorBodySchema,
13534
- 404: ErrorBodySchema
13535
- },
13536
- summary: "Add a tag to files"
13537
- },
13538
- bulkRemoveAssetTag: {
13539
- method: "POST",
13540
- path: "/files/bulk/untag",
13541
- body: BulkAssetTagBodySchema,
13542
- responses: {
13543
- 200: BulkFileActionResponseSchema,
13544
- 403: ErrorBodySchema,
13545
- 404: ErrorBodySchema
13546
- },
13547
- summary: "Remove a tag from files"
13548
- },
13549
- bulkMoveFiles: {
13550
- method: "POST",
13551
- path: "/files/bulk/move",
13552
- body: BulkMoveFilesBodySchema,
13553
- responses: {
13554
- 200: BulkFileActionResponseSchema,
13555
- 403: ErrorBodySchema,
13556
- 404: ErrorBodySchema
13557
- },
13558
- summary: "Move files to a folder"
13559
- },
13560
- moveFile: {
13561
- method: "POST",
13562
- path: "/files/:assetId/move",
13563
- pathParams: FileAssetIdParamsSchema,
13564
- body: MoveFileBodySchema,
13565
- responses: {
13566
- 200: FileCardSchema,
13567
- 403: ErrorBodySchema,
13568
- 404: ErrorBodySchema
13569
- },
13570
- summary: "Move a file to a folder"
13571
- },
13572
- renameFile: {
13573
- method: "PATCH",
13574
- path: "/files/:assetId/name",
13575
- pathParams: FileAssetIdParamsSchema,
13576
- body: RenameFileBodySchema,
13577
- responses: {
13578
- 200: FileCardSchema,
13579
- 403: ErrorBodySchema,
13580
- 404: ErrorBodySchema
13581
- },
13582
- summary: "Rename a file"
13583
- },
13584
- bulkDownloadFiles: {
13585
- method: "POST",
13586
- path: "/files/bulk/download",
13587
- body: BulkDownloadFilesBodySchema,
13588
- responses: {
13589
- 200: BulkDownloadFilesResponseSchema,
13590
- 403: ErrorBodySchema,
13591
- 404: ErrorBodySchema
13592
- },
13593
- summary: "Download files and folders as a zip archive"
13594
- },
13595
- bulkHideFiles: {
13596
- method: "POST",
13597
- path: "/files/bulk/hide",
13598
- body: BulkHideFilesBodySchema,
13599
- responses: {
13600
- 200: BulkFileActionResponseSchema,
13601
- 403: ErrorBodySchema,
13602
- 404: ErrorBodySchema
13603
- },
13604
- summary: "Hide files from Files"
13605
- },
13606
- bulkDeleteFiles: {
13607
- method: "POST",
13608
- path: "/files/bulk/delete",
13609
- body: BulkDeleteFilesBodySchema,
13610
- responses: {
13611
- 200: BulkFileActionResponseSchema,
13612
- 403: ErrorBodySchema,
13613
- 404: ErrorBodySchema
13614
- },
13615
- summary: "Delete files from Files"
13616
- },
13617
- hideFile: {
13618
- method: "POST",
13619
- path: "/files/:assetId/hide",
13620
- pathParams: FileAssetIdParamsSchema,
13621
- body: null,
13622
- responses: {
13623
- 204: c6.noBody(),
13624
- 403: ErrorBodySchema,
13625
- 404: ErrorBodySchema
13626
- },
13627
- summary: "Hide a file from Files"
13628
- },
13629
- deleteFile: {
13630
- method: "DELETE",
13631
- path: "/files/:assetId",
13632
- pathParams: FileAssetIdParamsSchema,
13633
- body: null,
13634
- responses: {
13635
- 204: c6.noBody(),
13636
- 403: ErrorBodySchema,
13637
- 404: ErrorBodySchema
13638
- },
13639
- summary: "Delete a file from Files"
13640
- },
13641
- bulkUnhideFiles: {
13642
- method: "POST",
13643
- path: "/files/bulk/unhide",
13644
- body: BulkUnhideFilesBodySchema,
13645
- responses: {
13646
- 200: BulkFileActionResponseSchema,
13647
- 403: ErrorBodySchema,
13648
- 404: ErrorBodySchema
13649
- },
13650
- summary: "Restore files hidden from Files"
13651
- },
13652
- unhideFile: {
13653
- method: "POST",
13654
- path: "/files/:assetId/unhide",
13444
+ // ../pricing/src/plan-ids.ts
13445
+ var TEAM_PLAN_IDS = [
13446
+ "TIER_0",
13447
+ "TIER_1",
13448
+ "TIER_2",
13449
+ "TIER_3",
13450
+ "TIER_4"
13451
+ ];
13452
+ var CUSTOM_PLAN_TYPE_IDS = ["enterprise", "creative_partner"];
13453
+
13454
+ // ../pricing/src/credit-top-up.ts
13455
+ var MELIUS_CREDITS_PER_USD = 1e3;
13456
+ var CENTS_PER_USD = 100;
13457
+ var CREDITS_PER_USD_CENT = MELIUS_CREDITS_PER_USD / CENTS_PER_USD;
13458
+ var MAX_CREDIT_TOP_UP_DISCOUNT_PERCENTAGE = 90;
13459
+
13460
+ // ../api-contract/src/team/schema.ts
13461
+ var TeamRoleSchema = external_exports.enum(["owner", "admin", "editor", "viewer"]);
13462
+ var TeamPlanSchema = external_exports.enum(TEAM_PLAN_IDS);
13463
+ var ResolvedTeamSchema = external_exports.object({
13464
+ teamId: external_exports.string().uuid(),
13465
+ role: TeamRoleSchema
13466
+ });
13467
+ var CustomPlanTypeSchema = external_exports.enum(CUSTOM_PLAN_TYPE_IDS);
13468
+ var InviteLinkRoleSchema = external_exports.enum(["admin", "editor", "viewer"]);
13469
+ var EnterpriseOrderLineItemSchema = external_exports.object({
13470
+ description: external_exports.string().min(1),
13471
+ quantity: external_exports.string().min(1),
13472
+ unitPrice: external_exports.string().min(1),
13473
+ total: external_exports.string().min(1)
13474
+ });
13475
+ var EnterpriseBillingIntervalSchema = external_exports.enum(["monthly", "annual"]);
13476
+ var EnterpriseAllowedPaymentMethodsSchema = external_exports.enum([
13477
+ "card_and_bank",
13478
+ "bank_only",
13479
+ "card_only"
13480
+ ]);
13481
+ var EnterpriseStripeBillingInputSchema = external_exports.object({
13482
+ unitAmount: external_exports.number().int().positive(),
13483
+ // Expose the transform output to OpenAPI generation.
13484
+ currency: external_exports.string().length(3).transform((value) => value.toLowerCase()).pipe(external_exports.string()),
13485
+ billingInterval: EnterpriseBillingIntervalSchema,
13486
+ creditsPerPeriod: external_exports.number().int().positive(),
13487
+ allowedPaymentMethods: EnterpriseAllowedPaymentMethodsSchema.optional(),
13488
+ contractEndAt: external_exports.string().datetime().optional(),
13489
+ /**
13490
+ * Whether the term rolls into another of the same length instead of
13491
+ * ending. Only meaningful alongside a `contractEndAt`. Absent means off,
13492
+ * which is what a plan created before this field gets; new plans send it
13493
+ * explicitly rather than the resolver defaulting to on, so existing
13494
+ * contracts keep their current behavior.
13495
+ */
13496
+ autoRenew: external_exports.boolean().optional()
13497
+ }).refine(
13498
+ (input) => input.billingInterval !== "annual" || input.contractEndAt != null,
13499
+ {
13500
+ message: "contractEndAt is required for annual billing",
13501
+ path: ["contractEndAt"]
13502
+ }
13503
+ );
13504
+ var CustomPlanCreditRolloverPolicySchema = external_exports.discriminatedUnion(
13505
+ "mode",
13506
+ [
13507
+ external_exports.object({ mode: external_exports.literal("none") }),
13508
+ external_exports.object({ mode: external_exports.literal("unlimited") }),
13509
+ external_exports.object({
13510
+ mode: external_exports.literal("months"),
13511
+ months: external_exports.number().int().nonnegative()
13512
+ }),
13513
+ external_exports.object({
13514
+ mode: external_exports.literal("percentage"),
13515
+ percentage: external_exports.number().int().min(0).max(100)
13516
+ })
13517
+ ]
13518
+ );
13519
+ var EnterpriseOrderDetailsSchema = external_exports.object({
13520
+ orderType: external_exports.string().min(1),
13521
+ customPlanType: CustomPlanTypeSchema.optional(),
13522
+ creditPackageAmount: external_exports.number().int().nonnegative(),
13523
+ creditPackageUnit: external_exports.string().min(1),
13524
+ creditRolloverPolicy: CustomPlanCreditRolloverPolicySchema.optional(),
13525
+ /**
13526
+ * Whole percent off the standard per-credit rate for top-ups beyond the
13527
+ * plan's allowance. Absent means the standard rate. Unlike the rest of the
13528
+ * order details this is not presentational — checkout, the Stripe grant and
13529
+ * the receipt all price against it (see `@repo/pricing/credit-top-up`).
13530
+ */
13531
+ creditTopUpDiscountPercentage: external_exports.number().int().min(1).max(MAX_CREDIT_TOP_UP_DISCOUNT_PERCENTAGE).optional(),
13532
+ orderDate: external_exports.string().date(),
13533
+ /** Omit for plans with no fixed contract term (e.g. monthly Stripe plans). */
13534
+ termCount: external_exports.number().int().positive().optional(),
13535
+ termUnit: external_exports.string().min(1).optional(),
13536
+ lineItems: external_exports.array(EnterpriseOrderLineItemSchema),
13537
+ totalContractValue: external_exports.string().min(1)
13538
+ });
13539
+ var EnterprisePendingExpansionSchema = external_exports.object({
13540
+ /** Stable id minted at prepare; also the credit-grant idempotency key. */
13541
+ id: external_exports.string(),
13542
+ newUnitAmount: external_exports.number().int().positive(),
13543
+ newCreditsPerPeriod: external_exports.number().int().positive(),
13544
+ newStripePriceId: external_exports.string().min(1),
13545
+ /** Flat catch-up = new unit amount − current unit amount. Negative when the update lowers the rate; nothing is charged then. */
13546
+ deltaAmountCents: external_exports.number().int(),
13547
+ /** Credits granted on activation = new − current credits per period. Negative when the update lowers the allotment; nothing is granted or clawed back then. */
13548
+ deltaCredits: external_exports.number().int(),
13549
+ /** New contract end when the operator chose a new term; absent means keep the existing term. */
13550
+ contractEndAt: external_exports.string().datetime().optional(),
13551
+ keepContractEnd: external_exports.boolean(),
13552
+ /**
13553
+ * Operator-authored replacement order details (line items, total contract
13554
+ * value, credit package, term) applied to the stored order when the customer
13555
+ * activates. Absent keeps the existing terms. Purely presentational — the
13556
+ * actual charge/credits come from the billing figures above.
13557
+ */
13558
+ newOrderDetails: EnterpriseOrderDetailsSchema.optional(),
13559
+ preparedAt: external_exports.string().datetime(),
13560
+ preparedByEmail: external_exports.string().nullable()
13561
+ });
13562
+ var EnterprisePendingRenewalSchema = external_exports.object({
13563
+ id: external_exports.string(),
13564
+ newUnitAmount: external_exports.number().int().positive(),
13565
+ newCreditsPerPeriod: external_exports.number().int().positive(),
13566
+ newStripePriceId: external_exports.string().min(1),
13567
+ /** Length of the renewal term in monthly billing periods. */
13568
+ newTermMonths: external_exports.number().int().positive(),
13569
+ newContractEndAt: external_exports.string().datetime(),
13570
+ /** Operator-authored replacement order details. Purely presentational. */
13571
+ newOrderDetails: EnterpriseOrderDetailsSchema.optional(),
13572
+ preparedAt: external_exports.string().datetime(),
13573
+ preparedByEmail: external_exports.string().nullable()
13574
+ });
13575
+ var EnterpriseStripeBillingSchema = external_exports.object({
13576
+ unitAmount: external_exports.number().int().positive(),
13577
+ // Expose the transform output to OpenAPI generation.
13578
+ currency: external_exports.string().length(3).transform((value) => value.toLowerCase()).pipe(external_exports.string()),
13579
+ billingInterval: EnterpriseBillingIntervalSchema,
13580
+ creditsPerPeriod: external_exports.number().int().positive(),
13581
+ allowedPaymentMethods: EnterpriseAllowedPaymentMethodsSchema.optional(),
13582
+ contractEndAt: external_exports.string().datetime().optional(),
13583
+ /**
13584
+ * Whether the contract rolls into another term of the same length at
13585
+ * `contractEndAt` instead of ending. Only meaningful alongside a
13586
+ * `contractEndAt`; a plan with no fixed term already renews indefinitely.
13587
+ * Absent means off, so a plan created before this field keeps ending at its
13588
+ * contract end. Read it through `resolveEnterpriseAutoRenew`.
13589
+ */
13590
+ autoRenew: external_exports.boolean().optional(),
13591
+ stripePriceId: external_exports.string().min(1),
13592
+ activatedAt: external_exports.string().datetime().optional(),
13593
+ activatedByEmail: external_exports.string().nullable().optional(),
13594
+ paymentMethodType: external_exports.enum(["card", "us_bank_account"]).optional(),
13595
+ firstPaymentSettledAt: external_exports.string().datetime().optional(),
13596
+ pendingExpansion: EnterprisePendingExpansionSchema.optional(),
13597
+ pendingRenewal: EnterprisePendingRenewalSchema.optional(),
13598
+ /** Stripe subscription schedule driving a prepared renewal, while attached. */
13599
+ stripeScheduleId: external_exports.string().min(1).optional()
13600
+ });
13601
+ var CustomerEnterpriseStripeBillingSchema = EnterpriseStripeBillingSchema.omit({
13602
+ activatedAt: true,
13603
+ activatedByEmail: true,
13604
+ allowedPaymentMethods: true,
13605
+ paymentMethodType: true,
13606
+ firstPaymentSettledAt: true,
13607
+ // Operator-only; the customer reads a pending expansion through the
13608
+ // dedicated preview endpoint, which excludes operator emails.
13609
+ pendingExpansion: true,
13610
+ // Same reason — it carries the preparing operator's email.
13611
+ pendingRenewal: true,
13612
+ stripeScheduleId: true
13613
+ });
13614
+ var EnterpriseStripeBillingAuditActionSchema = external_exports.enum([
13615
+ "created",
13616
+ "mutated",
13617
+ "activated",
13618
+ "term_ended",
13619
+ "canceled"
13620
+ ]);
13621
+ var EnterpriseStripeBillingAuditEntrySchema = external_exports.object({
13622
+ at: external_exports.string().datetime(),
13623
+ byEmail: external_exports.string().nullable(),
13624
+ action: EnterpriseStripeBillingAuditActionSchema,
13625
+ previousStripePriceId: external_exports.string().optional(),
13626
+ notes: external_exports.string().optional()
13627
+ });
13628
+ var EnterpriseOrderSchema = EnterpriseOrderDetailsSchema.extend({
13629
+ stripeBilling: EnterpriseStripeBillingInputSchema.optional()
13630
+ });
13631
+ var CustomerEnterpriseOrderSchema = EnterpriseOrderSchema.extend({
13632
+ stripeBilling: CustomerEnterpriseStripeBillingSchema.optional()
13633
+ });
13634
+ var CustomPlanCreditGrantScheduleSchema = external_exports.object({
13635
+ id: external_exports.string(),
13636
+ creditPackageAmount: external_exports.number().int().nonnegative(),
13637
+ creditPackageUnit: external_exports.string().min(1),
13638
+ grantStartDate: external_exports.string().date(),
13639
+ contractEndDate: external_exports.string().date(),
13640
+ /** Set when an amendment, pause, or revert ended this entry early. */
13641
+ effectiveEndDate: external_exports.string().date().optional(),
13642
+ createdAt: external_exports.string().datetime(),
13643
+ createdByEmail: external_exports.string().nullable()
13644
+ });
13645
+ var CustomPlanCreditGrantHistoryEntrySchema = external_exports.object({
13646
+ grantDate: external_exports.string().date(),
13647
+ amount: external_exports.number().int().nonnegative(),
13648
+ /** Billing event id once granted; null if scheduled but not yet processed. */
13649
+ billingEventId: external_exports.string().nullable(),
13650
+ /** How the credit grant landed once granted; null while scheduled. */
13651
+ billingSource: external_exports.enum(["custom_plan", "stripe"]).nullable(),
13652
+ /** Idempotency/source reference for the grant, e.g. custom schedule key or Stripe invoice/subscription reference. */
13653
+ billingReferenceId: external_exports.string().nullable(),
13654
+ /** ISO timestamp when the grant landed; null while still scheduled. */
13655
+ grantedAt: external_exports.string().datetime().nullable(),
13656
+ status: external_exports.enum(["granted", "scheduled"])
13657
+ });
13658
+ var InternalEnterpriseOrderSchema = EnterpriseOrderSchema.extend({
13659
+ updatedAt: external_exports.string().datetime(),
13660
+ updatedByEmail: external_exports.string().nullable(),
13661
+ creditGrantSchedule: external_exports.array(CustomPlanCreditGrantScheduleSchema),
13662
+ creditGrantHistory: external_exports.array(CustomPlanCreditGrantHistoryEntrySchema),
13663
+ nextGrantDate: external_exports.string().date().nullable(),
13664
+ stripeBilling: EnterpriseStripeBillingSchema.optional(),
13665
+ stripeBillingAuditLog: external_exports.array(EnterpriseStripeBillingAuditEntrySchema).optional()
13666
+ });
13667
+ var TeamAdvancedSettingsSchema = external_exports.object({
13668
+ negativePromptEnabled: external_exports.boolean().optional(),
13669
+ customSeedEnabled: external_exports.boolean().optional(),
13670
+ // Auto-approve join requests from signups whose email domain matches this
13671
+ // enterprise team's owner domain. Admin-governed via the dedicated
13672
+ // domain-join-settings endpoint, not the editor-facing advanced-settings write.
13673
+ domainJoinAutoApprove: external_exports.boolean().optional()
13674
+ // NOTE: the team's approval policy config also lives in this jsonb column,
13675
+ // but is deliberately NOT declared here — see `InternalTeamAdvancedSettings`
13676
+ // in `apps/core/nagi/team/team.mappers.ts`, the same treatment
13677
+ // `modelDiscounts` gets. Declaring it would publish the team's approver
13678
+ // list into the public OpenAPI surface, and would make it writable through
13679
+ // the editor-facing advanced-settings endpoint. It is read and written
13680
+ // only through the admin-gated approvals endpoints.
13681
+ });
13682
+ var DomainJoinTargetSchema = external_exports.object({
13683
+ teamId: external_exports.string().uuid(),
13684
+ teamName: external_exports.string(),
13685
+ teamPhotoUrl: external_exports.string().nullable(),
13686
+ alreadyRequested: external_exports.boolean()
13687
+ });
13688
+ var JoinRequestSchema = external_exports.object({
13689
+ id: external_exports.string().uuid(),
13690
+ userId: external_exports.string().uuid(),
13691
+ userName: external_exports.string(),
13692
+ userEmail: external_exports.string(),
13693
+ avatarUrl: external_exports.string().nullable(),
13694
+ createdAt: external_exports.string().datetime()
13695
+ });
13696
+ var ActiveProductFeatureOverrideSchema = external_exports.object({
13697
+ feature: external_exports.string().min(1),
13698
+ expiresAt: external_exports.string().datetime()
13699
+ });
13700
+ var ActivePlanPreviewSchema = external_exports.object({
13701
+ previewPlanTier: TeamPlanSchema,
13702
+ expiresAt: external_exports.string().datetime()
13703
+ });
13704
+ var TeamSchema = external_exports.object({
13705
+ id: external_exports.string().uuid(),
13706
+ name: external_exports.string(),
13707
+ plan: TeamPlanSchema,
13708
+ teamPhotoUrl: external_exports.string().nullable(),
13709
+ createdAt: external_exports.string().datetime(),
13710
+ creditExpiresAt: external_exports.string().datetime().nullable(),
13711
+ enterpriseOrder: CustomerEnterpriseOrderSchema.nullable(),
13712
+ advancedSettings: TeamAdvancedSettingsSchema,
13713
+ activeProductFeatureOverrides: external_exports.array(ActiveProductFeatureOverrideSchema).default([]),
13714
+ activePlanPreview: ActivePlanPreviewSchema.nullable().default(null)
13715
+ });
13716
+ var MemberSchema = external_exports.object({
13717
+ id: external_exports.string().uuid(),
13718
+ role: TeamRoleSchema,
13719
+ userId: external_exports.string().uuid(),
13720
+ userName: external_exports.string(),
13721
+ userEmail: external_exports.string(),
13722
+ avatarUrl: external_exports.string().nullable()
13723
+ });
13724
+ var TeamMembershipSchema = external_exports.object({
13725
+ id: external_exports.string().uuid(),
13726
+ role: TeamRoleSchema,
13727
+ team: TeamSchema
13728
+ });
13729
+ var InviteLinkSchema = external_exports.object({
13730
+ id: external_exports.string().uuid(),
13731
+ role: InviteLinkRoleSchema,
13732
+ token: external_exports.string(),
13733
+ createdAt: external_exports.string().datetime()
13734
+ });
13735
+ var EmailInviteStatusSchema = external_exports.enum(["pending", "accepted"]);
13736
+ var EmailInviteSchema = external_exports.object({
13737
+ id: external_exports.string().uuid(),
13738
+ email: external_exports.string(),
13739
+ role: InviteLinkRoleSchema,
13740
+ status: EmailInviteStatusSchema,
13741
+ senderName: external_exports.string(),
13742
+ createdAt: external_exports.string().datetime()
13743
+ });
13744
+
13745
+ // ../api-contract/src/files/routes.ts
13746
+ var c6 = initContract();
13747
+ var filesContract = c6.router({
13748
+ createFileFolder: {
13749
+ method: "POST",
13750
+ path: "/files/folders",
13751
+ body: CreateFileFolderBodySchema,
13752
+ responses: {
13753
+ 201: FileFolderResponseSchema,
13754
+ 403: ErrorBodySchema,
13755
+ 404: ErrorBodySchema
13756
+ },
13757
+ summary: "Create a Files folder"
13758
+ },
13759
+ listFileFolders: {
13760
+ method: "GET",
13761
+ path: "/files/folders",
13762
+ responses: {
13763
+ 200: FileFolderListResponseSchema,
13764
+ 403: ErrorBodySchema
13765
+ },
13766
+ summary: "List team Files folders"
13767
+ },
13768
+ // Maps a Files folder to its owning team for the current user. Deliberately
13769
+ // NOT team-scoped: a shared `/assets?folder=<id>` link is opened with
13770
+ // whatever team the recipient happens to have active, so the page resolves
13771
+ // the folder's team here and switches to it before listing (mirrors
13772
+ // resolveAssetTeam). 403 distinguishes "someone else's folder" from the
13773
+ // 404 of a deleted one, which is what lets the page tell the two apart.
13774
+ resolveFileFolderTeam: {
13775
+ method: "GET",
13776
+ path: "/files/folders/:folderId/team",
13777
+ pathParams: FileFolderIdParamsSchema,
13778
+ responses: {
13779
+ 200: ResolvedTeamSchema,
13780
+ 403: ErrorBodySchema,
13781
+ 404: ErrorBodySchema
13782
+ },
13783
+ summary: "Resolve a Files folder's owning team for the current user"
13784
+ },
13785
+ updateFileFolder: {
13786
+ method: "PATCH",
13787
+ path: "/files/folders/:folderId",
13788
+ pathParams: FileFolderIdParamsSchema,
13789
+ body: UpdateFileFolderBodySchema,
13790
+ responses: {
13791
+ 200: FileFolderResponseSchema,
13792
+ 403: ErrorBodySchema,
13793
+ 404: ErrorBodySchema,
13794
+ 409: ErrorBodySchema
13795
+ },
13796
+ summary: "Update a Files folder"
13797
+ },
13798
+ deleteFileFolder: {
13799
+ method: "DELETE",
13800
+ path: "/files/folders/:folderId",
13801
+ pathParams: FileFolderIdParamsSchema,
13802
+ body: null,
13803
+ responses: {
13804
+ 204: c6.noBody(),
13805
+ 403: ErrorBodySchema
13806
+ },
13807
+ summary: "Delete a Files folder"
13808
+ },
13809
+ listAssetTags: {
13810
+ method: "GET",
13811
+ path: "/files/tags",
13812
+ responses: {
13813
+ 200: AssetTagListResponseSchema,
13814
+ 403: ErrorBodySchema
13815
+ },
13816
+ summary: "List team asset tags"
13817
+ },
13818
+ createAssetTag: {
13819
+ method: "POST",
13820
+ path: "/files/tags",
13821
+ body: CreateAssetTagBodySchema,
13822
+ responses: {
13823
+ 201: AssetTagResponseSchema,
13824
+ 403: ErrorBodySchema,
13825
+ 409: ErrorBodySchema
13826
+ },
13827
+ summary: "Create an asset tag"
13828
+ },
13829
+ updateAssetTag: {
13830
+ method: "PATCH",
13831
+ path: "/files/tags/:tagId",
13832
+ pathParams: AssetTagIdParamsSchema,
13833
+ body: UpdateAssetTagBodySchema,
13834
+ responses: {
13835
+ 200: AssetTagResponseSchema,
13836
+ 403: ErrorBodySchema,
13837
+ 404: ErrorBodySchema,
13838
+ 409: ErrorBodySchema
13839
+ },
13840
+ summary: "Rename or recolor an asset tag"
13841
+ },
13842
+ deleteAssetTag: {
13843
+ method: "DELETE",
13844
+ path: "/files/tags/:tagId",
13845
+ pathParams: AssetTagIdParamsSchema,
13846
+ body: null,
13847
+ responses: {
13848
+ 204: c6.noBody(),
13849
+ 403: ErrorBodySchema,
13850
+ 404: ErrorBodySchema
13851
+ },
13852
+ summary: "Delete an asset tag"
13853
+ },
13854
+ addAssetTag: {
13855
+ method: "POST",
13856
+ path: "/files/:assetId/tags",
13857
+ pathParams: FileAssetIdParamsSchema,
13858
+ body: AssetTagAssignmentBodySchema,
13859
+ responses: {
13860
+ 200: FileCardSchema,
13861
+ 403: ErrorBodySchema,
13862
+ 404: ErrorBodySchema
13863
+ },
13864
+ summary: "Add a tag to a file"
13865
+ },
13866
+ removeAssetTag: {
13867
+ method: "DELETE",
13868
+ path: "/files/:assetId/tags/:tagId",
13869
+ pathParams: FileAssetTagParamsSchema,
13870
+ body: null,
13871
+ responses: {
13872
+ 200: FileCardSchema,
13873
+ 403: ErrorBodySchema,
13874
+ 404: ErrorBodySchema
13875
+ },
13876
+ summary: "Remove a tag from a file"
13877
+ },
13878
+ bulkAddAssetTag: {
13879
+ method: "POST",
13880
+ path: "/files/bulk/tag",
13881
+ body: BulkAssetTagBodySchema,
13882
+ responses: {
13883
+ 200: BulkFileActionResponseSchema,
13884
+ 403: ErrorBodySchema,
13885
+ 404: ErrorBodySchema
13886
+ },
13887
+ summary: "Add a tag to files"
13888
+ },
13889
+ bulkRemoveAssetTag: {
13890
+ method: "POST",
13891
+ path: "/files/bulk/untag",
13892
+ body: BulkAssetTagBodySchema,
13893
+ responses: {
13894
+ 200: BulkFileActionResponseSchema,
13895
+ 403: ErrorBodySchema,
13896
+ 404: ErrorBodySchema
13897
+ },
13898
+ summary: "Remove a tag from files"
13899
+ },
13900
+ bulkMoveFiles: {
13901
+ method: "POST",
13902
+ path: "/files/bulk/move",
13903
+ body: BulkMoveFilesBodySchema,
13904
+ responses: {
13905
+ 200: BulkFileActionResponseSchema,
13906
+ 403: ErrorBodySchema,
13907
+ 404: ErrorBodySchema
13908
+ },
13909
+ summary: "Move files to a folder"
13910
+ },
13911
+ moveFile: {
13912
+ method: "POST",
13913
+ path: "/files/:assetId/move",
13914
+ pathParams: FileAssetIdParamsSchema,
13915
+ body: MoveFileBodySchema,
13916
+ responses: {
13917
+ 200: FileCardSchema,
13918
+ 403: ErrorBodySchema,
13919
+ 404: ErrorBodySchema
13920
+ },
13921
+ summary: "Move a file to a folder"
13922
+ },
13923
+ renameFile: {
13924
+ method: "PATCH",
13925
+ path: "/files/:assetId/name",
13926
+ pathParams: FileAssetIdParamsSchema,
13927
+ body: RenameFileBodySchema,
13928
+ responses: {
13929
+ 200: FileCardSchema,
13930
+ 403: ErrorBodySchema,
13931
+ 404: ErrorBodySchema
13932
+ },
13933
+ summary: "Rename a file"
13934
+ },
13935
+ bulkDownloadFiles: {
13936
+ method: "POST",
13937
+ path: "/files/bulk/download",
13938
+ body: BulkDownloadFilesBodySchema,
13939
+ responses: {
13940
+ 200: BulkDownloadFilesResponseSchema,
13941
+ 403: ErrorBodySchema,
13942
+ 404: ErrorBodySchema
13943
+ },
13944
+ summary: "Download files and folders as a zip archive"
13945
+ },
13946
+ bulkHideFiles: {
13947
+ method: "POST",
13948
+ path: "/files/bulk/hide",
13949
+ body: BulkHideFilesBodySchema,
13950
+ responses: {
13951
+ 200: BulkFileActionResponseSchema,
13952
+ 403: ErrorBodySchema,
13953
+ 404: ErrorBodySchema
13954
+ },
13955
+ summary: "Hide files from Files"
13956
+ },
13957
+ bulkDeleteFiles: {
13958
+ method: "POST",
13959
+ path: "/files/bulk/delete",
13960
+ body: BulkDeleteFilesBodySchema,
13961
+ responses: {
13962
+ 200: BulkFileActionResponseSchema,
13963
+ 403: ErrorBodySchema,
13964
+ 404: ErrorBodySchema
13965
+ },
13966
+ summary: "Delete files from Files"
13967
+ },
13968
+ hideFile: {
13969
+ method: "POST",
13970
+ path: "/files/:assetId/hide",
13971
+ pathParams: FileAssetIdParamsSchema,
13972
+ body: null,
13973
+ responses: {
13974
+ 204: c6.noBody(),
13975
+ 403: ErrorBodySchema,
13976
+ 404: ErrorBodySchema
13977
+ },
13978
+ summary: "Hide a file from Files"
13979
+ },
13980
+ deleteFile: {
13981
+ method: "DELETE",
13982
+ path: "/files/:assetId",
13983
+ pathParams: FileAssetIdParamsSchema,
13984
+ body: null,
13985
+ responses: {
13986
+ 204: c6.noBody(),
13987
+ 403: ErrorBodySchema,
13988
+ 404: ErrorBodySchema
13989
+ },
13990
+ summary: "Delete a file from Files"
13991
+ },
13992
+ bulkUnhideFiles: {
13993
+ method: "POST",
13994
+ path: "/files/bulk/unhide",
13995
+ body: BulkUnhideFilesBodySchema,
13996
+ responses: {
13997
+ 200: BulkFileActionResponseSchema,
13998
+ 403: ErrorBodySchema,
13999
+ 404: ErrorBodySchema
14000
+ },
14001
+ summary: "Restore files hidden from Files"
14002
+ },
14003
+ unhideFile: {
14004
+ method: "POST",
14005
+ path: "/files/:assetId/unhide",
13655
14006
  pathParams: FileAssetIdParamsSchema,
13656
14007
  body: null,
13657
14008
  responses: {
@@ -13820,6 +14171,18 @@ var filesContract = c6.router({
13820
14171
  404: ErrorBodySchema
13821
14172
  },
13822
14173
  summary: "Import a file picked from a cloud source through Uploadcare"
14174
+ },
14175
+ importGoogleDriveFile: {
14176
+ method: "POST",
14177
+ path: "/files/import/google-drive",
14178
+ body: ImportGoogleDriveFileBodySchema,
14179
+ responses: {
14180
+ 200: ImportGoogleDriveFileResponseSchema,
14181
+ 400: ErrorBodySchema,
14182
+ 403: ErrorBodySchema,
14183
+ 404: ErrorBodySchema
14184
+ },
14185
+ summary: "Import a file the user picked from Google Drive"
13823
14186
  }
13824
14187
  });
13825
14188
 
@@ -14392,549 +14755,271 @@ var generationContract = c7.router({
14392
14755
  })
14393
14756
  }
14394
14757
  },
14395
- getGenerationsByWeek: {
14396
- method: "GET",
14397
- path: "/generation/generations-by-week",
14398
- query: external_exports.object({
14399
- weeks: external_exports.coerce.number().int().min(1).max(52).default(12)
14400
- }),
14401
- responses: {
14402
- 200: GetGenerationsByWeekResponseSchema
14403
- }
14404
- },
14405
- precheckSeedance: {
14406
- method: "POST",
14407
- path: "/generation/precheck-seedance",
14408
- body: SeedancePrecheckRequestSchema,
14409
- responses: {
14410
- 200: SeedancePrecheckResponseSchema
14411
- }
14412
- }
14413
- });
14414
-
14415
- // ../api-contract/src/presets/schema.ts
14416
- var TextNodeDataSchema = external_exports.object({
14417
- title: external_exports.string(),
14418
- mode: external_exports.string(),
14419
- prompt: external_exports.string(),
14420
- /** `getValidHandles` builds a text node's targets as `["text", ...this]`. */
14421
- supportedInputs: external_exports.array(external_exports.string()).optional()
14422
- });
14423
- var ImageNodeDataSchema = external_exports.object({
14424
- title: external_exports.string(),
14425
- src: external_exports.string().optional(),
14426
- mode: external_exports.string(),
14427
- aspectRatio: external_exports.string().optional(),
14428
- prompt: external_exports.string()
14429
- });
14430
- var VideoNodeDataSchema = external_exports.object({
14431
- title: external_exports.string(),
14432
- src: external_exports.string().optional(),
14433
- mode: external_exports.string(),
14434
- aspectRatio: external_exports.string().optional(),
14435
- duration: external_exports.string().optional(),
14436
- prompt: external_exports.string(),
14437
- /**
14438
- * Handle validation tests these by key PRESENCE (`hasModelCapabilityFlags`
14439
- * in `canvas-handles.ts`) and treats them as one family, so dropping any one
14440
- * key disables the whole model-flag branch rather than just that flag.
14441
- * Declared together for that reason, not because every preset sets all four.
14442
- */
14443
- modelSupportsEndImage: external_exports.boolean().optional(),
14444
- modelSupportsReferenceImage: external_exports.boolean().optional(),
14445
- modelSupportsOptionalStartImage: external_exports.boolean().optional(),
14446
- modelSupportsAudioInput: external_exports.boolean().optional()
14447
- });
14448
- var AudioNodeDataSchema = external_exports.object({
14449
- title: external_exports.string(),
14450
- src: external_exports.string().optional(),
14451
- mode: external_exports.string().optional(),
14452
- prompt: external_exports.string().optional(),
14453
- voiceId: external_exports.string().optional()
14454
- });
14455
- var FileNodeDataSchema = external_exports.object({
14456
- title: external_exports.string(),
14457
- src: external_exports.string().optional(),
14458
- mediaType: external_exports.enum(["image", "video"]),
14459
- /** Opts the preset viewer's file node into rendering an audio output. */
14460
- showAudioOutput: external_exports.boolean().optional()
14461
- });
14462
- var CustomTextNodeDataSchema = external_exports.object({
14463
- title: external_exports.string(),
14464
- generatedText: external_exports.string().optional()
14465
- });
14466
- var GroupNodeDataSchema = external_exports.object({
14467
- label: external_exports.string()
14468
- });
14469
- var SharedNodeFields = {
14470
- key: external_exports.string(),
14471
- width: external_exports.number().optional(),
14472
- height: external_exports.number().optional(),
14473
- column: external_exports.number().optional(),
14474
- x: external_exports.number().optional(),
14475
- y: external_exports.number().optional(),
14476
- autoModel: AutoModelConfigSchema.optional(),
14477
- parentKey: external_exports.string().optional()
14478
- };
14479
- var PresetNodeSchema = external_exports.discriminatedUnion("type", [
14480
- external_exports.object({
14481
- type: external_exports.literal("text"),
14482
- data: TextNodeDataSchema,
14483
- ...SharedNodeFields
14484
- }),
14485
- external_exports.object({
14486
- type: external_exports.literal("image"),
14487
- data: ImageNodeDataSchema,
14488
- ...SharedNodeFields
14489
- }),
14490
- external_exports.object({
14491
- type: external_exports.literal("video"),
14492
- data: VideoNodeDataSchema,
14493
- ...SharedNodeFields
14494
- }),
14495
- external_exports.object({
14496
- type: external_exports.literal("audio"),
14497
- data: AudioNodeDataSchema,
14498
- ...SharedNodeFields
14499
- }),
14500
- external_exports.object({
14501
- type: external_exports.literal("file"),
14502
- data: FileNodeDataSchema,
14503
- ...SharedNodeFields
14504
- }),
14505
- external_exports.object({
14506
- type: external_exports.literal("custom_text"),
14507
- data: CustomTextNodeDataSchema,
14508
- ...SharedNodeFields
14509
- }),
14510
- external_exports.object({
14511
- type: external_exports.literal("group"),
14512
- data: GroupNodeDataSchema,
14513
- ...SharedNodeFields
14514
- })
14515
- ]);
14516
- var PresetEdgeSchema = external_exports.object({
14517
- sourceKey: external_exports.string(),
14518
- targetKey: external_exports.string(),
14519
- handleId: external_exports.string(),
14520
- targetHandleId: external_exports.string().optional()
14521
- });
14522
- var PresetResponseSchema = external_exports.object({
14523
- id: external_exports.string(),
14524
- title: external_exports.string(),
14525
- groupLabel: external_exports.string(),
14526
- icon: external_exports.string(),
14527
- description: external_exports.string(),
14528
- nodes: external_exports.array(PresetNodeSchema),
14529
- edges: external_exports.array(PresetEdgeSchema)
14530
- });
14531
-
14532
- // ../api-contract/src/presets/routes.ts
14533
- var c8 = initContract();
14534
- var presetsContract = c8.router({
14535
- listPresets: {
14536
- method: "GET",
14537
- path: "/presets",
14538
- responses: {
14539
- 200: external_exports.object({
14540
- data: external_exports.array(PresetResponseSchema)
14541
- })
14542
- },
14543
- summary: "List available group presets"
14544
- }
14545
- });
14546
-
14547
- // ../api-contract/src/profile/schema.ts
14548
- var MagicResizeCustomResolutionSchema = external_exports.object({
14549
- width: external_exports.number().int().min(64).max(4096),
14550
- height: external_exports.number().int().min(64).max(4096)
14551
- });
14552
- var UserAdvancedSettingsSchema = external_exports.object({
14553
- seedancePrecheckEnabled: external_exports.boolean().optional(),
14554
- seedanceDurationWarningEnabled: external_exports.boolean().optional(),
14555
- // Pro view: hide a node's prompt until hovered, shown translucently over
14556
- // the media instead of below the node.
14557
- hideNodePromptsEnabled: external_exports.boolean().optional(),
14558
- magicResizeCustomResolutions: external_exports.array(MagicResizeCustomResolutionSchema).max(20).optional()
14559
- });
14560
- var ProfileUserSchema = external_exports.object({
14561
- id: external_exports.string().uuid(),
14562
- name: external_exports.string(),
14563
- email: external_exports.string(),
14564
- agentAutoRun: external_exports.boolean(),
14565
- // Set once the user answers the "how did you hear about us" intro. Marks
14566
- // the account-level onboarding as done, independently of the canvas
14567
- // product tour (`completedProductTour`).
14568
- signupSource: external_exports.string().nullable(),
14569
- completedProductTour: external_exports.string().datetime().nullable(),
14570
- avatarUrl: external_exports.string().nullable(),
14571
- advancedSettings: UserAdvancedSettingsSchema
14572
- });
14573
- var ProfileReferralInfoSchema = external_exports.object({
14574
- code: external_exports.string()
14575
- });
14576
- var ReferralRewardNotificationSchema = external_exports.object({
14577
- id: external_exports.string().uuid(),
14578
- kind: external_exports.enum(["referrer", "invitee"]),
14579
- counterpartName: external_exports.string(),
14580
- redeemedAt: external_exports.string().datetime()
14581
- });
14582
-
14583
- // ../api-contract/src/profile/routes.ts
14584
- var c9 = initContract();
14585
- var profileContract = c9.router({
14586
- getMyProfile: {
14587
- method: "GET",
14588
- path: "/profile/me",
14589
- responses: { 200: ProfileUserSchema }
14590
- },
14591
- getMyReferralInfo: {
14592
- method: "GET",
14593
- path: "/profile/referral",
14594
- responses: { 200: ProfileReferralInfoSchema }
14595
- },
14596
- getReferralRewards: {
14597
- method: "GET",
14598
- path: "/profile/referral/rewards",
14599
- responses: {
14600
- 200: external_exports.object({
14601
- rewards: external_exports.array(ReferralRewardNotificationSchema)
14602
- })
14603
- }
14604
- },
14605
- sendReferralInvite: {
14606
- method: "POST",
14607
- path: "/profile/referral/invite",
14608
- body: external_exports.object({
14609
- email: external_exports.string().email().max(320)
14610
- }),
14611
- responses: {
14612
- 200: external_exports.object({
14613
- result: external_exports.enum([
14614
- "sent",
14615
- "already_invited",
14616
- "already_has_account"
14617
- ])
14618
- })
14619
- }
14620
- },
14621
- updateMyProfile: {
14622
- method: "PATCH",
14623
- path: "/profile/me",
14624
- body: external_exports.object({
14625
- agentAutoRun: external_exports.boolean().optional(),
14626
- completedProductTour: external_exports.string().datetime().nullable().optional(),
14627
- avatarS3Bucket: external_exports.string().optional(),
14628
- avatarS3Key: external_exports.string().optional(),
14629
- signupSource: external_exports.string().min(1).max(200).optional()
14758
+ getGenerationsByWeek: {
14759
+ method: "GET",
14760
+ path: "/generation/generations-by-week",
14761
+ query: external_exports.object({
14762
+ weeks: external_exports.coerce.number().int().min(1).max(52).default(12)
14630
14763
  }),
14631
- responses: { 200: ProfileUserSchema }
14764
+ responses: {
14765
+ 200: GetGenerationsByWeekResponseSchema
14766
+ }
14632
14767
  },
14633
- updateAdvancedSettings: {
14634
- method: "PATCH",
14635
- path: "/profile/me/advanced-settings",
14636
- body: UserAdvancedSettingsSchema,
14768
+ precheckSeedance: {
14769
+ method: "POST",
14770
+ path: "/generation/precheck-seedance",
14771
+ body: SeedancePrecheckRequestSchema,
14637
14772
  responses: {
14638
- 200: external_exports.object({ advancedSettings: UserAdvancedSettingsSchema })
14773
+ 200: SeedancePrecheckResponseSchema
14639
14774
  }
14640
14775
  }
14641
14776
  });
14642
14777
 
14643
- // ../pricing/src/plan-ids.ts
14644
- var TEAM_PLAN_IDS = [
14645
- "TIER_0",
14646
- "TIER_1",
14647
- "TIER_2",
14648
- "TIER_3",
14649
- "TIER_4"
14650
- ];
14651
- var CUSTOM_PLAN_TYPE_IDS = ["enterprise", "creative_partner"];
14652
-
14653
- // ../pricing/src/credit-top-up.ts
14654
- var MELIUS_CREDITS_PER_USD = 1e3;
14655
- var CENTS_PER_USD = 100;
14656
- var CREDITS_PER_USD_CENT = MELIUS_CREDITS_PER_USD / CENTS_PER_USD;
14657
- var MAX_CREDIT_TOP_UP_DISCOUNT_PERCENTAGE = 90;
14658
-
14659
- // ../api-contract/src/team/schema.ts
14660
- var TeamRoleSchema = external_exports.enum(["owner", "admin", "editor", "viewer"]);
14661
- var TeamPlanSchema = external_exports.enum(TEAM_PLAN_IDS);
14662
- var CustomPlanTypeSchema = external_exports.enum(CUSTOM_PLAN_TYPE_IDS);
14663
- var InviteLinkRoleSchema = external_exports.enum(["admin", "editor", "viewer"]);
14664
- var EnterpriseOrderLineItemSchema = external_exports.object({
14665
- description: external_exports.string().min(1),
14666
- quantity: external_exports.string().min(1),
14667
- unitPrice: external_exports.string().min(1),
14668
- total: external_exports.string().min(1)
14669
- });
14670
- var EnterpriseBillingIntervalSchema = external_exports.enum(["monthly", "annual"]);
14671
- var EnterpriseAllowedPaymentMethodsSchema = external_exports.enum([
14672
- "card_and_bank",
14673
- "bank_only",
14674
- "card_only"
14675
- ]);
14676
- var EnterpriseStripeBillingInputSchema = external_exports.object({
14677
- unitAmount: external_exports.number().int().positive(),
14678
- // Expose the transform output to OpenAPI generation.
14679
- currency: external_exports.string().length(3).transform((value) => value.toLowerCase()).pipe(external_exports.string()),
14680
- billingInterval: EnterpriseBillingIntervalSchema,
14681
- creditsPerPeriod: external_exports.number().int().positive(),
14682
- allowedPaymentMethods: EnterpriseAllowedPaymentMethodsSchema.optional(),
14683
- contractEndAt: external_exports.string().datetime().optional(),
14684
- /**
14685
- * Whether the term rolls into another of the same length instead of
14686
- * ending. Only meaningful alongside a `contractEndAt`. Absent means off,
14687
- * which is what a plan created before this field gets; new plans send it
14688
- * explicitly rather than the resolver defaulting to on, so existing
14689
- * contracts keep their current behavior.
14690
- */
14691
- autoRenew: external_exports.boolean().optional()
14692
- }).refine(
14693
- (input) => input.billingInterval !== "annual" || input.contractEndAt != null,
14694
- {
14695
- message: "contractEndAt is required for annual billing",
14696
- path: ["contractEndAt"]
14697
- }
14698
- );
14699
- var CustomPlanCreditRolloverPolicySchema = external_exports.discriminatedUnion(
14700
- "mode",
14701
- [
14702
- external_exports.object({ mode: external_exports.literal("none") }),
14703
- external_exports.object({ mode: external_exports.literal("unlimited") }),
14704
- external_exports.object({
14705
- mode: external_exports.literal("months"),
14706
- months: external_exports.number().int().nonnegative()
14707
- }),
14708
- external_exports.object({
14709
- mode: external_exports.literal("percentage"),
14710
- percentage: external_exports.number().int().min(0).max(100)
14711
- })
14712
- ]
14713
- );
14714
- var EnterpriseOrderDetailsSchema = external_exports.object({
14715
- orderType: external_exports.string().min(1),
14716
- customPlanType: CustomPlanTypeSchema.optional(),
14717
- creditPackageAmount: external_exports.number().int().nonnegative(),
14718
- creditPackageUnit: external_exports.string().min(1),
14719
- creditRolloverPolicy: CustomPlanCreditRolloverPolicySchema.optional(),
14720
- /**
14721
- * Whole percent off the standard per-credit rate for top-ups beyond the
14722
- * plan's allowance. Absent means the standard rate. Unlike the rest of the
14723
- * order details this is not presentational — checkout, the Stripe grant and
14724
- * the receipt all price against it (see `@repo/pricing/credit-top-up`).
14725
- */
14726
- creditTopUpDiscountPercentage: external_exports.number().int().min(1).max(MAX_CREDIT_TOP_UP_DISCOUNT_PERCENTAGE).optional(),
14727
- orderDate: external_exports.string().date(),
14728
- /** Omit for plans with no fixed contract term (e.g. monthly Stripe plans). */
14729
- termCount: external_exports.number().int().positive().optional(),
14730
- termUnit: external_exports.string().min(1).optional(),
14731
- lineItems: external_exports.array(EnterpriseOrderLineItemSchema),
14732
- totalContractValue: external_exports.string().min(1)
14733
- });
14734
- var EnterprisePendingExpansionSchema = external_exports.object({
14735
- /** Stable id minted at prepare; also the credit-grant idempotency key. */
14736
- id: external_exports.string(),
14737
- newUnitAmount: external_exports.number().int().positive(),
14738
- newCreditsPerPeriod: external_exports.number().int().positive(),
14739
- newStripePriceId: external_exports.string().min(1),
14740
- /** Flat catch-up = new unit amount − current unit amount. Negative when the update lowers the rate; nothing is charged then. */
14741
- deltaAmountCents: external_exports.number().int(),
14742
- /** Credits granted on activation = new − current credits per period. Negative when the update lowers the allotment; nothing is granted or clawed back then. */
14743
- deltaCredits: external_exports.number().int(),
14744
- /** New contract end when the operator chose a new term; absent means keep the existing term. */
14745
- contractEndAt: external_exports.string().datetime().optional(),
14746
- keepContractEnd: external_exports.boolean(),
14747
- /**
14748
- * Operator-authored replacement order details (line items, total contract
14749
- * value, credit package, term) applied to the stored order when the customer
14750
- * activates. Absent keeps the existing terms. Purely presentational — the
14751
- * actual charge/credits come from the billing figures above.
14752
- */
14753
- newOrderDetails: EnterpriseOrderDetailsSchema.optional(),
14754
- preparedAt: external_exports.string().datetime(),
14755
- preparedByEmail: external_exports.string().nullable()
14778
+ // ../api-contract/src/presets/schema.ts
14779
+ var TextNodeDataSchema = external_exports.object({
14780
+ title: external_exports.string(),
14781
+ mode: external_exports.string(),
14782
+ prompt: external_exports.string(),
14783
+ /** `getValidHandles` builds a text node's targets as `["text", ...this]`. */
14784
+ supportedInputs: external_exports.array(external_exports.string()).optional()
14756
14785
  });
14757
- var EnterprisePendingRenewalSchema = external_exports.object({
14758
- id: external_exports.string(),
14759
- newUnitAmount: external_exports.number().int().positive(),
14760
- newCreditsPerPeriod: external_exports.number().int().positive(),
14761
- newStripePriceId: external_exports.string().min(1),
14762
- /** Length of the renewal term in monthly billing periods. */
14763
- newTermMonths: external_exports.number().int().positive(),
14764
- newContractEndAt: external_exports.string().datetime(),
14765
- /** Operator-authored replacement order details. Purely presentational. */
14766
- newOrderDetails: EnterpriseOrderDetailsSchema.optional(),
14767
- preparedAt: external_exports.string().datetime(),
14768
- preparedByEmail: external_exports.string().nullable()
14786
+ var ImageNodeDataSchema = external_exports.object({
14787
+ title: external_exports.string(),
14788
+ src: external_exports.string().optional(),
14789
+ mode: external_exports.string(),
14790
+ aspectRatio: external_exports.string().optional(),
14791
+ prompt: external_exports.string()
14769
14792
  });
14770
- var EnterpriseStripeBillingSchema = external_exports.object({
14771
- unitAmount: external_exports.number().int().positive(),
14772
- // Expose the transform output to OpenAPI generation.
14773
- currency: external_exports.string().length(3).transform((value) => value.toLowerCase()).pipe(external_exports.string()),
14774
- billingInterval: EnterpriseBillingIntervalSchema,
14775
- creditsPerPeriod: external_exports.number().int().positive(),
14776
- allowedPaymentMethods: EnterpriseAllowedPaymentMethodsSchema.optional(),
14777
- contractEndAt: external_exports.string().datetime().optional(),
14793
+ var VideoNodeDataSchema = external_exports.object({
14794
+ title: external_exports.string(),
14795
+ src: external_exports.string().optional(),
14796
+ mode: external_exports.string(),
14797
+ aspectRatio: external_exports.string().optional(),
14798
+ duration: external_exports.string().optional(),
14799
+ prompt: external_exports.string(),
14778
14800
  /**
14779
- * Whether the contract rolls into another term of the same length at
14780
- * `contractEndAt` instead of ending. Only meaningful alongside a
14781
- * `contractEndAt`; a plan with no fixed term already renews indefinitely.
14782
- * Absent means off, so a plan created before this field keeps ending at its
14783
- * contract end. Read it through `resolveEnterpriseAutoRenew`.
14801
+ * Handle validation tests these by key PRESENCE (`hasModelCapabilityFlags`
14802
+ * in `canvas-handles.ts`) and treats them as one family, so dropping any one
14803
+ * key disables the whole model-flag branch rather than just that flag.
14804
+ * Declared together for that reason, not because every preset sets all four.
14784
14805
  */
14785
- autoRenew: external_exports.boolean().optional(),
14786
- stripePriceId: external_exports.string().min(1),
14787
- activatedAt: external_exports.string().datetime().optional(),
14788
- activatedByEmail: external_exports.string().nullable().optional(),
14789
- paymentMethodType: external_exports.enum(["card", "us_bank_account"]).optional(),
14790
- firstPaymentSettledAt: external_exports.string().datetime().optional(),
14791
- pendingExpansion: EnterprisePendingExpansionSchema.optional(),
14792
- pendingRenewal: EnterprisePendingRenewalSchema.optional(),
14793
- /** Stripe subscription schedule driving a prepared renewal, while attached. */
14794
- stripeScheduleId: external_exports.string().min(1).optional()
14795
- });
14796
- var CustomerEnterpriseStripeBillingSchema = EnterpriseStripeBillingSchema.omit({
14797
- activatedAt: true,
14798
- activatedByEmail: true,
14799
- allowedPaymentMethods: true,
14800
- paymentMethodType: true,
14801
- firstPaymentSettledAt: true,
14802
- // Operator-only; the customer reads a pending expansion through the
14803
- // dedicated preview endpoint, which excludes operator emails.
14804
- pendingExpansion: true,
14805
- // Same reason — it carries the preparing operator's email.
14806
- pendingRenewal: true,
14807
- stripeScheduleId: true
14808
- });
14809
- var EnterpriseStripeBillingAuditActionSchema = external_exports.enum([
14810
- "created",
14811
- "mutated",
14812
- "activated",
14813
- "term_ended",
14814
- "canceled"
14815
- ]);
14816
- var EnterpriseStripeBillingAuditEntrySchema = external_exports.object({
14817
- at: external_exports.string().datetime(),
14818
- byEmail: external_exports.string().nullable(),
14819
- action: EnterpriseStripeBillingAuditActionSchema,
14820
- previousStripePriceId: external_exports.string().optional(),
14821
- notes: external_exports.string().optional()
14822
- });
14823
- var EnterpriseOrderSchema = EnterpriseOrderDetailsSchema.extend({
14824
- stripeBilling: EnterpriseStripeBillingInputSchema.optional()
14806
+ modelSupportsEndImage: external_exports.boolean().optional(),
14807
+ modelSupportsReferenceImage: external_exports.boolean().optional(),
14808
+ modelSupportsOptionalStartImage: external_exports.boolean().optional(),
14809
+ modelSupportsAudioInput: external_exports.boolean().optional()
14825
14810
  });
14826
- var CustomerEnterpriseOrderSchema = EnterpriseOrderSchema.extend({
14827
- stripeBilling: CustomerEnterpriseStripeBillingSchema.optional()
14811
+ var AudioNodeDataSchema = external_exports.object({
14812
+ title: external_exports.string(),
14813
+ src: external_exports.string().optional(),
14814
+ mode: external_exports.string().optional(),
14815
+ prompt: external_exports.string().optional(),
14816
+ voiceId: external_exports.string().optional()
14828
14817
  });
14829
- var CustomPlanCreditGrantScheduleSchema = external_exports.object({
14830
- id: external_exports.string(),
14831
- creditPackageAmount: external_exports.number().int().nonnegative(),
14832
- creditPackageUnit: external_exports.string().min(1),
14833
- grantStartDate: external_exports.string().date(),
14834
- contractEndDate: external_exports.string().date(),
14835
- /** Set when an amendment, pause, or revert ended this entry early. */
14836
- effectiveEndDate: external_exports.string().date().optional(),
14837
- createdAt: external_exports.string().datetime(),
14838
- createdByEmail: external_exports.string().nullable()
14818
+ var FileNodeDataSchema = external_exports.object({
14819
+ title: external_exports.string(),
14820
+ src: external_exports.string().optional(),
14821
+ mediaType: external_exports.enum(["image", "video"]),
14822
+ /** Opts the preset viewer's file node into rendering an audio output. */
14823
+ showAudioOutput: external_exports.boolean().optional()
14839
14824
  });
14840
- var CustomPlanCreditGrantHistoryEntrySchema = external_exports.object({
14841
- grantDate: external_exports.string().date(),
14842
- amount: external_exports.number().int().nonnegative(),
14843
- /** Billing event id once granted; null if scheduled but not yet processed. */
14844
- billingEventId: external_exports.string().nullable(),
14845
- /** How the credit grant landed once granted; null while scheduled. */
14846
- billingSource: external_exports.enum(["custom_plan", "stripe"]).nullable(),
14847
- /** Idempotency/source reference for the grant, e.g. custom schedule key or Stripe invoice/subscription reference. */
14848
- billingReferenceId: external_exports.string().nullable(),
14849
- /** ISO timestamp when the grant landed; null while still scheduled. */
14850
- grantedAt: external_exports.string().datetime().nullable(),
14851
- status: external_exports.enum(["granted", "scheduled"])
14825
+ var CustomTextNodeDataSchema = external_exports.object({
14826
+ title: external_exports.string(),
14827
+ generatedText: external_exports.string().optional()
14852
14828
  });
14853
- var InternalEnterpriseOrderSchema = EnterpriseOrderSchema.extend({
14854
- updatedAt: external_exports.string().datetime(),
14855
- updatedByEmail: external_exports.string().nullable(),
14856
- creditGrantSchedule: external_exports.array(CustomPlanCreditGrantScheduleSchema),
14857
- creditGrantHistory: external_exports.array(CustomPlanCreditGrantHistoryEntrySchema),
14858
- nextGrantDate: external_exports.string().date().nullable(),
14859
- stripeBilling: EnterpriseStripeBillingSchema.optional(),
14860
- stripeBillingAuditLog: external_exports.array(EnterpriseStripeBillingAuditEntrySchema).optional()
14829
+ var GroupNodeDataSchema = external_exports.object({
14830
+ label: external_exports.string()
14861
14831
  });
14862
- var TeamAdvancedSettingsSchema = external_exports.object({
14863
- negativePromptEnabled: external_exports.boolean().optional(),
14864
- customSeedEnabled: external_exports.boolean().optional(),
14865
- // Auto-approve join requests from signups whose email domain matches this
14866
- // enterprise team's owner domain. Admin-governed via the dedicated
14867
- // domain-join-settings endpoint, not the editor-facing advanced-settings write.
14868
- domainJoinAutoApprove: external_exports.boolean().optional()
14869
- // NOTE: the team's approval policy config also lives in this jsonb column,
14870
- // but is deliberately NOT declared here — see `InternalTeamAdvancedSettings`
14871
- // in `apps/core/nagi/team/team.mappers.ts`, the same treatment
14872
- // `modelDiscounts` gets. Declaring it would publish the team's approver
14873
- // list into the public OpenAPI surface, and would make it writable through
14874
- // the editor-facing advanced-settings endpoint. It is read and written
14875
- // only through the admin-gated approvals endpoints.
14832
+ var SharedNodeFields = {
14833
+ key: external_exports.string(),
14834
+ width: external_exports.number().optional(),
14835
+ height: external_exports.number().optional(),
14836
+ column: external_exports.number().optional(),
14837
+ x: external_exports.number().optional(),
14838
+ y: external_exports.number().optional(),
14839
+ autoModel: AutoModelConfigSchema.optional(),
14840
+ parentKey: external_exports.string().optional()
14841
+ };
14842
+ var PresetNodeSchema = external_exports.discriminatedUnion("type", [
14843
+ external_exports.object({
14844
+ type: external_exports.literal("text"),
14845
+ data: TextNodeDataSchema,
14846
+ ...SharedNodeFields
14847
+ }),
14848
+ external_exports.object({
14849
+ type: external_exports.literal("image"),
14850
+ data: ImageNodeDataSchema,
14851
+ ...SharedNodeFields
14852
+ }),
14853
+ external_exports.object({
14854
+ type: external_exports.literal("video"),
14855
+ data: VideoNodeDataSchema,
14856
+ ...SharedNodeFields
14857
+ }),
14858
+ external_exports.object({
14859
+ type: external_exports.literal("audio"),
14860
+ data: AudioNodeDataSchema,
14861
+ ...SharedNodeFields
14862
+ }),
14863
+ external_exports.object({
14864
+ type: external_exports.literal("file"),
14865
+ data: FileNodeDataSchema,
14866
+ ...SharedNodeFields
14867
+ }),
14868
+ external_exports.object({
14869
+ type: external_exports.literal("custom_text"),
14870
+ data: CustomTextNodeDataSchema,
14871
+ ...SharedNodeFields
14872
+ }),
14873
+ external_exports.object({
14874
+ type: external_exports.literal("group"),
14875
+ data: GroupNodeDataSchema,
14876
+ ...SharedNodeFields
14877
+ })
14878
+ ]);
14879
+ var PresetEdgeSchema = external_exports.object({
14880
+ sourceKey: external_exports.string(),
14881
+ targetKey: external_exports.string(),
14882
+ handleId: external_exports.string(),
14883
+ targetHandleId: external_exports.string().optional()
14876
14884
  });
14877
- var DomainJoinTargetSchema = external_exports.object({
14878
- teamId: external_exports.string().uuid(),
14879
- teamName: external_exports.string(),
14880
- teamPhotoUrl: external_exports.string().nullable(),
14881
- alreadyRequested: external_exports.boolean()
14885
+ var PresetResponseSchema = external_exports.object({
14886
+ id: external_exports.string(),
14887
+ title: external_exports.string(),
14888
+ groupLabel: external_exports.string(),
14889
+ icon: external_exports.string(),
14890
+ description: external_exports.string(),
14891
+ nodes: external_exports.array(PresetNodeSchema),
14892
+ edges: external_exports.array(PresetEdgeSchema)
14882
14893
  });
14883
- var JoinRequestSchema = external_exports.object({
14884
- id: external_exports.string().uuid(),
14885
- userId: external_exports.string().uuid(),
14886
- userName: external_exports.string(),
14887
- userEmail: external_exports.string(),
14888
- avatarUrl: external_exports.string().nullable(),
14889
- createdAt: external_exports.string().datetime()
14894
+
14895
+ // ../api-contract/src/presets/routes.ts
14896
+ var c8 = initContract();
14897
+ var presetsContract = c8.router({
14898
+ listPresets: {
14899
+ method: "GET",
14900
+ path: "/presets",
14901
+ responses: {
14902
+ 200: external_exports.object({
14903
+ data: external_exports.array(PresetResponseSchema)
14904
+ })
14905
+ },
14906
+ summary: "List available group presets"
14907
+ }
14890
14908
  });
14891
- var ActiveProductFeatureOverrideSchema = external_exports.object({
14892
- feature: external_exports.string().min(1),
14893
- expiresAt: external_exports.string().datetime()
14909
+
14910
+ // ../api-contract/src/profile/schema.ts
14911
+ var MagicResizeCustomResolutionSchema = external_exports.object({
14912
+ width: external_exports.number().int().min(64).max(4096),
14913
+ height: external_exports.number().int().min(64).max(4096)
14894
14914
  });
14895
- var ActivePlanPreviewSchema = external_exports.object({
14896
- previewPlanTier: TeamPlanSchema,
14897
- expiresAt: external_exports.string().datetime()
14915
+ var UserAdvancedSettingsSchema = external_exports.object({
14916
+ seedancePrecheckEnabled: external_exports.boolean().optional(),
14917
+ seedanceDurationWarningEnabled: external_exports.boolean().optional(),
14918
+ // Pro view: hide a node's prompt until hovered, shown translucently over
14919
+ // the media instead of below the node.
14920
+ hideNodePromptsEnabled: external_exports.boolean().optional(),
14921
+ magicResizeCustomResolutions: external_exports.array(MagicResizeCustomResolutionSchema).max(20).optional()
14898
14922
  });
14899
- var TeamSchema = external_exports.object({
14923
+ var ProfileUserSchema = external_exports.object({
14900
14924
  id: external_exports.string().uuid(),
14901
14925
  name: external_exports.string(),
14902
- plan: TeamPlanSchema,
14903
- teamPhotoUrl: external_exports.string().nullable(),
14904
- createdAt: external_exports.string().datetime(),
14905
- creditExpiresAt: external_exports.string().datetime().nullable(),
14906
- enterpriseOrder: CustomerEnterpriseOrderSchema.nullable(),
14907
- advancedSettings: TeamAdvancedSettingsSchema,
14908
- activeProductFeatureOverrides: external_exports.array(ActiveProductFeatureOverrideSchema).default([]),
14909
- activePlanPreview: ActivePlanPreviewSchema.nullable().default(null)
14910
- });
14911
- var MemberSchema = external_exports.object({
14912
- id: external_exports.string().uuid(),
14913
- role: TeamRoleSchema,
14914
- userId: external_exports.string().uuid(),
14915
- userName: external_exports.string(),
14916
- userEmail: external_exports.string(),
14917
- avatarUrl: external_exports.string().nullable()
14926
+ email: external_exports.string(),
14927
+ agentAutoRun: external_exports.boolean(),
14928
+ // Set once the user answers the "how did you hear about us" intro. Marks
14929
+ // the account-level onboarding as done, independently of the canvas
14930
+ // product tour (`completedProductTour`).
14931
+ signupSource: external_exports.string().nullable(),
14932
+ completedProductTour: external_exports.string().datetime().nullable(),
14933
+ avatarUrl: external_exports.string().nullable(),
14934
+ advancedSettings: UserAdvancedSettingsSchema,
14935
+ /**
14936
+ * Whether this session may open the staff tools panel — a Melius account,
14937
+ * or somebody of ours behind a verified impersonation marker.
14938
+ *
14939
+ * Sent because the client cannot work it out. While impersonating, `email`
14940
+ * above is the *customer's*, so a panel gated on the address it can see
14941
+ * would disappear exactly when support needs it. Says nothing about what
14942
+ * the tools do: the server re-decides that per request, so a client that
14943
+ * forces this to true gets a panel whose switches change nothing.
14944
+ *
14945
+ * Optional, so a client built before this reads the payload unchanged.
14946
+ */
14947
+ canUseStaffTools: external_exports.boolean().optional()
14918
14948
  });
14919
- var TeamMembershipSchema = external_exports.object({
14920
- id: external_exports.string().uuid(),
14921
- role: TeamRoleSchema,
14922
- team: TeamSchema
14949
+ var ProfileReferralInfoSchema = external_exports.object({
14950
+ code: external_exports.string()
14923
14951
  });
14924
- var InviteLinkSchema = external_exports.object({
14952
+ var ReferralRewardNotificationSchema = external_exports.object({
14925
14953
  id: external_exports.string().uuid(),
14926
- role: InviteLinkRoleSchema,
14927
- token: external_exports.string(),
14928
- createdAt: external_exports.string().datetime()
14954
+ kind: external_exports.enum(["referrer", "invitee"]),
14955
+ counterpartName: external_exports.string(),
14956
+ redeemedAt: external_exports.string().datetime()
14929
14957
  });
14930
- var EmailInviteStatusSchema = external_exports.enum(["pending", "accepted"]);
14931
- var EmailInviteSchema = external_exports.object({
14932
- id: external_exports.string().uuid(),
14933
- email: external_exports.string(),
14934
- role: InviteLinkRoleSchema,
14935
- status: EmailInviteStatusSchema,
14936
- senderName: external_exports.string(),
14937
- createdAt: external_exports.string().datetime()
14958
+
14959
+ // ../api-contract/src/profile/routes.ts
14960
+ var c9 = initContract();
14961
+ var profileContract = c9.router({
14962
+ getMyProfile: {
14963
+ method: "GET",
14964
+ path: "/profile/me",
14965
+ responses: { 200: ProfileUserSchema }
14966
+ },
14967
+ getMyReferralInfo: {
14968
+ method: "GET",
14969
+ path: "/profile/referral",
14970
+ responses: { 200: ProfileReferralInfoSchema }
14971
+ },
14972
+ getReferralRewards: {
14973
+ method: "GET",
14974
+ path: "/profile/referral/rewards",
14975
+ responses: {
14976
+ 200: external_exports.object({
14977
+ rewards: external_exports.array(ReferralRewardNotificationSchema)
14978
+ })
14979
+ }
14980
+ },
14981
+ sendReferralInvite: {
14982
+ method: "POST",
14983
+ path: "/profile/referral/invite",
14984
+ body: external_exports.object({
14985
+ email: external_exports.string().email().max(320)
14986
+ }),
14987
+ responses: {
14988
+ 200: external_exports.object({
14989
+ result: external_exports.enum([
14990
+ "sent",
14991
+ "already_invited",
14992
+ "already_has_account"
14993
+ ])
14994
+ })
14995
+ }
14996
+ },
14997
+ updateMyProfile: {
14998
+ method: "PATCH",
14999
+ path: "/profile/me",
15000
+ body: external_exports.object({
15001
+ agentAutoRun: external_exports.boolean().optional(),
15002
+ completedProductTour: external_exports.string().datetime().nullable().optional(),
15003
+ // How the walkthrough ended. `completedProductTour` is written on
15004
+ // both paths so it cannot tell finishing from skipping, and a
15005
+ // conversion that counts everyone who bailed at step 2 is the
15006
+ // opposite of a high-intent signal. Optional, so a client that
15007
+ // does not send it simply reports no conversion.
15008
+ productTourOutcome: external_exports.enum(["completed", "skipped"]).optional(),
15009
+ avatarS3Bucket: external_exports.string().optional(),
15010
+ avatarS3Key: external_exports.string().optional(),
15011
+ signupSource: external_exports.string().min(1).max(200).optional()
15012
+ }),
15013
+ responses: { 200: ProfileUserSchema }
15014
+ },
15015
+ updateAdvancedSettings: {
15016
+ method: "PATCH",
15017
+ path: "/profile/me/advanced-settings",
15018
+ body: UserAdvancedSettingsSchema,
15019
+ responses: {
15020
+ 200: external_exports.object({ advancedSettings: UserAdvancedSettingsSchema })
15021
+ }
15022
+ }
14938
15023
  });
14939
15024
 
14940
15025
  // ../api-contract/src/share/schema.ts
@@ -15095,7 +15180,9 @@ var ProjectResponseSchema = external_exports.object({
15095
15180
  previewAssets: external_exports.array(PreviewAssetSchema),
15096
15181
  createdAt: external_exports.string().datetime(),
15097
15182
  updatedAt: external_exports.string().datetime(),
15098
- lastEditAt: external_exports.string().datetime()
15183
+ lastEditAt: external_exports.string().datetime(),
15184
+ /** As on a canvas: the product's own project, shown only to a Melius account. */
15185
+ isSystem: external_exports.boolean().optional()
15099
15186
  });
15100
15187
  var ProjectOptionSchema = ProjectResponseSchema.pick({
15101
15188
  id: true,
@@ -16067,7 +16154,7 @@ function isMajorUpgrade(current, latest) {
16067
16154
  return l[0] > c14[0];
16068
16155
  }
16069
16156
  function shouldShowUpgradeNotice(ctx = {}) {
16070
- const current = ctx.current ?? "0.15.2";
16157
+ const current = ctx.current ?? "0.15.4";
16071
16158
  const latest = ctx.latest ?? serverLatestVersion;
16072
16159
  const env = ctx.env ?? process.env;
16073
16160
  const isTty = ctx.isTty ?? Boolean(process.stderr.isTTY);
@@ -16088,7 +16175,7 @@ Upgrade: npm install -g @melius-ai/cli@latest (or: brew update && brew upgrade
16088
16175
  function printUpgradeNoticeIfNeeded(ctx = {}) {
16089
16176
  try {
16090
16177
  if (!shouldShowUpgradeNotice(ctx)) return;
16091
- const current = ctx.current ?? "0.15.2";
16178
+ const current = ctx.current ?? "0.15.4";
16092
16179
  const latest = ctx.latest ?? serverLatestVersion;
16093
16180
  process.stderr.write(formatUpgradeNotice(current, latest));
16094
16181
  } catch {
@@ -20420,7 +20507,7 @@ function withDefaultHelp(args) {
20420
20507
  }
20421
20508
  function createProgram() {
20422
20509
  const program2 = new Command();
20423
- program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.15.2").showSuggestionAfterError(true).option("--json", "Force JSON output (default)").option("--text", "Human-readable output").option(
20510
+ program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.15.4").showSuggestionAfterError(true).option("--json", "Force JSON output (default)").option("--text", "Human-readable output").option(
20424
20511
  "--fields <fields>",
20425
20512
  "Select specific output fields (comma-separated)"
20426
20513
  ).option("--quiet", "Suppress output, exit code only").option("--verbose", "Log request/response metadata to stderr").addHelpText(