@remotion/studio-server 4.0.505 → 4.0.506

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.
@@ -0,0 +1,14 @@
1
+ import type { DefaultCodingAgent } from '@remotion/renderer';
2
+ export type InstalledCodingAgent = {
3
+ id: DefaultCodingAgent;
4
+ name: string;
5
+ applicationPath: string;
6
+ };
7
+ export type CodingAgentDiscoveryContext = {
8
+ platform: NodeJS.Platform;
9
+ homeDirectory: string;
10
+ pathExists: (filePath: string) => boolean;
11
+ findMacApplications: (bundleIdentifier: string) => Promise<readonly string[]>;
12
+ };
13
+ export declare const discoverAvailableCodingAgents: (context: CodingAgentDiscoveryContext) => Promise<readonly InstalledCodingAgent[]>;
14
+ export declare const getAvailableCodingAgents: () => Promise<readonly InstalledCodingAgent[]>;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getAvailableCodingAgents = exports.discoverAvailableCodingAgents = void 0;
7
+ const node_child_process_1 = require("node:child_process");
8
+ const node_fs_1 = require("node:fs");
9
+ const node_os_1 = require("node:os");
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ const node_util_1 = require("node:util");
12
+ const renderer_1 = require("@remotion/renderer");
13
+ const execFilePromise = (0, node_util_1.promisify)(node_child_process_1.execFile);
14
+ const codingAgentDefinitions = {
15
+ codex: {
16
+ name: 'Codex',
17
+ bundleIdentifiers: ['com.openai.codex'],
18
+ applicationNames: ['ChatGPT.app'],
19
+ },
20
+ cursor: {
21
+ name: 'Cursor',
22
+ bundleIdentifiers: ['com.todesktop.230313mzl4w4u92'],
23
+ applicationNames: ['Cursor.app'],
24
+ },
25
+ 'github-copilot': {
26
+ name: 'GitHub Copilot',
27
+ bundleIdentifiers: ['com.github.githubapp'],
28
+ applicationNames: ['GitHub Copilot.app'],
29
+ },
30
+ 'claude-code': {
31
+ name: 'Claude Code',
32
+ bundleIdentifiers: ['com.anthropic.claudefordesktop'],
33
+ applicationNames: ['Claude.app'],
34
+ },
35
+ };
36
+ const findMacApplications = async (bundleIdentifier) => {
37
+ try {
38
+ const { stdout } = await execFilePromise('mdfind', [
39
+ `kMDItemCFBundleIdentifier == '${bundleIdentifier}'`,
40
+ ]);
41
+ return stdout
42
+ .split('\n')
43
+ .map((line) => line.trim())
44
+ .filter(Boolean);
45
+ }
46
+ catch (_a) {
47
+ return [];
48
+ }
49
+ };
50
+ const defaultDiscoveryContext = {
51
+ platform: process.platform,
52
+ homeDirectory: (0, node_os_1.homedir)(),
53
+ pathExists: node_fs_1.existsSync,
54
+ findMacApplications,
55
+ };
56
+ const discoverAvailableCodingAgents = async (context) => {
57
+ if (context.platform !== 'darwin') {
58
+ return [];
59
+ }
60
+ const installedCodingAgents = [];
61
+ for (const id of renderer_1.defaultCodingAgentIds) {
62
+ const definition = codingAgentDefinitions[id];
63
+ const discoveredApplications = (await Promise.all(definition.bundleIdentifiers.map((bundleIdentifier) => context.findMacApplications(bundleIdentifier)))).flat();
64
+ const knownApplications = definition.applicationNames.flatMap((name) => [
65
+ node_path_1.default.posix.join('/Applications', name),
66
+ node_path_1.default.posix.join(context.homeDirectory, 'Applications', name),
67
+ ]);
68
+ for (const applicationPath of new Set([
69
+ ...discoveredApplications,
70
+ ...knownApplications,
71
+ ])) {
72
+ if (context.pathExists(applicationPath)) {
73
+ installedCodingAgents.push({
74
+ applicationPath,
75
+ id,
76
+ name: definition.name,
77
+ });
78
+ break;
79
+ }
80
+ }
81
+ }
82
+ return installedCodingAgents;
83
+ };
84
+ exports.discoverAvailableCodingAgents = discoverAvailableCodingAgents;
85
+ let availableCodingAgents = null;
86
+ const getAvailableCodingAgents = () => {
87
+ availableCodingAgents !== null && availableCodingAgents !== void 0 ? availableCodingAgents : (availableCodingAgents = (0, exports.discoverAvailableCodingAgents)(defaultDiscoveryContext));
88
+ return availableCodingAgents;
89
+ };
90
+ exports.getAvailableCodingAgents = getAvailableCodingAgents;
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export type { RemotionSkillsScope, RemotionSkillsStatus, } from './detect-outdat
7
7
  export type { RemotionSkillName } from './remotion-skill-names';
8
8
  export { detectOutdatedRemotionSkills, parseRemotionSkillVersion, remotionSkillNames, };
9
9
  export declare const StudioServerInternals: {
10
- startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, remotionRoot, relativePublicDir, bundlerOverride, rspackOverride, webpackOverride, poll, getRenderDefaults, getRenderQueue, getNumberOfAudioTags, queueMethods, previewEntry, gitSource, binariesDirectory, forceIPv4, getAudioLatencyHint, getPreviewSampleRate, enableCrossSiteIsolation, forceNew, rspack, getStudioRuntimeConfig, getDefaultEditor, configFile, }: {
10
+ startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, remotionRoot, relativePublicDir, bundlerOverride, rspackOverride, webpackOverride, poll, getRenderDefaults, getRenderQueue, getNumberOfAudioTags, queueMethods, previewEntry, gitSource, binariesDirectory, forceIPv4, getAudioLatencyHint, getPreviewSampleRate, enableCrossSiteIsolation, forceNew, rspack, getStudioRuntimeConfig, getDefaultCodingAgent, getDefaultEditor, configFile, }: {
11
11
  browserArgs: string;
12
12
  browserFlag: string;
13
13
  logLevel: "error" | "info" | "trace" | "verbose" | "warn";
@@ -36,6 +36,7 @@ export declare const StudioServerInternals: {
36
36
  forceNew: boolean;
37
37
  rspack: boolean;
38
38
  getStudioRuntimeConfig: () => import("@remotion/studio-shared").StudioRuntimeConfig;
39
+ getDefaultCodingAgent: () => "claude-code" | "codex" | "cursor" | "github-copilot" | null;
39
40
  getDefaultEditor: () => import("@remotion/renderer").DefaultEditor | null;
40
41
  configFile: string | null;
41
42
  }) => Promise<import("./start-studio").StartStudioResult>;
@@ -135,5 +136,9 @@ export declare const StudioServerInternals: {
135
136
  global: import("./detect-outdated-remotion-skills").RemotionSkillsStatus;
136
137
  };
137
138
  parseRemotionSkillVersion: (contents: string) => string | null;
138
- remotionSkillNames: readonly ["remotion-best-practices", "remotion-captions", "remotion-create", "remotion-docs", "remotion-interactivity", "remotion-maps", "remotion-markup", "remotion-multimedia", "remotion-render", "remotion-saas", "remotion-upgrade"];
139
+ remotionSkillNames: readonly ["remotion-best-practices", "remotion-captions", "remotion-create", "remotion-docs", "remotion-interactivity", "remotion-maps", "remotion-markup", "remotion-multimedia", "remotion-render", "remotion-saas", "remotion-studio", "remotion-upgrade"];
140
+ getEditorName: ({ getDefaultEditor, logLevel, }: {
141
+ getDefaultEditor: () => import("@remotion/renderer").DefaultEditor | null;
142
+ logLevel: "error" | "info" | "trace" | "verbose" | "warn";
143
+ }) => Promise<string | null>;
139
144
  };
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ const package_manager_spawn_options_1 = require("./helpers/package-manager-spawn
20
20
  const max_timeline_tracks_1 = require("./max-timeline-tracks");
21
21
  const get_package_manager_1 = require("./preview-server/get-package-manager");
22
22
  const live_events_1 = require("./preview-server/live-events");
23
+ const open_in_editor_1 = require("./preview-server/routes/open-in-editor");
23
24
  const update_available_1 = require("./preview-server/update-available");
24
25
  const remotion_skill_names_1 = require("./remotion-skill-names");
25
26
  Object.defineProperty(exports, "remotionSkillNames", { enumerable: true, get: function () { return remotion_skill_names_1.remotionSkillNames; } });
@@ -54,4 +55,5 @@ exports.StudioServerInternals = {
54
55
  detectOutdatedRemotionSkills: detect_outdated_remotion_skills_1.detectOutdatedRemotionSkills,
55
56
  parseRemotionSkillVersion: detect_outdated_remotion_skills_1.parseRemotionSkillVersion,
56
57
  remotionSkillNames: remotion_skill_names_1.remotionSkillNames,
58
+ getEditorName: open_in_editor_1.getEditorName,
57
59
  };
@@ -12,6 +12,7 @@ const batch_update_keyframe_settings_1 = require("./routes/batch-update-keyframe
12
12
  const cancel_render_1 = require("./routes/cancel-render");
13
13
  const composition_component_info_1 = require("./routes/composition-component-info");
14
14
  const convert_figma_clipboard_to_svg_1 = require("./routes/convert-figma-clipboard-to-svg");
15
+ const default_coding_agent_1 = require("./routes/default-coding-agent");
15
16
  const default_editor_1 = require("./routes/default-editor");
16
17
  const delete_effect_1 = require("./routes/delete-effect");
17
18
  const delete_jsx_node_1 = require("./routes/delete-jsx-node");
@@ -102,6 +103,8 @@ exports.allApiRoutes = {
102
103
  '/api/rename-static-file': rename_static_file_1.renameStaticFileHandler,
103
104
  '/api/restart-studio': restart_studio_1.handleRestartStudio,
104
105
  '/api/update-public-license': update_public_license_1.updatePublicLicenseHandler,
106
+ '/api/default-coding-agent-info': default_coding_agent_1.getDefaultCodingAgentInfoHandler,
107
+ '/api/update-default-coding-agent': default_coding_agent_1.updateDefaultCodingAgentHandler,
105
108
  '/api/default-editor-info': default_editor_1.getDefaultEditorInfoHandler,
106
109
  '/api/update-default-editor': default_editor_1.updateDefaultEditorHandler,
107
110
  '/api/install-package': install_dependency_1.handleInstallPackage,
@@ -1,5 +1,5 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
- import type { DefaultEditor, LogLevel } from '@remotion/renderer';
2
+ import type { DefaultCodingAgent, DefaultEditor, LogLevel } from '@remotion/renderer';
3
3
  import type { RenderJobWithCleanup } from '@remotion/studio-shared';
4
4
  export type QueueMethods = {
5
5
  removeJob: (jobId: string) => void;
@@ -22,5 +22,6 @@ export type ApiHandler<ReqData, ResData> = (params: {
22
22
  publicDir: string;
23
23
  binariesDirectory: string | null;
24
24
  configFile: string | null;
25
+ getDefaultCodingAgent: () => DefaultCodingAgent | null;
25
26
  getDefaultEditor: () => DefaultEditor | null;
26
27
  }) => Promise<ResData>;
@@ -1,7 +1,7 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
2
  import type { DefaultEditor } from '@remotion/renderer';
3
3
  import type { ApiHandler, QueueMethods } from './api-types';
4
- export declare const handleRequest: <Req, Res>({ remotionRoot, request, response, entryPoint, handler, logLevel, methods, binariesDirectory, publicDir, configFile, getDefaultEditor, }: {
4
+ export declare const handleRequest: <Req, Res>({ remotionRoot, request, response, entryPoint, handler, logLevel, methods, binariesDirectory, publicDir, configFile, getDefaultCodingAgent, getDefaultEditor, }: {
5
5
  remotionRoot: string;
6
6
  publicDir: string;
7
7
  request: IncomingMessage;
@@ -9,6 +9,7 @@ export declare const handleRequest: <Req, Res>({ remotionRoot, request, response
9
9
  entryPoint: string;
10
10
  binariesDirectory: string | null;
11
11
  configFile: string | null;
12
+ getDefaultCodingAgent: () => "claude-code" | "codex" | "cursor" | "github-copilot" | null;
12
13
  getDefaultEditor: () => DefaultEditor | null;
13
14
  handler: ApiHandler<Req, Res>;
14
15
  logLevel: "error" | "info" | "trace" | "verbose" | "warn";
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handleRequest = void 0;
4
4
  const parse_body_1 = require("./parse-body");
5
5
  const validate_same_origin_1 = require("./validate-same-origin");
6
- const handleRequest = async ({ remotionRoot, request, response, entryPoint, handler, logLevel, methods, binariesDirectory, publicDir, configFile, getDefaultEditor, }) => {
6
+ const handleRequest = async ({ remotionRoot, request, response, entryPoint, handler, logLevel, methods, binariesDirectory, publicDir, configFile, getDefaultCodingAgent, getDefaultEditor, }) => {
7
7
  if (request.method === 'OPTIONS') {
8
8
  response.statusCode = 200;
9
9
  response.end();
@@ -25,6 +25,7 @@ const handleRequest = async ({ remotionRoot, request, response, entryPoint, hand
25
25
  binariesDirectory,
26
26
  publicDir,
27
27
  configFile,
28
+ getDefaultCodingAgent,
28
29
  getDefaultEditor,
29
30
  });
30
31
  response.end(JSON.stringify({
@@ -0,0 +1,8 @@
1
+ import type { GetDefaultCodingAgentInfoRequest, GetDefaultCodingAgentInfoResponse, UpdateDefaultCodingAgentRequest, UpdateDefaultCodingAgentResponse } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const updateDefaultCodingAgentInConfig: ({ configContents, defaultCodingAgent, }: {
4
+ configContents: string;
5
+ defaultCodingAgent: "claude-code" | "codex" | "cursor" | "github-copilot" | null;
6
+ }) => string;
7
+ export declare const getDefaultCodingAgentInfoHandler: ApiHandler<GetDefaultCodingAgentInfoRequest, GetDefaultCodingAgentInfoResponse>;
8
+ export declare const updateDefaultCodingAgentHandler: ApiHandler<UpdateDefaultCodingAgentRequest, UpdateDefaultCodingAgentResponse>;
@@ -0,0 +1,103 @@
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
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.updateDefaultCodingAgentHandler = exports.getDefaultCodingAgentInfoHandler = exports.updateDefaultCodingAgentInConfig = void 0;
37
+ const node_fs_1 = require("node:fs");
38
+ const renderer_1 = require("@remotion/renderer");
39
+ const recast = __importStar(require("recast"));
40
+ const parse_ast_1 = require("../../codemods/parse-ast");
41
+ const file_watcher_1 = require("../../file-watcher");
42
+ const coding_agent_registry_1 = require("../../helpers/coding-agent-registry");
43
+ const updateDefaultCodingAgentInConfig = ({ configContents, defaultCodingAgent, }) => {
44
+ const ast = (0, parse_ast_1.parseAst)(configContents);
45
+ recast.types.visit(ast.program, {
46
+ visitExpressionStatement(path) {
47
+ const { expression } = path.node;
48
+ if (expression.type === 'CallExpression' &&
49
+ expression.callee.type === 'MemberExpression' &&
50
+ !expression.callee.computed &&
51
+ expression.callee.object.type === 'Identifier' &&
52
+ expression.callee.object.name === 'Config' &&
53
+ expression.callee.property.type === 'Identifier' &&
54
+ expression.callee.property.name === 'setDefaultCodingAgent') {
55
+ path.prune();
56
+ return false;
57
+ }
58
+ this.traverse(path);
59
+ },
60
+ });
61
+ const configWithoutExistingCalls = recast.print(ast, {
62
+ lineTerminator: '\n',
63
+ }).code;
64
+ if (defaultCodingAgent === null) {
65
+ return configWithoutExistingCalls;
66
+ }
67
+ const separator = configWithoutExistingCalls.endsWith('\n') ? '' : '\n';
68
+ return `${configWithoutExistingCalls}${separator}Config.setDefaultCodingAgent('${defaultCodingAgent}');\n`;
69
+ };
70
+ exports.updateDefaultCodingAgentInConfig = updateDefaultCodingAgentInConfig;
71
+ const getDefaultCodingAgentInfoHandler = async ({ getDefaultCodingAgent }) => {
72
+ const installedCodingAgents = await (0, coding_agent_registry_1.getAvailableCodingAgents)();
73
+ return {
74
+ defaultCodingAgent: getDefaultCodingAgent(),
75
+ installedCodingAgents: installedCodingAgents.map(({ id, name }) => ({
76
+ id,
77
+ name,
78
+ })),
79
+ };
80
+ };
81
+ exports.getDefaultCodingAgentInfoHandler = getDefaultCodingAgentInfoHandler;
82
+ const updateDefaultCodingAgentHandler = ({ input, configFile }) => {
83
+ if (configFile === null || configFile === undefined) {
84
+ return Promise.resolve({
85
+ success: false,
86
+ reason: 'No Remotion config file was loaded.',
87
+ });
88
+ }
89
+ if (input.defaultCodingAgent !== null &&
90
+ !renderer_1.defaultCodingAgentIds.includes(input.defaultCodingAgent)) {
91
+ return Promise.resolve({
92
+ success: false,
93
+ reason: `Unknown coding agent: ${input.defaultCodingAgent}`,
94
+ });
95
+ }
96
+ const configContents = (0, node_fs_1.readFileSync)(configFile, 'utf8');
97
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)(configFile, (0, exports.updateDefaultCodingAgentInConfig)({
98
+ configContents,
99
+ defaultCodingAgent: input.defaultCodingAgent,
100
+ }), undefined);
101
+ return Promise.resolve({ success: true });
102
+ };
103
+ exports.updateDefaultCodingAgentHandler = updateDefaultCodingAgentHandler;
@@ -5,6 +5,7 @@ export declare const validateElementInstallPosition: (position: import("@remotio
5
5
  export declare const validateElementForInstallation: (element: {
6
6
  dependencies: import("@remotion/studio-protocol").ElementDependency[];
7
7
  durationInFrames?: number | undefined;
8
+ installationMode?: import("@remotion/studio-protocol").ElementInstallationMode | undefined;
8
9
  slug: string;
9
10
  displayName: string;
10
11
  sourceCode: string;
@@ -22,13 +22,15 @@ const hasExpectedFileState = ({ expected, actual, }) => {
22
22
  return actual.sourceHash === expected.sourceHash;
23
23
  };
24
24
  const insertElementHandler = ({ input: { compositionFile, compositionId, element, expectedFileState, from, position, overwriteExisting, }, remotionRoot, logLevel, }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
25
- var _a;
25
+ var _a, _b;
26
26
  try {
27
27
  (0, element_install_plan_1.validateElementInstallPosition)(position);
28
28
  if (from !== null &&
29
29
  (!Number.isInteger(from) || !Number.isFinite(from) || from < 0)) {
30
30
  throw new Error('from must be a non-negative integer');
31
31
  }
32
+ const installationMode = (_a = element.installationMode) !== null && _a !== void 0 ? _a : 'wrapped';
33
+ const componentOwnsSequence = installationMode === 'component-owned-sequence';
32
34
  renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[insert-element] Received request for compositionFile="${compositionFile}" compositionId="${compositionId}" element="${element.slug}"`);
33
35
  const plan = await (0, element_install_plan_1.getElementInstallPlan)({
34
36
  compositionFile,
@@ -81,18 +83,32 @@ const insertElementHandler = ({ input: { compositionFile, compositionId, element
81
83
  componentName: plan.componentName,
82
84
  importName: plan.componentName,
83
85
  importPath: plan.importPath,
84
- props: [],
85
- position: null,
86
+ props: componentOwnsSequence
87
+ ? [
88
+ ...(element.durationInFrames === undefined
89
+ ? []
90
+ : [
91
+ {
92
+ name: 'durationInFrames',
93
+ value: element.durationInFrames,
94
+ },
95
+ ]),
96
+ { name: 'name', value: element.displayName },
97
+ ]
98
+ : [],
99
+ position: componentOwnsSequence ? position : null,
86
100
  },
87
- from: null,
101
+ from: componentOwnsSequence ? from : null,
88
102
  prettierConfigOverride: null,
89
- wrapInSequence: {
90
- dimensions: element.dimensions,
91
- durationInFrames: (_a = element.durationInFrames) !== null && _a !== void 0 ? _a : null,
92
- from,
93
- name: element.displayName,
94
- position,
95
- },
103
+ wrapInSequence: componentOwnsSequence
104
+ ? null
105
+ : {
106
+ dimensions: element.dimensions,
107
+ durationInFrames: (_b = element.durationInFrames) !== null && _b !== void 0 ? _b : null,
108
+ from,
109
+ name: element.displayName,
110
+ position,
111
+ },
96
112
  });
97
113
  const finalPlan = await (0, element_install_plan_1.getElementInstallPlan)({
98
114
  compositionFile,
@@ -1,5 +1,4 @@
1
- import type { ElementDependency } from '@remotion/studio-protocol';
2
- import { type InstallPackageRequest, type InstallPackageResponse } from '@remotion/studio-shared';
1
+ import { type InstallPackageRequest, type InstallPackageResponse, type PackageInstallSpec } from '@remotion/studio-shared';
3
2
  import type { ApiHandler } from '../api-types';
4
- export declare const getPackageInstallSpec: (dependency: string | ElementDependency) => string;
3
+ export declare const getPackageInstallSpec: (dependency: PackageInstallSpec) => string;
5
4
  export declare const handleInstallPackage: ApiHandler<InstallPackageRequest, InstallPackageResponse>;
@@ -13,15 +13,13 @@ const getExtraPackageVersion = (packageName) => {
13
13
  return pkg ? pkg.version : null;
14
14
  };
15
15
  const getPackageInstallSpec = (dependency) => {
16
- const { name, version } = typeof dependency === 'string'
17
- ? { name: dependency, version: null }
18
- : dependency;
19
- const extraVersion = getExtraPackageVersion(name);
20
- if (extraVersion)
21
- return `${name}@${extraVersion}`;
16
+ const { name, version } = dependency;
22
17
  if (name === 'remotion' || name.startsWith('@remotion/'))
23
18
  return `${name}@${version_1.VERSION}`;
24
- return version === null ? name : `${name}@${version}`;
19
+ if (version !== null)
20
+ return `${name}@${version}`;
21
+ const extraVersion = getExtraPackageVersion(name);
22
+ return extraVersion === null ? name : `${name}@${extraVersion}`;
25
23
  };
26
24
  exports.getPackageInstallSpec = getPackageInstallSpec;
27
25
  const handleInstallPackage = async ({ logLevel, remotionRoot, input: { dependencies } }) => {
@@ -42,6 +42,7 @@ export declare const startServer: (options: {
42
42
  forceNew: boolean;
43
43
  rspack: boolean;
44
44
  getStudioRuntimeConfig: () => StudioRuntimeConfig;
45
+ getDefaultCodingAgent: () => "claude-code" | "codex" | "cursor" | "github-copilot" | null;
45
46
  getDefaultEditor: () => DefaultEditor | null;
46
47
  configFile: string | null;
47
48
  }) => Promise<StartServerResult>;
@@ -102,6 +102,7 @@ const startServer = async (options) => {
102
102
  getPreviewSampleRate: options.getPreviewSampleRate,
103
103
  enableCrossSiteIsolation: options.enableCrossSiteIsolation,
104
104
  getStudioRuntimeConfig: options.getStudioRuntimeConfig,
105
+ getDefaultCodingAgent: options.getDefaultCodingAgent,
105
106
  getDefaultEditor: options.getDefaultEditor,
106
107
  configFile: options.configFile,
107
108
  });
@@ -1,6 +1,11 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
- export declare const handleStudioProtocolLicenseKey: ({ configFile, request, response, }: {
2
+ import type { LiveEventsServer } from '../live-events';
3
+ type FocusStudioTab = (studioUrl: string) => void;
4
+ export declare const handleStudioProtocolLicenseKey: ({ configFile, focusStudioTab, liveEventsServer, request, response, }: {
3
5
  readonly configFile: string | null;
6
+ readonly focusStudioTab: FocusStudioTab;
7
+ readonly liveEventsServer: LiveEventsServer;
4
8
  readonly request: IncomingMessage;
5
9
  readonly response: ServerResponse<IncomingMessage>;
6
10
  }) => Promise<void>;
11
+ export {};
@@ -5,7 +5,6 @@ const studio_protocol_1 = require("@remotion/studio-protocol");
5
5
  const zod_1 = require("zod");
6
6
  const element_install_state_1 = require("../element-install-state");
7
7
  const parse_body_1 = require("../parse-body");
8
- const update_public_license_1 = require("../routes/update-public-license");
9
8
  const origin_policy_1 = require("./origin-policy");
10
9
  const protocol_response_1 = require("./protocol-response");
11
10
  const studioProtocolLicenseKeyRequestSchema = zod_1.z.object({
@@ -16,7 +15,7 @@ const studioProtocolLicenseKeyRequestSchema = zod_1.z.object({
16
15
  licenseKey: zod_1.z.string(),
17
16
  });
18
17
  const MAX_STUDIO_PROTOCOL_LICENSE_KEY_BODY_SIZE = 4096;
19
- const handleStudioProtocolLicenseKey = async ({ configFile, request, response, }) => {
18
+ const handleStudioProtocolLicenseKey = async ({ configFile, focusStudioTab, liveEventsServer, request, response, }) => {
20
19
  (0, origin_policy_1.setStudioProtocolCorsHeaders)({ licenseKey: true, request, response });
21
20
  const requestOrigin = (0, origin_policy_1.getAllowedLicenseKeyOrigin)(request.headers.origin);
22
21
  if (requestOrigin === null) {
@@ -104,26 +103,25 @@ const handleStudioProtocolLicenseKey = async ({ configFile, request, response, }
104
103
  });
105
104
  return;
106
105
  }
107
- try {
108
- (0, update_public_license_1.setPublicLicenseKeyInConfigFile)({
109
- configFile,
110
- publicLicenseKey: parsedRequest.data.licenseKey,
111
- });
112
- }
113
- catch (_a) {
106
+ const delivered = liveEventsServer.sendEventToClientId(target.clientId, {
107
+ type: 'license-key-install-request',
108
+ licenseKey: parsedRequest.data.licenseKey,
109
+ });
110
+ if (!delivered) {
114
111
  (0, protocol_response_1.writeStudioProtocolError)({
115
- code: 'config-write-failed',
116
- message: 'Could not update the Remotion config file.',
112
+ code: 'target-expired',
113
+ message: 'The selected Remotion Studio tab is no longer connected.',
117
114
  response,
118
- status: 500,
115
+ status: 409,
119
116
  });
120
117
  return;
121
118
  }
119
+ focusStudioTab(target.studioUrl);
122
120
  response.writeHead(200, { 'Content-Type': 'application/json' });
123
121
  response.end(JSON.stringify({
124
122
  protocol: 'remotion-studio-protocol',
125
123
  protocolVersion: 1,
126
- status: 'license-key-set',
124
+ status: 'awaiting-confirmation',
127
125
  }));
128
126
  };
129
127
  exports.handleStudioProtocolLicenseKey = handleStudioProtocolLicenseKey;
@@ -1,2 +1,2 @@
1
- export declare const remotionSkillNames: readonly ["remotion-best-practices", "remotion-captions", "remotion-create", "remotion-docs", "remotion-interactivity", "remotion-maps", "remotion-markup", "remotion-multimedia", "remotion-render", "remotion-saas", "remotion-upgrade"];
1
+ export declare const remotionSkillNames: readonly ["remotion-best-practices", "remotion-captions", "remotion-create", "remotion-docs", "remotion-interactivity", "remotion-maps", "remotion-markup", "remotion-multimedia", "remotion-render", "remotion-saas", "remotion-studio", "remotion-upgrade"];
2
2
  export type RemotionSkillName = (typeof remotionSkillNames)[number];
@@ -12,5 +12,6 @@ exports.remotionSkillNames = [
12
12
  'remotion-multimedia',
13
13
  'remotion-render',
14
14
  'remotion-saas',
15
+ 'remotion-studio',
15
16
  'remotion-upgrade',
16
17
  ];
package/dist/routes.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { DefaultEditor } from '@remotion/renderer';
3
3
  import type { GitSource, RenderDefaults, RenderJob, StudioRuntimeConfig } from '@remotion/studio-shared';
4
4
  import type { QueueMethods } from './preview-server/api-types';
5
5
  import type { LiveEventsServer } from './preview-server/live-events';
6
- export declare const handleRoutes: ({ staticHash, staticHashPrefix, outputHash, outputHashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, entryPoint, publicDir, logLevel, getRenderQueue, getRenderDefaults, getNumberOfAudioTags, queueMethods: methods, gitSource, binariesDirectory, getAudioLatencyHint, getPreviewSampleRate, enableCrossSiteIsolation, getStudioRuntimeConfig, getDefaultEditor, configFile, }: {
6
+ export declare const handleRoutes: ({ staticHash, staticHashPrefix, outputHash, outputHashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, entryPoint, publicDir, logLevel, getRenderQueue, getRenderDefaults, getNumberOfAudioTags, queueMethods: methods, gitSource, binariesDirectory, getAudioLatencyHint, getPreviewSampleRate, enableCrossSiteIsolation, getStudioRuntimeConfig, getDefaultCodingAgent, getDefaultEditor, configFile, }: {
7
7
  staticHash: string;
8
8
  staticHashPrefix: string;
9
9
  outputHash: string;
@@ -27,6 +27,7 @@ export declare const handleRoutes: ({ staticHash, staticHashPrefix, outputHash,
27
27
  getPreviewSampleRate: () => number | null;
28
28
  enableCrossSiteIsolation: boolean;
29
29
  getStudioRuntimeConfig: () => StudioRuntimeConfig;
30
+ getDefaultCodingAgent: () => "claude-code" | "codex" | "cursor" | "github-copilot" | null;
30
31
  getDefaultEditor: () => DefaultEditor | null;
31
32
  configFile: string | null;
32
33
  }) => Promise<void>;
package/dist/routes.js CHANGED
@@ -252,7 +252,7 @@ const handleBeep = (_, response) => {
252
252
  readStream.pipe(response);
253
253
  return Promise.resolve();
254
254
  };
255
- const handleRoutes = ({ staticHash, staticHashPrefix, outputHash, outputHashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, entryPoint, publicDir, logLevel, getRenderQueue, getRenderDefaults, getNumberOfAudioTags, queueMethods: methods, gitSource, binariesDirectory, getAudioLatencyHint, getPreviewSampleRate, enableCrossSiteIsolation, getStudioRuntimeConfig, getDefaultEditor, configFile, }) => {
255
+ const handleRoutes = ({ staticHash, staticHashPrefix, outputHash, outputHashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, entryPoint, publicDir, logLevel, getRenderQueue, getRenderDefaults, getNumberOfAudioTags, queueMethods: methods, gitSource, binariesDirectory, getAudioLatencyHint, getPreviewSampleRate, enableCrossSiteIsolation, getStudioRuntimeConfig, getDefaultCodingAgent, getDefaultEditor, configFile, }) => {
256
256
  const url = new URL(request.url, 'http://localhost');
257
257
  if (url.pathname === '/api/file-source') {
258
258
  return handleFileSource({
@@ -299,7 +299,15 @@ const handleRoutes = ({ staticHash, staticHashPrefix, outputHash, outputHashPref
299
299
  });
300
300
  }
301
301
  if (url.pathname === '/api/studio-protocol/license-key') {
302
- return (0, handle_license_key_1.handleStudioProtocolLicenseKey)({ configFile, request, response });
302
+ return (0, handle_license_key_1.handleStudioProtocolLicenseKey)({
303
+ configFile,
304
+ focusStudioTab: (studioUrl) => {
305
+ (0, better_opn_1.focusBrowserTab)({ url: studioUrl }).catch(() => undefined);
306
+ },
307
+ liveEventsServer,
308
+ request,
309
+ response,
310
+ });
303
311
  }
304
312
  return (0, handle_install_1.handleStudioProtocolInstall)({
305
313
  focusStudioTab: (studioUrl) => {
@@ -323,6 +331,7 @@ const handleRoutes = ({ staticHash, staticHashPrefix, outputHash, outputHashPref
323
331
  binariesDirectory,
324
332
  publicDir,
325
333
  configFile,
334
+ getDefaultCodingAgent,
326
335
  getDefaultEditor,
327
336
  });
328
337
  }
@@ -7,7 +7,7 @@ export type StartStudioResult = {
7
7
  } | {
8
8
  type: 'already-running';
9
9
  };
10
- export declare const startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, remotionRoot, relativePublicDir, bundlerOverride, rspackOverride, webpackOverride, poll, getRenderDefaults, getRenderQueue, getNumberOfAudioTags, queueMethods, previewEntry, gitSource, binariesDirectory, forceIPv4, getAudioLatencyHint, getPreviewSampleRate, enableCrossSiteIsolation, forceNew, rspack, getStudioRuntimeConfig, getDefaultEditor, configFile, }: {
10
+ export declare const startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, remotionRoot, relativePublicDir, bundlerOverride, rspackOverride, webpackOverride, poll, getRenderDefaults, getRenderQueue, getNumberOfAudioTags, queueMethods, previewEntry, gitSource, binariesDirectory, forceIPv4, getAudioLatencyHint, getPreviewSampleRate, enableCrossSiteIsolation, forceNew, rspack, getStudioRuntimeConfig, getDefaultCodingAgent, getDefaultEditor, configFile, }: {
11
11
  browserArgs: string;
12
12
  browserFlag: string;
13
13
  logLevel: "error" | "info" | "trace" | "verbose" | "warn";
@@ -36,6 +36,7 @@ export declare const startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser
36
36
  forceNew: boolean;
37
37
  rspack: boolean;
38
38
  getStudioRuntimeConfig: () => StudioRuntimeConfig;
39
+ getDefaultCodingAgent: () => "claude-code" | "codex" | "cursor" | "github-copilot" | null;
39
40
  getDefaultEditor: () => DefaultEditor | null;
40
41
  configFile: string | null;
41
42
  }) => Promise<StartStudioResult>;
@@ -19,7 +19,7 @@ const public_folder_1 = require("./preview-server/public-folder");
19
19
  const start_server_1 = require("./preview-server/start-server");
20
20
  const server_ready_1 = require("./server-ready");
21
21
  const watch_root_file_1 = require("./watch-root-file");
22
- const startStudio = async ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, remotionRoot, relativePublicDir, bundlerOverride, rspackOverride, webpackOverride, poll, getRenderDefaults, getRenderQueue, getNumberOfAudioTags, queueMethods, previewEntry, gitSource, binariesDirectory, forceIPv4, getAudioLatencyHint, getPreviewSampleRate, enableCrossSiteIsolation, forceNew, rspack, getStudioRuntimeConfig, getDefaultEditor, configFile, }) => {
22
+ const startStudio = async ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, remotionRoot, relativePublicDir, bundlerOverride, rspackOverride, webpackOverride, poll, getRenderDefaults, getRenderQueue, getNumberOfAudioTags, queueMethods, previewEntry, gitSource, binariesDirectory, forceIPv4, getAudioLatencyHint, getPreviewSampleRate, enableCrossSiteIsolation, forceNew, rspack, getStudioRuntimeConfig, getDefaultCodingAgent, getDefaultEditor, configFile, }) => {
23
23
  try {
24
24
  if (typeof Bun === 'undefined') {
25
25
  process.title = 'node (npx remotion studio)';
@@ -93,6 +93,7 @@ const startStudio = async ({ browserArgs, browserFlag, shouldOpenBrowser, fullEn
93
93
  forceNew,
94
94
  rspack,
95
95
  getStudioRuntimeConfig,
96
+ getDefaultCodingAgent,
96
97
  getDefaultEditor,
97
98
  configFile,
98
99
  });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-server"
4
4
  },
5
5
  "name": "@remotion/studio-server",
6
- "version": "4.0.505",
6
+ "version": "4.0.506",
7
7
  "description": "Run a Remotion Studio with a server backend",
8
8
  "main": "dist",
9
9
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@remotion/studio-protocol": "4.0.505",
26
+ "@remotion/studio-protocol": "4.0.506",
27
27
  "@babel/types": "7.24.0",
28
28
  "@babel/parser": "7.24.1",
29
29
  "@svgr/core": "8.1.0",
@@ -32,12 +32,12 @@
32
32
  "semver": "7.5.3",
33
33
  "zod": "4.4.3",
34
34
  "prettier": "3.8.1",
35
- "remotion": "4.0.505",
35
+ "remotion": "4.0.506",
36
36
  "recast": "0.23.11",
37
- "@remotion/bundler": "4.0.505",
38
- "@remotion/renderer": "4.0.505",
39
- "@remotion/studio-codemods": "4.0.505",
40
- "@remotion/studio-shared": "4.0.505",
37
+ "@remotion/bundler": "4.0.506",
38
+ "@remotion/renderer": "4.0.506",
39
+ "@remotion/studio-codemods": "4.0.506",
40
+ "@remotion/studio-shared": "4.0.506",
41
41
  "memfs": "3.4.3",
42
42
  "open": "8.4.2"
43
43
  },
@@ -45,7 +45,7 @@
45
45
  "ast-types": "0.16.1",
46
46
  "react": "19.2.3",
47
47
  "@types/semver": "7.5.3",
48
- "@remotion/eslint-config-internal": "4.0.505",
48
+ "@remotion/eslint-config-internal": "4.0.506",
49
49
  "eslint": "9.19.0",
50
50
  "@types/node": "20.12.14",
51
51
  "@typescript/native-preview": "7.0.0-dev.20260217.1"