@burdenoff/ui-engine 2026.1203.1 → 2026.1204.2
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 +20 -2
- package/dist/analyze/analyze.d.ts +10 -0
- package/dist/analyze/context.d.ts +25 -9
- package/dist/analyze/index.d.ts +3 -2
- package/dist/analyze/messages.d.ts +2 -0
- package/dist/analyze/rules/run-command-from-variable.d.ts +2 -0
- package/dist/analyze/rules/single-method-image-target.d.ts +7 -0
- package/dist/analyze/sensitive.d.ts +2 -2
- package/dist/analyze/types.d.ts +6 -2
- package/dist/analyze.js +4 -2
- package/dist/desk.d.ts +13 -0
- package/dist/desk.js +29 -0
- package/dist/dom-runtime.iife.js +1 -1
- package/dist/dom-runtime.js +2 -2
- package/dist/drivers/desk-backend.d.ts +40 -0
- package/dist/drivers/desk-driver.d.ts +41 -0
- package/dist/drivers/desk-errors.d.ts +19 -0
- package/dist/drivers/desk-tree.d.ts +28 -0
- package/dist/drivers/desk-wire.d.ts +237 -0
- package/dist/drivers/index.d.ts +3 -1
- package/dist/drivers.js +13 -10
- package/dist/heal.js +5 -5
- package/dist/index-0ps53dhe.js +85 -0
- package/dist/{index-qm9nd548.js → index-2q0hh6we.js} +4 -4
- package/dist/index-552x2bnm.js +56 -0
- package/dist/index-6m0chbhq.js +64 -0
- package/dist/{index-xdtanv9b.js → index-7gfzv5n8.js} +97 -54
- package/dist/{index-gvavb597.js → index-93hfbk5c.js} +10 -0
- package/dist/index-a8s39bse.js +920 -0
- package/dist/{index-g7724awk.js → index-axph39g0.js} +22 -0
- package/dist/index-b5a306v7.js +43 -0
- package/dist/index-bx4bsvg0.js +458 -0
- package/dist/{index-6h7ah1dw.js → index-cc49ykn5.js} +4 -4
- package/dist/{index-3hsp44k5.js → index-e557vzdd.js} +221 -36
- package/dist/{index-vnv9tp11.js → index-e7pgqd60.js} +2 -2
- package/dist/index-hdq3y007.js +246 -0
- package/dist/{index-zagmp5ya.js → index-n3nfhjrj.js} +2 -2
- package/dist/{index-rs3yzt5q.js → index-nmsg2wze.js} +4 -4
- package/dist/{index-zhbwhdya.js → index-q2jbva7c.js} +5 -3
- package/dist/{index-n7ah1jn7.js → index-rbem2yms.js} +16 -243
- package/dist/{index-mhv6a02p.js → index-reef7e8m.js} +1 -1
- package/dist/{index-y4j6zep8.js → index-wdbn4xjc.js} +6 -6
- package/dist/{index-pfdm8evf.js → index-x8fc4r4h.js} +115 -9
- package/dist/{index-yc0jgph6.js → index-yhzykhdj.js} +6 -43
- package/dist/{index-t55wvhvh.js → index-z2v8prer.js} +1 -61
- package/dist/index-zj3zhbac.js +1123 -0
- package/dist/{index-hw5npwsv.js → index-zpxk3fzd.js} +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +162 -20
- package/dist/interpret/driver.d.ts +109 -18
- package/dist/interpret/errors.d.ts +7 -1
- package/dist/interpret/events.d.ts +5 -2
- package/dist/interpret/index.d.ts +4 -3
- package/dist/interpret/run.d.ts +28 -1
- package/dist/interpret.js +16 -9
- package/dist/script/adapters/recording-desktop.d.ts +52 -0
- package/dist/script/describe.d.ts +7 -2
- package/dist/script/desk-roles.d.ts +33 -0
- package/dist/script/desktop-capabilities.d.ts +125 -0
- package/dist/script/desktop-schema.d.ts +281 -0
- package/dist/script/desktop-types.d.ts +265 -0
- package/dist/script/fingerprint.d.ts +10 -1
- package/dist/script/hash.d.ts +9 -0
- package/dist/script/index.d.ts +14 -4
- package/dist/script/json-schema.d.ts +8 -0
- package/dist/script/parse.d.ts +29 -0
- package/dist/script/schema.d.ts +2098 -1
- package/dist/script/walk.d.ts +18 -4
- package/dist/script.js +118 -8
- package/dist/target/types.d.ts +10 -4
- package/dist/target.js +20 -16
- package/dist/testing.js +5 -3
- package/package.json +9 -3
- package/schema/ui-script-desktop-v1.schema.json +12181 -0
- package/dist/index-68x61c7a.js +0 -743
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
READ_ACTIONS2,
|
|
3
3
|
POINTER_ACTIONS2,
|
|
4
4
|
performDomAction2
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-e7pgqd60.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveWebTarget2,
|
|
8
8
|
serializeTreeSnapshot2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-rbem2yms.js";
|
|
10
10
|
|
|
11
11
|
// src/dom-runtime/runtime.ts
|
|
12
12
|
var DOM_RUNTIME_VERSION2 = 1;
|
|
@@ -9,17 +9,17 @@ import {
|
|
|
9
9
|
withFingerprint2,
|
|
10
10
|
UiScriptError2,
|
|
11
11
|
parseUiScript2
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-zj3zhbac.js";
|
|
13
13
|
import {
|
|
14
14
|
UiRunError2
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-yhzykhdj.js";
|
|
16
16
|
import {
|
|
17
17
|
requiredCapabilities2,
|
|
18
18
|
missingCapabilities2
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-zpxk3fzd.js";
|
|
20
20
|
import {
|
|
21
21
|
walkSteps2
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-axph39g0.js";
|
|
23
23
|
// src/interpret/compile.ts
|
|
24
24
|
var MAX_CALL_DEPTH2 = 4;
|
|
25
25
|
var COMPILED_NAME_PREFIX2 = "__c";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
snapshotUrl2
|
|
3
|
+
} from "./index-6m0chbhq.js";
|
|
1
4
|
import {
|
|
2
5
|
SENSITIVE_MARKERS2,
|
|
3
6
|
INPUT_ROLES,
|
|
4
7
|
TAG_ROLES,
|
|
5
8
|
NAME_FROM_CONTENT,
|
|
6
|
-
clip2
|
|
7
|
-
|
|
8
|
-
} from "./index-t55wvhvh.js";
|
|
9
|
+
clip2
|
|
10
|
+
} from "./index-z2v8prer.js";
|
|
9
11
|
|
|
10
12
|
// src/target/snapshot-tree.ts
|
|
11
13
|
var SNAPSHOT_ROOT_PATH2 = "/";
|
|
@@ -1,261 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
snapshotUrl2
|
|
3
|
+
} from "./index-6m0chbhq.js";
|
|
4
|
+
import {
|
|
5
|
+
MAX_CANDIDATES2,
|
|
6
|
+
MAX_CANDIDATE_NAME2,
|
|
7
|
+
isHeadingLike,
|
|
8
|
+
matchMethod2
|
|
9
|
+
} from "./index-hdq3y007.js";
|
|
1
10
|
import {
|
|
2
11
|
roleOf2,
|
|
3
12
|
isTypedContent2,
|
|
4
13
|
accessibleName2,
|
|
5
14
|
labelName2,
|
|
6
15
|
visibleText2,
|
|
7
|
-
matchesRoleAndName2,
|
|
8
16
|
isElementVisible2,
|
|
9
17
|
isElementEnabled2,
|
|
10
18
|
elementRect2,
|
|
11
|
-
elementsUnder2,
|
|
12
19
|
isSensitiveElement2
|
|
13
|
-
} from "./index-
|
|
20
|
+
} from "./index-reef7e8m.js";
|
|
14
21
|
import {
|
|
15
22
|
SENSITIVE_MARKERS2,
|
|
16
23
|
assignedSlotOf,
|
|
17
24
|
containerOf,
|
|
18
25
|
isMarkedSensitive,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
sameText2,
|
|
22
|
-
containsText2,
|
|
23
|
-
textSimilarity2,
|
|
24
|
-
clip2,
|
|
25
|
-
snapshotUrl2
|
|
26
|
-
} from "./index-t55wvhvh.js";
|
|
26
|
+
clip2
|
|
27
|
+
} from "./index-z2v8prer.js";
|
|
27
28
|
import {
|
|
28
29
|
redactCredentials2
|
|
29
30
|
} from "./index-mgztm37r.js";
|
|
30
31
|
|
|
31
|
-
// src/target/types.ts
|
|
32
|
-
var WEB_TARGET_ERROR_CODES2 = ["ELEMENT_NOT_FOUND", "ELEMENT_AMBIGUOUS", "ELEMENT_NOT_INTERACTABLE"];
|
|
33
|
-
var MAX_CANDIDATES2 = 5;
|
|
34
|
-
var MAX_CANDIDATE_NAME2 = 200;
|
|
35
|
-
|
|
36
|
-
// src/target/methods.ts
|
|
37
|
-
var DEFAULT_FUZZY_THRESHOLD2 = 0.8;
|
|
38
|
-
var FUZZY_MARGIN2 = 0.05;
|
|
39
|
-
var ANCHOR_MARGIN_PX2 = 4;
|
|
40
|
-
var MAX_XPATH_RESULTS2 = 1000;
|
|
41
|
-
var EDGE_SLACK_PX = 2;
|
|
42
|
-
var INTERACTIVE_ROLES2 = new Set([
|
|
43
|
-
"button",
|
|
44
|
-
"checkbox",
|
|
45
|
-
"combobox",
|
|
46
|
-
"link",
|
|
47
|
-
"listbox",
|
|
48
|
-
"menuitem",
|
|
49
|
-
"menuitemcheckbox",
|
|
50
|
-
"menuitemradio",
|
|
51
|
-
"option",
|
|
52
|
-
"radio",
|
|
53
|
-
"searchbox",
|
|
54
|
-
"slider",
|
|
55
|
-
"spinbutton",
|
|
56
|
-
"switch",
|
|
57
|
-
"tab",
|
|
58
|
-
"textbox",
|
|
59
|
-
"treeitem"
|
|
60
|
-
]);
|
|
61
|
-
var ATTRIBUTE_NAME = /^[A-Za-z_][\w:.-]{0,127}$/;
|
|
62
|
-
function documentOf(root) {
|
|
63
|
-
return root.nodeType === 9 ? root : root.ownerDocument;
|
|
64
|
-
}
|
|
65
|
-
function matchRole(method, context) {
|
|
66
|
-
const elements = elementsUnder2(context.root).filter((element) => matchesRoleAndName2(element, method.role, method.name, context.probe));
|
|
67
|
-
return { kind: "list", elements, ...method.nth !== undefined ? { nth: method.nth } : {} };
|
|
68
|
-
}
|
|
69
|
-
function matchCss(selector, context) {
|
|
70
|
-
try {
|
|
71
|
-
return { kind: "list", elements: Array.from(context.root.querySelectorAll(selector)) };
|
|
72
|
-
} catch {
|
|
73
|
-
return { kind: "invalid" };
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function matchTestId(method, context) {
|
|
77
|
-
const attribute = method.attribute ?? "data-testid";
|
|
78
|
-
if (!ATTRIBUTE_NAME.test(attribute))
|
|
79
|
-
return { kind: "invalid" };
|
|
80
|
-
const elements = elementsUnder2(context.root).filter((element) => element.getAttribute(attribute) === method.value);
|
|
81
|
-
return { kind: "list", elements };
|
|
82
|
-
}
|
|
83
|
-
function isUnder(root, node) {
|
|
84
|
-
if (root.nodeType === 9)
|
|
85
|
-
return node.ownerDocument === root && node.getRootNode() === root;
|
|
86
|
-
return root === node || root.contains(node);
|
|
87
|
-
}
|
|
88
|
-
function matchXPath(method, context) {
|
|
89
|
-
const document = documentOf(context.root);
|
|
90
|
-
if (typeof document.evaluate !== "function")
|
|
91
|
-
return { kind: "unsupported" };
|
|
92
|
-
let result;
|
|
93
|
-
try {
|
|
94
|
-
result = document.evaluate(method.xpath, context.root, null, 7, null);
|
|
95
|
-
} catch {
|
|
96
|
-
return { kind: "invalid" };
|
|
97
|
-
}
|
|
98
|
-
const elements = [];
|
|
99
|
-
const length = Math.min(result.snapshotLength, MAX_XPATH_RESULTS2);
|
|
100
|
-
for (let index = 0;index < length; index += 1) {
|
|
101
|
-
const node = result.snapshotItem(index);
|
|
102
|
-
if (node && node.nodeType === 1 && isUnder(context.root, node))
|
|
103
|
-
elements.push(node);
|
|
104
|
-
}
|
|
105
|
-
return { kind: "list", elements, ...result.snapshotLength > MAX_XPATH_RESULTS2 ? { overflow: true } : {} };
|
|
106
|
-
}
|
|
107
|
-
function lengthAllows(name, wantedLength, threshold) {
|
|
108
|
-
const length = Math.min(normaliseText2(name).length, MAX_COMPARED_TEXT2);
|
|
109
|
-
const longest = Math.max(length, wantedLength);
|
|
110
|
-
return longest > 0 && Math.abs(length - wantedLength) <= (1 - threshold) * longest;
|
|
111
|
-
}
|
|
112
|
-
function matchFuzzy(method, context) {
|
|
113
|
-
const threshold = Math.min(1, Math.max(0.5, method.threshold ?? DEFAULT_FUZZY_THRESHOLD2));
|
|
114
|
-
const wantedRole = method.role?.trim().toLowerCase();
|
|
115
|
-
const wantedLength = Math.min(normaliseText2(method.name).length, MAX_COMPARED_TEXT2);
|
|
116
|
-
const scored = [];
|
|
117
|
-
for (const element of elementsUnder2(context.root)) {
|
|
118
|
-
const role = roleOf2(element);
|
|
119
|
-
if (wantedRole ? role !== wantedRole : role === "")
|
|
120
|
-
continue;
|
|
121
|
-
const name = accessibleName2(element, context.probe);
|
|
122
|
-
if (!lengthAllows(name, wantedLength, threshold))
|
|
123
|
-
continue;
|
|
124
|
-
const score = textSimilarity2(name, method.name);
|
|
125
|
-
if (score >= threshold)
|
|
126
|
-
scored.push({ element, score });
|
|
127
|
-
}
|
|
128
|
-
return { kind: "ranked", scored, margin: FUZZY_MARGIN2 };
|
|
129
|
-
}
|
|
130
|
-
function innermostByText(context, matches) {
|
|
131
|
-
const hits = elementsUnder2(context.root).filter((element) => matches(visibleText2(element, context.probe)));
|
|
132
|
-
const keep = context.keep ?? (() => true);
|
|
133
|
-
const innerHits = hits.filter(keep);
|
|
134
|
-
return hits.filter((element) => !innerHits.some((inner) => inner !== element && element.contains(inner)));
|
|
135
|
-
}
|
|
136
|
-
function matchText(method, context) {
|
|
137
|
-
const test = method.exact ? (text) => sameText2(text, method.text) : (text) => containsText2(text, method.text);
|
|
138
|
-
if (normaliseText2(method.text).length === 0)
|
|
139
|
-
return { kind: "list", elements: [] };
|
|
140
|
-
return {
|
|
141
|
-
kind: "list",
|
|
142
|
-
elements: innermostByText(context, test),
|
|
143
|
-
...method.nth !== undefined ? { nth: method.nth } : {}
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
function labelText(text) {
|
|
147
|
-
return normaliseText2(text).replace(/[\s:*]+$/u, "");
|
|
148
|
-
}
|
|
149
|
-
function anchorElements(anchor, context) {
|
|
150
|
-
const found = anchor.kind === "role" ? elementsUnder2(context.root).filter((element) => matchesRoleAndName2(element, anchor.role, anchor.name, context.probe)) : innermostByText(context, (text) => labelText(text) === labelText(anchor.text) && labelText(text) !== "");
|
|
151
|
-
return found.filter((element) => isElementVisible2(element, context.probe));
|
|
152
|
-
}
|
|
153
|
-
function candidateElements(method, context, anchors) {
|
|
154
|
-
const wantedRole = method.role?.trim().toLowerCase();
|
|
155
|
-
return elementsUnder2(context.root).filter((element) => {
|
|
156
|
-
const role = roleOf2(element);
|
|
157
|
-
if (wantedRole ? role !== wantedRole : !INTERACTIVE_ROLES2.has(role))
|
|
158
|
-
return false;
|
|
159
|
-
return !anchors.some((anchor) => anchor === element || element.contains(anchor));
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
var HEADING_TAGS = new Set(["h1", "h2", "h3", "h4", "h5", "h6", "legend", "caption", "figcaption", "summary", "dt"]);
|
|
163
|
-
function isHeadingLike(element) {
|
|
164
|
-
return HEADING_TAGS.has(element.localName) || roleOf2(element) === "heading";
|
|
165
|
-
}
|
|
166
|
-
function headingOf(anchor) {
|
|
167
|
-
for (let current = anchor;current; current = current.parentElement) {
|
|
168
|
-
if (isHeadingLike(current))
|
|
169
|
-
return current;
|
|
170
|
-
}
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
function matchInside(method, context, anchors) {
|
|
174
|
-
const candidates = candidateElements(method, context, anchors);
|
|
175
|
-
const inside = new Set;
|
|
176
|
-
for (const anchor of anchors) {
|
|
177
|
-
const heading = headingOf(anchor);
|
|
178
|
-
const container = heading?.parentElement ?? anchor;
|
|
179
|
-
for (const candidate of candidates)
|
|
180
|
-
if (container.contains(candidate))
|
|
181
|
-
inside.add(candidate);
|
|
182
|
-
}
|
|
183
|
-
return { kind: "list", elements: candidates.filter((candidate) => inside.has(candidate)) };
|
|
184
|
-
}
|
|
185
|
-
function overlaps(aStart, aEnd, bStart, bEnd) {
|
|
186
|
-
return aStart < bEnd && bStart < aEnd;
|
|
187
|
-
}
|
|
188
|
-
function relationDistance2(relation, anchor, element) {
|
|
189
|
-
const aRight = anchor.x + anchor.width;
|
|
190
|
-
const aBottom = anchor.y + anchor.height;
|
|
191
|
-
const eRight = element.x + element.width;
|
|
192
|
-
const eBottom = element.y + element.height;
|
|
193
|
-
const sameRow = overlaps(anchor.y, aBottom, element.y, eBottom);
|
|
194
|
-
const sameColumn = overlaps(anchor.x, aRight, element.x, eRight);
|
|
195
|
-
switch (relation) {
|
|
196
|
-
case "rightOf":
|
|
197
|
-
return sameRow && element.x >= aRight - EDGE_SLACK_PX ? Math.max(0, element.x - aRight) : null;
|
|
198
|
-
case "leftOf":
|
|
199
|
-
return sameRow && eRight <= anchor.x + EDGE_SLACK_PX ? Math.max(0, anchor.x - eRight) : null;
|
|
200
|
-
case "below":
|
|
201
|
-
return sameColumn && element.y >= aBottom - EDGE_SLACK_PX ? Math.max(0, element.y - aBottom) : null;
|
|
202
|
-
case "above":
|
|
203
|
-
return sameColumn && eBottom <= anchor.y + EDGE_SLACK_PX ? Math.max(0, anchor.y - eBottom) : null;
|
|
204
|
-
case "sameRow":
|
|
205
|
-
return sameRow ? Math.abs(element.x + element.width / 2 - (anchor.x + anchor.width / 2)) : null;
|
|
206
|
-
default:
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
function hasArea(rect) {
|
|
211
|
-
return rect.width > 0 && rect.height > 0;
|
|
212
|
-
}
|
|
213
|
-
function matchAnchor(method, context) {
|
|
214
|
-
const anchors = anchorElements(method.anchor, context);
|
|
215
|
-
if (anchors.length === 0)
|
|
216
|
-
return { kind: "list", elements: [] };
|
|
217
|
-
if (method.relation === "inside")
|
|
218
|
-
return matchInside(method, context, anchors);
|
|
219
|
-
const anchorRects = anchors.map((anchor) => elementRect2(anchor, context.probe)).filter(hasArea);
|
|
220
|
-
if (anchorRects.length === 0)
|
|
221
|
-
return { kind: "unsupported" };
|
|
222
|
-
const scored = [];
|
|
223
|
-
for (const element of candidateElements(method, context, anchors)) {
|
|
224
|
-
const rect = elementRect2(element, context.probe);
|
|
225
|
-
if (!hasArea(rect))
|
|
226
|
-
continue;
|
|
227
|
-
let best = null;
|
|
228
|
-
for (const anchorRect of anchorRects) {
|
|
229
|
-
const distance = relationDistance2(method.relation, anchorRect, rect);
|
|
230
|
-
if (distance !== null && (best === null || distance < best))
|
|
231
|
-
best = distance;
|
|
232
|
-
}
|
|
233
|
-
if (best !== null)
|
|
234
|
-
scored.push({ element, score: -best });
|
|
235
|
-
}
|
|
236
|
-
return { kind: "ranked", scored, margin: ANCHOR_MARGIN_PX2 };
|
|
237
|
-
}
|
|
238
|
-
function matchMethod2(method, context) {
|
|
239
|
-
switch (method.kind) {
|
|
240
|
-
case "role":
|
|
241
|
-
return matchRole(method, context);
|
|
242
|
-
case "css":
|
|
243
|
-
return matchCss(method.selector, context);
|
|
244
|
-
case "testId":
|
|
245
|
-
return matchTestId(method, context);
|
|
246
|
-
case "xpath":
|
|
247
|
-
return matchXPath(method, context);
|
|
248
|
-
case "fuzzy":
|
|
249
|
-
return matchFuzzy(method, context);
|
|
250
|
-
case "anchor":
|
|
251
|
-
return matchAnchor(method, context);
|
|
252
|
-
case "text":
|
|
253
|
-
return matchText(method, context);
|
|
254
|
-
default:
|
|
255
|
-
return { kind: "unsupported" };
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
32
|
// src/target/container.ts
|
|
260
33
|
var MAX_CONTAINER_DEPTH2 = 12;
|
|
261
34
|
var MAX_CONTAINER_CHECKS2 = 3;
|
|
@@ -629,7 +402,7 @@ var DROPPED_ARIA = new Set(["aria-valuenow", "aria-valuetext", "aria-checked", "
|
|
|
629
402
|
var BUTTON_INPUTS = new Set(["button", "submit", "reset"]);
|
|
630
403
|
var TAG_NAME = /^[a-z][a-z0-9-]{0,63}$/;
|
|
631
404
|
var EMPTY_FRAME_DOCUMENT = "<!doctype html><html><head></head><body></body></html>";
|
|
632
|
-
var
|
|
405
|
+
var ATTRIBUTE_NAME = /^[a-z][a-z0-9_:.-]{0,127}$/;
|
|
633
406
|
function isEditingHost(element) {
|
|
634
407
|
const value = element.getAttribute("contenteditable");
|
|
635
408
|
return value !== null && value.trim().toLowerCase() !== "false";
|
|
@@ -697,7 +470,7 @@ function keptAttributes(element, marked) {
|
|
|
697
470
|
const tag = element.localName;
|
|
698
471
|
for (const attribute of Array.from(element.attributes)) {
|
|
699
472
|
const name = attribute.name.toLowerCase();
|
|
700
|
-
if (name.startsWith("on") || !
|
|
473
|
+
if (name.startsWith("on") || !ATTRIBUTE_NAME.test(name))
|
|
701
474
|
continue;
|
|
702
475
|
if (marked && (DESCRIPTIVE_ATTRIBUTES.has(name) || name === "href" || name.startsWith("aria-") && !STRUCTURAL_ARIA.has(name))) {
|
|
703
476
|
continue;
|
|
@@ -844,7 +617,7 @@ function appendChildren(document, parent, children, state) {
|
|
|
844
617
|
}
|
|
845
618
|
function applyNode(document, element, node, state) {
|
|
846
619
|
for (const [name, value] of Object.entries(node.a ?? {})) {
|
|
847
|
-
if (!
|
|
620
|
+
if (!ATTRIBUTE_NAME.test(name) || name.startsWith("on"))
|
|
848
621
|
continue;
|
|
849
622
|
if (name === "href" && snapshotUrl2(value) === null)
|
|
850
623
|
continue;
|
|
@@ -902,4 +675,4 @@ function hydrateTreeSnapshot2(document, snapshot) {
|
|
|
902
675
|
};
|
|
903
676
|
}
|
|
904
677
|
|
|
905
|
-
export {
|
|
678
|
+
export { MAX_CONTAINER_DEPTH2, MAX_CONTAINER_CHECKS2, MAX_CONTAINER_CHECKS_PER_RESOLUTION2, CONTAINER_TIME_BUDGET_MS2, MAX_CONTAINER_PAGE_ELEMENTS2, CONTAINER_ROLES2, createContainerBudget2, describeContainer2, containersAllowed2, enterFrames2, describeCandidate2, resolveWebTarget2, resolveAllWebTargets2, UI_TREE_SNAPSHOT_VERSION2, DEFAULT_SNAPSHOT_MAX_NODES2, MAX_SNAPSHOT_DEPTH2, MAX_SNAPSHOT_TEXT2, serializeTreeSnapshot2, hydrateTreeSnapshot2 };
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UiDriverError2
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-yhzykhdj.js";
|
|
4
4
|
import {
|
|
5
5
|
CAPABILITY_IDS2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-zpxk3fzd.js";
|
|
7
7
|
import {
|
|
8
8
|
MAX_LIST_ITEMS2
|
|
9
9
|
} from "./index-20bbwwc9.js";
|
|
10
10
|
import {
|
|
11
11
|
createDomRuntime2
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-n3nfhjrj.js";
|
|
13
13
|
import {
|
|
14
14
|
MAX_READ_TEXT2,
|
|
15
15
|
performDomAction2
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-e7pgqd60.js";
|
|
17
17
|
import {
|
|
18
18
|
enterFrames2,
|
|
19
19
|
describeCandidate2,
|
|
20
20
|
resolveWebTarget2,
|
|
21
21
|
resolveAllWebTargets2,
|
|
22
22
|
serializeTreeSnapshot2
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-rbem2yms.js";
|
|
24
24
|
import {
|
|
25
25
|
isElementVisible2,
|
|
26
26
|
isSensitiveElement2
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-reef7e8m.js";
|
|
28
28
|
import {
|
|
29
29
|
redactCredentials2
|
|
30
30
|
} from "./index-mgztm37r.js";
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DESKTOP_SCRIPT_SURFACE2,
|
|
2
3
|
uiScriptRegistry2,
|
|
3
4
|
NAME_PATTERN2,
|
|
4
5
|
uiScriptSchema2,
|
|
6
|
+
MAX_DESK_SELECTOR_STRING2,
|
|
7
|
+
desktopUiScriptRegistry2,
|
|
8
|
+
desktopUiScriptSchema2,
|
|
5
9
|
canonicalJson2,
|
|
6
10
|
soleRoleMethod,
|
|
7
11
|
uiStepFingerprint2,
|
|
12
|
+
withDesktopFingerprint2,
|
|
8
13
|
UiScriptError2,
|
|
9
|
-
parseUiScript2
|
|
10
|
-
|
|
14
|
+
parseUiScript2,
|
|
15
|
+
parseDesktopUiScript2,
|
|
16
|
+
isApplicationName2
|
|
17
|
+
} from "./index-zj3zhbac.js";
|
|
11
18
|
import {
|
|
12
19
|
maskUrl2,
|
|
13
|
-
sha256Hex2,
|
|
14
20
|
RecordingError2,
|
|
15
21
|
parseRecording2
|
|
16
22
|
} from "./index-dcs2pe49.js";
|
|
23
|
+
import {
|
|
24
|
+
platformRole2
|
|
25
|
+
} from "./index-0ps53dhe.js";
|
|
17
26
|
import {
|
|
18
27
|
MAX_SCRIPT_STEPS2,
|
|
19
28
|
MAX_SCRIPT_INPUTS2,
|
|
@@ -35,11 +44,6 @@ import {
|
|
|
35
44
|
import {
|
|
36
45
|
containsCredential
|
|
37
46
|
} from "./index-mgztm37r.js";
|
|
38
|
-
// src/script/hash.ts
|
|
39
|
-
var UI_SCRIPT_SCHEMA_HASH2 = "e6860649ad1cba906fb704ce4b62b3ea4380203e6628c809571602f4d0947884";
|
|
40
|
-
function schemaHashOf2(jsonSchema) {
|
|
41
|
-
return sha256Hex2(canonicalJson2(jsonSchema));
|
|
42
|
-
}
|
|
43
47
|
// src/script/json-schema.ts
|
|
44
48
|
import { z } from "zod";
|
|
45
49
|
var UI_SCRIPT_SCHEMA_TITLE2 = "FluidGrids UI script v1";
|
|
@@ -53,6 +57,17 @@ function uiScriptJsonSchema2() {
|
|
|
53
57
|
const { $schema, ...rest } = generated;
|
|
54
58
|
return { $schema, title: UI_SCRIPT_SCHEMA_TITLE2, ...rest };
|
|
55
59
|
}
|
|
60
|
+
var UI_DESKTOP_SCRIPT_SCHEMA_TITLE2 = "FluidGrids desktop UI script v1";
|
|
61
|
+
function desktopUiScriptJsonSchema2() {
|
|
62
|
+
const generated = z.toJSONSchema(desktopUiScriptSchema2, {
|
|
63
|
+
target: "draft-2020-12",
|
|
64
|
+
io: "input",
|
|
65
|
+
unrepresentable: "throw",
|
|
66
|
+
metadata: desktopUiScriptRegistry2
|
|
67
|
+
});
|
|
68
|
+
const { $schema, ...rest } = generated;
|
|
69
|
+
return { $schema, title: UI_DESKTOP_SCRIPT_SCHEMA_TITLE2, ...rest };
|
|
70
|
+
}
|
|
56
71
|
// src/script/adapters/browser-action-contract.ts
|
|
57
72
|
var BROWSER_STEP_ACTIONS2 = [
|
|
58
73
|
"navigate",
|
|
@@ -819,6 +834,97 @@ function toRecordedStep(step, fallbackIntent) {
|
|
|
819
834
|
return stop2();
|
|
820
835
|
}
|
|
821
836
|
}
|
|
837
|
+
// src/script/adapters/recording-desktop.ts
|
|
838
|
+
function fits(text) {
|
|
839
|
+
return text === undefined || text.length >= 1 && text.length <= MAX_DESK_SELECTOR_STRING2;
|
|
840
|
+
}
|
|
841
|
+
function selectorMethodOfRecordedTarget2(target, platform) {
|
|
842
|
+
const role = platformRole2(target.role, platform);
|
|
843
|
+
if (target.nth !== 0 || role === undefined)
|
|
844
|
+
return;
|
|
845
|
+
if (!fits(target.name) || !fits(target.window) || !fits(target.app))
|
|
846
|
+
return;
|
|
847
|
+
if (target.app !== undefined && !isApplicationName2(target.app))
|
|
848
|
+
return;
|
|
849
|
+
return {
|
|
850
|
+
kind: platform,
|
|
851
|
+
...target.app === undefined ? {} : { app: target.app },
|
|
852
|
+
...target.window === undefined ? {} : { window: { title: target.window } },
|
|
853
|
+
path: [{ role, name: target.name }]
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
function roleMethodOf(target) {
|
|
857
|
+
return {
|
|
858
|
+
kind: "role",
|
|
859
|
+
role: target.role,
|
|
860
|
+
name: target.name,
|
|
861
|
+
nth: target.nth,
|
|
862
|
+
...target.app === undefined ? {} : { app: target.app },
|
|
863
|
+
...target.window === undefined ? {} : { window: target.window }
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
function desktopTargetOfRecordedTarget2(target, platform) {
|
|
867
|
+
const strict = selectorMethodOfRecordedTarget2(target, platform);
|
|
868
|
+
return { methods: strict ? [roleMethodOf(target), strict] : [roleMethodOf(target)] };
|
|
869
|
+
}
|
|
870
|
+
function fromRecordedStep2(step, platform) {
|
|
871
|
+
const base = {
|
|
872
|
+
id: step.id,
|
|
873
|
+
intent: step.intent,
|
|
874
|
+
...step.screenshotRef === undefined ? {} : { screenshotRef: step.screenshotRef }
|
|
875
|
+
};
|
|
876
|
+
const target = (recorded) => desktopTargetOfRecordedTarget2(recorded, platform);
|
|
877
|
+
switch (step.action) {
|
|
878
|
+
case "click": {
|
|
879
|
+
const button = step.button === "right" ? { button: "right" } : {};
|
|
880
|
+
return step.count === 2 ? { ...base, action: "doubleClick", target: target(step.target), ...button } : { ...base, action: "click", target: target(step.target), ...button };
|
|
881
|
+
}
|
|
882
|
+
case "type":
|
|
883
|
+
return {
|
|
884
|
+
...base,
|
|
885
|
+
action: "type",
|
|
886
|
+
...step.target ? { target: target(step.target) } : {},
|
|
887
|
+
...step.text === undefined ? {} : { text: step.text },
|
|
888
|
+
masked: step.masked
|
|
889
|
+
};
|
|
890
|
+
case "secret_fill":
|
|
891
|
+
return {
|
|
892
|
+
...base,
|
|
893
|
+
action: "typeSecret",
|
|
894
|
+
target: target(step.target),
|
|
895
|
+
secretRef: step.secretRef,
|
|
896
|
+
expectedOrigin: step.expectedOrigin
|
|
897
|
+
};
|
|
898
|
+
case "key":
|
|
899
|
+
return { ...base, action: "pressKey", keys: step.keys };
|
|
900
|
+
case "scroll":
|
|
901
|
+
return {
|
|
902
|
+
...base,
|
|
903
|
+
action: "scroll",
|
|
904
|
+
...step.target ? { target: target(step.target) } : {},
|
|
905
|
+
dx: step.dx,
|
|
906
|
+
dy: step.dy
|
|
907
|
+
};
|
|
908
|
+
case "navigate":
|
|
909
|
+
return { ...base, action: "navigate", url: step.url };
|
|
910
|
+
default:
|
|
911
|
+
return {
|
|
912
|
+
...base,
|
|
913
|
+
action: "focusWindow",
|
|
914
|
+
app: step.app,
|
|
915
|
+
...step.title === undefined ? {} : { title: step.title }
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
function fromRecordingForDesk2(value, options) {
|
|
920
|
+
const recording = parseRecording2(value);
|
|
921
|
+
const steps = recording.steps.map((step) => withDesktopFingerprint2(fromRecordedStep2(step, options.platform)));
|
|
922
|
+
return parseDesktopUiScript2({
|
|
923
|
+
scriptVersion: 1,
|
|
924
|
+
surface: DESKTOP_SCRIPT_SURFACE2,
|
|
925
|
+
steps
|
|
926
|
+
});
|
|
927
|
+
}
|
|
822
928
|
// src/script/adapters/from-computer-use.ts
|
|
823
929
|
var COMPUTER_USE_ACTIONS2 = [
|
|
824
930
|
"screenshot",
|
|
@@ -1296,4 +1402,4 @@ function propose(state, target, fingerprint, stepId, screenshotFileId) {
|
|
|
1296
1402
|
...fileId ? { screenshotFileId: fileId } : {}
|
|
1297
1403
|
});
|
|
1298
1404
|
}
|
|
1299
|
-
export {
|
|
1405
|
+
export { UI_SCRIPT_SCHEMA_TITLE2, uiScriptJsonSchema2, UI_DESKTOP_SCRIPT_SCHEMA_TITLE2, desktopUiScriptJsonSchema2, BROWSER_STEP_ACTIONS2, fromBrowserActionSteps2, toBrowserActionSteps2, targetFromPlaywrightSelector2, fromRemoteBrowserSteps2, fromRecording2, toRecording2, selectorMethodOfRecordedTarget2, desktopTargetOfRecordedTarget2, fromRecordingForDesk2, COMPUTER_USE_ACTIONS2, MAX_COMPUTER_USE_ACTIONS2, COMPUTER_USE_MAX_WAIT_MS2, COMPUTER_USE_DEFAULT_WAIT_MS2, DEFAULT_LOGIN_SECRET_REFS2, COMPUTER_USE_SKIP_REASONS2, targetFromUiFingerprint2, scriptFromComputerUseActions2 };
|
|
@@ -142,6 +142,11 @@ var UI_ERROR_CODES2 = {
|
|
|
142
142
|
family: "DEPENDENCY",
|
|
143
143
|
preflight: false,
|
|
144
144
|
meaning: "Healing found and checked a new target, but a person must approve it first (heal with approval, an always-ask step or keyword, or a consequential control); the run stops with the candidate in error.heal and the desk parks it for approval. Never retried in the script"
|
|
145
|
+
},
|
|
146
|
+
SHELL_NOT_ALLOWED: {
|
|
147
|
+
family: "VALIDATION",
|
|
148
|
+
preflight: true,
|
|
149
|
+
meaning: "The script has Run command or file-write steps and the pool or grant, or the machine (desk.allow-shell), does not allow them; no step ran"
|
|
145
150
|
}
|
|
146
151
|
};
|
|
147
152
|
var UI_ERROR_CODE_LIST2 = Object.keys(UI_ERROR_CODES2);
|
|
@@ -182,46 +187,4 @@ class UiDriverError2 extends Error {
|
|
|
182
187
|
}
|
|
183
188
|
}
|
|
184
189
|
|
|
185
|
-
|
|
186
|
-
function abortError() {
|
|
187
|
-
const error = new Error("The run was cancelled");
|
|
188
|
-
error.name = "AbortError";
|
|
189
|
-
return error;
|
|
190
|
-
}
|
|
191
|
-
var realClock2 = {
|
|
192
|
-
now: () => Date.now(),
|
|
193
|
-
sleep: (ms, signal) => new Promise((resolve, reject) => {
|
|
194
|
-
if (signal?.aborted) {
|
|
195
|
-
reject(abortError());
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
const timer = setTimeout(() => {
|
|
199
|
-
signal?.removeEventListener("abort", onAbort);
|
|
200
|
-
resolve();
|
|
201
|
-
}, Math.max(0, ms));
|
|
202
|
-
const onAbort = () => {
|
|
203
|
-
clearTimeout(timer);
|
|
204
|
-
reject(abortError());
|
|
205
|
-
};
|
|
206
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
207
|
-
})
|
|
208
|
-
};
|
|
209
|
-
function createVirtualClock2(start = 0) {
|
|
210
|
-
let time = start;
|
|
211
|
-
return {
|
|
212
|
-
now: () => time,
|
|
213
|
-
sleep: async (ms, signal) => {
|
|
214
|
-
if (signal?.aborted)
|
|
215
|
-
throw abortError();
|
|
216
|
-
time += Math.max(0, ms);
|
|
217
|
-
await Promise.resolve();
|
|
218
|
-
if (signal?.aborted)
|
|
219
|
-
throw abortError();
|
|
220
|
-
},
|
|
221
|
-
advance: (ms) => {
|
|
222
|
-
time += Math.max(0, ms);
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export { UI_ERROR_FAMILIES2, UI_ERROR_CODES2, UI_ERROR_CODE_LIST2, isUiErrorCode2, errorFamilyOf2, isRetryableInScript2, UiRunError2, UiDriverError2, realClock2, createVirtualClock2 };
|
|
190
|
+
export { UI_ERROR_FAMILIES2, UI_ERROR_CODES2, UI_ERROR_CODE_LIST2, isUiErrorCode2, errorFamilyOf2, isRetryableInScript2, UiRunError2, UiDriverError2 };
|