screw-bugs 0.1.6 → 0.1.7
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 +3 -3
- package/dist/browser-playwright/launch.d.ts +4 -2
- package/dist/browser-playwright/launch.js +8 -1
- package/dist/browser-playwright/still.d.ts +12 -0
- package/dist/browser-playwright/still.js +51 -0
- package/dist/build-info.json +3 -3
- package/dist/cli/app.d.ts +1 -1
- package/dist/cli/commands.js +1 -1
- package/dist/cli/share.js +10 -10
- package/dist/core/engine.js +22 -7
- package/dist/core/services.d.ts +6 -1
- package/dist/core/video.d.ts +31 -0
- package/dist/core/video.js +132 -0
- package/dist/report/html.js +9 -0
- package/dist/report/menu-bar.js +1 -1
- package/dist/report/view.d.ts +16 -5
- package/dist/report/view.js +58 -24
- package/dist/report/walkthrough.d.ts +3 -2
- package/dist/report/walkthrough.js +4 -3
- package/dist/schema/evidence.d.ts +15 -0
- package/dist/schema/evidence.js +8 -0
- package/dist/schema/ledger.d.ts +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -754,7 +754,7 @@ npx screw-bugs accounts sign-in trial-user --url http://localhost:3000 --about "
|
|
|
754
754
|
| `report <job-id> --serve [--port N]` | Serve the report at a `http://127.0.0.1` URL |
|
|
755
755
|
| `walkthrough <job-id> [--serve]` | Write (or serve) the run's video walkthrough |
|
|
756
756
|
| `findings <job-id> <file\|->` | Submit an agent's write-up of an ended run |
|
|
757
|
-
| `share <job-id>` | Share a report through
|
|
757
|
+
| `share <job-id>` | Share a report through Screw Bugs Cloud |
|
|
758
758
|
| `runs` | List recent runs |
|
|
759
759
|
| `analytics` | Show whether analytics are on (off by default) |
|
|
760
760
|
|
|
@@ -857,7 +857,7 @@ reports](#viewing-reports)).
|
|
|
857
857
|
With `report.html`, the run writes `walkthrough.html`: a page to click through what the run did. The
|
|
858
858
|
video in a browser window (a phone, for a run on a phone, with the script beside it on a wide
|
|
859
859
|
screen) with the page's address at each moment, controls under it (speed, "Skip inactive" to jump
|
|
860
|
-
over stretches where
|
|
860
|
+
over stretches where nothing happened, the cursor overlay, fullscreen), and below it the script: every
|
|
861
861
|
step of every case in run order, grouped by case (its title and status), each with its timecode
|
|
862
862
|
and the step in words (`0:01.5 Fill the field labelled "Note" with "this is a new line"`). As the
|
|
863
863
|
video plays, the step playing now is the script's top row, highlighted (without motion when the
|
|
@@ -1000,7 +1000,7 @@ The one other thing they answer is the Share button's routes, under `/.screw-bug
|
|
|
1000
1000
|
### Sharing
|
|
1001
1001
|
|
|
1002
1002
|
A report or walkthrough opened through the report server (its `http://127.0.0.1` URL) has a
|
|
1003
|
-
**Share** button that puts the run on
|
|
1003
|
+
**Share** button that puts the run on Screw Bugs Cloud: a link anyone can open for 7 days. Opened
|
|
1004
1004
|
from disk, or on Cloud itself, the page has no server to share it, so the button is not there.
|
|
1005
1005
|
|
|
1006
1006
|
1. Share sends the browser to `screwbugs.dev`, which signs you in with GitHub and shows what will
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Effect, FileSystem, Layer, Path } from 'effect';
|
|
2
|
+
import { ChildProcessSpawner } from 'effect/process';
|
|
2
3
|
import { Browser } from '../core/index.js';
|
|
3
4
|
/**
|
|
4
5
|
* Launches the installed Chrome, else Edge, else Playwright's downloaded Chromium. Needs the
|
|
5
|
-
* platform (`FileSystem`, `Path`) to find Playwright's ffmpeg
|
|
6
|
+
* platform (`FileSystem`, `Path`) to find Playwright's ffmpeg, and `ChildProcessSpawner` to run it
|
|
7
|
+
* over saved videos (`stillVideo`).
|
|
6
8
|
*/
|
|
7
|
-
export declare const BrowserPlaywright: Layer.Layer<Browser, never, FileSystem.FileSystem | Path.Path>;
|
|
9
|
+
export declare const BrowserPlaywright: Layer.Layer<Browser, never, ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path>;
|
|
8
10
|
/**
|
|
9
11
|
* Downloads the Chromium build that matches the bundled Playwright. Pinned to our version so the
|
|
10
12
|
* browser revision is the one we look for.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Effect, FileSystem, Layer, Path, Schema } from 'effect';
|
|
2
|
+
import { ChildProcessSpawner } from 'effect/process';
|
|
2
3
|
import { chromium } from 'playwright-core';
|
|
3
4
|
import { Browser, BrowserNotFound } from '../core/index.js';
|
|
4
5
|
import { annotateAll } from './annotate.js';
|
|
6
|
+
import { stillVideo } from './still.js';
|
|
5
7
|
import { signInBrowser } from './sign-in.js';
|
|
6
8
|
import { deviceLabel, newSession } from './page.js';
|
|
7
9
|
/** Order matters: prefer what the user already has installed. */
|
|
@@ -50,11 +52,13 @@ const open = (options) => launchAny(options.headed).pipe(Effect.map(({ candidate
|
|
|
50
52
|
})));
|
|
51
53
|
/**
|
|
52
54
|
* Launches the installed Chrome, else Edge, else Playwright's downloaded Chromium. Needs the
|
|
53
|
-
* platform (`FileSystem`, `Path`) to find Playwright's ffmpeg
|
|
55
|
+
* platform (`FileSystem`, `Path`) to find Playwright's ffmpeg, and `ChildProcessSpawner` to run it
|
|
56
|
+
* over saved videos (`stillVideo`).
|
|
54
57
|
*/
|
|
55
58
|
export const BrowserPlaywright = Layer.effect(Browser, Effect.gen(function* () {
|
|
56
59
|
const fs = yield* FileSystem.FileSystem;
|
|
57
60
|
const path = yield* Path.Path;
|
|
61
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
58
62
|
const videoSupport = Effect.gen(function* () {
|
|
59
63
|
const lookup = yield* findFfmpeg;
|
|
60
64
|
if (lookup.found)
|
|
@@ -64,6 +68,9 @@ export const BrowserPlaywright = Layer.effect(Browser, Effect.gen(function* () {
|
|
|
64
68
|
return {
|
|
65
69
|
detect: Effect.scoped(open({ headed: false })).pipe(Effect.map((session) => session.info)),
|
|
66
70
|
videoSupport,
|
|
71
|
+
stillVideo: (file) => findFfmpeg.pipe(Effect.flatMap((lookup) => lookup.found && lookup.path !== undefined
|
|
72
|
+
? stillVideo(lookup.path, file)
|
|
73
|
+
: Effect.succeed(undefined)), Effect.provideService(FileSystem.FileSystem, fs), Effect.provideService(Path.Path, path), Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner)),
|
|
67
74
|
open,
|
|
68
75
|
deviceLabel,
|
|
69
76
|
annotate: (jobs) => Effect.scoped(launchAny(false).pipe(Effect.flatMap(({ browser }) => annotateAll(browser, jobs)))),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Effect, FileSystem, Path } from 'effect';
|
|
2
|
+
import { ChildProcessSpawner } from 'effect/process';
|
|
3
|
+
import type { StillStretch } from '../schema/index.js';
|
|
4
|
+
/** How long measuring one video may take before it is given up (the run waits for it). */
|
|
5
|
+
export declare const STILL_TIMEOUT = "2 minutes";
|
|
6
|
+
/**
|
|
7
|
+
* Where the video at `file` stands still: Playwright's ffmpeg (at `ffmpeg`, the one that recorded it) writes it
|
|
8
|
+
* as small grey PNG frames into a temporary folder, removed afterwards, and `stillStretches`
|
|
9
|
+
* compares them. Undefined when ffmpeg fails, takes longer than `STILL_TIMEOUT`, or
|
|
10
|
+
* writes frames that cannot be read. Never changes the video.
|
|
11
|
+
*/
|
|
12
|
+
export declare const stillVideo: (ffmpeg: string, file: string) => Effect.Effect<ReadonlyArray<StillStretch> | undefined, never, FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { inflateSync } from 'node:zlib';
|
|
2
|
+
import { Effect, FileSystem, Path } from 'effect';
|
|
3
|
+
import { ChildProcess, ChildProcessSpawner } from 'effect/process';
|
|
4
|
+
import { grayPng, STILL_FPS, STILL_WIDTH, stillStretches } from '../core/index.js';
|
|
5
|
+
/** How long measuring one video may take before it is given up (the run waits for it). */
|
|
6
|
+
export const STILL_TIMEOUT = '2 minutes';
|
|
7
|
+
/**
|
|
8
|
+
* Boundary: zlib has no Effect service, and PNG frames are zlib-compressed. Only ever given the
|
|
9
|
+
* small frames ffmpeg wrote for `stillVideo`.
|
|
10
|
+
*/
|
|
11
|
+
const inflate = (data) => inflateSync(data);
|
|
12
|
+
/**
|
|
13
|
+
* Where the video at `file` stands still: Playwright's ffmpeg (at `ffmpeg`, the one that recorded it) writes it
|
|
14
|
+
* as small grey PNG frames into a temporary folder, removed afterwards, and `stillStretches`
|
|
15
|
+
* compares them. Undefined when ffmpeg fails, takes longer than `STILL_TIMEOUT`, or
|
|
16
|
+
* writes frames that cannot be read. Never changes the video.
|
|
17
|
+
*/
|
|
18
|
+
export const stillVideo = (ffmpeg, file) => Effect.scoped(Effect.gen(function* () {
|
|
19
|
+
const fs = yield* FileSystem.FileSystem;
|
|
20
|
+
const path = yield* Path.Path;
|
|
21
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
22
|
+
const dir = yield* fs.makeTempDirectoryScoped({ prefix: 'screw-bugs-still-' });
|
|
23
|
+
const code = yield* spawner.exitCode(ChildProcess.make(ffmpeg, [
|
|
24
|
+
'-hide_banner',
|
|
25
|
+
'-loglevel',
|
|
26
|
+
'error',
|
|
27
|
+
'-nostdin',
|
|
28
|
+
'-i',
|
|
29
|
+
file,
|
|
30
|
+
'-vf',
|
|
31
|
+
`scale=${STILL_WIDTH}:-2`,
|
|
32
|
+
'-r',
|
|
33
|
+
String(STILL_FPS),
|
|
34
|
+
'-pix_fmt',
|
|
35
|
+
'gray',
|
|
36
|
+
'-f',
|
|
37
|
+
'image2',
|
|
38
|
+
path.join(dir, 'f%06d.png'),
|
|
39
|
+
], { stdin: 'ignore', stdout: 'ignore', stderr: 'ignore' }));
|
|
40
|
+
if (code !== 0)
|
|
41
|
+
return undefined;
|
|
42
|
+
const names = (yield* fs.readDirectory(dir)).filter((n) => n.endsWith('.png')).toSorted();
|
|
43
|
+
const frames = [];
|
|
44
|
+
for (const name of names) {
|
|
45
|
+
const image = grayPng(yield* fs.readFile(path.join(dir, name)), inflate);
|
|
46
|
+
if (image === undefined)
|
|
47
|
+
return undefined;
|
|
48
|
+
frames.push(image);
|
|
49
|
+
}
|
|
50
|
+
return frames.length === 0 ? undefined : stillStretches(frames, 1000 / STILL_FPS);
|
|
51
|
+
})).pipe(Effect.timeout(STILL_TIMEOUT), Effect.orElseSucceed(() => undefined));
|
package/dist/build-info.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "2026-11-
|
|
3
|
-
"builtAt": "2026-11-
|
|
4
|
-
"commit": "
|
|
2
|
+
"id": "2026-11-13T20:15:56.148Z-adc7b8b2",
|
|
3
|
+
"builtAt": "2026-11-13T20:15:56.148Z",
|
|
4
|
+
"commit": "3059253e41bf40735ac3344abd03346997e55dfb"
|
|
5
5
|
}
|
package/dist/cli/app.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare const appLayer: (projectRoot: string) => Layer.Layer<Operations |
|
|
|
18
18
|
* What the detached report server (`serveDetached`) shares runs with: the engine of the project whose
|
|
19
19
|
* folder is `projectRoot`.
|
|
20
20
|
*/
|
|
21
|
-
export declare const detachedShareLayer: (projectRoot: string) => Layer.Layer<ShareSource, never, import("effect/FileSystem").FileSystem | Path.Path>;
|
|
21
|
+
export declare const detachedShareLayer: (projectRoot: string) => Layer.Layer<ShareSource, never, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | import("effect/FileSystem").FileSystem | Path.Path>;
|
|
22
22
|
/**
|
|
23
23
|
* Runs the CLI and resolves to the process exit code. A due update check started with it gets
|
|
24
24
|
* the rest of its time after the command has written everything; it never changes the code.
|
package/dist/cli/commands.js
CHANGED
|
@@ -509,7 +509,7 @@ export const root = Command.make('screw-bugs').pipe(Command.withDescription('Loc
|
|
|
509
509
|
report,
|
|
510
510
|
walkthrough,
|
|
511
511
|
findings,
|
|
512
|
-
stub('share', 'Share a report through
|
|
512
|
+
stub('share', 'Share a report through Screw Bugs Cloud'),
|
|
513
513
|
runs,
|
|
514
514
|
analytics,
|
|
515
515
|
]));
|
package/dist/cli/share.js
CHANGED
|
@@ -112,11 +112,11 @@ const onOrigin = (url, origin) => {
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
/** The person-facing sentence of a reply Cloud refused, from its error body when it has one. */
|
|
115
|
-
const refusal = (response) => HttpIncomingMessage.schemaBodyJson(ShareErrorReply)(response).pipe(Effect.map((reply) => reply.message), Effect.orElseSucceed(() => `
|
|
115
|
+
const refusal = (response) => HttpIncomingMessage.schemaBodyJson(ShareErrorReply)(response).pipe(Effect.map((reply) => reply.message), Effect.orElseSucceed(() => `Screw Bugs Cloud answered ${response.status}.`), Effect.flatMap((message) => Effect.fail(new ShareFailed({ message }))));
|
|
116
116
|
/** `response` decoded with `schema` when it is a success; Cloud's own sentence when not. */
|
|
117
117
|
const answer = (response, schema) => response.status >= 200 && response.status < 300
|
|
118
118
|
? HttpIncomingMessage.schemaBodyJson(schema)(response).pipe(Effect.mapError(() => new ShareFailed({
|
|
119
|
-
message: '
|
|
119
|
+
message: 'Screw Bugs Cloud gave an answer this version cannot read.',
|
|
120
120
|
})))
|
|
121
121
|
: refusal(response);
|
|
122
122
|
/** How much of a file is read at a time while it uploads. */
|
|
@@ -157,13 +157,13 @@ export const uploadShare = (input) => Effect.gen(function* () {
|
|
|
157
157
|
const client = yield* HttpClient.HttpClient;
|
|
158
158
|
const source = yield* ShareSource;
|
|
159
159
|
const unreachable = (error) => new ShareFailed({
|
|
160
|
-
message: `Could not reach
|
|
160
|
+
message: `Could not reach Screw Bugs Cloud at ${input.cloud}: ${String(error)}.`,
|
|
161
161
|
});
|
|
162
162
|
/** `effect`, failing as Cloud not answering after `duration`. */
|
|
163
163
|
const answeredWithin = (duration) => (effect) => effect.pipe(Effect.timeoutOrElse({
|
|
164
164
|
duration,
|
|
165
165
|
orElse: () => Effect.fail(new ShareFailed({
|
|
166
|
-
message: `
|
|
166
|
+
message: `Screw Bugs Cloud at ${input.cloud} stopped answering; the share was not made.`,
|
|
167
167
|
})),
|
|
168
168
|
}));
|
|
169
169
|
const bundle = scrubBundle(yield* source
|
|
@@ -171,7 +171,7 @@ export const uploadShare = (input) => Effect.gen(function* () {
|
|
|
171
171
|
.pipe(Effect.mapError(() => new ShareFailed({ message: `Could not read the run ${input.jobId}.` }))));
|
|
172
172
|
if (bundle.generator === undefined)
|
|
173
173
|
return yield* new ShareFailed({
|
|
174
|
-
message: 'This screw-bugs build does not know its version, which
|
|
174
|
+
message: 'This screw-bugs build does not know its version, which Screw Bugs Cloud needs to show the report.',
|
|
175
175
|
});
|
|
176
176
|
const generator = bundle.generator;
|
|
177
177
|
// Each file by its real path, and only one that really is a file Cloud takes inside the run
|
|
@@ -224,7 +224,7 @@ export const uploadShare = (input) => Effect.gen(function* () {
|
|
|
224
224
|
})))
|
|
225
225
|
.pipe(Effect.mapError(unreachable), Effect.flatMap((response) => answer(response, CreatedShare)), answeredWithin(CLOUD_ANSWER_TIMEOUT));
|
|
226
226
|
const wrongPlace = new ShareFailed({
|
|
227
|
-
message: '
|
|
227
|
+
message: 'Screw Bugs Cloud asked for an upload somewhere else; nothing more was sent.',
|
|
228
228
|
});
|
|
229
229
|
let done = 0;
|
|
230
230
|
for (const upload of created.uploads) {
|
|
@@ -254,7 +254,7 @@ export const uploadShare = (input) => Effect.gen(function* () {
|
|
|
254
254
|
}).pipe(Effect.scoped, Effect.timeoutOrElse({
|
|
255
255
|
duration: UPLOAD_DEADLINE,
|
|
256
256
|
orElse: () => Effect.fail(new ShareFailed({
|
|
257
|
-
message: 'The upload took longer than
|
|
257
|
+
message: 'The upload took longer than Screw Bugs Cloud allows; the share was not made.',
|
|
258
258
|
})),
|
|
259
259
|
}));
|
|
260
260
|
/**
|
|
@@ -313,7 +313,7 @@ export const makeShareRoutes = (root) => Effect.gen(function* () {
|
|
|
313
313
|
const callback = (query) => Effect.gen(function* () {
|
|
314
314
|
const params = Schema.decodeUnknownOption(ShareCallback)(Object.fromEntries(query));
|
|
315
315
|
if (Option.isNone(params))
|
|
316
|
-
return sharePage('Share not started', 'This link is not from
|
|
316
|
+
return sharePage('Share not started', 'This link is not from Screw Bugs Cloud.', {
|
|
317
317
|
status: 400,
|
|
318
318
|
});
|
|
319
319
|
const { state, ticket, api } = params.value;
|
|
@@ -324,7 +324,7 @@ export const makeShareRoutes = (root) => Effect.gen(function* () {
|
|
|
324
324
|
now - entry.created >= SHARE_WAIT_MS)
|
|
325
325
|
return sharePage('Share not started', 'This share was not started here, was already used, or waited too long. Click Share in the report again.', { status: 410 });
|
|
326
326
|
if (originOf(api) !== cloud)
|
|
327
|
-
return sharePage('Share not started', `The ticket is for another
|
|
327
|
+
return sharePage('Share not started', `The ticket is for another Screw Bugs Cloud than ${cloud}; nothing was sent.`, { status: 400, back: back(entry.jobId) });
|
|
328
328
|
const free = yield* Ref.modify(uploading, (busy) => [!busy, true]);
|
|
329
329
|
if (!free)
|
|
330
330
|
return sharePage('Another share is uploading', 'This server uploads one share at a time. Reload this page once the other one is done.', { status: 409, back: back(entry.jobId) });
|
|
@@ -352,7 +352,7 @@ export const makeShareRoutes = (root) => Effect.gen(function* () {
|
|
|
352
352
|
const phase = entry.phase;
|
|
353
353
|
switch (phase._tag) {
|
|
354
354
|
case 'uploading':
|
|
355
|
-
return sharePage('Sharing on
|
|
355
|
+
return sharePage('Sharing on Screw Bugs Cloud', phase.total === 0
|
|
356
356
|
? 'Uploading the report…'
|
|
357
357
|
: `Uploading screenshots and videos: ${phase.done} of ${phase.total}.`, { refresh: PROGRESS_REFRESH_S });
|
|
358
358
|
case 'done':
|
package/dist/core/engine.js
CHANGED
|
@@ -253,29 +253,43 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
|
|
|
253
253
|
const end = (next) => write(() => next, true);
|
|
254
254
|
/** The session that is open, if one is: its number, video and when its video started. */
|
|
255
255
|
let open;
|
|
256
|
+
/**
|
|
257
|
+
* The session that ended while its video is being measured, so a run interrupted then
|
|
258
|
+
* still records it (without `still`).
|
|
259
|
+
*/
|
|
260
|
+
let measuring;
|
|
256
261
|
/**
|
|
257
262
|
* Checks the video of the open session once its browser is closed: it exists, is not
|
|
258
|
-
* empty, and is about as long as the session ran (`videoProblemOf`)
|
|
263
|
+
* empty, and is about as long as the session ran (`videoProblemOf`); with `measure`, also
|
|
264
|
+
* where it stands still (`Browser.stillVideo`).
|
|
259
265
|
*/
|
|
260
|
-
const sessionEnd = Effect.gen(function* () {
|
|
266
|
+
const sessionEnd = (measure) => Effect.gen(function* () {
|
|
261
267
|
if (open === undefined)
|
|
262
|
-
return
|
|
268
|
+
return measuring;
|
|
263
269
|
const { number, video, startedAt } = open;
|
|
264
270
|
open = undefined;
|
|
265
271
|
const durationMs = Math.round((yield* Clock.currentTimeMillis) - startedAt);
|
|
266
272
|
const file = yield* storage.probe(jobId, video, VIDEO_HEAD_BYTES);
|
|
267
273
|
const videoDurationMs = file === undefined ? undefined : webmDurationMs(file.head);
|
|
268
274
|
const problem = videoProblemOf(file === undefined ? undefined : { size: file.size, durationMs: videoDurationMs }, durationMs);
|
|
269
|
-
|
|
275
|
+
const saved = file !== undefined && file.size > 0;
|
|
276
|
+
const ended = {
|
|
270
277
|
number,
|
|
271
278
|
fields: {
|
|
272
279
|
endedAt: yield* now,
|
|
273
280
|
durationMs,
|
|
274
|
-
...(
|
|
281
|
+
...(saved ? { video } : {}),
|
|
275
282
|
...(videoDurationMs !== undefined ? { videoDurationMs } : {}),
|
|
276
283
|
...(problem !== undefined ? { videoProblem: problem } : {}),
|
|
277
284
|
},
|
|
278
285
|
};
|
|
286
|
+
if (!measure || !saved)
|
|
287
|
+
return ended;
|
|
288
|
+
// Where the video stands still, for the walkthrough's "Skip inactive".
|
|
289
|
+
measuring = ended;
|
|
290
|
+
const still = yield* browser.stillVideo(storage.filePath(jobId, video));
|
|
291
|
+
measuring = undefined;
|
|
292
|
+
return still === undefined ? ended : { number, fields: { ...ended.fields, still } };
|
|
279
293
|
});
|
|
280
294
|
/** The sessions of `current` with the one that just ended filled in. */
|
|
281
295
|
const withSession = (current, ended, videoProblem) => current.sessions === undefined
|
|
@@ -292,7 +306,8 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
|
|
|
292
306
|
};
|
|
293
307
|
/** Ends the job early: whatever has not run stays not verified, with `reason`. */
|
|
294
308
|
const stop = (error, reason) => Effect.gen(function* () {
|
|
295
|
-
|
|
309
|
+
// An interrupted run ends at once: its video is not measured.
|
|
310
|
+
const ended = yield* sessionEnd(error !== RUN_INTERRUPTED);
|
|
296
311
|
yield* end({
|
|
297
312
|
...ledger,
|
|
298
313
|
state: 'errored',
|
|
@@ -365,7 +380,7 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
|
|
|
365
380
|
}
|
|
366
381
|
}
|
|
367
382
|
const { videoProblem } = yield* session.close;
|
|
368
|
-
const ended = yield* sessionEnd;
|
|
383
|
+
const ended = yield* sessionEnd(true);
|
|
369
384
|
if (crash !== undefined) {
|
|
370
385
|
const error = `The browser stopped working during case "${crash.caseId}": ${crash.message}`;
|
|
371
386
|
yield* end({
|
package/dist/core/services.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, type Effect, type Scope } from 'effect';
|
|
2
|
-
import type { AccountEntry, Box, Candidate, CaseLedger, Device, ElementTarget, JobId, JobRecord, JobSpec, JobState, OnScreen, PageFacts, PageNode, Point, ReportBundle, SavedSession, ShotFrame, SignInInput, Target, Truncated, VisualViewport, WaitState } from '../schema/index.js';
|
|
2
|
+
import type { AccountEntry, Box, Candidate, CaseLedger, Device, ElementTarget, JobId, JobRecord, JobSpec, JobState, OnScreen, PageFacts, PageNode, Point, ReportBundle, SavedSession, ShotFrame, SignInInput, StillStretch, Target, Truncated, VisualViewport, WaitState } from '../schema/index.js';
|
|
3
3
|
import type { BrowserNotFound, PageActionFailed, RunNotFound, StorageFailed } from './errors.js';
|
|
4
4
|
export type BrowserKind = 'chrome' | 'msedge' | 'playwright-chromium';
|
|
5
5
|
export interface BrowserInfo {
|
|
@@ -376,6 +376,11 @@ declare const Browser_base: Context.ServiceClass<Browser, "screw-bugs/Browser",
|
|
|
376
376
|
readonly detect: Effect.Effect<BrowserInfo, BrowserNotFound>;
|
|
377
377
|
/** Whether sessions can be recorded; looked up without downloading or launching anything. */
|
|
378
378
|
readonly videoSupport: Effect.Effect<VideoSupport>;
|
|
379
|
+
/**
|
|
380
|
+
* Where the saved video at `file` (an absolute path) stands still (see `stillStretches`);
|
|
381
|
+
* undefined when that could not be measured. Reads the video only.
|
|
382
|
+
*/
|
|
383
|
+
readonly stillVideo: (file: string) => Effect.Effect<ReadonlyArray<StillStretch> | undefined>;
|
|
379
384
|
readonly open: (options: {
|
|
380
385
|
readonly headed: boolean;
|
|
381
386
|
}) => Effect.Effect<BrowserSession, BrowserNotFound, Scope.Scope>;
|
package/dist/core/video.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StillStretch } from '../schema/index.js';
|
|
1
2
|
/** How many bytes from the start of a video file `webmDurationMs` needs. */
|
|
2
3
|
export declare const VIDEO_HEAD_BYTES: number;
|
|
3
4
|
/**
|
|
@@ -14,3 +15,33 @@ export declare const videoProblemOf: (file: {
|
|
|
14
15
|
readonly size: number;
|
|
15
16
|
readonly durationMs: number | undefined;
|
|
16
17
|
} | undefined, sessionMs: number) => string | undefined;
|
|
18
|
+
/** Frames a second the video is sampled at to find where it stands still. */
|
|
19
|
+
export declare const STILL_FPS = 4;
|
|
20
|
+
/** How wide, in pixels, each sampled frame is (its height keeps the video's shape). */
|
|
21
|
+
export declare const STILL_WIDTH = 64;
|
|
22
|
+
/** A pixel changed when its grey level moved by more than this (the video's own noise stays under it). */
|
|
23
|
+
export declare const STILL_LEVEL = 8;
|
|
24
|
+
/** A frame changed when at least this many of its pixels did. */
|
|
25
|
+
export declare const STILL_PIXELS = 3;
|
|
26
|
+
/** Still stretches shorter than this are not recorded. */
|
|
27
|
+
export declare const STILL_MIN_MS = 1000;
|
|
28
|
+
/** A grey image: one byte a pixel, row by row. */
|
|
29
|
+
export interface GrayImage {
|
|
30
|
+
readonly width: number;
|
|
31
|
+
readonly height: number;
|
|
32
|
+
readonly pixels: Uint8Array;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The pixels of an 8-bit greyscale, non-interlaced PNG (what ffmpeg writes with `-pix_fmt gray`),
|
|
36
|
+
* with `inflate` to undo its zlib compression; undefined for any other PNG or a broken one.
|
|
37
|
+
*/
|
|
38
|
+
export declare const grayPng: (bytes: Uint8Array, inflate: (data: Uint8Array) => Uint8Array) => GrayImage | undefined;
|
|
39
|
+
/** Whether `next` shows something other than `previous`: `STILL_PIXELS` or more moved past `STILL_LEVEL`. */
|
|
40
|
+
export declare const frameChanged: (previous: GrayImage, next: GrayImage) => boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The stretches in which frames sampled every `frameMs` (the first at 0) did not change (from one
|
|
43
|
+
* to the next, nor from the first of the stretch), at least
|
|
44
|
+
* `STILL_MIN_MS` long: from the first frame of each still run to its last, and to the end of the
|
|
45
|
+
* last frame for a run that lasts to the end. In time order.
|
|
46
|
+
*/
|
|
47
|
+
export declare const stillStretches: (frames: ReadonlyArray<GrayImage>, frameMs: number) => ReadonlyArray<StillStretch>;
|
package/dist/core/video.js
CHANGED
|
@@ -99,3 +99,135 @@ export const videoProblemOf = (file, sessionMs) => {
|
|
|
99
99
|
? `The video is ${seconds(file.durationMs)} long, but the session ran for ${seconds(sessionMs)}.`
|
|
100
100
|
: undefined;
|
|
101
101
|
};
|
|
102
|
+
/*
|
|
103
|
+
* Where a session's video stands still, for the walkthrough's "Skip inactive". After a session,
|
|
104
|
+
* Playwright's ffmpeg writes the video as small grey PNG frames (`STILL_FPS` a second,
|
|
105
|
+
* `STILL_WIDTH` pixels wide); here, in pure code, they are decoded and compared one after
|
|
106
|
+
* another. Measuring never changes the video, a status or anything a run did.
|
|
107
|
+
*/
|
|
108
|
+
/** Frames a second the video is sampled at to find where it stands still. */
|
|
109
|
+
export const STILL_FPS = 4;
|
|
110
|
+
/** How wide, in pixels, each sampled frame is (its height keeps the video's shape). */
|
|
111
|
+
export const STILL_WIDTH = 64;
|
|
112
|
+
/** A pixel changed when its grey level moved by more than this (the video's own noise stays under it). */
|
|
113
|
+
export const STILL_LEVEL = 8;
|
|
114
|
+
/** A frame changed when at least this many of its pixels did. */
|
|
115
|
+
export const STILL_PIXELS = 3;
|
|
116
|
+
/** Still stretches shorter than this are not recorded. */
|
|
117
|
+
export const STILL_MIN_MS = 1000;
|
|
118
|
+
const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
119
|
+
const paeth = (a, b, c) => {
|
|
120
|
+
const p = a + b - c;
|
|
121
|
+
const pa = Math.abs(p - a);
|
|
122
|
+
const pb = Math.abs(p - b);
|
|
123
|
+
const pc = Math.abs(p - c);
|
|
124
|
+
return pa <= pb && pa <= pc ? a : pb <= pc ? b : c;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* The pixels of an 8-bit greyscale, non-interlaced PNG (what ffmpeg writes with `-pix_fmt gray`),
|
|
128
|
+
* with `inflate` to undo its zlib compression; undefined for any other PNG or a broken one.
|
|
129
|
+
*/
|
|
130
|
+
export const grayPng = (bytes, inflate) => {
|
|
131
|
+
if (bytes.length < 8 || PNG_SIGNATURE.some((b, i) => bytes[i] !== b))
|
|
132
|
+
return undefined;
|
|
133
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
134
|
+
const tag = (at) => String.fromCharCode(...bytes.subarray(at, at + 4));
|
|
135
|
+
let width = 0;
|
|
136
|
+
let height = 0;
|
|
137
|
+
const data = [];
|
|
138
|
+
let at = 8;
|
|
139
|
+
while (at + 12 <= bytes.length) {
|
|
140
|
+
const length = view.getUint32(at);
|
|
141
|
+
const type = tag(at + 4);
|
|
142
|
+
const body = at + 8;
|
|
143
|
+
if (body + length > bytes.length)
|
|
144
|
+
return undefined;
|
|
145
|
+
if (type === 'IHDR') {
|
|
146
|
+
if (length < 13)
|
|
147
|
+
return undefined;
|
|
148
|
+
width = view.getUint32(body);
|
|
149
|
+
height = view.getUint32(body + 4);
|
|
150
|
+
const [depth, color, , , interlace] = bytes.subarray(body + 8, body + 13);
|
|
151
|
+
if (depth !== 8 || color !== 0 || interlace !== 0)
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
else if (type === 'IDAT')
|
|
155
|
+
data.push(bytes.subarray(body, body + length));
|
|
156
|
+
else if (type === 'IEND')
|
|
157
|
+
break;
|
|
158
|
+
at = body + length + 4;
|
|
159
|
+
}
|
|
160
|
+
if (width === 0 || height === 0 || data.length === 0)
|
|
161
|
+
return undefined;
|
|
162
|
+
const joined = new Uint8Array(data.reduce((n, d) => n + d.length, 0));
|
|
163
|
+
data.reduce((offset, d) => (joined.set(d, offset), offset + d.length), 0);
|
|
164
|
+
let raw;
|
|
165
|
+
try {
|
|
166
|
+
raw = inflate(joined);
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
if (raw.length < height * (width + 1))
|
|
172
|
+
return undefined;
|
|
173
|
+
const pixels = new Uint8Array(width * height);
|
|
174
|
+
for (let y = 0; y < height; y++) {
|
|
175
|
+
const filter = raw[y * (width + 1)];
|
|
176
|
+
const row = y * width;
|
|
177
|
+
for (let x = 0; x < width; x++) {
|
|
178
|
+
const value = raw[y * (width + 1) + 1 + x];
|
|
179
|
+
const left = x > 0 ? pixels[row + x - 1] : 0;
|
|
180
|
+
const up = y > 0 ? pixels[row - width + x] : 0;
|
|
181
|
+
const corner = x > 0 && y > 0 ? pixels[row - width + x - 1] : 0;
|
|
182
|
+
const predicted = filter === 0
|
|
183
|
+
? 0
|
|
184
|
+
: filter === 1
|
|
185
|
+
? left
|
|
186
|
+
: filter === 2
|
|
187
|
+
? up
|
|
188
|
+
: filter === 3
|
|
189
|
+
? (left + up) >> 1
|
|
190
|
+
: filter === 4
|
|
191
|
+
? paeth(left, up, corner)
|
|
192
|
+
: undefined;
|
|
193
|
+
if (predicted === undefined)
|
|
194
|
+
return undefined;
|
|
195
|
+
pixels[row + x] = (value + predicted) & 0xff;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return { width, height, pixels };
|
|
199
|
+
};
|
|
200
|
+
/** Whether `next` shows something other than `previous`: `STILL_PIXELS` or more moved past `STILL_LEVEL`. */
|
|
201
|
+
export const frameChanged = (previous, next) => {
|
|
202
|
+
if (previous.width !== next.width || previous.height !== next.height)
|
|
203
|
+
return true;
|
|
204
|
+
let changed = 0;
|
|
205
|
+
for (let i = 0; i < next.pixels.length; i++)
|
|
206
|
+
if (Math.abs(next.pixels[i] - previous.pixels[i]) > STILL_LEVEL && ++changed >= STILL_PIXELS)
|
|
207
|
+
return true;
|
|
208
|
+
return false;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* The stretches in which frames sampled every `frameMs` (the first at 0) did not change (from one
|
|
212
|
+
* to the next, nor from the first of the stretch), at least
|
|
213
|
+
* `STILL_MIN_MS` long: from the first frame of each still run to its last, and to the end of the
|
|
214
|
+
* last frame for a run that lasts to the end. In time order.
|
|
215
|
+
*/
|
|
216
|
+
export const stillStretches = (frames, frameMs) => {
|
|
217
|
+
const stretches = [];
|
|
218
|
+
const add = (from, to) => {
|
|
219
|
+
if (to - from >= STILL_MIN_MS)
|
|
220
|
+
stretches.push({ fromMs: from, toMs: to });
|
|
221
|
+
};
|
|
222
|
+
let start = 0;
|
|
223
|
+
// Each frame is compared with the one before and with the first of its still run, so a change
|
|
224
|
+
// too slow to show between two frames (a fade) still ends the run.
|
|
225
|
+
for (let i = 1; i < frames.length; i++)
|
|
226
|
+
if (frameChanged(frames[i - 1], frames[i]) || frameChanged(frames[start], frames[i])) {
|
|
227
|
+
add(start * frameMs, (i - 1) * frameMs);
|
|
228
|
+
start = i;
|
|
229
|
+
}
|
|
230
|
+
if (frames.length > 0)
|
|
231
|
+
add(start * frameMs, frames.length * frameMs);
|
|
232
|
+
return stretches;
|
|
233
|
+
};
|
package/dist/report/html.js
CHANGED
|
@@ -337,6 +337,10 @@ a.tc:hover { background: var(--accent); color: var(--on-accent); }
|
|
|
337
337
|
.rp-head h1 { font-size: 24px; line-height: 30px; }
|
|
338
338
|
.filters button { height: 44px; }
|
|
339
339
|
.rp-main { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 18px 0 0; }
|
|
340
|
+
/* The player no wider than on a phone, centered: in a window wider than a phone, a full-width
|
|
341
|
+
player would be pinned so tall that little room is left to read the cases under it. Its strip
|
|
342
|
+
stays full width, so the cases still scroll out of sight under it. */
|
|
343
|
+
.rp-sticky { max-width: 416px; margin: 0 auto; }
|
|
340
344
|
/* The player is pinned under the top bar; the cases fade out under it instead. */
|
|
341
345
|
.rp-left { position: sticky; top: var(--bar); z-index: 2; background: var(--bg); padding: 8px 12px 10px; }
|
|
342
346
|
.rp-left::after { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: var(--fade); background: linear-gradient(var(--bg), transparent); pointer-events: none; }
|
|
@@ -355,6 +359,11 @@ a.tc:hover { background: var(--accent); color: var(--on-accent); }
|
|
|
355
359
|
.play, .full { width: 44px; height: 44px; }
|
|
356
360
|
.speed button { height: 38px; }
|
|
357
361
|
}
|
|
362
|
+
/* Between a small window and the two columns, the cases as wide as the player, so their lines do
|
|
363
|
+
not run across the whole window; narrower windows give them all of their width. */
|
|
364
|
+
@media (min-width: 641px) and (max-width: 900px) {
|
|
365
|
+
.rp-right { max-width: 440px; margin: 0 auto; }
|
|
366
|
+
}
|
|
358
367
|
`;
|
|
359
368
|
const caseAnchor = (id) => `case-${id}`;
|
|
360
369
|
/** A timecode: a link that opens the video at that time, which the page's script turns into a
|
package/dist/report/menu-bar.js
CHANGED
|
@@ -24,7 +24,7 @@ export const SHARE_START_PATH = '/.screw-bugs/share/start';
|
|
|
24
24
|
export const shareButton = (jobId) => html `<a
|
|
25
25
|
class="share-btn"
|
|
26
26
|
href="${`${SHARE_START_PATH}?run=${encodeURIComponent(jobId)}`}"
|
|
27
|
-
title="Share this report on
|
|
27
|
+
title="Share this report on Screw Bugs Cloud: a link anyone can open for 7 days"
|
|
28
28
|
hidden
|
|
29
29
|
>${icon('share', { size: 16 })}<span class="share-word">Share</span></a
|
|
30
30
|
>`;
|
package/dist/report/view.d.ts
CHANGED
|
@@ -202,7 +202,7 @@ export interface UrlPoint {
|
|
|
202
202
|
export declare const urlTimeline: (bundle: ReportBundle, views?: ReadonlyArray<CaseView>) => ReadonlyArray<UrlPoint>;
|
|
203
203
|
/** The address at `ms` into a session's video: the last one recorded by then, if any. */
|
|
204
204
|
export declare const urlAt: (points: ReadonlyArray<UrlPoint>, session: number, ms: number) => string | undefined;
|
|
205
|
-
/** A stretch of a session's video in which
|
|
205
|
+
/** A stretch of a session's video in which nothing happened: what "Skip inactive" jumps over. */
|
|
206
206
|
export interface IdleStretch {
|
|
207
207
|
readonly session: number;
|
|
208
208
|
readonly fromMs: number;
|
|
@@ -213,10 +213,21 @@ export declare const IDLE_MIN_MS = 1500;
|
|
|
213
213
|
/** How much of an idle stretch is still played at either end, so a step's result can be seen. */
|
|
214
214
|
export declare const IDLE_MARGIN_MS = 300;
|
|
215
215
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
|
|
216
|
+
* Around a recorded action (a press of the mouse or a key) the video is never idle, even where
|
|
217
|
+
* it stands still: the walkthrough's cursor glides to it before (`GLIDE_S`) and its ripple and
|
|
218
|
+
* label show after.
|
|
219
|
+
*/
|
|
220
|
+
export declare const ACTION_BEFORE_MS = 600;
|
|
221
|
+
export declare const ACTION_AFTER_MS = 1500;
|
|
222
|
+
/**
|
|
223
|
+
* The stretches of each session's video where nothing happened, at least `IDLE_MIN_MS` long once
|
|
224
|
+
* `IDLE_MARGIN_MS` is kept at either end (none at the very start of the video). Where the run
|
|
225
|
+
* measured its video (`Session.still`), they are where its picture stood still, even while a step
|
|
226
|
+
* waited, except around each recorded action (`ACTION_BEFORE_MS`, `ACTION_AFTER_MS`; the whole
|
|
227
|
+
* step for an action recorded without a time, whose label shows while its step plays). For an
|
|
228
|
+
* older run they are where no step ran: before the first step, between steps and after the last
|
|
229
|
+
* one (to the end of the video, when its length is known); there a step that waited is not idle,
|
|
230
|
+
* since what it waited for may show at any moment.
|
|
220
231
|
*/
|
|
221
232
|
export declare const idleStretches: (bundle: ReportBundle) => ReadonlyArray<IdleStretch>;
|
|
222
233
|
/**
|
package/dist/report/view.js
CHANGED
|
@@ -513,35 +513,69 @@ export const IDLE_MIN_MS = 1500;
|
|
|
513
513
|
/** How much of an idle stretch is still played at either end, so a step's result can be seen. */
|
|
514
514
|
export const IDLE_MARGIN_MS = 300;
|
|
515
515
|
/**
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
|
|
516
|
+
* Around a recorded action (a press of the mouse or a key) the video is never idle, even where
|
|
517
|
+
* it stands still: the walkthrough's cursor glides to it before (`GLIDE_S`) and its ripple and
|
|
518
|
+
* label show after.
|
|
519
|
+
*/
|
|
520
|
+
export const ACTION_BEFORE_MS = 600;
|
|
521
|
+
export const ACTION_AFTER_MS = 1500;
|
|
522
|
+
/** `spans` with every part `busy` covers taken out; both in time order or not. */
|
|
523
|
+
const without = (spans, busy) => busy.reduce((left, [b0, b1]) => left.flatMap(([a0, a1]) => b1 <= a0 || b0 >= a1
|
|
524
|
+
? [[a0, a1]]
|
|
525
|
+
: [...(b0 > a0 ? [[a0, b0]] : []), ...(b1 < a1 ? [[b1, a1]] : [])]), spans);
|
|
526
|
+
/**
|
|
527
|
+
* The stretches of each session's video where nothing happened, at least `IDLE_MIN_MS` long once
|
|
528
|
+
* `IDLE_MARGIN_MS` is kept at either end (none at the very start of the video). Where the run
|
|
529
|
+
* measured its video (`Session.still`), they are where its picture stood still, even while a step
|
|
530
|
+
* waited, except around each recorded action (`ACTION_BEFORE_MS`, `ACTION_AFTER_MS`; the whole
|
|
531
|
+
* step for an action recorded without a time, whose label shows while its step plays). For an
|
|
532
|
+
* older run they are where no step ran: before the first step, between steps and after the last
|
|
533
|
+
* one (to the end of the video, when its length is known); there a step that waited is not idle,
|
|
534
|
+
* since what it waited for may show at any moment.
|
|
520
535
|
*/
|
|
521
536
|
export const idleStretches = (bundle) => {
|
|
522
|
-
const
|
|
523
|
-
|
|
537
|
+
const steps = new Map();
|
|
538
|
+
const actions = new Map();
|
|
539
|
+
for (const entry of bundle.ledger.cases) {
|
|
540
|
+
const session = sessionNumber(entry);
|
|
524
541
|
for (const s of entry.steps ?? []) {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
at = Math.max(at, end);
|
|
542
|
+
steps.set(session, [
|
|
543
|
+
...(steps.get(session) ?? []),
|
|
544
|
+
[s.startMs, Math.max(s.startMs, s.endMs)],
|
|
545
|
+
]);
|
|
546
|
+
if (s.action === undefined)
|
|
547
|
+
continue;
|
|
548
|
+
const at = s.action.atMs;
|
|
549
|
+
// An action whose input was not seen (a fill, a frame's click) is labelled while its step
|
|
550
|
+
// plays: all of that step is kept.
|
|
551
|
+
const busy = at !== undefined
|
|
552
|
+
? [at - ACTION_BEFORE_MS, at + ACTION_AFTER_MS]
|
|
553
|
+
: [s.startMs, Math.max(s.startMs, s.endMs)];
|
|
554
|
+
actions.set(session, [...(actions.get(session) ?? []), busy]);
|
|
539
555
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
556
|
+
}
|
|
557
|
+
const measured = new Map((bundle.ledger.sessions ?? []).flatMap((s) => s.still !== undefined ? [[s.number, s.still]] : []));
|
|
558
|
+
const sessions = [...new Set([...steps.keys(), ...measured.keys()])].toSorted((a, b) => a - b);
|
|
559
|
+
return sessions.flatMap((session) => {
|
|
560
|
+
const still = measured.get(session);
|
|
561
|
+
const gaps = still !== undefined
|
|
562
|
+
? without(still.map((s) => [s.fromMs, s.toMs]), actions.get(session) ?? [])
|
|
563
|
+
: (() => {
|
|
564
|
+
const sorted = (steps.get(session) ?? []).toSorted((a, b) => a[0] - b[0]);
|
|
565
|
+
const found = [];
|
|
566
|
+
let at = 0;
|
|
567
|
+
for (const [start, end] of sorted) {
|
|
568
|
+
if (start > at)
|
|
569
|
+
found.push([at, start]);
|
|
570
|
+
at = Math.max(at, end);
|
|
571
|
+
}
|
|
572
|
+
const length = sessionLength(bundle, session);
|
|
573
|
+
if (length !== undefined && length > at)
|
|
574
|
+
found.push([at, length]);
|
|
575
|
+
return found;
|
|
576
|
+
})();
|
|
543
577
|
return gaps.flatMap(([from, to]) => {
|
|
544
|
-
const [a, b] = [from
|
|
578
|
+
const [a, b] = [from <= 0 ? 0 : from + IDLE_MARGIN_MS, to - IDLE_MARGIN_MS];
|
|
545
579
|
return b - a >= IDLE_MIN_MS ? [{ session, fromMs: a, toMs: b }] : [];
|
|
546
580
|
});
|
|
547
581
|
});
|
|
@@ -19,7 +19,8 @@ export declare const GLIDE_S = 0.6;
|
|
|
19
19
|
* the reader prefers less; the top row that shows, below the top bar and, on a narrow screen, the
|
|
20
20
|
* pinned player and its fade, when the page has scrolled the script under them), draws the box of the element it acted on over the video while that was
|
|
21
21
|
* measured, makes timecodes and rows seek (and switch session videos) instead of opening the file,
|
|
22
|
-
* and, with "Skip inactive" on, jumps over the stretches where
|
|
22
|
+
* and, with "Skip inactive" on (remembered like the theme), jumps over the stretches where
|
|
23
|
+
* nothing happened (`idleStretches`) while it plays.
|
|
23
24
|
* "Expand" shows the whole script and makes the video smaller. Fullscreen takes the whole page
|
|
24
25
|
* (`.wt`), not only the video; on a wide screen (a desktop) it never takes the browser's screen,
|
|
25
26
|
* only lays the page out again (`.focus`, see `PLAYER_JS`): the top bar, the video as big as fits with its address over it and
|
|
@@ -40,7 +41,7 @@ export declare const GLIDE_S = 0.6;
|
|
|
40
41
|
* and there is no ripple. A "Cursor" switch turns it off, remembered like the theme. Nothing is
|
|
41
42
|
* added to the page under test or to the video.
|
|
42
43
|
*/
|
|
43
|
-
export declare const WALKTHROUGH_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();\n const stg=d.querySelector('.wt-stage');let fr=0;\n const fit=()=>{fr=0;if(!stg)return;const t=stg.getBoundingClientRect().top;stg.style.setProperty('--wt-top',Math.round(t)+'px');stg.style.setProperty('--wt-y',Math.round(t+scrollY)+'px')};\n const refit=()=>{if(!fr)fr=requestAnimationFrame(fit)};\n fit();addEventListener('resize',refit);addEventListener('load',refit);addEventListener('scroll',refit,{passive:true});d.addEventListener('fullscreenchange',refit);\n if(window.ResizeObserver)new ResizeObserver(refit).observe(d.body);\n const v=d.getElementById('wt-video');if(!v)return;\n const w=d.querySelector('.wt'),panel=d.getElementById('wt-script'),box=d.getElementById('wt-box'),cap=d.getElementById('wt-cap');\n const say=a=>{const x=a&&a.querySelector('.wt-text');cap.replaceChildren(...(x?[...x.childNodes].filter(n=>!(n instanceof Element&&n.classList.contains('wt-state'))).map(n=>n.cloneNode(true)):[]));cap.hidden=!x};\n const steps=[...d.querySelectorAll('.wt-step[data-t]')];\n const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));\n const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');\n let on=null,skip=!!skipB&&skipB.getAttribute('aria-pressed')==='true',P=null;\n w.classList.add('live');\n const hide=()=>{box.hidden=true};\n const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};\n const put=(e,x,y,bw,bh)=>{e.style.left=x+'px';e.style.top=y+'px';if(bw!==undefined){e.style.width=bw+'px';e.style.height=bh+'px'}};\n const draw=(t,g)=>{if(P.down()!==null||!g||!on||!on.dataset.box||t<Number(on.dataset.b0)||t>Number(on.dataset.b1))return hide();const b=on.dataset.box.split(' ').map(Number);put(box,g.x+b[0]*g.w,g.y+b[1]*g.h,b[2]*g.w,b[3]*g.h);box.querySelector('span').textContent=on.dataset.label||'';box.hidden=false};\n const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';\n const nums=x=>x?x.split(' ').map(Number):null;\n const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));\n let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}\n const fx=(t,g)=>{\n C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;\n if(!fon||P.down()!==null||!g)return;\n const m=still(),mine=acts.filter(a=>a.s===P.cur()),ptr=mine.filter(a=>a.p),xy=p=>[g.x+p[0]*g.w,g.y+p[1]*g.h];\n let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});\n const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;\n if(n&&a){const gw=Math.min(0.6,n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}\n if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}\n if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}\n let f=null,l=null,u=null;\n for(const x of mine){if(x.k==='fill'&&x.b&&t>=x.b0&&t<=x.b1)f=x;if(x.k==='fill'||!(x.at>=0)?t>=x.t0&&t<=x.t1:t>=x.at&&t<=x.at+1.5)l=x;else if(!u&&x.p&&x.at>t&&x.at-t<=0.6)u=x}\n l=l||u;\n if(f){const xy2=xy(f.b);put(G,xy2[0],xy2[1],f.b[2]*g.w,f.b[3]*g.h);G.hidden=false;box.hidden=true}\n if(l&&l.l){L.textContent=l.l;L.hidden=false;let x=g.x+10,y=g.y+10;if(l.p){const q=xy(l.p);x=q[0]+14;y=q[1]+20}else if(l.b){const q=xy(l.b);x=q[0];y=q[1]+l.b[3]*g.h+10}if(y+L.offsetHeight>g.y+g.h-4)y=l.b?g.y+l.b[1]*g.h-L.offsetHeight-10:g.y+g.h-L.offsetHeight-4;put(L,Math.max(g.x+4,Math.min(x,g.x+g.w-L.offsetWidth-4)),Math.max(g.y+4,y))}\n box.querySelector('span').hidden=!L.hidden;\n };\n const stage=d.querySelector('.wt-stage');\n const cover=()=>{let y=topEdge();if(stage&&getComputedStyle(stage).position==='sticky')y=Math.max(y,stage.getBoundingClientRect().bottom+16);return y};\n const anchor=a=>{const hid=Math.max(0,cover()-panel.getBoundingClientRect().top);panel.scrollTo({top:Math.max(0,a.offsetTop-6-hid),behavior:still()?'auto':'smooth'})};\n const tick=t=>{\n const cur=P.cur();\n if(skip&&!v.paused&&!v.seeking){const gap=idle.find(x=>x.s===cur&&t>=x.a&&t<x.b-0.05);if(gap){v.currentTime=gap.b;return}}\n let a=null;for(const s of steps){if(s.dataset.s===cur&&Number(s.dataset.t)<=t+0.02)a=s}\n if(a!==on){if(on){on.classList.remove('on');on.removeAttribute('aria-current');on.closest('.wt-case').classList.remove('on')}on=a;say(a);if(a){a.classList.add('on');a.setAttribute('aria-current','step');a.closest('.wt-case').classList.add('on');anchor(a)}}\n const g=geo();draw(t,g);fx(t,g);\n };\n P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});\n if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}\n if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip))});\n if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const a=t.closest('a[data-t][data-s],.wt-step[data-t][data-s]');if(!a||!P.has(a.dataset.s))return;\n e.preventDefault();const fig=v.closest('.player');\n if(fig.getBoundingClientRect().bottom<topEdge())fig.scrollIntoView({block:'start',behavior:still()?'auto':'smooth'});\n P.load(a.dataset.s,Number(a.dataset.t),P.playing());\n });\n P.update();\n});\n})();";
|
|
44
|
+
export declare const WALKTHROUGH_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();\n const stg=d.querySelector('.wt-stage');let fr=0;\n const fit=()=>{fr=0;if(!stg)return;const t=stg.getBoundingClientRect().top;stg.style.setProperty('--wt-top',Math.round(t)+'px');stg.style.setProperty('--wt-y',Math.round(t+scrollY)+'px')};\n const refit=()=>{if(!fr)fr=requestAnimationFrame(fit)};\n fit();addEventListener('resize',refit);addEventListener('load',refit);addEventListener('scroll',refit,{passive:true});d.addEventListener('fullscreenchange',refit);\n if(window.ResizeObserver)new ResizeObserver(refit).observe(d.body);\n const v=d.getElementById('wt-video');if(!v)return;\n const w=d.querySelector('.wt'),panel=d.getElementById('wt-script'),box=d.getElementById('wt-box'),cap=d.getElementById('wt-cap');\n const say=a=>{const x=a&&a.querySelector('.wt-text');cap.replaceChildren(...(x?[...x.childNodes].filter(n=>!(n instanceof Element&&n.classList.contains('wt-state'))).map(n=>n.cloneNode(true)):[]));cap.hidden=!x};\n const steps=[...d.querySelectorAll('.wt-step[data-t]')];\n const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));\n const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');\n let on=null,skip=!!skipB,P=null;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));\n w.classList.add('live');\n const hide=()=>{box.hidden=true};\n const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};\n const put=(e,x,y,bw,bh)=>{e.style.left=x+'px';e.style.top=y+'px';if(bw!==undefined){e.style.width=bw+'px';e.style.height=bh+'px'}};\n const draw=(t,g)=>{if(P.down()!==null||!g||!on||!on.dataset.box||t<Number(on.dataset.b0)||t>Number(on.dataset.b1))return hide();const b=on.dataset.box.split(' ').map(Number);put(box,g.x+b[0]*g.w,g.y+b[1]*g.h,b[2]*g.w,b[3]*g.h);box.querySelector('span').textContent=on.dataset.label||'';box.hidden=false};\n const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';\n const nums=x=>x?x.split(' ').map(Number):null;\n const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));\n let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}\n const fx=(t,g)=>{\n C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;\n if(!fon||P.down()!==null||!g)return;\n const m=still(),mine=acts.filter(a=>a.s===P.cur()),ptr=mine.filter(a=>a.p),xy=p=>[g.x+p[0]*g.w,g.y+p[1]*g.h];\n let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});\n const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;\n if(n&&a){const gw=Math.min(0.6,n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}\n if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}\n if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}\n let f=null,l=null,u=null;\n for(const x of mine){if(x.k==='fill'&&x.b&&t>=x.b0&&t<=x.b1)f=x;if(x.k==='fill'||!(x.at>=0)?t>=x.t0&&t<=x.t1:t>=x.at&&t<=x.at+1.5)l=x;else if(!u&&x.p&&x.at>t&&x.at-t<=0.6)u=x}\n l=l||u;\n if(f){const xy2=xy(f.b);put(G,xy2[0],xy2[1],f.b[2]*g.w,f.b[3]*g.h);G.hidden=false;box.hidden=true}\n if(l&&l.l){L.textContent=l.l;L.hidden=false;let x=g.x+10,y=g.y+10;if(l.p){const q=xy(l.p);x=q[0]+14;y=q[1]+20}else if(l.b){const q=xy(l.b);x=q[0];y=q[1]+l.b[3]*g.h+10}if(y+L.offsetHeight>g.y+g.h-4)y=l.b?g.y+l.b[1]*g.h-L.offsetHeight-10:g.y+g.h-L.offsetHeight-4;put(L,Math.max(g.x+4,Math.min(x,g.x+g.w-L.offsetWidth-4)),Math.max(g.y+4,y))}\n box.querySelector('span').hidden=!L.hidden;\n };\n const stage=d.querySelector('.wt-stage');\n const cover=()=>{let y=topEdge();if(stage&&getComputedStyle(stage).position==='sticky')y=Math.max(y,stage.getBoundingClientRect().bottom+16);return y};\n const anchor=a=>{const hid=Math.max(0,cover()-panel.getBoundingClientRect().top);panel.scrollTo({top:Math.max(0,a.offsetTop-6-hid),behavior:still()?'auto':'smooth'})};\n const tick=t=>{\n const cur=P.cur();\n if(skip&&!v.paused&&!v.seeking){const gap=idle.find(x=>x.s===cur&&t>=x.a&&t<x.b-0.05);if(gap){v.currentTime=gap.b;return}}\n let a=null;for(const s of steps){if(s.dataset.s===cur&&Number(s.dataset.t)<=t+0.02)a=s}\n if(a!==on){if(on){on.classList.remove('on');on.removeAttribute('aria-current');on.closest('.wt-case').classList.remove('on')}on=a;say(a);if(a){a.classList.add('on');a.setAttribute('aria-current','step');a.closest('.wt-case').classList.add('on');anchor(a)}}\n const g=geo();draw(t,g);fx(t,g);\n };\n P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});\n if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}\n if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});\n if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const a=t.closest('a[data-t][data-s],.wt-step[data-t][data-s]');if(!a||!P.has(a.dataset.s))return;\n e.preventDefault();const fig=v.closest('.player');\n if(fig.getBoundingClientRect().bottom<topEdge())fig.scrollIntoView({block:'start',behavior:still()?'auto':'smooth'});\n P.load(a.dataset.s,Number(a.dataset.t),P.playing());\n });\n P.update();\n});\n})();";
|
|
44
45
|
/**
|
|
45
46
|
* As the report's: the video by relative path, one script by hash, and from the network only
|
|
46
47
|
* Google Fonts' stylesheet and its fonts.
|
|
@@ -33,7 +33,8 @@ export const GLIDE_S = 0.6;
|
|
|
33
33
|
* the reader prefers less; the top row that shows, below the top bar and, on a narrow screen, the
|
|
34
34
|
* pinned player and its fade, when the page has scrolled the script under them), draws the box of the element it acted on over the video while that was
|
|
35
35
|
* measured, makes timecodes and rows seek (and switch session videos) instead of opening the file,
|
|
36
|
-
* and, with "Skip inactive" on, jumps over the stretches where
|
|
36
|
+
* and, with "Skip inactive" on (remembered like the theme), jumps over the stretches where
|
|
37
|
+
* nothing happened (`idleStretches`) while it plays.
|
|
37
38
|
* "Expand" shows the whole script and makes the video smaller. Fullscreen takes the whole page
|
|
38
39
|
* (`.wt`), not only the video; on a wide screen (a desktop) it never takes the browser's screen,
|
|
39
40
|
* only lays the page out again (`.focus`, see `PLAYER_JS`): the top bar, the video as big as fits with its address over it and
|
|
@@ -68,7 +69,7 @@ d.addEventListener('DOMContentLoaded',()=>{
|
|
|
68
69
|
const steps=[...d.querySelectorAll('.wt-step[data-t]')];
|
|
69
70
|
const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));
|
|
70
71
|
const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');
|
|
71
|
-
let on=null,skip=!!skipB&&skipB.
|
|
72
|
+
let on=null,skip=!!skipB,P=null;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));
|
|
72
73
|
w.classList.add('live');
|
|
73
74
|
const hide=()=>{box.hidden=true};
|
|
74
75
|
const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};
|
|
@@ -106,7 +107,7 @@ d.addEventListener('DOMContentLoaded',()=>{
|
|
|
106
107
|
};
|
|
107
108
|
P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});
|
|
108
109
|
if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}
|
|
109
|
-
if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip))});
|
|
110
|
+
if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});
|
|
110
111
|
if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});
|
|
111
112
|
d.addEventListener('click',e=>{
|
|
112
113
|
const t=e.target;if(!(t instanceof Element))return;
|
|
@@ -320,6 +320,12 @@ export declare const FACT_IMAGES_MAX = 12;
|
|
|
320
320
|
export declare const FACT_LINKS_MAX = 12;
|
|
321
321
|
/** Image sources and link addresses are cut to this many characters. */
|
|
322
322
|
export declare const URL_MAX = 300;
|
|
323
|
+
/** A stretch of a session's video, in ms on its clock. */
|
|
324
|
+
export declare const StillStretch: Schema.Struct<{
|
|
325
|
+
readonly fromMs: Schema.Number;
|
|
326
|
+
readonly toMs: Schema.Number;
|
|
327
|
+
}>;
|
|
328
|
+
export type StillStretch = typeof StillStretch.Type;
|
|
323
329
|
/**
|
|
324
330
|
* One test user in one browser, start to end, recorded as one continuous video. A run without a
|
|
325
331
|
* login is one session; jobs have at most one account today, so a run has one session.
|
|
@@ -339,6 +345,15 @@ export declare const Session: Schema.Struct<{
|
|
|
339
345
|
readonly videoDurationMs: Schema.optionalKey<Schema.Number>;
|
|
340
346
|
/** Why the video is missing or incomplete, in plain language. Never changes a status. */
|
|
341
347
|
readonly videoProblem: Schema.optionalKey<Schema.String>;
|
|
348
|
+
/**
|
|
349
|
+
* The stretches of the video in which its picture did not change, in ms on its clock, measured
|
|
350
|
+
* from the saved video once the session ended. Missing when that could not be measured (older
|
|
351
|
+
* runs, no video); empty when nothing stood still.
|
|
352
|
+
*/
|
|
353
|
+
readonly still: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
354
|
+
readonly fromMs: Schema.Number;
|
|
355
|
+
readonly toMs: Schema.Number;
|
|
356
|
+
}>>>;
|
|
342
357
|
}>;
|
|
343
358
|
export type Session = typeof Session.Type;
|
|
344
359
|
/**
|
package/dist/schema/evidence.js
CHANGED
|
@@ -212,6 +212,8 @@ export const FACT_IMAGES_MAX = 12;
|
|
|
212
212
|
export const FACT_LINKS_MAX = 12;
|
|
213
213
|
/** Image sources and link addresses are cut to this many characters. */
|
|
214
214
|
export const URL_MAX = 300;
|
|
215
|
+
/** A stretch of a session's video, in ms on its clock. */
|
|
216
|
+
export const StillStretch = Schema.Struct({ fromMs: Schema.Number, toMs: Schema.Number });
|
|
215
217
|
/**
|
|
216
218
|
* One test user in one browser, start to end, recorded as one continuous video. A run without a
|
|
217
219
|
* login is one session; jobs have at most one account today, so a run has one session.
|
|
@@ -231,6 +233,12 @@ export const Session = Schema.Struct({
|
|
|
231
233
|
videoDurationMs: Schema.optionalKey(Schema.Number),
|
|
232
234
|
/** Why the video is missing or incomplete, in plain language. Never changes a status. */
|
|
233
235
|
videoProblem: Schema.optionalKey(Schema.String),
|
|
236
|
+
/**
|
|
237
|
+
* The stretches of the video in which its picture did not change, in ms on its clock, measured
|
|
238
|
+
* from the saved video once the session ended. Missing when that could not be measured (older
|
|
239
|
+
* runs, no video); empty when nothing stood still.
|
|
240
|
+
*/
|
|
241
|
+
still: Schema.optionalKey(Schema.Array(StillStretch)),
|
|
234
242
|
});
|
|
235
243
|
/**
|
|
236
244
|
* Attributes of an element that a CSS selector may name, such as `data-test`, `title`, `href` or
|
package/dist/schema/ledger.d.ts
CHANGED
|
@@ -322,6 +322,10 @@ export declare const CaseLedger: Schema.Struct<{
|
|
|
322
322
|
readonly video: Schema.optionalKey<Schema.String>;
|
|
323
323
|
readonly videoDurationMs: Schema.optionalKey<Schema.Number>;
|
|
324
324
|
readonly videoProblem: Schema.optionalKey<Schema.String>;
|
|
325
|
+
readonly still: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
326
|
+
readonly fromMs: Schema.Number;
|
|
327
|
+
readonly toMs: Schema.Number;
|
|
328
|
+
}>>>;
|
|
325
329
|
}>>>;
|
|
326
330
|
/** The screw-bugs version that ran the job. */
|
|
327
331
|
readonly version: Schema.optionalKey<Schema.String>;
|
|
@@ -841,6 +845,10 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
841
845
|
readonly video: Schema.optionalKey<Schema.String>;
|
|
842
846
|
readonly videoDurationMs: Schema.optionalKey<Schema.Number>;
|
|
843
847
|
readonly videoProblem: Schema.optionalKey<Schema.String>;
|
|
848
|
+
readonly still: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
849
|
+
readonly fromMs: Schema.Number;
|
|
850
|
+
readonly toMs: Schema.Number;
|
|
851
|
+
}>>>;
|
|
844
852
|
}>>>;
|
|
845
853
|
/** The screw-bugs version that ran the job. */
|
|
846
854
|
readonly version: Schema.optionalKey<Schema.String>;
|