screw-bugs 0.1.7 → 0.1.9
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 +83 -13
- package/dist/browser-playwright/launch.js +27 -10
- package/dist/browser-playwright/page.d.ts +50 -28
- package/dist/browser-playwright/page.js +101 -91
- 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/commands.js +56 -11
- package/dist/cli/mcp.d.ts +11 -4
- package/dist/cli/mcp.js +86 -23
- package/dist/cli/operations.d.ts +30 -2
- package/dist/cli/operations.js +126 -20
- package/dist/cli/report-links.js +2 -2
- package/dist/cli/report-server.d.ts +41 -9
- package/dist/cli/report-server.js +139 -23
- package/dist/cli/share.d.ts +71 -4
- package/dist/cli/share.js +540 -109
- package/dist/cli/sign-in.d.ts +22 -10
- package/dist/cli/sign-in.js +23 -23
- package/dist/core/engine.js +54 -13
- package/dist/core/liveness.js +3 -1
- package/dist/core/services.d.ts +29 -4
- package/dist/core/share.d.ts +31 -0
- package/dist/core/share.js +139 -0
- package/dist/core/steps.d.ts +5 -0
- package/dist/core/steps.js +15 -1
- package/dist/core/video.d.ts +6 -0
- package/dist/core/video.js +8 -0
- package/dist/report/html.d.ts +4 -2
- package/dist/report/html.js +36 -13
- package/dist/report/icons.d.ts +3 -0
- package/dist/report/icons.js +5 -1
- package/dist/report/index.d.ts +3 -1
- package/dist/report/index.js +3 -1
- package/dist/report/live.d.ts +7 -0
- package/dist/report/live.js +135 -0
- package/dist/report/menu-bar.d.ts +3 -3
- package/dist/report/menu-bar.js +3 -3
- package/dist/report/player.d.ts +3 -3
- package/dist/report/player.js +3 -3
- package/dist/report/share-page.d.ts +48 -0
- package/dist/report/share-page.js +291 -0
- package/dist/report/styles.d.ts +2 -0
- package/dist/report/styles.js +2 -2
- package/dist/report/view.js +2 -0
- package/dist/report/walkthrough.d.ts +5 -2
- package/dist/report/walkthrough.js +17 -5
- package/dist/schema/accounts.js +10 -1
- package/dist/schema/evidence.d.ts +15 -8
- package/dist/schema/evidence.js +9 -4
- package/dist/schema/findings.js +1 -1
- package/dist/schema/job.d.ts +205 -65
- package/dist/schema/job.js +63 -11
- package/dist/schema/ledger.d.ts +80 -16
- package/dist/schema/ledger.js +36 -0
- package/dist/schema/share.d.ts +17 -0
- package/dist/schema/share.js +22 -0
- package/package.json +1 -1
package/dist/cli/sign-in.d.ts
CHANGED
|
@@ -9,10 +9,11 @@ export declare const FRAME_WAIT_MS = 15000;
|
|
|
9
9
|
/** How long fetching the app's icon may take in all; the sign-in opens without it after. */
|
|
10
10
|
export declare const SIGN_IN_ICON_TIMEOUT: Duration.Duration;
|
|
11
11
|
/**
|
|
12
|
-
* `SCREW_BUGS_SIGN_IN_HOST`:
|
|
13
|
-
* 127.0.0.1 unless set; set it to this machine's
|
|
12
|
+
* `SCREW_BUGS_SIGN_IN_HOST`: where the sign-in server listens, and the host in its link.
|
|
13
|
+
* 127.0.0.1 unless set; set it to this machine's MagicDNS name or tailnet IP to sign in from
|
|
14
|
+
* another device. Read as `SCREW_BUGS_REPORT_HOST` is (`hostSetting`): never every interface.
|
|
14
15
|
*/
|
|
15
|
-
export declare const signInHost: Effect.Effect<string,
|
|
16
|
+
export declare const signInHost: Effect.Effect<string, Failure, never>;
|
|
16
17
|
/** How a sign-in ended. */
|
|
17
18
|
export type SignInOutcome = 'saved' | 'cancelled' | 'idle';
|
|
18
19
|
export interface SignInRequest {
|
|
@@ -23,6 +24,20 @@ export interface SignInRequest {
|
|
|
23
24
|
/** Where the browser opens. */
|
|
24
25
|
readonly url: string;
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* One open sign-in, as `SignIns.begin` gave it: bound to that sign-in, never to whichever one its
|
|
29
|
+
* label has later (another origin's replaces it).
|
|
30
|
+
*/
|
|
31
|
+
export interface SignInHandle {
|
|
32
|
+
readonly link: string;
|
|
33
|
+
/** Waits for this sign-in to end. */
|
|
34
|
+
readonly done: Effect.Effect<SignInOutcome>;
|
|
35
|
+
/**
|
|
36
|
+
* How this sign-in ended, once any input or save in progress is over (a session that was
|
|
37
|
+
* written is then also reported saved); undefined while it is still open.
|
|
38
|
+
*/
|
|
39
|
+
readonly outcome: Effect.Effect<SignInOutcome | undefined>;
|
|
40
|
+
}
|
|
26
41
|
/** The app as the live view shows it: its title and its icon as an image data URL. */
|
|
27
42
|
export interface SignInSiteView {
|
|
28
43
|
readonly title: string | undefined;
|
|
@@ -59,14 +74,11 @@ export declare const makeSignInApp: (options: {
|
|
|
59
74
|
}) => Effect.Effect<HttpServerResponse.HttpServerResponse, never, HttpServerRequest.HttpServerRequest>;
|
|
60
75
|
declare const SignIns_base: Context.ServiceClass<SignIns, "screw-bugs/SignIns", {
|
|
61
76
|
/**
|
|
62
|
-
* Opens a sign-in for the account, or gives the
|
|
63
|
-
*
|
|
77
|
+
* Opens a sign-in for the account, or gives the one already open for it at the same origin
|
|
78
|
+
* (another origin's is ended first). Resolves at once with a handle bound to that sign-in, so
|
|
79
|
+
* a wait on it never moves to one that replaces it later.
|
|
64
80
|
*/
|
|
65
|
-
readonly begin: (request: SignInRequest) => Effect.Effect<
|
|
66
|
-
readonly link: string;
|
|
67
|
-
}, Failure>;
|
|
68
|
-
/** Waits for the sign-in open for `label` to end; undefined when none is open. */
|
|
69
|
-
readonly wait: (label: string) => Effect.Effect<SignInOutcome | undefined>;
|
|
81
|
+
readonly begin: (request: SignInRequest) => Effect.Effect<SignInHandle, Failure>;
|
|
70
82
|
}>;
|
|
71
83
|
/**
|
|
72
84
|
* The sign-ins this process holds open, one per account label. A long-lived process (the MCP
|
package/dist/cli/sign-in.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NodeHttpServer } from '@effect/platform-node';
|
|
2
2
|
// Boundary: NodeHttpServer serves a Node `http.Server`, made here.
|
|
3
3
|
import { createServer } from 'node:http';
|
|
4
|
-
import { Clock,
|
|
4
|
+
import { Clock, Context, DateTime, Deferred, Duration, Effect, Exit, Layer, Option, Schema, Scope, Semaphore, Stream, } from 'effect';
|
|
5
5
|
import { Base64 } from 'effect/encoding';
|
|
6
6
|
import { HttpClient, HttpServerRequest, HttpServerResponse } from 'effect/http';
|
|
7
7
|
import { SecureRandom } from 'effect/crypto';
|
|
@@ -10,6 +10,7 @@ import { hex, renderSignInPage, SIGN_IN_CSP } from '../report/index.js';
|
|
|
10
10
|
import { SignInInputs } from '../schema/index.js';
|
|
11
11
|
import { ExitCode } from './exit-codes.js';
|
|
12
12
|
import { Failure } from './failure.js';
|
|
13
|
+
import { boundAddress, hostSetting, isLoopback, urlHost } from './report-server.js';
|
|
13
14
|
/*
|
|
14
15
|
* Signing in to a test account: a headless browser at the app, which a person drives from a web
|
|
15
16
|
* page (the live view, `renderSignInPage`) in whatever browser reaches this machine: the one built
|
|
@@ -28,14 +29,22 @@ export const FRAME_WAIT_MS = 15_000;
|
|
|
28
29
|
export const SIGN_IN_ICON_TIMEOUT = Duration.seconds(3);
|
|
29
30
|
/** The largest input request taken: a few hundred inputs. */
|
|
30
31
|
const INPUT_BYTES_MAX = 256 * 1024;
|
|
31
|
-
const LOOPBACK = new Set(['127.0.0.1', 'localhost', '::1']);
|
|
32
32
|
/**
|
|
33
|
-
* `SCREW_BUGS_SIGN_IN_HOST`:
|
|
34
|
-
* 127.0.0.1 unless set; set it to this machine's
|
|
33
|
+
* `SCREW_BUGS_SIGN_IN_HOST`: where the sign-in server listens, and the host in its link.
|
|
34
|
+
* 127.0.0.1 unless set; set it to this machine's MagicDNS name or tailnet IP to sign in from
|
|
35
|
+
* another device. Read as `SCREW_BUGS_REPORT_HOST` is (`hostSetting`): never every interface.
|
|
35
36
|
*/
|
|
36
|
-
export const signInHost =
|
|
37
|
-
/**
|
|
38
|
-
const
|
|
37
|
+
export const signInHost = Effect.suspend(() => hostSetting('SCREW_BUGS_SIGN_IN_HOST', 'sign_in_host'));
|
|
38
|
+
/** The handle for an open sign-in. */
|
|
39
|
+
const handleOf = (entry) => ({
|
|
40
|
+
link: entry.link,
|
|
41
|
+
done: Deferred.await(entry.done),
|
|
42
|
+
outcome: Effect.gen(function* () {
|
|
43
|
+
if (!(yield* Deferred.isDone(entry.done)))
|
|
44
|
+
return undefined;
|
|
45
|
+
return yield* Deferred.await(entry.done);
|
|
46
|
+
}).pipe(Semaphore.withPermit(entry.steps)),
|
|
47
|
+
});
|
|
39
48
|
const randomToken = SecureRandom.SecureRandom.use((random) => random.randomBytes(32)).pipe(Effect.map(hex), Effect.provide(SecureRandom.layerWebCrypto));
|
|
40
49
|
/** Compares in time that does not depend on where the strings differ. */
|
|
41
50
|
const sameText = (a, b) => {
|
|
@@ -202,13 +211,6 @@ export class SignIns extends Context.Service()('screw-bugs/SignIns') {
|
|
|
202
211
|
const pending = new Map();
|
|
203
212
|
const open = (request) => Effect.gen(function* () {
|
|
204
213
|
const host = yield* signInHost;
|
|
205
|
-
if (host === '' || host === '0.0.0.0' || host === '::')
|
|
206
|
-
return yield* new Failure({
|
|
207
|
-
code: ExitCode.Usage,
|
|
208
|
-
reason: 'sign_in_host',
|
|
209
|
-
message: `SCREW_BUGS_SIGN_IN_HOST is "${host}"; give one address of this machine, such ` +
|
|
210
|
-
'as 127.0.0.1 or its tailnet IP, never every interface.',
|
|
211
|
-
});
|
|
212
214
|
const own = yield* Scope.fork(scope);
|
|
213
215
|
const opened = yield* Effect.gen(function* () {
|
|
214
216
|
const live = yield* browser.signIn(request.url).pipe(Effect.mapError((error) => new Failure({
|
|
@@ -259,8 +261,11 @@ export class SignIns extends Context.Service()('screw-bugs/SignIns') {
|
|
|
259
261
|
})));
|
|
260
262
|
if ('port' in server.address)
|
|
261
263
|
port = server.address.port;
|
|
264
|
+
const bound = yield* boundAddress(server.address, host, 'SCREW_BUGS_SIGN_IN_HOST', 'sign_in_host');
|
|
265
|
+
// The host it was set to, and the address that is (a name's IP): both can be opened.
|
|
262
266
|
hosts.add(`${urlHost(host)}:${port}`);
|
|
263
|
-
|
|
267
|
+
hosts.add(`${urlHost(bound)}:${port}`);
|
|
268
|
+
if (isLoopback(host))
|
|
264
269
|
for (const name of ['127.0.0.1', 'localhost', '[::1]'])
|
|
265
270
|
hosts.add(`${name}:${port}`);
|
|
266
271
|
yield* server.serve(app).pipe(Effect.provide(NodeHttpServer.layerHttpServices));
|
|
@@ -273,7 +278,7 @@ export class SignIns extends Context.Service()('screw-bugs/SignIns') {
|
|
|
273
278
|
yield* end('idle');
|
|
274
279
|
}
|
|
275
280
|
}).pipe(Effect.forkIn(own));
|
|
276
|
-
return { link: `http://${urlHost(host)}:${port}/${token}/`, done, end };
|
|
281
|
+
return { link: `http://${urlHost(host)}:${port}/${token}/`, done, end, steps };
|
|
277
282
|
}).pipe(Scope.provide(own), Effect.onError(() => Scope.close(own, Exit.void)));
|
|
278
283
|
const entry = { origin: request.origin, ...opened };
|
|
279
284
|
pending.set(request.label, entry);
|
|
@@ -289,17 +294,12 @@ export class SignIns extends Context.Service()('screw-bugs/SignIns') {
|
|
|
289
294
|
const open_ = pending.get(request.label);
|
|
290
295
|
if (open_ !== undefined && !(yield* Deferred.isDone(open_.done))) {
|
|
291
296
|
if (open_.origin === request.origin)
|
|
292
|
-
return
|
|
297
|
+
return handleOf(open_);
|
|
293
298
|
// After a save in progress, which then stands until this one saves.
|
|
294
299
|
yield* open_.end('cancelled');
|
|
295
300
|
}
|
|
296
|
-
|
|
297
|
-
return { link: opened.link };
|
|
301
|
+
return handleOf(yield* open(request));
|
|
298
302
|
}).pipe(Semaphore.withPermit(lock)),
|
|
299
|
-
wait: (label) => Effect.suspend(() => {
|
|
300
|
-
const open_ = pending.get(label);
|
|
301
|
-
return open_ === undefined ? Effect.succeed(undefined) : Deferred.await(open_.done);
|
|
302
|
-
}),
|
|
303
303
|
});
|
|
304
304
|
}));
|
|
305
305
|
}
|
package/dist/core/engine.js
CHANGED
|
@@ -9,7 +9,7 @@ import { placeMarks } from './marks.js';
|
|
|
9
9
|
import { pageUnplaced } from './viewport.js';
|
|
10
10
|
import { AccountBook, Browser, Notifier, ReportRenderer, Storage, } from './services.js';
|
|
11
11
|
import { runCase } from './steps.js';
|
|
12
|
-
import { VIDEO_HEAD_BYTES, videoProblemOf, webmDurationMs } from './video.js';
|
|
12
|
+
import { stillWithin, VIDEO_HEAD_BYTES, videoProblemOf, webmDurationMs } from './video.js';
|
|
13
13
|
const messageOf = (error) => error instanceof Error ? error.message : String(error);
|
|
14
14
|
/**
|
|
15
15
|
* The longest one write of `report.html` or `ledger.json` may take. A run's
|
|
@@ -201,18 +201,24 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
|
|
|
201
201
|
/** Writes `evidence.json`, the evidence pack an agent writes its findings from. */
|
|
202
202
|
const writeEvidence = (job, ledger) => bounded(runFiles.evidence, storage.writeFile(job.jobId, runFiles.evidence, `${JSON.stringify(evidencePackOf(job, ledger), null, 2)}\n`));
|
|
203
203
|
/**
|
|
204
|
-
* Writes the report of a run that just ended
|
|
205
|
-
*
|
|
206
|
-
*
|
|
204
|
+
* Writes the report of a run that just ended, and returns the pages written with it,
|
|
205
|
+
* relative to the run folder, for `live.html` to link. The report is derived from the ledger
|
|
206
|
+
* and can be rewritten with `screw-bugs report`, so failing to write it never changes the
|
|
207
|
+
* run's result: the notifier says so.
|
|
207
208
|
*/
|
|
208
|
-
const reportOnEnd = (ledger) => storage.readJob(ledger.jobId).pipe(Effect.flatMap((job) => writeEvidence(job, ledger).pipe(Effect.andThen(renderReport(job, ledger)))), Effect.
|
|
209
|
+
const reportOnEnd = (ledger) => storage.readJob(ledger.jobId).pipe(Effect.flatMap((job) => writeEvidence(job, ledger).pipe(Effect.andThen(renderReport(job, ledger)))), Effect.map(({ bundle }) => ({
|
|
210
|
+
report: runFiles.html,
|
|
211
|
+
walkthrough: bundle.files.walkthrough,
|
|
212
|
+
})), Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause)
|
|
209
213
|
? Effect.failCause(cause)
|
|
210
|
-
: notifier
|
|
214
|
+
: notifier
|
|
215
|
+
.notify({
|
|
211
216
|
jobId: ledger.jobId,
|
|
212
217
|
state: ledger.state,
|
|
213
218
|
message: `The run ended, but report.html could not be written: ${messageOf(Cause.squash(cause)).replace(/\.$/, '')}. ` +
|
|
214
219
|
`Run \`screw-bugs report ${ledger.jobId}\` to try again.`,
|
|
215
|
-
})
|
|
220
|
+
})
|
|
221
|
+
.pipe(Effect.as({}))));
|
|
216
222
|
const device = (spec) => ({
|
|
217
223
|
deviceLabel: browser.deviceLabel(spec.device ?? 'desktop'),
|
|
218
224
|
});
|
|
@@ -234,16 +240,39 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
|
|
|
234
240
|
...device(spec),
|
|
235
241
|
...(version !== undefined ? { version } : {}),
|
|
236
242
|
};
|
|
243
|
+
/**
|
|
244
|
+
* Where the job is (see `RunProgress`): set as each case and step starts, and saved with
|
|
245
|
+
* the next ledger write (the heartbeat, or the case's end), never a write of its own.
|
|
246
|
+
*/
|
|
247
|
+
let progress;
|
|
248
|
+
/** The ledger with the progress as it is now; only a running ledger has one. */
|
|
249
|
+
const withProgress = (next) => {
|
|
250
|
+
const { progress: _, ...rest } = next;
|
|
251
|
+
return next.state === 'running' && progress !== undefined
|
|
252
|
+
? { ...rest, progress }
|
|
253
|
+
: rest;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Writes `live.html` from the ledger just written, with the pages its report came with
|
|
257
|
+
* once the run ended. Only a page to watch: a failed write changes nothing else.
|
|
258
|
+
*/
|
|
259
|
+
const writeLive = (next, pages) => bounded(runFiles.live, Effect.sync(() => renderer.live({ spec, ledger: next, ...pages })).pipe(Effect.flatMap((page) => storage.writeFile(jobId, runFiles.live, page)))).pipe(Effect.catchCause(() => Effect.void));
|
|
237
260
|
/**
|
|
238
261
|
* One write at a time, each finished even when interrupted (but bounded, see
|
|
239
262
|
* `WRITE_TIMEOUT_MS`), so a heartbeat never lands over a newer ledger such as the final one.
|
|
263
|
+
* Once a ledger has ended, only another final write may follow it (`stop` after a final
|
|
264
|
+
* write that failed): a write that was waiting its turn behind it (the heartbeat) writes
|
|
265
|
+
* nothing, as it would rewrite live.html without the report's links.
|
|
240
266
|
*/
|
|
241
267
|
const writes = yield* Semaphore.make(1);
|
|
242
268
|
const write = (change, ends) => writes.withPermits(1)(Effect.uninterruptible(Effect.gen(function* () {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
269
|
+
if (!ends && ledger.state !== 'running')
|
|
270
|
+
return;
|
|
271
|
+
const next = yield* stamped(withProgress(change(ledger)));
|
|
272
|
+
// The report goes first, so whoever sees the run end in the ledger can open it;
|
|
273
|
+
// then live.html, so whoever sees it running there can open that.
|
|
274
|
+
const pages = ends ? yield* reportOnEnd(next) : {};
|
|
275
|
+
yield* writeLive(next, pages);
|
|
247
276
|
ledger = next;
|
|
248
277
|
yield* bounded('ledger.json', storage.writeLedger(next));
|
|
249
278
|
})));
|
|
@@ -287,7 +316,10 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
|
|
|
287
316
|
return ended;
|
|
288
317
|
// Where the video stands still, for the walkthrough's "Skip inactive".
|
|
289
318
|
measuring = ended;
|
|
290
|
-
const
|
|
319
|
+
const measured = yield* browser.stillVideo(storage.filePath(jobId, video));
|
|
320
|
+
const still = measured === undefined || videoDurationMs === undefined
|
|
321
|
+
? measured
|
|
322
|
+
: stillWithin(measured, videoDurationMs);
|
|
291
323
|
measuring = undefined;
|
|
292
324
|
return still === undefined ? ended : { number, fields: { ...ended.fields, still } };
|
|
293
325
|
});
|
|
@@ -323,7 +355,10 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
|
|
|
323
355
|
// Proof of life for other processes reading the ledger; stops with this scope.
|
|
324
356
|
yield* Effect.sleep(HEARTBEAT_INTERVAL_MS).pipe(Effect.andThen(update((current) => current)), Effect.ignore, Effect.forever, Effect.forkScoped);
|
|
325
357
|
yield* notifier.notify({ jobId, state: 'running', message: 'Run started.' });
|
|
326
|
-
const browserSession = yield* browser.open({
|
|
358
|
+
const browserSession = yield* browser.open({
|
|
359
|
+
headed: false,
|
|
360
|
+
device: spec.device ?? 'desktop',
|
|
361
|
+
});
|
|
327
362
|
// One session: one test user in one browser, recorded as one video. Its cases run
|
|
328
363
|
// one after another in job order and share cookies and storage.
|
|
329
364
|
const video = videoFile(1);
|
|
@@ -355,6 +390,7 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
|
|
|
355
390
|
// A case that continues goes on from the page the one before it left, whatever
|
|
356
391
|
// that case came to; the first case of a job cannot (see `JobSpec`).
|
|
357
392
|
const continuedFrom = caseSpec.continue === true ? cases[index - 1]?.id : undefined;
|
|
393
|
+
progress = { case: index + 1 };
|
|
358
394
|
yield* session.beginCase({ continues: continuedFrom !== undefined });
|
|
359
395
|
const entry = yield* runCase(session.page, caseSpec, {
|
|
360
396
|
continuedFrom,
|
|
@@ -367,7 +403,12 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
|
|
|
367
403
|
now: sinceVideo,
|
|
368
404
|
savePage: (fileName, page) => storage.writeFile(jobId, `${runFiles.evidenceDir}/${fileName}`, JSON.stringify(page)),
|
|
369
405
|
uploads: (path) => sources.get(path),
|
|
406
|
+
onStep: (step, kind) => Effect.sync(() => {
|
|
407
|
+
progress = { case: index + 1, step, kind };
|
|
408
|
+
}),
|
|
370
409
|
});
|
|
410
|
+
// Saved with this case's result: the next case, which starts now, if there is one.
|
|
411
|
+
progress = index + 1 < cases.length ? { case: index + 2 } : undefined;
|
|
371
412
|
yield* update((current) => ({
|
|
372
413
|
...current,
|
|
373
414
|
cases: current.cases.with(index, { ...entry, session: 1 }),
|
package/dist/core/liveness.js
CHANGED
|
@@ -46,7 +46,9 @@ export const withLiveness = (ledger, nowMs) => {
|
|
|
46
46
|
const beat = ledger.heartbeatAt === undefined ? Number.NaN : Date.parse(ledger.heartbeatAt);
|
|
47
47
|
if (nowMs - beat <= HEARTBEAT_STALE_MS)
|
|
48
48
|
return ledger;
|
|
49
|
-
|
|
49
|
+
// Where it was is no longer where it is: only a running ledger has a progress.
|
|
50
|
+
const { progress: _, ...rest } = ledger;
|
|
51
|
+
return { ...rest, state: 'errored', error: PROCESS_GONE, cases: markUnreached(ledger.cases) };
|
|
50
52
|
};
|
|
51
53
|
/**
|
|
52
54
|
* How long ago the heartbeat of a ledger that `withLiveness` reports errored was written; its
|
package/dist/core/services.d.ts
CHANGED
|
@@ -157,8 +157,9 @@ export interface TextScope {
|
|
|
157
157
|
export interface ActionTrace {
|
|
158
158
|
/**
|
|
159
159
|
* How long after the operation was called it acted, in ms: when the browser dispatched the
|
|
160
|
-
* click or the key to the page, or the load started. Missing when that was not seen,
|
|
161
|
-
* fill or files set on a file input directly (a page can make their edits itself)
|
|
160
|
+
* click or the key to the page, or the load started. Missing when that was not seen, for a
|
|
161
|
+
* fill or files set on a file input directly (a page can make their edits itself), and for a
|
|
162
|
+
* hover (see `StepAction.atMs`).
|
|
162
163
|
*/
|
|
163
164
|
readonly afterMs?: number | undefined;
|
|
164
165
|
/**
|
|
@@ -199,13 +200,19 @@ export interface UploadSource {
|
|
|
199
200
|
*/
|
|
200
201
|
export interface BrowserPage {
|
|
201
202
|
/**
|
|
202
|
-
* goto, reload, click, fill, upload and press fail only when the action itself could not be
|
|
203
|
+
* goto, reload, click, hover, fill, upload and press fail only when the action itself could not be
|
|
203
204
|
* performed. What the documents they load come to is judged by `settle`. Each says when it
|
|
204
205
|
* acted and, for an element, where (see `ActionTrace`).
|
|
205
206
|
*/
|
|
206
207
|
readonly goto: (url: string, wait?: Wait) => Effect.Effect<ActionTrace, PageActionFailed>;
|
|
207
208
|
readonly reload: (wait?: Wait) => Effect.Effect<ActionTrace, PageActionFailed>;
|
|
208
209
|
readonly click: (target: Target, wait?: Wait) => Effect.Effect<ActionTrace, PageActionFailed>;
|
|
210
|
+
/**
|
|
211
|
+
* Moves the mouse over `target` (waiting for it like `click` does, and scrolling it into view),
|
|
212
|
+
* so the page's own hover styles and handlers run; the mouse stays there until the next action
|
|
213
|
+
* moves it. Records no time or point (see `StepAction.atMs`).
|
|
214
|
+
*/
|
|
215
|
+
readonly hover: (target: Target, wait?: Wait) => Effect.Effect<ActionTrace, PageActionFailed>;
|
|
209
216
|
readonly fill: (target: Target, value: string, wait?: Wait) => Effect.Effect<ActionTrace, PageActionFailed>;
|
|
210
217
|
/**
|
|
211
218
|
* Sets `files` (absolute paths) on the file input `target` matches, hidden or not, or else
|
|
@@ -238,7 +245,7 @@ export interface BrowserPage {
|
|
|
238
245
|
* How `target` shows on the screen now (see `OnScreen`), for the step's record; never changes
|
|
239
246
|
* what the step decided. For a `check` (a step that held: waitFor visible, expectText,
|
|
240
247
|
* expectLink), the best of its visible matches, scrolling the page to one that only the page's
|
|
241
|
-
* scrolling keeps off the screen, as a person would. For an `act` (a click or fill), the match
|
|
248
|
+
* scrolling keeps off the screen, as a person would. For an `act` (a click, hover or fill), the match
|
|
242
249
|
* the action takes, as it is: the action scrolls to it, through anything that scrolls. While it
|
|
243
250
|
* does not show, it is measured again for a few seconds (at most `wait`'s timeout, after one
|
|
244
251
|
* whole look at the first match), for what is still moving into place. Undefined when nothing matches visibly or it could not be measured. Never fails.
|
|
@@ -383,6 +390,11 @@ declare const Browser_base: Context.ServiceClass<Browser, "screw-bugs/Browser",
|
|
|
383
390
|
readonly stillVideo: (file: string) => Effect.Effect<ReadonlyArray<StillStretch> | undefined>;
|
|
384
391
|
readonly open: (options: {
|
|
385
392
|
readonly headed: boolean;
|
|
393
|
+
/**
|
|
394
|
+
* The device its sessions are on (desktop when left out): the browser renders at its scale,
|
|
395
|
+
* so their videos have its resolution.
|
|
396
|
+
*/
|
|
397
|
+
readonly device?: Device | undefined;
|
|
386
398
|
}) => Effect.Effect<BrowserSession, BrowserNotFound, Scope.Scope>;
|
|
387
399
|
/** What `device` emulates, for people reading a run: "Desktop", "iPhone 17 (Chromium)". */
|
|
388
400
|
readonly deviceLabel: (device: Device) => string;
|
|
@@ -500,10 +512,23 @@ declare const Storage_base: Context.ServiceClass<Storage, "screw-bugs/Storage",
|
|
|
500
512
|
*/
|
|
501
513
|
export declare class Storage extends Storage_base {
|
|
502
514
|
}
|
|
515
|
+
/**
|
|
516
|
+
* What `live.html` (`runFiles.live`) shows: the job and its ledger as just written. Once the run
|
|
517
|
+
* has ended (the ledger says so), `report` and `walkthrough` name the pages written with its
|
|
518
|
+
* report, relative to the run folder, when they were.
|
|
519
|
+
*/
|
|
520
|
+
export interface LivePage {
|
|
521
|
+
readonly spec: JobSpec;
|
|
522
|
+
readonly ledger: CaseLedger;
|
|
523
|
+
readonly report?: string | undefined;
|
|
524
|
+
readonly walkthrough?: string | undefined;
|
|
525
|
+
}
|
|
503
526
|
declare const ReportRenderer_base: Context.ServiceClass<ReportRenderer, "screw-bugs/ReportRenderer", {
|
|
504
527
|
readonly html: (bundle: ReportBundle) => string;
|
|
505
528
|
/** The run's walkthrough (`runFiles.walkthrough`): its video and every step as a script. */
|
|
506
529
|
readonly walkthrough: (bundle: ReportBundle) => string;
|
|
530
|
+
/** The page a person watches the run on while it goes (`runFiles.live`). */
|
|
531
|
+
readonly live: (page: LivePage) => string;
|
|
507
532
|
}>;
|
|
508
533
|
/**
|
|
509
534
|
* Turns a run into its HTML report. Pure: the `report` module provides it, and the engine writes
|
package/dist/core/share.d.ts
CHANGED
|
@@ -35,3 +35,34 @@ export declare const typesSecret: (step: Step) => boolean;
|
|
|
35
35
|
* and video show.
|
|
36
36
|
*/
|
|
37
37
|
export declare const scrubBundle: (bundle: ReportBundle) => ReportBundle;
|
|
38
|
+
/** The screenshots of `bundle` a share may hold as WebP instead: its PNGs, of `shareFiles`. */
|
|
39
|
+
export declare const encodableFiles: (bundle: ReportBundle) => ReadonlySet<string>;
|
|
40
|
+
/** Where the WebP of the screenshot at `path` goes: the same path, ending `.webp`. */
|
|
41
|
+
export declare const webpPath: (path: string) => string;
|
|
42
|
+
/**
|
|
43
|
+
* `bundle` with its file paths changed as `renames` says (old path to new), wherever the bundle
|
|
44
|
+
* names them: each case's evidence, their names and shots, and the annotated copies.
|
|
45
|
+
*/
|
|
46
|
+
export declare const renameFiles: (bundle: ReportBundle, renames: ReadonlyMap<string, string>) => ReportBundle;
|
|
47
|
+
/** An image's size in pixels. */
|
|
48
|
+
export interface PixelSize {
|
|
49
|
+
readonly width: number;
|
|
50
|
+
readonly height: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The most pixels a WebP image has on a side. A browser asked to encode a taller screenshot (a
|
|
54
|
+
* long full-page one) gives a cut-down image, so such screenshots are never offered.
|
|
55
|
+
*/
|
|
56
|
+
export declare const WEBP_MAX_SIDE = 16383;
|
|
57
|
+
/** How many bytes of a PNG `pngSize` reads: the signature and the IHDR chunk's size fields. */
|
|
58
|
+
export declare const PNG_HEADER_BYTES = 24;
|
|
59
|
+
/** The size of the PNG whose first bytes are `bytes`, or undefined for anything else. */
|
|
60
|
+
export declare const pngSize: (bytes: Uint8Array) => PixelSize | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* The size of the WebP file `bytes`, or undefined unless it is one whole still image: a RIFF
|
|
63
|
+
* `WEBP` container whose length is the file's, made of chunks that fill it exactly (each padded
|
|
64
|
+
* to an even length), holding one lossy (`VP8 `) or lossless (`VP8L`) image with data in it,
|
|
65
|
+
* first or after an extended header (`VP8X`, not animated) whose canvas is the image's size.
|
|
66
|
+
* It does not decode the image, so a file can still be broken inside its image data.
|
|
67
|
+
*/
|
|
68
|
+
export declare const webpSize: (bytes: Uint8Array) => PixelSize | undefined;
|
package/dist/core/share.js
CHANGED
|
@@ -177,3 +177,142 @@ export const scrubBundle = (bundle) => {
|
|
|
177
177
|
// Only strings change, so the result keeps the bundle's shape.
|
|
178
178
|
return scrubStrings(typed);
|
|
179
179
|
};
|
|
180
|
+
/*
|
|
181
|
+
* Smaller screenshots for a share: the person's browser re-encodes PNG screenshots as WebP at
|
|
182
|
+
* their own size (see `src/cli/share.ts`), and the share holds the WebP in its place, under the
|
|
183
|
+
* same path with `.webp`. Only screenshots the ledger describes (`shots`) and annotated copies
|
|
184
|
+
* change: older runs without `shots` name their screenshots by `.png` endings the report reads.
|
|
185
|
+
*/
|
|
186
|
+
/** The screenshots of `bundle` a share may hold as WebP instead: its PNGs, of `shareFiles`. */
|
|
187
|
+
export const encodableFiles = (bundle) => {
|
|
188
|
+
const paths = new Set();
|
|
189
|
+
for (const entry of bundle.ledger.cases)
|
|
190
|
+
for (const shot of entry.shots ?? [])
|
|
191
|
+
paths.add(shot.path);
|
|
192
|
+
for (const path of Object.values(bundle.annotated ?? {}))
|
|
193
|
+
paths.add(path);
|
|
194
|
+
return new Set([...paths].filter((path) => shareable(path) && /\.png$/i.test(path)));
|
|
195
|
+
};
|
|
196
|
+
/** Where the WebP of the screenshot at `path` goes: the same path, ending `.webp`. */
|
|
197
|
+
export const webpPath = (path) => path.replace(/\.png$/i, '.webp');
|
|
198
|
+
/**
|
|
199
|
+
* `bundle` with its file paths changed as `renames` says (old path to new), wherever the bundle
|
|
200
|
+
* names them: each case's evidence, their names and shots, and the annotated copies.
|
|
201
|
+
*/
|
|
202
|
+
export const renameFiles = (bundle, renames) => {
|
|
203
|
+
if (renames.size === 0)
|
|
204
|
+
return bundle;
|
|
205
|
+
const to = (path) => renames.get(path) ?? path;
|
|
206
|
+
return {
|
|
207
|
+
...bundle,
|
|
208
|
+
ledger: {
|
|
209
|
+
...bundle.ledger,
|
|
210
|
+
cases: bundle.ledger.cases.map((entry) => ({
|
|
211
|
+
...entry,
|
|
212
|
+
evidence: entry.evidence.map(to),
|
|
213
|
+
...(entry.evidenceNames === undefined
|
|
214
|
+
? {}
|
|
215
|
+
: {
|
|
216
|
+
evidenceNames: Object.fromEntries(Object.entries(entry.evidenceNames).map(([path, name]) => [to(path), name])),
|
|
217
|
+
}),
|
|
218
|
+
...(entry.shots === undefined
|
|
219
|
+
? {}
|
|
220
|
+
: { shots: entry.shots.map((shot) => ({ ...shot, path: to(shot.path) })) }),
|
|
221
|
+
})),
|
|
222
|
+
},
|
|
223
|
+
...(bundle.annotated === undefined
|
|
224
|
+
? {}
|
|
225
|
+
: {
|
|
226
|
+
annotated: Object.fromEntries(Object.entries(bundle.annotated).map(([id, path]) => [id, to(path)])),
|
|
227
|
+
}),
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
const ascii = (bytes, at, text) => [...text].every((char, i) => bytes[at + i] === char.charCodeAt(0));
|
|
231
|
+
const u32be = (bytes, at) => ((bytes[at] << 24) | (bytes[at + 1] << 16) | (bytes[at + 2] << 8) | bytes[at + 3]) >>> 0;
|
|
232
|
+
const u32le = (bytes, at) => (bytes[at] | (bytes[at + 1] << 8) | (bytes[at + 2] << 16) | (bytes[at + 3] << 24)) >>> 0;
|
|
233
|
+
/**
|
|
234
|
+
* The most pixels a WebP image has on a side. A browser asked to encode a taller screenshot (a
|
|
235
|
+
* long full-page one) gives a cut-down image, so such screenshots are never offered.
|
|
236
|
+
*/
|
|
237
|
+
export const WEBP_MAX_SIDE = 16383;
|
|
238
|
+
/** How many bytes of a PNG `pngSize` reads: the signature and the IHDR chunk's size fields. */
|
|
239
|
+
export const PNG_HEADER_BYTES = 24;
|
|
240
|
+
/** The size of the PNG whose first bytes are `bytes`, or undefined for anything else. */
|
|
241
|
+
export const pngSize = (bytes) => {
|
|
242
|
+
const signature = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
243
|
+
if (bytes.length < PNG_HEADER_BYTES || !signature.every((byte, i) => bytes[i] === byte))
|
|
244
|
+
return undefined;
|
|
245
|
+
if (!ascii(bytes, 12, 'IHDR'))
|
|
246
|
+
return undefined;
|
|
247
|
+
const width = u32be(bytes, 16);
|
|
248
|
+
const height = u32be(bytes, 20);
|
|
249
|
+
return width > 0 && height > 0 ? { width, height } : undefined;
|
|
250
|
+
};
|
|
251
|
+
/** The size a VP8 (lossy) or VP8L (lossless) image chunk's `data` says, or undefined. */
|
|
252
|
+
const imageSize = (kind, data) => {
|
|
253
|
+
if (kind === 'VP8 ') {
|
|
254
|
+
// A frame tag that says key frame, its start code, then 14 bits each of width and height
|
|
255
|
+
// (2 bits of scale above), and image data after them.
|
|
256
|
+
if (data.length <= 10 || (data[0] & 1) !== 0)
|
|
257
|
+
return undefined;
|
|
258
|
+
if (data[3] !== 0x9d || data[4] !== 0x01 || data[5] !== 0x2a)
|
|
259
|
+
return undefined;
|
|
260
|
+
const width = (data[6] | (data[7] << 8)) & 0x3fff;
|
|
261
|
+
const height = (data[8] | (data[9] << 8)) & 0x3fff;
|
|
262
|
+
return width > 0 && height > 0 ? { width, height } : undefined;
|
|
263
|
+
}
|
|
264
|
+
if (kind === 'VP8L') {
|
|
265
|
+
// A signature byte, then 14 bits each of width - 1 and height - 1, and image data after them.
|
|
266
|
+
if (data.length <= 5 || data[0] !== 0x2f)
|
|
267
|
+
return undefined;
|
|
268
|
+
const bits = u32le(data, 1);
|
|
269
|
+
return { width: (bits & 0x3fff) + 1, height: ((bits >>> 14) & 0x3fff) + 1 };
|
|
270
|
+
}
|
|
271
|
+
return undefined;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* The size of the WebP file `bytes`, or undefined unless it is one whole still image: a RIFF
|
|
275
|
+
* `WEBP` container whose length is the file's, made of chunks that fill it exactly (each padded
|
|
276
|
+
* to an even length), holding one lossy (`VP8 `) or lossless (`VP8L`) image with data in it,
|
|
277
|
+
* first or after an extended header (`VP8X`, not animated) whose canvas is the image's size.
|
|
278
|
+
* It does not decode the image, so a file can still be broken inside its image data.
|
|
279
|
+
*/
|
|
280
|
+
export const webpSize = (bytes) => {
|
|
281
|
+
if (bytes.length < 20 || !ascii(bytes, 0, 'RIFF') || !ascii(bytes, 8, 'WEBP'))
|
|
282
|
+
return undefined;
|
|
283
|
+
if (u32le(bytes, 4) + 8 !== bytes.length)
|
|
284
|
+
return undefined;
|
|
285
|
+
const chunks = [];
|
|
286
|
+
let at = 12;
|
|
287
|
+
while (at < bytes.length) {
|
|
288
|
+
if (at + 8 > bytes.length)
|
|
289
|
+
return undefined;
|
|
290
|
+
const kind = String.fromCharCode(...bytes.subarray(at, at + 4));
|
|
291
|
+
const size = u32le(bytes, at + 4);
|
|
292
|
+
const end = at + 8 + size;
|
|
293
|
+
if (end > bytes.length)
|
|
294
|
+
return undefined;
|
|
295
|
+
chunks.push({ kind, data: bytes.subarray(at + 8, end) });
|
|
296
|
+
at = end + (size % 2);
|
|
297
|
+
}
|
|
298
|
+
if (at !== bytes.length)
|
|
299
|
+
return undefined;
|
|
300
|
+
const images = chunks.filter((chunk) => chunk.kind === 'VP8 ' || chunk.kind === 'VP8L');
|
|
301
|
+
if (images.length !== 1)
|
|
302
|
+
return undefined;
|
|
303
|
+
const image = images[0];
|
|
304
|
+
const size = imageSize(image.kind, image.data);
|
|
305
|
+
if (size === undefined)
|
|
306
|
+
return undefined;
|
|
307
|
+
const first = chunks[0];
|
|
308
|
+
if (first === image)
|
|
309
|
+
return size;
|
|
310
|
+
if (first.kind !== 'VP8X' || first.data.length < 10)
|
|
311
|
+
return undefined;
|
|
312
|
+
// Not animated (an animation has frames in ANMF chunks, not one image).
|
|
313
|
+
if ((first.data[0] & 0x02) !== 0)
|
|
314
|
+
return undefined;
|
|
315
|
+
const width = (first.data[4] | (first.data[5] << 8) | (first.data[6] << 16)) + 1;
|
|
316
|
+
const height = (first.data[7] | (first.data[8] << 8) | (first.data[9] << 16)) + 1;
|
|
317
|
+
return width === size.width && height === size.height ? size : undefined;
|
|
318
|
+
};
|
package/dist/core/steps.d.ts
CHANGED
|
@@ -98,4 +98,9 @@ export declare const runCase: (page: BrowserPage, spec: CaseSpec, options: {
|
|
|
98
98
|
* ledger records it.
|
|
99
99
|
*/
|
|
100
100
|
readonly continuedFrom?: string | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Told as each step starts: its number, as the ledger numbers steps (0 is the opening
|
|
103
|
+
* navigation), and its action. For showing where a running job is; it must not fail or block.
|
|
104
|
+
*/
|
|
105
|
+
readonly onStep?: ((step: number, kind: Step['action']) => Effect.Effect<void>) | undefined;
|
|
101
106
|
}) => Effect.Effect<CaseEntry>;
|
package/dist/core/steps.js
CHANGED
|
@@ -48,6 +48,8 @@ export const describeStep = (step) => {
|
|
|
48
48
|
return 'reload';
|
|
49
49
|
case 'click':
|
|
50
50
|
return `click ${describeTarget(step.target)}`;
|
|
51
|
+
case 'hover':
|
|
52
|
+
return `hover ${describeTarget(step.target)}`;
|
|
51
53
|
case 'fill':
|
|
52
54
|
return `fill ${describeTarget(step.target)}`;
|
|
53
55
|
case 'upload':
|
|
@@ -174,6 +176,7 @@ const ACTIONS = [
|
|
|
174
176
|
'goto',
|
|
175
177
|
'reload',
|
|
176
178
|
'click',
|
|
179
|
+
'hover',
|
|
177
180
|
'fill',
|
|
178
181
|
'upload',
|
|
179
182
|
'press',
|
|
@@ -182,7 +185,7 @@ const ACTIONS = [
|
|
|
182
185
|
* What a page load that went wrong means for the step during which it started: an HTTP error
|
|
183
186
|
* fails it; a load that failed or did not finish blocks it. Every page load is counted against
|
|
184
187
|
* the step that was running when it started (`BrowserPage.settle`). An action (goto, reload,
|
|
185
|
-
* click, fill, upload, press) is taken to have caused it; during an expectation or a screenshot, which cause nothing,
|
|
188
|
+
* click, hover, fill, upload, press) is taken to have caused it; during an expectation or a screenshot, which cause nothing,
|
|
186
189
|
* the page did it on its own, so the reason says only when it started.
|
|
187
190
|
*/
|
|
188
191
|
const loadOutcome = (problem, step) => {
|
|
@@ -287,6 +290,13 @@ const runStep = (page, step, jobUrl, capture, stepShot, uploads) => {
|
|
|
287
290
|
message: `It links to a ${scheme} URL, so it was not clicked; ${ONLY_WEB}.`,
|
|
288
291
|
}),
|
|
289
292
|
}));
|
|
293
|
+
case 'hover':
|
|
294
|
+
// Measured and shown after it, like a fill: the step is there for what the hover shows.
|
|
295
|
+
return action(page.hover(step.target, { timeoutMs: step.timeoutMs }), lookedFor(step.target, noMatch)).pipe(Effect.tap((outcome) => outcome._tag === 'ok'
|
|
296
|
+
? page
|
|
297
|
+
.onScreen(step.target, 'act', { timeoutMs: step.timeoutMs })
|
|
298
|
+
.pipe(Effect.andThen(stepShot(step.target)))
|
|
299
|
+
: Effect.void));
|
|
290
300
|
case 'fill':
|
|
291
301
|
return action(page.fill(step.target, step.value, { timeoutMs: step.timeoutMs }), lookedFor(step.target, noMatch)).pipe(Effect.tap((outcome) => outcome._tag === 'ok'
|
|
292
302
|
? page
|
|
@@ -439,6 +449,7 @@ const runStep = (page, step, jobUrl, capture, stepShot, uploads) => {
|
|
|
439
449
|
};
|
|
440
450
|
/** The element a step acts on, if it has one. */
|
|
441
451
|
const targetOf = (step) => step.action === 'click' ||
|
|
452
|
+
step.action === 'hover' ||
|
|
442
453
|
step.action === 'fill' ||
|
|
443
454
|
step.action === 'upload' ||
|
|
444
455
|
step.action === 'waitFor' ||
|
|
@@ -623,6 +634,7 @@ export const runCase = (page, spec, options) => Effect.gen(function* () {
|
|
|
623
634
|
goto: (url, wait) => traced('goto', page.goto(url, wait)),
|
|
624
635
|
reload: (wait) => traced('reload', page.reload(wait)),
|
|
625
636
|
click: (target, wait) => traced('click', page.click(target, wait)),
|
|
637
|
+
hover: (target, wait) => traced('hover', page.hover(target, wait)),
|
|
626
638
|
fill: (target, value, wait) => traced('fill', page.fill(target, value, wait)),
|
|
627
639
|
upload: (target, files, wait) => traced('upload', page.upload(target, files, wait)),
|
|
628
640
|
press: (key) => traced('press', page.press(key)),
|
|
@@ -655,6 +667,8 @@ export const runCase = (page, spec, options) => Effect.gen(function* () {
|
|
|
655
667
|
if (settled !== undefined)
|
|
656
668
|
return settled;
|
|
657
669
|
current = index + 1 - offset;
|
|
670
|
+
if (options.onStep !== undefined)
|
|
671
|
+
yield* options.onStep(current, step.action);
|
|
658
672
|
acted = undefined;
|
|
659
673
|
measured = undefined;
|
|
660
674
|
const from = Math.round(yield* options.now);
|
package/dist/core/video.d.ts
CHANGED
|
@@ -45,3 +45,9 @@ export declare const frameChanged: (previous: GrayImage, next: GrayImage) => boo
|
|
|
45
45
|
* last frame for a run that lasts to the end. In time order.
|
|
46
46
|
*/
|
|
47
47
|
export declare const stillStretches: (frames: ReadonlyArray<GrayImage>, frameMs: number) => ReadonlyArray<StillStretch>;
|
|
48
|
+
/**
|
|
49
|
+
* `stretches` cut at the end of a video `videoMs` long, leaving out those no longer
|
|
50
|
+
* `STILL_MIN_MS` long. Read back at a constant rate, a video with a frame only where the page
|
|
51
|
+
* changed can run on past its end: ffmpeg shows its last frame as long as the gap before it.
|
|
52
|
+
*/
|
|
53
|
+
export declare const stillWithin: (stretches: ReadonlyArray<StillStretch>, videoMs: number) => ReadonlyArray<StillStretch>;
|