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
|
@@ -9,10 +9,12 @@ import { runsDir } from '../store-local/index.js';
|
|
|
9
9
|
import { ExitCode } from './exit-codes.js';
|
|
10
10
|
import { makeShareRoutes, ShareSource } from './share.js';
|
|
11
11
|
import { Failure } from './failure.js';
|
|
12
|
+
import { isCi } from './environment.js';
|
|
13
|
+
import { TAILNET, Tailnet } from './tailnet.js';
|
|
12
14
|
/**
|
|
13
15
|
* A local HTTP server for reports, for browsers that cannot open `file://` (the ones built into
|
|
14
|
-
* coding tools). It binds one address
|
|
15
|
-
* (see `reportHost`), and serves the runs folder read-only: only files with
|
|
16
|
+
* coding tools). It binds one address: `SCREW_BUGS_REPORT_HOST`'s, or unset this machine's on
|
|
17
|
+
* the tailnet when Tailscale runs, else 127.0.0.1 (see `reportHost`), and serves the runs folder read-only: only files with
|
|
16
18
|
* the extensions a report uses, never a directory listing, a dotfile, or anything outside the
|
|
17
19
|
* folder (also through symlinks). Range requests (206, 416) come from `HttpStaticServer`, so
|
|
18
20
|
* videos seek and play. In a process that can share (see `ShareSource`), it also answers the
|
|
@@ -28,29 +30,52 @@ const unbracketed = (host) => host.replace(/^\[(.*)\]$/, '$1');
|
|
|
28
30
|
/** A host as it goes in a URL: an IPv6 address in brackets. */
|
|
29
31
|
export const urlHost = (host) => (host.includes(':') ? `[${host}]` : host);
|
|
30
32
|
/**
|
|
31
|
-
* `SCREW_BUGS_REPORT_HOST`: where the report server listens, and the host in its links.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
33
|
+
* `SCREW_BUGS_REPORT_HOST`: where the report server listens, and the host in its links. Unset,
|
|
34
|
+
* this machine's name on the tailnet when Tailscale is running (see `Tailnet`; never in CI), else
|
|
35
|
+
* 127.0.0.1; `127.0.0.1` keeps reports on this machine. A MagicDNS name, tailnet IP or `tailnet`
|
|
36
|
+
* opens reports from another device (a name binds the one address it resolves to). Never every
|
|
37
|
+
* interface: `0.0.0.0` or `::` is a `Failure` (an empty value is unset).
|
|
35
38
|
*/
|
|
36
39
|
export const reportHost = Effect.suspend(() => hostSetting('SCREW_BUGS_REPORT_HOST', 'report_host'));
|
|
37
40
|
/**
|
|
38
41
|
* A server's host setting (`SCREW_BUGS_REPORT_HOST`, `SCREW_BUGS_SIGN_IN_HOST`): one address or
|
|
39
|
-
* name of this machine, canonical (`canonicalHost`)
|
|
40
|
-
*
|
|
42
|
+
* name of this machine, canonical (`canonicalHost`). When `variable` is unset or empty,
|
|
43
|
+
* `follows` (another variable) is read in its place. Unset or empty, and `tailnet` (any case), are
|
|
44
|
+
* this machine's host on the tailnet, or 127.0.0.1 when Tailscale is not running (see `Tailnet`;
|
|
45
|
+
* only `tailnet` says so on stderr); unset is 127.0.0.1 in CI. Every spelling of every interface (`0.0.0.0`, `0`, `::`, …) is a `Failure` with
|
|
46
|
+
* `reason`.
|
|
41
47
|
*/
|
|
42
|
-
export const hostSetting = (variable, reason) =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
export const hostSetting = (variable, reason, follows) => hostSettingOf(variable, reason, follows).pipe(Effect.map(({ host }) => host));
|
|
49
|
+
/** `hostSetting`, with the variable it was read from (`variable`, or `follows` in its place). */
|
|
50
|
+
export const hostSettingOf = (variable, reason, follows) => Effect.gen(function* () {
|
|
51
|
+
const read = (name) => Config.String(name).pipe(Config.withDefault(''), Effect.orDie, Effect.map((v) => v.trim()));
|
|
52
|
+
let from = variable;
|
|
53
|
+
let value = yield* read(variable);
|
|
54
|
+
if (value === '' && follows !== undefined) {
|
|
55
|
+
from = follows;
|
|
56
|
+
value = yield* read(follows);
|
|
57
|
+
}
|
|
58
|
+
// Unset: on the tailnet when Tailscale is running (never in CI), else 127.0.0.1, silently.
|
|
59
|
+
if (value === '') {
|
|
60
|
+
if (yield* isCi)
|
|
61
|
+
return { host: REPORT_HOST, variable: from };
|
|
62
|
+
const status = yield* (yield* Tailnet).status;
|
|
63
|
+
return { host: status.running ? status.host : REPORT_HOST, variable: from };
|
|
64
|
+
}
|
|
65
|
+
if (value.toLowerCase() === TAILNET) {
|
|
66
|
+
const tailnet = yield* Tailnet;
|
|
67
|
+
return { host: (yield* tailnet.host) ?? REPORT_HOST, variable: from };
|
|
68
|
+
}
|
|
69
|
+
const host = canonicalHost(unbracketed(value));
|
|
70
|
+
if (host === undefined || isUnspecified(host))
|
|
71
|
+
return yield* new Failure({
|
|
47
72
|
code: ExitCode.Usage,
|
|
48
73
|
reason,
|
|
49
|
-
message: `${
|
|
50
|
-
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
})
|
|
74
|
+
message: `${from} is "${value}"; give one address or name of this machine, ` +
|
|
75
|
+
`such as its MagicDNS name or tailnet IP, or "${TAILNET}", or 127.0.0.1 for this machine only.`,
|
|
76
|
+
});
|
|
77
|
+
return { host, variable: from };
|
|
78
|
+
});
|
|
54
79
|
/**
|
|
55
80
|
* The address a server set to `host` (from `variable`) listens on, as a URL writes it without
|
|
56
81
|
* brackets; a `Failure` with `reason` when that is every interface (a name that resolved to an
|
package/dist/cli/share.js
CHANGED
|
@@ -7,7 +7,7 @@ import { base64, hex, renderSharePage, SHARE_START_PATH, sha256, sharePageCsp, }
|
|
|
7
7
|
import { CompletedShare, CreatedShare, JobId, ShareCallback, ShareClaimed, ShareErrorReply, ShareRequestCreated, ShareState, } from '../schema/index.js';
|
|
8
8
|
/*
|
|
9
9
|
* The Share button's local side: routes of the report server that put a run on screw-bugs Cloud,
|
|
10
|
-
* following Cloud's upload protocol (see `src/schema/share.ts`). Only a person can share: it
|
|
10
|
+
* following Cloud's upload protocol (see `packages/core/src/schema/share.ts`). Only a person can share: it
|
|
11
11
|
* takes a click in a report this server served, and a confirmation on Cloud.
|
|
12
12
|
*
|
|
13
13
|
* start the report's Share button: remembers a random `state` for the run, and sends the
|
|
@@ -764,7 +764,7 @@ export const makeShareRoutes = (root) => Effect.gen(function* () {
|
|
|
764
764
|
const phase = entry.phase;
|
|
765
765
|
switch (phase._tag) {
|
|
766
766
|
case 'pairing':
|
|
767
|
-
return sharePage('
|
|
767
|
+
return sharePage('Enter this code on Screw Bugs Cloud', 'Open Screw Bugs Cloud (that copies this code), sign in, and paste the code there to share the report. This page moves on by itself once you confirm there.', {
|
|
768
768
|
code: phase.code,
|
|
769
769
|
link: { href: phase.confirmUrl, text: 'Open Screw Bugs Cloud' },
|
|
770
770
|
refresh: PAIRING_REFRESH_S,
|
package/dist/cli/sign-in.d.ts
CHANGED
|
@@ -9,10 +9,16 @@ export declare const FRAME_WAIT_MS = 15000;
|
|
|
9
9
|
/** How long fetching the app's icon may take in all; the sign-in opens without it after. */
|
|
10
10
|
export declare const SIGN_IN_ICON_TIMEOUT: Duration.Duration;
|
|
11
11
|
/**
|
|
12
|
-
* `SCREW_BUGS_SIGN_IN_HOST`: where the sign-in server listens, and the host in its link.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* `SCREW_BUGS_SIGN_IN_HOST`: where the sign-in server listens, and the host in its link. When
|
|
13
|
+
* unset, `SCREW_BUGS_REPORT_HOST`'s value (so one variable covers both); with both unset, this
|
|
14
|
+
* machine's tailnet host when Tailscale runs (not in CI), else 127.0.0.1. Set it to `127.0.0.1` to
|
|
15
|
+
* keep sign-ins on this machine, or to a MagicDNS name, tailnet IP or `tailnet`. Read as `SCREW_BUGS_REPORT_HOST` is (`hostSetting`): never every interface.
|
|
15
16
|
*/
|
|
17
|
+
export declare const signInHostOf: Effect.Effect<{
|
|
18
|
+
host: string;
|
|
19
|
+
variable: string;
|
|
20
|
+
}, Failure, never>;
|
|
21
|
+
/** The host of `signInHostOf` alone. */
|
|
16
22
|
export declare const signInHost: Effect.Effect<string, Failure, never>;
|
|
17
23
|
/** How a sign-in ended. */
|
|
18
24
|
export type SignInOutcome = 'saved' | 'cancelled' | 'idle';
|
package/dist/cli/sign-in.js
CHANGED
|
@@ -10,12 +10,12 @@ import { hex, renderSignInPage, SIGN_IN_CSP } from '../report/index.js';
|
|
|
10
10
|
import { SignInInputs } from '../schema/index.js';
|
|
11
11
|
import { ExitCode } from './exit-codes.js';
|
|
12
12
|
import { Failure } from './failure.js';
|
|
13
|
-
import { boundAddress,
|
|
13
|
+
import { boundAddress, hostSettingOf, isLoopback, urlHost } from './report-server.js';
|
|
14
14
|
/*
|
|
15
15
|
* Signing in to a test account: a headless browser at the app, which a person drives from a web
|
|
16
16
|
* page (the live view, `renderSignInPage`) in whatever browser reaches this machine: the one built
|
|
17
17
|
* into their coding tool, or a phone on their tailnet. Each sign-in gets a server of its own on a
|
|
18
|
-
* free port, bound to `SCREW_BUGS_SIGN_IN_HOST` (
|
|
18
|
+
* free port, bound to `SCREW_BUGS_SIGN_IN_HOST` (else `SCREW_BUGS_REPORT_HOST`'s host, see `hostSetting`), answering only under a
|
|
19
19
|
* random token and only to its own Host; it ends when the person saves or cancels, after
|
|
20
20
|
* `SIGN_IN_IDLE` without a request, or with the process. Only the session is kept: the cookies
|
|
21
21
|
* the browser sends to the app and its origin's storage, in the account book. Nothing typed is
|
|
@@ -30,11 +30,14 @@ export const SIGN_IN_ICON_TIMEOUT = Duration.seconds(3);
|
|
|
30
30
|
/** The largest input request taken: a few hundred inputs. */
|
|
31
31
|
const INPUT_BYTES_MAX = 256 * 1024;
|
|
32
32
|
/**
|
|
33
|
-
* `SCREW_BUGS_SIGN_IN_HOST`: where the sign-in server listens, and the host in its link.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* `SCREW_BUGS_SIGN_IN_HOST`: where the sign-in server listens, and the host in its link. When
|
|
34
|
+
* unset, `SCREW_BUGS_REPORT_HOST`'s value (so one variable covers both); with both unset, this
|
|
35
|
+
* machine's tailnet host when Tailscale runs (not in CI), else 127.0.0.1. Set it to `127.0.0.1` to
|
|
36
|
+
* keep sign-ins on this machine, or to a MagicDNS name, tailnet IP or `tailnet`. Read as `SCREW_BUGS_REPORT_HOST` is (`hostSetting`): never every interface.
|
|
36
37
|
*/
|
|
37
|
-
export const
|
|
38
|
+
export const signInHostOf = Effect.suspend(() => hostSettingOf('SCREW_BUGS_SIGN_IN_HOST', 'sign_in_host', 'SCREW_BUGS_REPORT_HOST'));
|
|
39
|
+
/** The host of `signInHostOf` alone. */
|
|
40
|
+
export const signInHost = signInHostOf.pipe(Effect.map(({ host }) => host));
|
|
38
41
|
/** The handle for an open sign-in. */
|
|
39
42
|
const handleOf = (entry) => ({
|
|
40
43
|
link: entry.link,
|
|
@@ -210,7 +213,7 @@ export class SignIns extends Context.Service()('screw-bugs/SignIns') {
|
|
|
210
213
|
const lock = yield* Semaphore.make(1);
|
|
211
214
|
const pending = new Map();
|
|
212
215
|
const open = (request) => Effect.gen(function* () {
|
|
213
|
-
const host = yield*
|
|
216
|
+
const { host, variable } = yield* signInHostOf;
|
|
214
217
|
const own = yield* Scope.fork(scope);
|
|
215
218
|
const opened = yield* Effect.gen(function* () {
|
|
216
219
|
const live = yield* browser.signIn(request.url).pipe(Effect.mapError((error) => new Failure({
|
|
@@ -256,12 +259,12 @@ export class SignIns extends Context.Service()('screw-bugs/SignIns') {
|
|
|
256
259
|
const server = yield* NodeHttpServer.make(() => createServer(), { port: 0, host }).pipe(Effect.mapError((error) => new Failure({
|
|
257
260
|
code: ExitCode.Usage,
|
|
258
261
|
reason: 'sign_in_serve',
|
|
259
|
-
message: `Could not serve the sign-in page on ${host} (check
|
|
262
|
+
message: `Could not serve the sign-in page on ${host} (check ${variable}): ` +
|
|
260
263
|
String(error.cause),
|
|
261
264
|
})));
|
|
262
265
|
if ('port' in server.address)
|
|
263
266
|
port = server.address.port;
|
|
264
|
-
const bound = yield* boundAddress(server.address, host,
|
|
267
|
+
const bound = yield* boundAddress(server.address, host, variable, 'sign_in_host');
|
|
265
268
|
// The host it was set to, and the address that is (a name's IP): both can be opened.
|
|
266
269
|
hosts.add(`${urlHost(host)}:${port}`);
|
|
267
270
|
hosts.add(`${urlHost(bound)}:${port}`);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Context, Duration, Effect, Layer, Schema } from 'effect';
|
|
2
|
+
import { ChildProcessSpawner } from 'effect/process';
|
|
3
|
+
/**
|
|
4
|
+
* Tailscale, for the host settings (`SCREW_BUGS_REPORT_HOST`) when unset or `tailnet`: this
|
|
5
|
+
* machine's MagicDNS name (its tailnet IPv4 when MagicDNS is off), read from `tailscale status
|
|
6
|
+
* --json` once per process. Unset, reports and sign-ins go there whenever Tailscale is running
|
|
7
|
+
* (not in CI); `SCREW_BUGS_REPORT_HOST=127.0.0.1` keeps them on this machine, and doctor says so
|
|
8
|
+
* (see `checkTailnet`).
|
|
9
|
+
*/
|
|
10
|
+
/** The value of a host setting that means "this machine's name on the tailnet". */
|
|
11
|
+
export declare const TAILNET = "tailnet";
|
|
12
|
+
/** The few fields of `tailscale status --json` screw-bugs reads; the rest is ignored. */
|
|
13
|
+
export declare const TailscaleStatus: Schema.Struct<{
|
|
14
|
+
readonly BackendState: Schema.String;
|
|
15
|
+
readonly Self: Schema.optionalKey<Schema.NullOr<Schema.Struct<{
|
|
16
|
+
readonly DNSName: Schema.optionalKey<Schema.String>;
|
|
17
|
+
readonly TailscaleIPs: Schema.optionalKey<Schema.NullOr<Schema.$Array<Schema.String>>>;
|
|
18
|
+
}>>>;
|
|
19
|
+
readonly CurrentTailnet: Schema.optionalKey<Schema.NullOr<Schema.Struct<{
|
|
20
|
+
readonly MagicDNSEnabled: Schema.optionalKey<Schema.Boolean>;
|
|
21
|
+
}>>>;
|
|
22
|
+
}>;
|
|
23
|
+
export type TailscaleStatus = typeof TailscaleStatus.Type;
|
|
24
|
+
/** What the lookup found: this machine's host on the tailnet, or why there is none. */
|
|
25
|
+
export type TailnetStatus = {
|
|
26
|
+
readonly running: true;
|
|
27
|
+
readonly host: string;
|
|
28
|
+
} | {
|
|
29
|
+
readonly running: false;
|
|
30
|
+
readonly why: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* This machine's host on a running tailnet: its MagicDNS name without the trailing dot, lowercase,
|
|
34
|
+
* unless the tailnet has MagicDNS off; otherwise its first tailnet IPv4.
|
|
35
|
+
*/
|
|
36
|
+
export declare const tailnetStatusOf: (status: TailscaleStatus) => TailnetStatus;
|
|
37
|
+
/** How long `tailscale status` may take. */
|
|
38
|
+
export declare const LOOKUP_TIMEOUT: Duration.Duration;
|
|
39
|
+
/** Asks the Tailscale CLI for this machine's status; never fails. */
|
|
40
|
+
export declare const lookupTailnet: Effect.Effect<TailnetStatus, never, ChildProcessSpawner.ChildProcessSpawner>;
|
|
41
|
+
export interface TailnetLookup {
|
|
42
|
+
/** What Tailscale said, the first time anything asked. */
|
|
43
|
+
readonly status: Effect.Effect<TailnetStatus>;
|
|
44
|
+
/**
|
|
45
|
+
* The host for a setting of `tailnet`: Tailscale's, or undefined when it is not running. The
|
|
46
|
+
* first time it is undefined, one line on stderr says the servers use 127.0.0.1 instead.
|
|
47
|
+
*/
|
|
48
|
+
readonly host: Effect.Effect<string | undefined>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* This machine's tailnet, looked up once per process (on first need) so every link a process gives
|
|
52
|
+
* names the address its servers bound. Without `TailnetLive` (tests, and code with no process
|
|
53
|
+
* around it), there is none.
|
|
54
|
+
*/
|
|
55
|
+
export declare const Tailnet: Context.Reference<TailnetLookup>;
|
|
56
|
+
/** The lookup through the Tailscale CLI, cached for the process. */
|
|
57
|
+
export declare const TailnetLive: Layer.Layer<never, never, ChildProcessSpawner.ChildProcessSpawner>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Console, Context, Duration, Effect, Layer, Schema } from 'effect';
|
|
2
|
+
import { ChildProcess, ChildProcessSpawner } from 'effect/process';
|
|
3
|
+
/**
|
|
4
|
+
* Tailscale, for the host settings (`SCREW_BUGS_REPORT_HOST`) when unset or `tailnet`: this
|
|
5
|
+
* machine's MagicDNS name (its tailnet IPv4 when MagicDNS is off), read from `tailscale status
|
|
6
|
+
* --json` once per process. Unset, reports and sign-ins go there whenever Tailscale is running
|
|
7
|
+
* (not in CI); `SCREW_BUGS_REPORT_HOST=127.0.0.1` keeps them on this machine, and doctor says so
|
|
8
|
+
* (see `checkTailnet`).
|
|
9
|
+
*/
|
|
10
|
+
/** The value of a host setting that means "this machine's name on the tailnet". */
|
|
11
|
+
export const TAILNET = 'tailnet';
|
|
12
|
+
/** The few fields of `tailscale status --json` screw-bugs reads; the rest is ignored. */
|
|
13
|
+
export const TailscaleStatus = Schema.Struct({
|
|
14
|
+
BackendState: Schema.String,
|
|
15
|
+
Self: Schema.optionalKey(Schema.NullOr(Schema.Struct({
|
|
16
|
+
DNSName: Schema.optionalKey(Schema.String),
|
|
17
|
+
TailscaleIPs: Schema.optionalKey(Schema.NullOr(Schema.Array(Schema.String))),
|
|
18
|
+
}))),
|
|
19
|
+
CurrentTailnet: Schema.optionalKey(Schema.NullOr(Schema.Struct({ MagicDNSEnabled: Schema.optionalKey(Schema.Boolean) }))),
|
|
20
|
+
});
|
|
21
|
+
const IPV4 = /^\d{1,3}(\.\d{1,3}){3}$/;
|
|
22
|
+
/**
|
|
23
|
+
* This machine's host on a running tailnet: its MagicDNS name without the trailing dot, lowercase,
|
|
24
|
+
* unless the tailnet has MagicDNS off; otherwise its first tailnet IPv4.
|
|
25
|
+
*/
|
|
26
|
+
export const tailnetStatusOf = (status) => {
|
|
27
|
+
if (status.BackendState !== 'Running')
|
|
28
|
+
return { running: false, why: `Tailscale is ${status.BackendState.toLowerCase()}` };
|
|
29
|
+
const name = status.Self?.DNSName?.trim().replace(/\.$/, '').toLowerCase() ?? '';
|
|
30
|
+
const magicDns = status.CurrentTailnet?.MagicDNSEnabled !== false;
|
|
31
|
+
if (magicDns && name !== '')
|
|
32
|
+
return { running: true, host: name };
|
|
33
|
+
const ipv4 = (status.Self?.TailscaleIPs ?? []).find((ip) => IPV4.test(ip));
|
|
34
|
+
return ipv4 === undefined
|
|
35
|
+
? { running: false, why: 'Tailscale gave this machine no name or IPv4 address' }
|
|
36
|
+
: { running: true, host: ipv4 };
|
|
37
|
+
};
|
|
38
|
+
/** How long `tailscale status` may take. */
|
|
39
|
+
export const LOOKUP_TIMEOUT = Duration.seconds(3);
|
|
40
|
+
/**
|
|
41
|
+
* Where the Tailscale CLI may be: on the PATH, else the macOS app's own (the Mac App Store and
|
|
42
|
+
* standalone apps do not put one on the PATH).
|
|
43
|
+
*/
|
|
44
|
+
const TAILSCALE_COMMANDS = ['tailscale', '/Applications/Tailscale.app/Contents/MacOS/Tailscale'];
|
|
45
|
+
const decodeStatus = Schema.decodeUnknownEffect(Schema.fromJsonString(TailscaleStatus));
|
|
46
|
+
/** Asks the Tailscale CLI for this machine's status; never fails. */
|
|
47
|
+
export const lookupTailnet = Effect.gen(function* () {
|
|
48
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
49
|
+
for (const command of TAILSCALE_COMMANDS) {
|
|
50
|
+
const out = yield* spawner
|
|
51
|
+
.string(ChildProcess.make(command, ['status', '--json'], { stdin: 'ignore' }))
|
|
52
|
+
.pipe(Effect.timeout(LOOKUP_TIMEOUT), Effect.option);
|
|
53
|
+
if (out._tag === 'None')
|
|
54
|
+
continue;
|
|
55
|
+
return yield* decodeStatus(out.value).pipe(Effect.map(tailnetStatusOf), Effect.orElseSucceed(() => ({
|
|
56
|
+
running: false,
|
|
57
|
+
why: 'Tailscale gave a status screw-bugs cannot read',
|
|
58
|
+
})));
|
|
59
|
+
}
|
|
60
|
+
return { running: false, why: 'Tailscale is not installed or did not answer' };
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* This machine's tailnet, looked up once per process (on first need) so every link a process gives
|
|
64
|
+
* names the address its servers bound. Without `TailnetLive` (tests, and code with no process
|
|
65
|
+
* around it), there is none.
|
|
66
|
+
*/
|
|
67
|
+
export const Tailnet = Context.Reference('screw-bugs/Tailnet', {
|
|
68
|
+
defaultValue: () => ({
|
|
69
|
+
status: Effect.succeed({ running: false, why: 'Tailscale was not looked up' }),
|
|
70
|
+
host: Effect.succeed(undefined),
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
73
|
+
/** The lookup through the Tailscale CLI, cached for the process. */
|
|
74
|
+
export const TailnetLive = Layer.effect(Tailnet, Effect.gen(function* () {
|
|
75
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
76
|
+
const status = yield* Effect.cached(lookupTailnet.pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner)));
|
|
77
|
+
const host = yield* Effect.cached(status.pipe(Effect.flatMap((found) => found.running
|
|
78
|
+
? Effect.succeed(found.host)
|
|
79
|
+
: Console.error(`screw-bugs: a host setting is "${TAILNET}", but ${found.why}; ` +
|
|
80
|
+
'serving on 127.0.0.1 until screw-bugs restarts.').pipe(Effect.as(undefined)))));
|
|
81
|
+
return { status, host };
|
|
82
|
+
}));
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export * from './engine.js';
|
|
3
|
-
export * from './errors.js';
|
|
4
|
-
export * from './evidence.js';
|
|
5
|
-
export * from './labels.js';
|
|
6
|
-
export * from './css.js';
|
|
7
|
-
export * from './marks.js';
|
|
8
|
-
export * from './services.js';
|
|
9
|
-
export * from './steps.js';
|
|
10
|
-
export * from './liveness.js';
|
|
11
|
-
export * from './video.js';
|
|
12
|
-
export * from './uploads.js';
|
|
13
|
-
export * from './viewport.js';
|
|
14
|
-
export * from './share.js';
|
|
1
|
+
export * from '@screw-bugs/core/core';
|
package/dist/core/index.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export * from '
|
|
4
|
-
export * from './evidence.js';
|
|
5
|
-
export * from './labels.js';
|
|
6
|
-
export * from './css.js';
|
|
7
|
-
export * from './marks.js';
|
|
8
|
-
export * from './services.js';
|
|
9
|
-
export * from './steps.js';
|
|
10
|
-
export * from './liveness.js';
|
|
11
|
-
export * from './video.js';
|
|
12
|
-
export * from './uploads.js';
|
|
13
|
-
export * from './viewport.js';
|
|
14
|
-
export * from './share.js';
|
|
1
|
+
// screw-bugs' `core` module lives in @screw-bugs/core, the platform-free package that screw-bugs
|
|
2
|
+
// Cloud shares; this keeps `screw-bugs/core` and the module boundaries working.
|
|
3
|
+
export * from '@screw-bugs/core/core';
|
package/dist/report/index.d.ts
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export * from './pr-summary.js';
|
|
3
|
-
export { SHARE_START_PATH } from './menu-bar.js';
|
|
4
|
-
export { stepText } from './view.js';
|
|
5
|
-
export { base64, cspHash, hex, hmacSha256, sha256 } from './sha256.js';
|
|
6
|
-
export { renderWalkthrough, WALKTHROUGH_CSP, WALKTHROUGH_SCRIPT, walkthroughCsp, } from './walkthrough.js';
|
|
7
|
-
export { AssetBaseUrl, type RenderOptions } from './assets.js';
|
|
8
|
-
export { renderSignInPage, SIGN_IN_CSP, SIGN_IN_SCRIPT } from './sign-in.js';
|
|
9
|
-
export { LIVE_CSP, LIVE_REFRESH_S, renderLivePage } from './live.js';
|
|
10
|
-
export { renderSharePage, SHARE_PAGE_SCRIPT, SHARE_POLL_MS, SHARE_WEBP_QUALITY, type SharePage, sharePageCsp, } from './share-page.js';
|
|
1
|
+
export * from '@screw-bugs/core/report';
|
package/dist/report/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export { stepText } from './view.js';
|
|
5
|
-
export { base64, cspHash, hex, hmacSha256, sha256 } from './sha256.js';
|
|
6
|
-
export { renderWalkthrough, WALKTHROUGH_CSP, WALKTHROUGH_SCRIPT, walkthroughCsp, } from './walkthrough.js';
|
|
7
|
-
export { AssetBaseUrl } from './assets.js';
|
|
8
|
-
export { renderSignInPage, SIGN_IN_CSP, SIGN_IN_SCRIPT } from './sign-in.js';
|
|
9
|
-
export { LIVE_CSP, LIVE_REFRESH_S, renderLivePage } from './live.js';
|
|
10
|
-
export { renderSharePage, SHARE_PAGE_SCRIPT, SHARE_POLL_MS, SHARE_WEBP_QUALITY, sharePageCsp, } from './share-page.js';
|
|
1
|
+
// screw-bugs' `report` module lives in @screw-bugs/core, the platform-free package that screw-bugs
|
|
2
|
+
// Cloud shares; this keeps `screw-bugs/report` and the module boundaries working.
|
|
3
|
+
export * from '@screw-bugs/core/report';
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export * from './config.js';
|
|
3
|
-
export * from './doctor.js';
|
|
4
|
-
export * from './evidence.js';
|
|
5
|
-
export * from './findings.js';
|
|
6
|
-
export * from './job.js';
|
|
7
|
-
export * from './ledger.js';
|
|
8
|
-
export * from './status.js';
|
|
9
|
-
export * from './share.js';
|
|
1
|
+
export * from '@screw-bugs/core/schema';
|
package/dist/schema/index.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export * from '
|
|
4
|
-
export * from './evidence.js';
|
|
5
|
-
export * from './findings.js';
|
|
6
|
-
export * from './job.js';
|
|
7
|
-
export * from './ledger.js';
|
|
8
|
-
export * from './status.js';
|
|
9
|
-
export * from './share.js';
|
|
1
|
+
// screw-bugs' `schema` module lives in @screw-bugs/core, the platform-free package that screw-bugs
|
|
2
|
+
// Cloud shares; this keeps `screw-bugs/schema` and the module boundaries working.
|
|
3
|
+
export * from '@screw-bugs/core/schema';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "screw-bugs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Local browser QA for coding agents (MCP), people and CI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser",
|
|
@@ -43,20 +43,10 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"scripts": {
|
|
47
|
-
"build": "tsc -p tsconfig.build.json && node dist/cli/stamp-build.js",
|
|
48
|
-
"typecheck": "tsc -p tsconfig.json",
|
|
49
|
-
"lint": "oxlint --deny-warnings",
|
|
50
|
-
"format": "oxfmt",
|
|
51
|
-
"format:check": "oxfmt --check",
|
|
52
|
-
"test": "vitest run",
|
|
53
|
-
"check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm test",
|
|
54
|
-
"e2e": "tsc -p e2e && node e2e/run.ts",
|
|
55
|
-
"prepack": "node -e \"process.getBuiltinModule('fs').rmSync('dist',{recursive:true,force:true})\" && pnpm build"
|
|
56
|
-
},
|
|
57
46
|
"dependencies": {
|
|
58
47
|
"@effect/platform-node": "^4.1.0",
|
|
59
48
|
"@modelcontextprotocol/server": "2.4.0",
|
|
49
|
+
"@screw-bugs/core": "0.1.11",
|
|
60
50
|
"effect": "^4.1.0",
|
|
61
51
|
"playwright-core": "1.64.1"
|
|
62
52
|
},
|
|
@@ -71,5 +61,15 @@
|
|
|
71
61
|
"engines": {
|
|
72
62
|
"node": ">=22.19.0"
|
|
73
63
|
},
|
|
74
|
-
"
|
|
75
|
-
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "pnpm --filter @screw-bugs/core build && tsc -p tsconfig.build.json && node dist/cli/stamp-build.js",
|
|
66
|
+
"typecheck": "pnpm --filter @screw-bugs/core typecheck && tsc -p tsconfig.json",
|
|
67
|
+
"lint": "oxlint --deny-warnings",
|
|
68
|
+
"format": "oxfmt",
|
|
69
|
+
"format:check": "oxfmt --check",
|
|
70
|
+
"test": "vitest run",
|
|
71
|
+
"check:workers": "pnpm --filter @screw-bugs/core check:workers",
|
|
72
|
+
"check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm test && pnpm check:workers",
|
|
73
|
+
"e2e": "tsc -p e2e && node e2e/run.ts"
|
|
74
|
+
}
|
|
75
|
+
}
|
package/dist/core/accounts.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { SavedAccount } from './services.js';
|
|
2
|
-
import { type JobAccount, type SavedSession, type SignInWhy } from '../schema/index.js';
|
|
3
|
-
/** How recent a session counts as just signed in, so `renew` does not ask for it again. */
|
|
4
|
-
export declare const RENEW_GRACE_MS: number;
|
|
5
|
-
/**
|
|
6
|
-
* Whether the browser sends a cookie of `domain` (as Playwright gives it) to `origin`'s host. A
|
|
7
|
-
* host-only cookie (no leading dot) goes to its own host alone; a domain cookie (`.acme.dev`) to
|
|
8
|
-
* that host and every name under it (RFC 6265 domain matching). Browsers never keep a cookie for
|
|
9
|
-
* a public suffix (`co.uk`, `github.io`), so this never takes in another site that shares one;
|
|
10
|
-
* a sibling's cookie (`api.acme.dev` for `app.acme.dev`), or the parent's own host-only one, is
|
|
11
|
-
* not kept either.
|
|
12
|
-
*/
|
|
13
|
-
export declare const sentTo: (origin: string, domain: string) => boolean;
|
|
14
|
-
/** The origin of a job URL, such as `http://localhost:3000`; undefined for one that is not a URL. */
|
|
15
|
-
export declare const originOf: (url: string) => string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Whether every cookie of the session has an expiry and it has passed: then the browser would
|
|
18
|
-
* start with none of them, and the session cannot work. A session with no cookies at all may
|
|
19
|
-
* live in storage, so it counts as working.
|
|
20
|
-
*/
|
|
21
|
-
export declare const sessionExpired: (session: Pick<SavedSession, 'cookies'>, nowMs: number) => boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Why a run of a job with `account` at `url` cannot start from its saved session yet (a person has
|
|
24
|
-
* to sign in to it first), or undefined when it can.
|
|
25
|
-
*/
|
|
26
|
-
export declare const needsSignIn: (account: JobAccount, url: string, saved: SavedAccount | undefined, nowMs: number) => SignInWhy | undefined;
|
|
27
|
-
/** What kind of user the account is: what the job says, else what was saved. */
|
|
28
|
-
export declare const aboutOf: (account: JobAccount, saved: SavedAccount | undefined) => string | undefined;
|
|
29
|
-
/** Why the account needs signing in, as the end of a sentence about it. */
|
|
30
|
-
export declare const describeSignInWhy: (why: SignInWhy) => string;
|
|
31
|
-
/** At most this long, the app's title as the live view shows it. */
|
|
32
|
-
export declare const SITE_TITLE_MAX = 120;
|
|
33
|
-
/** A page title on one line, cut to `SITE_TITLE_MAX`; undefined when blank. */
|
|
34
|
-
export declare const siteTitle: (raw: string) => string | undefined;
|
|
35
|
-
/** At most this many icon addresses are tried, best first. */
|
|
36
|
-
export declare const SITE_ICONS_MAX = 4;
|
|
37
|
-
/** The largest icon the live view shows, in bytes. */
|
|
38
|
-
export declare const SITE_ICON_BYTES_MAX: number;
|
|
39
|
-
/** The image type of an icon from its `Content-Type`, or undefined when it is not one shown. */
|
|
40
|
-
export declare const siteIconType: (contentType: string | undefined) => string | undefined;
|
package/dist/core/accounts.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { DateTime, Option } from 'effect';
|
|
2
|
-
import { accountAboutOf, } from '../schema/index.js';
|
|
3
|
-
/** How recent a session counts as just signed in, so `renew` does not ask for it again. */
|
|
4
|
-
export const RENEW_GRACE_MS = 10 * 60_000;
|
|
5
|
-
/**
|
|
6
|
-
* Whether the browser sends a cookie of `domain` (as Playwright gives it) to `origin`'s host. A
|
|
7
|
-
* host-only cookie (no leading dot) goes to its own host alone; a domain cookie (`.acme.dev`) to
|
|
8
|
-
* that host and every name under it (RFC 6265 domain matching). Browsers never keep a cookie for
|
|
9
|
-
* a public suffix (`co.uk`, `github.io`), so this never takes in another site that shares one;
|
|
10
|
-
* a sibling's cookie (`api.acme.dev` for `app.acme.dev`), or the parent's own host-only one, is
|
|
11
|
-
* not kept either.
|
|
12
|
-
*/
|
|
13
|
-
export const sentTo = (origin, domain) => {
|
|
14
|
-
const host = URL.parse(origin)
|
|
15
|
-
?.hostname.toLowerCase()
|
|
16
|
-
.replace(/^\[|\]$/g, '');
|
|
17
|
-
const lower = domain.toLowerCase().replace(/\.$/, '');
|
|
18
|
-
const bare = lower.replace(/^\./, '');
|
|
19
|
-
if (host === undefined || bare === '')
|
|
20
|
-
return false;
|
|
21
|
-
return host === bare || (lower.startsWith('.') && host.endsWith(`.${bare}`));
|
|
22
|
-
};
|
|
23
|
-
/** The origin of a job URL, such as `http://localhost:3000`; undefined for one that is not a URL. */
|
|
24
|
-
export const originOf = (url) => {
|
|
25
|
-
const parsed = URL.parse(url);
|
|
26
|
-
return parsed === null ? undefined : parsed.origin;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Whether every cookie of the session has an expiry and it has passed: then the browser would
|
|
30
|
-
* start with none of them, and the session cannot work. A session with no cookies at all may
|
|
31
|
-
* live in storage, so it counts as working.
|
|
32
|
-
*/
|
|
33
|
-
export const sessionExpired = (session, nowMs) => session.cookies.length > 0 &&
|
|
34
|
-
session.cookies.every((c) => c.expires > 0 && c.expires * 1000 <= nowMs);
|
|
35
|
-
/**
|
|
36
|
-
* Why a run of a job with `account` at `url` cannot start from its saved session yet (a person has
|
|
37
|
-
* to sign in to it first), or undefined when it can.
|
|
38
|
-
*/
|
|
39
|
-
export const needsSignIn = (account, url, saved, nowMs) => {
|
|
40
|
-
if (saved === undefined || saved.session === undefined)
|
|
41
|
-
return { _tag: 'none' };
|
|
42
|
-
if (saved.entry.origin !== originOf(url))
|
|
43
|
-
return { _tag: 'origin', saved: saved.entry.origin };
|
|
44
|
-
if (sessionExpired(saved.session, nowMs))
|
|
45
|
-
return { _tag: 'expired' };
|
|
46
|
-
const savedAt = Option.map(DateTime.make(saved.entry.savedAt), DateTime.toEpochMillis);
|
|
47
|
-
const renew = typeof account !== 'string' && account.renew === true;
|
|
48
|
-
const justSaved = Option.exists(savedAt, (at) => nowMs - at < RENEW_GRACE_MS);
|
|
49
|
-
if (renew && !justSaved)
|
|
50
|
-
return { _tag: 'renew' };
|
|
51
|
-
return undefined;
|
|
52
|
-
};
|
|
53
|
-
/** What kind of user the account is: what the job says, else what was saved. */
|
|
54
|
-
export const aboutOf = (account, saved) => accountAboutOf(account) ?? saved?.entry.about;
|
|
55
|
-
/** Why the account needs signing in, as the end of a sentence about it. */
|
|
56
|
-
export const describeSignInWhy = (why) => {
|
|
57
|
-
switch (why._tag) {
|
|
58
|
-
case 'none':
|
|
59
|
-
return 'has no saved sign-in yet';
|
|
60
|
-
case 'origin':
|
|
61
|
-
return `is signed in on ${why.saved}, not here`;
|
|
62
|
-
case 'expired':
|
|
63
|
-
return 'has a saved sign-in whose cookies have all expired';
|
|
64
|
-
case 'renew':
|
|
65
|
-
return 'was asked to sign in again';
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
/** At most this long, the app's title as the live view shows it. */
|
|
69
|
-
export const SITE_TITLE_MAX = 120;
|
|
70
|
-
/** A page title on one line, cut to `SITE_TITLE_MAX`; undefined when blank. */
|
|
71
|
-
export const siteTitle = (raw) => {
|
|
72
|
-
const line = raw.replace(/\s+/g, ' ').trim();
|
|
73
|
-
if (line === '')
|
|
74
|
-
return undefined;
|
|
75
|
-
return line.length > SITE_TITLE_MAX ? `${line.slice(0, SITE_TITLE_MAX - 1)}…` : line;
|
|
76
|
-
};
|
|
77
|
-
/** At most this many icon addresses are tried, best first. */
|
|
78
|
-
export const SITE_ICONS_MAX = 4;
|
|
79
|
-
/** The largest icon the live view shows, in bytes. */
|
|
80
|
-
export const SITE_ICON_BYTES_MAX = 64 * 1024;
|
|
81
|
-
/** Image types an icon is shown as. It goes in an `<img>`, where even an SVG runs no script. */
|
|
82
|
-
const SITE_ICON_TYPES = new Set([
|
|
83
|
-
'image/png',
|
|
84
|
-
'image/x-icon',
|
|
85
|
-
'image/vnd.microsoft.icon',
|
|
86
|
-
'image/svg+xml',
|
|
87
|
-
'image/gif',
|
|
88
|
-
'image/jpeg',
|
|
89
|
-
'image/webp',
|
|
90
|
-
]);
|
|
91
|
-
/** The image type of an icon from its `Content-Type`, or undefined when it is not one shown. */
|
|
92
|
-
export const siteIconType = (contentType) => {
|
|
93
|
-
const type = contentType?.split(';')[0]?.trim().toLowerCase();
|
|
94
|
-
return type !== undefined && SITE_ICON_TYPES.has(type) ? type : undefined;
|
|
95
|
-
};
|