@melius-ai/cli 0.15.3 → 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.
@@ -8204,6 +8204,16 @@ var ImportUploadcareFileBodySchema = external_exports.object({
8204
8204
  var ImportUploadcareFileResponseSchema = external_exports.object({
8205
8205
  file: FileCardSchema
8206
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
+ });
8207
8217
  var UploadcareUploadSignatureResponseSchema = external_exports.object({
8208
8218
  signature: external_exports.string(),
8209
8219
  /** Unix seconds, as a string — the exact bytes that were signed. */
@@ -11485,13 +11495,17 @@ var EdgeResponseSchema = external_exports.object({
11485
11495
  });
11486
11496
  var PinnedModelSchema = external_exports.object({
11487
11497
  model: external_exports.string(),
11488
- 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()
11489
11501
  });
11490
11502
  var pinnedModelsField = external_exports.array(PinnedModelSchema).max(MAX_PINNED_MODELS).optional();
11491
11503
  var CanvasMediaPresetSchema = external_exports.object({
11492
11504
  image: external_exports.object({
11493
11505
  model: external_exports.string().optional(),
11494
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(),
11495
11509
  pinnedModels: pinnedModelsField,
11496
11510
  aspectRatio: OutputAspectRatioSchema.optional(),
11497
11511
  resolution: OutputResolutionSchema.optional(),
@@ -11501,6 +11515,8 @@ var CanvasMediaPresetSchema = external_exports.object({
11501
11515
  video: external_exports.object({
11502
11516
  model: external_exports.string().optional(),
11503
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(),
11504
11520
  pinnedModels: pinnedModelsField,
11505
11521
  aspectRatio: OutputAspectRatioSchema.optional(),
11506
11522
  resolution: OutputResolutionSchema.optional(),
@@ -11511,6 +11527,8 @@ var CanvasMediaPresetSchema = external_exports.object({
11511
11527
  text: external_exports.object({
11512
11528
  model: external_exports.string().optional(),
11513
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(),
11514
11532
  pinnedModels: pinnedModelsField,
11515
11533
  fast: external_exports.boolean().optional(),
11516
11534
  numVariations: external_exports.number().int().min(1).max(MAX_VARIATIONS).optional()
@@ -11518,6 +11536,8 @@ var CanvasMediaPresetSchema = external_exports.object({
11518
11536
  audio: external_exports.object({
11519
11537
  model: external_exports.string().optional(),
11520
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(),
11521
11541
  pinnedModels: pinnedModelsField,
11522
11542
  /** Default ElevenLabs stock voice id (text-to-speech / voice changer). */
11523
11543
  voiceId: external_exports.string().optional(),
@@ -13421,257 +13441,575 @@ var AssetDownloadResponseSchema = external_exports.object({
13421
13441
  filename: external_exports.string()
13422
13442
  });
13423
13443
 
13424
- // ../api-contract/src/files/routes.ts
13425
- var c6 = initContract();
13426
- var filesContract = c6.router({
13427
- createFileFolder: {
13428
- method: "POST",
13429
- path: "/files/folders",
13430
- body: CreateFileFolderBodySchema,
13431
- responses: {
13432
- 201: FileFolderResponseSchema,
13433
- 403: ErrorBodySchema,
13434
- 404: ErrorBodySchema
13435
- },
13436
- summary: "Create a Files folder"
13437
- },
13438
- listFileFolders: {
13439
- method: "GET",
13440
- path: "/files/folders",
13441
- responses: {
13442
- 200: FileFolderListResponseSchema,
13443
- 403: ErrorBodySchema
13444
- },
13445
- summary: "List team Files folders"
13446
- },
13447
- updateFileFolder: {
13448
- method: "PATCH",
13449
- path: "/files/folders/:folderId",
13450
- pathParams: FileFolderIdParamsSchema,
13451
- body: UpdateFileFolderBodySchema,
13452
- responses: {
13453
- 200: FileFolderResponseSchema,
13454
- 403: ErrorBodySchema,
13455
- 404: ErrorBodySchema,
13456
- 409: ErrorBodySchema
13457
- },
13458
- summary: "Update a Files folder"
13459
- },
13460
- deleteFileFolder: {
13461
- method: "DELETE",
13462
- path: "/files/folders/:folderId",
13463
- pathParams: FileFolderIdParamsSchema,
13464
- body: null,
13465
- responses: {
13466
- 204: c6.noBody(),
13467
- 403: ErrorBodySchema
13468
- },
13469
- summary: "Delete a Files folder"
13470
- },
13471
- listAssetTags: {
13472
- method: "GET",
13473
- path: "/files/tags",
13474
- responses: {
13475
- 200: AssetTagListResponseSchema,
13476
- 403: ErrorBodySchema
13477
- },
13478
- summary: "List team asset tags"
13479
- },
13480
- createAssetTag: {
13481
- method: "POST",
13482
- path: "/files/tags",
13483
- body: CreateAssetTagBodySchema,
13484
- responses: {
13485
- 201: AssetTagResponseSchema,
13486
- 403: ErrorBodySchema,
13487
- 409: ErrorBodySchema
13488
- },
13489
- summary: "Create an asset tag"
13490
- },
13491
- updateAssetTag: {
13492
- method: "PATCH",
13493
- path: "/files/tags/:tagId",
13494
- pathParams: AssetTagIdParamsSchema,
13495
- body: UpdateAssetTagBodySchema,
13496
- responses: {
13497
- 200: AssetTagResponseSchema,
13498
- 403: ErrorBodySchema,
13499
- 404: ErrorBodySchema,
13500
- 409: ErrorBodySchema
13501
- },
13502
- summary: "Rename or recolor an asset tag"
13503
- },
13504
- deleteAssetTag: {
13505
- method: "DELETE",
13506
- path: "/files/tags/:tagId",
13507
- pathParams: AssetTagIdParamsSchema,
13508
- body: null,
13509
- responses: {
13510
- 204: c6.noBody(),
13511
- 403: ErrorBodySchema,
13512
- 404: ErrorBodySchema
13513
- },
13514
- summary: "Delete an asset tag"
13515
- },
13516
- addAssetTag: {
13517
- method: "POST",
13518
- path: "/files/:assetId/tags",
13519
- pathParams: FileAssetIdParamsSchema,
13520
- body: AssetTagAssignmentBodySchema,
13521
- responses: {
13522
- 200: FileCardSchema,
13523
- 403: ErrorBodySchema,
13524
- 404: ErrorBodySchema
13525
- },
13526
- summary: "Add a tag to a file"
13527
- },
13528
- removeAssetTag: {
13529
- method: "DELETE",
13530
- path: "/files/:assetId/tags/:tagId",
13531
- pathParams: FileAssetTagParamsSchema,
13532
- body: null,
13533
- responses: {
13534
- 200: FileCardSchema,
13535
- 403: ErrorBodySchema,
13536
- 404: ErrorBodySchema
13537
- },
13538
- summary: "Remove a tag from a file"
13539
- },
13540
- bulkAddAssetTag: {
13541
- method: "POST",
13542
- path: "/files/bulk/tag",
13543
- body: BulkAssetTagBodySchema,
13544
- responses: {
13545
- 200: BulkFileActionResponseSchema,
13546
- 403: ErrorBodySchema,
13547
- 404: ErrorBodySchema
13548
- },
13549
- summary: "Add a tag to files"
13550
- },
13551
- bulkRemoveAssetTag: {
13552
- method: "POST",
13553
- path: "/files/bulk/untag",
13554
- body: BulkAssetTagBodySchema,
13555
- responses: {
13556
- 200: BulkFileActionResponseSchema,
13557
- 403: ErrorBodySchema,
13558
- 404: ErrorBodySchema
13559
- },
13560
- summary: "Remove a tag from files"
13561
- },
13562
- bulkMoveFiles: {
13563
- method: "POST",
13564
- path: "/files/bulk/move",
13565
- body: BulkMoveFilesBodySchema,
13566
- responses: {
13567
- 200: BulkFileActionResponseSchema,
13568
- 403: ErrorBodySchema,
13569
- 404: ErrorBodySchema
13570
- },
13571
- summary: "Move files to a folder"
13572
- },
13573
- moveFile: {
13574
- method: "POST",
13575
- path: "/files/:assetId/move",
13576
- pathParams: FileAssetIdParamsSchema,
13577
- body: MoveFileBodySchema,
13578
- responses: {
13579
- 200: FileCardSchema,
13580
- 403: ErrorBodySchema,
13581
- 404: ErrorBodySchema
13582
- },
13583
- summary: "Move a file to a folder"
13584
- },
13585
- renameFile: {
13586
- method: "PATCH",
13587
- path: "/files/:assetId/name",
13588
- pathParams: FileAssetIdParamsSchema,
13589
- body: RenameFileBodySchema,
13590
- responses: {
13591
- 200: FileCardSchema,
13592
- 403: ErrorBodySchema,
13593
- 404: ErrorBodySchema
13594
- },
13595
- summary: "Rename a file"
13596
- },
13597
- bulkDownloadFiles: {
13598
- method: "POST",
13599
- path: "/files/bulk/download",
13600
- body: BulkDownloadFilesBodySchema,
13601
- responses: {
13602
- 200: BulkDownloadFilesResponseSchema,
13603
- 403: ErrorBodySchema,
13604
- 404: ErrorBodySchema
13605
- },
13606
- summary: "Download files and folders as a zip archive"
13607
- },
13608
- bulkHideFiles: {
13609
- method: "POST",
13610
- path: "/files/bulk/hide",
13611
- body: BulkHideFilesBodySchema,
13612
- responses: {
13613
- 200: BulkFileActionResponseSchema,
13614
- 403: ErrorBodySchema,
13615
- 404: ErrorBodySchema
13616
- },
13617
- summary: "Hide files from Files"
13618
- },
13619
- bulkDeleteFiles: {
13620
- method: "POST",
13621
- path: "/files/bulk/delete",
13622
- body: BulkDeleteFilesBodySchema,
13623
- responses: {
13624
- 200: BulkFileActionResponseSchema,
13625
- 403: ErrorBodySchema,
13626
- 404: ErrorBodySchema
13627
- },
13628
- summary: "Delete files from Files"
13629
- },
13630
- hideFile: {
13631
- method: "POST",
13632
- path: "/files/:assetId/hide",
13633
- pathParams: FileAssetIdParamsSchema,
13634
- body: null,
13635
- responses: {
13636
- 204: c6.noBody(),
13637
- 403: ErrorBodySchema,
13638
- 404: ErrorBodySchema
13639
- },
13640
- summary: "Hide a file from Files"
13641
- },
13642
- deleteFile: {
13643
- method: "DELETE",
13644
- path: "/files/:assetId",
13645
- pathParams: FileAssetIdParamsSchema,
13646
- body: null,
13647
- responses: {
13648
- 204: c6.noBody(),
13649
- 403: ErrorBodySchema,
13650
- 404: ErrorBodySchema
13651
- },
13652
- summary: "Delete a file from Files"
13653
- },
13654
- bulkUnhideFiles: {
13655
- method: "POST",
13656
- path: "/files/bulk/unhide",
13657
- body: BulkUnhideFilesBodySchema,
13658
- responses: {
13659
- 200: BulkFileActionResponseSchema,
13660
- 403: ErrorBodySchema,
13661
- 404: ErrorBodySchema
13662
- },
13663
- summary: "Restore files hidden from Files"
13664
- },
13665
- unhideFile: {
13666
- method: "POST",
13667
- path: "/files/:assetId/unhide",
13668
- pathParams: FileAssetIdParamsSchema,
13669
- body: null,
13670
- responses: {
13671
- 204: c6.noBody(),
13672
- 403: ErrorBodySchema,
13673
- 404: ErrorBodySchema
13674
- },
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",
14006
+ pathParams: FileAssetIdParamsSchema,
14007
+ body: null,
14008
+ responses: {
14009
+ 204: c6.noBody(),
14010
+ 403: ErrorBodySchema,
14011
+ 404: ErrorBodySchema
14012
+ },
13675
14013
  summary: "Restore a file hidden from Files"
13676
14014
  },
13677
14015
  /**
@@ -13833,6 +14171,18 @@ var filesContract = c6.router({
13833
14171
  404: ErrorBodySchema
13834
14172
  },
13835
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"
13836
14186
  }
13837
14187
  });
13838
14188
 
@@ -14408,559 +14758,268 @@ var generationContract = c7.router({
14408
14758
  getGenerationsByWeek: {
14409
14759
  method: "GET",
14410
14760
  path: "/generation/generations-by-week",
14411
- query: external_exports.object({
14412
- weeks: external_exports.coerce.number().int().min(1).max(52).default(12)
14413
- }),
14414
- responses: {
14415
- 200: GetGenerationsByWeekResponseSchema
14416
- }
14417
- },
14418
- precheckSeedance: {
14419
- method: "POST",
14420
- path: "/generation/precheck-seedance",
14421
- body: SeedancePrecheckRequestSchema,
14422
- responses: {
14423
- 200: SeedancePrecheckResponseSchema
14424
- }
14425
- }
14426
- });
14427
-
14428
- // ../api-contract/src/presets/schema.ts
14429
- var TextNodeDataSchema = external_exports.object({
14430
- title: external_exports.string(),
14431
- mode: external_exports.string(),
14432
- prompt: external_exports.string(),
14433
- /** `getValidHandles` builds a text node's targets as `["text", ...this]`. */
14434
- supportedInputs: external_exports.array(external_exports.string()).optional()
14435
- });
14436
- var ImageNodeDataSchema = external_exports.object({
14437
- title: external_exports.string(),
14438
- src: external_exports.string().optional(),
14439
- mode: external_exports.string(),
14440
- aspectRatio: external_exports.string().optional(),
14441
- prompt: external_exports.string()
14442
- });
14443
- var VideoNodeDataSchema = external_exports.object({
14444
- title: external_exports.string(),
14445
- src: external_exports.string().optional(),
14446
- mode: external_exports.string(),
14447
- aspectRatio: external_exports.string().optional(),
14448
- duration: external_exports.string().optional(),
14449
- prompt: external_exports.string(),
14450
- /**
14451
- * Handle validation tests these by key PRESENCE (`hasModelCapabilityFlags`
14452
- * in `canvas-handles.ts`) and treats them as one family, so dropping any one
14453
- * key disables the whole model-flag branch rather than just that flag.
14454
- * Declared together for that reason, not because every preset sets all four.
14455
- */
14456
- modelSupportsEndImage: external_exports.boolean().optional(),
14457
- modelSupportsReferenceImage: external_exports.boolean().optional(),
14458
- modelSupportsOptionalStartImage: external_exports.boolean().optional(),
14459
- modelSupportsAudioInput: external_exports.boolean().optional()
14460
- });
14461
- var AudioNodeDataSchema = external_exports.object({
14462
- title: external_exports.string(),
14463
- src: external_exports.string().optional(),
14464
- mode: external_exports.string().optional(),
14465
- prompt: external_exports.string().optional(),
14466
- voiceId: external_exports.string().optional()
14467
- });
14468
- var FileNodeDataSchema = external_exports.object({
14469
- title: external_exports.string(),
14470
- src: external_exports.string().optional(),
14471
- mediaType: external_exports.enum(["image", "video"]),
14472
- /** Opts the preset viewer's file node into rendering an audio output. */
14473
- showAudioOutput: external_exports.boolean().optional()
14474
- });
14475
- var CustomTextNodeDataSchema = external_exports.object({
14476
- title: external_exports.string(),
14477
- generatedText: external_exports.string().optional()
14478
- });
14479
- var GroupNodeDataSchema = external_exports.object({
14480
- label: external_exports.string()
14481
- });
14482
- var SharedNodeFields = {
14483
- key: external_exports.string(),
14484
- width: external_exports.number().optional(),
14485
- height: external_exports.number().optional(),
14486
- column: external_exports.number().optional(),
14487
- x: external_exports.number().optional(),
14488
- y: external_exports.number().optional(),
14489
- autoModel: AutoModelConfigSchema.optional(),
14490
- parentKey: external_exports.string().optional()
14491
- };
14492
- var PresetNodeSchema = external_exports.discriminatedUnion("type", [
14493
- external_exports.object({
14494
- type: external_exports.literal("text"),
14495
- data: TextNodeDataSchema,
14496
- ...SharedNodeFields
14497
- }),
14498
- external_exports.object({
14499
- type: external_exports.literal("image"),
14500
- data: ImageNodeDataSchema,
14501
- ...SharedNodeFields
14502
- }),
14503
- external_exports.object({
14504
- type: external_exports.literal("video"),
14505
- data: VideoNodeDataSchema,
14506
- ...SharedNodeFields
14507
- }),
14508
- external_exports.object({
14509
- type: external_exports.literal("audio"),
14510
- data: AudioNodeDataSchema,
14511
- ...SharedNodeFields
14512
- }),
14513
- external_exports.object({
14514
- type: external_exports.literal("file"),
14515
- data: FileNodeDataSchema,
14516
- ...SharedNodeFields
14517
- }),
14518
- external_exports.object({
14519
- type: external_exports.literal("custom_text"),
14520
- data: CustomTextNodeDataSchema,
14521
- ...SharedNodeFields
14522
- }),
14523
- external_exports.object({
14524
- type: external_exports.literal("group"),
14525
- data: GroupNodeDataSchema,
14526
- ...SharedNodeFields
14527
- })
14528
- ]);
14529
- var PresetEdgeSchema = external_exports.object({
14530
- sourceKey: external_exports.string(),
14531
- targetKey: external_exports.string(),
14532
- handleId: external_exports.string(),
14533
- targetHandleId: external_exports.string().optional()
14534
- });
14535
- var PresetResponseSchema = external_exports.object({
14536
- id: external_exports.string(),
14537
- title: external_exports.string(),
14538
- groupLabel: external_exports.string(),
14539
- icon: external_exports.string(),
14540
- description: external_exports.string(),
14541
- nodes: external_exports.array(PresetNodeSchema),
14542
- edges: external_exports.array(PresetEdgeSchema)
14543
- });
14544
-
14545
- // ../api-contract/src/presets/routes.ts
14546
- var c8 = initContract();
14547
- var presetsContract = c8.router({
14548
- listPresets: {
14549
- method: "GET",
14550
- path: "/presets",
14551
- responses: {
14552
- 200: external_exports.object({
14553
- data: external_exports.array(PresetResponseSchema)
14554
- })
14555
- },
14556
- summary: "List available group presets"
14557
- }
14558
- });
14559
-
14560
- // ../api-contract/src/profile/schema.ts
14561
- var MagicResizeCustomResolutionSchema = external_exports.object({
14562
- width: external_exports.number().int().min(64).max(4096),
14563
- height: external_exports.number().int().min(64).max(4096)
14564
- });
14565
- var UserAdvancedSettingsSchema = external_exports.object({
14566
- seedancePrecheckEnabled: external_exports.boolean().optional(),
14567
- seedanceDurationWarningEnabled: external_exports.boolean().optional(),
14568
- // Pro view: hide a node's prompt until hovered, shown translucently over
14569
- // the media instead of below the node.
14570
- hideNodePromptsEnabled: external_exports.boolean().optional(),
14571
- magicResizeCustomResolutions: external_exports.array(MagicResizeCustomResolutionSchema).max(20).optional()
14572
- });
14573
- var ProfileUserSchema = external_exports.object({
14574
- id: external_exports.string().uuid(),
14575
- name: external_exports.string(),
14576
- email: external_exports.string(),
14577
- agentAutoRun: external_exports.boolean(),
14578
- // Set once the user answers the "how did you hear about us" intro. Marks
14579
- // the account-level onboarding as done, independently of the canvas
14580
- // product tour (`completedProductTour`).
14581
- signupSource: external_exports.string().nullable(),
14582
- completedProductTour: external_exports.string().datetime().nullable(),
14583
- avatarUrl: external_exports.string().nullable(),
14584
- advancedSettings: UserAdvancedSettingsSchema,
14585
- /**
14586
- * Whether this session may open the staff tools panel — a Melius account,
14587
- * or somebody of ours behind a verified impersonation marker.
14588
- *
14589
- * Sent because the client cannot work it out. While impersonating, `email`
14590
- * above is the *customer's*, so a panel gated on the address it can see
14591
- * would disappear exactly when support needs it. Says nothing about what
14592
- * the tools do: the server re-decides that per request, so a client that
14593
- * forces this to true gets a panel whose switches change nothing.
14594
- *
14595
- * Optional, so a client built before this reads the payload unchanged.
14596
- */
14597
- canUseStaffTools: external_exports.boolean().optional()
14598
- });
14599
- var ProfileReferralInfoSchema = external_exports.object({
14600
- code: external_exports.string()
14601
- });
14602
- var ReferralRewardNotificationSchema = external_exports.object({
14603
- id: external_exports.string().uuid(),
14604
- kind: external_exports.enum(["referrer", "invitee"]),
14605
- counterpartName: external_exports.string(),
14606
- redeemedAt: external_exports.string().datetime()
14607
- });
14608
-
14609
- // ../api-contract/src/profile/routes.ts
14610
- var c9 = initContract();
14611
- var profileContract = c9.router({
14612
- getMyProfile: {
14613
- method: "GET",
14614
- path: "/profile/me",
14615
- responses: { 200: ProfileUserSchema }
14616
- },
14617
- getMyReferralInfo: {
14618
- method: "GET",
14619
- path: "/profile/referral",
14620
- responses: { 200: ProfileReferralInfoSchema }
14621
- },
14622
- getReferralRewards: {
14623
- method: "GET",
14624
- path: "/profile/referral/rewards",
14625
- responses: {
14626
- 200: external_exports.object({
14627
- rewards: external_exports.array(ReferralRewardNotificationSchema)
14628
- })
14629
- }
14630
- },
14631
- sendReferralInvite: {
14632
- method: "POST",
14633
- path: "/profile/referral/invite",
14634
- body: external_exports.object({
14635
- email: external_exports.string().email().max(320)
14636
- }),
14637
- responses: {
14638
- 200: external_exports.object({
14639
- result: external_exports.enum([
14640
- "sent",
14641
- "already_invited",
14642
- "already_has_account"
14643
- ])
14644
- })
14645
- }
14646
- },
14647
- updateMyProfile: {
14648
- method: "PATCH",
14649
- path: "/profile/me",
14650
- body: external_exports.object({
14651
- agentAutoRun: external_exports.boolean().optional(),
14652
- completedProductTour: external_exports.string().datetime().nullable().optional(),
14653
- avatarS3Bucket: external_exports.string().optional(),
14654
- avatarS3Key: external_exports.string().optional(),
14655
- signupSource: external_exports.string().min(1).max(200).optional()
14761
+ query: external_exports.object({
14762
+ weeks: external_exports.coerce.number().int().min(1).max(52).default(12)
14656
14763
  }),
14657
- responses: { 200: ProfileUserSchema }
14764
+ responses: {
14765
+ 200: GetGenerationsByWeekResponseSchema
14766
+ }
14658
14767
  },
14659
- updateAdvancedSettings: {
14660
- method: "PATCH",
14661
- path: "/profile/me/advanced-settings",
14662
- body: UserAdvancedSettingsSchema,
14768
+ precheckSeedance: {
14769
+ method: "POST",
14770
+ path: "/generation/precheck-seedance",
14771
+ body: SeedancePrecheckRequestSchema,
14663
14772
  responses: {
14664
- 200: external_exports.object({ advancedSettings: UserAdvancedSettingsSchema })
14773
+ 200: SeedancePrecheckResponseSchema
14665
14774
  }
14666
14775
  }
14667
14776
  });
14668
14777
 
14669
- // ../pricing/src/plan-ids.ts
14670
- var TEAM_PLAN_IDS = [
14671
- "TIER_0",
14672
- "TIER_1",
14673
- "TIER_2",
14674
- "TIER_3",
14675
- "TIER_4"
14676
- ];
14677
- var CUSTOM_PLAN_TYPE_IDS = ["enterprise", "creative_partner"];
14678
-
14679
- // ../pricing/src/credit-top-up.ts
14680
- var MELIUS_CREDITS_PER_USD = 1e3;
14681
- var CENTS_PER_USD = 100;
14682
- var CREDITS_PER_USD_CENT = MELIUS_CREDITS_PER_USD / CENTS_PER_USD;
14683
- var MAX_CREDIT_TOP_UP_DISCOUNT_PERCENTAGE = 90;
14684
-
14685
- // ../api-contract/src/team/schema.ts
14686
- var TeamRoleSchema = external_exports.enum(["owner", "admin", "editor", "viewer"]);
14687
- var TeamPlanSchema = external_exports.enum(TEAM_PLAN_IDS);
14688
- var CustomPlanTypeSchema = external_exports.enum(CUSTOM_PLAN_TYPE_IDS);
14689
- var InviteLinkRoleSchema = external_exports.enum(["admin", "editor", "viewer"]);
14690
- var EnterpriseOrderLineItemSchema = external_exports.object({
14691
- description: external_exports.string().min(1),
14692
- quantity: external_exports.string().min(1),
14693
- unitPrice: external_exports.string().min(1),
14694
- total: external_exports.string().min(1)
14695
- });
14696
- var EnterpriseBillingIntervalSchema = external_exports.enum(["monthly", "annual"]);
14697
- var EnterpriseAllowedPaymentMethodsSchema = external_exports.enum([
14698
- "card_and_bank",
14699
- "bank_only",
14700
- "card_only"
14701
- ]);
14702
- var EnterpriseStripeBillingInputSchema = external_exports.object({
14703
- unitAmount: external_exports.number().int().positive(),
14704
- // Expose the transform output to OpenAPI generation.
14705
- currency: external_exports.string().length(3).transform((value) => value.toLowerCase()).pipe(external_exports.string()),
14706
- billingInterval: EnterpriseBillingIntervalSchema,
14707
- creditsPerPeriod: external_exports.number().int().positive(),
14708
- allowedPaymentMethods: EnterpriseAllowedPaymentMethodsSchema.optional(),
14709
- contractEndAt: external_exports.string().datetime().optional(),
14710
- /**
14711
- * Whether the term rolls into another of the same length instead of
14712
- * ending. Only meaningful alongside a `contractEndAt`. Absent means off,
14713
- * which is what a plan created before this field gets; new plans send it
14714
- * explicitly rather than the resolver defaulting to on, so existing
14715
- * contracts keep their current behavior.
14716
- */
14717
- autoRenew: external_exports.boolean().optional()
14718
- }).refine(
14719
- (input) => input.billingInterval !== "annual" || input.contractEndAt != null,
14720
- {
14721
- message: "contractEndAt is required for annual billing",
14722
- path: ["contractEndAt"]
14723
- }
14724
- );
14725
- var CustomPlanCreditRolloverPolicySchema = external_exports.discriminatedUnion(
14726
- "mode",
14727
- [
14728
- external_exports.object({ mode: external_exports.literal("none") }),
14729
- external_exports.object({ mode: external_exports.literal("unlimited") }),
14730
- external_exports.object({
14731
- mode: external_exports.literal("months"),
14732
- months: external_exports.number().int().nonnegative()
14733
- }),
14734
- external_exports.object({
14735
- mode: external_exports.literal("percentage"),
14736
- percentage: external_exports.number().int().min(0).max(100)
14737
- })
14738
- ]
14739
- );
14740
- var EnterpriseOrderDetailsSchema = external_exports.object({
14741
- orderType: external_exports.string().min(1),
14742
- customPlanType: CustomPlanTypeSchema.optional(),
14743
- creditPackageAmount: external_exports.number().int().nonnegative(),
14744
- creditPackageUnit: external_exports.string().min(1),
14745
- creditRolloverPolicy: CustomPlanCreditRolloverPolicySchema.optional(),
14746
- /**
14747
- * Whole percent off the standard per-credit rate for top-ups beyond the
14748
- * plan's allowance. Absent means the standard rate. Unlike the rest of the
14749
- * order details this is not presentational — checkout, the Stripe grant and
14750
- * the receipt all price against it (see `@repo/pricing/credit-top-up`).
14751
- */
14752
- creditTopUpDiscountPercentage: external_exports.number().int().min(1).max(MAX_CREDIT_TOP_UP_DISCOUNT_PERCENTAGE).optional(),
14753
- orderDate: external_exports.string().date(),
14754
- /** Omit for plans with no fixed contract term (e.g. monthly Stripe plans). */
14755
- termCount: external_exports.number().int().positive().optional(),
14756
- termUnit: external_exports.string().min(1).optional(),
14757
- lineItems: external_exports.array(EnterpriseOrderLineItemSchema),
14758
- totalContractValue: external_exports.string().min(1)
14759
- });
14760
- var EnterprisePendingExpansionSchema = external_exports.object({
14761
- /** Stable id minted at prepare; also the credit-grant idempotency key. */
14762
- id: external_exports.string(),
14763
- newUnitAmount: external_exports.number().int().positive(),
14764
- newCreditsPerPeriod: external_exports.number().int().positive(),
14765
- newStripePriceId: external_exports.string().min(1),
14766
- /** Flat catch-up = new unit amount − current unit amount. Negative when the update lowers the rate; nothing is charged then. */
14767
- deltaAmountCents: external_exports.number().int(),
14768
- /** Credits granted on activation = new − current credits per period. Negative when the update lowers the allotment; nothing is granted or clawed back then. */
14769
- deltaCredits: external_exports.number().int(),
14770
- /** New contract end when the operator chose a new term; absent means keep the existing term. */
14771
- contractEndAt: external_exports.string().datetime().optional(),
14772
- keepContractEnd: external_exports.boolean(),
14773
- /**
14774
- * Operator-authored replacement order details (line items, total contract
14775
- * value, credit package, term) applied to the stored order when the customer
14776
- * activates. Absent keeps the existing terms. Purely presentational — the
14777
- * actual charge/credits come from the billing figures above.
14778
- */
14779
- newOrderDetails: EnterpriseOrderDetailsSchema.optional(),
14780
- preparedAt: external_exports.string().datetime(),
14781
- 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()
14782
14785
  });
14783
- var EnterprisePendingRenewalSchema = external_exports.object({
14784
- id: external_exports.string(),
14785
- newUnitAmount: external_exports.number().int().positive(),
14786
- newCreditsPerPeriod: external_exports.number().int().positive(),
14787
- newStripePriceId: external_exports.string().min(1),
14788
- /** Length of the renewal term in monthly billing periods. */
14789
- newTermMonths: external_exports.number().int().positive(),
14790
- newContractEndAt: external_exports.string().datetime(),
14791
- /** Operator-authored replacement order details. Purely presentational. */
14792
- newOrderDetails: EnterpriseOrderDetailsSchema.optional(),
14793
- preparedAt: external_exports.string().datetime(),
14794
- 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()
14795
14792
  });
14796
- var EnterpriseStripeBillingSchema = external_exports.object({
14797
- unitAmount: external_exports.number().int().positive(),
14798
- // Expose the transform output to OpenAPI generation.
14799
- currency: external_exports.string().length(3).transform((value) => value.toLowerCase()).pipe(external_exports.string()),
14800
- billingInterval: EnterpriseBillingIntervalSchema,
14801
- creditsPerPeriod: external_exports.number().int().positive(),
14802
- allowedPaymentMethods: EnterpriseAllowedPaymentMethodsSchema.optional(),
14803
- 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(),
14804
14800
  /**
14805
- * Whether the contract rolls into another term of the same length at
14806
- * `contractEndAt` instead of ending. Only meaningful alongside a
14807
- * `contractEndAt`; a plan with no fixed term already renews indefinitely.
14808
- * Absent means off, so a plan created before this field keeps ending at its
14809
- * 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.
14810
14805
  */
14811
- autoRenew: external_exports.boolean().optional(),
14812
- stripePriceId: external_exports.string().min(1),
14813
- activatedAt: external_exports.string().datetime().optional(),
14814
- activatedByEmail: external_exports.string().nullable().optional(),
14815
- paymentMethodType: external_exports.enum(["card", "us_bank_account"]).optional(),
14816
- firstPaymentSettledAt: external_exports.string().datetime().optional(),
14817
- pendingExpansion: EnterprisePendingExpansionSchema.optional(),
14818
- pendingRenewal: EnterprisePendingRenewalSchema.optional(),
14819
- /** Stripe subscription schedule driving a prepared renewal, while attached. */
14820
- stripeScheduleId: external_exports.string().min(1).optional()
14821
- });
14822
- var CustomerEnterpriseStripeBillingSchema = EnterpriseStripeBillingSchema.omit({
14823
- activatedAt: true,
14824
- activatedByEmail: true,
14825
- allowedPaymentMethods: true,
14826
- paymentMethodType: true,
14827
- firstPaymentSettledAt: true,
14828
- // Operator-only; the customer reads a pending expansion through the
14829
- // dedicated preview endpoint, which excludes operator emails.
14830
- pendingExpansion: true,
14831
- // Same reason — it carries the preparing operator's email.
14832
- pendingRenewal: true,
14833
- stripeScheduleId: true
14834
- });
14835
- var EnterpriseStripeBillingAuditActionSchema = external_exports.enum([
14836
- "created",
14837
- "mutated",
14838
- "activated",
14839
- "term_ended",
14840
- "canceled"
14841
- ]);
14842
- var EnterpriseStripeBillingAuditEntrySchema = external_exports.object({
14843
- at: external_exports.string().datetime(),
14844
- byEmail: external_exports.string().nullable(),
14845
- action: EnterpriseStripeBillingAuditActionSchema,
14846
- previousStripePriceId: external_exports.string().optional(),
14847
- notes: external_exports.string().optional()
14848
- });
14849
- var EnterpriseOrderSchema = EnterpriseOrderDetailsSchema.extend({
14850
- stripeBilling: EnterpriseStripeBillingInputSchema.optional()
14851
- });
14852
- var CustomerEnterpriseOrderSchema = EnterpriseOrderSchema.extend({
14853
- stripeBilling: CustomerEnterpriseStripeBillingSchema.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()
14854
14810
  });
14855
- var CustomPlanCreditGrantScheduleSchema = external_exports.object({
14856
- id: external_exports.string(),
14857
- creditPackageAmount: external_exports.number().int().nonnegative(),
14858
- creditPackageUnit: external_exports.string().min(1),
14859
- grantStartDate: external_exports.string().date(),
14860
- contractEndDate: external_exports.string().date(),
14861
- /** Set when an amendment, pause, or revert ended this entry early. */
14862
- effectiveEndDate: external_exports.string().date().optional(),
14863
- createdAt: external_exports.string().datetime(),
14864
- createdByEmail: external_exports.string().nullable()
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()
14865
14817
  });
14866
- var CustomPlanCreditGrantHistoryEntrySchema = external_exports.object({
14867
- grantDate: external_exports.string().date(),
14868
- amount: external_exports.number().int().nonnegative(),
14869
- /** Billing event id once granted; null if scheduled but not yet processed. */
14870
- billingEventId: external_exports.string().nullable(),
14871
- /** How the credit grant landed once granted; null while scheduled. */
14872
- billingSource: external_exports.enum(["custom_plan", "stripe"]).nullable(),
14873
- /** Idempotency/source reference for the grant, e.g. custom schedule key or Stripe invoice/subscription reference. */
14874
- billingReferenceId: external_exports.string().nullable(),
14875
- /** ISO timestamp when the grant landed; null while still scheduled. */
14876
- grantedAt: external_exports.string().datetime().nullable(),
14877
- status: external_exports.enum(["granted", "scheduled"])
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()
14878
14824
  });
14879
- var InternalEnterpriseOrderSchema = EnterpriseOrderSchema.extend({
14880
- updatedAt: external_exports.string().datetime(),
14881
- updatedByEmail: external_exports.string().nullable(),
14882
- creditGrantSchedule: external_exports.array(CustomPlanCreditGrantScheduleSchema),
14883
- creditGrantHistory: external_exports.array(CustomPlanCreditGrantHistoryEntrySchema),
14884
- nextGrantDate: external_exports.string().date().nullable(),
14885
- stripeBilling: EnterpriseStripeBillingSchema.optional(),
14886
- stripeBillingAuditLog: external_exports.array(EnterpriseStripeBillingAuditEntrySchema).optional()
14825
+ var CustomTextNodeDataSchema = external_exports.object({
14826
+ title: external_exports.string(),
14827
+ generatedText: external_exports.string().optional()
14887
14828
  });
14888
- var TeamAdvancedSettingsSchema = external_exports.object({
14889
- negativePromptEnabled: external_exports.boolean().optional(),
14890
- customSeedEnabled: external_exports.boolean().optional(),
14891
- // Auto-approve join requests from signups whose email domain matches this
14892
- // enterprise team's owner domain. Admin-governed via the dedicated
14893
- // domain-join-settings endpoint, not the editor-facing advanced-settings write.
14894
- domainJoinAutoApprove: external_exports.boolean().optional()
14895
- // NOTE: the team's approval policy config also lives in this jsonb column,
14896
- // but is deliberately NOT declared here — see `InternalTeamAdvancedSettings`
14897
- // in `apps/core/nagi/team/team.mappers.ts`, the same treatment
14898
- // `modelDiscounts` gets. Declaring it would publish the team's approver
14899
- // list into the public OpenAPI surface, and would make it writable through
14900
- // the editor-facing advanced-settings endpoint. It is read and written
14901
- // only through the admin-gated approvals endpoints.
14829
+ var GroupNodeDataSchema = external_exports.object({
14830
+ label: external_exports.string()
14902
14831
  });
14903
- var DomainJoinTargetSchema = external_exports.object({
14904
- teamId: external_exports.string().uuid(),
14905
- teamName: external_exports.string(),
14906
- teamPhotoUrl: external_exports.string().nullable(),
14907
- alreadyRequested: external_exports.boolean()
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()
14908
14884
  });
14909
- var JoinRequestSchema = external_exports.object({
14910
- id: external_exports.string().uuid(),
14911
- userId: external_exports.string().uuid(),
14912
- userName: external_exports.string(),
14913
- userEmail: external_exports.string(),
14914
- avatarUrl: external_exports.string().nullable(),
14915
- createdAt: external_exports.string().datetime()
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)
14916
14893
  });
14917
- var ActiveProductFeatureOverrideSchema = external_exports.object({
14918
- feature: external_exports.string().min(1),
14919
- expiresAt: 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
+ }
14920
14908
  });
14921
- var ActivePlanPreviewSchema = external_exports.object({
14922
- previewPlanTier: TeamPlanSchema,
14923
- 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)
14924
14914
  });
14925
- var TeamSchema = external_exports.object({
14926
- id: external_exports.string().uuid(),
14927
- name: external_exports.string(),
14928
- plan: TeamPlanSchema,
14929
- teamPhotoUrl: external_exports.string().nullable(),
14930
- createdAt: external_exports.string().datetime(),
14931
- creditExpiresAt: external_exports.string().datetime().nullable(),
14932
- enterpriseOrder: CustomerEnterpriseOrderSchema.nullable(),
14933
- advancedSettings: TeamAdvancedSettingsSchema,
14934
- activeProductFeatureOverrides: external_exports.array(ActiveProductFeatureOverrideSchema).default([]),
14935
- activePlanPreview: ActivePlanPreviewSchema.nullable().default(null)
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()
14936
14922
  });
14937
- var MemberSchema = external_exports.object({
14923
+ var ProfileUserSchema = external_exports.object({
14938
14924
  id: external_exports.string().uuid(),
14939
- role: TeamRoleSchema,
14940
- userId: external_exports.string().uuid(),
14941
- userName: external_exports.string(),
14942
- userEmail: external_exports.string(),
14943
- avatarUrl: external_exports.string().nullable()
14925
+ name: external_exports.string(),
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()
14944
14948
  });
14945
- var TeamMembershipSchema = external_exports.object({
14946
- id: external_exports.string().uuid(),
14947
- role: TeamRoleSchema,
14948
- team: TeamSchema
14949
+ var ProfileReferralInfoSchema = external_exports.object({
14950
+ code: external_exports.string()
14949
14951
  });
14950
- var InviteLinkSchema = external_exports.object({
14952
+ var ReferralRewardNotificationSchema = external_exports.object({
14951
14953
  id: external_exports.string().uuid(),
14952
- role: InviteLinkRoleSchema,
14953
- token: external_exports.string(),
14954
- createdAt: external_exports.string().datetime()
14954
+ kind: external_exports.enum(["referrer", "invitee"]),
14955
+ counterpartName: external_exports.string(),
14956
+ redeemedAt: external_exports.string().datetime()
14955
14957
  });
14956
- var EmailInviteStatusSchema = external_exports.enum(["pending", "accepted"]);
14957
- var EmailInviteSchema = external_exports.object({
14958
- id: external_exports.string().uuid(),
14959
- email: external_exports.string(),
14960
- role: InviteLinkRoleSchema,
14961
- status: EmailInviteStatusSchema,
14962
- senderName: external_exports.string(),
14963
- 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
+ }
14964
15023
  });
14965
15024
 
14966
15025
  // ../api-contract/src/share/schema.ts
@@ -16095,7 +16154,7 @@ function isMajorUpgrade(current, latest) {
16095
16154
  return l[0] > c14[0];
16096
16155
  }
16097
16156
  function shouldShowUpgradeNotice(ctx = {}) {
16098
- const current = ctx.current ?? "0.15.3";
16157
+ const current = ctx.current ?? "0.15.4";
16099
16158
  const latest = ctx.latest ?? serverLatestVersion;
16100
16159
  const env = ctx.env ?? process.env;
16101
16160
  const isTty = ctx.isTty ?? Boolean(process.stderr.isTTY);
@@ -16116,7 +16175,7 @@ Upgrade: npm install -g @melius-ai/cli@latest (or: brew update && brew upgrade
16116
16175
  function printUpgradeNoticeIfNeeded(ctx = {}) {
16117
16176
  try {
16118
16177
  if (!shouldShowUpgradeNotice(ctx)) return;
16119
- const current = ctx.current ?? "0.15.3";
16178
+ const current = ctx.current ?? "0.15.4";
16120
16179
  const latest = ctx.latest ?? serverLatestVersion;
16121
16180
  process.stderr.write(formatUpgradeNotice(current, latest));
16122
16181
  } catch {
@@ -20448,7 +20507,7 @@ function withDefaultHelp(args) {
20448
20507
  }
20449
20508
  function createProgram() {
20450
20509
  const program2 = new Command();
20451
- program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.15.3").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(
20452
20511
  "--fields <fields>",
20453
20512
  "Select specific output fields (comma-separated)"
20454
20513
  ).option("--quiet", "Suppress output, exit code only").option("--verbose", "Log request/response metadata to stderr").addHelpText(