@reticlehq/core 3.8.2 → 3.10.0
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/dist/artifacts/flow-constants.d.ts +17 -0
- package/dist/artifacts/flow-constants.js +15 -0
- package/dist/artifacts/flow-results.d.ts +27 -2
- package/dist/artifacts/flow-step-tool.d.ts +17 -0
- package/dist/artifacts/flow-step-tool.js +18 -1
- package/dist/artifacts/flow-types.d.ts +59 -0
- package/dist/artifacts/flow-types.js +51 -6
- package/dist/identity/github-action.d.ts +7 -0
- package/dist/identity/github-action.js +7 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/onboarding.d.ts +60 -0
- package/dist/onboarding.js +35 -0
- package/dist/schema/event-message.json +1 -0
- package/dist/schema/event-payloads.json +47 -1
- package/dist/schema/event-type.json +1 -0
- package/dist/schema/reticle-event.json +1 -0
- package/dist/schema/reticle-message.json +1 -0
- package/dist/telemetry-refusal.d.ts +83 -0
- package/dist/telemetry-refusal.js +56 -0
- package/dist/telemetry-signals.d.ts +132 -0
- package/dist/telemetry-signals.js +68 -0
- package/dist/telemetry.d.ts +89 -4
- package/dist/telemetry.js +5 -3
- package/dist/verdict/findings.d.ts +34 -0
- package/dist/verdict/findings.js +37 -0
- package/dist/verdict/predicate.d.ts +1 -0
- package/dist/verdict/predicate.js +145 -5
- package/dist/verdict/verdict-attribution.js +1 -0
- package/dist/verdict/verified-constants.d.ts +17 -0
- package/dist/verdict/verified-constants.js +17 -0
- package/dist/wire/click-input.d.ts +26 -0
- package/dist/wire/click-input.js +65 -0
- package/dist/wire/constants/animation-command.d.ts +2 -0
- package/dist/wire/constants/animation-command.js +2 -0
- package/dist/wire/constants/console-event.d.ts +44 -0
- package/dist/wire/constants/console-event.js +44 -0
- package/dist/wire/constants/constants.d.ts +45 -0
- package/dist/wire/constants/constants.js +45 -0
- package/dist/wire/constants/determinism.d.ts +17 -0
- package/dist/wire/constants/determinism.js +17 -0
- package/dist/wire/constants/event-types.d.ts +113 -0
- package/dist/wire/constants/event-types.js +87 -0
- package/dist/wire/constants/match-args.d.ts +19 -0
- package/dist/wire/constants/match-args.js +19 -0
- package/dist/wire/constants/reticle-chrome.d.ts +12 -0
- package/dist/wire/constants/reticle-chrome.js +14 -0
- package/dist/wire/constants/session-constants.d.ts +17 -0
- package/dist/wire/constants/session-constants.js +5 -0
- package/dist/wire/event-payloads.d.ts +16 -93
- package/dist/wire/event-payloads.js +26 -72
- package/dist/wire/event-priority.js +1 -0
- package/dist/wire/global-press.d.ts +9 -2
- package/dist/wire/global-press.js +39 -12
- package/dist/wire/messages.d.ts +3 -0
- package/dist/wire/net.d.ts +39 -0
- package/dist/wire/net.js +56 -8
- package/dist/wire/redaction.d.ts +18 -0
- package/dist/wire/redaction.js +72 -0
- package/dist/wire/tool-names.d.ts +4 -0
- package/dist/wire/tool-names.js +4 -0
- package/dist/wire/types.d.ts +31 -0
- package/dist/wire/types.js +10 -0
- package/dist/words/notices.d.ts +10 -0
- package/dist/words/notices.js +19 -0
- package/package.json +1 -1
|
@@ -17,3 +17,17 @@ export const RETICLE_OVERLAY_SELECTOR = '[data-reticle-overlay],[data-reticle-cu
|
|
|
17
17
|
* page without Reticle would have looked like.
|
|
18
18
|
*/
|
|
19
19
|
export const HIDE_RETICLE_CHROME_CSS = `${RETICLE_OVERLAY_SELECTOR}{display:none !important}`;
|
|
20
|
+
/** Where the pass-through keeps each node's own inline `pointer-events`, on the page's window. */
|
|
21
|
+
const POINTER_HELD_KEY = '__reticlePointerHeld';
|
|
22
|
+
/**
|
|
23
|
+
* A page script that takes Reticle's own UI out of the hit test for one real pointer gesture.
|
|
24
|
+
*
|
|
25
|
+
* A real click goes to the topmost element that takes pointer events. When a HUD control sat over
|
|
26
|
+
* the app's button, the HUD took the daemon's click, and the verdict said the app did nothing
|
|
27
|
+
* (#992). Each Reticle node gets an inline `pointer-events: none !important`, because a control
|
|
28
|
+
* sets `pointer-events: auto` on itself and a value on the host alone does not reach it. Inline
|
|
29
|
+
* style is not blocked by a page's CSP, and an injected stylesheet can be. Nothing moves or flickers.
|
|
30
|
+
*/
|
|
31
|
+
export const RETICLE_CHROME_PASS_THROUGH_SCRIPT = `(() => { const held = []; const seen = new Set(); for (const host of document.querySelectorAll(${JSON.stringify(RETICLE_OVERLAY_SELECTOR)})) { for (const el of [host, ...host.querySelectorAll('*')]) { if (seen.has(el) || !el.style) continue; seen.add(el); held.push([el, el.style.getPropertyValue('pointer-events'), el.style.getPropertyPriority('pointer-events')]); el.style.setProperty('pointer-events', 'none', 'important'); } } window.${POINTER_HELD_KEY} = held; })()`;
|
|
32
|
+
/** Puts back what `RETICLE_CHROME_PASS_THROUGH_SCRIPT` changed, so a person can click the HUD again. */
|
|
33
|
+
export const RETICLE_CHROME_RESTORE_POINTER_SCRIPT = `(() => { for (const [el, value, priority] of window.${POINTER_HELD_KEY} ?? []) { if (value) el.style.setProperty('pointer-events', value, priority); else el.style.removeProperty('pointer-events'); } delete window.${POINTER_HELD_KEY}; })()`;
|
|
@@ -202,3 +202,20 @@ export declare const NoSessionAction: {
|
|
|
202
202
|
readonly DAEMON_SPLIT: "daemon_split";
|
|
203
203
|
};
|
|
204
204
|
export type NoSessionAction = (typeof NoSessionAction)[keyof typeof NoSessionAction];
|
|
205
|
+
/** How a tool call started a session that did not exist before the call. */
|
|
206
|
+
export declare const SessionStartedVia: {
|
|
207
|
+
/** The daemon opened a lease on the URL that the call named. */
|
|
208
|
+
readonly LEASE: "lease";
|
|
209
|
+
};
|
|
210
|
+
export type SessionStartedVia = (typeof SessionStartedVia)[keyof typeof SessionStartedVia];
|
|
211
|
+
/**
|
|
212
|
+
* `sessionStarted` on a `reticle_navigate` result. Present only when the call found no session and
|
|
213
|
+
* opened one, so the agent knows that the tab it now drives is new. The zod schema is in the tool's
|
|
214
|
+
* output schema: zod in this file goes into the first load of every page that loads the SDK.
|
|
215
|
+
*/
|
|
216
|
+
export interface SessionStarted {
|
|
217
|
+
sessionId: string;
|
|
218
|
+
via: SessionStartedVia;
|
|
219
|
+
/** The page has no Reticle SDK, so the lease supplied one: no component state, no source line. */
|
|
220
|
+
zeroInstall?: boolean;
|
|
221
|
+
}
|
|
@@ -198,3 +198,8 @@ export const NoSessionAction = {
|
|
|
198
198
|
*/
|
|
199
199
|
DAEMON_SPLIT: 'daemon_split',
|
|
200
200
|
};
|
|
201
|
+
/** How a tool call started a session that did not exist before the call. */
|
|
202
|
+
export const SessionStartedVia = {
|
|
203
|
+
/** The daemon opened a lease on the URL that the call named. */
|
|
204
|
+
LEASE: 'lease',
|
|
205
|
+
};
|
|
@@ -13,99 +13,6 @@ import { EventType } from './constants/constants.js';
|
|
|
13
13
|
* fields (stack, TTFB, initiator, path diffs) pass through instead of failing closed. Each closes
|
|
14
14
|
* fully as its observer is rewritten.
|
|
15
15
|
*/
|
|
16
|
-
/**
|
|
17
|
-
* Wire payload vocabularies. The browser observers EMIT these values and the schemas below VALIDATE
|
|
18
|
-
* them, so a browser-side typo (`'SSE'`) would pass tsc and fail only here, at runtime. Each is a const
|
|
19
|
-
* object — the browser imports the members, the schema derives its z.nativeEnum from the same object —
|
|
20
|
-
* so emitter and validator are one source. Co-located with the schemas (kept constants.ts under its cap).
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* `FETCH` is a response whose BODY is still arriving after the request itself resolved.
|
|
24
|
-
*
|
|
25
|
-
* `fetch` settles at HEADERS, so a streamed response is reported complete while the server is still
|
|
26
|
-
* writing. Measured on a Next.js App Router page: the RSC payload's NET_REQUEST landed 16 ms in, the
|
|
27
|
-
* shell rendered, and the Suspense boundary's content arrived 889 ms later — a window in which
|
|
28
|
-
* nothing at all was observed, so `settled` passed while the fallback was still on screen.
|
|
29
|
-
*/
|
|
30
|
-
export declare const StreamTransport: {
|
|
31
|
-
readonly SSE: "sse";
|
|
32
|
-
readonly WS: "ws";
|
|
33
|
-
readonly FETCH: "fetch";
|
|
34
|
-
};
|
|
35
|
-
export type StreamTransport = (typeof StreamTransport)[keyof typeof StreamTransport];
|
|
36
|
-
/** `CLOSE` pairs with `OPEN`: until it arrives, the body is still being written. */
|
|
37
|
-
export declare const StreamDirection: {
|
|
38
|
-
readonly OPEN: "open";
|
|
39
|
-
readonly IN: "in";
|
|
40
|
-
readonly OUT: "out";
|
|
41
|
-
readonly CLOSE: "close";
|
|
42
|
-
};
|
|
43
|
-
export type StreamDirection = (typeof StreamDirection)[keyof typeof StreamDirection];
|
|
44
|
-
export declare const ScrollDirection: {
|
|
45
|
-
readonly UP: "up";
|
|
46
|
-
readonly DOWN: "down";
|
|
47
|
-
};
|
|
48
|
-
export type ScrollDirection = (typeof ScrollDirection)[keyof typeof ScrollDirection];
|
|
49
|
-
/**
|
|
50
|
-
* How a `route.change` happened.
|
|
51
|
-
*
|
|
52
|
-
* `push` is `history.pushState`, `replace` is `history.replaceState`, and `pop` is the session
|
|
53
|
-
* history moving under the page (`popstate`, or a `hashchange` the page did not push). A
|
|
54
|
-
* same-pathname replace records UI state in the URL; it is not a navigation to a new view.
|
|
55
|
-
*/
|
|
56
|
-
export declare const RouteChangeHow: {
|
|
57
|
-
readonly PUSH: "push";
|
|
58
|
-
readonly REPLACE: "replace";
|
|
59
|
-
readonly POP: "pop";
|
|
60
|
-
};
|
|
61
|
-
export type RouteChangeHow = (typeof RouteChangeHow)[keyof typeof RouteChangeHow];
|
|
62
|
-
/** Wire field on `route.change` carrying a `RouteChangeHow`. */
|
|
63
|
-
export declare const ROUTE_CHANGE_HOW_FIELD = "how";
|
|
64
|
-
/**
|
|
65
|
-
* Why a `field.change` was emitted.
|
|
66
|
-
*
|
|
67
|
-
* `input` is a burst of keystrokes and `change` is the commit that ends one — both are the user's
|
|
68
|
-
* own event, fired before a controlled component restores its DOM property. `settled` is a read of
|
|
69
|
-
* that property on the frame after the handlers ran. Only a settled read that differs from the
|
|
70
|
-
* pre-action value is evidence the screen moved.
|
|
71
|
-
*/
|
|
72
|
-
export declare const FieldChangeKind: {
|
|
73
|
-
readonly INPUT: "input";
|
|
74
|
-
readonly CHANGE: "change";
|
|
75
|
-
readonly SETTLED: "settled";
|
|
76
|
-
};
|
|
77
|
-
export type FieldChangeKind = (typeof FieldChangeKind)[keyof typeof FieldChangeKind];
|
|
78
|
-
/**
|
|
79
|
-
* Wire fields on `field.change` beyond `field` / `kind` / `value` / `length`.
|
|
80
|
-
*
|
|
81
|
-
* `checked` is the property a checkbox or radio actually renders; `value` on those is the HTML
|
|
82
|
-
* value (`"on"`), which does not move when the box is toggled. `previous` and `previousChecked`
|
|
83
|
-
* are the same reading from before the action, present on a settled event so a consumer can tell
|
|
84
|
-
* a render from a restore.
|
|
85
|
-
*/
|
|
86
|
-
export declare const FieldChangeField: {
|
|
87
|
-
readonly FIELD: "field";
|
|
88
|
-
readonly KIND: "kind";
|
|
89
|
-
readonly LENGTH: "length";
|
|
90
|
-
readonly VALUE: "value";
|
|
91
|
-
readonly REDACTED: "redacted";
|
|
92
|
-
readonly CHECKED: "checked";
|
|
93
|
-
readonly PREVIOUS: "previous";
|
|
94
|
-
readonly PREVIOUS_CHECKED: "previousChecked";
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* The three readable client-side storage areas.
|
|
98
|
-
*
|
|
99
|
-
* `cookies` is plural because that is what the storage tool accepts, what the browser returns and
|
|
100
|
-
* what the docs publish. This member read `cookie` for as long as it had no callers, which is
|
|
101
|
-
* exactly how long a name can disagree with every use of it for free.
|
|
102
|
-
*/
|
|
103
|
-
export declare const StorageArea: {
|
|
104
|
-
readonly LOCAL: "local";
|
|
105
|
-
readonly SESSION: "session";
|
|
106
|
-
readonly COOKIE: "cookies";
|
|
107
|
-
};
|
|
108
|
-
export type StorageArea = (typeof StorageArea)[keyof typeof StorageArea];
|
|
109
16
|
/**
|
|
110
17
|
* A single cookie to seed before initial navigation.
|
|
111
18
|
*/
|
|
@@ -188,6 +95,10 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
188
95
|
old: z.ZodOptional<z.ZodString>;
|
|
189
96
|
testid: z.ZodOptional<z.ZodString>;
|
|
190
97
|
initial: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
live: z.ZodOptional<z.ZodEnum<{
|
|
99
|
+
readonly ASSERTIVE: "assertive";
|
|
100
|
+
readonly POLITE: "polite";
|
|
101
|
+
}>>;
|
|
191
102
|
}, z.core.$strip>;
|
|
192
103
|
"net.request": z.ZodObject<{
|
|
193
104
|
id: z.ZodString;
|
|
@@ -200,6 +111,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
200
111
|
urlRaw: z.ZodOptional<z.ZodString>;
|
|
201
112
|
nextAction: z.ZodOptional<z.ZodString>;
|
|
202
113
|
requestShape: z.ZodOptional<z.ZodString>;
|
|
114
|
+
fromDepartedDocument: z.ZodOptional<z.ZodBoolean>;
|
|
203
115
|
}, z.core.$loose>;
|
|
204
116
|
"net.pending": z.ZodObject<{
|
|
205
117
|
id: z.ZodString;
|
|
@@ -207,7 +119,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
207
119
|
url: z.ZodString;
|
|
208
120
|
initiator: z.ZodString;
|
|
209
121
|
urlRaw: z.ZodOptional<z.ZodString>;
|
|
122
|
+
fromDepartedDocument: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
pageUnloaded: z.ZodOptional<z.ZodBoolean>;
|
|
210
124
|
}, z.core.$strip>;
|
|
125
|
+
"net.unpatched": z.ZodObject<{
|
|
126
|
+
url: z.ZodString;
|
|
127
|
+
urlRaw: z.ZodOptional<z.ZodString>;
|
|
128
|
+
initiator: z.ZodString;
|
|
129
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
130
|
+
}, z.core.$loose>;
|
|
211
131
|
"net.stream": z.ZodObject<{
|
|
212
132
|
transport: z.ZodEnum<{
|
|
213
133
|
readonly SSE: "sse";
|
|
@@ -239,6 +159,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
239
159
|
}>;
|
|
240
160
|
value: z.ZodNumber;
|
|
241
161
|
at: z.ZodNumber;
|
|
162
|
+
shift: z.ZodOptional<z.ZodNumber>;
|
|
242
163
|
shifted: z.ZodOptional<z.ZodObject<{
|
|
243
164
|
ref: z.ZodString;
|
|
244
165
|
selector: z.ZodString;
|
|
@@ -395,6 +316,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
395
316
|
readonly UNOBSERVED_IPC: "unobserved-ipc";
|
|
396
317
|
readonly VERDICTLESS_SEND: "verdictless-send";
|
|
397
318
|
readonly UNWATCHED_STATE: "unwatched-state";
|
|
319
|
+
readonly CANVAS_PAINT_UNOBSERVED: "canvas-paint-unobserved";
|
|
398
320
|
}>;
|
|
399
321
|
count: z.ZodNumber;
|
|
400
322
|
}, z.core.$strip>;
|
|
@@ -514,6 +436,7 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
514
436
|
readonly POLL: "poll";
|
|
515
437
|
readonly ACT: "act";
|
|
516
438
|
}>>;
|
|
439
|
+
visible: z.ZodOptional<z.ZodBoolean>;
|
|
517
440
|
}, z.core.$strip>;
|
|
518
441
|
};
|
|
519
442
|
/** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
2
|
import { CanvasTrigger, EventType, MediaEvent, PerfMetric } from './constants/constants.js';
|
|
3
|
+
import { FieldChangeField, FieldChangeKind, LivePoliteness, RouteChangeHow, ROUTE_CHANGE_HOW_FIELD, ScrollDirection, StorageArea, StreamDirection, StreamTransport, } from './constants/event-types.js';
|
|
3
4
|
import { ResponseBodyReason } from './constants/response-body-reason.js';
|
|
4
5
|
import { BlindSpotKind } from '../verdict/verified-constants.js';
|
|
5
6
|
import { BrowserBrand } from '../telemetry-feedback.js';
|
|
6
7
|
import { HudUseDataSchema, HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
|
|
7
|
-
import { NEXT_ACTION_FIELD, REQUEST_SHAPE_FIELD } from './net.js';
|
|
8
|
+
import { DepartedNetField, NEXT_ACTION_FIELD, REQUEST_SHAPE_FIELD } from './net.js';
|
|
8
9
|
/**
|
|
9
10
|
* Per-event-type payload schemas — the typed replacement for the envelope's open `data` record.
|
|
10
11
|
* The envelope (`ReticleEventSchema.data`) stays open on the wire so a richer SDK is never rejected
|
|
@@ -18,77 +19,6 @@ import { NEXT_ACTION_FIELD, REQUEST_SHAPE_FIELD } from './net.js';
|
|
|
18
19
|
* fields (stack, TTFB, initiator, path diffs) pass through instead of failing closed. Each closes
|
|
19
20
|
* fully as its observer is rewritten.
|
|
20
21
|
*/
|
|
21
|
-
/**
|
|
22
|
-
* Wire payload vocabularies. The browser observers EMIT these values and the schemas below VALIDATE
|
|
23
|
-
* them, so a browser-side typo (`'SSE'`) would pass tsc and fail only here, at runtime. Each is a const
|
|
24
|
-
* object — the browser imports the members, the schema derives its z.nativeEnum from the same object —
|
|
25
|
-
* so emitter and validator are one source. Co-located with the schemas (kept constants.ts under its cap).
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* `FETCH` is a response whose BODY is still arriving after the request itself resolved.
|
|
29
|
-
*
|
|
30
|
-
* `fetch` settles at HEADERS, so a streamed response is reported complete while the server is still
|
|
31
|
-
* writing. Measured on a Next.js App Router page: the RSC payload's NET_REQUEST landed 16 ms in, the
|
|
32
|
-
* shell rendered, and the Suspense boundary's content arrived 889 ms later — a window in which
|
|
33
|
-
* nothing at all was observed, so `settled` passed while the fallback was still on screen.
|
|
34
|
-
*/
|
|
35
|
-
export const StreamTransport = { SSE: 'sse', WS: 'ws', FETCH: 'fetch' };
|
|
36
|
-
/** `CLOSE` pairs with `OPEN`: until it arrives, the body is still being written. */
|
|
37
|
-
export const StreamDirection = { OPEN: 'open', IN: 'in', OUT: 'out', CLOSE: 'close' };
|
|
38
|
-
export const ScrollDirection = { UP: 'up', DOWN: 'down' };
|
|
39
|
-
/**
|
|
40
|
-
* How a `route.change` happened.
|
|
41
|
-
*
|
|
42
|
-
* `push` is `history.pushState`, `replace` is `history.replaceState`, and `pop` is the session
|
|
43
|
-
* history moving under the page (`popstate`, or a `hashchange` the page did not push). A
|
|
44
|
-
* same-pathname replace records UI state in the URL; it is not a navigation to a new view.
|
|
45
|
-
*/
|
|
46
|
-
export const RouteChangeHow = {
|
|
47
|
-
PUSH: 'push',
|
|
48
|
-
REPLACE: 'replace',
|
|
49
|
-
POP: 'pop',
|
|
50
|
-
};
|
|
51
|
-
/** Wire field on `route.change` carrying a `RouteChangeHow`. */
|
|
52
|
-
export const ROUTE_CHANGE_HOW_FIELD = 'how';
|
|
53
|
-
/**
|
|
54
|
-
* Why a `field.change` was emitted.
|
|
55
|
-
*
|
|
56
|
-
* `input` is a burst of keystrokes and `change` is the commit that ends one — both are the user's
|
|
57
|
-
* own event, fired before a controlled component restores its DOM property. `settled` is a read of
|
|
58
|
-
* that property on the frame after the handlers ran. Only a settled read that differs from the
|
|
59
|
-
* pre-action value is evidence the screen moved.
|
|
60
|
-
*/
|
|
61
|
-
export const FieldChangeKind = {
|
|
62
|
-
INPUT: 'input',
|
|
63
|
-
CHANGE: 'change',
|
|
64
|
-
SETTLED: 'settled',
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Wire fields on `field.change` beyond `field` / `kind` / `value` / `length`.
|
|
68
|
-
*
|
|
69
|
-
* `checked` is the property a checkbox or radio actually renders; `value` on those is the HTML
|
|
70
|
-
* value (`"on"`), which does not move when the box is toggled. `previous` and `previousChecked`
|
|
71
|
-
* are the same reading from before the action, present on a settled event so a consumer can tell
|
|
72
|
-
* a render from a restore.
|
|
73
|
-
*/
|
|
74
|
-
export const FieldChangeField = {
|
|
75
|
-
FIELD: 'field',
|
|
76
|
-
KIND: 'kind',
|
|
77
|
-
LENGTH: 'length',
|
|
78
|
-
VALUE: 'value',
|
|
79
|
-
REDACTED: 'redacted',
|
|
80
|
-
CHECKED: 'checked',
|
|
81
|
-
PREVIOUS: 'previous',
|
|
82
|
-
PREVIOUS_CHECKED: 'previousChecked',
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* The three readable client-side storage areas.
|
|
86
|
-
*
|
|
87
|
-
* `cookies` is plural because that is what the storage tool accepts, what the browser returns and
|
|
88
|
-
* what the docs publish. This member read `cookie` for as long as it had no callers, which is
|
|
89
|
-
* exactly how long a name can disagree with every use of it for free.
|
|
90
|
-
*/
|
|
91
|
-
export const StorageArea = { LOCAL: 'local', SESSION: 'session', COOKIE: 'cookies' };
|
|
92
22
|
/**
|
|
93
23
|
* A single cookie to seed before initial navigation.
|
|
94
24
|
*/
|
|
@@ -166,6 +96,7 @@ const netRequestSchema = z
|
|
|
166
96
|
urlRaw: z.string().optional(),
|
|
167
97
|
[NEXT_ACTION_FIELD]: z.string().optional(),
|
|
168
98
|
[REQUEST_SHAPE_FIELD]: z.string().optional(),
|
|
99
|
+
[DepartedNetField.FROM_DEPARTED_DOCUMENT]: z.boolean().optional(),
|
|
169
100
|
})
|
|
170
101
|
.passthrough();
|
|
171
102
|
const consoleSchema = z.object({ message: z.string() }).passthrough();
|
|
@@ -189,6 +120,12 @@ export const EVENT_PAYLOAD_SCHEMAS = {
|
|
|
189
120
|
testid: z.string().optional(),
|
|
190
121
|
/** The text an element ARRIVED with, not a change: the baseline a later change is read against. */
|
|
191
122
|
initial: z.boolean().optional(),
|
|
123
|
+
/**
|
|
124
|
+
* Set when the text changed inside a live region that already exists: how urgently the region
|
|
125
|
+
* announces it. An app that writes its error text into an existing alert region tells the user
|
|
126
|
+
* about a failure, and a mount event does not record that write.
|
|
127
|
+
*/
|
|
128
|
+
live: z.nativeEnum(LivePoliteness).optional(),
|
|
192
129
|
}),
|
|
193
130
|
[EventType.NET_REQUEST]: netRequestSchema,
|
|
194
131
|
[EventType.NET_PENDING]: z.object({
|
|
@@ -197,13 +134,25 @@ export const EVENT_PAYLOAD_SCHEMAS = {
|
|
|
197
134
|
url: z.string(),
|
|
198
135
|
initiator: z.string(),
|
|
199
136
|
urlRaw: z.string().optional(),
|
|
137
|
+
[DepartedNetField.FROM_DEPARTED_DOCUMENT]: z.boolean().optional(),
|
|
138
|
+
[DepartedNetField.PAGE_UNLOADED]: z.boolean().optional(),
|
|
200
139
|
}),
|
|
140
|
+
[EventType.NET_UNPATCHED]: z
|
|
141
|
+
.object({
|
|
142
|
+
url: z.string(),
|
|
143
|
+
urlRaw: z.string().optional(),
|
|
144
|
+
initiator: z.string(),
|
|
145
|
+
status: z.number().optional(),
|
|
146
|
+
})
|
|
147
|
+
.passthrough(),
|
|
201
148
|
[EventType.NET_STREAM]: netStreamSchema,
|
|
202
149
|
[EventType.DOWNLOAD]: downloadSchema,
|
|
203
150
|
[EventType.PERF]: z.object({
|
|
204
151
|
metric: z.nativeEnum(PerfMetric),
|
|
205
152
|
value: z.number(),
|
|
206
153
|
at: z.number(),
|
|
154
|
+
// CLS only: this entry's own shift; `value` is the running total since load (#1784).
|
|
155
|
+
shift: z.number().optional(),
|
|
207
156
|
// CLS only: the element the shift moved most, so the value has somewhere to point (#1266).
|
|
208
157
|
shifted: z.object({ ref: z.string(), selector: z.string() }).optional(),
|
|
209
158
|
}),
|
|
@@ -377,6 +326,11 @@ export const EVENT_PAYLOAD_SCHEMAS = {
|
|
|
377
326
|
* `poll` when the timer did. Absent from an SDK older than the field.
|
|
378
327
|
*/
|
|
379
328
|
trigger: z.nativeEnum(CanvasTrigger).optional(),
|
|
329
|
+
/**
|
|
330
|
+
* Whether the canvas had a size and was inside the viewport when it was sampled. A hidden canvas
|
|
331
|
+
* cannot carry a render the user sees. Absent from an SDK older than the field.
|
|
332
|
+
*/
|
|
333
|
+
visible: z.boolean().optional(),
|
|
380
334
|
}),
|
|
381
335
|
};
|
|
382
336
|
/** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
|
|
@@ -16,6 +16,7 @@ import { EventType } from './constants/constants.js';
|
|
|
16
16
|
export const HIGH_VALUE_EVENT_TYPES = new Set([
|
|
17
17
|
EventType.NET_REQUEST,
|
|
18
18
|
EventType.NET_PENDING,
|
|
19
|
+
EventType.NET_UNPATCHED,
|
|
19
20
|
EventType.NET_STREAM,
|
|
20
21
|
EventType.NET_DETAIL,
|
|
21
22
|
EventType.NET_RESPONSE_BODY,
|
|
@@ -6,10 +6,17 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const DEFAULT_PRESS_KEY = "Enter";
|
|
8
8
|
/**
|
|
9
|
-
* Keys a real user sends at the page, not at a control. Escape dismisses, Tab moves focus
|
|
9
|
+
* Keys a real user sends at the page, not at a control. Escape dismisses, Tab moves focus, and an
|
|
10
|
+
* arrow key moves the player in a canvas game, which often has no element to name.
|
|
10
11
|
* A press of one of these with no ref is valid; a press of Enter or a letter is not.
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The press arg that sends ANY key to the document: `{ text: 'w', document: true }`. A canvas game
|
|
15
|
+
* reads WASD, Space and Enter from the page and has no element to name. Only the boolean `true`
|
|
16
|
+
* counts, and it is never the default, so a forgotten ref on Enter is still refused.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PRESS_DOCUMENT_ARG = "document";
|
|
19
|
+
export declare const GLOBAL_PRESS_KEYS: readonly ["Escape", "Tab", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
13
20
|
/**
|
|
14
21
|
* Which key a `press` is asking for.
|
|
15
22
|
*
|
|
@@ -7,10 +7,24 @@ import { ActionType } from './constants/constants.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export const DEFAULT_PRESS_KEY = 'Enter';
|
|
9
9
|
/**
|
|
10
|
-
* Keys a real user sends at the page, not at a control. Escape dismisses, Tab moves focus
|
|
10
|
+
* Keys a real user sends at the page, not at a control. Escape dismisses, Tab moves focus, and an
|
|
11
|
+
* arrow key moves the player in a canvas game, which often has no element to name.
|
|
11
12
|
* A press of one of these with no ref is valid; a press of Enter or a letter is not.
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The press arg that sends ANY key to the document: `{ text: 'w', document: true }`. A canvas game
|
|
16
|
+
* reads WASD, Space and Enter from the page and has no element to name. Only the boolean `true`
|
|
17
|
+
* counts, and it is never the default, so a forgotten ref on Enter is still refused.
|
|
18
|
+
*/
|
|
19
|
+
export const PRESS_DOCUMENT_ARG = 'document';
|
|
20
|
+
export const GLOBAL_PRESS_KEYS = [
|
|
21
|
+
'Escape',
|
|
22
|
+
'Tab',
|
|
23
|
+
'ArrowUp',
|
|
24
|
+
'ArrowDown',
|
|
25
|
+
'ArrowLeft',
|
|
26
|
+
'ArrowRight',
|
|
27
|
+
];
|
|
14
28
|
const GLOBAL_PRESS_KEY_SET = new Set(GLOBAL_PRESS_KEYS.map((k) => k.toLowerCase()));
|
|
15
29
|
/**
|
|
16
30
|
* Which key a `press` is asking for.
|
|
@@ -21,11 +35,13 @@ const GLOBAL_PRESS_KEY_SET = new Set(GLOBAL_PRESS_KEYS.map((k) => k.toLowerCase(
|
|
|
21
35
|
*/
|
|
22
36
|
export function pressKeyFromArgs(args) {
|
|
23
37
|
const text = args['text'];
|
|
24
|
-
if ('string' === typeof text && 0 < text.length)
|
|
38
|
+
if ('string' === typeof text && 0 < text.length) {
|
|
25
39
|
return text;
|
|
40
|
+
}
|
|
26
41
|
const key = args['key'];
|
|
27
|
-
if ('string' === typeof key && 0 < key.length)
|
|
42
|
+
if ('string' === typeof key && 0 < key.length) {
|
|
28
43
|
return key;
|
|
44
|
+
}
|
|
29
45
|
return DEFAULT_PRESS_KEY;
|
|
30
46
|
}
|
|
31
47
|
/**
|
|
@@ -38,12 +54,14 @@ export function pressKeyFromArgs(args) {
|
|
|
38
54
|
*/
|
|
39
55
|
export function pressKeysFromArgs(args) {
|
|
40
56
|
const raw = args['keys'];
|
|
41
|
-
if (!Array.isArray(raw))
|
|
57
|
+
if (!Array.isArray(raw)) {
|
|
42
58
|
return [];
|
|
59
|
+
}
|
|
43
60
|
const keys = [];
|
|
44
61
|
for (const item of raw) {
|
|
45
|
-
if ('string' === typeof item && 0 < item.length)
|
|
62
|
+
if ('string' === typeof item && 0 < item.length) {
|
|
46
63
|
keys.push(item);
|
|
64
|
+
}
|
|
47
65
|
}
|
|
48
66
|
return keys;
|
|
49
67
|
}
|
|
@@ -77,15 +95,18 @@ const MODIFIER_ALIASES = {
|
|
|
77
95
|
*/
|
|
78
96
|
export function pressModifiersFromArgs(args) {
|
|
79
97
|
const raw = args['modifiers'];
|
|
80
|
-
if (!Array.isArray(raw))
|
|
98
|
+
if (!Array.isArray(raw)) {
|
|
81
99
|
return [];
|
|
100
|
+
}
|
|
82
101
|
const named = new Set();
|
|
83
102
|
for (const item of raw) {
|
|
84
|
-
if ('string' !== typeof item)
|
|
103
|
+
if ('string' !== typeof item) {
|
|
85
104
|
continue;
|
|
105
|
+
}
|
|
86
106
|
const canonical = MODIFIER_ALIASES[item.toLowerCase()];
|
|
87
|
-
if (canonical !== undefined)
|
|
107
|
+
if (canonical !== undefined) {
|
|
88
108
|
named.add(canonical);
|
|
109
|
+
}
|
|
89
110
|
}
|
|
90
111
|
return PRESS_MODIFIERS.filter((modifier) => named.has(modifier));
|
|
91
112
|
}
|
|
@@ -114,12 +135,17 @@ function hasModifiers(args) {
|
|
|
114
135
|
* pass where `{ key: "Enter" }` is refused.
|
|
115
136
|
*/
|
|
116
137
|
export function isGlobalPress(args) {
|
|
117
|
-
if (
|
|
138
|
+
if (true === args[PRESS_DOCUMENT_ARG]) {
|
|
118
139
|
return true;
|
|
140
|
+
}
|
|
141
|
+
if (hasModifiers(args)) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
119
144
|
const keys = pressKeysFromArgs(args);
|
|
120
145
|
// SEVERAL keys held together is a sequence at the page, never aimed at one control.
|
|
121
|
-
if (1 < keys.length)
|
|
146
|
+
if (1 < keys.length) {
|
|
122
147
|
return true;
|
|
148
|
+
}
|
|
123
149
|
// ONE key in `keys` is the same press as naming it in `key`/`text`, so it must answer the same
|
|
124
150
|
// question. Reading the list by LENGTH alone let `{ keys: ["Enter"] }` omit a ref, which the
|
|
125
151
|
// one-key spelling refuses on purpose: Enter lands on whatever holds focus, and on a focused field
|
|
@@ -134,8 +160,9 @@ export function isGlobalPress(args) {
|
|
|
134
160
|
* The tool/step shape `{ action, args }` — a press of a document key, so no locator is required.
|
|
135
161
|
*/
|
|
136
162
|
export function isGlobalPressCall(args) {
|
|
137
|
-
if (ActionType.PRESS !== args['action'])
|
|
163
|
+
if (ActionType.PRESS !== args['action']) {
|
|
138
164
|
return false;
|
|
165
|
+
}
|
|
139
166
|
const inner = args['args'];
|
|
140
167
|
const pressArgs = 'object' === typeof inner && null !== inner ? inner : {};
|
|
141
168
|
return isGlobalPress(pressArgs);
|
package/dist/wire/messages.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ export declare const ReticleEventSchema: z.ZodObject<{
|
|
|
96
96
|
readonly DOM_TEXT: "dom.text";
|
|
97
97
|
readonly NET_REQUEST: "net.request";
|
|
98
98
|
readonly NET_PENDING: "net.pending";
|
|
99
|
+
readonly NET_UNPATCHED: "net.unpatched";
|
|
99
100
|
readonly NET_STREAM: "net.stream";
|
|
100
101
|
readonly PERF: "perf";
|
|
101
102
|
readonly ROUTE_CHANGE: "route.change";
|
|
@@ -252,6 +253,7 @@ export declare const EventMessageSchema: z.ZodObject<{
|
|
|
252
253
|
readonly DOM_TEXT: "dom.text";
|
|
253
254
|
readonly NET_REQUEST: "net.request";
|
|
254
255
|
readonly NET_PENDING: "net.pending";
|
|
256
|
+
readonly NET_UNPATCHED: "net.unpatched";
|
|
255
257
|
readonly NET_STREAM: "net.stream";
|
|
256
258
|
readonly PERF: "perf";
|
|
257
259
|
readonly ROUTE_CHANGE: "route.change";
|
|
@@ -394,6 +396,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
394
396
|
readonly DOM_TEXT: "dom.text";
|
|
395
397
|
readonly NET_REQUEST: "net.request";
|
|
396
398
|
readonly NET_PENDING: "net.pending";
|
|
399
|
+
readonly NET_UNPATCHED: "net.unpatched";
|
|
397
400
|
readonly NET_STREAM: "net.stream";
|
|
398
401
|
readonly PERF: "perf";
|
|
399
402
|
readonly ROUTE_CHANGE: "route.change";
|
package/dist/wire/net.d.ts
CHANGED
|
@@ -28,6 +28,16 @@ export declare const NetInitiator: {
|
|
|
28
28
|
* false red over favicons and fonts.
|
|
29
29
|
*/
|
|
30
30
|
readonly DOCUMENT: "document";
|
|
31
|
+
/**
|
|
32
|
+
* A file the SERVER sent as a download (`Content-Disposition: attachment`), seen by the driven
|
|
33
|
+
* browser's network stack.
|
|
34
|
+
*
|
|
35
|
+
* The click leaves the page as a navigation the browser turns into a download, so no patched
|
|
36
|
+
* transport in the page ever sees the response. Only a driven browser (CDP) does, and its detail
|
|
37
|
+
* had no in-page request to merge onto, so a `net` check on a working export missed. The engine
|
|
38
|
+
* records such a detail as a request with this initiator.
|
|
39
|
+
*/
|
|
40
|
+
readonly DOWNLOAD: "download";
|
|
31
41
|
/**
|
|
32
42
|
* The browser is LEAVING for this URL, recorded at the moment of departure.
|
|
33
43
|
*
|
|
@@ -211,3 +221,32 @@ export declare const NEXT_ACTION_HEADER = "Next-Action";
|
|
|
211
221
|
* that named the same action are the same write even when the body could not be read as text.
|
|
212
222
|
*/
|
|
213
223
|
export declare const NEXT_ACTION_FIELD = "nextAction";
|
|
224
|
+
/**
|
|
225
|
+
* Fields the daemon writes on a network record that the document BEFORE this one made (#1944).
|
|
226
|
+
*
|
|
227
|
+
* A click can send a request and then load a new document. The old document sends its records
|
|
228
|
+
* before it unloads, but the new document connects as a new session, and every read after that
|
|
229
|
+
* reads the new session. The daemon carries the old document's network records from the last act
|
|
230
|
+
* into the new session, so a `net` check and `reticle_observe { action: "network" }` still see them.
|
|
231
|
+
*/
|
|
232
|
+
export declare const DepartedNetField: {
|
|
233
|
+
/**
|
|
234
|
+
* On every carried record. The record came from the document before this one. Its `t` is when
|
|
235
|
+
* the new document connected, not when the request happened, so it does not show the order of
|
|
236
|
+
* the request relative to the old document's other events.
|
|
237
|
+
*/
|
|
238
|
+
readonly FROM_DEPARTED_DOCUMENT: "fromDepartedDocument";
|
|
239
|
+
/**
|
|
240
|
+
* On a carried `NET_PENDING` that had no answer when its document unloaded. The answer went to a
|
|
241
|
+
* document that no longer exists, so no `NET_REQUEST` can close it. Its outcome is unknown, not
|
|
242
|
+
* absent and not failed: the server can have received it or not.
|
|
243
|
+
*/
|
|
244
|
+
readonly PAGE_UNLOADED: "pageUnloaded";
|
|
245
|
+
};
|
|
246
|
+
export type DepartedNetField = (typeof DepartedNetField)[keyof typeof DepartedNetField];
|
|
247
|
+
/**
|
|
248
|
+
* True when a `NET_PENDING` can never get its answer in this session: a departure (the browser left
|
|
249
|
+
* for this URL), or a request whose page unloaded before the answer arrived. Neither one is a
|
|
250
|
+
* request in flight. Every settle and in-flight decision reads this one function.
|
|
251
|
+
*/
|
|
252
|
+
export declare function neverAnswered(data: Readonly<Record<string, unknown>>): boolean;
|