@videomule/recorder 0.0.0-stage → 0.1.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/.claude-plugin/marketplace.json +14 -0
- package/README.md +151 -2
- package/bin/vm-bridge-mcp.mjs +45 -0
- package/bin/vm-bridge.mjs +40 -0
- package/dist/aidemo.js +145 -0
- package/dist/aidemo.js.map +1 -0
- package/dist/browser.js +362 -0
- package/dist/browser.js.map +1 -0
- package/dist/cli.js +105 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.js +25 -0
- package/dist/config.js.map +1 -0
- package/dist/log.js +10 -0
- package/dist/log.js.map +1 -0
- package/dist/mapper.js +201 -0
- package/dist/mapper.js.map +1 -0
- package/dist/mcp-server.js +208 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/pipeline.js +116 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/s3.js +60 -0
- package/dist/s3.js.map +1 -0
- package/dist/seed-client.js +36 -0
- package/dist/seed-client.js.map +1 -0
- package/dist/types.js +126 -0
- package/dist/types.js.map +1 -0
- package/dist/video.js +58 -0
- package/dist/video.js.map +1 -0
- package/docs/INTEGRATE_PAGE.md +126 -0
- package/docs/SEED_ENDPOINT.md +248 -0
- package/manifest.json +67 -0
- package/package.json +46 -4
- package/plugins/videomule-aidemo-bridge/.claude-plugin/plugin.json +23 -0
- package/plugins/videomule-aidemo-bridge/.mcp.json +11 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "videomule",
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "VideoMule",
|
|
5
|
+
"url": "https://github.com/videomule"
|
|
6
|
+
},
|
|
7
|
+
"plugins": [
|
|
8
|
+
{
|
|
9
|
+
"name": "videomule-aidemo-bridge",
|
|
10
|
+
"source": "./plugins/videomule-aidemo-bridge",
|
|
11
|
+
"description": "Record a web flow locally with aidemo and seed an editable VideoMule Script page from it — no API key, no AWS credentials; you log into VideoMule once in the browser the server opens."
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
package/README.md
CHANGED
|
@@ -1,3 +1,152 @@
|
|
|
1
|
-
#
|
|
1
|
+
# videomule-aidemo-bridge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Turn **"record this feature"** into an **editable VideoMule Script page**.
|
|
4
|
+
|
|
5
|
+
This repo is the thin **glue** between [aidemo](https://github.com/tandryukha/aidemo)
|
|
6
|
+
and VideoMule. It records a web flow with aidemo (used **as‑is**, via its CLI),
|
|
7
|
+
then seeds a VideoMule project's Script page from the recording — so the user
|
|
8
|
+
lands on the Script page with a first‑draft script they can **edit**, after which
|
|
9
|
+
**VideoMule** does the voiceover (ElevenLabs) and the render (Remotion).
|
|
10
|
+
|
|
11
|
+
It does **not** fork, copy, or modify aidemo, and it does **not** touch the
|
|
12
|
+
existing `videomule-auto-record` MCP. Both stay untouched.
|
|
13
|
+
|
|
14
|
+
It runs two ways over the **same pipeline** (`src/pipeline.ts` → `runPipeline`):
|
|
15
|
+
as a **CLI** (`vm-bridge`) and as a **local stdio MCP server** (`vm-bridge-mcp`)
|
|
16
|
+
you connect to a chat client so *"record this feature"* triggers it directly.
|
|
17
|
+
|
|
18
|
+
## What it does
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
record this feature (you log into VideoMule once, in a browser the server opens)
|
|
22
|
+
1. author aidemo `init --from-url` → demos/<name>/generated/storyboard.json
|
|
23
|
+
2. record aidemo `record` → recordings/raw.webm + generated/timeline.json (local)
|
|
24
|
+
3. map storyboard + timeline → seed payload (steps, script lines, actions)
|
|
25
|
+
4. upload POST /api/upload (session) → presigned PUT → raw.webm lands in VideoMule's S3
|
|
26
|
+
5. seed POST /api/bridge/seed-project (session) → creates the project + Script page
|
|
27
|
+
→ returns the /script URL
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Steps 4–5 ride your VideoMule browser session — no API key, no AWS credentials. The
|
|
31
|
+
AWS credentials stay server-side inside the dashboard's presign route.
|
|
32
|
+
|
|
33
|
+
What it deliberately does **not** do: it never runs aidemo's `voice`,
|
|
34
|
+
`captions`, `compose`, or `render`. VideoMule owns voiceover + word timing +
|
|
35
|
+
pacing/sync + render. aidemo only contributes **structure + recording +
|
|
36
|
+
click timings + first‑draft narration**.
|
|
37
|
+
|
|
38
|
+
### Cursor is baked into the recording
|
|
39
|
+
|
|
40
|
+
The recorded `raw.webm` shows a visible pointer that glides to each target with a
|
|
41
|
+
ripple on every click — same approach as `videomule-auto-record`'s in‑page
|
|
42
|
+
overlay (both inject a pointer that the CDP video captures). aidemo bakes this in
|
|
43
|
+
by default; the bridge **enforces** it by stripping any `cursor` block from the
|
|
44
|
+
storyboard before recording (a `cursor` block would switch aidemo to a clean,
|
|
45
|
+
cursor‑free take whose pointer is only drawn at aidemo's compose stage — which the
|
|
46
|
+
bridge never runs, so the cursor would vanish). See `ensureBakedCursor` in
|
|
47
|
+
`src/aidemo.ts`.
|
|
48
|
+
|
|
49
|
+
## Why audio is generated *after* the Script page (not before)
|
|
50
|
+
|
|
51
|
+
The Script page exists so the user **edits** the script. The moment they edit a
|
|
52
|
+
line, any pre‑generated audio and its word timing are stale — VideoMule
|
|
53
|
+
regenerates the voiceover (and its ElevenLabs word timing) after the edit
|
|
54
|
+
anyway. So we seed **text only**; audio + sync happen downstream, on the final
|
|
55
|
+
edited script. See `docs/SEED_ENDPOINT.md` and the project plan for the full
|
|
56
|
+
rationale.
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Requires: Node 20+, and the same tools aidemo needs on PATH — **Chrome**,
|
|
65
|
+
**ffmpeg/ffprobe**. Point `AIDEMO_DIR` at an aidemo checkout (default
|
|
66
|
+
`/Users/techie/aidemo`); aidemo needs its own `OPENAI_API_KEY` only if you later
|
|
67
|
+
run its voice/caption stages — this bridge does not.
|
|
68
|
+
|
|
69
|
+
## Authentication — your VideoMule browser session (no API key, no AWS creds)
|
|
70
|
+
|
|
71
|
+
You log into VideoMule **once** in the Chrome window the server opens (via the `login`
|
|
72
|
+
tool, or automatically before a CLI run). That session persists in a local Chrome
|
|
73
|
+
profile and authorizes everything after it:
|
|
74
|
+
|
|
75
|
+
- the recording is uploaded to VideoMule's S3 through the dashboard's **own
|
|
76
|
+
session-guarded presigned-upload route** (`/api/upload`) — so **no AWS credentials
|
|
77
|
+
ever touch your machine**, and there's no bucket to configure;
|
|
78
|
+
- the seed call rides the same session.
|
|
79
|
+
|
|
80
|
+
Nothing sensitive is stored in your MCP config — just where VideoMule is.
|
|
81
|
+
|
|
82
|
+
## Configure (env)
|
|
83
|
+
|
|
84
|
+
| Var | Meaning |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `VIDEOMULE_DASHBOARD_URL` | dashboard base URL (default `https://app.videomule.ai`) |
|
|
87
|
+
| `VIDEOMULE_ORG_SLUG` | optional — a hint for the project URL; the real org comes from your session |
|
|
88
|
+
| `AIDEMO_DIR` | path to the aidemo checkout (default `/Users/techie/aidemo`) |
|
|
89
|
+
| `VIDEOMULE_LOGIN_EMAIL` / `VIDEOMULE_LOGIN_PASSWORD` | optional — automate the one-time sign-in |
|
|
90
|
+
| `VIDEOMULE_USER_DATA_DIR` | optional — where the Chrome login profile lives |
|
|
91
|
+
| `VIDEOMULE_BASIC_AUTH_USER` / `_PASS` | optional — outer HTTP Basic Auth gate (e.g. staging) |
|
|
92
|
+
|
|
93
|
+
## Run
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# record a site and seed the Script page
|
|
97
|
+
vm-bridge --url https://example.com --name my-demo
|
|
98
|
+
|
|
99
|
+
# reuse an existing recording (e.g. after hand-editing the storyboard narration)
|
|
100
|
+
vm-bridge --name my-demo --skip-record
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
On success it prints the **Script page URL** on stdout (logs go to stderr).
|
|
104
|
+
|
|
105
|
+
## Run as an MCP server
|
|
106
|
+
|
|
107
|
+
Connect the server to any MCP client (Claude Code, Claude Desktop, …) so a chat
|
|
108
|
+
prompt like *"record this feature at <url>"* drives the whole pipeline. stdout is
|
|
109
|
+
reserved for JSON-RPC; all logs go to stderr.
|
|
110
|
+
|
|
111
|
+
### One-click install (the "Integrate" path)
|
|
112
|
+
|
|
113
|
+
The package ships a Claude Desktop/MCPB bundle (`manifest.json`) and a Claude plugin
|
|
114
|
+
(`.claude-plugin/marketplace.json`). Build the bundle with `npm run bundle` → a
|
|
115
|
+
`videomule-aidemo-bridge-<version>.mcpb` you double-click in Claude Desktop, or add via
|
|
116
|
+
`claude mcp add videomule-aidemo-bridge -- npx -y @videomule/recorder`. The install
|
|
117
|
+
dialog collects the dashboard URL + aidemo path; you then run `login` once.
|
|
118
|
+
|
|
119
|
+
### Manual client config
|
|
120
|
+
|
|
121
|
+
```jsonc
|
|
122
|
+
{
|
|
123
|
+
"mcpServers": {
|
|
124
|
+
"videomule-aidemo-bridge": {
|
|
125
|
+
"command": "node",
|
|
126
|
+
"args": ["/abs/path/to/videomule-aidemo-bridge/bin/vm-bridge-mcp.mjs"],
|
|
127
|
+
"env": {
|
|
128
|
+
"VIDEOMULE_DASHBOARD_URL": "https://app.videomule.ai",
|
|
129
|
+
"AIDEMO_DIR": "/abs/path/to/aidemo"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Tools:
|
|
137
|
+
|
|
138
|
+
| Tool | What it does |
|
|
139
|
+
|---|---|
|
|
140
|
+
| `login` | Open VideoMule so you sign in once; the session persists. **Call first.** |
|
|
141
|
+
| `record_and_seed` | `{ url, name, headed?, force? }` → author → record → upload → seed. Returns `scriptUrl`. Long synchronous call (aidemo's recorder blocks until the take finishes). |
|
|
142
|
+
| `seed_only` | `{ name }` → reuse an existing recording; upload → seed only (after hand-editing the storyboard narration). |
|
|
143
|
+
|
|
144
|
+
Dev: `npm run mcp` runs the server from source via `tsx`.
|
|
145
|
+
|
|
146
|
+
## Status
|
|
147
|
+
|
|
148
|
+
The bridge side is complete. The **VideoMule dashboard seed endpoint**
|
|
149
|
+
(`POST /api/bridge/seed-project`) is specified in [`docs/SEED_ENDPOINT.md`](docs/SEED_ENDPOINT.md)
|
|
150
|
+
for the VideoMule team to implement — a new **session-authed** route (there is no JSON
|
|
151
|
+
project-creation API today). The recording upload reuses the dashboard's existing
|
|
152
|
+
`/api/upload` presign route, so no new upload endpoint is needed.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launcher for the MCP server. Prefers the compiled build (dist/mcp-server.js,
|
|
3
|
+
// what ships to users); falls back to running the TypeScript source via tsx for
|
|
4
|
+
// local development. stdout is the JSON-RPC stream, so we inherit stdio and write
|
|
5
|
+
// nothing to stdout here.
|
|
6
|
+
import { spawnSync } from "node:child_process";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { dirname, join } from "node:path";
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import { createRequire } from "node:module";
|
|
11
|
+
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
const root = join(__dirname, "..");
|
|
15
|
+
|
|
16
|
+
const compiled = join(root, "dist", "mcp-server.js");
|
|
17
|
+
if (existsSync(compiled)) {
|
|
18
|
+
const res = spawnSync(process.execPath, [compiled, ...process.argv.slice(2)], {
|
|
19
|
+
stdio: "inherit",
|
|
20
|
+
});
|
|
21
|
+
process.exit(res.status ?? 1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Dev fallback: no build present, run the source through tsx.
|
|
25
|
+
function resolveTsx() {
|
|
26
|
+
try {
|
|
27
|
+
const pkg = require.resolve("tsx/package.json");
|
|
28
|
+
return join(dirname(pkg), "dist", "cli.mjs");
|
|
29
|
+
} catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const tsx = resolveTsx();
|
|
34
|
+
if (!tsx) {
|
|
35
|
+
process.stderr.write(
|
|
36
|
+
"No compiled build (dist/) and tsx is unavailable. Run `npm run build` first.\n"
|
|
37
|
+
);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
const res = spawnSync(
|
|
41
|
+
process.execPath,
|
|
42
|
+
[tsx, join(root, "src", "mcp-server.ts"), ...process.argv.slice(2)],
|
|
43
|
+
{ stdio: "inherit" }
|
|
44
|
+
);
|
|
45
|
+
process.exit(res.status ?? 1);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launcher for the CLI. Prefers the compiled build (dist/cli.js); falls back to
|
|
3
|
+
// running the TypeScript source via tsx for local development.
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
import { createRequire } from "node:module";
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
12
|
+
const root = join(__dirname, "..");
|
|
13
|
+
|
|
14
|
+
const compiled = join(root, "dist", "cli.js");
|
|
15
|
+
if (existsSync(compiled)) {
|
|
16
|
+
const res = spawnSync(process.execPath, [compiled, ...process.argv.slice(2)], {
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
});
|
|
19
|
+
process.exit(res.status ?? 1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function resolveTsx() {
|
|
23
|
+
try {
|
|
24
|
+
const pkg = require.resolve("tsx/package.json");
|
|
25
|
+
return join(dirname(pkg), "dist", "cli.mjs");
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const tsx = resolveTsx();
|
|
31
|
+
if (!tsx) {
|
|
32
|
+
console.error("No compiled build (dist/) and tsx is unavailable. Run `npm run build` first.");
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
const res = spawnSync(
|
|
36
|
+
process.execPath,
|
|
37
|
+
[tsx, join(root, "src", "cli.ts"), ...process.argv.slice(2)],
|
|
38
|
+
{ stdio: "inherit" }
|
|
39
|
+
);
|
|
40
|
+
process.exit(res.status ?? 1);
|
package/dist/aidemo.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrates aidemo AS-IS via its CLI. We never import or modify aidemo code;
|
|
3
|
+
* we shell out to `node bin/aidemo.mjs <cmd>` in the aidemo checkout and read
|
|
4
|
+
* the files it writes. We only use aidemo up to the RECORDING — never its
|
|
5
|
+
* voice/captions/compose/render stages (VideoMule owns those).
|
|
6
|
+
*
|
|
7
|
+
* Output files aidemo writes (stable, documented paths), all under
|
|
8
|
+
* `<aidemoDir>/demos/<name>/`:
|
|
9
|
+
* generated/storyboard.json — scene narration + actions
|
|
10
|
+
* generated/timeline.json — scene windows + per-action timing
|
|
11
|
+
* recordings/raw.webm — the recording
|
|
12
|
+
*/
|
|
13
|
+
import { spawn } from "node:child_process";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { access, readFile, writeFile } from "node:fs/promises";
|
|
16
|
+
import { constants as FS } from "node:fs";
|
|
17
|
+
export function demoPaths(aidemoDir, name) {
|
|
18
|
+
const demoDir = join(aidemoDir, "demos", name);
|
|
19
|
+
return {
|
|
20
|
+
demoDir,
|
|
21
|
+
storyboard: join(demoDir, "generated", "storyboard.json"),
|
|
22
|
+
timeline: join(demoDir, "generated", "timeline.json"),
|
|
23
|
+
rawVideo: join(demoDir, "recordings", "raw.webm"),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Run the aidemo CLI with cwd=aidemoDir, streaming logs to our stderr. */
|
|
27
|
+
function runAidemo(aidemoDir, args) {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
const child = spawn("node", [join(aidemoDir, "bin", "aidemo.mjs"), ...args], {
|
|
30
|
+
cwd: aidemoDir,
|
|
31
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
32
|
+
env: process.env,
|
|
33
|
+
});
|
|
34
|
+
child.on("error", reject);
|
|
35
|
+
child.on("exit", (code) => code === 0
|
|
36
|
+
? resolve()
|
|
37
|
+
: reject(new Error(`aidemo ${args[0]} exited with code ${code}`)));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async function fileExists(p) {
|
|
41
|
+
try {
|
|
42
|
+
await access(p, FS.R_OK);
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** True if `bin` resolves on PATH (exit 0 from `<bin> -version`). */
|
|
50
|
+
function onPath(bin) {
|
|
51
|
+
return new Promise((resolve) => {
|
|
52
|
+
const child = spawn(bin, ["-version"], { stdio: "ignore" });
|
|
53
|
+
child.on("error", () => resolve(false));
|
|
54
|
+
child.on("exit", (code) => resolve(code === 0));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Check the local prerequisites a recording needs and throw ONE clear, actionable
|
|
59
|
+
* message if anything is missing — so a non-technical user sees "install X", not an
|
|
60
|
+
* aidemo stack trace. Prereqs: an aidemo checkout at aidemoDir, and ffmpeg/ffprobe on
|
|
61
|
+
* PATH. (Chrome is resolved by aidemo/Playwright at launch; its absence surfaces as a
|
|
62
|
+
* launch error we can't pre-detect cleanly here.)
|
|
63
|
+
*/
|
|
64
|
+
export async function preflight(aidemoDir) {
|
|
65
|
+
const problems = [];
|
|
66
|
+
if (!(await fileExists(join(aidemoDir, "bin", "aidemo.mjs")))) {
|
|
67
|
+
problems.push(`aidemo not found at ${aidemoDir} (set AIDEMO_DIR to your aidemo checkout, ` +
|
|
68
|
+
`or install it: npx -y github:tandryukha/aidemo).`);
|
|
69
|
+
}
|
|
70
|
+
const [ff, fp] = await Promise.all([onPath("ffmpeg"), onPath("ffprobe")]);
|
|
71
|
+
if (!ff || !fp) {
|
|
72
|
+
problems.push("ffmpeg/ffprobe not on PATH (install ffmpeg — e.g. `brew install ffmpeg` on macOS).");
|
|
73
|
+
}
|
|
74
|
+
if (problems.length) {
|
|
75
|
+
throw new Error("Can't record — missing local prerequisites:\n - " + problems.join("\n - "));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Scaffold a demo from a live URL: `aidemo init <name> --from-url <url>`.
|
|
80
|
+
* aidemo inspects the page (no LLM) → a starter storyboard the caller can
|
|
81
|
+
* refine. Returns the demo's file paths.
|
|
82
|
+
*/
|
|
83
|
+
export async function authorFromUrl(aidemoDir, name, url, opts = {}) {
|
|
84
|
+
const args = ["init", name, "--from-url", url];
|
|
85
|
+
if (opts.force)
|
|
86
|
+
args.push("--force");
|
|
87
|
+
if (opts.headed)
|
|
88
|
+
args.push("--headed");
|
|
89
|
+
await runAidemo(aidemoDir, args);
|
|
90
|
+
const paths = demoPaths(aidemoDir, name);
|
|
91
|
+
if (!(await fileExists(paths.storyboard))) {
|
|
92
|
+
throw new Error(`aidemo init did not produce ${paths.storyboard}. Check the init output above.`);
|
|
93
|
+
}
|
|
94
|
+
return paths;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Guarantee the cursor is BAKED into the recording (an arrow that glides to each
|
|
98
|
+
* target + a ripple on every click — same technique as videomule-auto-record's
|
|
99
|
+
* installCursorOverlay). aidemo bakes the cursor by default, BUT a storyboard
|
|
100
|
+
* with a `cursor` block switches it to a clean, cursor-free take whose pointer
|
|
101
|
+
* is drawn only at aidemo's compose stage — which the bridge never runs
|
|
102
|
+
* (VideoMule renders). That would silently ship a cursor-less video with no
|
|
103
|
+
* clicks visible. So strip any `cursor` block before recording and warn.
|
|
104
|
+
*
|
|
105
|
+
* Returns true if it had to strip one.
|
|
106
|
+
*/
|
|
107
|
+
export async function ensureBakedCursor(storyboardPath) {
|
|
108
|
+
const raw = await readFile(storyboardPath, "utf8");
|
|
109
|
+
const sb = JSON.parse(raw);
|
|
110
|
+
if (!("cursor" in sb))
|
|
111
|
+
return false;
|
|
112
|
+
delete sb.cursor;
|
|
113
|
+
await writeFile(storyboardPath, JSON.stringify(sb, null, 2) + "\n", "utf8");
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Record the demo: `aidemo record <demoDir> [--headless]`. Writes raw.webm +
|
|
118
|
+
* timeline.json. (The aidemo CLI blocks until the take finishes, so there's no
|
|
119
|
+
* jobId to poll — that polling model is only the MCP surface.)
|
|
120
|
+
*
|
|
121
|
+
* Before recording it enforces the baked cursor so the final video shows the
|
|
122
|
+
* pointer + clicks (see ensureBakedCursor). Returns true when it had to strip a
|
|
123
|
+
* `cursor` block, so the caller can surface that as a warning (we don't log it
|
|
124
|
+
* here — stdout is reserved for the MCP server's JSON-RPC).
|
|
125
|
+
*/
|
|
126
|
+
export async function record(paths, aidemoDir, opts = {}) {
|
|
127
|
+
const stripped = await ensureBakedCursor(paths.storyboard);
|
|
128
|
+
const args = ["record", paths.demoDir];
|
|
129
|
+
if (opts.headless)
|
|
130
|
+
args.push("--headless");
|
|
131
|
+
// Seed a logged-in target-site session so the take records as that user.
|
|
132
|
+
// aidemo adds the storageState's cookies + localStorage before the first action;
|
|
133
|
+
// --profile-seeded silences its carried-over-state warning.
|
|
134
|
+
if (opts.storageState) {
|
|
135
|
+
args.push("--storage-state", opts.storageState, "--profile-seeded");
|
|
136
|
+
}
|
|
137
|
+
await runAidemo(aidemoDir, args);
|
|
138
|
+
for (const f of [paths.timeline, paths.rawVideo]) {
|
|
139
|
+
if (!(await fileExists(f))) {
|
|
140
|
+
throw new Error(`aidemo record finished but ${f} is missing.`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return stripped;
|
|
144
|
+
}
|
|
145
|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