screw-bugs 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -6
- package/dist/browser-playwright/launch.d.ts +4 -2
- package/dist/browser-playwright/launch.js +8 -1
- package/dist/browser-playwright/still.d.ts +12 -0
- package/dist/browser-playwright/still.js +51 -0
- package/dist/build-info.json +3 -3
- package/dist/cli/app.d.ts +1 -1
- package/dist/cli/commands.js +45 -20
- package/dist/cli/mcp.d.ts +13 -7
- package/dist/cli/mcp.js +55 -12
- package/dist/cli/operations.d.ts +12 -2
- package/dist/cli/operations.js +20 -2
- package/dist/cli/share.js +10 -10
- package/dist/core/engine.js +22 -7
- package/dist/core/services.d.ts +6 -1
- package/dist/core/video.d.ts +31 -0
- package/dist/core/video.js +132 -0
- package/dist/report/html.d.ts +1 -1
- package/dist/report/html.js +38 -11
- package/dist/report/menu-bar.js +1 -1
- package/dist/report/player.d.ts +18 -2
- package/dist/report/player.js +54 -5
- package/dist/report/pr-summary.d.ts +1 -1
- package/dist/report/pr-summary.js +13 -4
- package/dist/report/sign-in.d.ts +1 -1
- package/dist/report/sign-in.js +37 -8
- package/dist/report/styles.js +8 -0
- package/dist/report/view.d.ts +25 -5
- package/dist/report/view.js +74 -30
- package/dist/report/walkthrough.d.ts +5 -3
- package/dist/report/walkthrough.js +29 -12
- package/dist/schema/evidence.d.ts +15 -0
- package/dist/schema/evidence.js +8 -0
- package/dist/schema/findings.d.ts +2 -0
- package/dist/schema/findings.js +8 -2
- package/dist/schema/ledger.d.ts +38 -0
- package/dist/schema/ledger.js +24 -0
- package/package.json +1 -1
package/dist/report/view.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type Box, type CaseEntry, type CaseFindings, type CaseSpec, type CaseStatus, type PlacedMark, type ReportBundle, type Session, type Severity, type Shot, type Step, type StepTiming } from '../schema/index.js';
|
|
2
2
|
export declare const statuses: ReadonlyArray<CaseStatus>;
|
|
3
3
|
export declare const statusLabel: Record<CaseStatus, string>;
|
|
4
|
+
/**
|
|
5
|
+
* The code's result, shown under the agent's verdict on a case its findings mark failed:
|
|
6
|
+
* `Checks passed`, `Checks: blocked`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const checksNote: (status: CaseStatus) => string;
|
|
4
9
|
export declare const countsOf: (cases: ReadonlyArray<CaseEntry>) => Record<CaseStatus, number>;
|
|
5
10
|
/** A piece of a step's description: plain words, a quoted value, or code (URLs, keys, CSS). */
|
|
6
11
|
export type TextPart = {
|
|
@@ -72,6 +77,10 @@ export interface CaseView {
|
|
|
72
77
|
readonly otherShots: ReadonlyArray<ShotView>;
|
|
73
78
|
/** The agent's write-up of this case, if it gave one. */
|
|
74
79
|
readonly findings: CaseFindings | undefined;
|
|
80
|
+
/** The status the run's code gave the case; `entry.status` is the one results show. */
|
|
81
|
+
readonly checkStatus: CaseStatus;
|
|
82
|
+
/** What is wrong, when the agent's findings mark the case failed (see `judgedCase`). */
|
|
83
|
+
readonly agentFailed: string | undefined;
|
|
75
84
|
readonly video: VideoView | undefined;
|
|
76
85
|
}
|
|
77
86
|
/** The video of `entry`'s session, if the run had sessions. */
|
|
@@ -193,7 +202,7 @@ export interface UrlPoint {
|
|
|
193
202
|
export declare const urlTimeline: (bundle: ReportBundle, views?: ReadonlyArray<CaseView>) => ReadonlyArray<UrlPoint>;
|
|
194
203
|
/** The address at `ms` into a session's video: the last one recorded by then, if any. */
|
|
195
204
|
export declare const urlAt: (points: ReadonlyArray<UrlPoint>, session: number, ms: number) => string | undefined;
|
|
196
|
-
/** A stretch of a session's video in which
|
|
205
|
+
/** A stretch of a session's video in which nothing happened: what "Skip inactive" jumps over. */
|
|
197
206
|
export interface IdleStretch {
|
|
198
207
|
readonly session: number;
|
|
199
208
|
readonly fromMs: number;
|
|
@@ -204,10 +213,21 @@ export declare const IDLE_MIN_MS = 1500;
|
|
|
204
213
|
/** How much of an idle stretch is still played at either end, so a step's result can be seen. */
|
|
205
214
|
export declare const IDLE_MARGIN_MS = 300;
|
|
206
215
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
|
|
216
|
+
* Around a recorded action (a press of the mouse or a key) the video is never idle, even where
|
|
217
|
+
* it stands still: the walkthrough's cursor glides to it before (`GLIDE_S`) and its ripple and
|
|
218
|
+
* label show after.
|
|
219
|
+
*/
|
|
220
|
+
export declare const ACTION_BEFORE_MS = 600;
|
|
221
|
+
export declare const ACTION_AFTER_MS = 1500;
|
|
222
|
+
/**
|
|
223
|
+
* The stretches of each session's video where nothing happened, at least `IDLE_MIN_MS` long once
|
|
224
|
+
* `IDLE_MARGIN_MS` is kept at either end (none at the very start of the video). Where the run
|
|
225
|
+
* measured its video (`Session.still`), they are where its picture stood still, even while a step
|
|
226
|
+
* waited, except around each recorded action (`ACTION_BEFORE_MS`, `ACTION_AFTER_MS`; the whole
|
|
227
|
+
* step for an action recorded without a time, whose label shows while its step plays). For an
|
|
228
|
+
* older run they are where no step ran: before the first step, between steps and after the last
|
|
229
|
+
* one (to the end of the video, when its length is known); there a step that waited is not idle,
|
|
230
|
+
* since what it waited for may show at any moment.
|
|
211
231
|
*/
|
|
212
232
|
export declare const idleStretches: (bundle: ReportBundle) => ReadonlyArray<IdleStretch>;
|
|
213
233
|
/**
|
package/dist/report/view.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateTime, Duration, Option } from 'effect';
|
|
2
2
|
import { clipBox, drawableAction, drawableShot, MISMATCH_ALLOWED, withStartPage, } from '../core/index.js';
|
|
3
|
-
import { casesOf, framesOf, baseName, customTimeoutOf, uploadFileOf, } from '../schema/index.js';
|
|
3
|
+
import { casesOf, framesOf, agentFailures, baseName, judgedCase, judgedLedger, customTimeoutOf, uploadFileOf, } from '../schema/index.js';
|
|
4
4
|
/* What both reports show, worked out once. Plain data: escaping is each format's job. */
|
|
5
5
|
export const statuses = ['passed', 'failed', 'blocked', 'not_verified'];
|
|
6
6
|
export const statusLabel = {
|
|
@@ -9,6 +9,11 @@ export const statusLabel = {
|
|
|
9
9
|
blocked: 'Blocked',
|
|
10
10
|
not_verified: 'Not verified',
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* The code's result, shown under the agent's verdict on a case its findings mark failed:
|
|
14
|
+
* `Checks passed`, `Checks: blocked`.
|
|
15
|
+
*/
|
|
16
|
+
export const checksNote = (status) => status === 'passed' ? 'Checks passed' : `Checks: ${statusLabel[status].toLowerCase()}`;
|
|
12
17
|
export const countsOf = (cases) => {
|
|
13
18
|
const counts = { passed: 0, failed: 0, blocked: 0, not_verified: 0 };
|
|
14
19
|
for (const c of cases)
|
|
@@ -202,8 +207,11 @@ const drawableEntry = (entry, device) => ({
|
|
|
202
207
|
export const caseViews = (bundle) => {
|
|
203
208
|
const specs = new Map(casesOf(bundle.spec).map((spec) => [spec.id, spec]));
|
|
204
209
|
const written = new Map((bundle.findings?.cases ?? []).map((c) => [c.id, c]));
|
|
210
|
+
const failures = agentFailures(bundle.findings);
|
|
205
211
|
return bundle.ledger.cases.map((recorded) => {
|
|
206
|
-
|
|
212
|
+
// Steps and screenshots are as the code ran them; the status is the one results show.
|
|
213
|
+
const checked = drawableEntry(recorded, bundle.device.kind);
|
|
214
|
+
const { checkStatus, agentFailed, ...entry } = judgedCase(checked, failures);
|
|
207
215
|
const spec = specs.get(entry.id);
|
|
208
216
|
const steps = spec ? withStartPage(spec, bundle.spec.url) : [];
|
|
209
217
|
const offset = spec ? steps.length - spec.steps.length : 0;
|
|
@@ -218,7 +226,7 @@ export const caseViews = (bundle) => {
|
|
|
218
226
|
elements: (shot && bundle.elements?.[shot.id]) ?? [],
|
|
219
227
|
};
|
|
220
228
|
});
|
|
221
|
-
const failurePath = entry.evidence.findLast((path) => records.get(path)?.kind === 'failure' || isFailureShot(
|
|
229
|
+
const failurePath = entry.evidence.findLast((path) => records.get(path)?.kind === 'failure' || isFailureShot(checked, path));
|
|
222
230
|
return {
|
|
223
231
|
entry,
|
|
224
232
|
spec,
|
|
@@ -226,12 +234,14 @@ export const caseViews = (bundle) => {
|
|
|
226
234
|
index: i + 1 - offset,
|
|
227
235
|
step,
|
|
228
236
|
implicit: i < offset,
|
|
229
|
-
state: stateOf(
|
|
237
|
+
state: stateOf(checked, i + 1 - offset),
|
|
230
238
|
timing: timings.get(i + 1 - offset),
|
|
231
239
|
})),
|
|
232
240
|
failureShot: shots.find((s) => s.path === failurePath),
|
|
233
241
|
otherShots: shots.filter((s) => s.path !== failurePath),
|
|
234
242
|
findings: written.get(entry.id),
|
|
243
|
+
checkStatus,
|
|
244
|
+
agentFailed,
|
|
235
245
|
video: videoOf(bundle, entry),
|
|
236
246
|
};
|
|
237
247
|
});
|
|
@@ -503,35 +513,69 @@ export const IDLE_MIN_MS = 1500;
|
|
|
503
513
|
/** How much of an idle stretch is still played at either end, so a step's result can be seen. */
|
|
504
514
|
export const IDLE_MARGIN_MS = 300;
|
|
505
515
|
/**
|
|
506
|
-
*
|
|
507
|
-
*
|
|
508
|
-
*
|
|
509
|
-
|
|
516
|
+
* Around a recorded action (a press of the mouse or a key) the video is never idle, even where
|
|
517
|
+
* it stands still: the walkthrough's cursor glides to it before (`GLIDE_S`) and its ripple and
|
|
518
|
+
* label show after.
|
|
519
|
+
*/
|
|
520
|
+
export const ACTION_BEFORE_MS = 600;
|
|
521
|
+
export const ACTION_AFTER_MS = 1500;
|
|
522
|
+
/** `spans` with every part `busy` covers taken out; both in time order or not. */
|
|
523
|
+
const without = (spans, busy) => busy.reduce((left, [b0, b1]) => left.flatMap(([a0, a1]) => b1 <= a0 || b0 >= a1
|
|
524
|
+
? [[a0, a1]]
|
|
525
|
+
: [...(b0 > a0 ? [[a0, b0]] : []), ...(b1 < a1 ? [[b1, a1]] : [])]), spans);
|
|
526
|
+
/**
|
|
527
|
+
* The stretches of each session's video where nothing happened, at least `IDLE_MIN_MS` long once
|
|
528
|
+
* `IDLE_MARGIN_MS` is kept at either end (none at the very start of the video). Where the run
|
|
529
|
+
* measured its video (`Session.still`), they are where its picture stood still, even while a step
|
|
530
|
+
* waited, except around each recorded action (`ACTION_BEFORE_MS`, `ACTION_AFTER_MS`; the whole
|
|
531
|
+
* step for an action recorded without a time, whose label shows while its step plays). For an
|
|
532
|
+
* older run they are where no step ran: before the first step, between steps and after the last
|
|
533
|
+
* one (to the end of the video, when its length is known); there a step that waited is not idle,
|
|
534
|
+
* since what it waited for may show at any moment.
|
|
510
535
|
*/
|
|
511
536
|
export const idleStretches = (bundle) => {
|
|
512
|
-
const
|
|
513
|
-
|
|
537
|
+
const steps = new Map();
|
|
538
|
+
const actions = new Map();
|
|
539
|
+
for (const entry of bundle.ledger.cases) {
|
|
540
|
+
const session = sessionNumber(entry);
|
|
514
541
|
for (const s of entry.steps ?? []) {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
542
|
+
steps.set(session, [
|
|
543
|
+
...(steps.get(session) ?? []),
|
|
544
|
+
[s.startMs, Math.max(s.startMs, s.endMs)],
|
|
545
|
+
]);
|
|
546
|
+
if (s.action === undefined)
|
|
547
|
+
continue;
|
|
548
|
+
const at = s.action.atMs;
|
|
549
|
+
// An action whose input was not seen (a fill, a frame's click) is labelled while its step
|
|
550
|
+
// plays: all of that step is kept.
|
|
551
|
+
const busy = at !== undefined
|
|
552
|
+
? [at - ACTION_BEFORE_MS, at + ACTION_AFTER_MS]
|
|
553
|
+
: [s.startMs, Math.max(s.startMs, s.endMs)];
|
|
554
|
+
actions.set(session, [...(actions.get(session) ?? []), busy]);
|
|
518
555
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
556
|
+
}
|
|
557
|
+
const measured = new Map((bundle.ledger.sessions ?? []).flatMap((s) => s.still !== undefined ? [[s.number, s.still]] : []));
|
|
558
|
+
const sessions = [...new Set([...steps.keys(), ...measured.keys()])].toSorted((a, b) => a - b);
|
|
559
|
+
return sessions.flatMap((session) => {
|
|
560
|
+
const still = measured.get(session);
|
|
561
|
+
const gaps = still !== undefined
|
|
562
|
+
? without(still.map((s) => [s.fromMs, s.toMs]), actions.get(session) ?? [])
|
|
563
|
+
: (() => {
|
|
564
|
+
const sorted = (steps.get(session) ?? []).toSorted((a, b) => a[0] - b[0]);
|
|
565
|
+
const found = [];
|
|
566
|
+
let at = 0;
|
|
567
|
+
for (const [start, end] of sorted) {
|
|
568
|
+
if (start > at)
|
|
569
|
+
found.push([at, start]);
|
|
570
|
+
at = Math.max(at, end);
|
|
571
|
+
}
|
|
572
|
+
const length = sessionLength(bundle, session);
|
|
573
|
+
if (length !== undefined && length > at)
|
|
574
|
+
found.push([at, length]);
|
|
575
|
+
return found;
|
|
576
|
+
})();
|
|
533
577
|
return gaps.flatMap(([from, to]) => {
|
|
534
|
-
const [a, b] = [from
|
|
578
|
+
const [a, b] = [from <= 0 ? 0 : from + IDLE_MARGIN_MS, to - IDLE_MARGIN_MS];
|
|
535
579
|
return b - a >= IDLE_MIN_MS ? [{ session, fromMs: a, toMs: b }] : [];
|
|
536
580
|
});
|
|
537
581
|
});
|
|
@@ -614,7 +658,7 @@ export const reportHeading = (bundle) => {
|
|
|
614
658
|
* `7 of 7 cases passed · 3 areas not tested`, never that all passed.
|
|
615
659
|
*/
|
|
616
660
|
export const verdictOf = (bundle) => {
|
|
617
|
-
const { cases, state } = bundle.ledger;
|
|
661
|
+
const { cases, state } = judgedLedger(bundle.ledger, bundle.findings);
|
|
618
662
|
const passed = cases.filter((c) => c.status === 'passed').length;
|
|
619
663
|
if (state !== 'finished' && state !== 'errored')
|
|
620
664
|
return `In progress: ${passed} of ${cases.length} passed so far`;
|
|
@@ -626,7 +670,7 @@ export const verdictOf = (bundle) => {
|
|
|
626
670
|
/** `2 failed`, `1 not verified`: a count of cases with a status, as the filters say it. */
|
|
627
671
|
export const countWords = (status, n) => `${n} ${statusLabel[status].toLowerCase()}`;
|
|
628
672
|
export const evaluationOf = (bundle) => {
|
|
629
|
-
const counts = countsOf(bundle.ledger.cases);
|
|
673
|
+
const counts = countsOf(judgedLedger(bundle.ledger, bundle.findings).cases);
|
|
630
674
|
const line = statuses
|
|
631
675
|
.filter((s) => s !== 'passed' && counts[s] > 0)
|
|
632
676
|
.map((s) => countWords(s, counts[s]))
|
|
@@ -19,7 +19,8 @@ export declare const GLIDE_S = 0.6;
|
|
|
19
19
|
* the reader prefers less; the top row that shows, below the top bar and, on a narrow screen, the
|
|
20
20
|
* pinned player and its fade, when the page has scrolled the script under them), draws the box of the element it acted on over the video while that was
|
|
21
21
|
* measured, makes timecodes and rows seek (and switch session videos) instead of opening the file,
|
|
22
|
-
* and, with "Skip inactive" on, jumps over the stretches where
|
|
22
|
+
* and, with "Skip inactive" on (remembered like the theme), jumps over the stretches where
|
|
23
|
+
* nothing happened (`idleStretches`) while it plays.
|
|
23
24
|
* "Expand" shows the whole script and makes the video smaller. Fullscreen takes the whole page
|
|
24
25
|
* (`.wt`), not only the video; on a wide screen (a desktop) it never takes the browser's screen,
|
|
25
26
|
* only lays the page out again (`.focus`, see `PLAYER_JS`): the top bar, the video as big as fits with its address over it and
|
|
@@ -40,7 +41,7 @@ export declare const GLIDE_S = 0.6;
|
|
|
40
41
|
* and there is no ripple. A "Cursor" switch turns it off, remembered like the theme. Nothing is
|
|
41
42
|
* added to the page under test or to the video.
|
|
42
43
|
*/
|
|
43
|
-
export declare const WALKTHROUGH_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),empty=d.getElementById(p+'-none');let cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{if(!v.error)return;dead.add(cur);if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();\n const stg=d.querySelector('.wt-stage');let fr=0;\n const fit=()=>{fr=0;if(!stg)return;const t=stg.getBoundingClientRect().top;stg.style.setProperty('--wt-top',Math.round(t)+'px');stg.style.setProperty('--wt-y',Math.round(t+scrollY)+'px')};\n const refit=()=>{if(!fr)fr=requestAnimationFrame(fit)};\n fit();addEventListener('resize',refit);addEventListener('load',refit);addEventListener('scroll',refit,{passive:true});d.addEventListener('fullscreenchange',refit);\n if(window.ResizeObserver)new ResizeObserver(refit).observe(d.body);\n const v=d.getElementById('wt-video');if(!v)return;\n const w=d.querySelector('.wt'),panel=d.getElementById('wt-script'),box=d.getElementById('wt-box'),cap=d.getElementById('wt-cap');\n const say=a=>{const x=a&&a.querySelector('.wt-text');cap.replaceChildren(...(x?[...x.childNodes].filter(n=>!(n instanceof Element&&n.classList.contains('wt-state'))).map(n=>n.cloneNode(true)):[]));cap.hidden=!x};\n const steps=[...d.querySelectorAll('.wt-step[data-t]')];\n const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));\n const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');\n let on=null,skip=!!skipB&&skipB.getAttribute('aria-pressed')==='true',P=null;\n w.classList.add('live');\n const hide=()=>{box.hidden=true};\n const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};\n const put=(e,x,y,bw,bh)=>{e.style.left=x+'px';e.style.top=y+'px';if(bw!==undefined){e.style.width=bw+'px';e.style.height=bh+'px'}};\n const draw=(t,g)=>{if(P.down()!==null||!g||!on||!on.dataset.box||t<Number(on.dataset.b0)||t>Number(on.dataset.b1))return hide();const b=on.dataset.box.split(' ').map(Number);put(box,g.x+b[0]*g.w,g.y+b[1]*g.h,b[2]*g.w,b[3]*g.h);box.querySelector('span').textContent=on.dataset.label||'';box.hidden=false};\n const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';\n const nums=x=>x?x.split(' ').map(Number):null;\n const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));\n let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}\n const fx=(t,g)=>{\n C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;\n if(!fon||P.down()!==null||!g)return;\n const m=still(),mine=acts.filter(a=>a.s===P.cur()),ptr=mine.filter(a=>a.p),xy=p=>[g.x+p[0]*g.w,g.y+p[1]*g.h];\n let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});\n const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;\n if(n&&a){const gw=Math.min(0.6,n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}\n if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}\n if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}\n let f=null,l=null,u=null;\n for(const x of mine){if(x.k==='fill'&&x.b&&t>=x.b0&&t<=x.b1)f=x;if(x.k==='fill'||!(x.at>=0)?t>=x.t0&&t<=x.t1:t>=x.at&&t<=x.at+1.5)l=x;else if(!u&&x.p&&x.at>t&&x.at-t<=0.6)u=x}\n l=l||u;\n if(f){const xy2=xy(f.b);put(G,xy2[0],xy2[1],f.b[2]*g.w,f.b[3]*g.h);G.hidden=false;box.hidden=true}\n if(l&&l.l){L.textContent=l.l;L.hidden=false;let x=g.x+10,y=g.y+10;if(l.p){const q=xy(l.p);x=q[0]+14;y=q[1]+20}else if(l.b){const q=xy(l.b);x=q[0];y=q[1]+l.b[3]*g.h+10}if(y+L.offsetHeight>g.y+g.h-4)y=l.b?g.y+l.b[1]*g.h-L.offsetHeight-10:g.y+g.h-L.offsetHeight-4;put(L,Math.max(g.x+4,Math.min(x,g.x+g.w-L.offsetWidth-4)),Math.max(g.y+4,y))}\n box.querySelector('span').hidden=!L.hidden;\n };\n const stage=d.querySelector('.wt-stage');\n const cover=()=>{let y=topEdge();if(stage&&getComputedStyle(stage).position==='sticky')y=Math.max(y,stage.getBoundingClientRect().bottom+16);return y};\n const anchor=a=>{const hid=Math.max(0,cover()-panel.getBoundingClientRect().top);panel.scrollTo({top:Math.max(0,a.offsetTop-6-hid),behavior:still()?'auto':'smooth'})};\n const tick=t=>{\n const cur=P.cur();\n if(skip&&!v.paused&&!v.seeking){const gap=idle.find(x=>x.s===cur&&t>=x.a&&t<x.b-0.05);if(gap){v.currentTime=gap.b;return}}\n let a=null;for(const s of steps){if(s.dataset.s===cur&&Number(s.dataset.t)<=t+0.02)a=s}\n if(a!==on){if(on){on.classList.remove('on');on.removeAttribute('aria-current');on.closest('.wt-case').classList.remove('on')}on=a;say(a);if(a){a.classList.add('on');a.setAttribute('aria-current','step');a.closest('.wt-case').classList.add('on');anchor(a)}}\n const g=geo();draw(t,g);fx(t,g);\n };\n P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});\n if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}\n if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip))});\n if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const a=t.closest('a[data-t][data-s],.wt-step[data-t][data-s]');if(!a||!P.has(a.dataset.s))return;\n e.preventDefault();const fig=v.closest('.player');\n if(fig.getBoundingClientRect().bottom<topEdge())fig.scrollIntoView({block:'start',behavior:still()?'auto':'smooth'});\n P.load(a.dataset.s,Number(a.dataset.t),P.playing());\n });\n P.update();\n});\n})();";
|
|
44
|
+
export declare const WALKTHROUGH_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.menubar');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst themeCycle=(b,key)=>{\n const r=document.documentElement,T=['light','dark','system'],N={light:'Light theme',dark:'Dark theme',system:'Theme from system'};\n const at=()=>{const i=T.indexOf(r.dataset.theme);return i<0?2:i};\n const show=()=>{const i=at(),f=document.getElementById('favicon'),h=f&&f.dataset[T[i]];if(h)f.href=h;b.setAttribute('aria-label',N[T[i]]+'. Switch to '+N[T[(i+1)%3]].toLowerCase());b.title=N[T[i]]};\n show();\n b.addEventListener('click',()=>{const m=T[(at()+1)%3];r.dataset.theme=m;if(key)try{localStorage.setItem(key,m)}catch(e){}show()});\n};\nconst chrome=()=>{\n d.querySelectorAll('.menubar .theme').forEach(b=>{themeCycle(b,K);b.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n const y=d.createElement('span');y.className='year';y.textContent=', '+p.year;\n e.replaceChildren(p.month+' '+p.day,y,' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute);\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),errs=new Map(),empty=d.getElementById(p+'-none');let shown=0,cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){++shown;note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}const ft=note.querySelector('.fix-text'),fd=note.querySelector('.fix-done');if(ft){ft.hidden=true;ft.value=''}if(fd)fd.textContent=''}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{const e=v.error;if(!e)return;dead.add(cur);errs.set(cur,'error code '+e.code+(e.message?': '+e.message:''));if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n const fix=d.getElementById(p+'-fix');\n if(fix){const box=fix.parentElement,ta=box.querySelector('.fix-text'),said=box.querySelector('.fix-done');\n fix.addEventListener('click',()=>{\n let t=ta.dataset.template||'';\n [['video',down?srcs.get(down)||'':''],['page',location.href],['browser',navigator.userAgent],['error',errs.get(down)||'nothing']].forEach(([k,x])=>{t=t.split('{'+k+'}').join(x)});\n const g=shown;ta.value=t;const ok=()=>{if(g!==shown)return;said.textContent='Copied. Paste it into your coding agent.'};\n const by=()=>{if(g!==shown)return;ta.hidden=false;ta.focus();ta.setSelectionRange(0,t.length);ta.scrollTop=0;let c=false;try{c=d.execCommand('copy')}catch(x){}if(c)ok();else said.textContent='Copy the prompt below.'};\n if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(t).then(ok,by);else by();\n })}\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();\n const stg=d.querySelector('.wt-stage');let fr=0;\n const fit=()=>{fr=0;if(!stg)return;const t=stg.getBoundingClientRect().top;stg.style.setProperty('--wt-top',Math.round(t)+'px');stg.style.setProperty('--wt-y',Math.round(t+scrollY)+'px')};\n const refit=()=>{if(!fr)fr=requestAnimationFrame(fit)};\n fit();addEventListener('resize',refit);addEventListener('load',refit);addEventListener('scroll',refit,{passive:true});d.addEventListener('fullscreenchange',refit);\n if(window.ResizeObserver)new ResizeObserver(refit).observe(d.body);\n const v=d.getElementById('wt-video');if(!v)return;\n const w=d.querySelector('.wt'),panel=d.getElementById('wt-script'),box=d.getElementById('wt-box'),cap=d.getElementById('wt-cap');\n const say=a=>{const x=a&&a.querySelector('.wt-text');cap.replaceChildren(...(x?[...x.childNodes].filter(n=>!(n instanceof Element&&n.classList.contains('wt-state'))).map(n=>n.cloneNode(true)):[]));cap.hidden=!x};\n const steps=[...d.querySelectorAll('.wt-step[data-t]')];\n const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));\n const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');\n let on=null,skip=!!skipB,P=null;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));\n w.classList.add('live');\n const hide=()=>{box.hidden=true};\n const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};\n const put=(e,x,y,bw,bh)=>{e.style.left=x+'px';e.style.top=y+'px';if(bw!==undefined){e.style.width=bw+'px';e.style.height=bh+'px'}};\n const draw=(t,g)=>{if(P.down()!==null||!g||!on||!on.dataset.box||t<Number(on.dataset.b0)||t>Number(on.dataset.b1))return hide();const b=on.dataset.box.split(' ').map(Number);put(box,g.x+b[0]*g.w,g.y+b[1]*g.h,b[2]*g.w,b[3]*g.h);box.querySelector('span').textContent=on.dataset.label||'';box.hidden=false};\n const C=d.getElementById('wt-cursor'),R=d.getElementById('wt-ripple'),G=d.getElementById('wt-ring'),L=d.getElementById('wt-act'),T=d.getElementById('wt-cursor-on'),ck='screw-bugs-cursor';\n const nums=x=>x?x.split(' ').map(Number):null;\n const acts=[...d.querySelectorAll('.wt-step[data-act][data-s]')].map(e=>({s:e.dataset.s,at:e.dataset.at?Number(e.dataset.at):NaN,t0:Number(e.dataset.t),t1:Number(e.dataset.a1),b0:Number(e.dataset.b0),b1:Number(e.dataset.b1),k:e.dataset.act,p:nums(e.dataset.pt),b:nums(e.dataset.tb),l:e.dataset.al||''})).sort((a,b)=>(a.at>=0?a.at:a.t0)-(b.at>=0?b.at:b.t0));\n let fon=true;try{fon=localStorage.getItem(ck)!=='off'}catch(e){}\n const fx=(t,g)=>{\n C.hidden=R.hidden=G.hidden=L.hidden=true;box.querySelector('span').hidden=false;\n if(!fon||P.down()!==null||!g)return;\n const m=still(),mine=acts.filter(a=>a.s===P.cur()),ptr=mine.filter(a=>a.p),xy=p=>[g.x+p[0]*g.w,g.y+p[1]*g.h];\n let i=-1;ptr.forEach((a,j)=>{if(a.at<=t)i=j});\n const a=ptr[i],n=ptr[i+1];let c=a?a.p:null;\n if(n&&a){const gw=Math.min(0.6,n.at-a.at),q=gw>0?(t-n.at+gw)/gw:1;if(q>=0){const e=q<.5?4*q*q*q:1-Math.pow(2-2*q,3)/2;c=!m&&q<1?[a.p[0]+(n.p[0]-a.p[0])*e,a.p[1]+(n.p[1]-a.p[1])*e]:n.p}}\n if(c){const xy0=xy(c);put(C,xy0[0]-3,xy0[1]-2);C.hidden=false}\n if(a&&!m&&t-a.at<.6){const q=(t-a.at)/.6,xy1=xy(a.p);put(R,xy1[0],xy1[1]);R.style.transform='translate(-50%,-50%) scale('+(.35+q*1.3)+')';R.style.opacity=String(1-q);R.hidden=false}\n let f=null,l=null,u=null;\n for(const x of mine){if(x.k==='fill'&&x.b&&t>=x.b0&&t<=x.b1)f=x;if(x.k==='fill'||!(x.at>=0)?t>=x.t0&&t<=x.t1:t>=x.at&&t<=x.at+1.5)l=x;else if(!u&&x.p&&x.at>t&&x.at-t<=0.6)u=x}\n l=l||u;\n if(f){const xy2=xy(f.b);put(G,xy2[0],xy2[1],f.b[2]*g.w,f.b[3]*g.h);G.hidden=false;box.hidden=true}\n if(l&&l.l){L.textContent=l.l;L.hidden=false;let x=g.x+10,y=g.y+10;if(l.p){const q=xy(l.p);x=q[0]+14;y=q[1]+20}else if(l.b){const q=xy(l.b);x=q[0];y=q[1]+l.b[3]*g.h+10}if(y+L.offsetHeight>g.y+g.h-4)y=l.b?g.y+l.b[1]*g.h-L.offsetHeight-10:g.y+g.h-L.offsetHeight-4;put(L,Math.max(g.x+4,Math.min(x,g.x+g.w-L.offsetWidth-4)),Math.max(g.y+4,y))}\n box.querySelector('span').hidden=!L.hidden;\n };\n const stage=d.querySelector('.wt-stage');\n const cover=()=>{let y=topEdge();if(stage&&getComputedStyle(stage).position==='sticky')y=Math.max(y,stage.getBoundingClientRect().bottom+16);return y};\n const anchor=a=>{const hid=Math.max(0,cover()-panel.getBoundingClientRect().top);panel.scrollTo({top:Math.max(0,a.offsetTop-6-hid),behavior:still()?'auto':'smooth'})};\n const tick=t=>{\n const cur=P.cur();\n if(skip&&!v.paused&&!v.seeking){const gap=idle.find(x=>x.s===cur&&t>=x.a&&t<x.b-0.05);if(gap){v.currentTime=gap.b;return}}\n let a=null;for(const s of steps){if(s.dataset.s===cur&&Number(s.dataset.t)<=t+0.02)a=s}\n if(a!==on){if(on){on.classList.remove('on');on.removeAttribute('aria-current');on.closest('.wt-case').classList.remove('on')}on=a;say(a);if(a){a.classList.add('on');a.setAttribute('aria-current','step');a.closest('.wt-case').classList.add('on');anchor(a)}}\n const g=geo();draw(t,g);fx(t,g);\n };\n P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});\n if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}\n if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});\n if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const a=t.closest('a[data-t][data-s],.wt-step[data-t][data-s]');if(!a||!P.has(a.dataset.s))return;\n e.preventDefault();const fig=v.closest('.player');\n if(fig.getBoundingClientRect().bottom<topEdge())fig.scrollIntoView({block:'start',behavior:still()?'auto':'smooth'});\n P.load(a.dataset.s,Number(a.dataset.t),P.playing());\n });\n P.update();\n});\n})();";
|
|
44
45
|
/**
|
|
45
46
|
* As the report's: the video by relative path, one script by hash, and from the network only
|
|
46
47
|
* Google Fonts' stylesheet and its fonts.
|
|
@@ -83,6 +84,7 @@ export declare const stepAction: (action: StepAction | undefined) => {
|
|
|
83
84
|
* one inline script, and from the network only Geist and Geist Mono from Google Fonts (system
|
|
84
85
|
* fonts offline). The video loads by relative path, or under `options.assetBaseUrl` (see
|
|
85
86
|
* `RenderOptions`); with no options the page is exactly the local one. Code decides everything
|
|
86
|
-
* on it
|
|
87
|
+
* on it, except that a case the agent's findings mark failed shows as failed, with the agent's
|
|
88
|
+
* verdict labelled as its own; nothing else from the write-up is shown. Every piece of text from the job or the page is escaped.
|
|
87
89
|
*/
|
|
88
90
|
export declare const renderWalkthrough: (bundle: ReportBundle, options?: RenderOptions) => string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { clampBox } from '../core/index.js';
|
|
2
2
|
import { runFiles, } from '../schema/index.js';
|
|
3
3
|
import { favicon, generatorMeta, html, icon, Markup, promptBlock, safeRelative, statusIcon, statusTag, textParts, webFonts, } from './markup.js';
|
|
4
|
-
import { controlsBlock, PLAYER_JS, playableSessions, playerWindow, shapeStyle, share, toggleButton, } from './player.js';
|
|
4
|
+
import { controlsBlock, PLAYER_JS, playableSessions, playerWindow, shapeStyle, share, toggleButton, videoFixPrompt, } from './player.js';
|
|
5
5
|
import { assetsOf, contentPolicy } from './assets.js';
|
|
6
6
|
import { topBar } from './menu-bar.js';
|
|
7
7
|
import { cspHash } from './sha256.js';
|
|
8
8
|
import { styles } from './styles.js';
|
|
9
|
-
import { caseViews, formatTimecode, fragmentSeconds, idleStretches, stepParts, stepText, statusLabel, urlAt, urlTimeline, } from './view.js';
|
|
9
|
+
import { caseViews, checksNote, formatTimecode, fragmentSeconds, idleStretches, stepParts, stepText, statusLabel, urlAt, urlTimeline, } from './view.js';
|
|
10
10
|
/*
|
|
11
11
|
* The walkthrough: one player for the run's video, and under it (beside it, for a run on a phone)
|
|
12
12
|
* the script: every step of every case in run order with its timecode. The step playing now is the
|
|
@@ -33,7 +33,8 @@ export const GLIDE_S = 0.6;
|
|
|
33
33
|
* the reader prefers less; the top row that shows, below the top bar and, on a narrow screen, the
|
|
34
34
|
* pinned player and its fade, when the page has scrolled the script under them), draws the box of the element it acted on over the video while that was
|
|
35
35
|
* measured, makes timecodes and rows seek (and switch session videos) instead of opening the file,
|
|
36
|
-
* and, with "Skip inactive" on, jumps over the stretches where
|
|
36
|
+
* and, with "Skip inactive" on (remembered like the theme), jumps over the stretches where
|
|
37
|
+
* nothing happened (`idleStretches`) while it plays.
|
|
37
38
|
* "Expand" shows the whole script and makes the video smaller. Fullscreen takes the whole page
|
|
38
39
|
* (`.wt`), not only the video; on a wide screen (a desktop) it never takes the browser's screen,
|
|
39
40
|
* only lays the page out again (`.focus`, see `PLAYER_JS`): the top bar, the video as big as fits with its address over it and
|
|
@@ -68,7 +69,7 @@ d.addEventListener('DOMContentLoaded',()=>{
|
|
|
68
69
|
const steps=[...d.querySelectorAll('.wt-step[data-t]')];
|
|
69
70
|
const idle=[...d.querySelectorAll('.idle[data-a]')].map(e=>({s:e.closest('.track').dataset.s,a:Number(e.dataset.a),b:Number(e.dataset.b)}));
|
|
70
71
|
const skipB=d.getElementById('wt-skip'),expB=d.getElementById('wt-expand');
|
|
71
|
-
let on=null,skip=!!skipB&&skipB.
|
|
72
|
+
let on=null,skip=!!skipB,P=null;const sk='screw-bugs-skip';try{skip=skip&&localStorage.getItem(sk)!=='off'}catch(e){}if(skipB)skipB.setAttribute('aria-pressed',String(skip));
|
|
72
73
|
w.classList.add('live');
|
|
73
74
|
const hide=()=>{box.hidden=true};
|
|
74
75
|
const geo=()=>{const vw=v.videoWidth,vh=v.videoHeight,cw=v.clientWidth,ch=v.clientHeight;if(!vw||!vh||!cw||!ch)return null;const s=Math.min(cw/vw,ch/vh);return{x:v.offsetLeft+(cw-vw*s)/2,y:v.offsetTop+(ch-vh*s)/2,w:vw*s,h:vh*s}};
|
|
@@ -106,7 +107,7 @@ d.addEventListener('DOMContentLoaded',()=>{
|
|
|
106
107
|
};
|
|
107
108
|
P=player('wt',{tick,full:w,expand:true,inPage:()=>matchMedia('(min-width: 901px)').matches,broken:()=>{hide();fx(0,null);w.classList.remove('live')},fine:()=>{w.classList.add('live')}});
|
|
108
109
|
if(T&&acts.length){T.checked=fon;T.closest('label').hidden=false;T.addEventListener('change',()=>{fon=T.checked;try{localStorage.setItem(ck,fon?'on':'off')}catch(e){}P.update()})}
|
|
109
|
-
if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip))});
|
|
110
|
+
if(skipB)skipB.addEventListener('click',()=>{skip=!skip;skipB.setAttribute('aria-pressed',String(skip));try{localStorage.setItem(sk,skip?'on':'off')}catch(e){}});
|
|
110
111
|
if(expB)expB.addEventListener('click',()=>{const x=w.classList.toggle('expanded');expB.setAttribute('aria-expanded',String(x));expB.querySelector('span').textContent=x?'Collapse':'Expand';P.update();if(on)anchor(on)});
|
|
111
112
|
d.addEventListener('click',e=>{
|
|
112
113
|
const t=e.target;if(!(t instanceof Element))return;
|
|
@@ -431,8 +432,16 @@ export const stepAction = (action) => {
|
|
|
431
432
|
};
|
|
432
433
|
const stepLabel = (step) => (step.index === 0 ? 'Opening page' : `Step ${step.index}`);
|
|
433
434
|
const notRun = { 'not-run': 'not run', unknown: '', done: '', decided: '' };
|
|
434
|
-
|
|
435
|
-
|
|
435
|
+
/** Why the code gave a case its status (`status`: the code's, not one the agent gave). */
|
|
436
|
+
const why = (entry, status, extraClass = '') => html `<p class="${`wt-why s-${status}${extraClass}`}">
|
|
437
|
+
${statusTag(status)}<span>${entry.reason}</span>
|
|
438
|
+
</p>`;
|
|
439
|
+
/** The agent's verdict on a case its findings mark failed, beside the code's result. */
|
|
440
|
+
const agentWhy = (view) => html `<p class="wt-why s-failed wt-case-why">
|
|
441
|
+
${statusTag('failed')}<span
|
|
442
|
+
>Agent's verdict: ${view.agentFailed ?? ''}
|
|
443
|
+
<span class="wt-checked">(${checksNote(view.checkStatus)})</span></span
|
|
444
|
+
>
|
|
436
445
|
</p>`;
|
|
437
446
|
/**
|
|
438
447
|
* The input a step gives the page, as an icon by its words in the fullscreen caption: a left
|
|
@@ -461,7 +470,7 @@ const stepRow = (view, step, sessions) => {
|
|
|
461
470
|
const decided = step.state === 'decided';
|
|
462
471
|
const kind = stepIcon[step.step.action];
|
|
463
472
|
return html `<li
|
|
464
|
-
class="wt-step st-${step.state}${decided ? ` s-${
|
|
473
|
+
class="wt-step st-${step.state}${decided ? ` s-${view.checkStatus}` : ''}"
|
|
465
474
|
id="${`wt-${entry.id}-${step.index}`}"
|
|
466
475
|
${timed ? html ` data-s="${String(session)}" data-t="${fragmentSeconds(ms)}"` : ''}
|
|
467
476
|
${box
|
|
@@ -480,7 +489,7 @@ const stepRow = (view, step, sessions) => {
|
|
|
480
489
|
? html ` <span class="wt-state">(added: every case starts at the job URL)</span>`
|
|
481
490
|
: ''}${notRun[step.state] ? html ` <span class="wt-state">(${notRun[step.state]})</span>` : ''}</span
|
|
482
491
|
>
|
|
483
|
-
${decided && entry.reason ? why(entry) : ''}
|
|
492
|
+
${decided && entry.reason ? why(entry, view.checkStatus) : ''}
|
|
484
493
|
</li>`;
|
|
485
494
|
};
|
|
486
495
|
/** Steps that only check the page, left out of the walkthrough's script, even one that decided its case. */
|
|
@@ -514,7 +523,7 @@ const caseBlock = (view, position, sessions) => {
|
|
|
514
523
|
>${statusLabel[entry.status]}</span
|
|
515
524
|
>
|
|
516
525
|
</div>
|
|
517
|
-
${timedButNoVideo}${entry.reason && !decidedShown ? why(entry, ' wt-case-why') : ''}
|
|
526
|
+
${timedButNoVideo}${view.agentFailed !== undefined ? agentWhy(view) : ''}${entry.reason && !decidedShown ? why(entry, view.checkStatus, ' wt-case-why') : ''}
|
|
518
527
|
${steps.length > 0
|
|
519
528
|
? html `<ol class="wt-steps">
|
|
520
529
|
${steps.map((step) => stepRow(view, step, sessions))}
|
|
@@ -541,7 +550,11 @@ const problemsBlock = (views, sessions) => {
|
|
|
541
550
|
>`;
|
|
542
551
|
return html `<li class="s-${entry.status}">
|
|
543
552
|
${at}${statusTag(entry.status)}<span class="why"
|
|
544
|
-
><a href="${`#wt-${entry.id}`}">${entry.title}</a>${
|
|
553
|
+
><a href="${`#wt-${entry.id}`}">${entry.title}</a>${view.agentFailed !== undefined
|
|
554
|
+
? html `: agent's verdict: ${view.agentFailed} (${checksNote(view.checkStatus)})`
|
|
555
|
+
: entry.reason
|
|
556
|
+
? html `: ${entry.reason}`
|
|
557
|
+
: ''}</span
|
|
545
558
|
>
|
|
546
559
|
</li>`;
|
|
547
560
|
})}
|
|
@@ -555,7 +568,8 @@ const expandIcon = html `${icon('chevrons-up-down', { size: 13, className: 'i-ex
|
|
|
555
568
|
* one inline script, and from the network only Geist and Geist Mono from Google Fonts (system
|
|
556
569
|
* fonts offline). The video loads by relative path, or under `options.assetBaseUrl` (see
|
|
557
570
|
* `RenderOptions`); with no options the page is exactly the local one. Code decides everything
|
|
558
|
-
* on it
|
|
571
|
+
* on it, except that a case the agent's findings mark failed shows as failed, with the agent's
|
|
572
|
+
* verdict labelled as its own; nothing else from the write-up is shown. Every piece of text from the job or the page is escaped.
|
|
559
573
|
*/
|
|
560
574
|
export const renderWalkthrough = (bundle, options) => {
|
|
561
575
|
const { spec, ledger } = bundle;
|
|
@@ -606,6 +620,9 @@ export const renderWalkthrough = (bundle, options) => {
|
|
|
606
620
|
overlay,
|
|
607
621
|
below: caption,
|
|
608
622
|
extraClass: 'wt-player',
|
|
623
|
+
...(options?.assetBaseUrl === undefined
|
|
624
|
+
? { fixPrompt: videoFixPrompt(bundle.jobId) }
|
|
625
|
+
: {}),
|
|
609
626
|
})}
|
|
610
627
|
${controlsBlock({
|
|
611
628
|
prefix: 'wt',
|
|
@@ -320,6 +320,12 @@ export declare const FACT_IMAGES_MAX = 12;
|
|
|
320
320
|
export declare const FACT_LINKS_MAX = 12;
|
|
321
321
|
/** Image sources and link addresses are cut to this many characters. */
|
|
322
322
|
export declare const URL_MAX = 300;
|
|
323
|
+
/** A stretch of a session's video, in ms on its clock. */
|
|
324
|
+
export declare const StillStretch: Schema.Struct<{
|
|
325
|
+
readonly fromMs: Schema.Number;
|
|
326
|
+
readonly toMs: Schema.Number;
|
|
327
|
+
}>;
|
|
328
|
+
export type StillStretch = typeof StillStretch.Type;
|
|
323
329
|
/**
|
|
324
330
|
* One test user in one browser, start to end, recorded as one continuous video. A run without a
|
|
325
331
|
* login is one session; jobs have at most one account today, so a run has one session.
|
|
@@ -339,6 +345,15 @@ export declare const Session: Schema.Struct<{
|
|
|
339
345
|
readonly videoDurationMs: Schema.optionalKey<Schema.Number>;
|
|
340
346
|
/** Why the video is missing or incomplete, in plain language. Never changes a status. */
|
|
341
347
|
readonly videoProblem: Schema.optionalKey<Schema.String>;
|
|
348
|
+
/**
|
|
349
|
+
* The stretches of the video in which its picture did not change, in ms on its clock, measured
|
|
350
|
+
* from the saved video once the session ended. Missing when that could not be measured (older
|
|
351
|
+
* runs, no video); empty when nothing stood still.
|
|
352
|
+
*/
|
|
353
|
+
readonly still: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
354
|
+
readonly fromMs: Schema.Number;
|
|
355
|
+
readonly toMs: Schema.Number;
|
|
356
|
+
}>>>;
|
|
342
357
|
}>;
|
|
343
358
|
export type Session = typeof Session.Type;
|
|
344
359
|
/**
|
package/dist/schema/evidence.js
CHANGED
|
@@ -212,6 +212,8 @@ export const FACT_IMAGES_MAX = 12;
|
|
|
212
212
|
export const FACT_LINKS_MAX = 12;
|
|
213
213
|
/** Image sources and link addresses are cut to this many characters. */
|
|
214
214
|
export const URL_MAX = 300;
|
|
215
|
+
/** A stretch of a session's video, in ms on its clock. */
|
|
216
|
+
export const StillStretch = Schema.Struct({ fromMs: Schema.Number, toMs: Schema.Number });
|
|
215
217
|
/**
|
|
216
218
|
* One test user in one browser, start to end, recorded as one continuous video. A run without a
|
|
217
219
|
* login is one session; jobs have at most one account today, so a run has one session.
|
|
@@ -231,6 +233,12 @@ export const Session = Schema.Struct({
|
|
|
231
233
|
videoDurationMs: Schema.optionalKey(Schema.Number),
|
|
232
234
|
/** Why the video is missing or incomplete, in plain language. Never changes a status. */
|
|
233
235
|
videoProblem: Schema.optionalKey(Schema.String),
|
|
236
|
+
/**
|
|
237
|
+
* The stretches of the video in which its picture did not change, in ms on its clock, measured
|
|
238
|
+
* from the saved video once the session ended. Missing when that could not be measured (older
|
|
239
|
+
* runs, no video); empty when nothing stood still.
|
|
240
|
+
*/
|
|
241
|
+
still: Schema.optionalKey(Schema.Array(StillStretch)),
|
|
234
242
|
});
|
|
235
243
|
/**
|
|
236
244
|
* Attributes of an element that a CSS selector may name, such as `data-test`, `title`, `href` or
|
|
@@ -56,6 +56,7 @@ export declare const CaseFindings: Schema.Struct<{
|
|
|
56
56
|
readonly did: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
57
57
|
readonly worked: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
58
58
|
readonly didnt: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
59
|
+
readonly failed: Schema.optionalKey<Schema.String>;
|
|
59
60
|
readonly highlights: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
60
61
|
readonly shot: Schema.NonEmptyString;
|
|
61
62
|
readonly target: Schema.Struct<{
|
|
@@ -114,6 +115,7 @@ export declare const Findings: Schema.Struct<{
|
|
|
114
115
|
readonly did: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
115
116
|
readonly worked: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
116
117
|
readonly didnt: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
118
|
+
readonly failed: Schema.optionalKey<Schema.String>;
|
|
117
119
|
readonly highlights: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
118
120
|
readonly shot: Schema.NonEmptyString;
|
|
119
121
|
readonly target: Schema.Struct<{
|
package/dist/schema/findings.js
CHANGED
|
@@ -2,8 +2,9 @@ import { Schema } from 'effect';
|
|
|
2
2
|
import { ShortLine as Line, Target } from './job.js';
|
|
3
3
|
/*
|
|
4
4
|
* The agent's write-up of an ended run: fixed, structured slots that the report lays out. Every
|
|
5
|
-
* text is short and plain
|
|
6
|
-
*
|
|
5
|
+
* text is short and plain. The run's code sets each case's status; the only status the write-up
|
|
6
|
+
* can give is `failed`, through a case's `failed` (see `judgedLedger`), never a pass. IDs (cases,
|
|
7
|
+
* screenshots, timecodes) are checked against the run by `checkFindings` in core.
|
|
7
8
|
*/
|
|
8
9
|
/** A list of at most `max` short lines. */
|
|
9
10
|
const Lines = (max, length, description) => Schema.Array(Line(length))
|
|
@@ -43,6 +44,11 @@ export const CaseFindings = Schema.Struct({
|
|
|
43
44
|
did: Schema.optionalKey(Lines(8, 160, 'What the case did, as a user would say it.')),
|
|
44
45
|
worked: Schema.optionalKey(Lines(8, 160, 'What worked.')),
|
|
45
46
|
didnt: Schema.optionalKey(Lines(8, 160, "What didn't work.")),
|
|
47
|
+
failed: Schema.optionalKey(Line(160, 'Set when your own evidence (the database, logs, the screenshots, the video) shows the ' +
|
|
48
|
+
'case did not do what its success says, even if every check passed: what is wrong, in ' +
|
|
49
|
+
'one line. The case then counts as failed by your review everywhere results are shown. ' +
|
|
50
|
+
'Leave it out when the case did what it should; minor issues go in didnt. It can never ' +
|
|
51
|
+
'make a case pass.').check(Schema.makeFilter((text) => /[\r\n]/.test(text) ? 'Use one line, with no line breaks' : undefined))),
|
|
46
52
|
highlights: Schema.optionalKey(Schema.Array(Highlight)
|
|
47
53
|
.check(Schema.isMaxLength(6, { message: 'Use at most 6 highlights per case' }))
|
|
48
54
|
.annotate({ description: 'Elements to mark on this case’s screenshots. At most 6.' })),
|