@alan-ai-hq/agent-manager-linux-x64 0.1.203 → 0.1.205
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/alan-agent.cjs +106169 -112172
- package/alan-holder.cjs +64431 -63890
- package/alan-lease.cjs +75 -52
- package/builtin-skills/alan-docs/references/cloud-and-local/local-execution.md +2 -3
- package/builtin-skills/alan-test-feature/SKILL.md +17 -13
- package/builtin-skills/alan-test-web/SKILL.md +34 -5
- package/builtin-skills/alan-test-web/scripts/record-walkthrough.mjs +474 -0
- package/builtin-skills/alan-walkthrough/SKILL.md +13 -4
- package/builtin-skills/manifest.json +4 -4
- package/package.json +2 -2
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
|
|
7
|
+
const FORMAT_VERSION = 1;
|
|
8
|
+
const DEFAULT_NOTE_MS = 2600;
|
|
9
|
+
const MIN_IDLE_MS = 2000;
|
|
10
|
+
const USAGE = `Usage:
|
|
11
|
+
record-walkthrough.mjs start <raw.webm|raw.mp4> [--session <name>] [--fps <1-60>] [--output <annotated.mp4>]
|
|
12
|
+
record-walkthrough.mjs section <raw-video> <title>
|
|
13
|
+
record-walkthrough.mjs note <raw-video> <text> [--selector <css>] [--duration <500-10000ms>]
|
|
14
|
+
record-walkthrough.mjs idle <raw-video> start <label>
|
|
15
|
+
record-walkthrough.mjs idle <raw-video> stop
|
|
16
|
+
record-walkthrough.mjs stop <raw-video>`;
|
|
17
|
+
|
|
18
|
+
function fail(message) {
|
|
19
|
+
throw new Error(message);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function run(command, args) {
|
|
23
|
+
const result = spawnSync(command, args, {
|
|
24
|
+
encoding: "utf8",
|
|
25
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
26
|
+
timeout: 120000,
|
|
27
|
+
});
|
|
28
|
+
if (result.error) fail(`${command}: ${result.error.message}`);
|
|
29
|
+
if (result.status !== 0)
|
|
30
|
+
fail(`${command} exited ${result.status}: ${result.stderr.trim() || result.stdout.trim()}`);
|
|
31
|
+
return result.stdout.trim();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function parseOptions(args, allowed) {
|
|
35
|
+
const options = {};
|
|
36
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
37
|
+
const name = args[index];
|
|
38
|
+
if (!allowed.has(name)) fail(`Unexpected option: ${name}\n${USAGE}`);
|
|
39
|
+
const value = args[++index];
|
|
40
|
+
if (!value) fail(`${name} needs a value\n${USAGE}`);
|
|
41
|
+
options[name.slice(2)] = value;
|
|
42
|
+
}
|
|
43
|
+
return options;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function manifestPath(recording) {
|
|
47
|
+
return `${path.resolve(recording)}.walkthrough.json`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function readManifest(recording) {
|
|
51
|
+
const file = manifestPath(recording);
|
|
52
|
+
if (!existsSync(file)) fail(`No walkthrough manifest: ${file}`);
|
|
53
|
+
return JSON.parse(readFileSync(file, "utf8"));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function writeManifest(manifest) {
|
|
57
|
+
writeFileSync(manifestPath(manifest.recording), `${JSON.stringify(manifest, null, 2)}\n`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function defaultOutput(recording) {
|
|
61
|
+
const resolved = path.resolve(recording);
|
|
62
|
+
const extension = path.extname(resolved);
|
|
63
|
+
const filename = path.basename(resolved, extension);
|
|
64
|
+
const annotated = filename.endsWith(".raw") ? filename.slice(0, -4) : `${filename}.annotated`;
|
|
65
|
+
return path.join(path.dirname(resolved), `${annotated}.mp4`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function browserArgs(manifest, args) {
|
|
69
|
+
return manifest.session ? ["--session", manifest.session, ...args] : args;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function elapsed(manifest) {
|
|
73
|
+
return Math.max(0, Date.now() - manifest.startedAt);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function recordingManifest(recording) {
|
|
77
|
+
const manifest = readManifest(recording);
|
|
78
|
+
if (manifest.status !== "recording")
|
|
79
|
+
fail(`Walkthrough is ${manifest.status}; expected recording`);
|
|
80
|
+
return manifest;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function start(recording, args) {
|
|
84
|
+
if (!/\.(webm|mp4)$/i.test(recording)) fail(`Recording must be .webm or .mp4\n${USAGE}`);
|
|
85
|
+
const options = parseOptions(args, new Set(["--session", "--fps", "--output"]));
|
|
86
|
+
const previous = existsSync(manifestPath(recording)) ? readManifest(recording) : null;
|
|
87
|
+
if (previous?.status === "recording") fail(`Walkthrough is already recording: ${recording}`);
|
|
88
|
+
const manifest = {
|
|
89
|
+
version: FORMAT_VERSION,
|
|
90
|
+
status: "recording",
|
|
91
|
+
recording: path.resolve(recording),
|
|
92
|
+
output: options.output ? path.resolve(options.output) : defaultOutput(recording),
|
|
93
|
+
session: options.session,
|
|
94
|
+
startedAt: Date.now(),
|
|
95
|
+
events: [],
|
|
96
|
+
idleRanges: [],
|
|
97
|
+
};
|
|
98
|
+
const browser = browserArgs(manifest, [
|
|
99
|
+
"record",
|
|
100
|
+
"start",
|
|
101
|
+
manifest.recording,
|
|
102
|
+
"--cursor",
|
|
103
|
+
...(options.fps ? ["--fps", options.fps] : []),
|
|
104
|
+
]);
|
|
105
|
+
run("agent-browser", browser);
|
|
106
|
+
writeManifest(manifest);
|
|
107
|
+
console.log(`Recording with cursor: ${manifest.recording}`);
|
|
108
|
+
console.log(`Manifest: ${manifestPath(manifest.recording)}`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function section(recording, title) {
|
|
112
|
+
const manifest = recordingManifest(recording);
|
|
113
|
+
manifest.events.push({ type: "section", atMs: elapsed(manifest), title });
|
|
114
|
+
writeManifest(manifest);
|
|
115
|
+
console.log(`${title}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function idle(recording, action, label) {
|
|
119
|
+
const manifest = recordingManifest(recording);
|
|
120
|
+
manifest.idleRanges ??= [];
|
|
121
|
+
const open = manifest.idleRanges.find((range) => range.endMs === undefined);
|
|
122
|
+
if (action === "start") {
|
|
123
|
+
if (!label?.trim()) fail(`Idle start needs a label\n${USAGE}`);
|
|
124
|
+
if (open) fail("An idle range is already open");
|
|
125
|
+
manifest.idleRanges.push({ startMs: elapsed(manifest), label: label.trim() });
|
|
126
|
+
console.log(`Idle start: ${label.trim()}`);
|
|
127
|
+
} else if (action === "stop") {
|
|
128
|
+
if (!open) fail("No idle range is open");
|
|
129
|
+
open.endMs = elapsed(manifest);
|
|
130
|
+
console.log(`Idle end: ${open.label}`);
|
|
131
|
+
} else {
|
|
132
|
+
fail(USAGE);
|
|
133
|
+
}
|
|
134
|
+
writeManifest(manifest);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function closeOpenIdleRange(manifest) {
|
|
138
|
+
const open = manifest.idleRanges?.find((range) => range.endMs === undefined);
|
|
139
|
+
if (open) open.endMs = elapsed(manifest);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function usableIdleRanges(manifest) {
|
|
143
|
+
return (manifest.idleRanges ?? [])
|
|
144
|
+
.map((range) => ({
|
|
145
|
+
startMs: Math.max(0, Math.min(range.startMs, manifest.video.durationMs)),
|
|
146
|
+
endMs: Math.max(0, Math.min(range.endMs, manifest.video.durationMs)),
|
|
147
|
+
...(range.label ? { label: range.label } : {}),
|
|
148
|
+
}))
|
|
149
|
+
.filter((range) => range.endMs - range.startMs >= MIN_IDLE_MS);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function parseBrowserJson(output) {
|
|
153
|
+
const lines = output.trim().split("\n");
|
|
154
|
+
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
155
|
+
try {
|
|
156
|
+
return JSON.parse(lines.slice(index).join("\n"));
|
|
157
|
+
} catch {
|
|
158
|
+
if (index === 0) fail(`Could not parse agent-browser eval output: ${output}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
fail(`Could not parse agent-browser eval output: ${output}`);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function note(recording, text, args) {
|
|
165
|
+
const manifest = recordingManifest(recording);
|
|
166
|
+
const options = parseOptions(args, new Set(["--selector", "--duration"]));
|
|
167
|
+
const durationMs = Number(options.duration ?? DEFAULT_NOTE_MS);
|
|
168
|
+
if (!Number.isInteger(durationMs) || durationMs < 500 || durationMs > 10000)
|
|
169
|
+
fail("Note duration must be an integer from 500 to 10000 ms");
|
|
170
|
+
const event = { type: "note", atMs: elapsed(manifest), text, durationMs };
|
|
171
|
+
if (options.selector) {
|
|
172
|
+
const selector = JSON.stringify(options.selector);
|
|
173
|
+
const expression = `(() => { const element = document.querySelector(${selector}); if (!element) throw new Error("No element matches " + ${selector}); const rect = element.getBoundingClientRect(); return { rect: { x: rect.left, y: rect.top, width: rect.width, height: rect.height }, viewport: { width: innerWidth, height: innerHeight } }; })()`;
|
|
174
|
+
const target = parseBrowserJson(
|
|
175
|
+
run("agent-browser", browserArgs(manifest, ["eval", expression]))
|
|
176
|
+
);
|
|
177
|
+
if (!target?.rect || !target?.viewport)
|
|
178
|
+
fail("agent-browser returned an invalid annotation target");
|
|
179
|
+
const { rect, viewport } = target;
|
|
180
|
+
const dimensions = [rect.x, rect.y, rect.width, rect.height, viewport.width, viewport.height];
|
|
181
|
+
if (!dimensions.every(Number.isFinite) || viewport.width <= 0 || viewport.height <= 0)
|
|
182
|
+
fail("agent-browser returned invalid annotation dimensions");
|
|
183
|
+
if (
|
|
184
|
+
rect.width <= 0 ||
|
|
185
|
+
rect.height <= 0 ||
|
|
186
|
+
rect.x >= viewport.width ||
|
|
187
|
+
rect.y >= viewport.height ||
|
|
188
|
+
rect.x + rect.width <= 0 ||
|
|
189
|
+
rect.y + rect.height <= 0
|
|
190
|
+
)
|
|
191
|
+
fail(`Annotation target is not visible: ${options.selector}`);
|
|
192
|
+
event.rect = rect;
|
|
193
|
+
event.viewport = viewport;
|
|
194
|
+
}
|
|
195
|
+
manifest.events.push(event);
|
|
196
|
+
writeManifest(manifest);
|
|
197
|
+
console.log(`${text}`);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function assTime(milliseconds) {
|
|
201
|
+
const centiseconds = Math.max(0, Math.round(milliseconds / 10));
|
|
202
|
+
const hours = Math.floor(centiseconds / 360000);
|
|
203
|
+
const minutes = Math.floor((centiseconds % 360000) / 6000);
|
|
204
|
+
const seconds = Math.floor((centiseconds % 6000) / 100);
|
|
205
|
+
const fraction = String(centiseconds % 100).padStart(2, "0");
|
|
206
|
+
return `${hours}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}.${fraction}`;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function vttTime(milliseconds) {
|
|
210
|
+
const whole = Math.max(0, Math.round(milliseconds));
|
|
211
|
+
const hours = Math.floor(whole / 3600000);
|
|
212
|
+
const minutes = Math.floor((whole % 3600000) / 60000);
|
|
213
|
+
const seconds = Math.floor((whole % 60000) / 1000);
|
|
214
|
+
const rest = `${String(seconds).padStart(2, "0")}.${String(whole % 1000).padStart(3, "0")}`;
|
|
215
|
+
return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}:${rest}`;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function clockTime(milliseconds) {
|
|
219
|
+
const seconds = Math.max(0, Math.floor(milliseconds / 1000));
|
|
220
|
+
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function assText(text) {
|
|
224
|
+
return text.replace(/[{}]/g, "").replace(/\r?\n/g, "\\N");
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function dialogue(event, end, style, text, layer = 0) {
|
|
228
|
+
return `Dialogue: ${layer},${assTime(event.atMs)},${assTime(end)},${style},,0,0,0,,${text}`;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function roundedRectangle(width, height, radius) {
|
|
232
|
+
const r = Math.max(0, Math.min(radius, width / 2, height / 2));
|
|
233
|
+
return `m ${r} 0 l ${width - r} 0 b ${width} 0 ${width} 0 ${width} ${r} l ${width} ${height - r} b ${width} ${height} ${width} ${height} ${width - r} ${height} l ${r} ${height} b 0 ${height} 0 ${height} 0 ${height - r} l 0 ${r} b 0 0 0 0 ${r} 0`;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function panelDrawing(x, y, width, height, radius = 16) {
|
|
237
|
+
const drawing = roundedRectangle(width, height, radius);
|
|
238
|
+
return `{\\an7\\pos(${x},${y})\\p1\\bord1\\shad0\\1c&H120E0C&\\1a&H10&\\3c&H66FFD8&\\3a&H88&}${drawing}`;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function accentDrawing(x, y, height) {
|
|
242
|
+
return `{\\an7\\pos(${x},${y})\\p1\\bord0\\shad0\\1c&H66FFD8&\\1a&H00&}${roundedRectangle(4, height, 2)}`;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function wrapText(text, limit) {
|
|
246
|
+
const lines = [];
|
|
247
|
+
let line = "";
|
|
248
|
+
for (const word of text.trim().split(/\s+/)) {
|
|
249
|
+
if (line && line.length + word.length + 1 > limit) {
|
|
250
|
+
lines.push(line);
|
|
251
|
+
line = word;
|
|
252
|
+
} else {
|
|
253
|
+
line = line ? `${line} ${word}` : word;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (line) lines.push(line);
|
|
257
|
+
return lines.join("\n");
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function estimatedWidth(text, fontSize) {
|
|
261
|
+
return Math.max(...text.split("\n").map((line) => line.length)) * fontSize * 0.53;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function sectionOverlay(event, index, end, video) {
|
|
265
|
+
const title = wrapText(event.title, 42);
|
|
266
|
+
const lineCount = title.split("\n").length;
|
|
267
|
+
const width = Math.min(video.width - 48, Math.max(250, estimatedWidth(title, 23) + 68));
|
|
268
|
+
const height = 66 + (lineCount - 1) * 28;
|
|
269
|
+
const x = 24;
|
|
270
|
+
const y = video.height - height - 24;
|
|
271
|
+
const kicker = `SECTION ${String(index + 1).padStart(2, "0")} ${clockTime(event.atMs)}`;
|
|
272
|
+
return [
|
|
273
|
+
dialogue(event, end, "Panel", panelDrawing(x, y, width, height), 0),
|
|
274
|
+
dialogue(event, end, "Accent", accentDrawing(x + 16, y + 15, height - 30), 1),
|
|
275
|
+
dialogue(event, end, "SectionKicker", `{\\an7\\pos(${x + 32},${y + 10})}${kicker}`, 2),
|
|
276
|
+
dialogue(event, end, "SectionTitle", `{\\an7\\pos(${x + 32},${y + 29})}${assText(title)}`, 2),
|
|
277
|
+
];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function noteGeometry(event, video) {
|
|
281
|
+
const text = wrapText(event.text, 52);
|
|
282
|
+
const lineCount = text.split("\n").length;
|
|
283
|
+
const width = Math.min(video.width - 48, Math.max(190, estimatedWidth(text, 21) + 48));
|
|
284
|
+
const height = 12 + lineCount * 26;
|
|
285
|
+
let centerX = video.width / 2;
|
|
286
|
+
let y = 20;
|
|
287
|
+
if (event.rect) {
|
|
288
|
+
const scaleX = video.width / event.viewport.width;
|
|
289
|
+
const scaleY = video.height / event.viewport.height;
|
|
290
|
+
const targetX = (event.rect.x + event.rect.width / 2) * scaleX;
|
|
291
|
+
const targetTop = event.rect.y * scaleY;
|
|
292
|
+
const targetBottom = (event.rect.y + event.rect.height) * scaleY;
|
|
293
|
+
centerX = Math.min(video.width - width / 2 - 24, Math.max(width / 2 + 24, targetX));
|
|
294
|
+
const above = targetTop >= height + 28 && targetTop < video.height * 0.45;
|
|
295
|
+
if (above) y = targetTop - height - 14;
|
|
296
|
+
else if (targetBottom + height + 28 < video.height) y = targetBottom + 14;
|
|
297
|
+
else y = targetTop > video.height / 2 ? 20 : video.height - height - 20;
|
|
298
|
+
}
|
|
299
|
+
return { text, width, height, centerX, y };
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function noteOverlay(event, end, video) {
|
|
303
|
+
const { text, width, height, centerX, y } = noteGeometry(event, video);
|
|
304
|
+
const left = centerX - width / 2;
|
|
305
|
+
return [
|
|
306
|
+
dialogue(event, end, "Panel", `{\\fad(120,120)}${panelDrawing(left, y, width, height)}`, 1),
|
|
307
|
+
dialogue(
|
|
308
|
+
event,
|
|
309
|
+
end,
|
|
310
|
+
"Note",
|
|
311
|
+
`{\\an5\\pos(${centerX},${y + height / 2})\\fad(120,120)}${assText(text)}`,
|
|
312
|
+
2
|
|
313
|
+
),
|
|
314
|
+
];
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function targetDrawing(event, video, glow = false) {
|
|
318
|
+
const scaleX = video.width / event.viewport.width;
|
|
319
|
+
const scaleY = video.height / event.viewport.height;
|
|
320
|
+
const padding = glow ? 8 : 5;
|
|
321
|
+
const x = event.rect.x * scaleX - padding;
|
|
322
|
+
const y = event.rect.y * scaleY - padding;
|
|
323
|
+
const width = event.rect.width * scaleX + padding * 2;
|
|
324
|
+
const height = event.rect.height * scaleY + padding * 2;
|
|
325
|
+
const border = glow ? 4 : 2;
|
|
326
|
+
const alpha = glow ? "D8" : "00";
|
|
327
|
+
const drawing = roundedRectangle(width, height, 9);
|
|
328
|
+
return `{\\an7\\pos(${x},${y})\\p1\\bord${border}\\shad0\\1c&H66FFD8&\\1a&HFA&\\3c&H66FFD8&\\3a&H${alpha}&\\fad(120,120)}${drawing}`;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function buildAss(manifest) {
|
|
332
|
+
const { video, events } = manifest;
|
|
333
|
+
const sections = events.filter((event) => event.type === "section");
|
|
334
|
+
const lines = [
|
|
335
|
+
"[Script Info]",
|
|
336
|
+
"ScriptType: v4.00+",
|
|
337
|
+
`PlayResX: ${video.width}`,
|
|
338
|
+
`PlayResY: ${video.height}`,
|
|
339
|
+
"",
|
|
340
|
+
"[V4+ Styles]",
|
|
341
|
+
"Format: Name,Fontname,Fontsize,PrimaryColour,SecondaryColour,OutlineColour,BackColour,Bold,Italic,Underline,StrikeOut,ScaleX,ScaleY,Spacing,Angle,BorderStyle,Outline,Shadow,Alignment,MarginL,MarginR,MarginV,Encoding",
|
|
342
|
+
"Style: Panel,Inter,21,&H00FAF7F5,&H000000FF,&H0066FFD8,&H00120E0C,0,0,0,0,100,100,0,0,1,0,0,7,0,0,0,1",
|
|
343
|
+
"Style: Accent,Inter,21,&H0066FFD8,&H000000FF,&H0066FFD8,&H00120E0C,0,0,0,0,100,100,0,0,1,0,0,7,0,0,0,1",
|
|
344
|
+
"Style: SectionKicker,Inter,11,&H0066FFD8,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,1.6,0,1,0,0,7,0,0,0,1",
|
|
345
|
+
"Style: SectionTitle,Inter Display,23,&H00FAF7F5,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,0,0,7,0,0,0,1",
|
|
346
|
+
"Style: Note,Inter,21,&H00FAF7F5,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,0,0,5,0,0,0,1",
|
|
347
|
+
"Style: Target,Inter,21,&H0066FFD8,&H000000FF,&H0066FFD8,&H0066FFD8,0,0,0,0,100,100,0,0,1,0,0,7,0,0,0,1",
|
|
348
|
+
"",
|
|
349
|
+
"[Events]",
|
|
350
|
+
"Format: Layer,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text",
|
|
351
|
+
];
|
|
352
|
+
sections.forEach((event, index) => {
|
|
353
|
+
lines.push(
|
|
354
|
+
...sectionOverlay(event, index, sections[index + 1]?.atMs ?? video.durationMs, video)
|
|
355
|
+
);
|
|
356
|
+
});
|
|
357
|
+
for (const event of events.filter((entry) => entry.type === "note")) {
|
|
358
|
+
const end = Math.min(video.durationMs, event.atMs + event.durationMs);
|
|
359
|
+
if (event.rect) {
|
|
360
|
+
lines.push(dialogue(event, end, "Target", targetDrawing(event, video, true), 0));
|
|
361
|
+
lines.push(dialogue(event, end, "Target", targetDrawing(event, video), 1));
|
|
362
|
+
}
|
|
363
|
+
lines.push(...noteOverlay(event, end, video));
|
|
364
|
+
}
|
|
365
|
+
return `${lines.join("\n")}\n`;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function buildVtt(manifest) {
|
|
369
|
+
const sections = manifest.events.filter((event) => event.type === "section");
|
|
370
|
+
const cues = sections.map((event, index) => ({
|
|
371
|
+
start: event.atMs,
|
|
372
|
+
end: sections[index + 1]?.atMs ?? manifest.video.durationMs,
|
|
373
|
+
text: event.title.replace(/-->/g, "→"),
|
|
374
|
+
}));
|
|
375
|
+
return `WEBVTT\n\n${cues.map((cue, index) => `${index + 1}\n${vttTime(cue.start)} --> ${vttTime(cue.end)}\n${cue.text}\n`).join("\n")}`;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function chapterList(manifest) {
|
|
379
|
+
const sections = manifest.events.filter((event) => event.type === "section");
|
|
380
|
+
return sections.length
|
|
381
|
+
? sections.map((event) => `${clockTime(event.atMs)} ${event.title}`).join("\n")
|
|
382
|
+
: "No sections recorded.";
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function probe(recording) {
|
|
386
|
+
const output = run("ffprobe", [
|
|
387
|
+
"-v",
|
|
388
|
+
"error",
|
|
389
|
+
"-select_streams",
|
|
390
|
+
"v:0",
|
|
391
|
+
"-show_entries",
|
|
392
|
+
"stream=width,height:format=duration",
|
|
393
|
+
"-of",
|
|
394
|
+
"json",
|
|
395
|
+
recording,
|
|
396
|
+
]);
|
|
397
|
+
const parsed = JSON.parse(output);
|
|
398
|
+
const stream = parsed.streams?.[0];
|
|
399
|
+
const durationMs = Math.round(Number(parsed.format?.duration) * 1000);
|
|
400
|
+
if (!stream?.width || !stream?.height || !durationMs) fail(`Invalid ffprobe output: ${output}`);
|
|
401
|
+
return { width: stream.width, height: stream.height, durationMs };
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
function stop(recording) {
|
|
405
|
+
const manifest = readManifest(recording);
|
|
406
|
+
if (manifest.status === "complete") fail("Walkthrough is already complete");
|
|
407
|
+
if (manifest.status === "recording") {
|
|
408
|
+
closeOpenIdleRange(manifest);
|
|
409
|
+
run("agent-browser", browserArgs(manifest, ["record", "stop"]));
|
|
410
|
+
manifest.status = "recorded";
|
|
411
|
+
writeManifest(manifest);
|
|
412
|
+
}
|
|
413
|
+
if (manifest.status !== "recorded") fail(`Walkthrough is ${manifest.status}; expected recorded`);
|
|
414
|
+
if (!manifest.video) {
|
|
415
|
+
manifest.video = probe(manifest.recording);
|
|
416
|
+
writeManifest(manifest);
|
|
417
|
+
}
|
|
418
|
+
manifest.idleRanges = usableIdleRanges(manifest);
|
|
419
|
+
writeManifest(manifest);
|
|
420
|
+
const assPath = `${manifestPath(manifest.recording)}.ass`;
|
|
421
|
+
const vttPath = manifest.output.replace(/\.mp4$/i, ".vtt");
|
|
422
|
+
const playbackPath = manifest.output.replace(/\.mp4$/i, ".playback.json");
|
|
423
|
+
writeFileSync(assPath, buildAss(manifest));
|
|
424
|
+
writeFileSync(vttPath, buildVtt(manifest));
|
|
425
|
+
writeFileSync(
|
|
426
|
+
playbackPath,
|
|
427
|
+
`${JSON.stringify({ version: 1, idleRanges: manifest.idleRanges }, null, 2)}\n`
|
|
428
|
+
);
|
|
429
|
+
const filter = `ass=filename='${assPath.replaceAll("'", "\\'")}'`;
|
|
430
|
+
run("ffmpeg", [
|
|
431
|
+
"-v",
|
|
432
|
+
"error",
|
|
433
|
+
"-y",
|
|
434
|
+
"-i",
|
|
435
|
+
manifest.recording,
|
|
436
|
+
"-vf",
|
|
437
|
+
filter,
|
|
438
|
+
"-c:v",
|
|
439
|
+
"libx264",
|
|
440
|
+
"-preset",
|
|
441
|
+
"veryfast",
|
|
442
|
+
"-crf",
|
|
443
|
+
"20",
|
|
444
|
+
"-pix_fmt",
|
|
445
|
+
"yuv420p",
|
|
446
|
+
"-an",
|
|
447
|
+
manifest.output,
|
|
448
|
+
]);
|
|
449
|
+
manifest.status = "complete";
|
|
450
|
+
writeManifest(manifest);
|
|
451
|
+
console.log(`Annotated recording: ${manifest.output}`);
|
|
452
|
+
console.log(`Raw recording: ${manifest.recording}`);
|
|
453
|
+
console.log(`Manifest: ${manifestPath(manifest.recording)}`);
|
|
454
|
+
console.log(`Chapters: ${vttPath}`);
|
|
455
|
+
console.log(`Smart playback: ${playbackPath}`);
|
|
456
|
+
console.log(`\n${chapterList(manifest)}`);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function main(argv) {
|
|
460
|
+
const [command, recording, ...args] = argv;
|
|
461
|
+
if (command === "start" && recording) return start(recording, args);
|
|
462
|
+
if (command === "section" && recording && args[0]) return section(recording, args[0]);
|
|
463
|
+
if (command === "note" && recording && args[0]) return note(recording, args[0], args.slice(1));
|
|
464
|
+
if (command === "idle" && recording && args[0]) return idle(recording, args[0], args[1]);
|
|
465
|
+
if (command === "stop" && recording && args.length === 0) return stop(recording);
|
|
466
|
+
fail(USAGE);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
try {
|
|
470
|
+
main(process.argv.slice(2));
|
|
471
|
+
} catch (error) {
|
|
472
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
473
|
+
process.exitCode = 1;
|
|
474
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: alan-walkthrough
|
|
3
|
-
version: 1.
|
|
4
|
-
description:
|
|
3
|
+
version: 1.4.0
|
|
4
|
+
description: 'This skill should be used when test findings and screenshots or recordings from an Alan cloud sandbox need to become published evidence, or when the user asks to "show that this works", "record a walkthrough", "prove this bugfix", or "attach screenshots of the change". It selects the minimum captures that prove each claim, captions them, publishes them, and returns capture refs. Do not use it to choose test coverage, judge a run''s status, or write the test report.'
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Turn captures into evidence
|
|
@@ -67,6 +67,12 @@ verification. Use its returned `ref` and `markdown`; treat the ref as opaque.
|
|
|
67
67
|
The runtime supplies session-bound access. Never read or expose credentials,
|
|
68
68
|
pass guessed ownership IDs, or put a local path or upload URL in the report.
|
|
69
69
|
|
|
70
|
+
When the driver supplies a `.playback.json` sidecar for a selected recording,
|
|
71
|
+
return `smartPlayback: [{ src: <published capture ref>, idleRanges }]` with its
|
|
72
|
+
explicit ranges. Do not infer idle time from the video or mark application
|
|
73
|
+
loading, timeouts, actions, or assertions. The caller passes this metadata to
|
|
74
|
+
`create_test_report`; this skill still does not create the report.
|
|
75
|
+
|
|
70
76
|
If the helper is unavailable, use the exposed `publish_capture` MCP tool
|
|
71
77
|
according to its current schema. If neither route is available, return the
|
|
72
78
|
publishing gap. Correct an invalid capture by retaking, trimming, or converting
|
|
@@ -124,6 +130,7 @@ the marks; this skill checks, publishes, and arranges them.
|
|
|
124
130
|
`removed`, `added`). Prefer selectors. `mark()` returns `overlaps`; retake
|
|
125
131
|
with fewer or shorter labels if it is not empty. Open each marked capture
|
|
126
132
|
before selecting it, and reject one where a mark hides what it points at.
|
|
133
|
+
|
|
127
134
|
- Publish both images (Step 3) and return, per surface, the table row
|
|
128
135
|
`| Surface |  |  |` plus one legend
|
|
129
136
|
line per number, `N. Before: ... -> After: ...`, and the two local image
|
|
@@ -139,8 +146,10 @@ the marks; this skill checks, publishes, and arranges them.
|
|
|
139
146
|
## Output
|
|
140
147
|
|
|
141
148
|
Return to the caller, per claim: the published `markdown` lines (and the
|
|
142
|
-
Before / After rows with their legends) in the order they should appear,
|
|
143
|
-
|
|
149
|
+
Before / After rows with their legends) in the order they should appear, any
|
|
150
|
+
`smartPlayback` entries from explicit recording sidecars, and any claim whose
|
|
151
|
+
evidence was rejected or failed to publish, with the reason. Nothing else; the
|
|
152
|
+
caller writes the report.
|
|
144
153
|
|
|
145
154
|
## Standalone use
|
|
146
155
|
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
"alan-artifact": "sha256:ed9997cb41538630d6c3f8f297e9de79c63d9523bc8c7d0903919b5a9d8c9a5d",
|
|
5
5
|
"alan-deck": "sha256:c28976074cdb5c7c3c9d3358f14aa926fd3bd9efe4c49ca932ba9355f92bfa32",
|
|
6
6
|
"alan-diagrams": "sha256:0c5db2370042ca6dbcee86a29cb2107f11287ada66f60936889e2af938db204a",
|
|
7
|
-
"alan-docs": "sha256:
|
|
7
|
+
"alan-docs": "sha256:73adb97864ec998ffd7a6afaa64004203367cb6e6bdb939f4584ccec051a938a",
|
|
8
8
|
"alan-environment-setup": "sha256:4a4aaa5f01712100ecd702bf28185593a579424673be82f701584679d22a5943",
|
|
9
9
|
"alan-skill-authoring": "sha256:328d4e9fff80fd376bf7737e820305e708c9da102710a61131d3baf2b93aaa99",
|
|
10
10
|
"alan-tasks": "sha256:0c325cbc20f71d93354919b3f870386b54ab6dd0207a63eff485f83e28c4547e",
|
|
11
11
|
"alan-test-android": "sha256:637a0174d024270d5fd462c7dc790b34566e01fa2c3085e9dfe5856683e97b03",
|
|
12
12
|
"alan-test-desktop": "sha256:260e985f7084535b5eb3ae56e9643b60423cc9f5340f106206d6d8ae86aa4e1f",
|
|
13
|
-
"alan-test-feature": "sha256:
|
|
13
|
+
"alan-test-feature": "sha256:bfb0fe4254fd0e9e38329dc058441e38492d2f612ef343c7025d4c0e9eb899d6",
|
|
14
14
|
"alan-test-mobile": "sha256:bd8a1f60bd297c1ec6cf93d2a3dc44ec375e8d2a4b07c184efd5c68ca78110f6",
|
|
15
|
-
"alan-test-web": "sha256:
|
|
16
|
-
"alan-walkthrough": "sha256:
|
|
15
|
+
"alan-test-web": "sha256:1d48ce2eacc74d940d4a6f003be6d1a6552b040de6423158718e24a790b3cce8",
|
|
16
|
+
"alan-walkthrough": "sha256:fbc0ba190ac3955f1468e7f252d8648ba073bc1d55ebec43135e6d1d0560ebcf",
|
|
17
17
|
"alan-workflows": "sha256:ff571df9ced11a9d23970b0534d9b4cec8de89ff203f15cb6baf885d47142c08"
|
|
18
18
|
}
|
|
19
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alan-ai-hq/agent-manager-linux-x64",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.205",
|
|
4
4
|
"description": "Alan machine runtime (alan-agent) for one platform: the official Node.js binary, the runtime bundle and its launcher. Installed by @alan-ai-hq/agent-manager.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"homepage": "https://tryalan.ai",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"builtin-skills"
|
|
31
31
|
],
|
|
32
32
|
"alanRuntime": {
|
|
33
|
-
"holderProtocol":
|
|
33
|
+
"holderProtocol": 6,
|
|
34
34
|
"linkProtocol": 2,
|
|
35
35
|
"node": "24.21.0"
|
|
36
36
|
}
|