@reticlehq/core 2.13.1 → 3.1.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/artifacts-entry.d.ts +20 -0
- package/dist/artifacts/artifacts-entry.js +20 -0
- package/dist/artifacts/flow-composition.d.ts +30 -0
- package/dist/artifacts/flow-composition.js +19 -0
- package/dist/{flow-constants.d.ts → artifacts/flow-constants.d.ts} +97 -3
- package/dist/{flow-constants.js → artifacts/flow-constants.js} +103 -4
- package/dist/artifacts/flow-mutation-target.d.ts +39 -0
- package/dist/artifacts/flow-mutation-target.js +89 -0
- package/dist/artifacts/flow-order.d.ts +30 -0
- package/dist/artifacts/flow-order.js +49 -0
- package/dist/artifacts/flow-select.d.ts +56 -0
- package/dist/artifacts/flow-select.js +56 -0
- package/dist/artifacts/flow-step-tool.d.ts +31 -0
- package/dist/artifacts/flow-step-tool.js +31 -0
- package/dist/artifacts/flow-types.d.ts +3736 -0
- package/dist/artifacts/flow-types.js +463 -0
- package/dist/artifacts/flow-unreached.d.ts +12 -0
- package/dist/artifacts/flow-unreached.js +24 -0
- package/dist/{impact-savings.d.ts → artifacts/impact-savings.d.ts} +7 -3
- package/dist/{impact-savings.js → artifacts/impact-savings.js} +27 -4
- package/dist/{impact.d.ts → artifacts/impact.d.ts} +122 -54
- package/dist/{impact.js → artifacts/impact.js} +30 -0
- package/dist/{journal.d.ts → artifacts/journal.d.ts} +50 -6
- package/dist/{journal.js → artifacts/journal.js} +38 -2
- package/dist/artifacts/step-effect.d.ts +29 -0
- package/dist/artifacts/step-effect.js +28 -0
- package/dist/hooks/hook-events.d.ts +311 -0
- package/dist/hooks/hook-events.js +127 -0
- package/dist/hooks/hooks-entry.d.ts +9 -0
- package/dist/hooks/hooks-entry.js +9 -0
- package/dist/{brand.d.ts → identity/brand.d.ts} +7 -0
- package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
- package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
- package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
- package/dist/{document-identity.js → identity/document-identity.js} +4 -5
- package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
- package/dist/{source-constants.js → identity/source-constants.js} +4 -4
- package/dist/index.d.ts +69 -42
- package/dist/index.js +78 -44
- package/dist/onboarding.d.ts +114 -0
- package/dist/onboarding.js +141 -0
- package/dist/realm/registry.d.ts +212 -0
- package/dist/realm/registry.js +302 -0
- package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +4 -5
- package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
- package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
- package/dist/{project-registry.js → registry/project-registry.js} +5 -5
- package/dist/schema/command-name.json +31 -0
- package/dist/schema/event-message.json +1 -0
- package/dist/schema/event-payloads.json +791 -0
- package/dist/schema/event-type.json +1 -0
- package/dist/schema/hello-message.json +76 -2
- package/dist/schema/reticle-event.json +1 -0
- package/dist/schema/reticle-message.json +77 -2
- package/dist/telemetry-entry.d.ts +15 -0
- package/dist/telemetry-entry.js +15 -0
- package/dist/telemetry-feedback.d.ts +13 -14
- package/dist/telemetry-feedback.js +11 -12
- package/dist/telemetry-license.d.ts +1 -1
- package/dist/telemetry-license.js +1 -1
- package/dist/telemetry-refusal.d.ts +11 -11
- package/dist/telemetry-refusal.js +7 -8
- package/dist/telemetry-session.d.ts +49 -57
- package/dist/telemetry-session.js +47 -55
- package/dist/telemetry.d.ts +229 -198
- package/dist/telemetry.js +83 -98
- package/dist/tour-entry.d.ts +10 -0
- package/dist/tour-entry.js +10 -0
- package/dist/tour.d.ts +125 -0
- package/dist/tour.js +165 -0
- package/dist/{consequence.d.ts → verdict/consequence.d.ts} +35 -11
- package/dist/{consequence.js → verdict/consequence.js} +9 -22
- package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
- package/dist/{findings.d.ts → verdict/findings.d.ts} +149 -41
- package/dist/{findings.js → verdict/findings.js} +169 -48
- package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +22 -14
- package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +23 -15
- package/dist/{intent.d.ts → verdict/intent.d.ts} +41 -52
- package/dist/{intent.js → verdict/intent.js} +11 -22
- package/dist/verdict/revision.d.ts +44 -0
- package/dist/verdict/revision.js +53 -0
- package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
- package/dist/{run-context.js → verdict/run-context.js} +15 -36
- package/dist/{security.js → verdict/security.js} +12 -21
- package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +369 -93
- package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
- package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +36 -13
- package/dist/{verified-constants.js → verdict/verified-constants.js} +36 -13
- package/dist/verdict/verify-progress.d.ts +129 -0
- package/dist/verdict/verify-progress.js +74 -0
- package/dist/wire/channel.d.ts +46 -0
- package/dist/wire/channel.js +95 -0
- package/dist/{constants.d.ts → wire/constants/constants.d.ts} +124 -28
- package/dist/{constants.js → wire/constants/constants.js} +137 -28
- package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +9 -2
- package/dist/{session-constants.js → wire/constants/session-constants.js} +9 -2
- package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
- package/dist/{event-classification.js → wire/event-classification.js} +1 -1
- package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +229 -17
- package/dist/{event-payloads.js → wire/event-payloads.js} +61 -3
- package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
- package/dist/{event-priority.js → wire/event-priority.js} +2 -5
- package/dist/wire/global-press.d.ts +30 -0
- package/dist/wire/global-press.js +54 -0
- package/dist/{messages.d.ts → wire/messages.d.ts} +290 -38
- package/dist/{messages.js → wire/messages.js} +93 -5
- package/dist/wire/narrow.d.ts +39 -0
- package/dist/wire/narrow.js +45 -0
- package/dist/{net.d.ts → wire/net.d.ts} +49 -10
- package/dist/{net.js → wire/net.js} +49 -10
- package/dist/wire/platform.d.ts +37 -0
- package/dist/wire/platform.js +36 -0
- package/dist/{redaction.d.ts → wire/redaction.d.ts} +30 -0
- package/dist/wire/redaction.js +274 -0
- package/dist/wire/tool-names.d.ts +133 -0
- package/dist/wire/tool-names.js +142 -0
- package/dist/{toon.js → wire/toon.js} +1 -1
- package/dist/{types.d.ts → wire/types.d.ts} +106 -66
- package/dist/{types.js → wire/types.js} +24 -4
- package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
- package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
- package/dist/{notices.d.ts → words/notices.d.ts} +24 -12
- package/dist/{notices.js → words/notices.js} +27 -12
- package/package.json +22 -5
- package/dist/flow-types.d.ts +0 -1473
- package/dist/flow-types.js +0 -195
- package/dist/redaction.js +0 -149
- /package/dist/{brand.js → identity/brand.js} +0 -0
- /package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
- /package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
- /package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
- /package/dist/{project-id.js → identity/project-id.js} +0 -0
- /package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
- /package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
- /package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
- /package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
- /package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
- /package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
- /package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
- /package/dist/{state-select.js → wire/state-select.js} +0 -0
- /package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
- /package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
- /package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
- /package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
- /package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
- /package/dist/{upgrade.d.ts → words/upgrade.d.ts} +0 -0
- /package/dist/{upgrade.js → words/upgrade.js} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Session lifecycle, health, control, and lease constants.
|
|
3
|
-
* file under the cohesion cap; re-exported from the package index, so importers are unaffected.
|
|
2
|
+
* Session lifecycle, health, control, and lease constants. Re-exported from the package index.
|
|
4
3
|
*/
|
|
5
4
|
/**
|
|
6
5
|
* Live-control: per-session lifecycle state (server-owned). The presenter panel mirrors it.
|
|
@@ -28,6 +27,14 @@ export declare const HumanControlKind: {
|
|
|
28
27
|
readonly MESSAGE: "message";
|
|
29
28
|
/** Human clicked ▶ on a saved flow in the panel — replay it (no agent). `text` carries the name. */
|
|
30
29
|
readonly REPLAY: "replay";
|
|
30
|
+
/**
|
|
31
|
+
* Human asked the panel to push to the dashboard NOW, rather than waiting for the sync timer.
|
|
32
|
+
*
|
|
33
|
+
* The timer already keeps the dashboard current on its own, so this is not how sync happens — it
|
|
34
|
+
* is how somebody watching the panel stops wondering whether it is happening. Carries nothing:
|
|
35
|
+
* what to send is the daemon's question, and a panel that named artifacts could disagree with it.
|
|
36
|
+
*/
|
|
37
|
+
readonly SYNC: "sync";
|
|
31
38
|
};
|
|
32
39
|
export type HumanControlKind = (typeof HumanControlKind)[keyof typeof HumanControlKind];
|
|
33
40
|
/**
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Session lifecycle, health, control, and lease constants.
|
|
3
|
-
* file under the cohesion cap; re-exported from the package index, so importers are unaffected.
|
|
2
|
+
* Session lifecycle, health, control, and lease constants. Re-exported from the package index.
|
|
4
3
|
*/
|
|
5
4
|
/**
|
|
6
5
|
* Live-control: per-session lifecycle state (server-owned). The presenter panel mirrors it.
|
|
@@ -29,6 +28,14 @@ export const HumanControlKind = {
|
|
|
29
28
|
MESSAGE: 'message',
|
|
30
29
|
/** Human clicked ▶ on a saved flow in the panel — replay it (no agent). `text` carries the name. */
|
|
31
30
|
REPLAY: 'replay',
|
|
31
|
+
/**
|
|
32
|
+
* Human asked the panel to push to the dashboard NOW, rather than waiting for the sync timer.
|
|
33
|
+
*
|
|
34
|
+
* The timer already keeps the dashboard current on its own, so this is not how sync happens — it
|
|
35
|
+
* is how somebody watching the panel stops wondering whether it is happening. Carries nothing:
|
|
36
|
+
* what to send is the daemon's question, and a panel that named artifacts could disagree with it.
|
|
37
|
+
*/
|
|
38
|
+
SYNC: 'sync',
|
|
32
39
|
};
|
|
33
40
|
/**
|
|
34
41
|
* Human review marks: the durability tier of the anchor that pins a mark to an element. Mirrors the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventType } from './constants.js';
|
|
1
|
+
import { EventType } from './constants/constants.js';
|
|
2
2
|
/**
|
|
3
3
|
* The high-volume, low-signal floor. These fire continuously on any live page and are the ONLY
|
|
4
4
|
* thing that should be sacrificed when a buffer is full. Everything else is scarce evidence a
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { EventType } from './constants.js';
|
|
2
|
+
import { EventType } from './constants/constants.js';
|
|
3
3
|
/**
|
|
4
4
|
* Per-event-type payload schemas — the typed replacement for the envelope's open `data` record.
|
|
5
5
|
* The envelope (`ReticleEventSchema.data`) stays open on the wire so a richer SDK is never rejected
|
|
@@ -59,6 +59,141 @@ export declare const StorageArea: {
|
|
|
59
59
|
readonly COOKIE: "cookies";
|
|
60
60
|
};
|
|
61
61
|
export type StorageArea = (typeof StorageArea)[keyof typeof StorageArea];
|
|
62
|
+
/**
|
|
63
|
+
* A single cookie to seed before initial navigation.
|
|
64
|
+
*/
|
|
65
|
+
export declare const SeedCookieSchema: z.ZodObject<{
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
value: z.ZodString;
|
|
68
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
69
|
+
path: z.ZodOptional<z.ZodString>;
|
|
70
|
+
url: z.ZodOptional<z.ZodString>;
|
|
71
|
+
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
secure: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
sameSite: z.ZodOptional<z.ZodEnum<["Strict", "Lax", "None"]>>;
|
|
74
|
+
expires: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
value: string;
|
|
77
|
+
name: string;
|
|
78
|
+
path?: string | undefined;
|
|
79
|
+
url?: string | undefined;
|
|
80
|
+
domain?: string | undefined;
|
|
81
|
+
httpOnly?: boolean | undefined;
|
|
82
|
+
secure?: boolean | undefined;
|
|
83
|
+
sameSite?: "Strict" | "Lax" | "None" | undefined;
|
|
84
|
+
expires?: number | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
value: string;
|
|
87
|
+
name: string;
|
|
88
|
+
path?: string | undefined;
|
|
89
|
+
url?: string | undefined;
|
|
90
|
+
domain?: string | undefined;
|
|
91
|
+
httpOnly?: boolean | undefined;
|
|
92
|
+
secure?: boolean | undefined;
|
|
93
|
+
sameSite?: "Strict" | "Lax" | "None" | undefined;
|
|
94
|
+
expires?: number | undefined;
|
|
95
|
+
}>;
|
|
96
|
+
export type SeedCookie = z.infer<typeof SeedCookieSchema>;
|
|
97
|
+
export declare const SeedCookiesSchema: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodArray<z.ZodObject<{
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
value: z.ZodString;
|
|
100
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
101
|
+
path: z.ZodOptional<z.ZodString>;
|
|
102
|
+
url: z.ZodOptional<z.ZodString>;
|
|
103
|
+
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
+
secure: z.ZodOptional<z.ZodBoolean>;
|
|
105
|
+
sameSite: z.ZodOptional<z.ZodEnum<["Strict", "Lax", "None"]>>;
|
|
106
|
+
expires: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
value: string;
|
|
109
|
+
name: string;
|
|
110
|
+
path?: string | undefined;
|
|
111
|
+
url?: string | undefined;
|
|
112
|
+
domain?: string | undefined;
|
|
113
|
+
httpOnly?: boolean | undefined;
|
|
114
|
+
secure?: boolean | undefined;
|
|
115
|
+
sameSite?: "Strict" | "Lax" | "None" | undefined;
|
|
116
|
+
expires?: number | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
value: string;
|
|
119
|
+
name: string;
|
|
120
|
+
path?: string | undefined;
|
|
121
|
+
url?: string | undefined;
|
|
122
|
+
domain?: string | undefined;
|
|
123
|
+
httpOnly?: boolean | undefined;
|
|
124
|
+
secure?: boolean | undefined;
|
|
125
|
+
sameSite?: "Strict" | "Lax" | "None" | undefined;
|
|
126
|
+
expires?: number | undefined;
|
|
127
|
+
}>, "many">]>;
|
|
128
|
+
export type SeedCookies = z.infer<typeof SeedCookiesSchema>;
|
|
129
|
+
/**
|
|
130
|
+
* Client storage and session state to seed into an isolated context before the first navigation.
|
|
131
|
+
* Matches the three storage areas Reticle already observes (localStorage, sessionStorage, cookies).
|
|
132
|
+
*/
|
|
133
|
+
export declare const SeedStorageSchema: z.ZodObject<{
|
|
134
|
+
local: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
135
|
+
session: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
136
|
+
cookies: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodArray<z.ZodObject<{
|
|
137
|
+
name: z.ZodString;
|
|
138
|
+
value: z.ZodString;
|
|
139
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
140
|
+
path: z.ZodOptional<z.ZodString>;
|
|
141
|
+
url: z.ZodOptional<z.ZodString>;
|
|
142
|
+
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
143
|
+
secure: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
+
sameSite: z.ZodOptional<z.ZodEnum<["Strict", "Lax", "None"]>>;
|
|
145
|
+
expires: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
value: string;
|
|
148
|
+
name: string;
|
|
149
|
+
path?: string | undefined;
|
|
150
|
+
url?: string | undefined;
|
|
151
|
+
domain?: string | undefined;
|
|
152
|
+
httpOnly?: boolean | undefined;
|
|
153
|
+
secure?: boolean | undefined;
|
|
154
|
+
sameSite?: "Strict" | "Lax" | "None" | undefined;
|
|
155
|
+
expires?: number | undefined;
|
|
156
|
+
}, {
|
|
157
|
+
value: string;
|
|
158
|
+
name: string;
|
|
159
|
+
path?: string | undefined;
|
|
160
|
+
url?: string | undefined;
|
|
161
|
+
domain?: string | undefined;
|
|
162
|
+
httpOnly?: boolean | undefined;
|
|
163
|
+
secure?: boolean | undefined;
|
|
164
|
+
sameSite?: "Strict" | "Lax" | "None" | undefined;
|
|
165
|
+
expires?: number | undefined;
|
|
166
|
+
}>, "many">]>>;
|
|
167
|
+
}, "strip", z.ZodTypeAny, {
|
|
168
|
+
local?: Record<string, string> | undefined;
|
|
169
|
+
session?: Record<string, string> | undefined;
|
|
170
|
+
cookies?: Record<string, string> | {
|
|
171
|
+
value: string;
|
|
172
|
+
name: string;
|
|
173
|
+
path?: string | undefined;
|
|
174
|
+
url?: string | undefined;
|
|
175
|
+
domain?: string | undefined;
|
|
176
|
+
httpOnly?: boolean | undefined;
|
|
177
|
+
secure?: boolean | undefined;
|
|
178
|
+
sameSite?: "Strict" | "Lax" | "None" | undefined;
|
|
179
|
+
expires?: number | undefined;
|
|
180
|
+
}[] | undefined;
|
|
181
|
+
}, {
|
|
182
|
+
local?: Record<string, string> | undefined;
|
|
183
|
+
session?: Record<string, string> | undefined;
|
|
184
|
+
cookies?: Record<string, string> | {
|
|
185
|
+
value: string;
|
|
186
|
+
name: string;
|
|
187
|
+
path?: string | undefined;
|
|
188
|
+
url?: string | undefined;
|
|
189
|
+
domain?: string | undefined;
|
|
190
|
+
httpOnly?: boolean | undefined;
|
|
191
|
+
secure?: boolean | undefined;
|
|
192
|
+
sameSite?: "Strict" | "Lax" | "None" | undefined;
|
|
193
|
+
expires?: number | undefined;
|
|
194
|
+
}[] | undefined;
|
|
195
|
+
}>;
|
|
196
|
+
export type SeedStorage = z.infer<typeof SeedStorageSchema>;
|
|
62
197
|
/**
|
|
63
198
|
* The registry. `satisfies Record<EventType,...>` makes a missing event type a *compile* error —
|
|
64
199
|
* the wire can never carry a type without a payload contract.
|
|
@@ -142,15 +277,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
142
277
|
initiator: z.ZodString;
|
|
143
278
|
urlRaw: z.ZodOptional<z.ZodString>;
|
|
144
279
|
}, "strip", z.ZodTypeAny, {
|
|
145
|
-
url: string;
|
|
146
280
|
id: string;
|
|
147
281
|
method: string;
|
|
282
|
+
url: string;
|
|
148
283
|
initiator: string;
|
|
149
284
|
urlRaw?: string | undefined;
|
|
150
285
|
}, {
|
|
151
|
-
url: string;
|
|
152
286
|
id: string;
|
|
153
287
|
method: string;
|
|
288
|
+
url: string;
|
|
154
289
|
initiator: string;
|
|
155
290
|
urlRaw?: string | undefined;
|
|
156
291
|
}>;
|
|
@@ -225,12 +360,12 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
225
360
|
value: z.ZodNumber;
|
|
226
361
|
at: z.ZodNumber;
|
|
227
362
|
}, "strip", z.ZodTypeAny, {
|
|
228
|
-
at: number;
|
|
229
363
|
value: number;
|
|
364
|
+
at: number;
|
|
230
365
|
metric: "lcp" | "cls" | "longtask";
|
|
231
366
|
}, {
|
|
232
|
-
at: number;
|
|
233
367
|
value: number;
|
|
368
|
+
at: number;
|
|
234
369
|
metric: "lcp" | "cls" | "longtask";
|
|
235
370
|
}>;
|
|
236
371
|
"route.change": z.ZodObject<{
|
|
@@ -240,15 +375,15 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
240
375
|
search: z.ZodString;
|
|
241
376
|
hash: z.ZodString;
|
|
242
377
|
}, "strip", z.ZodTypeAny, {
|
|
378
|
+
pathname: string;
|
|
243
379
|
from: string;
|
|
244
380
|
to: string;
|
|
245
|
-
pathname: string;
|
|
246
381
|
search: string;
|
|
247
382
|
hash: string;
|
|
248
383
|
}, {
|
|
384
|
+
pathname: string;
|
|
249
385
|
from: string;
|
|
250
386
|
to: string;
|
|
251
|
-
pathname: string;
|
|
252
387
|
search: string;
|
|
253
388
|
hash: string;
|
|
254
389
|
}>;
|
|
@@ -386,13 +521,13 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
386
521
|
old: z.ZodOptional<z.ZodString>;
|
|
387
522
|
new: z.ZodOptional<z.ZodString>;
|
|
388
523
|
}, "strip", z.ZodTypeAny, {
|
|
389
|
-
area: "local" | "session" | "cookies";
|
|
390
524
|
key: string;
|
|
525
|
+
area: "local" | "session" | "cookies";
|
|
391
526
|
old?: string | undefined;
|
|
392
527
|
new?: string | undefined;
|
|
393
528
|
}, {
|
|
394
|
-
area: "local" | "session" | "cookies";
|
|
395
529
|
key: string;
|
|
530
|
+
area: "local" | "session" | "cookies";
|
|
396
531
|
old?: string | undefined;
|
|
397
532
|
new?: string | undefined;
|
|
398
533
|
}>;
|
|
@@ -416,6 +551,24 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
416
551
|
readonly SAFARI: "safari";
|
|
417
552
|
readonly OTHER: "other";
|
|
418
553
|
}>>;
|
|
554
|
+
/**
|
|
555
|
+
* Which shell the page is running in: `web`, `electron`, `tauri`, or something newer.
|
|
556
|
+
*
|
|
557
|
+
* The SDK has always sent this and the server has always read it, but until now the field was
|
|
558
|
+
* not declared here, so it travelled through `.passthrough()` and appeared in NONE of the
|
|
559
|
+
* generated `dist/schema/*.json` files. Anyone implementing this contract from the published
|
|
560
|
+
* schemas -- which is what a third-party realm does -- could not see that the field exists, let
|
|
561
|
+
* alone that the server depends on it.
|
|
562
|
+
*
|
|
563
|
+
* A plain string on purpose, NOT a closed list of the three shells that ship today. A realm
|
|
564
|
+
* that does not exist yet has to be able to name itself, and an enum here would mean one
|
|
565
|
+
* unknown value fails the whole health report, taking visibility, focus and the heartbeat down
|
|
566
|
+
* with it. The wire says the field exists and is a string; which values mean something stays
|
|
567
|
+
* with the reader, where it already is.
|
|
568
|
+
*/
|
|
569
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
570
|
+
/** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
|
|
571
|
+
engine: z.ZodOptional<z.ZodString>;
|
|
419
572
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
420
573
|
hidden: z.ZodBoolean;
|
|
421
574
|
focused: z.ZodBoolean;
|
|
@@ -436,6 +589,24 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
436
589
|
readonly SAFARI: "safari";
|
|
437
590
|
readonly OTHER: "other";
|
|
438
591
|
}>>;
|
|
592
|
+
/**
|
|
593
|
+
* Which shell the page is running in: `web`, `electron`, `tauri`, or something newer.
|
|
594
|
+
*
|
|
595
|
+
* The SDK has always sent this and the server has always read it, but until now the field was
|
|
596
|
+
* not declared here, so it travelled through `.passthrough()` and appeared in NONE of the
|
|
597
|
+
* generated `dist/schema/*.json` files. Anyone implementing this contract from the published
|
|
598
|
+
* schemas -- which is what a third-party realm does -- could not see that the field exists, let
|
|
599
|
+
* alone that the server depends on it.
|
|
600
|
+
*
|
|
601
|
+
* A plain string on purpose, NOT a closed list of the three shells that ship today. A realm
|
|
602
|
+
* that does not exist yet has to be able to name itself, and an enum here would mean one
|
|
603
|
+
* unknown value fails the whole health report, taking visibility, focus and the heartbeat down
|
|
604
|
+
* with it. The wire says the field exists and is a string; which values mean something stays
|
|
605
|
+
* with the reader, where it already is.
|
|
606
|
+
*/
|
|
607
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
608
|
+
/** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
|
|
609
|
+
engine: z.ZodOptional<z.ZodString>;
|
|
439
610
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
440
611
|
hidden: z.ZodBoolean;
|
|
441
612
|
focused: z.ZodBoolean;
|
|
@@ -456,6 +627,24 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
456
627
|
readonly SAFARI: "safari";
|
|
457
628
|
readonly OTHER: "other";
|
|
458
629
|
}>>;
|
|
630
|
+
/**
|
|
631
|
+
* Which shell the page is running in: `web`, `electron`, `tauri`, or something newer.
|
|
632
|
+
*
|
|
633
|
+
* The SDK has always sent this and the server has always read it, but until now the field was
|
|
634
|
+
* not declared here, so it travelled through `.passthrough()` and appeared in NONE of the
|
|
635
|
+
* generated `dist/schema/*.json` files. Anyone implementing this contract from the published
|
|
636
|
+
* schemas -- which is what a third-party realm does -- could not see that the field exists, let
|
|
637
|
+
* alone that the server depends on it.
|
|
638
|
+
*
|
|
639
|
+
* A plain string on purpose, NOT a closed list of the three shells that ship today. A realm
|
|
640
|
+
* that does not exist yet has to be able to name itself, and an enum here would mean one
|
|
641
|
+
* unknown value fails the whole health report, taking visibility, focus and the heartbeat down
|
|
642
|
+
* with it. The wire says the field exists and is a string; which values mean something stays
|
|
643
|
+
* with the reader, where it already is.
|
|
644
|
+
*/
|
|
645
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
646
|
+
/** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
|
|
647
|
+
engine: z.ZodOptional<z.ZodString>;
|
|
459
648
|
}, z.ZodTypeAny, "passthrough">>;
|
|
460
649
|
"context.opened": z.ZodObject<{
|
|
461
650
|
href: z.ZodOptional<z.ZodString>;
|
|
@@ -464,6 +653,28 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
464
653
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
465
654
|
href: z.ZodOptional<z.ZodString>;
|
|
466
655
|
}, z.ZodTypeAny, "passthrough">>;
|
|
656
|
+
"dialog.opened": z.ZodObject<{
|
|
657
|
+
/** Which of the three, so a caller can tell a blocking question from a blocking notice. */
|
|
658
|
+
kind: z.ZodEnum<["alert", "confirm", "prompt"]>;
|
|
659
|
+
/** What the app asked. The whole point: a cancelled action is only legible with the question. */
|
|
660
|
+
message: z.ZodOptional<z.ZodString>;
|
|
661
|
+
/** What Reticle answered on the app's behalf. `false`/`null` are the non-destructive replies. */
|
|
662
|
+
answered: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
663
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
664
|
+
/** Which of the three, so a caller can tell a blocking question from a blocking notice. */
|
|
665
|
+
kind: z.ZodEnum<["alert", "confirm", "prompt"]>;
|
|
666
|
+
/** What the app asked. The whole point: a cancelled action is only legible with the question. */
|
|
667
|
+
message: z.ZodOptional<z.ZodString>;
|
|
668
|
+
/** What Reticle answered on the app's behalf. `false`/`null` are the non-destructive replies. */
|
|
669
|
+
answered: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
670
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
671
|
+
/** Which of the three, so a caller can tell a blocking question from a blocking notice. */
|
|
672
|
+
kind: z.ZodEnum<["alert", "confirm", "prompt"]>;
|
|
673
|
+
/** What the app asked. The whole point: a cancelled action is only legible with the question. */
|
|
674
|
+
message: z.ZodOptional<z.ZodString>;
|
|
675
|
+
/** What Reticle answered on the app's behalf. `false`/`null` are the non-destructive replies. */
|
|
676
|
+
answered: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
|
|
677
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
467
678
|
"render.commit": z.ZodObject<{
|
|
468
679
|
commits: z.ZodNumber;
|
|
469
680
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -572,13 +783,14 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
572
783
|
readonly END: "end";
|
|
573
784
|
readonly MESSAGE: "message";
|
|
574
785
|
readonly REPLAY: "replay";
|
|
786
|
+
readonly SYNC: "sync";
|
|
575
787
|
}>;
|
|
576
788
|
text: z.ZodOptional<z.ZodString>;
|
|
577
789
|
}, "strip", z.ZodTypeAny, {
|
|
578
|
-
kind: "pause" | "resume" | "end" | "
|
|
790
|
+
kind: "message" | "pause" | "resume" | "end" | "replay" | "sync";
|
|
579
791
|
text?: string | undefined;
|
|
580
792
|
}, {
|
|
581
|
-
kind: "pause" | "resume" | "end" | "
|
|
793
|
+
kind: "message" | "pause" | "resume" | "end" | "replay" | "sync";
|
|
582
794
|
text?: string | undefined;
|
|
583
795
|
}>;
|
|
584
796
|
"human.mark": z.ZodObject<{
|
|
@@ -603,25 +815,25 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
|
|
|
603
815
|
}>>;
|
|
604
816
|
route: z.ZodOptional<z.ZodString>;
|
|
605
817
|
}, "strip", z.ZodTypeAny, {
|
|
606
|
-
note: string;
|
|
607
818
|
anchor: string;
|
|
608
|
-
|
|
819
|
+
note: string;
|
|
820
|
+
strategy: "role" | "testid" | "component" | "position";
|
|
609
821
|
label?: string | undefined;
|
|
822
|
+
route?: string | undefined;
|
|
610
823
|
source?: {
|
|
611
824
|
file: string;
|
|
612
825
|
line: number;
|
|
613
826
|
} | undefined;
|
|
614
|
-
route?: string | undefined;
|
|
615
827
|
}, {
|
|
616
|
-
note: string;
|
|
617
828
|
anchor: string;
|
|
618
|
-
|
|
829
|
+
note: string;
|
|
830
|
+
strategy: "role" | "testid" | "component" | "position";
|
|
619
831
|
label?: string | undefined;
|
|
832
|
+
route?: string | undefined;
|
|
620
833
|
source?: {
|
|
621
834
|
file: string;
|
|
622
835
|
line: number;
|
|
623
836
|
} | undefined;
|
|
624
|
-
route?: string | undefined;
|
|
625
837
|
}>;
|
|
626
838
|
};
|
|
627
839
|
/** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { EventType, PerfMetric } from './constants.js';
|
|
3
|
-
import { BlindSpotKind } from '
|
|
4
|
-
import { BrowserBrand } from '
|
|
2
|
+
import { EventType, PerfMetric } from './constants/constants.js';
|
|
3
|
+
import { BlindSpotKind } from '../verdict/verified-constants.js';
|
|
4
|
+
import { BrowserBrand } from '../telemetry-feedback.js';
|
|
5
5
|
import { HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
|
|
6
6
|
/**
|
|
7
7
|
* Per-event-type payload schemas — the typed replacement for the envelope's open `data` record.
|
|
@@ -42,6 +42,36 @@ export const ScrollDirection = { UP: 'up', DOWN: 'down' };
|
|
|
42
42
|
* exactly how long a name can disagree with every use of it for free.
|
|
43
43
|
*/
|
|
44
44
|
export const StorageArea = { LOCAL: 'local', SESSION: 'session', COOKIE: 'cookies' };
|
|
45
|
+
/**
|
|
46
|
+
* A single cookie to seed before initial navigation.
|
|
47
|
+
*/
|
|
48
|
+
export const SeedCookieSchema = z.object({
|
|
49
|
+
name: z.string().describe('Cookie name.'),
|
|
50
|
+
value: z.string().describe('Cookie value.'),
|
|
51
|
+
domain: z.string().optional().describe('Cookie domain. Defaults to the navigation URL domain.'),
|
|
52
|
+
path: z.string().optional().describe('Cookie path. Defaults to "/".'),
|
|
53
|
+
url: z.string().optional().describe('Cookie URL. Defaults to the navigation URL.'),
|
|
54
|
+
httpOnly: z.boolean().optional().describe('Whether the cookie is httpOnly.'),
|
|
55
|
+
secure: z.boolean().optional().describe('Whether the cookie is secure.'),
|
|
56
|
+
sameSite: z.enum(['Strict', 'Lax', 'None']).optional().describe('SameSite policy.'),
|
|
57
|
+
expires: z.number().optional().describe('Unix timestamp in seconds for cookie expiration.'),
|
|
58
|
+
});
|
|
59
|
+
export const SeedCookiesSchema = z.union([z.record(z.string()), z.array(SeedCookieSchema)]);
|
|
60
|
+
/**
|
|
61
|
+
* Client storage and session state to seed into an isolated context before the first navigation.
|
|
62
|
+
* Matches the three storage areas Reticle already observes (localStorage, sessionStorage, cookies).
|
|
63
|
+
*/
|
|
64
|
+
export const SeedStorageSchema = z.object({
|
|
65
|
+
local: z
|
|
66
|
+
.record(z.string())
|
|
67
|
+
.optional()
|
|
68
|
+
.describe('Key-value pairs to seed into window.localStorage before first navigation.'),
|
|
69
|
+
session: z
|
|
70
|
+
.record(z.string())
|
|
71
|
+
.optional()
|
|
72
|
+
.describe('Key-value pairs to seed into window.sessionStorage before first navigation.'),
|
|
73
|
+
cookies: SeedCookiesSchema.optional().describe('Cookies to seed before first navigation: a name-value record scoped to the lease URL or an array of cookie objects.'),
|
|
74
|
+
});
|
|
45
75
|
const elementLabel = z.object({ role: z.string().optional(), name: z.string().optional() });
|
|
46
76
|
/**
|
|
47
77
|
* A file the app produced. `preview`/`lines` are present only when body capture is on, for the same
|
|
@@ -152,11 +182,39 @@ export const EVENT_PAYLOAD_SCHEMAS = {
|
|
|
152
182
|
* one, and a desktop webview has no brand to report.
|
|
153
183
|
*/
|
|
154
184
|
brand: z.nativeEnum(BrowserBrand).optional(),
|
|
185
|
+
/**
|
|
186
|
+
* Which shell the page is running in: `web`, `electron`, `tauri`, or something newer.
|
|
187
|
+
*
|
|
188
|
+
* The SDK has always sent this and the server has always read it, but until now the field was
|
|
189
|
+
* not declared here, so it travelled through `.passthrough()` and appeared in NONE of the
|
|
190
|
+
* generated `dist/schema/*.json` files. Anyone implementing this contract from the published
|
|
191
|
+
* schemas -- which is what a third-party realm does -- could not see that the field exists, let
|
|
192
|
+
* alone that the server depends on it.
|
|
193
|
+
*
|
|
194
|
+
* A plain string on purpose, NOT a closed list of the three shells that ship today. A realm
|
|
195
|
+
* that does not exist yet has to be able to name itself, and an enum here would mean one
|
|
196
|
+
* unknown value fails the whole health report, taking visibility, focus and the heartbeat down
|
|
197
|
+
* with it. The wire says the field exists and is a string; which values mean something stays
|
|
198
|
+
* with the reader, where it already is.
|
|
199
|
+
*/
|
|
200
|
+
runtime: z.string().optional(),
|
|
201
|
+
/** The rendering engine, coarse on purpose (blink / gecko / webkit). Same reasoning as `runtime`. */
|
|
202
|
+
engine: z.string().optional(),
|
|
155
203
|
})
|
|
156
204
|
.passthrough(),
|
|
157
205
|
// The page called window.open — the clicked consequence may continue in a context the SDK cannot
|
|
158
206
|
// enter (#508). `href` is what the page asked to open, omitted for the blank-tab form.
|
|
159
207
|
[EventType.CONTEXT_OPENED]: z.object({ href: z.string().optional() }).passthrough(),
|
|
208
|
+
[EventType.DIALOG_OPENED]: z
|
|
209
|
+
.object({
|
|
210
|
+
/** Which of the three, so a caller can tell a blocking question from a blocking notice. */
|
|
211
|
+
kind: z.enum(['alert', 'confirm', 'prompt']),
|
|
212
|
+
/** What the app asked. The whole point: a cancelled action is only legible with the question. */
|
|
213
|
+
message: z.string().optional(),
|
|
214
|
+
/** What Reticle answered on the app's behalf. `false`/`null` are the non-destructive replies. */
|
|
215
|
+
answered: z.union([z.boolean(), z.null()]).optional(),
|
|
216
|
+
})
|
|
217
|
+
.passthrough(),
|
|
160
218
|
[EventType.RENDER_COMMIT]: z.object({ commits: z.number() }),
|
|
161
219
|
[EventType.FOCUS_CHANGE]: z.object({
|
|
162
220
|
to: z.string().optional(),
|
|
@@ -8,10 +8,7 @@
|
|
|
8
8
|
* First-come-first-dropped therefore spends the whole budget on churn and loses exactly the signal
|
|
9
9
|
* the agent asked about.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
* single IPC call under test was among them. The assertion came back `unknown` — honest, but blind.
|
|
13
|
-
*
|
|
14
|
-
* So over the cap we drop the high-volume/low-value kinds first and keep a reserve for these. The
|
|
11
|
+
* So over the cap the high-volume/low-value kinds drop first and these keep a reserve. The
|
|
15
12
|
* reserve is bounded (see RATE_CAP_HIGH_VALUE_RESERVE_RATIO) — a flood of errors is still a flood,
|
|
16
13
|
* and going unbounded here would just move the overload rather than shed it.
|
|
17
14
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventType } from './constants.js';
|
|
1
|
+
import { EventType } from './constants/constants.js';
|
|
2
2
|
/**
|
|
3
3
|
* Which events survive the bridge's rate cap.
|
|
4
4
|
*
|
|
@@ -9,10 +9,7 @@ import { EventType } from './constants.js';
|
|
|
9
9
|
* First-come-first-dropped therefore spends the whole budget on churn and loses exactly the signal
|
|
10
10
|
* the agent asked about.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* single IPC call under test was among them. The assertion came back `unknown` — honest, but blind.
|
|
14
|
-
*
|
|
15
|
-
* So over the cap we drop the high-volume/low-value kinds first and keep a reserve for these. The
|
|
12
|
+
* So over the cap the high-volume/low-value kinds drop first and these keep a reserve. The
|
|
16
13
|
* reserve is bounded (see RATE_CAP_HIGH_VALUE_RESERVE_RATIO) — a flood of errors is still a flood,
|
|
17
14
|
* and going unbounded here would just move the overload rather than shed it.
|
|
18
15
|
*/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The key a `press` sends when neither `text` nor `key` was named.
|
|
3
|
+
*
|
|
4
|
+
* Enter is the historical default. It is also the one key that must NEVER be treated as a
|
|
5
|
+
* document key without a locator: on a focused field inside a form it submits it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_PRESS_KEY = "Enter";
|
|
8
|
+
/**
|
|
9
|
+
* Keys a real user sends at the page, not at a control. Escape dismisses, Tab moves focus.
|
|
10
|
+
* A press of one of these with no ref is valid; a press of Enter or a letter is not.
|
|
11
|
+
*/
|
|
12
|
+
export declare const GLOBAL_PRESS_KEYS: readonly ["Escape", "Tab"];
|
|
13
|
+
/**
|
|
14
|
+
* Which key a `press` is asking for.
|
|
15
|
+
*
|
|
16
|
+
* `text` FIRST, because that is what the tool description documents ("{ text } for type/press")
|
|
17
|
+
* and therefore what agents send. `key` still works — it is what anyone reading the source would
|
|
18
|
+
* have sent — and the default only applies when neither was named.
|
|
19
|
+
*/
|
|
20
|
+
export declare function pressKeyFromArgs(args: Record<string, unknown>): string;
|
|
21
|
+
/**
|
|
22
|
+
* A press that is a document key, not an element action: Escape, Tab, or any key with modifiers
|
|
23
|
+
* (Cmd+K). Requiring a ref for these forced a snapshot just to name an element the keystroke is
|
|
24
|
+
* not about.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isGlobalPress(args: Record<string, unknown>): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The tool/step shape `{ action, args }` — a press of a document key, so no locator is required.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isGlobalPressCall(args: Record<string, unknown>): boolean;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ActionType } from './constants/constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* The key a `press` sends when neither `text` nor `key` was named.
|
|
4
|
+
*
|
|
5
|
+
* Enter is the historical default. It is also the one key that must NEVER be treated as a
|
|
6
|
+
* document key without a locator: on a focused field inside a form it submits it.
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_PRESS_KEY = 'Enter';
|
|
9
|
+
/**
|
|
10
|
+
* Keys a real user sends at the page, not at a control. Escape dismisses, Tab moves focus.
|
|
11
|
+
* A press of one of these with no ref is valid; a press of Enter or a letter is not.
|
|
12
|
+
*/
|
|
13
|
+
export const GLOBAL_PRESS_KEYS = ['Escape', 'Tab'];
|
|
14
|
+
const GLOBAL_PRESS_KEY_SET = new Set(GLOBAL_PRESS_KEYS.map((k) => k.toLowerCase()));
|
|
15
|
+
/**
|
|
16
|
+
* Which key a `press` is asking for.
|
|
17
|
+
*
|
|
18
|
+
* `text` FIRST, because that is what the tool description documents ("{ text } for type/press")
|
|
19
|
+
* and therefore what agents send. `key` still works — it is what anyone reading the source would
|
|
20
|
+
* have sent — and the default only applies when neither was named.
|
|
21
|
+
*/
|
|
22
|
+
export function pressKeyFromArgs(args) {
|
|
23
|
+
const text = args['text'];
|
|
24
|
+
if ('string' === typeof text && 0 < text.length)
|
|
25
|
+
return text;
|
|
26
|
+
const key = args['key'];
|
|
27
|
+
if ('string' === typeof key && 0 < key.length)
|
|
28
|
+
return key;
|
|
29
|
+
return DEFAULT_PRESS_KEY;
|
|
30
|
+
}
|
|
31
|
+
function hasModifiers(args) {
|
|
32
|
+
const raw = args['modifiers'];
|
|
33
|
+
return Array.isArray(raw) && 0 < raw.length;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A press that is a document key, not an element action: Escape, Tab, or any key with modifiers
|
|
37
|
+
* (Cmd+K). Requiring a ref for these forced a snapshot just to name an element the keystroke is
|
|
38
|
+
* not about.
|
|
39
|
+
*/
|
|
40
|
+
export function isGlobalPress(args) {
|
|
41
|
+
if (hasModifiers(args))
|
|
42
|
+
return true;
|
|
43
|
+
return GLOBAL_PRESS_KEY_SET.has(pressKeyFromArgs(args).toLowerCase());
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The tool/step shape `{ action, args }` — a press of a document key, so no locator is required.
|
|
47
|
+
*/
|
|
48
|
+
export function isGlobalPressCall(args) {
|
|
49
|
+
if (ActionType.PRESS !== args['action'])
|
|
50
|
+
return false;
|
|
51
|
+
const inner = args['args'];
|
|
52
|
+
const pressArgs = 'object' === typeof inner && null !== inner ? inner : {};
|
|
53
|
+
return isGlobalPress(pressArgs);
|
|
54
|
+
}
|