@clipform/mcp-server 5.1.0 → 5.3.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.
@@ -1,4 +1,6 @@
1
1
  import {
2
+ EXPOSED_COMPOSITIONS,
3
+ FORM_CLIP_RULES,
2
4
  NEVER,
3
5
  WORKFLOW_TYPES,
4
6
  ZodIssueCode,
@@ -29,7 +31,7 @@ import {
29
31
  union,
30
32
  unknown,
31
33
  url
32
- } from "./chunk-WZ4LCPSY.js";
34
+ } from "./chunk-NXNCAGMO.js";
33
35
  import {
34
36
  GUIDE_TYPES,
35
37
  QUIZ_VARIANTS,
@@ -38,7 +40,7 @@ import {
38
40
  getGuideUri,
39
41
  guideFallbackText,
40
42
  registerResources
41
- } from "./chunk-DWFBJMC5.js";
43
+ } from "./chunk-4KXP67SR.js";
42
44
  import {
43
45
  ANON_PREVIEW_LINK_LABEL,
44
46
  ANON_PREVIEW_NOTICE,
@@ -52,7 +54,7 @@ import {
52
54
  isPreviewViewerUrl,
53
55
  previewOnlyNotice,
54
56
  withAdoptedNotice
55
- } from "./chunk-25QAMDHS.js";
57
+ } from "./chunk-SH53TD4L.js";
56
58
  import {
57
59
  ACTIVE_NODE_TYPES,
58
60
  ANON_MCP_BLOCKED_NODE_TYPES,
@@ -62,6 +64,8 @@ import {
62
64
  FEATURE_FLAGS,
63
65
  FORM_TYPES_LIST,
64
66
  FORM_TYPE_ALIASES,
67
+ MAX_CLIP_SECONDS,
68
+ MAX_NARRATION_CHARS,
65
69
  MCP_TOOL_SECURITY,
66
70
  MCP_TOOL_TIERS,
67
71
  MCP_TOOL_TOOLSETS,
@@ -74,7 +78,6 @@ import {
74
78
  contactFieldNotes,
75
79
  defaultTarget,
76
80
  errorResult,
77
- exposedCompositionIds,
78
81
  gatedConfigKeys,
79
82
  gatedEnumValues,
80
83
  isAnonMcpLockedNode,
@@ -85,7 +88,7 @@ import {
85
88
  stripGatedConfigKeys,
86
89
  structuredResult,
87
90
  textResult
88
- } from "./chunk-QED4R32Z.js";
91
+ } from "./chunk-5D3UEINC.js";
89
92
  import {
90
93
  getMcpAuth,
91
94
  runWithMcpAuth,
@@ -13088,7 +13091,7 @@ var AjvJsonSchemaValidator = class {
13088
13091
  var Ajv = import_ajv.Ajv;
13089
13092
 
13090
13093
  // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/server/dist/shimsNode.mjs
13091
- import process2 from "process";
13094
+ import process from "process";
13092
13095
 
13093
13096
  // ../../node_modules/.pnpm/@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/server/dist/mcp-DIH4cS6P.mjs
13094
13097
  var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
@@ -16126,14 +16129,6 @@ function buildOnboardingOffer(variant = ONBOARDING_OFFER_CONTROL_VARIANT) {
16126
16129
  }
16127
16130
  var ONBOARDING_OFFER_TOOL_CUE = `If the user hasn't said what to build yet, offer to build their first form and suggest starting points: ${STARTERS}, or something else.`;
16128
16131
 
16129
- // src/lib/config.ts
16130
- var _endScreen = NODE_TYPES.end_screen.config_schema.properties;
16131
- var END_SCREEN_ICONS = _endScreen.icon.enum;
16132
- var END_SCREEN_CTA_TYPES = _endScreen.cta_type.enum;
16133
- var EXPOSED_COMPOSITIONS = exposedCompositionIds(
16134
- process.env.NODE_ENV !== "production"
16135
- );
16136
-
16137
16132
  // src/lib/schemas.ts
16138
16133
  var CUSTOM_SCORES_GATED_KEYS = /* @__PURE__ */ new Set(["show_score", "score_ranges", "scoring_results"]);
16139
16134
  var ACTIVE_NODE_TYPES2 = ACTIVE_NODE_TYPES;
@@ -18835,7 +18830,8 @@ var CaptionSchema2 = external_exports.object({
18835
18830
  words: external_exports.array(external_exports.object({ word: external_exports.string(), start: external_exports.number(), end: external_exports.number() })).min(1)
18836
18831
  });
18837
18832
  var TtsItemSchema = external_exports.object({
18838
- text: external_exports.string().min(1).max(5e3).describe("Narration text"),
18833
+ text: external_exports.string().min(1).max(FORM_CLIP_RULES ? MAX_NARRATION_CHARS : 5e3).describe(FORM_CLIP_RULES ? `Narration text for one question (max ${MAX_NARRATION_CHARS} characters)` : "Narration text"),
18834
+ ...FORM_CLIP_RULES ? { node_id: external_exports.string().describe("The form node (question) this narration is for. Required: a voiceover is for one question in a Clipform form.") } : {},
18839
18835
  voice: external_exports.enum(["ryan", "sonia", "andrew", "ava", "guy"]).optional().default("ryan").describe("Voice: ryan (British male, clear/articulate), sonia (British female, warm/bright), andrew (American male, smooth/neutral), ava (American female, vibrant/friendly), guy (American male, deep/authoritative). Pick ONE voice for the whole form based on its topic and audience, then reuse that same voice on every item and every call - never mix voices within a form unless the user explicitly asks for more than one."),
18840
18836
  tone: external_exports.string().max(500).optional().describe("Style instructions for how the voice should sound. E.g. 'Speak like an energetic quiz show host, playful and teasing' or 'Warm and conversational, like chatting with a friend'. Infer from context if not specified by the user.")
18841
18837
  });
@@ -18844,7 +18840,7 @@ function registerGenerateTtsTool(server) {
18844
18840
  "clipform_generate_tts",
18845
18841
  {
18846
18842
  title: "Generate Text-to-Speech",
18847
- description: `Generate narration audio from text with word-level captions. Use this for quiz question narration, survey introductions, form instructions, or any node that benefits from a human voice. Proactively suggest narration for quizzes and content-rich forms - it significantly improves engagement.
18843
+ description: `Generate narration audio from text with word-level captions${FORM_CLIP_RULES ? ` for one question in a Clipform form (max ${MAX_NARRATION_CHARS} characters). It does not make standalone voiceover files. Pass form_id and a node_id per item` : ""}. Use this for quiz question narration, survey introductions, form instructions, or any node that benefits from a human voice. Proactively suggest narration for quizzes and content-rich forms - it significantly improves engagement.
18848
18844
 
18849
18845
  Available voices: ryan (British male, clear), sonia (British female, warm), andrew (American male, smooth), ava (American female, vibrant), guy (American male, deep). Pick ONE voice that fits the topic - e.g. a London quiz gets ryan or sonia, a US sports quiz gets andrew or guy - and reuse that SAME voice for every item and every call across the whole form. Never mix voices within one form unless the user explicitly asks for multiple voices.
18850
18846
 
@@ -18853,7 +18849,7 @@ Use the tone parameter to direct HOW the voice speaks. Always set a tone that ma
18853
18849
  Pass one item or many (max 10) - multiple items run in parallel. Returns audio_url and caption_ref per item - pass caption_ref downstream to clipform_render_composition / clipform_render_video_template / clipform_upload_media_asset to attach this run's word-level captions instead of hand-copying the captions array.`,
18854
18850
  inputSchema: external_exports.object({
18855
18851
  workspace_id: workspaceIdInput,
18856
- form_id: formIdTargetInput,
18852
+ form_id: FORM_CLIP_RULES ? external_exports.string().uuid().describe("The form this narration is for (from clipform_create_form). Required.") : formIdTargetInput,
18857
18853
  items: external_exports.array(TtsItemSchema).min(1).max(10).describe("One or more TTS items to generate")
18858
18854
  }),
18859
18855
  outputSchema: external_exports.object({
@@ -18869,16 +18865,27 @@ Pass one item or many (max 10) - multiple items run in parallel. Returns audio_u
18869
18865
  }),
18870
18866
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
18871
18867
  },
18872
- // `form_id` (#4621) is a routing hint only, consumed centrally by
18868
+ // `form_id` (#4621) is also a routing hint, consumed centrally by
18873
18869
  // `runWithWorkspaceTarget` (server.ts) before this handler runs - it
18874
- // swaps the auth context's workspace_id read below, but is never
18875
- // forwarded to the API itself (the /internal/tts route takes no form_id).
18876
- async ({ items, form_id: _form_id }) => {
18870
+ // swaps the auth context's workspace_id read below. Under the form-clip
18871
+ // rules (#4622) it and each item's node_id are ALSO forwarded: the API
18872
+ // checks the node belongs to the form in the caller's workspace.
18873
+ async ({ items, form_id }) => {
18874
+ if (FORM_CLIP_RULES && (!form_id || items.some((i) => !i.node_id))) {
18875
+ return errorResult("form_id and a node_id per item are required: a voiceover is for one question in a Clipform form.");
18876
+ }
18877
18877
  const workspace_id = getMcpAuth()?.workspace_id;
18878
18878
  const results = await Promise.allSettled(
18879
18879
  items.map(
18880
18880
  (item) => callApi("/internal/tts", {
18881
- body: { text: item.text, voice: item.voice, tone: item.tone, workspace_id },
18881
+ body: {
18882
+ text: item.text,
18883
+ voice: item.voice,
18884
+ tone: item.tone,
18885
+ workspace_id,
18886
+ ...FORM_CLIP_RULES && form_id ? { form_id } : {},
18887
+ ...FORM_CLIP_RULES && item.node_id ? { node_id: item.node_id } : {}
18888
+ },
18882
18889
  // Synthesize + audio upload + caption store (#4070) occasionally
18883
18890
  // exceeds 45s; 90s clears the real tail with margin.
18884
18891
  timeoutMs: 9e4
@@ -19033,7 +19040,7 @@ Example: { queries: [{ query: "saturn rings" }, { query: "mars surface", count:
19033
19040
 
19034
19041
  // src/lib/render-routing.ts
19035
19042
  var RENDER_ROUTING_RULE = `Choosing a render tool: for a recognisable form/quiz beat (guess-the-city, this-or-that, mystery reveal, multiple choice, photo montage...) reach for a video template first (clipform_list_video_templates + clipform_render_video_template) - it is a one-call recipe. For a photo/clip montage, narrated or silent, use the slideshow template (pass audio_url to sync it to a voice track). Use clipform_render_composition only when neither fits and you need a custom layer stack.`;
19036
- var RENDER_ATTACH_RULE = `A render for a form node is not done until it is attached to that node. Pass node_id (and form_id) so the completed render attaches itself automatically - do not poll clipform_check_render to completion or manually chain clipform_upload_media_asset + clipform_attach_node_media; fire the render and move on.`;
19043
+ var RENDER_ATTACH_RULE = FORM_CLIP_RULES ? `A render is a short clip (max ${MAX_CLIP_SECONDS}s) for one question in a Clipform form, and it is not done until it is attached to that question. Pass form_id and node_id so the completed render attaches itself automatically and returns the node and media_asset_id - do not poll clipform_check_render to completion; fire the render and move on. It does not clip or edit existing footage, animate photos, lip-sync, or make standalone or long videos.` : `A render for a form node is not done until it is attached to that node. Pass node_id (and form_id) so the completed render attaches itself automatically - do not poll clipform_check_render to completion or manually chain clipform_upload_media_asset + clipform_attach_node_media; fire the render and move on.`;
19037
19044
 
19038
19045
  // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/stringify.js
19039
19046
  var byteToHex = [];
@@ -19286,16 +19293,21 @@ function attachStructuredFields(attach) {
19286
19293
  ...attach.error ? { attach_error: attach.error } : {}
19287
19294
  };
19288
19295
  }
19296
+ function visiblePublicUrl(publicUrl, attach) {
19297
+ return FORM_CLIP_RULES && attach?.attached ? void 0 : publicUrl;
19298
+ }
19289
19299
  function attachSummaryLine(nodeId, attach) {
19290
- return attach.attached ? `Attached to node ${nodeId}${attach.republished ? " and republished." : "."}` : `Auto-attach to node ${nodeId} failed: ${attach.error}. Attach manually via clipform_upload_media_asset then clipform_attach_node_media.`;
19300
+ return attach.attached ? `Attached to node ${nodeId}${attach.media_asset_id && FORM_CLIP_RULES ? ` (media_asset_id ${attach.media_asset_id})` : ""}${attach.republished ? " and republished." : "."}` : `Auto-attach to node ${nodeId} failed: ${attach.error}. Attach manually via clipform_upload_media_asset then clipform_attach_node_media.`;
19291
19301
  }
19292
19302
 
19293
19303
  // src/tools/render-composition.ts
19304
+ var nodeIdField = FORM_CLIP_RULES ? external_exports.string() : external_exports.string().optional();
19305
+ var formIdField = FORM_CLIP_RULES ? external_exports.string().uuid() : external_exports.string().uuid().optional();
19294
19306
  var RenderItemSchema = external_exports.object({
19295
19307
  compositionId: external_exports.string().describe("The composition ID (see clipform_list_compositions)"),
19296
19308
  outputFormat: external_exports.enum(["mp4", "png"]).default("mp4").describe("Output format (default: mp4)"),
19297
19309
  inputProps: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Props matching the composition's schema - validated strictly"),
19298
- node_id: external_exports.string().optional().describe("Form node to attach this item's render to automatically once it completes. Requires the batch's top-level form_id."),
19310
+ node_id: nodeIdField.describe("Form node to attach this item's render to automatically once it completes. Requires the batch's top-level form_id."),
19299
19311
  captions: external_exports.array(CaptionSchema).optional().describe("Word-level captions from clipform_generate_tts - carried onto the attached media asset. Only used when node_id is set."),
19300
19312
  caption_ref: external_exports.string().optional().describe("caption_ref from clipform_generate_tts - an opaque handle that attaches that TTS run's word-level captions to the media asset, resolved server-side. Preferred over captions. Only used when node_id is set.")
19301
19313
  });
@@ -19311,7 +19323,9 @@ function fireRender(item, formId) {
19311
19323
  body: {
19312
19324
  compositionId: item.compositionId,
19313
19325
  outputFormat: item.outputFormat,
19314
- inputProps: item.inputProps ?? {}
19326
+ inputProps: item.inputProps ?? {},
19327
+ ...formId ? { form_id: formId } : {},
19328
+ ...item.node_id ? { node_id: item.node_id } : {}
19315
19329
  }
19316
19330
  }).then(async (r) => {
19317
19331
  if (!r.ok) {
@@ -19355,11 +19369,11 @@ function registerRenderCompositionTool(server) {
19355
19369
  "clipform_render_composition",
19356
19370
  {
19357
19371
  title: "Render Composition",
19358
- description: `Render a specialised video composition to MP4 or PNG - custom animated visuals that a video template can't provide, such as geography animations or designed motion graphics. Available composition names and their required input props schemas come from clipform_list_compositions.
19372
+ description: `Render a specialised video composition to MP4 or PNG${FORM_CLIP_RULES ? ` for one question in a Clipform form (max ${MAX_CLIP_SECONDS}s, attached to that question)` : ""} - custom animated visuals that a video template can't provide, such as geography animations or designed motion graphics. Available composition names and their required input props schemas come from clipform_list_compositions.
19359
19373
 
19360
- Output formats: mp4 (H.264, best for social media) or png (single frame). Returns a public URL when complete.
19374
+ Output formats: mp4 (H.264) or png (single frame). ${FORM_CLIP_RULES ? "The completed render attaches itself to the node and returns the node and media_asset_id." : "Returns a public URL when complete."}
19361
19375
 
19362
- For multi-render builds (e.g. one clip per quiz question), pass everything in ONE call via items (max 10): all renders fire in parallel and you get one job ID each - then collect the URLs in a single clipform_check_render call with job_ids. Single render: pass compositionId/inputProps at the top level (wait: true blocks and returns the URL; wait: false returns a job ID).
19376
+ For multi-render builds (e.g. one clip per quiz question), pass everything in ONE call via items (max 10): all renders fire in parallel and you get one job ID each - then collect the results in a single clipform_check_render call with job_ids. Single render: pass compositionId/inputProps at the top level (wait: true blocks until the render is ready; wait: false returns a job ID).
19363
19377
 
19364
19378
  ${RENDER_ROUTING_RULE}
19365
19379
  ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_id once at the top level.`,
@@ -19367,10 +19381,10 @@ ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_i
19367
19381
  compositionId: external_exports.string().optional().describe(`Single render: the composition ID. Call clipform_list_compositions to see available options (e.g. ${EXPOSED_COMPOSITIONS.map((id) => `'${id}'`).join(", ")}). Use items instead for multiple renders.`),
19368
19382
  outputFormat: external_exports.enum(["mp4", "png"]).default("mp4").describe("Single render: output format (default: mp4)"),
19369
19383
  inputProps: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Single render: props object matching the composition's schema from clipform_list_compositions. Validated STRICTLY - unknown or missing props fail with the schema in the error, nothing renders silently with defaults. For map compositions (Map), wide shots (camera.zoom < 9) may round lat/lng to 1 decimal place to improve cache hit rates; close shots and pin drops should keep full precision \u2014 the pin lands exactly on `target`."),
19370
- wait: external_exports.boolean().optional().default(true).describe("Single render only: true (default) blocks until the render is ready and returns its URL; false returns a job ID for clipform_check_render. Batch items always run fire-and-poll."),
19384
+ wait: external_exports.boolean().optional().default(true).describe(FORM_CLIP_RULES ? "Single render only: true (default) blocks until the render is ready and attached to the node; false returns a job ID for clipform_check_render. Batch items always run fire-and-poll." : "Single render only: true (default) blocks until the render is ready and returns its URL; false returns a job ID for clipform_check_render. Batch items always run fire-and-poll."),
19371
19385
  items: external_exports.array(RenderItemSchema).min(1).max(10).optional().describe("Batch mode: multiple renders in one call. All fire in parallel; returns one job ID per item - collect with clipform_check_render (job_ids). Use this whenever rendering more than one clip."),
19372
- node_id: external_exports.string().optional().describe("Single render only: form node to attach this render to automatically once it completes. Requires form_id. For batch mode, set node_id per item instead."),
19373
- form_id: external_exports.string().uuid().optional().describe("The form UUID - required when node_id is set (single render) or any item sets node_id (batch)."),
19386
+ node_id: external_exports.string().optional().describe(FORM_CLIP_RULES ? "Single render only (required for a single render): form node to attach this render to automatically once it completes. Requires form_id. For batch mode, set node_id per item instead." : "Single render only: form node to attach this render to automatically once it completes. Requires form_id. For batch mode, set node_id per item instead."),
19387
+ form_id: formIdField.describe(`The form UUID${FORM_CLIP_RULES ? " - required" : " - required when node_id is set (single render) or any item sets node_id (batch)"}.`),
19374
19388
  captions: external_exports.array(CaptionSchema).optional().describe("Single render only: word-level captions from clipform_generate_tts, carried onto the attached media asset. Only used when node_id is set. For batch mode, set captions per item instead."),
19375
19389
  caption_ref: external_exports.string().optional().describe("Single render only: caption_ref from clipform_generate_tts - an opaque handle that attaches that TTS run's word-level captions to the media asset, resolved server-side. Preferred over captions. Only used when node_id is set. For batch mode, set caption_ref per item instead.")
19376
19390
  }),
@@ -19379,7 +19393,7 @@ ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_i
19379
19393
  external_exports.object({
19380
19394
  status: external_exports.enum(["rendering", "complete"]),
19381
19395
  job_id: external_exports.string().optional().describe("Present when status is 'rendering' - pass to check_render"),
19382
- public_url: external_exports.string().optional().describe("Present when status is 'complete' - attach via upload_media_asset then attach_node_media (fit_media: true), unless node_id was set (auto-attached)"),
19396
+ public_url: external_exports.string().optional().describe(FORM_CLIP_RULES ? "Present when status is 'complete' and the render was not attached to a node, or alongside attach_error so the attach can be retried." : "Present when status is 'complete' - attach via upload_media_asset then attach_node_media (fit_media: true), unless node_id was set (auto-attached)"),
19383
19397
  composition_id: external_exports.string().optional(),
19384
19398
  output_format: external_exports.string().optional(),
19385
19399
  attached: external_exports.boolean().optional().describe("True when node_id was provided and the render was attached to the node automatically (present once the attach outcome is known)."),
@@ -19396,6 +19410,11 @@ ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_i
19396
19410
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true }
19397
19411
  },
19398
19412
  async ({ compositionId, outputFormat, inputProps, wait, items, node_id, form_id, captions, caption_ref }) => {
19413
+ if (FORM_CLIP_RULES) {
19414
+ if (!form_id) return errorResult("form_id is required: a render is for one question in a Clipform form.");
19415
+ const missing = items?.length ? items.some((i) => !i.node_id) : !node_id;
19416
+ if (missing) return errorResult("node_id is required: a render is for one question in a Clipform form, so every render needs the node it attaches to.");
19417
+ }
19399
19418
  if (items?.length && compositionId) {
19400
19419
  return errorResult("Pass EITHER items (batch) OR compositionId (single render), not both.");
19401
19420
  }
@@ -19450,7 +19469,13 @@ ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_i
19450
19469
  const placeholderPromise = node_id && form_id ? createRenderPlaceholder({ formId: form_id, nodeId: node_id, mediaType: mediaTypeSingle, narrated }) : Promise.resolve(void 0);
19451
19470
  const result = await callApi("/internal/render", {
19452
19471
  timeoutMs: 3e5,
19453
- body: { compositionId, outputFormat, inputProps: inputProps ?? {} }
19472
+ body: {
19473
+ compositionId,
19474
+ outputFormat,
19475
+ inputProps: inputProps ?? {},
19476
+ ...form_id ? { form_id } : {},
19477
+ ...node_id ? { node_id } : {}
19478
+ }
19454
19479
  });
19455
19480
  if (!result.ok) {
19456
19481
  const placeholder = await placeholderPromise;
@@ -19476,16 +19501,17 @@ ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_i
19476
19501
  await failPlaceholder(placeholder, "Render completed without a public_url; nothing to attach.");
19477
19502
  }
19478
19503
  }
19504
+ const shownUrl = visiblePublicUrl(data.public_url, attach);
19479
19505
  return structuredResult(
19480
19506
  [
19481
- `Render complete. Public URL: ${data.public_url}`,
19507
+ shownUrl ? `Render complete. Public URL: ${shownUrl}` : `Render complete.`,
19482
19508
  attach ? attachSummaryLine(node_id, attach) : `Attach via clipform_upload_media_asset then clipform_attach_node_media with fit_media: true (composed 9:16 frame - contain, never crop).`
19483
19509
  ].join("\n"),
19484
19510
  {
19485
19511
  jobs: [
19486
19512
  {
19487
19513
  status: "complete",
19488
- ...data.public_url ? { public_url: data.public_url } : {},
19514
+ ...shownUrl ? { public_url: shownUrl } : {},
19489
19515
  composition_id: compositionId,
19490
19516
  output_format: outputFormat,
19491
19517
  ...attachStructuredFields(attach)
@@ -19714,7 +19740,7 @@ function registerRenderVideoTemplateTool(server) {
19714
19740
  "clipform_render_video_template",
19715
19741
  {
19716
19742
  title: "Render Video Template",
19717
- description: `Render a curated video template (a pre-arranged Scene: bed + overlay + sane defaults) to MP4 or PNG from a small controls object, instead of hand-assembling Scene layers. Call clipform_list_video_templates first for available template names and their controls. Renders through the Scene composition under the hood.
19743
+ description: `Render a curated video template (a pre-arranged Scene: bed + overlay + sane defaults) to MP4 or PNG${FORM_CLIP_RULES ? ` for one question in a Clipform form (max ${MAX_CLIP_SECONDS}s, attached to that question)` : ""} from a small controls object, instead of hand-assembling Scene layers. Call clipform_list_video_templates first for available template names and their controls. Renders through the Scene composition under the hood.
19718
19744
 
19719
19745
  ${RENDER_ROUTING_RULE}
19720
19746
  ${RENDER_ATTACH_RULE}`,
@@ -19722,16 +19748,16 @@ ${RENDER_ATTACH_RULE}`,
19722
19748
  template: external_exports.string().describe("Video template name (see clipform_list_video_templates)."),
19723
19749
  controls: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Template-specific controls (see clipform_list_video_templates for the exposed control surface)."),
19724
19750
  outputFormat: external_exports.enum(["mp4", "png"]).default("mp4").describe("Output format (default: mp4)"),
19725
- wait: external_exports.boolean().optional().default(true).describe("true (default) blocks until the render is ready and returns its URL; false returns a job ID for clipform_check_render."),
19726
- node_id: external_exports.string().optional().describe("Form node to attach this render to automatically once it completes - skips the manual clipform_upload_media_asset + clipform_attach_node_media steps and republishes the form if it's currently live. Requires form_id."),
19727
- form_id: external_exports.string().uuid().optional().describe("The form UUID (required when node_id is set)."),
19751
+ wait: external_exports.boolean().optional().default(true).describe(FORM_CLIP_RULES ? "true (default) blocks until the render is ready and attached to the node; false returns a job ID for clipform_check_render." : "true (default) blocks until the render is ready and returns its URL; false returns a job ID for clipform_check_render."),
19752
+ node_id: (FORM_CLIP_RULES ? external_exports.string() : external_exports.string().optional()).describe(FORM_CLIP_RULES ? "The form node (question) this clip is for - the render attaches to it automatically once it completes and the form is republished if it's currently live. Requires form_id." : "Form node to attach this render to automatically once it completes - skips the manual clipform_upload_media_asset + clipform_attach_node_media steps and republishes the form if it's currently live. Requires form_id."),
19753
+ form_id: (FORM_CLIP_RULES ? external_exports.string().uuid() : external_exports.string().uuid().optional()).describe(FORM_CLIP_RULES ? "The form UUID." : "The form UUID (required when node_id is set)."),
19728
19754
  captions: external_exports.array(CaptionSchema).optional().describe("Word-level captions from clipform_generate_tts - carried onto the attached media asset. Only used when node_id is set."),
19729
19755
  caption_ref: external_exports.string().optional().describe("caption_ref from clipform_generate_tts - an opaque handle that attaches that TTS run's word-level captions to the media asset, resolved server-side. Preferred over captions. Only used when node_id is set. Defaults to controls.audio_url when that is a clipform_generate_tts track (slideshow narration), so narrated montages keep their captions.")
19730
19756
  }),
19731
19757
  outputSchema: external_exports.object({
19732
19758
  status: external_exports.enum(["rendering", "complete"]),
19733
19759
  job_id: external_exports.string().optional().describe("Present when status is 'rendering' - pass to clipform_check_render"),
19734
- public_url: external_exports.string().optional().describe("Present when status is 'complete' - attach via upload_media_asset then attach_node_media (fit_media: true), unless node_id was set (auto-attached)"),
19760
+ public_url: external_exports.string().optional().describe(FORM_CLIP_RULES ? "Present when status is 'complete' and the render was not attached to a node, or alongside attach_error so the attach can be retried." : "Present when status is 'complete' - attach via upload_media_asset then attach_node_media (fit_media: true), unless node_id was set (auto-attached)"),
19735
19761
  template: external_exports.string().optional(),
19736
19762
  duration_seconds: external_exports.number().optional().describe("Final video length in seconds - the narration's real length when audio_url drove it."),
19737
19763
  output_format: external_exports.string().optional(),
@@ -19747,12 +19773,21 @@ ${RENDER_ATTACH_RULE}`,
19747
19773
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true }
19748
19774
  },
19749
19775
  async ({ template, controls, outputFormat, wait, node_id, form_id, captions, caption_ref }) => {
19776
+ if (FORM_CLIP_RULES && (!form_id || !node_id)) {
19777
+ return errorResult("form_id and node_id are required: a render is for one question in a Clipform form, so it needs the node it attaches to.");
19778
+ }
19750
19779
  if (node_id && !form_id) {
19751
19780
  return errorResult("form_id is required when node_id is set.");
19752
19781
  }
19753
19782
  const captionRef = resolveCaptionRef(caption_ref, controls?.audio_url);
19754
19783
  const narrated = renderHasNarration({ captions, captionRef, controls });
19755
- const renderBody = { template, controls: controls ?? {}, outputFormat };
19784
+ const renderBody = {
19785
+ template,
19786
+ controls: controls ?? {},
19787
+ outputFormat,
19788
+ ...form_id ? { form_id } : {},
19789
+ ...node_id ? { node_id } : {}
19790
+ };
19756
19791
  const mediaType = outputFormat === "png" ? "still" : "video";
19757
19792
  if (wait === false) {
19758
19793
  const job = createJob("clipform_render_video_template");
@@ -19815,15 +19850,16 @@ ${RENDER_ATTACH_RULE}`,
19815
19850
  await failPlaceholder(placeholder, "Render completed without a public_url; nothing to attach.");
19816
19851
  }
19817
19852
  }
19853
+ const shownUrl = visiblePublicUrl(data.public_url, attach);
19818
19854
  return structuredResult(
19819
19855
  [
19820
- `Render complete. Public URL: ${data.public_url}`,
19856
+ shownUrl ? `Render complete. Public URL: ${shownUrl}` : `Render complete.`,
19821
19857
  typeof data.duration_seconds === "number" ? `Duration: ${data.duration_seconds}s` : "",
19822
19858
  attach ? attachSummaryLine(node_id, attach) : `Attach via clipform_upload_media_asset then clipform_attach_node_media with fit_media: true (composed 9:16 frame - contain, never crop).`
19823
19859
  ].filter(Boolean).join("\n"),
19824
19860
  {
19825
19861
  status: "complete",
19826
- ...data.public_url ? { public_url: data.public_url } : {},
19862
+ ...shownUrl ? { public_url: shownUrl } : {},
19827
19863
  ...typeof data.duration_seconds === "number" ? { duration_seconds: data.duration_seconds } : {},
19828
19864
  template,
19829
19865
  output_format: outputFormat,
@@ -19912,7 +19948,7 @@ function projectJob(id, job) {
19912
19948
  return {
19913
19949
  job_id: id,
19914
19950
  status: "complete",
19915
- ...data?.public_url ? { public_url: data.public_url } : {},
19951
+ ...visiblePublicUrl(data?.public_url, job.attach) ? { public_url: visiblePublicUrl(data.public_url, job.attach) } : {},
19916
19952
  ...typeof data?.duration_seconds === "number" ? { duration_seconds: data.duration_seconds } : {},
19917
19953
  ...attachStructuredFields(job.attach)
19918
19954
  };
@@ -19936,7 +19972,7 @@ function describeJob(id, job) {
19936
19972
  }
19937
19973
  const data = job.result;
19938
19974
  const extras = [
19939
- ...data.public_url ? [data.public_url] : [],
19975
+ ...visiblePublicUrl(data.public_url, job.attach) ? [visiblePublicUrl(data.public_url, job.attach)] : [],
19940
19976
  ...data.duration_seconds ? [`${data.duration_seconds}s`] : []
19941
19977
  ].join(" | ");
19942
19978
  const attachNote = job.attach ? job.attach.attached ? ` (attached${job.attach.republished ? " + republished" : ""})` : ` (attach FAILED: ${job.attach.error})` : "";
@@ -19968,7 +20004,7 @@ Pass job_ids to check a whole batch in ONE call - one line of status per job. Pa
19968
20004
  republished: external_exports.boolean().optional().describe("True when the form was live and was republished to include this media."),
19969
20005
  attach_error: external_exports.string().optional().describe("Present when node_id was set but auto-attach failed - the render itself still succeeded.")
19970
20006
  })
19971
- ).describe("One entry per queried job; attach completed public_urls via upload_media_asset then attach_node_media unless already auto-attached")
20007
+ ).describe(FORM_CLIP_RULES ? "One entry per queried job. A render that attached to its node carries the attach outcome and media_asset_id; public_url appears only when it was not attached or alongside attach_error." : "One entry per queried job; attach completed public_urls via upload_media_asset then attach_node_media unless already auto-attached")
19972
20008
  }),
19973
20009
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }
19974
20010
  },
@@ -20004,7 +20040,7 @@ Pass job_ids to check a whole batch in ONE call - one line of status per job. Pa
20004
20040
  return structuredResult(
20005
20041
  [
20006
20042
  `Render complete.`,
20007
- ...data.public_url ? [`Public URL: ${data.public_url}`] : [],
20043
+ ...visiblePublicUrl(data.public_url, job.attach) ? [`Public URL: ${visiblePublicUrl(data.public_url, job.attach)}`] : [],
20008
20044
  ...data.duration_seconds ? [`Duration: ${data.duration_seconds}s`] : [],
20009
20045
  ...attachLines
20010
20046
  ].join("\n"),
@@ -20301,6 +20337,7 @@ function buildInstructions(caps, signedIn) {
20301
20337
  "When the brief is clear, build the form directly; when it's vague, ask one or two short questions first.",
20302
20338
  caps.media && "Prefer rich media: video over images over plain text.",
20303
20339
  caps.media ? "Before building, derive a register from the topic and audience (e.g. hype, playful, warm, considered, elegant, sombre); if the user states a mood explicitly, that wins. State the register once, then apply it to every rendering choice - narration tone, motion preset, music, pacing. Never mix registers in one form." : "Before building, derive a register from the topic and audience (e.g. hype, playful, warm, considered, elegant, sombre); if the user states a mood explicitly, that wins. State the register once, then apply it to every question, option, and end-screen line. Never mix registers in one form.",
20340
+ caps.media && "Clipform's video tools make short clips for questions in a form. For clipping or editing existing video, animating a photo, lip-sync, or standalone or long videos, tell the user plainly that Clipform does not do that.",
20304
20341
  "At the start of a build, call clipform_get_workflow to load the recipe for the form type, and clipform_get_guide for craft detail.",
20305
20342
  "Every *_id argument is a UUID returned by the tools - not the short share_id from a form URL.",
20306
20343
  "Use clipform_whoami when the request is about the account itself (the active workspace, plan, or limits); building a form does not need it first.",
@@ -20462,7 +20499,7 @@ export {
20462
20499
  MissingRequiredClientCapabilityError,
20463
20500
  ReadBuffer,
20464
20501
  serializeMessage,
20465
- process2 as process,
20502
+ process,
20466
20503
  isLegacyRequest,
20467
20504
  createMcpHandler,
20468
20505
  RENDER_TIMING,
@@ -20480,4 +20517,4 @@ export {
20480
20517
  * MIT Licensed
20481
20518
  *)
20482
20519
  */
20483
- //# sourceMappingURL=chunk-RHMP5D55.js.map
20520
+ //# sourceMappingURL=chunk-H7MHP72Z.js.map