screw-bugs 0.1.9 → 0.1.11
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 +100 -54
- package/dist/browser-playwright/capture.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli/app.js +6 -2
- package/dist/cli/commands.js +4 -3
- package/dist/cli/doctor.d.ts +17 -2
- package/dist/cli/doctor.js +62 -4
- package/dist/cli/mcp.js +7 -4
- package/dist/cli/report-server.d.ts +19 -10
- package/dist/cli/report-server.js +43 -18
- package/dist/cli/share.js +2 -2
- package/dist/cli/sign-in.d.ts +9 -3
- package/dist/cli/sign-in.js +12 -9
- package/dist/cli/tailnet.d.ts +57 -0
- package/dist/cli/tailnet.js +82 -0
- package/dist/core/index.d.ts +1 -14
- package/dist/core/index.js +3 -14
- package/dist/report/index.d.ts +1 -10
- package/dist/report/index.js +3 -10
- package/dist/schema/index.d.ts +1 -9
- package/dist/schema/index.js +3 -9
- package/package.json +14 -14
- package/dist/core/accounts.d.ts +0 -40
- package/dist/core/accounts.js +0 -95
- package/dist/core/css.d.ts +0 -95
- package/dist/core/css.js +0 -436
- package/dist/core/engine.d.ts +0 -75
- package/dist/core/engine.js +0 -560
- package/dist/core/errors.d.ts +0 -85
- package/dist/core/errors.js +0 -36
- package/dist/core/evidence.d.ts +0 -14
- package/dist/core/evidence.js +0 -131
- package/dist/core/labels.d.ts +0 -47
- package/dist/core/labels.js +0 -199
- package/dist/core/liveness.d.ts +0 -45
- package/dist/core/liveness.js +0 -66
- package/dist/core/marks.d.ts +0 -63
- package/dist/core/marks.js +0 -410
- package/dist/core/services.d.ts +0 -579
- package/dist/core/services.js +0 -25
- package/dist/core/share.d.ts +0 -68
- package/dist/core/share.js +0 -318
- package/dist/core/steps.d.ts +0 -106
- package/dist/core/steps.js +0 -722
- package/dist/core/uploads.d.ts +0 -49
- package/dist/core/uploads.js +0 -133
- package/dist/core/video.d.ts +0 -53
- package/dist/core/video.js +0 -241
- package/dist/core/viewport.d.ts +0 -28
- package/dist/core/viewport.js +0 -50
- package/dist/report/assets.d.ts +0 -34
- package/dist/report/assets.js +0 -105
- package/dist/report/bug.d.ts +0 -11
- package/dist/report/bug.js +0 -20
- package/dist/report/html.d.ts +0 -47
- package/dist/report/html.js +0 -923
- package/dist/report/icons.d.ts +0 -51
- package/dist/report/icons.js +0 -93
- package/dist/report/live.d.ts +0 -7
- package/dist/report/live.js +0 -135
- package/dist/report/logos.d.ts +0 -4
- package/dist/report/logos.js +0 -19
- package/dist/report/markup.d.ts +0 -50
- package/dist/report/markup.js +0 -156
- package/dist/report/menu-bar.d.ts +0 -60
- package/dist/report/menu-bar.js +0 -157
- package/dist/report/player.d.ts +0 -102
- package/dist/report/player.js +0 -315
- package/dist/report/pr-summary.d.ts +0 -11
- package/dist/report/pr-summary.js +0 -119
- package/dist/report/sha256.d.ts +0 -9
- package/dist/report/sha256.js +0 -97
- package/dist/report/share-page.d.ts +0 -48
- package/dist/report/share-page.js +0 -291
- package/dist/report/shots.d.ts +0 -59
- package/dist/report/shots.js +0 -280
- package/dist/report/sign-in.d.ts +0 -41
- package/dist/report/sign-in.js +0 -568
- package/dist/report/styles.d.ts +0 -3
- package/dist/report/styles.js +0 -274
- package/dist/report/view.d.ts +0 -296
- package/dist/report/view.js +0 -702
- package/dist/report/walkthrough.d.ts +0 -93
- package/dist/report/walkthrough.js +0 -716
- package/dist/schema/accounts.d.ts +0 -137
- package/dist/schema/accounts.js +0 -121
- package/dist/schema/config.d.ts +0 -7
- package/dist/schema/config.js +0 -6
- package/dist/schema/doctor.d.ts +0 -46
- package/dist/schema/doctor.js +0 -30
- package/dist/schema/evidence.d.ts +0 -1115
- package/dist/schema/evidence.js +0 -565
- package/dist/schema/findings.d.ts +0 -161
- package/dist/schema/findings.js +0 -82
- package/dist/schema/job.d.ts +0 -1905
- package/dist/schema/job.js +0 -577
- package/dist/schema/ledger.d.ts +0 -1124
- package/dist/schema/ledger.js +0 -285
- package/dist/schema/share.d.ts +0 -55
- package/dist/schema/share.js +0 -64
- package/dist/schema/status.d.ts +0 -7
- package/dist/schema/status.js +0 -11
package/dist/schema/ledger.js
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
import { Box, PageFacts, Session, Shot, StepTiming } from './evidence.js';
|
|
3
|
-
import { Findings } from './findings.js';
|
|
4
|
-
import { Device, JobId, JobSpec, summaryOf } from './job.js';
|
|
5
|
-
import { CaseStatus, JobState } from './status.js';
|
|
6
|
-
/**
|
|
7
|
-
* `run_status` cuts each listed reason to this many characters. A reason with a hint about where
|
|
8
|
-
* else its text or element is (see `withHint` in core) is kept within it, so the hint shows.
|
|
9
|
-
*/
|
|
10
|
-
export const REASON_MAX = 150;
|
|
11
|
-
/** One row of the case ledger. Evidence entries are paths relative to the run directory. */
|
|
12
|
-
export const CaseEntry = Schema.Struct({
|
|
13
|
-
id: Schema.NonEmptyString,
|
|
14
|
-
title: Schema.NonEmptyString,
|
|
15
|
-
status: CaseStatus,
|
|
16
|
-
/**
|
|
17
|
-
* For a case that continued (`CaseSpec.continue`): the ID of the case before it, on whose page
|
|
18
|
-
* it started rather than at the job URL.
|
|
19
|
-
*/
|
|
20
|
-
continuedFrom: Schema.optionalKey(Schema.String),
|
|
21
|
-
/** Why the case did not pass, in plain language. Never DOM or browser logs. */
|
|
22
|
-
reason: Schema.optionalKey(Schema.String),
|
|
23
|
-
/**
|
|
24
|
-
* 1-based index of the step that decided a failed or blocked status; 0 is the opening
|
|
25
|
-
* navigation to the job URL that a case gets when its first step is not goto.
|
|
26
|
-
*/
|
|
27
|
-
step: Schema.optionalKey(Schema.Int),
|
|
28
|
-
/**
|
|
29
|
-
* Paths such as `evidence/01/02-after-login.png`: case and screenshot numbers, so they never
|
|
30
|
-
* collide on any file system. Runs from older versions have `evidence/<case>/<name>.png` or
|
|
31
|
-
* `evidence/<case>-<name>.png`.
|
|
32
|
-
*/
|
|
33
|
-
evidence: Schema.Array(Schema.String),
|
|
34
|
-
/**
|
|
35
|
-
* The name each evidence path was saved under, as the job gave it (`after-login`), or
|
|
36
|
-
* `step3-failed` for the screenshot taken when the case stopped. Missing in older runs.
|
|
37
|
-
*/
|
|
38
|
-
evidenceNames: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
|
|
39
|
-
/** The session it ran in (`Session.number`). Missing in older runs, as are the fields below. */
|
|
40
|
-
session: Schema.optionalKey(Schema.Int),
|
|
41
|
-
/** When the case started and ended, in ms from the start of its session's video. */
|
|
42
|
-
startMs: Schema.optionalKey(Schema.Number),
|
|
43
|
-
endMs: Schema.optionalKey(Schema.Number),
|
|
44
|
-
/** When each step that ran started and ended. */
|
|
45
|
-
steps: Schema.optionalKey(Schema.Array(StepTiming)),
|
|
46
|
-
/** Every screenshot of `evidence`, with what it shows. */
|
|
47
|
-
shots: Schema.optionalKey(Schema.Array(Shot)),
|
|
48
|
-
/** Short facts about the page when the case ended. */
|
|
49
|
-
facts: Schema.optionalKey(PageFacts),
|
|
50
|
-
});
|
|
51
|
-
/**
|
|
52
|
-
* The browser a run used, as Playwright reported it when the run's browser started: its type
|
|
53
|
-
* (`chromium`), the channel it was launched with (`chrome`, `msedge`; none for the Chromium
|
|
54
|
-
* Playwright downloaded, which runs headless as its headless shell) and its version, such as
|
|
55
|
-
* `141.0.7390.37`.
|
|
56
|
-
*/
|
|
57
|
-
export const BrowserRecord = Schema.Struct({
|
|
58
|
-
type: Schema.String,
|
|
59
|
-
channel: Schema.optionalKey(Schema.String),
|
|
60
|
-
version: Schema.String,
|
|
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
|
-
});
|
|
73
|
-
/** The running record of every case in a job; the source of truth for status and reports. */
|
|
74
|
-
export const CaseLedger = Schema.Struct({
|
|
75
|
-
jobId: JobId,
|
|
76
|
-
state: JobState,
|
|
77
|
-
cases: Schema.Array(CaseEntry),
|
|
78
|
-
startedAt: Schema.optionalKey(Schema.String),
|
|
79
|
-
finishedAt: Schema.optionalKey(Schema.String),
|
|
80
|
-
/** Why the job stopped early, when `state` is `errored`. */
|
|
81
|
-
error: Schema.optionalKey(Schema.String),
|
|
82
|
-
/**
|
|
83
|
-
* When the process running the job last rewrote the ledger. Refreshed every few seconds while
|
|
84
|
-
* the job is queued or running; a stale one means that process is gone.
|
|
85
|
-
*/
|
|
86
|
-
heartbeatAt: Schema.optionalKey(Schema.String),
|
|
87
|
-
/** ID of the operating-system process running the job, when known. */
|
|
88
|
-
pid: Schema.optionalKey(Schema.Int),
|
|
89
|
-
/** The device the browser emulated, as people read it, such as `iPhone 17 (Chromium)`. */
|
|
90
|
-
deviceLabel: Schema.optionalKey(Schema.String),
|
|
91
|
-
/** The browser the run used, once it started. Missing in older runs. */
|
|
92
|
-
browser: Schema.optionalKey(BrowserRecord),
|
|
93
|
-
/** The browser sessions of the run, each with its video. Missing in older runs. */
|
|
94
|
-
sessions: Schema.optionalKey(Schema.Array(Session)),
|
|
95
|
-
/** The screw-bugs version that ran the job. */
|
|
96
|
-
version: Schema.optionalKey(Schema.String),
|
|
97
|
-
/** Where the job is while it runs (see `RunProgress`). */
|
|
98
|
-
progress: Schema.optionalKey(RunProgress),
|
|
99
|
-
});
|
|
100
|
-
/**
|
|
101
|
-
* A highlight of the agent's findings as the report draws it: its box on the screenshot, or in
|
|
102
|
-
* words why it has none (the element was not found, or more than one matched). Never a guess.
|
|
103
|
-
*/
|
|
104
|
-
export const PlacedMark = Schema.Struct({
|
|
105
|
-
mark: Schema.Literals(['red', 'green']),
|
|
106
|
-
/** The element as the agent named it, such as `button "Sign in"`. */
|
|
107
|
-
target: Schema.String,
|
|
108
|
-
note: Schema.optionalKey(Schema.String),
|
|
109
|
-
box: Schema.optionalKey(Box),
|
|
110
|
-
/** Where the element's text and images are inside `box` (`Candidate.content`), when known. */
|
|
111
|
-
content: Schema.optionalKey(Box),
|
|
112
|
-
problem: Schema.optionalKey(Schema.String),
|
|
113
|
-
/**
|
|
114
|
-
* Other matches that were left out because they were not on the screenshot, in words, such as
|
|
115
|
-
* `1 more match outside this screenshot was ignored`.
|
|
116
|
-
*/
|
|
117
|
-
ignored: Schema.optionalKey(Schema.String),
|
|
118
|
-
});
|
|
119
|
-
/**
|
|
120
|
-
* Everything a finished run leaves on disk. `files` paths are relative to the bundle directory,
|
|
121
|
-
* so a bundle can be zipped, moved or uploaded as is.
|
|
122
|
-
*/
|
|
123
|
-
export const ReportBundle = Schema.Struct({
|
|
124
|
-
formatVersion: Schema.Literal(1),
|
|
125
|
-
/**
|
|
126
|
-
* The screw-bugs version that built this bundle: the run, or a later `screw-bugs report`,
|
|
127
|
-
* `submit_findings` or `screw-bugs findings`, which may be a newer version than the one that ran
|
|
128
|
-
* the job (`ledger.version`). Missing in bundles built before it was kept, or by a build that
|
|
129
|
-
* does not know its version.
|
|
130
|
-
*/
|
|
131
|
-
generator: Schema.optionalKey(Schema.Struct({ name: Schema.Literal('screw-bugs'), version: Schema.String })),
|
|
132
|
-
jobId: JobId,
|
|
133
|
-
spec: JobSpec,
|
|
134
|
-
ledger: CaseLedger,
|
|
135
|
-
startedAt: Schema.String,
|
|
136
|
-
finishedAt: Schema.optionalKey(Schema.String),
|
|
137
|
-
/**
|
|
138
|
-
* What the run tests, from `summaryOf(spec)`: the caller's summary, or one derived from the case
|
|
139
|
-
* titles when `derived` is true. The caller's own text, if any, is also in `spec.summary`.
|
|
140
|
-
*/
|
|
141
|
-
summary: Schema.Struct({ text: Schema.String, derived: Schema.Boolean }),
|
|
142
|
-
/**
|
|
143
|
-
* The device the run used: `spec.device` (desktop by default) and its label from the ledger,
|
|
144
|
-
* or a generic one for runs recorded before ledgers kept it.
|
|
145
|
-
*/
|
|
146
|
-
device: Schema.Struct({ kind: Device, label: Schema.String }),
|
|
147
|
-
/** The browser the run used, from the ledger; missing for runs recorded before it kept it. */
|
|
148
|
-
browser: Schema.optionalKey(BrowserRecord),
|
|
149
|
-
files: Schema.Struct({
|
|
150
|
-
ledger: Schema.String,
|
|
151
|
-
html: Schema.optionalKey(Schema.String),
|
|
152
|
-
/** The walkthrough (`runFiles.walkthrough`), when one was written with this report. */
|
|
153
|
-
walkthrough: Schema.optionalKey(Schema.String),
|
|
154
|
-
evidenceDir: Schema.String,
|
|
155
|
-
}),
|
|
156
|
-
/** The agent's write-up, once it submitted one. */
|
|
157
|
-
findings: Schema.optionalKey(Findings),
|
|
158
|
-
/** The agent's highlights, placed on their screenshots by code, by screenshot ID. */
|
|
159
|
-
marks: Schema.optionalKey(Schema.Record(Schema.String, Schema.Array(PlacedMark))),
|
|
160
|
-
/** Copies of screenshots with the highlights drawn in, by screenshot ID; relative paths. */
|
|
161
|
-
annotated: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
|
|
162
|
-
/**
|
|
163
|
-
* The boxes of the page's elements on screenshots that get boxes drawn on them, by screenshot
|
|
164
|
-
* ID, from their saved page state: labels keep off them where they can.
|
|
165
|
-
*/
|
|
166
|
-
elements: Schema.optionalKey(Schema.Record(Schema.String, Schema.Array(Box))),
|
|
167
|
-
/**
|
|
168
|
-
* The page's URL when each screenshot was taken, from its saved page state, by screenshot ID:
|
|
169
|
-
* what the reports' players show as the address at that moment of the video.
|
|
170
|
-
*/
|
|
171
|
-
urls: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
|
|
172
|
-
});
|
|
173
|
-
/** Where things are inside a run folder, relative to it. */
|
|
174
|
-
export const runFiles = {
|
|
175
|
-
job: 'job.json',
|
|
176
|
-
ledger: 'ledger.json',
|
|
177
|
-
/** The run's own report; only the run, or `screw-bugs report` once it has ended, writes it. */
|
|
178
|
-
html: 'report.html',
|
|
179
|
-
/** The report of a run whose process is gone, written by whoever reads its status. */
|
|
180
|
-
interruptedHtml: 'report-interrupted.html',
|
|
181
|
-
/**
|
|
182
|
-
* The run's walkthrough: its video with every step as a clickable script. Written with
|
|
183
|
-
* `report.html`, by whoever writes that, never by itself or with `report-interrupted.html`.
|
|
184
|
-
*/
|
|
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',
|
|
192
|
-
evidenceDir: 'evidence',
|
|
193
|
-
/** The evidence pack of an ended run, written by the run. */
|
|
194
|
-
evidence: 'evidence.json',
|
|
195
|
-
/** The agent's write-up, written by `submit_findings` and `screw-bugs findings`. */
|
|
196
|
-
findings: 'findings.json',
|
|
197
|
-
/** One video per session, `video/session-<n>.webm`. */
|
|
198
|
-
videoDir: 'video',
|
|
199
|
-
/**
|
|
200
|
-
* Screenshots with the agent's highlights drawn in, `annotated/<shot ID>-<revision>.png`, where
|
|
201
|
-
* the revision is that of the `findings.json` they were drawn for. Copies for older findings
|
|
202
|
-
* may be left there; nothing shows them.
|
|
203
|
-
*/
|
|
204
|
-
annotatedDir: 'annotated',
|
|
205
|
-
};
|
|
206
|
-
/** Where the video of session `number` goes, relative to the run folder. */
|
|
207
|
-
export const videoFile = (number) => `${runFiles.videoDir}/session-${number}.webm`;
|
|
208
|
-
/**
|
|
209
|
-
* Where the annotated copy of a screenshot goes, relative to the run folder, for the findings of
|
|
210
|
-
* `revision` (see `findingsRevision`).
|
|
211
|
-
*/
|
|
212
|
-
export const annotatedFile = (shotId, revision) => `${runFiles.annotatedDir}/${shotId}-${revision}.png`;
|
|
213
|
-
/**
|
|
214
|
-
* A short fingerprint of the text of a `findings.json` (FNV-1a, 64 bits, in hex), so annotated
|
|
215
|
-
* copies drawn for other findings are never taken for this one's. Not a security measure.
|
|
216
|
-
*/
|
|
217
|
-
export const findingsRevision = (text) => {
|
|
218
|
-
let hash = 0xcbf29ce484222325n;
|
|
219
|
-
for (const byte of new TextEncoder().encode(text))
|
|
220
|
-
hash = BigInt.asUintN(64, (hash ^ BigInt(byte)) * 0x100000001b3n);
|
|
221
|
-
return hash.toString(16).padStart(16, '0');
|
|
222
|
-
};
|
|
223
|
-
const deviceOf = (spec, ledger) => {
|
|
224
|
-
const kind = spec.device ?? 'desktop';
|
|
225
|
-
return { kind, label: ledger.deviceLabel ?? (kind === 'mobile' ? 'Mobile' : 'Desktop') };
|
|
226
|
-
};
|
|
227
|
-
/**
|
|
228
|
-
* The report bundle of a run, from its job record and (current or final) ledger. `version` is
|
|
229
|
-
* the screw-bugs version building it (`generator`); undefined leaves that out.
|
|
230
|
-
*/
|
|
231
|
-
export const reportBundleOf = (job, ledger, writeUp = {}, version) => ({
|
|
232
|
-
...writeUp,
|
|
233
|
-
formatVersion: 1,
|
|
234
|
-
...(version !== undefined ? { generator: { name: 'screw-bugs', version } } : {}),
|
|
235
|
-
jobId: job.jobId,
|
|
236
|
-
spec: job.spec,
|
|
237
|
-
ledger,
|
|
238
|
-
startedAt: ledger.startedAt ?? job.createdAt,
|
|
239
|
-
...(ledger.finishedAt !== undefined ? { finishedAt: ledger.finishedAt } : {}),
|
|
240
|
-
summary: summaryOf(job.spec),
|
|
241
|
-
device: deviceOf(job.spec, ledger),
|
|
242
|
-
...(ledger.browser !== undefined ? { browser: ledger.browser } : {}),
|
|
243
|
-
files: { ledger: runFiles.ledger, html: runFiles.html, evidenceDir: runFiles.evidenceDir },
|
|
244
|
-
});
|
|
245
|
-
/**
|
|
246
|
-
* The cases the agent's findings mark failed (`CaseFindings.failed`), by case ID, with what is
|
|
247
|
-
* wrong. Empty without findings.
|
|
248
|
-
*/
|
|
249
|
-
export const agentFailures = (findings) => new Map((findings?.cases ?? []).flatMap((c) => c.failed !== undefined && c.failed.trim() !== '' ? [[c.id, c.failed.trim()]] : []));
|
|
250
|
-
/**
|
|
251
|
-
* A case's status as results show it: `failed` when the agent's findings mark it failed, else the
|
|
252
|
-
* code's. Findings can only turn a case into a failure, never make one pass.
|
|
253
|
-
*/
|
|
254
|
-
export const judgedCase = (entry, failures) => {
|
|
255
|
-
const agentFailed = failures.get(entry.id);
|
|
256
|
-
return agentFailed === undefined
|
|
257
|
-
? { ...entry, checkStatus: entry.status }
|
|
258
|
-
: { ...entry, status: 'failed', checkStatus: entry.status, agentFailed };
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* The ledger as everything that shows results reads it (reports, replies, the CLI): each case's
|
|
262
|
-
* status after the agent's findings (`judgedCase`). `ledger.json` and `evidence.json` keep the
|
|
263
|
-
* code's statuses.
|
|
264
|
-
*/
|
|
265
|
-
export const judgedLedger = (ledger, findings) => {
|
|
266
|
-
const failures = agentFailures(findings);
|
|
267
|
-
return { ...ledger, cases: ledger.cases.map((entry) => judgedCase(entry, failures)) };
|
|
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
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
/** The `state` the server makes per share: 16-128 of `A-Za-z0-9_-` (ours: 64 hex digits). */
|
|
3
|
-
export declare const ShareState: Schema.String;
|
|
4
|
-
/** A one-time upload ticket: 43 characters of base64url (32 random bytes). */
|
|
5
|
-
export declare const ShareTicket: Schema.String;
|
|
6
|
-
/** What Cloud's callback brings back to the local server, in its query. */
|
|
7
|
-
export declare const ShareCallback: Schema.Struct<{
|
|
8
|
-
readonly state: Schema.String;
|
|
9
|
-
readonly ticket: Schema.String;
|
|
10
|
-
readonly api: Schema.String;
|
|
11
|
-
}>;
|
|
12
|
-
export type ShareCallback = typeof ShareCallback.Type;
|
|
13
|
-
/** Cloud's reply to the start of an upload: where each file goes, and where to complete. */
|
|
14
|
-
export declare const CreatedShare: Schema.Struct<{
|
|
15
|
-
readonly slug: Schema.String;
|
|
16
|
-
/** Where to PUT each file, in the order they were given. */
|
|
17
|
-
readonly uploads: Schema.$Array<Schema.Struct<{
|
|
18
|
-
readonly path: Schema.String;
|
|
19
|
-
readonly url: Schema.String;
|
|
20
|
-
}>>;
|
|
21
|
-
readonly completeUrl: Schema.String;
|
|
22
|
-
readonly expiresAt: Schema.String;
|
|
23
|
-
}>;
|
|
24
|
-
export type CreatedShare = typeof CreatedShare.Type;
|
|
25
|
-
/** Cloud's reply once every file is stored: the link to give out, and the share's own page. */
|
|
26
|
-
export declare const CompletedShare: Schema.Struct<{
|
|
27
|
-
readonly slug: Schema.String;
|
|
28
|
-
readonly url: Schema.String;
|
|
29
|
-
readonly resultUrl: Schema.String;
|
|
30
|
-
readonly expiresAt: Schema.String;
|
|
31
|
-
}>;
|
|
32
|
-
export type CompletedShare = typeof CompletedShare.Type;
|
|
33
|
-
/** Every error reply of Cloud: a stable code and one sentence for people. */
|
|
34
|
-
export declare const ShareErrorReply: Schema.Struct<{
|
|
35
|
-
readonly error: Schema.String;
|
|
36
|
-
readonly message: Schema.String;
|
|
37
|
-
}>;
|
|
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
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
/*
|
|
3
|
-
* screw-bugs Cloud's upload protocol, as the local report server speaks it (the Share button).
|
|
4
|
-
* The Cloud repo's `docs/upload-protocol.md` is the reference: a person clicks Share in a report
|
|
5
|
-
* the local server served; the server sends the browser to Cloud's `/share/new` with a loopback
|
|
6
|
-
* `callback` and a random `state`; Cloud signs the person in, asks them to confirm, and sends the
|
|
7
|
-
* browser back to the callback with the `state` and a one-time upload `ticket`; the server then
|
|
8
|
-
* uploads with the ticket as a bearer token:
|
|
9
|
-
*
|
|
10
|
-
* 1. POST /api/shares the scrubbed bundle and its files -> `CreatedShare`
|
|
11
|
-
* 2. PUT <upload url> each file's bytes
|
|
12
|
-
* 3. POST <complete url> -> `CompletedShare`
|
|
13
|
-
*
|
|
14
|
-
* and sends the browser to `resultUrl`, the share's page on Cloud.
|
|
15
|
-
*/
|
|
16
|
-
/** The `state` the server makes per share: 16-128 of `A-Za-z0-9_-` (ours: 64 hex digits). */
|
|
17
|
-
export const ShareState = Schema.String.check(Schema.makeFilter((text) => /^[A-Za-z0-9_-]{16,128}$/.test(text) ? undefined : 'Must be 16-128 of A-Za-z0-9_-'));
|
|
18
|
-
/** A one-time upload ticket: 43 characters of base64url (32 random bytes). */
|
|
19
|
-
export const ShareTicket = Schema.String.check(Schema.makeFilter((text) => /^[A-Za-z0-9_-]{43}$/.test(text) ? undefined : 'Must be 43 characters of base64url'));
|
|
20
|
-
/** What Cloud's callback brings back to the local server, in its query. */
|
|
21
|
-
export const ShareCallback = Schema.Struct({
|
|
22
|
-
state: ShareState,
|
|
23
|
-
ticket: ShareTicket,
|
|
24
|
-
api: Schema.String,
|
|
25
|
-
});
|
|
26
|
-
/** Cloud's reply to the start of an upload: where each file goes, and where to complete. */
|
|
27
|
-
export const CreatedShare = Schema.Struct({
|
|
28
|
-
slug: Schema.String,
|
|
29
|
-
/** Where to PUT each file, in the order they were given. */
|
|
30
|
-
uploads: Schema.Array(Schema.Struct({ path: Schema.String, url: Schema.String })),
|
|
31
|
-
completeUrl: Schema.String,
|
|
32
|
-
expiresAt: Schema.String,
|
|
33
|
-
});
|
|
34
|
-
/** Cloud's reply once every file is stored: the link to give out, and the share's own page. */
|
|
35
|
-
export const CompletedShare = Schema.Struct({
|
|
36
|
-
slug: Schema.String,
|
|
37
|
-
url: Schema.String,
|
|
38
|
-
resultUrl: Schema.String,
|
|
39
|
-
expiresAt: Schema.String,
|
|
40
|
-
});
|
|
41
|
-
/** Every error reply of Cloud: a stable code and one sentence for people. */
|
|
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 });
|
package/dist/schema/status.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
/** Outcome of one test case. `not_verified` means the run ended before the case could be judged. */
|
|
3
|
-
export declare const CaseStatus: Schema.Literals<readonly ["passed", "failed", "blocked", "not_verified"]>;
|
|
4
|
-
export type CaseStatus = typeof CaseStatus.Type;
|
|
5
|
-
/** Lifecycle of a job, as reported by `run_status` and `screw-bugs status`. */
|
|
6
|
-
export declare const JobState: Schema.Literals<readonly ["queued", "running", "waiting_for_answer", "finished", "errored"]>;
|
|
7
|
-
export type JobState = typeof JobState.Type;
|
package/dist/schema/status.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
/** Outcome of one test case. `not_verified` means the run ended before the case could be judged. */
|
|
3
|
-
export const CaseStatus = Schema.Literals(['passed', 'failed', 'blocked', 'not_verified']);
|
|
4
|
-
/** Lifecycle of a job, as reported by `run_status` and `screw-bugs status`. */
|
|
5
|
-
export const JobState = Schema.Literals([
|
|
6
|
-
'queued',
|
|
7
|
-
'running',
|
|
8
|
-
'waiting_for_answer',
|
|
9
|
-
'finished',
|
|
10
|
-
'errored',
|
|
11
|
-
]);
|