@melius-ai/cli 0.15.3 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7741,7 +7741,7 @@ var MAX_INPUT_DOCUMENTS = 5;
7741
7741
  var MAX_AGENT_MESSAGE_CONTENT_LENGTH = 5e4;
7742
7742
  var MAX_SEED = 2147483647;
7743
7743
  var MAX_VARIATIONS = 10;
7744
- var MAX_PINNED_MODELS = 5;
7744
+ var MAX_PINNED_MODELS = 20;
7745
7745
 
7746
7746
  // ../api-contract/src/common.ts
7747
7747
  var MessageResponseSchema = external_exports.object({ message: external_exports.string() });
@@ -7757,6 +7757,17 @@ var CompletedPartSchema = external_exports.object({
7757
7757
  partNumber: external_exports.number().int().positive(),
7758
7758
  etag: external_exports.string()
7759
7759
  });
7760
+ var NodeMaterializationPayloadSchema = external_exports.object({
7761
+ nodeType: external_exports.string(),
7762
+ geometry: external_exports.object({
7763
+ x: external_exports.number(),
7764
+ y: external_exports.number(),
7765
+ w: external_exports.number(),
7766
+ h: external_exports.number()
7767
+ }),
7768
+ title: external_exports.string().optional(),
7769
+ createdByUserId: external_exports.string().uuid().optional()
7770
+ });
7760
7771
  function paginationQuery({
7761
7772
  maxLimit,
7762
7773
  defaultLimit
@@ -7922,6 +7933,12 @@ var FileCardSchema = external_exports.object({
7922
7933
  // version-stack affordance on the card and whether the viewer shows the
7923
7934
  // read-only Versions list. Absent/`<= 1` means a single version (no stack).
7924
7935
  versionCount: external_exports.number().int().nonnegative().optional(),
7936
+ // Live comments on this asset, across every thread on it — the count the
7937
+ // viewer's Comments tab would show. Drives the comment indicator on the
7938
+ // card so a member can see which assets are being discussed without opening
7939
+ // each one. Optional so a client that ships ahead of the server keeps
7940
+ // validating; absent reads the same as zero.
7941
+ commentCount: external_exports.number().int().nonnegative().optional(),
7925
7942
  // Node/version to toggle when favoriting this asset from a Files surface.
7926
7943
  favoriteNodeId: external_exports.string().uuid().nullable().optional(),
7927
7944
  favoriteVersionId: external_exports.string().uuid().nullable().optional(),
@@ -8204,6 +8221,38 @@ var ImportUploadcareFileBodySchema = external_exports.object({
8204
8221
  var ImportUploadcareFileResponseSchema = external_exports.object({
8205
8222
  file: FileCardSchema
8206
8223
  });
8224
+ var MAX_GOOGLE_DRIVE_FILE_ID_LENGTH = 512;
8225
+ var MAX_GOOGLE_DRIVE_ACCESS_TOKEN_LENGTH = 4096;
8226
+ var ImportGoogleDriveFileBodySchema = external_exports.object({
8227
+ driveFileId: external_exports.string().min(1).max(MAX_GOOGLE_DRIVE_FILE_ID_LENGTH),
8228
+ accessToken: external_exports.string().min(1).max(MAX_GOOGLE_DRIVE_ACCESS_TOKEN_LENGTH).optional(),
8229
+ folderId: external_exports.string().uuid().nullable().optional()
8230
+ });
8231
+ var ImportGoogleDriveFileResponseSchema = external_exports.object({
8232
+ file: FileCardSchema
8233
+ });
8234
+ var StartGoogleDriveImportJobBodySchema = external_exports.object({
8235
+ requestId: external_exports.string().uuid(),
8236
+ driveFileId: external_exports.string().min(1).max(MAX_GOOGLE_DRIVE_FILE_ID_LENGTH),
8237
+ folderId: external_exports.string().uuid().nullable().optional()
8238
+ });
8239
+ var StartGoogleDriveImportJobResponseSchema = external_exports.object({
8240
+ jobId: external_exports.string().uuid()
8241
+ });
8242
+ var GoogleDriveImportJobParamsSchema = external_exports.object({
8243
+ jobId: external_exports.string().uuid()
8244
+ });
8245
+ var GoogleDriveImportJobStatusSchema = external_exports.discriminatedUnion("status", [
8246
+ external_exports.object({ status: external_exports.literal("running") }),
8247
+ external_exports.object({
8248
+ status: external_exports.literal("completed"),
8249
+ file: FileCardSchema
8250
+ }),
8251
+ external_exports.object({
8252
+ status: external_exports.literal("failed"),
8253
+ message: external_exports.string()
8254
+ })
8255
+ ]);
8207
8256
  var UploadcareUploadSignatureResponseSchema = external_exports.object({
8208
8257
  signature: external_exports.string(),
8209
8258
  /** Unix seconds, as a string — the exact bytes that were signed. */
@@ -8552,7 +8601,7 @@ var agentContract = c.router({
8552
8601
  // Per-turn override for the persisted profile setting.
8553
8602
  // Omitted = use the user's saved preference.
8554
8603
  agentAutoRunOverride: external_exports.boolean().optional(),
8555
- // Plan mode (flag `agent-plan-mode`): run this turn on the
8604
+ // Plan mode: run this turn on the
8556
8605
  // execution model with high reasoning and a read-only toolset
8557
8606
  // so the agent drafts or refines a plan instead of executing.
8558
8607
  // Ignored (normal turn) when the flag is off for the caller.
@@ -8776,6 +8825,15 @@ var agentContract = c.router({
8776
8825
  }
8777
8826
  });
8778
8827
 
8828
+ // ../api-contract/src/errors.ts
8829
+ var API_ERROR_CODE = {
8830
+ projectNameTaken: "PROJECT_NAME_TAKEN",
8831
+ apiKeyNameTaken: "API_KEY_NAME_TAKEN",
8832
+ accountNotFound: "ACCOUNT_NOT_FOUND",
8833
+ /** The `:teamId` in the path names a different team than `X-Team-Id`. */
8834
+ teamIdMismatch: "TEAM_ID_MISMATCH"
8835
+ };
8836
+
8779
8837
  // ../api-contract/src/api-key/schema.ts
8780
8838
  var MAX_API_KEY_NAME_LENGTH = 255;
8781
8839
  var CreateApiKeyBodySchema = external_exports.object({
@@ -8788,6 +8846,9 @@ var CreateApiKeyBodySchema = external_exports.object({
8788
8846
  var RenameApiKeyBodySchema = external_exports.object({
8789
8847
  name: external_exports.string().trim().min(1).max(MAX_API_KEY_NAME_LENGTH)
8790
8848
  });
8849
+ var API_KEY_CONFLICT_CODE = {
8850
+ nameTaken: API_ERROR_CODE.apiKeyNameTaken
8851
+ };
8791
8852
  var AGENT_SESSION_KEY_NAME_PREFIX = "agent-session-";
8792
8853
  var API_KEY_NAME_RESERVED_MESSAGE = `"${AGENT_SESSION_KEY_NAME_PREFIX}" is a reserved name prefix`;
8793
8854
  var ApiKeyResponseSchema = external_exports.object({
@@ -8949,6 +9010,9 @@ var STANDARD_VOICE_LIBRARY_FILTER_OPTIONS = {
8949
9010
  age: ["young", "middle_aged", "old"],
8950
9011
  useCase: STANDARD_VOICE_LIBRARY_USE_CASES.map((entry) => entry.value)
8951
9012
  };
9013
+ var USE_CASE_LABEL_BY_VALUE = Object.fromEntries(
9014
+ STANDARD_VOICE_LIBRARY_USE_CASES.map((entry) => [entry.value, entry.label])
9015
+ );
8952
9016
  var asZodEnum = (values) => values;
8953
9017
  var AudioVoiceResponseSchema = external_exports.object({
8954
9018
  voiceId: external_exports.string(),
@@ -8957,10 +9021,7 @@ var AudioVoiceResponseSchema = external_exports.object({
8957
9021
  previewUrl: external_exports.string().url().nullable(),
8958
9022
  labels: external_exports.record(external_exports.string())
8959
9023
  });
8960
- var ListAudioVoicesQuerySchema = external_exports.object({
8961
- page: external_exports.coerce.number().int().min(0).default(0),
8962
- pageSize: external_exports.coerce.number().int().min(1).max(100).default(AUDIO_VOICE_LIBRARY_PAGE_SIZE),
8963
- search: external_exports.string().optional(),
9024
+ var StandardVoiceLibraryFilterQueryShape = {
8964
9025
  /** Maps to `category=high_quality` on ElevenLabs (`studio` is the only value). */
8965
9026
  quality: external_exports.enum(asZodEnum(STANDARD_VOICE_LIBRARY_FILTER_OPTIONS.quality)).optional(),
8966
9027
  language: external_exports.enum(asZodEnum(STANDARD_VOICE_LIBRARY_FILTER_OPTIONS.language)).optional(),
@@ -8968,6 +9029,12 @@ var ListAudioVoicesQuerySchema = external_exports.object({
8968
9029
  gender: external_exports.enum(asZodEnum(STANDARD_VOICE_LIBRARY_FILTER_OPTIONS.gender)).optional(),
8969
9030
  age: external_exports.enum(asZodEnum(STANDARD_VOICE_LIBRARY_FILTER_OPTIONS.age)).optional(),
8970
9031
  useCase: external_exports.enum(asZodEnum(STANDARD_VOICE_LIBRARY_FILTER_OPTIONS.useCase)).optional()
9032
+ };
9033
+ var ListAudioVoicesQuerySchema = external_exports.object({
9034
+ page: external_exports.coerce.number().int().min(0).default(0),
9035
+ pageSize: external_exports.coerce.number().int().min(1).max(100).default(AUDIO_VOICE_LIBRARY_PAGE_SIZE),
9036
+ search: external_exports.string().optional(),
9037
+ ...StandardVoiceLibraryFilterQueryShape
8971
9038
  });
8972
9039
  var ListAudioVoicesResponseSchema = external_exports.object({
8973
9040
  voices: external_exports.array(AudioVoiceResponseSchema),
@@ -9159,7 +9226,8 @@ var CANVAS_NODE_TYPES = [
9159
9226
  "pdf",
9160
9227
  "composite",
9161
9228
  "stitch",
9162
- "magic_resize"
9229
+ "magic_resize",
9230
+ "element"
9163
9231
  ];
9164
9232
  var CANVAS_GROUP_TYPES = ["default", "unified", "template"];
9165
9233
  var CANVAS_MEDIA_TYPES = ["image", "video", "audio", "pdf"];
@@ -9247,13 +9315,13 @@ var AUTO_MODEL_REGISTRY = [
9247
9315
  {
9248
9316
  nodeType: "image",
9249
9317
  inputPattern: "text-to-image",
9250
- model: "nano-banana-pro",
9318
+ model: "seedream-5-pro",
9251
9319
  variant: "text-to-image"
9252
9320
  },
9253
9321
  {
9254
9322
  nodeType: "image",
9255
9323
  inputPattern: "image-to-image",
9256
- model: "nano-banana-pro",
9324
+ model: "seedream-5-pro",
9257
9325
  variant: "image-to-image"
9258
9326
  },
9259
9327
  // ── Text ────────────────────────────────────────────────────────────
@@ -9497,6 +9565,12 @@ var MODALITIES = {
9497
9565
  var GENERATIVE_NODE_TYPES = Object.keys(
9498
9566
  MODALITIES
9499
9567
  );
9568
+ var SOURCE_ONLY_NODE_TYPES = /* @__PURE__ */ new Set([
9569
+ "custom_text",
9570
+ "file",
9571
+ "pdf",
9572
+ "element"
9573
+ ]);
9500
9574
  var NODE_DEFAULTS = {
9501
9575
  text: { title: "Text", mode: "text", prompt: "" },
9502
9576
  image: {
@@ -9528,7 +9602,8 @@ var NODE_DEFAULTS = {
9528
9602
  magic_resize: {
9529
9603
  title: "Magic resize",
9530
9604
  ratios: ["16:9", "1:1", "9:16", "4:3", "3:4"]
9531
- }
9605
+ },
9606
+ element: { title: "Element", src: "", mediaType: "image" }
9532
9607
  };
9533
9608
  function estimateNodeHeight(contentHeight) {
9534
9609
  return contentHeight + NODE_CARD_OVERHEAD;
@@ -9588,6 +9663,7 @@ function getDefaultGeometry(nodeType, aspectRatio) {
9588
9663
  return { x: 0, y: 0, w, h: estimateNodeHeight(contentH) };
9589
9664
  }
9590
9665
  case "file":
9666
+ case "element":
9591
9667
  return {
9592
9668
  x: 0,
9593
9669
  y: 0,
@@ -9652,6 +9728,7 @@ function getPresetNodeWidth(type, aspectRatio, explicitWidth) {
9652
9728
  function getEstimatedHeight(type) {
9653
9729
  switch (type) {
9654
9730
  case "file":
9731
+ case "element":
9655
9732
  return 320;
9656
9733
  case "text":
9657
9734
  case "custom_text":
@@ -10045,19 +10122,26 @@ function computeAutoformat(allNodes, allEdges, nodeIds) {
10045
10122
  const rawComponents = findConnectedComponents(targetIds, topologyEdges);
10046
10123
  const connectedComponents = rawComponents.filter((c14) => c14.length > 1);
10047
10124
  const isolatedIds = rawComponents.filter((c14) => c14.length === 1).flat().toSorted();
10048
- if (isolatedIds.length > 0) connectedComponents.push(isolatedIds);
10049
- const components = connectedComponents.toSorted((a, b) => {
10050
- const aHasText = a.some((id) => {
10051
- const n = nodeById.get(id);
10052
- return n != null && isTextType(n.nodeType);
10053
- });
10054
- const bHasText = b.some((id) => {
10055
- const n = nodeById.get(id);
10056
- return n != null && isTextType(n.nodeType);
10057
- });
10058
- if (aHasText !== bHasText) return aHasText ? -1 : 1;
10059
- return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
10060
- });
10125
+ const isSourceOnly = (id) => {
10126
+ const nodeType = nodeById.get(id)?.nodeType;
10127
+ return nodeType != null && SOURCE_ONLY_NODE_TYPES.has(nodeType);
10128
+ };
10129
+ const looseSources = isolatedIds.filter(isSourceOnly);
10130
+ const looseOthers = isolatedIds.filter((id) => !isSourceOnly(id));
10131
+ if (looseSources.length > 0) connectedComponents.push(looseSources);
10132
+ if (looseOthers.length > 0) connectedComponents.push(looseOthers);
10133
+ const componentRank = (ids) => {
10134
+ const nodes = ids.flatMap((id) => nodeById.get(id) ?? []);
10135
+ if (nodes.length > 0 && nodes.every((n) => isSourceOnly(n.id))) {
10136
+ return 0;
10137
+ }
10138
+ if (nodes.some((n) => isTextType(n.nodeType))) return 1;
10139
+ return 2;
10140
+ };
10141
+ const components = connectedComponents.map((ids) => ({ ids, rank: componentRank(ids) })).toSorted((a, b) => {
10142
+ if (a.rank !== b.rank) return a.rank - b.rank;
10143
+ return a.ids[0] < b.ids[0] ? -1 : a.ids[0] > b.ids[0] ? 1 : 0;
10144
+ }).map((c14) => c14.ids);
10061
10145
  if (components.length > 1) {
10062
10146
  const targets2 = sortedNodes.filter((n) => targetIds.has(n.id));
10063
10147
  const parentId2 = targets2[0]?.groupId;
@@ -10795,6 +10879,14 @@ function inferDirectFileNodeMediaTypeFromContentType(contentType) {
10795
10879
  if (mimeType === "application/pdf") return "pdf";
10796
10880
  return null;
10797
10881
  }
10882
+ function refuseDirectElementNode(input, ctx) {
10883
+ if (input.nodeType !== "element") return;
10884
+ ctx.addIssue({
10885
+ code: external_exports.ZodIssueCode.custom,
10886
+ path: ["nodeType"],
10887
+ message: "An element node is placed from the element library, not created directly"
10888
+ });
10889
+ }
10798
10890
  function validateDirectFileNodeAssetFields(input, ctx) {
10799
10891
  if (input.nodeType !== "file") {
10800
10892
  const assetField = [
@@ -11029,8 +11121,8 @@ var HeygenAvatarVariantSchema = external_exports.object({
11029
11121
  description: external_exports.string().describe("Pose, setting, and framing, e.g. 'Standing office front'")
11030
11122
  });
11031
11123
  var HeygenAvatarPersonSchema = external_exports.object({
11032
- name: external_exports.string().describe("The presenter's first name, e.g. 'Abigail'"),
11033
- variants: external_exports.array(HeygenAvatarVariantSchema).describe("Every pose available for this presenter")
11124
+ name: external_exports.string().describe("The avatar's first name, e.g. 'Abigail'"),
11125
+ variants: external_exports.array(HeygenAvatarVariantSchema).describe("Every pose available for this avatar")
11034
11126
  });
11035
11127
  var HeygenAvatarCatalogSchema = external_exports.object({
11036
11128
  people: external_exports.array(HeygenAvatarPersonSchema),
@@ -11138,6 +11230,23 @@ var PreviewAssetSchema = external_exports.object({
11138
11230
  thumbnailUrl: external_exports.string().nullable()
11139
11231
  });
11140
11232
 
11233
+ // ../api-contract/src/text-thinking.ts
11234
+ var TEXT_THINKING_LEVELS = [
11235
+ "off",
11236
+ "on",
11237
+ "minimal",
11238
+ "low",
11239
+ "medium",
11240
+ "high",
11241
+ "xhigh",
11242
+ "max"
11243
+ ];
11244
+ var TextThinkingLevelSchema = external_exports.enum(TEXT_THINKING_LEVELS);
11245
+ var TextThinkingCapabilitySchema = external_exports.object({
11246
+ levels: external_exports.array(TextThinkingLevelSchema).min(1),
11247
+ defaultLevel: TextThinkingLevelSchema
11248
+ });
11249
+
11141
11250
  // ../api-contract/src/canvas/schema.ts
11142
11251
  var CanvasResponseSchema = external_exports.object({
11143
11252
  id: external_exports.string().uuid(),
@@ -11186,10 +11295,18 @@ var EdgeTypeSchema = external_exports.enum([
11186
11295
  ]);
11187
11296
  var GroupTypeSchema = external_exports.enum(CANVAS_GROUP_TYPES);
11188
11297
  var GroupColorSchema = external_exports.enum(GROUP_COLOR_KEYS);
11298
+ var ImageGenerationQualityIdSchema = external_exports.string().trim().min(1).max(64);
11299
+ var ImageGenerationQualityOptionSchema = external_exports.object({
11300
+ id: ImageGenerationQualityIdSchema,
11301
+ label: external_exports.string().trim().min(1).max(64)
11302
+ });
11189
11303
  var ModelConfigSchema = external_exports.object({
11190
11304
  model: external_exports.string(),
11191
11305
  variant: external_exports.string(),
11192
11306
  tier: external_exports.string().nullable().optional(),
11307
+ quality: ImageGenerationQualityIdSchema.optional(),
11308
+ /** Text-only: reasoning control used for this version. */
11309
+ thinkingLevel: TextThinkingLevelSchema.optional(),
11193
11310
  /** HeyGen Avatar V only: the Runware avatar id for this node. */
11194
11311
  heygenAvatar: external_exports.string().optional(),
11195
11312
  /** HeyGen Avatar V presentation, speech, and output controls. */
@@ -11224,6 +11341,9 @@ var ModelConfigInputSchema = external_exports.object({
11224
11341
  model: external_exports.string(),
11225
11342
  variant: external_exports.string().refine(isValidGenerationMode, "Invalid generation mode"),
11226
11343
  tier: external_exports.string().nullable().optional(),
11344
+ quality: ImageGenerationQualityIdSchema.optional(),
11345
+ /** Text-only: reasoning control for this run. */
11346
+ thinkingLevel: TextThinkingLevelSchema.optional(),
11227
11347
  /** HeyGen Avatar V only: the Runware avatar id for this node. */
11228
11348
  heygenAvatar: external_exports.string().trim().min(1).optional(),
11229
11349
  /** HeyGen Avatar V presentation, speech, and output controls. */
@@ -11379,6 +11499,8 @@ var NodeVersionResponseSchema = external_exports.object({
11379
11499
  pdfExtraction: PdfExtractionSchema.nullable().optional(),
11380
11500
  /** Present when an active node run exists for this version (e.g. PDF extraction in progress). */
11381
11501
  nodeRunId: external_exports.string().uuid().nullable().optional(),
11502
+ /** Element nodes only: the element version this node version is pinned to. */
11503
+ elementVersionId: external_exports.string().uuid().nullable().optional(),
11382
11504
  layerCount: external_exports.number().int().nonnegative(),
11383
11505
  errorMessage: external_exports.string().nullable(),
11384
11506
  errorSeverity: ErrorSeveritySchema.nullable(),
@@ -11485,13 +11607,17 @@ var EdgeResponseSchema = external_exports.object({
11485
11607
  });
11486
11608
  var PinnedModelSchema = external_exports.object({
11487
11609
  model: external_exports.string(),
11488
- mode: external_exports.string().optional()
11610
+ mode: external_exports.string().optional(),
11611
+ /** Speed tier of the pinned row; absent names the model's standard speed. */
11612
+ tier: external_exports.string().nullable().optional()
11489
11613
  });
11490
11614
  var pinnedModelsField = external_exports.array(PinnedModelSchema).max(MAX_PINNED_MODELS).optional();
11491
11615
  var CanvasMediaPresetSchema = external_exports.object({
11492
11616
  image: external_exports.object({
11493
11617
  model: external_exports.string().optional(),
11494
11618
  mode: external_exports.string().optional(),
11619
+ /** Speed tier of the default row; absent names the standard speed. */
11620
+ tier: external_exports.string().nullable().optional(),
11495
11621
  pinnedModels: pinnedModelsField,
11496
11622
  aspectRatio: OutputAspectRatioSchema.optional(),
11497
11623
  resolution: OutputResolutionSchema.optional(),
@@ -11501,6 +11627,8 @@ var CanvasMediaPresetSchema = external_exports.object({
11501
11627
  video: external_exports.object({
11502
11628
  model: external_exports.string().optional(),
11503
11629
  mode: external_exports.string().optional(),
11630
+ /** Speed tier of the default row; absent names the standard speed. */
11631
+ tier: external_exports.string().nullable().optional(),
11504
11632
  pinnedModels: pinnedModelsField,
11505
11633
  aspectRatio: OutputAspectRatioSchema.optional(),
11506
11634
  resolution: OutputResolutionSchema.optional(),
@@ -11511,6 +11639,8 @@ var CanvasMediaPresetSchema = external_exports.object({
11511
11639
  text: external_exports.object({
11512
11640
  model: external_exports.string().optional(),
11513
11641
  mode: external_exports.string().optional(),
11642
+ /** Speed tier of the default row; absent names the standard speed. */
11643
+ tier: external_exports.string().nullable().optional(),
11514
11644
  pinnedModels: pinnedModelsField,
11515
11645
  fast: external_exports.boolean().optional(),
11516
11646
  numVariations: external_exports.number().int().min(1).max(MAX_VARIATIONS).optional()
@@ -11518,6 +11648,8 @@ var CanvasMediaPresetSchema = external_exports.object({
11518
11648
  audio: external_exports.object({
11519
11649
  model: external_exports.string().optional(),
11520
11650
  mode: external_exports.string().optional(),
11651
+ /** Speed tier of the default row; absent names the standard speed. */
11652
+ tier: external_exports.string().nullable().optional(),
11521
11653
  pinnedModels: pinnedModelsField,
11522
11654
  /** Default ElevenLabs stock voice id (text-to-speech / voice changer). */
11523
11655
  voiceId: external_exports.string().optional(),
@@ -12007,8 +12139,8 @@ var CreateDirectNodeBodyObjectSchema = external_exports.object({
12007
12139
  });
12008
12140
  var CreateDirectNodeBodySchema = CreateDirectNodeBodyObjectSchema.superRefine(
12009
12141
  validateDirectFileNodeAssetFields
12010
- );
12011
- var UpdateDirectNodeBodySchema = external_exports.object({
12142
+ ).superRefine(refuseDirectElementNode);
12143
+ var UpdateDirectNodeBodyObjectSchema = external_exports.object({
12012
12144
  geometry: GeometrySchema.optional(),
12013
12145
  nodeType: NodeTypeSchema.optional(),
12014
12146
  title: external_exports.string().optional(),
@@ -12033,6 +12165,7 @@ var UpdateDirectNodeBodySchema = external_exports.object({
12033
12165
  customVoiceId: external_exports.string().uuid().nullable().optional(),
12034
12166
  elevenLabsVoiceSettings: ElevenLabsVoiceSettingsSchema.nullable().optional()
12035
12167
  });
12168
+ var UpdateDirectNodeBodySchema = UpdateDirectNodeBodyObjectSchema.superRefine(refuseDirectElementNode);
12036
12169
  var CreateDirectEdgeBodySchema = external_exports.object({
12037
12170
  id: external_exports.string().uuid(),
12038
12171
  srcNodeId: external_exports.string().uuid(),
@@ -12195,7 +12328,12 @@ var CanvasSettingsResponseSchema = external_exports.object({
12195
12328
  createdAt: external_exports.string().datetime(),
12196
12329
  updatedAt: external_exports.string().datetime()
12197
12330
  });
12198
- var GenerationSurfaceSchema = external_exports.enum(["playground", "cast"]);
12331
+ var GenerationSurfaceSchema = external_exports.enum([
12332
+ "playground",
12333
+ "cast",
12334
+ "element"
12335
+ ]);
12336
+ var RequestableGenerationSurfaceSchema = GenerationSurfaceSchema.exclude(["element"]);
12199
12337
  var PlaygroundCanvasReferenceSchema = external_exports.object({
12200
12338
  projectId: external_exports.string().uuid(),
12201
12339
  canvasId: external_exports.string().uuid()
@@ -12225,7 +12363,7 @@ var canvasContract = c4.router({
12225
12363
  body: external_exports.object({
12226
12364
  destination: PlaygroundCanvasDestinationSchema.optional(),
12227
12365
  /** Defaults to `playground` server-side. */
12228
- surface: GenerationSurfaceSchema.optional()
12366
+ surface: RequestableGenerationSurfaceSchema.optional()
12229
12367
  }).optional(),
12230
12368
  responses: {
12231
12369
  201: PlaygroundCanvasReferenceSchema,
@@ -12239,7 +12377,7 @@ var canvasContract = c4.router({
12239
12377
  query: external_exports.object({
12240
12378
  ...paginationQuery({ maxLimit: 100, defaultLimit: 25 }),
12241
12379
  /** Defaults to `playground` server-side. */
12242
- surface: GenerationSurfaceSchema.optional()
12380
+ surface: RequestableGenerationSurfaceSchema.optional()
12243
12381
  }),
12244
12382
  responses: { 200: PlaygroundCanvasPageSchema }
12245
12383
  },
@@ -12908,7 +13046,19 @@ var canvasContract = c4.router({
12908
13046
  * Node ids whose audio-to-video duration should be matched to
12909
13047
  * connected generated audio after upstream audio nodes finish.
12910
13048
  */
12911
- matchAudioToVideoDurationNodeIds: external_exports.array(external_exports.string().uuid()).max(500).optional()
13049
+ matchAudioToVideoDurationNodeIds: external_exports.array(external_exports.string().uuid()).max(500).optional(),
13050
+ /**
13051
+ * Node ids whose connected audio may be shortened to the longest
13052
+ * clip the model offers, when it overruns by a hair.
13053
+ *
13054
+ * Separate from the field above, and deliberately narrower: matching
13055
+ * grows the *video* to fit the read and is safe for anything, while
13056
+ * this drops the end of somebody's audio. Only a caller that
13057
+ * generated that audio itself — from a script the member wrote, in
13058
+ * the same run — can say that is the right trade, so the permission
13059
+ * is the caller's to give rather than something inferred here.
13060
+ */
13061
+ trimAudioToMatchedDurationNodeIds: external_exports.array(external_exports.string().uuid()).max(500).optional()
12912
13062
  }),
12913
13063
  responses: {
12914
13064
  201: BulkNodeRunResponseSchema,
@@ -13221,7 +13371,10 @@ var canvasContract = c4.router({
13221
13371
  assetId: external_exports.string().uuid()
13222
13372
  }),
13223
13373
  body: external_exports.object({
13224
- nodeId: external_exports.string().uuid()
13374
+ nodeId: external_exports.string().uuid(),
13375
+ // The node was just created client-side in the CRDT; this lets the
13376
+ // server materialize its row when the WS update hasn't arrived yet.
13377
+ node: NodeMaterializationPayloadSchema.optional()
13225
13378
  }),
13226
13379
  responses: {
13227
13380
  200: external_exports.object({
@@ -13400,6 +13553,8 @@ var ASSET_ENGAGEMENT_SOURCES = {
13400
13553
  /** In-app (web) Mel chat acting for a member. */
13401
13554
  Agent: "agent",
13402
13555
  Canvas: "canvas",
13556
+ /** Cast studio playback handoff: download or public sharing. */
13557
+ Cast: "cast",
13403
13558
  /** API key with no MCP session header — CLI and direct API use. */
13404
13559
  Cli: "cli",
13405
13560
  Files: "files",
@@ -13413,6 +13568,7 @@ var ASSET_ENGAGEMENT_SOURCES = {
13413
13568
  };
13414
13569
  var ClientAssetEngagementSourceSchema = external_exports.enum([
13415
13570
  ASSET_ENGAGEMENT_SOURCES.Canvas,
13571
+ ASSET_ENGAGEMENT_SOURCES.Cast,
13416
13572
  ASSET_ENGAGEMENT_SOURCES.Files,
13417
13573
  ASSET_ENGAGEMENT_SOURCES.Playground
13418
13574
  ]);
@@ -13421,1546 +13577,1666 @@ var AssetDownloadResponseSchema = external_exports.object({
13421
13577
  filename: external_exports.string()
13422
13578
  });
13423
13579
 
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
- },
13675
- summary: "Restore a file hidden from Files"
13676
- },
13580
+ // ../pricing/src/plan-ids.ts
13581
+ var TEAM_PLAN_IDS = [
13582
+ "TIER_0",
13583
+ "TIER_1",
13584
+ "TIER_2",
13585
+ "TIER_3",
13586
+ "TIER_4"
13587
+ ];
13588
+ var CUSTOM_PLAN_TYPE_IDS = ["enterprise", "creative_partner"];
13589
+
13590
+ // ../pricing/src/credit-top-up.ts
13591
+ var MELIUS_CREDITS_PER_USD = 1e3;
13592
+ var CENTS_PER_USD = 100;
13593
+ var CREDITS_PER_USD_CENT = MELIUS_CREDITS_PER_USD / CENTS_PER_USD;
13594
+ var MAX_CREDIT_TOP_UP_DISCOUNT_PERCENTAGE = 90;
13595
+
13596
+ // ../api-contract/src/team/schema.ts
13597
+ var TeamRoleSchema = external_exports.enum(["owner", "admin", "editor", "viewer"]);
13598
+ var TeamPlanSchema = external_exports.enum(TEAM_PLAN_IDS);
13599
+ var ResolvedTeamSchema = external_exports.object({
13600
+ teamId: external_exports.string().uuid(),
13601
+ role: TeamRoleSchema
13602
+ });
13603
+ var CustomPlanTypeSchema = external_exports.enum(CUSTOM_PLAN_TYPE_IDS);
13604
+ var InviteLinkRoleSchema = external_exports.enum(["admin", "editor", "viewer"]);
13605
+ var EnterpriseOrderLineItemSchema = external_exports.object({
13606
+ description: external_exports.string().min(1),
13607
+ quantity: external_exports.string().min(1),
13608
+ unitPrice: external_exports.string().min(1),
13609
+ total: external_exports.string().min(1)
13610
+ });
13611
+ var EnterpriseBillingIntervalSchema = external_exports.enum(["monthly", "annual"]);
13612
+ var EnterpriseAllowedPaymentMethodsSchema = external_exports.enum([
13613
+ "card_and_bank",
13614
+ "bank_only",
13615
+ "card_only"
13616
+ ]);
13617
+ var EnterpriseStripeBillingInputSchema = external_exports.object({
13618
+ unitAmount: external_exports.number().int().positive(),
13619
+ // Expose the transform output to OpenAPI generation.
13620
+ currency: external_exports.string().length(3).transform((value) => value.toLowerCase()).pipe(external_exports.string()),
13621
+ billingInterval: EnterpriseBillingIntervalSchema,
13622
+ creditsPerPeriod: external_exports.number().int().positive(),
13623
+ allowedPaymentMethods: EnterpriseAllowedPaymentMethodsSchema.optional(),
13624
+ contractEndAt: external_exports.string().datetime().optional(),
13677
13625
  /**
13678
- * Put a generation made on a canvas no member may view into Files. Cast's
13679
- * clips are the first caller: the canvas they were made on is the
13680
- * product's, so nothing on it is a file until somebody asks for one.
13681
- *
13682
- * Distinct from `unhideFile`, which restores a file the member removed.
13683
- * This one adds a file that was never there.
13626
+ * Whether the term rolls into another of the same length instead of
13627
+ * ending. Only meaningful alongside a `contractEndAt`. Absent means off,
13628
+ * which is what a plan created before this field gets; new plans send it
13629
+ * explicitly rather than the resolver defaulting to on, so existing
13630
+ * contracts keep their current behavior.
13684
13631
  */
13685
- saveFileToFiles: {
13686
- method: "POST",
13687
- path: "/files/:assetId/save",
13688
- pathParams: FileAssetIdParamsSchema,
13689
- body: null,
13690
- responses: {
13691
- 204: c6.noBody(),
13692
- 403: ErrorBodySchema,
13693
- 404: ErrorBodySchema
13694
- },
13695
- summary: "Save a generation into Files"
13696
- },
13697
- unsaveFileFromFiles: {
13698
- method: "POST",
13699
- path: "/files/:assetId/unsave",
13700
- pathParams: FileAssetIdParamsSchema,
13701
- body: null,
13702
- responses: {
13703
- 204: c6.noBody(),
13704
- 403: ErrorBodySchema,
13705
- 404: ErrorBodySchema
13706
- },
13707
- summary: "Take a saved generation back out of Files"
13708
- },
13709
- listFiles: {
13710
- method: "GET",
13711
- path: "/files",
13712
- query: ListFilesQuerySchema,
13713
- responses: {
13714
- 200: ListFilesResponseSchema,
13715
- 403: ErrorBodySchema
13716
- },
13717
- summary: "List team files"
13718
- },
13719
- getFileTabCounts: {
13720
- method: "GET",
13721
- path: "/files/tab-counts",
13722
- query: FileTabCountsQuerySchema,
13723
- responses: {
13724
- 200: FileTabCountsResponseSchema,
13725
- 403: ErrorBodySchema
13726
- },
13727
- summary: "Per-tab asset counts for the Assets page, scoped to the search"
13728
- },
13729
- searchAgentAssets: {
13730
- method: "GET",
13731
- path: "/files/agent-search",
13732
- query: AgentAssetSearchRequestSchema,
13733
- responses: {
13734
- 200: AgentAssetSearchResponseSchema,
13735
- 403: ErrorBodySchema
13736
- },
13737
- summary: "Search team assets for the agent"
13738
- },
13739
- listAgentAssetFolders: {
13740
- method: "GET",
13741
- path: "/files/agent-folders",
13742
- responses: {
13743
- 200: AgentListAssetFoldersResponseSchema,
13744
- 403: ErrorBodySchema
13745
- },
13746
- summary: "List team asset folders for the agent"
13747
- },
13748
- getEmbeddingStorageUsage: {
13749
- method: "GET",
13750
- path: "/files/embedding-storage-usage",
13751
- responses: {
13752
- 200: EmbeddingStorageUsageResponseSchema,
13753
- 403: ErrorBodySchema
13754
- },
13755
- summary: "Get the team's DAM embedding-storage usage and cap"
13756
- },
13757
- getFileDetail: {
13758
- method: "GET",
13759
- path: "/files/:assetId/detail",
13760
- pathParams: FileAssetIdParamsSchema,
13761
- responses: {
13762
- 200: FileDetailSchema,
13763
- 403: ErrorBodySchema,
13764
- 404: ErrorBodySchema
13765
- },
13766
- summary: "Get a file's details with generation metadata"
13767
- },
13768
- getAssetShareMode: {
13769
- method: "GET",
13770
- path: "/files/:assetId/share-mode",
13771
- pathParams: FileAssetIdParamsSchema,
13772
- responses: {
13773
- 200: external_exports.object({ shareMode: AssetShareModeSchema }),
13774
- 403: ErrorBodySchema,
13775
- 404: ErrorBodySchema
13776
- },
13777
- summary: "Get an asset's share mode"
13778
- },
13779
- updateAssetShareMode: {
13780
- method: "PATCH",
13781
- path: "/files/:assetId/share-mode",
13782
- pathParams: FileAssetIdParamsSchema,
13783
- body: external_exports.object({
13784
- shareMode: AssetShareModeSchema,
13785
- nodeVersionId: external_exports.string().uuid().nullable().optional(),
13786
- engagementSource: ClientAssetEngagementSourceSchema.optional()
13632
+ autoRenew: external_exports.boolean().optional()
13633
+ }).refine(
13634
+ (input) => input.billingInterval !== "annual" || input.contractEndAt != null,
13635
+ {
13636
+ message: "contractEndAt is required for annual billing",
13637
+ path: ["contractEndAt"]
13638
+ }
13639
+ );
13640
+ var CustomPlanCreditRolloverPolicySchema = external_exports.discriminatedUnion(
13641
+ "mode",
13642
+ [
13643
+ external_exports.object({ mode: external_exports.literal("none") }),
13644
+ external_exports.object({ mode: external_exports.literal("unlimited") }),
13645
+ external_exports.object({
13646
+ mode: external_exports.literal("months"),
13647
+ months: external_exports.number().int().nonnegative()
13787
13648
  }),
13788
- responses: {
13789
- 200: external_exports.object({ shareMode: AssetShareModeSchema }),
13790
- 403: ErrorBodySchema,
13791
- 404: ErrorBodySchema
13792
- },
13793
- summary: "Set who can view an asset"
13794
- },
13795
- initFileUpload: {
13796
- method: "POST",
13797
- path: "/files/upload/init",
13798
- body: InitFilesUploadBodySchema,
13799
- responses: {
13800
- 200: InitFilesUploadResponseSchema,
13801
- 403: ErrorBodySchema
13802
- },
13803
- summary: "Initiate a Files upload"
13804
- },
13805
- completeFileUpload: {
13806
- method: "POST",
13807
- path: "/files/upload/complete",
13808
- body: CompleteFilesUploadBodySchema,
13809
- responses: {
13810
- 200: CompleteFilesUploadResponseSchema,
13811
- 403: ErrorBodySchema
13812
- },
13813
- summary: "Complete a Files upload"
13814
- },
13815
- createUploadcareUploadSignature: {
13816
- method: "POST",
13817
- path: "/files/import/uploadcare/signature",
13818
- body: external_exports.object({}),
13819
- responses: {
13820
- 200: UploadcareUploadSignatureResponseSchema,
13821
- 403: ErrorBodySchema
13822
- },
13823
- summary: "Mint short-lived credentials for a signed Uploadcare upload"
13824
- },
13825
- importUploadcareFile: {
13826
- method: "POST",
13827
- path: "/files/import/uploadcare",
13828
- body: ImportUploadcareFileBodySchema,
13829
- responses: {
13830
- 200: ImportUploadcareFileResponseSchema,
13831
- 400: ErrorBodySchema,
13832
- 403: ErrorBodySchema,
13833
- 404: ErrorBodySchema
13834
- },
13835
- summary: "Import a file picked from a cloud source through Uploadcare"
13836
- }
13837
- });
13838
-
13839
- // ../api-contract/src/audio-voices.ts
13840
- var VoiceCatalogIdSchema = external_exports.enum(["elevenlabs", "fish-audio"]);
13841
- var VoiceCapabilitySchema = external_exports.discriminatedUnion("source", [
13842
- external_exports.object({
13843
- source: external_exports.literal("static"),
13844
- /** The provider's complete voice enum. */
13845
- values: external_exports.array(external_exports.string()).readonly(),
13846
- defaultVoice: external_exports.string()
13847
- }),
13848
- external_exports.object({
13849
- source: external_exports.literal("catalog"),
13850
- catalog: VoiceCatalogIdSchema,
13851
- defaultVoice: external_exports.string().optional(),
13852
- /** Team-owned cloned voices may be selected alongside the catalog. */
13853
- supportsCustomVoices: external_exports.boolean().optional()
13854
- })
13855
- ]);
13856
-
13857
- // ../api-contract/src/generation/schema.ts
13858
- var GenerationJobStatusSchema = external_exports.enum([
13859
- "in_progress",
13860
- "finished",
13861
- "failed",
13862
- "cancelled"
13863
- ]);
13864
- var FISH_AUDIO_MODEL = "fish-audio-s2.1-pro";
13865
- var BetterFontSourceSchema = external_exports.enum(["custom", "google"]);
13866
- var BetterFontSelectionSchema = external_exports.object({
13867
- source: BetterFontSourceSchema,
13868
- familyName: external_exports.string().trim().min(1).max(100)
13869
- });
13870
- var GenerationMediaMetadataSchema = external_exports.object({
13871
- width: external_exports.number().int().positive().nullable().optional(),
13872
- height: external_exports.number().int().positive().nullable().optional(),
13873
- fileSizeBytes: external_exports.number().int().nonnegative().nullable().optional()
13874
- });
13875
- var GenerationRunBodySchema = external_exports.object({
13876
- model: external_exports.string().trim().min(1),
13877
- tier: external_exports.string().optional(),
13878
- prompt: external_exports.string().trim().min(1).optional(),
13879
- /** Selected avatar id from Runware's HeyGen Avatar V catalog. */
13880
- heygenAvatar: external_exports.string().trim().min(1).optional(),
13881
- /** HeyGen Avatar V presentation controls. */
13882
- heygenSettings: HeygenAvatarSettingsSchema.optional(),
13883
- imageUrls: external_exports.array(external_exports.string().url()).optional(),
13884
- endImageUrls: external_exports.array(external_exports.string().url()).optional(),
13885
- referenceImageUrls: external_exports.array(external_exports.string().url()).optional(),
13886
- imageMetadata: external_exports.array(GenerationMediaMetadataSchema).optional(),
13887
- endImageMetadata: external_exports.array(GenerationMediaMetadataSchema).optional(),
13888
- referenceImageMetadata: external_exports.array(GenerationMediaMetadataSchema).optional(),
13889
- videoUrl: external_exports.string().url().optional(),
13890
- videoUrls: external_exports.array(external_exports.string().url()).optional(),
13891
- audioUrls: external_exports.array(external_exports.string().url()).optional(),
13892
- videoMetadata: external_exports.array(GenerationMediaMetadataSchema).optional(),
13893
- audioMetadata: external_exports.array(GenerationMediaMetadataSchema).optional(),
13894
- videoDurationsMs: external_exports.array(external_exports.number().int().nonnegative().nullable()).optional(),
13895
- audioDurationsMs: external_exports.array(external_exports.number().int().nonnegative().nullable()).optional(),
13896
- aspectRatio: OutputAspectRatioSchema.optional(),
13897
- duration: external_exports.number().int().positive().optional(),
13898
- resolution: OutputResolutionSchema.optional(),
13899
- seed: external_exports.number().int().nonnegative().max(MAX_SEED).optional(),
13900
- numVariations: external_exports.number().int().min(1).max(MAX_VARIATIONS).optional(),
13901
- /**
13902
- * Whether the variant should generate audio. Only honored on variants
13903
- * whose registry entry declares `falAudioField`. Defaults to `true`.
13904
- */
13905
- generateAudio: external_exports.boolean().optional(),
13906
- /**
13907
- * Optional negative prompt — terms the user wants suppressed from the
13908
- * output. Only honored on variants whose registry entry declares
13909
- * `falNegativePromptField`. Empty/whitespace values are dropped before
13910
- * sending so the provider's own default (e.g. Kling's
13911
- * "blur, distort, and low quality") still applies.
13912
- */
13913
- negativePrompt: external_exports.string().optional(),
13914
- /** Recraft's preferred RGB palette. Ignored by models without `falColorsField`. */
13915
- colors: external_exports.array(RgbColorSchema).optional(),
13916
- /** Recraft's RGB background colour. Ignored by models without `falBackgroundColorField`. */
13917
- backgroundColor: RgbColorSchema.optional(),
13649
+ external_exports.object({
13650
+ mode: external_exports.literal("percentage"),
13651
+ percentage: external_exports.number().int().min(0).max(100)
13652
+ })
13653
+ ]
13654
+ );
13655
+ var EnterpriseOrderDetailsSchema = external_exports.object({
13656
+ orderType: external_exports.string().min(1),
13657
+ customPlanType: CustomPlanTypeSchema.optional(),
13658
+ creditPackageAmount: external_exports.number().int().nonnegative(),
13659
+ creditPackageUnit: external_exports.string().min(1),
13660
+ creditRolloverPolicy: CustomPlanCreditRolloverPolicySchema.optional(),
13918
13661
  /**
13919
- * The font the better-font-32b model should use as its typography
13920
- * reference. Only honored when `model === "better-font-32b"`; ignored
13921
- * by every other model. When absent, the server falls back to a
13922
- * default Google font (Inter).
13662
+ * Whole percent off the standard per-credit rate for top-ups beyond the
13663
+ * plan's allowance. Absent means the standard rate. Unlike the rest of the
13664
+ * order details this is not presentational — checkout, the Stripe grant and
13665
+ * the receipt all price against it (see `@repo/pricing/credit-top-up`).
13923
13666
  */
13924
- font: BetterFontSelectionSchema.optional(),
13667
+ creditTopUpDiscountPercentage: external_exports.number().int().min(1).max(MAX_CREDIT_TOP_UP_DISCOUNT_PERCENTAGE).optional(),
13668
+ orderDate: external_exports.string().date(),
13669
+ /** Omit for plans with no fixed contract term (e.g. monthly Stripe plans). */
13670
+ termCount: external_exports.number().int().positive().optional(),
13671
+ termUnit: external_exports.string().min(1).optional(),
13672
+ lineItems: external_exports.array(EnterpriseOrderLineItemSchema),
13673
+ totalContractValue: external_exports.string().min(1)
13674
+ });
13675
+ var EnterprisePendingExpansionSchema = external_exports.object({
13676
+ /** Stable id minted at prepare; also the credit-grant idempotency key. */
13677
+ id: external_exports.string(),
13678
+ newUnitAmount: external_exports.number().int().positive(),
13679
+ newCreditsPerPeriod: external_exports.number().int().positive(),
13680
+ newStripePriceId: external_exports.string().min(1),
13681
+ /** Flat catch-up = new unit amount − current unit amount. Negative when the update lowers the rate; nothing is charged then. */
13682
+ deltaAmountCents: external_exports.number().int(),
13683
+ /** Credits granted on activation = new − current credits per period. Negative when the update lowers the allotment; nothing is granted or clawed back then. */
13684
+ deltaCredits: external_exports.number().int(),
13685
+ /** New contract end when the operator chose a new term; absent means keep the existing term. */
13686
+ contractEndAt: external_exports.string().datetime().optional(),
13687
+ keepContractEnd: external_exports.boolean(),
13925
13688
  /**
13926
- * LoRA adapters to stack on a LoRA-capable image generation (`{ id, weight }`;
13927
- * the server resolves each id to a presigned weights URL). Only honored on
13928
- * LoRA-capable models (SDXL on Modal, Flux on fal); ignored by every other
13929
- * model.
13689
+ * Operator-authored replacement order details (line items, total contract
13690
+ * value, credit package, term) applied to the stored order when the customer
13691
+ * activates. Absent keeps the existing terms. Purely presentational — the
13692
+ * actual charge/credits come from the billing figures above.
13930
13693
  */
13931
- loras: LoraStackSchema.optional(),
13932
- /** Sampler steps. Only honored on LoRA-capable models (SDXL, Flux). */
13933
- steps: SdxlStepsSchema.optional(),
13694
+ newOrderDetails: EnterpriseOrderDetailsSchema.optional(),
13695
+ preparedAt: external_exports.string().datetime(),
13696
+ preparedByEmail: external_exports.string().nullable()
13697
+ });
13698
+ var EnterprisePendingRenewalSchema = external_exports.object({
13699
+ id: external_exports.string(),
13700
+ newUnitAmount: external_exports.number().int().positive(),
13701
+ newCreditsPerPeriod: external_exports.number().int().positive(),
13702
+ newStripePriceId: external_exports.string().min(1),
13703
+ /** Length of the renewal term in monthly billing periods. */
13704
+ newTermMonths: external_exports.number().int().positive(),
13705
+ newContractEndAt: external_exports.string().datetime(),
13706
+ /** Operator-authored replacement order details. Purely presentational. */
13707
+ newOrderDetails: EnterpriseOrderDetailsSchema.optional(),
13708
+ preparedAt: external_exports.string().datetime(),
13709
+ preparedByEmail: external_exports.string().nullable()
13710
+ });
13711
+ var EnterpriseStripeBillingSchema = external_exports.object({
13712
+ unitAmount: external_exports.number().int().positive(),
13713
+ // Expose the transform output to OpenAPI generation.
13714
+ currency: external_exports.string().length(3).transform((value) => value.toLowerCase()).pipe(external_exports.string()),
13715
+ billingInterval: EnterpriseBillingIntervalSchema,
13716
+ creditsPerPeriod: external_exports.number().int().positive(),
13717
+ allowedPaymentMethods: EnterpriseAllowedPaymentMethodsSchema.optional(),
13718
+ contractEndAt: external_exports.string().datetime().optional(),
13934
13719
  /**
13935
- * Classifier-free guidance scale. Only honored on LoRA-capable models
13936
- * (SDXL, Flux).
13720
+ * Whether the contract rolls into another term of the same length at
13721
+ * `contractEndAt` instead of ending. Only meaningful alongside a
13722
+ * `contractEndAt`; a plan with no fixed term already renews indefinitely.
13723
+ * Absent means off, so a plan created before this field keeps ending at its
13724
+ * contract end. Read it through `resolveEnterpriseAutoRenew`.
13937
13725
  */
13938
- guidanceScale: SdxlGuidanceScaleSchema.optional()
13726
+ autoRenew: external_exports.boolean().optional(),
13727
+ stripePriceId: external_exports.string().min(1),
13728
+ activatedAt: external_exports.string().datetime().optional(),
13729
+ activatedByEmail: external_exports.string().nullable().optional(),
13730
+ paymentMethodType: external_exports.enum(["card", "us_bank_account"]).optional(),
13731
+ firstPaymentSettledAt: external_exports.string().datetime().optional(),
13732
+ pendingExpansion: EnterprisePendingExpansionSchema.optional(),
13733
+ pendingRenewal: EnterprisePendingRenewalSchema.optional(),
13734
+ /** Stripe subscription schedule driving a prepared renewal, while attached. */
13735
+ stripeScheduleId: external_exports.string().min(1).optional()
13939
13736
  });
13940
- var ModelCategorySchema = external_exports.enum([
13941
- "image",
13942
- "video",
13943
- "text",
13944
- "image_tool",
13945
- "video_tool",
13946
- "audio"
13737
+ var CustomerEnterpriseStripeBillingSchema = EnterpriseStripeBillingSchema.omit({
13738
+ activatedAt: true,
13739
+ activatedByEmail: true,
13740
+ allowedPaymentMethods: true,
13741
+ paymentMethodType: true,
13742
+ firstPaymentSettledAt: true,
13743
+ // Operator-only; the customer reads a pending expansion through the
13744
+ // dedicated preview endpoint, which excludes operator emails.
13745
+ pendingExpansion: true,
13746
+ // Same reason — it carries the preparing operator's email.
13747
+ pendingRenewal: true,
13748
+ stripeScheduleId: true
13749
+ });
13750
+ var EnterpriseStripeBillingAuditActionSchema = external_exports.enum([
13751
+ "created",
13752
+ "mutated",
13753
+ "activated",
13754
+ "term_ended",
13755
+ "canceled"
13947
13756
  ]);
13948
- var AutoModelConfigSchema = external_exports.object({
13949
- model: external_exports.string().trim().min(1),
13950
- variant: external_exports.string().trim().min(1)
13757
+ var EnterpriseStripeBillingAuditEntrySchema = external_exports.object({
13758
+ at: external_exports.string().datetime(),
13759
+ byEmail: external_exports.string().nullable(),
13760
+ action: EnterpriseStripeBillingAuditActionSchema,
13761
+ previousStripePriceId: external_exports.string().optional(),
13762
+ notes: external_exports.string().optional()
13951
13763
  });
13952
- var AutoModelDefaultCapabilitiesSchema = external_exports.object({
13953
- displayName: external_exports.string().optional(),
13954
- provider: external_exports.string().optional(),
13955
- tier: external_exports.string().nullable().optional(),
13956
- /** Text models expose image/video support at the model level, not as variants. */
13957
- supportedInputs: external_exports.array(external_exports.enum(["image", "video"])).optional(),
13958
- requiredInputs: external_exports.array(external_exports.string()).optional(),
13959
- optionalInputs: external_exports.array(external_exports.string()).optional(),
13960
- supportsSeed: external_exports.boolean().optional(),
13961
- supportsAudioGeneration: external_exports.boolean().optional(),
13962
- supportsAudioToggle: external_exports.boolean().optional(),
13963
- supportsNegativePrompt: external_exports.boolean().optional(),
13964
- supportedAspectRatios: external_exports.array(OutputAspectRatioSchema).optional(),
13965
- supportedDurations: external_exports.array(external_exports.number()).nullable().optional(),
13966
- supportedDurationsByResolution: external_exports.record(external_exports.string(), external_exports.array(external_exports.number())).nullable().optional(),
13967
- supportedResolutions: external_exports.array(OutputResolutionSchema).nullable().optional(),
13968
- supportsCustomResolution: external_exports.boolean().optional(),
13969
- maxCustomResolutionArea: external_exports.number().nullable().optional(),
13970
- minCustomResolutionArea: external_exports.number().nullable().optional(),
13971
- maxCustomResolutionAspectRatio: external_exports.number().nullable().optional(),
13972
- resolutionPricingMultipliers: external_exports.record(external_exports.string(), external_exports.number()).nullable().optional(),
13973
- audioOffCreditMultiplier: external_exports.number().nullable().optional(),
13974
- audioOffCreditMultipliersByResolution: external_exports.record(external_exports.string(), external_exports.number()).nullable().optional(),
13975
- maxImageInputs: external_exports.number().nullable().optional(),
13976
- maxReferenceImageInputs: external_exports.number().nullable().optional(),
13977
- maxReferenceImagesWithEndImage: external_exports.number().nullable().optional(),
13978
- maxVideoInputs: external_exports.number().nullable().optional(),
13979
- maxAudioInputs: external_exports.number().nullable().optional(),
13980
- /** Maximum combined reference image, video, and audio inputs. */
13981
- maxCombinedReferenceInputs: external_exports.number().nullable().optional(),
13982
- maxNativeOutputs: external_exports.number().nullable().optional(),
13983
- maxInputArea: external_exports.number().nullable().optional(),
13984
- minInputVideoArea: external_exports.number().nullable().optional(),
13985
- maxInputVideoDurationSeconds: external_exports.number().nullable().optional(),
13986
- minInputVideoDurationSeconds: external_exports.number().nullable().optional(),
13987
- maxPromptLength: external_exports.number().nullable().optional(),
13988
- minPromptLength: external_exports.number().nullable().optional(),
13989
- defaultResolution: OutputResolutionSchema.nullable().optional(),
13990
- estimatedLatency: external_exports.string().nullable().optional(),
13991
- estimatedLatencySeconds: external_exports.number().nullable().optional(),
13992
- featuredDescription: external_exports.string().nullable().optional()
13764
+ var EnterpriseOrderSchema = EnterpriseOrderDetailsSchema.extend({
13765
+ stripeBilling: EnterpriseStripeBillingInputSchema.optional()
13993
13766
  });
13994
- var AutoModelDefaultEntrySchema = AutoModelConfigSchema.extend({
13995
- capabilities: AutoModelDefaultCapabilitiesSchema.optional()
13767
+ var CustomerEnterpriseOrderSchema = EnterpriseOrderSchema.extend({
13768
+ stripeBilling: CustomerEnterpriseStripeBillingSchema.optional()
13996
13769
  });
13997
- var AutoModelDefaultsCategorySchema = external_exports.object({
13998
- text: AutoModelDefaultEntrySchema,
13999
- image: external_exports.object({
14000
- textToImage: AutoModelDefaultEntrySchema,
14001
- imageToImage: AutoModelDefaultEntrySchema
14002
- }),
14003
- video: external_exports.object({
14004
- textToVideo: AutoModelDefaultEntrySchema,
14005
- imageToVideo: AutoModelDefaultEntrySchema,
14006
- videoToVideo: AutoModelDefaultEntrySchema
14007
- }),
14008
- audio: external_exports.object({
14009
- textToSpeech: AutoModelDefaultEntrySchema,
14010
- audioToAudio: AutoModelDefaultEntrySchema,
14011
- textToSfx: AutoModelDefaultEntrySchema,
14012
- // Optional so deployed clients validating a response from an
14013
- // older backend (which omits it) keep working.
14014
- videoToSfx: AutoModelDefaultEntrySchema.optional(),
14015
- textToMusic: AutoModelDefaultEntrySchema,
14016
- speechToText: AutoModelDefaultEntrySchema
14017
- }).optional()
13770
+ var CustomPlanCreditGrantScheduleSchema = external_exports.object({
13771
+ id: external_exports.string(),
13772
+ creditPackageAmount: external_exports.number().int().nonnegative(),
13773
+ creditPackageUnit: external_exports.string().min(1),
13774
+ grantStartDate: external_exports.string().date(),
13775
+ contractEndDate: external_exports.string().date(),
13776
+ /** Set when an amendment, pause, or revert ended this entry early. */
13777
+ effectiveEndDate: external_exports.string().date().optional(),
13778
+ createdAt: external_exports.string().datetime(),
13779
+ createdByEmail: external_exports.string().nullable()
14018
13780
  });
14019
- var AutoModelDefaultsResponseSchema = AutoModelDefaultsCategorySchema.extend({
14020
- fast: AutoModelDefaultsCategorySchema
13781
+ var CustomPlanCreditGrantHistoryEntrySchema = external_exports.object({
13782
+ grantDate: external_exports.string().date(),
13783
+ amount: external_exports.number().int().nonnegative(),
13784
+ /** Billing event id once granted; null if scheduled but not yet processed. */
13785
+ billingEventId: external_exports.string().nullable(),
13786
+ /** How the credit grant landed once granted; null while scheduled. */
13787
+ billingSource: external_exports.enum(["custom_plan", "stripe"]).nullable(),
13788
+ /** Idempotency/source reference for the grant, e.g. custom schedule key or Stripe invoice/subscription reference. */
13789
+ billingReferenceId: external_exports.string().nullable(),
13790
+ /** ISO timestamp when the grant landed; null while still scheduled. */
13791
+ grantedAt: external_exports.string().datetime().nullable(),
13792
+ status: external_exports.enum(["granted", "scheduled"])
14021
13793
  });
14022
- function sanitizeAgentAutoModelDefaultsCategory(category) {
14023
- if (category.audio?.textToSpeech.model !== FISH_AUDIO_MODEL) {
14024
- return category;
14025
- }
14026
- return {
14027
- ...category,
14028
- audio: {
14029
- ...category.audio,
14030
- textToSpeech: {
14031
- model: ELEVENLABS_V3_MODEL_ID,
14032
- variant: "text-to-speech"
14033
- }
14034
- }
14035
- };
14036
- }
14037
- function sanitizeAgentAutoModelDefaults(defaults) {
14038
- const standard = sanitizeAgentAutoModelDefaultsCategory(defaults);
14039
- const fast = sanitizeAgentAutoModelDefaultsCategory(defaults.fast);
14040
- if (standard === defaults && fast === defaults.fast) return defaults;
14041
- return { ...standard, fast };
14042
- }
14043
- var ModelCostSchema = external_exports.discriminatedUnion("type", [
14044
- external_exports.object({
14045
- type: external_exports.literal("fixed"),
14046
- creditCost: external_exports.number()
14047
- }),
14048
- external_exports.object({
14049
- type: external_exports.literal("fixed_duration"),
14050
- creditCost: external_exports.number(),
14051
- durationSeconds: external_exports.number()
14052
- }),
14053
- external_exports.object({
14054
- type: external_exports.literal("per_second"),
14055
- creditCostPerSecond: external_exports.number()
14056
- }),
14057
- external_exports.object({
14058
- type: external_exports.literal("per_minute"),
14059
- creditCostPerMinute: external_exports.number()
14060
- }),
14061
- external_exports.object({
14062
- type: external_exports.literal("per_megapixel_frame"),
14063
- creditCostPerMegapixelFrame: external_exports.number(),
14064
- estimatedCreditCost: external_exports.number().optional()
14065
- }),
14066
- external_exports.object({
14067
- type: external_exports.literal("estimated"),
14068
- creditCost: external_exports.number()
14069
- }),
14070
- // A cost that varies between a floor and a ceiling depending on inputs — e.g.
14071
- // text models that accept video input are free for text-to-text
14072
- // (`minCreditCost`) but charge a flat fee when a video is attached
14073
- // (`maxCreditCost`). Rendered as a "min–max" range.
14074
- external_exports.object({
14075
- type: external_exports.literal("range"),
14076
- minCreditCost: external_exports.number(),
14077
- maxCreditCost: external_exports.number()
14078
- })
14079
- ]);
14080
- var TextTokenPricingSchema = external_exports.object({
14081
- inputCreditsPerMillionTokens: external_exports.number(),
14082
- outputCreditsPerMillionTokens: external_exports.number()
13794
+ var InternalEnterpriseOrderSchema = EnterpriseOrderSchema.extend({
13795
+ updatedAt: external_exports.string().datetime(),
13796
+ updatedByEmail: external_exports.string().nullable(),
13797
+ creditGrantSchedule: external_exports.array(CustomPlanCreditGrantScheduleSchema),
13798
+ creditGrantHistory: external_exports.array(CustomPlanCreditGrantHistoryEntrySchema),
13799
+ nextGrantDate: external_exports.string().date().nullable(),
13800
+ stripeBilling: EnterpriseStripeBillingSchema.optional(),
13801
+ stripeBillingAuditLog: external_exports.array(EnterpriseStripeBillingAuditEntrySchema).optional()
14083
13802
  });
14084
- var InputFileSizeConstraintsResponseSchema = external_exports.object({
14085
- maximumFileBytes: external_exports.number().int().nonnegative().optional(),
14086
- maximumTotalBytes: external_exports.number().int().nonnegative().optional()
13803
+ var TeamAdvancedSettingsSchema = external_exports.object({
13804
+ negativePromptEnabled: external_exports.boolean().optional(),
13805
+ customSeedEnabled: external_exports.boolean().optional(),
13806
+ // Auto-approve join requests from signups whose email domain matches this
13807
+ // enterprise team's owner domain. Admin-governed via the dedicated
13808
+ // domain-join-settings endpoint, not the editor-facing advanced-settings write.
13809
+ domainJoinAutoApprove: external_exports.boolean().optional()
13810
+ // NOTE: the team's approval policy config also lives in this jsonb column,
13811
+ // but is deliberately NOT declared here — see `InternalTeamAdvancedSettings`
13812
+ // in `apps/core/nagi/team/team.mappers.ts`, the same treatment
13813
+ // `modelDiscounts` gets. Declaring it would publish the team's approver
13814
+ // list into the public OpenAPI surface, and would make it writable through
13815
+ // the editor-facing advanced-settings endpoint. It is read and written
13816
+ // only through the admin-gated approvals endpoints.
14087
13817
  });
14088
- var InputImageDimensionConstraintsResponseSchema = external_exports.object({
14089
- minimumWidth: external_exports.number().int().nonnegative(),
14090
- minimumHeight: external_exports.number().int().nonnegative(),
14091
- maximumWidth: external_exports.number().int().nonnegative().optional(),
14092
- maximumHeight: external_exports.number().int().nonnegative().optional()
13818
+ var DomainJoinTargetSchema = external_exports.object({
13819
+ teamId: external_exports.string().uuid(),
13820
+ teamName: external_exports.string(),
13821
+ teamPhotoUrl: external_exports.string().nullable(),
13822
+ alreadyRequested: external_exports.boolean()
14093
13823
  });
14094
- var InputImageAspectRatioConstraintsResponseSchema = external_exports.object({
14095
- maximumRatio: external_exports.number().positive()
13824
+ var JoinRequestSchema = external_exports.object({
13825
+ id: external_exports.string().uuid(),
13826
+ userId: external_exports.string().uuid(),
13827
+ userName: external_exports.string(),
13828
+ userEmail: external_exports.string(),
13829
+ avatarUrl: external_exports.string().nullable(),
13830
+ createdAt: external_exports.string().datetime()
14096
13831
  });
14097
- var PromoRateLimitSchema = external_exports.object({
14098
- used: external_exports.number().int().nonnegative(),
14099
- limit: external_exports.number().int().nonnegative(),
14100
- remaining: external_exports.number().int().nonnegative(),
14101
- /**
14102
- * Credits one unit of allowance is worth, for a campaign metered in
14103
- * something other than whole generations. Present makes the allowance
14104
- * divisible: a run costing more than what is left is part-covered rather
14105
- * than dropped to full price.
14106
- *
14107
- * Absent means the campaign meters generations, where `remaining > 0` is
14108
- * the whole answer. A client that does not understand this field must
14109
- * treat the run as fully priced rather than free — see `freeResolution`.
14110
- */
14111
- unitCredits: external_exports.number().positive().optional(),
14112
- /**
14113
- * The output resolution `unitCredits` prices. Absent means every resolution
14114
- * qualifies. Sent rather than assumed so the client never hardcodes which
14115
- * resolution the campaign is running on.
14116
- *
14117
- * A campaign spendable at several resolutions still sends this pair, naming
14118
- * the one a client that predates `unitCreditsByResolution` should treat as
14119
- * covered. Such a client quotes the rest at full price, which understates a
14120
- * discount rather than promising one that is not honoured.
14121
- */
14122
- freeResolution: external_exports.string().optional(),
14123
- /**
14124
- * Credits one unit is worth at each covered resolution, when the allowance
14125
- * is one pool spendable across several of them. A resolution absent from
14126
- * the map is not covered.
14127
- *
14128
- * Present, this supersedes `unitCredits` / `freeResolution` entirely — that
14129
- * pair stays on the wire only for clients that predate it. Read it through
14130
- * `resolvePromoUnitCredits` rather than indexing it directly, so the
14131
- * precedence lives in one place.
14132
- */
14133
- unitCreditsByResolution: external_exports.record(external_exports.string(), external_exports.number().positive()).optional()
13832
+ var ActiveProductFeatureOverrideSchema = external_exports.object({
13833
+ feature: external_exports.string().min(1),
13834
+ expiresAt: external_exports.string().datetime()
14134
13835
  });
14135
- var ModelVariantResponseSchema = external_exports.object({
14136
- mode: external_exports.string(),
14137
- tier: external_exports.string().nullable(),
14138
- requiredInputs: external_exports.array(external_exports.string()),
14139
- optionalInputs: external_exports.array(external_exports.string()),
14140
- supportsSeed: external_exports.boolean(),
14141
- supportsAudioGeneration: external_exports.boolean().optional(),
14142
- /** True when the variant exposes a user-controllable audio toggle. */
14143
- supportsAudioToggle: external_exports.boolean().optional(),
14144
- /** True when the variant accepts a user-supplied negative prompt. */
14145
- supportsNegativePrompt: external_exports.boolean().optional(),
14146
- supportedAspectRatios: external_exports.array(OutputAspectRatioSchema),
14147
- supportedDurations: external_exports.array(external_exports.number()).nullable(),
14148
- /** Provider default used when a duration is not selected. */
14149
- defaultDuration: external_exports.number().nullable().optional(),
14150
- /**
14151
- * For a per-second model whose output length is NOT user-selected: how the
14152
- * billed length is derived. `"input-media"` → longest connected input
14153
- * audio/video duration; a number → fixed render length in seconds.
14154
- */
14155
- billedDurationSource: external_exports.union([external_exports.literal("input-media"), external_exports.number()]).nullable().optional(),
14156
- /** Per-resolution duration overrides. When a resolution has an entry, only those durations are valid. */
14157
- supportedDurationsByResolution: external_exports.record(external_exports.string(), external_exports.array(external_exports.number())).nullable().optional(),
14158
- supportedResolutions: external_exports.array(OutputResolutionSchema).nullable(),
14159
- supportsCustomResolution: external_exports.boolean().optional(),
14160
- maxCustomResolutionArea: external_exports.number().nullable().optional(),
14161
- minCustomResolutionArea: external_exports.number().nullable().optional(),
14162
- maxCustomResolutionAspectRatio: external_exports.number().nullable().optional(),
14163
- resolutionPricingMultipliers: external_exports.record(external_exports.string(), external_exports.number()).nullable(),
14164
- /** Multiplier applied to creditCost when audio is toggled off. */
14165
- audioOffCreditMultiplier: external_exports.number().nullable().optional(),
14166
- /** Per-resolution overrides of audioOffCreditMultiplier. */
14167
- audioOffCreditMultipliersByResolution: external_exports.record(external_exports.string(), external_exports.number()).nullable().optional(),
14168
- maxImageInputs: external_exports.number().nullable(),
14169
- maxReferenceImageInputs: external_exports.number().nullable().optional(),
14170
- maxReferenceImagesWithEndImage: external_exports.number().nullable().optional(),
14171
- maxVideoInputs: external_exports.number().nullable().optional(),
14172
- maxAudioInputs: external_exports.number().nullable().optional(),
14173
- maxCombinedReferenceInputs: external_exports.number().nullable().optional(),
14174
- /**
14175
- * For variants accepting both video and audio: whether the connected
14176
- * durations must line up. `false` for lipsync models (e.g. Kling Lipsync)
14177
- * whose endpoint takes audio independent of the video length, so the
14178
- * frontend preflight must not block a mismatch. Omitted/null means the
14179
- * default duration-match requirement applies.
14180
- */
14181
- requiresMatchingAudioVideoDuration: external_exports.boolean().nullable().optional(),
14182
- maxNativeOutputs: external_exports.number().nullable(),
14183
- maxInputArea: external_exports.number().nullable(),
14184
- inputImageFileSizeConstraints: InputFileSizeConstraintsResponseSchema.nullable().optional(),
14185
- inputReferenceImageFileSizeConstraints: InputFileSizeConstraintsResponseSchema.nullable().optional(),
14186
- inputImageDimensionConstraints: InputImageDimensionConstraintsResponseSchema.nullable().optional(),
14187
- inputImageAspectRatioConstraints: InputImageAspectRatioConstraintsResponseSchema.nullable().optional(),
14188
- inputImageMimeTypes: external_exports.array(external_exports.string()).nullable().optional(),
14189
- inputReferenceImageMimeTypes: external_exports.array(external_exports.string()).nullable().optional(),
14190
- /** Minimum input video area in pixels², or null if unconstrained. */
14191
- minInputVideoArea: external_exports.number().nullable().optional(),
14192
- /** Maximum input video clip duration (seconds), or null if unconstrained. */
14193
- maxInputVideoDurationSeconds: external_exports.number().nullable().optional(),
14194
- /** Minimum input video clip duration (seconds), or null if unconstrained. */
14195
- minInputVideoDurationSeconds: external_exports.number().nullable().optional(),
14196
- /** Maximum prompt length in characters, or null if unconstrained. */
14197
- maxPromptLength: external_exports.number().nullable().optional(),
14198
- /** Minimum prompt length in characters, or null if unconstrained. */
14199
- minPromptLength: external_exports.number().nullable().optional(),
14200
- estimatedLatency: external_exports.string().nullable(),
14201
- estimatedLatencySeconds: external_exports.number().nullable().optional(),
14202
- defaultResolution: OutputResolutionSchema.nullable().optional(),
14203
- featuredDescription: external_exports.string().nullable(),
14204
- cost: ModelCostSchema.optional(),
14205
- /** Selectable voices for audio variants, or null when none apply. */
14206
- voices: VoiceCapabilitySchema.nullable().optional(),
14207
- /**
14208
- * Per-second credit multiplier applied to connected input video duration,
14209
- * using the resolution-adjusted output per-second price as the base. Lets
14210
- * the cost preview include the input-video surcharge that the server bills.
14211
- */
14212
- inputVideoCreditMultiplier: external_exports.number().optional()
13836
+ var ActivePlanPreviewSchema = external_exports.object({
13837
+ previewPlanTier: TeamPlanSchema,
13838
+ expiresAt: external_exports.string().datetime()
14213
13839
  });
14214
- var ModelResponseSchema = external_exports.object({
13840
+ var TeamSchema = external_exports.object({
13841
+ id: external_exports.string().uuid(),
14215
13842
  name: external_exports.string(),
14216
- displayName: external_exports.string(),
14217
- provider: external_exports.string(),
14218
- releasedAt: external_exports.string().nullable().optional(),
14219
- variants: external_exports.array(ModelVariantResponseSchema),
14220
- /** Media input modalities the model accepts in addition to text (e.g. image, video). */
14221
- supportedInputs: external_exports.array(external_exports.enum(["image", "video"])).optional(),
14222
- estimatedLatency: external_exports.string().nullable().optional(),
14223
- estimatedLatencySeconds: external_exports.number().nullable().optional(),
14224
- featuredDescription: external_exports.string().nullable().optional(),
14225
- cost: ModelCostSchema,
14226
- deprecated: external_exports.boolean().optional(),
14227
- hiddenFromAgent: external_exports.boolean().optional(),
14228
- promoRateLimit: PromoRateLimitSchema.optional(),
14229
- /** Maximum prompt length in characters. Used by text models that lack variants. */
14230
- maxPromptLength: external_exports.number().nullable().optional(),
14231
- /** Per-1M-token credit rates for text models; drives the live cost-range estimate. */
14232
- textTokenPricing: TextTokenPricingSchema.optional()
14233
- });
14234
- var ListGenerativeModelsResponseSchema = external_exports.object({
14235
- models: external_exports.array(ModelResponseSchema)
14236
- });
14237
- var GenerationHistoryItemSchema = external_exports.object({
14238
- id: external_exports.string(),
14239
- type: external_exports.enum(["media", "text"]),
14240
- model: external_exports.string(),
14241
- // Speed tier (e.g. "fast") the job ran at, when it ran at a non-standard
14242
- // one. Optional so older clients ignore it and the field is absent for
14243
- // standard-tier and text generations.
14244
- tier: external_exports.string().nullable().optional(),
14245
- status: GenerationJobStatusSchema,
14246
- creditCost: external_exports.number().nullable(),
14247
- // Whether the debit was reversed — `creditCost` was charged and given back,
14248
- // so it did not count towards usage. Optional so older clients ignore it.
14249
- refunded: external_exports.boolean().optional(),
14250
- createdAt: external_exports.string(),
14251
- user: external_exports.object({
14252
- id: external_exports.string(),
14253
- name: external_exports.string(),
14254
- email: external_exports.string()
14255
- }).nullable(),
14256
- project: external_exports.object({
14257
- id: external_exports.string(),
14258
- title: external_exports.string(),
14259
- archived: external_exports.boolean()
14260
- }).nullable(),
14261
- // Set when the generation was produced by running a template: the bulk run
14262
- // it belonged to plus the template's name. Lets a run's per-model rows be
14263
- // consolidated into one row (see `consolidateTemplateRuns`). Optional so
14264
- // older clients ignore it and it is absent for non-template generations.
14265
- templateRun: external_exports.object({
14266
- runId: external_exports.string(),
14267
- title: external_exports.string()
14268
- }).nullable().optional()
14269
- });
14270
- var ListGenerationHistoryResponseSchema = external_exports.object({
14271
- items: external_exports.array(GenerationHistoryItemSchema),
14272
- total: external_exports.number()
13843
+ plan: TeamPlanSchema,
13844
+ teamPhotoUrl: external_exports.string().nullable(),
13845
+ createdAt: external_exports.string().datetime(),
13846
+ creditExpiresAt: external_exports.string().datetime().nullable(),
13847
+ enterpriseOrder: CustomerEnterpriseOrderSchema.nullable(),
13848
+ advancedSettings: TeamAdvancedSettingsSchema,
13849
+ activeProductFeatureOverrides: external_exports.array(ActiveProductFeatureOverrideSchema).default([]),
13850
+ activePlanPreview: ActivePlanPreviewSchema.nullable().default(null)
14273
13851
  });
14274
- var GenerationsByWeekItemSchema = external_exports.object({
14275
- weekStart: external_exports.string().datetime(),
14276
- count: external_exports.number().int().nonnegative()
13852
+ var MemberSchema = external_exports.object({
13853
+ id: external_exports.string().uuid(),
13854
+ role: TeamRoleSchema,
13855
+ userId: external_exports.string().uuid(),
13856
+ userName: external_exports.string(),
13857
+ userEmail: external_exports.string(),
13858
+ avatarUrl: external_exports.string().nullable()
14277
13859
  });
14278
- var GetGenerationsByWeekResponseSchema = external_exports.object({
14279
- items: external_exports.array(GenerationsByWeekItemSchema)
13860
+ var TeamMembershipSchema = external_exports.object({
13861
+ id: external_exports.string().uuid(),
13862
+ role: TeamRoleSchema,
13863
+ team: TeamSchema
14280
13864
  });
14281
- var SeedancePrecheckCategorySchema = external_exports.enum([
14282
- "named_public_figure",
14283
- "minor_risk",
14284
- "deception_risk",
14285
- "political_risk",
14286
- "intimate_sexual",
14287
- "copyrighted_ip",
14288
- "brand_logo",
14289
- "violence_weapons"
14290
- ]);
14291
- var SeedancePrecheckRequestSchema = external_exports.object({
14292
- /** Model name as it appears on the canvas node (e.g. "seedance-2.0"). */
14293
- model: external_exports.string().trim().min(1),
14294
- prompt: external_exports.string().optional(),
14295
- imageUrls: external_exports.array(external_exports.string().url()).optional(),
14296
- videoUrls: external_exports.array(external_exports.string().url()).optional()
13865
+ var InviteLinkSchema = external_exports.object({
13866
+ id: external_exports.string().uuid(),
13867
+ role: InviteLinkRoleSchema,
13868
+ token: external_exports.string(),
13869
+ createdAt: external_exports.string().datetime()
14297
13870
  });
14298
- var SeedancePrecheckResponseSchema = external_exports.object({
14299
- verdict: external_exports.enum(["likely_pass", "likely_fail"]),
14300
- category: SeedancePrecheckCategorySchema.optional(),
14301
- confidence: external_exports.enum(["high", "medium"]),
14302
- reason: external_exports.string(),
14303
- cacheKey: external_exports.string()
13871
+ var EmailInviteStatusSchema = external_exports.enum(["pending", "accepted"]);
13872
+ var EmailInviteSchema = external_exports.object({
13873
+ id: external_exports.string().uuid(),
13874
+ email: external_exports.string(),
13875
+ role: InviteLinkRoleSchema,
13876
+ status: EmailInviteStatusSchema,
13877
+ senderName: external_exports.string(),
13878
+ createdAt: external_exports.string().datetime()
14304
13879
  });
14305
13880
 
14306
- // ../api-contract/src/generation/routes.ts
14307
- var c7 = initContract();
14308
- var generationContract = c7.router({
14309
- listGenerativeModels: {
13881
+ // ../api-contract/src/files/routes.ts
13882
+ var c6 = initContract();
13883
+ var filesContract = c6.router({
13884
+ createFileFolder: {
13885
+ method: "POST",
13886
+ path: "/files/folders",
13887
+ body: CreateFileFolderBodySchema,
13888
+ responses: {
13889
+ 201: FileFolderResponseSchema,
13890
+ 403: ErrorBodySchema,
13891
+ 404: ErrorBodySchema
13892
+ },
13893
+ summary: "Create a Files folder"
13894
+ },
13895
+ listFileFolders: {
14310
13896
  method: "GET",
14311
- path: "/generation/models",
14312
- query: external_exports.object({ category: ModelCategorySchema }),
13897
+ path: "/files/folders",
13898
+ responses: {
13899
+ 200: FileFolderListResponseSchema,
13900
+ 403: ErrorBodySchema
13901
+ },
13902
+ summary: "List team Files folders"
13903
+ },
13904
+ // Maps a Files folder to its owning team for the current user. Deliberately
13905
+ // NOT team-scoped: a shared `/assets?folder=<id>` link is opened with
13906
+ // whatever team the recipient happens to have active, so the page resolves
13907
+ // the folder's team here and switches to it before listing (mirrors
13908
+ // resolveAssetTeam). 403 distinguishes "someone else's folder" from the
13909
+ // 404 of a deleted one, which is what lets the page tell the two apart.
13910
+ resolveFileFolderTeam: {
13911
+ method: "GET",
13912
+ path: "/files/folders/:folderId/team",
13913
+ pathParams: FileFolderIdParamsSchema,
13914
+ responses: {
13915
+ 200: ResolvedTeamSchema,
13916
+ 403: ErrorBodySchema,
13917
+ 404: ErrorBodySchema
13918
+ },
13919
+ summary: "Resolve a Files folder's owning team for the current user"
13920
+ },
13921
+ getFileFolderShareMode: {
13922
+ method: "GET",
13923
+ path: "/files/folders/:folderId/share-mode",
13924
+ pathParams: FileFolderIdParamsSchema,
13925
+ responses: {
13926
+ 200: external_exports.object({ shareMode: AssetShareModeSchema }),
13927
+ 403: ErrorBodySchema,
13928
+ 404: ErrorBodySchema
13929
+ },
13930
+ summary: "Get an asset folder share mode"
13931
+ },
13932
+ updateFileFolderShareMode: {
13933
+ method: "PATCH",
13934
+ path: "/files/folders/:folderId/share-mode",
13935
+ pathParams: FileFolderIdParamsSchema,
13936
+ body: external_exports.object({ shareMode: AssetShareModeSchema }),
13937
+ responses: {
13938
+ 200: external_exports.object({ shareMode: AssetShareModeSchema }),
13939
+ 403: ErrorBodySchema,
13940
+ 404: ErrorBodySchema
13941
+ },
13942
+ summary: "Update an asset folder share mode"
13943
+ },
13944
+ updateFileFolder: {
13945
+ method: "PATCH",
13946
+ path: "/files/folders/:folderId",
13947
+ pathParams: FileFolderIdParamsSchema,
13948
+ body: UpdateFileFolderBodySchema,
13949
+ responses: {
13950
+ 200: FileFolderResponseSchema,
13951
+ 403: ErrorBodySchema,
13952
+ 404: ErrorBodySchema,
13953
+ 409: ErrorBodySchema
13954
+ },
13955
+ summary: "Update a Files folder"
13956
+ },
13957
+ deleteFileFolder: {
13958
+ method: "DELETE",
13959
+ path: "/files/folders/:folderId",
13960
+ pathParams: FileFolderIdParamsSchema,
13961
+ body: null,
13962
+ responses: {
13963
+ 204: c6.noBody(),
13964
+ 403: ErrorBodySchema
13965
+ },
13966
+ summary: "Delete a Files folder"
13967
+ },
13968
+ listAssetTags: {
13969
+ method: "GET",
13970
+ path: "/files/tags",
13971
+ responses: {
13972
+ 200: AssetTagListResponseSchema,
13973
+ 403: ErrorBodySchema
13974
+ },
13975
+ summary: "List team asset tags"
13976
+ },
13977
+ createAssetTag: {
13978
+ method: "POST",
13979
+ path: "/files/tags",
13980
+ body: CreateAssetTagBodySchema,
13981
+ responses: {
13982
+ 201: AssetTagResponseSchema,
13983
+ 403: ErrorBodySchema,
13984
+ 409: ErrorBodySchema
13985
+ },
13986
+ summary: "Create an asset tag"
13987
+ },
13988
+ updateAssetTag: {
13989
+ method: "PATCH",
13990
+ path: "/files/tags/:tagId",
13991
+ pathParams: AssetTagIdParamsSchema,
13992
+ body: UpdateAssetTagBodySchema,
13993
+ responses: {
13994
+ 200: AssetTagResponseSchema,
13995
+ 403: ErrorBodySchema,
13996
+ 404: ErrorBodySchema,
13997
+ 409: ErrorBodySchema
13998
+ },
13999
+ summary: "Rename or recolor an asset tag"
14000
+ },
14001
+ deleteAssetTag: {
14002
+ method: "DELETE",
14003
+ path: "/files/tags/:tagId",
14004
+ pathParams: AssetTagIdParamsSchema,
14005
+ body: null,
14006
+ responses: {
14007
+ 204: c6.noBody(),
14008
+ 403: ErrorBodySchema,
14009
+ 404: ErrorBodySchema
14010
+ },
14011
+ summary: "Delete an asset tag"
14012
+ },
14013
+ addAssetTag: {
14014
+ method: "POST",
14015
+ path: "/files/:assetId/tags",
14016
+ pathParams: FileAssetIdParamsSchema,
14017
+ body: AssetTagAssignmentBodySchema,
14018
+ responses: {
14019
+ 200: FileCardSchema,
14020
+ 403: ErrorBodySchema,
14021
+ 404: ErrorBodySchema
14022
+ },
14023
+ summary: "Add a tag to a file"
14024
+ },
14025
+ removeAssetTag: {
14026
+ method: "DELETE",
14027
+ path: "/files/:assetId/tags/:tagId",
14028
+ pathParams: FileAssetTagParamsSchema,
14029
+ body: null,
14030
+ responses: {
14031
+ 200: FileCardSchema,
14032
+ 403: ErrorBodySchema,
14033
+ 404: ErrorBodySchema
14034
+ },
14035
+ summary: "Remove a tag from a file"
14036
+ },
14037
+ bulkAddAssetTag: {
14038
+ method: "POST",
14039
+ path: "/files/bulk/tag",
14040
+ body: BulkAssetTagBodySchema,
14041
+ responses: {
14042
+ 200: BulkFileActionResponseSchema,
14043
+ 403: ErrorBodySchema,
14044
+ 404: ErrorBodySchema
14045
+ },
14046
+ summary: "Add a tag to files"
14047
+ },
14048
+ bulkRemoveAssetTag: {
14049
+ method: "POST",
14050
+ path: "/files/bulk/untag",
14051
+ body: BulkAssetTagBodySchema,
14052
+ responses: {
14053
+ 200: BulkFileActionResponseSchema,
14054
+ 403: ErrorBodySchema,
14055
+ 404: ErrorBodySchema
14056
+ },
14057
+ summary: "Remove a tag from files"
14058
+ },
14059
+ bulkMoveFiles: {
14060
+ method: "POST",
14061
+ path: "/files/bulk/move",
14062
+ body: BulkMoveFilesBodySchema,
14063
+ responses: {
14064
+ 200: BulkFileActionResponseSchema,
14065
+ 403: ErrorBodySchema,
14066
+ 404: ErrorBodySchema
14067
+ },
14068
+ summary: "Move files to a folder"
14069
+ },
14070
+ moveFile: {
14071
+ method: "POST",
14072
+ path: "/files/:assetId/move",
14073
+ pathParams: FileAssetIdParamsSchema,
14074
+ body: MoveFileBodySchema,
14075
+ responses: {
14076
+ 200: FileCardSchema,
14077
+ 403: ErrorBodySchema,
14078
+ 404: ErrorBodySchema
14079
+ },
14080
+ summary: "Move a file to a folder"
14081
+ },
14082
+ renameFile: {
14083
+ method: "PATCH",
14084
+ path: "/files/:assetId/name",
14085
+ pathParams: FileAssetIdParamsSchema,
14086
+ body: RenameFileBodySchema,
14087
+ responses: {
14088
+ 200: FileCardSchema,
14089
+ 403: ErrorBodySchema,
14090
+ 404: ErrorBodySchema
14091
+ },
14092
+ summary: "Rename a file"
14093
+ },
14094
+ bulkDownloadFiles: {
14095
+ method: "POST",
14096
+ path: "/files/bulk/download",
14097
+ body: BulkDownloadFilesBodySchema,
14098
+ responses: {
14099
+ 200: BulkDownloadFilesResponseSchema,
14100
+ 403: ErrorBodySchema,
14101
+ 404: ErrorBodySchema
14102
+ },
14103
+ summary: "Download files and folders as a zip archive"
14104
+ },
14105
+ bulkHideFiles: {
14106
+ method: "POST",
14107
+ path: "/files/bulk/hide",
14108
+ body: BulkHideFilesBodySchema,
14109
+ responses: {
14110
+ 200: BulkFileActionResponseSchema,
14111
+ 403: ErrorBodySchema,
14112
+ 404: ErrorBodySchema
14113
+ },
14114
+ summary: "Hide files from Files"
14115
+ },
14116
+ bulkDeleteFiles: {
14117
+ method: "POST",
14118
+ path: "/files/bulk/delete",
14119
+ body: BulkDeleteFilesBodySchema,
14120
+ responses: {
14121
+ 200: BulkFileActionResponseSchema,
14122
+ 403: ErrorBodySchema,
14123
+ 404: ErrorBodySchema
14124
+ },
14125
+ summary: "Delete files from Files"
14126
+ },
14127
+ hideFile: {
14128
+ method: "POST",
14129
+ path: "/files/:assetId/hide",
14130
+ pathParams: FileAssetIdParamsSchema,
14131
+ body: null,
14132
+ responses: {
14133
+ 204: c6.noBody(),
14134
+ 403: ErrorBodySchema,
14135
+ 404: ErrorBodySchema
14136
+ },
14137
+ summary: "Hide a file from Files"
14138
+ },
14139
+ deleteFile: {
14140
+ method: "DELETE",
14141
+ path: "/files/:assetId",
14142
+ pathParams: FileAssetIdParamsSchema,
14143
+ body: null,
14144
+ responses: {
14145
+ 204: c6.noBody(),
14146
+ 403: ErrorBodySchema,
14147
+ 404: ErrorBodySchema
14148
+ },
14149
+ summary: "Delete a file from Files"
14150
+ },
14151
+ bulkUnhideFiles: {
14152
+ method: "POST",
14153
+ path: "/files/bulk/unhide",
14154
+ body: BulkUnhideFilesBodySchema,
14155
+ responses: {
14156
+ 200: BulkFileActionResponseSchema,
14157
+ 403: ErrorBodySchema,
14158
+ 404: ErrorBodySchema
14159
+ },
14160
+ summary: "Restore files hidden from Files"
14161
+ },
14162
+ unhideFile: {
14163
+ method: "POST",
14164
+ path: "/files/:assetId/unhide",
14165
+ pathParams: FileAssetIdParamsSchema,
14166
+ body: null,
14313
14167
  responses: {
14314
- 200: ListGenerativeModelsResponseSchema
14315
- }
14168
+ 204: c6.noBody(),
14169
+ 403: ErrorBodySchema,
14170
+ 404: ErrorBodySchema
14171
+ },
14172
+ summary: "Restore a file hidden from Files"
14316
14173
  },
14317
- listPublicGenerativeModels: {
14318
- method: "GET",
14319
- path: "/generation/models/public",
14320
- query: external_exports.object({ category: ModelCategorySchema }),
14174
+ /**
14175
+ * Put a generation made on a canvas no member may view into Files. Cast's
14176
+ * clips are the first caller: the canvas they were made on is the
14177
+ * product's, so nothing on it is a file until somebody asks for one.
14178
+ *
14179
+ * Distinct from `unhideFile`, which restores a file the member removed.
14180
+ * This one adds a file that was never there.
14181
+ */
14182
+ saveFileToFiles: {
14183
+ method: "POST",
14184
+ path: "/files/:assetId/save",
14185
+ pathParams: FileAssetIdParamsSchema,
14186
+ body: null,
14321
14187
  responses: {
14322
- 200: ListGenerativeModelsResponseSchema
14188
+ 204: c6.noBody(),
14189
+ 403: ErrorBodySchema,
14190
+ 404: ErrorBodySchema
14323
14191
  },
14324
- summary: "List generally-available models without authentication (logged-out home)"
14192
+ summary: "Save a generation into Files"
14325
14193
  },
14326
- listHeygenAvatarVAvatars: {
14327
- method: "GET",
14328
- path: "/generation/heygen-avatar-v-avatars",
14329
- // Each HeyGen avatar model has its own provider roster, so the caller
14330
- // names the model it is picking for. Omitted means Avatar V, which is
14331
- // what every client sent before Avatar IV existed.
14332
- query: external_exports.object({ model: external_exports.string().optional() }).optional(),
14194
+ unsaveFileFromFiles: {
14195
+ method: "POST",
14196
+ path: "/files/:assetId/unsave",
14197
+ pathParams: FileAssetIdParamsSchema,
14198
+ body: null,
14333
14199
  responses: {
14334
- 200: external_exports.object({ avatars: external_exports.array(external_exports.string()) })
14335
- }
14200
+ 204: c6.noBody(),
14201
+ 403: ErrorBodySchema,
14202
+ 404: ErrorBodySchema
14203
+ },
14204
+ summary: "Take a saved generation back out of Files"
14336
14205
  },
14337
- listHeygenAvatarVVoices: {
14206
+ listFiles: {
14338
14207
  method: "GET",
14339
- path: "/generation/heygen-avatar-v-voices",
14208
+ path: "/files",
14209
+ query: ListFilesQuerySchema,
14340
14210
  responses: {
14341
- 200: external_exports.object({ voices: external_exports.array(external_exports.string()) })
14342
- }
14211
+ 200: ListFilesResponseSchema,
14212
+ 403: ErrorBodySchema
14213
+ },
14214
+ summary: "List team files"
14343
14215
  },
14344
- getAutoModelDefaults: {
14216
+ getFileTabCounts: {
14345
14217
  method: "GET",
14346
- path: "/generation/auto-model-defaults",
14218
+ path: "/files/tab-counts",
14219
+ query: FileTabCountsQuerySchema,
14347
14220
  responses: {
14348
- 200: AutoModelDefaultsResponseSchema
14349
- }
14221
+ 200: FileTabCountsResponseSchema,
14222
+ 403: ErrorBodySchema
14223
+ },
14224
+ summary: "Per-tab asset counts for the Assets page, scoped to the search"
14350
14225
  },
14351
- getPublicAutoModelDefaults: {
14226
+ searchAgentAssets: {
14352
14227
  method: "GET",
14353
- path: "/generation/auto-model-defaults/public",
14228
+ path: "/files/agent-search",
14229
+ query: AgentAssetSearchRequestSchema,
14354
14230
  responses: {
14355
- 200: AutoModelDefaultsResponseSchema
14231
+ 200: AgentAssetSearchResponseSchema,
14232
+ 403: ErrorBodySchema
14356
14233
  },
14357
- summary: "Auto-model defaults without authentication (logged-out home)"
14234
+ summary: "Search team assets for the agent"
14358
14235
  },
14359
- listGenerationHistory: {
14236
+ listAgentAssetFolders: {
14360
14237
  method: "GET",
14361
- path: "/generation/history",
14362
- query: external_exports.object({
14363
- ...paginationQuery({ maxLimit: 100, defaultLimit: 50 }),
14364
- search: external_exports.string().optional(),
14365
- userId: external_exports.string().optional(),
14366
- projectId: external_exports.string().optional(),
14367
- since: external_exports.string().datetime().optional(),
14368
- until: external_exports.string().datetime().optional()
14369
- }),
14238
+ path: "/files/agent-folders",
14370
14239
  responses: {
14371
- 200: ListGenerationHistoryResponseSchema
14372
- }
14240
+ 200: AgentListAssetFoldersResponseSchema,
14241
+ 403: ErrorBodySchema
14242
+ },
14243
+ summary: "List team asset folders for the agent"
14373
14244
  },
14374
- listGenerationHistoryPaginated: {
14245
+ getEmbeddingStorageUsage: {
14375
14246
  method: "GET",
14376
- path: "/generation/history/paginated",
14377
- query: external_exports.object({
14378
- ...paginationQuery({ maxLimit: 100, defaultLimit: 50 }),
14379
- search: external_exports.string().optional(),
14380
- userId: external_exports.string().optional(),
14381
- projectId: external_exports.string().optional(),
14382
- since: external_exports.string().datetime().optional(),
14383
- until: external_exports.string().datetime().optional()
14384
- }),
14247
+ path: "/files/embedding-storage-usage",
14385
14248
  responses: {
14386
- 200: ListGenerationHistoryResponseSchema
14387
- }
14249
+ 200: EmbeddingStorageUsageResponseSchema,
14250
+ 403: ErrorBodySchema
14251
+ },
14252
+ summary: "Get the team's DAM embedding-storage usage and cap"
14388
14253
  },
14389
- downloadGenerationHistory: {
14254
+ getFileDetail: {
14390
14255
  method: "GET",
14391
- path: "/generation/history/download",
14392
- // Same filters as the paginated list, minus pagination: an export
14393
- // returns every matching row, not a page.
14394
- query: external_exports.object({
14395
- search: external_exports.string().optional(),
14396
- userId: external_exports.string().optional(),
14397
- projectId: external_exports.string().optional(),
14398
- since: external_exports.string().datetime().optional(),
14399
- until: external_exports.string().datetime().optional()
14400
- }),
14256
+ path: "/files/:assetId/detail",
14257
+ pathParams: FileAssetIdParamsSchema,
14401
14258
  responses: {
14402
- 200: c7.otherResponse({
14403
- contentType: "text/csv",
14404
- body: external_exports.string()
14405
- })
14406
- }
14259
+ 200: FileDetailSchema,
14260
+ 403: ErrorBodySchema,
14261
+ 404: ErrorBodySchema
14262
+ },
14263
+ summary: "Get a file's details with generation metadata"
14407
14264
  },
14408
- getGenerationsByWeek: {
14265
+ getAssetShareMode: {
14409
14266
  method: "GET",
14410
- path: "/generation/generations-by-week",
14411
- query: external_exports.object({
14412
- weeks: external_exports.coerce.number().int().min(1).max(52).default(12)
14267
+ path: "/files/:assetId/share-mode",
14268
+ pathParams: FileAssetIdParamsSchema,
14269
+ responses: {
14270
+ 200: external_exports.object({ shareMode: AssetShareModeSchema }),
14271
+ 403: ErrorBodySchema,
14272
+ 404: ErrorBodySchema
14273
+ },
14274
+ summary: "Get an asset's share mode"
14275
+ },
14276
+ updateAssetShareMode: {
14277
+ method: "PATCH",
14278
+ path: "/files/:assetId/share-mode",
14279
+ pathParams: FileAssetIdParamsSchema,
14280
+ body: external_exports.object({
14281
+ shareMode: AssetShareModeSchema,
14282
+ nodeVersionId: external_exports.string().uuid().nullable().optional(),
14283
+ engagementSource: ClientAssetEngagementSourceSchema.optional()
14413
14284
  }),
14414
14285
  responses: {
14415
- 200: GetGenerationsByWeekResponseSchema
14416
- }
14286
+ 200: external_exports.object({ shareMode: AssetShareModeSchema }),
14287
+ 403: ErrorBodySchema,
14288
+ 404: ErrorBodySchema
14289
+ },
14290
+ summary: "Set who can view an asset"
14417
14291
  },
14418
- precheckSeedance: {
14292
+ initFileUpload: {
14419
14293
  method: "POST",
14420
- path: "/generation/precheck-seedance",
14421
- body: SeedancePrecheckRequestSchema,
14294
+ path: "/files/upload/init",
14295
+ body: InitFilesUploadBodySchema,
14422
14296
  responses: {
14423
- 200: SeedancePrecheckResponseSchema
14424
- }
14297
+ 200: InitFilesUploadResponseSchema,
14298
+ 403: ErrorBodySchema
14299
+ },
14300
+ summary: "Initiate a Files upload"
14301
+ },
14302
+ completeFileUpload: {
14303
+ method: "POST",
14304
+ path: "/files/upload/complete",
14305
+ body: CompleteFilesUploadBodySchema,
14306
+ responses: {
14307
+ 200: CompleteFilesUploadResponseSchema,
14308
+ 403: ErrorBodySchema
14309
+ },
14310
+ summary: "Complete a Files upload"
14311
+ },
14312
+ createUploadcareUploadSignature: {
14313
+ method: "POST",
14314
+ path: "/files/import/uploadcare/signature",
14315
+ body: external_exports.object({}),
14316
+ responses: {
14317
+ 200: UploadcareUploadSignatureResponseSchema,
14318
+ 403: ErrorBodySchema
14319
+ },
14320
+ summary: "Mint short-lived credentials for a signed Uploadcare upload"
14321
+ },
14322
+ importUploadcareFile: {
14323
+ method: "POST",
14324
+ path: "/files/import/uploadcare",
14325
+ body: ImportUploadcareFileBodySchema,
14326
+ responses: {
14327
+ 200: ImportUploadcareFileResponseSchema,
14328
+ 400: ErrorBodySchema,
14329
+ 403: ErrorBodySchema,
14330
+ 404: ErrorBodySchema
14331
+ },
14332
+ summary: "Import a file picked from a cloud source through Uploadcare"
14333
+ },
14334
+ importGoogleDriveFile: {
14335
+ method: "POST",
14336
+ path: "/files/import/google-drive",
14337
+ body: ImportGoogleDriveFileBodySchema,
14338
+ responses: {
14339
+ 200: ImportGoogleDriveFileResponseSchema,
14340
+ 400: ErrorBodySchema,
14341
+ 403: ErrorBodySchema,
14342
+ 404: ErrorBodySchema
14343
+ },
14344
+ summary: "Import a file the user picked from Google Drive"
14345
+ },
14346
+ startGoogleDriveImportJob: {
14347
+ method: "POST",
14348
+ path: "/files/import/google-drive/jobs",
14349
+ body: StartGoogleDriveImportJobBodySchema,
14350
+ responses: {
14351
+ 202: StartGoogleDriveImportJobResponseSchema,
14352
+ 400: ErrorBodySchema,
14353
+ 403: ErrorBodySchema,
14354
+ 404: ErrorBodySchema,
14355
+ 503: ErrorBodySchema
14356
+ },
14357
+ summary: "Start a durable Google Drive import"
14358
+ },
14359
+ getGoogleDriveImportJob: {
14360
+ method: "GET",
14361
+ path: "/files/import/google-drive/jobs/:jobId",
14362
+ pathParams: GoogleDriveImportJobParamsSchema,
14363
+ responses: {
14364
+ 200: GoogleDriveImportJobStatusSchema,
14365
+ 403: ErrorBodySchema,
14366
+ 404: ErrorBodySchema,
14367
+ 503: ErrorBodySchema
14368
+ },
14369
+ summary: "Get a durable Google Drive import"
14425
14370
  }
14426
14371
  });
14427
14372
 
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()
14373
+ // ../api-contract/src/audio-voices.ts
14374
+ var VoiceCatalogIdSchema = external_exports.enum(["elevenlabs", "fish-audio"]);
14375
+ var VoiceCapabilitySchema = external_exports.discriminatedUnion("source", [
14376
+ external_exports.object({
14377
+ source: external_exports.literal("static"),
14378
+ /** The provider's complete voice enum. */
14379
+ values: external_exports.array(external_exports.string()).readonly(),
14380
+ defaultVoice: external_exports.string()
14381
+ }),
14382
+ external_exports.object({
14383
+ source: external_exports.literal("catalog"),
14384
+ catalog: VoiceCatalogIdSchema,
14385
+ defaultVoice: external_exports.string().optional(),
14386
+ /** Team-owned cloned voices may be selected alongside the catalog. */
14387
+ supportsCustomVoices: external_exports.boolean().optional()
14388
+ })
14389
+ ]);
14390
+
14391
+ // ../api-contract/src/generation/schema.ts
14392
+ var ImageGenerationQualityPricingSchema = external_exports.record(
14393
+ external_exports.string(),
14394
+ external_exports.record(external_exports.string(), external_exports.number())
14395
+ );
14396
+ var GenerationJobStatusSchema = external_exports.enum([
14397
+ "in_progress",
14398
+ "finished",
14399
+ "failed",
14400
+ "cancelled"
14401
+ ]);
14402
+ var FISH_AUDIO_MODEL = "fish-audio-s2.1-pro";
14403
+ var BetterFontSourceSchema = external_exports.enum(["custom", "google"]);
14404
+ var BetterFontSelectionSchema = external_exports.object({
14405
+ source: BetterFontSourceSchema,
14406
+ familyName: external_exports.string().trim().min(1).max(100)
14435
14407
  });
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()
14408
+ var GenerationMediaMetadataSchema = external_exports.object({
14409
+ width: external_exports.number().int().positive().nullable().optional(),
14410
+ height: external_exports.number().int().positive().nullable().optional(),
14411
+ fileSizeBytes: external_exports.number().int().nonnegative().nullable().optional()
14442
14412
  });
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(),
14413
+ var GenerationRunBodySchema = external_exports.object({
14414
+ model: external_exports.string().trim().min(1),
14415
+ tier: external_exports.string().optional(),
14416
+ prompt: external_exports.string().trim().min(1).optional(),
14417
+ /** Selected avatar id from Runware's HeyGen Avatar V catalog. */
14418
+ heygenAvatar: external_exports.string().trim().min(1).optional(),
14419
+ /** HeyGen Avatar V presentation controls. */
14420
+ heygenSettings: HeygenAvatarSettingsSchema.optional(),
14421
+ imageUrls: external_exports.array(external_exports.string().url()).optional(),
14422
+ endImageUrls: external_exports.array(external_exports.string().url()).optional(),
14423
+ referenceImageUrls: external_exports.array(external_exports.string().url()).optional(),
14424
+ imageMetadata: external_exports.array(GenerationMediaMetadataSchema).optional(),
14425
+ endImageMetadata: external_exports.array(GenerationMediaMetadataSchema).optional(),
14426
+ referenceImageMetadata: external_exports.array(GenerationMediaMetadataSchema).optional(),
14427
+ videoUrl: external_exports.string().url().optional(),
14428
+ videoUrls: external_exports.array(external_exports.string().url()).optional(),
14429
+ audioUrls: external_exports.array(external_exports.string().url()).optional(),
14430
+ videoMetadata: external_exports.array(GenerationMediaMetadataSchema).optional(),
14431
+ audioMetadata: external_exports.array(GenerationMediaMetadataSchema).optional(),
14432
+ videoDurationsMs: external_exports.array(external_exports.number().int().nonnegative().nullable()).optional(),
14433
+ audioDurationsMs: external_exports.array(external_exports.number().int().nonnegative().nullable()).optional(),
14434
+ aspectRatio: OutputAspectRatioSchema.optional(),
14435
+ duration: external_exports.number().int().positive().optional(),
14436
+ resolution: OutputResolutionSchema.optional(),
14437
+ /** Quality mode for image variants that expose it; ignored by other models. */
14438
+ quality: ImageGenerationQualityIdSchema.optional(),
14439
+ seed: external_exports.number().int().nonnegative().max(MAX_SEED).optional(),
14440
+ numVariations: external_exports.number().int().min(1).max(MAX_VARIATIONS).optional(),
14450
14441
  /**
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.
14442
+ * Whether the variant should generate audio. Only honored on variants
14443
+ * whose registry entry declares `falAudioField`. Defaults to `true`.
14455
14444
  */
14456
- modelSupportsEndImage: external_exports.boolean().optional(),
14457
- modelSupportsReferenceImage: external_exports.boolean().optional(),
14458
- modelSupportsOptionalStartImage: external_exports.boolean().optional(),
14459
- modelSupportsAudioInput: external_exports.boolean().optional()
14445
+ generateAudio: external_exports.boolean().optional(),
14446
+ /**
14447
+ * Optional negative prompt — terms the user wants suppressed from the
14448
+ * output. Only honored on variants whose registry entry declares
14449
+ * `falNegativePromptField`. Empty/whitespace values are dropped before
14450
+ * sending so the provider's own default (e.g. Kling's
14451
+ * "blur, distort, and low quality") still applies.
14452
+ */
14453
+ negativePrompt: external_exports.string().optional(),
14454
+ /** Recraft's preferred RGB palette. Ignored by models without `falColorsField`. */
14455
+ colors: external_exports.array(RgbColorSchema).optional(),
14456
+ /** Recraft's RGB background colour. Ignored by models without `falBackgroundColorField`. */
14457
+ backgroundColor: RgbColorSchema.optional(),
14458
+ /**
14459
+ * The font the better-font-32b model should use as its typography
14460
+ * reference. Only honored when `model === "better-font-32b"`; ignored
14461
+ * by every other model. When absent, the server falls back to a
14462
+ * default Google font (Inter).
14463
+ */
14464
+ font: BetterFontSelectionSchema.optional(),
14465
+ /**
14466
+ * LoRA adapters to stack on a LoRA-capable image generation (`{ id, weight }`;
14467
+ * the server resolves each id to a presigned weights URL). Only honored on
14468
+ * LoRA-capable models (SDXL on Modal, Flux on fal); ignored by every other
14469
+ * model.
14470
+ */
14471
+ loras: LoraStackSchema.optional(),
14472
+ /** Sampler steps. Only honored on LoRA-capable models (SDXL, Flux). */
14473
+ steps: SdxlStepsSchema.optional(),
14474
+ /**
14475
+ * Classifier-free guidance scale. Only honored on LoRA-capable models
14476
+ * (SDXL, Flux).
14477
+ */
14478
+ guidanceScale: SdxlGuidanceScaleSchema.optional()
14460
14479
  });
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()
14480
+ var ModelCategorySchema = external_exports.enum([
14481
+ "image",
14482
+ "video",
14483
+ "text",
14484
+ "image_tool",
14485
+ "video_tool",
14486
+ "audio"
14487
+ ]);
14488
+ var AutoModelConfigSchema = external_exports.object({
14489
+ model: external_exports.string().trim().min(1),
14490
+ variant: external_exports.string().trim().min(1)
14467
14491
  });
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()
14492
+ var AutoModelDefaultCapabilitiesSchema = external_exports.object({
14493
+ displayName: external_exports.string().optional(),
14494
+ provider: external_exports.string().optional(),
14495
+ tier: external_exports.string().nullable().optional(),
14496
+ /** Text models expose image/video support at the model level, not as variants. */
14497
+ supportedInputs: external_exports.array(external_exports.enum(["image", "video"])).optional(),
14498
+ requiredInputs: external_exports.array(external_exports.string()).optional(),
14499
+ optionalInputs: external_exports.array(external_exports.string()).optional(),
14500
+ supportsSeed: external_exports.boolean().optional(),
14501
+ supportsAudioGeneration: external_exports.boolean().optional(),
14502
+ supportsAudioToggle: external_exports.boolean().optional(),
14503
+ supportsNegativePrompt: external_exports.boolean().optional(),
14504
+ supportedAspectRatios: external_exports.array(OutputAspectRatioSchema).optional(),
14505
+ supportedDurations: external_exports.array(external_exports.number()).nullable().optional(),
14506
+ supportedDurationsByResolution: external_exports.record(external_exports.string(), external_exports.array(external_exports.number())).nullable().optional(),
14507
+ supportedResolutions: external_exports.array(OutputResolutionSchema).nullable().optional(),
14508
+ supportsCustomResolution: external_exports.boolean().optional(),
14509
+ maxCustomResolutionArea: external_exports.number().nullable().optional(),
14510
+ minCustomResolutionArea: external_exports.number().nullable().optional(),
14511
+ maxCustomResolutionAspectRatio: external_exports.number().nullable().optional(),
14512
+ resolutionPricingMultipliers: external_exports.record(external_exports.string(), external_exports.number()).nullable().optional(),
14513
+ qualityOptions: external_exports.array(ImageGenerationQualityOptionSchema).optional(),
14514
+ defaultQuality: ImageGenerationQualityIdSchema.optional(),
14515
+ qualityPricingMultipliersByResolution: ImageGenerationQualityPricingSchema.nullable().optional(),
14516
+ audioOffCreditMultiplier: external_exports.number().nullable().optional(),
14517
+ audioOffCreditMultipliersByResolution: external_exports.record(external_exports.string(), external_exports.number()).nullable().optional(),
14518
+ maxImageInputs: external_exports.number().nullable().optional(),
14519
+ maxReferenceImageInputs: external_exports.number().nullable().optional(),
14520
+ maxReferenceImagesWithEndImage: external_exports.number().nullable().optional(),
14521
+ maxVideoInputs: external_exports.number().nullable().optional(),
14522
+ maxAudioInputs: external_exports.number().nullable().optional(),
14523
+ /** Maximum combined reference image, video, and audio inputs. */
14524
+ maxCombinedReferenceInputs: external_exports.number().nullable().optional(),
14525
+ maxNativeOutputs: external_exports.number().nullable().optional(),
14526
+ maxInputArea: external_exports.number().nullable().optional(),
14527
+ minInputVideoArea: external_exports.number().nullable().optional(),
14528
+ maxInputVideoDurationSeconds: external_exports.number().nullable().optional(),
14529
+ minInputVideoDurationSeconds: external_exports.number().nullable().optional(),
14530
+ maxPromptLength: external_exports.number().nullable().optional(),
14531
+ minPromptLength: external_exports.number().nullable().optional(),
14532
+ defaultResolution: OutputResolutionSchema.nullable().optional(),
14533
+ estimatedLatency: external_exports.string().nullable().optional(),
14534
+ estimatedLatencySeconds: external_exports.number().nullable().optional(),
14535
+ featuredDescription: external_exports.string().nullable().optional()
14474
14536
  });
14475
- var CustomTextNodeDataSchema = external_exports.object({
14476
- title: external_exports.string(),
14477
- generatedText: external_exports.string().optional()
14537
+ var AutoModelDefaultEntrySchema = AutoModelConfigSchema.extend({
14538
+ capabilities: AutoModelDefaultCapabilitiesSchema.optional()
14478
14539
  });
14479
- var GroupNodeDataSchema = external_exports.object({
14480
- label: external_exports.string()
14540
+ var AutoModelDefaultsCategorySchema = external_exports.object({
14541
+ text: AutoModelDefaultEntrySchema,
14542
+ image: external_exports.object({
14543
+ textToImage: AutoModelDefaultEntrySchema,
14544
+ imageToImage: AutoModelDefaultEntrySchema
14545
+ }),
14546
+ video: external_exports.object({
14547
+ textToVideo: AutoModelDefaultEntrySchema,
14548
+ imageToVideo: AutoModelDefaultEntrySchema,
14549
+ videoToVideo: AutoModelDefaultEntrySchema
14550
+ }),
14551
+ audio: external_exports.object({
14552
+ textToSpeech: AutoModelDefaultEntrySchema,
14553
+ audioToAudio: AutoModelDefaultEntrySchema,
14554
+ textToSfx: AutoModelDefaultEntrySchema,
14555
+ // Optional so deployed clients validating a response from an
14556
+ // older backend (which omits it) keep working.
14557
+ videoToSfx: AutoModelDefaultEntrySchema.optional(),
14558
+ textToMusic: AutoModelDefaultEntrySchema,
14559
+ speechToText: AutoModelDefaultEntrySchema
14560
+ }).optional()
14481
14561
  });
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", [
14562
+ var AutoModelDefaultsResponseSchema = AutoModelDefaultsCategorySchema.extend({
14563
+ fast: AutoModelDefaultsCategorySchema
14564
+ });
14565
+ function sanitizeAgentAutoModelDefaultsCategory(category) {
14566
+ if (category.audio?.textToSpeech.model !== FISH_AUDIO_MODEL) {
14567
+ return category;
14568
+ }
14569
+ return {
14570
+ ...category,
14571
+ audio: {
14572
+ ...category.audio,
14573
+ textToSpeech: {
14574
+ model: ELEVENLABS_V3_MODEL_ID,
14575
+ variant: "text-to-speech"
14576
+ }
14577
+ }
14578
+ };
14579
+ }
14580
+ function sanitizeAgentAutoModelDefaults(defaults) {
14581
+ const standard = sanitizeAgentAutoModelDefaultsCategory(defaults);
14582
+ const fast = sanitizeAgentAutoModelDefaultsCategory(defaults.fast);
14583
+ if (standard === defaults && fast === defaults.fast) return defaults;
14584
+ return { ...standard, fast };
14585
+ }
14586
+ var ModelCostSchema = external_exports.discriminatedUnion("type", [
14493
14587
  external_exports.object({
14494
- type: external_exports.literal("text"),
14495
- data: TextNodeDataSchema,
14496
- ...SharedNodeFields
14588
+ type: external_exports.literal("fixed"),
14589
+ creditCost: external_exports.number()
14497
14590
  }),
14498
14591
  external_exports.object({
14499
- type: external_exports.literal("image"),
14500
- data: ImageNodeDataSchema,
14501
- ...SharedNodeFields
14592
+ type: external_exports.literal("fixed_duration"),
14593
+ creditCost: external_exports.number(),
14594
+ durationSeconds: external_exports.number()
14502
14595
  }),
14503
14596
  external_exports.object({
14504
- type: external_exports.literal("video"),
14505
- data: VideoNodeDataSchema,
14506
- ...SharedNodeFields
14597
+ type: external_exports.literal("per_second"),
14598
+ creditCostPerSecond: external_exports.number()
14507
14599
  }),
14508
14600
  external_exports.object({
14509
- type: external_exports.literal("audio"),
14510
- data: AudioNodeDataSchema,
14511
- ...SharedNodeFields
14601
+ type: external_exports.literal("per_minute"),
14602
+ creditCostPerMinute: external_exports.number()
14512
14603
  }),
14513
14604
  external_exports.object({
14514
- type: external_exports.literal("file"),
14515
- data: FileNodeDataSchema,
14516
- ...SharedNodeFields
14605
+ type: external_exports.literal("per_megapixel_frame"),
14606
+ creditCostPerMegapixelFrame: external_exports.number(),
14607
+ estimatedCreditCost: external_exports.number().optional()
14517
14608
  }),
14518
14609
  external_exports.object({
14519
- type: external_exports.literal("custom_text"),
14520
- data: CustomTextNodeDataSchema,
14521
- ...SharedNodeFields
14610
+ type: external_exports.literal("estimated"),
14611
+ creditCost: external_exports.number()
14522
14612
  }),
14613
+ // A cost that varies between a floor and a ceiling depending on inputs — e.g.
14614
+ // text models that accept video input are free for text-to-text
14615
+ // (`minCreditCost`) but charge a flat fee when a video is attached
14616
+ // (`maxCreditCost`). Rendered as a "min–max" range.
14523
14617
  external_exports.object({
14524
- type: external_exports.literal("group"),
14525
- data: GroupNodeDataSchema,
14526
- ...SharedNodeFields
14618
+ type: external_exports.literal("range"),
14619
+ minCreditCost: external_exports.number(),
14620
+ maxCreditCost: external_exports.number()
14527
14621
  })
14528
14622
  ]);
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()
14623
+ var TextTokenPricingSchema = external_exports.object({
14624
+ inputCreditsPerMillionTokens: external_exports.number(),
14625
+ outputCreditsPerMillionTokens: external_exports.number()
14534
14626
  });
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)
14627
+ var InputFileSizeConstraintsResponseSchema = external_exports.object({
14628
+ maximumFileBytes: external_exports.number().int().nonnegative().optional(),
14629
+ maximumTotalBytes: external_exports.number().int().nonnegative().optional()
14543
14630
  });
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
- }
14631
+ var InputImageDimensionConstraintsResponseSchema = external_exports.object({
14632
+ minimumWidth: external_exports.number().int().nonnegative(),
14633
+ minimumHeight: external_exports.number().int().nonnegative(),
14634
+ maximumWidth: external_exports.number().int().nonnegative().optional(),
14635
+ maximumHeight: external_exports.number().int().nonnegative().optional()
14558
14636
  });
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)
14637
+ var InputImageAspectRatioConstraintsResponseSchema = external_exports.object({
14638
+ maximumRatio: external_exports.number().positive()
14564
14639
  });
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()
14640
+ var PromoRateLimitSchema = external_exports.object({
14641
+ used: external_exports.number().int().nonnegative(),
14642
+ limit: external_exports.number().int().nonnegative(),
14643
+ remaining: external_exports.number().int().nonnegative(),
14644
+ /**
14645
+ * Credits one unit of allowance is worth, for a campaign metered in
14646
+ * something other than whole generations. Present makes the allowance
14647
+ * divisible: a run costing more than what is left is part-covered rather
14648
+ * than dropped to full price.
14649
+ *
14650
+ * Absent means the campaign meters generations, where `remaining > 0` is
14651
+ * the whole answer. A client that does not understand this field must
14652
+ * treat the run as fully priced rather than free — see `freeResolution`.
14653
+ */
14654
+ unitCredits: external_exports.number().positive().optional(),
14655
+ /**
14656
+ * The output resolution `unitCredits` prices. Absent means every resolution
14657
+ * qualifies. Sent rather than assumed so the client never hardcodes which
14658
+ * resolution the campaign is running on.
14659
+ *
14660
+ * A campaign spendable at several resolutions still sends this pair, naming
14661
+ * the one a client that predates `unitCreditsByResolution` should treat as
14662
+ * covered. Such a client quotes the rest at full price, which understates a
14663
+ * discount rather than promising one that is not honoured.
14664
+ */
14665
+ freeResolution: external_exports.string().optional(),
14666
+ /**
14667
+ * Credits one unit is worth at each covered resolution, when the allowance
14668
+ * is one pool spendable across several of them. A resolution absent from
14669
+ * the map is not covered.
14670
+ *
14671
+ * Present, this supersedes `unitCredits` / `freeResolution` entirely — that
14672
+ * pair stays on the wire only for clients that predate it. Read it through
14673
+ * `resolvePromoUnitCredits` rather than indexing it directly, so the
14674
+ * precedence lives in one place.
14675
+ */
14676
+ unitCreditsByResolution: external_exports.record(external_exports.string(), external_exports.number().positive()).optional()
14677
+ });
14678
+ var ModelVariantResponseSchema = external_exports.object({
14679
+ mode: external_exports.string(),
14680
+ tier: external_exports.string().nullable(),
14681
+ requiredInputs: external_exports.array(external_exports.string()),
14682
+ optionalInputs: external_exports.array(external_exports.string()),
14683
+ supportsSeed: external_exports.boolean(),
14684
+ supportsAudioGeneration: external_exports.boolean().optional(),
14685
+ /** True when the variant exposes a user-controllable audio toggle. */
14686
+ supportsAudioToggle: external_exports.boolean().optional(),
14687
+ /** True when the variant accepts a user-supplied negative prompt. */
14688
+ supportsNegativePrompt: external_exports.boolean().optional(),
14689
+ supportedAspectRatios: external_exports.array(OutputAspectRatioSchema),
14690
+ supportedDurations: external_exports.array(external_exports.number()).nullable(),
14691
+ /** Provider default used when a duration is not selected. */
14692
+ defaultDuration: external_exports.number().nullable().optional(),
14693
+ /**
14694
+ * For a per-second model whose output length is NOT user-selected: how the
14695
+ * billed length is derived. `"input-media"` → longest connected input
14696
+ * audio/video duration; a number → fixed render length in seconds.
14697
+ */
14698
+ billedDurationSource: external_exports.union([external_exports.literal("input-media"), external_exports.number()]).nullable().optional(),
14699
+ /** Per-resolution duration overrides. When a resolution has an entry, only those durations are valid. */
14700
+ supportedDurationsByResolution: external_exports.record(external_exports.string(), external_exports.array(external_exports.number())).nullable().optional(),
14701
+ supportedResolutions: external_exports.array(OutputResolutionSchema).nullable(),
14702
+ supportsCustomResolution: external_exports.boolean().optional(),
14703
+ maxCustomResolutionArea: external_exports.number().nullable().optional(),
14704
+ minCustomResolutionArea: external_exports.number().nullable().optional(),
14705
+ maxCustomResolutionAspectRatio: external_exports.number().nullable().optional(),
14706
+ resolutionPricingMultipliers: external_exports.record(external_exports.string(), external_exports.number()).nullable(),
14707
+ /** User-selectable quality modes for this image variant. */
14708
+ qualityOptions: external_exports.array(ImageGenerationQualityOptionSchema).optional(),
14709
+ /** Quality used when a node predates the selector or has no explicit value. */
14710
+ defaultQuality: ImageGenerationQualityIdSchema.optional(),
14711
+ /** Total base-price multiplier for each quality/resolution pair. */
14712
+ qualityPricingMultipliersByResolution: ImageGenerationQualityPricingSchema.nullable().optional(),
14713
+ /** Multiplier applied to creditCost when audio is toggled off. */
14714
+ audioOffCreditMultiplier: external_exports.number().nullable().optional(),
14715
+ /** Per-resolution overrides of audioOffCreditMultiplier. */
14716
+ audioOffCreditMultipliersByResolution: external_exports.record(external_exports.string(), external_exports.number()).nullable().optional(),
14717
+ maxImageInputs: external_exports.number().nullable(),
14718
+ maxReferenceImageInputs: external_exports.number().nullable().optional(),
14719
+ maxReferenceImagesWithEndImage: external_exports.number().nullable().optional(),
14720
+ maxVideoInputs: external_exports.number().nullable().optional(),
14721
+ maxAudioInputs: external_exports.number().nullable().optional(),
14722
+ maxCombinedReferenceInputs: external_exports.number().nullable().optional(),
14723
+ /**
14724
+ * For variants accepting both video and audio: whether the connected
14725
+ * durations must line up. `false` for lipsync models (e.g. Kling Lipsync)
14726
+ * whose endpoint takes audio independent of the video length, so the
14727
+ * frontend preflight must not block a mismatch. Omitted/null means the
14728
+ * default duration-match requirement applies.
14729
+ */
14730
+ requiresMatchingAudioVideoDuration: external_exports.boolean().nullable().optional(),
14731
+ maxNativeOutputs: external_exports.number().nullable(),
14732
+ maxInputArea: external_exports.number().nullable(),
14733
+ inputImageFileSizeConstraints: InputFileSizeConstraintsResponseSchema.nullable().optional(),
14734
+ inputReferenceImageFileSizeConstraints: InputFileSizeConstraintsResponseSchema.nullable().optional(),
14735
+ inputImageDimensionConstraints: InputImageDimensionConstraintsResponseSchema.nullable().optional(),
14736
+ inputImageAspectRatioConstraints: InputImageAspectRatioConstraintsResponseSchema.nullable().optional(),
14737
+ inputImageMimeTypes: external_exports.array(external_exports.string()).nullable().optional(),
14738
+ inputReferenceImageMimeTypes: external_exports.array(external_exports.string()).nullable().optional(),
14739
+ /** Minimum input video area in pixels², or null if unconstrained. */
14740
+ minInputVideoArea: external_exports.number().nullable().optional(),
14741
+ /** Maximum input video clip duration (seconds), or null if unconstrained. */
14742
+ maxInputVideoDurationSeconds: external_exports.number().nullable().optional(),
14743
+ /** Minimum input video clip duration (seconds), or null if unconstrained. */
14744
+ minInputVideoDurationSeconds: external_exports.number().nullable().optional(),
14745
+ /** Maximum prompt length in characters, or null if unconstrained. */
14746
+ maxPromptLength: external_exports.number().nullable().optional(),
14747
+ /** Minimum prompt length in characters, or null if unconstrained. */
14748
+ minPromptLength: external_exports.number().nullable().optional(),
14749
+ estimatedLatency: external_exports.string().nullable(),
14750
+ estimatedLatencySeconds: external_exports.number().nullable().optional(),
14751
+ defaultResolution: OutputResolutionSchema.nullable().optional(),
14752
+ featuredDescription: external_exports.string().nullable(),
14753
+ cost: ModelCostSchema.optional(),
14754
+ /** Selectable voices for audio variants, or null when none apply. */
14755
+ voices: VoiceCapabilitySchema.nullable().optional(),
14756
+ /**
14757
+ * Per-second credit multiplier applied to connected input video duration,
14758
+ * using the resolution-adjusted output per-second price as the base. Lets
14759
+ * the cost preview include the input-video surcharge that the server bills.
14760
+ */
14761
+ inputVideoCreditMultiplier: external_exports.number().optional()
14762
+ });
14763
+ var ModelResponseSchema = external_exports.object({
14764
+ name: external_exports.string(),
14765
+ displayName: external_exports.string(),
14766
+ provider: external_exports.string(),
14767
+ releasedAt: external_exports.string().nullable().optional(),
14768
+ variants: external_exports.array(ModelVariantResponseSchema),
14769
+ /** Media input modalities the model accepts in addition to text (e.g. image, video). */
14770
+ supportedInputs: external_exports.array(external_exports.enum(["image", "video"])).optional(),
14771
+ estimatedLatency: external_exports.string().nullable().optional(),
14772
+ estimatedLatencySeconds: external_exports.number().nullable().optional(),
14773
+ featuredDescription: external_exports.string().nullable().optional(),
14774
+ cost: ModelCostSchema,
14775
+ deprecated: external_exports.boolean().optional(),
14776
+ hiddenFromAgent: external_exports.boolean().optional(),
14777
+ promoRateLimit: PromoRateLimitSchema.optional(),
14778
+ /** Maximum prompt length in characters. Used by text models that lack variants. */
14779
+ maxPromptLength: external_exports.number().nullable().optional(),
14780
+ /** Per-1M-token credit rates for text models; drives the live cost-range estimate. */
14781
+ textTokenPricing: TextTokenPricingSchema.optional(),
14782
+ /** Text-only reasoning levels supported by the routed provider model. */
14783
+ thinking: TextThinkingCapabilitySchema.nullable().optional()
14784
+ });
14785
+ var ListGenerativeModelsResponseSchema = external_exports.object({
14786
+ models: external_exports.array(ModelResponseSchema)
14787
+ });
14788
+ var GenerationHistoryItemSchema = external_exports.object({
14789
+ id: external_exports.string(),
14790
+ type: external_exports.enum(["media", "text"]),
14791
+ model: external_exports.string(),
14792
+ // Speed tier (e.g. "fast") the job ran at, when it ran at a non-standard
14793
+ // one. Optional so older clients ignore it and the field is absent for
14794
+ // standard-tier and text generations.
14795
+ tier: external_exports.string().nullable().optional(),
14796
+ status: GenerationJobStatusSchema,
14797
+ creditCost: external_exports.number().nullable(),
14798
+ // Whether the debit was reversed — `creditCost` was charged and given back,
14799
+ // so it did not count towards usage. Optional so older clients ignore it.
14800
+ refunded: external_exports.boolean().optional(),
14801
+ createdAt: external_exports.string(),
14802
+ user: external_exports.object({
14803
+ id: external_exports.string(),
14804
+ name: external_exports.string(),
14805
+ email: external_exports.string()
14806
+ }).nullable(),
14807
+ project: external_exports.object({
14808
+ id: external_exports.string(),
14809
+ title: external_exports.string(),
14810
+ archived: external_exports.boolean()
14811
+ }).nullable(),
14812
+ // Set when the generation was produced by running a template: the bulk run
14813
+ // it belonged to plus the template's name. Lets a run's per-model rows be
14814
+ // consolidated into one row (see `consolidateTemplateRuns`). Optional so
14815
+ // older clients ignore it and it is absent for non-template generations.
14816
+ templateRun: external_exports.object({
14817
+ runId: external_exports.string(),
14818
+ title: external_exports.string()
14819
+ }).nullable().optional()
14820
+ });
14821
+ var ListGenerationHistoryResponseSchema = external_exports.object({
14822
+ items: external_exports.array(GenerationHistoryItemSchema),
14823
+ total: external_exports.number()
14824
+ });
14825
+ var GenerationsByWeekItemSchema = external_exports.object({
14826
+ weekStart: external_exports.string().datetime(),
14827
+ count: external_exports.number().int().nonnegative()
14572
14828
  });
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()
14829
+ var GetGenerationsByWeekResponseSchema = external_exports.object({
14830
+ items: external_exports.array(GenerationsByWeekItemSchema)
14598
14831
  });
14599
- var ProfileReferralInfoSchema = external_exports.object({
14600
- code: external_exports.string()
14832
+ var SeedancePrecheckCategorySchema = external_exports.enum([
14833
+ "named_public_figure",
14834
+ "minor_risk",
14835
+ "deception_risk",
14836
+ "political_risk",
14837
+ "intimate_sexual",
14838
+ "copyrighted_ip",
14839
+ "brand_logo",
14840
+ "violence_weapons"
14841
+ ]);
14842
+ var SeedancePrecheckRequestSchema = external_exports.object({
14843
+ /** Model name as it appears on the canvas node (e.g. "seedance-2.0"). */
14844
+ model: external_exports.string().trim().min(1),
14845
+ prompt: external_exports.string().optional(),
14846
+ imageUrls: external_exports.array(external_exports.string().url()).optional(),
14847
+ videoUrls: external_exports.array(external_exports.string().url()).optional()
14601
14848
  });
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()
14849
+ var SeedancePrecheckResponseSchema = external_exports.object({
14850
+ verdict: external_exports.enum(["likely_pass", "likely_fail"]),
14851
+ category: SeedancePrecheckCategorySchema.optional(),
14852
+ confidence: external_exports.enum(["high", "medium"]),
14853
+ reason: external_exports.string(),
14854
+ cacheKey: external_exports.string()
14607
14855
  });
14608
14856
 
14609
- // ../api-contract/src/profile/routes.ts
14610
- var c9 = initContract();
14611
- var profileContract = c9.router({
14612
- getMyProfile: {
14857
+ // ../api-contract/src/generation/routes.ts
14858
+ var c7 = initContract();
14859
+ var generationContract = c7.router({
14860
+ listGenerativeModels: {
14613
14861
  method: "GET",
14614
- path: "/profile/me",
14615
- responses: { 200: ProfileUserSchema }
14862
+ path: "/generation/models",
14863
+ query: external_exports.object({ category: ModelCategorySchema }),
14864
+ responses: {
14865
+ 200: ListGenerativeModelsResponseSchema
14866
+ }
14616
14867
  },
14617
- getMyReferralInfo: {
14868
+ listPublicGenerativeModels: {
14618
14869
  method: "GET",
14619
- path: "/profile/referral",
14620
- responses: { 200: ProfileReferralInfoSchema }
14870
+ path: "/generation/models/public",
14871
+ query: external_exports.object({ category: ModelCategorySchema }),
14872
+ responses: {
14873
+ 200: ListGenerativeModelsResponseSchema
14874
+ },
14875
+ summary: "List generally-available models without authentication (logged-out home)"
14621
14876
  },
14622
- getReferralRewards: {
14877
+ listHeygenAvatarVAvatars: {
14623
14878
  method: "GET",
14624
- path: "/profile/referral/rewards",
14879
+ path: "/generation/heygen-avatar-v-avatars",
14880
+ // Each HeyGen avatar model has its own provider roster, so the caller
14881
+ // names the model it is picking for. Omitted means Avatar V, which is
14882
+ // what every client sent before Avatar IV existed.
14883
+ query: external_exports.object({ model: external_exports.string().optional() }).optional(),
14625
14884
  responses: {
14626
- 200: external_exports.object({
14627
- rewards: external_exports.array(ReferralRewardNotificationSchema)
14628
- })
14885
+ 200: external_exports.object({ avatars: external_exports.array(external_exports.string()) })
14629
14886
  }
14630
14887
  },
14631
- sendReferralInvite: {
14632
- method: "POST",
14633
- path: "/profile/referral/invite",
14634
- body: external_exports.object({
14635
- email: external_exports.string().email().max(320)
14888
+ listHeygenAvatarVVoices: {
14889
+ method: "GET",
14890
+ path: "/generation/heygen-avatar-v-voices",
14891
+ responses: {
14892
+ 200: external_exports.object({ voices: external_exports.array(external_exports.string()) })
14893
+ }
14894
+ },
14895
+ getAutoModelDefaults: {
14896
+ method: "GET",
14897
+ path: "/generation/auto-model-defaults",
14898
+ responses: {
14899
+ 200: AutoModelDefaultsResponseSchema
14900
+ }
14901
+ },
14902
+ getPublicAutoModelDefaults: {
14903
+ method: "GET",
14904
+ path: "/generation/auto-model-defaults/public",
14905
+ responses: {
14906
+ 200: AutoModelDefaultsResponseSchema
14907
+ },
14908
+ summary: "Auto-model defaults without authentication (logged-out home)"
14909
+ },
14910
+ listGenerationHistory: {
14911
+ method: "GET",
14912
+ path: "/generation/history",
14913
+ query: external_exports.object({
14914
+ ...paginationQuery({ maxLimit: 100, defaultLimit: 50 }),
14915
+ search: external_exports.string().optional(),
14916
+ userId: external_exports.string().optional(),
14917
+ projectId: external_exports.string().optional(),
14918
+ since: external_exports.string().datetime().optional(),
14919
+ until: external_exports.string().datetime().optional()
14636
14920
  }),
14637
14921
  responses: {
14638
- 200: external_exports.object({
14639
- result: external_exports.enum([
14640
- "sent",
14641
- "already_invited",
14642
- "already_has_account"
14643
- ])
14644
- })
14922
+ 200: ListGenerationHistoryResponseSchema
14645
14923
  }
14646
14924
  },
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()
14925
+ listGenerationHistoryPaginated: {
14926
+ method: "GET",
14927
+ path: "/generation/history/paginated",
14928
+ query: external_exports.object({
14929
+ ...paginationQuery({ maxLimit: 100, defaultLimit: 50 }),
14930
+ search: external_exports.string().optional(),
14931
+ userId: external_exports.string().optional(),
14932
+ projectId: external_exports.string().optional(),
14933
+ since: external_exports.string().datetime().optional(),
14934
+ until: external_exports.string().datetime().optional()
14656
14935
  }),
14657
- responses: { 200: ProfileUserSchema }
14936
+ responses: {
14937
+ 200: ListGenerationHistoryResponseSchema
14938
+ }
14658
14939
  },
14659
- updateAdvancedSettings: {
14660
- method: "PATCH",
14661
- path: "/profile/me/advanced-settings",
14662
- body: UserAdvancedSettingsSchema,
14940
+ downloadGenerationHistory: {
14941
+ method: "GET",
14942
+ path: "/generation/history/download",
14943
+ // Same filters as the paginated list, minus pagination: an export
14944
+ // returns every matching row, not a page.
14945
+ query: external_exports.object({
14946
+ search: external_exports.string().optional(),
14947
+ userId: external_exports.string().optional(),
14948
+ projectId: external_exports.string().optional(),
14949
+ since: external_exports.string().datetime().optional(),
14950
+ until: external_exports.string().datetime().optional()
14951
+ }),
14663
14952
  responses: {
14664
- 200: external_exports.object({ advancedSettings: UserAdvancedSettingsSchema })
14953
+ 200: c7.otherResponse({
14954
+ contentType: "text/csv",
14955
+ body: external_exports.string()
14956
+ })
14665
14957
  }
14666
- }
14667
- });
14668
-
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()
14958
+ },
14959
+ getGenerationsByWeek: {
14960
+ method: "GET",
14961
+ path: "/generation/generations-by-week",
14962
+ query: external_exports.object({
14963
+ weeks: external_exports.coerce.number().int().min(1).max(52).default(12)
14733
14964
  }),
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)
14965
+ responses: {
14966
+ 200: GetGenerationsByWeekResponseSchema
14967
+ }
14968
+ },
14969
+ precheckSeedance: {
14970
+ method: "POST",
14971
+ path: "/generation/precheck-seedance",
14972
+ body: SeedancePrecheckRequestSchema,
14973
+ responses: {
14974
+ 200: SeedancePrecheckResponseSchema
14975
+ }
14976
+ }
14759
14977
  });
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()
14978
+
14979
+ // ../api-contract/src/presets/schema.ts
14980
+ var TextNodeDataSchema = external_exports.object({
14981
+ title: external_exports.string(),
14982
+ mode: external_exports.string(),
14983
+ prompt: external_exports.string(),
14984
+ /** `getValidHandles` builds a text node's targets as `["text", ...this]`. */
14985
+ supportedInputs: external_exports.array(external_exports.string()).optional()
14782
14986
  });
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()
14987
+ var ImageNodeDataSchema = external_exports.object({
14988
+ title: external_exports.string(),
14989
+ src: external_exports.string().optional(),
14990
+ mode: external_exports.string(),
14991
+ aspectRatio: external_exports.string().optional(),
14992
+ prompt: external_exports.string()
14795
14993
  });
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(),
14994
+ var VideoNodeDataSchema = external_exports.object({
14995
+ title: external_exports.string(),
14996
+ src: external_exports.string().optional(),
14997
+ mode: external_exports.string(),
14998
+ aspectRatio: external_exports.string().optional(),
14999
+ duration: external_exports.string().optional(),
15000
+ prompt: external_exports.string(),
14804
15001
  /**
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`.
15002
+ * Handle validation tests these by key PRESENCE (`hasModelCapabilityFlags`
15003
+ * in `canvas-handles.ts`) and treats them as one family, so dropping any one
15004
+ * key disables the whole model-flag branch rather than just that flag.
15005
+ * Declared together for that reason, not because every preset sets all four.
14810
15006
  */
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()
15007
+ modelSupportsEndImage: external_exports.boolean().optional(),
15008
+ modelSupportsReferenceImage: external_exports.boolean().optional(),
15009
+ modelSupportsOptionalStartImage: external_exports.boolean().optional(),
15010
+ modelSupportsAudioInput: external_exports.boolean().optional()
14851
15011
  });
14852
- var CustomerEnterpriseOrderSchema = EnterpriseOrderSchema.extend({
14853
- stripeBilling: CustomerEnterpriseStripeBillingSchema.optional()
15012
+ var AudioNodeDataSchema = external_exports.object({
15013
+ title: external_exports.string(),
15014
+ src: external_exports.string().optional(),
15015
+ mode: external_exports.string().optional(),
15016
+ prompt: external_exports.string().optional(),
15017
+ voiceId: external_exports.string().optional()
14854
15018
  });
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()
15019
+ var FileNodeDataSchema = external_exports.object({
15020
+ title: external_exports.string(),
15021
+ src: external_exports.string().optional(),
15022
+ mediaType: external_exports.enum(["image", "video"]),
15023
+ /** Opts the preset viewer's file node into rendering an audio output. */
15024
+ showAudioOutput: external_exports.boolean().optional()
14865
15025
  });
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"])
15026
+ var CustomTextNodeDataSchema = external_exports.object({
15027
+ title: external_exports.string(),
15028
+ generatedText: external_exports.string().optional()
14878
15029
  });
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()
15030
+ var GroupNodeDataSchema = external_exports.object({
15031
+ label: external_exports.string()
14887
15032
  });
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.
15033
+ var SharedNodeFields = {
15034
+ key: external_exports.string(),
15035
+ width: external_exports.number().optional(),
15036
+ height: external_exports.number().optional(),
15037
+ column: external_exports.number().optional(),
15038
+ x: external_exports.number().optional(),
15039
+ y: external_exports.number().optional(),
15040
+ autoModel: AutoModelConfigSchema.optional(),
15041
+ parentKey: external_exports.string().optional()
15042
+ };
15043
+ var PresetNodeSchema = external_exports.discriminatedUnion("type", [
15044
+ external_exports.object({
15045
+ type: external_exports.literal("text"),
15046
+ data: TextNodeDataSchema,
15047
+ ...SharedNodeFields
15048
+ }),
15049
+ external_exports.object({
15050
+ type: external_exports.literal("image"),
15051
+ data: ImageNodeDataSchema,
15052
+ ...SharedNodeFields
15053
+ }),
15054
+ external_exports.object({
15055
+ type: external_exports.literal("video"),
15056
+ data: VideoNodeDataSchema,
15057
+ ...SharedNodeFields
15058
+ }),
15059
+ external_exports.object({
15060
+ type: external_exports.literal("audio"),
15061
+ data: AudioNodeDataSchema,
15062
+ ...SharedNodeFields
15063
+ }),
15064
+ external_exports.object({
15065
+ type: external_exports.literal("file"),
15066
+ data: FileNodeDataSchema,
15067
+ ...SharedNodeFields
15068
+ }),
15069
+ external_exports.object({
15070
+ type: external_exports.literal("custom_text"),
15071
+ data: CustomTextNodeDataSchema,
15072
+ ...SharedNodeFields
15073
+ }),
15074
+ external_exports.object({
15075
+ type: external_exports.literal("group"),
15076
+ data: GroupNodeDataSchema,
15077
+ ...SharedNodeFields
15078
+ })
15079
+ ]);
15080
+ var PresetEdgeSchema = external_exports.object({
15081
+ sourceKey: external_exports.string(),
15082
+ targetKey: external_exports.string(),
15083
+ handleId: external_exports.string(),
15084
+ targetHandleId: external_exports.string().optional()
14902
15085
  });
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()
15086
+ var PresetResponseSchema = external_exports.object({
15087
+ id: external_exports.string(),
15088
+ title: external_exports.string(),
15089
+ groupLabel: external_exports.string(),
15090
+ icon: external_exports.string(),
15091
+ description: external_exports.string(),
15092
+ nodes: external_exports.array(PresetNodeSchema),
15093
+ edges: external_exports.array(PresetEdgeSchema)
14908
15094
  });
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()
15095
+
15096
+ // ../api-contract/src/presets/routes.ts
15097
+ var c8 = initContract();
15098
+ var presetsContract = c8.router({
15099
+ listPresets: {
15100
+ method: "GET",
15101
+ path: "/presets",
15102
+ responses: {
15103
+ 200: external_exports.object({
15104
+ data: external_exports.array(PresetResponseSchema)
15105
+ })
15106
+ },
15107
+ summary: "List available group presets"
15108
+ }
14916
15109
  });
14917
- var ActiveProductFeatureOverrideSchema = external_exports.object({
14918
- feature: external_exports.string().min(1),
14919
- expiresAt: external_exports.string().datetime()
15110
+
15111
+ // ../api-contract/src/profile/schema.ts
15112
+ var MagicResizeCustomResolutionSchema = external_exports.object({
15113
+ width: external_exports.number().int().min(64).max(4096),
15114
+ height: external_exports.number().int().min(64).max(4096)
14920
15115
  });
14921
- var ActivePlanPreviewSchema = external_exports.object({
14922
- previewPlanTier: TeamPlanSchema,
14923
- expiresAt: external_exports.string().datetime()
15116
+ var UserAdvancedSettingsSchema = external_exports.object({
15117
+ seedancePrecheckEnabled: external_exports.boolean().optional(),
15118
+ seedanceDurationWarningEnabled: external_exports.boolean().optional(),
15119
+ // Pro view: hide a node's prompt until hovered, shown translucently over
15120
+ // the media instead of below the node.
15121
+ hideNodePromptsEnabled: external_exports.boolean().optional(),
15122
+ magicResizeCustomResolutions: external_exports.array(MagicResizeCustomResolutionSchema).max(20).optional()
14924
15123
  });
14925
- var TeamSchema = external_exports.object({
15124
+ var ProfileUserSchema = external_exports.object({
14926
15125
  id: external_exports.string().uuid(),
14927
15126
  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)
14936
- });
14937
- var MemberSchema = external_exports.object({
14938
- 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()
15127
+ email: external_exports.string(),
15128
+ agentAutoRun: external_exports.boolean(),
15129
+ // Set once the user answers the "how did you hear about us" intro. Marks
15130
+ // the account-level onboarding as done, independently of the canvas
15131
+ // product tour (`completedProductTour`).
15132
+ signupSource: external_exports.string().nullable(),
15133
+ completedProductTour: external_exports.string().datetime().nullable(),
15134
+ avatarUrl: external_exports.string().nullable(),
15135
+ advancedSettings: UserAdvancedSettingsSchema,
15136
+ /**
15137
+ * Generations this member started themselves, saturating at
15138
+ * {@link PROFILE_GENERATION_COUNT_CAP}. Agent- and MCP-triggered runs are
15139
+ * not counted: the readers are prompts about hands-on canvas work, and the
15140
+ * two attribution columns cannot be counted together within one bounded
15141
+ * index scan.
15142
+ *
15143
+ * Sent only while `advancedSettings.hideNodePromptsEnabled` is unset. The
15144
+ * count exists to decide whether to offer the node-display prompt, and a
15145
+ * saved display default has already decided it, so the server does not
15146
+ * spend the query. Absent therefore means "no reader needs this" — never
15147
+ * "this member has run nothing" — and a client must not show it as a total.
15148
+ *
15149
+ * Optional, so a client built before this reads the payload unchanged.
15150
+ */
15151
+ generationCount: external_exports.number().int().nonnegative().optional(),
15152
+ /**
15153
+ * Whether this session may open the staff tools panel — a Melius account,
15154
+ * or somebody of ours behind a verified impersonation marker.
15155
+ *
15156
+ * Sent because the client cannot work it out. While impersonating, `email`
15157
+ * above is the *customer's*, so a panel gated on the address it can see
15158
+ * would disappear exactly when support needs it. Says nothing about what
15159
+ * the tools do: the server re-decides that per request, so a client that
15160
+ * forces this to true gets a panel whose switches change nothing.
15161
+ *
15162
+ * Optional, so a client built before this reads the payload unchanged.
15163
+ */
15164
+ canUseStaffTools: external_exports.boolean().optional()
14944
15165
  });
14945
- var TeamMembershipSchema = external_exports.object({
14946
- id: external_exports.string().uuid(),
14947
- role: TeamRoleSchema,
14948
- team: TeamSchema
15166
+ var ProfileReferralInfoSchema = external_exports.object({
15167
+ code: external_exports.string()
14949
15168
  });
14950
- var InviteLinkSchema = external_exports.object({
15169
+ var ReferralRewardNotificationSchema = external_exports.object({
14951
15170
  id: external_exports.string().uuid(),
14952
- role: InviteLinkRoleSchema,
14953
- token: external_exports.string(),
14954
- createdAt: external_exports.string().datetime()
15171
+ kind: external_exports.enum(["referrer", "invitee"]),
15172
+ counterpartName: external_exports.string(),
15173
+ redeemedAt: external_exports.string().datetime()
14955
15174
  });
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()
15175
+
15176
+ // ../api-contract/src/profile/routes.ts
15177
+ var c9 = initContract();
15178
+ var profileContract = c9.router({
15179
+ getMyProfile: {
15180
+ method: "GET",
15181
+ path: "/profile/me",
15182
+ responses: { 200: ProfileUserSchema }
15183
+ },
15184
+ getMyReferralInfo: {
15185
+ method: "GET",
15186
+ path: "/profile/referral",
15187
+ responses: { 200: ProfileReferralInfoSchema }
15188
+ },
15189
+ getReferralRewards: {
15190
+ method: "GET",
15191
+ path: "/profile/referral/rewards",
15192
+ responses: {
15193
+ 200: external_exports.object({
15194
+ rewards: external_exports.array(ReferralRewardNotificationSchema)
15195
+ })
15196
+ }
15197
+ },
15198
+ sendReferralInvite: {
15199
+ method: "POST",
15200
+ path: "/profile/referral/invite",
15201
+ body: external_exports.object({
15202
+ email: external_exports.string().email().max(320)
15203
+ }),
15204
+ responses: {
15205
+ 200: external_exports.object({
15206
+ result: external_exports.enum([
15207
+ "sent",
15208
+ "already_invited",
15209
+ "already_has_account"
15210
+ ])
15211
+ })
15212
+ }
15213
+ },
15214
+ updateMyProfile: {
15215
+ method: "PATCH",
15216
+ path: "/profile/me",
15217
+ body: external_exports.object({
15218
+ agentAutoRun: external_exports.boolean().optional(),
15219
+ completedProductTour: external_exports.string().datetime().nullable().optional(),
15220
+ // How the walkthrough ended. `completedProductTour` is written on
15221
+ // both paths so it cannot tell finishing from skipping, and a
15222
+ // conversion that counts everyone who bailed at step 2 is the
15223
+ // opposite of a high-intent signal. Optional, so a client that
15224
+ // does not send it simply reports no conversion.
15225
+ productTourOutcome: external_exports.enum(["completed", "skipped"]).optional(),
15226
+ avatarS3Bucket: external_exports.string().optional(),
15227
+ avatarS3Key: external_exports.string().optional(),
15228
+ signupSource: external_exports.string().min(1).max(200).optional()
15229
+ }),
15230
+ responses: { 200: ProfileUserSchema }
15231
+ },
15232
+ updateAdvancedSettings: {
15233
+ method: "PATCH",
15234
+ path: "/profile/me/advanced-settings",
15235
+ body: UserAdvancedSettingsSchema,
15236
+ responses: {
15237
+ 200: external_exports.object({ advancedSettings: UserAdvancedSettingsSchema })
15238
+ }
15239
+ }
14964
15240
  });
14965
15241
 
14966
15242
  // ../api-contract/src/share/schema.ts
@@ -14976,6 +15252,37 @@ var SharedAssetResponseSchema = external_exports.object({
14976
15252
  height: external_exports.number().int().nullable(),
14977
15253
  durationInMs: external_exports.number().int().nullable()
14978
15254
  });
15255
+ var SharedFolderAssetSchema = external_exports.object({
15256
+ id: external_exports.string().uuid(),
15257
+ folderId: external_exports.string().uuid(),
15258
+ filename: external_exports.string(),
15259
+ fileType: FileTypeSchema,
15260
+ contentType: external_exports.string().nullable(),
15261
+ mediaUrl: external_exports.string().url().nullable(),
15262
+ previewUrl: external_exports.string().url().nullable(),
15263
+ width: external_exports.number().int().nullable(),
15264
+ height: external_exports.number().int().nullable(),
15265
+ durationInMs: external_exports.number().int().nullable(),
15266
+ // The three fields the shared grid sorts and filters on, matching what a
15267
+ // `FileCard` carries so the public page renders the same tile and row a
15268
+ // member sees. Optional to support version-skew between web and core
15269
+ // deployments; the viewer treats an absent value as unknown rather than
15270
+ // guessing.
15271
+ source: FileSourceSchema.optional(),
15272
+ fileSizeInKb: external_exports.number().int().nullable().optional(),
15273
+ createdAt: external_exports.string().datetime().nullable().optional()
15274
+ });
15275
+ var SharedFolderChildSchema = external_exports.object({
15276
+ id: external_exports.string().uuid(),
15277
+ parentFolderId: external_exports.string().uuid().nullable(),
15278
+ name: external_exports.string()
15279
+ });
15280
+ var SharedFolderResponseSchema = external_exports.object({
15281
+ id: external_exports.string().uuid(),
15282
+ name: external_exports.string(),
15283
+ folders: external_exports.array(SharedFolderChildSchema),
15284
+ assets: external_exports.array(SharedFolderAssetSchema)
15285
+ });
14979
15286
  var SharedDownloadResponseSchema = external_exports.object({
14980
15287
  url: external_exports.string().url().nullable(),
14981
15288
  text: external_exports.string().nullable(),
@@ -15181,7 +15488,7 @@ var ProjectThumbnailsResponseSchema = external_exports.object({
15181
15488
  });
15182
15489
  var MAX_PROJECT_TITLE_LENGTH = 500;
15183
15490
  var PROJECT_CONFLICT_CODE = {
15184
- nameTaken: "PROJECT_NAME_TAKEN"
15491
+ nameTaken: API_ERROR_CODE.projectNameTaken
15185
15492
  };
15186
15493
  var ProjectConflictResponseSchema = MessageResponseSchema.extend({
15187
15494
  code: external_exports.nativeEnum(PROJECT_CONFLICT_CODE).optional()
@@ -15651,6 +15958,27 @@ var publicTemplateApplyRoute = {
15651
15958
  }
15652
15959
  };
15653
15960
 
15961
+ // ../api-contract/src/media-types.ts
15962
+ var IMAGE_CONTENT_TYPE_BY_EXTENSION = {
15963
+ ".jpg": "image/jpeg",
15964
+ ".jpeg": "image/jpeg",
15965
+ ".png": "image/png",
15966
+ ".webp": "image/webp",
15967
+ ".gif": "image/gif",
15968
+ ".avif": "image/avif",
15969
+ ".svg": "image/svg+xml"
15970
+ };
15971
+ var MAX_DOCUMENT_PDF_FILE_SIZE = 25 * 1024 * 1024;
15972
+ var MAX_DOCUMENT_MARKDOWN_FILE_SIZE = 1 * 1024 * 1024;
15973
+ var UPLOAD_PURPOSES = [
15974
+ "asset",
15975
+ "avatar",
15976
+ "team-photo",
15977
+ "custom-font",
15978
+ "comment-attachment"
15979
+ ];
15980
+ var MAX_FONT_FILE_SIZE_BYTES = 10 * 1024 * 1024;
15981
+
15654
15982
  // ../api-contract/src/upload/schema.ts
15655
15983
  var PdfExtractionModeSchema = external_exports.enum(["summary", "pages"]);
15656
15984
  var InitUploadBodySchema = external_exports.object({
@@ -15658,7 +15986,7 @@ var InitUploadBodySchema = external_exports.object({
15658
15986
  filename: external_exports.string(),
15659
15987
  contentType: external_exports.string(),
15660
15988
  sizeInBytes: external_exports.number().int().positive(),
15661
- purpose: external_exports.enum(["asset", "avatar", "team-photo", "custom-font"]).optional().default("asset")
15989
+ purpose: external_exports.enum(UPLOAD_PURPOSES).optional().default("asset")
15662
15990
  });
15663
15991
  var InitUploadResponseSchema = external_exports.object({
15664
15992
  uploadId: external_exports.string(),
@@ -15675,17 +16003,6 @@ var SignPartBodySchema = external_exports.object({
15675
16003
  var SignPartResponseSchema = external_exports.object({
15676
16004
  url: external_exports.string()
15677
16005
  });
15678
- var CompleteUploadNodePayloadSchema = external_exports.object({
15679
- nodeType: external_exports.string(),
15680
- geometry: external_exports.object({
15681
- x: external_exports.number(),
15682
- y: external_exports.number(),
15683
- w: external_exports.number(),
15684
- h: external_exports.number()
15685
- }),
15686
- title: external_exports.string().optional(),
15687
- createdByUserId: external_exports.string().uuid().optional()
15688
- });
15689
16006
  var CompleteUploadBodySchema = external_exports.object({
15690
16007
  uploadId: external_exports.string(),
15691
16008
  s3Bucket: external_exports.string(),
@@ -15701,8 +16018,8 @@ var CompleteUploadBodySchema = external_exports.object({
15701
16018
  // here lets the server skip a separate ranged S3 GET on complete.
15702
16019
  width: external_exports.number().int().positive().optional(),
15703
16020
  height: external_exports.number().int().positive().optional(),
15704
- // Optional materialization payload — see schema comment above.
15705
- node: CompleteUploadNodePayloadSchema.optional(),
16021
+ // Optional materialization payload — see `NodeMaterializationPayloadSchema`.
16022
+ node: NodeMaterializationPayloadSchema.optional(),
15706
16023
  // url_to_canvas (agent) uploads need the final image URL written into
15707
16024
  // the CRDT so the file node renders immediately when the update arrives
15708
16025
  // over WS. Regular web uploads keep the broadcastPreviewUrls flow.
@@ -15715,7 +16032,10 @@ var CompleteUploadBodySchema = external_exports.object({
15715
16032
  replaceActiveVersion: external_exports.boolean().optional(),
15716
16033
  // PDF-only: how to process the upload once complete. Omitted ⇒ "summary"
15717
16034
  // (the server default and every non-PDF upload). See PdfExtractionModeSchema.
15718
- pdfExtractionMode: PdfExtractionModeSchema.optional()
16035
+ pdfExtractionMode: PdfExtractionModeSchema.optional(),
16036
+ // The same purpose given to `init`. Omitted ⇒ "asset" (old clients). A
16037
+ // `comment-attachment` completes as an asset that stays out of Files.
16038
+ purpose: external_exports.enum(UPLOAD_PURPOSES).optional()
15719
16039
  });
15720
16040
  var CompleteUploadResponseSchema = external_exports.object({
15721
16041
  success: external_exports.boolean(),
@@ -16095,7 +16415,7 @@ function isMajorUpgrade(current, latest) {
16095
16415
  return l[0] > c14[0];
16096
16416
  }
16097
16417
  function shouldShowUpgradeNotice(ctx = {}) {
16098
- const current = ctx.current ?? "0.15.3";
16418
+ const current = ctx.current ?? "0.16.0";
16099
16419
  const latest = ctx.latest ?? serverLatestVersion;
16100
16420
  const env = ctx.env ?? process.env;
16101
16421
  const isTty = ctx.isTty ?? Boolean(process.stderr.isTTY);
@@ -16116,7 +16436,7 @@ Upgrade: npm install -g @melius-ai/cli@latest (or: brew update && brew upgrade
16116
16436
  function printUpgradeNoticeIfNeeded(ctx = {}) {
16117
16437
  try {
16118
16438
  if (!shouldShowUpgradeNotice(ctx)) return;
16119
- const current = ctx.current ?? "0.15.3";
16439
+ const current = ctx.current ?? "0.16.0";
16120
16440
  const latest = ctx.latest ?? serverLatestVersion;
16121
16441
  process.stderr.write(formatUpgradeNotice(current, latest));
16122
16442
  } catch {
@@ -16679,20 +16999,6 @@ function normalizeEdgeId(id, generateId = () => crypto.randomUUID()) {
16679
16999
  return id && UUID_RE.test(id) ? id : generateId();
16680
17000
  }
16681
17001
 
16682
- // ../api-contract/src/media-types.ts
16683
- var IMAGE_CONTENT_TYPE_BY_EXTENSION = {
16684
- ".jpg": "image/jpeg",
16685
- ".jpeg": "image/jpeg",
16686
- ".png": "image/png",
16687
- ".webp": "image/webp",
16688
- ".gif": "image/gif",
16689
- ".avif": "image/avif",
16690
- ".svg": "image/svg+xml"
16691
- };
16692
- var MAX_DOCUMENT_PDF_FILE_SIZE = 25 * 1024 * 1024;
16693
- var MAX_DOCUMENT_MARKDOWN_FILE_SIZE = 1 * 1024 * 1024;
16694
- var MAX_FONT_FILE_SIZE_BYTES = 10 * 1024 * 1024;
16695
-
16696
17002
  // ../api-contract/src/canvas-layout.ts
16697
17003
  function computePresetLayout(preset, center) {
16698
17004
  const presetGroups = preset.nodes.filter((n) => n.type === "group");
@@ -17319,7 +17625,7 @@ function resolveNodeIds2(canvasId, nodeIds) {
17319
17625
  }
17320
17626
 
17321
17627
  // src/lib/validation.ts
17322
- function validateModelConfig(model, variant) {
17628
+ function validateModelConfig(model, variant, tier) {
17323
17629
  if (model === FISH_AUDIO_MODEL) {
17324
17630
  writeError(
17325
17631
  formatError(
@@ -17332,7 +17638,19 @@ function validateModelConfig(model, variant) {
17332
17638
  EXIT_USAGE_ERROR
17333
17639
  );
17334
17640
  }
17335
- if (model && variant) return { model, variant };
17641
+ if (model && variant) return { model, variant, ...tier && { tier } };
17642
+ if (tier) {
17643
+ writeError(
17644
+ formatError(
17645
+ "USAGE_ERROR",
17646
+ "--tier requires --model and --variant",
17647
+ {
17648
+ suggestion: "A tier names a speed of one model+variant. Run: mel model list to find the variant's tier, then pass --model <model> --variant <variant> --tier <tier>"
17649
+ }
17650
+ ),
17651
+ EXIT_USAGE_ERROR
17652
+ );
17653
+ }
17336
17654
  if (!model && !variant) return void 0;
17337
17655
  writeError(
17338
17656
  formatError(
@@ -17383,7 +17701,10 @@ function parseClipOrder(value) {
17383
17701
  return clipOrder.length > 0 ? clipOrder : void 0;
17384
17702
  }
17385
17703
  function addNodeOptions(cmd) {
17386
- return cmd.option("--id <uuid>", "Node ID (auto-generated if omitted)").option("--title <title>", "Node title").option("--x <number>", "X position").option("--y <number>", "Y position").option("--w <number>", "Width").option("--h <number>", "Height").option("--z-index <number>", "Z-index").option("--group-id <uuid>", "Parent group ID").option("--model <model>", "Model name (requires --variant)").option("--variant <variant>", "Model variant (requires --model)").option("--prompt <text>", "Text prompt").option(
17704
+ return cmd.option("--id <uuid>", "Node ID (auto-generated if omitted)").option("--title <title>", "Node title").option("--x <number>", "X position").option("--y <number>", "Y position").option("--w <number>", "Width").option("--h <number>", "Height").option("--z-index <number>", "Z-index").option("--group-id <uuid>", "Parent group ID").option("--model <model>", "Model name (requires --variant)").option("--variant <variant>", "Model variant (requires --model)").option(
17705
+ "--tier <tier>",
17706
+ "Speed tier of that model+variant (e.g. fast, pro, turbo; requires --model and --variant). Omit for the model's standard speed. Use mel model list to see each variant's tier"
17707
+ ).option("--prompt <text>", "Text prompt").option(
17387
17708
  "--content <text>",
17388
17709
  "Literal text content for custom_text nodes"
17389
17710
  ).option("--aspect-ratio <ratio>", "Output aspect ratio").option(
@@ -17455,6 +17776,7 @@ Examples:
17455
17776
  $ mel node create <canvasId> --type stitch --clip-order <video1>,<video2> --scale-fit stretch
17456
17777
  $ mel node create <canvasId> --type text --x 100 --y 200 --title "My node"
17457
17778
  $ mel node create <canvasId> --type image --model flux-pro --variant text-to-image
17779
+ $ mel node create <canvasId> --type video --model wan-3.0 --variant text-to-video --tier fast
17458
17780
  $ mel node create <canvasId> --type file --src https://cdn.example.com/photo.jpg --media-type image --s3-key assets/photo.jpg --s3-bucket <bucket> --content-type image/jpeg --title "Source"
17459
17781
  $ mel node create <canvasId> --type audio --model eleven_v3 --variant text-to-speech --prompt "Hello there" --voice-id <voiceId>
17460
17782
  $ mel node create <canvasId> --type audio --model elevenlabs-sfx --variant text-to-sfx --prompt "Thunder crack" --duration 10
@@ -17463,7 +17785,11 @@ Examples:
17463
17785
  ).action(async (canvasId, opts) => {
17464
17786
  const client = getClient();
17465
17787
  const id = opts.id ?? crypto.randomUUID();
17466
- const modelConfig = validateModelConfig(opts.model, opts.variant);
17788
+ const modelConfig = validateModelConfig(
17789
+ opts.model,
17790
+ opts.variant,
17791
+ opts.tier
17792
+ );
17467
17793
  const geometry = buildGeometry(opts.type, opts);
17468
17794
  const clipOrder = parseClipOrder(opts.clipOrder);
17469
17795
  const result = await client.node.create({
@@ -17553,7 +17879,8 @@ Examples:
17553
17879
  const client = getClient();
17554
17880
  const modelConfig = validateModelConfig(
17555
17881
  opts.model,
17556
- opts.variant
17882
+ opts.variant,
17883
+ opts.tier
17557
17884
  );
17558
17885
  const clipOrder = parseClipOrder(opts.clipOrder);
17559
17886
  const geoProvided = [opts.x, opts.y, opts.w, opts.h].filter(
@@ -17641,7 +17968,7 @@ Examples:
17641
17968
  "Canvas ID (from mel canvas create or mel canvas list)"
17642
17969
  ).option(
17643
17970
  "--json <json>",
17644
- 'JSON array of node objects OR {"nodes":[...],"edges":[...]} object, or "-" to read from stdin. Each node object: { type, title?, x?, y?, w?, h?, prompt?, text?, aspectRatio?, duration?, model?, variant?, groupId?, id?, seed?, voiceId?, negativePrompt?, clipOrder?, scaleFit?, src?, mediaType?, s3Key?, s3Bucket?, contentType?, sourceNodeId? }'
17971
+ 'JSON array of node objects OR {"nodes":[...],"edges":[...]} object, or "-" to read from stdin. Each node object: { type, title?, x?, y?, w?, h?, prompt?, text?, aspectRatio?, duration?, model?, variant?, tier?, groupId?, id?, seed?, voiceId?, negativePrompt?, clipOrder?, scaleFit?, src?, mediaType?, s3Key?, s3Bucket?, contentType?, sourceNodeId? }'
17645
17972
  ).option(
17646
17973
  "--edges <json>",
17647
17974
  'JSON array of edge objects: [{"src":"a","dst":"b","type":"text"}]. Merged with any edges in the JSON body'
@@ -17822,7 +18149,8 @@ Valid node types: text, image, video, audio, file, group, custom_text, stitch.
17822
18149
  const autoGeo = item.id ? autoPositions[item.id] : void 0;
17823
18150
  const modelConfig = validateModelConfig(
17824
18151
  item.model,
17825
- item.variant
18152
+ item.variant,
18153
+ item.tier
17826
18154
  );
17827
18155
  return {
17828
18156
  id,
@@ -18601,6 +18929,9 @@ function registerRunCommands(program2, getOutputOpts) {
18601
18929
  ).option(
18602
18930
  "--variant <variant>",
18603
18931
  "Model variant (requires --model). e.g. text-to-image, image-to-image"
18932
+ ).option(
18933
+ "--tier <tier>",
18934
+ "Speed tier of that model+variant (e.g. fast, pro, turbo; requires --model and --variant). Omit for the model's standard speed. Use mel model list to see each variant's tier"
18604
18935
  ).option(
18605
18936
  "--aspect-ratio <ratio>",
18606
18937
  "Output aspect ratio: 21:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, 9:21"
@@ -18640,6 +18971,7 @@ Examples:
18640
18971
  $ mel run start <nodeId> --canvas-id <canvasId>
18641
18972
  $ mel run start <nodeId> --canvas-id <canvasId> --prompt "A sunset over the ocean"
18642
18973
  $ mel run start <nodeId> --canvas-id <canvasId> --variations 3
18974
+ $ mel run start <nodeId> --canvas-id <canvasId> --model wan-3.0 --variant text-to-video --tier fast
18643
18975
  $ mel run start <audioNodeId> --canvas-id <canvasId> --voice-id <voiceId>
18644
18976
  $ mel run start <audioNodeId> --canvas-id <canvasId> --duration 10`
18645
18977
  ).action(
@@ -18647,7 +18979,8 @@ Examples:
18647
18979
  const client = getClient();
18648
18980
  const modelConfig = validateModelConfig(
18649
18981
  opts.model,
18650
- opts.variant
18982
+ opts.variant,
18983
+ opts.tier
18651
18984
  );
18652
18985
  const canvasNodeIds = await loadCanvasNodeIds(
18653
18986
  client,
@@ -20448,7 +20781,7 @@ function withDefaultHelp(args) {
20448
20781
  }
20449
20782
  function createProgram() {
20450
20783
  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(
20784
+ program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.16.0").showSuggestionAfterError(true).option("--json", "Force JSON output (default)").option("--text", "Human-readable output").option(
20452
20785
  "--fields <fields>",
20453
20786
  "Select specific output fields (comma-separated)"
20454
20787
  ).option("--quiet", "Suppress output, exit code only").option("--verbose", "Log request/response metadata to stderr").addHelpText(