@remotion/studio-server 4.0.506 → 4.0.508

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 (101) hide show
  1. package/dist/codemods/delete-jsx-node.d.ts +4 -0
  2. package/dist/codemods/delete-jsx-node.js +8 -0
  3. package/dist/codemods/duplicate-jsx-node.d.ts +2 -0
  4. package/dist/codemods/duplicate-jsx-node.js +8 -0
  5. package/dist/codemods/effect-param-expression.js +2 -0
  6. package/dist/codemods/get-node-path-remappings.d.ts +13 -0
  7. package/dist/codemods/get-node-path-remappings.js +87 -0
  8. package/dist/codemods/reorder-sequence.d.ts +2 -1
  9. package/dist/codemods/reorder-sequence.js +8 -0
  10. package/dist/codemods/split-jsx-sequence.d.ts +2 -0
  11. package/dist/codemods/split-jsx-sequence.js +8 -0
  12. package/dist/codemods/update-keyframes/update-keyframes.js +2 -0
  13. package/dist/file-watcher.d.ts +11 -1
  14. package/dist/file-watcher.js +16 -5
  15. package/dist/helpers/coding-agent-registry.d.ts +34 -0
  16. package/dist/helpers/coding-agent-registry.js +442 -21
  17. package/dist/helpers/editor-registry.d.ts +1 -0
  18. package/dist/helpers/editor-registry.js +31 -3
  19. package/dist/helpers/finder-artwork.d.ts +1 -0
  20. package/dist/helpers/finder-artwork.js +4 -0
  21. package/dist/helpers/open-in-editor.js +5 -5
  22. package/dist/helpers/parse-keyframe-easing-expression.js +3 -0
  23. package/dist/helpers/resolve-composition-component.d.ts +2 -1
  24. package/dist/helpers/resolve-composition-component.js +60 -68
  25. package/dist/helpers/resolve-editor.d.ts +2 -0
  26. package/dist/helpers/resolve-editor.js +4 -1
  27. package/dist/helpers/terminal-artwork.d.ts +6 -0
  28. package/dist/helpers/terminal-artwork.js +14 -0
  29. package/dist/helpers/terminal-registry.d.ts +36 -0
  30. package/dist/helpers/terminal-registry.js +401 -0
  31. package/dist/index.d.ts +7 -2
  32. package/dist/preview-server/api-routes.js +7 -4
  33. package/dist/preview-server/handler.d.ts +1 -1
  34. package/dist/preview-server/live-events.d.ts +1 -0
  35. package/dist/preview-server/live-events.js +3 -1
  36. package/dist/preview-server/routes/add-effect-keyframe.js +7 -1
  37. package/dist/preview-server/routes/add-effect.js +7 -1
  38. package/dist/preview-server/routes/add-keyframes.js +10 -2
  39. package/dist/preview-server/routes/add-render.js +2 -0
  40. package/dist/preview-server/routes/add-sequence-keyframe.js +7 -1
  41. package/dist/preview-server/routes/app-icon.d.ts +6 -0
  42. package/dist/preview-server/routes/app-icon.js +66 -0
  43. package/dist/preview-server/routes/apply-codemod.js +15 -2
  44. package/dist/preview-server/routes/apply-visual-control-change.js +7 -1
  45. package/dist/preview-server/routes/batch-update-keyframe-settings.js +10 -2
  46. package/dist/preview-server/routes/can-update-sequence-props.d.ts +1 -0
  47. package/dist/preview-server/routes/can-update-sequence-props.js +33 -9
  48. package/dist/preview-server/routes/copy-render-output-to-asset.d.ts +3 -0
  49. package/dist/preview-server/routes/copy-render-output-to-asset.js +58 -0
  50. package/dist/preview-server/routes/default-coding-agent.d.ts +2 -6
  51. package/dist/preview-server/routes/default-coding-agent.js +19 -88
  52. package/dist/preview-server/routes/default-editor.d.ts +1 -6
  53. package/dist/preview-server/routes/default-editor.js +13 -113
  54. package/dist/preview-server/routes/delete-effect.js +7 -1
  55. package/dist/preview-server/routes/delete-jsx-node.js +16 -2
  56. package/dist/preview-server/routes/delete-keyframes.js +10 -2
  57. package/dist/preview-server/routes/duplicate-effect.js +7 -1
  58. package/dist/preview-server/routes/duplicate-jsx-node.js +17 -5
  59. package/dist/preview-server/routes/insert-element.js +23 -3
  60. package/dist/preview-server/routes/insert-jsx-element.js +17 -2
  61. package/dist/preview-server/routes/move-keyframes.js +10 -2
  62. package/dist/preview-server/routes/open-in-editor.js +1 -1
  63. package/dist/preview-server/routes/open-in-terminal.d.ts +3 -0
  64. package/dist/preview-server/routes/open-in-terminal.js +17 -0
  65. package/dist/preview-server/routes/paste-effects.js +7 -1
  66. package/dist/preview-server/routes/reorder-effect.js +7 -1
  67. package/dist/preview-server/routes/reorder-sequence.js +17 -2
  68. package/dist/preview-server/routes/save-effect-props.js +7 -1
  69. package/dist/preview-server/routes/save-multiple-effect-props.js +10 -2
  70. package/dist/preview-server/routes/save-sequence-props.js +10 -2
  71. package/dist/preview-server/routes/split-jsx-sequence.js +17 -6
  72. package/dist/preview-server/routes/update-config.d.ts +7 -0
  73. package/dist/preview-server/routes/update-config.js +193 -0
  74. package/dist/preview-server/routes/update-default-props.js +7 -1
  75. package/dist/preview-server/routes/update-effect-keyframe-settings.js +7 -1
  76. package/dist/preview-server/routes/update-sequence-keyframe-settings.js +7 -1
  77. package/dist/preview-server/sequence-node-path-mutation.d.ts +7 -0
  78. package/dist/preview-server/sequence-node-path-mutation.js +21 -0
  79. package/dist/preview-server/sequence-props-watchers.js +15 -6
  80. package/dist/preview-server/start-server.d.ts +1 -1
  81. package/dist/preview-server/studio-protocol/handle-discovery.js +3 -4
  82. package/dist/preview-server/studio-protocol/handle-install.js +1 -1
  83. package/dist/preview-server/studio-protocol/handle-license-key.js +2 -2
  84. package/dist/preview-server/studio-protocol/origin-policy.d.ts +2 -5
  85. package/dist/preview-server/studio-protocol/origin-policy.js +6 -30
  86. package/dist/preview-server/undo-stack.d.ts +7 -13
  87. package/dist/preview-server/undo-stack.js +58 -5
  88. package/dist/routes.d.ts +1 -1
  89. package/dist/routes.js +8 -1
  90. package/dist/start-studio.d.ts +1 -1
  91. package/package.json +8 -8
  92. package/web/coding-agent-icons/claude-code.png +0 -0
  93. package/web/coding-agent-icons/codex.png +0 -0
  94. package/web/coding-agent-icons/copilot.png +0 -0
  95. package/web/coding-agent-icons/cursor.png +0 -0
  96. package/dist/preview-server/routes/delete-effect-keyframe.d.ts +0 -3
  97. package/dist/preview-server/routes/delete-effect-keyframe.js +0 -89
  98. package/dist/preview-server/routes/delete-sequence-keyframe.d.ts +0 -3
  99. package/dist/preview-server/routes/delete-sequence-keyframe.js +0 -82
  100. package/dist/preview-server/routes/save-props-mutex.d.ts +0 -1
  101. package/dist/preview-server/routes/save-props-mutex.js +0 -11
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getAvailableCodingAgents = exports.discoverAvailableCodingAgents = void 0;
6
+ exports.launchCodingAgent = exports.getCodingAgentLaunchCommands = exports.getCodingAgentLaunchCommand = exports.getAvailableCodingAgents = exports.discoverAvailableCodingAgents = void 0;
7
7
  const node_child_process_1 = require("node:child_process");
8
8
  const node_fs_1 = require("node:fs");
9
9
  const node_os_1 = require("node:os");
@@ -11,28 +11,165 @@ const node_path_1 = __importDefault(require("node:path"));
11
11
  const node_util_1 = require("node:util");
12
12
  const renderer_1 = require("@remotion/renderer");
13
13
  const execFilePromise = (0, node_util_1.promisify)(node_child_process_1.execFile);
14
+ const getLinuxCommandPaths = (context, command) => [
15
+ node_path_1.default.posix.join('/usr/local/bin', command),
16
+ node_path_1.default.posix.join('/usr/bin', command),
17
+ node_path_1.default.posix.join(context.homeDirectory, '.local/bin', command),
18
+ ];
19
+ const getWindowsCommandPaths = (context, command) => [
20
+ node_path_1.default.win32.join(context.homeDirectory, '.local', 'bin', `${command}.exe`),
21
+ node_path_1.default.win32.join(context.homeDirectory, '.local', 'bin', `${command}.cmd`),
22
+ ];
23
+ const getWindowsEnvironmentPaths = (context, segments) => {
24
+ const paths = [];
25
+ if (context.env.LOCALAPPDATA) {
26
+ paths.push(node_path_1.default.win32.join(context.env.LOCALAPPDATA, 'Programs', ...segments));
27
+ }
28
+ for (const directory of [
29
+ context.env.ProgramFiles,
30
+ context.env['ProgramFiles(x86)'],
31
+ ]) {
32
+ if (directory) {
33
+ paths.push(node_path_1.default.win32.join(directory, ...segments));
34
+ }
35
+ }
36
+ return paths;
37
+ };
14
38
  const codingAgentDefinitions = {
15
39
  codex: {
16
40
  name: 'Codex',
17
- bundleIdentifiers: ['com.openai.codex'],
18
- applicationNames: ['ChatGPT.app'],
41
+ nameWithType: 'Codex',
42
+ darwin: {
43
+ bundleIdentifiers: ['com.openai.codex'],
44
+ applicationNames: ['ChatGPT.app'],
45
+ },
46
+ linux: [
47
+ {
48
+ paths: (context) => getLinuxCommandPaths(context, 'codex'),
49
+ commands: ['codex'],
50
+ launchMode: 'terminal',
51
+ },
52
+ ],
53
+ win32: [
54
+ {
55
+ paths: (context) => [
56
+ ...getWindowsCommandPaths(context, 'codex'),
57
+ ...(context.env.LOCALAPPDATA
58
+ ? [
59
+ node_path_1.default.win32.join(context.env.LOCALAPPDATA, 'OpenAI', 'Codex', 'bin', 'codex.exe'),
60
+ node_path_1.default.win32.join(context.env.LOCALAPPDATA, 'Packages', 'OpenAI.Codex_2p2nqsd0c76g0', 'LocalCache', 'Local', 'OpenAI', 'Codex', 'bin', 'codex.exe'),
61
+ ]
62
+ : []),
63
+ ],
64
+ commands: ['codex.exe', 'codex.cmd'],
65
+ launchMode: 'terminal',
66
+ },
67
+ ],
19
68
  },
20
69
  cursor: {
21
70
  name: 'Cursor',
22
- bundleIdentifiers: ['com.todesktop.230313mzl4w4u92'],
23
- applicationNames: ['Cursor.app'],
71
+ nameWithType: 'Cursor Agent',
72
+ darwin: {
73
+ bundleIdentifiers: ['com.todesktop.230313mzl4w4u92'],
74
+ applicationNames: ['Cursor.app'],
75
+ },
76
+ linux: [
77
+ {
78
+ paths: (context) => getLinuxCommandPaths(context, 'cursor'),
79
+ commands: ['cursor'],
80
+ launchMode: 'direct',
81
+ },
82
+ {
83
+ paths: (context) => [
84
+ ...getLinuxCommandPaths(context, 'cursor-agent'),
85
+ node_path_1.default.posix.join(context.homeDirectory, '.cursor/bin/cursor-agent'),
86
+ ],
87
+ commands: ['cursor-agent'],
88
+ launchMode: 'terminal',
89
+ },
90
+ ],
91
+ win32: [
92
+ {
93
+ paths: (context) => getWindowsEnvironmentPaths(context, ['cursor', 'Cursor.exe']),
94
+ commands: ['Cursor.exe', 'cursor.cmd'],
95
+ launchMode: 'direct',
96
+ },
97
+ {
98
+ paths: (context) => getWindowsCommandPaths(context, 'cursor-agent'),
99
+ commands: ['cursor-agent.exe', 'cursor-agent.cmd'],
100
+ launchMode: 'terminal',
101
+ },
102
+ ],
24
103
  },
25
- 'github-copilot': {
104
+ copilot: {
26
105
  name: 'GitHub Copilot',
27
- bundleIdentifiers: ['com.github.githubapp'],
28
- applicationNames: ['GitHub Copilot.app'],
106
+ nameWithType: 'GitHub Copilot',
107
+ darwin: {
108
+ bundleIdentifiers: ['com.github.githubapp'],
109
+ applicationNames: ['GitHub Copilot.app'],
110
+ },
111
+ linux: [
112
+ {
113
+ paths: (context) => getLinuxCommandPaths(context, 'copilot'),
114
+ commands: ['copilot'],
115
+ launchMode: 'terminal',
116
+ },
117
+ ],
118
+ win32: [
119
+ {
120
+ paths: (context) => getWindowsCommandPaths(context, 'copilot'),
121
+ commands: ['copilot.exe', 'copilot.cmd'],
122
+ launchMode: 'terminal',
123
+ },
124
+ ],
29
125
  },
30
126
  'claude-code': {
31
127
  name: 'Claude Code',
32
- bundleIdentifiers: ['com.anthropic.claudefordesktop'],
33
- applicationNames: ['Claude.app'],
128
+ nameWithType: 'Claude Code',
129
+ darwin: {
130
+ bundleIdentifiers: ['com.anthropic.claudefordesktop'],
131
+ applicationNames: ['Claude.app'],
132
+ },
133
+ linux: [
134
+ {
135
+ paths: (context) => [
136
+ ...getLinuxCommandPaths(context, 'claude'),
137
+ node_path_1.default.posix.join(context.homeDirectory, '.claude/local/claude'),
138
+ ],
139
+ commands: ['claude'],
140
+ launchMode: 'terminal',
141
+ },
142
+ ],
143
+ win32: [
144
+ {
145
+ paths: (context) => getWindowsCommandPaths(context, 'claude'),
146
+ commands: ['claude.exe', 'claude.cmd'],
147
+ launchMode: 'terminal',
148
+ },
149
+ ],
34
150
  },
35
151
  };
152
+ const linuxTerminalDefinitions = [
153
+ {
154
+ id: 'x-terminal-emulator',
155
+ paths: ['/usr/bin/x-terminal-emulator'],
156
+ commands: ['x-terminal-emulator'],
157
+ },
158
+ {
159
+ id: 'gnome-terminal',
160
+ paths: ['/usr/bin/gnome-terminal'],
161
+ commands: ['gnome-terminal'],
162
+ },
163
+ {
164
+ id: 'konsole',
165
+ paths: ['/usr/bin/konsole'],
166
+ commands: ['konsole'],
167
+ },
168
+ { id: 'kitty', paths: ['/usr/bin/kitty'], commands: ['kitty'] },
169
+ { id: 'alacritty', paths: ['/usr/bin/alacritty'], commands: ['alacritty'] },
170
+ { id: 'wezterm', paths: ['/usr/bin/wezterm'], commands: ['wezterm'] },
171
+ { id: 'xterm', paths: ['/usr/bin/xterm'], commands: ['xterm'] },
172
+ ];
36
173
  const findMacApplications = async (bundleIdentifier) => {
37
174
  try {
38
175
  const { stdout } = await execFilePromise('mdfind', [
@@ -49,31 +186,108 @@ const findMacApplications = async (bundleIdentifier) => {
49
186
  };
50
187
  const defaultDiscoveryContext = {
51
188
  platform: process.platform,
189
+ env: process.env,
52
190
  homeDirectory: (0, node_os_1.homedir)(),
53
191
  pathExists: node_fs_1.existsSync,
54
192
  findMacApplications,
55
193
  };
194
+ const getPathDirectories = (context) => {
195
+ var _a, _b;
196
+ const value = (_b = (_a = context.env.PATH) !== null && _a !== void 0 ? _a : context.env.Path) !== null && _b !== void 0 ? _b : '';
197
+ return value.split(context.platform === 'win32' ? ';' : ':').filter(Boolean);
198
+ };
199
+ const findExecutable = ({ paths, commands, context, }) => {
200
+ for (const executablePath of paths) {
201
+ if (context.pathExists(executablePath)) {
202
+ return executablePath;
203
+ }
204
+ }
205
+ const pathImplementation = context.platform === 'win32' ? node_path_1.default.win32 : node_path_1.default.posix;
206
+ for (const directory of getPathDirectories(context)) {
207
+ for (const command of commands) {
208
+ const executablePath = pathImplementation.join(directory, command);
209
+ if (context.pathExists(executablePath)) {
210
+ return executablePath;
211
+ }
212
+ }
213
+ }
214
+ return null;
215
+ };
216
+ const findLinuxTerminal = (context) => {
217
+ for (const definition of linuxTerminalDefinitions) {
218
+ const terminalPath = findExecutable({
219
+ paths: definition.paths,
220
+ commands: definition.commands,
221
+ context,
222
+ });
223
+ if (terminalPath) {
224
+ return { id: definition.id, path: terminalPath };
225
+ }
226
+ }
227
+ return null;
228
+ };
56
229
  const discoverAvailableCodingAgents = async (context) => {
57
- if (context.platform !== 'darwin') {
230
+ var _a, _b;
231
+ if (context.platform !== 'darwin' &&
232
+ context.platform !== 'linux' &&
233
+ context.platform !== 'win32') {
58
234
  return [];
59
235
  }
236
+ const { platform } = context;
237
+ const terminal = platform === 'linux'
238
+ ? findLinuxTerminal(context)
239
+ : platform === 'win32'
240
+ ? {
241
+ id: 'cmd',
242
+ path: (_b = (_a = context.env.ComSpec) !== null && _a !== void 0 ? _a : context.env.COMSPEC) !== null && _b !== void 0 ? _b : 'cmd.exe',
243
+ }
244
+ : null;
60
245
  const installedCodingAgents = [];
61
246
  for (const id of renderer_1.defaultCodingAgentIds) {
62
247
  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)) {
248
+ if (platform === 'darwin') {
249
+ const discoveredApplications = (await Promise.all(definition.darwin.bundleIdentifiers.map((bundleIdentifier) => context.findMacApplications(bundleIdentifier)))).flat();
250
+ const knownApplications = definition.darwin.applicationNames.flatMap((name) => [
251
+ node_path_1.default.posix.join('/Applications', name),
252
+ node_path_1.default.posix.join(context.homeDirectory, 'Applications', name),
253
+ ]);
254
+ for (const applicationPath of new Set([
255
+ ...discoveredApplications,
256
+ ...knownApplications,
257
+ ])) {
258
+ if (context.pathExists(applicationPath)) {
259
+ installedCodingAgents.push({
260
+ applicationPath,
261
+ id,
262
+ launchMode: 'direct',
263
+ name: definition.name,
264
+ nameWithType: definition.nameWithType,
265
+ platform,
266
+ terminal: null,
267
+ });
268
+ break;
269
+ }
270
+ }
271
+ continue;
272
+ }
273
+ for (const variant of definition[platform]) {
274
+ if (variant.launchMode === 'terminal' && terminal === null) {
275
+ continue;
276
+ }
277
+ const applicationPath = findExecutable({
278
+ paths: variant.paths(context),
279
+ commands: variant.commands,
280
+ context,
281
+ });
282
+ if (applicationPath) {
73
283
  installedCodingAgents.push({
74
284
  applicationPath,
75
285
  id,
286
+ launchMode: variant.launchMode,
76
287
  name: definition.name,
288
+ nameWithType: definition.nameWithType,
289
+ platform,
290
+ terminal: variant.launchMode === 'terminal' ? terminal : null,
77
291
  });
78
292
  break;
79
293
  }
@@ -88,3 +302,210 @@ const getAvailableCodingAgents = () => {
88
302
  return availableCodingAgents;
89
303
  };
90
304
  exports.getAvailableCodingAgents = getAvailableCodingAgents;
305
+ const getCodingAgentLaunchCommand = ({ codingAgent, projectPath, }) => {
306
+ if (codingAgent.platform === 'darwin') {
307
+ switch (codingAgent.id) {
308
+ case 'codex':
309
+ return {
310
+ command: node_path_1.default.posix.join(codingAgent.applicationPath, 'Contents/Resources/codex'),
311
+ args: ['app', projectPath],
312
+ cwd: null,
313
+ };
314
+ case 'cursor':
315
+ return {
316
+ command: node_path_1.default.posix.join(codingAgent.applicationPath, 'Contents/Resources/app/bin/cursor'),
317
+ args: ['--glass', '--suppress-popups-on-startup', projectPath],
318
+ cwd: null,
319
+ };
320
+ case 'copilot':
321
+ case 'claude-code':
322
+ return {
323
+ command: 'open',
324
+ args: ['-a', codingAgent.applicationPath, projectPath],
325
+ cwd: null,
326
+ };
327
+ default: {
328
+ const invalidId = codingAgent.id;
329
+ throw new Error(`Unknown coding agent: ${invalidId}`);
330
+ }
331
+ }
332
+ }
333
+ if (codingAgent.launchMode === 'direct') {
334
+ return {
335
+ command: codingAgent.applicationPath,
336
+ args: codingAgent.id === 'cursor'
337
+ ? ['--glass', '--suppress-popups-on-startup', projectPath]
338
+ : [projectPath],
339
+ cwd: null,
340
+ };
341
+ }
342
+ if (codingAgent.terminal === null) {
343
+ throw new Error(`No terminal found for coding agent ${codingAgent.name}`);
344
+ }
345
+ if (codingAgent.terminal.id === 'cmd') {
346
+ return {
347
+ command: codingAgent.terminal.path,
348
+ args: [
349
+ '/d',
350
+ '/s',
351
+ '/c',
352
+ 'start',
353
+ '',
354
+ '/d',
355
+ projectPath,
356
+ codingAgent.terminal.path,
357
+ '/k',
358
+ codingAgent.applicationPath,
359
+ ],
360
+ cwd: null,
361
+ };
362
+ }
363
+ const command = codingAgent.applicationPath;
364
+ switch (codingAgent.terminal.id) {
365
+ case 'gnome-terminal':
366
+ return {
367
+ command: codingAgent.terminal.path,
368
+ args: [`--working-directory=${projectPath}`, '--', command],
369
+ cwd: projectPath,
370
+ };
371
+ case 'konsole':
372
+ return {
373
+ command: codingAgent.terminal.path,
374
+ args: ['--workdir', projectPath, '-e', command],
375
+ cwd: projectPath,
376
+ };
377
+ case 'kitty':
378
+ return {
379
+ command: codingAgent.terminal.path,
380
+ args: ['--directory', projectPath, command],
381
+ cwd: projectPath,
382
+ };
383
+ case 'alacritty':
384
+ return {
385
+ command: codingAgent.terminal.path,
386
+ args: ['--working-directory', projectPath, '-e', command],
387
+ cwd: projectPath,
388
+ };
389
+ case 'wezterm':
390
+ return {
391
+ command: codingAgent.terminal.path,
392
+ args: ['start', '--cwd', projectPath, '--', command],
393
+ cwd: projectPath,
394
+ };
395
+ case 'x-terminal-emulator':
396
+ case 'xterm':
397
+ return {
398
+ command: codingAgent.terminal.path,
399
+ args: ['-e', command],
400
+ cwd: projectPath,
401
+ };
402
+ default: {
403
+ const invalidTerminal = codingAgent.terminal.id;
404
+ throw new Error(`Unknown terminal: ${invalidTerminal}`);
405
+ }
406
+ }
407
+ };
408
+ exports.getCodingAgentLaunchCommand = getCodingAgentLaunchCommand;
409
+ const getCodingAgentLaunchCommands = ({ codingAgent, projectPath, prompt, }) => {
410
+ const defaultCommand = {
411
+ ...(0, exports.getCodingAgentLaunchCommand)({ codingAgent, projectPath }),
412
+ waitForExit: false,
413
+ };
414
+ if (prompt === null ||
415
+ codingAgent.platform !== 'darwin' ||
416
+ codingAgent.id === 'copilot') {
417
+ return [defaultCommand];
418
+ }
419
+ switch (codingAgent.id) {
420
+ case 'codex': {
421
+ const deepLink = new URL('codex://new');
422
+ deepLink.searchParams.set('path', projectPath);
423
+ deepLink.searchParams.set('prompt', prompt);
424
+ return [
425
+ {
426
+ command: 'open',
427
+ args: [deepLink.toString()],
428
+ cwd: null,
429
+ waitForExit: false,
430
+ },
431
+ ];
432
+ }
433
+ case 'cursor': {
434
+ const deepLink = new URL('cursor://anysphere.cursor-deeplink/prompt');
435
+ deepLink.searchParams.set('text', prompt);
436
+ return [
437
+ { ...defaultCommand, waitForExit: true },
438
+ {
439
+ command: 'open',
440
+ args: [deepLink.toString()],
441
+ cwd: null,
442
+ waitForExit: false,
443
+ },
444
+ ];
445
+ }
446
+ case 'claude-code': {
447
+ const deepLink = new URL('claude://code/new');
448
+ deepLink.searchParams.set('folder', projectPath);
449
+ deepLink.searchParams.set('q', prompt);
450
+ return [
451
+ {
452
+ command: 'open',
453
+ args: [deepLink.toString()],
454
+ cwd: null,
455
+ waitForExit: false,
456
+ },
457
+ ];
458
+ }
459
+ default: {
460
+ const invalidId = codingAgent.id;
461
+ throw new Error(`Unknown coding agent: ${invalidId}`);
462
+ }
463
+ }
464
+ };
465
+ exports.getCodingAgentLaunchCommands = getCodingAgentLaunchCommands;
466
+ const launchCodingAgent = async ({ codingAgent, projectPath, logLevel, prompt, }) => {
467
+ const commands = (0, exports.getCodingAgentLaunchCommands)({
468
+ codingAgent,
469
+ projectPath,
470
+ prompt,
471
+ });
472
+ for (const { command, args, cwd, waitForExit } of commands) {
473
+ const success = await new Promise((resolve) => {
474
+ try {
475
+ const child = (0, node_child_process_1.spawn)(command, args, {
476
+ cwd: cwd !== null && cwd !== void 0 ? cwd : undefined,
477
+ detached: !waitForExit,
478
+ shell: false,
479
+ stdio: 'ignore',
480
+ });
481
+ child.once('error', (error) => {
482
+ renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, `Could not launch coding agent ${codingAgent.name}:`, error);
483
+ resolve(false);
484
+ });
485
+ if (waitForExit) {
486
+ child.once('exit', (code) => {
487
+ if (code !== 0) {
488
+ renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, `Could not launch coding agent ${codingAgent.name}: Process exited with code ${code}`);
489
+ }
490
+ resolve(code === 0);
491
+ });
492
+ }
493
+ else {
494
+ child.once('spawn', () => {
495
+ child.unref();
496
+ resolve(true);
497
+ });
498
+ }
499
+ }
500
+ catch (error) {
501
+ renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, `Could not launch coding agent ${codingAgent.name}:`, error);
502
+ resolve(false);
503
+ }
504
+ });
505
+ if (!success) {
506
+ return false;
507
+ }
508
+ }
509
+ return true;
510
+ };
511
+ exports.launchCodingAgent = launchCodingAgent;
@@ -2,6 +2,7 @@ import type { BuiltInEditor } from '@remotion/renderer';
2
2
  export type InstalledEditor = {
3
3
  id: BuiltInEditor;
4
4
  name: string;
5
+ nameWithType: string;
5
6
  process: string;
6
7
  command: string;
7
8
  };