@tmhs/screencast-mcp 0.39.0 → 0.45.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 (344) hide show
  1. package/README.md +95 -17
  2. package/assets/icon.png +0 -0
  3. package/assets/ui/player.html +47 -302
  4. package/assets/ui/player.js +402 -0
  5. package/dist/context.js +0 -5
  6. package/dist/index.js +17 -21
  7. package/dist/prompts.js +18 -8
  8. package/dist/resources.js +2 -14
  9. package/dist/server.js +49 -11
  10. package/dist/tools/addMarker.js +89 -0
  11. package/dist/tools/assembleHighlights.js +12 -7
  12. package/dist/tools/backdrop.js +89 -0
  13. package/dist/tools/bugReport.js +266 -0
  14. package/dist/tools/burnSubtitles.js +12 -6
  15. package/dist/tools/callout.js +32 -16
  16. package/dist/tools/chapters.js +156 -0
  17. package/dist/tools/clip.js +12 -9
  18. package/dist/tools/compress.js +10 -5
  19. package/dist/tools/concat.js +16 -15
  20. package/dist/tools/contactSheet.js +39 -33
  21. package/dist/tools/convert.js +12 -6
  22. package/dist/tools/crop.js +12 -7
  23. package/dist/tools/cutIdle.js +15 -9
  24. package/dist/tools/denoise.js +12 -6
  25. package/dist/tools/doctor.js +133 -0
  26. package/dist/tools/exportGif.js +14 -10
  27. package/dist/tools/exportPreset.js +11 -8
  28. package/dist/tools/extractAudio.js +10 -8
  29. package/dist/tools/findText.js +52 -98
  30. package/dist/tools/getMediaInfo.js +17 -3
  31. package/dist/tools/getSession.js +15 -3
  32. package/dist/tools/keystrokeOverlay.js +131 -0
  33. package/dist/tools/listAudioDevices.js +14 -7
  34. package/dist/tools/listSessions.js +13 -3
  35. package/dist/tools/listTargets.js +76 -0
  36. package/dist/tools/musicBed.js +14 -10
  37. package/dist/tools/normalizeAudio.js +12 -8
  38. package/dist/tools/overlay.js +16 -12
  39. package/dist/tools/pipeline.js +86 -25
  40. package/dist/tools/readEvents.js +21 -12
  41. package/dist/tools/redactRegion.js +19 -17
  42. package/dist/tools/reframe.js +9 -5
  43. package/dist/tools/reviewRecording.js +75 -22
  44. package/dist/tools/sampleFrames.js +33 -40
  45. package/dist/tools/saveReplay.js +90 -0
  46. package/dist/tools/scale.js +9 -3
  47. package/dist/tools/screenDiff.js +23 -17
  48. package/dist/tools/screenshot.js +21 -17
  49. package/dist/tools/speed.js +15 -4
  50. package/dist/tools/startRecording.js +96 -59
  51. package/dist/tools/stopRecording.js +35 -10
  52. package/dist/tools/titleCard.js +19 -11
  53. package/dist/tools/transcribe.js +13 -7
  54. package/dist/tools/trim.js +11 -10
  55. package/dist/tools/waitForChange.js +37 -22
  56. package/dist/tools/xfadeTransition.js +12 -8
  57. package/dist/tools/zoom.js +26 -29
  58. package/dist/utils/anim.js +1 -21
  59. package/dist/utils/animExport.js +5 -10
  60. package/dist/utils/audio.js +4 -33
  61. package/dist/utils/audioDevices.js +1 -48
  62. package/dist/utils/backdrop.js +151 -0
  63. package/dist/utils/bugReport.js +246 -0
  64. package/dist/utils/callout.js +1 -19
  65. package/dist/utils/calloutAssets.js +21 -11
  66. package/dist/utils/capabilities.js +95 -0
  67. package/dist/utils/captions.js +9 -26
  68. package/dist/utils/chapters.js +222 -0
  69. package/dist/utils/consent.js +29 -0
  70. package/dist/utils/diff.js +0 -46
  71. package/dist/utils/errors.js +5 -13
  72. package/dist/utils/events.js +21 -77
  73. package/dist/utils/expr.js +11 -0
  74. package/dist/utils/ffmpeg.js +119 -48
  75. package/dist/utils/fontCoverage.js +177 -0
  76. package/dist/utils/fonts.js +139 -23
  77. package/dist/utils/idle.js +12 -24
  78. package/dist/utils/images.js +0 -17
  79. package/dist/utils/jobs.js +42 -41
  80. package/dist/utils/keystrokes.js +170 -0
  81. package/dist/utils/lifecycle.js +11 -31
  82. package/dist/utils/logging.js +75 -0
  83. package/dist/utils/media.js +16 -124
  84. package/dist/utils/monitors.js +7 -43
  85. package/dist/utils/ocr.js +53 -71
  86. package/dist/utils/ocrScan.js +77 -0
  87. package/dist/utils/paths.js +68 -31
  88. package/dist/utils/pipeline.js +39 -25
  89. package/dist/utils/player.js +50 -27
  90. package/dist/utils/produce.js +6 -66
  91. package/dist/utils/replay.js +278 -0
  92. package/dist/utils/resolveTarget.js +0 -19
  93. package/dist/utils/retention.js +1 -15
  94. package/dist/utils/roots.js +42 -0
  95. package/dist/utils/sessions.js +195 -160
  96. package/dist/utils/sheet.js +0 -19
  97. package/dist/utils/still.js +0 -15
  98. package/dist/utils/targetList.js +63 -0
  99. package/dist/utils/targets.js +5 -70
  100. package/dist/utils/toolSpec.js +25 -0
  101. package/dist/utils/toolsets.js +122 -0
  102. package/dist/utils/validate.js +0 -22
  103. package/dist/utils/wgc.js +0 -46
  104. package/dist/utils/windows.js +5 -50
  105. package/dist/utils/zoom.js +55 -85
  106. package/dist/wgcRecorder.js +1 -30
  107. package/package.json +7 -3
  108. package/dist/context.d.ts +0 -9
  109. package/dist/context.d.ts.map +0 -1
  110. package/dist/context.js.map +0 -1
  111. package/dist/index.d.ts +0 -3
  112. package/dist/index.d.ts.map +0 -1
  113. package/dist/index.js.map +0 -1
  114. package/dist/prompts.d.ts +0 -10
  115. package/dist/prompts.d.ts.map +0 -1
  116. package/dist/prompts.js.map +0 -1
  117. package/dist/resources.d.ts +0 -3
  118. package/dist/resources.d.ts.map +0 -1
  119. package/dist/resources.js.map +0 -1
  120. package/dist/server.d.ts +0 -3
  121. package/dist/server.d.ts.map +0 -1
  122. package/dist/server.js.map +0 -1
  123. package/dist/tools/assembleHighlights.d.ts +0 -3
  124. package/dist/tools/assembleHighlights.d.ts.map +0 -1
  125. package/dist/tools/assembleHighlights.js.map +0 -1
  126. package/dist/tools/burnSubtitles.d.ts +0 -3
  127. package/dist/tools/burnSubtitles.d.ts.map +0 -1
  128. package/dist/tools/burnSubtitles.js.map +0 -1
  129. package/dist/tools/callout.d.ts +0 -37
  130. package/dist/tools/callout.d.ts.map +0 -1
  131. package/dist/tools/callout.js.map +0 -1
  132. package/dist/tools/clip.d.ts +0 -3
  133. package/dist/tools/clip.d.ts.map +0 -1
  134. package/dist/tools/clip.js.map +0 -1
  135. package/dist/tools/compress.d.ts +0 -3
  136. package/dist/tools/compress.d.ts.map +0 -1
  137. package/dist/tools/compress.js.map +0 -1
  138. package/dist/tools/concat.d.ts +0 -3
  139. package/dist/tools/concat.d.ts.map +0 -1
  140. package/dist/tools/concat.js.map +0 -1
  141. package/dist/tools/contactSheet.d.ts +0 -3
  142. package/dist/tools/contactSheet.d.ts.map +0 -1
  143. package/dist/tools/contactSheet.js.map +0 -1
  144. package/dist/tools/convert.d.ts +0 -3
  145. package/dist/tools/convert.d.ts.map +0 -1
  146. package/dist/tools/convert.js.map +0 -1
  147. package/dist/tools/crop.d.ts +0 -3
  148. package/dist/tools/crop.d.ts.map +0 -1
  149. package/dist/tools/crop.js.map +0 -1
  150. package/dist/tools/cutIdle.d.ts +0 -3
  151. package/dist/tools/cutIdle.d.ts.map +0 -1
  152. package/dist/tools/cutIdle.js.map +0 -1
  153. package/dist/tools/denoise.d.ts +0 -3
  154. package/dist/tools/denoise.d.ts.map +0 -1
  155. package/dist/tools/denoise.js.map +0 -1
  156. package/dist/tools/exportGif.d.ts +0 -3
  157. package/dist/tools/exportGif.d.ts.map +0 -1
  158. package/dist/tools/exportGif.js.map +0 -1
  159. package/dist/tools/exportPreset.d.ts +0 -3
  160. package/dist/tools/exportPreset.d.ts.map +0 -1
  161. package/dist/tools/exportPreset.js.map +0 -1
  162. package/dist/tools/extractAudio.d.ts +0 -3
  163. package/dist/tools/extractAudio.d.ts.map +0 -1
  164. package/dist/tools/extractAudio.js.map +0 -1
  165. package/dist/tools/findText.d.ts +0 -6
  166. package/dist/tools/findText.d.ts.map +0 -1
  167. package/dist/tools/findText.js.map +0 -1
  168. package/dist/tools/getMediaInfo.d.ts +0 -3
  169. package/dist/tools/getMediaInfo.d.ts.map +0 -1
  170. package/dist/tools/getMediaInfo.js.map +0 -1
  171. package/dist/tools/getSession.d.ts +0 -3
  172. package/dist/tools/getSession.d.ts.map +0 -1
  173. package/dist/tools/getSession.js.map +0 -1
  174. package/dist/tools/listAudioDevices.d.ts +0 -3
  175. package/dist/tools/listAudioDevices.d.ts.map +0 -1
  176. package/dist/tools/listAudioDevices.js.map +0 -1
  177. package/dist/tools/listSessions.d.ts +0 -3
  178. package/dist/tools/listSessions.d.ts.map +0 -1
  179. package/dist/tools/listSessions.js.map +0 -1
  180. package/dist/tools/musicBed.d.ts +0 -3
  181. package/dist/tools/musicBed.d.ts.map +0 -1
  182. package/dist/tools/musicBed.js.map +0 -1
  183. package/dist/tools/normalizeAudio.d.ts +0 -3
  184. package/dist/tools/normalizeAudio.d.ts.map +0 -1
  185. package/dist/tools/normalizeAudio.js.map +0 -1
  186. package/dist/tools/overlay.d.ts +0 -3
  187. package/dist/tools/overlay.d.ts.map +0 -1
  188. package/dist/tools/overlay.js.map +0 -1
  189. package/dist/tools/pipeline.d.ts +0 -3
  190. package/dist/tools/pipeline.d.ts.map +0 -1
  191. package/dist/tools/pipeline.js.map +0 -1
  192. package/dist/tools/readEvents.d.ts +0 -6
  193. package/dist/tools/readEvents.d.ts.map +0 -1
  194. package/dist/tools/readEvents.js.map +0 -1
  195. package/dist/tools/redactRegion.d.ts +0 -13
  196. package/dist/tools/redactRegion.d.ts.map +0 -1
  197. package/dist/tools/redactRegion.js.map +0 -1
  198. package/dist/tools/reframe.d.ts +0 -3
  199. package/dist/tools/reframe.d.ts.map +0 -1
  200. package/dist/tools/reframe.js.map +0 -1
  201. package/dist/tools/reviewRecording.d.ts +0 -5
  202. package/dist/tools/reviewRecording.d.ts.map +0 -1
  203. package/dist/tools/reviewRecording.js.map +0 -1
  204. package/dist/tools/sampleFrames.d.ts +0 -3
  205. package/dist/tools/sampleFrames.d.ts.map +0 -1
  206. package/dist/tools/sampleFrames.js.map +0 -1
  207. package/dist/tools/scale.d.ts +0 -3
  208. package/dist/tools/scale.d.ts.map +0 -1
  209. package/dist/tools/scale.js.map +0 -1
  210. package/dist/tools/screenDiff.d.ts +0 -3
  211. package/dist/tools/screenDiff.d.ts.map +0 -1
  212. package/dist/tools/screenDiff.js.map +0 -1
  213. package/dist/tools/screenshot.d.ts +0 -3
  214. package/dist/tools/screenshot.d.ts.map +0 -1
  215. package/dist/tools/screenshot.js.map +0 -1
  216. package/dist/tools/speed.d.ts +0 -3
  217. package/dist/tools/speed.d.ts.map +0 -1
  218. package/dist/tools/speed.js.map +0 -1
  219. package/dist/tools/startRecording.d.ts +0 -3
  220. package/dist/tools/startRecording.d.ts.map +0 -1
  221. package/dist/tools/startRecording.js.map +0 -1
  222. package/dist/tools/stopRecording.d.ts +0 -3
  223. package/dist/tools/stopRecording.d.ts.map +0 -1
  224. package/dist/tools/stopRecording.js.map +0 -1
  225. package/dist/tools/titleCard.d.ts +0 -3
  226. package/dist/tools/titleCard.d.ts.map +0 -1
  227. package/dist/tools/titleCard.js.map +0 -1
  228. package/dist/tools/transcribe.d.ts +0 -3
  229. package/dist/tools/transcribe.d.ts.map +0 -1
  230. package/dist/tools/transcribe.js.map +0 -1
  231. package/dist/tools/trim.d.ts +0 -3
  232. package/dist/tools/trim.d.ts.map +0 -1
  233. package/dist/tools/trim.js.map +0 -1
  234. package/dist/tools/waitForChange.d.ts +0 -3
  235. package/dist/tools/waitForChange.d.ts.map +0 -1
  236. package/dist/tools/waitForChange.js.map +0 -1
  237. package/dist/tools/xfadeTransition.d.ts +0 -3
  238. package/dist/tools/xfadeTransition.d.ts.map +0 -1
  239. package/dist/tools/xfadeTransition.js.map +0 -1
  240. package/dist/tools/zoom.d.ts +0 -15
  241. package/dist/tools/zoom.d.ts.map +0 -1
  242. package/dist/tools/zoom.js.map +0 -1
  243. package/dist/utils/anim.d.ts +0 -33
  244. package/dist/utils/anim.d.ts.map +0 -1
  245. package/dist/utils/anim.js.map +0 -1
  246. package/dist/utils/animExport.d.ts +0 -27
  247. package/dist/utils/animExport.d.ts.map +0 -1
  248. package/dist/utils/animExport.js.map +0 -1
  249. package/dist/utils/audio.d.ts +0 -49
  250. package/dist/utils/audio.d.ts.map +0 -1
  251. package/dist/utils/audio.js.map +0 -1
  252. package/dist/utils/audioDevices.d.ts +0 -33
  253. package/dist/utils/audioDevices.d.ts.map +0 -1
  254. package/dist/utils/audioDevices.js.map +0 -1
  255. package/dist/utils/callout.d.ts +0 -72
  256. package/dist/utils/callout.d.ts.map +0 -1
  257. package/dist/utils/callout.js.map +0 -1
  258. package/dist/utils/calloutAssets.d.ts +0 -3
  259. package/dist/utils/calloutAssets.d.ts.map +0 -1
  260. package/dist/utils/calloutAssets.js.map +0 -1
  261. package/dist/utils/captions.d.ts +0 -26
  262. package/dist/utils/captions.d.ts.map +0 -1
  263. package/dist/utils/captions.js.map +0 -1
  264. package/dist/utils/diff.d.ts +0 -112
  265. package/dist/utils/diff.d.ts.map +0 -1
  266. package/dist/utils/diff.js.map +0 -1
  267. package/dist/utils/errors.d.ts +0 -33
  268. package/dist/utils/errors.d.ts.map +0 -1
  269. package/dist/utils/errors.js.map +0 -1
  270. package/dist/utils/events.d.ts +0 -143
  271. package/dist/utils/events.d.ts.map +0 -1
  272. package/dist/utils/events.js.map +0 -1
  273. package/dist/utils/ffmpeg.d.ts +0 -50
  274. package/dist/utils/ffmpeg.d.ts.map +0 -1
  275. package/dist/utils/ffmpeg.js.map +0 -1
  276. package/dist/utils/fonts.d.ts +0 -17
  277. package/dist/utils/fonts.d.ts.map +0 -1
  278. package/dist/utils/fonts.js.map +0 -1
  279. package/dist/utils/idle.d.ts +0 -23
  280. package/dist/utils/idle.d.ts.map +0 -1
  281. package/dist/utils/idle.js.map +0 -1
  282. package/dist/utils/images.d.ts +0 -21
  283. package/dist/utils/images.d.ts.map +0 -1
  284. package/dist/utils/images.js.map +0 -1
  285. package/dist/utils/jobs.d.ts +0 -44
  286. package/dist/utils/jobs.d.ts.map +0 -1
  287. package/dist/utils/jobs.js.map +0 -1
  288. package/dist/utils/lifecycle.d.ts +0 -29
  289. package/dist/utils/lifecycle.d.ts.map +0 -1
  290. package/dist/utils/lifecycle.js.map +0 -1
  291. package/dist/utils/media.d.ts +0 -272
  292. package/dist/utils/media.d.ts.map +0 -1
  293. package/dist/utils/media.js.map +0 -1
  294. package/dist/utils/monitors.d.ts +0 -47
  295. package/dist/utils/monitors.d.ts.map +0 -1
  296. package/dist/utils/monitors.js.map +0 -1
  297. package/dist/utils/ocr.d.ts +0 -50
  298. package/dist/utils/ocr.d.ts.map +0 -1
  299. package/dist/utils/ocr.js.map +0 -1
  300. package/dist/utils/paths.d.ts +0 -28
  301. package/dist/utils/paths.d.ts.map +0 -1
  302. package/dist/utils/paths.js.map +0 -1
  303. package/dist/utils/pipeline.d.ts +0 -69
  304. package/dist/utils/pipeline.d.ts.map +0 -1
  305. package/dist/utils/pipeline.js.map +0 -1
  306. package/dist/utils/player.d.ts +0 -30
  307. package/dist/utils/player.d.ts.map +0 -1
  308. package/dist/utils/player.js.map +0 -1
  309. package/dist/utils/produce.d.ts +0 -126
  310. package/dist/utils/produce.d.ts.map +0 -1
  311. package/dist/utils/produce.js.map +0 -1
  312. package/dist/utils/resolveTarget.d.ts +0 -32
  313. package/dist/utils/resolveTarget.d.ts.map +0 -1
  314. package/dist/utils/resolveTarget.js.map +0 -1
  315. package/dist/utils/retention.d.ts +0 -10
  316. package/dist/utils/retention.d.ts.map +0 -1
  317. package/dist/utils/retention.js.map +0 -1
  318. package/dist/utils/sessions.d.ts +0 -154
  319. package/dist/utils/sessions.d.ts.map +0 -1
  320. package/dist/utils/sessions.js.map +0 -1
  321. package/dist/utils/sheet.d.ts +0 -26
  322. package/dist/utils/sheet.d.ts.map +0 -1
  323. package/dist/utils/sheet.js.map +0 -1
  324. package/dist/utils/still.d.ts +0 -7
  325. package/dist/utils/still.d.ts.map +0 -1
  326. package/dist/utils/still.js.map +0 -1
  327. package/dist/utils/targets.d.ts +0 -113
  328. package/dist/utils/targets.d.ts.map +0 -1
  329. package/dist/utils/targets.js.map +0 -1
  330. package/dist/utils/validate.d.ts +0 -15
  331. package/dist/utils/validate.d.ts.map +0 -1
  332. package/dist/utils/validate.js.map +0 -1
  333. package/dist/utils/wgc.d.ts +0 -46
  334. package/dist/utils/wgc.d.ts.map +0 -1
  335. package/dist/utils/wgc.js.map +0 -1
  336. package/dist/utils/windows.d.ts +0 -94
  337. package/dist/utils/windows.d.ts.map +0 -1
  338. package/dist/utils/windows.js.map +0 -1
  339. package/dist/utils/zoom.d.ts +0 -95
  340. package/dist/utils/zoom.d.ts.map +0 -1
  341. package/dist/utils/zoom.js.map +0 -1
  342. package/dist/wgcRecorder.d.ts +0 -2
  343. package/dist/wgcRecorder.d.ts.map +0 -1
  344. 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 } 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
@@ -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, runCapture, probeMedia } from "../utils/ffmpeg.js";
5
6
  import { runEditJob, jobTimeoutMs } from "../utils/jobs.js";
6
7
  import { buildDenoiseArgs, buildNoiseFloorArgs, parseNoiseFloor } from "../utils/audio.js";
@@ -16,8 +17,14 @@ const inputSchema = {
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("denoise", "Reduce steady background noise (fan, hum, hiss) in a recording's audio with an " +
20
- "adaptive FFT denoiser. Video is copied untouched. Returns the output path.", inputSchema, async (args, extra) => {
20
+ server.registerTool("denoise", {
21
+ title: "Denoise Audio",
22
+ description: "Reduce steady background noise (fan, hum, hiss) in a recording's audio with an " +
23
+ "adaptive FFT denoiser. Video is copied untouched. Returns the output path.",
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)) {
@@ -30,9 +37,9 @@ export function register(server) {
30
37
  assertEditContainer(args.output);
31
38
  const ext = editOutputExt(args.input, { audio: true });
32
39
  const output = resolveOutput(args.output, subdir("edits"), `denoise-${stamp()}-${rand()}${ext}`, args.overwrite);
33
- // Measure the noise floor first: afftdn only works when told roughly how
34
- // loud the noise is.
35
- const scan = await runCapture(requireFfmpeg().ffmpeg, buildNoiseFloorArgs(args.input), jobTimeoutMs(info.durationSec));
40
+ const scan = await runCapture(requireFfmpeg().ffmpeg, buildNoiseFloorArgs(args.input), jobTimeoutMs(info.durationSec), {
41
+ signal: extra.signal,
42
+ });
36
43
  const floor = parseNoiseFloor(scan.stdout);
37
44
  await runEditJob(buildDenoiseArgs(args.input, output, strength, floor), {
38
45
  output,
@@ -51,4 +58,3 @@ export function register(server) {
51
58
  }
52
59
  });
53
60
  }
54
- //# sourceMappingURL=denoise.js.map
@@ -0,0 +1,133 @@
1
+ import { createRequire } from "node:module";
2
+ import { existsSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { z } from "zod";
5
+ import { errorResponse, okResponse } from "../utils/errors.js";
6
+ import { READ_ONLY, looseOutput } from "../utils/toolSpec.js";
7
+ import { detectFfmpeg, hasFilter, wgcAvailable } from "../utils/ffmpeg.js";
8
+ import { allowedOutputDirs, envAllowedDirs, homeRoot } from "../utils/paths.js";
9
+ import { FFMPEG_FEATURE_MAJOR, KEY_FILTERS, devicesText, envSettings, locate, ocrStatus, parseDevices, parseFfmpegVersion, versionText, } from "../utils/capabilities.js";
10
+ import { parseToolsets, SELECTABLE_TOOLSETS } from "../utils/toolsets.js";
11
+ const { version: serverVersion } = createRequire(import.meta.url)("../../package.json");
12
+ const binary = z.looseObject({
13
+ found: z.boolean(),
14
+ path: z.string().nullable(),
15
+ version: z.string().nullable(),
16
+ major: z.number().nullable(),
17
+ });
18
+ const outputSchema = looseOutput({
19
+ ok: z.boolean(),
20
+ problems: z.array(z.string()),
21
+ server: z.looseObject({ version: z.string(), node: z.string(), platform: z.string(), arch: z.string() }),
22
+ ffmpeg: binary.extend({ meetsFfmpeg8: z.boolean().nullable() }),
23
+ ffprobe: binary,
24
+ filters: z.record(z.string(), z.boolean()),
25
+ devices: z.looseObject({ gdigrab: z.boolean(), dshow: z.boolean() }),
26
+ wgc: z.looseObject({ available: z.boolean() }),
27
+ ocr: z.looseObject({ available: z.boolean(), language: z.string().nullable(), languages: z.array(z.string()) }),
28
+ storage: z.looseObject({ home: z.string(), homeExists: z.boolean() }),
29
+ env: z.record(z.string(), z.string().nullable()),
30
+ });
31
+ function errorText(err) {
32
+ const first = errorResponse(err).content[0];
33
+ return first?.type === "text" ? first.text.replace(/\s*\n+\s*/g, " ") : String(err);
34
+ }
35
+ function describeBinary(bin) {
36
+ const text = versionText(bin);
37
+ const parsed = parseFfmpegVersion(text ?? "");
38
+ return {
39
+ found: text !== null,
40
+ path: text !== null ? locate(bin) : null,
41
+ version: parsed.version,
42
+ major: parsed.major,
43
+ ...(parsed.inferred ? { majorInferred: true } : {}),
44
+ };
45
+ }
46
+ export function register(server) {
47
+ server.registerTool("doctor", {
48
+ title: "Check Setup",
49
+ description: `Check the setup: ffmpeg/ffprobe (FFmpeg ${FFMPEG_FEATURE_MAJOR}+?), optional filters, capture ` +
50
+ "devices, Windows OCR, settings, and enabled toolsets; `problems` says what is missing and how to " +
51
+ "fix it. Call on first use or when a tool reports a missing feature.",
52
+ inputSchema: {},
53
+ outputSchema,
54
+ annotations: READ_ONLY,
55
+ }, async () => {
56
+ try {
57
+ const problems = [];
58
+ let tools = null;
59
+ try {
60
+ tools = detectFfmpeg();
61
+ }
62
+ catch (err) {
63
+ problems.push(errorText(err));
64
+ }
65
+ const ffmpeg = describeBinary(tools?.ffmpeg ?? (process.env.FFMPEG_PATH?.trim() || "ffmpeg"));
66
+ const ffprobe = describeBinary(tools?.ffprobe ?? (process.env.FFPROBE_PATH?.trim() || "ffprobe"));
67
+ const meetsFfmpeg8 = ffmpeg.major === null ? null : ffmpeg.major >= FFMPEG_FEATURE_MAJOR;
68
+ if (tools && meetsFfmpeg8 === false) {
69
+ problems.push(`FFmpeg ${ffmpeg.version} is older than ${FFMPEG_FEATURE_MAJOR}: transcribe and backend "wgc" need FFmpeg ${FFMPEG_FEATURE_MAJOR}+. ` +
70
+ "Windows: `winget install Gyan.FFmpeg`.");
71
+ }
72
+ const filters = {};
73
+ let devices = { gdigrab: false, dshow: false };
74
+ if (tools) {
75
+ for (const f of KEY_FILTERS) {
76
+ filters[f.filter] = f.filter === "gfxcapture" ? wgcAvailable() : hasFilter(f.filter);
77
+ if (!filters[f.filter] && !(f.filter === "gfxcapture" && process.platform !== "win32")) {
78
+ problems.push(`No ${f.filter} filter: ${f.tools} unavailable (needs ${f.why}).`);
79
+ }
80
+ }
81
+ const names = parseDevices(devicesText(tools.ffmpeg) ?? "");
82
+ devices = { gdigrab: names.includes("gdigrab"), dshow: names.includes("dshow") };
83
+ if (process.platform === "win32" && !devices.gdigrab) {
84
+ problems.push("This ffmpeg has no gdigrab device: screenshot and start_recording cannot capture the screen.");
85
+ }
86
+ }
87
+ if (process.platform !== "win32") {
88
+ problems.push("Not Windows: capture (screenshot, start_recording, list_targets) and OCR are unavailable; the watch and edit tools work.");
89
+ }
90
+ const ocr = await ocrStatus();
91
+ if (process.platform === "win32" && !ocr.available) {
92
+ problems.push(`Windows OCR unavailable: find_text cannot read the screen. ${ocr.error ?? "Install an OCR language (Settings > Time & language > Language)."}`);
93
+ }
94
+ const env = envSettings();
95
+ const model = env.SCREENCAST_WHISPER_MODEL;
96
+ if (model && !existsSync(model))
97
+ problems.push(`SCREENCAST_WHISPER_MODEL points at a missing file: ${model}`);
98
+ const home = homeRoot();
99
+ for (const dir of envAllowedDirs()) {
100
+ if (!existsSync(dir))
101
+ problems.push(`SCREENCAST_ALLOWED_DIRS names a missing folder: ${dir}`);
102
+ }
103
+ const toolsets = parseToolsets(env.SCREENCAST_TOOLSETS ?? undefined);
104
+ if (toolsets.unknown.length > 0) {
105
+ problems.push(`SCREENCAST_TOOLSETS names unknown toolsets (ignored): ${toolsets.unknown.join(", ")}.`);
106
+ }
107
+ return okResponse({
108
+ ok: problems.length === 0,
109
+ problems,
110
+ server: { version: serverVersion, node: process.version, platform: process.platform, arch: process.arch },
111
+ ffmpeg: { ...ffmpeg, meetsFfmpeg8 },
112
+ ffprobe,
113
+ filters,
114
+ devices,
115
+ wgc: { available: filters.gfxcapture === true },
116
+ ocr,
117
+ storage: {
118
+ home,
119
+ homeExists: existsSync(home),
120
+ recordings: join(home, "recordings"),
121
+ screenshots: join(home, "screenshots"),
122
+ edits: join(home, "edits"),
123
+ allowedOutputDirs: allowedOutputDirs(),
124
+ },
125
+ env,
126
+ toolsets: { enabled: toolsets.enabled, available: ["all", ...SELECTABLE_TOOLSETS] },
127
+ });
128
+ }
129
+ catch (error) {
130
+ return errorResponse(error);
131
+ }
132
+ });
133
+ }
@@ -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 { DEFAULT_ANIM_FPS, DEFAULT_ANIM_WIDTH, DEFAULT_MAX_BYTES } from "../utils/anim.js";
6
7
  import { exportAnimation } from "../utils/animExport.js";
@@ -10,14 +11,13 @@ const inputSchema = {
10
11
  format: z
11
12
  .enum(["gif", "webp"])
12
13
  .optional()
13
- .describe("gif (plays everywhere, default) or webp (animated WebP, usually much smaller)."),
14
+ .describe("gif (default) or webp (usually much smaller)."),
14
15
  maxBytes: z
15
16
  .number()
16
17
  .int()
17
18
  .min(10_000)
18
19
  .optional()
19
- .describe(`File-size budget in bytes (default ${DEFAULT_MAX_BYTES}, under GitHub's 10 MB limit ` +
20
- "for images). Quality steps down until the file fits."),
20
+ .describe(`Size budget in bytes (default ${DEFAULT_MAX_BYTES}, under GitHub's 10 MB image limit).`),
21
21
  fps: z.number().positive().max(30).optional().describe(`Starting frame rate (default ${DEFAULT_ANIM_FPS}).`),
22
22
  width: z
23
23
  .number()
@@ -25,16 +25,21 @@ const inputSchema = {
25
25
  .min(64)
26
26
  .max(1920)
27
27
  .optional()
28
- .describe(`Starting width in px (default ${DEFAULT_ANIM_WIDTH}); height follows the aspect ratio.`),
29
- start: z.number().nonnegative().optional().describe("Start at this many seconds into the video."),
30
- duration: z.number().positive().optional().describe("Export only this many seconds (default: to the end)."),
28
+ .describe(`Starting width in px (default ${DEFAULT_ANIM_WIDTH}).`),
29
+ start: z.number().nonnegative().optional().describe("Start second."),
30
+ duration: z.number().positive().optional().describe("Seconds to export (default: to the end)."),
31
31
  output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
32
32
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
33
33
  };
34
34
  export function register(server) {
35
- server.tool("export_gif", "Export a video as an optimized animated GIF or WebP that fits a file-size budget " +
36
- "(default: GitHub's 10 MB image limit), for PRs, issues, and READMEs. Steps fps, " +
37
- "width, and palette/quality down until it fits and reports the settings used.", inputSchema, async (args, extra) => {
35
+ server.registerTool("export_gif", {
36
+ title: "Export GIF or WebP",
37
+ description: "Export an animated GIF or WebP that fits a size budget (for PRs, issues, READMEs), stepping " +
38
+ "fps, width, and quality down until it fits.",
39
+ inputSchema,
40
+ outputSchema: OUTPUT_PATH,
41
+ annotations: WRITES_FILE,
42
+ }, async (args, extra) => {
38
43
  try {
39
44
  requireFfmpeg();
40
45
  if (!existsSync(args.input)) {
@@ -50,4 +55,3 @@ export function register(server) {
50
55
  }
51
56
  });
52
57
  }
53
- //# sourceMappingURL=exportGif.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 { buildExportPresetArgs, PLATFORM_PRESETS, PLATFORMS, } from "../utils/produce.js";
@@ -9,20 +10,23 @@ const inputSchema = {
9
10
  input: z.string().min(1).describe("Path to the source video."),
10
11
  platform: z
11
12
  .enum(PLATFORMS)
12
- .describe("Target platform. Sets aspect, resolution, fps, and bitrate. steam_trailer: 1920x1080, " +
13
- "H.264 High, padded 5.5 Mbps CBR, AAC 48 kHz at -14 LUFS. vertical_reel: 1080x1920 with the " +
14
- "footage centred over a blurred copy of itself, audio at -14 LUFS (fit is ignored)."),
13
+ .describe("Sets aspect, size, fps, bitrate. steam_trailer: 1080p 5.5 Mbps CBR, -14 LUFS. vertical_reel: " +
14
+ "1080x1920 over a blurred copy of itself, -14 LUFS (ignores fit)."),
15
15
  fit: z
16
16
  .enum(["pad", "crop"])
17
17
  .optional()
18
- .describe("How to fit the source into the platform aspect: pad (default) or crop."),
18
+ .describe("Fit to the platform aspect: pad (default) or crop."),
19
19
  output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
20
20
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
21
21
  };
22
22
  export function register(server) {
23
- server.tool("export_preset", "Encode a platform-ready file for youtube, instagram_reel, tiktok, x, square, " +
24
- "steam_trailer, or vertical_reel. Reframes to the platform aspect, caps fps, and " +
25
- "encodes H.264 at the platform bitrate with faststart. Returns the output path.", inputSchema, async (args, extra) => {
23
+ server.registerTool("export_preset", {
24
+ title: "Export for Platform",
25
+ description: "Encode a platform-ready H.264 file (aspect, fps, bitrate, faststart) for a named platform.",
26
+ inputSchema,
27
+ outputSchema: OUTPUT_PATH,
28
+ annotations: WRITES_FILE,
29
+ }, async (args, extra) => {
26
30
  try {
27
31
  requireFfmpeg();
28
32
  if (!existsSync(args.input)) {
@@ -40,4 +44,3 @@ export function register(server) {
40
44
  }
41
45
  });
42
46
  }
43
- //# sourceMappingURL=exportPreset.js.map
@@ -1,13 +1,11 @@
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, runCapture } from "../utils/ffmpeg.js";
5
6
  import { runEditJob, probeDuration } from "../utils/jobs.js";
6
7
  import { buildExtractAudioArgs, buildProbeArgs, parseMediaInfo, copyAudioExtension, } from "../utils/media.js";
7
8
  import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
8
- // Re-encode formats have a fixed container. `copy` keeps the source codec, so
9
- // its container must match that codec (probed per call, see below) - a blanket
10
- // .m4a writes a broken file for opus/vorbis/etc (#36).
11
9
  const EXTENSION = {
12
10
  mp3: "mp3",
13
11
  aac: "m4a",
@@ -22,8 +20,14 @@ const inputSchema = {
22
20
  overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
23
21
  };
24
22
  export function register(server) {
25
- server.tool("extract_audio", "Extract the audio track of a media file to its own file (mp3, aac, wav, " +
26
- "or copy). Returns the output path.", inputSchema, async (args, extra) => {
23
+ server.registerTool("extract_audio", {
24
+ title: "Extract Audio",
25
+ description: "Extract the audio track of a media file to its own file (mp3, aac, wav, " +
26
+ "or copy). Returns the output path.",
27
+ inputSchema,
28
+ outputSchema: OUTPUT_PATH,
29
+ annotations: WRITES_FILE,
30
+ }, async (args, extra) => {
27
31
  try {
28
32
  const { ffprobe } = requireFfmpeg();
29
33
  if (!existsSync(args.input)) {
@@ -33,8 +37,7 @@ export function register(server) {
33
37
  let audioCodec = null;
34
38
  let ext;
35
39
  if (format === "copy") {
36
- // The copied codec dictates the container; probe it first.
37
- const res = await runCapture(ffprobe, buildProbeArgs(args.input), 30_000);
40
+ const res = await runCapture(ffprobe, buildProbeArgs(args.input), 30_000, { signal: extra.signal });
38
41
  if (res.code !== 0) {
39
42
  throw new ScreencastError(`ffprobe failed (exit ${res.code}): ${res.stderr.trim().slice(-400)}`);
40
43
  }
@@ -60,4 +63,3 @@ export function register(server) {
60
63
  }
61
64
  });
62
65
  }
63
- //# sourceMappingURL=extractAudio.js.map