@clipform/mcp-server 4.2.2 → 4.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@ import {
29
29
  union,
30
30
  unknown,
31
31
  url
32
- } from "./chunk-APCG2RRD.js";
32
+ } from "./chunk-LBNRRZTC.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-FFOQNI3B.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-NN77UKUQ.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-NZCRZDRQ.js";
75
75
  import {
76
76
  getMcpAuth,
77
77
  runWithMcpAuth,
@@ -16769,7 +16769,7 @@ function registerImportFormTool(server) {
16769
16769
  }
16770
16770
 
16771
16771
  // src/tools/list-forms.ts
16772
- function registerListFormsTool(server) {
16772
+ function registerListFormsTool(server, caps = FULL_CAPS) {
16773
16773
  server.registerTool(
16774
16774
  "clipform_list_forms",
16775
16775
  {
@@ -16841,7 +16841,12 @@ function registerListFormsTool(server) {
16841
16841
  next_cursor: data.next_cursor
16842
16842
  };
16843
16843
  if (data.forms.length === 0) {
16844
- return structuredResult("No forms found matching the criteria.", structured);
16844
+ const unfiltered = !search && !tag && !published && !cursor;
16845
+ if (!unfiltered) {
16846
+ return structuredResult("No forms found matching the criteria.", structured);
16847
+ }
16848
+ const text = caps.forms ? `No forms in this workspace yet. ${ONBOARDING_OFFER_TOOL_CUE} Then build it with clipform_create_form.` : "No forms in this workspace yet.";
16849
+ return structuredResult(text, structured);
16845
16850
  }
16846
16851
  const lines = [`Found ${data.forms.length} form(s):
16847
16852
  `];
@@ -18873,6 +18878,37 @@ function resolveCaptionRef(explicit, audioUrl) {
18873
18878
  if (explicit) return explicit;
18874
18879
  return typeof audioUrl === "string" && audioUrl ? audioUrl : void 0;
18875
18880
  }
18881
+ function soundNarration(inputProps) {
18882
+ const sound = inputProps?.sound;
18883
+ const narration = sound && typeof sound === "object" && sound.enabled !== false ? sound.narration : void 0;
18884
+ if (typeof narration === "string" && narration) return narration;
18885
+ const audioUrl = inputProps?.audioUrl;
18886
+ return typeof audioUrl === "string" && audioUrl ? audioUrl : void 0;
18887
+ }
18888
+ var VOICEOVER_PROP_NAMES = [
18889
+ "narration",
18890
+ "audioUrl",
18891
+ "narrationSrc",
18892
+ "answerNarration",
18893
+ "introNarration",
18894
+ "outroNarration"
18895
+ ];
18896
+ var VOICEOVER_CONTROL_NAMES = ["audio_url"];
18897
+ function nonEmpty(v) {
18898
+ if (typeof v === "string") return v.length > 0;
18899
+ if (Array.isArray(v)) return v.length > 0;
18900
+ return typeof v === "object" && v !== null;
18901
+ }
18902
+ function renderHasNarration(input) {
18903
+ if (input.captions && input.captions.length > 0) return true;
18904
+ if (input.captionRef) return true;
18905
+ const sound = input.inputProps?.sound;
18906
+ const soundBlock = sound && typeof sound === "object" && sound.enabled !== false ? sound : void 0;
18907
+ for (const name of VOICEOVER_PROP_NAMES) {
18908
+ if (nonEmpty(input.inputProps?.[name]) || nonEmpty(soundBlock?.[name])) return true;
18909
+ }
18910
+ return VOICEOVER_CONTROL_NAMES.some((name) => nonEmpty(input.controls?.[name]));
18911
+ }
18876
18912
  async function createRenderPlaceholder(input) {
18877
18913
  try {
18878
18914
  const me = await callApi("/me", { method: "GET" });
@@ -18893,7 +18929,7 @@ async function createRenderPlaceholder(input) {
18893
18929
  if (!attached.ok) return void 0;
18894
18930
  await callApi(`/forms/${input.formId}/nodes/${input.nodeId}/media`, {
18895
18931
  method: "PATCH",
18896
- body: { fit_media: true, show_captions: true }
18932
+ body: { fit_media: true, show_captions: input.narrated !== false }
18897
18933
  }).catch(() => void 0);
18898
18934
  return { workspaceId, assetId };
18899
18935
  } catch {
@@ -18921,6 +18957,7 @@ async function completeViaPlaceholder(placeholder, input) {
18921
18957
  const body = { url: input.publicUrl };
18922
18958
  if (input.captions?.length) body.captions = input.captions;
18923
18959
  if (input.captionRef) body.caption_ref = input.captionRef;
18960
+ if (input.narrated === false) body.transcribe = false;
18924
18961
  const completed = await callApi(`/workspaces/${placeholder.workspaceId}/media/${placeholder.assetId}/complete`, {
18925
18962
  method: "POST",
18926
18963
  body
@@ -18950,6 +18987,7 @@ async function legacyAutoAttach(input) {
18950
18987
  };
18951
18988
  if (input.captions?.length) createBody.captions = input.captions;
18952
18989
  if (input.captionRef) createBody.caption_ref = input.captionRef;
18990
+ if (input.narrated === false) createBody.transcribe = false;
18953
18991
  const created = await callApi(`/workspaces/${workspaceId}/media`, { method: "POST", body: createBody });
18954
18992
  if (!created.ok) return { attached: false, error: `Failed to create media asset: ${created.error}` };
18955
18993
  const mediaAssetId = created.data?.media_asset_id;
@@ -18963,7 +19001,7 @@ async function legacyAutoAttach(input) {
18963
19001
  }
18964
19002
  await callApi(`/forms/${input.formId}/nodes/${input.nodeId}/media`, {
18965
19003
  method: "PATCH",
18966
- body: { fit_media: true, show_captions: true }
19004
+ body: { fit_media: true, show_captions: input.narrated !== false }
18967
19005
  }).catch(() => void 0);
18968
19006
  let republished = false;
18969
19007
  const form = await callApi(`/forms/${input.formId}`, { method: "GET" });
@@ -19001,7 +19039,9 @@ var RenderItemSchema = external_exports.object({
19001
19039
  function fireRender(item, formId) {
19002
19040
  const job = createJob("clipform_render_composition");
19003
19041
  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);
19042
+ const captionRef = resolveCaptionRef(item.caption_ref, soundNarration(item.inputProps));
19043
+ const narrated = renderHasNarration({ captions: item.captions, captionRef, inputProps: item.inputProps });
19044
+ const placeholderPromise = item.node_id && formId ? createRenderPlaceholder({ formId, nodeId: item.node_id, mediaType, narrated }) : Promise.resolve(void 0);
19005
19045
  callApi("/internal/render", {
19006
19046
  timeoutMs: 3e5,
19007
19047
  // local renders pay a cold webpack bundle; Lambda is fast but bursty
@@ -19028,8 +19068,9 @@ function fireRender(item, formId) {
19028
19068
  publicUrl,
19029
19069
  mediaType,
19030
19070
  captions: item.captions,
19031
- captionRef: item.caption_ref,
19032
- placeholder
19071
+ captionRef,
19072
+ placeholder,
19073
+ narrated
19033
19074
  });
19034
19075
  } else {
19035
19076
  const message = "Render completed without a public_url; nothing to attach.";
@@ -19141,7 +19182,9 @@ ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_i
19141
19182
  );
19142
19183
  }
19143
19184
  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);
19185
+ const captionRefSingle = resolveCaptionRef(caption_ref, soundNarration(inputProps));
19186
+ const narrated = renderHasNarration({ captions, captionRef: captionRefSingle, inputProps });
19187
+ const placeholderPromise = node_id && form_id ? createRenderPlaceholder({ formId: form_id, nodeId: node_id, mediaType: mediaTypeSingle, narrated }) : Promise.resolve(void 0);
19145
19188
  const result = await callApi("/internal/render", {
19146
19189
  timeoutMs: 3e5,
19147
19190
  body: { compositionId, outputFormat, inputProps: inputProps ?? {} }
@@ -19162,8 +19205,9 @@ ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_i
19162
19205
  publicUrl: data.public_url,
19163
19206
  mediaType: mediaTypeSingle,
19164
19207
  captions,
19165
- captionRef: caption_ref,
19166
- placeholder
19208
+ captionRef: captionRefSingle,
19209
+ placeholder,
19210
+ narrated
19167
19211
  });
19168
19212
  } else if (placeholder) {
19169
19213
  await failPlaceholder(placeholder, "Render completed without a public_url; nothing to attach.");
@@ -19444,11 +19488,12 @@ ${RENDER_ATTACH_RULE}`,
19444
19488
  return errorResult("form_id is required when node_id is set.");
19445
19489
  }
19446
19490
  const captionRef = resolveCaptionRef(caption_ref, controls?.audio_url);
19491
+ const narrated = renderHasNarration({ captions, captionRef, controls });
19447
19492
  const renderBody = { template, controls: controls ?? {}, outputFormat };
19448
19493
  const mediaType = outputFormat === "png" ? "still" : "video";
19449
19494
  if (wait === false) {
19450
19495
  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);
19496
+ const placeholderPromise2 = node_id && form_id ? createRenderPlaceholder({ formId: form_id, nodeId: node_id, mediaType, narrated }) : Promise.resolve(void 0);
19452
19497
  callApi("/internal/render-template", {
19453
19498
  timeoutMs: 3e5,
19454
19499
  body: renderBody
@@ -19464,7 +19509,7 @@ ${RENDER_ATTACH_RULE}`,
19464
19509
  const publicUrl = r.data.public_url;
19465
19510
  const placeholder = await placeholderPromise2;
19466
19511
  if (publicUrl) {
19467
- attach2 = await autoAttachRender({ formId: form_id, nodeId: node_id, publicUrl, mediaType, captions, captionRef, placeholder });
19512
+ attach2 = await autoAttachRender({ formId: form_id, nodeId: node_id, publicUrl, mediaType, captions, captionRef, placeholder, narrated });
19468
19513
  } else {
19469
19514
  const message = "Render completed without a public_url; nothing to attach.";
19470
19515
  attach2 = { attached: false, error: message };
@@ -19487,7 +19532,7 @@ ${RENDER_ATTACH_RULE}`,
19487
19532
  { status: "rendering", job_id: job.id, template, output_format: outputFormat }
19488
19533
  );
19489
19534
  }
19490
- const placeholderPromise = node_id && form_id ? createRenderPlaceholder({ formId: form_id, nodeId: node_id, mediaType }) : Promise.resolve(void 0);
19535
+ const placeholderPromise = node_id && form_id ? createRenderPlaceholder({ formId: form_id, nodeId: node_id, mediaType, narrated }) : Promise.resolve(void 0);
19491
19536
  const result = await callApi("/internal/render-template", {
19492
19537
  timeoutMs: 3e5,
19493
19538
  body: renderBody
@@ -19502,7 +19547,7 @@ ${RENDER_ATTACH_RULE}`,
19502
19547
  if (node_id && form_id) {
19503
19548
  const placeholder = await placeholderPromise;
19504
19549
  if (data.public_url) {
19505
- attach = await autoAttachRender({ formId: form_id, nodeId: node_id, publicUrl: data.public_url, mediaType, captions, captionRef, placeholder });
19550
+ attach = await autoAttachRender({ formId: form_id, nodeId: node_id, publicUrl: data.public_url, mediaType, captions, captionRef, placeholder, narrated });
19506
19551
  } else if (placeholder) {
19507
19552
  await failPlaceholder(placeholder, "Render completed without a public_url; nothing to attach.");
19508
19553
  }
@@ -20068,7 +20113,7 @@ function createServer(options) {
20068
20113
  };
20069
20114
  registerCreateFormTool(server);
20070
20115
  registerImportFormTool(server);
20071
- registerListFormsTool(server);
20116
+ registerListFormsTool(server, caps);
20072
20117
  registerWhoamiTool(server);
20073
20118
  registerGetFormTool(server);
20074
20119
  registerUpdateFormTool(server);
@@ -20167,4 +20212,4 @@ export {
20167
20212
  * MIT Licensed
20168
20213
  *)
20169
20214
  */
20170
- //# sourceMappingURL=chunk-XOV5ILOJ.js.map
20215
+ //# sourceMappingURL=chunk-XW3FEMD4.js.map