@synthetic-ai/premiere-mcp 2.1.0 → 2.3.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +135 -123
  2. package/LICENSE +21 -21
  3. package/README.md +242 -242
  4. package/cep-plugin/.debug +8 -8
  5. package/cep-plugin/CSInterface.js +92 -92
  6. package/cep-plugin/host.jsx +7 -7
  7. package/cep-plugin/index.html +472 -472
  8. package/cep-plugin/main.js +6 -0
  9. package/cep-plugin/premiere.jsx +24947 -24947
  10. package/dist/bridge/script-builder.js +378 -378
  11. package/dist/index.js +103 -4
  12. package/dist/license.js +38 -0
  13. package/dist/server.js +60 -60
  14. package/dist/tools/advanced.js +357 -357
  15. package/dist/tools/audio-advanced.js +1049 -1049
  16. package/dist/tools/audio.js +42 -42
  17. package/dist/tools/captions.js +27 -27
  18. package/dist/tools/clipboard.js +214 -214
  19. package/dist/tools/color-advanced.js +253 -253
  20. package/dist/tools/discovery.js +291 -291
  21. package/dist/tools/effects.js +285 -285
  22. package/dist/tools/export-presets.js +206 -206
  23. package/dist/tools/export.js +255 -255
  24. package/dist/tools/health.js +10 -10
  25. package/dist/tools/inspection.js +885 -885
  26. package/dist/tools/keyframes.js +369 -369
  27. package/dist/tools/markers.js +89 -89
  28. package/dist/tools/media.js +178 -178
  29. package/dist/tools/metadata.js +94 -94
  30. package/dist/tools/multicam.js +50 -50
  31. package/dist/tools/playback.js +15 -15
  32. package/dist/tools/playhead.js +95 -95
  33. package/dist/tools/project-manager.js +21 -21
  34. package/dist/tools/project.js +149 -149
  35. package/dist/tools/scripting.js +319 -319
  36. package/dist/tools/selection.js +202 -202
  37. package/dist/tools/sequence-advanced.js +379 -379
  38. package/dist/tools/sequence-settings.js +564 -564
  39. package/dist/tools/sequence.js +167 -167
  40. package/dist/tools/source-monitor.js +68 -68
  41. package/dist/tools/text.js +58 -58
  42. package/dist/tools/timeline.js +312 -312
  43. package/dist/tools/track-management.js +446 -446
  44. package/dist/tools/track-targeting.js +635 -635
  45. package/dist/tools/tracks.js +87 -87
  46. package/dist/tools/transitions-motion.js +174 -174
  47. package/dist/tools/transitions.js +111 -111
  48. package/dist/tools/utility.js +606 -606
  49. package/dist/tools/workspace.js +29 -29
  50. package/package.json +66 -66
  51. package/scripts/build-chat-dmg.sh +210 -210
  52. package/scripts/build-chat-zip.sh +291 -291
  53. package/scripts/install-cep-windows.ps1 +99 -99
  54. package/scripts/install-cep.sh +66 -66
  55. package/scripts/install-chat-plugin.bat +67 -67
  56. package/scripts/install-chat-plugin.sh +85 -85
  57. package/scripts/install-windows.bat +95 -95
  58. package/scripts/package.mjs +254 -254
@@ -6,29 +6,29 @@ export function getDiscoveryTools(bridgeOptions) {
6
6
  description: "Get information about the currently open Premiere Pro project",
7
7
  parameters: {},
8
8
  handler: async () => {
9
- const script = buildToolScript(`
10
- var project = app.project;
11
- if (!project) return __error("No project is open");
12
-
13
- var info = {
14
- name: project.name,
15
- path: project.path,
16
- numSequences: project.sequences.numSequences,
17
- numItems: project.rootItem.children.numItems,
18
- activeSequence: null
19
- };
20
-
21
- var activeSeq = project.activeSequence;
22
- if (activeSeq) {
23
- info.activeSequence = {
24
- name: activeSeq.name,
25
- id: activeSeq.sequenceID,
26
- videoTracks: activeSeq.videoTracks.numTracks,
27
- audioTracks: activeSeq.audioTracks.numTracks
28
- };
29
- }
30
-
31
- return __result(info);
9
+ const script = buildToolScript(`
10
+ var project = app.project;
11
+ if (!project) return __error("No project is open");
12
+
13
+ var info = {
14
+ name: project.name,
15
+ path: project.path,
16
+ numSequences: project.sequences.numSequences,
17
+ numItems: project.rootItem.children.numItems,
18
+ activeSequence: null
19
+ };
20
+
21
+ var activeSeq = project.activeSequence;
22
+ if (activeSeq) {
23
+ info.activeSequence = {
24
+ name: activeSeq.name,
25
+ id: activeSeq.sequenceID,
26
+ videoTracks: activeSeq.videoTracks.numTracks,
27
+ audioTracks: activeSeq.audioTracks.numTracks
28
+ };
29
+ }
30
+
31
+ return __result(info);
32
32
  `);
33
33
  return sendCommand(script, bridgeOptions);
34
34
  },
@@ -46,43 +46,43 @@ export function getDiscoveryTools(bridgeOptions) {
46
46
  },
47
47
  handler: async (args) => {
48
48
  const binPath = args.bin_path ? `"${escapeForExtendScript(args.bin_path)}"` : "null";
49
- const script = buildToolScript(`
50
- var rootItem = app.project.rootItem;
51
- var targetItem = rootItem;
52
-
53
- var binPath = ${binPath};
54
- if (binPath) {
55
- var parts = binPath.split("/");
56
- for (var p = 0; p < parts.length; p++) {
57
- var found = false;
58
- for (var i = 0; i < targetItem.children.numItems; i++) {
59
- if (targetItem.children[i].name === parts[p] && targetItem.children[i].type === 2) {
60
- targetItem = targetItem.children[i];
61
- found = true;
62
- break;
63
- }
64
- }
65
- if (!found) return __error("Bin not found: " + binPath);
66
- }
67
- }
68
-
69
- var items = [];
70
- for (var i = 0; i < targetItem.children.numItems; i++) {
71
- var item = targetItem.children[i];
72
- var entry = {
73
- nodeId: item.nodeId,
74
- name: item.name,
75
- type: (item.type === 1 ? "clip" : item.type === 2 ? "bin" : item.type === 3 ? "root" : item.type === 4 ? "file" : "unknown"),
76
- isSequence: __readMaybe(item, "isSequence", false),
77
- mediaPath: ""
78
- };
79
- try {
80
- if (item.getMediaPath) entry.mediaPath = item.getMediaPath();
81
- } catch(e) {}
82
- items.push(entry);
83
- }
84
-
85
- return __result(items);
49
+ const script = buildToolScript(`
50
+ var rootItem = app.project.rootItem;
51
+ var targetItem = rootItem;
52
+
53
+ var binPath = ${binPath};
54
+ if (binPath) {
55
+ var parts = binPath.split("/");
56
+ for (var p = 0; p < parts.length; p++) {
57
+ var found = false;
58
+ for (var i = 0; i < targetItem.children.numItems; i++) {
59
+ if (targetItem.children[i].name === parts[p] && targetItem.children[i].type === 2) {
60
+ targetItem = targetItem.children[i];
61
+ found = true;
62
+ break;
63
+ }
64
+ }
65
+ if (!found) return __error("Bin not found: " + binPath);
66
+ }
67
+ }
68
+
69
+ var items = [];
70
+ for (var i = 0; i < targetItem.children.numItems; i++) {
71
+ var item = targetItem.children[i];
72
+ var entry = {
73
+ nodeId: item.nodeId,
74
+ name: item.name,
75
+ type: (item.type === 1 ? "clip" : item.type === 2 ? "bin" : item.type === 3 ? "root" : item.type === 4 ? "file" : "unknown"),
76
+ isSequence: __readMaybe(item, "isSequence", false),
77
+ mediaPath: ""
78
+ };
79
+ try {
80
+ if (item.getMediaPath) entry.mediaPath = item.getMediaPath();
81
+ } catch(e) {}
82
+ items.push(entry);
83
+ }
84
+
85
+ return __result(items);
86
86
  `);
87
87
  return sendCommand(script, bridgeOptions);
88
88
  },
@@ -91,24 +91,24 @@ export function getDiscoveryTools(bridgeOptions) {
91
91
  description: "List all sequences in the project",
92
92
  parameters: {},
93
93
  handler: async () => {
94
- const script = buildToolScript(`
95
- var project = app.project;
96
- if (!project) return __error("No project is open");
97
-
98
- var sequences = [];
99
- for (var i = 0; i < project.sequences.numSequences; i++) {
100
- var seq = project.sequences[i];
101
- sequences.push({
102
- name: seq.name,
103
- id: seq.sequenceID,
104
- videoTracks: seq.videoTracks.numTracks,
105
- audioTracks: seq.audioTracks.numTracks,
106
- inPoint: __ticksToSeconds(seq.zeroPoint),
107
- end: __ticksToSeconds(seq.end)
108
- });
109
- }
110
-
111
- return __result(sequences);
94
+ const script = buildToolScript(`
95
+ var project = app.project;
96
+ if (!project) return __error("No project is open");
97
+
98
+ var sequences = [];
99
+ for (var i = 0; i < project.sequences.numSequences; i++) {
100
+ var seq = project.sequences[i];
101
+ sequences.push({
102
+ name: seq.name,
103
+ id: seq.sequenceID,
104
+ videoTracks: seq.videoTracks.numTracks,
105
+ audioTracks: seq.audioTracks.numTracks,
106
+ inPoint: __ticksToSeconds(seq.zeroPoint),
107
+ end: __ticksToSeconds(seq.end)
108
+ });
109
+ }
110
+
111
+ return __result(sequences);
112
112
  `);
113
113
  return sendCommand(script, bridgeOptions);
114
114
  },
@@ -117,65 +117,65 @@ export function getDiscoveryTools(bridgeOptions) {
117
117
  description: "Get detailed information about the currently active sequence",
118
118
  parameters: {},
119
119
  handler: async () => {
120
- const script = buildToolScript(`
121
- var seq = app.project.activeSequence;
122
- if (!seq) return __error("No active sequence");
123
-
124
- var videoTracks = [];
125
- for (var t = 0; t < seq.videoTracks.numTracks; t++) {
126
- var track = seq.videoTracks[t];
127
- var clips = [];
128
- for (var c = 0; c < track.clips.numItems; c++) {
129
- var clip = track.clips[c];
130
- clips.push({
131
- nodeId: clip.nodeId,
132
- name: clip.name,
133
- start: __ticksToSeconds(clip.start.ticks),
134
- end: __ticksToSeconds(clip.end.ticks),
135
- inPoint: __ticksToSeconds(clip.inPoint.ticks),
136
- outPoint: __ticksToSeconds(clip.outPoint.ticks),
137
- duration: __ticksToSeconds(clip.duration.ticks)
138
- });
139
- }
140
- videoTracks.push({
141
- index: t,
142
- name: track.name,
143
- numClips: track.clips.numItems,
144
- clips: clips
145
- });
146
- }
147
-
148
- var audioTracks = [];
149
- for (var t = 0; t < seq.audioTracks.numTracks; t++) {
150
- var track = seq.audioTracks[t];
151
- var clips = [];
152
- for (var c = 0; c < track.clips.numItems; c++) {
153
- var clip = track.clips[c];
154
- clips.push({
155
- nodeId: clip.nodeId,
156
- name: clip.name,
157
- start: __ticksToSeconds(clip.start.ticks),
158
- end: __ticksToSeconds(clip.end.ticks),
159
- duration: __ticksToSeconds(clip.duration.ticks)
160
- });
161
- }
162
- audioTracks.push({
163
- index: t,
164
- name: track.name,
165
- numClips: track.clips.numItems,
166
- clips: clips
167
- });
168
- }
169
-
170
- return __result({
171
- name: seq.name,
172
- id: seq.sequenceID,
173
- frameSizeHorizontal: seq.frameSizeHorizontal,
174
- frameSizeVertical: seq.frameSizeVertical,
175
- end: __ticksToSeconds(seq.end),
176
- videoTracks: videoTracks,
177
- audioTracks: audioTracks
178
- });
120
+ const script = buildToolScript(`
121
+ var seq = app.project.activeSequence;
122
+ if (!seq) return __error("No active sequence");
123
+
124
+ var videoTracks = [];
125
+ for (var t = 0; t < seq.videoTracks.numTracks; t++) {
126
+ var track = seq.videoTracks[t];
127
+ var clips = [];
128
+ for (var c = 0; c < track.clips.numItems; c++) {
129
+ var clip = track.clips[c];
130
+ clips.push({
131
+ nodeId: clip.nodeId,
132
+ name: clip.name,
133
+ start: __ticksToSeconds(clip.start.ticks),
134
+ end: __ticksToSeconds(clip.end.ticks),
135
+ inPoint: __ticksToSeconds(clip.inPoint.ticks),
136
+ outPoint: __ticksToSeconds(clip.outPoint.ticks),
137
+ duration: __ticksToSeconds(clip.duration.ticks)
138
+ });
139
+ }
140
+ videoTracks.push({
141
+ index: t,
142
+ name: track.name,
143
+ numClips: track.clips.numItems,
144
+ clips: clips
145
+ });
146
+ }
147
+
148
+ var audioTracks = [];
149
+ for (var t = 0; t < seq.audioTracks.numTracks; t++) {
150
+ var track = seq.audioTracks[t];
151
+ var clips = [];
152
+ for (var c = 0; c < track.clips.numItems; c++) {
153
+ var clip = track.clips[c];
154
+ clips.push({
155
+ nodeId: clip.nodeId,
156
+ name: clip.name,
157
+ start: __ticksToSeconds(clip.start.ticks),
158
+ end: __ticksToSeconds(clip.end.ticks),
159
+ duration: __ticksToSeconds(clip.duration.ticks)
160
+ });
161
+ }
162
+ audioTracks.push({
163
+ index: t,
164
+ name: track.name,
165
+ numClips: track.clips.numItems,
166
+ clips: clips
167
+ });
168
+ }
169
+
170
+ return __result({
171
+ name: seq.name,
172
+ id: seq.sequenceID,
173
+ frameSizeHorizontal: seq.frameSizeHorizontal,
174
+ frameSizeVertical: seq.frameSizeVertical,
175
+ end: __ticksToSeconds(seq.end),
176
+ videoTracks: videoTracks,
177
+ audioTracks: audioTracks
178
+ });
179
179
  `);
180
180
  return sendCommand(script, bridgeOptions);
181
181
  },
@@ -195,34 +195,34 @@ export function getDiscoveryTools(bridgeOptions) {
195
195
  const seqLookup = args.sequence_id
196
196
  ? `var seq = __findSequence("${escapeForExtendScript(args.sequence_id)}"); if (!seq) return __error("Sequence not found");`
197
197
  : `var seq = app.project.activeSequence; if (!seq) return __error("No active sequence");`;
198
- const script = buildToolScript(`
199
- ${seqLookup}
200
-
201
- var tracks = [];
202
- for (var t = 0; t < seq.videoTracks.numTracks; t++) {
203
- var track = seq.videoTracks[t];
204
- tracks.push({
205
- index: t,
206
- type: "video",
207
- name: track.name,
208
- numClips: track.clips.numItems,
209
- isMuted: __readMaybe(track, "isMuted", false),
210
- isLocked: __readMaybe(track, "isLocked", false)
211
- });
212
- }
213
- for (var t = 0; t < seq.audioTracks.numTracks; t++) {
214
- var track = seq.audioTracks[t];
215
- tracks.push({
216
- index: t,
217
- type: "audio",
218
- name: track.name,
219
- numClips: track.clips.numItems,
220
- isMuted: __readMaybe(track, "isMuted", false),
221
- isLocked: __readMaybe(track, "isLocked", false)
222
- });
223
- }
224
-
225
- return __result(tracks);
198
+ const script = buildToolScript(`
199
+ ${seqLookup}
200
+
201
+ var tracks = [];
202
+ for (var t = 0; t < seq.videoTracks.numTracks; t++) {
203
+ var track = seq.videoTracks[t];
204
+ tracks.push({
205
+ index: t,
206
+ type: "video",
207
+ name: track.name,
208
+ numClips: track.clips.numItems,
209
+ isMuted: __readMaybe(track, "isMuted", false),
210
+ isLocked: __readMaybe(track, "isLocked", false)
211
+ });
212
+ }
213
+ for (var t = 0; t < seq.audioTracks.numTracks; t++) {
214
+ var track = seq.audioTracks[t];
215
+ tracks.push({
216
+ index: t,
217
+ type: "audio",
218
+ name: track.name,
219
+ numClips: track.clips.numItems,
220
+ isMuted: __readMaybe(track, "isMuted", false),
221
+ isLocked: __readMaybe(track, "isLocked", false)
222
+ });
223
+ }
224
+
225
+ return __result(tracks);
226
226
  `);
227
227
  return sendCommand(script, bridgeOptions);
228
228
  },
@@ -240,41 +240,41 @@ export function getDiscoveryTools(bridgeOptions) {
240
240
  required: ["node_id"],
241
241
  },
242
242
  handler: async (args) => {
243
- const script = buildToolScript(`
244
- var result = __findClip("${escapeForExtendScript(args.node_id)}");
245
- if (!result) return __error("Clip not found: ${escapeForExtendScript(args.node_id)}");
246
-
247
- var clip = result.clip;
248
- var props = {
249
- nodeId: clip.nodeId,
250
- name: clip.name,
251
- trackIndex: result.trackIndex,
252
- trackType: result.trackType,
253
- clipIndex: result.clipIndex,
254
- start: __ticksToSeconds(clip.start.ticks),
255
- end: __ticksToSeconds(clip.end.ticks),
256
- inPoint: __ticksToSeconds(clip.inPoint.ticks),
257
- outPoint: __ticksToSeconds(clip.outPoint.ticks),
258
- duration: __ticksToSeconds(clip.duration.ticks),
259
- mediaType: clip.mediaType,
260
- isSelected: __readMaybe(clip, "isSelected", false),
261
- isSpeedReversed: __readMaybe(clip, "isSpeedReversed", false)
262
- };
263
-
264
- try {
265
- if (clip.components) {
266
- var effects = [];
267
- for (var i = 0; i < clip.components.numItems; i++) {
268
- effects.push({
269
- displayName: clip.components[i].displayName,
270
- matchName: clip.components[i].matchName
271
- });
272
- }
273
- props.effects = effects;
274
- }
275
- } catch(e) {}
276
-
277
- return __result(props);
243
+ const script = buildToolScript(`
244
+ var result = __findClip("${escapeForExtendScript(args.node_id)}");
245
+ if (!result) return __error("Clip not found: ${escapeForExtendScript(args.node_id)}");
246
+
247
+ var clip = result.clip;
248
+ var props = {
249
+ nodeId: clip.nodeId,
250
+ name: clip.name,
251
+ trackIndex: result.trackIndex,
252
+ trackType: result.trackType,
253
+ clipIndex: result.clipIndex,
254
+ start: __ticksToSeconds(clip.start.ticks),
255
+ end: __ticksToSeconds(clip.end.ticks),
256
+ inPoint: __ticksToSeconds(clip.inPoint.ticks),
257
+ outPoint: __ticksToSeconds(clip.outPoint.ticks),
258
+ duration: __ticksToSeconds(clip.duration.ticks),
259
+ mediaType: clip.mediaType,
260
+ isSelected: __readMaybe(clip, "isSelected", false),
261
+ isSpeedReversed: __readMaybe(clip, "isSpeedReversed", false)
262
+ };
263
+
264
+ try {
265
+ if (clip.components) {
266
+ var effects = [];
267
+ for (var i = 0; i < clip.components.numItems; i++) {
268
+ effects.push({
269
+ displayName: clip.components[i].displayName,
270
+ matchName: clip.components[i].matchName
271
+ });
272
+ }
273
+ props.effects = effects;
274
+ }
275
+ } catch(e) {}
276
+
277
+ return __result(props);
278
278
  `);
279
279
  return sendCommand(script, bridgeOptions);
280
280
  },
@@ -292,22 +292,22 @@ export function getDiscoveryTools(bridgeOptions) {
292
292
  required: ["name"],
293
293
  },
294
294
  handler: async (args) => {
295
- const script = buildToolScript(`
296
- var item = __findProjectItem("${escapeForExtendScript(args.name)}");
297
- if (!item) return __error("Project item not found: ${escapeForExtendScript(args.name)}");
298
-
299
- var info = {
300
- nodeId: item.nodeId,
301
- name: item.name,
302
- type: (item.type === 1 ? "clip" : item.type === 2 ? "bin" : item.type === 3 ? "root" : item.type === 4 ? "file" : "unknown"),
303
- isSequence: __readMaybe(item, "isSequence", false),
304
- mediaPath: ""
305
- };
306
- try {
307
- if (item.getMediaPath) info.mediaPath = item.getMediaPath();
308
- } catch(e) {}
309
-
310
- return __result(info);
295
+ const script = buildToolScript(`
296
+ var item = __findProjectItem("${escapeForExtendScript(args.name)}");
297
+ if (!item) return __error("Project item not found: ${escapeForExtendScript(args.name)}");
298
+
299
+ var info = {
300
+ nodeId: item.nodeId,
301
+ name: item.name,
302
+ type: (item.type === 1 ? "clip" : item.type === 2 ? "bin" : item.type === 3 ? "root" : item.type === 4 ? "file" : "unknown"),
303
+ isSequence: __readMaybe(item, "isSequence", false),
304
+ mediaPath: ""
305
+ };
306
+ try {
307
+ if (item.getMediaPath) info.mediaPath = item.getMediaPath();
308
+ } catch(e) {}
309
+
310
+ return __result(info);
311
311
  `);
312
312
  return sendCommand(script, bridgeOptions);
313
313
  },
@@ -327,34 +327,34 @@ export function getDiscoveryTools(bridgeOptions) {
327
327
  const seqLookup = args.sequence_id
328
328
  ? `var seq = __findSequence("${escapeForExtendScript(args.sequence_id)}"); if (!seq) return __error("Sequence not found");`
329
329
  : `var seq = app.project.activeSequence; if (!seq) return __error("No active sequence");`;
330
- const script = buildToolScript(`
331
- ${seqLookup}
332
-
333
- var settings = {
334
- name: seq.name,
335
- id: seq.sequenceID,
336
- frameSizeHorizontal: seq.frameSizeHorizontal,
337
- frameSizeVertical: seq.frameSizeVertical,
338
- timebase: seq.timebase,
339
- end: __ticksToSeconds(seq.end),
340
- videoTracks: seq.videoTracks.numTracks,
341
- audioTracks: seq.audioTracks.numTracks
342
- };
343
-
344
- try {
345
- var seqSettings = seq.getSettings();
346
- if (seqSettings) {
347
- settings.audioChannelCount = seqSettings.audioChannelCount;
348
- settings.audioChannelType = seqSettings.audioChannelType;
349
- settings.audioDisplayFormat = seqSettings.audioDisplayFormat;
350
- settings.audioSampleRate = seqSettings.audioSampleRate;
351
- settings.videoDisplayFormat = seqSettings.videoDisplayFormat;
352
- settings.videoFieldType = seqSettings.videoFieldType;
353
- settings.videoFrameRate = seqSettings.videoFrameRate;
354
- }
355
- } catch(e) {}
356
-
357
- return __result(settings);
330
+ const script = buildToolScript(`
331
+ ${seqLookup}
332
+
333
+ var settings = {
334
+ name: seq.name,
335
+ id: seq.sequenceID,
336
+ frameSizeHorizontal: seq.frameSizeHorizontal,
337
+ frameSizeVertical: seq.frameSizeVertical,
338
+ timebase: seq.timebase,
339
+ end: __ticksToSeconds(seq.end),
340
+ videoTracks: seq.videoTracks.numTracks,
341
+ audioTracks: seq.audioTracks.numTracks
342
+ };
343
+
344
+ try {
345
+ var seqSettings = seq.getSettings();
346
+ if (seqSettings) {
347
+ settings.audioChannelCount = seqSettings.audioChannelCount;
348
+ settings.audioChannelType = seqSettings.audioChannelType;
349
+ settings.audioDisplayFormat = seqSettings.audioDisplayFormat;
350
+ settings.audioSampleRate = seqSettings.audioSampleRate;
351
+ settings.videoDisplayFormat = seqSettings.videoDisplayFormat;
352
+ settings.videoFieldType = seqSettings.videoFieldType;
353
+ settings.videoFrameRate = seqSettings.videoFrameRate;
354
+ }
355
+ } catch(e) {}
356
+
357
+ return __result(settings);
358
358
  `);
359
359
  return sendCommand(script, bridgeOptions);
360
360
  },
@@ -363,25 +363,25 @@ export function getDiscoveryTools(bridgeOptions) {
363
363
  description: "Get the currently selected clips in the active sequence",
364
364
  parameters: {},
365
365
  handler: async () => {
366
- const script = buildToolScript(`
367
- var seq = app.project.activeSequence;
368
- if (!seq) return __error("No active sequence");
369
-
370
- var selection = seq.getSelection();
371
- var clips = [];
372
- for (var i = 0; i < selection.length; i++) {
373
- var clip = selection[i];
374
- clips.push({
375
- nodeId: clip.nodeId,
376
- name: clip.name,
377
- start: __ticksToSeconds(clip.start.ticks),
378
- end: __ticksToSeconds(clip.end.ticks),
379
- duration: __ticksToSeconds(clip.duration.ticks),
380
- mediaType: clip.mediaType
381
- });
382
- }
383
-
384
- return __result(clips);
366
+ const script = buildToolScript(`
367
+ var seq = app.project.activeSequence;
368
+ if (!seq) return __error("No active sequence");
369
+
370
+ var selection = seq.getSelection();
371
+ var clips = [];
372
+ for (var i = 0; i < selection.length; i++) {
373
+ var clip = selection[i];
374
+ clips.push({
375
+ nodeId: clip.nodeId,
376
+ name: clip.name,
377
+ start: __ticksToSeconds(clip.start.ticks),
378
+ end: __ticksToSeconds(clip.end.ticks),
379
+ duration: __ticksToSeconds(clip.duration.ticks),
380
+ mediaType: clip.mediaType
381
+ });
382
+ }
383
+
384
+ return __result(clips);
385
385
  `);
386
386
  return sendCommand(script, bridgeOptions);
387
387
  },
@@ -408,34 +408,34 @@ export function getDiscoveryTools(bridgeOptions) {
408
408
  required: ["time_seconds", "track_index", "track_type"],
409
409
  },
410
410
  handler: async (args) => {
411
- const script = buildToolScript(`
412
- var seq = app.project.activeSequence;
413
- if (!seq) return __error("No active sequence");
414
-
415
- var tracks = ${args.track_type === "video" ? "seq.videoTracks" : "seq.audioTracks"};
416
- if (${args.track_index} >= tracks.numTracks) return __error("Track index out of range");
417
-
418
- var track = tracks[${args.track_index}];
419
- var targetTicks = __secondsToTicks(${args.time_seconds});
420
-
421
- for (var c = 0; c < track.clips.numItems; c++) {
422
- var clip = track.clips[c];
423
- var startTicks = parseFloat(clip.start.ticks);
424
- var endTicks = parseFloat(clip.end.ticks);
425
- if (targetTicks >= startTicks && targetTicks < endTicks) {
426
- return __result({
427
- nodeId: clip.nodeId,
428
- name: clip.name,
429
- trackIndex: ${args.track_index},
430
- trackType: "${args.track_type}",
431
- start: __ticksToSeconds(clip.start.ticks),
432
- end: __ticksToSeconds(clip.end.ticks),
433
- duration: __ticksToSeconds(clip.duration.ticks)
434
- });
435
- }
436
- }
437
-
438
- return __error("No clip found at position " + ${args.time_seconds} + "s on ${args.track_type} track " + ${args.track_index});
411
+ const script = buildToolScript(`
412
+ var seq = app.project.activeSequence;
413
+ if (!seq) return __error("No active sequence");
414
+
415
+ var tracks = ${args.track_type === "video" ? "seq.videoTracks" : "seq.audioTracks"};
416
+ if (${args.track_index} >= tracks.numTracks) return __error("Track index out of range");
417
+
418
+ var track = tracks[${args.track_index}];
419
+ var targetTicks = __secondsToTicks(${args.time_seconds});
420
+
421
+ for (var c = 0; c < track.clips.numItems; c++) {
422
+ var clip = track.clips[c];
423
+ var startTicks = parseFloat(clip.start.ticks);
424
+ var endTicks = parseFloat(clip.end.ticks);
425
+ if (targetTicks >= startTicks && targetTicks < endTicks) {
426
+ return __result({
427
+ nodeId: clip.nodeId,
428
+ name: clip.name,
429
+ trackIndex: ${args.track_index},
430
+ trackType: "${args.track_type}",
431
+ start: __ticksToSeconds(clip.start.ticks),
432
+ end: __ticksToSeconds(clip.end.ticks),
433
+ duration: __ticksToSeconds(clip.duration.ticks)
434
+ });
435
+ }
436
+ }
437
+
438
+ return __error("No clip found at position " + ${args.time_seconds} + "s on ${args.track_type} track " + ${args.track_index});
439
439
  `);
440
440
  return sendCommand(script, bridgeOptions);
441
441
  },