@melius-ai/cli 0.52.0 → 0.54.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.
@@ -3483,10 +3483,10 @@ var util;
3483
3483
  return obj[e];
3484
3484
  });
3485
3485
  };
3486
- util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
3486
+ util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object2) => {
3487
3487
  const keys = [];
3488
- for (const key2 in object) {
3489
- if (Object.prototype.hasOwnProperty.call(object, key2)) {
3488
+ for (const key2 in object2) {
3489
+ if (Object.prototype.hasOwnProperty.call(object2, key2)) {
3490
3490
  keys.push(key2);
3491
3491
  }
3492
3492
  }
@@ -7456,7 +7456,8 @@ var CANVAS_NODE_TYPES = [
7456
7456
  "magic_resize",
7457
7457
  "element",
7458
7458
  "linked_output",
7459
- "router"
7459
+ "router",
7460
+ "motion"
7460
7461
  ];
7461
7462
  var CANVAS_GROUP_TYPES = ["default", "unified", "template"];
7462
7463
  var CANVAS_MEDIA_TYPES = ["image", "video", "audio", "pdf"];
@@ -7477,6 +7478,7 @@ var NOTE_COLOR_KEYS = [
7477
7478
  "purple"
7478
7479
  ];
7479
7480
  var CUSTOM_TEXT_VIEWS = ["raw", "markdown"];
7481
+ var VIDEO_USES = ["edit", "reference"];
7480
7482
 
7481
7483
  // ../api-contract/src/direct-file-node-validation.ts
7482
7484
  var DirectFileNodeMediaTypeSchema = external_exports.enum(CANVAS_MEDIA_TYPES);
@@ -7732,7 +7734,8 @@ var NODE_DEFAULTS = {
7732
7734
  ratios: ["16:9", "1:1", "9:16", "4:3", "3:4"]
7733
7735
  },
7734
7736
  element: { title: "Element", src: "", mediaType: "image" },
7735
- router: { title: "Router" }
7737
+ router: { title: "Router" },
7738
+ motion: { title: "Motion" }
7736
7739
  };
7737
7740
  var NODE_TYPE_TO_MODEL_CATEGORY = Object.fromEntries(
7738
7741
  Object.entries(MODALITIES).map(([k, v]) => [k, v.modelCategory])
@@ -7760,11 +7763,13 @@ var GENERATION_MODES = [
7760
7763
  "speech-to-text",
7761
7764
  "voice-isolator"
7762
7765
  ];
7766
+ var MOTION_NODE_MODE = "motion";
7763
7767
  var VALID_VARIANT_VALUES = /* @__PURE__ */ new Set([
7764
7768
  ...GENERATION_MODES,
7765
7769
  "image-tool",
7766
7770
  "video-tool",
7767
- "text"
7771
+ "text",
7772
+ MOTION_NODE_MODE
7768
7773
  ]);
7769
7774
  function isValidGenerationMode(mode) {
7770
7775
  return VALID_VARIANT_VALUES.has(mode);
@@ -8189,10 +8194,10 @@ function extractMentionedNodeIds(text) {
8189
8194
  const ids = [];
8190
8195
  const seen = /* @__PURE__ */ new Set();
8191
8196
  for (const match of text.matchAll(MENTION_WITH_ID_RE)) {
8192
- const id = match[1];
8193
- if (!seen.has(id)) {
8194
- seen.add(id);
8195
- ids.push(id);
8197
+ const id2 = match[1];
8198
+ if (!seen.has(id2)) {
8199
+ seen.add(id2);
8200
+ ids.push(id2);
8196
8201
  }
8197
8202
  }
8198
8203
  return ids;
@@ -8305,7 +8310,7 @@ function compareById(a, b) {
8305
8310
  }
8306
8311
  function itemOrderComparator(itemOrder) {
8307
8312
  if (!itemOrder) return compareById;
8308
- const rank = new Map(itemOrder.map((id, index) => [id, index]));
8313
+ const rank = new Map(itemOrder.map((id2, index) => [id2, index]));
8309
8314
  return (a, b) => {
8310
8315
  const aRank = rank.get(a.id) ?? Infinity;
8311
8316
  const bRank = rank.get(b.id) ?? Infinity;
@@ -8342,10 +8347,10 @@ function orderTargetsByEdgeDirection(targets, edges, compare) {
8342
8347
  queue.sort((a, b) => (rankById.get(a) ?? 0) - (rankById.get(b) ?? 0));
8343
8348
  const orderedIds = [];
8344
8349
  while (queue.length > 0) {
8345
- const id = queue.shift();
8346
- if (!id) break;
8347
- orderedIds.push(id);
8348
- for (const nextId of outgoing.get(id) ?? []) {
8350
+ const id2 = queue.shift();
8351
+ if (!id2) break;
8352
+ orderedIds.push(id2);
8353
+ for (const nextId of outgoing.get(id2) ?? []) {
8349
8354
  const nextInDegree = (inDegree.get(nextId) ?? 0) - 1;
8350
8355
  inDegree.set(nextId, nextInDegree);
8351
8356
  if (nextInDegree === 0) {
@@ -8358,11 +8363,11 @@ function orderTargetsByEdgeDirection(targets, edges, compare) {
8358
8363
  }
8359
8364
  if (orderedIds.length < orderedByPosition.length) {
8360
8365
  const orderedSet = new Set(orderedIds);
8361
- const remaining = orderedByPosition.map((n) => n.id).filter((id) => !orderedSet.has(id));
8366
+ const remaining = orderedByPosition.map((n) => n.id).filter((id2) => !orderedSet.has(id2));
8362
8367
  orderedIds.push(...remaining);
8363
8368
  }
8364
8369
  return {
8365
- orderedTargets: orderedIds.map((id) => targetById.get(id)).filter((n) => !!n),
8370
+ orderedTargets: orderedIds.map((id2) => targetById.get(id2)).filter((n) => !!n),
8366
8371
  outgoing,
8367
8372
  incoming,
8368
8373
  hasInternalEdges: internalEdges > 0
@@ -8370,7 +8375,7 @@ function orderTargetsByEdgeDirection(targets, edges, compare) {
8370
8375
  }
8371
8376
  function findConnectedComponents(nodeIds, edges) {
8372
8377
  const parent = /* @__PURE__ */ new Map();
8373
- for (const id of nodeIds) parent.set(id, id);
8378
+ for (const id2 of nodeIds) parent.set(id2, id2);
8374
8379
  function find(x) {
8375
8380
  while (parent.get(x) !== x) {
8376
8381
  parent.set(x, parent.get(parent.get(x)));
@@ -8388,10 +8393,10 @@ function findConnectedComponents(nodeIds, edges) {
8388
8393
  }
8389
8394
  }
8390
8395
  const groups = /* @__PURE__ */ new Map();
8391
- for (const id of nodeIds) {
8392
- const root = find(id);
8396
+ for (const id2 of nodeIds) {
8397
+ const root = find(id2);
8393
8398
  if (!groups.has(root)) groups.set(root, []);
8394
- groups.get(root).push(id);
8399
+ groups.get(root).push(id2);
8395
8400
  }
8396
8401
  return [...groups.values()].map((ids) => ids.toSorted()).toSorted((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
8397
8402
  }
@@ -8545,8 +8550,8 @@ function computeAutoformat(allNodes, allEdges, nodeIds, options) {
8545
8550
  const node = nodeById.get(update.nodeId);
8546
8551
  return node ? spacing(node) : { w: update.w, h: update.h };
8547
8552
  };
8548
- function resolveToTargetAncestor(id) {
8549
- let current = id;
8553
+ function resolveToTargetAncestor(id2) {
8554
+ let current = id2;
8550
8555
  const seen = /* @__PURE__ */ new Set();
8551
8556
  while (current && !seen.has(current)) {
8552
8557
  if (targetIds.has(current)) return current;
@@ -8563,14 +8568,14 @@ function computeAutoformat(allNodes, allEdges, nodeIds, options) {
8563
8568
  topologyEdges.push({ ...edge, srcNodeId: src, dstNodeId: dst });
8564
8569
  }
8565
8570
  const rawComponents = findConnectedComponents(targetIds, topologyEdges);
8566
- const connectedComponents = rawComponents.filter((c20) => c20.length > 1);
8567
- const isolatedIds = rawComponents.filter((c20) => c20.length === 1).flat().toSorted();
8568
- const isSourceOnly = (id) => {
8569
- const nodeType = nodeById.get(id)?.nodeType;
8571
+ const connectedComponents = rawComponents.filter((c22) => c22.length > 1);
8572
+ const isolatedIds = rawComponents.filter((c22) => c22.length === 1).flat().toSorted();
8573
+ const isSourceOnly = (id2) => {
8574
+ const nodeType = nodeById.get(id2)?.nodeType;
8570
8575
  return nodeType != null && SOURCE_ONLY_NODE_TYPES.has(nodeType);
8571
8576
  };
8572
8577
  const looseSources = isolatedIds.filter(isSourceOnly);
8573
- const looseOthers = isolatedIds.filter((id) => !isSourceOnly(id));
8578
+ const looseOthers = isolatedIds.filter((id2) => !isSourceOnly(id2));
8574
8579
  if (layout.columns !== null) {
8575
8580
  connectedComponents.push(isolatedIds);
8576
8581
  } else {
@@ -8578,14 +8583,14 @@ function computeAutoformat(allNodes, allEdges, nodeIds, options) {
8578
8583
  if (looseOthers.length > 0) connectedComponents.push(looseOthers);
8579
8584
  }
8580
8585
  const componentRank = (ids) => {
8581
- const nodes = ids.flatMap((id) => nodeById.get(id) ?? []);
8586
+ const nodes = ids.flatMap((id2) => nodeById.get(id2) ?? []);
8582
8587
  if (nodes.length > 0 && nodes.every((n) => isSourceOnly(n.id))) {
8583
8588
  return 0;
8584
8589
  }
8585
8590
  if (nodes.some((n) => isTextType(n.nodeType))) return 1;
8586
8591
  return 2;
8587
8592
  };
8588
- const leadInOrder = (ids) => ids.flatMap((id) => nodeById.get(id) ?? []).reduce(
8593
+ const leadInOrder = (ids) => ids.flatMap((id2) => nodeById.get(id2) ?? []).reduce(
8589
8594
  (lead, n) => lead && compare(lead, n) <= 0 ? lead : n,
8590
8595
  void 0
8591
8596
  );
@@ -8600,7 +8605,7 @@ function computeAutoformat(allNodes, allEdges, nodeIds, options) {
8600
8605
  }
8601
8606
  return a.ids[0] < b.ids[0] ? -1 : a.ids[0] > b.ids[0] ? 1 : 0;
8602
8607
  });
8603
- const components = rankedComponents.map((c20) => c20.ids);
8608
+ const components = rankedComponents.map((c22) => c22.ids);
8604
8609
  if (components.length > 1) {
8605
8610
  const targets2 = sortedNodes.filter((n) => targetIds.has(n.id));
8606
8611
  const parentId2 = targets2[0]?.groupId;
@@ -8789,8 +8794,8 @@ function computeAutoformat(allNodes, allEdges, nodeIds, options) {
8789
8794
  blockStartY = originY;
8790
8795
  }
8791
8796
  if (blockStartY < originY) blockStartY = originY;
8792
- for (const [id, relY] of colPositions) {
8793
- posMap.set(id, { x, y: blockStartY + relY });
8797
+ for (const [id2, relY] of colPositions) {
8798
+ posMap.set(id2, { x, y: blockStartY + relY });
8794
8799
  }
8795
8800
  }
8796
8801
  x += columnWidth + layout.columnGap;
@@ -8800,8 +8805,8 @@ function computeAutoformat(allNodes, allEdges, nodeIds, options) {
8800
8805
  targets.map((node) => ({ id: node.id, ...spacing(node) })),
8801
8806
  layout
8802
8807
  );
8803
- for (const [id, offset] of offsets) {
8804
- posMap.set(id, { x: originX + offset.x, y: originY + offset.y });
8808
+ for (const [id2, offset] of offsets) {
8809
+ posMap.set(id2, { x: originX + offset.x, y: originY + offset.y });
8805
8810
  }
8806
8811
  } else {
8807
8812
  const cols = layout.columns ?? Math.max(
@@ -8822,19 +8827,19 @@ function computeAutoformat(allNodes, allEdges, nodeIds, options) {
8822
8827
  const col = i % cols;
8823
8828
  const row = Math.floor(i / cols);
8824
8829
  let cx = originX;
8825
- for (let c20 = 0; c20 < col; c20++)
8826
- cx += colWidths[c20] + layout.columnGap;
8830
+ for (let c22 = 0; c22 < col; c22++)
8831
+ cx += colWidths[c22] + layout.columnGap;
8827
8832
  let cy = originY;
8828
8833
  for (let r = 0; r < row; r++) cy += rowHeights[r] + layout.rowGap;
8829
8834
  posMap.set(targets[i].id, { x: cx, y: cy });
8830
8835
  }
8831
8836
  }
8832
8837
  const updates = [];
8833
- for (const [id, pos] of posMap) {
8834
- const node = nodeById.get(id);
8838
+ for (const [id2, pos] of posMap) {
8839
+ const node = nodeById.get(id2);
8835
8840
  if (node) {
8836
8841
  updates.push({
8837
- nodeId: id,
8842
+ nodeId: id2,
8838
8843
  x: pos.x,
8839
8844
  y: pos.y,
8840
8845
  w: node.geometry.w,
@@ -8846,8 +8851,8 @@ function computeAutoformat(allNodes, allEdges, nodeIds, options) {
8846
8851
  if (allShareParent && parentId) {
8847
8852
  let maxX = 0;
8848
8853
  let maxY = 0;
8849
- for (const [id, pos] of posMap) {
8850
- const node = nodeById.get(id);
8854
+ for (const [id2, pos] of posMap) {
8855
+ const node = nodeById.get(id2);
8851
8856
  if (!node) continue;
8852
8857
  maxX = Math.max(maxX, pos.x + node.geometry.w);
8853
8858
  maxY = Math.max(maxY, pos.y + node.geometry.h);
@@ -8870,10 +8875,10 @@ function computeAutoformat(allNodes, allEdges, nodeIds, options) {
8870
8875
  function computeNestedAutoformat(allNodes, allEdges, nodeIds, options = {}) {
8871
8876
  const original = new Map(allNodes.map((n) => [n.id, n]));
8872
8877
  const working = new Map(original);
8873
- const outermostTargetAncestor = (id, ids) => {
8878
+ const outermostTargetAncestor = (id2, ids) => {
8874
8879
  const seen = /* @__PURE__ */ new Set();
8875
8880
  let outermost = null;
8876
- let current = working.get(id)?.groupId;
8881
+ let current = working.get(id2)?.groupId;
8877
8882
  while (current && !seen.has(current)) {
8878
8883
  if (ids.has(current)) outermost = current;
8879
8884
  seen.add(current);
@@ -8891,18 +8896,18 @@ function computeNestedAutoformat(allNodes, allEdges, nodeIds, options = {}) {
8891
8896
  const idSet = new Set(ids);
8892
8897
  const levelIds = [];
8893
8898
  const contentsByGroup = /* @__PURE__ */ new Map();
8894
- for (const id of ids) {
8895
- const ancestor = outermostTargetAncestor(id, idSet);
8899
+ for (const id2 of ids) {
8900
+ const ancestor = outermostTargetAncestor(id2, idSet);
8896
8901
  if (ancestor === null) {
8897
- levelIds.push(id);
8902
+ levelIds.push(id2);
8898
8903
  continue;
8899
8904
  }
8900
8905
  const contents = contentsByGroup.get(ancestor);
8901
- if (contents) contents.push(id);
8902
- else contentsByGroup.set(ancestor, [id]);
8906
+ if (contents) contents.push(id2);
8907
+ else contentsByGroup.set(ancestor, [id2]);
8903
8908
  }
8904
8909
  for (const contents of contentsByGroup.values()) arrange(contents);
8905
- const levelNodes = levelIds.flatMap((id) => working.get(id) ?? []);
8910
+ const levelNodes = levelIds.flatMap((id2) => working.get(id2) ?? []);
8906
8911
  const result = computeAutoformat(
8907
8912
  [...working.values()],
8908
8913
  allEdges,
@@ -8925,16 +8930,16 @@ function computeNestedAutoformat(allNodes, allEdges, nodeIds, options = {}) {
8925
8930
  }
8926
8931
  }
8927
8932
  };
8928
- arrange(nodeIds.filter((id) => working.has(id)));
8933
+ arrange(nodeIds.filter((id2) => working.has(id2)));
8929
8934
  const updates = [];
8930
- for (const [id, node] of working) {
8931
- const before = original.get(id)?.geometry;
8935
+ for (const [id2, node] of working) {
8936
+ const before = original.get(id2)?.geometry;
8932
8937
  const after = node.geometry;
8933
- if (before && (before.x !== after.x || before.y !== after.y || before.w !== after.w || before.h !== after.h || original.get(id)?.groupPadding !== node.groupPadding)) {
8938
+ if (before && (before.x !== after.x || before.y !== after.y || before.w !== after.w || before.h !== after.h || original.get(id2)?.groupPadding !== node.groupPadding)) {
8934
8939
  updates.push({
8935
- nodeId: id,
8940
+ nodeId: id2,
8936
8941
  ...after,
8937
- ...node.groupPadding !== original.get(id)?.groupPadding ? { groupPadding: node.groupPadding } : {}
8942
+ ...node.groupPadding !== original.get(id2)?.groupPadding ? { groupPadding: node.groupPadding } : {}
8938
8943
  });
8939
8944
  }
8940
8945
  }
@@ -8980,17 +8985,17 @@ function findNearestClearPosition(idealX, idealY, blockW, blockH, obstacles, pre
8980
8985
  let bestPos = null;
8981
8986
  let bestMaxDim = Infinity;
8982
8987
  let bestDist = Infinity;
8983
- for (const c20 of candidates) {
8984
- if (!overlapsAny(c20.x, c20.y, blockW, blockH, obstacles)) {
8985
- const totalW = Math.max(allMaxX, c20.x + blockW) - Math.min(allMinX, c20.x);
8986
- const totalH = Math.max(allMaxY, c20.y + blockH) - Math.min(allMinY, c20.y);
8988
+ for (const c22 of candidates) {
8989
+ if (!overlapsAny(c22.x, c22.y, blockW, blockH, obstacles)) {
8990
+ const totalW = Math.max(allMaxX, c22.x + blockW) - Math.min(allMinX, c22.x);
8991
+ const totalH = Math.max(allMaxY, c22.y + blockH) - Math.min(allMinY, c22.y);
8987
8992
  const maxDim = Math.max(totalW, totalH);
8988
- const dist = Math.abs(c20.x - idealX) + Math.abs(c20.y - idealY);
8993
+ const dist = Math.abs(c22.x - idealX) + Math.abs(c22.y - idealY);
8989
8994
  const better = prefer === "proximity" ? dist < bestDist || dist === bestDist && maxDim < bestMaxDim : maxDim < bestMaxDim || maxDim === bestMaxDim && dist < bestDist;
8990
8995
  if (better) {
8991
8996
  bestMaxDim = maxDim;
8992
8997
  bestDist = dist;
8993
- bestPos = c20;
8998
+ bestPos = c22;
8994
8999
  }
8995
9000
  }
8996
9001
  }
@@ -9135,8 +9140,8 @@ function placementAnchorIds(allNodes, targetIds, allEdges, formattedHeight) {
9135
9140
  allNodes.filter((n) => !targetIds.has(n.id) && !n.groupId).map((n) => n.id)
9136
9141
  );
9137
9142
  const nodeById = new Map(allNodes.map((n) => [n.id, n]));
9138
- function resolveTopLevelNodeId(id) {
9139
- let resolvedId = id;
9143
+ function resolveTopLevelNodeId(id2) {
9144
+ let resolvedId = id2;
9140
9145
  const seen = /* @__PURE__ */ new Set();
9141
9146
  while (!seen.has(resolvedId)) {
9142
9147
  seen.add(resolvedId);
@@ -9162,8 +9167,8 @@ function placementAnchorIds(allNodes, targetIds, allEdges, formattedHeight) {
9162
9167
  const anchors = incomingSourceIds.size > 0 ? incomingSourceIds : outgoingTargetIds;
9163
9168
  let minY = Infinity;
9164
9169
  let maxY = -Infinity;
9165
- for (const id of anchors) {
9166
- const { y, h } = nodeById.get(id).geometry;
9170
+ for (const id2 of anchors) {
9171
+ const { y, h } = nodeById.get(id2).geometry;
9167
9172
  minY = Math.min(minY, y);
9168
9173
  maxY = Math.max(maxY, y + h);
9169
9174
  }
@@ -9396,8 +9401,8 @@ function moveBatchIntoArea(positions, area, obstacles, wiredToCanvas, horizontal
9396
9401
  const dx = spot.x - minX;
9397
9402
  const dy = spot.y - minY;
9398
9403
  return Object.fromEntries(
9399
- Object.entries(positions).map(([id, p]) => [
9400
- id,
9404
+ Object.entries(positions).map(([id2, p]) => [
9405
+ id2,
9401
9406
  { ...p, x: p.x + dx, y: p.y + dy }
9402
9407
  ])
9403
9408
  );
@@ -9477,7 +9482,7 @@ function findClearSpotInArea(size, ideal, area, obstacles, horizontalBounds) {
9477
9482
  const crowded = (x, y) => nearby.some(
9478
9483
  (o) => x < o.x + o.w + COL_GAP2 && x + size.w > o.x - COL_GAP2 && y < o.y + o.h + ROW_GAP2 && y + size.h > o.y - ROW_GAP2
9479
9484
  );
9480
- const clear = nearestFirst.find((c20) => !crowded(c20.x, c20.y));
9485
+ const clear = nearestFirst.find((c22) => !crowded(c22.x, c22.y));
9481
9486
  return clear ? { x: clear.x, y: clear.y } : null;
9482
9487
  }
9483
9488
 
@@ -9507,7 +9512,7 @@ function planLayout(content, planned, edges, anchorNodeIds, options) {
9507
9512
  }
9508
9513
  let startX = 0;
9509
9514
  let startY = 0;
9510
- const anchorNodes = anchorNodeIds && anchorNodeIds.length > 0 ? anchorNodeIds.map((id) => nodeById.get(id)).filter((n) => n !== void 0) : null;
9515
+ const anchorNodes = anchorNodeIds && anchorNodeIds.length > 0 ? anchorNodeIds.map((id2) => nodeById.get(id2)).filter((n) => n !== void 0) : null;
9511
9516
  if (anchorNodes && anchorNodes.length > 0) {
9512
9517
  let sumX = 0;
9513
9518
  let sumY = 0;
@@ -9708,13 +9713,13 @@ function planAutoformatRequest(nodes, edges, request, savedLayout) {
9708
9713
  order = autoformatReadingOrder(children);
9709
9714
  } else {
9710
9715
  const ids = [...new Set(request.nodeIds)];
9711
- const missing = ids.filter((id) => !nodeById.has(id));
9716
+ const missing = ids.filter((id2) => !nodeById.has(id2));
9712
9717
  if (missing.length > 0) {
9713
9718
  throw new AutoformatRequestError(
9714
9719
  `Unknown node ids: ${missing.join(", ")}. Read the canvas for current ids`
9715
9720
  );
9716
9721
  }
9717
- const parents = new Set(ids.map((id) => nodeById.get(id).groupId));
9722
+ const parents = new Set(ids.map((id2) => nodeById.get(id2).groupId));
9718
9723
  if (parents.size > 1) {
9719
9724
  throw new AutoformatRequestError(
9720
9725
  "nodeIds must share the same parent: all top-level, or all inside the same group. To arrange a group's contents, pass groupId"
@@ -9723,8 +9728,8 @@ function planAutoformatRequest(nodes, edges, request, savedLayout) {
9723
9728
  levelIds = ids;
9724
9729
  order = ids;
9725
9730
  }
9726
- for (const id of levelIds) {
9727
- let parentId = nodeById.get(id)?.groupId;
9731
+ for (const id2 of levelIds) {
9732
+ let parentId = nodeById.get(id2)?.groupId;
9728
9733
  const seen = /* @__PURE__ */ new Set();
9729
9734
  while (parentId && !seen.has(parentId)) {
9730
9735
  seen.add(parentId);
@@ -9738,7 +9743,7 @@ function planAutoformatRequest(nodes, edges, request, savedLayout) {
9738
9743
  }
9739
9744
  }
9740
9745
  const groupsArranged = new Set(
9741
- levelIds.filter((id) => nodeById.get(id)?.nodeType === "group")
9746
+ levelIds.filter((id2) => nodeById.get(id2)?.nodeType === "group")
9742
9747
  );
9743
9748
  const contents = request.arrangeGroupContents === true ? descendantsOf(nodes, groupsArranged) : [];
9744
9749
  const layout = resolveAutoformatLayoutSettings(request.layout, savedLayout);
@@ -10054,7 +10059,11 @@ var FileCardSchema = external_exports.object({
10054
10059
  // Node/version to toggle when favoriting this asset from a Files surface.
10055
10060
  favoriteNodeId: external_exports.string().uuid().nullable().optional(),
10056
10061
  favoriteVersionId: external_exports.string().uuid().nullable().optional(),
10057
- favoritedByUserId: external_exports.string().uuid().nullable().optional()
10062
+ favoritedByUserId: external_exports.string().uuid().nullable().optional(),
10063
+ /** The Cast take whose clip this file is, which the viewer may open, so
10064
+ * the Assets page can open it in Cast. Null for anything else. Optional so
10065
+ * a client released ahead of the server keeps validating. */
10066
+ castGenerationId: external_exports.string().uuid().nullable().optional()
10058
10067
  });
10059
10068
  var FileGenerationSchema = external_exports.object({
10060
10069
  prompt: external_exports.string().nullable(),
@@ -10199,7 +10208,7 @@ var ListFilesQuerySchema = external_exports.object({
10199
10208
  // this GET has no array-query support; absent means no tag filter. Each id
10200
10209
  // is validated as a uuid after splitting.
10201
10210
  tagIds: external_exports.string().optional().transform(
10202
- (value) => value ? value.split(",").map((id) => id.trim()).filter(Boolean) : void 0
10211
+ (value) => value ? value.split(",").map((id2) => id2.trim()).filter(Boolean) : void 0
10203
10212
  ).pipe(external_exports.array(external_exports.string().uuid()).optional()),
10204
10213
  // The "Hidden" view: lists files hidden from Files (across all folders)
10205
10214
  // instead of the normal visible listing. Coerced from the query string so
@@ -11048,10 +11057,10 @@ var RegenerateImageAngleBodySchema = external_exports.object({
11048
11057
  ...imageAngleFields,
11049
11058
  resolution: ImageAngleResolutionSchema.default("1K"),
11050
11059
  count: ImageAngleCountSchema.default(1)
11051
- }).strict().transform(({ resolution, count, ...angle }) => ({
11060
+ }).strict().transform(({ resolution, count: count2, ...angle }) => ({
11052
11061
  ...canonicalImageAngle(angle),
11053
11062
  resolution,
11054
- count
11063
+ count: count2
11055
11064
  }));
11056
11065
  var CreateImageAngleBodySchema = external_exports.object({
11057
11066
  sourceNodeId: external_exports.string().uuid(),
@@ -11246,6 +11255,8 @@ var ModelConfigSchema = external_exports.object({
11246
11255
  StoredImageAngleSchema
11247
11256
  ).optional().catch(void 0),
11248
11257
  videoEditMode: external_exports.literal("replacement").optional(),
11258
+ /** How a lone input video is used; absent means edit. */
11259
+ videoUse: external_exports.enum(VIDEO_USES).optional().catch(void 0),
11249
11260
  model: external_exports.string(),
11250
11261
  variant: external_exports.string(),
11251
11262
  tier: external_exports.string().nullable().optional(),
@@ -11300,6 +11311,8 @@ var ModelConfigSchema = external_exports.object({
11300
11311
  });
11301
11312
  var ModelConfigInputSchema = external_exports.object({
11302
11313
  videoEditMode: external_exports.literal("replacement").optional(),
11314
+ /** How a lone input video is used; absent means edit. */
11315
+ videoUse: external_exports.enum(VIDEO_USES).optional(),
11303
11316
  model: external_exports.string(),
11304
11317
  variant: external_exports.string().refine(isValidGenerationMode, "Invalid generation mode"),
11305
11318
  tier: external_exports.string().nullable().optional(),
@@ -11475,7 +11488,7 @@ var PrepareCanvasPasteBodySchema = external_exports.object({
11475
11488
  })
11476
11489
  ).max(200).refine(
11477
11490
  (entries) => entries.reduce(
11478
- (count, entry) => count + entry.urls.length,
11491
+ (count2, entry) => count2 + entry.urls.length,
11479
11492
  0
11480
11493
  ) <= 200,
11481
11494
  "Copy at most 200 layer images at a time"
@@ -11663,6 +11676,12 @@ var NodeVersionResponseSchema = external_exports.object({
11663
11676
  */
11664
11677
  producedBy: VersionProducedBySchema.nullable().optional(),
11665
11678
  layerCount: external_exports.number().int().nonnegative(),
11679
+ /**
11680
+ * A Motion Node version whose run stored an artifact. The artifact is the
11681
+ * version's output before any render lands, and after a render fails.
11682
+ * Optional for older servers and saved snapshots.
11683
+ */
11684
+ hasMotionArtifact: external_exports.boolean().optional(),
11666
11685
  errorMessage: external_exports.string().nullable(),
11667
11686
  errorSeverity: ErrorSeveritySchema.nullable(),
11668
11687
  errorRetryable: external_exports.boolean().nullable().optional(),
@@ -11955,6 +11974,58 @@ var CanvasPreviewImageWidthSchema = external_exports.union([
11955
11974
  ]);
11956
11975
  var MAX_HIGH_RESOLUTION_URL_VERSION_IDS = 100;
11957
11976
 
11977
+ // ../api-contract/src/canvas/schema/run-webhook.ts
11978
+ var RegisterRunWebhookBodySchema = external_exports.object({
11979
+ url: external_exports.string().url().max(2048).refine((value) => {
11980
+ let url;
11981
+ try {
11982
+ url = new URL(value);
11983
+ } catch {
11984
+ return false;
11985
+ }
11986
+ return url.protocol === "https:" && !url.username && !url.password && !url.hash;
11987
+ }, "Use an HTTPS URL without credentials or a fragment"),
11988
+ signingSecret: external_exports.string().min(32).max(256)
11989
+ });
11990
+ var RunWebhookResponseSchema = external_exports.object({
11991
+ id: external_exports.string(),
11992
+ status: external_exports.enum(["pending", "delivered", "failed"])
11993
+ });
11994
+ var webhookEventEnvelope = external_exports.object({
11995
+ id: external_exports.string(),
11996
+ sequence: external_exports.number().int().positive(),
11997
+ createdAt: external_exports.string().datetime()
11998
+ });
11999
+ var RunWebhookEventSchema = webhookEventEnvelope.extend({
12000
+ type: external_exports.literal("run.status_changed"),
12001
+ data: external_exports.object({
12002
+ nodeRunId: external_exports.string().uuid(),
12003
+ teamId: external_exports.string().uuid(),
12004
+ nodeId: external_exports.string().uuid(),
12005
+ nodeVersionId: external_exports.string().uuid().nullable(),
12006
+ status: external_exports.enum(["finished", "failed", "cancelled"])
12007
+ })
12008
+ });
12009
+ var SettledVideoWebhookStatusSchema = external_exports.enum(["ready", "failed"]);
12010
+ var videoWebhookData = external_exports.object({
12011
+ generationId: external_exports.string().uuid(),
12012
+ teamId: external_exports.string().uuid(),
12013
+ status: SettledVideoWebhookStatusSchema
12014
+ });
12015
+ var CastVideoWebhookEventSchema = webhookEventEnvelope.extend({
12016
+ type: external_exports.literal("cast_video.status_changed"),
12017
+ data: videoWebhookData
12018
+ });
12019
+ var DittoWebhookEventSchema = webhookEventEnvelope.extend({
12020
+ type: external_exports.literal("ditto.status_changed"),
12021
+ data: videoWebhookData
12022
+ });
12023
+ var GenerationWebhookEventSchema = external_exports.discriminatedUnion("type", [
12024
+ RunWebhookEventSchema,
12025
+ CastVideoWebhookEventSchema,
12026
+ DittoWebhookEventSchema
12027
+ ]);
12028
+
11958
12029
  // ../api-contract/src/free-generation/schema.ts
11959
12030
  var GRANTABLE_FREE_GENERATION_ACTION_KINDS = [
11960
12031
  "cast_video",
@@ -12089,10 +12160,6 @@ var NodeRunQuoteOptionSchema = external_exports.object({
12089
12160
  resolution: OutputResolutionSchema.optional(),
12090
12161
  duration: external_exports.number().positive().optional()
12091
12162
  });
12092
- var QuoteNodeRunBodySchema = external_exports.object({
12093
- canvasId: external_exports.string().uuid(),
12094
- options: external_exports.array(NodeRunQuoteOptionSchema).min(1).max(4)
12095
- });
12096
12163
  var QuoteNodeRunResponseSchema = external_exports.object({
12097
12164
  quotes: external_exports.array(
12098
12165
  NodeRunQuoteOptionSchema.extend({
@@ -12106,8 +12173,29 @@ var QuoteNodeRunResponseSchema = external_exports.object({
12106
12173
  })
12107
12174
  )
12108
12175
  });
12176
+ var MediaUrlSchema = external_exports.string().url().refine(
12177
+ (value) => ["http:", "https:"].includes(new URL(value).protocol),
12178
+ "Use an HTTP or HTTPS media URL"
12179
+ );
12180
+ var NodeRunMediaUrlsSchema = external_exports.object({
12181
+ imageUrls: external_exports.array(MediaUrlSchema).max(MAX_INPUT_IMAGES).optional(),
12182
+ endImageUrls: external_exports.array(MediaUrlSchema).max(1).optional(),
12183
+ referenceImageUrls: external_exports.array(MediaUrlSchema).max(MAX_INPUT_IMAGES).optional(),
12184
+ videoUrls: external_exports.array(MediaUrlSchema).max(MAX_INPUT_VIDEOS).optional(),
12185
+ audioUrls: external_exports.array(MediaUrlSchema).max(MAX_INPUT_AUDIOS).optional()
12186
+ }).strict();
12187
+ var QuoteNodeRunBodySchema = external_exports.object({
12188
+ canvasId: external_exports.string().uuid(),
12189
+ options: external_exports.array(NodeRunQuoteOptionSchema).min(1).max(4),
12190
+ mediaUrls: NodeRunMediaUrlsSchema.optional()
12191
+ });
12109
12192
  var RunNodeBodySchema = external_exports.object({
12193
+ webhook: RegisterRunWebhookBodySchema.optional(),
12194
+ /** Run-scoped media with explicit roles, fetched and checked before billing. Use instead of media edges or legacy imageUrls. */
12195
+ mediaUrls: NodeRunMediaUrlsSchema.optional(),
12110
12196
  canvasId: external_exports.string().uuid().optional(),
12197
+ /** Refuse unsupported output settings, inputs and clip trims instead of adjusting them. */
12198
+ strictSettings: external_exports.boolean().optional(),
12111
12199
  postProcess: NodeRunPostProcessSchema.optional(),
12112
12200
  /** Product surface this run originated on. Defaults to `canvas` server-side. */
12113
12201
  origin: RunOriginSchema.optional(),
@@ -12159,6 +12247,8 @@ var RunNodeBodySchema = external_exports.object({
12159
12247
  backgroundColor: RgbColorSchema.optional(),
12160
12248
  /** Explicit image URLs to include as inputs (merged with edge-resolved images). */
12161
12249
  imageUrls: external_exports.array(external_exports.string().url()).max(MAX_INPUT_IMAGES).optional(),
12250
+ /** Video end frame; requires a start image and an empty end-frame canvas input. */
12251
+ endImageUrls: external_exports.array(external_exports.string().url()).max(1).optional(),
12162
12252
  /**
12163
12253
  * Provider-agnostic voice selection for audio TTS, validated against the
12164
12254
  * resolved variant's voice capability. Mode-specific validation lives in
@@ -12289,6 +12379,28 @@ var REMOVE_BACKGROUND_NODE_TOOL_NAME = "remove-background";
12289
12379
  var BACKGROUND_REMOVAL_MODELS = ["pixelcut"];
12290
12380
  var DEFAULT_BACKGROUND_REMOVAL_MODEL = "pixelcut";
12291
12381
  var TOPAZ_UPSCALE_NODE_TOOL_NAME = "topaz-upscale";
12382
+ var ENHANCOR_SKIN_MODEL_VERSIONS = [
12383
+ "enhancorv4",
12384
+ "enhancorv4_base"
12385
+ ];
12386
+ var ENHANCOR_SKIN_STRENGTHS = [
12387
+ "subtle",
12388
+ "realistic",
12389
+ "pimple",
12390
+ "freckle"
12391
+ ];
12392
+ var ENHANCOR_FRECKLE_INTENSITIES = [50, 100];
12393
+ var EnhancorSkinToolConfigSchema = external_exports.object({
12394
+ model_version: external_exports.enum(ENHANCOR_SKIN_MODEL_VERSIONS).default("enhancorv4"),
12395
+ enhancement_strength: external_exports.enum(ENHANCOR_SKIN_STRENGTHS).default("realistic"),
12396
+ freckle_intensity: external_exports.union([
12397
+ external_exports.literal(ENHANCOR_FRECKLE_INTENSITIES[0]),
12398
+ external_exports.literal(ENHANCOR_FRECKLE_INTENSITIES[1])
12399
+ ]).default(50),
12400
+ fast_mode: external_exports.boolean().default(false),
12401
+ fix_lighting_mode: external_exports.boolean().default(false)
12402
+ });
12403
+ var DEFAULT_ENHANCOR_SKIN_TOOL_CONFIG = EnhancorSkinToolConfigSchema.parse({});
12292
12404
  var EDIT_REGIONS_MAX_REGIONS = 10;
12293
12405
  var EDIT_REGIONS_MAX_NOTE_LENGTH = 800;
12294
12406
  var EDIT_REGIONS_QUALITIES = ["low", "medium", "high"];
@@ -12567,7 +12679,7 @@ var BulkNodeRunQuerySchema = external_exports.object({
12567
12679
  */
12568
12680
  nodeIds: external_exports.union([
12569
12681
  external_exports.string().transform(
12570
- (value) => value.split(",").filter((id) => id.length > 0)
12682
+ (value) => value.split(",").filter((id2) => id2.length > 0)
12571
12683
  ),
12572
12684
  external_exports.array(external_exports.string())
12573
12685
  ]).pipe(external_exports.array(external_exports.string().uuid()).min(1).max(5e3)).optional()
@@ -12615,6 +12727,8 @@ var BulkNodeRunStartResponseSchema = BulkNodeRunResponseSchema.extend({
12615
12727
 
12616
12728
  // ../api-contract/src/canvas/schema/direct-mutation.ts
12617
12729
  var CreateDirectNodeBodyObjectSchema = external_exports.object({
12730
+ /** Refuse unsupported output settings instead of normalizing them. */
12731
+ strictSettings: external_exports.boolean().optional(),
12618
12732
  id: external_exports.string().uuid(),
12619
12733
  nodeType: NodeTypeSchema,
12620
12734
  geometry: GeometrySchema,
@@ -13177,8 +13291,88 @@ var CanvasPaginationErrorSchema = external_exports.object({
13177
13291
  code: external_exports.literal("INVALID_CURSOR")
13178
13292
  });
13179
13293
 
13294
+ // ../api-contract/src/cast/scenes.ts
13295
+ var CAST_SCENE_TIMES = ["present", "flashback", "later"];
13296
+ var CastSceneTimeSchema = external_exports.enum(CAST_SCENE_TIMES);
13297
+ var MAX_CAST_SCENE_PLACE_LENGTH = 500;
13298
+ var MAX_CAST_SCENE_LOOK_LENGTH = 500;
13299
+ var MAX_CAST_SCENE_TIME_LABEL_LENGTH = 80;
13300
+ var MAX_CAST_SCENE_LOOKS = 8;
13301
+ var CastSceneLookSchema = external_exports.object({
13302
+ /** The avatar entry id (`config.avatars[].id`), as a section's `speakerId`. */
13303
+ avatarId: external_exports.string().min(1).max(200),
13304
+ lookId: external_exports.string().uuid().optional(),
13305
+ look: external_exports.string().trim().min(1).max(MAX_CAST_SCENE_LOOK_LENGTH).optional()
13306
+ }).refine((entry) => !(entry.lookId && entry.look), {
13307
+ message: "Name a look by lookId or describe it in look, not both"
13308
+ });
13309
+ var CastSceneHeadingSchema = external_exports.object({
13310
+ /** A place the series keeps. */
13311
+ placeId: external_exports.string().uuid().optional(),
13312
+ /** A place described in words, when the series keeps none for it. */
13313
+ place: external_exports.string().trim().min(1).max(MAX_CAST_SCENE_PLACE_LENGTH).optional(),
13314
+ /** Absent is the present. */
13315
+ time: CastSceneTimeSchema.optional(),
13316
+ /** How far from the present, in the member's words: "10 years earlier". */
13317
+ timeLabel: external_exports.string().trim().min(1).max(MAX_CAST_SCENE_TIME_LABEL_LENGTH).optional(),
13318
+ /** Each person's look from this scene on; a person left out keeps theirs. */
13319
+ looks: external_exports.array(CastSceneLookSchema).max(MAX_CAST_SCENE_LOOKS).optional()
13320
+ }).refine((heading) => !(heading.placeId && heading.place), {
13321
+ message: "Name a place by placeId or describe it in place, not both"
13322
+ });
13323
+ var CastLookChangesSchema = external_exports.array(CastSceneLookSchema).min(1).max(MAX_CAST_SCENE_LOOKS);
13324
+ var CastWrittenSceneLookSchema = external_exports.object({
13325
+ speaker: external_exports.string().trim().min(1).max(200),
13326
+ /** A look the series keeps, where the writer named one of its looks. */
13327
+ lookId: external_exports.string().uuid().optional(),
13328
+ /** The look's name, kept or new. */
13329
+ look: external_exports.string().trim().min(1).max(MAX_CAST_SCENE_LOOK_LENGTH).optional(),
13330
+ /** A new look's description: what changes from the character sheet. */
13331
+ lookDescription: external_exports.string().trim().min(1).max(MAX_CAST_SCENE_LOOK_LENGTH).optional()
13332
+ });
13333
+ var CastWrittenSceneHeadingSchema = external_exports.object({
13334
+ /** A place the series keeps, where the writer named one of its places. */
13335
+ placeId: external_exports.string().uuid().optional(),
13336
+ /** The place's name, kept or new. */
13337
+ place: external_exports.string().trim().min(1).max(MAX_CAST_SCENE_PLACE_LENGTH).optional(),
13338
+ /** A new place's description, for drawing its picture. */
13339
+ placeDescription: external_exports.string().trim().min(1).max(MAX_CAST_SCENE_PLACE_LENGTH).optional(),
13340
+ time: CastSceneTimeSchema.optional(),
13341
+ timeLabel: external_exports.string().trim().min(1).max(MAX_CAST_SCENE_TIME_LABEL_LENGTH).optional(),
13342
+ looks: external_exports.array(CastWrittenSceneLookSchema).max(MAX_CAST_SCENE_LOOKS).optional()
13343
+ });
13344
+ var CastWrittenLookChangesSchema = external_exports.array(CastWrittenSceneLookSchema).min(1).max(MAX_CAST_SCENE_LOOKS);
13345
+ var MAX_CAST_SCENE_READ_TEXT_LENGTH = 4e3;
13346
+ var MAX_CAST_SCENE_READ_SECTIONS = 300;
13347
+ var CastSceneReadSectionSchema = external_exports.object({
13348
+ text: external_exports.string().max(MAX_CAST_SCENE_READ_TEXT_LENGTH),
13349
+ action: external_exports.string().max(MAX_CAST_SCENE_READ_TEXT_LENGTH).optional(),
13350
+ scene: external_exports.string().max(MAX_CAST_SCENE_READ_TEXT_LENGTH).optional(),
13351
+ /** Who says it, by a `cast` name. */
13352
+ speaker: external_exports.string().trim().min(1).max(200).optional()
13353
+ });
13354
+ var ReadCastSeriesScenesBodySchema = external_exports.object({
13355
+ sections: external_exports.array(CastSceneReadSectionSchema).min(1).max(MAX_CAST_SCENE_READ_SECTIONS),
13356
+ cast: external_exports.array(
13357
+ external_exports.object({
13358
+ name: external_exports.string().trim().min(1).max(200),
13359
+ customAvatarId: external_exports.string().uuid().optional(),
13360
+ presetAvatarId: external_exports.string().uuid().optional(),
13361
+ elementId: external_exports.string().uuid().optional()
13362
+ })
13363
+ ).min(1).max(MAX_CAST_SCENE_LOOKS)
13364
+ });
13365
+ var ReadCastSeriesScenesResponseSchema = external_exports.object({
13366
+ sections: external_exports.array(
13367
+ external_exports.object({
13368
+ heading: CastWrittenSceneHeadingSchema.optional(),
13369
+ lookChanges: CastWrittenLookChangesSchema.optional()
13370
+ })
13371
+ )
13372
+ });
13373
+
13180
13374
  // ../api-contract/src/cast/creation.ts
13181
- var CastVideoEngineSchema = external_exports.enum(["seedance"]);
13375
+ var CastVideoEngineSchema = external_exports.enum(["seedance", "seedance-fast"]);
13182
13376
  var CastVideoStyleIdSchema = external_exports.enum([
13183
13377
  "auto",
13184
13378
  "self-filmed",
@@ -13216,7 +13410,8 @@ var CastVideoStyleIdSchema = external_exports.enum([
13216
13410
  "product-stop-motion",
13217
13411
  "asmr",
13218
13412
  "claymation",
13219
- "animated-2d"
13413
+ "animated-2d",
13414
+ "open-world-game"
13220
13415
  ]);
13221
13416
  var CAST_VIDEO_STYLE_IDS = CastVideoStyleIdSchema.options;
13222
13417
  var CAST_MICRODRAMA_STYLE_IDS = [
@@ -13235,8 +13430,8 @@ var CAST_MICRODRAMA_STYLE_IDS = [
13235
13430
  "drama-2d"
13236
13431
  ];
13237
13432
  var CastMicrodramaStyleIdSchema = external_exports.enum(CAST_MICRODRAMA_STYLE_IDS);
13238
- function isCastMicrodramaStyle(id) {
13239
- return CAST_MICRODRAMA_STYLE_IDS.some((style) => style === id);
13433
+ function isCastMicrodramaStyle(id2) {
13434
+ return CAST_MICRODRAMA_STYLE_IDS.some((style) => style === id2);
13240
13435
  }
13241
13436
  var CastVideoStyleSchema = external_exports.object({
13242
13437
  id: CastVideoStyleIdSchema,
@@ -13260,6 +13455,9 @@ var CastCreationSettingsSchema = external_exports.object({
13260
13455
  aesthetic: CastAestheticSchema.optional().describe(
13261
13456
  "How self-filmed the video looks, on Auto, Self-filmed and Comment reply; other styles ignore it. Polished: a steady phone in soft, even light, focus holding. Natural: a propped phone with small camera flaws. Raw: the phone held in the hand, with shake, late autofocus and an uneven zoom. Set it only when the member asks for a polished, raw, handheld or shaky look; omitted means Natural."
13262
13457
  ),
13458
+ brandKit: external_exports.union([external_exports.literal("none"), external_exports.string().uuid()]).optional().describe(
13459
+ "The brand kit added visuals wear. Omitted is Auto: the team's kit the script names, else its default kit. none: graphics follow the script, with no brand colors, fonts or logo. A kit id picks that kit, which must be one of the team's kits in use. Visuals Off ignores it."
13460
+ ),
13263
13461
  visualsBrief: external_exports.string().trim().min(1).max(1e3).optional().describe(
13264
13462
  "The member's direction for every added visual, in their words: look, colors, type, motion, mood and how many. Never filmed; it asks for added visuals, so Visuals must not be Off."
13265
13463
  ),
@@ -13321,7 +13519,14 @@ var CastAuthoredSectionSchema = external_exports.object({
13321
13519
  * their words ("STOP slams in word by word"). Never filmed: the visuals
13322
13520
  * pass answers it over the finished clip.
13323
13521
  */
13324
- onScreen: external_exports.string().optional()
13522
+ onScreen: external_exports.string().optional(),
13523
+ /**
13524
+ * A Microdrama scene begins here (`places-and-looks-microdramas`): where it
13525
+ * happens, when, and how each person looks. It runs to the next heading.
13526
+ */
13527
+ sceneHeading: CastSceneHeadingSchema.optional(),
13528
+ /** Looks that change after this section, inside its scene. */
13529
+ lookChanges: CastLookChangesSchema.optional()
13325
13530
  });
13326
13531
  function dropShotFieldsFromSpokenSections(sections) {
13327
13532
  return sections.map((section) => {
@@ -13341,11 +13546,6 @@ function refuseShotFieldsOffShots(section, context2) {
13341
13546
  code: external_exports.ZodIssueCode.custom,
13342
13547
  message: 'cutaway and seconds belong to a silent action section (kind: "action")'
13343
13548
  });
13344
- else if (section.seconds !== void 0 && section.cutaway !== true)
13345
- context2.addIssue({
13346
- code: external_exports.ZodIssueCode.custom,
13347
- message: "seconds is how long a Shot holds: set it only with cutaway: true"
13348
- });
13349
13549
  }
13350
13550
  function refuseShotFieldsOffShotsInSections(sections, context2) {
13351
13551
  for (const section of sections) refuseShotFieldsOffShots(section, context2);
@@ -13590,6 +13790,10 @@ var UpdateCustomAvatarBodySchema = external_exports.object({
13590
13790
  var DeleteCustomAvatarResponseSchema = external_exports.object({
13591
13791
  id: external_exports.string().uuid()
13592
13792
  });
13793
+ var BadRequestSchema = MessageResponseSchema;
13794
+ var ForbiddenSchema = MessageResponseSchema;
13795
+ var NotFoundSchema = MessageResponseSchema;
13796
+ var ConflictSchema = MessageResponseSchema;
13593
13797
  var AvatarBackgroundSchema = CastBackgroundSchema;
13594
13798
  var CustomAvatarBackgroundSchema = AvatarBackgroundSchema.extend({
13595
13799
  customAvatarId: external_exports.string().uuid()
@@ -13597,6 +13801,9 @@ var CustomAvatarBackgroundSchema = AvatarBackgroundSchema.extend({
13597
13801
  var ListCustomAvatarBackgroundsResponseSchema = external_exports.object({
13598
13802
  backgrounds: external_exports.array(CustomAvatarBackgroundSchema)
13599
13803
  });
13804
+ var CreateCustomAvatarBackgroundBodySchema = CreateCastBackgroundBodySchema;
13805
+ var UpdateCustomAvatarBackgroundBodySchema = UpdateCastBackgroundBodySchema;
13806
+ var DeleteCustomAvatarBackgroundResponseSchema = DeleteCastBackgroundResponseSchema;
13600
13807
  var CustomAvatarRenderLayoutSchema = external_exports.enum(["sheet", "portrait"]);
13601
13808
  var CustomAvatarRenderInputSchema = external_exports.object({
13602
13809
  /** Main photo first. Empty only for a portrait made from a description. */
@@ -13695,6 +13902,40 @@ var CastScriptReferencesSchema = external_exports.array(
13695
13902
  name: external_exports.string().trim().min(1).max(MAX_CAST_SCRIPT_REFERENCE_NAME_LENGTH)
13696
13903
  })
13697
13904
  ).max(MAX_CAST_SCRIPT_REFERENCES).optional();
13905
+ var CastScriptSectionSchema = external_exports.object({
13906
+ title: external_exports.string().trim().min(1).max(MAX_CAST_SECTION_TITLE_LENGTH),
13907
+ /** The words said across the beat — empty only on an action beat. */
13908
+ text: external_exports.string().trim(),
13909
+ /**
13910
+ * What the presenter does while the beat is spoken, when the words
13911
+ * imply it. Direction for the picture, never part of the read.
13912
+ */
13913
+ action: external_exports.string().trim().min(1).max(MAX_CAST_SECTION_ACTION_LENGTH).optional(),
13914
+ /** The setting and visual direction for this beat, separate from speech. */
13915
+ scene: external_exports.string().max(4e3).optional(),
13916
+ /**
13917
+ * `action`: a beat with nothing said across it — a production script's
13918
+ * visual-only beat. Absent means a spoken beat.
13919
+ */
13920
+ kind: external_exports.enum(["action"]).optional(),
13921
+ /** On an action beat, a Shot: nobody from the cast is its subject. */
13922
+ cutaway: external_exports.literal(true).optional(),
13923
+ /** On an action beat, how long it holds in whole seconds. */
13924
+ seconds: external_exports.number().int().min(1).max(CAST_MAX_ACTION_BEAT_SECONDS).optional(),
13925
+ /**
13926
+ * Who says it, as the request's `speakers` spell the name. Only on a
13927
+ * split or a draft asked with a cast.
13928
+ */
13929
+ speaker: external_exports.string().optional(),
13930
+ /** A Microdrama episode's scene begins here; only the episode writer writes one. */
13931
+ heading: CastWrittenSceneHeadingSchema.optional(),
13932
+ /** Looks that change after this beat, inside its scene. */
13933
+ lookChanges: CastWrittenLookChangesSchema.optional()
13934
+ }).refine((section) => section.kind === "action" || section.text.length > 0, {
13935
+ message: "A spoken beat needs words",
13936
+ path: ["text"]
13937
+ });
13938
+ var MAX_PREPARED_CAST_SCRIPT_SECTIONS = 100;
13698
13939
  var CastScriptTreatmentSchema = external_exports.discriminatedUnion("operation", [
13699
13940
  /** Same words, better writing: no delivery tags, no restructure into beats. */
13700
13941
  external_exports.object({ operation: external_exports.literal("rewrite") }),
@@ -13793,6 +14034,26 @@ var CastScriptTreatmentSchema = external_exports.discriminatedUnion("operation",
13793
14034
  * read to the camera. Absent writes a read to the camera.
13794
14035
  */
13795
14036
  videoStyle: CastVideoStyleSchema.optional()
14037
+ }),
14038
+ /**
14039
+ * The member's script, cut to fit a length the team's credits cover: the
14040
+ * same speakers and claims in fewer words. `prompt` carries the spoken
14041
+ * script; the beats carry who says what and what they do.
14042
+ */
14043
+ external_exports.object({
14044
+ operation: external_exports.literal("shorten"),
14045
+ seconds: CastDraftSecondsSchema,
14046
+ sections: external_exports.array(
14047
+ // An action beat's own seconds count toward the slot.
14048
+ CastScriptSectionSchema.and(
14049
+ external_exports.object({
14050
+ seconds: CastAuthoredSectionSchema.shape.seconds
14051
+ })
14052
+ )
14053
+ ).min(1).max(MAX_PREPARED_CAST_SCRIPT_SECTIONS),
14054
+ speakers: CastScriptSpeakersSchema,
14055
+ /** A style whose people talk to each other (Microdrama) is cut as a scene. */
14056
+ videoStyle: CastVideoStyleSchema.optional()
13796
14057
  })
13797
14058
  ]);
13798
14059
  var EnhancePromptBodySchema = external_exports.object({
@@ -13816,33 +14077,6 @@ var EnhanceScriptBodySchema = external_exports.object({
13816
14077
  */
13817
14078
  castTreatment: CastScriptTreatmentSchema.optional()
13818
14079
  });
13819
- var CastScriptSectionSchema = external_exports.object({
13820
- title: external_exports.string().trim().min(1).max(MAX_CAST_SECTION_TITLE_LENGTH),
13821
- /** The words said across the beat — empty only on an action beat. */
13822
- text: external_exports.string().trim(),
13823
- /**
13824
- * What the presenter does while the beat is spoken, when the words
13825
- * imply it. Direction for the picture, never part of the read.
13826
- */
13827
- action: external_exports.string().trim().min(1).max(MAX_CAST_SECTION_ACTION_LENGTH).optional(),
13828
- /** The setting and visual direction for this beat, separate from speech. */
13829
- scene: external_exports.string().max(4e3).optional(),
13830
- /**
13831
- * `action`: a beat with nothing said across it — a production script's
13832
- * visual-only beat. Absent means a spoken beat.
13833
- */
13834
- kind: external_exports.enum(["action"]).optional(),
13835
- /** On an action beat, a Shot: nobody from the cast is its subject. */
13836
- cutaway: external_exports.literal(true).optional(),
13837
- /**
13838
- * Who says it, as the request's `speakers` spell the name. Only on a
13839
- * split or a draft asked with a cast.
13840
- */
13841
- speaker: external_exports.string().optional()
13842
- }).refine((section) => section.kind === "action" || section.text.length > 0, {
13843
- message: "A spoken beat needs words",
13844
- path: ["text"]
13845
- });
13846
14080
  var PrepareCastScriptBodySchema = external_exports.object({
13847
14081
  prompt: external_exports.string().trim().min(1).max(MAX_PROMPT_ENHANCE_INPUT_LENGTH),
13848
14082
  engine: CastVideoEngineSchema,
@@ -13853,7 +14087,6 @@ var PrepareCastScriptBodySchema = external_exports.object({
13853
14087
  references: CastScriptReferencesSchema,
13854
14088
  longVideo: external_exports.boolean()
13855
14089
  });
13856
- var MAX_PREPARED_CAST_SCRIPT_SECTIONS = 100;
13857
14090
  var PrepareCastScriptResponseSchema = external_exports.object({
13858
14091
  sections: external_exports.array(CastScriptSectionSchema).min(1).max(MAX_PREPARED_CAST_SCRIPT_SECTIONS),
13859
14092
  requestedSeconds: external_exports.number().positive().nullable(),
@@ -13862,8 +14095,8 @@ var PrepareCastScriptResponseSchema = external_exports.object({
13862
14095
  var EnhanceScriptResponseSchema = external_exports.object({
13863
14096
  prompt: external_exports.string(),
13864
14097
  /**
13865
- * Present for the two operations that answer in beats — `split` and
13866
- * `draft`. Both echo their input back as `prompt`, a split because it does
14098
+ * Present for the operations that answer in beats — `split`, `sort`,
14099
+ * `draft` and `shorten`. Both echo their input back as `prompt`, a split because it does
13867
14100
  * not rewrite the script and a draft because the brief is not the answer;
13868
14101
  * the beats are. Optional rather than a second response shape: every other
13869
14102
  * operation returns `prompt` alone, which is what this endpoint has always
@@ -14179,8 +14412,22 @@ var CastTemplateReferenceSchema = external_exports.object({
14179
14412
  source: external_exports.enum(["static", "database"])
14180
14413
  });
14181
14414
 
14415
+ // ../api-contract/src/https-media-url.ts
14416
+ var HttpsMediaUrlSchema = external_exports.string().trim().url().max(2048).refine(isHttpsUrl, {
14417
+ message: "Use an https URL without a user name or password"
14418
+ });
14419
+ function isHttpsUrl(value) {
14420
+ try {
14421
+ const url = new URL(value);
14422
+ return url.protocol === "https:" && url.username === "" && url.password === "";
14423
+ } catch {
14424
+ return false;
14425
+ }
14426
+ }
14427
+
14182
14428
  // ../api-contract/src/cast/video.ts
14183
14429
  var CAST_VIDEO_MAX_PROPS = 6;
14430
+ var MAX_CAST_VIDEO_SECTIONS = 300;
14184
14431
  var CastVideoAvatarSchema = external_exports.object({
14185
14432
  kind: external_exports.enum(["custom", "curated", "element"]),
14186
14433
  id: external_exports.string().uuid()
@@ -14240,7 +14487,7 @@ var CastVideoInputSchema = external_exports.object({
14240
14487
  */
14241
14488
  continues: external_exports.boolean().optional()
14242
14489
  }).strict().superRefine(refuseShotFieldsOffShots)
14243
- ).min(1).max(30),
14490
+ ).min(1).max(MAX_CAST_VIDEO_SECTIONS),
14244
14491
  backgroundId: external_exports.string().uuid().optional(),
14245
14492
  propAssetId: external_exports.string().uuid().optional(),
14246
14493
  propName: external_exports.string().max(200).optional(),
@@ -14253,6 +14500,22 @@ var CastVideoInputSchema = external_exports.object({
14253
14500
  aspectRatio: OutputAspectRatioSchema.default("9:16"),
14254
14501
  workId: external_exports.string().uuid().optional()
14255
14502
  }).strict();
14503
+ var CastVideoPropRequestSchema = external_exports.object({
14504
+ assetId: external_exports.string().uuid().optional(),
14505
+ url: HttpsMediaUrlSchema.optional().describe(
14506
+ "A public HTTPS URL of the prop picture (JPEG, PNG or WebP, up to 50 MB), in place of assetId. Melius downloads and checks it before estimating credits, and prepare returns it as assetId."
14507
+ ),
14508
+ name: external_exports.string().trim().min(1).max(200).optional()
14509
+ }).strict().refine((prop) => !prop.assetId !== !prop.url, {
14510
+ message: "Send one of assetId or url",
14511
+ path: ["url"]
14512
+ });
14513
+ var castVideoPropRequests = {
14514
+ props: external_exports.array(CastVideoPropRequestSchema).min(1).max(CAST_VIDEO_MAX_PROPS).optional()
14515
+ };
14516
+ var CastVideoInputRequestSchema = CastVideoInputSchema.extend(
14517
+ castVideoPropRequests
14518
+ );
14256
14519
  var CastVideoRequestSchema = CastVideoInputSchema.extend({
14257
14520
  useFreeGeneration: external_exports.boolean().optional(),
14258
14521
  voice: CastVideoVoiceSchema.optional(),
@@ -14264,6 +14527,9 @@ var CastVideoRequestSchema = CastVideoInputSchema.extend({
14264
14527
  }).strict()
14265
14528
  ])
14266
14529
  });
14530
+ var CastVideoUrlRequestSchema = CastVideoRequestSchema.extend(
14531
+ castVideoPropRequests
14532
+ );
14267
14533
  var CastVideoReviewSchema = external_exports.object({
14268
14534
  avatar: external_exports.object({ name: external_exports.string(), imageUrl: external_exports.string().nullable() }),
14269
14535
  voice: external_exports.string(),
@@ -14279,6 +14545,8 @@ var CastVideoReviewSchema = external_exports.object({
14279
14545
  visuals: external_exports.string().optional(),
14280
14546
  /** Auto or One shot, for a member offered Camera (`cast-one-shot`); absent otherwise. */
14281
14547
  camera: external_exports.string().optional(),
14548
+ /** Polished, Natural or Raw, for a member offered Aesthetic (`cast-aesthetic`) in a style that takes it; absent otherwise. */
14549
+ aesthetic: external_exports.string().optional(),
14282
14550
  /** What preparation changed from the request, said where the member reviews it. */
14283
14551
  notice: external_exports.string().optional(),
14284
14552
  /** Everyone the video casts, `avatar` first, where it casts several. */
@@ -14290,6 +14558,18 @@ var CastVideoReviewSchema = external_exports.object({
14290
14558
  })
14291
14559
  ).optional()
14292
14560
  });
14561
+ var CastPreparedClipSchema = external_exports.object({
14562
+ /** The sections, from 0, it films; a section cut across clips is in each. */
14563
+ sections: external_exports.array(external_exports.number().int().min(0)),
14564
+ /** The length it is generated at. */
14565
+ seconds: external_exports.number().nonnegative(),
14566
+ /** What its lines and silent beats take; under `seconds` where the model's shortest clip holds it. */
14567
+ scriptSeconds: external_exports.number().nonnegative(),
14568
+ /** Everyone it films, in cast order. */
14569
+ people: external_exports.array(external_exports.object({ avatarId: external_exports.string(), name: external_exports.string() })),
14570
+ /** The place it films in, where the video films a series' scenes. */
14571
+ place: external_exports.string().nullable().optional()
14572
+ });
14293
14573
  var preparation = external_exports.object({
14294
14574
  attemptId: external_exports.string().uuid(),
14295
14575
  preparationToken: external_exports.string().uuid().optional(),
@@ -14298,7 +14578,41 @@ var preparation = external_exports.object({
14298
14578
  scriptSeconds: external_exports.number().nonnegative(),
14299
14579
  aspectRatios: external_exports.array(OutputAspectRatioSchema),
14300
14580
  estimatedWait: external_exports.string().optional(),
14301
- visualsUnavailableReason: external_exports.string().optional()
14581
+ visualsUnavailableReason: external_exports.string().optional(),
14582
+ /**
14583
+ * The scenes the video films, in order, where it films a Microdrama
14584
+ * series' scenes (`places-and-looks-microdramas`): where each begins, its place
14585
+ * and time, and each person's look there.
14586
+ */
14587
+ scenes: external_exports.array(
14588
+ external_exports.object({
14589
+ /** The section, from 0, its heading is on. */
14590
+ startsAtSection: external_exports.number().int().min(0),
14591
+ place: external_exports.string().nullable(),
14592
+ placePictureAssetId: external_exports.string().optional(),
14593
+ time: CastSceneTimeSchema,
14594
+ timeLabel: external_exports.string().optional(),
14595
+ looks: external_exports.array(
14596
+ external_exports.object({
14597
+ avatarId: external_exports.string(),
14598
+ look: external_exports.string(),
14599
+ pictureAssetId: external_exports.string().optional()
14600
+ })
14601
+ )
14602
+ })
14603
+ ).optional(),
14604
+ /**
14605
+ * The clips the video is generated as, in order, where it is more than
14606
+ * one: the script sections each films, its length, and who is in it.
14607
+ */
14608
+ clips: external_exports.array(CastPreparedClipSchema).optional(),
14609
+ /**
14610
+ * Where `clips` films something other than the script reads, each in
14611
+ * words the member can act on before running: a clip the model's
14612
+ * shortest generation holds well past its lines, a scene whose place no
14613
+ * clip films.
14614
+ */
14615
+ warnings: external_exports.array(external_exports.string()).optional()
14302
14616
  });
14303
14617
  var PrepareCastVideoResponseSchema = external_exports.discriminatedUnion("status", [
14304
14618
  preparation.extend({
@@ -14315,6 +14629,7 @@ var PrepareCastVideoResponseSchema = external_exports.discriminatedUnion("status
14315
14629
  estimatedCredits: external_exports.null()
14316
14630
  })
14317
14631
  ]);
14632
+ var CastStudioWorkSchema = external_exports.object({ workId: external_exports.string().uuid(), rootWorkId: external_exports.string().uuid() }).strict();
14318
14633
  var RunCastVideoBodySchema = external_exports.object({
14319
14634
  attemptId: external_exports.string().uuid(),
14320
14635
  preparationToken: external_exports.string().uuid().optional(),
@@ -14329,8 +14644,18 @@ var RunCastVideoBodySchema = external_exports.object({
14329
14644
  */
14330
14645
  collectionId: external_exports.string().uuid().optional(),
14331
14646
  /** Make another take of this episode of a series collection. */
14332
- episodeId: external_exports.string().uuid().optional()
14647
+ episodeId: external_exports.string().uuid().optional(),
14648
+ /**
14649
+ * The studio session the video continues (the analytics' `workId` and
14650
+ * `rootWorkId`), so History stacks it with that session's takes.
14651
+ */
14652
+ studioWork: CastStudioWorkSchema.optional(),
14653
+ /** A signed HTTPS callback for when the video is ready or failed. A repeat of the same attempt keeps the first one. */
14654
+ webhook: RegisterRunWebhookBodySchema.optional()
14333
14655
  }).strict();
14656
+ var RunCastVideoUrlBodySchema = RunCastVideoBodySchema.extend({
14657
+ input: CastVideoInputRequestSchema
14658
+ });
14334
14659
  var CastPreparedVideoQuoteSchema = external_exports.object({
14335
14660
  estimatedCredits: external_exports.number().finite().nonnegative()
14336
14661
  });
@@ -14360,7 +14685,9 @@ var CastVideoResponseSchema = external_exports.discriminatedUnion("status", [
14360
14685
  }),
14361
14686
  videoReference.extend({
14362
14687
  status: external_exports.literal("failed"),
14363
- message: external_exports.string()
14688
+ message: external_exports.string(),
14689
+ /** Why it failed; absent from a video saved before reasons. */
14690
+ failureReason: GenerationFailureReasonSchema.optional()
14364
14691
  })
14365
14692
  ]);
14366
14693
  var CastVideoDownloadSchema = external_exports.object({
@@ -14655,6 +14982,12 @@ var AgentInFlightEntrySchema = external_exports.discriminatedUnion("type", [
14655
14982
  summary: external_exports.string(),
14656
14983
  status: external_exports.enum(["running", "complete", "error"]),
14657
14984
  error: external_exports.string().optional(),
14985
+ /**
14986
+ * Tool call input, present only for tools whose chat row is named
14987
+ * and grouped from it. A snapshot without it shows the tool's own
14988
+ * label.
14989
+ */
14990
+ input: external_exports.unknown().optional(),
14658
14991
  /**
14659
14992
  * Tool result payload, present only for tools whose result is
14660
14993
  * worth rendering inline (currently `web_search`). Other tools
@@ -14898,8 +15231,8 @@ var INSUFFICIENT_CREDITS_ERROR_CODE = "INSUFFICIENT_CREDITS";
14898
15231
  function isInsufficientCreditsError(body) {
14899
15232
  return typeof body === "object" && body !== null && body.code === INSUFFICIENT_CREDITS_ERROR_CODE;
14900
15233
  }
14901
- function countNodes(count) {
14902
- return `${count} ${count === 1 ? "node" : "nodes"}`;
15234
+ function countNodes(count2) {
15235
+ return `${count2} ${count2 === 1 ? "node" : "nodes"}`;
14903
15236
  }
14904
15237
  function describeCreditShortfall(shortfall) {
14905
15238
  const runCount = shortfall.affordableNodeIds.length;
@@ -14910,6 +15243,488 @@ function describeCreditShortfall(shortfall) {
14910
15243
  // ../api-contract/src/credit-refusal.ts
14911
15244
  var MEMBER_CREDIT_LIMIT_ERROR_CODE = "MEMBER_CREDIT_LIMIT";
14912
15245
 
15246
+ // ../api-contract/src/distribution/schema.ts
15247
+ var DISTRIBUTION_RECENT_DAYS = 7;
15248
+ var MAX_DISTRIBUTION_SEARCH_QUERY_LENGTH = 200;
15249
+ var MAX_DISTRIBUTION_ACCOUNT_FILTER_IDS = 100;
15250
+ var MAX_DISTRIBUTION_REPORT_DAYS = 366;
15251
+ var DEFAULT_DISTRIBUTION_REPORT_TOP_ROWS = 5;
15252
+ var MAX_DISTRIBUTION_REPORT_TOP_ROWS = 100;
15253
+ var MAX_DISTRIBUTION_REVIEW_NOTE_LENGTH = 2e3;
15254
+ var MAX_DISTRIBUTION_POST_REVIEW_EVENTS = 100;
15255
+ var DISTRIBUTION_REVIEW_STATE_CONFLICT_CODE = "REVIEW_STATE_CONFLICT";
15256
+ var DAY_MS = 864e5;
15257
+ var FIRST_REQUEST_DAY = "2000-01-01";
15258
+ var LAST_REQUEST_DAY = "2100-12-31";
15259
+ var id = external_exports.string().uuid();
15260
+ var day = external_exports.string().date();
15261
+ var requestDay = day.refine(
15262
+ (value) => value >= FIRST_REQUEST_DAY && value <= LAST_REQUEST_DAY,
15263
+ {
15264
+ message: `Choose a day from ${FIRST_REQUEST_DAY} to ${LAST_REQUEST_DAY}`
15265
+ }
15266
+ );
15267
+ var time = external_exports.string().datetime();
15268
+ var count = external_exports.number().int().nonnegative();
15269
+ var countOrUnknown = count.nullable();
15270
+ var link = external_exports.string().url();
15271
+ var DistributionPlatformSchema = external_exports.enum([
15272
+ "tiktok",
15273
+ "instagram",
15274
+ "facebook",
15275
+ "youtube"
15276
+ ]);
15277
+ var DistributionCampaignPhaseSchema = external_exports.enum([
15278
+ "upcoming",
15279
+ "live",
15280
+ "ended"
15281
+ ]);
15282
+ var DistributionFreshnessStateSchema = external_exports.enum([
15283
+ "awaiting_first_sync",
15284
+ "current"
15285
+ ]);
15286
+ var DistributionTargetMetricSchema = external_exports.enum(["views", "posts"]);
15287
+ var DistributionPostStatusSchema = external_exports.enum([
15288
+ "awaiting_review",
15289
+ "changes_requested",
15290
+ "approved",
15291
+ "scheduled",
15292
+ "published",
15293
+ "failed",
15294
+ "declined",
15295
+ "removed"
15296
+ ]);
15297
+ var DistributionPostFormatSchema = external_exports.enum([
15298
+ "video",
15299
+ "slideshow",
15300
+ "image",
15301
+ "unknown"
15302
+ ]);
15303
+ var DistributionAccountStatusSchema = external_exports.enum([
15304
+ "warming",
15305
+ "active",
15306
+ "inactive",
15307
+ "restricted",
15308
+ "unknown"
15309
+ ]);
15310
+ var DistributionCampaignSummarySchema = external_exports.object({
15311
+ id,
15312
+ /** The team the campaign belongs to; every other route takes it as the team header. */
15313
+ teamId: id,
15314
+ teamName: external_exports.string(),
15315
+ name: external_exports.string(),
15316
+ platforms: external_exports.array(DistributionPlatformSchema),
15317
+ phase: DistributionCampaignPhaseSchema,
15318
+ /** The first day a published post counts; null when every published post counts. */
15319
+ startsOn: day.nullable(),
15320
+ /** The campaign's last day; null while it has none. */
15321
+ endsOn: day.nullable()
15322
+ });
15323
+ var DistributionCampaignListItemSchema = DistributionCampaignSummarySchema.extend({
15324
+ /** Whether the person may approve and decline the campaign's posts and send Melius requests: an editor, an admin or an owner of its team. A viewer reads. */
15325
+ canDecide: external_exports.boolean()
15326
+ });
15327
+ var DistributionCampaignListSchema = external_exports.object({
15328
+ /** The person's campaigns across their teams: those running or yet to start first, then ended ones, newest first within each. */
15329
+ campaigns: external_exports.array(DistributionCampaignListItemSchema)
15330
+ });
15331
+ var DistributionFreshnessSchema = external_exports.object({
15332
+ state: DistributionFreshnessStateSchema,
15333
+ /** When the latest full read finished, which is when the counts were last brought up to date; null while awaiting the first. */
15334
+ lastFullSyncAt: time.nullable()
15335
+ });
15336
+ var DistributionTargetProgressSchema = external_exports.object({
15337
+ id,
15338
+ metric: DistributionTargetMetricSchema,
15339
+ targetValue: external_exports.number().int().positive(),
15340
+ /** The target is due at the end of this time's day; null for a target with no due day. */
15341
+ dueAt: time.nullable(),
15342
+ /** The metric's count so far; once the due day has passed, the count as last read on or before that day. Null while unknown. */
15343
+ progress: countOrUnknown,
15344
+ /** What is left to reach the target, divided by the days from today to the due day, both included. Null with no due day, once it has passed, or while progress is unknown. */
15345
+ neededPerDay: external_exports.number().nonnegative().nullable(),
15346
+ /** What the last `DISTRIBUTION_RECENT_DAYS` complete days added, as an average a day. Null until posting has run that many complete days, or while no day of them has a reading. */
15347
+ recentDailyAverage: external_exports.number().nonnegative().nullable()
15348
+ });
15349
+ var DistributionAccountSummarySchema = external_exports.object({
15350
+ total: count,
15351
+ /** One entry for each status an account holds. */
15352
+ byStatus: external_exports.array(
15353
+ external_exports.object({
15354
+ status: DistributionAccountStatusSchema,
15355
+ accounts: count
15356
+ })
15357
+ ),
15358
+ /** One entry for each platform an account is on. */
15359
+ byPlatform: external_exports.array(
15360
+ external_exports.object({
15361
+ platform: DistributionPlatformSchema,
15362
+ accounts: count,
15363
+ /** How many of them are `active`. */
15364
+ activeAccounts: count
15365
+ })
15366
+ )
15367
+ });
15368
+ var DistributionCampaignOverviewSchema = external_exports.object({
15369
+ campaign: DistributionCampaignSummarySchema,
15370
+ freshness: DistributionFreshnessSchema,
15371
+ /** The latest known views of the posts that count, summed. Null while posts count and none of them has a known view count. */
15372
+ viewsDelivered: countOrUnknown,
15373
+ /** How many posts count. */
15374
+ postsPublished: count,
15375
+ /** One entry for each target the campaign has, oldest first. */
15376
+ targets: external_exports.array(DistributionTargetProgressSchema),
15377
+ accounts: DistributionAccountSummarySchema,
15378
+ posts: external_exports.object({
15379
+ /** How many posts hold each status, one entry for each status a post holds. */
15380
+ byStatus: external_exports.array(
15381
+ external_exports.object({ status: DistributionPostStatusSchema, posts: count })
15382
+ ),
15383
+ /** When the post that has waited longest for review was first held for it; null while none waits. */
15384
+ oldestAwaitingReviewSince: time.nullable()
15385
+ })
15386
+ });
15387
+ var DistributionPreviewMediaSchema = external_exports.object({
15388
+ kind: external_exports.enum(["video", "image"]),
15389
+ /** Signed for the Melius CDN. */
15390
+ url: link,
15391
+ width: external_exports.number().int().positive(),
15392
+ height: external_exports.number().int().positive(),
15393
+ /** Null for an image. */
15394
+ durationMs: external_exports.number().int().nonnegative().nullable()
15395
+ });
15396
+ var DistributionPostPreviewSchema = external_exports.discriminatedUnion("state", [
15397
+ external_exports.object({
15398
+ state: external_exports.literal("ready"),
15399
+ media: external_exports.array(DistributionPreviewMediaSchema).min(1),
15400
+ /** Names these files. An approval that sends it back is refused once the files change. */
15401
+ version: external_exports.string()
15402
+ }),
15403
+ external_exports.object({ state: external_exports.literal("pending") }),
15404
+ external_exports.object({ state: external_exports.literal("unavailable") })
15405
+ ]);
15406
+ var DistributionPostAccountSchema = external_exports.object({
15407
+ /** Its ID in the accounts search; null when the account is not among the campaign's listed accounts. */
15408
+ id: id.nullable(),
15409
+ /** As the post carries it: a post exists only on an account that is set up. */
15410
+ handle: external_exports.string(),
15411
+ /** The account's public profile on its platform's own site. */
15412
+ profileUrl: link.nullable()
15413
+ });
15414
+ var DistributionReportAccountSchema = DistributionPostAccountSchema.extend({
15415
+ /** Null until a listed account is named. */
15416
+ handle: external_exports.string().nullable()
15417
+ });
15418
+ var DistributionCampaignPostSchema = external_exports.object({
15419
+ id,
15420
+ /** Null, with `account`, for a post held for review before its account is chosen. */
15421
+ platform: DistributionPlatformSchema.nullable(),
15422
+ format: DistributionPostFormatSchema,
15423
+ status: DistributionPostStatusSchema,
15424
+ caption: external_exports.string(),
15425
+ /** Null for a post held for review before its account is chosen; it gets one before it is posted. */
15426
+ account: DistributionPostAccountSchema.nullable(),
15427
+ /** When the post was first held for the team's review; null for a post that never was. */
15428
+ reviewRequestedAt: time.nullable(),
15429
+ /** When the post is planned to go out; null while it has no planned time. */
15430
+ scheduledFor: time.nullable(),
15431
+ publishedAt: time.nullable(),
15432
+ /** The post's own page on its platform; null until it is known. */
15433
+ publicUrl: link.nullable(),
15434
+ /** The post's latest known counts on its platform. */
15435
+ views: countOrUnknown,
15436
+ likes: countOrUnknown,
15437
+ comments: countOrUnknown,
15438
+ shares: countOrUnknown,
15439
+ /** When a count was last read; null while none is known. */
15440
+ countsUpdatedAt: time.nullable(),
15441
+ preview: DistributionPostPreviewSchema
15442
+ });
15443
+ var DistributionReviewEventKindSchema = external_exports.enum([
15444
+ "approve",
15445
+ "decline",
15446
+ "edit_request",
15447
+ "takedown_request",
15448
+ "comment"
15449
+ ]);
15450
+ var DistributionReviewRequestStateSchema = external_exports.enum([
15451
+ "open",
15452
+ "resolved"
15453
+ ]);
15454
+ var DistributionReviewEventSchema = external_exports.object({
15455
+ id,
15456
+ kind: DistributionReviewEventKindSchema,
15457
+ author: external_exports.object({
15458
+ /** The member's name; null for someone at Melius, and once the member's account is gone. */
15459
+ name: external_exports.string().nullable(),
15460
+ /** Someone at Melius sent it for the team. */
15461
+ isMelius: external_exports.boolean()
15462
+ }),
15463
+ createdAt: time,
15464
+ /** The words sent with it; null when none were. */
15465
+ note: external_exports.string().nullable(),
15466
+ /** Where a request stands; null for a decision. */
15467
+ requestState: DistributionReviewRequestStateSchema.nullable()
15468
+ });
15469
+ var DistributionOpenRequestKindSchema = DistributionReviewEventKindSchema.extract([
15470
+ "edit_request",
15471
+ "takedown_request"
15472
+ ]);
15473
+ var DistributionPostSearchResultSchema = DistributionCampaignPostSchema.extend({
15474
+ /** Its edit and takedown requests that Melius has yet to act on, oldest first. Comments are read with the post. */
15475
+ openRequests: external_exports.array(DistributionReviewEventSchema)
15476
+ });
15477
+ var DistributionPostSortSchema = external_exports.enum([
15478
+ "review_oldest",
15479
+ "newest",
15480
+ "most_viewed"
15481
+ ]);
15482
+ var searchQuery = external_exports.string().trim().min(1).max(MAX_DISTRIBUTION_SEARCH_QUERY_LENGTH);
15483
+ var SearchDistributionPostsBodySchema = createCursorPaginationRequestSchema({
15484
+ defaultPageSize: 24,
15485
+ maxPageSize: 100
15486
+ }).extend({
15487
+ /** Matched against each post's caption, then its account handle. Results come best match first, and `sort` orders the posts that match equally well. */
15488
+ query: searchQuery.optional(),
15489
+ sort: DistributionPostSortSchema.default("newest"),
15490
+ /** Each list keeps the posts that hold any of its values; an empty list keeps every post. */
15491
+ filters: external_exports.object({
15492
+ statuses: external_exports.array(DistributionPostStatusSchema).max(DistributionPostStatusSchema.options.length).default([]),
15493
+ platforms: external_exports.array(DistributionPlatformSchema).max(DistributionPlatformSchema.options.length).default([]),
15494
+ accountIds: external_exports.array(id).max(MAX_DISTRIBUTION_ACCOUNT_FILTER_IDS).default([]),
15495
+ /** Keeps the posts with a request of one of these kinds that Melius has yet to act on. */
15496
+ openRequests: external_exports.array(DistributionOpenRequestKindSchema).max(DistributionOpenRequestKindSchema.options.length).default([]),
15497
+ /** Keeps posts published on or after this day. */
15498
+ publishedFrom: requestDay.optional(),
15499
+ /** Keeps posts published on or before this day. */
15500
+ publishedTo: requestDay.optional()
15501
+ }).refine(
15502
+ ({ publishedFrom, publishedTo }) => !publishedFrom || !publishedTo || publishedFrom <= publishedTo,
15503
+ {
15504
+ path: ["publishedTo"],
15505
+ message: "End on or after the first day"
15506
+ }
15507
+ ).default({}),
15508
+ /** Also return `totals`, which take a read of their own. */
15509
+ includeTotals: external_exports.boolean().default(false)
15510
+ });
15511
+ var DistributionPostTotalsSchema = external_exports.object({
15512
+ /** How many of the matching posts count. */
15513
+ postsPublished: count,
15514
+ /** The latest known views of those posts, summed; null while they exist and none has a known view count. The three counts below follow the same rule. */
15515
+ views: countOrUnknown,
15516
+ likes: countOrUnknown,
15517
+ comments: countOrUnknown,
15518
+ shares: countOrUnknown
15519
+ });
15520
+ var DistributionPostsPageSchema = createPaginatedResponseSchema(
15521
+ DistributionPostSearchResultSchema
15522
+ ).and(
15523
+ external_exports.object({
15524
+ /** Null unless `includeTotals` asked for them. */
15525
+ totals: DistributionPostTotalsSchema.nullable()
15526
+ })
15527
+ );
15528
+ var reviewNote = external_exports.string().trim().max(MAX_DISTRIBUTION_REVIEW_NOTE_LENGTH);
15529
+ var MAX_PREVIEW_VERSION_LENGTH = 100;
15530
+ var requiredReviewNote = reviewNote.min(1);
15531
+ var optionalReviewNote = reviewNote.optional();
15532
+ var CreateDistributionReviewEventBodySchema = external_exports.discriminatedUnion(
15533
+ "kind",
15534
+ [
15535
+ external_exports.object({
15536
+ kind: external_exports.literal("approve"),
15537
+ note: optionalReviewNote,
15538
+ /** The `version` of the ready preview the approval was made from; refused once the preview has changed. */
15539
+ previewVersion: external_exports.string().max(MAX_PREVIEW_VERSION_LENGTH).optional()
15540
+ }),
15541
+ external_exports.object({ kind: external_exports.literal("decline"), note: optionalReviewNote }),
15542
+ external_exports.object({
15543
+ kind: external_exports.literal("edit_request"),
15544
+ note: requiredReviewNote
15545
+ }),
15546
+ external_exports.object({
15547
+ kind: external_exports.literal("takedown_request"),
15548
+ note: optionalReviewNote
15549
+ }),
15550
+ external_exports.object({ kind: external_exports.literal("comment"), note: requiredReviewNote })
15551
+ ]
15552
+ );
15553
+ var DistributionReviewEventResultSchema = external_exports.object({
15554
+ /** The post as it stands when the answer is made: as the event left it, or as later work has moved it when a repeated key returns a stored event. */
15555
+ post: DistributionCampaignPostSchema,
15556
+ event: DistributionReviewEventSchema
15557
+ });
15558
+ var DistributionReviewConflictSchema = ApiErrorResponseSchema.extend({
15559
+ code: external_exports.literal(DISTRIBUTION_REVIEW_STATE_CONFLICT_CODE),
15560
+ post: DistributionCampaignPostSchema
15561
+ });
15562
+ var DistributionPostDaySchema = external_exports.object({
15563
+ day,
15564
+ /** Views the post gained that day: its count that day less its count on the reading before. Null when it was not read that day, or when its first reading came more than a day after it was published. */
15565
+ views: countOrUnknown,
15566
+ /** The post's views as read that day; null when it was not read. */
15567
+ viewsToDate: countOrUnknown
15568
+ });
15569
+ var DistributionCampaignPostDetailSchema = external_exports.object({
15570
+ post: DistributionCampaignPostSchema,
15571
+ /** One entry a day, from the day the post was published to today, oldest first; empty before it is published. */
15572
+ days: external_exports.array(DistributionPostDaySchema),
15573
+ /** The post's review events, oldest first: the latest `MAX_DISTRIBUTION_POST_REVIEW_EVENTS` when it has more. */
15574
+ events: external_exports.array(DistributionReviewEventSchema).max(MAX_DISTRIBUTION_POST_REVIEW_EVENTS)
15575
+ });
15576
+ var DistributionDayViewsSchema = external_exports.object({
15577
+ day,
15578
+ /** Views the account's posts that count gained that day; null when posts were live and what they gained that day is unknown. */
15579
+ views: countOrUnknown
15580
+ });
15581
+ var DistributionCampaignAccountSchema = external_exports.object({
15582
+ id,
15583
+ platform: DistributionPlatformSchema,
15584
+ /** Null until the account is named: one being set up has none yet. */
15585
+ handle: external_exports.string().nullable(),
15586
+ /** The account's name on its platform; null while it has none. */
15587
+ displayName: external_exports.string().nullable(),
15588
+ status: DistributionAccountStatusSchema,
15589
+ /** The account's public profile on its platform's own site; null while it has no handle. */
15590
+ profileUrl: link.nullable(),
15591
+ followers: countOrUnknown,
15592
+ /** How many of the account's posts count. */
15593
+ postsPublished: count,
15594
+ /** The latest known views of those posts, summed; null while they exist and none has a known view count. */
15595
+ views: countOrUnknown,
15596
+ /** The last `DISTRIBUTION_RECENT_DAYS` complete days. */
15597
+ recentViews: external_exports.object({
15598
+ /** The days' views, summed; null while no day of them has a reading. */
15599
+ total: countOrUnknown,
15600
+ /** One entry a day, oldest first. */
15601
+ days: external_exports.array(DistributionDayViewsSchema).length(DISTRIBUTION_RECENT_DAYS)
15602
+ }),
15603
+ /** When the latest of the account's posts that count was published; null while none has been. */
15604
+ lastPostAt: time.nullable()
15605
+ });
15606
+ var DistributionAccountSortSchema = external_exports.enum([
15607
+ "most_viewed",
15608
+ "most_posts",
15609
+ "recently_posted",
15610
+ "handle"
15611
+ ]);
15612
+ var SearchDistributionAccountsBodySchema = createCursorPaginationRequestSchema({
15613
+ defaultPageSize: 50,
15614
+ maxPageSize: 100
15615
+ }).extend({
15616
+ /** Matched against each account's handle, so an account with no handle yet is never a match. Results come best match first, and `sort` orders the accounts that match equally well. */
15617
+ query: searchQuery.optional(),
15618
+ sort: DistributionAccountSortSchema.default("most_viewed"),
15619
+ /** Each list keeps the accounts that hold any of its values; an empty list keeps every account. */
15620
+ filters: external_exports.object({
15621
+ platforms: external_exports.array(DistributionPlatformSchema).max(DistributionPlatformSchema.options.length).default([]),
15622
+ statuses: external_exports.array(DistributionAccountStatusSchema).max(DistributionAccountStatusSchema.options.length).default([])
15623
+ }).default({}),
15624
+ /** Also return `summary`, which takes a read of its own. */
15625
+ includeSummary: external_exports.boolean().default(false)
15626
+ });
15627
+ var DistributionAccountsPageSchema = createPaginatedResponseSchema(
15628
+ DistributionCampaignAccountSchema
15629
+ ).and(
15630
+ external_exports.object({
15631
+ /** Every account of the campaign, whatever the search filters by. Null unless `includeSummary` asked for it. */
15632
+ summary: DistributionAccountSummarySchema.nullable()
15633
+ })
15634
+ );
15635
+ var DistributionPeriodReportQuerySchema = external_exports.object({
15636
+ /** The period's first and last days, both included. */
15637
+ from: requestDay,
15638
+ to: requestDay,
15639
+ /** How many accounts and posts to return as top rows. */
15640
+ top: external_exports.coerce.number().int().min(1).max(MAX_DISTRIBUTION_REPORT_TOP_ROWS).default(DEFAULT_DISTRIBUTION_REPORT_TOP_ROWS)
15641
+ }).refine(
15642
+ ({ from, to }) => {
15643
+ const days = (Date.parse(to) - Date.parse(from)) / DAY_MS + 1;
15644
+ return days >= 1 && days <= MAX_DISTRIBUTION_REPORT_DAYS;
15645
+ },
15646
+ {
15647
+ message: `Choose a period of up to ${MAX_DISTRIBUTION_REPORT_DAYS} days`
15648
+ }
15649
+ );
15650
+ var DistributionCampaignDaySchema = external_exports.object({
15651
+ day,
15652
+ /** Views the posts that count gained that day: each post's count that day less its count on the reading before. Null when posts were live and what they gained that day is unknown. */
15653
+ views: countOrUnknown,
15654
+ /** Posts that count published that day. */
15655
+ postsPublished: count
15656
+ });
15657
+ var reportPart = {
15658
+ /** Posts that count published in the period. */
15659
+ postsPublished: count,
15660
+ /** Views the part's posts gained in the period, added up over those read in it; null while they exist and none was read in it. */
15661
+ views: countOrUnknown
15662
+ };
15663
+ var DistributionReportOthersSchema = external_exports.object({
15664
+ /** How many rows they are. */
15665
+ count,
15666
+ /** Views they gained in the period; null while they exist and none was read in it. */
15667
+ views: countOrUnknown
15668
+ });
15669
+ var DistributionPeriodReportSchema = external_exports.object({
15670
+ from: day,
15671
+ to: day,
15672
+ totals: external_exports.object({
15673
+ /** Views the posts that count gained in the period: for each post read in it, its count as last read in the period, less its count as last read before the first day. A post that was not read in the period adds nothing here, and the period of its next reading holds the whole rise. Null while such posts exist and none was read in the period. */
15674
+ views: countOrUnknown,
15675
+ /** Posts that count published in the period. */
15676
+ postsPublished: count
15677
+ }),
15678
+ /** The campaign as the period ended. */
15679
+ toDate: external_exports.object({
15680
+ /** Views of the posts that count, each as last read on or before the period's last day, summed. Null while such posts exist and none has a reading. */
15681
+ viewsDelivered: countOrUnknown,
15682
+ /** Posts that count published on or before the period's last day. */
15683
+ postsPublished: count
15684
+ }),
15685
+ /** One entry for each day of the period, oldest first. */
15686
+ days: external_exports.array(DistributionCampaignDaySchema),
15687
+ /** One entry for each platform with a post that counts, most views first. */
15688
+ byPlatform: external_exports.array(
15689
+ external_exports.object({ platform: DistributionPlatformSchema, ...reportPart })
15690
+ ),
15691
+ /** One entry for each format with a post that counts, most views first. */
15692
+ byFormat: external_exports.array(
15693
+ external_exports.object({ format: DistributionPostFormatSchema, ...reportPart })
15694
+ ),
15695
+ /** The accounts with a post that counts, by views gained in the period. */
15696
+ byAccount: external_exports.object({
15697
+ top: external_exports.array(
15698
+ external_exports.object({
15699
+ account: DistributionReportAccountSchema,
15700
+ platform: DistributionPlatformSchema,
15701
+ ...reportPart
15702
+ })
15703
+ ),
15704
+ others: DistributionReportOthersSchema
15705
+ }),
15706
+ /** The posts that count, by views gained in the period, whenever they were published. */
15707
+ byPost: external_exports.object({
15708
+ top: external_exports.array(
15709
+ external_exports.object({
15710
+ post: DistributionCampaignPostSchema,
15711
+ /** Views the post gained in the period; null when it was not read in it. */
15712
+ views: countOrUnknown
15713
+ })
15714
+ ),
15715
+ others: DistributionReportOthersSchema
15716
+ }),
15717
+ /** Reviews the team made in the period, by what each decided. */
15718
+ postsReviewed: external_exports.object({
15719
+ approved: count,
15720
+ editsRequested: count,
15721
+ declined: count
15722
+ })
15723
+ });
15724
+
15725
+ // ../api-contract/src/task-budget/refusal.ts
15726
+ var TASK_BUDGET_EXCEEDED_ERROR_CODE = "TASK_BUDGET_EXCEEDED";
15727
+
14913
15728
  // ../api-contract/src/errors.ts
14914
15729
  var API_ERROR_CODE = {
14915
15730
  projectNameTaken: "PROJECT_NAME_TAKEN",
@@ -14933,6 +15748,8 @@ var API_ERROR_CODE = {
14933
15748
  insufficientCredits: INSUFFICIENT_CREDITS_ERROR_CODE,
14934
15749
  /** The member's own credit limit can't cover the run; an admin can raise it. */
14935
15750
  memberCreditLimit: MEMBER_CREDIT_LIMIT_ERROR_CODE,
15751
+ /** The run costs more than its task budget has left; only the member raises the limit. */
15752
+ taskBudgetExceeded: TASK_BUDGET_EXCEEDED_ERROR_CODE,
14936
15753
  /** The team is not in the Ditto beta; the client offers the waitlist. */
14937
15754
  dittoBetaRequired: "DITTO_BETA_REQUIRED",
14938
15755
  /** The Ditto template was retired or deleted; the client asks for another video. */
@@ -14946,7 +15763,9 @@ var API_ERROR_CODE = {
14946
15763
  /** The request asked for a free generation and none covers it; refused, never billed. */
14947
15764
  freeGenerationUnavailable: FREE_GENERATION_UNAVAILABLE_ERROR_CODE,
14948
15765
  /** Someone saved the subtitles since this edit started; the client reloads them. */
14949
- videoSubtitlesRevisionStale: "VIDEO_SUBTITLES_REVISION_STALE"
15766
+ videoSubtitlesRevisionStale: "VIDEO_SUBTITLES_REVISION_STALE",
15767
+ /** A distribution post's status does not allow the review event; the answer carries the post as it stands. */
15768
+ distributionReviewStateConflict: DISTRIBUTION_REVIEW_STATE_CONFLICT_CODE
14950
15769
  };
14951
15770
  var TEAM_SEAT_LIMIT_REACHED_MESSAGE = `Team supports up to ${TEAM_SEAT_PLAN.maxSeats} seats. We've notified our team and will reach out over email about a larger plan.`;
14952
15771
 
@@ -15666,20 +16485,104 @@ var CastSubtitledFromSchema = external_exports.object({
15666
16485
  generationId: external_exports.string().uuid()
15667
16486
  });
15668
16487
 
15669
- // ../api-contract/src/generation/schema.ts
15670
- var InputFileSizeConstraintsResponseSchema = external_exports.object({
15671
- maximumFileBytes: external_exports.number().int().nonnegative().optional(),
15672
- maximumTotalBytes: external_exports.number().int().nonnegative().optional()
15673
- });
15674
- var ImageGenerationQualityPricingSchema = external_exports.record(
15675
- external_exports.string(),
15676
- external_exports.record(external_exports.string(), external_exports.number())
16488
+ // ../api-contract/src/cast/trim-take.ts
16489
+ var CAST_TRIM_MIN_DURATION_MS = 500;
16490
+ var TrimCastGenerationBodySchema = external_exports.object({
16491
+ /** Where the kept part starts, in milliseconds from the clip's start. */
16492
+ startTimeMs: external_exports.number().int().nonnegative(),
16493
+ /** Where the kept part ends; after `startTimeMs`, within the clip. */
16494
+ endTimeMs: external_exports.number().int().positive()
16495
+ }).refine(
16496
+ (range) => range.endTimeMs - range.startTimeMs >= CAST_TRIM_MIN_DURATION_MS,
16497
+ {
16498
+ message: "Keep at least half a second of the video",
16499
+ path: ["endTimeMs"]
16500
+ }
15677
16501
  );
15678
- var GenerationJobStatusSchema = external_exports.enum([
15679
- "in_progress",
15680
- "finished",
15681
- "failed",
15682
- "cancelled"
16502
+ var CastTrimmedFromSchema = external_exports.object({
16503
+ generationId: external_exports.string().uuid()
16504
+ });
16505
+
16506
+ // ../pricing/src/model-rate-card.ts
16507
+ var MODEL_RATE_UNITS = [
16508
+ "second",
16509
+ "image",
16510
+ "video",
16511
+ "minute",
16512
+ "million-tokens"
16513
+ ];
16514
+
16515
+ // ../api-contract/src/generation/customer-model-pricing.ts
16516
+ var ContractDecimalSchema = external_exports.string().regex(/^\d{1,9}(\.\d{1,6})?$/);
16517
+ var ModelRateUnitSchema = external_exports.enum(MODEL_RATE_UNITS);
16518
+ var ModelRateSelectorSchema = external_exports.object({
16519
+ mode: external_exports.string().min(1),
16520
+ tier: external_exports.string().min(1).optional(),
16521
+ resolution: external_exports.string().min(1).optional(),
16522
+ audio: external_exports.enum(["on", "off"]).optional(),
16523
+ quality: external_exports.string().min(1).optional()
16524
+ });
16525
+ var ModelContractPriceSchema = external_exports.discriminatedUnion("kind", [
16526
+ external_exports.object({
16527
+ kind: external_exports.literal("percent"),
16528
+ percent: ContractDecimalSchema.refine((value) => Number(value) <= 100),
16529
+ basis: external_exports.enum(["unit", "token"])
16530
+ }),
16531
+ external_exports.object({
16532
+ kind: external_exports.literal("target"),
16533
+ usd: ContractDecimalSchema,
16534
+ unit: ModelRateUnitSchema
16535
+ })
16536
+ ]);
16537
+ var CustomerModelPricingSchema = external_exports.object({
16538
+ defaultSelector: ModelRateSelectorSchema,
16539
+ creditUsdPerThousand: ContractDecimalSchema.nullable(),
16540
+ rows: external_exports.array(
16541
+ external_exports.object({
16542
+ selector: ModelRateSelectorSchema,
16543
+ price: ModelContractPriceSchema,
16544
+ nativeCreditsPerMillionTokens: external_exports.number().nonnegative().optional()
16545
+ })
16546
+ ),
16547
+ tokenFormula: external_exports.object({
16548
+ kind: external_exports.literal("video-frame-tokens"),
16549
+ unit: external_exports.literal("1000 tokens"),
16550
+ framesPerSecond: external_exports.number().positive(),
16551
+ extraFrames: external_exports.number().nonnegative(),
16552
+ pixelsPerToken: external_exports.number().positive(),
16553
+ inputVideoSecondsBilled: external_exports.boolean(),
16554
+ inputVideoSecondsRoundedDown: external_exports.literal(true).optional(),
16555
+ frameSizes: external_exports.record(
16556
+ external_exports.string(),
16557
+ external_exports.record(
16558
+ external_exports.string(),
16559
+ external_exports.object({
16560
+ width: external_exports.number().positive(),
16561
+ height: external_exports.number().positive()
16562
+ })
16563
+ )
16564
+ )
16565
+ }).optional(),
16566
+ inputVideoCreditMultiplier: external_exports.number().nonnegative(),
16567
+ legacyDiscountPercent: external_exports.number(),
16568
+ alternativeDiscountPercent: external_exports.number(),
16569
+ runDiscountPercent: external_exports.number()
16570
+ });
16571
+
16572
+ // ../api-contract/src/generation/schema.ts
16573
+ var InputFileSizeConstraintsResponseSchema = external_exports.object({
16574
+ maximumFileBytes: external_exports.number().int().nonnegative().optional(),
16575
+ maximumTotalBytes: external_exports.number().int().nonnegative().optional()
16576
+ });
16577
+ var ImageGenerationQualityPricingSchema = external_exports.record(
16578
+ external_exports.string(),
16579
+ external_exports.record(external_exports.string(), external_exports.number())
16580
+ );
16581
+ var GenerationJobStatusSchema = external_exports.enum([
16582
+ "in_progress",
16583
+ "finished",
16584
+ "failed",
16585
+ "cancelled"
15683
16586
  ]);
15684
16587
  var BetterFontSourceSchema = external_exports.enum(["custom", "google"]);
15685
16588
  var BetterFontSelectionSchema = external_exports.object({
@@ -15693,6 +16596,14 @@ var GenerationMediaMetadataSchema = external_exports.object({
15693
16596
  });
15694
16597
  var GenerationRunBodySchema = external_exports.object({
15695
16598
  videoEditMode: external_exports.literal("replacement").optional(),
16599
+ /**
16600
+ * How a lone input video is used: `edit` keeps its shape and lets the
16601
+ * model pick the length; `reference` takes the requested ratio and
16602
+ * duration. Absent names no task: the run keeps the clip's shape and
16603
+ * length, as clients without the choice send it, and the provider's
16604
+ * default task applies.
16605
+ */
16606
+ videoUse: external_exports.enum(VIDEO_USES).optional(),
15696
16607
  model: external_exports.string().trim().min(1),
15697
16608
  tier: external_exports.string().optional(),
15698
16609
  prompt: external_exports.string().trim().min(1).optional(),
@@ -15951,6 +16862,28 @@ var ImageInputSurchargeSchema = external_exports.object({
15951
16862
  includedInputCount: external_exports.number(),
15952
16863
  perOutputSecond: external_exports.boolean()
15953
16864
  });
16865
+ var ReferenceTokenSurchargeSchema = external_exports.object({
16866
+ creditCostPerTokenUnit: external_exports.number(),
16867
+ includedTokenCount: external_exports.number(),
16868
+ tokenUnit: external_exports.number(),
16869
+ imageShortSidePatches: external_exports.number(),
16870
+ imageMaximumAspectRatio: external_exports.number(),
16871
+ fallbackTokenCountPerImage: external_exports.number(),
16872
+ audioTokensPerSecond: external_exports.number(),
16873
+ frameCanvasShortSidePixelsByResolution: external_exports.record(external_exports.string(), external_exports.number()),
16874
+ video: external_exports.object({
16875
+ patchSizePixels: external_exports.number(),
16876
+ canvasShortSidePixelsByResolution: external_exports.record(external_exports.string(), external_exports.number()),
16877
+ latentFramesBySeconds: external_exports.array(external_exports.tuple([external_exports.number(), external_exports.number()])),
16878
+ fallbackAspectRatio: external_exports.number()
16879
+ }),
16880
+ /** Whether a wired start frame is sent to the provider, and so counted. */
16881
+ sendsStartFrame: external_exports.boolean(),
16882
+ /** Whether a wired end frame is sent to the provider, and so counted. */
16883
+ sendsEndFrame: external_exports.boolean(),
16884
+ /** The start frame's shape, not the requested ratio, shapes the frames' canvas. */
16885
+ startFrameSetsAspectRatio: external_exports.boolean()
16886
+ });
15954
16887
  var InputImageDimensionConstraintsResponseSchema = external_exports.object({
15955
16888
  minimumWidth: external_exports.number().int().nonnegative(),
15956
16889
  minimumHeight: external_exports.number().int().nonnegative(),
@@ -16116,6 +17049,8 @@ var ModelVariantResponseSchema = external_exports.object({
16116
17049
  defaultResolution: OutputResolutionSchema.nullable().optional(),
16117
17050
  featuredDescription: external_exports.string().nullable(),
16118
17051
  cost: ModelCostSchema.optional(),
17052
+ /** Team contract prices by setting; catalog cost remains the undiscounted basis. */
17053
+ customerPricing: CustomerModelPricingSchema.optional(),
16119
17054
  /** `cost` before the team's model discount; set only when the team has one. */
16120
17055
  listCost: ModelCostSchema.optional(),
16121
17056
  /** Selectable voices for audio variants, or null when none apply. */
@@ -16130,7 +17065,14 @@ var ModelVariantResponseSchema = external_exports.object({
16130
17065
  * Null when the price covers every image. Optional only so a client can
16131
17066
  * read a server that predates it.
16132
17067
  */
16133
- imageInputSurcharge: ImageInputSurchargeSchema.nullable().optional()
17068
+ imageInputSurcharge: ImageInputSurchargeSchema.nullable().optional(),
17069
+ /**
17070
+ * With billed input video, the fewest output lengths a run is charged:
17071
+ * the total is never under the output's price times this.
17072
+ */
17073
+ minimumBilledOutputMultiple: external_exports.number().optional(),
17074
+ /** Null when the price covers every reference. */
17075
+ referenceTokenSurcharge: ReferenceTokenSurchargeSchema.nullable().optional()
16134
17076
  });
16135
17077
  var ModelResponseSchema = external_exports.object({
16136
17078
  /** Whether wired audio can be played as recorded, rather than used only as a voice sample. */
@@ -16374,7 +17316,7 @@ var STYLE_TRANSFER_WITH_REPLACEMENTS = {
16374
17316
  var DittoInputSchema = external_exports.union([MultiDittoInputSchema, LegacyDittoInputSchema]).refine(hasDittoEdit, MISSING_DITTO_EDIT).refine(styleTransferHasNoReplacements, STYLE_TRANSFER_WITH_REPLACEMENTS);
16375
17317
  function requireReferenceOrAvatar(input, context2) {
16376
17318
  input.replacements?.forEach((target, index) => {
16377
- if (!target.referenceAssetId && !target.avatar)
17319
+ if (!target.referenceAssetId && !target.referenceUrl && !target.avatar)
16378
17320
  context2.addIssue({
16379
17321
  code: "custom",
16380
17322
  path: ["replacements", index],
@@ -16389,14 +17331,48 @@ var PrepareDittoBodySchema = external_exports.union([
16389
17331
  }),
16390
17332
  LegacyDittoInputSchema
16391
17333
  ]).refine(hasDittoEdit, MISSING_DITTO_EDIT).refine(styleTransferHasNoReplacements, STYLE_TRANSFER_WITH_REPLACEMENTS).superRefine(requireReferenceOrAvatar);
17334
+ var DittoTargetUrlRequestSchema = DittoTargetRequestSchema.extend({
17335
+ referenceUrl: HttpsMediaUrlSchema.optional().describe(
17336
+ "A public HTTPS URL of the replacement image (JPEG, PNG or WebP, up to 50 MB), in place of referenceAssetId. Melius downloads and checks it before pricing and returns it as referenceAssetId."
17337
+ )
17338
+ });
17339
+ var DittoTargetUrlRequestsSchema = external_exports.array(DittoTargetUrlRequestSchema).max(MAX_DITTO_TARGETS);
17340
+ var DittoSourceRequestFields = {
17341
+ sourceAssetId: DittoSettingsSchema.shape.sourceAssetId.optional().describe("The source video's asset id. Send this or sourceUrl."),
17342
+ sourceUrl: HttpsMediaUrlSchema.optional().describe(
17343
+ "A public HTTPS URL of the source video (MP4 or MOV, up to 100 MB), in place of sourceAssetId. Melius downloads and checks it before pricing and returns it as sourceAssetId."
17344
+ )
17345
+ };
17346
+ function requireOneSource(input, context2) {
17347
+ if (!input.sourceAssetId === !input.sourceUrl)
17348
+ context2.addIssue({
17349
+ code: "custom",
17350
+ path: ["sourceUrl"],
17351
+ message: "Send one of sourceAssetId or sourceUrl"
17352
+ });
17353
+ }
17354
+ function requireOneReferenceImage(input, context2) {
17355
+ input.replacements?.forEach((target, index) => {
17356
+ if (target.referenceUrl && (target.referenceAssetId || target.avatar))
17357
+ context2.addIssue({
17358
+ code: "custom",
17359
+ path: ["replacements", index],
17360
+ message: "Send referenceUrl without referenceAssetId or avatar"
17361
+ });
17362
+ });
17363
+ }
16392
17364
  var CreateDittoBodySchema = DittoSettingsSchema.extend({
16393
- replacements: DittoTargetRequestsSchema.default([]).describe(
17365
+ ...DittoSourceRequestFields,
17366
+ replacements: DittoTargetUrlRequestsSchema.default([]).describe(
16394
17367
  "What to replace, in order: each item names an image or an avatar. Leave it out for a style transfer or an edit described only in additionalInstructions."
16395
17368
  ),
16396
17369
  maxCredits: external_exports.number().finite().nonnegative().optional().describe(
16397
17370
  "The most credits this video may cost. A higher price answers 402 and starts nothing."
17371
+ ),
17372
+ webhook: RegisterRunWebhookBodySchema.optional().describe(
17373
+ "A signed HTTPS callback for when the video is ready or failed."
16398
17374
  )
16399
- }).refine(hasDittoEdit, MISSING_DITTO_EDIT).refine(styleTransferHasNoReplacements, STYLE_TRANSFER_WITH_REPLACEMENTS).superRefine(requireReferenceOrAvatar);
17375
+ }).refine(hasDittoEdit, MISSING_DITTO_EDIT).refine(styleTransferHasNoReplacements, STYLE_TRANSFER_WITH_REPLACEMENTS).superRefine(requireReferenceOrAvatar).superRefine(requireOneReferenceImage).superRefine(requireOneSource);
16400
17376
  function getDittoTargets(input) {
16401
17377
  if (input.replacements) return input.replacements;
16402
17378
  return [
@@ -16588,6 +17564,12 @@ var PresetAvatarSummarySchema = external_exports.object({
16588
17564
  * resized; absent from a server that predates it.
16589
17565
  */
16590
17566
  thumbnailUrl: external_exports.string().nullable().optional(),
17567
+ /**
17568
+ * The same picture at a card's width, for a tile wider than the
17569
+ * thumbnail. The counterpart of a team-made avatar's `cardUrl`; null and
17570
+ * absent on the same terms as `thumbnailUrl`.
17571
+ */
17572
+ cardUrl: external_exports.string().nullable().optional(),
16591
17573
  defaultVoice: PresetAvatarDefaultVoiceSchema.nullable(),
16592
17574
  /**
16593
17575
  * @deprecated Always empty. Melius curates avatars, not places — a team
@@ -16731,6 +17713,22 @@ var CastExploreVideoSchema = external_exports.object({
16731
17713
  * so a client reading from a server that predates featuring shows none.
16732
17714
  */
16733
17715
  featured: external_exports.boolean().optional(),
17716
+ /**
17717
+ * Staff feature it on its use case's row on the Cast home, kept apart
17718
+ * from `featured`. Optional so a server that predates it marks none.
17719
+ */
17720
+ homeRowFeatured: external_exports.boolean().optional(),
17721
+ /**
17722
+ * Staff feature it on its ad type's or genre's row on its use case's
17723
+ * page. Optional so a server that predates it marks none.
17724
+ */
17725
+ sectionFeatured: external_exports.boolean().optional(),
17726
+ /**
17727
+ * Staff picked it for business teams, and the reader's team is one: its
17728
+ * owner signs in with a company email, or staff set it so. Absent for
17729
+ * any other reader and from a server that predates business picks.
17730
+ */
17731
+ businessPick: external_exports.boolean().optional(),
16734
17732
  /**
16735
17733
  * The tab staff listed it under. Absent until they choose one, and from
16736
17734
  * a server that predates use cases.
@@ -16760,6 +17758,26 @@ var SearchCastExploreBodySchema = createCursorPaginationRequestSchema({
16760
17758
  * predates it lists every video, so a client keeps those with `featured`.
16761
17759
  */
16762
17760
  featured: external_exports.boolean().optional(),
17761
+ /**
17762
+ * True lists only the videos staff feature on their use case's row on the
17763
+ * Cast home, in staff order; pair it with `useCase` for one row. A server
17764
+ * that predates it lists every video, so a client keeps those with
17765
+ * `homeRowFeatured`.
17766
+ */
17767
+ homeRowFeatured: external_exports.boolean().optional(),
17768
+ /**
17769
+ * True lists only the videos staff feature on their ad type's or genre's
17770
+ * row on their use case's page, in staff order within each row; pair it
17771
+ * with `useCase` for one page. A server that predates it lists every
17772
+ * video, so a client keeps those with `sectionFeatured`.
17773
+ */
17774
+ sectionFeatured: external_exports.boolean().optional(),
17775
+ /**
17776
+ * True lists only the reader's business picks (`businessPick`); a reader
17777
+ * whose team is not a business team gets none. A server that predates it
17778
+ * lists every video, so a client keeps those with `businessPick`.
17779
+ */
17780
+ businessPicks: external_exports.boolean().optional(),
16763
17781
  /**
16764
17782
  * One tab's videos only. A server that predates it lists every video, so
16765
17783
  * a client keeps those whose `useCase` matches.
@@ -16779,6 +17797,35 @@ var SearchCastExploreBodySchema = createCursorPaginationRequestSchema({
16779
17797
  var CastExplorePageSchema = createPaginatedResponseSchema(
16780
17798
  CastExploreVideoSchema
16781
17799
  );
17800
+ var CastExampleSeriesSchema = external_exports.object({
17801
+ id: external_exports.string().uuid(),
17802
+ title: external_exports.string().min(1).max(200),
17803
+ /** Its row: a Microdrama genre is its look. */
17804
+ genre: CastGenreSchema,
17805
+ episodeCount: external_exports.number().int().nonnegative(),
17806
+ /** Episode 1's poster and a small silent copy to play on the card; null until it has one. */
17807
+ cover: external_exports.object({
17808
+ posterUrl: external_exports.string().url(),
17809
+ previewVideoUrl: external_exports.string().url().optional()
17810
+ }).nullable()
17811
+ });
17812
+ var CastExampleSeriesEpisodeSchema = external_exports.object({
17813
+ number: external_exports.number().int().positive(),
17814
+ /** The take it shows, which a reader's own series remixes Episode 1 from. */
17815
+ generationId: external_exports.string().uuid(),
17816
+ videoUrl: external_exports.string().url(),
17817
+ posterUrl: external_exports.string().url().optional(),
17818
+ /** Absent when the take does not record them; a reader draws 9:16. */
17819
+ width: external_exports.number().int().positive().optional(),
17820
+ height: external_exports.number().int().positive().optional()
17821
+ });
17822
+ var MAX_CAST_EXAMPLE_SERIES_EPISODES = 100;
17823
+ var CastExampleSeriesDetailSchema = CastExampleSeriesSchema.extend({
17824
+ episodes: external_exports.array(CastExampleSeriesEpisodeSchema).max(MAX_CAST_EXAMPLE_SERIES_EPISODES)
17825
+ });
17826
+ var CastExampleSeriesListSchema = external_exports.object({
17827
+ data: external_exports.array(CastExampleSeriesSchema)
17828
+ });
16782
17829
 
16783
17830
  // ../api-contract/src/cast/schema.ts
16784
17831
  var CAST_TREATMENT_IDS = ["self-filmed", "produced", "vlog"];
@@ -16800,6 +17847,7 @@ var CAST_ENGINE_MODES = [
16800
17847
  "boreal",
16801
17848
  "heygen",
16802
17849
  "seedance",
17850
+ "seedance-fast",
16803
17851
  "seedance-2",
16804
17852
  "kling-3-turbo",
16805
17853
  "omni-1.1-flash",
@@ -16896,6 +17944,10 @@ var CastGenerationAnalyticsWriteSchema = CastGenerationAnalyticsSchema.omit({ ag
16896
17944
  partCount: external_exports.number().int().positive().max(STITCH_MAX_CLIPS).optional()
16897
17945
  });
16898
17946
  var CastGenerationOperationSchema = external_exports.enum(["script", "replacement"]);
17947
+ var CastSourceSessionSchema = external_exports.object({
17948
+ rootWorkId: external_exports.string().uuid(),
17949
+ authorId: external_exports.string().uuid().optional()
17950
+ });
16899
17951
  var CastGenerationConfigSchema = external_exports.object({
16900
17952
  operation: CastGenerationOperationSchema.optional(),
16901
17953
  replacement: DittoInputSchema.optional(),
@@ -16903,6 +17955,19 @@ var CastGenerationConfigSchema = external_exports.object({
16903
17955
  external_exports.array(CastAuthoredSectionSchema)
16904
17956
  ).optional(),
16905
17957
  requestedSeconds: external_exports.number().positive().optional(),
17958
+ /**
17959
+ * The nodes of this generation's graph that draw a picture of its
17960
+ * series' places and looks (`places-and-looks-microdramas`): once the run
17961
+ * finishes, each one's picture is kept on its place or look, so every
17962
+ * later episode films the same picture.
17963
+ */
17964
+ scenePictures: external_exports.array(
17965
+ external_exports.object({
17966
+ nodeId: external_exports.string().min(1).max(200),
17967
+ kind: external_exports.enum(["place", "look"]),
17968
+ id: external_exports.string().uuid()
17969
+ })
17970
+ ).max(60).optional().catch(void 0),
16906
17971
  creationSettings: CastCreationSettingsSchema.optional(),
16907
17972
  // Attribution must not reject an otherwise valid generation record.
16908
17973
  scriptTemplate: CastTemplateReferenceSchema.optional().catch(void 0),
@@ -17123,7 +18188,9 @@ var CastGenerationConfigSchema = external_exports.object({
17123
18188
  * result — for a generation they have already been charged for. A
17124
18189
  * telemetry field must never be able to refuse a record.
17125
18190
  */
17126
- analytics: CastGenerationAnalyticsSchema.optional().catch(void 0)
18191
+ analytics: CastGenerationAnalyticsSchema.optional().catch(void 0),
18192
+ /** Server-written on a derived take; see `CastSourceSessionSchema`. */
18193
+ sourceSession: CastSourceSessionSchema.optional().catch(void 0)
17127
18194
  }).passthrough();
17128
18195
  var SharedCastConfigSchema = CastGenerationConfigSchema.pick({
17129
18196
  autoVoice: true,
@@ -17137,6 +18204,11 @@ var SharedCastConfigSchema = CastGenerationConfigSchema.pick({
17137
18204
  engine: true,
17138
18205
  resolution: true,
17139
18206
  subtitles: true
18207
+ }).extend({
18208
+ // A brand kit is the source team's; a remix wears one of its own.
18209
+ creationSettings: CastCreationSettingsSchema.omit({
18210
+ brandKit: true
18211
+ }).optional()
17140
18212
  }).strip();
17141
18213
  var SharedCastGlobalSelectionSchema = external_exports.object({
17142
18214
  kind: external_exports.literal("global"),
@@ -17241,7 +18313,17 @@ var CastGenerationCollectionSchema = external_exports.object({
17241
18313
  /** The episode this video is a take of, what another take sends back; null outside a series. */
17242
18314
  episodeId: external_exports.string().uuid().nullable(),
17243
18315
  episodeNumber: external_exports.number().int().positive().nullable(),
17244
- episodeCount: external_exports.number().int().nonnegative()
18316
+ episodeCount: external_exports.number().int().nonnegative(),
18317
+ /**
18318
+ * The take a member pinned as the one its episode shows; null while none
18319
+ * is, when the newest take that finished shows. Absent outside a series
18320
+ * and from a server built before pins.
18321
+ */
18322
+ pinnedTakeId: external_exports.string().uuid().nullable().optional()
18323
+ });
18324
+ var CastStudioSessionSchema = external_exports.object({
18325
+ key: external_exports.string().min(1).max(200),
18326
+ takeCount: external_exports.number().int().positive()
17245
18327
  });
17246
18328
  var CastGenerationResponseSchema = external_exports.object({
17247
18329
  id: external_exports.string().uuid(),
@@ -17335,11 +18417,31 @@ var CastGenerationResponseSchema = external_exports.object({
17335
18417
  addSubtitles: CastAddSubtitlesSchema.nullable().optional(),
17336
18418
  /** Set on a take that is another with subtitles added. Null otherwise. */
17337
18419
  subtitledFrom: CastSubtitledFromSchema.nullable().optional(),
18420
+ /**
18421
+ * Whether the reader can trim this take into a take of its own: true on
18422
+ * their own finished take; false on one being made, a replacement or a
18423
+ * teammate's. Absent for a client built before this field.
18424
+ */
18425
+ canTrim: external_exports.boolean().optional(),
18426
+ /** Set on a take that is a trim of another. Null otherwise; absent for an older client. */
18427
+ trimmedFrom: CastTrimmedFromSchema.nullable().optional(),
17338
18428
  /**
17339
18429
  * The collection this video is in; absent for a video in none, and from a
17340
18430
  * server built before collections.
17341
18431
  */
17342
- collection: CastGenerationCollectionSchema.nullable().optional()
18432
+ collection: CastGenerationCollectionSchema.nullable().optional(),
18433
+ /**
18434
+ * A one-off Microdrama's own collection, which keeps its places and looks
18435
+ * and which another take of it files under; absent for any other video
18436
+ * and from a server built before one-offs kept them.
18437
+ */
18438
+ oneOffId: external_exports.string().uuid().optional(),
18439
+ /**
18440
+ * The studio session the take was made in, on a History read: its key and
18441
+ * how many takes the read lists in it, loaded or not. Null for a take in
18442
+ * none; absent from a server built before sessions and on other reads.
18443
+ */
18444
+ session: CastStudioSessionSchema.nullable().optional()
17343
18445
  });
17344
18446
  var CreateCastGenerationResponseSchema = CastGenerationResponseSchema.extend({
17345
18447
  /** Ownership acknowledgment, not a guarantee of delivery to PostHog. */
@@ -17357,6 +18459,11 @@ var CastGenerationPageSchema = external_exports.object({
17357
18459
  var SearchCastGenerationsBodySchema = createCursorPaginationRequestSchema({
17358
18460
  defaultPageSize: 24
17359
18461
  }).extend({
18462
+ /**
18463
+ * File each row in its studio session (`session` on each row), which
18464
+ * costs the read a grouped query per page. Unset, rows carry none.
18465
+ */
18466
+ includeSessions: external_exports.boolean().optional(),
17360
18467
  filters: external_exports.object({
17361
18468
  scope: CastHistoryScopeSchema.default("mine"),
17362
18469
  generationId: external_exports.string().uuid().optional(),
@@ -17379,7 +18486,12 @@ var SearchCastGenerationsBodySchema = createCursorPaginationRequestSchema({
17379
18486
  */
17380
18487
  inCollection: external_exports.boolean().optional(),
17381
18488
  /** Only this collection's videos: every take of a series' episodes. */
17382
- collectionId: external_exports.string().uuid().optional()
18489
+ collectionId: external_exports.string().uuid().optional(),
18490
+ /**
18491
+ * Only this studio session's takes (a row's `session.key`),
18492
+ * all on one page, newest first.
18493
+ */
18494
+ session: external_exports.string().min(1).max(200).optional()
17383
18495
  }).default({})
17384
18496
  });
17385
18497
  var SearchCastGenerationsResponseSchema = createPaginatedResponseSchema(CastGenerationResponseSchema);
@@ -17449,7 +18561,9 @@ var SearchCastCollectionsBodySchema = createCursorPaginationRequestSchema({
17449
18561
  }).extend({
17450
18562
  filters: external_exports.object({
17451
18563
  /** Only collections of this kind; absent lists every kind. */
17452
- kind: CastCollectionKindSchema.optional()
18564
+ kind: CastCollectionKindSchema.optional(),
18565
+ /** `mine` lists the collections the reader started or made a take in; absent lists the team's. */
18566
+ scope: CastHistoryScopeSchema.optional()
17453
18567
  }).default({})
17454
18568
  });
17455
18569
  var SearchCastCollectionsResponseSchema = createPaginatedResponseSchema(CastCollectionListItemSchema);
@@ -17458,6 +18572,13 @@ var CastCollectionEpisodeSchema = external_exports.object({
17458
18572
  number: external_exports.number().int().positive(),
17459
18573
  take: CastGenerationResponseSchema
17460
18574
  });
18575
+ var PinCastCollectionEpisodeTakeBodySchema = external_exports.object({
18576
+ takeId: external_exports.string().uuid().nullable()
18577
+ });
18578
+ var PinCastCollectionEpisodeTakeResponseSchema = external_exports.object({
18579
+ episodeId: external_exports.string().uuid(),
18580
+ pinnedTakeId: external_exports.string().uuid().nullable()
18581
+ });
17461
18582
  var SearchCastCollectionEpisodesBodySchema = createCursorPaginationRequestSchema({ defaultPageSize: 24 });
17462
18583
  var SearchCastCollectionEpisodesResponseSchema = createPaginatedResponseSchema(CastCollectionEpisodeSchema);
17463
18584
  var DraftCastCollectionEpisodeBodySchema = external_exports.object({
@@ -17466,6 +18587,18 @@ var DraftCastCollectionEpisodeBodySchema = external_exports.object({
17466
18587
  seconds: CastDraftSecondsSchema.optional(),
17467
18588
  /** The cast's names, lead first: every line is said by one of them. */
17468
18589
  speakers: CastScriptSpeakersSchema,
18590
+ /**
18591
+ * Who each speaker is (`places-and-looks-microdramas`), so the writer can name
18592
+ * the looks the series keeps for them. In `speakers` order.
18593
+ */
18594
+ cast: external_exports.array(
18595
+ external_exports.object({
18596
+ name: external_exports.string().trim().min(1).max(200),
18597
+ customAvatarId: external_exports.string().uuid().optional(),
18598
+ presetAvatarId: external_exports.string().uuid().optional(),
18599
+ elementId: external_exports.string().uuid().optional()
18600
+ })
18601
+ ).max(8).optional(),
17469
18602
  /**
17470
18603
  * The episode to write: one already made, written again from the episodes
17471
18604
  * before it, or absent (or past the last) for the series' next episode.
@@ -17528,6 +18661,163 @@ var CastTemplatePageSchema = createPaginatedResponseSchema(
17528
18661
  })
17529
18662
  );
17530
18663
 
18664
+ // ../api-contract/src/cast/series-story.ts
18665
+ var MAX_CAST_SERIES_NAME_LENGTH = 120;
18666
+ var MAX_CAST_SERIES_DESCRIPTION_LENGTH = 1e3;
18667
+ var CastSeriesPersonSchema = external_exports.object({
18668
+ customAvatarId: external_exports.string().uuid().optional(),
18669
+ presetAvatarId: external_exports.string().uuid().optional(),
18670
+ elementId: external_exports.string().uuid().optional()
18671
+ }).refine(
18672
+ (person) => [
18673
+ person.customAvatarId,
18674
+ person.presetAvatarId,
18675
+ person.elementId
18676
+ ].filter(Boolean).length === 1,
18677
+ { message: "Name the person by exactly one id" }
18678
+ );
18679
+ var NameSchema = external_exports.string().trim().min(1).max(MAX_CAST_SERIES_NAME_LENGTH);
18680
+ var DescriptionSchema = external_exports.string().trim().min(1).max(MAX_CAST_SERIES_DESCRIPTION_LENGTH);
18681
+ var CastSeriesPlaceSchema = external_exports.object({
18682
+ id: external_exports.string().uuid(),
18683
+ name: external_exports.string(),
18684
+ /** What the place's picture is drawn from. */
18685
+ description: external_exports.string(),
18686
+ /**
18687
+ * Proposed by a draft (Write it for me, the scene reader) and kept once an
18688
+ * episode that names it starts, or a member edits it. The writers are
18689
+ * shown kept places and looks only.
18690
+ */
18691
+ pending: external_exports.boolean(),
18692
+ /** Null until an episode draws it; every later episode films this picture. */
18693
+ pictureAssetId: external_exports.string().uuid().nullable(),
18694
+ pictureUrl: external_exports.string().nullable(),
18695
+ /**
18696
+ * The picture at a tile's size, which every surface but the full-screen
18697
+ * viewer draws; the original where no smaller one resolves. Absent from a
18698
+ * server older than it.
18699
+ */
18700
+ previewUrl: external_exports.string().nullable().optional(),
18701
+ /**
18702
+ * Its picture is being drawn on the server, which keeps it on the place
18703
+ * as it lands. Absent while nothing is drawn, and from an older server.
18704
+ */
18705
+ drawing: external_exports.literal(true).optional(),
18706
+ createdAt: external_exports.string(),
18707
+ updatedAt: external_exports.string()
18708
+ });
18709
+ var CastSeriesLookSchema = external_exports.object({
18710
+ id: external_exports.string().uuid(),
18711
+ person: CastSeriesPersonSchema,
18712
+ name: external_exports.string(),
18713
+ /** What changes from the look it starts from, or from the character sheet. */
18714
+ description: external_exports.string(),
18715
+ startsFromLookId: external_exports.string().uuid().nullable(),
18716
+ /** A look for the past, at the age its description gives. */
18717
+ flashback: external_exports.boolean(),
18718
+ /**
18719
+ * Proposed by a draft (Write it for me, the scene reader) and kept once an
18720
+ * episode that names it starts, or a member edits it. The writers are
18721
+ * shown kept places and looks only.
18722
+ */
18723
+ pending: external_exports.boolean(),
18724
+ pictureAssetId: external_exports.string().uuid().nullable(),
18725
+ pictureUrl: external_exports.string().nullable(),
18726
+ /**
18727
+ * The picture at a tile's size, which every surface but the full-screen
18728
+ * viewer draws; the original where no smaller one resolves. Absent from a
18729
+ * server older than it.
18730
+ */
18731
+ previewUrl: external_exports.string().nullable().optional(),
18732
+ /** As a place's: its picture is being drawn on the server. */
18733
+ drawing: external_exports.literal(true).optional(),
18734
+ createdAt: external_exports.string(),
18735
+ updatedAt: external_exports.string()
18736
+ });
18737
+ var CastSeriesCarriedLookSchema = external_exports.object({
18738
+ person: CastSeriesPersonSchema,
18739
+ lookId: external_exports.string().uuid()
18740
+ });
18741
+ var CastSeriesStorySchema = external_exports.object({
18742
+ places: external_exports.array(CastSeriesPlaceSchema),
18743
+ looks: external_exports.array(CastSeriesLookSchema),
18744
+ /** As the newest episode left everyone; empty before the first. */
18745
+ carried: external_exports.array(CastSeriesCarriedLookSchema),
18746
+ /** The newest episode's last place, where the next one picks up. */
18747
+ lastPlaceId: external_exports.string().uuid().nullable()
18748
+ });
18749
+ var PlacePictureSchema = external_exports.string().uuid();
18750
+ var CreateCastSeriesPlaceBodySchema = external_exports.object({
18751
+ name: NameSchema,
18752
+ description: DescriptionSchema,
18753
+ /** Absent, the picture is drawn the first time an episode films the place. */
18754
+ pictureAssetId: PlacePictureSchema.optional(),
18755
+ /**
18756
+ * A draft's proposal (Write it for me, the scene reader), kept once an
18757
+ * episode that names it starts. A create naming a pending row of the same
18758
+ * name takes that row instead; without this it is kept at once.
18759
+ */
18760
+ pending: external_exports.literal(true).optional()
18761
+ });
18762
+ var UpdateCastSeriesPlaceBodySchema = external_exports.object({
18763
+ name: NameSchema.optional(),
18764
+ description: DescriptionSchema.optional(),
18765
+ pictureAssetId: PlacePictureSchema.optional()
18766
+ }).refine(
18767
+ (body) => body.name !== void 0 || body.description !== void 0 || body.pictureAssetId !== void 0,
18768
+ {
18769
+ message: "Change the name, the description or the picture"
18770
+ }
18771
+ );
18772
+ var CreateCastSeriesLookBodySchema = external_exports.object({
18773
+ person: CastSeriesPersonSchema,
18774
+ name: NameSchema,
18775
+ description: DescriptionSchema,
18776
+ startsFromLookId: external_exports.string().uuid().optional(),
18777
+ flashback: external_exports.boolean().optional(),
18778
+ /** Absent, the picture is drawn the first time an episode films the look. */
18779
+ pictureAssetId: PlacePictureSchema.optional(),
18780
+ /**
18781
+ * A draft's proposal (Write it for me, the scene reader), kept once an
18782
+ * episode that names it starts. A create naming a pending row of the same
18783
+ * name takes that row instead; without this it is kept at once.
18784
+ */
18785
+ pending: external_exports.literal(true).optional()
18786
+ });
18787
+ var UpdateCastSeriesLookBodySchema = external_exports.object({
18788
+ name: NameSchema.optional(),
18789
+ description: DescriptionSchema.optional(),
18790
+ /** Kept through a new description, which on its own lets the picture go. */
18791
+ pictureAssetId: PlacePictureSchema.optional()
18792
+ }).refine(
18793
+ (body) => body.name !== void 0 || body.description !== void 0 || body.pictureAssetId !== void 0,
18794
+ { message: "Change the name, the description or the picture" }
18795
+ );
18796
+ var MAX_CAST_SERIES_PICTURE_REFERENCES = 10;
18797
+ var DrawCastSeriesPictureBodySchema = external_exports.object({
18798
+ /** What the picture is drawn from: a place's description, a look's brief. */
18799
+ prompt: external_exports.string().trim().min(1).max(4e3),
18800
+ /** A place's photos, or the sheet or picture a look is drawn from: team images. */
18801
+ referenceAssetIds: external_exports.array(external_exports.string().uuid()).max(MAX_CAST_SERIES_PICTURE_REFERENCES).optional(),
18802
+ /**
18803
+ * Create or Redraw: the new picture replaces the one the row has. Without
18804
+ * it a picture kept first stays, and this one is dropped.
18805
+ */
18806
+ replacesPicture: external_exports.literal(true).optional()
18807
+ });
18808
+ var DrawCastSeriesPictureResponseSchema = external_exports.object({
18809
+ /** The run drawing it; null while another press's drawing is still starting. */
18810
+ bulkNodeRunId: external_exports.string().uuid().nullable()
18811
+ });
18812
+ var CreateCastOneOffCollectionBodySchema = external_exports.object({
18813
+ /** The style the one-off is filmed in. */
18814
+ videoStyleId: CastMicrodramaStyleIdSchema
18815
+ });
18816
+ var CreateCastOneOffCollectionResponseSchema = external_exports.object({
18817
+ /** What the series' places, looks, story and scene routes take, and Generate files under. */
18818
+ collectionId: external_exports.string().uuid()
18819
+ });
18820
+
17531
18821
  // ../api-contract/src/custom-context/schema.ts
17532
18822
  var MAX_CUSTOM_CONTEXT_NAME_LENGTH = 80;
17533
18823
  var MAX_CUSTOM_CONTEXT_INSTRUCTIONS_LENGTH = 4e3;
@@ -18200,11 +19490,351 @@ var SearchElementsBodySchema = createCursorPaginationRequestSchema({
18200
19490
  createdByMe: external_exports.boolean().optional(),
18201
19491
  /** Latest live version belongs to the requesting member and is pending or needs review. */
18202
19492
  reviewNotificationsOnly: external_exports.boolean().optional(),
19493
+ /** Only elements with a published (default) version, the ones a run can use. */
19494
+ publishedOnly: external_exports.boolean().optional(),
18203
19495
  /** Newest first by default, the order every older caller gets. */
18204
19496
  sort: ElementLibrarySortSchema.optional()
18205
19497
  });
18206
19498
  var SearchElementsResponseSchema = createPaginatedResponseSchema(ElementSummarySchema);
18207
19499
 
19500
+ // ../api-contract/src/motion-node/schema.ts
19501
+ var MOTION_ARTIFACT_LIMITS = {
19502
+ maxTweaks: 8,
19503
+ maxTweakLabelLength: 24,
19504
+ maxTextTweakLength: 200,
19505
+ minOptions: 2,
19506
+ maxOptions: 8,
19507
+ /** Wired inputs plus files the agent made for the artifact. */
19508
+ maxSlots: 16,
19509
+ maxTitleLength: 80,
19510
+ /** Keeps a slider's arithmetic exact enough that clamping never overflows or throws. */
19511
+ maxSliderMagnitude: 1e9,
19512
+ maxSliderStops: 1e5,
19513
+ /** A render is one sandbox command, capped at 10 minutes; 30 s at the slowest measured render rate uses half of it. */
19514
+ maxDurationSeconds: 30,
19515
+ maxFrameSide: 1920,
19516
+ maxFramePixels: 1920 * 1080,
19517
+ minFrameSide: 16,
19518
+ maxHtmlBytes: 10 * 1024 * 1024,
19519
+ maxProjectBytes: 50 * 1024 * 1024
19520
+ };
19521
+ var MOTION_PLAYER_MEDIA_URL_LIFETIME_SECONDS = 60 * 60;
19522
+ var MOTION_PLAYER_MEDIA_URL_RENEW_BEFORE_SECONDS = 10 * 60;
19523
+ var IDENTIFIER = /^[a-z][a-zA-Z0-9_]{0,31}$/;
19524
+ var identifier = (what) => external_exports.string().regex(
19525
+ IDENTIFIER,
19526
+ `${what} must start with a lowercase letter and use up to 32 letters, digits and underscores`
19527
+ );
19528
+ var label = external_exports.string().trim().min(1).max(MOTION_ARTIFACT_LIMITS.maxTweakLabelLength);
19529
+ var finite = external_exports.number().finite();
19530
+ function object(shape, unknownKeys) {
19531
+ return unknownKeys === "strict" ? external_exports.object(shape).strict() : external_exports.object(shape).strip();
19532
+ }
19533
+ function buildSchemas(unknownKeys) {
19534
+ const options = external_exports.array(object({ id: identifier("An option id"), label }, unknownKeys)).min(MOTION_ARTIFACT_LIMITS.minOptions).max(MOTION_ARTIFACT_LIMITS.maxOptions).refine(
19535
+ (list) => new Set(list.map((option) => option.id)).size === list.length,
19536
+ "Option ids must be unique"
19537
+ );
19538
+ const tweakBase = { id: identifier("A tweak id"), label };
19539
+ const sliderBound = finite.min(-MOTION_ARTIFACT_LIMITS.maxSliderMagnitude).max(MOTION_ARTIFACT_LIMITS.maxSliderMagnitude);
19540
+ const tweak = external_exports.discriminatedUnion("type", [
19541
+ object(
19542
+ {
19543
+ ...tweakBase,
19544
+ type: external_exports.literal("slider"),
19545
+ min: sliderBound,
19546
+ max: sliderBound,
19547
+ step: finite.positive(),
19548
+ unit: external_exports.string().trim().min(1).max(8).optional(),
19549
+ default: finite
19550
+ },
19551
+ unknownKeys
19552
+ ),
19553
+ object(
19554
+ {
19555
+ ...tweakBase,
19556
+ type: external_exports.literal("toggle"),
19557
+ default: external_exports.boolean()
19558
+ },
19559
+ unknownKeys
19560
+ ),
19561
+ object(
19562
+ {
19563
+ ...tweakBase,
19564
+ type: external_exports.literal("text"),
19565
+ maxLength: external_exports.number().int().min(1).max(MOTION_ARTIFACT_LIMITS.maxTextTweakLength),
19566
+ default: external_exports.string()
19567
+ },
19568
+ unknownKeys
19569
+ ),
19570
+ object(
19571
+ {
19572
+ ...tweakBase,
19573
+ type: external_exports.literal("radio"),
19574
+ options,
19575
+ default: external_exports.string()
19576
+ },
19577
+ unknownKeys
19578
+ ),
19579
+ object(
19580
+ {
19581
+ ...tweakBase,
19582
+ type: external_exports.literal("multiSelect"),
19583
+ options,
19584
+ default: external_exports.array(external_exports.string())
19585
+ },
19586
+ unknownKeys
19587
+ ),
19588
+ // A press with no value, for an action during playback; a render shows the artifact unpressed.
19589
+ object({ ...tweakBase, type: external_exports.literal("button") }, unknownKeys)
19590
+ ]).superRefine((tweak2, context2) => {
19591
+ const fail = (message) => context2.addIssue({ code: external_exports.ZodIssueCode.custom, message });
19592
+ switch (tweak2.type) {
19593
+ case "slider":
19594
+ if (tweak2.min >= tweak2.max) {
19595
+ fail("A slider's minimum must be below its maximum");
19596
+ } else if (tweak2.default < tweak2.min || tweak2.default > tweak2.max) {
19597
+ fail("A slider's default must be within its range");
19598
+ } else if ((tweak2.max - tweak2.min) / tweak2.step > MOTION_ARTIFACT_LIMITS.maxSliderStops) {
19599
+ fail(
19600
+ `A slider has at most ${MOTION_ARTIFACT_LIMITS.maxSliderStops} steps`
19601
+ );
19602
+ }
19603
+ return;
19604
+ case "text":
19605
+ if (/[\r\n]/.test(tweak2.default)) {
19606
+ fail("A text tweak holds one line");
19607
+ }
19608
+ if (Array.from(tweak2.default).length > tweak2.maxLength) {
19609
+ fail(
19610
+ "A text tweak's default must fit its maximum length"
19611
+ );
19612
+ }
19613
+ return;
19614
+ case "radio":
19615
+ case "multiSelect": {
19616
+ const ids = new Set(
19617
+ tweak2.options.map((option) => option.id)
19618
+ );
19619
+ const defaults = tweak2.type === "radio" ? [tweak2.default] : tweak2.default;
19620
+ if (!defaults.every((id2) => ids.has(id2))) {
19621
+ fail("A default must be one of the options");
19622
+ }
19623
+ if (new Set(defaults).size !== defaults.length) {
19624
+ fail("A default names each option once");
19625
+ }
19626
+ return;
19627
+ }
19628
+ case "toggle":
19629
+ case "button":
19630
+ return;
19631
+ }
19632
+ });
19633
+ const slotId = identifier("A slot id");
19634
+ const slot = external_exports.discriminatedUnion("kind", [
19635
+ object({ id: slotId, kind: external_exports.literal("image") }, unknownKeys),
19636
+ object({ id: slotId, kind: external_exports.literal("text") }, unknownKeys),
19637
+ object(
19638
+ { id: slotId, kind: external_exports.literal("video"), heard: external_exports.boolean() },
19639
+ unknownKeys
19640
+ ),
19641
+ object(
19642
+ { id: slotId, kind: external_exports.literal("audio"), heard: external_exports.boolean() },
19643
+ unknownKeys
19644
+ )
19645
+ ]);
19646
+ const frameSide = external_exports.number().int().min(MOTION_ARTIFACT_LIMITS.minFrameSide).max(MOTION_ARTIFACT_LIMITS.maxFrameSide);
19647
+ const manifest = object(
19648
+ {
19649
+ title: external_exports.string().trim().min(1).max(MOTION_ARTIFACT_LIMITS.maxTitleLength),
19650
+ width: frameSide,
19651
+ height: frameSide,
19652
+ /** Absent for an interactive artifact, which renders a still. */
19653
+ durationSeconds: finite.positive().max(MOTION_ARTIFACT_LIMITS.maxDurationSeconds).optional(),
19654
+ slots: external_exports.array(slot).max(MOTION_ARTIFACT_LIMITS.maxSlots),
19655
+ tweaks: external_exports.array(tweak).max(MOTION_ARTIFACT_LIMITS.maxTweaks)
19656
+ },
19657
+ unknownKeys
19658
+ ).superRefine((manifest2, context2) => {
19659
+ const fail = (message) => context2.addIssue({ code: external_exports.ZodIssueCode.custom, message });
19660
+ if (manifest2.width * manifest2.height > MOTION_ARTIFACT_LIMITS.maxFramePixels) {
19661
+ fail(
19662
+ `The frame can hold at most ${MOTION_ARTIFACT_LIMITS.maxFrameSide} \xD7 ${MOTION_ARTIFACT_LIMITS.maxFramePixels / MOTION_ARTIFACT_LIMITS.maxFrameSide} pixels`
19663
+ );
19664
+ }
19665
+ const tweakIds = manifest2.tweaks.map((tweak2) => tweak2.id);
19666
+ if (new Set(tweakIds).size !== tweakIds.length) {
19667
+ fail("Tweak ids must be unique");
19668
+ }
19669
+ const slotIds = manifest2.slots.map((slot2) => slot2.id);
19670
+ if (new Set(slotIds).size !== slotIds.length) {
19671
+ fail("Slot ids must be unique");
19672
+ }
19673
+ });
19674
+ return { tweak, slot, manifest };
19675
+ }
19676
+ var strictSchemas = buildSchemas("strict");
19677
+ var MotionTweakSchema = strictSchemas.tweak;
19678
+ var MotionTweakValueSchema = external_exports.union([
19679
+ finite,
19680
+ external_exports.boolean(),
19681
+ // Counted in characters, as a text tweak's maximum length is.
19682
+ external_exports.string().refine(
19683
+ (text) => Array.from(text).length <= MOTION_ARTIFACT_LIMITS.maxTextTweakLength,
19684
+ `A text value holds at most ${MOTION_ARTIFACT_LIMITS.maxTextTweakLength} characters`
19685
+ ),
19686
+ external_exports.array(identifier("An option id")).max(MOTION_ARTIFACT_LIMITS.maxOptions).readonly()
19687
+ ]);
19688
+ var MotionTweakValuesSchema = external_exports.record(identifier("A tweak id"), MotionTweakValueSchema).refine(
19689
+ (values) => Object.keys(values).length <= MOTION_ARTIFACT_LIMITS.maxTweaks,
19690
+ `At most ${MOTION_ARTIFACT_LIMITS.maxTweaks} tweak values`
19691
+ );
19692
+ var MotionInputSlotSchema = strictSchemas.slot;
19693
+ var MotionArtifactManifestSchema = strictSchemas.manifest;
19694
+ var readSchemas = buildSchemas("strip");
19695
+ var MotionArtifactManifestReadSchema = readSchemas.manifest;
19696
+ var MotionTweakReadSchema = readSchemas.tweak;
19697
+ var MOTION_NODE_RENDER_KINDS = ["first", "update"];
19698
+ var MOTION_NODE_RENDER_STATUSES = [
19699
+ "queued",
19700
+ "running",
19701
+ "finished",
19702
+ "failed"
19703
+ ];
19704
+ var MotionNodeRenderSchema = external_exports.object({
19705
+ renderId: external_exports.string().uuid(),
19706
+ nodeVersionId: external_exports.string().uuid(),
19707
+ /** `first` at the end of a run, `update` for "Update output". */
19708
+ kind: external_exports.enum(MOTION_NODE_RENDER_KINDS),
19709
+ status: external_exports.enum(MOTION_NODE_RENDER_STATUSES),
19710
+ tweakValues: external_exports.record(external_exports.string(), MotionTweakValueSchema),
19711
+ /** The MP4 or PNG once finished. */
19712
+ outputAssetId: external_exports.string().uuid().nullable(),
19713
+ /** Why it failed, in words for the member. */
19714
+ errorMessage: external_exports.string().nullable(),
19715
+ createdAt: external_exports.string().datetime(),
19716
+ finishedAt: external_exports.string().datetime().nullable()
19717
+ });
19718
+ var MotionNodePathParamsSchema = external_exports.object({
19719
+ canvasId: external_exports.string().uuid(),
19720
+ nodeId: external_exports.string().uuid()
19721
+ });
19722
+ var UpdateMotionNodeOutputBodySchema = external_exports.object({
19723
+ /** The version to render; its artifact is rendered as it was stored. */
19724
+ nodeVersionId: external_exports.string().uuid(),
19725
+ /** The values to render with; each is fitted to its tweak, and a missing one takes its default. */
19726
+ tweakValues: external_exports.record(external_exports.string(), external_exports.unknown())
19727
+ });
19728
+ var MotionNodeVersionQuerySchema = external_exports.object({
19729
+ nodeVersionId: external_exports.string().uuid()
19730
+ });
19731
+ var MotionNodeOutputResponseSchema = external_exports.object({
19732
+ /** The render that is the version's output now, if any. */
19733
+ output: MotionNodeRenderSchema.nullable(),
19734
+ /** The version's newest render, which may still be queued or running, or have failed. */
19735
+ latest: MotionNodeRenderSchema.nullable()
19736
+ });
19737
+ var MotionPlaybackInputSchema = external_exports.discriminatedUnion("kind", [
19738
+ external_exports.object({
19739
+ kind: external_exports.literal("video"),
19740
+ url: external_exports.string().url(),
19741
+ heard: external_exports.boolean(),
19742
+ width: external_exports.number().int().nonnegative(),
19743
+ height: external_exports.number().int().nonnegative(),
19744
+ durationSeconds: external_exports.number().nonnegative()
19745
+ }),
19746
+ external_exports.object({
19747
+ kind: external_exports.literal("audio"),
19748
+ url: external_exports.string().url(),
19749
+ heard: external_exports.boolean(),
19750
+ durationSeconds: external_exports.number().nonnegative()
19751
+ }),
19752
+ external_exports.object({
19753
+ kind: external_exports.literal("image"),
19754
+ url: external_exports.string().url(),
19755
+ width: external_exports.number().int().nonnegative(),
19756
+ height: external_exports.number().int().nonnegative()
19757
+ }),
19758
+ external_exports.object({ kind: external_exports.literal("text"), text: external_exports.string() })
19759
+ ]);
19760
+ var MotionNodeSlotSourceSchema = external_exports.object({
19761
+ nodeId: external_exports.string().uuid(),
19762
+ /** Null for text read from a node's canvas state that no saved version holds. */
19763
+ nodeVersionId: external_exports.string().uuid().nullable()
19764
+ });
19765
+ var MotionNodePlayerResponseSchema = external_exports.object({
19766
+ /** The packaged `index.html` on the untrusted-content domain, on a short-lived URL. */
19767
+ artifactUrl: external_exports.string().url().nullable(),
19768
+ manifest: MotionArtifactManifestReadSchema,
19769
+ /** The still captured at the end of the run, shown while the artifact is not playing. */
19770
+ posterUrl: external_exports.string().url().nullable(),
19771
+ /** By slot ID. A slot whose file is gone is left out. */
19772
+ inputs: external_exports.record(external_exports.string(), MotionPlaybackInputSchema),
19773
+ /**
19774
+ * Each node the run read and the version it read, once each, so the node
19775
+ * can say its wired inputs have changed since the run.
19776
+ */
19777
+ sources: external_exports.array(MotionNodeSlotSourceSchema),
19778
+ /** When the first of the URLs above stops working; fetch again before then. */
19779
+ expiresAt: external_exports.string().datetime()
19780
+ });
19781
+ var MOTION_NODE_RUN_STATUSES = [
19782
+ "running",
19783
+ "finished",
19784
+ "failed",
19785
+ "stopped"
19786
+ ];
19787
+ var MOTION_NODE_RUN_MAX_STEPS = 20;
19788
+ var MotionNodeRunStepSchema = external_exports.object({
19789
+ label: external_exports.string(),
19790
+ at: external_exports.string().datetime()
19791
+ });
19792
+ var MotionNodeRunProgressSchema = external_exports.object({
19793
+ status: external_exports.enum(MOTION_NODE_RUN_STATUSES),
19794
+ /** Oldest first, the newest `MOTION_NODE_RUN_MAX_STEPS`. */
19795
+ steps: external_exports.array(MotionNodeRunStepSchema).max(MOTION_NODE_RUN_MAX_STEPS),
19796
+ /** The agent's closing summary, once it has replied. */
19797
+ summary: external_exports.string().nullable(),
19798
+ /** Why it failed, in words for the member. */
19799
+ failureMessage: external_exports.string().nullable(),
19800
+ /** The model ID the run used. */
19801
+ model: external_exports.string()
19802
+ });
19803
+ var MotionNodeDetailsQuerySchema = external_exports.object({
19804
+ nodeVersionId: external_exports.string().uuid().optional()
19805
+ });
19806
+ var MotionNodeDetailsSchema = external_exports.object({
19807
+ nodeVersionId: external_exports.string().uuid(),
19808
+ /** The prompt the version was run with. */
19809
+ prompt: external_exports.string().nullable(),
19810
+ /** The model ID the version was run with. */
19811
+ model: external_exports.string().nullable(),
19812
+ /** The run that made the version; null for a version no run made. */
19813
+ run: MotionNodeRunProgressSchema.nullable(),
19814
+ /** Whether the run stored an artifact; tweaks and renders need one. */
19815
+ hasArtifact: external_exports.boolean(),
19816
+ /** The controls the artifact declares, in its order. */
19817
+ tweaks: external_exports.array(MotionTweakReadSchema),
19818
+ /** The node's saved value for each tweak, fitted to it, or its default. */
19819
+ tweakValues: external_exports.record(external_exports.string(), MotionTweakValueSchema),
19820
+ /** The render that is the version's output now. */
19821
+ output: MotionNodeRenderSchema.nullable(),
19822
+ /** A download URL for the output's MP4 or PNG. */
19823
+ outputUrl: external_exports.string().nullable(),
19824
+ /** The version's newest render, which may still be queued or running, or have failed. */
19825
+ latestRender: MotionNodeRenderSchema.nullable()
19826
+ });
19827
+ var SaveMotionNodeTweakValuesBodySchema = external_exports.object({
19828
+ nodeVersionId: external_exports.string().uuid(),
19829
+ /** Values by tweak ID; each is fitted to its tweak, and a tweak left out keeps its saved value. */
19830
+ tweakValues: external_exports.record(external_exports.string(), external_exports.unknown())
19831
+ });
19832
+ var MotionNodeTweakValuesResponseSchema = external_exports.object({
19833
+ nodeVersionId: external_exports.string().uuid(),
19834
+ /** Every tweak's saved value after the change, fitted to it. */
19835
+ tweakValues: external_exports.record(external_exports.string(), MotionTweakValueSchema)
19836
+ });
19837
+
18208
19838
  // ../api-contract/src/generation-preferences/schema.ts
18209
19839
  function overridable(section) {
18210
19840
  const shape = Object.fromEntries(
@@ -18565,6 +20195,7 @@ var InAppExperience;
18565
20195
  InAppExperience2["CastNamesGuide"] = "cast_names_guide";
18566
20196
  InAppExperience2["CastShotsGuide"] = "cast_shots_guide";
18567
20197
  InAppExperience2["CastLanguageGuide"] = "cast_language_guide";
20198
+ InAppExperience2["CastScenesGuide"] = "cast_scenes_guide";
18568
20199
  InAppExperience2["ElementCreatorGuide"] = "element_creator_guide";
18569
20200
  InAppExperience2["ElementProductDescriptionGuide"] = "element_product_description_guide";
18570
20201
  InAppExperience2["PlaygroundGuide"] = "playground_guide";
@@ -18609,6 +20240,7 @@ var IN_APP_EXPERIENCE_REGISTRY = {
18609
20240
  [InAppExperience.CastNamesGuide]: ON_OUTCOME,
18610
20241
  [InAppExperience.CastShotsGuide]: ON_OUTCOME,
18611
20242
  [InAppExperience.CastLanguageGuide]: ON_OUTCOME,
20243
+ [InAppExperience.CastScenesGuide]: ON_OUTCOME,
18612
20244
  [InAppExperience.ElementCreatorGuide]: ON_OUTCOME,
18613
20245
  [InAppExperience.ElementProductDescriptionGuide]: ON_OUTCOME,
18614
20246
  [InAppExperience.PlaygroundGuide]: ON_OUTCOME,
@@ -19571,7 +21203,9 @@ var DittoGenerationResponseSchema = CastGenerationResponseSchema.omit({
19571
21203
  upscale: true,
19572
21204
  upscaledFrom: true,
19573
21205
  addSubtitles: true,
19574
- subtitledFrom: true
21206
+ subtitledFrom: true,
21207
+ canTrim: true,
21208
+ trimmedFrom: true
19575
21209
  }).extend({
19576
21210
  // Optional so a web build that ships ahead of core still validates.
19577
21211
  shareLink: ShareLinkSchema.pick({ id: true, url: true }).nullable().optional(),
@@ -19588,14 +21222,28 @@ var DittoGenerationResponseSchema = CastGenerationResponseSchema.omit({
19588
21222
  * while it settles, for any other status, and from a server before
19589
21223
  * this field.
19590
21224
  */
19591
- credits: RunCreditsSchema.optional()
21225
+ credits: RunCreditsSchema.optional(),
21226
+ /**
21227
+ * Whether a member of the team favorited the finished video, the
21228
+ * favorite its canvas version holds. Absent from a server before this
21229
+ * field.
21230
+ */
21231
+ favorited: external_exports.boolean().optional()
21232
+ });
21233
+ var SetDittoGenerationFavoriteBodySchema = external_exports.object({
21234
+ favorited: external_exports.boolean()
21235
+ });
21236
+ var SetDittoGenerationFavoriteResponseSchema = external_exports.object({
21237
+ favorited: external_exports.boolean()
19592
21238
  });
19593
21239
  var SearchDittoGenerationsBodySchema = createCursorPaginationRequestSchema({ defaultPageSize: 24 }).extend({
19594
21240
  // Omitted filters preserve the personal-only behavior of deployed clients.
19595
21241
  filters: external_exports.object({
19596
21242
  scope: CastHistoryScopeSchema.default("mine"),
19597
21243
  /** Only the videos made from this template; omitted lists every one. */
19598
- templateId: external_exports.string().uuid().optional()
21244
+ templateId: external_exports.string().uuid().optional(),
21245
+ /** Only the videos a member of the team favorited. */
21246
+ favorites: external_exports.boolean().optional()
19599
21247
  }).optional()
19600
21248
  });
19601
21249
  var SearchDittoGenerationsResponseSchema = createPaginatedResponseSchema(DittoGenerationResponseSchema);
@@ -21234,6 +22882,18 @@ var BulkRunFreeGenerationFields = {
21234
22882
  */
21235
22883
  generationAction: CastGenerationActionSchema.optional()
21236
22884
  };
22885
+ var BulkRunCastSeriesField = {
22886
+ /**
22887
+ * The Microdrama series a Cast run draws for, by its series or by the
22888
+ * episode it takes again (`places-and-looks-microdramas`): a place of
22889
+ * that series the run draws, for a video's clips or on its own, is free.
22890
+ * Ignored for a series not the team's.
22891
+ */
22892
+ castSeries: external_exports.object({
22893
+ collectionId: external_exports.string().uuid().optional(),
22894
+ episodeId: external_exports.string().uuid().optional()
22895
+ }).strict().optional()
22896
+ };
21237
22897
  var canvasContract = c5.router({
21238
22898
  verifyMedia: {
21239
22899
  summary: "Verify a saved media export",
@@ -22097,6 +23757,29 @@ var canvasContract = c5.router({
22097
23757
  404: NodeRunErrorResponseSchema
22098
23758
  }
22099
23759
  },
23760
+ registerRunWebhook: {
23761
+ method: "POST",
23762
+ path: "/node-runs/:nodeRunId/webhook",
23763
+ pathParams: external_exports.object({ nodeRunId: external_exports.string().uuid() }),
23764
+ body: RegisterRunWebhookBodySchema,
23765
+ responses: {
23766
+ 202: RunWebhookResponseSchema,
23767
+ 400: NodeRunErrorResponseSchema,
23768
+ 404: NodeRunErrorResponseSchema,
23769
+ 409: NodeRunErrorResponseSchema
23770
+ },
23771
+ summary: "Register a signed notification when a generation settles"
23772
+ },
23773
+ getRunWebhook: {
23774
+ method: "GET",
23775
+ path: "/node-runs/:nodeRunId/webhook",
23776
+ pathParams: external_exports.object({ nodeRunId: external_exports.string().uuid() }),
23777
+ responses: {
23778
+ 200: RunWebhookResponseSchema,
23779
+ 404: NodeRunErrorResponseSchema
23780
+ },
23781
+ summary: "Read generation webhook delivery status"
23782
+ },
22100
23783
  getNodeRun: {
22101
23784
  method: "GET",
22102
23785
  path: "/node-runs/:nodeRunId",
@@ -22202,6 +23885,13 @@ var canvasContract = c5.router({
22202
23885
  * one node.
22203
23886
  */
22204
23887
  includeAllActiveRuns: external_exports.coerce.boolean().optional(),
23888
+ /**
23889
+ * Return only runs that are pending/running or were updated in the
23890
+ * last two minutes, instead of every node's latest run. For a
23891
+ * status poller: a run it tracks that is absent is read through
23892
+ * `getNodeRun`.
23893
+ */
23894
+ activeOrRecentlyUpdatedOnly: external_exports.coerce.boolean().optional(),
22205
23895
  /** Resolve visible template owners for clients with collapsed canvas content. */
22206
23896
  includeTemplateOwnership: external_exports.coerce.boolean().optional()
22207
23897
  }),
@@ -22262,7 +23952,8 @@ var canvasContract = c5.router({
22262
23952
  */
22263
23953
  scheduleNodesLate: external_exports.boolean().optional(),
22264
23954
  creditShortfall: BulkRunCreditShortfallModeSchema.optional(),
22265
- ...BulkRunFreeGenerationFields
23955
+ ...BulkRunFreeGenerationFields,
23956
+ ...BulkRunCastSeriesField
22266
23957
  }),
22267
23958
  responses: {
22268
23959
  201: BulkNodeRunStartResponseSchema,
@@ -22292,7 +23983,8 @@ var canvasContract = c5.router({
22292
23983
  castVoiceReferences: external_exports.array(CastVoiceReferenceSchema).min(1).max(STITCH_MAX_CLIPS).optional(),
22293
23984
  /** As on `bulkRunNodes`: the reads run first, then every clip at once. */
22294
23985
  scheduleNodesLate: external_exports.boolean().optional(),
22295
- ...BulkRunFreeGenerationFields
23986
+ ...BulkRunFreeGenerationFields,
23987
+ ...BulkRunCastSeriesField
22296
23988
  }),
22297
23989
  responses: {
22298
23990
  201: BulkNodeRunStartResponseSchema,
@@ -22784,7 +24476,7 @@ var canvasContract = c5.router({
22784
24476
  }).nullable().optional(),
22785
24477
  status: external_exports.string().min(1).max(80)
22786
24478
  }).refine(
22787
- (c20) => c20.nodeIds.length > 0 || c20.bounds != null,
24479
+ (c22) => c22.nodeIds.length > 0 || c22.bounds != null,
22788
24480
  "claim must include nodeIds or bounds"
22789
24481
  ).nullable()
22790
24482
  }),
@@ -22809,9 +24501,186 @@ var canvasContract = c5.router({
22809
24501
  }
22810
24502
  });
22811
24503
 
22812
- // ../api-contract/src/custom-font/routes.ts
24504
+ // ../api-contract/src/custom-avatar/routes.ts
22813
24505
  var c6 = initContract();
22814
- var customFontContract = c6.router({
24506
+ var customAvatarContract = c6.router({
24507
+ listCustomAvatars: {
24508
+ method: "GET",
24509
+ path: "/teams/:teamId/custom-avatars",
24510
+ pathParams: external_exports.object({ teamId: external_exports.string().uuid() }),
24511
+ query: external_exports.object({
24512
+ /** "true" gives each avatar its `videoCount`. */
24513
+ includeVideoCounts: external_exports.literal("true").optional()
24514
+ }),
24515
+ responses: {
24516
+ 200: ListCustomAvatarsResponseSchema,
24517
+ 403: ForbiddenSchema,
24518
+ 404: NotFoundSchema
24519
+ }
24520
+ },
24521
+ getCustomAvatar: {
24522
+ method: "GET",
24523
+ path: "/teams/:teamId/custom-avatars/:avatarId",
24524
+ pathParams: external_exports.object({
24525
+ teamId: external_exports.string().uuid(),
24526
+ avatarId: external_exports.string().uuid()
24527
+ }),
24528
+ responses: {
24529
+ 200: CustomAvatarSummarySchema,
24530
+ 403: ForbiddenSchema,
24531
+ 404: NotFoundSchema
24532
+ }
24533
+ },
24534
+ createCustomAvatar: {
24535
+ method: "POST",
24536
+ path: "/teams/:teamId/custom-avatars",
24537
+ pathParams: external_exports.object({ teamId: external_exports.string().uuid() }),
24538
+ body: CreateCustomAvatarBodySchema,
24539
+ responses: {
24540
+ 200: CustomAvatarSummarySchema,
24541
+ 400: BadRequestSchema,
24542
+ 403: ForbiddenSchema,
24543
+ 404: NotFoundSchema,
24544
+ // The team already has an avatar with this name, case-insensitively.
24545
+ 409: ConflictSchema
24546
+ }
24547
+ },
24548
+ /** Prices a render before it starts; nothing is written. */
24549
+ quoteCustomAvatarRender: {
24550
+ method: "POST",
24551
+ path: "/teams/:teamId/custom-avatar-renders/quote",
24552
+ pathParams: external_exports.object({ teamId: external_exports.string().uuid() }),
24553
+ body: QuoteCustomAvatarRenderBodySchema,
24554
+ responses: {
24555
+ 200: QuoteCustomAvatarRenderResponseSchema,
24556
+ 400: BadRequestSchema,
24557
+ 403: ForbiddenSchema
24558
+ }
24559
+ },
24560
+ /** Renders one avatar sheet or portrait; the run continues if the client leaves. */
24561
+ startCustomAvatarRender: {
24562
+ method: "POST",
24563
+ path: "/teams/:teamId/custom-avatar-renders",
24564
+ pathParams: external_exports.object({ teamId: external_exports.string().uuid() }),
24565
+ body: StartCustomAvatarRenderBodySchema,
24566
+ responses: {
24567
+ 201: StartCustomAvatarRenderResponseSchema,
24568
+ 400: BadRequestSchema,
24569
+ /** `code` tells the team's balance from the member's own limit. */
24570
+ 402: ApiErrorResponseSchema,
24571
+ 403: ForbiddenSchema,
24572
+ 404: NotFoundSchema,
24573
+ /** The attempt id names another team's run. */
24574
+ 409: ConflictSchema
24575
+ }
24576
+ },
24577
+ getCustomAvatarRender: {
24578
+ method: "GET",
24579
+ path: "/teams/:teamId/custom-avatar-renders/:renderId",
24580
+ pathParams: external_exports.object({
24581
+ teamId: external_exports.string().uuid(),
24582
+ renderId: external_exports.string().uuid()
24583
+ }),
24584
+ responses: {
24585
+ 200: CustomAvatarRenderSchema,
24586
+ 403: ForbiddenSchema,
24587
+ 404: NotFoundSchema
24588
+ }
24589
+ },
24590
+ updateCustomAvatar: {
24591
+ method: "PATCH",
24592
+ path: "/teams/:teamId/custom-avatars/:avatarId",
24593
+ pathParams: external_exports.object({
24594
+ teamId: external_exports.string().uuid(),
24595
+ avatarId: external_exports.string().uuid()
24596
+ }),
24597
+ body: UpdateCustomAvatarBodySchema,
24598
+ responses: {
24599
+ 200: CustomAvatarSummarySchema,
24600
+ 400: BadRequestSchema,
24601
+ 403: ForbiddenSchema,
24602
+ 404: NotFoundSchema,
24603
+ 409: ConflictSchema
24604
+ }
24605
+ },
24606
+ deleteCustomAvatar: {
24607
+ method: "DELETE",
24608
+ path: "/teams/:teamId/custom-avatars/:avatarId",
24609
+ pathParams: external_exports.object({
24610
+ teamId: external_exports.string().uuid(),
24611
+ avatarId: external_exports.string().uuid()
24612
+ }),
24613
+ responses: {
24614
+ 200: DeleteCustomAvatarResponseSchema,
24615
+ 403: ForbiddenSchema,
24616
+ 404: NotFoundSchema
24617
+ }
24618
+ },
24619
+ listCustomAvatarBackgrounds: {
24620
+ method: "GET",
24621
+ path: "/teams/:teamId/custom-avatars/:avatarId/backgrounds",
24622
+ pathParams: external_exports.object({
24623
+ teamId: external_exports.string().uuid(),
24624
+ avatarId: external_exports.string().uuid()
24625
+ }),
24626
+ responses: {
24627
+ 200: ListCustomAvatarBackgroundsResponseSchema,
24628
+ 403: ForbiddenSchema,
24629
+ 404: NotFoundSchema
24630
+ }
24631
+ },
24632
+ createCustomAvatarBackground: {
24633
+ method: "POST",
24634
+ path: "/teams/:teamId/custom-avatars/:avatarId/backgrounds",
24635
+ pathParams: external_exports.object({
24636
+ teamId: external_exports.string().uuid(),
24637
+ avatarId: external_exports.string().uuid()
24638
+ }),
24639
+ body: CreateCustomAvatarBackgroundBodySchema,
24640
+ responses: {
24641
+ 200: CustomAvatarBackgroundSchema,
24642
+ 400: BadRequestSchema,
24643
+ 403: ForbiddenSchema,
24644
+ 404: NotFoundSchema,
24645
+ 409: ConflictSchema
24646
+ }
24647
+ },
24648
+ updateCustomAvatarBackground: {
24649
+ method: "PATCH",
24650
+ path: "/teams/:teamId/custom-avatars/:avatarId/backgrounds/:backgroundId",
24651
+ pathParams: external_exports.object({
24652
+ teamId: external_exports.string().uuid(),
24653
+ avatarId: external_exports.string().uuid(),
24654
+ backgroundId: external_exports.string().uuid()
24655
+ }),
24656
+ body: UpdateCustomAvatarBackgroundBodySchema,
24657
+ responses: {
24658
+ 200: CustomAvatarBackgroundSchema,
24659
+ 400: BadRequestSchema,
24660
+ 403: ForbiddenSchema,
24661
+ 404: NotFoundSchema,
24662
+ 409: ConflictSchema
24663
+ }
24664
+ },
24665
+ deleteCustomAvatarBackground: {
24666
+ method: "DELETE",
24667
+ path: "/teams/:teamId/custom-avatars/:avatarId/backgrounds/:backgroundId",
24668
+ pathParams: external_exports.object({
24669
+ teamId: external_exports.string().uuid(),
24670
+ avatarId: external_exports.string().uuid(),
24671
+ backgroundId: external_exports.string().uuid()
24672
+ }),
24673
+ responses: {
24674
+ 200: DeleteCustomAvatarBackgroundResponseSchema,
24675
+ 403: ForbiddenSchema,
24676
+ 404: NotFoundSchema
24677
+ }
24678
+ }
24679
+ });
24680
+
24681
+ // ../api-contract/src/custom-font/routes.ts
24682
+ var c7 = initContract();
24683
+ var customFontContract = c7.router({
22815
24684
  list: {
22816
24685
  method: "GET",
22817
24686
  path: "/custom-fonts",
@@ -22840,8 +24709,8 @@ var customFontContract = c6.router({
22840
24709
  });
22841
24710
 
22842
24711
  // ../api-contract/src/ditto/routes.ts
22843
- var c7 = initContract();
22844
- var dittoContract = c7.router({
24712
+ var c8 = initContract();
24713
+ var dittoContract = c8.router({
22845
24714
  prepareSourceClip: {
22846
24715
  method: "POST",
22847
24716
  path: "/ditto/source-clips",
@@ -23150,7 +25019,7 @@ var dittoContract = c7.router({
23150
25019
  method: "DELETE",
23151
25020
  path: "/ditto/custom-styles/:styleId",
23152
25021
  pathParams: DittoCustomStylePathSchema,
23153
- body: c7.noBody(),
25022
+ body: c8.noBody(),
23154
25023
  responses: {
23155
25024
  200: external_exports.object({ id: external_exports.string().uuid() }),
23156
25025
  403: MessageResponseSchema,
@@ -23218,6 +25087,31 @@ var dittoContract = c7.router({
23218
25087
  },
23219
25088
  summary: "A Ditto video's progress, and its video once status is ready"
23220
25089
  },
25090
+ registerDittoWebhook: {
25091
+ method: "POST",
25092
+ path: "/ditto/:generationId/webhook",
25093
+ pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
25094
+ body: RegisterRunWebhookBodySchema,
25095
+ responses: {
25096
+ 202: RunWebhookResponseSchema,
25097
+ 400: MessageResponseSchema,
25098
+ 403: MessageResponseSchema,
25099
+ 404: MessageResponseSchema,
25100
+ 409: MessageResponseSchema
25101
+ },
25102
+ summary: "Register a signed notification when a Ditto video is ready or fails"
25103
+ },
25104
+ getDittoWebhook: {
25105
+ method: "GET",
25106
+ path: "/ditto/:generationId/webhook",
25107
+ pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
25108
+ responses: {
25109
+ 200: RunWebhookResponseSchema,
25110
+ 403: MessageResponseSchema,
25111
+ 404: MessageResponseSchema
25112
+ },
25113
+ summary: "Read a Ditto video webhook's delivery status"
25114
+ },
23221
25115
  getReplacement: {
23222
25116
  method: "GET",
23223
25117
  path: "/ditto/replacements/:generationId",
@@ -23246,7 +25140,7 @@ var dittoContract = c7.router({
23246
25140
  pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
23247
25141
  body: null,
23248
25142
  responses: {
23249
- 204: c7.noBody(),
25143
+ 204: c8.noBody(),
23250
25144
  404: MessageResponseSchema
23251
25145
  },
23252
25146
  summary: "Remove the signed-in member's rating from a Ditto video"
@@ -23280,11 +25174,24 @@ var dittoContract = c7.router({
23280
25174
  pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
23281
25175
  body: null,
23282
25176
  responses: {
23283
- 204: c7.noBody(),
25177
+ 204: c8.noBody(),
23284
25178
  403: MessageResponseSchema,
23285
25179
  404: MessageResponseSchema
23286
25180
  }
23287
25181
  },
25182
+ setGenerationFavorite: {
25183
+ method: "PUT",
25184
+ path: "/ditto/generations/:generationId/favorite",
25185
+ summary: "Favorite a Ditto video the member can see, or take the favorite back, on the canvas version it was saved as. Repeating it returns the same state",
25186
+ pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
25187
+ body: SetDittoGenerationFavoriteBodySchema,
25188
+ responses: {
25189
+ 200: SetDittoGenerationFavoriteResponseSchema,
25190
+ 403: MessageResponseSchema,
25191
+ 404: MessageResponseSchema,
25192
+ 409: MessageResponseSchema
25193
+ }
25194
+ },
23288
25195
  searchImports: {
23289
25196
  method: "POST",
23290
25197
  path: "/ditto/imports/search",
@@ -23363,7 +25270,7 @@ var dittoContract = c7.router({
23363
25270
  pathParams: external_exports.object({ importId: external_exports.string().uuid() }),
23364
25271
  body: null,
23365
25272
  responses: {
23366
- 204: c7.noBody(),
25273
+ 204: c8.noBody(),
23367
25274
  403: MessageResponseSchema,
23368
25275
  404: MessageResponseSchema
23369
25276
  }
@@ -23402,7 +25309,7 @@ var dittoContract = c7.router({
23402
25309
  });
23403
25310
 
23404
25311
  // ../api-contract/src/element/routes.ts
23405
- var c8 = initContract();
25312
+ var c9 = initContract();
23406
25313
  var elementParams = external_exports.object({ elementId: external_exports.string().uuid() });
23407
25314
  var versionParams = elementParams.extend({ versionId: external_exports.string().uuid() });
23408
25315
  var reviewResponses = {
@@ -23412,7 +25319,7 @@ var reviewResponses = {
23412
25319
  404: MessageResponseSchema,
23413
25320
  409: MessageResponseSchema
23414
25321
  };
23415
- var elementContract = c8.router({
25322
+ var elementContract = c9.router({
23416
25323
  /** Cast avatars this team can add to Elements: those no live element was made from. */
23417
25324
  listElementCastAvatars: {
23418
25325
  method: "GET",
@@ -23837,8 +25744,8 @@ var elementContract = c8.router({
23837
25744
  });
23838
25745
 
23839
25746
  // ../api-contract/src/files/routes.ts
23840
- var c9 = initContract();
23841
- var filesContract = c9.router({
25747
+ var c10 = initContract();
25748
+ var filesContract = c10.router({
23842
25749
  createFileFolder: {
23843
25750
  method: "POST",
23844
25751
  path: "/files/folders",
@@ -23919,7 +25826,7 @@ var filesContract = c9.router({
23919
25826
  query: FolderDeleteQuerySchema,
23920
25827
  body: null,
23921
25828
  responses: {
23922
- 204: c9.noBody(),
25829
+ 204: c10.noBody(),
23923
25830
  403: ErrorBodySchema,
23924
25831
  404: ErrorBodySchema
23925
25832
  },
@@ -23964,7 +25871,7 @@ var filesContract = c9.router({
23964
25871
  pathParams: AssetTagIdParamsSchema,
23965
25872
  body: null,
23966
25873
  responses: {
23967
- 204: c9.noBody(),
25874
+ 204: c10.noBody(),
23968
25875
  403: ErrorBodySchema,
23969
25876
  404: ErrorBodySchema
23970
25877
  },
@@ -24103,7 +26010,7 @@ var filesContract = c9.router({
24103
26010
  pathParams: FileAssetIdParamsSchema,
24104
26011
  body: null,
24105
26012
  responses: {
24106
- 204: c9.noBody(),
26013
+ 204: c10.noBody(),
24107
26014
  403: ErrorBodySchema,
24108
26015
  404: ErrorBodySchema
24109
26016
  },
@@ -24115,7 +26022,7 @@ var filesContract = c9.router({
24115
26022
  pathParams: FileAssetIdParamsSchema,
24116
26023
  body: null,
24117
26024
  responses: {
24118
- 204: c9.noBody(),
26025
+ 204: c10.noBody(),
24119
26026
  403: ErrorBodySchema,
24120
26027
  404: ErrorBodySchema
24121
26028
  },
@@ -24138,7 +26045,7 @@ var filesContract = c9.router({
24138
26045
  pathParams: FileAssetIdParamsSchema,
24139
26046
  body: null,
24140
26047
  responses: {
24141
- 204: c9.noBody(),
26048
+ 204: c10.noBody(),
24142
26049
  403: ErrorBodySchema,
24143
26050
  404: ErrorBodySchema
24144
26051
  },
@@ -24158,7 +26065,7 @@ var filesContract = c9.router({
24158
26065
  pathParams: FileAssetIdParamsSchema,
24159
26066
  body: null,
24160
26067
  responses: {
24161
- 204: c9.noBody(),
26068
+ 204: c10.noBody(),
24162
26069
  403: ErrorBodySchema,
24163
26070
  404: ErrorBodySchema
24164
26071
  },
@@ -24170,7 +26077,7 @@ var filesContract = c9.router({
24170
26077
  pathParams: FileAssetIdParamsSchema,
24171
26078
  body: null,
24172
26079
  responses: {
24173
- 204: c9.noBody(),
26080
+ 204: c10.noBody(),
24174
26081
  403: ErrorBodySchema,
24175
26082
  404: ErrorBodySchema
24176
26083
  },
@@ -24370,8 +26277,8 @@ var filesContract = c9.router({
24370
26277
  });
24371
26278
 
24372
26279
  // ../api-contract/src/free-generation/routes.ts
24373
- var c10 = initContract();
24374
- var freeGenerationContract = c10.router({
26280
+ var c11 = initContract();
26281
+ var freeGenerationContract = c11.router({
24375
26282
  listFreeGenerations: {
24376
26283
  method: "GET",
24377
26284
  path: "/free-generations",
@@ -24387,8 +26294,8 @@ var freeGenerationContract = c10.router({
24387
26294
  });
24388
26295
 
24389
26296
  // ../api-contract/src/generation/routes.ts
24390
- var c11 = initContract();
24391
- var generationContract = c11.router({
26297
+ var c12 = initContract();
26298
+ var generationContract = c12.router({
24392
26299
  listGenerativeModels: {
24393
26300
  method: "GET",
24394
26301
  path: "/generation/models",
@@ -24497,7 +26404,7 @@ var generationContract = c11.router({
24497
26404
  until: external_exports.string().datetime().optional()
24498
26405
  }),
24499
26406
  responses: {
24500
- 200: c11.otherResponse({
26407
+ 200: c12.otherResponse({
24501
26408
  contentType: "text/csv",
24502
26409
  body: external_exports.string()
24503
26410
  })
@@ -24513,19 +26420,117 @@ var generationContract = c11.router({
24513
26420
  200: GetGenerationsByWeekResponseSchema
24514
26421
  }
24515
26422
  },
24516
- precheckSeedance: {
24517
- method: "POST",
24518
- path: "/generation/precheck-seedance",
24519
- body: SeedancePrecheckRequestSchema,
26423
+ precheckSeedance: {
26424
+ method: "POST",
26425
+ path: "/generation/precheck-seedance",
26426
+ body: SeedancePrecheckRequestSchema,
26427
+ responses: {
26428
+ 200: SeedancePrecheckResponseSchema
26429
+ }
26430
+ }
26431
+ });
26432
+
26433
+ // ../api-contract/src/motion-node/routes.ts
26434
+ var c13 = initContract();
26435
+ var motionNodeContract = c13.router({
26436
+ /**
26437
+ * A version's prompt, model, run, tweaks with their saved values, and
26438
+ * render, for callers with no place to play an artifact.
26439
+ */
26440
+ getMotionNodeDetails: {
26441
+ method: "GET",
26442
+ path: "/canvases/:canvasId/nodes/:nodeId/motion",
26443
+ pathParams: MotionNodePathParamsSchema,
26444
+ query: MotionNodeDetailsQuerySchema,
26445
+ responses: {
26446
+ 200: MotionNodeDetailsSchema,
26447
+ 403: MessageResponseSchema,
26448
+ 404: MessageResponseSchema
26449
+ }
26450
+ },
26451
+ /**
26452
+ * Saves tweak values to the node for a version, as an editor's change in
26453
+ * the node does. Starts no run and no render.
26454
+ */
26455
+ saveMotionNodeTweakValues: {
26456
+ method: "PUT",
26457
+ path: "/canvases/:canvasId/nodes/:nodeId/motion/tweaks",
26458
+ pathParams: MotionNodePathParamsSchema,
26459
+ body: SaveMotionNodeTweakValuesBodySchema,
26460
+ responses: {
26461
+ 200: MotionNodeTweakValuesResponseSchema,
26462
+ 400: MessageResponseSchema,
26463
+ 403: MessageResponseSchema,
26464
+ 404: MessageResponseSchema,
26465
+ /** The artifact's tweaks are in a form this server cannot read yet. */
26466
+ 409: MessageResponseSchema
26467
+ }
26468
+ },
26469
+ /**
26470
+ * "Update output": renders the version's artifact at the given tweak
26471
+ * values in a sandbox of its own and makes the file the version's output.
26472
+ * Creates no node version. A node renders one at a time; a later request
26473
+ * waits for the one before.
26474
+ */
26475
+ updateMotionNodeOutput: {
26476
+ method: "POST",
26477
+ path: "/canvases/:canvasId/nodes/:nodeId/motion/output",
26478
+ pathParams: MotionNodePathParamsSchema,
26479
+ body: UpdateMotionNodeOutputBodySchema,
26480
+ responses: {
26481
+ 202: MotionNodeRenderSchema,
26482
+ 400: MessageResponseSchema,
26483
+ 403: MessageResponseSchema,
26484
+ 404: MessageResponseSchema,
26485
+ /** The node already has as many renders waiting as it may. */
26486
+ 409: MessageResponseSchema,
26487
+ 503: MessageResponseSchema
26488
+ }
26489
+ },
26490
+ /** The version's output and its newest render. */
26491
+ getMotionNodeOutput: {
26492
+ method: "GET",
26493
+ path: "/canvases/:canvasId/nodes/:nodeId/motion/output",
26494
+ pathParams: MotionNodePathParamsSchema,
26495
+ query: MotionNodeVersionQuerySchema,
26496
+ responses: {
26497
+ 200: MotionNodeOutputResponseSchema,
26498
+ 403: MessageResponseSchema,
26499
+ 404: MessageResponseSchema
26500
+ }
26501
+ },
26502
+ /**
26503
+ * The version's artifact, manifest, poster and inputs, with short-lived
26504
+ * URLs the node renews before `expiresAt`. Canvas viewers may call it.
26505
+ */
26506
+ getMotionNodePlayer: {
26507
+ method: "GET",
26508
+ path: "/canvases/:canvasId/nodes/:nodeId/motion/player",
26509
+ pathParams: MotionNodePathParamsSchema,
26510
+ query: MotionNodeVersionQuerySchema,
26511
+ responses: {
26512
+ 200: MotionNodePlayerResponseSchema,
26513
+ 403: MessageResponseSchema,
26514
+ 404: MessageResponseSchema
26515
+ }
26516
+ },
26517
+ /** Where the run that made the version stands: its status, latest steps and closing summary. */
26518
+ getMotionNodeRun: {
26519
+ method: "GET",
26520
+ path: "/canvases/:canvasId/nodes/:nodeId/motion/run",
26521
+ pathParams: MotionNodePathParamsSchema,
26522
+ query: MotionNodeVersionQuerySchema,
24520
26523
  responses: {
24521
- 200: SeedancePrecheckResponseSchema
26524
+ 200: MotionNodeRunProgressSchema,
26525
+ 403: MessageResponseSchema,
26526
+ 404: MessageResponseSchema
24522
26527
  }
24523
26528
  }
24524
26529
  });
24525
26530
 
24526
26531
  // ../api-contract/src/presets/routes.ts
24527
- var c12 = initContract();
24528
- var presetsContract = c12.router({
26532
+ var c14 = initContract();
26533
+ var presetsContract = c14.router({
24529
26534
  listPresets: {
24530
26535
  method: "GET",
24531
26536
  path: "/presets",
@@ -24545,8 +26550,8 @@ var UserActionEvent = {
24545
26550
  var RecordUserActionSchema = external_exports.object({ event: external_exports.nativeEnum(UserActionEvent) }).strict();
24546
26551
 
24547
26552
  // ../api-contract/src/profile/routes.ts
24548
- var c13 = initContract();
24549
- var profileContract = c13.router({
26553
+ var c15 = initContract();
26554
+ var profileContract = c15.router({
24550
26555
  listExperiences: {
24551
26556
  method: "GET",
24552
26557
  path: "/profile/me/experiences",
@@ -24566,7 +26571,7 @@ var profileContract = c13.router({
24566
26571
  method: "POST",
24567
26572
  path: "/profile/me/actions",
24568
26573
  body: RecordUserActionSchema,
24569
- responses: { 204: c13.noBody() }
26574
+ responses: { 204: c15.noBody() }
24570
26575
  },
24571
26576
  getMyProfile: {
24572
26577
  method: "GET",
@@ -24584,7 +26589,7 @@ var profileContract = c13.router({
24584
26589
  path: "/profile/me",
24585
26590
  body: null,
24586
26591
  responses: {
24587
- 204: c13.noBody(),
26592
+ 204: c15.noBody(),
24588
26593
  400: ApiErrorResponseSchema,
24589
26594
  409: ApiErrorResponseSchema,
24590
26595
  503: ApiErrorResponseSchema
@@ -24694,8 +26699,8 @@ var profileContract = c13.router({
24694
26699
  });
24695
26700
 
24696
26701
  // ../api-contract/src/project/routes.ts
24697
- var c14 = initContract();
24698
- var projectContract = c14.router({
26702
+ var c16 = initContract();
26703
+ var projectContract = c16.router({
24699
26704
  searchProjects: {
24700
26705
  method: "POST",
24701
26706
  path: "/projects/search",
@@ -24776,14 +26781,14 @@ var projectContract = c14.router({
24776
26781
  path: "/projects/:projectId",
24777
26782
  pathParams: ProjectIdParamsSchema,
24778
26783
  body: null,
24779
- responses: { 204: c14.noBody() }
26784
+ responses: { 204: c16.noBody() }
24780
26785
  },
24781
26786
  recordProjectView: {
24782
26787
  method: "POST",
24783
26788
  path: "/projects/:projectId/view",
24784
26789
  pathParams: ProjectIdParamsSchema,
24785
26790
  body: RecordProjectViewBodySchema,
24786
- responses: { 204: c14.noBody() }
26791
+ responses: { 204: c16.noBody() }
24787
26792
  },
24788
26793
  listRecentCanvases: {
24789
26794
  method: "GET",
@@ -24902,7 +26907,7 @@ var projectContract = c14.router({
24902
26907
  path: "/projects/:projectId/settings",
24903
26908
  pathParams: ProjectIdParamsSchema,
24904
26909
  body: null,
24905
- responses: { 204: c14.noBody() }
26910
+ responses: { 204: c16.noBody() }
24906
26911
  },
24907
26912
  // ── Project Memory ──────────────────────────────────────────────
24908
26913
  getProjectMemory: {
@@ -25039,8 +27044,8 @@ var projectContract = c14.router({
25039
27044
  });
25040
27045
 
25041
27046
  // ../api-contract/src/team/routes.ts
25042
- var c15 = initContract();
25043
- var teamContract = c15.router({
27047
+ var c17 = initContract();
27048
+ var teamContract = c17.router({
25044
27049
  createTeam: {
25045
27050
  method: "POST",
25046
27051
  path: "/teams",
@@ -25147,13 +27152,13 @@ var teamContract = c15.router({
25147
27152
  method: "DELETE",
25148
27153
  path: "/teams/current",
25149
27154
  body: null,
25150
- responses: { 204: c15.noBody() }
27155
+ responses: { 204: c17.noBody() }
25151
27156
  },
25152
27157
  leaveTeam: {
25153
27158
  method: "POST",
25154
27159
  path: "/teams/current/leave",
25155
27160
  body: null,
25156
- responses: { 204: c15.noBody() }
27161
+ responses: { 204: c17.noBody() }
25157
27162
  },
25158
27163
  listMembers: {
25159
27164
  method: "GET",
@@ -25186,7 +27191,7 @@ var teamContract = c15.router({
25186
27191
  path: "/teams/current/members/:userId",
25187
27192
  pathParams: external_exports.object({ userId: external_exports.string().uuid() }),
25188
27193
  body: null,
25189
- responses: { 204: c15.noBody() }
27194
+ responses: { 204: c17.noBody() }
25190
27195
  },
25191
27196
  getShareableLink: {
25192
27197
  method: "GET",
@@ -25248,7 +27253,7 @@ var teamContract = c15.router({
25248
27253
  path: "/teams/current/invite-email/:inviteId",
25249
27254
  pathParams: external_exports.object({ inviteId: external_exports.string().uuid() }),
25250
27255
  body: null,
25251
- responses: { 204: c15.noBody() }
27256
+ responses: { 204: c17.noBody() }
25252
27257
  },
25253
27258
  listJoinRequests: {
25254
27259
  method: "GET",
@@ -25267,7 +27272,7 @@ var teamContract = c15.router({
25267
27272
  path: "/teams/current/join-requests/:requestId",
25268
27273
  pathParams: external_exports.object({ requestId: external_exports.string().uuid() }),
25269
27274
  body: null,
25270
- responses: { 204: c15.noBody() }
27275
+ responses: { 204: c17.noBody() }
25271
27276
  },
25272
27277
  updateDomainJoinSettings: {
25273
27278
  method: "PATCH",
@@ -25302,8 +27307,8 @@ var teamContract = c15.router({
25302
27307
  });
25303
27308
 
25304
27309
  // ../api-contract/src/upload/routes.ts
25305
- var c16 = initContract();
25306
- var uploadContract = c16.router({
27310
+ var c18 = initContract();
27311
+ var uploadContract = c18.router({
25307
27312
  init: {
25308
27313
  method: "POST",
25309
27314
  path: "/upload/init",
@@ -25376,8 +27381,8 @@ var uploadContract = c16.router({
25376
27381
  });
25377
27382
 
25378
27383
  // ../api-contract/src/cast-template/routes.ts
25379
- var c17 = initContract();
25380
- var castTemplateContract = c17.router({
27384
+ var c19 = initContract();
27385
+ var castTemplateContract = c19.router({
25381
27386
  search: {
25382
27387
  summary: "Search Cast script templates",
25383
27388
  method: "POST",
@@ -25414,7 +27419,9 @@ var CastCompletionSchema = external_exports.object({
25414
27419
  ]),
25415
27420
  subtitleRunId: external_exports.string().uuid().optional(),
25416
27421
  outputVersionId: external_exports.string().uuid().optional(),
25417
- warning: external_exports.string().optional()
27422
+ warning: external_exports.string().optional(),
27423
+ /** Why a failed video failed; absent from a server built before reasons. */
27424
+ failureReason: GenerationFailureReasonSchema.optional()
25418
27425
  });
25419
27426
 
25420
27427
  // ../api-contract/src/cast/script-language.ts
@@ -25559,8 +27566,8 @@ var ResolveCastPropReferencesResponseSchema = external_exports.object({
25559
27566
  });
25560
27567
 
25561
27568
  // ../api-contract/src/cast/routes.ts
25562
- var c18 = initContract();
25563
- var castContract = c18.router({
27569
+ var c20 = initContract();
27570
+ var castContract = c20.router({
25564
27571
  getCastOptions: {
25565
27572
  method: "GET",
25566
27573
  path: "/cast/options",
@@ -25584,7 +27591,7 @@ var castContract = c18.router({
25584
27591
  prepareCastVideo: {
25585
27592
  method: "POST",
25586
27593
  path: "/cast/videos/prepare",
25587
- body: CastVideoRequestSchema,
27594
+ body: CastVideoUrlRequestSchema,
25588
27595
  responses: {
25589
27596
  200: PrepareCastVideoResponseSchema,
25590
27597
  400: MessageResponseSchema,
@@ -25596,7 +27603,10 @@ var castContract = c18.router({
25596
27603
  readCastPreparedVideoQuote: {
25597
27604
  method: "POST",
25598
27605
  path: "/cast/videos/prepared-quote",
25599
- body: RunCastVideoBodySchema.omit({ expectedEstimatedCredits: true }),
27606
+ body: RunCastVideoUrlBodySchema.omit({
27607
+ expectedEstimatedCredits: true,
27608
+ webhook: true
27609
+ }),
25600
27610
  responses: {
25601
27611
  200: CastPreparedVideoQuoteSchema,
25602
27612
  400: MessageResponseSchema,
@@ -25609,7 +27619,7 @@ var castContract = c18.router({
25609
27619
  headers: IdempotencyRequestHeadersSchema,
25610
27620
  metadata: { idempotent: true },
25611
27621
  path: "/cast/videos",
25612
- body: RunCastVideoBodySchema,
27622
+ body: RunCastVideoUrlBodySchema,
25613
27623
  responses: {
25614
27624
  200: CastVideoResponseSchema,
25615
27625
  400: MessageResponseSchema,
@@ -25634,6 +27644,31 @@ var castContract = c18.router({
25634
27644
  },
25635
27645
  summary: "Read a saved Cast video's progress and exact output"
25636
27646
  },
27647
+ registerCastVideoWebhook: {
27648
+ method: "POST",
27649
+ path: "/cast/videos/:generationId/webhook",
27650
+ pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
27651
+ body: RegisterRunWebhookBodySchema,
27652
+ responses: {
27653
+ 202: RunWebhookResponseSchema,
27654
+ 400: MessageResponseSchema,
27655
+ 403: MessageResponseSchema,
27656
+ 404: MessageResponseSchema,
27657
+ 409: MessageResponseSchema
27658
+ },
27659
+ summary: "Register a signed notification when a Cast video is ready or fails"
27660
+ },
27661
+ getCastVideoWebhook: {
27662
+ method: "GET",
27663
+ path: "/cast/videos/:generationId/webhook",
27664
+ pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
27665
+ responses: {
27666
+ 200: RunWebhookResponseSchema,
27667
+ 403: MessageResponseSchema,
27668
+ 404: MessageResponseSchema
27669
+ },
27670
+ summary: "Read a Cast video webhook's delivery status"
27671
+ },
25637
27672
  downloadCastVideo: {
25638
27673
  method: "POST",
25639
27674
  path: "/cast/videos/:generationId/download",
@@ -25823,6 +27858,20 @@ var castContract = c18.router({
25823
27858
  },
25824
27859
  summary: "Burn subtitles into a finished Cast take that has none, as a new take of its own"
25825
27860
  },
27861
+ trimCastGeneration: {
27862
+ method: "POST",
27863
+ path: "/cast/generations/:generationId/trim",
27864
+ pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
27865
+ body: TrimCastGenerationBodySchema,
27866
+ responses: {
27867
+ 201: CastGenerationResponseSchema,
27868
+ 400: MessageResponseSchema,
27869
+ 403: MessageResponseSchema,
27870
+ 404: MessageResponseSchema,
27871
+ 409: MessageResponseSchema
27872
+ },
27873
+ summary: "Trim a finished Cast take to the part between two points, as a new take of its own"
27874
+ },
25826
27875
  getSharedCastGeneration: {
25827
27876
  method: "GET",
25828
27877
  path: "/cast/shared/:generationId",
@@ -25863,6 +27912,19 @@ var castContract = c18.router({
25863
27912
  404: MessageResponseSchema
25864
27913
  }
25865
27914
  },
27915
+ deleteCastGeneration: {
27916
+ method: "DELETE",
27917
+ path: "/cast/generations/:generationId",
27918
+ pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
27919
+ body: null,
27920
+ responses: {
27921
+ 204: c20.noBody(),
27922
+ 403: MessageResponseSchema,
27923
+ 404: MessageResponseSchema,
27924
+ 409: MessageResponseSchema
27925
+ },
27926
+ summary: "Delete a finished Cast video its maker no longer wants, from Cast History and Assets. Repeating it also returns 204"
27927
+ },
25866
27928
  upsertCastGenerationFeedback: {
25867
27929
  method: "PUT",
25868
27930
  path: "/cast/generations/:generationId/feedback",
@@ -25880,7 +27942,7 @@ var castContract = c18.router({
25880
27942
  pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
25881
27943
  body: null,
25882
27944
  responses: {
25883
- 204: c18.noBody(),
27945
+ 204: c20.noBody(),
25884
27946
  404: MessageResponseSchema
25885
27947
  },
25886
27948
  summary: "Remove the signed-in member's rating from a Cast video"
@@ -25957,6 +28019,172 @@ var castContract = c18.router({
25957
28019
  },
25958
28020
  summary: "Write a series' next episode as a scene, continuing from the episodes before it"
25959
28021
  },
28022
+ createCastOneOffCollection: {
28023
+ method: "POST",
28024
+ path: "/cast/collections/one-off",
28025
+ body: CreateCastOneOffCollectionBodySchema,
28026
+ responses: {
28027
+ 201: CreateCastOneOffCollectionResponseSchema,
28028
+ 400: MessageResponseSchema,
28029
+ 404: MessageResponseSchema
28030
+ },
28031
+ summary: "Start a one-off Microdrama's own places and looks, kept apart from any series"
28032
+ },
28033
+ getCastSeriesStory: {
28034
+ method: "GET",
28035
+ path: "/cast/collections/:collectionId/story",
28036
+ pathParams: external_exports.object({ collectionId: external_exports.string().uuid() }),
28037
+ responses: {
28038
+ 200: CastSeriesStorySchema,
28039
+ 404: MessageResponseSchema
28040
+ },
28041
+ summary: "A Microdrama series' places and looks, and how its newest episode left everyone"
28042
+ },
28043
+ readCastSeriesScenes: {
28044
+ method: "POST",
28045
+ path: "/cast/collections/:collectionId/scenes/read",
28046
+ pathParams: external_exports.object({ collectionId: external_exports.string().uuid() }),
28047
+ body: ReadCastSeriesScenesBodySchema,
28048
+ responses: {
28049
+ 200: ReadCastSeriesScenesResponseSchema,
28050
+ 404: MessageResponseSchema,
28051
+ 503: MessageResponseSchema
28052
+ },
28053
+ summary: "Read where each scene of a Microdrama series' script happens and how everyone looks there"
28054
+ },
28055
+ createCastSeriesPlace: {
28056
+ method: "POST",
28057
+ path: "/cast/collections/:collectionId/places",
28058
+ pathParams: external_exports.object({ collectionId: external_exports.string().uuid() }),
28059
+ body: CreateCastSeriesPlaceBodySchema,
28060
+ responses: {
28061
+ 201: CastSeriesPlaceSchema,
28062
+ 400: MessageResponseSchema,
28063
+ 404: MessageResponseSchema,
28064
+ 409: MessageResponseSchema
28065
+ },
28066
+ summary: "Add a place to a Microdrama series, with a picture of the team's or one drawn the first time an episode films it"
28067
+ },
28068
+ updateCastSeriesPlace: {
28069
+ method: "PATCH",
28070
+ path: "/cast/collections/:collectionId/places/:placeId",
28071
+ pathParams: external_exports.object({
28072
+ collectionId: external_exports.string().uuid(),
28073
+ placeId: external_exports.string().uuid()
28074
+ }),
28075
+ body: UpdateCastSeriesPlaceBodySchema,
28076
+ responses: {
28077
+ 200: CastSeriesPlaceSchema,
28078
+ 400: MessageResponseSchema,
28079
+ 404: MessageResponseSchema,
28080
+ 409: MessageResponseSchema
28081
+ },
28082
+ summary: "Rename a series place, give it another picture, or describe it again, which draws its picture again unless one is named"
28083
+ },
28084
+ deleteCastSeriesPlace: {
28085
+ method: "DELETE",
28086
+ path: "/cast/collections/:collectionId/places/:placeId",
28087
+ pathParams: external_exports.object({
28088
+ collectionId: external_exports.string().uuid(),
28089
+ placeId: external_exports.string().uuid()
28090
+ }),
28091
+ body: null,
28092
+ responses: {
28093
+ 204: c20.noBody(),
28094
+ 404: MessageResponseSchema
28095
+ },
28096
+ summary: "Remove a place from a series; episodes already made keep it"
28097
+ },
28098
+ drawCastSeriesPlacePicture: {
28099
+ method: "POST",
28100
+ path: "/cast/collections/:collectionId/places/:placeId/picture",
28101
+ pathParams: external_exports.object({
28102
+ collectionId: external_exports.string().uuid(),
28103
+ placeId: external_exports.string().uuid()
28104
+ }),
28105
+ body: DrawCastSeriesPictureBodySchema,
28106
+ responses: {
28107
+ 202: DrawCastSeriesPictureResponseSchema,
28108
+ 400: MessageResponseSchema,
28109
+ 402: MessageResponseSchema,
28110
+ 404: MessageResponseSchema
28111
+ },
28112
+ summary: "Draw a series place's picture on the server, kept on the place as it lands"
28113
+ },
28114
+ createCastSeriesLook: {
28115
+ method: "POST",
28116
+ path: "/cast/collections/:collectionId/looks",
28117
+ pathParams: external_exports.object({ collectionId: external_exports.string().uuid() }),
28118
+ body: CreateCastSeriesLookBodySchema,
28119
+ responses: {
28120
+ 201: CastSeriesLookSchema,
28121
+ 400: MessageResponseSchema,
28122
+ 404: MessageResponseSchema,
28123
+ 409: MessageResponseSchema
28124
+ },
28125
+ summary: "Add a look for one person to a Microdrama series; its picture is drawn the first time an episode films it"
28126
+ },
28127
+ updateCastSeriesLook: {
28128
+ method: "PATCH",
28129
+ path: "/cast/collections/:collectionId/looks/:lookId",
28130
+ pathParams: external_exports.object({
28131
+ collectionId: external_exports.string().uuid(),
28132
+ lookId: external_exports.string().uuid()
28133
+ }),
28134
+ body: UpdateCastSeriesLookBodySchema,
28135
+ responses: {
28136
+ 200: CastSeriesLookSchema,
28137
+ 400: MessageResponseSchema,
28138
+ 404: MessageResponseSchema,
28139
+ 409: MessageResponseSchema
28140
+ },
28141
+ summary: "Rename a series look, give it another picture, or describe it again, which draws its picture again unless one is named"
28142
+ },
28143
+ drawCastSeriesLookPicture: {
28144
+ method: "POST",
28145
+ path: "/cast/collections/:collectionId/looks/:lookId/picture",
28146
+ pathParams: external_exports.object({
28147
+ collectionId: external_exports.string().uuid(),
28148
+ lookId: external_exports.string().uuid()
28149
+ }),
28150
+ body: DrawCastSeriesPictureBodySchema,
28151
+ responses: {
28152
+ 202: DrawCastSeriesPictureResponseSchema,
28153
+ 400: MessageResponseSchema,
28154
+ 402: MessageResponseSchema,
28155
+ 404: MessageResponseSchema
28156
+ },
28157
+ summary: "Draw a series look's picture on the server, kept on the look as it lands"
28158
+ },
28159
+ deleteCastSeriesLook: {
28160
+ method: "DELETE",
28161
+ path: "/cast/collections/:collectionId/looks/:lookId",
28162
+ pathParams: external_exports.object({
28163
+ collectionId: external_exports.string().uuid(),
28164
+ lookId: external_exports.string().uuid()
28165
+ }),
28166
+ body: null,
28167
+ responses: {
28168
+ 204: c20.noBody(),
28169
+ 404: MessageResponseSchema
28170
+ },
28171
+ summary: "Remove a look from a series; episodes already made keep it"
28172
+ },
28173
+ pinCastCollectionEpisodeTake: {
28174
+ method: "PUT",
28175
+ path: "/cast/collections/:collectionId/episodes/:episodeId/pinned-take",
28176
+ pathParams: external_exports.object({
28177
+ collectionId: external_exports.string().uuid(),
28178
+ episodeId: external_exports.string().uuid()
28179
+ }),
28180
+ body: PinCastCollectionEpisodeTakeBodySchema,
28181
+ responses: {
28182
+ 200: PinCastCollectionEpisodeTakeResponseSchema,
28183
+ 400: MessageResponseSchema,
28184
+ 404: MessageResponseSchema
28185
+ },
28186
+ summary: "Pin the take a series episode shows, or unpin it to show its newest finished take"
28187
+ },
25960
28188
  updateCastCollection: {
25961
28189
  method: "PATCH",
25962
28190
  path: "/cast/collections/:collectionId",
@@ -25975,7 +28203,7 @@ var castContract = c18.router({
25975
28203
  pathParams: external_exports.object({ collectionId: external_exports.string().uuid() }),
25976
28204
  body: null,
25977
28205
  responses: {
25978
- 204: c18.noBody(),
28206
+ 204: c20.noBody(),
25979
28207
  404: MessageResponseSchema
25980
28208
  },
25981
28209
  summary: "Delete a Cast collection; its videos stay in History, in no collection"
@@ -26036,8 +28264,8 @@ var castContract = c18.router({
26036
28264
  });
26037
28265
 
26038
28266
  // ../api-contract/src/public/index.ts
26039
- var c19 = initContract();
26040
- var publicContract = c19.router(
28267
+ var c21 = initContract();
28268
+ var publicContract = c21.router(
26041
28269
  {
26042
28270
  cast: {
26043
28271
  options: castContract.getCastOptions,
@@ -26046,9 +28274,23 @@ var publicContract = c19.router(
26046
28274
  preparedQuote: castContract.readCastPreparedVideoQuote,
26047
28275
  run: castContract.runCastVideo,
26048
28276
  get: castContract.getCastVideo,
28277
+ registerWebhook: castContract.registerCastVideoWebhook,
28278
+ getWebhook: castContract.getCastVideoWebhook,
26049
28279
  download: castContract.downloadCastVideo,
26050
28280
  history: castContract.searchCastGenerations
26051
28281
  },
28282
+ // Render an avatar from photos, then save it to use in `cast.prepare`.
28283
+ // The avatar-scoped background routes stay out: a background belongs to the team.
28284
+ customAvatar: {
28285
+ quoteRender: customAvatarContract.quoteCustomAvatarRender,
28286
+ startRender: customAvatarContract.startCustomAvatarRender,
28287
+ getRender: customAvatarContract.getCustomAvatarRender,
28288
+ create: customAvatarContract.createCustomAvatar,
28289
+ list: customAvatarContract.listCustomAvatars,
28290
+ get: customAvatarContract.getCustomAvatar,
28291
+ update: customAvatarContract.updateCustomAvatar,
28292
+ delete: customAvatarContract.deleteCustomAvatar
28293
+ },
26052
28294
  castTemplate: {
26053
28295
  search: castTemplateContract.search,
26054
28296
  get: castTemplateContract.get
@@ -26059,13 +28301,25 @@ var publicContract = c19.router(
26059
28301
  search: castContract.searchCastCollections,
26060
28302
  get: castContract.getCastCollection,
26061
28303
  episodes: castContract.searchCastCollectionEpisodes,
26062
- rename: castContract.updateCastCollection
28304
+ rename: castContract.updateCastCollection,
28305
+ // A series' or one-off's places and looks; each answers 404 without `places-and-looks-microdramas`.
28306
+ // A one-off's id is never listed: keep the one `startOneOff` returns.
28307
+ startOneOff: castContract.createCastOneOffCollection,
28308
+ story: castContract.getCastSeriesStory,
28309
+ createPlace: castContract.createCastSeriesPlace,
28310
+ updatePlace: castContract.updateCastSeriesPlace,
28311
+ deletePlace: castContract.deleteCastSeriesPlace,
28312
+ createLook: castContract.createCastSeriesLook,
28313
+ updateLook: castContract.updateCastSeriesLook,
28314
+ deleteLook: castContract.deleteCastSeriesLook
26063
28315
  },
26064
28316
  ditto: {
26065
28317
  listModels: dittoContract.listReplacementModels,
26066
28318
  listAvatars: dittoContract.listAvatars,
26067
28319
  create: dittoContract.createDitto,
26068
28320
  get: dittoContract.getDitto,
28321
+ registerWebhook: dittoContract.registerDittoWebhook,
28322
+ getWebhook: dittoContract.getDittoWebhook,
26069
28323
  // The quote-then-run paths `create` replaces, kept for released CLI versions.
26070
28324
  prepare: { ...dittoContract.prepareReplacement, deprecated: true },
26071
28325
  run: { ...dittoContract.runReplacement, deprecated: true },
@@ -26117,6 +28371,14 @@ var publicContract = c19.router(
26117
28371
  setVersion: canvasContract.setNodeVersion,
26118
28372
  verifyMedia: canvasContract.verifyMedia
26119
28373
  },
28374
+ // Each answers 403 for a member or team without `motion-node`.
28375
+ motionNode: {
28376
+ get: motionNodeContract.getMotionNodeDetails,
28377
+ saveTweakValues: motionNodeContract.saveMotionNodeTweakValues,
28378
+ updateOutput: motionNodeContract.updateMotionNodeOutput,
28379
+ getOutput: motionNodeContract.getMotionNodeOutput,
28380
+ getRun: motionNodeContract.getMotionNodeRun
28381
+ },
26120
28382
  stitch: {
26121
28383
  get: canvasContract.getStitchEdit,
26122
28384
  replaceClip: canvasContract.replaceStitchClip
@@ -26141,6 +28403,8 @@ var publicContract = c19.router(
26141
28403
  bulkCreate: canvasContract.bulkCreateDirectEdges
26142
28404
  },
26143
28405
  run: {
28406
+ registerWebhook: canvasContract.registerRunWebhook,
28407
+ getWebhook: canvasContract.getRunWebhook,
26144
28408
  start: canvasContract.runNode,
26145
28409
  tool: canvasContract.runNodeTool,
26146
28410
  get: canvasContract.getNodeRun,
@@ -26321,8 +28585,8 @@ function planAutoformatCanvasContent(content, request, savedLayout) {
26321
28585
  }
26322
28586
 
26323
28587
  // ../api-contract/src/edge-id.ts
26324
- function normalizeEdgeId(id, generateId = () => crypto.randomUUID()) {
26325
- return id && UUID_RE.test(id) ? id : generateId();
28588
+ function normalizeEdgeId(id2, generateId = () => crypto.randomUUID()) {
28589
+ return id2 && UUID_RE.test(id2) ? id2 : generateId();
26326
28590
  }
26327
28591
 
26328
28592
  // ../api-contract/src/client-platform.ts
@@ -26378,7 +28642,14 @@ var CUSTOM_REQUEST_HEADERS = {
26378
28642
  * NON-AUTHORITATIVE — client-asserted, and it only labels telemetry. It
26379
28643
  * must never gate auth or data access.
26380
28644
  */
26381
- agentEvalRun: "X-Melius-Agent-Eval-Run"
28645
+ agentEvalRun: "X-Melius-Agent-Eval-Run",
28646
+ /**
28647
+ * `SLOW_CONNECTION_HEADER_VALUE` when the browser reports Save-Data or a
28648
+ * 2G/3G connection, so the API signs smaller thumbnails. Absent otherwise.
28649
+ * NON-AUTHORITATIVE — client-asserted, and it only picks image sizes. It
28650
+ * must never gate auth or data access.
28651
+ */
28652
+ meliusConnection: "X-Melius-Connection"
26382
28653
  };
26383
28654
  var ALL_CUSTOM_REQUEST_HEADERS = Object.values(CUSTOM_REQUEST_HEADERS);
26384
28655
 
@@ -26438,10 +28709,10 @@ function resolvePresetMentions(layout, keyToId) {
26438
28709
  if (!prompt) continue;
26439
28710
  const rewritten = prompt.replace(
26440
28711
  MENTION_RE,
26441
- (full, label, existingId) => {
28712
+ (full, label2, existingId) => {
26442
28713
  if (existingId) return full;
26443
- const resolvedId = titleToId.get(label.toLowerCase());
26444
- return resolvedId ? `@[${label}]{${resolvedId}}` : full;
28714
+ const resolvedId = titleToId.get(label2.toLowerCase());
28715
+ return resolvedId ? `@[${label2}]{${resolvedId}}` : full;
26445
28716
  }
26446
28717
  );
26447
28718
  if (rewritten !== prompt) {
@@ -26612,10 +28883,10 @@ function computeSingleGroupLayout(preset, center) {
26612
28883
  }
26613
28884
 
26614
28885
  // ../api-contract/src/agent-canvas-group.ts
26615
- function planNodeGroupPlacement(nodes, nodeIds, label, groupType = "default") {
28886
+ function planNodeGroupPlacement(nodes, nodeIds, label2, groupType = "default") {
26616
28887
  const nodeMap = new Map(nodes.map((node) => [node.id, node]));
26617
- const getNode = (id) => nodeMap.get(id);
26618
- const targetNodes = nodeIds.map((id) => nodeMap.get(id)).filter((node) => node !== void 0);
28888
+ const getNode = (id2) => nodeMap.get(id2);
28889
+ const targetNodes = nodeIds.map((id2) => nodeMap.get(id2)).filter((node) => node !== void 0);
26619
28890
  if (targetNodes.length < 2) {
26620
28891
  throw new Error(
26621
28892
  "At least 2 valid node IDs are required to create a group"
@@ -26626,7 +28897,7 @@ function planNodeGroupPlacement(nodes, nodeIds, label, groupType = "default") {
26626
28897
  if (sharedParentId !== null && !canNestNewGroupIn(nodes, getNode(sharedParentId), nodeIds)) {
26627
28898
  return {
26628
28899
  groupId: sharedParentId,
26629
- label,
28900
+ label: label2,
26630
28901
  nodeIds,
26631
28902
  groupType,
26632
28903
  alreadyGrouped: true,
@@ -26670,7 +28941,7 @@ function planNodeGroupPlacement(nodes, nodeIds, label, groupType = "default") {
26670
28941
  const groupGeometry = { x: groupX, y: groupY, w: groupW, h: groupH };
26671
28942
  return {
26672
28943
  groupId,
26673
- label,
28944
+ label: label2,
26674
28945
  nodeIds,
26675
28946
  groupType,
26676
28947
  parentGroupId: sharedParentId,
@@ -26741,13 +29012,13 @@ function toAgentAssetSearchFilters(scope) {
26741
29012
  };
26742
29013
  }
26743
29014
  function toAgentAssetSearchResult(page, shownBefore) {
26744
- const { data, count, hasMore, nextCursor, tags } = page;
29015
+ const { data, count: count2, hasMore, nextCursor, tags } = page;
26745
29016
  return {
26746
29017
  query: page.query,
26747
29018
  results: data,
26748
29019
  // Pickers offer more while total exceeds what they show, so an
26749
29020
  // uncounted (ranked) search reports one past it when more remain.
26750
- total: count ?? shownBefore + data.length + (hasMore ? 1 : 0),
29021
+ total: count2 ?? shownBefore + data.length + (hasMore ? 1 : 0),
26751
29022
  ...page.folderId !== void 0 && { folderId: page.folderId },
26752
29023
  ...page.canvasId !== void 0 && { canvasId: page.canvasId },
26753
29024
  ...page.source !== void 0 && { source: page.source },
@@ -26774,7 +29045,7 @@ var CANVAS_FOCUS_NODE_QUERY_PARAM = "node";
26774
29045
  var CANVAS_FOCUS_NODES_QUERY_PARAM = "nodes";
26775
29046
  var MAX_CANVAS_FOCUS_NODES = 100;
26776
29047
  function normalizeCanvasFocusIds(ids) {
26777
- return [...new Set(ids.map((id) => id.trim()).filter(Boolean))];
29048
+ return [...new Set(ids.map((id2) => id2.trim()).filter(Boolean))];
26778
29049
  }
26779
29050
  function buildCanvasPath(projectId, canvasId, nodeIds = []) {
26780
29051
  const ids = normalizeCanvasFocusIds(nodeIds);
@@ -27095,23 +29366,23 @@ function parseVersion(version) {
27095
29366
  return [major, minor, patch];
27096
29367
  }
27097
29368
  function isNewerVersion(current, latest) {
27098
- const c20 = parseVersion(current);
29369
+ const c22 = parseVersion(current);
27099
29370
  const l = parseVersion(latest);
27100
- if (!c20 || !l) return false;
29371
+ if (!c22 || !l) return false;
27101
29372
  for (let i = 0; i < 3; i++) {
27102
- if (l[i] > c20[i]) return true;
27103
- if (l[i] < c20[i]) return false;
29373
+ if (l[i] > c22[i]) return true;
29374
+ if (l[i] < c22[i]) return false;
27104
29375
  }
27105
29376
  return false;
27106
29377
  }
27107
29378
  function isMajorUpgrade(current, latest) {
27108
- const c20 = parseVersion(current);
29379
+ const c22 = parseVersion(current);
27109
29380
  const l = parseVersion(latest);
27110
- if (!c20 || !l) return false;
27111
- return l[0] > c20[0];
29381
+ if (!c22 || !l) return false;
29382
+ return l[0] > c22[0];
27112
29383
  }
27113
29384
  function shouldShowUpgradeNotice(ctx = {}) {
27114
- const current = ctx.current ?? "0.52.0";
29385
+ const current = ctx.current ?? "0.54.0";
27115
29386
  const latest = ctx.latest ?? serverLatestVersion;
27116
29387
  const env = ctx.env ?? process.env;
27117
29388
  const isTty = ctx.isTty ?? Boolean(process.stderr.isTTY);
@@ -27132,7 +29403,7 @@ Upgrade: npm install -g @melius-ai/cli@latest (or: brew update && brew upgrade
27132
29403
  function printUpgradeNoticeIfNeeded(ctx = {}) {
27133
29404
  try {
27134
29405
  if (!shouldShowUpgradeNotice(ctx)) return;
27135
- const current = ctx.current ?? "0.52.0";
29406
+ const current = ctx.current ?? "0.54.0";
27136
29407
  const latest = ctx.latest ?? serverLatestVersion;
27137
29408
  process.stderr.write(formatUpgradeNotice(current, latest));
27138
29409
  } catch {
@@ -27239,7 +29510,7 @@ function createClient(config) {
27239
29510
  "Bypass-Tunnel-Reminder": "true",
27240
29511
  [CUSTOM_REQUEST_HEADERS.meliusClient]: buildMeliusClientHeader({
27241
29512
  surface: "cli",
27242
- version: "0.52.0"
29513
+ version: "0.54.0"
27243
29514
  })
27244
29515
  };
27245
29516
  if (config.teamId) {
@@ -27411,8 +29682,8 @@ function writeText(data) {
27411
29682
 
27412
29683
  // src/lib/validation.ts
27413
29684
  import { readFileSync as readFileSync2 } from "fs";
27414
- function readElementCastAvatarOptions(id, kind) {
27415
- const parsed = ElementCastAvatarRefSchema.safeParse({ id, kind });
29685
+ function readElementCastAvatarOptions(id2, kind) {
29686
+ const parsed = ElementCastAvatarRefSchema.safeParse({ id: id2, kind });
27416
29687
  if (!parsed.success) {
27417
29688
  writeError(
27418
29689
  formatError(
@@ -29039,10 +31310,10 @@ function pageInput(options) {
29039
31310
  }
29040
31311
  function writePage(page, output2) {
29041
31312
  writeJson(page.data, output2);
29042
- const { pageSize, count, hasMore, nextCursor } = page;
31313
+ const { pageSize, count: count2, hasMore, nextCursor } = page;
29043
31314
  process.stderr.write(
29044
31315
  JSON.stringify({
29045
- pagination: { pageSize, count, hasMore, nextCursor }
31316
+ pagination: { pageSize, count: count2, hasMore, nextCursor }
29046
31317
  }) + "\n"
29047
31318
  );
29048
31319
  }
@@ -29058,7 +31329,7 @@ function fixedBackoff(delaysMs) {
29058
31329
  // ../utils/src/retry/retry.ts
29059
31330
  var UNDESCRIBED_RESULT_REASON = "retryable result";
29060
31331
  async function withRetry(options, run) {
29061
- const { label, schedule } = options;
31332
+ const { label: label2, schedule } = options;
29062
31333
  const sleep3 = options.sleep ?? defaultSleep;
29063
31334
  const onRetry = options.onRetry ?? warnRetry;
29064
31335
  for (let attempt = 1; ; attempt++) {
@@ -29081,7 +31352,7 @@ async function withRetry(options, run) {
29081
31352
  }
29082
31353
  const delayMs = decision.delayMs ?? schedule.delayMs(attempt);
29083
31354
  onRetry({
29084
- label,
31355
+ label: label2,
29085
31356
  attempt,
29086
31357
  maxAttempts: schedule.maxAttempts,
29087
31358
  delayMs,
@@ -29091,13 +31362,13 @@ async function withRetry(options, run) {
29091
31362
  }
29092
31363
  }
29093
31364
  function formatRetryAttempt({
29094
- label,
31365
+ label: label2,
29095
31366
  attempt,
29096
31367
  maxAttempts,
29097
31368
  delayMs,
29098
31369
  reason
29099
31370
  }) {
29100
- return `[retry] ${label} attempt ${attempt}/${maxAttempts} failed (${reason}) \u2014 retrying in ${Math.round(delayMs)}ms`;
31371
+ return `[retry] ${label2} attempt ${attempt}/${maxAttempts} failed (${reason}) \u2014 retrying in ${Math.round(delayMs)}ms`;
29101
31372
  }
29102
31373
  function readVerdict(options, outcome, attempt) {
29103
31374
  const verdict = outcome.ok ? options.retryOnResult?.(outcome.value, attempt) : options.retryOnError?.(outcome.error, attempt);
@@ -29279,10 +31550,10 @@ async function downloadCastFile(url, output2, generationId) {
29279
31550
  // src/commands/cast-series.ts
29280
31551
  var GENRES = CastListedGenreSchema.options.join(", ");
29281
31552
  var STYLES = CAST_MICRODRAMA_STYLE_IDS.join(", ");
29282
- function seriesParams(id) {
31553
+ function seriesParams(id2) {
29283
31554
  return parseCastValue(
29284
31555
  publicContract.castCollections.get.pathParams,
29285
- { collectionId: id },
31556
+ { collectionId: id2 },
29286
31557
  "Use a seriesId from mel cast series list or mel cast series create"
29287
31558
  );
29288
31559
  }
@@ -29492,10 +31763,10 @@ Examples:
29492
31763
  }
29493
31764
 
29494
31765
  // src/commands/cast.ts
29495
- function generationParams(id) {
31766
+ function generationParams(id2) {
29496
31767
  return parseCastValue(
29497
31768
  publicContract.cast.get.pathParams,
29498
- { generationId: id },
31769
+ { generationId: id2 },
29499
31770
  "Use the attemptId from mel cast prepare or generationId from mel cast history"
29500
31771
  );
29501
31772
  }
@@ -29526,15 +31797,15 @@ function castSeriesFields(options, videoStyleId) {
29526
31797
  function recovery(generationId) {
29527
31798
  return `Run: mel cast wait --id ${generationId}. To retry submission, use mel cast run --input-file <prepared.json> with the same prepared file`;
29528
31799
  }
29529
- async function getVideo(id, deadline) {
29530
- const params = generationParams(id);
31800
+ async function getVideo(id2, deadline) {
31801
+ const params = generationParams(id2);
29531
31802
  const client = getClient();
29532
31803
  return castRequest(
29533
31804
  (signal) => client.cast.get({ params, fetchOptions: { signal } }),
29534
31805
  {
29535
31806
  label: "Cast status",
29536
- generationId: id,
29537
- suggestion: recovery(id),
31807
+ generationId: id2,
31808
+ suggestion: recovery(id2),
29538
31809
  deadline
29539
31810
  }
29540
31811
  );
@@ -29683,7 +31954,7 @@ Examples:
29683
31954
  `
29684
31955
  Returns: status (ready, invalid, estimate_unavailable), attemptId, input, review, estimatedCredits, scriptSeconds, aspectRatios.
29685
31956
  Input: { avatar: { name } or { kind: custom|curated|element, id }, sections: [{ text, action?, title? }], voice?, backgroundId?, props?, tone?, engine?, aspectRatio?, resolution?, subtitles?, creationSettings?, scriptTemplate? }.
29686
- Use 1-30 sections (text up to 5000 characters, action up to 2000, title up to 200).
31957
+ Use 1-${MAX_CAST_VIDEO_SECTIONS} sections (text up to 5000 characters, action up to 2000, title up to 200).
29687
31958
  Props: 1-${CAST_VIDEO_MAX_PROPS} items shaped { assetId, name? }; get asset IDs from mel upload or mel asset search.
29688
31959
  Template reference: scriptTemplate: { id: <templateId>, revision: <revision>, source: database }; discover with mel cast templates.
29689
31960
  Omitted voice uses the avatar's saved voice. Explicit voice { kind: auto } generates speech.
@@ -30139,9 +32410,9 @@ Examples:
30139
32410
  loadConfig().baseUrl,
30140
32411
  { canvasId, nodeId: opts.nodeId },
30141
32412
  result.body,
30142
- async (id) => {
32413
+ async (id2) => {
30143
32414
  const meta = await client.canvas.get({
30144
- params: { canvasId: id }
32415
+ params: { canvasId: id2 }
30145
32416
  });
30146
32417
  return meta.status === 200 ? meta.body : null;
30147
32418
  }
@@ -30397,7 +32668,7 @@ Examples:
30397
32668
  plan = planAutoformatCanvasContent(
30398
32669
  { ...contentResult.body, notes },
30399
32670
  {
30400
- nodeIds: opts.nodeIds?.split(",").map((id) => id.trim()).filter((id) => id.length > 0),
32671
+ nodeIds: opts.nodeIds?.split(",").map((id2) => id2.trim()).filter((id2) => id2.length > 0),
30401
32672
  groupId: opts.groupId,
30402
32673
  arrangeGroupContents: opts.arrangeGroupContents,
30403
32674
  layout
@@ -30473,7 +32744,7 @@ Examples:
30473
32744
  let finished = allRuns.filter((r) => r.status === "finished");
30474
32745
  if (opts.nodeIds) {
30475
32746
  const nodeIdSet = new Set(
30476
- opts.nodeIds.split(",").map((id) => id.trim()).filter(Boolean)
32747
+ opts.nodeIds.split(",").map((id2) => id2.trim()).filter(Boolean)
30477
32748
  );
30478
32749
  finished = finished.filter((r) => nodeIdSet.has(r.nodeId));
30479
32750
  }
@@ -30575,7 +32846,7 @@ function rememberTempNodeIds(canvasId, idMap) {
30575
32846
  }
30576
32847
  function resolveNodeIds2(canvasId, nodeIds) {
30577
32848
  const idMap = readState().canvases[canvasId]?.idMap ?? {};
30578
- return resolveNodeIds((label) => idMap[label], nodeIds);
32849
+ return resolveNodeIds((label2) => idMap[label2], nodeIds);
30579
32850
  }
30580
32851
 
30581
32852
  // src/lib/stdin.ts
@@ -30803,7 +33074,7 @@ Examples:
30803
33074
  $ mel node create <canvasId> --type audio --model elevenlabs-voice-changer --variant audio-to-audio --voice-id <voiceId>`
30804
33075
  ).action(async (canvasId, opts) => {
30805
33076
  const client = getClient();
30806
- const id = opts.id ?? crypto.randomUUID();
33077
+ const id2 = opts.id ?? crypto.randomUUID();
30807
33078
  const modelConfig = validateModelConfig(
30808
33079
  opts.model,
30809
33080
  opts.variant,
@@ -30816,7 +33087,7 @@ Examples:
30816
33087
  const result = await createGraphNode(client, {
30817
33088
  params: { canvasId },
30818
33089
  body: {
30819
- id,
33090
+ id: id2,
30820
33091
  nodeType: opts.type,
30821
33092
  geometry,
30822
33093
  ...opts.title !== void 0 ? { title: opts.title } : { title: getDefaultTitle(opts.type) },
@@ -31200,12 +33471,12 @@ Valid node types: text, image, video, audio, file, group, custom_text, stitch.
31200
33471
  }
31201
33472
  const labelToId = /* @__PURE__ */ new Map();
31202
33473
  const nodes = items.map((item, index) => {
31203
- let id;
33474
+ let id2;
31204
33475
  if (item.id && !UUID_RE.test(item.id)) {
31205
- id = crypto.randomUUID();
31206
- labelToId.set(item.id, id);
33476
+ id2 = crypto.randomUUID();
33477
+ labelToId.set(item.id, id2);
31207
33478
  } else {
31208
- id = item.id ?? crypto.randomUUID();
33479
+ id2 = item.id ?? crypto.randomUUID();
31209
33480
  }
31210
33481
  const nodeType = item.type;
31211
33482
  const defaults = getDefaultGeometry(
@@ -31222,7 +33493,7 @@ Valid node types: text, image, video, audio, file, group, custom_text, stitch.
31222
33493
  `Node ${item.id ?? index + 1}`
31223
33494
  );
31224
33495
  return {
31225
- id,
33496
+ id: id2,
31226
33497
  nodeType,
31227
33498
  geometry: {
31228
33499
  x: item.x ?? autoGeo?.x ?? defaults.x,
@@ -31565,7 +33836,7 @@ Examples:
31565
33836
  ).action(
31566
33837
  async (canvasId, opts) => {
31567
33838
  const client = getClient();
31568
- const nodeIds = opts.nodeIds.split(",").map((id) => id.trim()).filter(Boolean);
33839
+ const nodeIds = opts.nodeIds.split(",").map((id2) => id2.trim()).filter(Boolean);
31569
33840
  if (nodeIds.length < 2) {
31570
33841
  writeError(
31571
33842
  formatError(
@@ -31585,12 +33856,12 @@ Examples:
31585
33856
  handleApiError(contentResult.status, contentResult.body);
31586
33857
  }
31587
33858
  const content = contentResult.body;
31588
- for (const id of nodeIds) {
31589
- if (!content.nodes.some((n) => n.id === id)) {
33859
+ for (const id2 of nodeIds) {
33860
+ if (!content.nodes.some((n) => n.id === id2)) {
31590
33861
  writeError(
31591
33862
  formatError(
31592
33863
  "NOT_FOUND",
31593
- `Node "${id}" not found on canvas`,
33864
+ `Node "${id2}" not found on canvas`,
31594
33865
  {
31595
33866
  suggestion: `Run: mel canvas content ${canvasId}`
31596
33867
  }
@@ -31771,13 +34042,13 @@ Examples:
31771
34042
  ).action(
31772
34043
  async (canvasId, opts) => {
31773
34044
  const client = getClient();
31774
- const id = opts.id ?? crypto.randomUUID();
34045
+ const id2 = opts.id ?? crypto.randomUUID();
31775
34046
  const saved = await mutateGraph(client, canvasId, {
31776
34047
  operation: "update",
31777
34048
  nodes: [],
31778
34049
  edges: [
31779
34050
  {
31780
- id,
34051
+ id: id2,
31781
34052
  srcNodeId: opts.src,
31782
34053
  dstNodeId: opts.dst,
31783
34054
  edgeType: opts.type,
@@ -32299,10 +34570,10 @@ function context(client) {
32299
34570
  };
32300
34571
  }
32301
34572
  function requestPath(request) {
32302
- const id = "nodeId" in request.params ? request.params.nodeId : request.params.canvasId;
34573
+ const id2 = "nodeId" in request.params ? request.params.nodeId : request.params.canvasId;
32303
34574
  return routes[request.route].path.replace(
32304
34575
  /:(?:nodeId|canvasId)/,
32305
- encodeURIComponent(id)
34576
+ encodeURIComponent(id2)
32306
34577
  );
32307
34578
  }
32308
34579
  function withSubmissionReceipt(client, request, suppliedKey) {
@@ -33481,6 +35752,190 @@ Examples:
33481
35752
  });
33482
35753
  }
33483
35754
 
35755
+ // src/commands/motion.ts
35756
+ var RENDER_POLL_INTERVAL_MS = 5e3;
35757
+ var DEFAULT_WAIT_TIMEOUT_SECONDS = 900;
35758
+ function parseTweakValues(values, command) {
35759
+ let parsed;
35760
+ try {
35761
+ parsed = JSON.parse(values);
35762
+ } catch {
35763
+ parsed = void 0;
35764
+ }
35765
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
35766
+ writeError(
35767
+ formatError(
35768
+ "USAGE_ERROR",
35769
+ "--values must be a JSON object of tweak IDs to values",
35770
+ {
35771
+ suggestion: `Read the tweak IDs with mel motion get, then run: mel motion ${command} <canvasId> <nodeId> --version-id <nodeVersionId> --values '{"<tweakId>": <value>}'`
35772
+ }
35773
+ ),
35774
+ EXIT_USAGE_ERROR
35775
+ );
35776
+ return parsed;
35777
+ }
35778
+ async function readDetails(canvasId, nodeId, nodeVersionId) {
35779
+ const result = await getClient().motionNode.get({
35780
+ params: { canvasId, nodeId },
35781
+ query: nodeVersionId ? { nodeVersionId } : {}
35782
+ });
35783
+ if (result.status !== 200) handleApiError(result.status, result.body);
35784
+ return result.body;
35785
+ }
35786
+ async function saveTweakValues(canvasId, nodeId, nodeVersionId, tweakValues) {
35787
+ const result = await getClient().motionNode.saveTweakValues({
35788
+ params: { canvasId, nodeId },
35789
+ body: { nodeVersionId, tweakValues }
35790
+ });
35791
+ if (result.status !== 200) handleApiError(result.status, result.body);
35792
+ return result.body.tweakValues;
35793
+ }
35794
+ function registerMotionCommands(program2, getOutputOpts) {
35795
+ const motion = program2.command("motion", { hidden: true }).description(
35796
+ "Motion nodes: read a version's run, tweaks and output render, save tweak values, and update the output"
35797
+ );
35798
+ motion.command("get").description(
35799
+ "Read a Motion node version: its prompt, model, run summary, tweaks with saved values, and output render with a download URL"
35800
+ ).argument("<canvasId>", "Canvas ID from mel canvas list").argument("<nodeId>", "Motion node ID from mel canvas content").option(
35801
+ "--version-id <nodeVersionId>",
35802
+ "Version ID from mel canvas content --include-all-versions; defaults to the node's active version"
35803
+ ).addHelpText(
35804
+ "after",
35805
+ `
35806
+ Returns: { nodeVersionId, prompt, model, run: { status, steps, summary, failureMessage, model } | null, hasArtifact, tweaks, tweakValues, output, outputUrl, latestRender }
35807
+ outputUrl downloads the output MP4 or PNG. A version has tweaks once its run stored a motion graphic.
35808
+ Create one with mel node create <canvasId> --type motion --prompt "<what to make>", wire its inputs with mel edge create, then mel run start.
35809
+
35810
+ Examples:
35811
+ $ mel motion get <canvasId> <nodeId>
35812
+ $ mel motion get <canvasId> <nodeId> --version-id <nodeVersionId> --fields tweaks,tweakValues`
35813
+ ).action(
35814
+ async (canvasId, nodeId, opts) => {
35815
+ writeJson(
35816
+ await readDetails(canvasId, nodeId, opts.versionId),
35817
+ getOutputOpts()
35818
+ );
35819
+ }
35820
+ );
35821
+ motion.command("tweaks").description(
35822
+ "Save tweak values for a Motion node version; each is fitted to its tweak. Starts no run and no render"
35823
+ ).argument("<canvasId>", "Canvas ID from mel canvas list").argument("<nodeId>", "Motion node ID from mel canvas content").requiredOption(
35824
+ "--version-id <nodeVersionId>",
35825
+ "Version ID from mel motion get"
35826
+ ).requiredOption(
35827
+ "--values <json>",
35828
+ `JSON object of tweak IDs to values, from mel motion get tweaks (e.g. '{"bar":35,"labels":false}'); a tweak left out keeps its saved value`
35829
+ ).addHelpText(
35830
+ "after",
35831
+ `
35832
+ Returns: { nodeVersionId, tweakValues } \u2014 every tweak's saved value after the change.
35833
+ A slider value outside its range is clamped; an unknown tweak ID is dropped. Use mel motion update-output to make the output file at these values.
35834
+
35835
+ Examples:
35836
+ $ mel motion tweaks <canvasId> <nodeId> --version-id <nodeVersionId> --values '{"bar":35}'
35837
+ $ mel motion tweaks <canvasId> <nodeId> --version-id <nodeVersionId> --values '{"labels":false,"speed":1.5}'`
35838
+ ).action(
35839
+ async (canvasId, nodeId, opts) => {
35840
+ const tweakValues = await saveTweakValues(
35841
+ canvasId,
35842
+ nodeId,
35843
+ opts.versionId,
35844
+ parseTweakValues(opts.values, "tweaks")
35845
+ );
35846
+ writeJson(
35847
+ { nodeVersionId: opts.versionId, tweakValues },
35848
+ getOutputOpts()
35849
+ );
35850
+ }
35851
+ );
35852
+ motion.command("update-output").description(
35853
+ "Render a Motion node version to its output MP4 or PNG at given tweak values; creates no node version"
35854
+ ).argument("<canvasId>", "Canvas ID from mel canvas list").argument("<nodeId>", "Motion node ID from mel canvas content").option(
35855
+ "--version-id <nodeVersionId>",
35856
+ "Version ID from mel motion get; defaults to the node's active version"
35857
+ ).option(
35858
+ "--values <json>",
35859
+ "JSON object of tweak IDs to values, saved on the node before the render; defaults to the node's saved values"
35860
+ ).option(
35861
+ "--wait",
35862
+ "Wait for the render to finish, then print mel motion get's result with outputUrl"
35863
+ ).option(
35864
+ "--timeout <seconds>",
35865
+ "Seconds to wait with --wait",
35866
+ String(DEFAULT_WAIT_TIMEOUT_SECONDS)
35867
+ ).addHelpText(
35868
+ "after",
35869
+ `
35870
+ Returns: the queued render { renderId, nodeVersionId, kind, status, tweakValues, outputAssetId, errorMessage, createdAt, finishedAt }, or with --wait the version's details once it finishes.
35871
+ A node renders one output at a time and holds at most 2 waiting; a third is refused (409).
35872
+
35873
+ Examples:
35874
+ $ mel motion update-output <canvasId> <nodeId> --wait
35875
+ $ mel motion update-output <canvasId> <nodeId> --version-id <nodeVersionId> --values '{"bar":35}' --wait --timeout 1200`
35876
+ ).action(
35877
+ async (canvasId, nodeId, opts) => {
35878
+ const given = opts.values === void 0 ? void 0 : parseTweakValues(opts.values, "update-output");
35879
+ const current = opts.versionId && given ? void 0 : await readDetails(canvasId, nodeId, opts.versionId);
35880
+ const nodeVersionId = opts.versionId ?? current.nodeVersionId;
35881
+ const tweakValues = given ? await saveTweakValues(
35882
+ canvasId,
35883
+ nodeId,
35884
+ nodeVersionId,
35885
+ given
35886
+ ) : current.tweakValues;
35887
+ const result = await getClient().motionNode.updateOutput({
35888
+ params: { canvasId, nodeId },
35889
+ body: { nodeVersionId, tweakValues }
35890
+ });
35891
+ if (result.status !== 202)
35892
+ handleApiError(result.status, result.body);
35893
+ if (!opts.wait) {
35894
+ writeJson(result.body, getOutputOpts());
35895
+ return;
35896
+ }
35897
+ writeJson(
35898
+ await waitForRender(
35899
+ canvasId,
35900
+ nodeId,
35901
+ nodeVersionId,
35902
+ result.body.renderId,
35903
+ Number(opts.timeout) * 1e3
35904
+ ),
35905
+ getOutputOpts()
35906
+ );
35907
+ }
35908
+ );
35909
+ }
35910
+ async function waitForRender(canvasId, nodeId, nodeVersionId, renderId, timeoutMs) {
35911
+ const deadline = Date.now() + timeoutMs;
35912
+ while (Date.now() < deadline) {
35913
+ await new Promise(
35914
+ (resolve) => setTimeout(resolve, RENDER_POLL_INTERVAL_MS)
35915
+ );
35916
+ const details = await readDetails(canvasId, nodeId, nodeVersionId);
35917
+ if (details.output?.renderId === renderId) return details;
35918
+ const render = details.latestRender;
35919
+ if (render?.renderId === renderId && render.status === "failed")
35920
+ writeError(
35921
+ formatError(
35922
+ "RENDER_FAILED",
35923
+ render.errorMessage ?? "The output render failed",
35924
+ {
35925
+ suggestion: `Run: mel motion update-output ${canvasId} ${nodeId} --version-id ${nodeVersionId} --wait to try again`
35926
+ }
35927
+ ),
35928
+ EXIT_API_ERROR
35929
+ );
35930
+ }
35931
+ return writeError(
35932
+ formatError("TIMEOUT", "The output render is still going", {
35933
+ suggestion: `Run: mel motion get ${canvasId} ${nodeId} --version-id ${nodeVersionId} to check it later`
35934
+ }),
35935
+ EXIT_TIMEOUT
35936
+ );
35937
+ }
35938
+
33484
35939
  // src/commands/bulk-run.ts
33485
35940
  function writeCreditShortfall(shortfall) {
33486
35941
  const runCount = shortfall.affordableNodeIds.length;
@@ -33565,7 +36020,7 @@ Examples:
33565
36020
  );
33566
36021
  let nodeIds;
33567
36022
  if (opts.nodeIds) {
33568
- nodeIds = opts.nodeIds.split(",").map((id) => id.trim()).filter(Boolean);
36023
+ nodeIds = opts.nodeIds.split(",").map((id2) => id2.trim()).filter(Boolean);
33569
36024
  if (nodeIds.length === 0) {
33570
36025
  writeError(
33571
36026
  formatError(
@@ -33843,7 +36298,7 @@ function resolveClipIds(canvasId, clipIds) {
33843
36298
  if (clipIds === void 0) return void 0;
33844
36299
  const { resolvedNodeIds, unresolvedTempLabels } = resolveNodeIds2(
33845
36300
  canvasId,
33846
- clipIds.split(",").map((id) => id.trim()).filter(Boolean)
36301
+ clipIds.split(",").map((id2) => id2.trim()).filter(Boolean)
33847
36302
  );
33848
36303
  if (unresolvedTempLabels.length > 0) {
33849
36304
  writeError(
@@ -33860,7 +36315,7 @@ function resolveClipIds(canvasId, clipIds) {
33860
36315
  return resolvedNodeIds;
33861
36316
  }
33862
36317
  function assertClipsInRun(clipIds, nodeIds) {
33863
- const outside = (clipIds ?? []).filter((id) => !nodeIds.includes(id));
36318
+ const outside = (clipIds ?? []).filter((id2) => !nodeIds.includes(id2));
33864
36319
  if (outside.length === 0) return;
33865
36320
  writeError(
33866
36321
  formatError(
@@ -34064,11 +36519,11 @@ async function applyPreset(client, canvasId, preset, centerX, centerY) {
34064
36519
  const failedNodeKeys = /* @__PURE__ */ new Set();
34065
36520
  const errors = [];
34066
36521
  for (const layoutNode of layout.nodes) {
34067
- const id = keyToId.get(layoutNode.key);
36522
+ const id2 = keyToId.get(layoutNode.key);
34068
36523
  const parentId = layoutNode.parentKey ? keyToId.get(layoutNode.parentKey) : void 0;
34069
36524
  const body = mapPresetLayoutNodeToDirectBody(
34070
36525
  layoutNode,
34071
- id,
36526
+ id2,
34072
36527
  parentId,
34073
36528
  resolvedPrompts
34074
36529
  );
@@ -34083,7 +36538,7 @@ async function applyPreset(client, canvasId, preset, centerX, centerY) {
34083
36538
  continue;
34084
36539
  }
34085
36540
  createdNodes.push({
34086
- id,
36541
+ id: id2,
34087
36542
  nodeType: layoutNode.type,
34088
36543
  title: body.title,
34089
36544
  presetKey: layoutNode.key
@@ -34097,10 +36552,10 @@ async function applyPreset(client, canvasId, preset, centerX, centerY) {
34097
36552
  const src = keyToId.get(layoutEdge.sourceKey);
34098
36553
  const dst = keyToId.get(layoutEdge.targetKey);
34099
36554
  if (!src || !dst) continue;
34100
- const id = crypto.randomUUID();
36555
+ const id2 = crypto.randomUUID();
34101
36556
  const edgeType = layoutEdge.sourceHandle;
34102
36557
  const result = await createEdge(client, canvasId, {
34103
- id,
36558
+ id: id2,
34104
36559
  srcNodeId: src,
34105
36560
  dstNodeId: dst,
34106
36561
  edgeType,
@@ -34114,7 +36569,7 @@ async function applyPreset(client, canvasId, preset, centerX, centerY) {
34114
36569
  `);
34115
36570
  continue;
34116
36571
  }
34117
- createdEdges.push({ id, srcNodeId: src, dstNodeId: dst, edgeType });
36572
+ createdEdges.push({ id: id2, srcNodeId: src, dstNodeId: dst, edgeType });
34118
36573
  }
34119
36574
  if (errors.length > 0) {
34120
36575
  process.stderr.write(
@@ -34734,7 +37189,7 @@ function withDefaultHelp(args) {
34734
37189
  }
34735
37190
  function createProgram() {
34736
37191
  const program2 = new Command();
34737
- program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.52.0").showSuggestionAfterError(true).option("--json", "Force JSON output (default)").option("--text", "Human-readable output").option(
37192
+ program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.54.0").showSuggestionAfterError(true).option("--json", "Force JSON output (default)").option("--text", "Human-readable output").option(
34738
37193
  "--fields <fields>",
34739
37194
  "Select specific output fields (comma-separated)"
34740
37195
  ).option("--quiet", "Suppress output, exit code only").option("--verbose", "Log request/response metadata to stderr").addHelpText(
@@ -34778,6 +37233,7 @@ Learn more: https://docs.melius.com`
34778
37233
  registerAudioCommands(program2, getOutputOpts);
34779
37234
  registerFontCommands(program2, getOutputOpts);
34780
37235
  registerFreeGenerationCommands(program2, getOutputOpts);
37236
+ registerMotionCommands(program2, getOutputOpts);
34781
37237
  registerAngleCommands(program2, getOutputOpts);
34782
37238
  registerPresetCommands(program2, getOutputOpts);
34783
37239
  registerTemplateCommands(program2, getOutputOpts);