@burdenoff/ui-engine 2026.1204.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 +10 -7
- package/dist/heal.js +5 -5
- package/dist/index-0ps53dhe.js +85 -0
- package/dist/{index-ptrmf779.js → index-2q0hh6we.js} +3 -3
- package/dist/index-552x2bnm.js +56 -0
- package/dist/index-6m0chbhq.js +64 -0
- package/dist/{index-dwp10g62.js → index-7gfzv5n8.js} +96 -53
- package/dist/{index-gvavb597.js → index-93hfbk5c.js} +10 -0
- package/dist/index-a8s39bse.js +920 -0
- package/dist/index-b5a306v7.js +43 -0
- package/dist/index-bx4bsvg0.js +458 -0
- package/dist/{index-9xgz8dxt.js → index-cc49ykn5.js} +4 -4
- package/dist/{index-vpm1gnmy.js → index-e557vzdd.js} +219 -34
- 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-wnch00m6.js → index-nmsg2wze.js} +2 -2
- 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-3r2y0mnc.js → index-wdbn4xjc.js} +5 -5
- package/dist/{index-8eb4xd1j.js → index-x8fc4r4h.js} +101 -426
- package/dist/{index-0tfzfxx9.js → index-yhzykhdj.js} +1 -43
- package/dist/{index-t55wvhvh.js → index-z2v8prer.js} +1 -61
- package/dist/{index-5pv673wd.js → index-zj3zhbac.js} +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +79 -31
- package/dist/interpret/driver.d.ts +109 -18
- 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 +7 -2
- package/dist/script/desktop-schema.d.ts +2 -0
- package/dist/script/index.d.ts +3 -1
- package/dist/script.js +35 -19
- package/dist/target/types.d.ts +10 -4
- package/dist/target.js +20 -16
- package/dist/testing.js +5 -3
- package/package.json +7 -3
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
looksLikeSecretField
|
|
3
|
+
} from "./index-552x2bnm.js";
|
|
1
4
|
import {
|
|
2
5
|
describeTarget2
|
|
3
|
-
} from "./index-
|
|
6
|
+
} from "./index-93hfbk5c.js";
|
|
4
7
|
import {
|
|
5
8
|
UI_FLOW_ACTIONS2,
|
|
6
9
|
walkSteps2,
|
|
@@ -204,6 +207,12 @@ function elementInfoFromTarget2(target, elementName) {
|
|
|
204
207
|
}
|
|
205
208
|
|
|
206
209
|
// src/analyze/context.ts
|
|
210
|
+
function webOnlyStep(step) {
|
|
211
|
+
return step;
|
|
212
|
+
}
|
|
213
|
+
function webOnlyTarget(target) {
|
|
214
|
+
return target;
|
|
215
|
+
}
|
|
207
216
|
function stepNumber2(path) {
|
|
208
217
|
return path.split(".").filter((part) => part !== "then" && part !== "steps").map((part) => /^\d+$/.test(part) ? String(Number(part) + 1) : part).join(".");
|
|
209
218
|
}
|
|
@@ -241,6 +250,14 @@ function variablesRead(expression) {
|
|
|
241
250
|
});
|
|
242
251
|
return names;
|
|
243
252
|
}
|
|
253
|
+
function inputsRead(expression) {
|
|
254
|
+
const names = [];
|
|
255
|
+
visitExpression2(expression, (node) => {
|
|
256
|
+
if (node !== null && typeof node === "object" && "input" in node)
|
|
257
|
+
names.push(node.input);
|
|
258
|
+
});
|
|
259
|
+
return names;
|
|
260
|
+
}
|
|
244
261
|
function stepVariablesRead(step) {
|
|
245
262
|
return stepExpressions2(step).flatMap(([, expression]) => variablesRead(expression));
|
|
246
263
|
}
|
|
@@ -289,7 +306,9 @@ var UI_SCRIPT_PROBLEM_MESSAGES2 = {
|
|
|
289
306
|
popupHandlerAction: "Pop-up handler step {{step}} uses {{action}}. A handler may only click, check, press keys, hover, scroll or wait.",
|
|
290
307
|
popupHandlerConsequential: "Pop-up handler step {{step}} acts on {{target}}, which looks like a {{consequence}} control. A handler never acts on such a control.",
|
|
291
308
|
popupHandlerWait: "Pop-up handler step {{step}} waits {{milliseconds}} ms. A handler step waits at most 5,000 ms, so a pop-up never holds up a run.",
|
|
292
|
-
popupHandlerNoAction: "The pop-up handler has no step that clicks, checks or presses a key, so it cannot clear the pop-up."
|
|
309
|
+
popupHandlerNoAction: "The pop-up handler has no step that clicks, checks or presses a key, so it cannot clear the pop-up.",
|
|
310
|
+
runCommandFromVariable: "Step {{step}} runs a command built from {{name}}. A value read from the screen, a file or another node could change what the command does. Use a fixed command, or check the value in an earlier step.",
|
|
311
|
+
singleMethodImageTarget: "Step {{step}} finds {{target}} by an image only. An image match breaks when the theme, the display scale or the resolution changes. Add a selector or a text method."
|
|
293
312
|
};
|
|
294
313
|
function problemMessageKey2(name) {
|
|
295
314
|
return `${UI_SCRIPT_PROBLEM_KEY_PREFIX2}${name}`;
|
|
@@ -411,12 +430,13 @@ var healConsequentialRule = {
|
|
|
411
430
|
const alwaysAsk = new Set(healing.alwaysAskStepIds ?? []);
|
|
412
431
|
const findings = [];
|
|
413
432
|
for (const active of context.steps) {
|
|
414
|
-
const step = active.step;
|
|
433
|
+
const step = webOnlyStep(active.step);
|
|
415
434
|
if (!HEALABLE_ACTIONS2.has(step.action) || alwaysAsk.has(step.id) || !("target" in step) || !step.target)
|
|
416
435
|
continue;
|
|
417
|
-
const
|
|
418
|
-
if (!
|
|
436
|
+
const found = context.targetOf(step.target);
|
|
437
|
+
if (!found)
|
|
419
438
|
continue;
|
|
439
|
+
const target = webOnlyTarget(found);
|
|
420
440
|
const name = "element" in step.target ? context.elements[step.target.element]?.name : undefined;
|
|
421
441
|
const verdict = classifyConsequence2(elementInfoFromTarget2(target, name), { action: step.action, ...step.action === "type" && step.pressEnter === true ? { pressEnter: true } : {} }, healing.keywords);
|
|
422
442
|
const vars = { target: context.describeTarget(step.target) };
|
|
@@ -474,48 +494,6 @@ var noCleanupRule = {
|
|
|
474
494
|
}
|
|
475
495
|
};
|
|
476
496
|
|
|
477
|
-
// src/analyze/sensitive.ts
|
|
478
|
-
var SECRET_FIELD = /password|passcode|passwd|\bpin\b|\botp\b|one[\s-]?time|\bverification\b|security code|auth(?:entication)? code|\bcvv\b|\bcvc\b|card number|\bsecrets?\b|\btokens?\b|\brecovery\b/i;
|
|
479
|
-
var PASSWORD_TYPE = /type\s*=\s*["']?password/i;
|
|
480
|
-
function words(text) {
|
|
481
|
-
return text.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[^\p{L}\p{N}]+/gu, " ").trim();
|
|
482
|
-
}
|
|
483
|
-
function readsLikeSecret(text) {
|
|
484
|
-
return PASSWORD_TYPE.test(text) || SECRET_FIELD.test(words(text));
|
|
485
|
-
}
|
|
486
|
-
function targetWords(target) {
|
|
487
|
-
const texts = [];
|
|
488
|
-
for (const method of target.methods) {
|
|
489
|
-
switch (method.kind) {
|
|
490
|
-
case "role":
|
|
491
|
-
case "fuzzy":
|
|
492
|
-
texts.push(method.name);
|
|
493
|
-
break;
|
|
494
|
-
case "css":
|
|
495
|
-
texts.push(method.selector);
|
|
496
|
-
break;
|
|
497
|
-
case "testId":
|
|
498
|
-
texts.push(method.value);
|
|
499
|
-
break;
|
|
500
|
-
case "xpath":
|
|
501
|
-
texts.push(method.xpath);
|
|
502
|
-
break;
|
|
503
|
-
case "anchor":
|
|
504
|
-
texts.push(method.anchor.kind === "text" ? method.anchor.text : method.anchor.name);
|
|
505
|
-
break;
|
|
506
|
-
default:
|
|
507
|
-
texts.push(method.text);
|
|
508
|
-
break;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
return texts;
|
|
512
|
-
}
|
|
513
|
-
function looksLikeSecretField(target, elementName) {
|
|
514
|
-
if (elementName !== undefined && readsLikeSecret(elementName))
|
|
515
|
-
return true;
|
|
516
|
-
return target !== undefined && targetWords(target).some(readsLikeSecret);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
497
|
// src/analyze/rules/plain-text-secret.ts
|
|
520
498
|
var plainTextSecretRule = {
|
|
521
499
|
id: "plainTextSecret",
|
|
@@ -533,6 +511,28 @@ var plainTextSecretRule = {
|
|
|
533
511
|
})
|
|
534
512
|
};
|
|
535
513
|
|
|
514
|
+
// src/analyze/rules/run-command-from-variable.ts
|
|
515
|
+
var runCommandFromVariableRule = {
|
|
516
|
+
id: "runCommandFromVariable",
|
|
517
|
+
group: "security",
|
|
518
|
+
severity: "warning",
|
|
519
|
+
description: "A Run command step whose command is built from a variable or an input.",
|
|
520
|
+
check: (context) => {
|
|
521
|
+
const findings = [];
|
|
522
|
+
for (const active of context.steps) {
|
|
523
|
+
const step = active.step;
|
|
524
|
+
if (step.action !== "runCommand")
|
|
525
|
+
continue;
|
|
526
|
+
const names = [...variablesRead(step.command), ...inputsRead(step.command)];
|
|
527
|
+
const [first] = names;
|
|
528
|
+
if (first === undefined)
|
|
529
|
+
continue;
|
|
530
|
+
findings.push(stepFinding(active, "runCommandFromVariable", { name: `[${first}]` }, "command"));
|
|
531
|
+
}
|
|
532
|
+
return findings;
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
|
|
536
536
|
// src/heal/popup-limits.ts
|
|
537
537
|
var MAX_POPUP_HANDLERS_PER_STEP2 = 2;
|
|
538
538
|
var MAX_POPUP_HANDLERS_PER_APPLICATION2 = 50;
|
|
@@ -561,7 +561,7 @@ var popupHandlerLoopRule = {
|
|
|
561
561
|
const findings = [];
|
|
562
562
|
let clears = false;
|
|
563
563
|
for (const active of context.steps) {
|
|
564
|
-
const step = active.step;
|
|
564
|
+
const step = webOnlyStep(active.step);
|
|
565
565
|
if (FLOW.has(step.action)) {
|
|
566
566
|
findings.push(stepFinding(active, "popupHandlerFlow", { action: step.action }, "action"));
|
|
567
567
|
continue;
|
|
@@ -581,7 +581,7 @@ var popupHandlerLoopRule = {
|
|
|
581
581
|
const target = context.targetOf(step.target);
|
|
582
582
|
if (!target)
|
|
583
583
|
continue;
|
|
584
|
-
const verdict = classifyConsequence2(elementInfoFromTarget2(target), { action: step.action });
|
|
584
|
+
const verdict = classifyConsequence2(elementInfoFromTarget2(webOnlyTarget(target)), { action: step.action });
|
|
585
585
|
if (verdict.consequence) {
|
|
586
586
|
findings.push(stepFinding(active, "popupHandlerConsequential", { target: context.describeTarget(step.target), consequence: CONSEQUENCE_WORDS2[verdict.consequence] }, "target"));
|
|
587
587
|
}
|
|
@@ -625,6 +625,36 @@ var sensitiveScreenshotRule = {
|
|
|
625
625
|
}
|
|
626
626
|
};
|
|
627
627
|
|
|
628
|
+
// src/analyze/rules/single-method-image-target.ts
|
|
629
|
+
var singleMethodImageTargetRule = {
|
|
630
|
+
id: "singleMethodImageTarget",
|
|
631
|
+
group: "reliability",
|
|
632
|
+
severity: "warning",
|
|
633
|
+
description: "A target found by an image only.",
|
|
634
|
+
check: (context) => {
|
|
635
|
+
const findings = [];
|
|
636
|
+
const seenElements = new Set;
|
|
637
|
+
for (const active of context.steps) {
|
|
638
|
+
for (const [field, ref] of stepTargets2(active.step)) {
|
|
639
|
+
if ("element" in ref) {
|
|
640
|
+
if (seenElements.has(ref.element))
|
|
641
|
+
continue;
|
|
642
|
+
seenElements.add(ref.element);
|
|
643
|
+
}
|
|
644
|
+
const target = context.targetOf(ref);
|
|
645
|
+
if (!target || !isImageOnly(target.methods))
|
|
646
|
+
continue;
|
|
647
|
+
findings.push(stepFinding(active, "singleMethodImageTarget", { target: context.describeTarget(ref) }, field));
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
return findings;
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
function isImageOnly(methods) {
|
|
654
|
+
const enabled = methods.filter((method) => method.enabled !== false);
|
|
655
|
+
return enabled.length === 1 && enabled[0]?.kind === "image";
|
|
656
|
+
}
|
|
657
|
+
|
|
628
658
|
// src/analyze/rules/single-method-target.ts
|
|
629
659
|
var singleMethodTargetRule = {
|
|
630
660
|
id: "singleMethodTarget",
|
|
@@ -645,7 +675,7 @@ var singleMethodTargetRule = {
|
|
|
645
675
|
if (!target)
|
|
646
676
|
continue;
|
|
647
677
|
const enabled = target.methods.filter((method) => method.enabled !== false).length;
|
|
648
|
-
if (enabled > 1)
|
|
678
|
+
if (enabled > 1 || isImageOnly(target.methods))
|
|
649
679
|
continue;
|
|
650
680
|
findings.push(stepFinding(active, enabled === 0 ? "noEnabledMethod" : "singleMethodTarget", { target: context.describeTarget(ref) }, field));
|
|
651
681
|
}
|
|
@@ -782,7 +812,9 @@ var UI_ANALYZER_RULES2 = [
|
|
|
782
812
|
inlineTargetRule,
|
|
783
813
|
unusedValueRule,
|
|
784
814
|
healConsequentialRule,
|
|
785
|
-
popupHandlerLoopRule
|
|
815
|
+
popupHandlerLoopRule,
|
|
816
|
+
runCommandFromVariableRule,
|
|
817
|
+
singleMethodImageTargetRule
|
|
786
818
|
];
|
|
787
819
|
|
|
788
820
|
// src/analyze/types.ts
|
|
@@ -801,7 +833,9 @@ var UI_ANALYZER_RULE_IDS2 = [
|
|
|
801
833
|
"inlineTarget",
|
|
802
834
|
"unusedValue",
|
|
803
835
|
"healConsequential",
|
|
804
|
-
"popupHandlerLoop"
|
|
836
|
+
"popupHandlerLoop",
|
|
837
|
+
"runCommandFromVariable",
|
|
838
|
+
"singleMethodImageTarget"
|
|
805
839
|
];
|
|
806
840
|
|
|
807
841
|
// src/analyze/analyze.ts
|
|
@@ -812,6 +846,15 @@ function severitySetting(setting, fallback) {
|
|
|
812
846
|
return UI_PROBLEM_SEVERITIES2.find((severity) => severity === setting) ?? fallback;
|
|
813
847
|
}
|
|
814
848
|
function analyzeUiScript2(script, options = {}) {
|
|
849
|
+
return analyze(script, options);
|
|
850
|
+
}
|
|
851
|
+
function analyzeDesktopUiScript2(script, options = {}) {
|
|
852
|
+
return analyze(script, {
|
|
853
|
+
...options.severity === undefined ? {} : { severity: options.severity },
|
|
854
|
+
...options.externalReads === undefined ? {} : { externalReads: options.externalReads }
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
function analyze(script, options) {
|
|
815
858
|
const context = createContext(script, options);
|
|
816
859
|
const found = [];
|
|
817
860
|
UI_ANALYZER_RULES2.forEach((rule, rank) => {
|
|
@@ -840,4 +883,4 @@ function analyzeUiScript2(script, options = {}) {
|
|
|
840
883
|
return found.sort((a, b) => a.order - b.order || a.rank - b.rank || a.seq - b.seq).map(({ problem }) => problem);
|
|
841
884
|
}
|
|
842
885
|
|
|
843
|
-
export { MAX_HEAL_KEYWORDS2, MAX_HEAL_KEYWORD_LENGTH2, CONSEQUENCE_KEYWORDS2, keywordWords2, usableKeywords2, isActingStep, classifyConsequence2, elementInfoFromTarget2, stepNumber2, UI_SCRIPT_PROBLEM_KEY_PREFIX2, UI_SCRIPT_PROBLEM_MESSAGES2, problemMessageKey2, problemMessage2, HEALABLE_ACTIONS2, compatibleRoles2, VALUE_ACTIONS2, ACTIONABLE_ROLES, MAX_POPUP_HANDLERS_PER_STEP2, MAX_POPUP_HANDLERS_PER_APPLICATION2, MAX_POPUP_HANDLER_STEPS2, MAX_POPUP_URL_PATTERN2, POPUP_HANDLER_STEP_WAIT_MS2, UI_ANALYZER_RULES2, UI_PROBLEM_SEVERITIES2, UI_ANALYZER_RULE_GROUPS2, UI_ANALYZER_RULE_IDS2, UI_ANALYZER_DEFAULT_SEVERITY2, analyzeUiScript2 };
|
|
886
|
+
export { MAX_HEAL_KEYWORDS2, MAX_HEAL_KEYWORD_LENGTH2, CONSEQUENCE_KEYWORDS2, keywordWords2, usableKeywords2, isActingStep, classifyConsequence2, elementInfoFromTarget2, stepNumber2, UI_SCRIPT_PROBLEM_KEY_PREFIX2, UI_SCRIPT_PROBLEM_MESSAGES2, problemMessageKey2, problemMessage2, HEALABLE_ACTIONS2, compatibleRoles2, VALUE_ACTIONS2, ACTIONABLE_ROLES, MAX_POPUP_HANDLERS_PER_STEP2, MAX_POPUP_HANDLERS_PER_APPLICATION2, MAX_POPUP_HANDLER_STEPS2, MAX_POPUP_URL_PATTERN2, POPUP_HANDLER_STEP_WAIT_MS2, UI_ANALYZER_RULES2, UI_PROBLEM_SEVERITIES2, UI_ANALYZER_RULE_GROUPS2, UI_ANALYZER_RULE_IDS2, UI_ANALYZER_DEFAULT_SEVERITY2, analyzeUiScript2, analyzeDesktopUiScript2 };
|
|
@@ -90,6 +90,16 @@ function describeTarget2(ref, elements = {}) {
|
|
|
90
90
|
return quoted(method.selector);
|
|
91
91
|
case "xpath":
|
|
92
92
|
return quoted(method.xpath);
|
|
93
|
+
case "uia":
|
|
94
|
+
case "ax":
|
|
95
|
+
case "atspi": {
|
|
96
|
+
const node = method.path[method.path.length - 1];
|
|
97
|
+
return quoted(node?.name ?? node?.automationId ?? node?.role ?? "?");
|
|
98
|
+
}
|
|
99
|
+
case "ocr":
|
|
100
|
+
return quoted(method.text);
|
|
101
|
+
case "image":
|
|
102
|
+
return quoted("image");
|
|
93
103
|
default:
|
|
94
104
|
return quoted("?");
|
|
95
105
|
}
|