@alan-ai-hq/agent-manager-linux-arm64 0.1.204 → 0.1.206
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 +133866 -139932
- package/alan-holder.cjs +81215 -80682
- package/{alan-lease.cjs → alan-watchdog.cjs} +45 -5086
- 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 +3 -3
|
@@ -199,13 +199,12 @@ A team VM is a computer that everyone in the team can run sessions on. VM means
|
|
|
199
199
|
|
|
200
200
|
> **Warning:** Anyone in the team can run agent commands on a team VM. Do not use your personal laptop. Use a computer that exists only for this work.
|
|
201
201
|
|
|
202
|
-
**Use Alan's tools from CLIs you start yourself (
|
|
202
|
+
**Use Alan's tools from CLIs you start yourself (Alan MCP)**
|
|
203
203
|
|
|
204
204
|
This is only for coding agents that you start yourself in a terminal. Sessions that you start in Alan do not need it.
|
|
205
205
|
|
|
206
|
-
1. In your computer's details, choose the **
|
|
206
|
+
1. In your computer's details, choose the **Alan MCP** tab.
|
|
207
207
|
2. Under **Alan MCP**, choose **Enable**. Alan adds its tools to the coding agents on this computer, such as Claude Code, Codex and Cursor.
|
|
208
|
-
3. Optional: under **Session ingestion**, turn on the switch for Claude Code or Codex. Alan then copies those terminal sessions into Alan after each reply.
|
|
209
208
|
|
|
210
209
|
## Next
|
|
211
210
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: alan-test-feature
|
|
3
|
-
version: 3.
|
|
4
|
-
description:
|
|
3
|
+
version: 3.4.0
|
|
4
|
+
description: 'This skill should be used when the user asks to "test this change", "test this PR", "QA this feature", "verify this works in the browser", or "test this desktop app" on any repository in an Alan cloud sandbox. It works out the surfaces from the diff, writes exploratory charters, runs them through the web, desktop, or mobile driver with sub-agents when available, judges the result, and always creates a free-flow test report with published evidence inline. Do not use for authoring Playwright specs or for pure unit-test work.'
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Test a change the way a first-day QA engineer would
|
|
@@ -16,14 +16,14 @@ would explain the run to a teammate.
|
|
|
16
16
|
|
|
17
17
|
This skill is the orchestrator. It decides; other skills operate:
|
|
18
18
|
|
|
19
|
-
| Job
|
|
20
|
-
|
|
|
21
|
-
| Recon, risk ranking, charters, routing, final status, the report | this skill
|
|
22
|
-
| Browser pages, responsive layouts, PWAs
|
|
23
|
-
| Desktop apps, including native ones with no CDP endpoint
|
|
24
|
-
| Phone and tablet targets, including native-app gaps
|
|
25
|
-
| Choosing, captioning, and publishing evidence
|
|
26
|
-
| Persisting the report
|
|
19
|
+
| Job | Owner |
|
|
20
|
+
| ---------------------------------------------------------------- | -------------------- |
|
|
21
|
+
| Recon, risk ranking, charters, routing, final status, the report | this skill |
|
|
22
|
+
| Browser pages, responsive layouts, PWAs | `/alan-test-web` |
|
|
23
|
+
| Desktop apps, including native ones with no CDP endpoint | `/alan-test-desktop` |
|
|
24
|
+
| Phone and tablet targets, including native-app gaps | `/alan-test-mobile` |
|
|
25
|
+
| Choosing, captioning, and publishing evidence | `/alan-walkthrough` |
|
|
26
|
+
| Persisting the report | `create_test_report` |
|
|
27
27
|
|
|
28
28
|
Drivers return notes and sandbox capture paths; they never publish evidence or
|
|
29
29
|
create reports. Only this skill assigns the overall status and calls
|
|
@@ -107,8 +107,8 @@ parent session through the web driver and save state for the charters.
|
|
|
107
107
|
|
|
108
108
|
## Step 3 · Write charters, not checklists
|
|
109
109
|
|
|
110
|
-
A charter is one mission with a time box ("Explore
|
|
111
|
-
|
|
110
|
+
A charter is one mission with a time box ("Explore _X_ with _Y_ to discover
|
|
111
|
+
_Z_") plus the relevant risks with a one-line oracle each. Choose enough charters
|
|
112
112
|
to meet the requested coverage, ordered by risk; a smoke run may need only one.
|
|
113
113
|
Keep each mission bounded. The agent running it may follow whatever looks
|
|
114
114
|
wrong, and should.
|
|
@@ -179,7 +179,11 @@ share media. Leave the other captures in the report.
|
|
|
179
179
|
|
|
180
180
|
Call `create_test_report` with `teamId`, `title`, a one- or two-sentence
|
|
181
181
|
`summary`, `status`, `branch`, `baseBranch`, `appUrl`, `commits`,
|
|
182
|
-
`changedFiles` when known, and the report in `content`.
|
|
182
|
+
`changedFiles` when known, and the report in `content`. Include the
|
|
183
|
+
walkthrough's `smartPlayback` entries when explicit idle-range sidecars are
|
|
184
|
+
present. These reference published `capture:` refs and enable opt-in 4×
|
|
185
|
+
playback only during intentional inactivity; never infer or add ranges for
|
|
186
|
+
application loading, timeouts, actions, or assertions. The owning task,
|
|
183
187
|
workflow, and conversation come from the session.
|
|
184
188
|
|
|
185
189
|
The body is free-flow Markdown for the person who decides what happens next,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: alan-test-web
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.6.0
|
|
4
4
|
description: "This skill should be used when a test charter must be run in a real browser: a web page or route, a responsive or mobile-width layout, or a PWA. It drives agent-browser on the streamed Alan cloud desktop, returns observations, findings, gaps, and sandbox capture paths. Do not use it to choose coverage, publish evidence, or write the test report; alan-test-feature does that."
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -66,9 +66,38 @@ every observation. It is not native-device validation.
|
|
|
66
66
|
- Set and verify the viewport before recording; keep it stable for the flow.
|
|
67
67
|
- Save driver captures with `.local-only` before the extension. Alan skips
|
|
68
68
|
automatic chat attachment for those files; the caller selects what to publish.
|
|
69
|
-
- Start `record start <evidence-dir>/<charter-slug>.local-only.webm` before
|
|
70
|
-
action and stop it at the end, including on failure.
|
|
71
|
-
|
|
69
|
+
- Start `record start <evidence-dir>/<charter-slug>.local-only.webm --cursor` before
|
|
70
|
+
the first action and stop it at the end, including on failure. The pointer must
|
|
71
|
+
be visible in the finished recording. Keep one recording under two minutes;
|
|
72
|
+
split long charters.
|
|
73
|
+
- When a flow needs explanation, use `scripts/record-walkthrough.mjs` from this
|
|
74
|
+
skill's directory instead of bare `record start`. It keeps the raw take, adds
|
|
75
|
+
the cursor, and renders an annotated MP4 plus a manifest and WebVTT chapters:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
node <this-skill-dir>/scripts/record-walkthrough.mjs start <evidence-dir>/<charter-slug>.local-only.raw.webm --session <charter-slug>
|
|
79
|
+
node <this-skill-dir>/scripts/record-walkthrough.mjs section <evidence-dir>/<charter-slug>.local-only.raw.webm "Open an existing task"
|
|
80
|
+
node <this-skill-dir>/scripts/record-walkthrough.mjs note <evidence-dir>/<charter-slug>.local-only.raw.webm "Priority remains High after reload" --selector "[data-testid=task-priority]"
|
|
81
|
+
node <this-skill-dir>/scripts/record-walkthrough.mjs idle <evidence-dir>/<charter-slug>.local-only.raw.webm start "Between independent checks"
|
|
82
|
+
node <this-skill-dir>/scripts/record-walkthrough.mjs idle <evidence-dir>/<charter-slug>.local-only.raw.webm stop
|
|
83
|
+
node <this-skill-dir>/scripts/record-walkthrough.mjs stop <evidence-dir>/<charter-slug>.local-only.raw.webm
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Use two to five intent-level sections, not one per click. Add a note only when
|
|
87
|
+
the viewer could miss the point; keep it short and never hide the decisive
|
|
88
|
+
action or outcome. `stop` prints the chapter list for the caller's notes and
|
|
89
|
+
report. If annotation rendering fails, keep the raw recording, make one bounded
|
|
90
|
+
`stop` retry (it does not stop the browser twice), and return the raw take plus
|
|
91
|
+
the rendering gap if it still fails. The annotated MP4 is derived evidence;
|
|
92
|
+
the raw take remains available for inspection.
|
|
93
|
+
|
|
94
|
+
Bracket only intentional inactivity with `idle start <label>` and `idle stop`.
|
|
95
|
+
Never mark application loading, network waits, timeouts, actions, or assertions
|
|
96
|
+
as idle: their duration is evidence. `stop` writes `<annotated>.playback.json`
|
|
97
|
+
with the explicit ranges; both video files stay real-time. The report player
|
|
98
|
+
offers opt-in 4× playback inside those ranges without altering the source.
|
|
99
|
+
Return this sidecar path with the recording when it contains idle ranges.
|
|
100
|
+
|
|
72
101
|
- Re-observe with `snapshot --delta`: the first observation returns the full
|
|
73
102
|
tree and later ones return only what changed. Use `--full` to reset the
|
|
74
103
|
baseline after a navigation, a viewport change, or a ref you no longer trust.
|
|
@@ -105,7 +134,7 @@ Return only this, as a short note:
|
|
|
105
134
|
exact reproduction from a known state, times reproduced out of attempts,
|
|
106
135
|
confidence, and the sandbox capture paths that support it;
|
|
107
136
|
- **unverified**: what you could not reach and why;
|
|
108
|
-
- **capture paths**: the recording and screenshots you took, with before/after pairs and their numbered change list.
|
|
137
|
+
- **capture paths**: the recording and screenshots you took, with before/after pairs and their numbered change list. For an annotated walkthrough, include the annotated MP4, raw take, printed chapter list, and any smart-playback sidecar with explicit idle ranges.
|
|
109
138
|
|
|
110
139
|
## Cleanup
|
|
111
140
|
|
|
@@ -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
|
|