@burdenoff/ui-engine 2026.1127.2 → 2026.1127.4
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 +74 -4
- package/dist/capture.js +3 -2
- package/dist/dom-runtime/actions.d.ts +65 -0
- package/dist/dom-runtime/iife.d.ts +1 -0
- package/dist/dom-runtime/index.d.ts +7 -0
- package/dist/dom-runtime/runtime.d.ts +79 -0
- package/dist/dom-runtime.d.ts +2 -0
- package/dist/dom-runtime.iife.js +1 -0
- package/dist/dom-runtime.js +30 -0
- package/dist/drivers/dom-driver.d.ts +44 -0
- package/dist/drivers/index.d.ts +7 -0
- package/dist/drivers/snapshot-driver.d.ts +59 -0
- package/dist/drivers.d.ts +2 -0
- package/dist/drivers.js +170 -0
- package/dist/{index-n5amgh31.js → index-2kgsgn1c.js} +1 -1
- package/dist/index-3f1j8386.js +334 -0
- package/dist/index-3jymbm5t.js +315 -0
- package/dist/index-5k26keah.js +815 -0
- package/dist/index-77pcz6n3.js +303 -0
- package/dist/index-895kscx3.js +741 -0
- package/dist/{index-phd8yhyg.js → index-bnvmt4wf.js} +7 -5
- package/dist/{index-c6pmt2rg.js → index-cs6acyjn.js} +6 -59
- package/dist/index-ct2xctrq.js +229 -0
- package/dist/index-h88y5qgv.js +400 -0
- package/dist/index-mgztm37r.js +57 -0
- package/dist/{index-tqffkt91.js → index-pm13mvvc.js} +26 -1009
- package/dist/index-vg8r40y7.js +220 -0
- package/dist/index-ycs2bz1a.js +589 -0
- package/dist/index-zzhysbkj.js +1731 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +130 -42
- package/dist/interpret/compile.d.ts +58 -0
- package/dist/interpret/driver.d.ts +171 -0
- package/dist/interpret/errors.d.ts +194 -0
- package/dist/interpret/events.d.ts +73 -0
- package/dist/interpret/expr.d.ts +35 -0
- package/dist/interpret/index.d.ts +13 -0
- package/dist/interpret/run.d.ts +77 -0
- package/dist/interpret.d.ts +2 -0
- package/dist/interpret.js +84 -0
- package/dist/recording.js +1 -1
- package/dist/replay.js +2 -2
- package/dist/script/adapters/browser-action-contract.d.ts +5 -2
- package/dist/script/limits.d.ts +2 -0
- package/dist/script.js +44 -38
- package/dist/target/aria.d.ts +31 -0
- package/dist/target/dom.d.ts +35 -0
- package/dist/target/index.d.ts +13 -0
- package/dist/target/markers.d.ts +18 -0
- package/dist/target/methods.d.ts +52 -0
- package/dist/target/resolve.d.ts +63 -0
- package/dist/target/snapshot.d.ts +57 -0
- package/dist/target/text.d.ts +23 -0
- package/dist/target/types.d.ts +88 -0
- package/dist/target.d.ts +2 -0
- package/dist/target.js +96 -0
- package/dist/testing/fake-web-driver.d.ts +28 -0
- package/dist/testing/fixtures/ambiguous.d.ts +7 -0
- package/dist/testing/fixtures/iframe.d.ts +6 -0
- package/dist/testing/fixtures/index.d.ts +26 -0
- package/dist/testing/fixtures/invoices-v2.d.ts +8 -0
- package/dist/testing/fixtures/invoices-v3.d.ts +7 -0
- package/dist/testing/fixtures/invoices.d.ts +6 -0
- package/dist/testing/fixtures/login.d.ts +6 -0
- package/dist/testing/fixtures/shadow.d.ts +7 -0
- package/dist/testing/index.d.ts +7 -0
- package/dist/testing/mount.d.ts +18 -0
- package/dist/testing.d.ts +2 -0
- package/dist/testing.js +379 -0
- package/package.json +29 -5
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RECORDING_VERSION2,
|
|
3
|
+
targetFingerprint2,
|
|
4
|
+
parseRecording2
|
|
5
|
+
} from "./index-cs6acyjn.js";
|
|
1
6
|
import {
|
|
2
7
|
REDACTED2,
|
|
3
8
|
redactCredentials2,
|
|
4
9
|
containsCredential,
|
|
5
10
|
decodeUriText,
|
|
6
|
-
containsCredentialInUrl
|
|
7
|
-
|
|
8
|
-
targetFingerprint2,
|
|
9
|
-
parseRecording2
|
|
10
|
-
} from "./index-c6pmt2rg.js";
|
|
11
|
+
containsCredentialInUrl
|
|
12
|
+
} from "./index-mgztm37r.js";
|
|
11
13
|
|
|
12
14
|
// src/capture.ts
|
|
13
15
|
var SECRET_FIELD = /password|passcode|passwd|\bpin\b|otp|one[\s-]?time|verification|security code|auth(?:entication)? code|\bcvv\b|\bcvc\b|card number|secret|token|recovery/i;
|
|
@@ -1,65 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
containsCredential,
|
|
3
|
+
containsCredentialInUrl
|
|
4
|
+
} from "./index-mgztm37r.js";
|
|
5
|
+
|
|
1
6
|
// src/recording.ts
|
|
2
7
|
import { sha256 as nobleSha256 } from "@noble/hashes/sha2.js";
|
|
3
8
|
import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
|
|
4
9
|
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
// src/redact-credentials.ts
|
|
7
|
-
var REDACTED2 = "[REDACTED]";
|
|
8
|
-
var CREDENTIAL_PATTERNS = [
|
|
9
|
-
/\b(?:Bearer|Basic)\s+[^\s"'`,;)\]}]+/gi,
|
|
10
|
-
/\b(?:sk|pk|rk|xai)-[^\s"'`,;)\]}]+/gi,
|
|
11
|
-
/\b(?:gsk|hf|ghp|gho|ghs|ghu|glpat)_[^\s"'`,;)\]}]+/gi,
|
|
12
|
-
/\bAIza[\w-]{10,}/g,
|
|
13
|
-
/\b(?:AKIA|ASIA)[0-9A-Z]{12,}/g
|
|
14
|
-
];
|
|
15
|
-
var SEPARATORS = /([\s"'`,;:=()[\]{}]+)/;
|
|
16
|
-
var SECRET_KEY = /^(?:api[_-]?key|access[_-]?key|secret|secret[_-]?key|client[_-]?secret|token|password)$/i;
|
|
17
|
-
function isMaskedFragment(word) {
|
|
18
|
-
const ellipsis = word.indexOf("…");
|
|
19
|
-
return word.includes("***") || ellipsis !== -1 && ellipsis < word.length - 1;
|
|
20
|
-
}
|
|
21
|
-
function redactWords(text) {
|
|
22
|
-
const parts = text.split(SEPARATORS);
|
|
23
|
-
for (let index = 0;index < parts.length; index += 2) {
|
|
24
|
-
const word = parts[index] ?? "";
|
|
25
|
-
if (word && word !== REDACTED2 && isMaskedFragment(word))
|
|
26
|
-
parts[index] = REDACTED2;
|
|
27
|
-
const separator = parts[index + 1] ?? "";
|
|
28
|
-
const next = parts[index + 2];
|
|
29
|
-
if (next && SECRET_KEY.test(word) && /[:=]/.test(separator))
|
|
30
|
-
parts[index + 2] = REDACTED2;
|
|
31
|
-
}
|
|
32
|
-
return parts.join("");
|
|
33
|
-
}
|
|
34
|
-
function redactCredentials2(text) {
|
|
35
|
-
if (!text)
|
|
36
|
-
return text;
|
|
37
|
-
let redacted = text;
|
|
38
|
-
for (const pattern of CREDENTIAL_PATTERNS) {
|
|
39
|
-
redacted = redacted.replace(pattern, REDACTED2);
|
|
40
|
-
}
|
|
41
|
-
redacted = redactWords(redacted);
|
|
42
|
-
return redacted.replace(/(?:\[REDACTED\]){2,}/g, REDACTED2);
|
|
43
|
-
}
|
|
44
|
-
var MARKER_PROBE = "";
|
|
45
|
-
function containsCredential(text) {
|
|
46
|
-
if (!text)
|
|
47
|
-
return false;
|
|
48
|
-
const probe = text.replaceAll(REDACTED2, MARKER_PROBE);
|
|
49
|
-
return redactCredentials2(probe).replaceAll(MARKER_PROBE, REDACTED2) !== text;
|
|
50
|
-
}
|
|
51
|
-
function decodeUriText(text) {
|
|
52
|
-
try {
|
|
53
|
-
return decodeURIComponent(text.replaceAll("+", " "));
|
|
54
|
-
} catch {
|
|
55
|
-
return text;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function containsCredentialInUrl(text) {
|
|
59
|
-
return containsCredential(decodeUriText(text).replace(/[/?&#]/g, " "));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// src/recording.ts
|
|
63
10
|
function sha256Hex2(text) {
|
|
64
11
|
return bytesToHex(nobleSha256(utf8ToBytes(text)));
|
|
65
12
|
}
|
|
@@ -210,4 +157,4 @@ function isSavedStepAuthor2(value) {
|
|
|
210
157
|
return typeof value === "string" && SAVED_STEP_AUTHORS2.includes(value);
|
|
211
158
|
}
|
|
212
159
|
|
|
213
|
-
export {
|
|
160
|
+
export { sha256Hex2, RECORDING_VERSION2, MAX_RECORDED_STEPS2, SAVED_STEP_AUTHORS2, REPLAYABLE_ACTIONS2, recordedTargetSchema2, recordedStepSchema2, recordingSchema2, targetFingerprint2, RecordingError2, parseRecording2, isSavedStepAuthor2 };
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import {
|
|
2
|
+
READ_ACTIONS2,
|
|
3
|
+
POINTER_ACTIONS2,
|
|
4
|
+
performDomAction2
|
|
5
|
+
} from "./index-77pcz6n3.js";
|
|
6
|
+
import {
|
|
7
|
+
resolveWebTarget2,
|
|
8
|
+
serializeTreeSnapshot2
|
|
9
|
+
} from "./index-5k26keah.js";
|
|
10
|
+
|
|
11
|
+
// src/dom-runtime/runtime.ts
|
|
12
|
+
var DOM_RUNTIME_VERSION2 = 1;
|
|
13
|
+
var DOM_RUNTIME_GLOBAL2 = "__burdenoffUiRuntime";
|
|
14
|
+
var MAX_HIGHLIGHT_MS2 = 60000;
|
|
15
|
+
var HIGHLIGHT_HOST_TAG2 = "fg-ui-highlight";
|
|
16
|
+
var METHOD_KINDS = new Set(["role", "css", "testId", "xpath", "fuzzy", "anchor", "text"]);
|
|
17
|
+
function isRuntimeTarget2(value) {
|
|
18
|
+
if (!value || typeof value !== "object")
|
|
19
|
+
return false;
|
|
20
|
+
const target = value;
|
|
21
|
+
if (!Array.isArray(target.methods) || target.methods.length === 0 || target.methods.length > 8)
|
|
22
|
+
return false;
|
|
23
|
+
if (target.frame !== undefined && !(Array.isArray(target.frame) && target.frame.every((item) => typeof item === "string"))) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return target.methods.every((method) => !!method && typeof method === "object" && METHOD_KINDS.has(String(method.kind)));
|
|
27
|
+
}
|
|
28
|
+
function invalidTarget() {
|
|
29
|
+
return { status: "failed", code: "ELEMENT_NOT_FOUND", candidates: [], candidateCount: 0, attempts: [] };
|
|
30
|
+
}
|
|
31
|
+
function withoutElement(found) {
|
|
32
|
+
return {
|
|
33
|
+
status: found.status,
|
|
34
|
+
method: found.method,
|
|
35
|
+
methodIndex: found.methodIndex,
|
|
36
|
+
fallback: found.fallback,
|
|
37
|
+
candidate: found.candidate,
|
|
38
|
+
attempts: found.attempts
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function frameElementOf(document) {
|
|
42
|
+
try {
|
|
43
|
+
return document.defaultView?.frameElement ?? null;
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function coveredAt(current, x, y, labels) {
|
|
49
|
+
const root = current.getRootNode();
|
|
50
|
+
if (typeof root.elementFromPoint !== "function")
|
|
51
|
+
return null;
|
|
52
|
+
const top = root.elementFromPoint(x, y);
|
|
53
|
+
if (!top)
|
|
54
|
+
return "offscreen";
|
|
55
|
+
if (top === current || current.contains(top))
|
|
56
|
+
return null;
|
|
57
|
+
return labels.some((label) => label.contains(top)) ? null : "covered";
|
|
58
|
+
}
|
|
59
|
+
function coverage(element, rect) {
|
|
60
|
+
let x = rect.x + rect.width / 2;
|
|
61
|
+
let y = rect.y + rect.height / 2;
|
|
62
|
+
const labels = Array.from(element.labels ?? []);
|
|
63
|
+
let current = element;
|
|
64
|
+
for (let hop = 0;hop < 32; hop += 1) {
|
|
65
|
+
const blocked = coveredAt(current, x, y, hop === 0 ? labels : []);
|
|
66
|
+
if (blocked)
|
|
67
|
+
return blocked;
|
|
68
|
+
const root = current.getRootNode();
|
|
69
|
+
if (root && "host" in root) {
|
|
70
|
+
current = root.host;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const frame = frameElementOf(current.ownerDocument);
|
|
74
|
+
if (!frame)
|
|
75
|
+
return null;
|
|
76
|
+
const box = frame.getBoundingClientRect();
|
|
77
|
+
x += box.x + frame.clientLeft;
|
|
78
|
+
y += box.y + frame.clientTop;
|
|
79
|
+
current = frame;
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
function outsideViewport(element, rect) {
|
|
84
|
+
const view = element.ownerDocument.defaultView;
|
|
85
|
+
if (!view)
|
|
86
|
+
return false;
|
|
87
|
+
const x = rect.x + rect.width / 2;
|
|
88
|
+
const y = rect.y + rect.height / 2;
|
|
89
|
+
return x < 0 || y < 0 || x >= view.innerWidth || y >= view.innerHeight;
|
|
90
|
+
}
|
|
91
|
+
function pointerBlock(element) {
|
|
92
|
+
const view = element.ownerDocument.defaultView;
|
|
93
|
+
if (view && view.getComputedStyle(element).pointerEvents === "none")
|
|
94
|
+
return "noPointerEvents";
|
|
95
|
+
let rect = element.getBoundingClientRect();
|
|
96
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
97
|
+
return null;
|
|
98
|
+
if (outsideViewport(element, rect) && typeof element.scrollIntoView === "function") {
|
|
99
|
+
element.scrollIntoView({ block: "center", inline: "center" });
|
|
100
|
+
rect = element.getBoundingClientRect();
|
|
101
|
+
}
|
|
102
|
+
return coverage(element, rect);
|
|
103
|
+
}
|
|
104
|
+
function createDomRuntime2(document, options = {}) {
|
|
105
|
+
const root = options.root ?? document;
|
|
106
|
+
const probe = {
|
|
107
|
+
...options.rectOf ? { rectOf: options.rectOf } : {},
|
|
108
|
+
...options.isVisible ? { isVisible: options.isVisible } : {}
|
|
109
|
+
};
|
|
110
|
+
let overlay = null;
|
|
111
|
+
let clearTimer = null;
|
|
112
|
+
const clearHighlight = () => {
|
|
113
|
+
if (clearTimer !== null) {
|
|
114
|
+
clearTimeout(clearTimer);
|
|
115
|
+
clearTimer = null;
|
|
116
|
+
}
|
|
117
|
+
overlay?.remove();
|
|
118
|
+
overlay = null;
|
|
119
|
+
};
|
|
120
|
+
const resolveRaw = (target, state) => {
|
|
121
|
+
clearHighlight();
|
|
122
|
+
return resolveWebTarget2(root, target, { ...probe, ...state ? { state } : {} });
|
|
123
|
+
};
|
|
124
|
+
const resolve = (target, resolveOptions = {}) => {
|
|
125
|
+
if (!isRuntimeTarget2(target))
|
|
126
|
+
return invalidTarget();
|
|
127
|
+
const result = resolveRaw(target, resolveOptions.state);
|
|
128
|
+
return result.status === "found" ? withoutElement(result) : result;
|
|
129
|
+
};
|
|
130
|
+
const act = (target, action, actOptions = {}) => {
|
|
131
|
+
if (!action || typeof action !== "object" || typeof action.kind !== "string") {
|
|
132
|
+
return { ok: false, code: "INVALID_ACTION" };
|
|
133
|
+
}
|
|
134
|
+
if (!isRuntimeTarget2(target)) {
|
|
135
|
+
return { ok: false, code: "ELEMENT_NOT_FOUND", resolution: invalidTarget() };
|
|
136
|
+
}
|
|
137
|
+
const state = actOptions.state ?? (READ_ACTIONS2.has(action.kind) ? "visible" : "interactable");
|
|
138
|
+
const result = resolveRaw(target, state);
|
|
139
|
+
if (result.status !== "found") {
|
|
140
|
+
if (action.kind === "exists" && result.code === "ELEMENT_NOT_FOUND") {
|
|
141
|
+
return { ok: true, value: false, resolution: result };
|
|
142
|
+
}
|
|
143
|
+
return { ok: false, code: result.code, resolution: result };
|
|
144
|
+
}
|
|
145
|
+
const resolution = withoutElement(result);
|
|
146
|
+
const blocked = POINTER_ACTIONS2.has(action.kind) ? pointerBlock(result.element) : null;
|
|
147
|
+
if (blocked) {
|
|
148
|
+
return {
|
|
149
|
+
ok: false,
|
|
150
|
+
code: "ELEMENT_NOT_INTERACTABLE",
|
|
151
|
+
reason: blocked,
|
|
152
|
+
resolution: {
|
|
153
|
+
status: "failed",
|
|
154
|
+
code: "ELEMENT_NOT_INTERACTABLE",
|
|
155
|
+
candidates: [result.candidate],
|
|
156
|
+
candidateCount: 1,
|
|
157
|
+
attempts: result.attempts
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const outcome = performDomAction2(result.element, action);
|
|
162
|
+
if (!outcome.ok)
|
|
163
|
+
return { ok: false, code: outcome.problem, resolution };
|
|
164
|
+
return outcome.value === undefined ? { ok: true, resolution } : { ok: true, resolution, value: outcome.value };
|
|
165
|
+
};
|
|
166
|
+
const drawBoxes = (boxes, label, numbered) => {
|
|
167
|
+
const host = document.createElement(HIGHLIGHT_HOST_TAG2);
|
|
168
|
+
host.setAttribute("aria-hidden", "true");
|
|
169
|
+
host.setAttribute("style", "all: initial; position: fixed; inset: 0; pointer-events: none; z-index: 2147483647;");
|
|
170
|
+
const shadow = host.attachShadow({ mode: "closed" });
|
|
171
|
+
boxes.forEach((box, index) => {
|
|
172
|
+
const frame = document.createElement("div");
|
|
173
|
+
frame.setAttribute("style", `position: fixed; left: ${box.bounds.x - 3}px; top: ${box.bounds.y - 3}px; width: ${box.bounds.width + 6}px; height: ${box.bounds.height + 6}px; outline: 3px solid Highlight; border-radius: 4px; box-sizing: border-box;`);
|
|
174
|
+
const caption = numbered ? `${index + 1}${label ? ` ${label}` : ""}` : label;
|
|
175
|
+
if (caption) {
|
|
176
|
+
const tag = document.createElement("span");
|
|
177
|
+
tag.textContent = caption.slice(0, 120);
|
|
178
|
+
tag.setAttribute("style", "position: absolute; left: 0; top: 100%; margin-top: 4px; padding: 2px 6px; font: 600 11px system-ui, sans-serif; background: Highlight; color: HighlightText; border-radius: 3px; white-space: nowrap;");
|
|
179
|
+
frame.appendChild(tag);
|
|
180
|
+
}
|
|
181
|
+
shadow.appendChild(frame);
|
|
182
|
+
});
|
|
183
|
+
document.documentElement.appendChild(host);
|
|
184
|
+
overlay = host;
|
|
185
|
+
};
|
|
186
|
+
const highlight = (target, highlightOptions = {}) => {
|
|
187
|
+
if (!isRuntimeTarget2(target))
|
|
188
|
+
return invalidTarget();
|
|
189
|
+
const result = resolveRaw(target, highlightOptions.state ?? "visible");
|
|
190
|
+
if (result.status === "found")
|
|
191
|
+
drawBoxes([result.candidate], highlightOptions.label, false);
|
|
192
|
+
else if (result.candidates.length > 0)
|
|
193
|
+
drawBoxes(result.candidates, highlightOptions.label, true);
|
|
194
|
+
const duration = Math.min(MAX_HIGHLIGHT_MS2, Math.max(0, Number(highlightOptions.durationMs ?? 0) || 0));
|
|
195
|
+
if (overlay && duration > 0)
|
|
196
|
+
clearTimer = setTimeout(clearHighlight, duration);
|
|
197
|
+
return result.status === "found" ? withoutElement(result) : result;
|
|
198
|
+
};
|
|
199
|
+
return {
|
|
200
|
+
version: DOM_RUNTIME_VERSION2,
|
|
201
|
+
resolve,
|
|
202
|
+
act,
|
|
203
|
+
highlight,
|
|
204
|
+
clearHighlight,
|
|
205
|
+
snapshot: (snapshotOptions = {}) => {
|
|
206
|
+
clearHighlight();
|
|
207
|
+
return serializeTreeSnapshot2(document, {
|
|
208
|
+
...probe,
|
|
209
|
+
...snapshotOptions.maxNodes ? { maxNodes: snapshotOptions.maxNodes } : {}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function installDomRuntime2(scope, document) {
|
|
215
|
+
const existing = Reflect.get(scope, DOM_RUNTIME_GLOBAL2);
|
|
216
|
+
if (existing && typeof existing === "object" && typeof existing.version === "number" && existing.version >= DOM_RUNTIME_VERSION2) {
|
|
217
|
+
return existing;
|
|
218
|
+
}
|
|
219
|
+
const runtime = Object.freeze(createDomRuntime2(document));
|
|
220
|
+
Object.defineProperty(scope, DOM_RUNTIME_GLOBAL2, {
|
|
221
|
+
value: runtime,
|
|
222
|
+
configurable: true,
|
|
223
|
+
enumerable: false,
|
|
224
|
+
writable: false
|
|
225
|
+
});
|
|
226
|
+
return runtime;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export { DOM_RUNTIME_VERSION2, DOM_RUNTIME_GLOBAL2, MAX_HIGHLIGHT_MS2, HIGHLIGHT_HOST_TAG2, isRuntimeTarget2, createDomRuntime2, installDomRuntime2 };
|