@clipform/mcp-server 4.2.2 → 4.2.3

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.
@@ -29,7 +29,7 @@ import {
29
29
  union,
30
30
  unknown,
31
31
  url
32
- } from "./chunk-APCG2RRD.js";
32
+ } from "./chunk-UYJLVVM3.js";
33
33
  import {
34
34
  GUIDE_TYPES,
35
35
  QUIZ_VARIANTS,
@@ -38,7 +38,7 @@ import {
38
38
  getGuideUri,
39
39
  guideFallbackText,
40
40
  registerResources
41
- } from "./chunk-5AAKB4S5.js";
41
+ } from "./chunk-MO3ABORB.js";
42
42
  import {
43
43
  ANON_PREVIEW_LINK_LABEL,
44
44
  ANON_PREVIEW_NOTICE,
@@ -49,7 +49,7 @@ import {
49
49
  anonPreviewNotice,
50
50
  capsFromToolsets,
51
51
  isPreviewViewerUrl
52
- } from "./chunk-FGTU764J.js";
52
+ } from "./chunk-E7C34M2J.js";
53
53
  import {
54
54
  ACTIVE_NODE_TYPES,
55
55
  CONTACT_FIELDS,
@@ -71,7 +71,7 @@ import {
71
71
  resolveFormType,
72
72
  structuredResult,
73
73
  textResult
74
- } from "./chunk-KZNBYHHR.js";
74
+ } from "./chunk-ZRBMT7BF.js";
75
75
  import {
76
76
  getMcpAuth,
77
77
  runWithMcpAuth,
@@ -18873,6 +18873,37 @@ function resolveCaptionRef(explicit, audioUrl) {
18873
18873
  if (explicit) return explicit;
18874
18874
  return typeof audioUrl === "string" && audioUrl ? audioUrl : void 0;
18875
18875
  }
18876
+ function soundNarration(inputProps) {
18877
+ const sound = inputProps?.sound;
18878
+ const narration = sound && typeof sound === "object" && sound.enabled !== false ? sound.narration : void 0;
18879
+ if (typeof narration === "string" && narration) return narration;
18880
+ const audioUrl = inputProps?.audioUrl;
18881
+ return typeof audioUrl === "string" && audioUrl ? audioUrl : void 0;
18882
+ }
18883
+ var VOICEOVER_PROP_NAMES = [
18884
+ "narration",
18885
+ "audioUrl",
18886
+ "narrationSrc",
18887
+ "answerNarration",
18888
+ "introNarration",
18889
+ "outroNarration"
18890
+ ];
18891
+ var VOICEOVER_CONTROL_NAMES = ["audio_url"];
18892
+ function nonEmpty(v) {
18893
+ if (typeof v === "string") return v.length > 0;
18894
+ if (Array.isArray(v)) return v.length > 0;
18895
+ return typeof v === "object" && v !== null;
18896
+ }
18897
+ function renderHasNarration(input) {
18898
+ if (input.captions && input.captions.length > 0) return true;
18899
+ if (input.captionRef) return true;
18900
+ const sound = input.inputProps?.sound;
18901
+ const soundBlock = sound && typeof sound === "object" && sound.enabled !== false ? sound : void 0;
18902
+ for (const name of VOICEOVER_PROP_NAMES) {
18903
+ if (nonEmpty(input.inputProps?.[name]) || nonEmpty(soundBlock?.[name])) return true;
18904
+ }
18905
+ return VOICEOVER_CONTROL_NAMES.some((name) => nonEmpty(input.controls?.[name]));
18906
+ }
18876
18907
  async function createRenderPlaceholder(input) {
18877
18908
  try {
18878
18909
  const me = await callApi("/me", { method: "GET" });
@@ -18893,7 +18924,7 @@ async function createRenderPlaceholder(input) {
18893
18924
  if (!attached.ok) return void 0;
18894
18925
  await callApi(`/forms/${input.formId}/nodes/${input.nodeId}/media`, {
18895
18926
  method: "PATCH",
18896
- body: { fit_media: true, show_captions: true }
18927
+ body: { fit_media: true, show_captions: input.narrated !== false }
18897
18928
  }).catch(() => void 0);
18898
18929
  return { workspaceId, assetId };
18899
18930
  } catch {
@@ -18921,6 +18952,7 @@ async function completeViaPlaceholder(placeholder, input) {
18921
18952
  const body = { url: input.publicUrl };
18922
18953
  if (input.captions?.length) body.captions = input.captions;
18923
18954
  if (input.captionRef) body.caption_ref = input.captionRef;
18955
+ if (input.narrated === false) body.transcribe = false;
18924
18956
  const completed = await callApi(`/workspaces/${placeholder.workspaceId}/media/${placeholder.assetId}/complete`, {
18925
18957
  method: "POST",
18926
18958
  body
@@ -18950,6 +18982,7 @@ async function legacyAutoAttach(input) {
18950
18982
  };
18951
18983
  if (input.captions?.length) createBody.captions = input.captions;
18952
18984
  if (input.captionRef) createBody.caption_ref = input.captionRef;
18985
+ if (input.narrated === false) createBody.transcribe = false;
18953
18986
  const created = await callApi(`/workspaces/${workspaceId}/media`, { method: "POST", body: createBody });
18954
18987
  if (!created.ok) return { attached: false, error: `Failed to create media asset: ${created.error}` };
18955
18988
  const mediaAssetId = created.data?.media_asset_id;
@@ -18963,7 +18996,7 @@ async function legacyAutoAttach(input) {
18963
18996
  }
18964
18997
  await callApi(`/forms/${input.formId}/nodes/${input.nodeId}/media`, {
18965
18998
  method: "PATCH",
18966
- body: { fit_media: true, show_captions: true }
18999
+ body: { fit_media: true, show_captions: input.narrated !== false }
18967
19000
  }).catch(() => void 0);
18968
19001
  let republished = false;
18969
19002
  const form = await callApi(`/forms/${input.formId}`, { method: "GET" });
@@ -19001,7 +19034,9 @@ var RenderItemSchema = external_exports.object({
19001
19034
  function fireRender(item, formId) {
19002
19035
  const job = createJob("clipform_render_composition");
19003
19036
  const mediaType = item.outputFormat === "png" ? "still" : "video";
19004
- const placeholderPromise = item.node_id && formId ? createRenderPlaceholder({ formId, nodeId: item.node_id, mediaType }) : Promise.resolve(void 0);
19037
+ const captionRef = resolveCaptionRef(item.caption_ref, soundNarration(item.inputProps));
19038
+ const narrated = renderHasNarration({ captions: item.captions, captionRef, inputProps: item.inputProps });
19039
+ const placeholderPromise = item.node_id && formId ? createRenderPlaceholder({ formId, nodeId: item.node_id, mediaType, narrated }) : Promise.resolve(void 0);
19005
19040
  callApi("/internal/render", {
19006
19041
  timeoutMs: 3e5,
19007
19042
  // local renders pay a cold webpack bundle; Lambda is fast but bursty
@@ -19028,8 +19063,9 @@ function fireRender(item, formId) {
19028
19063
  publicUrl,
19029
19064
  mediaType,
19030
19065
  captions: item.captions,
19031
- captionRef: item.caption_ref,
19032
- placeholder
19066
+ captionRef,
19067
+ placeholder,
19068
+ narrated
19033
19069
  });
19034
19070
  } else {
19035
19071
  const message = "Render completed without a public_url; nothing to attach.";
@@ -19141,7 +19177,9 @@ ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_i
19141
19177
  );
19142
19178
  }
19143
19179
  const mediaTypeSingle = outputFormat === "png" ? "still" : "video";
19144
- const placeholderPromise = node_id && form_id ? createRenderPlaceholder({ formId: form_id, nodeId: node_id, mediaType: mediaTypeSingle }) : Promise.resolve(void 0);
19180
+ const captionRefSingle = resolveCaptionRef(caption_ref, soundNarration(inputProps));
19181
+ const narrated = renderHasNarration({ captions, captionRef: captionRefSingle, inputProps });
19182
+ const placeholderPromise = node_id && form_id ? createRenderPlaceholder({ formId: form_id, nodeId: node_id, mediaType: mediaTypeSingle, narrated }) : Promise.resolve(void 0);
19145
19183
  const result = await callApi("/internal/render", {
19146
19184
  timeoutMs: 3e5,
19147
19185
  body: { compositionId, outputFormat, inputProps: inputProps ?? {} }
@@ -19162,8 +19200,9 @@ ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_i
19162
19200
  publicUrl: data.public_url,
19163
19201
  mediaType: mediaTypeSingle,
19164
19202
  captions,
19165
- captionRef: caption_ref,
19166
- placeholder
19203
+ captionRef: captionRefSingle,
19204
+ placeholder,
19205
+ narrated
19167
19206
  });
19168
19207
  } else if (placeholder) {
19169
19208
  await failPlaceholder(placeholder, "Render completed without a public_url; nothing to attach.");
@@ -19444,11 +19483,12 @@ ${RENDER_ATTACH_RULE}`,
19444
19483
  return errorResult("form_id is required when node_id is set.");
19445
19484
  }
19446
19485
  const captionRef = resolveCaptionRef(caption_ref, controls?.audio_url);
19486
+ const narrated = renderHasNarration({ captions, captionRef, controls });
19447
19487
  const renderBody = { template, controls: controls ?? {}, outputFormat };
19448
19488
  const mediaType = outputFormat === "png" ? "still" : "video";
19449
19489
  if (wait === false) {
19450
19490
  const job = createJob("clipform_render_video_template");
19451
- const placeholderPromise2 = node_id && form_id ? createRenderPlaceholder({ formId: form_id, nodeId: node_id, mediaType }) : Promise.resolve(void 0);
19491
+ const placeholderPromise2 = node_id && form_id ? createRenderPlaceholder({ formId: form_id, nodeId: node_id, mediaType, narrated }) : Promise.resolve(void 0);
19452
19492
  callApi("/internal/render-template", {
19453
19493
  timeoutMs: 3e5,
19454
19494
  body: renderBody
@@ -19464,7 +19504,7 @@ ${RENDER_ATTACH_RULE}`,
19464
19504
  const publicUrl = r.data.public_url;
19465
19505
  const placeholder = await placeholderPromise2;
19466
19506
  if (publicUrl) {
19467
- attach2 = await autoAttachRender({ formId: form_id, nodeId: node_id, publicUrl, mediaType, captions, captionRef, placeholder });
19507
+ attach2 = await autoAttachRender({ formId: form_id, nodeId: node_id, publicUrl, mediaType, captions, captionRef, placeholder, narrated });
19468
19508
  } else {
19469
19509
  const message = "Render completed without a public_url; nothing to attach.";
19470
19510
  attach2 = { attached: false, error: message };
@@ -19487,7 +19527,7 @@ ${RENDER_ATTACH_RULE}`,
19487
19527
  { status: "rendering", job_id: job.id, template, output_format: outputFormat }
19488
19528
  );
19489
19529
  }
19490
- const placeholderPromise = node_id && form_id ? createRenderPlaceholder({ formId: form_id, nodeId: node_id, mediaType }) : Promise.resolve(void 0);
19530
+ const placeholderPromise = node_id && form_id ? createRenderPlaceholder({ formId: form_id, nodeId: node_id, mediaType, narrated }) : Promise.resolve(void 0);
19491
19531
  const result = await callApi("/internal/render-template", {
19492
19532
  timeoutMs: 3e5,
19493
19533
  body: renderBody
@@ -19502,7 +19542,7 @@ ${RENDER_ATTACH_RULE}`,
19502
19542
  if (node_id && form_id) {
19503
19543
  const placeholder = await placeholderPromise;
19504
19544
  if (data.public_url) {
19505
- attach = await autoAttachRender({ formId: form_id, nodeId: node_id, publicUrl: data.public_url, mediaType, captions, captionRef, placeholder });
19545
+ attach = await autoAttachRender({ formId: form_id, nodeId: node_id, publicUrl: data.public_url, mediaType, captions, captionRef, placeholder, narrated });
19506
19546
  } else if (placeholder) {
19507
19547
  await failPlaceholder(placeholder, "Render completed without a public_url; nothing to attach.");
19508
19548
  }
@@ -20167,4 +20207,4 @@ export {
20167
20207
  * MIT Licensed
20168
20208
  *)
20169
20209
  */
20170
- //# sourceMappingURL=chunk-XOV5ILOJ.js.map
20210
+ //# sourceMappingURL=chunk-XFGQP52H.js.map