screw-bugs 0.1.8 → 0.1.10
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 +49 -34
- package/dist/browser-playwright/capture.js +1 -1
- package/dist/browser-playwright/launch.js +27 -10
- package/dist/browser-playwright/page.d.ts +48 -26
- package/dist/browser-playwright/page.js +86 -89
- package/dist/browser-playwright/recorder.d.ts +154 -0
- package/dist/browser-playwright/recorder.js +382 -0
- package/dist/build-info.json +3 -3
- package/dist/cli/app.js +6 -2
- package/dist/cli/commands.js +4 -3
- package/dist/cli/doctor.d.ts +17 -2
- package/dist/cli/doctor.js +62 -4
- package/dist/cli/mcp.js +2 -2
- package/dist/cli/report-server.d.ts +19 -10
- package/dist/cli/report-server.js +43 -18
- package/dist/cli/share.js +2 -2
- package/dist/cli/sign-in.d.ts +9 -3
- package/dist/cli/sign-in.js +12 -9
- package/dist/cli/tailnet.d.ts +57 -0
- package/dist/cli/tailnet.js +82 -0
- package/dist/core/index.d.ts +1 -14
- package/dist/core/index.js +3 -14
- package/dist/report/index.d.ts +1 -10
- package/dist/report/index.js +3 -10
- package/dist/schema/index.d.ts +1 -9
- package/dist/schema/index.js +3 -9
- package/package.json +14 -14
- package/dist/core/accounts.d.ts +0 -40
- package/dist/core/accounts.js +0 -95
- package/dist/core/css.d.ts +0 -95
- package/dist/core/css.js +0 -436
- package/dist/core/engine.d.ts +0 -75
- package/dist/core/engine.js +0 -554
- package/dist/core/errors.d.ts +0 -85
- package/dist/core/errors.js +0 -36
- package/dist/core/evidence.d.ts +0 -14
- package/dist/core/evidence.js +0 -131
- package/dist/core/labels.d.ts +0 -47
- package/dist/core/labels.js +0 -199
- package/dist/core/liveness.d.ts +0 -45
- package/dist/core/liveness.js +0 -66
- package/dist/core/marks.d.ts +0 -63
- package/dist/core/marks.js +0 -410
- package/dist/core/services.d.ts +0 -574
- package/dist/core/services.js +0 -25
- package/dist/core/share.d.ts +0 -68
- package/dist/core/share.js +0 -318
- package/dist/core/steps.d.ts +0 -106
- package/dist/core/steps.js +0 -722
- package/dist/core/uploads.d.ts +0 -49
- package/dist/core/uploads.js +0 -133
- package/dist/core/video.d.ts +0 -47
- package/dist/core/video.js +0 -233
- package/dist/core/viewport.d.ts +0 -28
- package/dist/core/viewport.js +0 -50
- package/dist/report/assets.d.ts +0 -34
- package/dist/report/assets.js +0 -105
- package/dist/report/bug.d.ts +0 -11
- package/dist/report/bug.js +0 -20
- package/dist/report/html.d.ts +0 -47
- package/dist/report/html.js +0 -923
- package/dist/report/icons.d.ts +0 -51
- package/dist/report/icons.js +0 -93
- package/dist/report/live.d.ts +0 -7
- package/dist/report/live.js +0 -135
- package/dist/report/logos.d.ts +0 -4
- package/dist/report/logos.js +0 -19
- package/dist/report/markup.d.ts +0 -50
- package/dist/report/markup.js +0 -156
- package/dist/report/menu-bar.d.ts +0 -60
- package/dist/report/menu-bar.js +0 -157
- package/dist/report/player.d.ts +0 -102
- package/dist/report/player.js +0 -315
- package/dist/report/pr-summary.d.ts +0 -11
- package/dist/report/pr-summary.js +0 -119
- package/dist/report/sha256.d.ts +0 -9
- package/dist/report/sha256.js +0 -97
- package/dist/report/share-page.d.ts +0 -48
- package/dist/report/share-page.js +0 -291
- package/dist/report/shots.d.ts +0 -59
- package/dist/report/shots.js +0 -280
- package/dist/report/sign-in.d.ts +0 -41
- package/dist/report/sign-in.js +0 -568
- package/dist/report/styles.d.ts +0 -3
- package/dist/report/styles.js +0 -274
- package/dist/report/view.d.ts +0 -296
- package/dist/report/view.js +0 -702
- package/dist/report/walkthrough.d.ts +0 -93
- package/dist/report/walkthrough.js +0 -716
- package/dist/schema/accounts.d.ts +0 -137
- package/dist/schema/accounts.js +0 -121
- package/dist/schema/config.d.ts +0 -7
- package/dist/schema/config.js +0 -6
- package/dist/schema/doctor.d.ts +0 -46
- package/dist/schema/doctor.js +0 -30
- package/dist/schema/evidence.d.ts +0 -1115
- package/dist/schema/evidence.js +0 -565
- package/dist/schema/findings.d.ts +0 -161
- package/dist/schema/findings.js +0 -82
- package/dist/schema/job.d.ts +0 -1905
- package/dist/schema/job.js +0 -577
- package/dist/schema/ledger.d.ts +0 -1124
- package/dist/schema/ledger.js +0 -285
- package/dist/schema/share.d.ts +0 -55
- package/dist/schema/share.js +0 -64
- package/dist/schema/status.d.ts +0 -7
- package/dist/schema/status.js +0 -11
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Effect, FileSystem } from 'effect';
|
|
2
|
+
import { ChildProcessSpawner } from 'effect/process';
|
|
3
|
+
import type { Page } from 'playwright-core';
|
|
4
|
+
/**
|
|
5
|
+
* A session's video, recorded by screw-bugs itself rather than by Playwright's `recordVideo`:
|
|
6
|
+
* the tab's screencast frames (JPEG, from `page.screencast`) go to Playwright's ffmpeg as
|
|
7
|
+
* Matroska on its stdin, which writes VP9 WebM at a constant frame rate, as Playwright's own
|
|
8
|
+
* recorder does (same container, encoder settings, frame times and last frame).
|
|
9
|
+
*
|
|
10
|
+
* Two frames are left out, so the video only ever shows the page as it renders on its own:
|
|
11
|
+
*
|
|
12
|
+
* - A frame that does not fit the video's size (`fits`). Chromium sends frames at the browser's
|
|
13
|
+
* own scale whatever size is asked for, except around a device-pixel capture on an emulated
|
|
14
|
+
* phone in a browser at 1x, where one may come at full device size (3x); Playwright's recorder
|
|
15
|
+
* crops it into the video, which shows the page's top left corner magnified for one frame.
|
|
16
|
+
* - A frame painted while a screenshot is taken (`hold`). Every device-pixel capture (the step
|
|
17
|
+
* screenshots) changes how the page renders for a moment: on a phone, text comes out crisper
|
|
18
|
+
* and darker, then pale again, a flicker at every step. Such a frame is painted during the
|
|
19
|
+
* capture and often only arrives after it, so frames are judged by when they were painted.
|
|
20
|
+
*
|
|
21
|
+
* The video then holds the last frame it kept, as for any frame the browser does not send.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The most frames a second the video has (Playwright's recorder's rate). Unlike Playwright's, it
|
|
25
|
+
* has only the frames the page changed in (the screencast sends one only then), so a still page
|
|
26
|
+
* costs next to nothing to encode and store (`framePacer`).
|
|
27
|
+
*/
|
|
28
|
+
export declare const VIDEO_FPS = 25;
|
|
29
|
+
/**
|
|
30
|
+
* How much smaller than the video a frame may be (Chromium rounds the screencast's size). One a
|
|
31
|
+
* pixel larger is the page's odd last row or column, which the video leaves out (`videoSize`).
|
|
32
|
+
*/
|
|
33
|
+
export declare const FRAME_SLACK = 4;
|
|
34
|
+
/** How long the video shows its last frame at least, after it came (as in Playwright). */
|
|
35
|
+
export declare const LAST_FRAME_MS = 1000;
|
|
36
|
+
/**
|
|
37
|
+
* How many frames may wait for ffmpeg (seconds of video at `VIDEO_FPS`, some MB of JPEG). While
|
|
38
|
+
* it is that far behind, new frames are dropped and the video holds the last one it has.
|
|
39
|
+
*/
|
|
40
|
+
export declare const BACKLOG_FRAMES: number;
|
|
41
|
+
/** How long ffmpeg may take, after the first frame, to open the video it writes. */
|
|
42
|
+
export declare const READY_TIMEOUT_MS = 3000;
|
|
43
|
+
export interface FrameSize {
|
|
44
|
+
readonly width: number;
|
|
45
|
+
readonly height: number;
|
|
46
|
+
}
|
|
47
|
+
/** A JPEG's size, from its first start-of-frame segment; undefined when it has none. */
|
|
48
|
+
export declare const jpegSize: (bytes: Uint8Array) => FrameSize | undefined;
|
|
49
|
+
/** Whether a frame of `frame`'s size shows the page whole in a video of `video`'s. */
|
|
50
|
+
export declare const fits: (frame: FrameSize, video: FrameSize) => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Which frames go on the video, and where: a frame's time on the video is its paint time (epoch
|
|
53
|
+
* ms) after the first kept frame's, so the video starts at its first frame, as Playwright's does.
|
|
54
|
+
*/
|
|
55
|
+
export declare const frameGate: (video: FrameSize) => {
|
|
56
|
+
/** A screenshot starts being taken `at`; call the result when it was taken. */
|
|
57
|
+
hold: (at: number) => (end: number) => void;
|
|
58
|
+
/**
|
|
59
|
+
* The frame's time on the video in ms when it is kept, else undefined: when it does not fit
|
|
60
|
+
* (`size` undefined is a frame that could not be read), was painted while a screenshot was
|
|
61
|
+
* taken, or does not come after the last kept frame (the video's frames only go forward).
|
|
62
|
+
*/
|
|
63
|
+
admit: (size: FrameSize | undefined, timestamp: number) => number | undefined;
|
|
64
|
+
/** When the first kept frame was painted, in epoch ms. */
|
|
65
|
+
first: () => number | undefined;
|
|
66
|
+
/** The time on the video of a frame painted at `timestamp`. */
|
|
67
|
+
at: (timestamp: number) => number;
|
|
68
|
+
};
|
|
69
|
+
export type FrameGate = ReturnType<typeof frameGate>;
|
|
70
|
+
/**
|
|
71
|
+
* When the video's last frame goes again, to end it: as Playwright does, at least `LAST_FRAME_MS`
|
|
72
|
+
* after it was painted, or as long after as the session went on without a new one.
|
|
73
|
+
*/
|
|
74
|
+
export declare const lastFrameTime: (paintedAt: number, sinceItCameMs: number) => number;
|
|
75
|
+
/**
|
|
76
|
+
* At most one frame for each `1000 / VIDEO_FPS` ms of the video, never losing the page's latest
|
|
77
|
+
* state: the first frame in a slot after the last written one is written at once; a later one in
|
|
78
|
+
* that slot waits, replacing the one waiting, and is written at the start of the next slot when a
|
|
79
|
+
* frame comes after that slot, or at the end (`flush`). `ms` (time on the video) only grows.
|
|
80
|
+
*/
|
|
81
|
+
export declare const framePacer: <F>() => {
|
|
82
|
+
/** What to write now, in order, for a frame at `ms` on the video. */
|
|
83
|
+
add: (frame: F, ms: number) => Array<{
|
|
84
|
+
readonly frame: F;
|
|
85
|
+
readonly ms: number;
|
|
86
|
+
}>;
|
|
87
|
+
/** The frame still waiting, if one is, to write before the video ends. */
|
|
88
|
+
flush: () => {
|
|
89
|
+
frame: F;
|
|
90
|
+
ms: number;
|
|
91
|
+
}[];
|
|
92
|
+
};
|
|
93
|
+
/** EBML's variable-length size. */
|
|
94
|
+
export declare const vint: (value: number) => Uint8Array;
|
|
95
|
+
/** The stream's start: its EBML header, a segment of unknown size, its info and its track. */
|
|
96
|
+
export declare const matroskaHeader: () => Uint8Array;
|
|
97
|
+
/** One frame: a cluster at `ms` holding it as a key frame of track 1. */
|
|
98
|
+
export declare const matroskaFrame: (ms: number, jpeg: Uint8Array) => Uint8Array;
|
|
99
|
+
/** Playwright's ffmpeg arguments for its recorder, writing WebM to `file`. */
|
|
100
|
+
export declare const ffmpegArgs: (size: FrameSize, file: string) => ReadonlyArray<string>;
|
|
101
|
+
export interface Recorder {
|
|
102
|
+
/** When the first frame on the video was painted, in epoch ms; waits for it. */
|
|
103
|
+
readonly firstFrame: Effect.Effect<number>;
|
|
104
|
+
/** Runs `effect` (a screenshot) keeping the frames painted meanwhile off the video. */
|
|
105
|
+
readonly hold: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
106
|
+
/**
|
|
107
|
+
* Ends the video and saves it at its path: why it could not be, else undefined. Call once the
|
|
108
|
+
* tab is closed, so no frame comes after. Only the first call ends it; later ones say the same.
|
|
109
|
+
*/
|
|
110
|
+
readonly finish: Effect.Effect<string | undefined>;
|
|
111
|
+
/**
|
|
112
|
+
* Waits, after the first frame (or once there is none), until ffmpeg has opened the video it
|
|
113
|
+
* writes, for at most `READY_TIMEOUT_MS`; fails when ffmpeg has ended instead, or has not
|
|
114
|
+
* opened it by then (no frame came, or it is stuck).
|
|
115
|
+
*/
|
|
116
|
+
readonly ready: Effect.Effect<void, Error>;
|
|
117
|
+
/** Why the video stopped being recorded before `finish`, once ffmpeg ended early. */
|
|
118
|
+
readonly stopped: Effect.Effect<string | undefined>;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Records `page`'s video into `file` (a `.webm`) with the ffmpeg at `ffmpeg`, at `size` (see
|
|
122
|
+
* `videoSize`). Written to a file beside it first and moved there by `finish`, so a run whose
|
|
123
|
+
* process dies leaves no half-written video where a video is looked for. Fails when ffmpeg or
|
|
124
|
+
* the screencast cannot start; with the scope, ffmpeg and the screencast are stopped.
|
|
125
|
+
*/
|
|
126
|
+
export declare const startRecorder: (page: Page, options: {
|
|
127
|
+
readonly ffmpeg: string;
|
|
128
|
+
readonly file: string;
|
|
129
|
+
readonly size: FrameSize;
|
|
130
|
+
}) => Effect.Effect<{
|
|
131
|
+
firstFrame: Effect.Effect<number, never, never>;
|
|
132
|
+
hold: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
133
|
+
finish: Effect.Effect<string | undefined, never, never>;
|
|
134
|
+
ready: Effect.Effect<undefined, Error, never>;
|
|
135
|
+
stopped: Effect.Effect<string | undefined, never, never>;
|
|
136
|
+
}, Error | import("effect/PlatformError").PlatformError, ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | import("effect/Scope").Scope>;
|
|
137
|
+
/**
|
|
138
|
+
* How a session with a video at `path` (in the folder `dir`, made when missing) is recorded with
|
|
139
|
+
* the ffmpeg at `ffmpeg`, on the platform this runs on.
|
|
140
|
+
*/
|
|
141
|
+
export declare const videoRecording: (video: {
|
|
142
|
+
readonly dir: string;
|
|
143
|
+
readonly path: string;
|
|
144
|
+
readonly ffmpeg: string;
|
|
145
|
+
}) => Effect.Effect<{
|
|
146
|
+
path: string;
|
|
147
|
+
record: (page: Page, size: FrameSize) => Effect.Effect<{
|
|
148
|
+
firstFrame: Effect.Effect<number, never, never>;
|
|
149
|
+
hold: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
150
|
+
finish: Effect.Effect<string | undefined, never, never>;
|
|
151
|
+
ready: Effect.Effect<undefined, Error, never>;
|
|
152
|
+
stopped: Effect.Effect<string | undefined, never, never>;
|
|
153
|
+
}, Error | import("effect/PlatformError").PlatformError, import("effect/Scope").Scope>;
|
|
154
|
+
}, never, ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem>;
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { Clock, Deferred, Effect, Exit, FileSystem, Queue, Stream } from 'effect';
|
|
2
|
+
import { ChildProcess, ChildProcessSpawner } from 'effect/process';
|
|
3
|
+
/**
|
|
4
|
+
* A session's video, recorded by screw-bugs itself rather than by Playwright's `recordVideo`:
|
|
5
|
+
* the tab's screencast frames (JPEG, from `page.screencast`) go to Playwright's ffmpeg as
|
|
6
|
+
* Matroska on its stdin, which writes VP9 WebM at a constant frame rate, as Playwright's own
|
|
7
|
+
* recorder does (same container, encoder settings, frame times and last frame).
|
|
8
|
+
*
|
|
9
|
+
* Two frames are left out, so the video only ever shows the page as it renders on its own:
|
|
10
|
+
*
|
|
11
|
+
* - A frame that does not fit the video's size (`fits`). Chromium sends frames at the browser's
|
|
12
|
+
* own scale whatever size is asked for, except around a device-pixel capture on an emulated
|
|
13
|
+
* phone in a browser at 1x, where one may come at full device size (3x); Playwright's recorder
|
|
14
|
+
* crops it into the video, which shows the page's top left corner magnified for one frame.
|
|
15
|
+
* - A frame painted while a screenshot is taken (`hold`). Every device-pixel capture (the step
|
|
16
|
+
* screenshots) changes how the page renders for a moment: on a phone, text comes out crisper
|
|
17
|
+
* and darker, then pale again, a flicker at every step. Such a frame is painted during the
|
|
18
|
+
* capture and often only arrives after it, so frames are judged by when they were painted.
|
|
19
|
+
*
|
|
20
|
+
* The video then holds the last frame it kept, as for any frame the browser does not send.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* The most frames a second the video has (Playwright's recorder's rate). Unlike Playwright's, it
|
|
24
|
+
* has only the frames the page changed in (the screencast sends one only then), so a still page
|
|
25
|
+
* costs next to nothing to encode and store (`framePacer`).
|
|
26
|
+
*/
|
|
27
|
+
export const VIDEO_FPS = 25;
|
|
28
|
+
/**
|
|
29
|
+
* How much smaller than the video a frame may be (Chromium rounds the screencast's size). One a
|
|
30
|
+
* pixel larger is the page's odd last row or column, which the video leaves out (`videoSize`).
|
|
31
|
+
*/
|
|
32
|
+
export const FRAME_SLACK = 4;
|
|
33
|
+
/** How long the video shows its last frame at least, after it came (as in Playwright). */
|
|
34
|
+
export const LAST_FRAME_MS = 1_000;
|
|
35
|
+
/** How long ffmpeg gets to end after it was asked to stop, before it is killed. */
|
|
36
|
+
const FFMPEG_KILL_AFTER = '2 seconds';
|
|
37
|
+
/**
|
|
38
|
+
* How many frames may wait for ffmpeg (seconds of video at `VIDEO_FPS`, some MB of JPEG). While
|
|
39
|
+
* it is that far behind, new frames are dropped and the video holds the last one it has.
|
|
40
|
+
*/
|
|
41
|
+
export const BACKLOG_FRAMES = 10 * VIDEO_FPS;
|
|
42
|
+
/** How long ffmpeg may take, after the first frame, to open the video it writes. */
|
|
43
|
+
export const READY_TIMEOUT_MS = 3_000;
|
|
44
|
+
/** How often whether it has is looked at. */
|
|
45
|
+
const READY_POLL = '50 millis';
|
|
46
|
+
/** A JPEG's size, from its first start-of-frame segment; undefined when it has none. */
|
|
47
|
+
export const jpegSize = (bytes) => {
|
|
48
|
+
if (bytes[0] !== 0xff || bytes[1] !== 0xd8)
|
|
49
|
+
return undefined;
|
|
50
|
+
const u16 = (at) => (bytes[at] << 8) | bytes[at + 1];
|
|
51
|
+
let at = 2;
|
|
52
|
+
while (at + 3 < bytes.length) {
|
|
53
|
+
if (bytes[at] !== 0xff)
|
|
54
|
+
return undefined;
|
|
55
|
+
const marker = bytes[at + 1];
|
|
56
|
+
// Fill bytes before a marker.
|
|
57
|
+
if (marker === 0xff) {
|
|
58
|
+
at += 1;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
// Markers without a length.
|
|
62
|
+
if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd8)) {
|
|
63
|
+
at += 2;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
// Start of frame (baseline, progressive and the rest), not DHT, JPG or DAC.
|
|
67
|
+
if (marker >= 0xc0 && marker <= 0xcf && marker !== 0xc4 && marker !== 0xc8 && marker !== 0xcc)
|
|
68
|
+
return at + 8 < bytes.length ? { height: u16(at + 5), width: u16(at + 7) } : undefined;
|
|
69
|
+
// Start of scan or end of image: no frame header came first.
|
|
70
|
+
if (marker === 0xda || marker === 0xd9)
|
|
71
|
+
return undefined;
|
|
72
|
+
at += 2 + u16(at + 2);
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
};
|
|
76
|
+
/** Whether a frame of `frame`'s size shows the page whole in a video of `video`'s. */
|
|
77
|
+
export const fits = (frame, video) => frame.width <= video.width + 1 &&
|
|
78
|
+
frame.height <= video.height + 1 &&
|
|
79
|
+
frame.width >= video.width - FRAME_SLACK &&
|
|
80
|
+
frame.height >= video.height - FRAME_SLACK;
|
|
81
|
+
/**
|
|
82
|
+
* Which frames go on the video, and where: a frame's time on the video is its paint time (epoch
|
|
83
|
+
* ms) after the first kept frame's, so the video starts at its first frame, as Playwright's does.
|
|
84
|
+
*/
|
|
85
|
+
export const frameGate = (video) => {
|
|
86
|
+
/** Screenshots being taken (`end` undefined) or taken, by when, in epoch ms. */
|
|
87
|
+
let holds = [];
|
|
88
|
+
let first;
|
|
89
|
+
let lastMs;
|
|
90
|
+
const held = (timestamp) => holds.some((h) => timestamp >= h.start && (h.end === undefined || timestamp <= h.end));
|
|
91
|
+
return {
|
|
92
|
+
/** A screenshot starts being taken `at`; call the result when it was taken. */
|
|
93
|
+
hold: (at) => {
|
|
94
|
+
const window = { start: at, end: undefined };
|
|
95
|
+
holds.push(window);
|
|
96
|
+
return (end) => {
|
|
97
|
+
window.end = Math.max(end, at);
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
/**
|
|
101
|
+
* The frame's time on the video in ms when it is kept, else undefined: when it does not fit
|
|
102
|
+
* (`size` undefined is a frame that could not be read), was painted while a screenshot was
|
|
103
|
+
* taken, or does not come after the last kept frame (the video's frames only go forward).
|
|
104
|
+
*/
|
|
105
|
+
admit: (size, timestamp) => {
|
|
106
|
+
if (size === undefined || !fits(size, video) || held(timestamp))
|
|
107
|
+
return undefined;
|
|
108
|
+
const ms = Math.round(timestamp - (first ?? timestamp));
|
|
109
|
+
if (lastMs !== undefined && ms <= lastMs)
|
|
110
|
+
return undefined;
|
|
111
|
+
first ??= timestamp;
|
|
112
|
+
lastMs = ms;
|
|
113
|
+
// A screenshot taken before this frame was painted cannot hold back any later frame.
|
|
114
|
+
holds = holds.filter((h) => h.end === undefined || h.end >= timestamp);
|
|
115
|
+
return ms;
|
|
116
|
+
},
|
|
117
|
+
/** When the first kept frame was painted, in epoch ms. */
|
|
118
|
+
first: () => first,
|
|
119
|
+
/** The time on the video of a frame painted at `timestamp`. */
|
|
120
|
+
at: (timestamp) => Math.round(timestamp - (first ?? timestamp)),
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* When the video's last frame goes again, to end it: as Playwright does, at least `LAST_FRAME_MS`
|
|
125
|
+
* after it was painted, or as long after as the session went on without a new one.
|
|
126
|
+
*/
|
|
127
|
+
export const lastFrameTime = (paintedAt, sinceItCameMs) => paintedAt + Math.max(sinceItCameMs, LAST_FRAME_MS);
|
|
128
|
+
/**
|
|
129
|
+
* At most one frame for each `1000 / VIDEO_FPS` ms of the video, never losing the page's latest
|
|
130
|
+
* state: the first frame in a slot after the last written one is written at once; a later one in
|
|
131
|
+
* that slot waits, replacing the one waiting, and is written at the start of the next slot when a
|
|
132
|
+
* frame comes after that slot, or at the end (`flush`). `ms` (time on the video) only grows.
|
|
133
|
+
*/
|
|
134
|
+
export const framePacer = () => {
|
|
135
|
+
const slotMs = 1000 / VIDEO_FPS;
|
|
136
|
+
let lastSlot;
|
|
137
|
+
let waiting;
|
|
138
|
+
/** The waiting frame, at the earliest time in the slot after the last written one. */
|
|
139
|
+
const takeWaiting = () => {
|
|
140
|
+
const next = lastSlot + 1;
|
|
141
|
+
const out = { frame: waiting.frame, ms: Math.max(waiting.ms, Math.ceil(next * slotMs)) };
|
|
142
|
+
lastSlot = next;
|
|
143
|
+
waiting = undefined;
|
|
144
|
+
return out;
|
|
145
|
+
};
|
|
146
|
+
return {
|
|
147
|
+
/** What to write now, in order, for a frame at `ms` on the video. */
|
|
148
|
+
add: (frame, ms) => {
|
|
149
|
+
const slot = Math.floor(ms / slotMs);
|
|
150
|
+
const out = waiting !== undefined && slot > lastSlot + 1 ? [takeWaiting()] : [];
|
|
151
|
+
if (waiting === undefined && (lastSlot === undefined || slot > lastSlot)) {
|
|
152
|
+
out.push({ frame, ms });
|
|
153
|
+
lastSlot = slot;
|
|
154
|
+
}
|
|
155
|
+
else
|
|
156
|
+
waiting = { frame, ms };
|
|
157
|
+
return out;
|
|
158
|
+
},
|
|
159
|
+
/** The frame still waiting, if one is, to write before the video ends. */
|
|
160
|
+
flush: () => (waiting === undefined ? [] : [takeWaiting()]),
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
// Matroska (EBML) as Playwright's recorder writes it: one MJPEG track whose frames each come in
|
|
164
|
+
// a cluster of their own with its time in ms.
|
|
165
|
+
const hex = (text) => Uint8Array.from(text.match(/../g), (b) => Number.parseInt(b, 16));
|
|
166
|
+
const concat = (parts) => {
|
|
167
|
+
const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
|
|
168
|
+
let at = 0;
|
|
169
|
+
for (const part of parts) {
|
|
170
|
+
out.set(part, at);
|
|
171
|
+
at += part.length;
|
|
172
|
+
}
|
|
173
|
+
return out;
|
|
174
|
+
};
|
|
175
|
+
/** EBML's variable-length size. */
|
|
176
|
+
export const vint = (value) => {
|
|
177
|
+
let length = 1;
|
|
178
|
+
while (value >= 2 ** (7 * length) - 1)
|
|
179
|
+
length++;
|
|
180
|
+
const out = new Uint8Array(length);
|
|
181
|
+
let v = value;
|
|
182
|
+
for (let i = length - 1; i >= 0; i--) {
|
|
183
|
+
out[i] = v & 0xff;
|
|
184
|
+
v = Math.floor(v / 256);
|
|
185
|
+
}
|
|
186
|
+
out[0] |= 1 << (8 - length);
|
|
187
|
+
return out;
|
|
188
|
+
};
|
|
189
|
+
const uint = (value) => {
|
|
190
|
+
const bytes = [];
|
|
191
|
+
for (let v = value; v > 0; v = Math.floor(v / 256))
|
|
192
|
+
bytes.unshift(v & 0xff);
|
|
193
|
+
return Uint8Array.from(bytes.length === 0 ? [0] : bytes);
|
|
194
|
+
};
|
|
195
|
+
const text = (value) => new TextEncoder().encode(value);
|
|
196
|
+
const element = (id, payload) => concat([hex(id), vint(payload.length), payload]);
|
|
197
|
+
/** The stream's start: its EBML header, a segment of unknown size, its info and its track. */
|
|
198
|
+
export const matroskaHeader = () => concat([
|
|
199
|
+
element('1A45DFA3', concat([
|
|
200
|
+
element('4286', uint(1)),
|
|
201
|
+
element('42F7', uint(1)),
|
|
202
|
+
element('42F2', uint(4)),
|
|
203
|
+
element('42F3', uint(8)),
|
|
204
|
+
element('4282', text('matroska')),
|
|
205
|
+
element('4287', uint(4)),
|
|
206
|
+
element('4285', uint(2)),
|
|
207
|
+
])),
|
|
208
|
+
hex('18538067'),
|
|
209
|
+
Uint8Array.from([1, 255, 255, 255, 255, 255, 255, 255]),
|
|
210
|
+
// Times in ms.
|
|
211
|
+
element('1549A966', concat([
|
|
212
|
+
element('2AD7B1', uint(1_000_000)),
|
|
213
|
+
element('4D80', text('screw-bugs')),
|
|
214
|
+
element('5741', text('screw-bugs')),
|
|
215
|
+
])),
|
|
216
|
+
element('1654AE6B', element('AE', concat([
|
|
217
|
+
element('D7', uint(1)),
|
|
218
|
+
element('73C5', uint(1)),
|
|
219
|
+
element('83', uint(1)),
|
|
220
|
+
element('9C', uint(0)),
|
|
221
|
+
element('86', text('V_MJPEG')),
|
|
222
|
+
// Required, but each JPEG gives its own size; 1x1 as Playwright, which found that a
|
|
223
|
+
// larger one can make ffmpeg read a short progressive JPEG as an interlaced field.
|
|
224
|
+
element('E0', concat([element('B0', uint(1)), element('BA', uint(1))])),
|
|
225
|
+
]))),
|
|
226
|
+
]);
|
|
227
|
+
/** One frame: a cluster at `ms` holding it as a key frame of track 1. */
|
|
228
|
+
export const matroskaFrame = (ms, jpeg) => {
|
|
229
|
+
const block = concat([hex('A3'), vint(4 + jpeg.length), vint(1), Uint8Array.from([0, 0, 0x80])]);
|
|
230
|
+
const timestamp = element('E7', uint(ms));
|
|
231
|
+
return concat([
|
|
232
|
+
hex('1F43B675'),
|
|
233
|
+
vint(timestamp.length + block.length + jpeg.length),
|
|
234
|
+
timestamp,
|
|
235
|
+
block,
|
|
236
|
+
jpeg,
|
|
237
|
+
]);
|
|
238
|
+
};
|
|
239
|
+
/** Playwright's ffmpeg arguments for its recorder, writing WebM to `file`. */
|
|
240
|
+
export const ffmpegArgs = (size, file) => {
|
|
241
|
+
const { width: w, height: h } = size;
|
|
242
|
+
const pixelRateScale = Math.max(1, (w * h * VIDEO_FPS) / (800 * 450 * 25));
|
|
243
|
+
const threads = Math.min(8, Math.ceil(pixelRateScale / 4));
|
|
244
|
+
return [
|
|
245
|
+
'-loglevel error -nostdin',
|
|
246
|
+
'-f matroska -fpsprobesize 0 -probesize 32 -analyzeduration 0 -i pipe:0',
|
|
247
|
+
// Each frame at its own time, none repeated: `framePacer` keeps to `VIDEO_FPS` at most.
|
|
248
|
+
'-y -an -fps_mode passthrough',
|
|
249
|
+
// Playwright's settings but the quality: crf 30, not 8, which is near lossless and twice as
|
|
250
|
+
// big, with text that looks the same.
|
|
251
|
+
'-c:v libvpx-vp9 -qmin 0 -qmax 50 -crf 30 -deadline realtime -cpu-used 8 -lag-in-frames 0',
|
|
252
|
+
`-b:v ${Math.round(pixelRateScale * 1000)}k -threads ${threads}`,
|
|
253
|
+
`-tile-columns ${Math.ceil(Math.log2(threads))} -row-mt 1`,
|
|
254
|
+
// A frame a little smaller than the video (see `FRAME_SLACK`) is padded, as Playwright does;
|
|
255
|
+
// one a pixel larger loses its odd row or column first. Cropped before it is padded: `pad` cuts
|
|
256
|
+
// an odd-height 4:2:0 frame (the JPEG's) to even and pads it back, greying its last row.
|
|
257
|
+
`-vf crop='min(iw,${w})':'min(ih,${h})':0:0,pad=${w}:${h}:0:0:gray`,
|
|
258
|
+
'-f webm',
|
|
259
|
+
]
|
|
260
|
+
.flatMap((options) => options.split(' '))
|
|
261
|
+
.concat(file);
|
|
262
|
+
};
|
|
263
|
+
const ffmpegEnded = (code) => typeof code === 'number' ? `ffmpeg ended with code ${code}` : `ffmpeg failed: ${code}`;
|
|
264
|
+
/**
|
|
265
|
+
* Records `page`'s video into `file` (a `.webm`) with the ffmpeg at `ffmpeg`, at `size` (see
|
|
266
|
+
* `videoSize`). Written to a file beside it first and moved there by `finish`, so a run whose
|
|
267
|
+
* process dies leaves no half-written video where a video is looked for. Fails when ffmpeg or
|
|
268
|
+
* the screencast cannot start; with the scope, ffmpeg and the screencast are stopped.
|
|
269
|
+
*/
|
|
270
|
+
export const startRecorder = (page, options) => Effect.gen(function* () {
|
|
271
|
+
const fs = yield* FileSystem.FileSystem;
|
|
272
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
273
|
+
const clock = yield* Effect.clockWith((clock) => Effect.succeed(clock));
|
|
274
|
+
const partial = `${options.file}.part`;
|
|
275
|
+
const gate = frameGate(options.size);
|
|
276
|
+
// Bounded, so an ffmpeg that stops reading never makes frames pile up in memory.
|
|
277
|
+
const queue = yield* Queue.make({
|
|
278
|
+
capacity: BACKLOG_FRAMES,
|
|
279
|
+
strategy: 'dropping',
|
|
280
|
+
});
|
|
281
|
+
const first = yield* Deferred.make();
|
|
282
|
+
const handle = yield* spawner.spawn(ChildProcess.make(options.ffmpeg, [...ffmpegArgs(options.size, partial)], {
|
|
283
|
+
stdin: Stream.fromQueue(queue),
|
|
284
|
+
stdout: 'ignore',
|
|
285
|
+
stderr: 'ignore',
|
|
286
|
+
forceKillAfter: FFMPEG_KILL_AFTER,
|
|
287
|
+
}));
|
|
288
|
+
// Once ffmpeg has ended, frames are no longer queued for it.
|
|
289
|
+
const exited = yield* Deferred.make();
|
|
290
|
+
let endedWith;
|
|
291
|
+
yield* handle.exitCode.pipe(Effect.map(Number), Effect.catch((error) => Effect.succeed(error.message)), Effect.tap((code) => Effect.andThen(Effect.sync(() => {
|
|
292
|
+
endedWith = code;
|
|
293
|
+
}), Deferred.succeed(exited, code))), Effect.andThen(Queue.shutdown(queue)), Effect.forkScoped);
|
|
294
|
+
Queue.offerUnsafe(queue, matroskaHeader());
|
|
295
|
+
let ended = false;
|
|
296
|
+
const pacer = framePacer();
|
|
297
|
+
/** The latest frame on the video (written, or waiting in `pacer`). */
|
|
298
|
+
let last;
|
|
299
|
+
// Boundary: Playwright hands frames to a callback. It only queues them.
|
|
300
|
+
const onFrame = ({ data, timestamp, }) => {
|
|
301
|
+
if (ended)
|
|
302
|
+
return;
|
|
303
|
+
const ms = gate.admit(jpegSize(data), timestamp);
|
|
304
|
+
if (ms === undefined)
|
|
305
|
+
return;
|
|
306
|
+
const now = pacer.add(data, ms);
|
|
307
|
+
// Not on the video when ffmpeg is gone or too far behind.
|
|
308
|
+
for (const frame of now)
|
|
309
|
+
if (!Queue.offerUnsafe(queue, matroskaFrame(frame.ms, frame.frame)) && frame.frame === data)
|
|
310
|
+
return;
|
|
311
|
+
last = { jpeg: data, paintedAt: timestamp, came: clock.currentTimeMillisUnsafe() };
|
|
312
|
+
if (now.length > 0)
|
|
313
|
+
Deferred.doneUnsafe(first, Exit.succeed(gate.first()));
|
|
314
|
+
};
|
|
315
|
+
yield* Effect.acquireRelease(Effect.tryPromise({
|
|
316
|
+
// Two pixels more than the video, so the page's odd last row or column comes as it is:
|
|
317
|
+
// the screencast shrinks, resampling, a frame not smaller than the size it is asked for
|
|
318
|
+
// (1206x2043 for 1206x2043, as for 1206x2042; not for 1206x2044).
|
|
319
|
+
try: () => page.screencast.start({
|
|
320
|
+
size: { width: options.size.width + 2, height: options.size.height + 2 },
|
|
321
|
+
onFrame,
|
|
322
|
+
}),
|
|
323
|
+
catch: (error) => new Error(`the screencast did not start: ${String(error).split('\n')[0]}`),
|
|
324
|
+
}), (listening) => Effect.tryPromise(() => listening.dispose()).pipe(Effect.timeoutOption('2 seconds'), Effect.ignore));
|
|
325
|
+
const finish = yield* Effect.cached(Effect.gen(function* () {
|
|
326
|
+
ended = true;
|
|
327
|
+
const now = yield* Clock.currentTimeMillis;
|
|
328
|
+
if (last !== undefined) {
|
|
329
|
+
const end = matroskaFrame(gate.at(lastFrameTime(last.paintedAt, now - last.came)), last.jpeg);
|
|
330
|
+
// The page's last state and the frame that gives the video its length wait for room,
|
|
331
|
+
// unlike the others; the session's close bounds how long (`CLOSE_TIMEOUT_MS`).
|
|
332
|
+
for (const frame of [...pacer.flush().map((f) => matroskaFrame(f.ms, f.frame)), end])
|
|
333
|
+
while (endedWith === undefined && !Queue.offerUnsafe(queue, frame))
|
|
334
|
+
yield* Effect.sleep(READY_POLL);
|
|
335
|
+
}
|
|
336
|
+
yield* Queue.end(queue);
|
|
337
|
+
const code = yield* Deferred.await(exited);
|
|
338
|
+
if (last === undefined) {
|
|
339
|
+
yield* fs.remove(partial).pipe(Effect.ignore);
|
|
340
|
+
return 'The tab never showed a frame, so there is no video.';
|
|
341
|
+
}
|
|
342
|
+
if (code !== 0) {
|
|
343
|
+
yield* fs.remove(partial).pipe(Effect.ignore);
|
|
344
|
+
return `The video could not be saved: ${ffmpegEnded(code)}.`;
|
|
345
|
+
}
|
|
346
|
+
return yield* fs.rename(partial, options.file).pipe(Effect.as(undefined), Effect.catch((error) => Effect.succeed(`The video could not be saved: ${error.message}`)));
|
|
347
|
+
}));
|
|
348
|
+
return {
|
|
349
|
+
firstFrame: Deferred.await(first),
|
|
350
|
+
hold: (effect) => Effect.acquireUseRelease(Clock.currentTimeMillis.pipe(Effect.map(gate.hold)), () => effect, (release) => Clock.currentTimeMillis.pipe(Effect.map(release))),
|
|
351
|
+
finish,
|
|
352
|
+
ready: Effect.gen(function* () {
|
|
353
|
+
yield* Effect.raceFirst(Deferred.await(first), Deferred.await(exited)).pipe(Effect.timeoutOption(READY_TIMEOUT_MS));
|
|
354
|
+
const opened = yield* Effect.gen(function* () {
|
|
355
|
+
while (endedWith === undefined && !(yield* fs.exists(partial)))
|
|
356
|
+
yield* Effect.sleep(READY_POLL);
|
|
357
|
+
}).pipe(Effect.ignore, Effect.timeoutOption(READY_TIMEOUT_MS));
|
|
358
|
+
if (endedWith !== undefined)
|
|
359
|
+
return yield* Effect.fail(new Error(`${ffmpegEnded(endedWith)}.`));
|
|
360
|
+
if (opened._tag === 'None')
|
|
361
|
+
return yield* Effect.fail(new Error(`ffmpeg did not start writing the video within ${READY_TIMEOUT_MS / 1000} s.`));
|
|
362
|
+
}),
|
|
363
|
+
stopped: Effect.sync(() => ended || endedWith === undefined
|
|
364
|
+
? undefined
|
|
365
|
+
: `the video stopped being recorded (${ffmpegEnded(endedWith)}).`),
|
|
366
|
+
};
|
|
367
|
+
});
|
|
368
|
+
/**
|
|
369
|
+
* How a session with a video at `path` (in the folder `dir`, made when missing) is recorded with
|
|
370
|
+
* the ffmpeg at `ffmpeg`, on the platform this runs on.
|
|
371
|
+
*/
|
|
372
|
+
export const videoRecording = (video) => Effect.gen(function* () {
|
|
373
|
+
const platform = yield* Effect.context();
|
|
374
|
+
return {
|
|
375
|
+
path: video.path,
|
|
376
|
+
record: (page, size) => Effect.gen(function* () {
|
|
377
|
+
const fs = yield* FileSystem.FileSystem;
|
|
378
|
+
yield* fs.makeDirectory(video.dir, { recursive: true });
|
|
379
|
+
return yield* startRecorder(page, { ffmpeg: video.ffmpeg, file: video.path, size });
|
|
380
|
+
}).pipe(Effect.provideContext(platform)),
|
|
381
|
+
};
|
|
382
|
+
});
|
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-19T22:18:52.547Z-02cb4258",
|
|
3
|
+
"builtAt": "2026-11-19T22:18:52.547Z",
|
|
4
|
+
"commit": "28f7e492960f28e8592ee2f1938b07a080cd9600"
|
|
5
5
|
}
|
package/dist/cli/app.js
CHANGED
|
@@ -15,6 +15,7 @@ import { ReportServer } from './report-server.js';
|
|
|
15
15
|
import { PlaywrightDownloads, Setup } from './setup.js';
|
|
16
16
|
import { ShareSource } from './share.js';
|
|
17
17
|
import { SignIns } from './sign-in.js';
|
|
18
|
+
import { TailnetLive } from './tailnet.js';
|
|
18
19
|
import { CLI_WAIT, UpdateCheck } from './update-check.js';
|
|
19
20
|
/** Progress goes nowhere yet; the terminal and MCP notifiers come with real runs. */
|
|
20
21
|
const NotifierSilent = Layer.succeed(Notifier, { notify: () => Effect.void });
|
|
@@ -52,7 +53,10 @@ export const appLayer = (projectRoot) => {
|
|
|
52
53
|
Layer.provideMerge(UpdateCheckLive), Layer.provideMerge(PackageInfo.layer),
|
|
53
54
|
// Starts nothing until a CLI command first gives a report URL.
|
|
54
55
|
Layer.merge(ReportLinks.layer(projectRoot).pipe(Layer.provide(ReportServerLauncherLive))));
|
|
55
|
-
return Setup.layer(projectRoot).pipe(Layer.provide(PlaywrightDownloads.layer), Layer.provideMerge(operations)
|
|
56
|
+
return Setup.layer(projectRoot).pipe(Layer.provide(PlaywrightDownloads.layer), Layer.provideMerge(operations),
|
|
57
|
+
// Under everything, and given to the program too: every link and server of the process uses
|
|
58
|
+
// the one lookup of Tailscale (`SCREW_BUGS_REPORT_HOST=tailnet`).
|
|
59
|
+
Layer.provideMerge(TailnetLive));
|
|
56
60
|
};
|
|
57
61
|
/**
|
|
58
62
|
* The engine on top of the local adapters (which it gives too), for one project folder; it needs
|
|
@@ -63,7 +67,7 @@ const engineLayer = (projectRoot) => Engine.layer.pipe(Layer.provideMerge(Layer.
|
|
|
63
67
|
* What the detached report server (`serveDetached`) shares runs with: the engine of the project whose
|
|
64
68
|
* folder is `projectRoot`.
|
|
65
69
|
*/
|
|
66
|
-
export const detachedShareLayer = (projectRoot) => ShareSource.layer.pipe(Layer.provide(engineLayer(projectRoot)), Layer.provide(PackageInfo.layer));
|
|
70
|
+
export const detachedShareLayer = (projectRoot) => ShareSource.layer.pipe(Layer.provide(engineLayer(projectRoot)), Layer.provide(PackageInfo.layer), Layer.merge(TailnetLive));
|
|
67
71
|
/**
|
|
68
72
|
* Before a command: the line about a newer version (when one is known and due), and, when a check
|
|
69
73
|
* is due, a check of the registry in the background. Returns the wait for that check, which the
|
package/dist/cli/commands.js
CHANGED
|
@@ -208,7 +208,8 @@ const status = Command.make('status', { json, jobId: Argument.String('job-id') }
|
|
|
208
208
|
}))).pipe(Command.withDescription('Show the state and case results of a run'));
|
|
209
209
|
const portFlag = Flag.Int('port').pipe(Flag.withDescription("Port for --serve, which fails if it is taken (default: the project's port in 41000-41999, else a free one)"), Flag.optional);
|
|
210
210
|
/**
|
|
211
|
-
* Serves the run folders on 127.0.0.1 or
|
|
211
|
+
* Serves the run folders on the report host (`reportHost`: the tailnet, 127.0.0.1 or
|
|
212
|
+
* `SCREW_BUGS_REPORT_HOST`'s; the project's port, see
|
|
212
213
|
* `startReportServer`) and prints the URL of `path`, a page in a run folder; runs until Ctrl+C,
|
|
213
214
|
* unless another screw-bugs process already serves them. `report --serve` and `walkthrough --serve` share it.
|
|
214
215
|
*/
|
|
@@ -247,7 +248,7 @@ const report = Command.make('report', {
|
|
|
247
248
|
['html', 'html'],
|
|
248
249
|
['markdown', 'markdown'],
|
|
249
250
|
]).pipe(Flag.withDescription('html prints the path of the report; markdown prints a pull request summary'), Flag.withDefault('html')),
|
|
250
|
-
serve: Flag.Boolean('serve').pipe(Flag.withDescription(
|
|
251
|
+
serve: Flag.Boolean('serve').pipe(Flag.withDescription("Serve the run folders (on this machine's tailnet name when Tailscale runs, else 127.0.0.1; SCREW_BUGS_REPORT_HOST sets it) and print the report URL, for browsers that cannot open files (such as those built into coding tools); runs until Ctrl+C"), Flag.withDefault(false)),
|
|
251
252
|
port: portFlag,
|
|
252
253
|
}, (flags) => handle(flags.json)(Effect.gen(function* () {
|
|
253
254
|
const { path, bundle, walkthroughPath } = yield* (yield* Operations).report(flags.jobId);
|
|
@@ -278,7 +279,7 @@ const report = Command.make('report', {
|
|
|
278
279
|
const walkthrough = Command.make('walkthrough', {
|
|
279
280
|
json,
|
|
280
281
|
jobId: Argument.String('job-id'),
|
|
281
|
-
serve: Flag.Boolean('serve').pipe(Flag.withDescription(
|
|
282
|
+
serve: Flag.Boolean('serve').pipe(Flag.withDescription("Serve the run folders (on this machine's tailnet name when Tailscale runs, else 127.0.0.1; SCREW_BUGS_REPORT_HOST sets it) and print the walkthrough URL, as report --serve does; runs until Ctrl+C"), Flag.withDefault(false)),
|
|
282
283
|
port: portFlag,
|
|
283
284
|
}, (flags) => handle(flags.json)(Effect.gen(function* () {
|
|
284
285
|
const { path, reportPath } = yield* (yield* Operations).walkthrough(flags.jobId);
|
package/dist/cli/doctor.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Browser, type BrowserInfo } from '../core/index.js';
|
|
|
4
4
|
import type { DoctorCheck, DoctorReport } from '../schema/index.js';
|
|
5
5
|
import { type BuildInfo } from './build-info.js';
|
|
6
6
|
import { PackageInfo } from './package-info.js';
|
|
7
|
+
import { type TailnetStatus } from './tailnet.js';
|
|
7
8
|
/** Room for a few runs' screenshots, traces and videos. */
|
|
8
9
|
export declare const MIN_FREE_BYTES: number;
|
|
9
10
|
/**
|
|
@@ -17,9 +18,23 @@ export declare const checkBrowser: (found: BrowserInfo | undefined, installComma
|
|
|
17
18
|
/** A failure: every run is recorded as video, so without ffmpeg no run starts. */
|
|
18
19
|
export declare const checkVideo: (lookup: FfmpegLookup, installCommand: string) => DoctorCheck;
|
|
19
20
|
export declare const checkDisk: (path: string, freeBytes: number | undefined) => DoctorCheck;
|
|
21
|
+
/** The host settings as set, trimmed; empty when unset. */
|
|
22
|
+
export interface HostSettings {
|
|
23
|
+
readonly report: string;
|
|
24
|
+
readonly signIn: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Tailscale and the host settings, a warning at most; none when Tailscale is not running and no
|
|
28
|
+
* setting is `tailnet`, or when the report host is set otherwise. With nothing set and Tailscale running,
|
|
29
|
+
* reports and sign-ins are on the tailnet by default: it passes, saying so and how to turn it off.
|
|
30
|
+
*/
|
|
31
|
+
export declare const checkTailnet: (status: TailnetStatus, settings: HostSettings, ci?: boolean) => DoctorCheck | undefined;
|
|
32
|
+
/** `checkTailnet` for this process: its tailnet lookup and environment. */
|
|
33
|
+
export declare const tailnetCheck: Effect.Effect<DoctorCheck | undefined>;
|
|
20
34
|
/**
|
|
21
35
|
* Checks the machine without changing it: nothing is installed or downloaded. `lookupFfmpeg` is
|
|
22
|
-
* replaceable so tests need not depend on this machine's Playwright cache. `
|
|
23
|
-
*
|
|
36
|
+
* replaceable so tests need not depend on this machine's Playwright cache. `tailnet` (see
|
|
37
|
+
* `checkTailnet`) comes when there is something to say about Tailscale. `update` is the check for
|
|
38
|
+
* a newer or stale screw-bugs (see `UpdateCheck`), last when given; a warning at most.
|
|
24
39
|
*/
|
|
25
40
|
export declare const runDoctor: (projectRoot: string, lookupFfmpeg?: Effect.Effect<FfmpegLookup, never, FileSystem.FileSystem>, update?: Effect.Effect<DoctorCheck>) => Effect.Effect<DoctorReport, never, Browser | PackageInfo | FileSystem.FileSystem | Path.Path>;
|