@remotion/studio 4.0.522 → 4.0.523

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.
Files changed (220) hide show
  1. package/dist/api/install-package.js +4 -2
  2. package/dist/components/AssetAudioVolume.d.ts +5 -0
  3. package/dist/components/AssetAudioVolume.js +33 -0
  4. package/dist/components/Canvas.js +5 -6
  5. package/dist/components/CaptionInspector.js +74 -20
  6. package/dist/components/CheckboardToggle.js +8 -6
  7. package/dist/components/Checkbox.d.ts +1 -0
  8. package/dist/components/Checkbox.js +2 -2
  9. package/dist/components/CompositionContextButton.js +4 -1
  10. package/dist/components/CompositionSelectorItem.js +2 -2
  11. package/dist/components/ConfigureLicenseModal.js +1 -1
  12. package/dist/components/CurrentAsset.js +40 -6
  13. package/dist/components/EditorContexts.js +3 -1
  14. package/dist/components/ElementInstallConfirmation.js +287 -135
  15. package/dist/components/FixComputedValueModal.js +38 -8
  16. package/dist/components/FullscreenToggle.js +9 -8
  17. package/dist/components/GlobalKeybindings.js +50 -49
  18. package/dist/components/HighlightedElementSource.d.ts +5 -0
  19. package/dist/components/HighlightedElementSource.js +78 -0
  20. package/dist/components/InspectorPanel/MultiSequenceField.d.ts +12 -0
  21. package/dist/components/InspectorPanel/MultiSequenceField.js +131 -0
  22. package/dist/components/InspectorPanel/MultiSequenceInspector.d.ts +8 -0
  23. package/dist/components/InspectorPanel/MultiSequenceInspector.js +102 -0
  24. package/dist/components/InspectorPanel/MultiSequenceNumberField.d.ts +9 -0
  25. package/dist/components/InspectorPanel/MultiSequenceNumberField.js +88 -0
  26. package/dist/components/InspectorPanel.js +4 -0
  27. package/dist/components/InspectorSequenceSection.js +64 -1
  28. package/dist/components/InstallPackage.js +4 -5
  29. package/dist/components/KeyboardShortcutsSettings.js +212 -33
  30. package/dist/components/MenuToolbar.js +7 -5
  31. package/dist/components/ModalContainer.d.ts +1 -0
  32. package/dist/components/ModalContainer.js +2 -2
  33. package/dist/components/Modals.js +3 -1
  34. package/dist/components/ModelManager.d.ts +16 -0
  35. package/dist/components/ModelManager.js +200 -0
  36. package/dist/components/ModelsSettings.d.ts +2 -0
  37. package/dist/components/ModelsSettings.js +133 -0
  38. package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
  39. package/dist/components/NewComposition/DismissableModal.js +2 -2
  40. package/dist/components/NewComposition/InputDragger.d.ts +2 -2
  41. package/dist/components/NewComposition/InputDragger.js +6 -6
  42. package/dist/components/NewComposition/NewFolder.js +11 -8
  43. package/dist/components/NewComposition/RenameFolder.js +17 -10
  44. package/dist/components/OptionalPackageModal.d.ts +11 -0
  45. package/dist/components/OptionalPackageModal.js +155 -0
  46. package/dist/components/PlayPause.js +4 -8
  47. package/dist/components/PlaybackKeyboardShortcutsManager.js +3 -6
  48. package/dist/components/PreviewToolbarOverflowButton.js +11 -2
  49. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +5 -2
  50. package/dist/components/RadioButton.d.ts +1 -0
  51. package/dist/components/RadioButton.js +2 -2
  52. package/dist/components/RenderButton.js +5 -1
  53. package/dist/components/RenderModal/NumberSetting.d.ts +6 -1
  54. package/dist/components/RenderModal/NumberSetting.js +2 -2
  55. package/dist/components/RenderModal/RenderModalBasic.js +1 -1
  56. package/dist/components/RenderModal/RenderModalOutputName.d.ts +3 -1
  57. package/dist/components/RenderModal/RenderModalOutputName.js +4 -4
  58. package/dist/components/RenderModal/SeparateAudioOption.js +1 -1
  59. package/dist/components/RenderModal/WebRenderModalBasic.js +1 -1
  60. package/dist/components/RenderQueue/CaptionQueueItem.d.ts +6 -0
  61. package/dist/components/RenderQueue/CaptionQueueItem.js +129 -0
  62. package/dist/components/RenderQueue/CaptionQueueProcessor.d.ts +1 -0
  63. package/dist/components/RenderQueue/CaptionQueueProcessor.js +110 -0
  64. package/dist/components/RenderQueue/CaptionQueueProcessorLoader.d.ts +2 -0
  65. package/dist/components/RenderQueue/CaptionQueueProcessorLoader.js +54 -0
  66. package/dist/components/RenderQueue/RenderQueueItem.js +3 -3
  67. package/dist/components/RenderQueue/VideoMattingQueueItem.d.ts +6 -0
  68. package/dist/components/RenderQueue/VideoMattingQueueItem.js +129 -0
  69. package/dist/components/RenderQueue/VideoMattingQueueProcessor.d.ts +1 -0
  70. package/dist/components/RenderQueue/VideoMattingQueueProcessor.js +105 -0
  71. package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.d.ts +2 -0
  72. package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.js +54 -0
  73. package/dist/components/RenderQueue/caption-job-types.d.ts +47 -0
  74. package/dist/components/RenderQueue/caption-job-types.js +7 -0
  75. package/dist/components/RenderQueue/context.d.ts +16 -0
  76. package/dist/components/RenderQueue/context.js +224 -11
  77. package/dist/components/RenderQueue/index.js +34 -10
  78. package/dist/components/RenderQueue/item-style.d.ts +1 -0
  79. package/dist/components/RenderQueue/item-style.js +2 -1
  80. package/dist/components/RenderQueue/load-model-for-job.d.ts +11 -0
  81. package/dist/components/RenderQueue/load-model-for-job.js +14 -0
  82. package/dist/components/RenderQueue/video-matting-job-types.d.ts +38 -0
  83. package/dist/components/RenderQueue/video-matting-job-types.js +5 -0
  84. package/dist/components/RendersTab.js +4 -4
  85. package/dist/components/SegmentedControl.d.ts +2 -2
  86. package/dist/components/SegmentedControl.js +38 -13
  87. package/dist/components/SelectedOutlinePolygon.js +8 -2
  88. package/dist/components/SettingsButton.d.ts +4 -0
  89. package/dist/components/SettingsButton.js +49 -0
  90. package/dist/components/SettingsModal.d.ts +1 -1
  91. package/dist/components/SettingsModal.js +3 -1
  92. package/dist/components/ShowOutlinesProvider.js +12 -0
  93. package/dist/components/SidebarCollapserControls.js +10 -11
  94. package/dist/components/SizeSelector.js +10 -2
  95. package/dist/components/SkillsSettings.js +2 -3
  96. package/dist/components/SnappingToggle.js +5 -2
  97. package/dist/components/Tabs/vertical.d.ts +1 -0
  98. package/dist/components/Tabs/vertical.js +2 -2
  99. package/dist/components/TimeValue.js +2 -3
  100. package/dist/components/Timeline/SequencePropsObserver.js +4 -0
  101. package/dist/components/Timeline/Timeline.js +2 -42
  102. package/dist/components/Timeline/TimelineClipboardKeybindings.js +2 -4
  103. package/dist/components/Timeline/TimelineDeleteKeybindings.js +3 -18
  104. package/dist/components/Timeline/TimelineDragHandler.js +2 -2
  105. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
  106. package/dist/components/Timeline/TimelineRowChrome.js +11 -3
  107. package/dist/components/Timeline/TimelineSchemaField.js +8 -4
  108. package/dist/components/Timeline/TimelineSelection.d.ts +2 -0
  109. package/dist/components/Timeline/TimelineSelection.js +55 -2
  110. package/dist/components/Timeline/TimelineSequence.js +75 -17
  111. package/dist/components/Timeline/TimelineSequenceItem.d.ts +0 -1
  112. package/dist/components/Timeline/TimelineSequenceItem.js +208 -111
  113. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +23 -3
  114. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +73 -25
  115. package/dist/components/Timeline/TimelineTimeIndicators.js +1 -0
  116. package/dist/components/Timeline/use-asset-timeline-context-menu.d.ts +2 -0
  117. package/dist/components/Timeline/use-asset-timeline-context-menu.js +52 -0
  118. package/dist/components/TimelineInOutToggle.js +20 -17
  119. package/dist/components/Transcription/LazyModels.d.ts +1 -0
  120. package/dist/components/Transcription/LazyModels.js +5 -0
  121. package/dist/components/Transcription/Models.d.ts +6 -0
  122. package/dist/components/Transcription/Models.js +18 -0
  123. package/dist/components/Transcription/TranscriptionModal.d.ts +3 -0
  124. package/dist/components/Transcription/TranscriptionModal.js +428 -0
  125. package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.d.ts +5 -0
  126. package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.js +48 -0
  127. package/dist/components/Transcription/caption-output-name.d.ts +2 -0
  128. package/dist/components/Transcription/caption-output-name.js +10 -0
  129. package/dist/components/Transcription/resample-media-to-16-khz.d.ts +6 -0
  130. package/dist/components/Transcription/resample-media-to-16-khz.js +82 -0
  131. package/dist/components/Transcription/whisper-languages.d.ts +2 -0
  132. package/dist/components/Transcription/whisper-languages.js +104 -0
  133. package/dist/components/Transcription/whisper-webgpu-capability.d.ts +2 -0
  134. package/dist/components/Transcription/whisper-webgpu-capability.js +7 -0
  135. package/dist/components/UndoRedoButtons.js +13 -38
  136. package/dist/components/UpdatesSettings.js +8 -12
  137. package/dist/components/VideoMatting/LazyModels.d.ts +1 -0
  138. package/dist/components/VideoMatting/LazyModels.js +5 -0
  139. package/dist/components/VideoMatting/Models.d.ts +6 -0
  140. package/dist/components/VideoMatting/Models.js +18 -0
  141. package/dist/components/VideoMatting/VideoMattingModal.d.ts +3 -0
  142. package/dist/components/VideoMatting/VideoMattingModal.js +207 -0
  143. package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.d.ts +5 -0
  144. package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.js +46 -0
  145. package/dist/components/VideoMatting/video-matting-capability.d.ts +2 -0
  146. package/dist/components/VideoMatting/video-matting-capability.js +7 -0
  147. package/dist/components/WebMcp.js +439 -22
  148. package/dist/components/import-assets.d.ts +3 -2
  149. package/dist/components/import-assets.js +5 -9
  150. package/dist/components/keyboard-shortcuts.d.ts +17 -1
  151. package/dist/components/keyboard-shortcuts.js +177 -89
  152. package/dist/components/public-output-name.d.ts +5 -0
  153. package/dist/components/public-output-name.js +60 -0
  154. package/dist/components/use-model-cache-status.d.ts +7 -0
  155. package/dist/components/use-model-cache-status.js +35 -0
  156. package/dist/esm/CaptionQueueProcessor-k0yrm3dj.mjs +211 -0
  157. package/dist/esm/HighlightedElementSource-jfc66k4p.mjs +1236 -0
  158. package/dist/esm/LazyModels-2trdm224.mjs +11 -0
  159. package/dist/esm/LazyModels-fjb5ckaq.mjs +11 -0
  160. package/dist/esm/TranscriptionModal-916jqhry.mjs +1011 -0
  161. package/dist/esm/VideoMattingModal-2tm79s9b.mjs +374 -0
  162. package/dist/esm/VideoMattingQueueProcessor-t1hgm2rm.mjs +109 -0
  163. package/dist/esm/index-1x7bsdh6.mjs +261 -0
  164. package/dist/esm/index-3hgr6gjx.mjs +41 -0
  165. package/dist/esm/index-5qddp5h7.mjs +36 -0
  166. package/dist/esm/index-5zrb1ft4.mjs +39 -0
  167. package/dist/esm/index-6cvm9a65.mjs +45923 -0
  168. package/dist/esm/index-7tt71e8n.mjs +36 -0
  169. package/dist/esm/index-9x6e1dq0.mjs +428 -0
  170. package/dist/esm/index-cw0pnpg5.mjs +50 -0
  171. package/dist/esm/index-czwvnn9g.mjs +35 -0
  172. package/dist/esm/index-hy4xcgty.mjs +1366 -0
  173. package/dist/esm/{chunk-je0h1bgt.js → index-jg13hf2g.mjs} +3 -1
  174. package/dist/esm/{chunk-6jf1natv.js → index-rcv7qkt5.mjs} +18 -1
  175. package/dist/esm/index-sgtmgc4h.mjs +423 -0
  176. package/dist/esm/index-te66vvrp.mjs +142 -0
  177. package/dist/esm/index-v4tr1bft.mjs +20 -0
  178. package/dist/esm/index-x7t2y7ws.mjs +54194 -0
  179. package/dist/esm/index-xhe2m2qr.mjs +1146 -0
  180. package/dist/esm/index.mjs +45 -933
  181. package/dist/esm/internals.mjs +13 -114393
  182. package/dist/esm/previewEntry.mjs +387 -115050
  183. package/dist/esm/renderEntry.mjs +3 -3
  184. package/dist/esm/{chunk-m0jqdbkr.js → resolve-composition-component-location-14148845.mjs} +1 -1
  185. package/dist/helpers/drag-aware-double-click.d.ts +2 -1
  186. package/dist/helpers/drag-aware-double-click.js +12 -1
  187. package/dist/helpers/get-asset-metadata.d.ts +1 -0
  188. package/dist/helpers/get-asset-metadata.js +4 -0
  189. package/dist/helpers/hoverable.js +8 -0
  190. package/dist/helpers/inject-css.js +2 -0
  191. package/dist/helpers/optional-package-dependencies.d.ts +3 -0
  192. package/dist/helpers/optional-package-dependencies.js +24 -0
  193. package/dist/helpers/pointer-session.d.ts +6 -0
  194. package/dist/helpers/pointer-session.js +36 -14
  195. package/dist/helpers/prism-tomorrow.d.ts +1 -0
  196. package/dist/helpers/prism-tomorrow.js +151 -0
  197. package/dist/helpers/sequence-node-path-mutations.js +11 -0
  198. package/dist/helpers/slugify-name.d.ts +1 -0
  199. package/dist/helpers/slugify-name.js +14 -0
  200. package/dist/helpers/studio-runtime-config.d.ts +1 -0
  201. package/dist/helpers/studio-runtime-config.js +6 -1
  202. package/dist/helpers/use-keybinding.d.ts +9 -3
  203. package/dist/helpers/use-keybinding.js +8 -9
  204. package/dist/helpers/use-keyboard-shortcut-label.d.ts +2 -0
  205. package/dist/helpers/use-keyboard-shortcut-label.js +15 -0
  206. package/dist/helpers/use-menu-structure.js +58 -13
  207. package/dist/icons/input-props.d.ts +1 -1
  208. package/dist/icons/input-props.js +2 -2
  209. package/dist/icons/models.d.ts +4 -0
  210. package/dist/icons/models.js +7 -0
  211. package/dist/icons/separation.d.ts +4 -0
  212. package/dist/icons/separation.js +7 -0
  213. package/dist/icons/transcription.d.ts +4 -0
  214. package/dist/icons/transcription.js +7 -0
  215. package/dist/icons/upload.js +1 -1
  216. package/dist/state/modals.d.ts +14 -2
  217. package/package.json +34 -20
  218. package/dist/components/UpdateCheck.d.ts +0 -1
  219. package/dist/components/UpdateCheck.js +0 -79
  220. package/dist/esm/chunk-3netyjd9.js +0 -99793
@@ -1,8 +1,43 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.WebMcp = void 0;
37
+ const studio_shared_1 = require("@remotion/studio-shared");
4
38
  const react_1 = require("react");
5
39
  const remotion_1 = require("remotion");
40
+ const install_package_1 = require("../api/install-package");
6
41
  const pause_1 = require("../api/pause");
7
42
  const play_1 = require("../api/play");
8
43
  const restart_studio_1 = require("../api/restart-studio");
@@ -12,6 +47,7 @@ const current_error_1 = require("../error-overlay/current-error");
12
47
  const calculate_timeline_1 = require("../helpers/calculate-timeline");
13
48
  const create_folder_tree_1 = require("../helpers/create-folder-tree");
14
49
  const format_file_location_1 = require("../helpers/format-file-location");
50
+ const get_preview_file_type_1 = require("../helpers/get-preview-file-type");
15
51
  const get_timeline_max_zoom_1 = require("../helpers/get-timeline-max-zoom");
16
52
  const editor_guides_1 = require("../state/editor-guides");
17
53
  const loop_1 = require("../state/loop");
@@ -19,6 +55,9 @@ const mute_1 = require("../state/mute");
19
55
  const playbackrate_1 = require("../state/playbackrate");
20
56
  const timeline_zoom_1 = require("../state/timeline-zoom");
21
57
  const InitialCompositionLoader_1 = require("./InitialCompositionLoader");
58
+ const OptionalPackageModal_1 = require("./OptionalPackageModal");
59
+ const public_output_name_1 = require("./public-output-name");
60
+ const context_1 = require("./RenderQueue/context");
22
61
  const selected_outline_measurement_1 = require("./selected-outline-measurement");
23
62
  const find_track_for_node_path_info_1 = require("./Timeline/find-track-for-node-path-info");
24
63
  const imperative_state_1 = require("./Timeline/imperative-state");
@@ -28,6 +67,10 @@ const timeline_refs_1 = require("./Timeline/timeline-refs");
28
67
  const TimelineSelection_1 = require("./Timeline/TimelineSelection");
29
68
  const get_stack_1 = require("./Timeline/TimelineStack/get-stack");
30
69
  const use_resolved_stack_react_to_change_1 = require("./Timeline/use-resolved-stack-react-to-change");
70
+ const caption_output_name_1 = require("./Transcription/caption-output-name");
71
+ const whisper_webgpu_capability_1 = require("./Transcription/whisper-webgpu-capability");
72
+ const use_static_files_1 = require("./use-static-files");
73
+ const video_matting_capability_1 = require("./VideoMatting/video-matting-capability");
31
74
  const serializeSequence = (track) => {
32
75
  var _a;
33
76
  return {
@@ -62,9 +105,34 @@ const serializeCompositionTree = (items) => {
62
105
  };
63
106
  const getNoStack = () => null;
64
107
  const MAX_CANVAS_HTML_LENGTH = 100000;
108
+ const missingOptionalPackageResult = (packageName) => ({
109
+ error: `This requires ${packageName}. Call install_package with packageName set to ${packageName}, then retry.`,
110
+ installPackage: {
111
+ packageName,
112
+ tool: 'install_package',
113
+ },
114
+ success: false,
115
+ });
116
+ const resolveAssetPath = ({ assetPath, currentContent, staticFiles, }) => {
117
+ var _a;
118
+ const resolvedAssetPath = assetPath === undefined
119
+ ? (currentContent === null || currentContent === void 0 ? void 0 : currentContent.type) === 'asset'
120
+ ? ((_a = currentContent.asset) !== null && _a !== void 0 ? _a : null)
121
+ : null
122
+ : assetPath;
123
+ if (typeof resolvedAssetPath !== 'string' || resolvedAssetPath.length === 0) {
124
+ throw new Error('assetPath must be a non-empty public-folder path, or an asset must be selected in Studio.');
125
+ }
126
+ if (!staticFiles.some((file) => file.name === resolvedAssetPath)) {
127
+ throw new Error(`Asset ${resolvedAssetPath} was not found in public/.`);
128
+ }
129
+ return resolvedAssetPath;
130
+ };
65
131
  const WebMcp = () => {
66
132
  var _a;
67
133
  var _b, _c, _d, _e, _f;
134
+ const { addCaptionJob, addVideoMattingJob } = (0, react_1.useContext)(context_1.RenderQueueContext);
135
+ const staticFiles = (0, use_static_files_1.useStaticFiles)();
68
136
  const { canSelect, clearSelection, selectedItems, selectItems } = (0, TimelineSelection_1.useTimelineSelection)();
69
137
  const { canvasContent, compositions, currentCompositionMetadata, folders } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
70
138
  const { playbackRate: currentPlaybackRate, setPlaybackRate } = remotion_1.Internals.usePlaybackRate();
@@ -157,6 +225,22 @@ const WebMcp = () => {
157
225
  }
158
226
  return ((_a = compositions.find((composition) => composition.id === canvasContent.compositionId)) !== null && _a !== void 0 ? _a : null);
159
227
  }, [canvasContent, compositions]);
228
+ const currentContent = (0, react_1.useMemo)(() => {
229
+ if ((canvasContent === null || canvasContent === void 0 ? void 0 : canvasContent.type) === 'output-blob') {
230
+ return {
231
+ type: canvasContent.type,
232
+ displayName: canvasContent.displayName,
233
+ width: canvasContent.width,
234
+ height: canvasContent.height,
235
+ sizeInBytes: canvasContent.sizeInBytes,
236
+ };
237
+ }
238
+ return canvasContent;
239
+ }, [canvasContent]);
240
+ const currentContentRef = (0, react_1.useRef)(currentContent);
241
+ currentContentRef.current = currentContent;
242
+ const staticFilesRef = (0, react_1.useRef)(staticFiles);
243
+ staticFilesRef.current = staticFiles;
160
244
  const currentComposition = (_f = currentCompositionDefinition === null || currentCompositionDefinition === void 0 ? void 0 : currentCompositionDefinition.id) !== null && _f !== void 0 ? _f : null;
161
245
  const currentCompositionRef = (0, react_1.useRef)(currentComposition);
162
246
  currentCompositionRef.current = currentComposition;
@@ -205,6 +289,332 @@ const WebMcp = () => {
205
289
  }).filter((timelineTrack) => (0, should_show_track_in_timeline_1.shouldShowTrackInTimeline)(timelineTrack, durationInFrames));
206
290
  };
207
291
  Promise.all([
292
+ modelContext.registerTool({
293
+ name: 'install_package',
294
+ title: 'Install Studio package',
295
+ description: 'Install an npm package into the current Remotion project. Remotion packages are pinned to the current Remotion version, and known auxiliary packages are pinned to their recommended version.',
296
+ inputSchema: {
297
+ type: 'object',
298
+ properties: {
299
+ packageName: {
300
+ type: 'string',
301
+ description: 'The npm package name to install.',
302
+ },
303
+ version: {
304
+ type: 'string',
305
+ description: 'An optional exact semantic version. Omit it to use the recommended version.',
306
+ },
307
+ },
308
+ required: ['packageName'],
309
+ additionalProperties: false,
310
+ },
311
+ annotations: { readOnlyHint: false },
312
+ execute: async ({ packageName, version }) => {
313
+ if (typeof packageName !== 'string' ||
314
+ !(0, studio_shared_1.isValidPackageName)(packageName)) {
315
+ throw new Error('packageName must be a valid npm package name.');
316
+ }
317
+ if (version !== undefined &&
318
+ (typeof version !== 'string' ||
319
+ !/^[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(version))) {
320
+ throw new Error('version must be an exact semantic version.');
321
+ }
322
+ await (0, install_package_1.installPackages)([
323
+ {
324
+ name: packageName,
325
+ version: typeof version === 'string' ? version : null,
326
+ },
327
+ ]);
328
+ (0, OptionalPackageModal_1.markOptionalPackageInstalled)(packageName);
329
+ return { installed: true, packageName };
330
+ },
331
+ }, { signal: controller.signal }),
332
+ modelContext.registerTool({
333
+ name: 'transcribe_asset',
334
+ title: 'Transcribe Studio asset',
335
+ description: 'Transcribe an audio or video asset from the public folder into Remotion Caption[] JSON and add the work to the Jobs queue. If assetPath is omitted, the asset currently open in Studio is used.',
336
+ inputSchema: {
337
+ type: 'object',
338
+ properties: {
339
+ assetPath: {
340
+ type: 'string',
341
+ description: 'Optional path relative to public/. Defaults to the asset currently open in Studio.',
342
+ },
343
+ outputPath: {
344
+ type: 'string',
345
+ description: 'Optional Caption[] JSON path relative to public/. Defaults to <asset>-captions.json.',
346
+ },
347
+ model: {
348
+ type: 'string',
349
+ default: 'small.en',
350
+ description: 'Whisper model. Defaults to small.en.',
351
+ },
352
+ language: {
353
+ type: 'string',
354
+ default: 'en',
355
+ description: 'Spoken language code for multilingual models. Defaults to en.',
356
+ },
357
+ task: {
358
+ type: 'string',
359
+ enum: ['transcribe', 'translate'],
360
+ default: 'transcribe',
361
+ },
362
+ chunkLengthInSeconds: {
363
+ type: 'number',
364
+ minimum: 1,
365
+ maximum: 30,
366
+ default: 30,
367
+ },
368
+ strideLengthInSeconds: {
369
+ type: 'number',
370
+ minimum: 0,
371
+ default: 5,
372
+ },
373
+ forceFullSequences: { type: 'boolean', default: false },
374
+ doSample: { type: 'boolean', default: false },
375
+ temperature: { type: 'number', exclusiveMinimum: 0, default: 1 },
376
+ topK: { type: 'integer', minimum: 0, default: 50 },
377
+ repetitionPenalty: {
378
+ type: 'number',
379
+ exclusiveMinimum: 0,
380
+ default: 1,
381
+ },
382
+ noRepeatNgramSize: { type: 'integer', minimum: 0, default: 0 },
383
+ },
384
+ additionalProperties: false,
385
+ },
386
+ annotations: { readOnlyHint: false },
387
+ execute: async (input) => {
388
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
389
+ if (!(0, OptionalPackageModal_1.isOptionalPackageInstalled)(whisper_webgpu_capability_1.WHISPER_WEBGPU_PACKAGE)) {
390
+ return missingOptionalPackageResult(whisper_webgpu_capability_1.WHISPER_WEBGPU_PACKAGE);
391
+ }
392
+ const assetPath = resolveAssetPath({
393
+ assetPath: input.assetPath,
394
+ currentContent: currentContentRef.current,
395
+ staticFiles: staticFilesRef.current,
396
+ });
397
+ const fileType = (0, get_preview_file_type_1.getPreviewFileType)(assetPath);
398
+ if (fileType !== 'audio' && fileType !== 'video') {
399
+ throw new Error('The transcription asset must be audio or video.');
400
+ }
401
+ const whisper = await Promise.resolve().then(() => __importStar(require('@remotion/whisper-webgpu')));
402
+ const modelName = (_a = input.model) !== null && _a !== void 0 ? _a : 'small.en';
403
+ if (typeof modelName !== 'string') {
404
+ throw new Error('model must be a string.');
405
+ }
406
+ const model = whisper
407
+ .getAvailableModels()
408
+ .find((candidate) => candidate.name === modelName);
409
+ if (!model) {
410
+ throw new Error(`Unknown Whisper model: ${modelName}.`);
411
+ }
412
+ const task = (_b = input.task) !== null && _b !== void 0 ? _b : 'transcribe';
413
+ if (task !== 'transcribe' && task !== 'translate') {
414
+ throw new Error('task must be transcribe or translate.');
415
+ }
416
+ if (task === 'translate' && !model.supportsTranslation) {
417
+ throw new Error(`${model.name} does not support translation.`);
418
+ }
419
+ const language = (_c = input.language) !== null && _c !== void 0 ? _c : 'en';
420
+ if (typeof language !== 'string' || language.length === 0) {
421
+ throw new Error('language must be a non-empty string.');
422
+ }
423
+ const chunkLengthInSeconds = (_d = input.chunkLengthInSeconds) !== null && _d !== void 0 ? _d : 30;
424
+ const strideLengthInSeconds = (_e = input.strideLengthInSeconds) !== null && _e !== void 0 ? _e : 5;
425
+ const temperature = (_f = input.temperature) !== null && _f !== void 0 ? _f : 1;
426
+ const topK = (_g = input.topK) !== null && _g !== void 0 ? _g : 50;
427
+ const repetitionPenalty = (_h = input.repetitionPenalty) !== null && _h !== void 0 ? _h : 1;
428
+ const noRepeatNgramSize = (_j = input.noRepeatNgramSize) !== null && _j !== void 0 ? _j : 0;
429
+ if (typeof chunkLengthInSeconds !== 'number' ||
430
+ !Number.isFinite(chunkLengthInSeconds) ||
431
+ chunkLengthInSeconds < 1 ||
432
+ chunkLengthInSeconds > 30) {
433
+ throw new Error('chunkLengthInSeconds must be between 1 and 30.');
434
+ }
435
+ if (typeof strideLengthInSeconds !== 'number' ||
436
+ !Number.isFinite(strideLengthInSeconds) ||
437
+ strideLengthInSeconds < 0 ||
438
+ strideLengthInSeconds * 2 >= chunkLengthInSeconds) {
439
+ throw new Error('strideLengthInSeconds must be non-negative and less than half of chunkLengthInSeconds.');
440
+ }
441
+ if (typeof temperature !== 'number' ||
442
+ !Number.isFinite(temperature) ||
443
+ temperature <= 0 ||
444
+ typeof repetitionPenalty !== 'number' ||
445
+ !Number.isFinite(repetitionPenalty) ||
446
+ repetitionPenalty <= 0 ||
447
+ typeof topK !== 'number' ||
448
+ !Number.isInteger(topK) ||
449
+ topK < 0 ||
450
+ typeof noRepeatNgramSize !== 'number' ||
451
+ !Number.isInteger(noRepeatNgramSize) ||
452
+ noRepeatNgramSize < 0) {
453
+ throw new Error('Invalid transcription decoding settings.');
454
+ }
455
+ const forceFullSequences = (_k = input.forceFullSequences) !== null && _k !== void 0 ? _k : false;
456
+ const doSample = (_l = input.doSample) !== null && _l !== void 0 ? _l : false;
457
+ if (typeof forceFullSequences !== 'boolean' ||
458
+ typeof doSample !== 'boolean') {
459
+ throw new Error('forceFullSequences and doSample must be booleans.');
460
+ }
461
+ const src = (0, remotion_1.staticFile)(assetPath);
462
+ const displayName = (_m = assetPath.split('/').at(-1)) !== null && _m !== void 0 ? _m : assetPath;
463
+ const outputPath = (_o = input.outputPath) !== null && _o !== void 0 ? _o : (0, caption_output_name_1.getDefaultCaptionOutputName)(src, displayName);
464
+ if (typeof outputPath !== 'string') {
465
+ throw new Error('outputPath must be a string.');
466
+ }
467
+ const outputError = (0, caption_output_name_1.validateCaptionOutputName)(outputPath);
468
+ if (outputError !== null) {
469
+ throw new Error(outputError);
470
+ }
471
+ const jobId = addCaptionJob({
472
+ audioStreamIndex: null,
473
+ chunkLengthInSeconds,
474
+ displayName,
475
+ doSample,
476
+ forceFullSequences,
477
+ language: model.multilingual ? language : null,
478
+ model: model.name,
479
+ noRepeatNgramSize,
480
+ outName: outputPath,
481
+ repetitionPenalty,
482
+ requestInit: null,
483
+ src,
484
+ strideLengthInSeconds,
485
+ task,
486
+ temperature,
487
+ topK,
488
+ });
489
+ return { jobId, outputPath, success: true };
490
+ },
491
+ }, { signal: controller.signal }),
492
+ modelContext.registerTool({
493
+ name: 'separate_video_layers',
494
+ title: 'Separate Studio video layers',
495
+ description: 'Separate a video asset from the public folder into background and foreground WebM files and add the work to the Jobs queue. If assetPath is omitted, the asset currently open in Studio is used.',
496
+ inputSchema: {
497
+ type: 'object',
498
+ properties: {
499
+ assetPath: {
500
+ type: 'string',
501
+ description: 'Optional path relative to public/. Defaults to the asset currently open in Studio.',
502
+ },
503
+ baseOutputPath: {
504
+ type: 'string',
505
+ description: 'Optional background output path relative to public/.',
506
+ },
507
+ foregroundOutputPath: {
508
+ type: 'string',
509
+ description: 'Optional foreground output path relative to public/.',
510
+ },
511
+ model: {
512
+ type: 'string',
513
+ default: 'ben2-base',
514
+ },
515
+ audio: {
516
+ type: 'string',
517
+ enum: ['base', 'foreground', 'both', 'none'],
518
+ default: 'base',
519
+ },
520
+ videoBitrate: {
521
+ oneOf: [
522
+ {
523
+ type: 'string',
524
+ enum: ['very-low', 'low', 'medium', 'high', 'very-high'],
525
+ },
526
+ { type: 'integer', minimum: 1 },
527
+ ],
528
+ default: 'very-high',
529
+ },
530
+ },
531
+ additionalProperties: false,
532
+ },
533
+ annotations: { readOnlyHint: false },
534
+ execute: async (input) => {
535
+ var _a;
536
+ var _b, _c, _d, _e, _f, _g, _h;
537
+ if (!(0, OptionalPackageModal_1.isOptionalPackageInstalled)(video_matting_capability_1.VIDEO_MATTING_PACKAGE)) {
538
+ return missingOptionalPackageResult(video_matting_capability_1.VIDEO_MATTING_PACKAGE);
539
+ }
540
+ const assetPath = resolveAssetPath({
541
+ assetPath: input.assetPath,
542
+ currentContent: currentContentRef.current,
543
+ staticFiles: staticFilesRef.current,
544
+ });
545
+ if ((0, get_preview_file_type_1.getPreviewFileType)(assetPath) !== 'video') {
546
+ throw new Error('The separation asset must be a video.');
547
+ }
548
+ const videoMatting = await Promise.resolve().then(() => __importStar(require('@remotion/video-matting')));
549
+ const modelName = (_b = input.model) !== null && _b !== void 0 ? _b : 'ben2-base';
550
+ if (typeof modelName !== 'string') {
551
+ throw new Error('model must be a string.');
552
+ }
553
+ const model = (_a = videoMatting
554
+ .getAvailableModels()
555
+ .find((candidate) => candidate.name === modelName)) === null || _a === void 0 ? void 0 : _a.name;
556
+ if (!model) {
557
+ throw new Error(`Unknown video matting model: ${modelName}.`);
558
+ }
559
+ const audio = (_c = input.audio) !== null && _c !== void 0 ? _c : 'base';
560
+ if (audio !== 'base' &&
561
+ audio !== 'foreground' &&
562
+ audio !== 'both' &&
563
+ audio !== 'none') {
564
+ throw new Error('audio must be base, foreground, both, or none.');
565
+ }
566
+ const videoBitrate = (_d = input.videoBitrate) !== null && _d !== void 0 ? _d : 'very-high';
567
+ if ((typeof videoBitrate !== 'number' ||
568
+ !Number.isInteger(videoBitrate) ||
569
+ videoBitrate <= 0) &&
570
+ videoBitrate !== 'very-low' &&
571
+ videoBitrate !== 'low' &&
572
+ videoBitrate !== 'medium' &&
573
+ videoBitrate !== 'high' &&
574
+ videoBitrate !== 'very-high') {
575
+ throw new Error('videoBitrate is invalid.');
576
+ }
577
+ const src = (0, remotion_1.staticFile)(assetPath);
578
+ const displayName = (_e = assetPath.split('/').at(-1)) !== null && _e !== void 0 ? _e : assetPath;
579
+ const baseName = (0, public_output_name_1.getDefaultOutputBaseName)(src, displayName, 'video');
580
+ const baseOutputPath = (_f = input.baseOutputPath) !== null && _f !== void 0 ? _f : `${baseName}-base.webm`;
581
+ const foregroundOutputPath = (_g = input.foregroundOutputPath) !== null && _g !== void 0 ? _g : `${baseName}-foreground.webm`;
582
+ if (typeof baseOutputPath !== 'string' ||
583
+ typeof foregroundOutputPath !== 'string') {
584
+ throw new Error('Output paths must be strings.');
585
+ }
586
+ const baseError = (0, public_output_name_1.validatePublicOutputName)({
587
+ extension: '.webm',
588
+ outName: baseOutputPath,
589
+ });
590
+ const foregroundError = (0, public_output_name_1.validatePublicOutputName)({
591
+ extension: '.webm',
592
+ outName: foregroundOutputPath,
593
+ });
594
+ if (baseError !== null || foregroundError !== null) {
595
+ throw new Error((_h = baseError !== null && baseError !== void 0 ? baseError : foregroundError) !== null && _h !== void 0 ? _h : 'Invalid output path.');
596
+ }
597
+ if (baseOutputPath.normalize('NFC').toLowerCase() ===
598
+ foregroundOutputPath.normalize('NFC').toLowerCase()) {
599
+ throw new Error('Background and foreground outputs must be different.');
600
+ }
601
+ const jobId = addVideoMattingJob({
602
+ audio,
603
+ baseOutName: baseOutputPath,
604
+ displayName,
605
+ foregroundOutName: foregroundOutputPath,
606
+ model,
607
+ src,
608
+ videoBitrate,
609
+ });
610
+ return {
611
+ baseOutputPath,
612
+ foregroundOutputPath,
613
+ jobId,
614
+ success: true,
615
+ };
616
+ },
617
+ }, { signal: controller.signal }),
208
618
  modelContext.registerTool({
209
619
  name: 'restart_studio',
210
620
  title: 'Restart Studio',
@@ -303,7 +713,12 @@ const WebMcp = () => {
303
713
  throw new Error(`Composition ${compositionName} not found.`);
304
714
  }
305
715
  selectComposition(composition, true);
306
- return Promise.resolve({ currentComposition: composition.id });
716
+ return Promise.resolve({
717
+ currentContent: {
718
+ type: 'composition',
719
+ compositionId: composition.id,
720
+ },
721
+ });
307
722
  },
308
723
  }, { signal: controller.signal }),
309
724
  modelContext.registerTool({
@@ -319,7 +734,7 @@ const WebMcp = () => {
319
734
  execute: () => {
320
735
  const compositionId = currentCompositionRef.current;
321
736
  return Promise.resolve({
322
- currentComposition: compositionId,
737
+ currentContent: currentContentRef.current,
323
738
  sequences: compositionId === null
324
739
  ? []
325
740
  : getCurrentTimeline().map(serializeSequence),
@@ -364,7 +779,7 @@ const WebMcp = () => {
364
779
  }
365
780
  selectItems([selection], { reveal: true });
366
781
  return Promise.resolve({
367
- currentComposition: compositionId,
782
+ currentContent: currentContentRef.current,
368
783
  selectedSequence: serializeSequence(timelineTrack),
369
784
  });
370
785
  },
@@ -419,7 +834,7 @@ const WebMcp = () => {
419
834
  const compositionId = currentCompositionRef.current;
420
835
  if (compositionId === null) {
421
836
  return Promise.resolve({
422
- currentComposition: null,
837
+ currentContent: currentContentRef.current,
423
838
  currentFrame: null,
424
839
  html: null,
425
840
  htmlLength: null,
@@ -428,7 +843,7 @@ const WebMcp = () => {
428
843
  }
429
844
  const outerHtml = remotion_1.Internals.portalNode().outerHTML;
430
845
  return Promise.resolve({
431
- currentComposition: compositionId,
846
+ currentContent: currentContentRef.current,
432
847
  currentFrame: (0, imperative_state_1.getCurrentFrame)(),
433
848
  html: outerHtml.slice(0, MAX_CANVAS_HTML_LENGTH),
434
849
  htmlLength: outerHtml.length,
@@ -451,7 +866,7 @@ const WebMcp = () => {
451
866
  const composition = currentCompositionDefinitionRef.current;
452
867
  if (composition === null) {
453
868
  return {
454
- currentComposition: null,
869
+ currentContent: currentContentRef.current,
455
870
  currentFrame: null,
456
871
  outlines: [],
457
872
  };
@@ -538,7 +953,7 @@ const WebMcp = () => {
538
953
  };
539
954
  }));
540
955
  return {
541
- currentComposition: composition.id,
956
+ currentContent: currentContentRef.current,
542
957
  currentFrame,
543
958
  outlines: outlines.filter((outline) => outline !== null),
544
959
  };
@@ -560,7 +975,7 @@ const WebMcp = () => {
560
975
  const compositionId = currentCompositionRef.current;
561
976
  if (compositionId === null) {
562
977
  return Promise.resolve({
563
- currentComposition: null,
978
+ currentContent: currentContentRef.current,
564
979
  currentFrame: null,
565
980
  playing: null,
566
981
  muted: null,
@@ -582,7 +997,7 @@ const WebMcp = () => {
582
997
  zoom: (_c = timelineZoomRef.current[compositionId]) !== null && _c !== void 0 ? _c : null,
583
998
  });
584
999
  return Promise.resolve({
585
- currentComposition: compositionId,
1000
+ currentContent: currentContentRef.current,
586
1001
  currentFrame: (0, imperative_state_1.getCurrentFrame)(),
587
1002
  playing: isPlaying(),
588
1003
  muted: playerMutedRef.current,
@@ -599,7 +1014,7 @@ const WebMcp = () => {
599
1014
  modelContext.registerTool({
600
1015
  name: 'get_selection',
601
1016
  title: 'Get Studio selection',
602
- description: 'Read the current frame, composition, and source-code context for the item currently selected in Remotion Studio. The selection matches "Copy context for agents".',
1017
+ description: 'Read the current frame, canvas content (composition, asset, or output), and source-code context for the item currently selected in Remotion Studio. The selection matches "Copy context for agents".',
603
1018
  inputSchema: {
604
1019
  type: 'object',
605
1020
  properties: {},
@@ -609,7 +1024,7 @@ const WebMcp = () => {
609
1024
  execute: () => Promise.resolve({
610
1025
  currentFrame: (0, imperative_state_1.getCurrentFrame)(),
611
1026
  currentSelection: currentSelectionRef.current,
612
- currentComposition: currentCompositionRef.current,
1027
+ currentContent: currentContentRef.current,
613
1028
  selectionType: selectedItemsRef.current.length === 1
614
1029
  ? selectedItemsRef.current[0].type
615
1030
  : null,
@@ -630,7 +1045,7 @@ const WebMcp = () => {
630
1045
  const compositionId = currentCompositionRef.current;
631
1046
  const guidesAreVisible = editorShowGuidesRef.current;
632
1047
  return Promise.resolve({
633
- currentComposition: compositionId,
1048
+ currentContent: currentContentRef.current,
634
1049
  guidesVisible: guidesAreVisible,
635
1050
  guides: compositionId === null
636
1051
  ? []
@@ -672,7 +1087,7 @@ const WebMcp = () => {
672
1087
  editorShowGuidesRef.current = visible;
673
1088
  setEditorShowGuides(() => visible);
674
1089
  return Promise.resolve({
675
- currentComposition: compositionId,
1090
+ currentContent: currentContentRef.current,
676
1091
  guidesVisible: visible,
677
1092
  });
678
1093
  },
@@ -723,7 +1138,7 @@ const WebMcp = () => {
723
1138
  editorShowGuidesRef.current = true;
724
1139
  setEditorShowGuides(() => true);
725
1140
  return Promise.resolve({
726
- currentComposition: compositionId,
1141
+ currentContent: currentContentRef.current,
727
1142
  guide: {
728
1143
  id: guide.id,
729
1144
  orientation: guide.orientation,
@@ -771,7 +1186,7 @@ const WebMcp = () => {
771
1186
  clearSelection();
772
1187
  }
773
1188
  return Promise.resolve({
774
- currentComposition: compositionId,
1189
+ currentContent: currentContentRef.current,
775
1190
  guideId,
776
1191
  removed: true,
777
1192
  });
@@ -800,7 +1215,7 @@ const WebMcp = () => {
800
1215
  }
801
1216
  (0, play_1.play)();
802
1217
  return Promise.resolve({
803
- currentComposition: compositionId,
1218
+ currentContent: currentContentRef.current,
804
1219
  playing: true,
805
1220
  });
806
1221
  },
@@ -825,7 +1240,7 @@ const WebMcp = () => {
825
1240
  }
826
1241
  (0, pause_1.pause)();
827
1242
  return Promise.resolve({
828
- currentComposition: compositionId,
1243
+ currentContent: currentContentRef.current,
829
1244
  playing: false,
830
1245
  });
831
1246
  },
@@ -848,7 +1263,7 @@ const WebMcp = () => {
848
1263
  setPlayerMuted(true);
849
1264
  (0, mute_1.persistMuteOption)(true);
850
1265
  return Promise.resolve({
851
- currentComposition: compositionId,
1266
+ currentContent: currentContentRef.current,
852
1267
  muted: true,
853
1268
  });
854
1269
  },
@@ -871,7 +1286,7 @@ const WebMcp = () => {
871
1286
  setPlayerMuted(false);
872
1287
  (0, mute_1.persistMuteOption)(false);
873
1288
  return Promise.resolve({
874
- currentComposition: compositionId,
1289
+ currentContent: currentContentRef.current,
875
1290
  muted: false,
876
1291
  });
877
1292
  },
@@ -929,7 +1344,7 @@ const WebMcp = () => {
929
1344
  anchorContentX: null,
930
1345
  });
931
1346
  return Promise.resolve({
932
- currentComposition: compositionId,
1347
+ currentContent: currentContentRef.current,
933
1348
  timelineZoom: (0, get_timeline_max_zoom_1.timelineZoomToNormalized)({
934
1349
  zoom: timelineZoom,
935
1350
  minZoom,
@@ -966,7 +1381,7 @@ const WebMcp = () => {
966
1381
  setPlaybackRate(() => playbackRate);
967
1382
  (0, playbackrate_1.persistPlaybackRate)(playbackRate);
968
1383
  return Promise.resolve({
969
- currentComposition: compositionId,
1384
+ currentContent: currentContentRef.current,
970
1385
  playbackRate,
971
1386
  });
972
1387
  },
@@ -1000,7 +1415,7 @@ const WebMcp = () => {
1000
1415
  (0, seek_1.seek)(currentFrame);
1001
1416
  return Promise.resolve({
1002
1417
  currentFrame,
1003
- currentComposition: compositionId,
1418
+ currentContent: currentContentRef.current,
1004
1419
  });
1005
1420
  },
1006
1421
  }, { signal: controller.signal }),
@@ -1009,6 +1424,8 @@ const WebMcp = () => {
1009
1424
  controller.abort();
1010
1425
  };
1011
1426
  }, [
1427
+ addCaptionJob,
1428
+ addVideoMattingJob,
1012
1429
  clearSelection,
1013
1430
  isPlaying,
1014
1431
  selectComposition,