@tmhs/screencast-mcp 0.39.0 → 0.44.2

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 (332) hide show
  1. package/README.md +58 -14
  2. package/assets/icon.png +0 -0
  3. package/assets/ui/player.html +38 -302
  4. package/assets/ui/player.js +382 -0
  5. package/dist/context.js +0 -5
  6. package/dist/index.js +5 -21
  7. package/dist/prompts.js +0 -7
  8. package/dist/resources.js +2 -14
  9. package/dist/server.js +37 -11
  10. package/dist/tools/assembleHighlights.js +12 -7
  11. package/dist/tools/burnSubtitles.js +12 -6
  12. package/dist/tools/callout.js +32 -16
  13. package/dist/tools/clip.js +12 -9
  14. package/dist/tools/compress.js +10 -5
  15. package/dist/tools/concat.js +16 -15
  16. package/dist/tools/contactSheet.js +26 -22
  17. package/dist/tools/convert.js +12 -6
  18. package/dist/tools/crop.js +12 -7
  19. package/dist/tools/cutIdle.js +15 -9
  20. package/dist/tools/denoise.js +12 -6
  21. package/dist/tools/doctor.js +133 -0
  22. package/dist/tools/exportGif.js +14 -10
  23. package/dist/tools/exportPreset.js +11 -8
  24. package/dist/tools/extractAudio.js +10 -8
  25. package/dist/tools/findText.js +69 -65
  26. package/dist/tools/getMediaInfo.js +17 -3
  27. package/dist/tools/getSession.js +15 -3
  28. package/dist/tools/listAudioDevices.js +14 -7
  29. package/dist/tools/listSessions.js +13 -3
  30. package/dist/tools/listTargets.js +76 -0
  31. package/dist/tools/musicBed.js +14 -10
  32. package/dist/tools/normalizeAudio.js +12 -8
  33. package/dist/tools/overlay.js +16 -12
  34. package/dist/tools/pipeline.js +31 -22
  35. package/dist/tools/readEvents.js +21 -12
  36. package/dist/tools/redactRegion.js +19 -17
  37. package/dist/tools/reframe.js +9 -5
  38. package/dist/tools/reviewRecording.js +63 -22
  39. package/dist/tools/sampleFrames.js +33 -40
  40. package/dist/tools/scale.js +9 -3
  41. package/dist/tools/screenDiff.js +23 -17
  42. package/dist/tools/screenshot.js +21 -17
  43. package/dist/tools/speed.js +15 -4
  44. package/dist/tools/startRecording.js +48 -52
  45. package/dist/tools/stopRecording.js +10 -9
  46. package/dist/tools/titleCard.js +19 -11
  47. package/dist/tools/transcribe.js +13 -7
  48. package/dist/tools/trim.js +11 -10
  49. package/dist/tools/waitForChange.js +37 -22
  50. package/dist/tools/xfadeTransition.js +12 -8
  51. package/dist/tools/zoom.js +26 -29
  52. package/dist/utils/anim.js +1 -21
  53. package/dist/utils/animExport.js +5 -10
  54. package/dist/utils/audio.js +4 -33
  55. package/dist/utils/audioDevices.js +1 -48
  56. package/dist/utils/callout.js +1 -19
  57. package/dist/utils/calloutAssets.js +21 -11
  58. package/dist/utils/capabilities.js +95 -0
  59. package/dist/utils/captions.js +9 -26
  60. package/dist/utils/consent.js +29 -0
  61. package/dist/utils/diff.js +0 -46
  62. package/dist/utils/errors.js +5 -13
  63. package/dist/utils/events.js +21 -77
  64. package/dist/utils/expr.js +11 -0
  65. package/dist/utils/ffmpeg.js +119 -48
  66. package/dist/utils/fontCoverage.js +177 -0
  67. package/dist/utils/fonts.js +139 -23
  68. package/dist/utils/idle.js +12 -24
  69. package/dist/utils/images.js +0 -17
  70. package/dist/utils/jobs.js +42 -41
  71. package/dist/utils/lifecycle.js +0 -29
  72. package/dist/utils/logging.js +75 -0
  73. package/dist/utils/media.js +11 -122
  74. package/dist/utils/monitors.js +7 -43
  75. package/dist/utils/ocr.js +53 -71
  76. package/dist/utils/paths.js +68 -31
  77. package/dist/utils/pipeline.js +0 -23
  78. package/dist/utils/player.js +50 -27
  79. package/dist/utils/produce.js +6 -66
  80. package/dist/utils/resolveTarget.js +0 -19
  81. package/dist/utils/retention.js +1 -15
  82. package/dist/utils/roots.js +42 -0
  83. package/dist/utils/sessions.js +195 -160
  84. package/dist/utils/sheet.js +0 -19
  85. package/dist/utils/still.js +0 -15
  86. package/dist/utils/targetList.js +63 -0
  87. package/dist/utils/targets.js +5 -70
  88. package/dist/utils/toolSpec.js +25 -0
  89. package/dist/utils/toolsets.js +102 -0
  90. package/dist/utils/validate.js +0 -22
  91. package/dist/utils/wgc.js +0 -46
  92. package/dist/utils/windows.js +5 -50
  93. package/dist/utils/zoom.js +55 -85
  94. package/dist/wgcRecorder.js +1 -30
  95. package/package.json +7 -3
  96. package/dist/context.d.ts +0 -9
  97. package/dist/context.d.ts.map +0 -1
  98. package/dist/context.js.map +0 -1
  99. package/dist/index.d.ts +0 -3
  100. package/dist/index.d.ts.map +0 -1
  101. package/dist/index.js.map +0 -1
  102. package/dist/prompts.d.ts +0 -10
  103. package/dist/prompts.d.ts.map +0 -1
  104. package/dist/prompts.js.map +0 -1
  105. package/dist/resources.d.ts +0 -3
  106. package/dist/resources.d.ts.map +0 -1
  107. package/dist/resources.js.map +0 -1
  108. package/dist/server.d.ts +0 -3
  109. package/dist/server.d.ts.map +0 -1
  110. package/dist/server.js.map +0 -1
  111. package/dist/tools/assembleHighlights.d.ts +0 -3
  112. package/dist/tools/assembleHighlights.d.ts.map +0 -1
  113. package/dist/tools/assembleHighlights.js.map +0 -1
  114. package/dist/tools/burnSubtitles.d.ts +0 -3
  115. package/dist/tools/burnSubtitles.d.ts.map +0 -1
  116. package/dist/tools/burnSubtitles.js.map +0 -1
  117. package/dist/tools/callout.d.ts +0 -37
  118. package/dist/tools/callout.d.ts.map +0 -1
  119. package/dist/tools/callout.js.map +0 -1
  120. package/dist/tools/clip.d.ts +0 -3
  121. package/dist/tools/clip.d.ts.map +0 -1
  122. package/dist/tools/clip.js.map +0 -1
  123. package/dist/tools/compress.d.ts +0 -3
  124. package/dist/tools/compress.d.ts.map +0 -1
  125. package/dist/tools/compress.js.map +0 -1
  126. package/dist/tools/concat.d.ts +0 -3
  127. package/dist/tools/concat.d.ts.map +0 -1
  128. package/dist/tools/concat.js.map +0 -1
  129. package/dist/tools/contactSheet.d.ts +0 -3
  130. package/dist/tools/contactSheet.d.ts.map +0 -1
  131. package/dist/tools/contactSheet.js.map +0 -1
  132. package/dist/tools/convert.d.ts +0 -3
  133. package/dist/tools/convert.d.ts.map +0 -1
  134. package/dist/tools/convert.js.map +0 -1
  135. package/dist/tools/crop.d.ts +0 -3
  136. package/dist/tools/crop.d.ts.map +0 -1
  137. package/dist/tools/crop.js.map +0 -1
  138. package/dist/tools/cutIdle.d.ts +0 -3
  139. package/dist/tools/cutIdle.d.ts.map +0 -1
  140. package/dist/tools/cutIdle.js.map +0 -1
  141. package/dist/tools/denoise.d.ts +0 -3
  142. package/dist/tools/denoise.d.ts.map +0 -1
  143. package/dist/tools/denoise.js.map +0 -1
  144. package/dist/tools/exportGif.d.ts +0 -3
  145. package/dist/tools/exportGif.d.ts.map +0 -1
  146. package/dist/tools/exportGif.js.map +0 -1
  147. package/dist/tools/exportPreset.d.ts +0 -3
  148. package/dist/tools/exportPreset.d.ts.map +0 -1
  149. package/dist/tools/exportPreset.js.map +0 -1
  150. package/dist/tools/extractAudio.d.ts +0 -3
  151. package/dist/tools/extractAudio.d.ts.map +0 -1
  152. package/dist/tools/extractAudio.js.map +0 -1
  153. package/dist/tools/findText.d.ts +0 -6
  154. package/dist/tools/findText.d.ts.map +0 -1
  155. package/dist/tools/findText.js.map +0 -1
  156. package/dist/tools/getMediaInfo.d.ts +0 -3
  157. package/dist/tools/getMediaInfo.d.ts.map +0 -1
  158. package/dist/tools/getMediaInfo.js.map +0 -1
  159. package/dist/tools/getSession.d.ts +0 -3
  160. package/dist/tools/getSession.d.ts.map +0 -1
  161. package/dist/tools/getSession.js.map +0 -1
  162. package/dist/tools/listAudioDevices.d.ts +0 -3
  163. package/dist/tools/listAudioDevices.d.ts.map +0 -1
  164. package/dist/tools/listAudioDevices.js.map +0 -1
  165. package/dist/tools/listSessions.d.ts +0 -3
  166. package/dist/tools/listSessions.d.ts.map +0 -1
  167. package/dist/tools/listSessions.js.map +0 -1
  168. package/dist/tools/musicBed.d.ts +0 -3
  169. package/dist/tools/musicBed.d.ts.map +0 -1
  170. package/dist/tools/musicBed.js.map +0 -1
  171. package/dist/tools/normalizeAudio.d.ts +0 -3
  172. package/dist/tools/normalizeAudio.d.ts.map +0 -1
  173. package/dist/tools/normalizeAudio.js.map +0 -1
  174. package/dist/tools/overlay.d.ts +0 -3
  175. package/dist/tools/overlay.d.ts.map +0 -1
  176. package/dist/tools/overlay.js.map +0 -1
  177. package/dist/tools/pipeline.d.ts +0 -3
  178. package/dist/tools/pipeline.d.ts.map +0 -1
  179. package/dist/tools/pipeline.js.map +0 -1
  180. package/dist/tools/readEvents.d.ts +0 -6
  181. package/dist/tools/readEvents.d.ts.map +0 -1
  182. package/dist/tools/readEvents.js.map +0 -1
  183. package/dist/tools/redactRegion.d.ts +0 -13
  184. package/dist/tools/redactRegion.d.ts.map +0 -1
  185. package/dist/tools/redactRegion.js.map +0 -1
  186. package/dist/tools/reframe.d.ts +0 -3
  187. package/dist/tools/reframe.d.ts.map +0 -1
  188. package/dist/tools/reframe.js.map +0 -1
  189. package/dist/tools/reviewRecording.d.ts +0 -5
  190. package/dist/tools/reviewRecording.d.ts.map +0 -1
  191. package/dist/tools/reviewRecording.js.map +0 -1
  192. package/dist/tools/sampleFrames.d.ts +0 -3
  193. package/dist/tools/sampleFrames.d.ts.map +0 -1
  194. package/dist/tools/sampleFrames.js.map +0 -1
  195. package/dist/tools/scale.d.ts +0 -3
  196. package/dist/tools/scale.d.ts.map +0 -1
  197. package/dist/tools/scale.js.map +0 -1
  198. package/dist/tools/screenDiff.d.ts +0 -3
  199. package/dist/tools/screenDiff.d.ts.map +0 -1
  200. package/dist/tools/screenDiff.js.map +0 -1
  201. package/dist/tools/screenshot.d.ts +0 -3
  202. package/dist/tools/screenshot.d.ts.map +0 -1
  203. package/dist/tools/screenshot.js.map +0 -1
  204. package/dist/tools/speed.d.ts +0 -3
  205. package/dist/tools/speed.d.ts.map +0 -1
  206. package/dist/tools/speed.js.map +0 -1
  207. package/dist/tools/startRecording.d.ts +0 -3
  208. package/dist/tools/startRecording.d.ts.map +0 -1
  209. package/dist/tools/startRecording.js.map +0 -1
  210. package/dist/tools/stopRecording.d.ts +0 -3
  211. package/dist/tools/stopRecording.d.ts.map +0 -1
  212. package/dist/tools/stopRecording.js.map +0 -1
  213. package/dist/tools/titleCard.d.ts +0 -3
  214. package/dist/tools/titleCard.d.ts.map +0 -1
  215. package/dist/tools/titleCard.js.map +0 -1
  216. package/dist/tools/transcribe.d.ts +0 -3
  217. package/dist/tools/transcribe.d.ts.map +0 -1
  218. package/dist/tools/transcribe.js.map +0 -1
  219. package/dist/tools/trim.d.ts +0 -3
  220. package/dist/tools/trim.d.ts.map +0 -1
  221. package/dist/tools/trim.js.map +0 -1
  222. package/dist/tools/waitForChange.d.ts +0 -3
  223. package/dist/tools/waitForChange.d.ts.map +0 -1
  224. package/dist/tools/waitForChange.js.map +0 -1
  225. package/dist/tools/xfadeTransition.d.ts +0 -3
  226. package/dist/tools/xfadeTransition.d.ts.map +0 -1
  227. package/dist/tools/xfadeTransition.js.map +0 -1
  228. package/dist/tools/zoom.d.ts +0 -15
  229. package/dist/tools/zoom.d.ts.map +0 -1
  230. package/dist/tools/zoom.js.map +0 -1
  231. package/dist/utils/anim.d.ts +0 -33
  232. package/dist/utils/anim.d.ts.map +0 -1
  233. package/dist/utils/anim.js.map +0 -1
  234. package/dist/utils/animExport.d.ts +0 -27
  235. package/dist/utils/animExport.d.ts.map +0 -1
  236. package/dist/utils/animExport.js.map +0 -1
  237. package/dist/utils/audio.d.ts +0 -49
  238. package/dist/utils/audio.d.ts.map +0 -1
  239. package/dist/utils/audio.js.map +0 -1
  240. package/dist/utils/audioDevices.d.ts +0 -33
  241. package/dist/utils/audioDevices.d.ts.map +0 -1
  242. package/dist/utils/audioDevices.js.map +0 -1
  243. package/dist/utils/callout.d.ts +0 -72
  244. package/dist/utils/callout.d.ts.map +0 -1
  245. package/dist/utils/callout.js.map +0 -1
  246. package/dist/utils/calloutAssets.d.ts +0 -3
  247. package/dist/utils/calloutAssets.d.ts.map +0 -1
  248. package/dist/utils/calloutAssets.js.map +0 -1
  249. package/dist/utils/captions.d.ts +0 -26
  250. package/dist/utils/captions.d.ts.map +0 -1
  251. package/dist/utils/captions.js.map +0 -1
  252. package/dist/utils/diff.d.ts +0 -112
  253. package/dist/utils/diff.d.ts.map +0 -1
  254. package/dist/utils/diff.js.map +0 -1
  255. package/dist/utils/errors.d.ts +0 -33
  256. package/dist/utils/errors.d.ts.map +0 -1
  257. package/dist/utils/errors.js.map +0 -1
  258. package/dist/utils/events.d.ts +0 -143
  259. package/dist/utils/events.d.ts.map +0 -1
  260. package/dist/utils/events.js.map +0 -1
  261. package/dist/utils/ffmpeg.d.ts +0 -50
  262. package/dist/utils/ffmpeg.d.ts.map +0 -1
  263. package/dist/utils/ffmpeg.js.map +0 -1
  264. package/dist/utils/fonts.d.ts +0 -17
  265. package/dist/utils/fonts.d.ts.map +0 -1
  266. package/dist/utils/fonts.js.map +0 -1
  267. package/dist/utils/idle.d.ts +0 -23
  268. package/dist/utils/idle.d.ts.map +0 -1
  269. package/dist/utils/idle.js.map +0 -1
  270. package/dist/utils/images.d.ts +0 -21
  271. package/dist/utils/images.d.ts.map +0 -1
  272. package/dist/utils/images.js.map +0 -1
  273. package/dist/utils/jobs.d.ts +0 -44
  274. package/dist/utils/jobs.d.ts.map +0 -1
  275. package/dist/utils/jobs.js.map +0 -1
  276. package/dist/utils/lifecycle.d.ts +0 -29
  277. package/dist/utils/lifecycle.d.ts.map +0 -1
  278. package/dist/utils/lifecycle.js.map +0 -1
  279. package/dist/utils/media.d.ts +0 -272
  280. package/dist/utils/media.d.ts.map +0 -1
  281. package/dist/utils/media.js.map +0 -1
  282. package/dist/utils/monitors.d.ts +0 -47
  283. package/dist/utils/monitors.d.ts.map +0 -1
  284. package/dist/utils/monitors.js.map +0 -1
  285. package/dist/utils/ocr.d.ts +0 -50
  286. package/dist/utils/ocr.d.ts.map +0 -1
  287. package/dist/utils/ocr.js.map +0 -1
  288. package/dist/utils/paths.d.ts +0 -28
  289. package/dist/utils/paths.d.ts.map +0 -1
  290. package/dist/utils/paths.js.map +0 -1
  291. package/dist/utils/pipeline.d.ts +0 -69
  292. package/dist/utils/pipeline.d.ts.map +0 -1
  293. package/dist/utils/pipeline.js.map +0 -1
  294. package/dist/utils/player.d.ts +0 -30
  295. package/dist/utils/player.d.ts.map +0 -1
  296. package/dist/utils/player.js.map +0 -1
  297. package/dist/utils/produce.d.ts +0 -126
  298. package/dist/utils/produce.d.ts.map +0 -1
  299. package/dist/utils/produce.js.map +0 -1
  300. package/dist/utils/resolveTarget.d.ts +0 -32
  301. package/dist/utils/resolveTarget.d.ts.map +0 -1
  302. package/dist/utils/resolveTarget.js.map +0 -1
  303. package/dist/utils/retention.d.ts +0 -10
  304. package/dist/utils/retention.d.ts.map +0 -1
  305. package/dist/utils/retention.js.map +0 -1
  306. package/dist/utils/sessions.d.ts +0 -154
  307. package/dist/utils/sessions.d.ts.map +0 -1
  308. package/dist/utils/sessions.js.map +0 -1
  309. package/dist/utils/sheet.d.ts +0 -26
  310. package/dist/utils/sheet.d.ts.map +0 -1
  311. package/dist/utils/sheet.js.map +0 -1
  312. package/dist/utils/still.d.ts +0 -7
  313. package/dist/utils/still.d.ts.map +0 -1
  314. package/dist/utils/still.js.map +0 -1
  315. package/dist/utils/targets.d.ts +0 -113
  316. package/dist/utils/targets.d.ts.map +0 -1
  317. package/dist/utils/targets.js.map +0 -1
  318. package/dist/utils/validate.d.ts +0 -15
  319. package/dist/utils/validate.d.ts.map +0 -1
  320. package/dist/utils/validate.js.map +0 -1
  321. package/dist/utils/wgc.d.ts +0 -46
  322. package/dist/utils/wgc.d.ts.map +0 -1
  323. package/dist/utils/wgc.js.map +0 -1
  324. package/dist/utils/windows.d.ts +0 -94
  325. package/dist/utils/windows.d.ts.map +0 -1
  326. package/dist/utils/windows.js.map +0 -1
  327. package/dist/utils/zoom.d.ts +0 -95
  328. package/dist/utils/zoom.d.ts.map +0 -1
  329. package/dist/utils/zoom.js.map +0 -1
  330. package/dist/wgcRecorder.d.ts +0 -2
  331. package/dist/wgcRecorder.d.ts.map +0 -1
  332. package/dist/wgcRecorder.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { existsSync } from "node:fs";
3
3
  import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
4
+ import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
4
5
  import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
5
6
  import { runEditJob } from "../utils/jobs.js";
6
7
  import { buildAssembleArgs, clipLength, DEFAULT_TRANSITION_DUR } from "../utils/produce.js";
@@ -9,16 +10,16 @@ const inputSchema = {
9
10
  clips: z
10
11
  .array(z.string().min(1))
11
12
  .min(2)
12
- .describe("Two or more clip paths, in order. Clips are auto-normalized, so they need not match."),
13
+ .describe("Clip paths, in order."),
13
14
  transition: z
14
15
  .string()
15
16
  .optional()
16
- .describe("'cut' (default, hard cuts) or an xfade transition name (fade, wipeleft, slideup, ...)."),
17
+ .describe("cut (default) or an xfade name (fade, wipeleft, slideup, ...)."),
17
18
  duration: z
18
19
  .number()
19
20
  .positive()
20
21
  .optional()
21
- .describe(`Transition length in seconds when not a cut (default ${DEFAULT_TRANSITION_DUR}).`),
22
+ .describe(`Transition seconds (default ${DEFAULT_TRANSITION_DUR}).`),
22
23
  width: z.number().int().positive().optional().describe("Common output width (default 1920)."),
23
24
  height: z.number().int().positive().optional().describe("Common output height (default 1080)."),
24
25
  fps: z.number().int().positive().optional().describe("Common output fps (default 30)."),
@@ -26,9 +27,14 @@ const inputSchema = {
26
27
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
27
28
  };
28
29
  export function register(server) {
29
- server.tool("assemble_highlights", "Stitch two or more clips into a single video, with hard cuts or an xfade " +
30
- "transition between each. Clips are auto-normalized to a common " +
31
- "resolution, fps, and audio rate, so they need not match.", inputSchema, async (args, extra) => {
30
+ server.registerTool("assemble_highlights", {
31
+ title: "Assemble Highlights",
32
+ description: "Stitch clips (including title cards) into one video with cuts or xfade transitions; they " +
33
+ "need not match in size, fps, or audio.",
34
+ inputSchema,
35
+ outputSchema: OUTPUT_PATH,
36
+ annotations: WRITES_FILE,
37
+ }, async (args, extra) => {
32
38
  try {
33
39
  requireFfmpeg();
34
40
  for (const f of args.clips) {
@@ -59,4 +65,3 @@ export function register(server) {
59
65
  }
60
66
  });
61
67
  }
62
- //# sourceMappingURL=assembleHighlights.js.map
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { dirname } from "node:path";
3
3
  import { existsSync } from "node:fs";
4
4
  import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
5
+ import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
5
6
  import { requireFfmpeg, probeMedia, hasFilter } from "../utils/ffmpeg.js";
6
7
  import { runEditJob } from "../utils/jobs.js";
7
8
  import { buildBurnSubtitlesArgs } from "../utils/captions.js";
@@ -14,13 +15,19 @@ const inputSchema = {
14
15
  style: z
15
16
  .enum(["clean", "social"])
16
17
  .optional()
17
- .describe("'clean' (default): a modest outlined line. 'social': large bold text on a dark box, for muted autoplay."),
18
+ .describe("clean (default for .srt): outlined line. social: big bold text on a dark box. .ass keeps its own " +
19
+ "styling unless set."),
18
20
  output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
19
21
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
20
22
  };
21
23
  export function register(server) {
22
- server.tool("burn_subtitles", "Burn subtitles (an SRT from transcribe, or any SRT/ASS) permanently into a video, in " +
23
- "the bundled font, in a clean or social-media style. Returns the output path.", inputSchema, async (args, extra) => {
24
+ server.registerTool("burn_subtitles", {
25
+ title: "Burn In Subtitles",
26
+ description: "Burn SRT/ASS subtitles (e.g. from transcribe) into a video in the bundled font.",
27
+ inputSchema,
28
+ outputSchema: OUTPUT_PATH,
29
+ annotations: WRITES_FILE,
30
+ }, async (args, extra) => {
24
31
  try {
25
32
  requireFfmpeg();
26
33
  for (const f of [args.input, args.subtitles]) {
@@ -34,17 +41,16 @@ export function register(server) {
34
41
  const ext = editOutputExt(args.input);
35
42
  const output = resolveOutput(args.output, subdir("edits"), `subtitled-${stamp()}-${rand()}${ext}`, args.overwrite);
36
43
  const fontsDir = dirname(bundledFontPath("regular"));
37
- const style = args.style ?? "clean";
44
+ const style = args.style ?? (/\.(ass|ssa)$/i.test(args.subtitles) ? null : "clean");
38
45
  await runEditJob(buildBurnSubtitlesArgs(args.input, args.subtitles, output, fontsDir, style), {
39
46
  output,
40
47
  durationSec: (await probeMedia(args.input)).durationSec,
41
48
  extra,
42
49
  });
43
- return okResponse({ outputPath: output, style });
50
+ return okResponse({ outputPath: output, style: style ?? "file" });
44
51
  }
45
52
  catch (error) {
46
53
  return errorResponse(error);
47
54
  }
48
55
  });
49
56
  }
50
- //# sourceMappingURL=burnSubtitles.js.map
@@ -3,6 +3,7 @@ import { join } from "node:path";
3
3
  import { existsSync, mkdtempSync, rmSync } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
5
  import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
6
+ import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
6
7
  import { requireFfmpeg } from "../utils/ffmpeg.js";
7
8
  import { runEditJob, probeDuration } from "../utils/jobs.js";
8
9
  import { buildCalloutArgs } from "../utils/callout.js";
@@ -10,11 +11,16 @@ import { prepareCalloutAssets } from "../utils/calloutAssets.js";
10
11
  import { editOutputExt, assertEditContainer } from "../utils/media.js";
11
12
  import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
12
13
  const timing = {
13
- from: z.number().nonnegative().optional().describe("Show from this second (default: start)."),
14
- to: z.number().positive().optional().describe("Hide after this second (default: end)."),
15
- color: z.string().optional().describe("Color name, #RRGGBB, or name@alpha."),
14
+ from: z.number().nonnegative().optional(),
15
+ to: z.number().positive().optional(),
16
+ color: z.string().optional(),
16
17
  };
17
- /** One callout; shared with pipeline. */
18
+ export const fontFileSchema = z
19
+ .string()
20
+ .min(1)
21
+ .optional()
22
+ .describe("Font: a .ttf/.otf/.ttc path or a C:\\Windows\\Fonts file name. Default: bundled Inter, with a " +
23
+ "covering system font for scripts it lacks (CJK, emoji, Arabic, ...).");
18
24
  export const calloutItemSchema = z.discriminatedUnion("type", [
19
25
  z.object({
20
26
  type: z.literal("box"),
@@ -37,10 +43,10 @@ export const calloutItemSchema = z.discriminatedUnion("type", [
37
43
  }),
38
44
  z.object({
39
45
  type: z.literal("arrow"),
40
- x1: z.number().describe("Tail x."),
41
- y1: z.number().describe("Tail y."),
42
- x2: z.number().describe("Head x: the point the arrow points at."),
43
- y2: z.number().describe("Head y."),
46
+ x1: z.number(),
47
+ y1: z.number(),
48
+ x2: z.number().describe("Head (x2,y2) is the point the arrow points at."),
49
+ y2: z.number(),
44
50
  thickness: z.number().positive().optional().describe("Shaft px (default 8)."),
45
51
  ...timing,
46
52
  }),
@@ -51,14 +57,21 @@ const inputSchema = {
51
57
  .array(calloutItemSchema)
52
58
  .min(1)
53
59
  .max(50)
54
- .describe("Annotations, drawn in order (later on top). Each is a box, a text label, or an arrow, " +
55
- "shown between from and to (seconds). Coordinates are video pixels."),
60
+ .describe("Boxes, text labels, and arrows, drawn in order (later on top), in video pixels. Each shows " +
61
+ "from..to seconds (default: whole video); color is a name, #RRGGBB, or name@alpha."),
62
+ fontFile: fontFileSchema,
56
63
  output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
57
64
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
58
65
  };
59
66
  export function register(server) {
60
- server.tool("callout", "Annotate a video with timed boxes, text labels, and arrows (e.g. 'click here', a box " +
61
- "around the bug), each shown between two timestamps. Returns the output path.", inputSchema, async (args, extra) => {
67
+ server.registerTool("callout", {
68
+ title: "Add Callouts",
69
+ description: "Annotate a video with timed boxes, text labels, and arrows. Fallback fonts used are listed in " +
70
+ "fallbackFonts; characters no font covers are reported in warnings.",
71
+ inputSchema,
72
+ outputSchema: OUTPUT_PATH,
73
+ annotations: WRITES_FILE,
74
+ }, async (args, extra) => {
62
75
  try {
63
76
  requireFfmpeg();
64
77
  if (!existsSync(args.input)) {
@@ -68,21 +81,24 @@ export function register(server) {
68
81
  assertEditContainer(args.output);
69
82
  const ext = editOutputExt(args.input);
70
83
  const output = resolveOutput(args.output, subdir("edits"), `callout-${stamp()}-${rand()}${ext}`, args.overwrite);
71
- // Text files and rendered arrows live in a private temp dir.
72
84
  const work = mkdtempSync(join(tmpdir(), "screencast-callout-"));
73
85
  try {
74
- const assets = await prepareCalloutAssets(items, work);
86
+ const assets = await prepareCalloutAssets(items, work, "", args.fontFile);
75
87
  const ffArgs = buildCalloutArgs(args.input, output, items, assets);
76
88
  await runEditJob(ffArgs, { output, durationSec: await probeDuration(args.input), extra });
89
+ return okResponse({
90
+ outputPath: output,
91
+ callouts: items.length,
92
+ ...(assets.fallbackFonts.length > 0 && { fallbackFonts: assets.fallbackFonts }),
93
+ ...(assets.warnings.length > 0 && { warnings: assets.warnings }),
94
+ });
77
95
  }
78
96
  finally {
79
97
  rmSync(work, { recursive: true, force: true });
80
98
  }
81
- return okResponse({ outputPath: output, callouts: items.length });
82
99
  }
83
100
  catch (error) {
84
101
  return errorResponse(error);
85
102
  }
86
103
  });
87
104
  }
88
- //# sourceMappingURL=callout.js.map
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { existsSync } from "node:fs";
3
3
  import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
4
+ import { WRITES_FILE, looseOutput } from "../utils/toolSpec.js";
4
5
  import { requireFfmpeg } from "../utils/ffmpeg.js";
5
6
  import { runEditJob } from "../utils/jobs.js";
6
7
  import { buildClipArgs, editOutputExt, assertEditContainer } from "../utils/media.js";
@@ -9,11 +10,11 @@ const inputSchema = {
9
10
  input: z.string().min(1).describe("Path to the source video."),
10
11
  segments: z
11
12
  .array(z.object({
12
- start: z.number().nonnegative().describe("Segment start in seconds."),
13
- end: z.number().positive().describe("Segment end in seconds."),
13
+ start: z.number().nonnegative(),
14
+ end: z.number().positive(),
14
15
  }))
15
16
  .min(1)
16
- .describe("One or more {start, end} segments. Each becomes its own output file."),
17
+ .describe("{start, end} segments in seconds; each becomes its own file."),
17
18
  output: z
18
19
  .string()
19
20
  .optional()
@@ -21,9 +22,13 @@ const inputSchema = {
21
22
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
22
23
  };
23
24
  export function register(server) {
24
- server.tool("clip", "Extract one or more frame-accurate sub-segments to separate files. Unlike " +
25
- "trim (fast stream copy that snaps to a keyframe), clip re-encodes so cuts " +
26
- "land exactly on the given times.", inputSchema, async (args, extra) => {
25
+ server.registerTool("clip", {
26
+ title: "Extract Clips",
27
+ description: "Extract several frame-exact segments, each to its own file. For one segment, trim does the same.",
28
+ inputSchema,
29
+ outputSchema: looseOutput({ outputs: z.array(z.string()), count: z.number().int() }),
30
+ annotations: WRITES_FILE,
31
+ }, async (args, extra) => {
27
32
  try {
28
33
  requireFfmpeg();
29
34
  if (!existsSync(args.input)) {
@@ -33,8 +38,7 @@ export function register(server) {
33
38
  const ext = editOutputExt(args.input);
34
39
  const single = args.segments.length === 1;
35
40
  const outputs = [];
36
- for (let i = 0; i < args.segments.length; i++) {
37
- const seg = args.segments[i];
41
+ for (const [i, seg] of args.segments.entries()) {
38
42
  const output = resolveOutput(single ? args.output : undefined, subdir("edits"), `clip-${stamp()}-${rand()}-${String(i).padStart(2, "0")}${ext}`, args.overwrite);
39
43
  await runEditJob(buildClipArgs(args.input, output, seg), { output, durationSec: seg.end - seg.start, extra });
40
44
  outputs.push(output);
@@ -46,4 +50,3 @@ export function register(server) {
46
50
  }
47
51
  });
48
52
  }
49
- //# sourceMappingURL=clip.js.map
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { existsSync } from "node:fs";
3
3
  import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
4
+ import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
4
5
  import { requireFfmpeg } from "../utils/ffmpeg.js";
5
6
  import { runEditJob, probeDuration } from "../utils/jobs.js";
6
7
  import { buildCompressArgs, editOutputExt, assertEditContainer } from "../utils/media.js";
@@ -10,19 +11,24 @@ const inputSchema = {
10
11
  level: z
11
12
  .enum(["light", "medium", "heavy"])
12
13
  .optional()
13
- .describe("How hard to compress (CRF 23 / 28 / 32). Default medium."),
14
+ .describe("CRF 23 / 28 / 32 (default medium)."),
14
15
  maxWidth: z
15
16
  .number()
16
17
  .int()
17
18
  .positive()
18
19
  .optional()
19
- .describe("Optional width cap in px; only ever downscales. Height follows aspect."),
20
+ .describe("Width cap in px (only downscales)."),
20
21
  output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
21
22
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
22
23
  };
23
24
  export function register(server) {
24
- server.tool("compress", "Re-encode a video to a smaller file with a CRF quality ladder and an " +
25
- "optional width cap. Returns the output path.", inputSchema, async (args, extra) => {
25
+ server.registerTool("compress", {
26
+ title: "Compress Video",
27
+ description: "Re-encode a video smaller (H.264 CRF ladder, optional width cap). For a platform target use export_preset.",
28
+ inputSchema,
29
+ outputSchema: OUTPUT_PATH,
30
+ annotations: WRITES_FILE,
31
+ }, async (args, extra) => {
26
32
  try {
27
33
  requireFfmpeg();
28
34
  if (!existsSync(args.input)) {
@@ -43,4 +49,3 @@ export function register(server) {
43
49
  }
44
50
  });
45
51
  }
46
- //# sourceMappingURL=compress.js.map
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { extname, resolve } from "node:path";
3
3
  import { existsSync, writeFileSync, rmSync } from "node:fs";
4
4
  import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
5
+ import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
5
6
  import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
6
7
  import { runEditJob } from "../utils/jobs.js";
7
8
  import { buildConcatArgs, buildConcatListContent, concatCopyBlocker, editOutputExt, assertEditContainer, } from "../utils/media.js";
@@ -11,42 +12,43 @@ const inputSchema = {
11
12
  inputs: z
12
13
  .array(z.string().min(1))
13
14
  .min(2)
14
- .describe("Two or more video paths to join, in order. Matching inputs are stream-copied; others are re-encoded."),
15
+ .describe("Video paths to join, in order."),
15
16
  output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
16
17
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
17
18
  };
18
19
  export function register(server) {
19
- server.tool("concat", "Concatenate two or more videos into a single file. Matching inputs are " +
20
- "joined by stream copy (fast, lossless). Inputs that differ in codec, size, " +
21
- "pixel format, frame rate or audio layout, or that hold frames hidden behind " +
22
- "an edit list (a trim with exact: false), are re-encoded with hard cuts " +
23
- "instead, so the result is always a valid file; `mode` in the result says which.", inputSchema, async (args, extra) => {
20
+ server.registerTool("concat", {
21
+ title: "Concatenate Videos",
22
+ description: "Join videos end to end with hard cuts: stream copy when they match, else a re-encode (`mode` " +
23
+ "says which). For transitions use xfade_transition or assemble_highlights.",
24
+ inputSchema,
25
+ outputSchema: OUTPUT_PATH,
26
+ annotations: WRITES_FILE,
27
+ }, async (args, extra) => {
24
28
  try {
25
29
  requireFfmpeg();
26
- // The concat demuxer resolves relative list entries against the list
27
- // file's directory (the OS temp dir), not our cwd, so inputs must be
28
- // absolute by the time they are written to the list.
29
30
  const inputs = args.inputs.map((f) => resolve(f));
30
31
  for (const f of inputs) {
31
32
  if (!existsSync(f))
32
33
  throw new ScreencastError(`Input file not found: ${f}`);
33
34
  }
34
35
  const infos = await Promise.all(inputs.map((f) => probeMedia(f)));
36
+ const [firstInput] = inputs;
37
+ const [first] = infos;
38
+ if (firstInput === undefined || first === undefined)
39
+ throw new ScreencastError("concat needs at least two inputs.");
35
40
  const durations = infos.map((i) => clipLength(i));
36
41
  const durationSec = durations.every((d) => d !== null) ? durations.reduce((a, d) => a + d, 0) : null;
37
- // Mismatched inputs make the concat demuxer write a broken file (#206),
38
- // and a copy carries any hidden frames along (#203): re-encode then.
39
42
  const reason = concatCopyBlocker(inputs, infos);
40
43
  if (reason !== null) {
41
44
  assertEditContainer(args.output);
42
- const output = resolveOutput(args.output, subdir("edits"), `concat-${stamp()}-${rand()}${editOutputExt(inputs[0])}`, args.overwrite);
43
- const first = infos[0];
45
+ const output = resolveOutput(args.output, subdir("edits"), `concat-${stamp()}-${rand()}${editOutputExt(firstInput)}`, args.overwrite);
44
46
  const even = (n) => (n !== null && n >= 2 ? n - (n % 2) : undefined);
45
47
  const ffArgs = buildAssembleArgs(inputs, durations.map((d) => d ?? 0), output, { transition: "cut", width: even(first.width), height: even(first.height), fps: first.fps ?? undefined }, infos.map((i) => i.audioCodec !== null));
46
48
  await runEditJob(ffArgs, { output, durationSec, extra });
47
49
  return okResponse({ outputPath: output, inputCount: inputs.length, mode: "reencode", reason });
48
50
  }
49
- const ext = extname(inputs[0]) || ".mp4";
51
+ const ext = extname(firstInput) || ".mp4";
50
52
  const output = resolveOutput(args.output, subdir("edits"), `concat-${stamp()}-${rand()}${ext}`, args.overwrite);
51
53
  const listFile = tempPath(".txt");
52
54
  writeFileSync(listFile, buildConcatListContent(inputs));
@@ -63,4 +65,3 @@ export function register(server) {
63
65
  }
64
66
  });
65
67
  }
66
- //# sourceMappingURL=concat.js.map
@@ -3,6 +3,7 @@ import { join } from "node:path";
3
3
  import { existsSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
5
  import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
6
+ import { WRITES_FILE, looseOutput } from "../utils/toolSpec.js";
6
7
  import { requireFfmpeg, runFfmpeg, runCapture, probeMedia } from "../utils/ffmpeg.js";
7
8
  import { jobTimeoutMs } from "../utils/jobs.js";
8
9
  import { buildSceneScanArgs, parseSceneScan, pickSceneFrames, DEFAULT_SCENE_THRESHOLD, } from "../utils/media.js";
@@ -18,18 +19,17 @@ const inputSchema = {
18
19
  .min(1)
19
20
  .max(MAX_SHEET_COUNT)
20
21
  .optional()
21
- .describe(`How many frames to tile (default ${DEFAULT_SHEET_COUNT}, max ${MAX_SHEET_COUNT}).`),
22
+ .describe(`Frames to tile (default ${DEFAULT_SHEET_COUNT}).`),
22
23
  mode: z
23
24
  .enum(["even", "scenes"])
24
25
  .optional()
25
- .describe("'even' spreads frames evenly across the video (default); 'scenes' uses the " +
26
- "opening frame plus the strongest scene changes, so static stretches take no tiles."),
26
+ .describe("even (default) or scenes (strongest changes; static stretches take no tiles)."),
27
27
  sceneThreshold: z
28
28
  .number()
29
29
  .gt(0)
30
30
  .lt(1)
31
31
  .optional()
32
- .describe(`Mode 'scenes': how much a frame must change to count (default ${DEFAULT_SCENE_THRESHOLD}).`),
32
+ .describe(`Mode scenes: change needed, 0-1 (default ${DEFAULT_SCENE_THRESHOLD}).`),
33
33
  columns: z.number().int().min(1).max(12).optional().describe("Tiles per row (default: roughly square)."),
34
34
  tileWidth: z
35
35
  .number()
@@ -37,30 +37,33 @@ const inputSchema = {
37
37
  .min(64)
38
38
  .max(1920)
39
39
  .optional()
40
- .describe(`Width of each tile in px (default ${DEFAULT_TILE_WIDTH}).`),
40
+ .describe(`Tile width in px (default ${DEFAULT_TILE_WIDTH}).`),
41
41
  poster: z
42
42
  .boolean()
43
43
  .optional()
44
- .describe("Instead of a sheet, write one representative poster frame (ffmpeg's thumbnail " +
45
- "filter over 30 candidates spread across the video), e.g. for a video thumbnail."),
44
+ .describe("Write one representative poster frame instead of a sheet."),
46
45
  output: z.string().optional().describe("Optional output .png path. Defaults under SCREENCAST_HOME/frames."),
47
46
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
48
47
  returnImage: z
49
48
  .boolean()
50
49
  .optional()
51
- .describe("Also return the sheet inline as an image the model can view directly (default true)."),
50
+ .describe("Return the sheet inline (default true)."),
52
51
  maxImageWidth: z
53
52
  .number()
54
53
  .int()
55
54
  .min(16)
56
55
  .optional()
57
- .describe(`Downscale the inline image to at most this width (default ${DEFAULT_MAX_IMAGE_WIDTH}).`),
56
+ .describe(`Max inline image width (default ${DEFAULT_MAX_IMAGE_WIDTH}).`),
58
57
  };
59
58
  export function register(server) {
60
- server.tool("contact_sheet", "Tile timestamped frames of a video into ONE image, so the agent can see a whole " +
61
- "recording in a single look: evenly spaced, or at the scene changes. Returns the " +
62
- "image path and the sheet inline. poster: true writes a single representative " +
63
- "frame instead.", inputSchema, async (args) => {
59
+ server.registerTool("contact_sheet", {
60
+ title: "Contact Sheet",
61
+ description: "Tile timestamped frames of a video into one image to see a whole recording at a glance " +
62
+ "(the cheapest first look).",
63
+ inputSchema,
64
+ outputSchema: looseOutput({ outputPath: z.string(), inlineImages: z.number().int() }),
65
+ annotations: WRITES_FILE,
66
+ }, async (args, extra) => {
64
67
  try {
65
68
  const { ffmpeg } = requireFfmpeg();
66
69
  if (!existsSync(args.input)) {
@@ -74,14 +77,16 @@ export function register(server) {
74
77
  const tileWidth = args.tileWidth ?? DEFAULT_TILE_WIDTH;
75
78
  let result;
76
79
  if (args.poster) {
77
- await runFfmpeg(buildPosterArgs(args.input, durationSec, output, Math.max(tileWidth, 1280)), jobTimeoutMs(durationSec));
80
+ await runFfmpeg(buildPosterArgs(args.input, durationSec, output, Math.max(tileWidth, 1280)), jobTimeoutMs(durationSec), {
81
+ signal: extra.signal,
82
+ });
78
83
  result = { outputPath: output, poster: true };
79
84
  }
80
85
  else {
81
86
  const count = args.count ?? DEFAULT_SHEET_COUNT;
82
87
  let times;
83
88
  if (args.mode === "scenes") {
84
- const scan = await runCapture(ffmpeg, buildSceneScanArgs(args.input, args.sceneThreshold ?? DEFAULT_SCENE_THRESHOLD), jobTimeoutMs(durationSec));
89
+ const scan = await runCapture(ffmpeg, buildSceneScanArgs(args.input, args.sceneThreshold ?? DEFAULT_SCENE_THRESHOLD), jobTimeoutMs(durationSec), { signal: extra.signal });
85
90
  if (scan.code !== 0) {
86
91
  throw new ScreencastError(`Scene scan failed (exit ${scan.code}): ${scan.stderr.trim().slice(-400)}`);
87
92
  }
@@ -91,18 +96,18 @@ export function register(server) {
91
96
  times = evenTimes(durationSec, count);
92
97
  }
93
98
  const grid = sheetGrid(times.length, args.columns);
94
- // Tiles and their label files live in a private temp dir, removed
95
- // whatever happens.
96
99
  const work = mkdtempSync(join(tmpdir(), "screencast-sheet-"));
97
100
  try {
98
101
  const font = bundledFontPath("bold");
99
- for (let i = 0; i < times.length; i++) {
102
+ for (const [i, t] of times.entries()) {
100
103
  const labelFile = join(work, `label_${i}.txt`);
101
- writeFileSync(labelFile, formatTimecode(times[i]));
104
+ writeFileSync(labelFile, formatTimecode(t));
102
105
  const tile = join(work, `tile_${String(i).padStart(3, "0")}.png`);
103
- await runFfmpeg(buildTileArgs(args.input, times[i], tile, tileWidth, font, labelFile), 60_000);
106
+ await runFfmpeg(buildTileArgs(args.input, t, tile, tileWidth, font, labelFile), 60_000, {
107
+ signal: extra.signal,
108
+ });
104
109
  }
105
- await runFfmpeg(buildSheetArgs(sequencePattern(work, "tile_%03d.png"), grid, output), 60_000);
110
+ await runFfmpeg(buildSheetArgs(sequencePattern(work, "tile_%03d.png"), grid, output), 60_000, { signal: extra.signal });
106
111
  }
107
112
  finally {
108
113
  rmSync(work, { recursive: true, force: true });
@@ -125,4 +130,3 @@ export function register(server) {
125
130
  }
126
131
  });
127
132
  }
128
- //# sourceMappingURL=contactSheet.js.map
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { existsSync } from "node:fs";
3
3
  import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
4
+ import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
4
5
  import { requireFfmpeg } from "../utils/ffmpeg.js";
5
6
  import { runEditJob, probeDuration } from "../utils/jobs.js";
6
7
  import { buildConvertArgs } from "../utils/media.js";
@@ -9,15 +10,21 @@ const inputSchema = {
9
10
  input: z.string().min(1).describe("Path to the source media."),
10
11
  format: z
11
12
  .enum(["mp4", "gif", "webm"])
12
- .describe("Target format. Converts mp4 <-> gif/webm (H.264 / VP9 / palette gif)."),
13
- fps: z.number().positive().optional().describe("Output fps (gif only; default 12)."),
14
- width: z.number().positive().optional().describe("Output width in px, height auto (gif only; default 720)."),
13
+ .describe("mp4 (H.264), webm (VP9), or gif (palette)."),
14
+ fps: z.number().positive().optional().describe("gif only: fps (default 12)."),
15
+ width: z.number().positive().optional().describe("gif only: width in px (default 720)."),
15
16
  output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
16
17
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
17
18
  };
18
19
  export function register(server) {
19
- server.tool("convert", "Convert a video between mp4, gif, and webm. mp4 uses H.264, webm uses VP9, " +
20
- "and gif uses a palette filter for quality. Returns the output path.", inputSchema, async (args, extra) => {
20
+ server.registerTool("convert", {
21
+ title: "Convert Format",
22
+ description: "Convert media to mp4, webm, or gif. For a size-bounded GIF/WebP prefer export_gif; for a " +
23
+ "smaller mp4, compress or export_preset.",
24
+ inputSchema,
25
+ outputSchema: OUTPUT_PATH,
26
+ annotations: WRITES_FILE,
27
+ }, async (args, extra) => {
21
28
  try {
22
29
  requireFfmpeg();
23
30
  if (!existsSync(args.input)) {
@@ -37,4 +44,3 @@ export function register(server) {
37
44
  }
38
45
  });
39
46
  }
40
- //# sourceMappingURL=convert.js.map
@@ -1,22 +1,28 @@
1
1
  import { z } from "zod";
2
2
  import { existsSync } from "node:fs";
3
3
  import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
4
+ import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
4
5
  import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
5
6
  import { runEditJob } from "../utils/jobs.js";
6
7
  import { buildCropArgs, editOutputExt, assertEditContainer } from "../utils/media.js";
7
8
  import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
8
9
  const inputSchema = {
9
10
  input: z.string().min(1).describe("Path to the source video."),
10
- x: z.number().int().nonnegative().describe("Left edge of the crop in pixels."),
11
- y: z.number().int().nonnegative().describe("Top edge of the crop in pixels."),
12
- width: z.number().int().positive().describe("Crop width in pixels."),
13
- height: z.number().int().positive().describe("Crop height in pixels."),
11
+ x: z.number().int().nonnegative(),
12
+ y: z.number().int().nonnegative(),
13
+ width: z.number().int().positive(),
14
+ height: z.number().int().positive(),
14
15
  output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
15
16
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
16
17
  };
17
18
  export function register(server) {
18
- server.tool("crop", "Crop a video to a pixel rectangle (x, y, width, height) and re-encode. A " +
19
- "rectangle that runs off the source frame is rejected.", inputSchema, async (args, extra) => {
19
+ server.registerTool("crop", {
20
+ title: "Crop Video",
21
+ description: "Crop a video to a pixel rectangle; one running off the frame is rejected.",
22
+ inputSchema,
23
+ outputSchema: OUTPUT_PATH,
24
+ annotations: WRITES_FILE,
25
+ }, async (args, extra) => {
20
26
  try {
21
27
  requireFfmpeg();
22
28
  if (!existsSync(args.input)) {
@@ -35,4 +41,3 @@ export function register(server) {
35
41
  }
36
42
  });
37
43
  }
38
- //# sourceMappingURL=crop.js.map
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { existsSync } from "node:fs";
3
3
  import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
4
+ import { WRITES_FILE } from "../utils/toolSpec.js";
4
5
  import { requireFfmpeg, runCapture, probeMedia } from "../utils/ffmpeg.js";
5
6
  import { runEditJob, jobTimeoutMs } from "../utils/jobs.js";
6
7
  import { buildIdleScanArgs, parseFreezes, parseSilences, intersect, cutsFor, buildCutIdleArgs, DEFAULT_MIN_IDLE_SEC, DEFAULT_KEEP_SEC, } from "../utils/idle.js";
@@ -17,20 +18,23 @@ const inputSchema = {
17
18
  .number()
18
19
  .min(0)
19
20
  .optional()
20
- .describe(`Keep this much of each stretch at both edges so cuts are not abrupt (default ${DEFAULT_KEEP_SEC}).`),
21
+ .describe(`Seconds kept at each edge of a cut (default ${DEFAULT_KEEP_SEC}).`),
21
22
  useAudio: z
22
23
  .boolean()
23
24
  .optional()
24
- .describe("Count a stretch as idle only if the audio is also silent (default true when the video " +
25
- "has audio). Set false to cut frozen video even while sound plays."),
26
- dryRun: z.boolean().optional().describe("Only report the stretches that would be cut; write nothing."),
25
+ .describe("Require silent audio too (default true when there is audio)."),
26
+ dryRun: z.boolean().optional().describe("Only report what would be cut."),
27
27
  output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
28
28
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
29
29
  };
30
30
  export function register(server) {
31
- server.tool("cut_idle", "Remove dead air: cut stretches where the screen is frozen (and, if there is audio, " +
32
- "silent), keeping a short pad at each edge. Agent recordings are full of these pauses. " +
33
- "dryRun reports what would be cut first. Returns the output path and the time saved.", inputSchema, async (args, extra) => {
31
+ server.registerTool("cut_idle", {
32
+ title: "Cut Idle Stretches",
33
+ description: "Remove dead air: cut stretches where the screen is frozen (and silent), keeping a short pad. " +
34
+ "Returns the time saved.",
35
+ inputSchema,
36
+ annotations: WRITES_FILE,
37
+ }, async (args, extra) => {
34
38
  try {
35
39
  const { ffmpeg } = requireFfmpeg();
36
40
  if (!existsSync(args.input))
@@ -43,7 +47,9 @@ export function register(server) {
43
47
  const keep = args.keepSec ?? DEFAULT_KEEP_SEC;
44
48
  const hasAudio = info.audioCodec !== null;
45
49
  const useAudio = (args.useAudio ?? true) && hasAudio;
46
- const scan = await runCapture(ffmpeg, buildIdleScanArgs(args.input, minIdle, useAudio), jobTimeoutMs(duration));
50
+ const scan = await runCapture(ffmpeg, buildIdleScanArgs(args.input, minIdle, useAudio), jobTimeoutMs(duration), {
51
+ signal: extra.signal,
52
+ });
47
53
  if (scan.code !== 0)
48
54
  throw new ScreencastError(`Idle scan failed (exit ${scan.code}): ${scan.stderr.trim().slice(-400)}`);
49
55
  const freezes = parseFreezes(scan.stderr, duration);
@@ -66,6 +72,7 @@ export function register(server) {
66
72
  await runEditJob(buildCutIdleArgs(args.input, output, cuts, hasAudio), {
67
73
  output,
68
74
  durationSec: duration - removedSec,
75
+ inputDurationSec: duration,
69
76
  extra,
70
77
  });
71
78
  return okResponse({ outputPath: output, ...summary });
@@ -75,4 +82,3 @@ export function register(server) {
75
82
  }
76
83
  });
77
84
  }
78
- //# sourceMappingURL=cutIdle.js.map