screw-bugs 0.1.6 → 0.1.8
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 +86 -16
- package/dist/browser-playwright/launch.d.ts +4 -2
- package/dist/browser-playwright/launch.js +8 -1
- package/dist/browser-playwright/page.d.ts +2 -2
- package/dist/browser-playwright/page.js +15 -2
- 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 +57 -12
- 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 +549 -118
- package/dist/cli/sign-in.d.ts +22 -10
- package/dist/cli/sign-in.js +23 -23
- package/dist/core/engine.js +67 -17
- package/dist/core/liveness.js +3 -1
- package/dist/core/services.d.ts +30 -5
- 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 +31 -0
- package/dist/core/video.js +132 -0
- package/dist/report/html.d.ts +4 -2
- package/dist/report/html.js +45 -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 +4 -4
- 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.d.ts +16 -5
- package/dist/report/view.js +60 -24
- package/dist/report/walkthrough.d.ts +7 -3
- package/dist/report/walkthrough.js +21 -8
- package/dist/schema/accounts.js +10 -1
- package/dist/schema/evidence.d.ts +30 -8
- package/dist/schema/evidence.js +17 -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 +88 -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/schema/job.js
CHANGED
|
@@ -5,7 +5,9 @@ export const JobId = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-
|
|
|
5
5
|
message: 'A job ID has only letters, digits and dashes',
|
|
6
6
|
})).pipe(Schema.brand('JobId'));
|
|
7
7
|
/** One short line of plain text: not blank, at most `max` characters. */
|
|
8
|
-
export const ShortLine = (max, description) => Schema.String.check(Schema.makeFilter((text) => (text.trim() ? undefined : 'Must not be blank')
|
|
8
|
+
export const ShortLine = (max, description) => Schema.String.check(Schema.makeFilter((text) => (text.trim() ? undefined : 'Must not be blank'), {
|
|
9
|
+
toJsonSchema: () => ({ pattern: '\\S' }),
|
|
10
|
+
}), Schema.isMaxLength(max, { message: `Use at most ${max} characters` })).annotate({
|
|
9
11
|
description: `${description ? `${description} ` : ''}One line, at most ${max} characters.`,
|
|
10
12
|
});
|
|
11
13
|
/**
|
|
@@ -25,6 +27,8 @@ export const Device = Schema.Literals(['desktop', 'mobile']);
|
|
|
25
27
|
*/
|
|
26
28
|
const Slug = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/, {
|
|
27
29
|
message: 'Use 1-64 letters, digits, dots, dashes or underscores, starting with a letter or digit',
|
|
30
|
+
// Effect leaves isPattern out of JSON Schema; this puts it in.
|
|
31
|
+
toJsonSchema: () => ({ pattern: '^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$' }),
|
|
28
32
|
}));
|
|
29
33
|
const targetKeys = ['role', 'text', 'label', 'alt', 'css'];
|
|
30
34
|
/** Ways of finding an element, shared by a step's target and the frames it is in. */
|
|
@@ -43,6 +47,11 @@ const targetFields = {
|
|
|
43
47
|
})),
|
|
44
48
|
css: Schema.optionalKey(Schema.NonEmptyString.annotate({ description: 'A CSS selector.' })),
|
|
45
49
|
};
|
|
50
|
+
/** {@link oneWay} in JSON Schema: exactly one way of finding the element, and name only with role. */
|
|
51
|
+
const oneWayJson = {
|
|
52
|
+
oneOf: targetKeys.map((key) => ({ required: [key] })),
|
|
53
|
+
dependentRequired: { name: ['role'] },
|
|
54
|
+
};
|
|
46
55
|
const oneWay = (target) => {
|
|
47
56
|
const set = targetKeys.filter((key) => target[key] !== undefined);
|
|
48
57
|
if (set.length !== 1)
|
|
@@ -65,7 +74,7 @@ export const FrameTarget = Schema.Struct({
|
|
|
65
74
|
})
|
|
66
75
|
.check(Schema.makeFilter((target) => target.frame !== undefined
|
|
67
76
|
? 'A frame cannot have its own frame; give frames inside frames as a list, outermost first'
|
|
68
|
-
: oneWay(target)))
|
|
77
|
+
: oneWay(target), { toJsonSchema: () => ({ ...oneWayJson, not: { required: ['frame'] } }) }))
|
|
69
78
|
.annotate({
|
|
70
79
|
description: 'The <iframe> element: exactly one of role (optionally with name), text, label, alt or css, such as {"css":"iframe.preview"}.',
|
|
71
80
|
});
|
|
@@ -74,7 +83,7 @@ export const FramePath = Schema.Union([
|
|
|
74
83
|
FrameTarget,
|
|
75
84
|
Schema.Array(FrameTarget).check(Schema.makeFilter((frames) => frames.length >= 1 && frames.length <= FRAME_DEPTH_MAX
|
|
76
85
|
? undefined
|
|
77
|
-
: `Give 1-${FRAME_DEPTH_MAX} frames, outermost first
|
|
86
|
+
: `Give 1-${FRAME_DEPTH_MAX} frames, outermost first`, { toJsonSchema: () => ({ minItems: 1, maxItems: FRAME_DEPTH_MAX }) })),
|
|
78
87
|
]).annotate({
|
|
79
88
|
description: 'Optional: the <iframe> it is in, found like a target, such as {"css":"iframe.preview"}; for ' +
|
|
80
89
|
'frames inside frames, a list, outermost first. Same- and cross-origin frames both work.',
|
|
@@ -84,7 +93,7 @@ export const FramePath = Schema.Union([
|
|
|
84
93
|
* first visible one in page order is used. With `frame`, it is looked for inside that `<iframe>`.
|
|
85
94
|
*/
|
|
86
95
|
export const Target = Schema.Struct({ ...targetFields, frame: Schema.optionalKey(FramePath) })
|
|
87
|
-
.check(Schema.makeFilter(oneWay))
|
|
96
|
+
.check(Schema.makeFilter(oneWay, { toJsonSchema: () => oneWayJson }))
|
|
88
97
|
.annotate({
|
|
89
98
|
description: 'Exactly one of role (optionally with name), text, label, alt or css. The first visible match ' +
|
|
90
99
|
'is used. Add frame to look inside an <iframe>: {"frame":{"css":"iframe.preview"},"text":"Hi"}.',
|
|
@@ -105,9 +114,17 @@ export const TIMEOUT_MIN_MS = 100;
|
|
|
105
114
|
export const TIMEOUT_MAX_MS = 180_000;
|
|
106
115
|
const timeoutMs = (what) => Schema.optionalKey(
|
|
107
116
|
// A plain number checked here, so a fraction gets the same plain error as one out of range.
|
|
108
|
-
|
|
117
|
+
// Finite, not Number: JSON has no NaN or Infinity, and Number's JSON Schema allows them as
|
|
118
|
+
// strings.
|
|
119
|
+
Schema.Finite.check(Schema.makeFilter((ms) => Number.isInteger(ms) && ms >= TIMEOUT_MIN_MS && ms <= TIMEOUT_MAX_MS
|
|
109
120
|
? undefined
|
|
110
|
-
: `timeoutMs must be a whole number of milliseconds from ${TIMEOUT_MIN_MS} to ${TIMEOUT_MAX_MS} (180 s)
|
|
121
|
+
: `timeoutMs must be a whole number of milliseconds from ${TIMEOUT_MIN_MS} to ${TIMEOUT_MAX_MS} (180 s)`, {
|
|
122
|
+
toJsonSchema: () => ({
|
|
123
|
+
type: 'integer',
|
|
124
|
+
minimum: TIMEOUT_MIN_MS,
|
|
125
|
+
maximum: TIMEOUT_MAX_MS,
|
|
126
|
+
}),
|
|
127
|
+
})).annotate({
|
|
111
128
|
description: `Optional, ${TIMEOUT_MIN_MS}-${TIMEOUT_MAX_MS} ms: how long to wait ${what}.`,
|
|
112
129
|
}));
|
|
113
130
|
/** The most files one upload step may give, and the largest a file may be. */
|
|
@@ -195,6 +212,14 @@ export const Step = Schema.Union([
|
|
|
195
212
|
description: 'Click an element. If it opens a page with an HTTP error status, here or in a new tab or ' +
|
|
196
213
|
'window, the case fails. Later steps act on this page, not a new tab.',
|
|
197
214
|
}),
|
|
215
|
+
Schema.Struct({
|
|
216
|
+
action: Schema.Literal('hover'),
|
|
217
|
+
target: Target,
|
|
218
|
+
timeoutMs: timeoutMs('for the element (default 5000)'),
|
|
219
|
+
}).annotate({
|
|
220
|
+
description: 'Move the pointer over an element, for controls that only show on hover, such as a ' +
|
|
221
|
+
"message's Reply button. The pointer stays there until the next action moves it.",
|
|
222
|
+
}),
|
|
198
223
|
Schema.Struct({
|
|
199
224
|
action: Schema.Literal('fill'),
|
|
200
225
|
target: Target,
|
|
@@ -209,7 +234,7 @@ export const Step = Schema.Union([
|
|
|
209
234
|
files: Schema.Array(UploadFile)
|
|
210
235
|
.check(Schema.makeFilter((files) => files.length >= 1 && files.length <= UPLOAD_FILES_MAX
|
|
211
236
|
? undefined
|
|
212
|
-
: `Give 1-${UPLOAD_FILES_MAX} files
|
|
237
|
+
: `Give 1-${UPLOAD_FILES_MAX} files`, { toJsonSchema: () => ({ minItems: 1, maxItems: UPLOAD_FILES_MAX }) }))
|
|
213
238
|
.annotate({
|
|
214
239
|
description: `1-${UPLOAD_FILES_MAX} files, each a path relative to the project (such as ` +
|
|
215
240
|
'fixtures/resume.pdf) or {"path","about"}. You create them, with synthetic content; ' +
|
|
@@ -249,7 +274,7 @@ export const Step = Schema.Union([
|
|
|
249
274
|
})
|
|
250
275
|
.check(Schema.makeFilter((step) => step.target !== undefined && step.frame !== undefined
|
|
251
276
|
? 'With target, give the frame in the target itself'
|
|
252
|
-
: undefined))
|
|
277
|
+
: undefined, { toJsonSchema: () => ({ not: { required: ['target', 'frame'] } }) }))
|
|
253
278
|
.annotate({
|
|
254
279
|
description: 'Expect this text not to show: not as visible text, not as the alt text of an image and ' +
|
|
255
280
|
'not as an ARIA label. Without frame or target, the page and the frames visible in it ' +
|
|
@@ -277,9 +302,16 @@ export const Step = Schema.Union([
|
|
|
277
302
|
})),
|
|
278
303
|
by: Schema.optionalKey(
|
|
279
304
|
// A plain number checked here, so a fraction gets the same plain error as one out of range.
|
|
280
|
-
Schema.
|
|
305
|
+
Schema.Finite.check(Schema.makeFilter((px) => Number.isInteger(px) && px !== 0 && Math.abs(px) <= SCROLL_BY_MAX
|
|
281
306
|
? undefined
|
|
282
|
-
: `by must be a whole number of pixels from -${SCROLL_BY_MAX} to ${SCROLL_BY_MAX}, not 0
|
|
307
|
+
: `by must be a whole number of pixels from -${SCROLL_BY_MAX} to ${SCROLL_BY_MAX}, not 0`, {
|
|
308
|
+
toJsonSchema: () => ({
|
|
309
|
+
type: 'integer',
|
|
310
|
+
minimum: -SCROLL_BY_MAX,
|
|
311
|
+
maximum: SCROLL_BY_MAX,
|
|
312
|
+
not: { const: 0 },
|
|
313
|
+
}),
|
|
314
|
+
})).annotate({
|
|
283
315
|
description: `Scroll the page, or with frame that frame, down this many CSS pixels (negative: up); at most ${SCROLL_BY_MAX}.`,
|
|
284
316
|
})),
|
|
285
317
|
frame: Schema.optionalKey(FramePath),
|
|
@@ -292,6 +324,11 @@ export const Step = Schema.Union([
|
|
|
292
324
|
if (step.target !== undefined && step.frame !== undefined)
|
|
293
325
|
return 'With target, give the frame in the target itself';
|
|
294
326
|
return undefined;
|
|
327
|
+
}, {
|
|
328
|
+
toJsonSchema: () => ({
|
|
329
|
+
oneOf: [{ required: ['target'] }, { required: ['to'] }, { required: ['by'] }],
|
|
330
|
+
not: { required: ['target', 'frame'] },
|
|
331
|
+
}),
|
|
295
332
|
}))
|
|
296
333
|
.annotate({
|
|
297
334
|
description: 'Scroll, then take a screenshot of what is in view: exactly one of target (into view), ' +
|
|
@@ -437,6 +474,18 @@ export const JobSpec = Schema.Struct({
|
|
|
437
474
|
return cases[0]?.continue === true
|
|
438
475
|
? `The first case, "${cases[0].id}", cannot continue: there is no case before it to continue from. Remove "continue" from it, or put the case that sets the page up before it`
|
|
439
476
|
: undefined;
|
|
477
|
+
},
|
|
478
|
+
// Unique IDs have no JSON Schema form (uniqueItems compares whole cases); the first
|
|
479
|
+
// case's continue does.
|
|
480
|
+
{
|
|
481
|
+
toJsonSchema: () => [
|
|
482
|
+
{
|
|
483
|
+
prefixItems: [
|
|
484
|
+
{ not: { required: ['continue'], properties: { continue: { const: true } } } },
|
|
485
|
+
],
|
|
486
|
+
},
|
|
487
|
+
true,
|
|
488
|
+
],
|
|
440
489
|
}))
|
|
441
490
|
.annotate({
|
|
442
491
|
description: 'Cases to run in order. Without cases, one "page loads" case runs.',
|
|
@@ -451,7 +500,10 @@ export const JobSpec = Schema.Struct({
|
|
|
451
500
|
'are saved). A test account to run signed in as: a label from .screw-bugs/accounts.json whose about ' +
|
|
452
501
|
'fits what the cases need (such as a user on a trial, or a paying one), or a new ' +
|
|
453
502
|
'{"label":"paid-user","about":"Pro plan, paying monthly"} for the user to sign in to. ' +
|
|
454
|
-
'
|
|
503
|
+
'Read .screw-bugs/accounts.json first: when the account the cases need is not saved ' +
|
|
504
|
+
'there, get the app running and that user in place (the sign-in opens the app at once), ' +
|
|
505
|
+
'then start the job before the rest of your preparation. Without a saved session ' +
|
|
506
|
+
'nothing starts and the reply gives a link for the user, who signs in while you prepare.',
|
|
455
507
|
})),
|
|
456
508
|
});
|
|
457
509
|
/**
|
package/dist/schema/ledger.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export declare const CaseEntry: Schema.Struct<{
|
|
|
50
50
|
readonly size: Schema.Number;
|
|
51
51
|
}>>>;
|
|
52
52
|
readonly action: Schema.optionalKey<Schema.Struct<{
|
|
53
|
-
readonly kind: Schema.Literals<readonly ["click", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
53
|
+
readonly kind: Schema.Literals<readonly ["click", "hover", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
54
54
|
readonly atMs: Schema.optionalKey<Schema.Number>;
|
|
55
55
|
readonly point: Schema.optionalKey<Schema.Struct<{
|
|
56
56
|
readonly x: Schema.Number;
|
|
@@ -155,6 +155,18 @@ export declare const BrowserRecord: Schema.Struct<{
|
|
|
155
155
|
readonly version: Schema.String;
|
|
156
156
|
}>;
|
|
157
157
|
export type BrowserRecord = typeof BrowserRecord.Type;
|
|
158
|
+
/**
|
|
159
|
+
* Where a running job is: the case (1-based, in job order) and, once it started one, the step
|
|
160
|
+
* running in it, numbered as `CaseEntry.step` numbers steps (0 is the opening navigation), with
|
|
161
|
+
* its action (`click`). Saved with the heartbeat and when a case ends, so it may be a few seconds
|
|
162
|
+
* behind; only a running ledger has it.
|
|
163
|
+
*/
|
|
164
|
+
export declare const RunProgress: Schema.Struct<{
|
|
165
|
+
readonly case: Schema.Int;
|
|
166
|
+
readonly step: Schema.optionalKey<Schema.Int>;
|
|
167
|
+
readonly kind: Schema.optionalKey<Schema.String>;
|
|
168
|
+
}>;
|
|
169
|
+
export type RunProgress = typeof RunProgress.Type;
|
|
158
170
|
/** The running record of every case in a job; the source of truth for status and reports. */
|
|
159
171
|
export declare const CaseLedger: Schema.Struct<{
|
|
160
172
|
readonly jobId: Schema.brand<Schema.String, "JobId">;
|
|
@@ -201,7 +213,7 @@ export declare const CaseLedger: Schema.Struct<{
|
|
|
201
213
|
readonly size: Schema.Number;
|
|
202
214
|
}>>>;
|
|
203
215
|
readonly action: Schema.optionalKey<Schema.Struct<{
|
|
204
|
-
readonly kind: Schema.Literals<readonly ["click", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
216
|
+
readonly kind: Schema.Literals<readonly ["click", "hover", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
205
217
|
readonly atMs: Schema.optionalKey<Schema.Number>;
|
|
206
218
|
readonly point: Schema.optionalKey<Schema.Struct<{
|
|
207
219
|
readonly x: Schema.Number;
|
|
@@ -322,9 +334,19 @@ export declare const CaseLedger: Schema.Struct<{
|
|
|
322
334
|
readonly video: Schema.optionalKey<Schema.String>;
|
|
323
335
|
readonly videoDurationMs: Schema.optionalKey<Schema.Number>;
|
|
324
336
|
readonly videoProblem: Schema.optionalKey<Schema.String>;
|
|
337
|
+
readonly still: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
338
|
+
readonly fromMs: Schema.Number;
|
|
339
|
+
readonly toMs: Schema.Number;
|
|
340
|
+
}>>>;
|
|
325
341
|
}>>>;
|
|
326
342
|
/** The screw-bugs version that ran the job. */
|
|
327
343
|
readonly version: Schema.optionalKey<Schema.String>;
|
|
344
|
+
/** Where the job is while it runs (see `RunProgress`). */
|
|
345
|
+
readonly progress: Schema.optionalKey<Schema.Struct<{
|
|
346
|
+
readonly case: Schema.Int;
|
|
347
|
+
readonly step: Schema.optionalKey<Schema.Int>;
|
|
348
|
+
readonly kind: Schema.optionalKey<Schema.String>;
|
|
349
|
+
}>>;
|
|
328
350
|
}>;
|
|
329
351
|
export type CaseLedger = typeof CaseLedger.Type;
|
|
330
352
|
/**
|
|
@@ -386,10 +408,10 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
386
408
|
readonly steps: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
387
409
|
readonly action: Schema.Literal<"goto">;
|
|
388
410
|
readonly url: Schema.NonEmptyString;
|
|
389
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
411
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
390
412
|
}>, Schema.Struct<{
|
|
391
413
|
readonly action: Schema.Literal<"reload">;
|
|
392
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
414
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
393
415
|
}>, Schema.Struct<{
|
|
394
416
|
readonly action: Schema.Literal<"click">;
|
|
395
417
|
readonly target: Schema.Struct<{
|
|
@@ -417,7 +439,35 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
417
439
|
readonly frame: Schema.optionalKey<Schema.Unknown>;
|
|
418
440
|
}>>]>>;
|
|
419
441
|
}>;
|
|
420
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
442
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
443
|
+
}>, Schema.Struct<{
|
|
444
|
+
readonly action: Schema.Literal<"hover">;
|
|
445
|
+
readonly target: Schema.Struct<{
|
|
446
|
+
readonly role: Schema.optionalKey<Schema.NonEmptyString>;
|
|
447
|
+
readonly name: Schema.optionalKey<Schema.NonEmptyString>;
|
|
448
|
+
readonly text: Schema.optionalKey<Schema.NonEmptyString>;
|
|
449
|
+
readonly label: Schema.optionalKey<Schema.NonEmptyString>;
|
|
450
|
+
readonly alt: Schema.optionalKey<Schema.NonEmptyString>;
|
|
451
|
+
readonly css: Schema.optionalKey<Schema.NonEmptyString>;
|
|
452
|
+
readonly frame: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
453
|
+
readonly role: Schema.optionalKey<Schema.NonEmptyString>;
|
|
454
|
+
readonly name: Schema.optionalKey<Schema.NonEmptyString>;
|
|
455
|
+
readonly text: Schema.optionalKey<Schema.NonEmptyString>;
|
|
456
|
+
readonly label: Schema.optionalKey<Schema.NonEmptyString>;
|
|
457
|
+
readonly alt: Schema.optionalKey<Schema.NonEmptyString>;
|
|
458
|
+
readonly css: Schema.optionalKey<Schema.NonEmptyString>;
|
|
459
|
+
readonly frame: Schema.optionalKey<Schema.Unknown>;
|
|
460
|
+
}>, Schema.$Array<Schema.Struct<{
|
|
461
|
+
readonly role: Schema.optionalKey<Schema.NonEmptyString>;
|
|
462
|
+
readonly name: Schema.optionalKey<Schema.NonEmptyString>;
|
|
463
|
+
readonly text: Schema.optionalKey<Schema.NonEmptyString>;
|
|
464
|
+
readonly label: Schema.optionalKey<Schema.NonEmptyString>;
|
|
465
|
+
readonly alt: Schema.optionalKey<Schema.NonEmptyString>;
|
|
466
|
+
readonly css: Schema.optionalKey<Schema.NonEmptyString>;
|
|
467
|
+
readonly frame: Schema.optionalKey<Schema.Unknown>;
|
|
468
|
+
}>>]>>;
|
|
469
|
+
}>;
|
|
470
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
421
471
|
}>, Schema.Struct<{
|
|
422
472
|
readonly action: Schema.Literal<"fill">;
|
|
423
473
|
readonly target: Schema.Struct<{
|
|
@@ -446,7 +496,7 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
446
496
|
}>>]>>;
|
|
447
497
|
}>;
|
|
448
498
|
readonly value: Schema.String;
|
|
449
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
499
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
450
500
|
}>, Schema.Struct<{
|
|
451
501
|
readonly action: Schema.Literal<"upload">;
|
|
452
502
|
readonly target: Schema.Struct<{
|
|
@@ -479,11 +529,11 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
479
529
|
readonly about: Schema.optionalKey<Schema.String>;
|
|
480
530
|
readonly allowMismatch: Schema.optionalKey<Schema.Boolean>;
|
|
481
531
|
}>]>>;
|
|
482
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
532
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
483
533
|
}>, Schema.Struct<{
|
|
484
534
|
readonly action: Schema.Literal<"press">;
|
|
485
535
|
readonly key: Schema.NonEmptyString;
|
|
486
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
536
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
487
537
|
}>, Schema.Struct<{
|
|
488
538
|
readonly action: Schema.Literal<"expectText">;
|
|
489
539
|
readonly text: Schema.NonEmptyString;
|
|
@@ -504,7 +554,7 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
504
554
|
readonly css: Schema.optionalKey<Schema.NonEmptyString>;
|
|
505
555
|
readonly frame: Schema.optionalKey<Schema.Unknown>;
|
|
506
556
|
}>>]>>;
|
|
507
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
557
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
508
558
|
}>, Schema.Struct<{
|
|
509
559
|
readonly action: Schema.Literal<"expectNoText">;
|
|
510
560
|
readonly text: Schema.NonEmptyString;
|
|
@@ -550,7 +600,7 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
550
600
|
readonly css: Schema.optionalKey<Schema.NonEmptyString>;
|
|
551
601
|
readonly frame: Schema.optionalKey<Schema.Unknown>;
|
|
552
602
|
}>>]>>;
|
|
553
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
603
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
554
604
|
}>, Schema.Struct<{
|
|
555
605
|
readonly action: Schema.Literal<"waitFor">;
|
|
556
606
|
readonly target: Schema.Struct<{
|
|
@@ -579,7 +629,7 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
579
629
|
}>>]>>;
|
|
580
630
|
}>;
|
|
581
631
|
readonly state: Schema.optionalKey<Schema.Literals<readonly ["visible", "hidden", "attached", "detached"]>>;
|
|
582
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
632
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
583
633
|
}>, Schema.Struct<{
|
|
584
634
|
readonly action: Schema.Literal<"scroll">;
|
|
585
635
|
readonly target: Schema.optionalKey<Schema.Struct<{
|
|
@@ -608,7 +658,7 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
608
658
|
}>>]>>;
|
|
609
659
|
}>>;
|
|
610
660
|
readonly to: Schema.optionalKey<Schema.Literals<readonly ["top", "bottom"]>>;
|
|
611
|
-
readonly by: Schema.optionalKey<Schema.
|
|
661
|
+
readonly by: Schema.optionalKey<Schema.Finite>;
|
|
612
662
|
readonly frame: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
613
663
|
readonly role: Schema.optionalKey<Schema.NonEmptyString>;
|
|
614
664
|
readonly name: Schema.optionalKey<Schema.NonEmptyString>;
|
|
@@ -626,11 +676,11 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
626
676
|
readonly css: Schema.optionalKey<Schema.NonEmptyString>;
|
|
627
677
|
readonly frame: Schema.optionalKey<Schema.Unknown>;
|
|
628
678
|
}>>]>>;
|
|
629
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
679
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
630
680
|
}>, Schema.Struct<{
|
|
631
681
|
readonly action: Schema.Literal<"expectUrl">;
|
|
632
682
|
readonly includes: Schema.NonEmptyString;
|
|
633
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
683
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
634
684
|
}>, Schema.Struct<{
|
|
635
685
|
readonly action: Schema.Literal<"expectLink">;
|
|
636
686
|
readonly target: Schema.Struct<{
|
|
@@ -660,7 +710,7 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
660
710
|
}>;
|
|
661
711
|
readonly href: Schema.NonEmptyString;
|
|
662
712
|
readonly match: Schema.optionalKey<Schema.Literals<readonly ["contains", "exact"]>>;
|
|
663
|
-
readonly timeoutMs: Schema.optionalKey<Schema.
|
|
713
|
+
readonly timeoutMs: Schema.optionalKey<Schema.Finite>;
|
|
664
714
|
}>, Schema.Struct<{
|
|
665
715
|
readonly action: Schema.Literal<"screenshot">;
|
|
666
716
|
readonly name: Schema.String;
|
|
@@ -720,7 +770,7 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
720
770
|
readonly size: Schema.Number;
|
|
721
771
|
}>>>;
|
|
722
772
|
readonly action: Schema.optionalKey<Schema.Struct<{
|
|
723
|
-
readonly kind: Schema.Literals<readonly ["click", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
773
|
+
readonly kind: Schema.Literals<readonly ["click", "hover", "fill", "upload", "press", "scroll", "goto", "reload"]>;
|
|
724
774
|
readonly atMs: Schema.optionalKey<Schema.Number>;
|
|
725
775
|
readonly point: Schema.optionalKey<Schema.Struct<{
|
|
726
776
|
readonly x: Schema.Number;
|
|
@@ -841,9 +891,19 @@ export declare const ReportBundle: Schema.Struct<{
|
|
|
841
891
|
readonly video: Schema.optionalKey<Schema.String>;
|
|
842
892
|
readonly videoDurationMs: Schema.optionalKey<Schema.Number>;
|
|
843
893
|
readonly videoProblem: Schema.optionalKey<Schema.String>;
|
|
894
|
+
readonly still: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
895
|
+
readonly fromMs: Schema.Number;
|
|
896
|
+
readonly toMs: Schema.Number;
|
|
897
|
+
}>>>;
|
|
844
898
|
}>>>;
|
|
845
899
|
/** The screw-bugs version that ran the job. */
|
|
846
900
|
readonly version: Schema.optionalKey<Schema.String>;
|
|
901
|
+
/** Where the job is while it runs (see `RunProgress`). */
|
|
902
|
+
readonly progress: Schema.optionalKey<Schema.Struct<{
|
|
903
|
+
readonly case: Schema.Int;
|
|
904
|
+
readonly step: Schema.optionalKey<Schema.Int>;
|
|
905
|
+
readonly kind: Schema.optionalKey<Schema.String>;
|
|
906
|
+
}>>;
|
|
847
907
|
}>;
|
|
848
908
|
readonly startedAt: Schema.String;
|
|
849
909
|
readonly finishedAt: Schema.optionalKey<Schema.String>;
|
|
@@ -992,6 +1052,12 @@ export declare const runFiles: {
|
|
|
992
1052
|
* `report.html`, by whoever writes that, never by itself or with `report-interrupted.html`.
|
|
993
1053
|
*/
|
|
994
1054
|
readonly walkthrough: 'walkthrough.html';
|
|
1055
|
+
/**
|
|
1056
|
+
* The page a person watches a run on while it goes: written only by the run, when it starts and
|
|
1057
|
+
* with every ledger write, refreshing itself while the run is going; its last write links the
|
|
1058
|
+
* report (and the walkthrough). Never the report, and nothing else reads it.
|
|
1059
|
+
*/
|
|
1060
|
+
readonly live: 'live.html';
|
|
995
1061
|
readonly evidenceDir: 'evidence';
|
|
996
1062
|
/** The evidence pack of an ended run, written by the run. */
|
|
997
1063
|
readonly evidence: 'evidence.json';
|
|
@@ -1050,3 +1116,9 @@ export type JudgedLedger = Omit<CaseLedger, 'cases'> & {
|
|
|
1050
1116
|
* code's statuses.
|
|
1051
1117
|
*/
|
|
1052
1118
|
export declare const judgedLedger: (ledger: CaseLedger, findings: Findings | undefined) => JudgedLedger;
|
|
1119
|
+
/**
|
|
1120
|
+
* Where a running job is, in words: `case 2 of 3 (reply-maya), step 4 (click)`, or without the
|
|
1121
|
+
* step before its case started one. Undefined unless the ledger is running and has a progress
|
|
1122
|
+
* that names one of its cases.
|
|
1123
|
+
*/
|
|
1124
|
+
export declare const progressText: (ledger: Pick<CaseLedger, 'state' | 'cases' | 'progress'>) => string | undefined;
|
package/dist/schema/ledger.js
CHANGED
|
@@ -59,6 +59,17 @@ export const BrowserRecord = Schema.Struct({
|
|
|
59
59
|
channel: Schema.optionalKey(Schema.String),
|
|
60
60
|
version: Schema.String,
|
|
61
61
|
});
|
|
62
|
+
/**
|
|
63
|
+
* Where a running job is: the case (1-based, in job order) and, once it started one, the step
|
|
64
|
+
* running in it, numbered as `CaseEntry.step` numbers steps (0 is the opening navigation), with
|
|
65
|
+
* its action (`click`). Saved with the heartbeat and when a case ends, so it may be a few seconds
|
|
66
|
+
* behind; only a running ledger has it.
|
|
67
|
+
*/
|
|
68
|
+
export const RunProgress = Schema.Struct({
|
|
69
|
+
case: Schema.Int,
|
|
70
|
+
step: Schema.optionalKey(Schema.Int),
|
|
71
|
+
kind: Schema.optionalKey(Schema.String),
|
|
72
|
+
});
|
|
62
73
|
/** The running record of every case in a job; the source of truth for status and reports. */
|
|
63
74
|
export const CaseLedger = Schema.Struct({
|
|
64
75
|
jobId: JobId,
|
|
@@ -83,6 +94,8 @@ export const CaseLedger = Schema.Struct({
|
|
|
83
94
|
sessions: Schema.optionalKey(Schema.Array(Session)),
|
|
84
95
|
/** The screw-bugs version that ran the job. */
|
|
85
96
|
version: Schema.optionalKey(Schema.String),
|
|
97
|
+
/** Where the job is while it runs (see `RunProgress`). */
|
|
98
|
+
progress: Schema.optionalKey(RunProgress),
|
|
86
99
|
});
|
|
87
100
|
/**
|
|
88
101
|
* A highlight of the agent's findings as the report draws it: its box on the screenshot, or in
|
|
@@ -170,6 +183,12 @@ export const runFiles = {
|
|
|
170
183
|
* `report.html`, by whoever writes that, never by itself or with `report-interrupted.html`.
|
|
171
184
|
*/
|
|
172
185
|
walkthrough: 'walkthrough.html',
|
|
186
|
+
/**
|
|
187
|
+
* The page a person watches a run on while it goes: written only by the run, when it starts and
|
|
188
|
+
* with every ledger write, refreshing itself while the run is going; its last write links the
|
|
189
|
+
* report (and the walkthrough). Never the report, and nothing else reads it.
|
|
190
|
+
*/
|
|
191
|
+
live: 'live.html',
|
|
173
192
|
evidenceDir: 'evidence',
|
|
174
193
|
/** The evidence pack of an ended run, written by the run. */
|
|
175
194
|
evidence: 'evidence.json',
|
|
@@ -247,3 +266,20 @@ export const judgedLedger = (ledger, findings) => {
|
|
|
247
266
|
const failures = agentFailures(findings);
|
|
248
267
|
return { ...ledger, cases: ledger.cases.map((entry) => judgedCase(entry, failures)) };
|
|
249
268
|
};
|
|
269
|
+
/**
|
|
270
|
+
* Where a running job is, in words: `case 2 of 3 (reply-maya), step 4 (click)`, or without the
|
|
271
|
+
* step before its case started one. Undefined unless the ledger is running and has a progress
|
|
272
|
+
* that names one of its cases.
|
|
273
|
+
*/
|
|
274
|
+
export const progressText = (ledger) => {
|
|
275
|
+
const { progress } = ledger;
|
|
276
|
+
if (ledger.state !== 'running' || progress === undefined)
|
|
277
|
+
return undefined;
|
|
278
|
+
const entry = ledger.cases[progress.case - 1];
|
|
279
|
+
if (entry === undefined)
|
|
280
|
+
return undefined;
|
|
281
|
+
const where = `case ${progress.case} of ${ledger.cases.length} (${entry.id})`;
|
|
282
|
+
return progress.step === undefined
|
|
283
|
+
? where
|
|
284
|
+
: `${where}, step ${progress.step}${progress.kind !== undefined ? ` (${progress.kind})` : ''}`;
|
|
285
|
+
};
|
package/dist/schema/share.d.ts
CHANGED
|
@@ -36,3 +36,20 @@ export declare const ShareErrorReply: Schema.Struct<{
|
|
|
36
36
|
readonly message: Schema.String;
|
|
37
37
|
}>;
|
|
38
38
|
export type ShareErrorReply = typeof ShareErrorReply.Type;
|
|
39
|
+
/** Cloud's reply to a new share request. */
|
|
40
|
+
export declare const ShareRequestCreated: Schema.Struct<{
|
|
41
|
+
readonly id: Schema.String;
|
|
42
|
+
/** The pairing code the person types on Cloud, such as `K7QM-4MDX`. */
|
|
43
|
+
readonly code: Schema.String;
|
|
44
|
+
readonly confirmUrl: Schema.String;
|
|
45
|
+
/** Seconds to wait between claims. */
|
|
46
|
+
readonly interval: Schema.Number;
|
|
47
|
+
readonly expiresAt: Schema.String;
|
|
48
|
+
}>;
|
|
49
|
+
export type ShareRequestCreated = typeof ShareRequestCreated.Type;
|
|
50
|
+
/** Cloud's reply to a claim once the person confirmed: the ticket, and where to upload. */
|
|
51
|
+
export declare const ShareClaimed: Schema.Struct<{
|
|
52
|
+
readonly ticket: Schema.String;
|
|
53
|
+
readonly api: Schema.String;
|
|
54
|
+
}>;
|
|
55
|
+
export type ShareClaimed = typeof ShareClaimed.Type;
|
package/dist/schema/share.js
CHANGED
|
@@ -40,3 +40,25 @@ export const CompletedShare = Schema.Struct({
|
|
|
40
40
|
});
|
|
41
41
|
/** Every error reply of Cloud: a stable code and one sentence for people. */
|
|
42
42
|
export const ShareErrorReply = Schema.Struct({ error: Schema.String, message: Schema.String });
|
|
43
|
+
/*
|
|
44
|
+
* The hand-off for a report opened from another device (`http://pop-os:<port>`, over a tailnet),
|
|
45
|
+
* where Cloud cannot send the browser back to a loopback callback. As `stripe login` does: the
|
|
46
|
+
* local server asks Cloud for a share request with the SHA-256 of a secret it keeps
|
|
47
|
+
* (`POST /api/share-requests`), shows the person the request's pairing code and sends them to
|
|
48
|
+
* `confirmUrl`, where they type the code and confirm; meanwhile it claims the request with the
|
|
49
|
+
* secret (`POST /api/share-requests/<id>/claim`) every `interval` seconds until Cloud gives the
|
|
50
|
+
* ticket, then uploads as above. Only the server that will receive the ticket shows the code, so
|
|
51
|
+
* a link someone else made cannot get a ticket into the person's account.
|
|
52
|
+
*/
|
|
53
|
+
/** Cloud's reply to a new share request. */
|
|
54
|
+
export const ShareRequestCreated = Schema.Struct({
|
|
55
|
+
id: ShareTicket,
|
|
56
|
+
/** The pairing code the person types on Cloud, such as `K7QM-4MDX`. */
|
|
57
|
+
code: Schema.String.check(Schema.makeFilter((text) => /^[A-Z0-9]{4}-[A-Z0-9]{4}$/.test(text) ? undefined : 'Must look like ABCD-EFGH')),
|
|
58
|
+
confirmUrl: Schema.String,
|
|
59
|
+
/** Seconds to wait between claims. */
|
|
60
|
+
interval: Schema.Number,
|
|
61
|
+
expiresAt: Schema.String,
|
|
62
|
+
});
|
|
63
|
+
/** Cloud's reply to a claim once the person confirmed: the ticket, and where to upload. */
|
|
64
|
+
export const ShareClaimed = Schema.Struct({ ticket: ShareTicket, api: Schema.String });
|