@melius-ai/cli 0.53.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);
@@ -10203,7 +10208,7 @@ var ListFilesQuerySchema = external_exports.object({
10203
10208
  // this GET has no array-query support; absent means no tag filter. Each id
10204
10209
  // is validated as a uuid after splitting.
10205
10210
  tagIds: external_exports.string().optional().transform(
10206
- (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
10207
10212
  ).pipe(external_exports.array(external_exports.string().uuid()).optional()),
10208
10213
  // The "Hidden" view: lists files hidden from Files (across all folders)
10209
10214
  // instead of the normal visible listing. Coerced from the query string so
@@ -11052,10 +11057,10 @@ var RegenerateImageAngleBodySchema = external_exports.object({
11052
11057
  ...imageAngleFields,
11053
11058
  resolution: ImageAngleResolutionSchema.default("1K"),
11054
11059
  count: ImageAngleCountSchema.default(1)
11055
- }).strict().transform(({ resolution, count, ...angle }) => ({
11060
+ }).strict().transform(({ resolution, count: count2, ...angle }) => ({
11056
11061
  ...canonicalImageAngle(angle),
11057
11062
  resolution,
11058
- count
11063
+ count: count2
11059
11064
  }));
11060
11065
  var CreateImageAngleBodySchema = external_exports.object({
11061
11066
  sourceNodeId: external_exports.string().uuid(),
@@ -11250,6 +11255,8 @@ var ModelConfigSchema = external_exports.object({
11250
11255
  StoredImageAngleSchema
11251
11256
  ).optional().catch(void 0),
11252
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),
11253
11260
  model: external_exports.string(),
11254
11261
  variant: external_exports.string(),
11255
11262
  tier: external_exports.string().nullable().optional(),
@@ -11304,6 +11311,8 @@ var ModelConfigSchema = external_exports.object({
11304
11311
  });
11305
11312
  var ModelConfigInputSchema = external_exports.object({
11306
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(),
11307
11316
  model: external_exports.string(),
11308
11317
  variant: external_exports.string().refine(isValidGenerationMode, "Invalid generation mode"),
11309
11318
  tier: external_exports.string().nullable().optional(),
@@ -11479,7 +11488,7 @@ var PrepareCanvasPasteBodySchema = external_exports.object({
11479
11488
  })
11480
11489
  ).max(200).refine(
11481
11490
  (entries) => entries.reduce(
11482
- (count, entry) => count + entry.urls.length,
11491
+ (count2, entry) => count2 + entry.urls.length,
11483
11492
  0
11484
11493
  ) <= 200,
11485
11494
  "Copy at most 200 layer images at a time"
@@ -11667,6 +11676,12 @@ var NodeVersionResponseSchema = external_exports.object({
11667
11676
  */
11668
11677
  producedBy: VersionProducedBySchema.nullable().optional(),
11669
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(),
11670
11685
  errorMessage: external_exports.string().nullable(),
11671
11686
  errorSeverity: ErrorSeveritySchema.nullable(),
11672
11687
  errorRetryable: external_exports.boolean().nullable().optional(),
@@ -11959,6 +11974,58 @@ var CanvasPreviewImageWidthSchema = external_exports.union([
11959
11974
  ]);
11960
11975
  var MAX_HIGH_RESOLUTION_URL_VERSION_IDS = 100;
11961
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
+
11962
12029
  // ../api-contract/src/free-generation/schema.ts
11963
12030
  var GRANTABLE_FREE_GENERATION_ACTION_KINDS = [
11964
12031
  "cast_video",
@@ -12093,10 +12160,6 @@ var NodeRunQuoteOptionSchema = external_exports.object({
12093
12160
  resolution: OutputResolutionSchema.optional(),
12094
12161
  duration: external_exports.number().positive().optional()
12095
12162
  });
12096
- var QuoteNodeRunBodySchema = external_exports.object({
12097
- canvasId: external_exports.string().uuid(),
12098
- options: external_exports.array(NodeRunQuoteOptionSchema).min(1).max(4)
12099
- });
12100
12163
  var QuoteNodeRunResponseSchema = external_exports.object({
12101
12164
  quotes: external_exports.array(
12102
12165
  NodeRunQuoteOptionSchema.extend({
@@ -12110,8 +12173,29 @@ var QuoteNodeRunResponseSchema = external_exports.object({
12110
12173
  })
12111
12174
  )
12112
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
+ });
12113
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(),
12114
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(),
12115
12199
  postProcess: NodeRunPostProcessSchema.optional(),
12116
12200
  /** Product surface this run originated on. Defaults to `canvas` server-side. */
12117
12201
  origin: RunOriginSchema.optional(),
@@ -12163,6 +12247,8 @@ var RunNodeBodySchema = external_exports.object({
12163
12247
  backgroundColor: RgbColorSchema.optional(),
12164
12248
  /** Explicit image URLs to include as inputs (merged with edge-resolved images). */
12165
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(),
12166
12252
  /**
12167
12253
  * Provider-agnostic voice selection for audio TTS, validated against the
12168
12254
  * resolved variant's voice capability. Mode-specific validation lives in
@@ -12593,7 +12679,7 @@ var BulkNodeRunQuerySchema = external_exports.object({
12593
12679
  */
12594
12680
  nodeIds: external_exports.union([
12595
12681
  external_exports.string().transform(
12596
- (value) => value.split(",").filter((id) => id.length > 0)
12682
+ (value) => value.split(",").filter((id2) => id2.length > 0)
12597
12683
  ),
12598
12684
  external_exports.array(external_exports.string())
12599
12685
  ]).pipe(external_exports.array(external_exports.string().uuid()).min(1).max(5e3)).optional()
@@ -12641,6 +12727,8 @@ var BulkNodeRunStartResponseSchema = BulkNodeRunResponseSchema.extend({
12641
12727
 
12642
12728
  // ../api-contract/src/canvas/schema/direct-mutation.ts
12643
12729
  var CreateDirectNodeBodyObjectSchema = external_exports.object({
12730
+ /** Refuse unsupported output settings instead of normalizing them. */
12731
+ strictSettings: external_exports.boolean().optional(),
12644
12732
  id: external_exports.string().uuid(),
12645
12733
  nodeType: NodeTypeSchema,
12646
12734
  geometry: GeometrySchema,
@@ -13342,8 +13430,8 @@ var CAST_MICRODRAMA_STYLE_IDS = [
13342
13430
  "drama-2d"
13343
13431
  ];
13344
13432
  var CastMicrodramaStyleIdSchema = external_exports.enum(CAST_MICRODRAMA_STYLE_IDS);
13345
- function isCastMicrodramaStyle(id) {
13346
- return CAST_MICRODRAMA_STYLE_IDS.some((style) => style === id);
13433
+ function isCastMicrodramaStyle(id2) {
13434
+ return CAST_MICRODRAMA_STYLE_IDS.some((style) => style === id2);
13347
13435
  }
13348
13436
  var CastVideoStyleSchema = external_exports.object({
13349
13437
  id: CastVideoStyleIdSchema,
@@ -13702,6 +13790,10 @@ var UpdateCustomAvatarBodySchema = external_exports.object({
13702
13790
  var DeleteCustomAvatarResponseSchema = external_exports.object({
13703
13791
  id: external_exports.string().uuid()
13704
13792
  });
13793
+ var BadRequestSchema = MessageResponseSchema;
13794
+ var ForbiddenSchema = MessageResponseSchema;
13795
+ var NotFoundSchema = MessageResponseSchema;
13796
+ var ConflictSchema = MessageResponseSchema;
13705
13797
  var AvatarBackgroundSchema = CastBackgroundSchema;
13706
13798
  var CustomAvatarBackgroundSchema = AvatarBackgroundSchema.extend({
13707
13799
  customAvatarId: external_exports.string().uuid()
@@ -13709,6 +13801,9 @@ var CustomAvatarBackgroundSchema = AvatarBackgroundSchema.extend({
13709
13801
  var ListCustomAvatarBackgroundsResponseSchema = external_exports.object({
13710
13802
  backgrounds: external_exports.array(CustomAvatarBackgroundSchema)
13711
13803
  });
13804
+ var CreateCustomAvatarBackgroundBodySchema = CreateCastBackgroundBodySchema;
13805
+ var UpdateCustomAvatarBackgroundBodySchema = UpdateCastBackgroundBodySchema;
13806
+ var DeleteCustomAvatarBackgroundResponseSchema = DeleteCastBackgroundResponseSchema;
13712
13807
  var CustomAvatarRenderLayoutSchema = external_exports.enum(["sheet", "portrait"]);
13713
13808
  var CustomAvatarRenderInputSchema = external_exports.object({
13714
13809
  /** Main photo first. Empty only for a portrait made from a description. */
@@ -14317,6 +14412,19 @@ var CastTemplateReferenceSchema = external_exports.object({
14317
14412
  source: external_exports.enum(["static", "database"])
14318
14413
  });
14319
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
+
14320
14428
  // ../api-contract/src/cast/video.ts
14321
14429
  var CAST_VIDEO_MAX_PROPS = 6;
14322
14430
  var MAX_CAST_VIDEO_SECTIONS = 300;
@@ -14392,6 +14500,22 @@ var CastVideoInputSchema = external_exports.object({
14392
14500
  aspectRatio: OutputAspectRatioSchema.default("9:16"),
14393
14501
  workId: external_exports.string().uuid().optional()
14394
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
+ );
14395
14519
  var CastVideoRequestSchema = CastVideoInputSchema.extend({
14396
14520
  useFreeGeneration: external_exports.boolean().optional(),
14397
14521
  voice: CastVideoVoiceSchema.optional(),
@@ -14403,6 +14527,9 @@ var CastVideoRequestSchema = CastVideoInputSchema.extend({
14403
14527
  }).strict()
14404
14528
  ])
14405
14529
  });
14530
+ var CastVideoUrlRequestSchema = CastVideoRequestSchema.extend(
14531
+ castVideoPropRequests
14532
+ );
14406
14533
  var CastVideoReviewSchema = external_exports.object({
14407
14534
  avatar: external_exports.object({ name: external_exports.string(), imageUrl: external_exports.string().nullable() }),
14408
14535
  voice: external_exports.string(),
@@ -14431,6 +14558,18 @@ var CastVideoReviewSchema = external_exports.object({
14431
14558
  })
14432
14559
  ).optional()
14433
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
+ });
14434
14573
  var preparation = external_exports.object({
14435
14574
  attemptId: external_exports.string().uuid(),
14436
14575
  preparationToken: external_exports.string().uuid().optional(),
@@ -14450,13 +14589,30 @@ var preparation = external_exports.object({
14450
14589
  /** The section, from 0, its heading is on. */
14451
14590
  startsAtSection: external_exports.number().int().min(0),
14452
14591
  place: external_exports.string().nullable(),
14592
+ placePictureAssetId: external_exports.string().optional(),
14453
14593
  time: CastSceneTimeSchema,
14454
14594
  timeLabel: external_exports.string().optional(),
14455
14595
  looks: external_exports.array(
14456
- external_exports.object({ avatarId: external_exports.string(), look: external_exports.string() })
14596
+ external_exports.object({
14597
+ avatarId: external_exports.string(),
14598
+ look: external_exports.string(),
14599
+ pictureAssetId: external_exports.string().optional()
14600
+ })
14457
14601
  )
14458
14602
  })
14459
- ).optional()
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()
14460
14616
  });
14461
14617
  var PrepareCastVideoResponseSchema = external_exports.discriminatedUnion("status", [
14462
14618
  preparation.extend({
@@ -14493,8 +14649,13 @@ var RunCastVideoBodySchema = external_exports.object({
14493
14649
  * The studio session the video continues (the analytics' `workId` and
14494
14650
  * `rootWorkId`), so History stacks it with that session's takes.
14495
14651
  */
14496
- studioWork: CastStudioWorkSchema.optional()
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()
14497
14655
  }).strict();
14656
+ var RunCastVideoUrlBodySchema = RunCastVideoBodySchema.extend({
14657
+ input: CastVideoInputRequestSchema
14658
+ });
14498
14659
  var CastPreparedVideoQuoteSchema = external_exports.object({
14499
14660
  estimatedCredits: external_exports.number().finite().nonnegative()
14500
14661
  });
@@ -14524,7 +14685,9 @@ var CastVideoResponseSchema = external_exports.discriminatedUnion("status", [
14524
14685
  }),
14525
14686
  videoReference.extend({
14526
14687
  status: external_exports.literal("failed"),
14527
- message: external_exports.string()
14688
+ message: external_exports.string(),
14689
+ /** Why it failed; absent from a video saved before reasons. */
14690
+ failureReason: GenerationFailureReasonSchema.optional()
14528
14691
  })
14529
14692
  ]);
14530
14693
  var CastVideoDownloadSchema = external_exports.object({
@@ -15068,8 +15231,8 @@ var INSUFFICIENT_CREDITS_ERROR_CODE = "INSUFFICIENT_CREDITS";
15068
15231
  function isInsufficientCreditsError(body) {
15069
15232
  return typeof body === "object" && body !== null && body.code === INSUFFICIENT_CREDITS_ERROR_CODE;
15070
15233
  }
15071
- function countNodes(count) {
15072
- return `${count} ${count === 1 ? "node" : "nodes"}`;
15234
+ function countNodes(count2) {
15235
+ return `${count2} ${count2 === 1 ? "node" : "nodes"}`;
15073
15236
  }
15074
15237
  function describeCreditShortfall(shortfall) {
15075
15238
  const runCount = shortfall.affordableNodeIds.length;
@@ -15080,6 +15243,485 @@ function describeCreditShortfall(shortfall) {
15080
15243
  // ../api-contract/src/credit-refusal.ts
15081
15244
  var MEMBER_CREDIT_LIMIT_ERROR_CODE = "MEMBER_CREDIT_LIMIT";
15082
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
+
15083
15725
  // ../api-contract/src/task-budget/refusal.ts
15084
15726
  var TASK_BUDGET_EXCEEDED_ERROR_CODE = "TASK_BUDGET_EXCEEDED";
15085
15727
 
@@ -15121,7 +15763,9 @@ var API_ERROR_CODE = {
15121
15763
  /** The request asked for a free generation and none covers it; refused, never billed. */
15122
15764
  freeGenerationUnavailable: FREE_GENERATION_UNAVAILABLE_ERROR_CODE,
15123
15765
  /** Someone saved the subtitles since this edit started; the client reloads them. */
15124
- 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
15125
15769
  };
15126
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.`;
15127
15771
 
@@ -15952,6 +16596,14 @@ var GenerationMediaMetadataSchema = external_exports.object({
15952
16596
  });
15953
16597
  var GenerationRunBodySchema = external_exports.object({
15954
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(),
15955
16607
  model: external_exports.string().trim().min(1),
15956
16608
  tier: external_exports.string().optional(),
15957
16609
  prompt: external_exports.string().trim().min(1).optional(),
@@ -16664,7 +17316,7 @@ var STYLE_TRANSFER_WITH_REPLACEMENTS = {
16664
17316
  var DittoInputSchema = external_exports.union([MultiDittoInputSchema, LegacyDittoInputSchema]).refine(hasDittoEdit, MISSING_DITTO_EDIT).refine(styleTransferHasNoReplacements, STYLE_TRANSFER_WITH_REPLACEMENTS);
16665
17317
  function requireReferenceOrAvatar(input, context2) {
16666
17318
  input.replacements?.forEach((target, index) => {
16667
- if (!target.referenceAssetId && !target.avatar)
17319
+ if (!target.referenceAssetId && !target.referenceUrl && !target.avatar)
16668
17320
  context2.addIssue({
16669
17321
  code: "custom",
16670
17322
  path: ["replacements", index],
@@ -16679,14 +17331,48 @@ var PrepareDittoBodySchema = external_exports.union([
16679
17331
  }),
16680
17332
  LegacyDittoInputSchema
16681
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
+ }
16682
17364
  var CreateDittoBodySchema = DittoSettingsSchema.extend({
16683
- replacements: DittoTargetRequestsSchema.default([]).describe(
17365
+ ...DittoSourceRequestFields,
17366
+ replacements: DittoTargetUrlRequestsSchema.default([]).describe(
16684
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."
16685
17368
  ),
16686
17369
  maxCredits: external_exports.number().finite().nonnegative().optional().describe(
16687
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."
16688
17374
  )
16689
- }).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);
16690
17376
  function getDittoTargets(input) {
16691
17377
  if (input.replacements) return input.replacements;
16692
17378
  return [
@@ -17744,6 +18430,12 @@ var CastGenerationResponseSchema = external_exports.object({
17744
18430
  * server built before collections.
17745
18431
  */
17746
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(),
17747
18439
  /**
17748
18440
  * The studio session the take was made in, on a History read: its key and
17749
18441
  * how many takes the read lists in it, loaded or not. Null for a take in
@@ -18006,6 +18698,11 @@ var CastSeriesPlaceSchema = external_exports.object({
18006
18698
  * server older than it.
18007
18699
  */
18008
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(),
18009
18706
  createdAt: external_exports.string(),
18010
18707
  updatedAt: external_exports.string()
18011
18708
  });
@@ -18032,6 +18729,8 @@ var CastSeriesLookSchema = external_exports.object({
18032
18729
  * server older than it.
18033
18730
  */
18034
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(),
18035
18734
  createdAt: external_exports.string(),
18036
18735
  updatedAt: external_exports.string()
18037
18736
  });
@@ -18094,6 +18793,30 @@ var UpdateCastSeriesLookBodySchema = external_exports.object({
18094
18793
  (body) => body.name !== void 0 || body.description !== void 0 || body.pictureAssetId !== void 0,
18095
18794
  { message: "Change the name, the description or the picture" }
18096
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
+ });
18097
18820
 
18098
18821
  // ../api-contract/src/custom-context/schema.ts
18099
18822
  var MAX_CUSTOM_CONTEXT_NAME_LENGTH = 80;
@@ -18774,87 +19497,425 @@ var SearchElementsBodySchema = createCursorPaginationRequestSchema({
18774
19497
  });
18775
19498
  var SearchElementsResponseSchema = createPaginatedResponseSchema(ElementSummarySchema);
18776
19499
 
18777
- // ../api-contract/src/generation-preferences/schema.ts
18778
- function overridable(section) {
18779
- const shape = Object.fromEntries(
18780
- Object.entries(section.shape).map(([key2, field]) => [
18781
- key2,
18782
- field.nullable().optional()
18783
- ])
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"
18784
19537
  );
18785
- return external_exports.object(shape);
18786
- }
18787
- var presetSections = CanvasMediaPresetSchema.shape;
18788
- var COST_QUALITY_PREFERENCES = COST_QUALITY_VIDEO_PREFERENCES;
18789
- var CostQualityPreferenceSchema = external_exports.enum(COST_QUALITY_PREFERENCES);
18790
- var PersonalMediaPresetSchema = external_exports.object({
18791
- image: overridable(
18792
- presetSections.image.unwrap().pick({
18793
- model: true,
18794
- mode: true,
18795
- tier: true,
18796
- aspectRatio: true,
18797
- resolution: true,
18798
- fast: true,
18799
- numVariations: true
18800
- })
18801
- ).optional(),
18802
- video: overridable(
18803
- presetSections.video.unwrap().pick({
18804
- model: true,
18805
- mode: true,
18806
- tier: true,
18807
- aspectRatio: true,
18808
- resolution: true,
18809
- duration: true,
18810
- fast: true,
18811
- numVariations: true
18812
- })
18813
- ).optional(),
18814
- text: overridable(
18815
- presetSections.text.unwrap().pick({
18816
- model: true,
18817
- mode: true,
18818
- tier: true,
18819
- fast: true,
18820
- numVariations: true
18821
- })
18822
- ).optional(),
18823
- audio: overridable(
18824
- presetSections.audio.unwrap().pick({
18825
- model: true,
18826
- mode: true,
18827
- tier: true,
18828
- voiceId: true,
18829
- voiceSettings: true,
18830
- duration: true,
18831
- numVariations: true
18832
- })
18833
- ).optional()
18834
- });
18835
- var TeamGenerationPreferencesSchema = external_exports.object({
18836
- modelPresets: CanvasMediaPresetSchema,
18837
- defaultFont: CanvasDefaultFontSchema.nullable(),
18838
- costQualityPreference: CostQualityPreferenceSchema.optional()
18839
- });
18840
- var PersonalGenerationPreferencesSchema = external_exports.object({
18841
- modelPresets: PersonalMediaPresetSchema
18842
- });
18843
- var EffectiveGenerationPreferencesSchema = TeamGenerationPreferencesSchema.omit({ costQualityPreference: true });
18844
-
18845
- // ../api-contract/src/presets/schema.ts
18846
- var TextNodeDataSchema = external_exports.object({
18847
- title: external_exports.string(),
18848
- mode: external_exports.string(),
18849
- prompt: external_exports.string(),
18850
- /** `getValidHandles` builds a text node's targets as `["text", ...this]`. */
18851
- supportedInputs: external_exports.array(external_exports.string()).optional()
18852
- });
18853
- var ImageNodeDataSchema = external_exports.object({
18854
- title: external_exports.string(),
18855
- src: external_exports.string().optional(),
18856
- mode: external_exports.string(),
18857
- aspectRatio: external_exports.string().optional(),
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
+
19838
+ // ../api-contract/src/generation-preferences/schema.ts
19839
+ function overridable(section) {
19840
+ const shape = Object.fromEntries(
19841
+ Object.entries(section.shape).map(([key2, field]) => [
19842
+ key2,
19843
+ field.nullable().optional()
19844
+ ])
19845
+ );
19846
+ return external_exports.object(shape);
19847
+ }
19848
+ var presetSections = CanvasMediaPresetSchema.shape;
19849
+ var COST_QUALITY_PREFERENCES = COST_QUALITY_VIDEO_PREFERENCES;
19850
+ var CostQualityPreferenceSchema = external_exports.enum(COST_QUALITY_PREFERENCES);
19851
+ var PersonalMediaPresetSchema = external_exports.object({
19852
+ image: overridable(
19853
+ presetSections.image.unwrap().pick({
19854
+ model: true,
19855
+ mode: true,
19856
+ tier: true,
19857
+ aspectRatio: true,
19858
+ resolution: true,
19859
+ fast: true,
19860
+ numVariations: true
19861
+ })
19862
+ ).optional(),
19863
+ video: overridable(
19864
+ presetSections.video.unwrap().pick({
19865
+ model: true,
19866
+ mode: true,
19867
+ tier: true,
19868
+ aspectRatio: true,
19869
+ resolution: true,
19870
+ duration: true,
19871
+ fast: true,
19872
+ numVariations: true
19873
+ })
19874
+ ).optional(),
19875
+ text: overridable(
19876
+ presetSections.text.unwrap().pick({
19877
+ model: true,
19878
+ mode: true,
19879
+ tier: true,
19880
+ fast: true,
19881
+ numVariations: true
19882
+ })
19883
+ ).optional(),
19884
+ audio: overridable(
19885
+ presetSections.audio.unwrap().pick({
19886
+ model: true,
19887
+ mode: true,
19888
+ tier: true,
19889
+ voiceId: true,
19890
+ voiceSettings: true,
19891
+ duration: true,
19892
+ numVariations: true
19893
+ })
19894
+ ).optional()
19895
+ });
19896
+ var TeamGenerationPreferencesSchema = external_exports.object({
19897
+ modelPresets: CanvasMediaPresetSchema,
19898
+ defaultFont: CanvasDefaultFontSchema.nullable(),
19899
+ costQualityPreference: CostQualityPreferenceSchema.optional()
19900
+ });
19901
+ var PersonalGenerationPreferencesSchema = external_exports.object({
19902
+ modelPresets: PersonalMediaPresetSchema
19903
+ });
19904
+ var EffectiveGenerationPreferencesSchema = TeamGenerationPreferencesSchema.omit({ costQualityPreference: true });
19905
+
19906
+ // ../api-contract/src/presets/schema.ts
19907
+ var TextNodeDataSchema = external_exports.object({
19908
+ title: external_exports.string(),
19909
+ mode: external_exports.string(),
19910
+ prompt: external_exports.string(),
19911
+ /** `getValidHandles` builds a text node's targets as `["text", ...this]`. */
19912
+ supportedInputs: external_exports.array(external_exports.string()).optional()
19913
+ });
19914
+ var ImageNodeDataSchema = external_exports.object({
19915
+ title: external_exports.string(),
19916
+ src: external_exports.string().optional(),
19917
+ mode: external_exports.string(),
19918
+ aspectRatio: external_exports.string().optional(),
18858
19919
  prompt: external_exports.string()
18859
19920
  });
18860
19921
  var VideoNodeDataSchema = external_exports.object({
@@ -22696,6 +23757,29 @@ var canvasContract = c5.router({
22696
23757
  404: NodeRunErrorResponseSchema
22697
23758
  }
22698
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
+ },
22699
23783
  getNodeRun: {
22700
23784
  method: "GET",
22701
23785
  path: "/node-runs/:nodeRunId",
@@ -23392,7 +24476,7 @@ var canvasContract = c5.router({
23392
24476
  }).nullable().optional(),
23393
24477
  status: external_exports.string().min(1).max(80)
23394
24478
  }).refine(
23395
- (c20) => c20.nodeIds.length > 0 || c20.bounds != null,
24479
+ (c22) => c22.nodeIds.length > 0 || c22.bounds != null,
23396
24480
  "claim must include nodeIds or bounds"
23397
24481
  ).nullable()
23398
24482
  }),
@@ -23417,9 +24501,186 @@ var canvasContract = c5.router({
23417
24501
  }
23418
24502
  });
23419
24503
 
23420
- // ../api-contract/src/custom-font/routes.ts
24504
+ // ../api-contract/src/custom-avatar/routes.ts
23421
24505
  var c6 = initContract();
23422
- 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({
23423
24684
  list: {
23424
24685
  method: "GET",
23425
24686
  path: "/custom-fonts",
@@ -23448,8 +24709,8 @@ var customFontContract = c6.router({
23448
24709
  });
23449
24710
 
23450
24711
  // ../api-contract/src/ditto/routes.ts
23451
- var c7 = initContract();
23452
- var dittoContract = c7.router({
24712
+ var c8 = initContract();
24713
+ var dittoContract = c8.router({
23453
24714
  prepareSourceClip: {
23454
24715
  method: "POST",
23455
24716
  path: "/ditto/source-clips",
@@ -23758,7 +25019,7 @@ var dittoContract = c7.router({
23758
25019
  method: "DELETE",
23759
25020
  path: "/ditto/custom-styles/:styleId",
23760
25021
  pathParams: DittoCustomStylePathSchema,
23761
- body: c7.noBody(),
25022
+ body: c8.noBody(),
23762
25023
  responses: {
23763
25024
  200: external_exports.object({ id: external_exports.string().uuid() }),
23764
25025
  403: MessageResponseSchema,
@@ -23826,6 +25087,31 @@ var dittoContract = c7.router({
23826
25087
  },
23827
25088
  summary: "A Ditto video's progress, and its video once status is ready"
23828
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
+ },
23829
25115
  getReplacement: {
23830
25116
  method: "GET",
23831
25117
  path: "/ditto/replacements/:generationId",
@@ -23854,7 +25140,7 @@ var dittoContract = c7.router({
23854
25140
  pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
23855
25141
  body: null,
23856
25142
  responses: {
23857
- 204: c7.noBody(),
25143
+ 204: c8.noBody(),
23858
25144
  404: MessageResponseSchema
23859
25145
  },
23860
25146
  summary: "Remove the signed-in member's rating from a Ditto video"
@@ -23888,7 +25174,7 @@ var dittoContract = c7.router({
23888
25174
  pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
23889
25175
  body: null,
23890
25176
  responses: {
23891
- 204: c7.noBody(),
25177
+ 204: c8.noBody(),
23892
25178
  403: MessageResponseSchema,
23893
25179
  404: MessageResponseSchema
23894
25180
  }
@@ -23984,7 +25270,7 @@ var dittoContract = c7.router({
23984
25270
  pathParams: external_exports.object({ importId: external_exports.string().uuid() }),
23985
25271
  body: null,
23986
25272
  responses: {
23987
- 204: c7.noBody(),
25273
+ 204: c8.noBody(),
23988
25274
  403: MessageResponseSchema,
23989
25275
  404: MessageResponseSchema
23990
25276
  }
@@ -24023,7 +25309,7 @@ var dittoContract = c7.router({
24023
25309
  });
24024
25310
 
24025
25311
  // ../api-contract/src/element/routes.ts
24026
- var c8 = initContract();
25312
+ var c9 = initContract();
24027
25313
  var elementParams = external_exports.object({ elementId: external_exports.string().uuid() });
24028
25314
  var versionParams = elementParams.extend({ versionId: external_exports.string().uuid() });
24029
25315
  var reviewResponses = {
@@ -24033,7 +25319,7 @@ var reviewResponses = {
24033
25319
  404: MessageResponseSchema,
24034
25320
  409: MessageResponseSchema
24035
25321
  };
24036
- var elementContract = c8.router({
25322
+ var elementContract = c9.router({
24037
25323
  /** Cast avatars this team can add to Elements: those no live element was made from. */
24038
25324
  listElementCastAvatars: {
24039
25325
  method: "GET",
@@ -24458,8 +25744,8 @@ var elementContract = c8.router({
24458
25744
  });
24459
25745
 
24460
25746
  // ../api-contract/src/files/routes.ts
24461
- var c9 = initContract();
24462
- var filesContract = c9.router({
25747
+ var c10 = initContract();
25748
+ var filesContract = c10.router({
24463
25749
  createFileFolder: {
24464
25750
  method: "POST",
24465
25751
  path: "/files/folders",
@@ -24540,7 +25826,7 @@ var filesContract = c9.router({
24540
25826
  query: FolderDeleteQuerySchema,
24541
25827
  body: null,
24542
25828
  responses: {
24543
- 204: c9.noBody(),
25829
+ 204: c10.noBody(),
24544
25830
  403: ErrorBodySchema,
24545
25831
  404: ErrorBodySchema
24546
25832
  },
@@ -24585,7 +25871,7 @@ var filesContract = c9.router({
24585
25871
  pathParams: AssetTagIdParamsSchema,
24586
25872
  body: null,
24587
25873
  responses: {
24588
- 204: c9.noBody(),
25874
+ 204: c10.noBody(),
24589
25875
  403: ErrorBodySchema,
24590
25876
  404: ErrorBodySchema
24591
25877
  },
@@ -24724,7 +26010,7 @@ var filesContract = c9.router({
24724
26010
  pathParams: FileAssetIdParamsSchema,
24725
26011
  body: null,
24726
26012
  responses: {
24727
- 204: c9.noBody(),
26013
+ 204: c10.noBody(),
24728
26014
  403: ErrorBodySchema,
24729
26015
  404: ErrorBodySchema
24730
26016
  },
@@ -24736,7 +26022,7 @@ var filesContract = c9.router({
24736
26022
  pathParams: FileAssetIdParamsSchema,
24737
26023
  body: null,
24738
26024
  responses: {
24739
- 204: c9.noBody(),
26025
+ 204: c10.noBody(),
24740
26026
  403: ErrorBodySchema,
24741
26027
  404: ErrorBodySchema
24742
26028
  },
@@ -24759,7 +26045,7 @@ var filesContract = c9.router({
24759
26045
  pathParams: FileAssetIdParamsSchema,
24760
26046
  body: null,
24761
26047
  responses: {
24762
- 204: c9.noBody(),
26048
+ 204: c10.noBody(),
24763
26049
  403: ErrorBodySchema,
24764
26050
  404: ErrorBodySchema
24765
26051
  },
@@ -24779,7 +26065,7 @@ var filesContract = c9.router({
24779
26065
  pathParams: FileAssetIdParamsSchema,
24780
26066
  body: null,
24781
26067
  responses: {
24782
- 204: c9.noBody(),
26068
+ 204: c10.noBody(),
24783
26069
  403: ErrorBodySchema,
24784
26070
  404: ErrorBodySchema
24785
26071
  },
@@ -24791,7 +26077,7 @@ var filesContract = c9.router({
24791
26077
  pathParams: FileAssetIdParamsSchema,
24792
26078
  body: null,
24793
26079
  responses: {
24794
- 204: c9.noBody(),
26080
+ 204: c10.noBody(),
24795
26081
  403: ErrorBodySchema,
24796
26082
  404: ErrorBodySchema
24797
26083
  },
@@ -24991,8 +26277,8 @@ var filesContract = c9.router({
24991
26277
  });
24992
26278
 
24993
26279
  // ../api-contract/src/free-generation/routes.ts
24994
- var c10 = initContract();
24995
- var freeGenerationContract = c10.router({
26280
+ var c11 = initContract();
26281
+ var freeGenerationContract = c11.router({
24996
26282
  listFreeGenerations: {
24997
26283
  method: "GET",
24998
26284
  path: "/free-generations",
@@ -25008,8 +26294,8 @@ var freeGenerationContract = c10.router({
25008
26294
  });
25009
26295
 
25010
26296
  // ../api-contract/src/generation/routes.ts
25011
- var c11 = initContract();
25012
- var generationContract = c11.router({
26297
+ var c12 = initContract();
26298
+ var generationContract = c12.router({
25013
26299
  listGenerativeModels: {
25014
26300
  method: "GET",
25015
26301
  path: "/generation/models",
@@ -25118,7 +26404,7 @@ var generationContract = c11.router({
25118
26404
  until: external_exports.string().datetime().optional()
25119
26405
  }),
25120
26406
  responses: {
25121
- 200: c11.otherResponse({
26407
+ 200: c12.otherResponse({
25122
26408
  contentType: "text/csv",
25123
26409
  body: external_exports.string()
25124
26410
  })
@@ -25144,9 +26430,107 @@ var generationContract = c11.router({
25144
26430
  }
25145
26431
  });
25146
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,
26523
+ responses: {
26524
+ 200: MotionNodeRunProgressSchema,
26525
+ 403: MessageResponseSchema,
26526
+ 404: MessageResponseSchema
26527
+ }
26528
+ }
26529
+ });
26530
+
25147
26531
  // ../api-contract/src/presets/routes.ts
25148
- var c12 = initContract();
25149
- var presetsContract = c12.router({
26532
+ var c14 = initContract();
26533
+ var presetsContract = c14.router({
25150
26534
  listPresets: {
25151
26535
  method: "GET",
25152
26536
  path: "/presets",
@@ -25166,8 +26550,8 @@ var UserActionEvent = {
25166
26550
  var RecordUserActionSchema = external_exports.object({ event: external_exports.nativeEnum(UserActionEvent) }).strict();
25167
26551
 
25168
26552
  // ../api-contract/src/profile/routes.ts
25169
- var c13 = initContract();
25170
- var profileContract = c13.router({
26553
+ var c15 = initContract();
26554
+ var profileContract = c15.router({
25171
26555
  listExperiences: {
25172
26556
  method: "GET",
25173
26557
  path: "/profile/me/experiences",
@@ -25187,7 +26571,7 @@ var profileContract = c13.router({
25187
26571
  method: "POST",
25188
26572
  path: "/profile/me/actions",
25189
26573
  body: RecordUserActionSchema,
25190
- responses: { 204: c13.noBody() }
26574
+ responses: { 204: c15.noBody() }
25191
26575
  },
25192
26576
  getMyProfile: {
25193
26577
  method: "GET",
@@ -25205,7 +26589,7 @@ var profileContract = c13.router({
25205
26589
  path: "/profile/me",
25206
26590
  body: null,
25207
26591
  responses: {
25208
- 204: c13.noBody(),
26592
+ 204: c15.noBody(),
25209
26593
  400: ApiErrorResponseSchema,
25210
26594
  409: ApiErrorResponseSchema,
25211
26595
  503: ApiErrorResponseSchema
@@ -25315,8 +26699,8 @@ var profileContract = c13.router({
25315
26699
  });
25316
26700
 
25317
26701
  // ../api-contract/src/project/routes.ts
25318
- var c14 = initContract();
25319
- var projectContract = c14.router({
26702
+ var c16 = initContract();
26703
+ var projectContract = c16.router({
25320
26704
  searchProjects: {
25321
26705
  method: "POST",
25322
26706
  path: "/projects/search",
@@ -25397,14 +26781,14 @@ var projectContract = c14.router({
25397
26781
  path: "/projects/:projectId",
25398
26782
  pathParams: ProjectIdParamsSchema,
25399
26783
  body: null,
25400
- responses: { 204: c14.noBody() }
26784
+ responses: { 204: c16.noBody() }
25401
26785
  },
25402
26786
  recordProjectView: {
25403
26787
  method: "POST",
25404
26788
  path: "/projects/:projectId/view",
25405
26789
  pathParams: ProjectIdParamsSchema,
25406
26790
  body: RecordProjectViewBodySchema,
25407
- responses: { 204: c14.noBody() }
26791
+ responses: { 204: c16.noBody() }
25408
26792
  },
25409
26793
  listRecentCanvases: {
25410
26794
  method: "GET",
@@ -25523,7 +26907,7 @@ var projectContract = c14.router({
25523
26907
  path: "/projects/:projectId/settings",
25524
26908
  pathParams: ProjectIdParamsSchema,
25525
26909
  body: null,
25526
- responses: { 204: c14.noBody() }
26910
+ responses: { 204: c16.noBody() }
25527
26911
  },
25528
26912
  // ── Project Memory ──────────────────────────────────────────────
25529
26913
  getProjectMemory: {
@@ -25660,8 +27044,8 @@ var projectContract = c14.router({
25660
27044
  });
25661
27045
 
25662
27046
  // ../api-contract/src/team/routes.ts
25663
- var c15 = initContract();
25664
- var teamContract = c15.router({
27047
+ var c17 = initContract();
27048
+ var teamContract = c17.router({
25665
27049
  createTeam: {
25666
27050
  method: "POST",
25667
27051
  path: "/teams",
@@ -25768,13 +27152,13 @@ var teamContract = c15.router({
25768
27152
  method: "DELETE",
25769
27153
  path: "/teams/current",
25770
27154
  body: null,
25771
- responses: { 204: c15.noBody() }
27155
+ responses: { 204: c17.noBody() }
25772
27156
  },
25773
27157
  leaveTeam: {
25774
27158
  method: "POST",
25775
27159
  path: "/teams/current/leave",
25776
27160
  body: null,
25777
- responses: { 204: c15.noBody() }
27161
+ responses: { 204: c17.noBody() }
25778
27162
  },
25779
27163
  listMembers: {
25780
27164
  method: "GET",
@@ -25807,7 +27191,7 @@ var teamContract = c15.router({
25807
27191
  path: "/teams/current/members/:userId",
25808
27192
  pathParams: external_exports.object({ userId: external_exports.string().uuid() }),
25809
27193
  body: null,
25810
- responses: { 204: c15.noBody() }
27194
+ responses: { 204: c17.noBody() }
25811
27195
  },
25812
27196
  getShareableLink: {
25813
27197
  method: "GET",
@@ -25869,7 +27253,7 @@ var teamContract = c15.router({
25869
27253
  path: "/teams/current/invite-email/:inviteId",
25870
27254
  pathParams: external_exports.object({ inviteId: external_exports.string().uuid() }),
25871
27255
  body: null,
25872
- responses: { 204: c15.noBody() }
27256
+ responses: { 204: c17.noBody() }
25873
27257
  },
25874
27258
  listJoinRequests: {
25875
27259
  method: "GET",
@@ -25888,7 +27272,7 @@ var teamContract = c15.router({
25888
27272
  path: "/teams/current/join-requests/:requestId",
25889
27273
  pathParams: external_exports.object({ requestId: external_exports.string().uuid() }),
25890
27274
  body: null,
25891
- responses: { 204: c15.noBody() }
27275
+ responses: { 204: c17.noBody() }
25892
27276
  },
25893
27277
  updateDomainJoinSettings: {
25894
27278
  method: "PATCH",
@@ -25923,8 +27307,8 @@ var teamContract = c15.router({
25923
27307
  });
25924
27308
 
25925
27309
  // ../api-contract/src/upload/routes.ts
25926
- var c16 = initContract();
25927
- var uploadContract = c16.router({
27310
+ var c18 = initContract();
27311
+ var uploadContract = c18.router({
25928
27312
  init: {
25929
27313
  method: "POST",
25930
27314
  path: "/upload/init",
@@ -25997,8 +27381,8 @@ var uploadContract = c16.router({
25997
27381
  });
25998
27382
 
25999
27383
  // ../api-contract/src/cast-template/routes.ts
26000
- var c17 = initContract();
26001
- var castTemplateContract = c17.router({
27384
+ var c19 = initContract();
27385
+ var castTemplateContract = c19.router({
26002
27386
  search: {
26003
27387
  summary: "Search Cast script templates",
26004
27388
  method: "POST",
@@ -26035,7 +27419,9 @@ var CastCompletionSchema = external_exports.object({
26035
27419
  ]),
26036
27420
  subtitleRunId: external_exports.string().uuid().optional(),
26037
27421
  outputVersionId: external_exports.string().uuid().optional(),
26038
- 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()
26039
27425
  });
26040
27426
 
26041
27427
  // ../api-contract/src/cast/script-language.ts
@@ -26180,8 +27566,8 @@ var ResolveCastPropReferencesResponseSchema = external_exports.object({
26180
27566
  });
26181
27567
 
26182
27568
  // ../api-contract/src/cast/routes.ts
26183
- var c18 = initContract();
26184
- var castContract = c18.router({
27569
+ var c20 = initContract();
27570
+ var castContract = c20.router({
26185
27571
  getCastOptions: {
26186
27572
  method: "GET",
26187
27573
  path: "/cast/options",
@@ -26205,7 +27591,7 @@ var castContract = c18.router({
26205
27591
  prepareCastVideo: {
26206
27592
  method: "POST",
26207
27593
  path: "/cast/videos/prepare",
26208
- body: CastVideoRequestSchema,
27594
+ body: CastVideoUrlRequestSchema,
26209
27595
  responses: {
26210
27596
  200: PrepareCastVideoResponseSchema,
26211
27597
  400: MessageResponseSchema,
@@ -26217,7 +27603,10 @@ var castContract = c18.router({
26217
27603
  readCastPreparedVideoQuote: {
26218
27604
  method: "POST",
26219
27605
  path: "/cast/videos/prepared-quote",
26220
- body: RunCastVideoBodySchema.omit({ expectedEstimatedCredits: true }),
27606
+ body: RunCastVideoUrlBodySchema.omit({
27607
+ expectedEstimatedCredits: true,
27608
+ webhook: true
27609
+ }),
26221
27610
  responses: {
26222
27611
  200: CastPreparedVideoQuoteSchema,
26223
27612
  400: MessageResponseSchema,
@@ -26230,7 +27619,7 @@ var castContract = c18.router({
26230
27619
  headers: IdempotencyRequestHeadersSchema,
26231
27620
  metadata: { idempotent: true },
26232
27621
  path: "/cast/videos",
26233
- body: RunCastVideoBodySchema,
27622
+ body: RunCastVideoUrlBodySchema,
26234
27623
  responses: {
26235
27624
  200: CastVideoResponseSchema,
26236
27625
  400: MessageResponseSchema,
@@ -26255,6 +27644,31 @@ var castContract = c18.router({
26255
27644
  },
26256
27645
  summary: "Read a saved Cast video's progress and exact output"
26257
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
+ },
26258
27672
  downloadCastVideo: {
26259
27673
  method: "POST",
26260
27674
  path: "/cast/videos/:generationId/download",
@@ -26504,7 +27918,7 @@ var castContract = c18.router({
26504
27918
  pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
26505
27919
  body: null,
26506
27920
  responses: {
26507
- 204: c18.noBody(),
27921
+ 204: c20.noBody(),
26508
27922
  403: MessageResponseSchema,
26509
27923
  404: MessageResponseSchema,
26510
27924
  409: MessageResponseSchema
@@ -26528,7 +27942,7 @@ var castContract = c18.router({
26528
27942
  pathParams: external_exports.object({ generationId: external_exports.string().uuid() }),
26529
27943
  body: null,
26530
27944
  responses: {
26531
- 204: c18.noBody(),
27945
+ 204: c20.noBody(),
26532
27946
  404: MessageResponseSchema
26533
27947
  },
26534
27948
  summary: "Remove the signed-in member's rating from a Cast video"
@@ -26605,6 +28019,17 @@ var castContract = c18.router({
26605
28019
  },
26606
28020
  summary: "Write a series' next episode as a scene, continuing from the episodes before it"
26607
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
+ },
26608
28033
  getCastSeriesStory: {
26609
28034
  method: "GET",
26610
28035
  path: "/cast/collections/:collectionId/story",
@@ -26665,11 +28090,27 @@ var castContract = c18.router({
26665
28090
  }),
26666
28091
  body: null,
26667
28092
  responses: {
26668
- 204: c18.noBody(),
28093
+ 204: c20.noBody(),
26669
28094
  404: MessageResponseSchema
26670
28095
  },
26671
28096
  summary: "Remove a place from a series; episodes already made keep it"
26672
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
+ },
26673
28114
  createCastSeriesLook: {
26674
28115
  method: "POST",
26675
28116
  path: "/cast/collections/:collectionId/looks",
@@ -26699,6 +28140,22 @@ var castContract = c18.router({
26699
28140
  },
26700
28141
  summary: "Rename a series look, give it another picture, or describe it again, which draws its picture again unless one is named"
26701
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
+ },
26702
28159
  deleteCastSeriesLook: {
26703
28160
  method: "DELETE",
26704
28161
  path: "/cast/collections/:collectionId/looks/:lookId",
@@ -26708,7 +28165,7 @@ var castContract = c18.router({
26708
28165
  }),
26709
28166
  body: null,
26710
28167
  responses: {
26711
- 204: c18.noBody(),
28168
+ 204: c20.noBody(),
26712
28169
  404: MessageResponseSchema
26713
28170
  },
26714
28171
  summary: "Remove a look from a series; episodes already made keep it"
@@ -26746,7 +28203,7 @@ var castContract = c18.router({
26746
28203
  pathParams: external_exports.object({ collectionId: external_exports.string().uuid() }),
26747
28204
  body: null,
26748
28205
  responses: {
26749
- 204: c18.noBody(),
28206
+ 204: c20.noBody(),
26750
28207
  404: MessageResponseSchema
26751
28208
  },
26752
28209
  summary: "Delete a Cast collection; its videos stay in History, in no collection"
@@ -26807,8 +28264,8 @@ var castContract = c18.router({
26807
28264
  });
26808
28265
 
26809
28266
  // ../api-contract/src/public/index.ts
26810
- var c19 = initContract();
26811
- var publicContract = c19.router(
28267
+ var c21 = initContract();
28268
+ var publicContract = c21.router(
26812
28269
  {
26813
28270
  cast: {
26814
28271
  options: castContract.getCastOptions,
@@ -26817,9 +28274,23 @@ var publicContract = c19.router(
26817
28274
  preparedQuote: castContract.readCastPreparedVideoQuote,
26818
28275
  run: castContract.runCastVideo,
26819
28276
  get: castContract.getCastVideo,
28277
+ registerWebhook: castContract.registerCastVideoWebhook,
28278
+ getWebhook: castContract.getCastVideoWebhook,
26820
28279
  download: castContract.downloadCastVideo,
26821
28280
  history: castContract.searchCastGenerations
26822
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
+ },
26823
28294
  castTemplate: {
26824
28295
  search: castTemplateContract.search,
26825
28296
  get: castTemplateContract.get
@@ -26831,7 +28302,9 @@ var publicContract = c19.router(
26831
28302
  get: castContract.getCastCollection,
26832
28303
  episodes: castContract.searchCastCollectionEpisodes,
26833
28304
  rename: castContract.updateCastCollection,
26834
- // A series' places and looks; each answers 404 without `places-and-looks-microdramas`.
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,
26835
28308
  story: castContract.getCastSeriesStory,
26836
28309
  createPlace: castContract.createCastSeriesPlace,
26837
28310
  updatePlace: castContract.updateCastSeriesPlace,
@@ -26845,6 +28318,8 @@ var publicContract = c19.router(
26845
28318
  listAvatars: dittoContract.listAvatars,
26846
28319
  create: dittoContract.createDitto,
26847
28320
  get: dittoContract.getDitto,
28321
+ registerWebhook: dittoContract.registerDittoWebhook,
28322
+ getWebhook: dittoContract.getDittoWebhook,
26848
28323
  // The quote-then-run paths `create` replaces, kept for released CLI versions.
26849
28324
  prepare: { ...dittoContract.prepareReplacement, deprecated: true },
26850
28325
  run: { ...dittoContract.runReplacement, deprecated: true },
@@ -26896,6 +28371,14 @@ var publicContract = c19.router(
26896
28371
  setVersion: canvasContract.setNodeVersion,
26897
28372
  verifyMedia: canvasContract.verifyMedia
26898
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
+ },
26899
28382
  stitch: {
26900
28383
  get: canvasContract.getStitchEdit,
26901
28384
  replaceClip: canvasContract.replaceStitchClip
@@ -26920,6 +28403,8 @@ var publicContract = c19.router(
26920
28403
  bulkCreate: canvasContract.bulkCreateDirectEdges
26921
28404
  },
26922
28405
  run: {
28406
+ registerWebhook: canvasContract.registerRunWebhook,
28407
+ getWebhook: canvasContract.getRunWebhook,
26923
28408
  start: canvasContract.runNode,
26924
28409
  tool: canvasContract.runNodeTool,
26925
28410
  get: canvasContract.getNodeRun,
@@ -27100,8 +28585,8 @@ function planAutoformatCanvasContent(content, request, savedLayout) {
27100
28585
  }
27101
28586
 
27102
28587
  // ../api-contract/src/edge-id.ts
27103
- function normalizeEdgeId(id, generateId = () => crypto.randomUUID()) {
27104
- return id && UUID_RE.test(id) ? id : generateId();
28588
+ function normalizeEdgeId(id2, generateId = () => crypto.randomUUID()) {
28589
+ return id2 && UUID_RE.test(id2) ? id2 : generateId();
27105
28590
  }
27106
28591
 
27107
28592
  // ../api-contract/src/client-platform.ts
@@ -27157,7 +28642,14 @@ var CUSTOM_REQUEST_HEADERS = {
27157
28642
  * NON-AUTHORITATIVE — client-asserted, and it only labels telemetry. It
27158
28643
  * must never gate auth or data access.
27159
28644
  */
27160
- 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"
27161
28653
  };
27162
28654
  var ALL_CUSTOM_REQUEST_HEADERS = Object.values(CUSTOM_REQUEST_HEADERS);
27163
28655
 
@@ -27217,10 +28709,10 @@ function resolvePresetMentions(layout, keyToId) {
27217
28709
  if (!prompt) continue;
27218
28710
  const rewritten = prompt.replace(
27219
28711
  MENTION_RE,
27220
- (full, label, existingId) => {
28712
+ (full, label2, existingId) => {
27221
28713
  if (existingId) return full;
27222
- const resolvedId = titleToId.get(label.toLowerCase());
27223
- return resolvedId ? `@[${label}]{${resolvedId}}` : full;
28714
+ const resolvedId = titleToId.get(label2.toLowerCase());
28715
+ return resolvedId ? `@[${label2}]{${resolvedId}}` : full;
27224
28716
  }
27225
28717
  );
27226
28718
  if (rewritten !== prompt) {
@@ -27391,10 +28883,10 @@ function computeSingleGroupLayout(preset, center) {
27391
28883
  }
27392
28884
 
27393
28885
  // ../api-contract/src/agent-canvas-group.ts
27394
- function planNodeGroupPlacement(nodes, nodeIds, label, groupType = "default") {
28886
+ function planNodeGroupPlacement(nodes, nodeIds, label2, groupType = "default") {
27395
28887
  const nodeMap = new Map(nodes.map((node) => [node.id, node]));
27396
- const getNode = (id) => nodeMap.get(id);
27397
- 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);
27398
28890
  if (targetNodes.length < 2) {
27399
28891
  throw new Error(
27400
28892
  "At least 2 valid node IDs are required to create a group"
@@ -27405,7 +28897,7 @@ function planNodeGroupPlacement(nodes, nodeIds, label, groupType = "default") {
27405
28897
  if (sharedParentId !== null && !canNestNewGroupIn(nodes, getNode(sharedParentId), nodeIds)) {
27406
28898
  return {
27407
28899
  groupId: sharedParentId,
27408
- label,
28900
+ label: label2,
27409
28901
  nodeIds,
27410
28902
  groupType,
27411
28903
  alreadyGrouped: true,
@@ -27449,7 +28941,7 @@ function planNodeGroupPlacement(nodes, nodeIds, label, groupType = "default") {
27449
28941
  const groupGeometry = { x: groupX, y: groupY, w: groupW, h: groupH };
27450
28942
  return {
27451
28943
  groupId,
27452
- label,
28944
+ label: label2,
27453
28945
  nodeIds,
27454
28946
  groupType,
27455
28947
  parentGroupId: sharedParentId,
@@ -27520,13 +29012,13 @@ function toAgentAssetSearchFilters(scope) {
27520
29012
  };
27521
29013
  }
27522
29014
  function toAgentAssetSearchResult(page, shownBefore) {
27523
- const { data, count, hasMore, nextCursor, tags } = page;
29015
+ const { data, count: count2, hasMore, nextCursor, tags } = page;
27524
29016
  return {
27525
29017
  query: page.query,
27526
29018
  results: data,
27527
29019
  // Pickers offer more while total exceeds what they show, so an
27528
29020
  // uncounted (ranked) search reports one past it when more remain.
27529
- total: count ?? shownBefore + data.length + (hasMore ? 1 : 0),
29021
+ total: count2 ?? shownBefore + data.length + (hasMore ? 1 : 0),
27530
29022
  ...page.folderId !== void 0 && { folderId: page.folderId },
27531
29023
  ...page.canvasId !== void 0 && { canvasId: page.canvasId },
27532
29024
  ...page.source !== void 0 && { source: page.source },
@@ -27553,7 +29045,7 @@ var CANVAS_FOCUS_NODE_QUERY_PARAM = "node";
27553
29045
  var CANVAS_FOCUS_NODES_QUERY_PARAM = "nodes";
27554
29046
  var MAX_CANVAS_FOCUS_NODES = 100;
27555
29047
  function normalizeCanvasFocusIds(ids) {
27556
- return [...new Set(ids.map((id) => id.trim()).filter(Boolean))];
29048
+ return [...new Set(ids.map((id2) => id2.trim()).filter(Boolean))];
27557
29049
  }
27558
29050
  function buildCanvasPath(projectId, canvasId, nodeIds = []) {
27559
29051
  const ids = normalizeCanvasFocusIds(nodeIds);
@@ -27874,23 +29366,23 @@ function parseVersion(version) {
27874
29366
  return [major, minor, patch];
27875
29367
  }
27876
29368
  function isNewerVersion(current, latest) {
27877
- const c20 = parseVersion(current);
29369
+ const c22 = parseVersion(current);
27878
29370
  const l = parseVersion(latest);
27879
- if (!c20 || !l) return false;
29371
+ if (!c22 || !l) return false;
27880
29372
  for (let i = 0; i < 3; i++) {
27881
- if (l[i] > c20[i]) return true;
27882
- if (l[i] < c20[i]) return false;
29373
+ if (l[i] > c22[i]) return true;
29374
+ if (l[i] < c22[i]) return false;
27883
29375
  }
27884
29376
  return false;
27885
29377
  }
27886
29378
  function isMajorUpgrade(current, latest) {
27887
- const c20 = parseVersion(current);
29379
+ const c22 = parseVersion(current);
27888
29380
  const l = parseVersion(latest);
27889
- if (!c20 || !l) return false;
27890
- return l[0] > c20[0];
29381
+ if (!c22 || !l) return false;
29382
+ return l[0] > c22[0];
27891
29383
  }
27892
29384
  function shouldShowUpgradeNotice(ctx = {}) {
27893
- const current = ctx.current ?? "0.53.0";
29385
+ const current = ctx.current ?? "0.54.0";
27894
29386
  const latest = ctx.latest ?? serverLatestVersion;
27895
29387
  const env = ctx.env ?? process.env;
27896
29388
  const isTty = ctx.isTty ?? Boolean(process.stderr.isTTY);
@@ -27911,7 +29403,7 @@ Upgrade: npm install -g @melius-ai/cli@latest (or: brew update && brew upgrade
27911
29403
  function printUpgradeNoticeIfNeeded(ctx = {}) {
27912
29404
  try {
27913
29405
  if (!shouldShowUpgradeNotice(ctx)) return;
27914
- const current = ctx.current ?? "0.53.0";
29406
+ const current = ctx.current ?? "0.54.0";
27915
29407
  const latest = ctx.latest ?? serverLatestVersion;
27916
29408
  process.stderr.write(formatUpgradeNotice(current, latest));
27917
29409
  } catch {
@@ -28018,7 +29510,7 @@ function createClient(config) {
28018
29510
  "Bypass-Tunnel-Reminder": "true",
28019
29511
  [CUSTOM_REQUEST_HEADERS.meliusClient]: buildMeliusClientHeader({
28020
29512
  surface: "cli",
28021
- version: "0.53.0"
29513
+ version: "0.54.0"
28022
29514
  })
28023
29515
  };
28024
29516
  if (config.teamId) {
@@ -28190,8 +29682,8 @@ function writeText(data) {
28190
29682
 
28191
29683
  // src/lib/validation.ts
28192
29684
  import { readFileSync as readFileSync2 } from "fs";
28193
- function readElementCastAvatarOptions(id, kind) {
28194
- const parsed = ElementCastAvatarRefSchema.safeParse({ id, kind });
29685
+ function readElementCastAvatarOptions(id2, kind) {
29686
+ const parsed = ElementCastAvatarRefSchema.safeParse({ id: id2, kind });
28195
29687
  if (!parsed.success) {
28196
29688
  writeError(
28197
29689
  formatError(
@@ -29818,10 +31310,10 @@ function pageInput(options) {
29818
31310
  }
29819
31311
  function writePage(page, output2) {
29820
31312
  writeJson(page.data, output2);
29821
- const { pageSize, count, hasMore, nextCursor } = page;
31313
+ const { pageSize, count: count2, hasMore, nextCursor } = page;
29822
31314
  process.stderr.write(
29823
31315
  JSON.stringify({
29824
- pagination: { pageSize, count, hasMore, nextCursor }
31316
+ pagination: { pageSize, count: count2, hasMore, nextCursor }
29825
31317
  }) + "\n"
29826
31318
  );
29827
31319
  }
@@ -29837,7 +31329,7 @@ function fixedBackoff(delaysMs) {
29837
31329
  // ../utils/src/retry/retry.ts
29838
31330
  var UNDESCRIBED_RESULT_REASON = "retryable result";
29839
31331
  async function withRetry(options, run) {
29840
- const { label, schedule } = options;
31332
+ const { label: label2, schedule } = options;
29841
31333
  const sleep3 = options.sleep ?? defaultSleep;
29842
31334
  const onRetry = options.onRetry ?? warnRetry;
29843
31335
  for (let attempt = 1; ; attempt++) {
@@ -29860,7 +31352,7 @@ async function withRetry(options, run) {
29860
31352
  }
29861
31353
  const delayMs = decision.delayMs ?? schedule.delayMs(attempt);
29862
31354
  onRetry({
29863
- label,
31355
+ label: label2,
29864
31356
  attempt,
29865
31357
  maxAttempts: schedule.maxAttempts,
29866
31358
  delayMs,
@@ -29870,13 +31362,13 @@ async function withRetry(options, run) {
29870
31362
  }
29871
31363
  }
29872
31364
  function formatRetryAttempt({
29873
- label,
31365
+ label: label2,
29874
31366
  attempt,
29875
31367
  maxAttempts,
29876
31368
  delayMs,
29877
31369
  reason
29878
31370
  }) {
29879
- 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`;
29880
31372
  }
29881
31373
  function readVerdict(options, outcome, attempt) {
29882
31374
  const verdict = outcome.ok ? options.retryOnResult?.(outcome.value, attempt) : options.retryOnError?.(outcome.error, attempt);
@@ -30058,10 +31550,10 @@ async function downloadCastFile(url, output2, generationId) {
30058
31550
  // src/commands/cast-series.ts
30059
31551
  var GENRES = CastListedGenreSchema.options.join(", ");
30060
31552
  var STYLES = CAST_MICRODRAMA_STYLE_IDS.join(", ");
30061
- function seriesParams(id) {
31553
+ function seriesParams(id2) {
30062
31554
  return parseCastValue(
30063
31555
  publicContract.castCollections.get.pathParams,
30064
- { collectionId: id },
31556
+ { collectionId: id2 },
30065
31557
  "Use a seriesId from mel cast series list or mel cast series create"
30066
31558
  );
30067
31559
  }
@@ -30271,10 +31763,10 @@ Examples:
30271
31763
  }
30272
31764
 
30273
31765
  // src/commands/cast.ts
30274
- function generationParams(id) {
31766
+ function generationParams(id2) {
30275
31767
  return parseCastValue(
30276
31768
  publicContract.cast.get.pathParams,
30277
- { generationId: id },
31769
+ { generationId: id2 },
30278
31770
  "Use the attemptId from mel cast prepare or generationId from mel cast history"
30279
31771
  );
30280
31772
  }
@@ -30305,15 +31797,15 @@ function castSeriesFields(options, videoStyleId) {
30305
31797
  function recovery(generationId) {
30306
31798
  return `Run: mel cast wait --id ${generationId}. To retry submission, use mel cast run --input-file <prepared.json> with the same prepared file`;
30307
31799
  }
30308
- async function getVideo(id, deadline) {
30309
- const params = generationParams(id);
31800
+ async function getVideo(id2, deadline) {
31801
+ const params = generationParams(id2);
30310
31802
  const client = getClient();
30311
31803
  return castRequest(
30312
31804
  (signal) => client.cast.get({ params, fetchOptions: { signal } }),
30313
31805
  {
30314
31806
  label: "Cast status",
30315
- generationId: id,
30316
- suggestion: recovery(id),
31807
+ generationId: id2,
31808
+ suggestion: recovery(id2),
30317
31809
  deadline
30318
31810
  }
30319
31811
  );
@@ -30918,9 +32410,9 @@ Examples:
30918
32410
  loadConfig().baseUrl,
30919
32411
  { canvasId, nodeId: opts.nodeId },
30920
32412
  result.body,
30921
- async (id) => {
32413
+ async (id2) => {
30922
32414
  const meta = await client.canvas.get({
30923
- params: { canvasId: id }
32415
+ params: { canvasId: id2 }
30924
32416
  });
30925
32417
  return meta.status === 200 ? meta.body : null;
30926
32418
  }
@@ -31176,7 +32668,7 @@ Examples:
31176
32668
  plan = planAutoformatCanvasContent(
31177
32669
  { ...contentResult.body, notes },
31178
32670
  {
31179
- 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),
31180
32672
  groupId: opts.groupId,
31181
32673
  arrangeGroupContents: opts.arrangeGroupContents,
31182
32674
  layout
@@ -31252,7 +32744,7 @@ Examples:
31252
32744
  let finished = allRuns.filter((r) => r.status === "finished");
31253
32745
  if (opts.nodeIds) {
31254
32746
  const nodeIdSet = new Set(
31255
- opts.nodeIds.split(",").map((id) => id.trim()).filter(Boolean)
32747
+ opts.nodeIds.split(",").map((id2) => id2.trim()).filter(Boolean)
31256
32748
  );
31257
32749
  finished = finished.filter((r) => nodeIdSet.has(r.nodeId));
31258
32750
  }
@@ -31354,7 +32846,7 @@ function rememberTempNodeIds(canvasId, idMap) {
31354
32846
  }
31355
32847
  function resolveNodeIds2(canvasId, nodeIds) {
31356
32848
  const idMap = readState().canvases[canvasId]?.idMap ?? {};
31357
- return resolveNodeIds((label) => idMap[label], nodeIds);
32849
+ return resolveNodeIds((label2) => idMap[label2], nodeIds);
31358
32850
  }
31359
32851
 
31360
32852
  // src/lib/stdin.ts
@@ -31582,7 +33074,7 @@ Examples:
31582
33074
  $ mel node create <canvasId> --type audio --model elevenlabs-voice-changer --variant audio-to-audio --voice-id <voiceId>`
31583
33075
  ).action(async (canvasId, opts) => {
31584
33076
  const client = getClient();
31585
- const id = opts.id ?? crypto.randomUUID();
33077
+ const id2 = opts.id ?? crypto.randomUUID();
31586
33078
  const modelConfig = validateModelConfig(
31587
33079
  opts.model,
31588
33080
  opts.variant,
@@ -31595,7 +33087,7 @@ Examples:
31595
33087
  const result = await createGraphNode(client, {
31596
33088
  params: { canvasId },
31597
33089
  body: {
31598
- id,
33090
+ id: id2,
31599
33091
  nodeType: opts.type,
31600
33092
  geometry,
31601
33093
  ...opts.title !== void 0 ? { title: opts.title } : { title: getDefaultTitle(opts.type) },
@@ -31979,12 +33471,12 @@ Valid node types: text, image, video, audio, file, group, custom_text, stitch.
31979
33471
  }
31980
33472
  const labelToId = /* @__PURE__ */ new Map();
31981
33473
  const nodes = items.map((item, index) => {
31982
- let id;
33474
+ let id2;
31983
33475
  if (item.id && !UUID_RE.test(item.id)) {
31984
- id = crypto.randomUUID();
31985
- labelToId.set(item.id, id);
33476
+ id2 = crypto.randomUUID();
33477
+ labelToId.set(item.id, id2);
31986
33478
  } else {
31987
- id = item.id ?? crypto.randomUUID();
33479
+ id2 = item.id ?? crypto.randomUUID();
31988
33480
  }
31989
33481
  const nodeType = item.type;
31990
33482
  const defaults = getDefaultGeometry(
@@ -32001,7 +33493,7 @@ Valid node types: text, image, video, audio, file, group, custom_text, stitch.
32001
33493
  `Node ${item.id ?? index + 1}`
32002
33494
  );
32003
33495
  return {
32004
- id,
33496
+ id: id2,
32005
33497
  nodeType,
32006
33498
  geometry: {
32007
33499
  x: item.x ?? autoGeo?.x ?? defaults.x,
@@ -32344,7 +33836,7 @@ Examples:
32344
33836
  ).action(
32345
33837
  async (canvasId, opts) => {
32346
33838
  const client = getClient();
32347
- const nodeIds = opts.nodeIds.split(",").map((id) => id.trim()).filter(Boolean);
33839
+ const nodeIds = opts.nodeIds.split(",").map((id2) => id2.trim()).filter(Boolean);
32348
33840
  if (nodeIds.length < 2) {
32349
33841
  writeError(
32350
33842
  formatError(
@@ -32364,12 +33856,12 @@ Examples:
32364
33856
  handleApiError(contentResult.status, contentResult.body);
32365
33857
  }
32366
33858
  const content = contentResult.body;
32367
- for (const id of nodeIds) {
32368
- if (!content.nodes.some((n) => n.id === id)) {
33859
+ for (const id2 of nodeIds) {
33860
+ if (!content.nodes.some((n) => n.id === id2)) {
32369
33861
  writeError(
32370
33862
  formatError(
32371
33863
  "NOT_FOUND",
32372
- `Node "${id}" not found on canvas`,
33864
+ `Node "${id2}" not found on canvas`,
32373
33865
  {
32374
33866
  suggestion: `Run: mel canvas content ${canvasId}`
32375
33867
  }
@@ -32550,13 +34042,13 @@ Examples:
32550
34042
  ).action(
32551
34043
  async (canvasId, opts) => {
32552
34044
  const client = getClient();
32553
- const id = opts.id ?? crypto.randomUUID();
34045
+ const id2 = opts.id ?? crypto.randomUUID();
32554
34046
  const saved = await mutateGraph(client, canvasId, {
32555
34047
  operation: "update",
32556
34048
  nodes: [],
32557
34049
  edges: [
32558
34050
  {
32559
- id,
34051
+ id: id2,
32560
34052
  srcNodeId: opts.src,
32561
34053
  dstNodeId: opts.dst,
32562
34054
  edgeType: opts.type,
@@ -33078,10 +34570,10 @@ function context(client) {
33078
34570
  };
33079
34571
  }
33080
34572
  function requestPath(request) {
33081
- 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;
33082
34574
  return routes[request.route].path.replace(
33083
34575
  /:(?:nodeId|canvasId)/,
33084
- encodeURIComponent(id)
34576
+ encodeURIComponent(id2)
33085
34577
  );
33086
34578
  }
33087
34579
  function withSubmissionReceipt(client, request, suppliedKey) {
@@ -34260,6 +35752,190 @@ Examples:
34260
35752
  });
34261
35753
  }
34262
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
+
34263
35939
  // src/commands/bulk-run.ts
34264
35940
  function writeCreditShortfall(shortfall) {
34265
35941
  const runCount = shortfall.affordableNodeIds.length;
@@ -34344,7 +36020,7 @@ Examples:
34344
36020
  );
34345
36021
  let nodeIds;
34346
36022
  if (opts.nodeIds) {
34347
- nodeIds = opts.nodeIds.split(",").map((id) => id.trim()).filter(Boolean);
36023
+ nodeIds = opts.nodeIds.split(",").map((id2) => id2.trim()).filter(Boolean);
34348
36024
  if (nodeIds.length === 0) {
34349
36025
  writeError(
34350
36026
  formatError(
@@ -34622,7 +36298,7 @@ function resolveClipIds(canvasId, clipIds) {
34622
36298
  if (clipIds === void 0) return void 0;
34623
36299
  const { resolvedNodeIds, unresolvedTempLabels } = resolveNodeIds2(
34624
36300
  canvasId,
34625
- clipIds.split(",").map((id) => id.trim()).filter(Boolean)
36301
+ clipIds.split(",").map((id2) => id2.trim()).filter(Boolean)
34626
36302
  );
34627
36303
  if (unresolvedTempLabels.length > 0) {
34628
36304
  writeError(
@@ -34639,7 +36315,7 @@ function resolveClipIds(canvasId, clipIds) {
34639
36315
  return resolvedNodeIds;
34640
36316
  }
34641
36317
  function assertClipsInRun(clipIds, nodeIds) {
34642
- const outside = (clipIds ?? []).filter((id) => !nodeIds.includes(id));
36318
+ const outside = (clipIds ?? []).filter((id2) => !nodeIds.includes(id2));
34643
36319
  if (outside.length === 0) return;
34644
36320
  writeError(
34645
36321
  formatError(
@@ -34843,11 +36519,11 @@ async function applyPreset(client, canvasId, preset, centerX, centerY) {
34843
36519
  const failedNodeKeys = /* @__PURE__ */ new Set();
34844
36520
  const errors = [];
34845
36521
  for (const layoutNode of layout.nodes) {
34846
- const id = keyToId.get(layoutNode.key);
36522
+ const id2 = keyToId.get(layoutNode.key);
34847
36523
  const parentId = layoutNode.parentKey ? keyToId.get(layoutNode.parentKey) : void 0;
34848
36524
  const body = mapPresetLayoutNodeToDirectBody(
34849
36525
  layoutNode,
34850
- id,
36526
+ id2,
34851
36527
  parentId,
34852
36528
  resolvedPrompts
34853
36529
  );
@@ -34862,7 +36538,7 @@ async function applyPreset(client, canvasId, preset, centerX, centerY) {
34862
36538
  continue;
34863
36539
  }
34864
36540
  createdNodes.push({
34865
- id,
36541
+ id: id2,
34866
36542
  nodeType: layoutNode.type,
34867
36543
  title: body.title,
34868
36544
  presetKey: layoutNode.key
@@ -34876,10 +36552,10 @@ async function applyPreset(client, canvasId, preset, centerX, centerY) {
34876
36552
  const src = keyToId.get(layoutEdge.sourceKey);
34877
36553
  const dst = keyToId.get(layoutEdge.targetKey);
34878
36554
  if (!src || !dst) continue;
34879
- const id = crypto.randomUUID();
36555
+ const id2 = crypto.randomUUID();
34880
36556
  const edgeType = layoutEdge.sourceHandle;
34881
36557
  const result = await createEdge(client, canvasId, {
34882
- id,
36558
+ id: id2,
34883
36559
  srcNodeId: src,
34884
36560
  dstNodeId: dst,
34885
36561
  edgeType,
@@ -34893,7 +36569,7 @@ async function applyPreset(client, canvasId, preset, centerX, centerY) {
34893
36569
  `);
34894
36570
  continue;
34895
36571
  }
34896
- createdEdges.push({ id, srcNodeId: src, dstNodeId: dst, edgeType });
36572
+ createdEdges.push({ id: id2, srcNodeId: src, dstNodeId: dst, edgeType });
34897
36573
  }
34898
36574
  if (errors.length > 0) {
34899
36575
  process.stderr.write(
@@ -35513,7 +37189,7 @@ function withDefaultHelp(args) {
35513
37189
  }
35514
37190
  function createProgram() {
35515
37191
  const program2 = new Command();
35516
- program2.name("mel").description("Mel \u2014 Melius agent CLI").version("0.53.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(
35517
37193
  "--fields <fields>",
35518
37194
  "Select specific output fields (comma-separated)"
35519
37195
  ).option("--quiet", "Suppress output, exit code only").option("--verbose", "Log request/response metadata to stderr").addHelpText(
@@ -35557,6 +37233,7 @@ Learn more: https://docs.melius.com`
35557
37233
  registerAudioCommands(program2, getOutputOpts);
35558
37234
  registerFontCommands(program2, getOutputOpts);
35559
37235
  registerFreeGenerationCommands(program2, getOutputOpts);
37236
+ registerMotionCommands(program2, getOutputOpts);
35560
37237
  registerAngleCommands(program2, getOutputOpts);
35561
37238
  registerPresetCommands(program2, getOutputOpts);
35562
37239
  registerTemplateCommands(program2, getOutputOpts);