cuetake 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/package.json +1 -2
- package/src/cli.js +28 -5
- package/src/cursor.js +3 -32
- package/src/edit.js +37 -41
- package/src/look.js +121 -0
- package/src/pipeline.js +55 -14
- package/src/render-page.js +391 -199
- package/src/render.js +33 -9
- package/src/stage.js +48 -44
- package/src/styles/arrow.js +13 -0
- package/src/styles/browser.js +24 -0
- package/src/styles/dot.js +11 -0
- package/src/styles/fluted.glsl +35 -0
- package/src/styles/macos.js +12 -0
- package/src/styles/shadow.glsl +10 -0
- package/src/styles/spark.js +19 -0
- package/src/styles.js +105 -0
- package/skills/cuetake/SKILL.md +0 -52
- package/skills/cuetake/authentication.md +0 -18
- package/skills/cuetake/scenarios.md +0 -94
- package/skills/cuetake/scripts/cuetake +0 -4
- package/skills/cuetake/setup.md +0 -28
package/src/render.js
CHANGED
|
@@ -3,11 +3,13 @@ import { createRequire } from 'node:module';
|
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { chromium } from 'playwright';
|
|
6
|
+
import { contentType } from './styles.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Render runs in a headless Chromium page (ADR 0001). Files reach the page through intercepted
|
|
9
10
|
* requests on a private origin, so no port is opened: the Source is served with byte ranges and
|
|
10
|
-
* the Final arrives as positioned chunks written straight to disk.
|
|
11
|
+
* the Final arrives as positioned chunks written straight to disk. The page has no network: it runs
|
|
12
|
+
* agent-written code (ADR 0005), and anything that code tries to fetch from elsewhere is refused.
|
|
11
13
|
*/
|
|
12
14
|
const ORIGIN = 'https://render.cuetake.invalid';
|
|
13
15
|
// The bundled build is a single file the page can import; the package's own entry is many modules.
|
|
@@ -30,19 +32,23 @@ async function serveRange(route, path) {
|
|
|
30
32
|
try {
|
|
31
33
|
const body = Buffer.alloc(end - start + 1);
|
|
32
34
|
await handle.read(body, 0, body.length, start);
|
|
33
|
-
await route.fulfill({ status: match ? 206 : 200, body, headers: { 'content-type':
|
|
35
|
+
await route.fulfill({ status: match ? 206 : 200, body, headers: { 'content-type': contentType(path), 'accept-ranges': 'bytes', 'content-range': `bytes ${start}-${end}/${size}` } });
|
|
34
36
|
} finally { await handle.close(); }
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
/** Opens the render page with `files` ({ name: path }) readable and `writable` ({ name: handle }) writable. */
|
|
38
40
|
async function withRenderPage({ files = {}, writable = {} }, task) {
|
|
39
|
-
|
|
41
|
+
// An unreachable proxy stops what request interception does not see, such as WebSockets.
|
|
42
|
+
const browser = await chromium.launch({ headless: true, channel: 'chromium', proxy: { server: 'http://127.0.0.1:9' }, args: ['--force-webrtc-ip-handling-policy=disable_non_proxied_udp'] });
|
|
43
|
+
const blocked = [];
|
|
40
44
|
try {
|
|
41
45
|
const page = await browser.newPage();
|
|
42
46
|
const errors = [];
|
|
43
47
|
page.on('pageerror', error => errors.push(error.message));
|
|
44
|
-
await page.route(
|
|
45
|
-
const
|
|
48
|
+
await page.route('**/*', async route => {
|
|
49
|
+
const url = new URL(route.request().url());
|
|
50
|
+
if (url.origin !== ORIGIN) { blocked.push(url.href); return route.abort('blockedbyclient'); }
|
|
51
|
+
const { pathname, searchParams } = url;
|
|
46
52
|
const name = pathname.slice('/files/'.length);
|
|
47
53
|
if (route.request().method() === 'POST' && writable[name]) {
|
|
48
54
|
const body = route.request().postDataBuffer();
|
|
@@ -56,21 +62,39 @@ async function withRenderPage({ files = {}, writable = {} }, task) {
|
|
|
56
62
|
});
|
|
57
63
|
await page.goto(`${ORIGIN}/render.html`);
|
|
58
64
|
await page.waitForFunction(() => window.cuetakeRender, null, { timeout: 15_000 }).catch(() => { throw new Error(`Render page failed to load: ${errors.join('; ')}`); });
|
|
59
|
-
|
|
65
|
+
const result = await task(page).catch(error => { throw offline(error, blocked); });
|
|
66
|
+
if (blocked.length) throw offline(null, blocked);
|
|
67
|
+
return result;
|
|
60
68
|
} finally { await browser.close(); }
|
|
61
69
|
}
|
|
62
70
|
|
|
63
|
-
/**
|
|
64
|
-
|
|
71
|
+
/** Names what styling code tried to fetch, which the render page cannot. */
|
|
72
|
+
function offline(error, blocked) {
|
|
73
|
+
if (!blocked.length) return error;
|
|
74
|
+
const note = `The render page has no network and refused ${[...new Set(blocked)].join(', ')}; download it next to the Look or Take and name it by its relative path in \`files\``;
|
|
75
|
+
return new Error(error ? `${error.message}\n${note}` : note);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Composes the Final from a Source, Timeline and Edit; `files` serves the Edit's styling files (styles.js forRender). */
|
|
79
|
+
export async function renderFinal({ sourcePath, finalPath, timeline, edit, files = {} }) {
|
|
65
80
|
const handle = await fs.open(finalPath, 'w');
|
|
66
81
|
try {
|
|
67
|
-
return await withRenderPage({ files: { source: sourcePath }, writable: { final: handle } }, page => page.evaluate(options => window.cuetakeRender(options), {
|
|
82
|
+
return await withRenderPage({ files: { ...files, source: sourcePath }, writable: { final: handle } }, page => page.evaluate(options => window.cuetakeRender(options), {
|
|
68
83
|
sourceUrl: `${ORIGIN}/files/source`, finalUrl: `${ORIGIN}/files/final`, duration: timeline.duration,
|
|
69
84
|
viewport: timeline.viewport, pointer: timeline.pointer ?? [], events: timeline.events ?? [], edit,
|
|
70
85
|
}));
|
|
71
86
|
} finally { await handle.close(); }
|
|
72
87
|
}
|
|
73
88
|
|
|
89
|
+
/** A Preview PNG of `tiles` ([{ name, edit }]) at `at` seconds, or at the end with the camera wide. No Final is touched. */
|
|
90
|
+
export async function composePreview({ sourcePath, timeline, tiles, at, files = {} }) {
|
|
91
|
+
const png = await withRenderPage({ files: { ...files, source: sourcePath } }, page => page.evaluate(options => window.cuetakePreview(options), {
|
|
92
|
+
sourceUrl: `${ORIGIN}/files/source`, duration: timeline.duration, viewport: timeline.viewport,
|
|
93
|
+
pointer: timeline.pointer ?? [], events: timeline.events ?? [], tiles, at: at ?? null,
|
|
94
|
+
}));
|
|
95
|
+
return Buffer.from(png, 'base64');
|
|
96
|
+
}
|
|
97
|
+
|
|
74
98
|
/** Container metadata of a Final plus a full decode. */
|
|
75
99
|
export function inspectFinal(path) {
|
|
76
100
|
return withRenderPage({ files: { final: path } }, page => page.evaluate(url => window.cuetakeInspect(url), `${ORIGIN}/files/final`));
|
package/src/stage.js
CHANGED
|
@@ -1,47 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Stage layout shared by Node and the render page. Pure functions, no imports.
|
|
3
3
|
*
|
|
4
|
-
* The stage is the Final's pixel grid
|
|
5
|
-
* bar above it)
|
|
4
|
+
* The stage is the Final's pixel grid at camera zoom 1: the page sits in a window (with an optional
|
|
5
|
+
* chrome bar above it) inset by padding. The Background stays in output pixels whatever the camera does.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
export const
|
|
10
|
-
/** Chrome bar heights in page CSS pixels. */
|
|
11
|
-
export const CHROME_HEIGHT = { none: 0, macos: 28, browser: 44 };
|
|
8
|
+
/** The Final's pixel size. */
|
|
9
|
+
export const outputSize = edit => ({ width: edit.output.width, height: edit.output.height });
|
|
12
10
|
|
|
13
|
-
/** The
|
|
14
|
-
export function
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
? { width: even(short * viewport.width / viewport.height), height: short }
|
|
18
|
-
: { width: short, height: even(short * viewport.height / viewport.width) };
|
|
19
|
-
const long = even(short * 16 / 9);
|
|
20
|
-
return { '16:9': { width: long, height: short }, '9:16': { width: short, height: long }, '1:1': { width: short, height: short } }[edit.output.aspect];
|
|
11
|
+
/** The Edit with its output scaled so the short side is `short` pixels; everything else scales with it. */
|
|
12
|
+
export function atShortSide(edit, short) {
|
|
13
|
+
const { width, height } = edit.output, k = short / Math.min(width, height), even = n => Math.round(n * k / 2) * 2;
|
|
14
|
+
return { ...edit, output: { ...edit.output, width: even(width), height: even(height) } };
|
|
21
15
|
}
|
|
22
16
|
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const scale = Math.min((width -
|
|
33
|
-
const w = viewport.width * scale, h = (viewport.height +
|
|
34
|
-
const window = { x: (width - w) / 2, y: (height - h) / 2, w, h };
|
|
35
|
-
const chrome = chromeCss * scale;
|
|
17
|
+
/**
|
|
18
|
+
* Where the window, its chrome and the page sit on the stage, in stage pixels. `chrome` is the chrome
|
|
19
|
+
* bar's height in CSS pixels; `scale` is stage px per CSS px. The window is as large as fits inside the
|
|
20
|
+
* padding and centered in it.
|
|
21
|
+
*/
|
|
22
|
+
export function layout(edit, viewport, chrome = 0) {
|
|
23
|
+
const { width, height } = outputSize(edit), short = Math.min(width, height);
|
|
24
|
+
const padding = [edit.frame.padding ?? 0].flat();
|
|
25
|
+
const [top, right, bottom, left] = (padding.length === 4 ? padding : [padding[0], padding[0], padding[0], padding[0]]).map(p => p * short);
|
|
26
|
+
const scale = Math.min((width - left - right) / viewport.width, (height - top - bottom) / (viewport.height + chrome));
|
|
27
|
+
const w = viewport.width * scale, h = (viewport.height + chrome) * scale;
|
|
28
|
+
const window = { x: left + (width - left - right - w) / 2, y: top + (height - top - bottom - h) / 2, w, h };
|
|
36
29
|
return {
|
|
37
|
-
width, height, scale, chrome, radius: edit.frame.radius *
|
|
38
|
-
window, page: { x: window.x, y: window.y + chrome, w, h: h - chrome },
|
|
30
|
+
width, height, scale, chrome: chrome * scale, radius: (edit.frame.radius ?? 0) * short / 1080,
|
|
31
|
+
window, page: { x: window.x, y: window.y + chrome * scale, w, h: h - chrome * scale },
|
|
39
32
|
};
|
|
40
33
|
}
|
|
41
34
|
|
|
42
35
|
/**
|
|
43
36
|
* The camera for a viewport crop: the stage point at the Final's center and the zoom. Zoom 1 shows
|
|
44
|
-
* the whole stage; zooming keeps the view inside the stage, so
|
|
37
|
+
* the whole stage; zooming keeps the view inside the stage, so the Background shows beside the page near its edges.
|
|
45
38
|
*/
|
|
46
39
|
export function cameraView(crop, stage, viewport) {
|
|
47
40
|
const zoom = viewport.width / crop.w;
|
|
@@ -54,24 +47,15 @@ export function cameraView(crop, stage, viewport) {
|
|
|
54
47
|
};
|
|
55
48
|
}
|
|
56
49
|
|
|
57
|
-
/** Mesh backgrounds: a base color under soft radial blobs [x, y, radius] as fractions of the stage. */
|
|
58
|
-
export const BACKGROUNDS = {
|
|
59
|
-
aurora: { base: '#1e1b4b', blobs: [[0.15, 0.2, 0.7, '#7c3aed'], [0.85, 0.15, 0.6, '#db2777'], [0.7, 0.9, 0.75, '#2563eb'], [0.2, 0.85, 0.55, '#0ea5e9']] },
|
|
60
|
-
sunset: { base: '#431407', blobs: [[0.1, 0.15, 0.7, '#f97316'], [0.9, 0.25, 0.65, '#e11d48'], [0.6, 0.95, 0.7, '#a21caf'], [0.25, 0.8, 0.45, '#facc15']] },
|
|
61
|
-
ocean: { base: '#082f49', blobs: [[0.2, 0.1, 0.65, '#14b8a6'], [0.85, 0.3, 0.7, '#0284c7'], [0.4, 0.95, 0.75, '#1e3a8a'], [0.95, 0.9, 0.4, '#22d3ee']] },
|
|
62
|
-
graphite: { base: '#0a0a0a', blobs: [[0.3, 0.2, 0.7, '#3f3f46'], [0.8, 0.8, 0.7, '#27272a']] },
|
|
63
|
-
paper: { base: '#f4f4f5', blobs: [[0.5, 0, 0.8, '#ffffff'], [0.5, 1.1, 0.7, '#e4e4e7']] },
|
|
64
|
-
};
|
|
65
|
-
|
|
66
50
|
const hsl = (h, s, l) => {
|
|
67
51
|
const k = n => (n + h / 30) % 12, a = s * Math.min(l, 1 - l);
|
|
68
|
-
|
|
69
|
-
return '#' + [f(0), f(8), f(4)].map(v => Math.round(v * 255).toString(16).padStart(2, '0')).join('');
|
|
52
|
+
return [0, 8, 4].map(n => l - a * Math.max(-1, Math.min(k(n) - 3, 9 - k(n), 1)));
|
|
70
53
|
};
|
|
71
54
|
|
|
72
|
-
/**
|
|
73
|
-
export function
|
|
74
|
-
|
|
55
|
+
/** The brand color shaders receive, as RGB from 0 to 1: the page's brand hue, or a neutral gray for a colorless page. */
|
|
56
|
+
export function brandColor(rgba) {
|
|
57
|
+
const hue = brandHue(rgba);
|
|
58
|
+
return hue === null ? [0.55, 0.56, 0.6] : hsl(hue, 0.75, 0.55);
|
|
75
59
|
}
|
|
76
60
|
|
|
77
61
|
/** The hue of the most frequent saturated color in RGBA pixels, or null for a colorless page. */
|
|
@@ -92,3 +76,23 @@ export function brandHue(rgba) {
|
|
|
92
76
|
const hue = max === r ? 60 * (((g - b) / d) % 6) : max === g ? 60 * ((b - r) / d + 2) : 60 * ((r - g) / d + 4);
|
|
93
77
|
return (hue + 360) % 360;
|
|
94
78
|
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Where Preview tiles sit on one sheet, in sheet pixels. A single tile is the sheet; several are shown
|
|
82
|
+
* at half size in a grid of up to three columns, each with its label above it. Each row is as tall as
|
|
83
|
+
* its tallest tile, so a portrait tile does not stretch the other rows.
|
|
84
|
+
*/
|
|
85
|
+
export function previewSheet(sizes) {
|
|
86
|
+
if (sizes.length === 1) return { width: sizes[0].width, height: sizes[0].height, tiles: [{ x: 0, y: 0, w: sizes[0].width, h: sizes[0].height, label: null }] };
|
|
87
|
+
const scale = 0.5, gap = 32, label = 44;
|
|
88
|
+
const columns = sizes.length <= 4 ? 2 : 3, cellWidth = Math.max(...sizes.map(s => s.width)) * scale;
|
|
89
|
+
const rows = Array.from({ length: Math.ceil(sizes.length / columns) }, (_, row) => Math.max(...sizes.slice(row * columns, (row + 1) * columns).map(s => s.height)) * scale);
|
|
90
|
+
const rowTop = rows.map((_, row) => gap + rows.slice(0, row).reduce((sum, h) => sum + label + h + gap, 0));
|
|
91
|
+
return {
|
|
92
|
+
width: gap + columns * (cellWidth + gap), height: rowTop.at(-1) + label + rows.at(-1) + gap,
|
|
93
|
+
tiles: sizes.map(({ width, height }, i) => {
|
|
94
|
+
const x = gap + (i % columns) * (cellWidth + gap) + (cellWidth - width * scale) / 2, y = rowTop[Math.floor(i / columns)];
|
|
95
|
+
return { x, y: y + label, w: width * scale, h: height * scale, label: { x, y: y + label / 2 } };
|
|
96
|
+
}),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The arrow cursor: filled with `color`, outlined in dark gray, with a soft shadow.
|
|
2
|
+
// Drawn in a 28×36 box whose tip at (2, 2) is the hotspot; CueTake scales the box to the cursor's size.
|
|
3
|
+
export const box = { width: 28, height: 36, hotspot: [2, 2] };
|
|
4
|
+
const ARROW = new Path2D('M2 2 L2 27 L8.5 21 L14 33 L19 30.5 L13.5 19 L23 19 Z');
|
|
5
|
+
|
|
6
|
+
export function draw(ctx, { params }) {
|
|
7
|
+
// Shadow sizes are in device pixels, so scale them by the box's current size on screen.
|
|
8
|
+
const pixels = ctx.getTransform().a;
|
|
9
|
+
ctx.shadowColor = '#00000055'; ctx.shadowBlur = 2 * pixels; ctx.shadowOffsetY = pixels;
|
|
10
|
+
ctx.fillStyle = params.color ?? '#ffffff'; ctx.fill(ARROW);
|
|
11
|
+
ctx.shadowColor = 'transparent';
|
|
12
|
+
ctx.lineJoin = 'round'; ctx.lineWidth = 1.7; ctx.strokeStyle = '#171717'; ctx.stroke(ARROW);
|
|
13
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// A browser window's top bar: traffic lights and a centered address field showing the url.
|
|
2
|
+
// Parameters: dark (a dark bar). Drawn in CSS pixels; CueTake clips it to the window's rounded top.
|
|
3
|
+
export const height = 44;
|
|
4
|
+
|
|
5
|
+
export function draw(ctx, { width, height, url, params }) {
|
|
6
|
+
const t = params.dark
|
|
7
|
+
? { bar: '#2a2a2e', line: '#111113', field: '#3a3a40', fieldLine: '#4a4a52', text: '#d4d4d8', lock: '#a1a1aa' }
|
|
8
|
+
: { bar: '#f3f3f5', line: '#d4d4d8', field: '#ffffff', fieldLine: '#e4e4e7', text: '#52525b', lock: '#71717a' };
|
|
9
|
+
ctx.fillStyle = t.bar; ctx.fillRect(0, 0, width, height);
|
|
10
|
+
ctx.fillStyle = t.line; ctx.fillRect(0, height - 1, width, 1);
|
|
11
|
+
['#ff5f57', '#febc2e', '#28c840'].forEach((light, i) => {
|
|
12
|
+
ctx.beginPath(); ctx.arc(20 + i * 20, height / 2, 6, 0, 2 * Math.PI);
|
|
13
|
+
ctx.fillStyle = light; ctx.fill(); ctx.strokeStyle = '#0000001f'; ctx.lineWidth = 0.5; ctx.stroke();
|
|
14
|
+
});
|
|
15
|
+
const w = 420, h = 28, x = (width - w) / 2, y = (height - h) / 2;
|
|
16
|
+
ctx.beginPath(); ctx.roundRect(x, y, w, h, h / 2);
|
|
17
|
+
ctx.fillStyle = t.field; ctx.fill(); ctx.strokeStyle = t.fieldLine; ctx.lineWidth = 0.8; ctx.stroke();
|
|
18
|
+
ctx.font = '13px system-ui, -apple-system, sans-serif'; ctx.textBaseline = 'middle';
|
|
19
|
+
const left = width / 2 - (ctx.measureText(url).width + 16) / 2;
|
|
20
|
+
ctx.fillStyle = t.lock; // padlock
|
|
21
|
+
ctx.beginPath(); ctx.roundRect(left, y + 13, 9, 7, 1.5); ctx.fill();
|
|
22
|
+
ctx.strokeStyle = t.lock; ctx.lineWidth = 1.3; ctx.beginPath(); ctx.arc(left + 4.5, y + 13, 2.8, Math.PI, 0); ctx.stroke();
|
|
23
|
+
ctx.fillStyle = t.text; ctx.fillText(url, left + 16, height / 2 + 0.5);
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// A round dot cursor filled with `color` and outlined in dark gray; its center is the hotspot.
|
|
2
|
+
export const box = { width: 24, height: 24, hotspot: [12, 12] };
|
|
3
|
+
|
|
4
|
+
export function draw(ctx, { params }) {
|
|
5
|
+
const pixels = ctx.getTransform().a;
|
|
6
|
+
ctx.shadowColor = '#00000055'; ctx.shadowBlur = 2 * pixels; ctx.shadowOffsetY = pixels;
|
|
7
|
+
ctx.beginPath(); ctx.arc(12, 12, 12, 0, 2 * Math.PI);
|
|
8
|
+
ctx.fillStyle = params.color ?? '#ffffff'; ctx.fill();
|
|
9
|
+
ctx.shadowColor = 'transparent';
|
|
10
|
+
ctx.lineWidth = 1.5; ctx.strokeStyle = '#171717'; ctx.beginPath(); ctx.arc(12, 12, 11.25, 0, 2 * Math.PI); ctx.stroke();
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Fluted glass: soft light in the page's brand color seen through glass ribs, over near black.
|
|
2
|
+
// Parameters: count (ribs across the short side), strength (how far a rib bends the light, as a
|
|
3
|
+
// fraction of the short side), angle (rib tilt in degrees). Set uBrand to light it in another color.
|
|
4
|
+
|
|
5
|
+
vec3 hueShift(vec3 c, float turn) {
|
|
6
|
+
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
7
|
+
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
8
|
+
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
9
|
+
float d = q.x - min(q.w, q.y);
|
|
10
|
+
vec3 hsv = vec3(fract(abs(q.z + (q.w - q.y) / (6.0 * d + 1e-10)) + turn), d / (q.x + 1e-10), q.x);
|
|
11
|
+
return hsv.z * mix(vec3(1.0), clamp(abs(mod(hsv.x * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0), hsv.y);
|
|
12
|
+
}
|
|
13
|
+
float blob(vec2 uv, vec2 c, float r) { return exp(-dot(uv - c, uv - c) / (r * r)); }
|
|
14
|
+
// Light placed where the margins around the window show; uv is 0–1 across the short side, centered.
|
|
15
|
+
vec3 light(vec2 uv) {
|
|
16
|
+
return uBrand * 0.06
|
|
17
|
+
+ uBrand * blob(uv, vec2(0.15, 0.95), 0.42)
|
|
18
|
+
+ hueShift(uBrand, 0.1) * blob(uv, vec2(0.92, 0.08), 0.38) * 0.9
|
|
19
|
+
+ hueShift(uBrand, -0.11) * blob(uv, vec2(0.85, 0.9), 0.3) * 0.7
|
|
20
|
+
+ hueShift(uBrand, 0.04) * blob(uv, vec2(0.05, 0.15), 0.25) * 0.5;
|
|
21
|
+
}
|
|
22
|
+
float hash(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }
|
|
23
|
+
|
|
24
|
+
void main() {
|
|
25
|
+
vec2 px = pixel(), center = uResolution * 0.5;
|
|
26
|
+
float side = min(uResolution.x, uResolution.y), a = radians(angle);
|
|
27
|
+
vec2 across = vec2(cos(a), sin(a));
|
|
28
|
+
float w = side / count, u = fract(dot(px - center, across) / w);
|
|
29
|
+
vec2 bent = px + across * (u - 0.5) * strength * side;
|
|
30
|
+
vec3 c = light((bent - center) / side + 0.5);
|
|
31
|
+
c *= 0.78 + 0.34 * pow(u, 1.6); // each rib darkens toward one edge
|
|
32
|
+
c += 0.05 * smoothstep(0.9, 1.0, u); // and catches a highlight on the other
|
|
33
|
+
c += (hash(px) - 0.5) * 0.05; // grain keeps H.264 from banding the light
|
|
34
|
+
color = vec4(c, 1.0);
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// A macOS app window's title bar: traffic lights only. Parameters: dark (a dark bar).
|
|
2
|
+
// Drawn in CSS pixels; CueTake clips it to the window's rounded top.
|
|
3
|
+
export const height = 28;
|
|
4
|
+
|
|
5
|
+
export function draw(ctx, { width, height, params }) {
|
|
6
|
+
ctx.fillStyle = params.dark ? '#2a2a2e' : '#ececef'; ctx.fillRect(0, 0, width, height);
|
|
7
|
+
ctx.fillStyle = params.dark ? '#111113' : '#d4d4d8'; ctx.fillRect(0, height - 1, width, 1);
|
|
8
|
+
['#ff5f57', '#febc2e', '#28c840'].forEach((light, i) => {
|
|
9
|
+
ctx.beginPath(); ctx.arc(16 + i * 20, height / 2, 6, 0, 2 * Math.PI);
|
|
10
|
+
ctx.fillStyle = light; ctx.fill(); ctx.strokeStyle = '#0000001f'; ctx.lineWidth = 0.5; ctx.stroke();
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// A soft drop shadow under the window and a faint light rim around it. It follows the window as the
|
|
2
|
+
// camera zooms and moves it. Parameters: blur and offset (1080p pixels at zoom 1), opacity and rim (0–1).
|
|
3
|
+
|
|
4
|
+
void main() {
|
|
5
|
+
vec2 px = pixel();
|
|
6
|
+
float k = uUnit * uZoom;
|
|
7
|
+
float shadow = opacity * (1.0 - smoothstep(-blur * k, blur * k, windowDistance(px - vec2(0.0, offset * k))));
|
|
8
|
+
float edge = rim * (1.0 - smoothstep(0.0, 1.5, abs(windowDistance(px))));
|
|
9
|
+
color = vec4(vec3(edge), edge + shadow * (1.0 - edge));
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// A spark: `count` rays burst out from the click to `radius` CSS px, shrinking from `length` and fading.
|
|
2
|
+
// Rays are the cursor's color unless `color` is set, with a dark edge so they read on any page.
|
|
3
|
+
export const reach = ({ radius, length }) => radius + length + 8;
|
|
4
|
+
|
|
5
|
+
export function draw(ctx, { progress, params, cursor }) {
|
|
6
|
+
const { radius, length: rayLength, count } = params, color = params.color ?? cursor.color ?? '#ffffff';
|
|
7
|
+
const eased = 1 - (1 - progress) ** 3;
|
|
8
|
+
const distance = 5 + eased * radius, length = rayLength * (1 - eased);
|
|
9
|
+
ctx.globalAlpha = 1 - progress;
|
|
10
|
+
ctx.lineCap = 'round';
|
|
11
|
+
for (let i = 0; i < count; i++) {
|
|
12
|
+
const angle = 2 * Math.PI * i / count + Math.PI / 8;
|
|
13
|
+
ctx.beginPath();
|
|
14
|
+
ctx.moveTo(distance * Math.cos(angle), distance * Math.sin(angle));
|
|
15
|
+
ctx.lineTo((distance + length) * Math.cos(angle), (distance + length) * Math.sin(angle));
|
|
16
|
+
ctx.strokeStyle = '#171717'; ctx.lineWidth = 4.5; ctx.stroke();
|
|
17
|
+
ctx.strokeStyle = color; ctx.lineWidth = 2.5; ctx.stroke();
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/styles.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import { basename, extname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The files an Edit or Look draws with (ADR 0005). A ref with an extension is a file, relative to the
|
|
7
|
+
* Take, Look or Scenario that names it; a ref without one is a built-in from src/styles, with the
|
|
8
|
+
* parameters it starts from. Built-ins are ordinary files agents can read and copy.
|
|
9
|
+
*/
|
|
10
|
+
export const BUILTIN_DIR = fileURLToPath(new URL('./styles/', import.meta.url));
|
|
11
|
+
export const BUILTINS = {
|
|
12
|
+
fluted: { file: 'fluted.glsl', params: { count: 36, strength: 0.09, angle: 0 } },
|
|
13
|
+
shadow: { file: 'shadow.glsl', params: { blur: 60, offset: 24, opacity: 0.5, rim: 0.12 } },
|
|
14
|
+
browser: { file: 'browser.js', params: { dark: false } },
|
|
15
|
+
'browser-dark': { file: 'browser.js', params: { dark: true } },
|
|
16
|
+
macos: { file: 'macos.js', params: { dark: false } },
|
|
17
|
+
'macos-dark': { file: 'macos.js', params: { dark: true } },
|
|
18
|
+
arrow: { file: 'arrow.js', params: {} },
|
|
19
|
+
dot: { file: 'dot.js', params: {} },
|
|
20
|
+
spark: { file: 'spark.js', params: { radius: 32, length: 16, count: 8 } },
|
|
21
|
+
};
|
|
22
|
+
export const KINDS = ['shader', 'draw', 'image'];
|
|
23
|
+
export const isFile = ref => typeof ref === 'string' && extname(ref) !== '';
|
|
24
|
+
|
|
25
|
+
/** Every drawn item an Edit or (partial) Look holds. */
|
|
26
|
+
function items(style) {
|
|
27
|
+
const { frame, cursor, clickEffect } = style ?? {};
|
|
28
|
+
return [...(Array.isArray(frame?.background) ? frame.background : []), ...(Array.isArray(frame?.effects) ? frame.effects : []), frame?.chrome, cursor, clickEffect]
|
|
29
|
+
.filter(item => item && typeof item === 'object');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** A copy of `style` with every file ref (an item's drawing and its `files`) replaced by `map(ref)`. */
|
|
33
|
+
export function mapFiles(style, map) {
|
|
34
|
+
const copy = structuredClone(style);
|
|
35
|
+
for (const item of items(copy)) {
|
|
36
|
+
for (const key of KINDS) if (isFile(item[key])) item[key] = map(item[key]);
|
|
37
|
+
if (item.files) item.files = Object.fromEntries(Object.entries(item.files).map(([name, ref]) => [name, isFile(ref) ? map(ref) : ref]));
|
|
38
|
+
}
|
|
39
|
+
return copy;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The file refs `style` names, in order, without repeats. */
|
|
43
|
+
export function fileRefs(style) {
|
|
44
|
+
const refs = new Set();
|
|
45
|
+
mapFiles(style, ref => refs.add(ref));
|
|
46
|
+
return [...refs];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The shader and drawing-code files `style` runs, for an agent to review before using a Look. */
|
|
50
|
+
export function codeRefs(style) {
|
|
51
|
+
return [...new Set(items(style).flatMap(item => ['shader', 'draw'].map(key => item[key]).filter(isFile)))];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Refs made absolute against `dir`, so styling from several places can be merged. */
|
|
55
|
+
export const absolute = (style, dir) => mapFiles(style, ref => resolve(dir, ref));
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Copies every file `style` names (resolved against `fromDir`) into `toDir` and points the refs at the
|
|
59
|
+
* copies as `prefix + name`. Files already inside `toDir` stay; a different file with a taken name gets a suffix.
|
|
60
|
+
*/
|
|
61
|
+
export async function bundle(style, fromDir, toDir, prefix = '') {
|
|
62
|
+
const copies = new Map();
|
|
63
|
+
for (const ref of fileRefs(style)) {
|
|
64
|
+
const source = resolve(fromDir, ref);
|
|
65
|
+
if (!relative(toDir, source).startsWith('..') && !isAbsolute(relative(toDir, source))) { copies.set(ref, prefix + relative(toDir, source)); continue; }
|
|
66
|
+
const bytes = await fs.readFile(source);
|
|
67
|
+
await fs.mkdir(toDir, { recursive: true });
|
|
68
|
+
const ext = extname(source), stem = basename(source, ext);
|
|
69
|
+
for (let n = 1; ; n++) {
|
|
70
|
+
const name = n === 1 ? stem + ext : `${stem}-${n}${ext}`, target = join(toDir, name);
|
|
71
|
+
const existing = await fs.readFile(target).catch(error => { if (error.code === 'ENOENT') return null; throw error; });
|
|
72
|
+
if (existing && !existing.equals(bytes)) continue;
|
|
73
|
+
if (!existing) await fs.writeFile(target, bytes);
|
|
74
|
+
copies.set(ref, prefix + name);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return mapFiles(style, ref => copies.get(ref));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const PAGE_TYPES = { '.js': 'text/javascript', '.mjs': 'text/javascript', '.glsl': 'text/plain', '.frag': 'text/plain', '.svg': 'image/svg+xml', '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp', '.woff2': 'font/woff2', '.woff': 'font/woff', '.ttf': 'font/ttf', '.otf': 'font/otf' };
|
|
82
|
+
export const contentType = path => PAGE_TYPES[extname(path).toLowerCase()] ?? 'application/octet-stream';
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The Edit as the render page reads it: each drawing becomes a URL under `/files/` (with its built-in
|
|
86
|
+
* parameters underneath the item's own). Refs resolve against `dir`; `files` collects the served
|
|
87
|
+
* names and paths, and may be shared by several Edits.
|
|
88
|
+
*/
|
|
89
|
+
export function forRender(edit, dir, files = {}) {
|
|
90
|
+
const serve = path => {
|
|
91
|
+
let name = Object.keys(files).find(key => files[key] === path);
|
|
92
|
+
if (!name) { name = `style-${Object.keys(files).length}${extname(path)}`; files[name] = path; }
|
|
93
|
+
return `/files/${name}`;
|
|
94
|
+
};
|
|
95
|
+
const copy = structuredClone(edit);
|
|
96
|
+
for (const item of items(copy)) {
|
|
97
|
+
const kind = KINDS.find(key => item[key] !== undefined);
|
|
98
|
+
if (!kind) continue;
|
|
99
|
+
const ref = item[kind], builtin = !isFile(ref) && BUILTINS[ref];
|
|
100
|
+
if (!isFile(ref) && !builtin) throw new Error(`No built-in named '${ref}'; built-ins are ${Object.keys(BUILTINS).join(', ')}, or name a file with its extension`);
|
|
101
|
+
Object.assign(item, { ...(builtin ? builtin.params : {}), ...item, ref, kind, url: serve(builtin ? join(BUILTIN_DIR, builtin.file) : resolve(dir, ref)) });
|
|
102
|
+
if (item.files) item.files = Object.fromEntries(Object.entries(item.files).map(([name, file]) => [name, serve(resolve(dir, file))]));
|
|
103
|
+
}
|
|
104
|
+
return { edit: copy, files };
|
|
105
|
+
}
|
package/skills/cuetake/SKILL.md
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: cuetake
|
|
3
|
-
description: Plan, record, refine, and verify browser product demo videos with the CueTake CLI, including login preparation and camera/cursor styling.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# CueTake agent operating manual
|
|
7
|
-
|
|
8
|
-
CueTake is a local execution engine for AI agents. You direct the story; CueTake captures the browser and renders the finished take. Run every command through `scripts/cuetake` in this skill's folder; it launches the pinned CueTake version with `npx`. Read [scenarios.md](scenarios.md) when writing a scenario, [authentication.md](authentication.md) when a page needs login, and [setup.md](setup.md) when Node or `npx` is missing or `doctor` reports a failed check.
|
|
9
|
-
|
|
10
|
-
## Workflow
|
|
11
|
-
|
|
12
|
-
1. Infer the audience, demonstrated outcome, duration and framing from the request. Inspect the actual application with the available browser tool; use real locators and measured canvas coordinates.
|
|
13
|
-
2. Run `doctor`. If it fails, follow [setup.md](setup.md): nothing installs without the user's agreement. This does not start the application's dev server.
|
|
14
|
-
3. Write a trusted `.mjs` scenario in the business project. `prepare(page)` loads examples/assets before capture. `run(d)` performs timed interactions and returns evidence of the demonstrated changes. Never embed credentials or copied browser state in a scenario.
|
|
15
|
-
4. Run `record` with the scenario path and a new Take directory. It captures, renders and verifies in the foreground, then prints the verification report; a failure exits non-zero. Capture lasts as long as the scenario and Render adds its own time, so run it in the background when your shell would time out.
|
|
16
|
-
5. Read verification and application evidence. Inspect frames around clicks and camera transitions with `frame <take> <seconds>`, which saves a PNG you can view, and play the final MP4. Deliver the absolute final path and relevant limitations. Technical verification is not editorial approval or authorization to publish.
|
|
17
|
-
|
|
18
|
-
Run `render` after changing a take's `edit.json`. This reuses source.webm. Cursor, click effect, camera and output all live in the Edit, so restyling never requires recording again. Preserve versions by copying a take before editing it.
|
|
19
|
-
|
|
20
|
-
## Division of responsibility
|
|
21
|
-
|
|
22
|
-
- Skill: story, pacing, discovery, authorization boundaries, quality judgment, and tool usage.
|
|
23
|
-
- Scenario: site-specific selectors, actions and assertions. Store it in the business project.
|
|
24
|
-
- CLI: recording, cursor/click effects, camera math, auth-state loading, output files and verification. Do not duplicate the engine under skill scripts.
|
|
25
|
-
|
|
26
|
-
## Login
|
|
27
|
-
|
|
28
|
-
Reuse a named auth profile when the user has authorized that account for the demo. If missing or expired, run `login <profile> <login-url>` in the background; no capture runs in that window. Ask the user to complete password/SSO/2FA and then close the window; the command saves the profile when the window closes. Pass `--auth-profile <profile>` to `record`.
|
|
29
|
-
|
|
30
|
-
`prepare` must verify an authenticated page anchor before capture. If redirected to sign-in, stop and refresh the profile instead of recording login. Do not read the user's normal Chrome profile, print tokens, or put auth files into output/source control. A stored file proves only that state exists; the application decides whether the session is still valid.
|
|
31
|
-
|
|
32
|
-
## Styling and timing
|
|
33
|
-
|
|
34
|
-
Defaults: CSS viewport 1440×900, 2× capture resolution, 60 fps target, a 3840×2160 Final with the page in a browser window on the `aurora` background, 24 px white arrow. Clicks use an outlined white spark: 32 px radius, 16 px rays, 8 rays, 420 ms duration. Set `clickEffect.style: 'none'` to disable it; color follows the cursor.
|
|
35
|
-
|
|
36
|
-
The camera zooms automatically, like Screen Studio: it arrives 0.6 s before each action, frames the target with 48 px padding at up to 2×, follows the cursor while zoomed, holds 1.5 s after the last of a run of actions, and ends every Final on the wide shot. Leave at least 2 s after the last action so the result is seen in context. Use `d.focus(box, seconds)` to direct the camera at a moment; it replaces only the automatic zoom around that moment. Pass `focus: false` to an action that should not move the camera. Boxes are CSS pixels.
|
|
37
|
-
|
|
38
|
-
Capture is variable frame rate: static scenes reduce cadence and moving scenes can drop frames. Report observed stats, not a promise of 60 independent page frames each second. Capture runs headless by default; pass `--headed` to watch it. Coverage is macOS, same-document/SPA operations, no audio. Known limitation: headless Chromium renders the generic `monospace` family as Courier rather than Menlo; record with `--headed` when a page relies on it. Full document navigation during capture requires separate takes; login and other navigation may happen before capture.
|
|
39
|
-
|
|
40
|
-
## Commands
|
|
41
|
-
|
|
42
|
-
`<skill>` is this skill's folder.
|
|
43
|
-
|
|
44
|
-
```sh
|
|
45
|
-
<skill>/scripts/cuetake doctor
|
|
46
|
-
<skill>/scripts/cuetake install-browser
|
|
47
|
-
<skill>/scripts/cuetake record <scenario.mjs> --out <new-take-directory> [--auth-profile product-demo] [--headed]
|
|
48
|
-
<skill>/scripts/cuetake render <take-directory>
|
|
49
|
-
<skill>/scripts/cuetake verify <take-directory>
|
|
50
|
-
<skill>/scripts/cuetake frame <take-directory> 2.5
|
|
51
|
-
<skill>/scripts/cuetake login product-demo https://your-app.example/login
|
|
52
|
-
```
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Login before recording
|
|
2
|
-
|
|
3
|
-
The default recorder launches an isolated browser context. It does not inherit the user's ordinary Chrome login. Use a named CueTake auth profile to restore an authorized session.
|
|
4
|
-
|
|
5
|
-
## Sequence
|
|
6
|
-
|
|
7
|
-
1. `cuetake login product-demo https://your-app.example/login` opens a separate headed browser. No recording starts. Run it in the background; it exits when the window closes.
|
|
8
|
-
2. The user completes login, including SSO/2FA, then closes the window. The command saves the state it last read and prints `saved: true`.
|
|
9
|
-
3. Record with `cuetake record <scenario.mjs> --out <new-take-directory> --auth-profile product-demo`.
|
|
10
|
-
4. In the scenario's `prepare`, wait for a reliable authenticated anchor. If it is absent or the site redirects to login, fail before capture and renew the profile.
|
|
11
|
-
|
|
12
|
-
The state loader uses Playwright `storageState`, including cookies, localStorage, and IndexedDB. See [Playwright authentication](https://playwright.dev/docs/auth).
|
|
13
|
-
|
|
14
|
-
Files live in `~/.local/share/cuetake/auth/<profile>.json` (or `CUETAKE_AUTH_DIR`). The directory is created with mode 0700; files are atomically saved with mode 0600. Files contain reusable session secrets and are not encrypted by CueTake. Never commit them, include them in a shared take, or paste their contents into agent messages. The take records only an authenticated-state boolean.
|
|
15
|
-
|
|
16
|
-
SessionStorage, device-bound sessions, passkeys, CAPTCHA, and some anti-automation SSO flows may require a different preparation path. A saved state does not bypass those controls or guarantee a session has not expired. The preferred flow remains authenticate before capture; refresh/re-authenticate when the site requires it.
|
|
17
|
-
|
|
18
|
-
Acceptance coverage: a local browser fixture verifies cookie/localStorage restore and file permissions. No real account has been logged into or exported during this implementation.
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# Scenario API and take folders
|
|
2
|
-
|
|
3
|
-
A scenario is trusted JavaScript exporting `config`, optional `prepare(page)`, and `run(director)`. Do not execute scenario modules from an untrusted source.
|
|
4
|
-
|
|
5
|
-
```js
|
|
6
|
-
export const config = {
|
|
7
|
-
name: 'product-editor',
|
|
8
|
-
url: 'http://localhost:3000/editor',
|
|
9
|
-
viewport: { width: 1440, height: 900 },
|
|
10
|
-
capture: { fps: 60, resolutionScale: 2 },
|
|
11
|
-
cursor: { style: 'arrow', size: 24, color: '#ffffff' },
|
|
12
|
-
clickEffect: { style: 'spark', radius: 32, length: 16, count: 8, duration: 420 },
|
|
13
|
-
output: { size: '2160p', aspect: '16:9', quality: 22 },
|
|
14
|
-
frame: { window: 'browser', background: 'aurora', padding: 0.08, radius: 12, shadow: true },
|
|
15
|
-
camera: {
|
|
16
|
-
maxZoom: 2,
|
|
17
|
-
minZoom: 1.2,
|
|
18
|
-
padding: 48,
|
|
19
|
-
lead: 0.6,
|
|
20
|
-
hold: 1.5,
|
|
21
|
-
chainGap: 2,
|
|
22
|
-
response: 0.6,
|
|
23
|
-
follow: true,
|
|
24
|
-
endWide: 1.5,
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export async function prepare(page) {
|
|
29
|
-
// Runs before capture. Load a free example, wait for assets, open the editor.
|
|
30
|
-
await page.getByRole('button', { name: 'Use example' }).click();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function run(d) {
|
|
34
|
-
await d.at(1);
|
|
35
|
-
await d.click(d.page.getByRole('button', { name: 'Preview' }));
|
|
36
|
-
await d.at(5);
|
|
37
|
-
return { previewOpened: true }; // Prefer evidence checked against the real UI.
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Only `name` and `url` are required in config. Other fields use the shown defaults. Capture FPS accepts 30 or 60. Resolution scale accepts 1 or 2. Widths and heights must be even. There is no audio capture.
|
|
42
|
-
|
|
43
|
-
## Director
|
|
44
|
-
|
|
45
|
-
| API | Behavior |
|
|
46
|
-
| --- | --- |
|
|
47
|
-
| `page` | The isolated Playwright page; use its locators and assertions. |
|
|
48
|
-
| `at(seconds)` | Wait until a time relative to the capture start. Past times return immediately. |
|
|
49
|
-
| `wait(ms)` | Hold the current state. |
|
|
50
|
-
| `move(x, y, durationMs=500)` | Move along a smooth path using viewport CSS coordinates. |
|
|
51
|
-
| `click(locator, { duration=450, focus })` | Move to a visible locator and click. A CSS selector also works. |
|
|
52
|
-
| `type(locator, text, { msPerChar=70, focus })` | Click a field, then type with a visible per-character delay. |
|
|
53
|
-
| `drag({x,y}, {x,y}, { duration=1200, focus })` | Move to the start, press, move, then release. |
|
|
54
|
-
| `focus({x,y,width,height}, seconds?)` | Add a camera target; defaults to the current time. |
|
|
55
|
-
| `time()` | Seconds elapsed since capture started. |
|
|
56
|
-
|
|
57
|
-
`move` starts from (0,0). If preparation positioned the cursor elsewhere, initialize it with `await d.move(x, y, 0)` at the start of `run`.
|
|
58
|
-
|
|
59
|
-
The camera works like Screen Studio's auto zoom. It follows the clicks, typing and drags the page observed, whether they came from the director or from Playwright input directly:
|
|
60
|
-
|
|
61
|
-
- It arrives `lead` seconds before each action, so the zoom is in place when the action happens.
|
|
62
|
-
- Actions whose zoom windows sit within `chainGap` seconds share one zoom segment: the camera stays zoomed and moves between them instead of zooming out and back in.
|
|
63
|
-
- It holds `hold` seconds after the segment's last action (after typing ends, for typing), then returns to the wide shot.
|
|
64
|
-
- While zoomed it follows the cursor, keeping it in the central 70% of the view (`follow: false` turns this off).
|
|
65
|
-
- Movement is a critically damped spring that settles in about `response` seconds and never overshoots.
|
|
66
|
-
- Every Final ends wide: the camera heads back `endWide` seconds before the end, so leave at least 2 seconds after the last action for the result to be seen in context.
|
|
67
|
-
|
|
68
|
-
Each target is framed with `padding` CSS px around its box, zooming at most `maxZoom`; boxes too large to reach `minZoom` stay wide. Set `zoom` on a target in `edit.json` to fix it. Pass `focus: false` to an action to keep the camera wide for it; a bare number still works as the action's timing. `d.focus(box)` adds a deliberate target and, like a manual zoom in Screen Studio, replaces only the automatic targets within its own span; the rest of the Take keeps following actions. Focus boxes always use CSS pixels, even when the source is captured at 2× scale.
|
|
69
|
-
|
|
70
|
-
Use actual locators for clicks. Canvas drags often require coordinates; derive or validate them for the configured viewport. Keep setup outside capture, hold important states, and assert meaningful application changes. An exception marks the take failed and closes the isolated browser.
|
|
71
|
-
|
|
72
|
-
## Take folder
|
|
73
|
-
|
|
74
|
-
```text
|
|
75
|
-
<output>/<scenario>/<take>/
|
|
76
|
-
project.json Scenario config, status, application evidence, duration
|
|
77
|
-
scenario.mjs Snapshot of the original scenario module
|
|
78
|
-
source.webm Source: original high-resolution VP9 capture
|
|
79
|
-
capture.json Track settings and video frame callback observations
|
|
80
|
-
timeline.json Timeline: pointer path, clicks, drags, typing and focus, in seconds and CSS pixels
|
|
81
|
-
edit.json Edit: camera targets and settings, cursor, click effect, frame, output
|
|
82
|
-
poster.png Final page state at native capture resolution
|
|
83
|
-
final.mp4 Final: H.264 camera composition
|
|
84
|
-
render.json Encoder, rate control and GPU used by the last Render
|
|
85
|
-
verification.json Output metadata, decode result, capture observations
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
A copied scenario snapshot may import helper modules from its original project. It is a record of the scenario, not a bundled runnable archive. Keep business scenarios in their application repository.
|
|
89
|
-
|
|
90
|
-
To edit a completed take, change `edit.json` (camera settings, target boxes and times, cursor, click effect, frame, output), then run `cuetake render <take>`. The Scenario config only seeds the first Edit. Changing what happens on the page requires recording again. `render` automatically runs verification; `verify` checks without rendering.
|
|
91
|
-
|
|
92
|
-
`output.size` names the Final's short side (`1080p`, `1440p`, `2160p`, or an even pixel count) and `output.aspect` is `16:9`, `1:1` or `9:16`; both are independent of device scale. `frame` places the page in a window on a background: `window` is `browser` (with an address bar showing `url`, which defaults to the Scenario's host), `macos` or `none`; `background` is `aurora`, `sunset`, `ocean`, `graphite`, `paper`, `auto` (a mesh around the page's brand color) or `blur` (the page itself, blurred); `padding` is a fraction of the short side; `radius` is in 1080p pixels. Set `frame: false` to let the page fill the Final at the viewport's aspect. The camera zooms the whole stage, so background may show beside the page when a target sits near its edge. `edit.json` also carries `output.fps`, the Final's frame rate, which a new Take takes from `capture.fps`. `output.quality` is the H.264 quantizer (10–40, default 22): lower is sharper and larger. Encoders without a quantizer mode fall back to a bitrate, recorded in `render.json`.
|
|
93
|
-
|
|
94
|
-
Click effects default to a white, dark-outlined spark matching the arrow. Set style to `none` to disable. Geometry is in CSS pixels and duration is milliseconds. Login is passed separately as a named runtime auth profile, never embedded in scenario config; see [authentication.md](authentication.md).
|