@tmhs/screencast-mcp 0.47.0 → 0.48.1
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.
- package/README.md +28 -247
- package/assets/fonts/Inter-Bold.ttf +0 -0
- package/assets/fonts/Inter-Regular.ttf +0 -0
- package/dist/cli.js +189 -34
- package/dist/server.js +13 -0
- package/dist/setup.js +437 -0
- package/dist/tools/assembleHighlights.js +2 -0
- package/dist/tools/cutByTranscript.js +3 -3
- package/dist/tools/exportPreset.js +2 -0
- package/dist/tools/indexRecording.js +37 -15
- package/dist/tools/narrate.js +3 -1
- package/dist/tools/pipeline.js +23 -11
- package/dist/tools/searchRecording.js +9 -3
- package/dist/tools/startRecording.js +72 -42
- package/dist/tools/stepGuide.js +57 -4
- package/dist/tools/titleCard.js +2 -0
- package/dist/tools/xfadeTransition.js +2 -0
- package/dist/utils/argPaths.js +39 -0
- package/dist/utils/audioDevices.js +0 -4
- package/dist/utils/captions.js +5 -3
- package/dist/utils/events.js +40 -8
- package/dist/utils/gpu.js +50 -4
- package/dist/utils/lifecycle.js +56 -16
- package/dist/utils/media.js +3 -2
- package/dist/utils/monitors.js +34 -3
- package/dist/utils/narrate.js +12 -3
- package/dist/utils/ocr.js +8 -3
- package/dist/utils/paths.js +41 -3
- package/dist/utils/pause.js +15 -1
- package/dist/utils/pipeline.js +5 -1
- package/dist/utils/recipes.js +7 -3
- package/dist/utils/recorder.js +20 -11
- package/dist/utils/recordingIndex.js +54 -8
- package/dist/utils/replay.js +20 -2
- package/dist/utils/retention.js +4 -1
- package/dist/utils/roots.js +1 -1
- package/dist/utils/sessions.js +3 -4
- package/dist/utils/sheet.js +4 -4
- package/dist/utils/stepGuide.js +26 -0
- package/dist/utils/transcriptCut.js +20 -5
- package/package.json +7 -5
package/dist/utils/roots.js
CHANGED
package/dist/utils/sessions.js
CHANGED
|
@@ -82,9 +82,6 @@ export function isRecorderProcess(pid, image) {
|
|
|
82
82
|
return false;
|
|
83
83
|
return tasklistHasImage(res.stdout, image);
|
|
84
84
|
}
|
|
85
|
-
export function isFfmpegProcess(pid) {
|
|
86
|
-
return isRecorderProcess(pid, "ffmpeg.exe");
|
|
87
|
-
}
|
|
88
85
|
export function classifyUnrequestedExit(opts) {
|
|
89
86
|
const { code, backend, maxDurationSec, elapsedMs } = opts;
|
|
90
87
|
if (backend === "wgc" && code === WGC_WINDOW_CLOSED_EXIT)
|
|
@@ -380,7 +377,9 @@ export class SessionStore {
|
|
|
380
377
|
getChild(id) {
|
|
381
378
|
return this.children.get(id);
|
|
382
379
|
}
|
|
383
|
-
detachChild(id) {
|
|
380
|
+
detachChild(id, child) {
|
|
381
|
+
if (child && this.children.get(id) !== child)
|
|
382
|
+
return;
|
|
384
383
|
this.children.delete(id);
|
|
385
384
|
}
|
|
386
385
|
activeIds() {
|
package/dist/utils/sheet.js
CHANGED
|
@@ -10,10 +10,10 @@ export function evenTimes(durationSec, count) {
|
|
|
10
10
|
return Array.from({ length: count }, (_, i) => Math.round(((i + 0.5) * durationSec) / count * 1000) / 1000);
|
|
11
11
|
}
|
|
12
12
|
export function formatTimecode(sec) {
|
|
13
|
-
const
|
|
14
|
-
const h = Math.floor(
|
|
15
|
-
const m = Math.floor((
|
|
16
|
-
const rest =
|
|
13
|
+
const tenths = Math.round(Math.max(0, sec) * 10);
|
|
14
|
+
const h = Math.floor(tenths / 36000);
|
|
15
|
+
const m = Math.floor((tenths % 36000) / 600);
|
|
16
|
+
const rest = (tenths % 600) / 10;
|
|
17
17
|
if (h > 0)
|
|
18
18
|
return `${h}:${String(m).padStart(2, "0")}:${String(Math.floor(rest)).padStart(2, "0")}`;
|
|
19
19
|
return `${m}:${rest.toFixed(1).padStart(4, "0")}`;
|
package/dist/utils/stepGuide.js
CHANGED
|
@@ -103,6 +103,32 @@ export function shotFilter(size, opts) {
|
|
|
103
103
|
export function buildStepFrameArgs(input, t, output) {
|
|
104
104
|
return ["-y", "-v", "error", "-ss", String(t), "-i", input, "-frames:v", "1", output];
|
|
105
105
|
}
|
|
106
|
+
export const HTML_MAX_BYTES = 10_000_000;
|
|
107
|
+
export const HTML_IMAGE_LADDER = [
|
|
108
|
+
{ width: 1280, q: 4 },
|
|
109
|
+
{ width: 960, q: 6 },
|
|
110
|
+
{ width: 800, q: 8 },
|
|
111
|
+
{ width: 640, q: 10 },
|
|
112
|
+
{ width: 480, q: 14 },
|
|
113
|
+
{ width: 360, q: 20 },
|
|
114
|
+
];
|
|
115
|
+
export const htmlImageName = (file) => file.replace(/\.png$/i, ".jpg");
|
|
116
|
+
export function buildHtmlImageArgs(png, rung, output) {
|
|
117
|
+
return [
|
|
118
|
+
"-y", "-v", "error", "-i", png,
|
|
119
|
+
"-vf", `scale=w='min(iw,${rung.width})':h=-2:flags=lanczos,format=yuvj420p`,
|
|
120
|
+
"-frames:v", "1", "-q:v", String(rung.q), output,
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
export const base64Bytes = (n) => 4 * Math.ceil(n / 3);
|
|
124
|
+
export function nextHtmlRung(at, bytes, budget = HTML_MAX_BYTES) {
|
|
125
|
+
const w = HTML_IMAGE_LADDER[at].width;
|
|
126
|
+
for (let k = at + 1; k < HTML_IMAGE_LADDER.length; k++) {
|
|
127
|
+
if (bytes * (HTML_IMAGE_LADDER[k].width / w) ** 2 <= budget)
|
|
128
|
+
return k;
|
|
129
|
+
}
|
|
130
|
+
return at + 1 < HTML_IMAGE_LADDER.length ? HTML_IMAGE_LADDER.length - 1 : null;
|
|
131
|
+
}
|
|
106
132
|
export function buildStepShotArgs(frame, filter, output) {
|
|
107
133
|
return ["-y", "-v", "error", "-i", frame, "-filter_complex", filter, "-map", "[out]", "-frames:v", "1", output];
|
|
108
134
|
}
|
|
@@ -57,10 +57,10 @@ export function mergeCuts(cuts) {
|
|
|
57
57
|
for (const c of sorted) {
|
|
58
58
|
const prev = out[out.length - 1];
|
|
59
59
|
if (prev && c.start <= prev.end + 0.01) {
|
|
60
|
-
if (c.end > prev.end)
|
|
60
|
+
if (c.end > prev.end)
|
|
61
61
|
prev.end = c.end;
|
|
62
|
+
if (!prev.text.includes(c.text))
|
|
62
63
|
prev.text = `${prev.text} ${c.text}`;
|
|
63
|
-
}
|
|
64
64
|
prev.exact &&= c.exact;
|
|
65
65
|
}
|
|
66
66
|
else
|
|
@@ -68,14 +68,29 @@ export function mergeCuts(cuts) {
|
|
|
68
68
|
}
|
|
69
69
|
return out;
|
|
70
70
|
}
|
|
71
|
+
export function cueByNumber(cues, n) {
|
|
72
|
+
const numbers = cues.flatMap((c) => (c.index === undefined ? [] : [c.index]));
|
|
73
|
+
if (numbers.length === 0) {
|
|
74
|
+
const c = Number.isInteger(n) ? cues[n - 1] : undefined;
|
|
75
|
+
if (!c)
|
|
76
|
+
throw new ScreencastError(`No cue ${n}: the transcript has cues 1-${cues.length}.`);
|
|
77
|
+
return c;
|
|
78
|
+
}
|
|
79
|
+
const hits = cues.filter((c) => c.index === n);
|
|
80
|
+
if (hits.length > 1)
|
|
81
|
+
throw new ScreencastError(`The transcript numbers ${hits.length} cues ${n}; quote the text to cut instead.`);
|
|
82
|
+
if (hits.length === 0) {
|
|
83
|
+
throw new ScreencastError(`No cue ${n}: the transcript's cues are numbered ${Math.min(...numbers)}-${Math.max(...numbers)}` +
|
|
84
|
+
" (a cue with no duration, or wholly overlapped by the next, has no time to cut).");
|
|
85
|
+
}
|
|
86
|
+
return hits[0];
|
|
87
|
+
}
|
|
71
88
|
export function planTranscriptCuts(cues, req) {
|
|
72
89
|
const words = cueWords(cues);
|
|
73
90
|
const cuts = [];
|
|
74
91
|
for (const r of req.remove ?? []) {
|
|
75
92
|
if (typeof r === "number") {
|
|
76
|
-
const c = cues
|
|
77
|
-
if (!Number.isInteger(r) || !c)
|
|
78
|
-
throw new ScreencastError(`No cue ${r}: the transcript has cues 1-${cues.length}.`);
|
|
93
|
+
const c = cueByNumber(cues, r);
|
|
79
94
|
cuts.push({ start: r3(c.start), end: r3(c.end), text: c.text.replace(/\s+/g, " "), exact: true });
|
|
80
95
|
continue;
|
|
81
96
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmhs/screencast-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.1",
|
|
4
4
|
"description": "Let AI agents record the Windows screen, watch it as frames, and edit it with ffmpeg",
|
|
5
5
|
"mcpName": "io.github.TMHSDigital/screencast-mcp",
|
|
6
6
|
"type": "module",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"start": "node dist/index.js",
|
|
26
26
|
"test": "vitest run",
|
|
27
27
|
"test:watch": "vitest",
|
|
28
|
+
"test:coverage": "vitest run --coverage",
|
|
28
29
|
"eval": "tsx evals/run.ts",
|
|
29
30
|
"typecheck:evals": "tsc -p evals/tsconfig.json",
|
|
30
31
|
"docs": "tsc && node scripts/build-tool-docs.mjs",
|
|
@@ -70,11 +71,12 @@
|
|
|
70
71
|
"@eslint/js": "^10.0.1",
|
|
71
72
|
"@types/jsdom": "^30.0.0",
|
|
72
73
|
"@types/node": "^22.15.3",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
74
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
75
|
+
"eslint": "^10.14.0",
|
|
76
|
+
"jsdom": "^31.0.0",
|
|
75
77
|
"tsx": "^4.19.4",
|
|
76
78
|
"typescript": "^5.8.3",
|
|
77
|
-
"typescript-eslint": "^8.
|
|
78
|
-
"vitest": "^5.0
|
|
79
|
+
"typescript-eslint": "^8.72.1",
|
|
80
|
+
"vitest": "^5.1.0"
|
|
79
81
|
}
|
|
80
82
|
}
|