@burdenoff/ui-engine 2026.1127.4 → 2026.1129.1
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 +68 -4
- package/dist/analyze/analyze.d.ts +19 -0
- package/dist/analyze/context.d.ts +40 -0
- package/dist/analyze/index.d.ts +10 -0
- package/dist/analyze/messages.d.ts +46 -0
- package/dist/analyze/rules/fixed-wait.d.ts +6 -0
- package/dist/analyze/rules/hardware-input.d.ts +2 -0
- package/dist/analyze/rules/heal-consequential.d.ts +2 -0
- package/dist/analyze/rules/index.d.ts +3 -0
- package/dist/analyze/rules/inline-target.d.ts +2 -0
- package/dist/analyze/rules/masked-value.d.ts +8 -0
- package/dist/analyze/rules/no-cleanup.d.ts +2 -0
- package/dist/analyze/rules/plain-text-secret.d.ts +2 -0
- package/dist/analyze/rules/popup-handler-loop.d.ts +2 -0
- package/dist/analyze/rules/rule.d.ts +15 -0
- package/dist/analyze/rules/secret-origin.d.ts +7 -0
- package/dist/analyze/rules/sensitive-screenshot.d.ts +2 -0
- package/dist/analyze/rules/single-method-target.d.ts +2 -0
- package/dist/analyze/rules/unknown-variable.d.ts +2 -0
- package/dist/analyze/rules/unused-value.d.ts +2 -0
- package/dist/analyze/sensitive.d.ts +14 -0
- package/dist/analyze/types.d.ts +89 -0
- package/dist/analyze.d.ts +2 -0
- package/dist/analyze.js +26 -0
- package/dist/dom-runtime.iife.js +1 -1
- package/dist/dom-runtime.js +2 -2
- package/dist/drivers.js +13 -9
- package/dist/heal/answer.d.ts +26 -0
- package/dist/heal/consequence.d.ts +74 -0
- package/dist/heal/index.d.ts +19 -0
- package/dist/heal/modes.d.ts +25 -0
- package/dist/heal/popup-limits.d.ts +11 -0
- package/dist/heal/popup.d.ts +48 -0
- package/dist/heal/question.d.ts +41 -0
- package/dist/heal/target-from-node.d.ts +9 -0
- package/dist/heal/types.d.ts +134 -0
- package/dist/heal/verify-rules.d.ts +19 -0
- package/dist/heal/verify.d.ts +52 -0
- package/dist/heal.d.ts +2 -0
- package/dist/heal.js +106 -0
- package/dist/index-20bbwwc9.js +37 -0
- package/dist/{index-pm13mvvc.js → index-2g060ryg.js} +3 -196
- package/dist/index-6h7ah1dw.js +328 -0
- package/dist/{index-h88y5qgv.js → index-6kva2gvd.js} +6 -4
- package/dist/{index-ct2xctrq.js → index-70vm0qz8.js} +2 -2
- package/dist/{index-3f1j8386.js → index-8w31tpfq.js} +38 -19
- package/dist/{index-zzhysbkj.js → index-eff47v1g.js} +436 -20
- package/dist/{index-3jymbm5t.js → index-g7724awk.js} +1 -92
- package/dist/index-gvavb597.js +195 -0
- package/dist/index-hw5npwsv.js +63 -0
- package/dist/{index-ycs2bz1a.js → index-mhv6a02p.js} +11 -166
- package/dist/index-p5823rpv.js +0 -0
- package/dist/{index-5k26keah.js → index-qg9yfr7r.js} +16 -67
- package/dist/{index-895kscx3.js → index-qmv3ar39.js} +7 -5
- package/dist/index-t55wvhvh.js +229 -0
- package/dist/{index-77pcz6n3.js → index-vnv9tp11.js} +4 -2
- package/dist/index-w9jc25y9.js +306 -0
- package/dist/index-xdtanv9b.js +843 -0
- package/dist/{index-vg8r40y7.js → index-yc0jgph6.js} +7 -0
- package/dist/index-zhbwhdya.js +407 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +156 -26
- package/dist/interpret/driver.d.ts +14 -0
- package/dist/interpret/errors.d.ts +11 -2
- package/dist/interpret/events.d.ts +4 -0
- package/dist/interpret/run.d.ts +33 -0
- package/dist/interpret.js +5 -4
- package/dist/script.js +29 -23
- package/dist/target/index.d.ts +2 -0
- package/dist/target/roles.d.ts +11 -0
- package/dist/target/snapshot-mask.d.ts +49 -0
- package/dist/target/snapshot-tree.d.ts +65 -0
- package/dist/target/snapshot-url.d.ts +6 -0
- package/dist/target/snapshot.d.ts +1 -6
- package/dist/target.js +55 -13
- package/dist/testing.js +2 -2
- package/package.json +11 -3
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of UI step healing (spec 10 section 3, plan P4-06a, contract README
|
|
3
|
+
* sections 22.2, 24 and 26.2).
|
|
4
|
+
*
|
|
5
|
+
* When a step's target is no longer found, the interpreter can ask its host
|
|
6
|
+
* for a repaired target (`RunUiScriptOptions.onTargetNotFound`). The host sends
|
|
7
|
+
* the masked request to the workflow service (P4-13), which asks a model one
|
|
8
|
+
* narrow question (`buildHealQuestion`) and reads the answer strictly
|
|
9
|
+
* (`parseHealAnswer`). The engine then checks the candidate on the live page
|
|
10
|
+
* (`verifyHealCandidate`), classifies what acting on it could cause
|
|
11
|
+
* (`classifyConsequence`) and decides, from the effective mode, whether to
|
|
12
|
+
* continue, stop with a suggestion, or stop and ask a person
|
|
13
|
+
* (`HEAL_APPROVAL_REQUIRED`). Nothing here changes a stored target: a
|
|
14
|
+
* proposal changes an element only when a person accepts it (threat P2).
|
|
15
|
+
*/
|
|
16
|
+
import type { UiStepAction, UiTarget } from '../script/types.js';
|
|
17
|
+
import type { UiTreeSnapshot } from '../target/snapshot.js';
|
|
18
|
+
import type { WebRect } from '../target/types.js';
|
|
19
|
+
/**
|
|
20
|
+
* Healing modes of a Use Browser node (`args.state.healing.mode`), lowest first.
|
|
21
|
+
* The GraphQL enum `UiHealingMode` uses the same names in capitals.
|
|
22
|
+
*/
|
|
23
|
+
export declare const UI_HEAL_MODES: readonly ["off", "suggest", "heal_with_approval", "heal_and_continue"];
|
|
24
|
+
export type UiHealMode = (typeof UI_HEAL_MODES)[number];
|
|
25
|
+
/**
|
|
26
|
+
* The rank of each mode, for the production cap (`healingMaxModeProd`). The
|
|
27
|
+
* cap compares ranks from this table, never positions in an enum list.
|
|
28
|
+
*/
|
|
29
|
+
export declare const UI_HEAL_MODE_RANK: Readonly<Record<UiHealMode, number>>;
|
|
30
|
+
/** What the interpreter does with a verified candidate. */
|
|
31
|
+
export type UiHealDecision = 'continue' | 'stop_suggest' | 'ask';
|
|
32
|
+
/** What acting on an element could cause, from the classifier's keyword lists. */
|
|
33
|
+
export declare const UI_CONSEQUENCES: readonly ["payment", "delete", "send_external", "security"];
|
|
34
|
+
export type UiConsequence = (typeof UI_CONSEQUENCES)[number];
|
|
35
|
+
/** A proposed replacement for a step's target. */
|
|
36
|
+
export interface UiHealCandidate {
|
|
37
|
+
/** The snapshot node the answer named (see `snapshot-tree.ts` for the path grammar). */
|
|
38
|
+
nodePath: string;
|
|
39
|
+
/** A multi-method target built from that node (`targetFromSnapshotNode`). */
|
|
40
|
+
proposedTarget: UiTarget;
|
|
41
|
+
/** The model's confidence, 0 to 1, when it gave one. */
|
|
42
|
+
confidence?: number;
|
|
43
|
+
}
|
|
44
|
+
/** The answer to a heal request. */
|
|
45
|
+
export type UiHealAnswer = {
|
|
46
|
+
kind: 'candidate';
|
|
47
|
+
candidate: UiHealCandidate;
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'not_present';
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'unavailable';
|
|
52
|
+
reason: string;
|
|
53
|
+
};
|
|
54
|
+
/** The library element a failed step pinned. */
|
|
55
|
+
export interface UiHealElementRef {
|
|
56
|
+
/** The key in the script's `elements`. */
|
|
57
|
+
element: string;
|
|
58
|
+
elementId?: string;
|
|
59
|
+
version?: number;
|
|
60
|
+
}
|
|
61
|
+
/** The target failure codes healing repairs. */
|
|
62
|
+
export declare const UI_HEAL_FAILURE_CODES: readonly ["ELEMENT_NOT_FOUND", "ELEMENT_AMBIGUOUS"];
|
|
63
|
+
export type UiHealFailureCode = (typeof UI_HEAL_FAILURE_CODES)[number];
|
|
64
|
+
/**
|
|
65
|
+
* What the interpreter hands the host when a step's target fails. The
|
|
66
|
+
* snapshot is already masked (`maskSnapshot`); `screenshotMask` holds the
|
|
67
|
+
* rectangles a desk paints over its screenshot before upload (threat R1).
|
|
68
|
+
*/
|
|
69
|
+
export interface UiHealRequest {
|
|
70
|
+
stepPath: string;
|
|
71
|
+
stepId: string;
|
|
72
|
+
/** The step in words (`describeStep`), English. */
|
|
73
|
+
stepSentence: string;
|
|
74
|
+
action: UiStepAction;
|
|
75
|
+
elementRef?: UiHealElementRef;
|
|
76
|
+
/** The target that failed. */
|
|
77
|
+
target: UiTarget;
|
|
78
|
+
/** How the target reads in a sentence (`describeTarget`). */
|
|
79
|
+
description: string;
|
|
80
|
+
failureCode: UiHealFailureCode;
|
|
81
|
+
/** The page address, as the desk reports it. */
|
|
82
|
+
url: string;
|
|
83
|
+
snapshot: UiTreeSnapshot;
|
|
84
|
+
/** The outermost masked elements of the snapshot. */
|
|
85
|
+
maskedPaths: string[];
|
|
86
|
+
screenshotMask: WebRect[];
|
|
87
|
+
}
|
|
88
|
+
/** What the host's `onTargetNotFound` returns. */
|
|
89
|
+
export interface UiHealHookResult {
|
|
90
|
+
answer: UiHealAnswer;
|
|
91
|
+
/** The effective mode after the node setting, the workspace default, the production cap and the flags. */
|
|
92
|
+
mode: UiHealMode;
|
|
93
|
+
/** True when the service says a person must always approve (an always-ask step or keyword). */
|
|
94
|
+
alwaysAsk?: boolean;
|
|
95
|
+
/** The service's own classification of the candidate, when it made one. */
|
|
96
|
+
consequence?: UiConsequence | null;
|
|
97
|
+
/** The fix proposal the service stored, carried into events and the run result. */
|
|
98
|
+
proposalId?: string;
|
|
99
|
+
}
|
|
100
|
+
/** The host's heal hook. It receives the run's abort signal; when the run is cancelled the hook's answer is ignored. */
|
|
101
|
+
export type UiHealHook = (request: UiHealRequest, context: {
|
|
102
|
+
signal?: AbortSignal;
|
|
103
|
+
}) => Promise<UiHealHookResult>;
|
|
104
|
+
/** Why a candidate failed the deterministic check. */
|
|
105
|
+
export declare const UI_HEAL_CHECK_REASONS: readonly ["UNKNOWN_NODE", "HIDDEN_NODE", "ACTION_NOT_HEALABLE", "NOT_FOUND", "NOT_UNIQUE", "NOT_INTERACTABLE", "OTHER_ELEMENT", "WRONG_CONTROL", "OTHER_FRAME", "SENSITIVE_FIELD", "DRIVER_ERROR", "STEP_FAILED"];
|
|
106
|
+
export type UiHealCheckReason = (typeof UI_HEAL_CHECK_REASONS)[number];
|
|
107
|
+
/** How a heal ended, as events and the run result report it. */
|
|
108
|
+
export type UiHealOutcome = 'healed' | 'suggested' | 'approval_required' | 'not_present' | 'unavailable' | 'check_failed';
|
|
109
|
+
/** A heal's report on a step: in `STEP_FAILED.detail.heal` and `UiRunFailure.heal`. */
|
|
110
|
+
export interface UiHealReport {
|
|
111
|
+
outcome: UiHealOutcome;
|
|
112
|
+
/** The effective mode, once the host answered. */
|
|
113
|
+
mode?: UiHealMode;
|
|
114
|
+
decision?: UiHealDecision;
|
|
115
|
+
candidate?: UiHealCandidate;
|
|
116
|
+
proposalId?: string;
|
|
117
|
+
consequence?: UiConsequence;
|
|
118
|
+
alwaysAsk?: boolean;
|
|
119
|
+
/** A short code: the check reason, or why no answer came. */
|
|
120
|
+
reason?: string;
|
|
121
|
+
/** The step ran on the healed target and failed with this code (its action may have taken effect). */
|
|
122
|
+
stepFailureCode?: string;
|
|
123
|
+
/** True when the step was tried on the healed target. */
|
|
124
|
+
attempted?: boolean;
|
|
125
|
+
}
|
|
126
|
+
/** Healing settings a host passes with the run (from the node data and the workspace's RPA settings). */
|
|
127
|
+
export interface UiHealSettings {
|
|
128
|
+
/** Step ids that always ask a person when healed (`args.state.healing.alwaysAskStepIds`). */
|
|
129
|
+
alwaysAskStepIds?: readonly string[];
|
|
130
|
+
/** The workspace's always-ask keyword phrases (D-P4-12): case-folded phrases, never regular expressions. */
|
|
131
|
+
keywords?: readonly string[];
|
|
132
|
+
/** Extra snapshot paths to mask before the request leaves the desk. */
|
|
133
|
+
maskedPaths?: readonly string[];
|
|
134
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which steps healing may repair, and which control types fit each action
|
|
3
|
+
* (plan P4-06a, threat R2 of document 24). Pure tables shared by the question
|
|
4
|
+
* builder (to rank elements), the verifier (to refuse a candidate whose
|
|
5
|
+
* control does not fit) and the interpreter (to decide whether to ask).
|
|
6
|
+
*/
|
|
7
|
+
import type { UiStepAction } from '../script/types.js';
|
|
8
|
+
/**
|
|
9
|
+
* The actions a heal may repair. `typeSecret` and `login` are never healed:
|
|
10
|
+
* a secret is never typed into an element a model chose. Navigation, flow,
|
|
11
|
+
* page reads and screenshots have no target to repair.
|
|
12
|
+
*/
|
|
13
|
+
export declare const HEALABLE_ACTIONS: ReadonlySet<UiStepAction>;
|
|
14
|
+
/** Roles an element of the snapshot or the page may have for the action, or undefined when any role fits (reads, waits). */
|
|
15
|
+
export declare function compatibleRoles(action: UiStepAction): ReadonlySet<string> | undefined;
|
|
16
|
+
/** The actions that type or change a field's value: they never act on a password or masked field. */
|
|
17
|
+
export declare const VALUE_ACTIONS: ReadonlySet<UiStepAction>;
|
|
18
|
+
/** Roles worth listing in a heal question even without a name: the controls steps act on. */
|
|
19
|
+
export declare const ACTIONABLE_ROLES: ReadonlySet<string>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `verifyHealCandidate` (plan P4-06a, threat R2 of document 24): the
|
|
3
|
+
* deterministic check every heal candidate passes before it is used or
|
|
4
|
+
* suggested. A model's answer is a hint; this check decides.
|
|
5
|
+
*
|
|
6
|
+
* A candidate passes only when:
|
|
7
|
+
* 1. the step's action is one healing repairs (never `typeSecret` or `login`);
|
|
8
|
+
* 2. its node is a visible element of the (masked) snapshot;
|
|
9
|
+
* 3. its proposed target resolves on the live page, in one attempt, to
|
|
10
|
+
* exactly one element that is visible, and enabled for a step that acts;
|
|
11
|
+
* 4. that element's control type fits the action (a click needs a button,
|
|
12
|
+
* link, checkbox, menu item, tab or option; a type step a text box), on
|
|
13
|
+
* the page and in the snapshot alike;
|
|
14
|
+
* 5. it is in the same frame as the failed step: the desk compares the two
|
|
15
|
+
* frames' origins when it can (`UiDriver.frameOrigin`), otherwise the two
|
|
16
|
+
* frame chains must be the same;
|
|
17
|
+
* 6. for a step that types or changes a value, it is not a password, secret
|
|
18
|
+
* or masked field;
|
|
19
|
+
* 7. in the top document, its position on the page matches the snapshot node
|
|
20
|
+
* (so a target that happens to resolve elsewhere is refused).
|
|
21
|
+
*/
|
|
22
|
+
import type { UiDriver, UiStepContext } from '../interpret/driver.js';
|
|
23
|
+
import type { UiStep, UiTarget } from '../script/types.js';
|
|
24
|
+
import type { UiTreeSnapshot } from '../target/snapshot.js';
|
|
25
|
+
import { type SnapshotIndex } from '../target/snapshot-tree.js';
|
|
26
|
+
import type { UiHealElementInfo } from './consequence.js';
|
|
27
|
+
import type { UiHealCandidate, UiHealCheckReason } from './types.js';
|
|
28
|
+
/** How far, in CSS pixels, the element's centre may be from the snapshot node's centre. */
|
|
29
|
+
export declare const HEAL_POSITION_TOLERANCE_PX = 24;
|
|
30
|
+
export interface VerifyHealContext {
|
|
31
|
+
/** The snapshot the candidate's node path belongs to (the masked copy the question was built from). */
|
|
32
|
+
snapshot: Pick<UiTreeSnapshot, 'root'>;
|
|
33
|
+
/** The target that failed. */
|
|
34
|
+
failedTarget: UiTarget;
|
|
35
|
+
/** The step's driver context. */
|
|
36
|
+
stepContext: UiStepContext;
|
|
37
|
+
/** A prepared index of the snapshot. */
|
|
38
|
+
index?: SnapshotIndex;
|
|
39
|
+
}
|
|
40
|
+
export type UiHealCheck = {
|
|
41
|
+
ok: true;
|
|
42
|
+
role: string;
|
|
43
|
+
name: string;
|
|
44
|
+
element: UiHealElementInfo;
|
|
45
|
+
/** The element is sensitive or masked, so its words could not be read. */
|
|
46
|
+
sensitive: boolean;
|
|
47
|
+
} | {
|
|
48
|
+
ok: false;
|
|
49
|
+
reason: UiHealCheckReason;
|
|
50
|
+
};
|
|
51
|
+
/** Check a heal candidate on the live page. Never throws: a desk failure is `DRIVER_ERROR`. */
|
|
52
|
+
export declare function verifyHealCandidate(driver: UiDriver, candidate: UiHealCandidate, step: Pick<UiStep, 'action' | 'id'>, context: VerifyHealContext): Promise<UiHealCheck>;
|
package/dist/heal.d.ts
ADDED
package/dist/heal.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import"./index-cs6acyjn.js";
|
|
2
|
+
import"./index-qmv3ar39.js";
|
|
3
|
+
import {
|
|
4
|
+
UI_HEAL_MODES2,
|
|
5
|
+
UI_HEAL_MODE_RANK2,
|
|
6
|
+
UI_CONSEQUENCES2,
|
|
7
|
+
UI_HEAL_FAILURE_CODES2,
|
|
8
|
+
UI_HEAL_CHECK_REASONS2,
|
|
9
|
+
parseHealMode2,
|
|
10
|
+
capHealMode2,
|
|
11
|
+
decideHeal2,
|
|
12
|
+
POPUP_HANDLER_ACTIONS2,
|
|
13
|
+
popupHandlerScript2,
|
|
14
|
+
parseUiPopupHandler2,
|
|
15
|
+
analyzeUiPopupHandler2,
|
|
16
|
+
usablePopupHandlers2,
|
|
17
|
+
matchesUrlPattern2,
|
|
18
|
+
HEAL_POSITION_TOLERANCE_PX2,
|
|
19
|
+
verifyHealCandidate2
|
|
20
|
+
} from "./index-w9jc25y9.js";
|
|
21
|
+
import {
|
|
22
|
+
MAX_HEAL_QUESTION_NODES2,
|
|
23
|
+
MAX_HEAL_NODE_NAME2,
|
|
24
|
+
HEAL_SYSTEM_PROMPT2,
|
|
25
|
+
buildHealQuestion2,
|
|
26
|
+
targetFromSnapshotNode2,
|
|
27
|
+
MAX_HEAL_ANSWER_LENGTH2,
|
|
28
|
+
parseHealAnswer2
|
|
29
|
+
} from "./index-6h7ah1dw.js";
|
|
30
|
+
import {
|
|
31
|
+
MAX_HEAL_KEYWORDS2,
|
|
32
|
+
MAX_HEAL_KEYWORD_LENGTH2,
|
|
33
|
+
CONSEQUENCE_KEYWORDS2,
|
|
34
|
+
keywordWords2,
|
|
35
|
+
usableKeywords2,
|
|
36
|
+
classifyConsequence2,
|
|
37
|
+
elementInfoFromTarget2,
|
|
38
|
+
HEALABLE_ACTIONS2,
|
|
39
|
+
compatibleRoles2,
|
|
40
|
+
VALUE_ACTIONS2,
|
|
41
|
+
MAX_POPUP_HANDLERS_PER_STEP2,
|
|
42
|
+
MAX_POPUP_HANDLERS_PER_APPLICATION2,
|
|
43
|
+
MAX_POPUP_HANDLER_STEPS2,
|
|
44
|
+
MAX_POPUP_URL_PATTERN2,
|
|
45
|
+
POPUP_HANDLER_STEP_WAIT_MS2
|
|
46
|
+
} from "./index-xdtanv9b.js";
|
|
47
|
+
import {
|
|
48
|
+
SNAPSHOT_ROOT_PATH2,
|
|
49
|
+
MAX_SNAPSHOT_PATH_LENGTH2,
|
|
50
|
+
isSnapshotPath2,
|
|
51
|
+
walkSnapshot2,
|
|
52
|
+
snapshotNodeAt2,
|
|
53
|
+
indexSnapshot2,
|
|
54
|
+
MASKED_MARKER2,
|
|
55
|
+
MAX_MASKED_PATHS2,
|
|
56
|
+
maskSnapshot2
|
|
57
|
+
} from "./index-zhbwhdya.js";
|
|
58
|
+
export {
|
|
59
|
+
CONSEQUENCE_KEYWORDS2 as CONSEQUENCE_KEYWORDS,
|
|
60
|
+
HEALABLE_ACTIONS2 as HEALABLE_ACTIONS,
|
|
61
|
+
HEAL_POSITION_TOLERANCE_PX2 as HEAL_POSITION_TOLERANCE_PX,
|
|
62
|
+
HEAL_SYSTEM_PROMPT2 as HEAL_SYSTEM_PROMPT,
|
|
63
|
+
MASKED_MARKER2 as MASKED_MARKER,
|
|
64
|
+
MAX_HEAL_ANSWER_LENGTH2 as MAX_HEAL_ANSWER_LENGTH,
|
|
65
|
+
MAX_HEAL_KEYWORDS2 as MAX_HEAL_KEYWORDS,
|
|
66
|
+
MAX_HEAL_KEYWORD_LENGTH2 as MAX_HEAL_KEYWORD_LENGTH,
|
|
67
|
+
MAX_HEAL_NODE_NAME2 as MAX_HEAL_NODE_NAME,
|
|
68
|
+
MAX_HEAL_QUESTION_NODES2 as MAX_HEAL_QUESTION_NODES,
|
|
69
|
+
MAX_MASKED_PATHS2 as MAX_MASKED_PATHS,
|
|
70
|
+
MAX_POPUP_HANDLERS_PER_APPLICATION2 as MAX_POPUP_HANDLERS_PER_APPLICATION,
|
|
71
|
+
MAX_POPUP_HANDLERS_PER_STEP2 as MAX_POPUP_HANDLERS_PER_STEP,
|
|
72
|
+
MAX_POPUP_HANDLER_STEPS2 as MAX_POPUP_HANDLER_STEPS,
|
|
73
|
+
MAX_POPUP_URL_PATTERN2 as MAX_POPUP_URL_PATTERN,
|
|
74
|
+
MAX_SNAPSHOT_PATH_LENGTH2 as MAX_SNAPSHOT_PATH_LENGTH,
|
|
75
|
+
POPUP_HANDLER_ACTIONS2 as POPUP_HANDLER_ACTIONS,
|
|
76
|
+
POPUP_HANDLER_STEP_WAIT_MS2 as POPUP_HANDLER_STEP_WAIT_MS,
|
|
77
|
+
SNAPSHOT_ROOT_PATH2 as SNAPSHOT_ROOT_PATH,
|
|
78
|
+
UI_CONSEQUENCES2 as UI_CONSEQUENCES,
|
|
79
|
+
UI_HEAL_CHECK_REASONS2 as UI_HEAL_CHECK_REASONS,
|
|
80
|
+
UI_HEAL_FAILURE_CODES2 as UI_HEAL_FAILURE_CODES,
|
|
81
|
+
UI_HEAL_MODES2 as UI_HEAL_MODES,
|
|
82
|
+
UI_HEAL_MODE_RANK2 as UI_HEAL_MODE_RANK,
|
|
83
|
+
VALUE_ACTIONS2 as VALUE_ACTIONS,
|
|
84
|
+
analyzeUiPopupHandler2 as analyzeUiPopupHandler,
|
|
85
|
+
buildHealQuestion2 as buildHealQuestion,
|
|
86
|
+
capHealMode2 as capHealMode,
|
|
87
|
+
classifyConsequence2 as classifyConsequence,
|
|
88
|
+
compatibleRoles2 as compatibleRoles,
|
|
89
|
+
decideHeal2 as decideHeal,
|
|
90
|
+
elementInfoFromTarget2 as elementInfoFromTarget,
|
|
91
|
+
indexSnapshot2 as indexSnapshot,
|
|
92
|
+
isSnapshotPath2 as isSnapshotPath,
|
|
93
|
+
keywordWords2 as keywordWords,
|
|
94
|
+
maskSnapshot2 as maskSnapshot,
|
|
95
|
+
matchesUrlPattern2 as matchesUrlPattern,
|
|
96
|
+
parseHealAnswer2 as parseHealAnswer,
|
|
97
|
+
parseHealMode2 as parseHealMode,
|
|
98
|
+
parseUiPopupHandler2 as parseUiPopupHandler,
|
|
99
|
+
popupHandlerScript2 as popupHandlerScript,
|
|
100
|
+
snapshotNodeAt2 as snapshotNodeAt,
|
|
101
|
+
targetFromSnapshotNode2 as targetFromSnapshotNode,
|
|
102
|
+
usableKeywords2 as usableKeywords,
|
|
103
|
+
usablePopupHandlers2 as usablePopupHandlers,
|
|
104
|
+
verifyHealCandidate2 as verifyHealCandidate,
|
|
105
|
+
walkSnapshot2 as walkSnapshot
|
|
106
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/script/limits.ts
|
|
2
|
+
var UI_SCRIPT_VERSION2 = 1;
|
|
3
|
+
var MAX_SCRIPT_STEPS2 = 500;
|
|
4
|
+
var MAX_SCRIPT_BYTES2 = 1024 * 1024;
|
|
5
|
+
var MAX_FLOW_DEPTH2 = 8;
|
|
6
|
+
var MAX_EXPRESSION_DEPTH2 = 16;
|
|
7
|
+
var MAX_EXPRESSION_ITEMS2 = 1000;
|
|
8
|
+
var MAX_OPERATOR_ARGS2 = 16;
|
|
9
|
+
var MAX_SCRIPT_INPUTS2 = 100;
|
|
10
|
+
var MAX_SCRIPT_OUTPUTS2 = 100;
|
|
11
|
+
var MAX_SCRIPT_VARIABLES2 = 100;
|
|
12
|
+
var MAX_SCRIPT_ELEMENTS2 = 500;
|
|
13
|
+
var MAX_TARGET_METHODS2 = 8;
|
|
14
|
+
var MAX_FRAME_DEPTH2 = 8;
|
|
15
|
+
var MAX_EXTRACT_FIELDS2 = 50;
|
|
16
|
+
var MAX_LIST_ITEMS2 = 5000;
|
|
17
|
+
var MAX_LIST_PAGES2 = 50;
|
|
18
|
+
var MAX_LOOP_ITERATIONS2 = 1e4;
|
|
19
|
+
var MAX_RETRY_ATTEMPTS2 = 10;
|
|
20
|
+
var MAX_STEP_TIMEOUT_MS2 = 600000;
|
|
21
|
+
var MAX_DELAY_MS2 = 60000;
|
|
22
|
+
var MAX_KEYS2 = 8;
|
|
23
|
+
var MAX_SELECT_VALUES2 = 50;
|
|
24
|
+
var MAX_SELECTOR_LENGTH2 = 500;
|
|
25
|
+
var MAX_URL_LENGTH2 = 4096;
|
|
26
|
+
var MAX_LABEL_LENGTH2 = 512;
|
|
27
|
+
var MAX_TEXT_LENGTH2 = 1e4;
|
|
28
|
+
var MAX_INTENT_LENGTH2 = 500;
|
|
29
|
+
var MAX_NAME_LENGTH2 = 64;
|
|
30
|
+
var LEGACY_MAX_BROWSER_STEPS2 = 100;
|
|
31
|
+
var LEGACY_MAX_STEPS_BYTES2 = 256 * 1024;
|
|
32
|
+
var LEGACY_MAX_STEP_TIMEOUT_MS2 = 60000;
|
|
33
|
+
function jsonByteLength2(value) {
|
|
34
|
+
return new TextEncoder().encode(JSON.stringify(value) ?? "").length;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { UI_SCRIPT_VERSION2, MAX_SCRIPT_STEPS2, MAX_SCRIPT_BYTES2, MAX_FLOW_DEPTH2, MAX_EXPRESSION_DEPTH2, MAX_EXPRESSION_ITEMS2, MAX_OPERATOR_ARGS2, MAX_SCRIPT_INPUTS2, MAX_SCRIPT_OUTPUTS2, MAX_SCRIPT_VARIABLES2, MAX_SCRIPT_ELEMENTS2, MAX_TARGET_METHODS2, MAX_FRAME_DEPTH2, MAX_EXTRACT_FIELDS2, MAX_LIST_ITEMS2, MAX_LIST_PAGES2, MAX_LOOP_ITERATIONS2, MAX_RETRY_ATTEMPTS2, MAX_STEP_TIMEOUT_MS2, MAX_DELAY_MS2, MAX_KEYS2, MAX_SELECT_VALUES2, MAX_SELECTOR_LENGTH2, MAX_URL_LENGTH2, MAX_LABEL_LENGTH2, MAX_TEXT_LENGTH2, MAX_INTENT_LENGTH2, MAX_NAME_LENGTH2, LEGACY_MAX_BROWSER_STEPS2, LEGACY_MAX_STEPS_BYTES2, LEGACY_MAX_STEP_TIMEOUT_MS2, jsonByteLength2 };
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
uiStepFingerprint2,
|
|
8
8
|
UiScriptError2,
|
|
9
9
|
parseUiScript2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-qmv3ar39.js";
|
|
11
11
|
import {
|
|
12
12
|
sha256Hex2,
|
|
13
13
|
RecordingError2,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
LEGACY_MAX_STEPS_BYTES2,
|
|
23
23
|
LEGACY_MAX_STEP_TIMEOUT_MS2,
|
|
24
24
|
jsonByteLength2
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-20bbwwc9.js";
|
|
26
26
|
// src/script/hash.ts
|
|
27
27
|
var UI_SCRIPT_SCHEMA_HASH2 = "e6860649ad1cba906fb704ce4b62b3ea4380203e6628c809571602f4d0947884";
|
|
28
28
|
function schemaHashOf2(jsonSchema) {
|
|
@@ -41,199 +41,6 @@ function uiScriptJsonSchema2() {
|
|
|
41
41
|
const { $schema, ...rest } = generated;
|
|
42
42
|
return { $schema, title: UI_SCRIPT_SCHEMA_TITLE2, ...rest };
|
|
43
43
|
}
|
|
44
|
-
// src/script/describe.ts
|
|
45
|
-
var UI_SCRIPT_STEP_KEY_PREFIX2 = "fluidgrids.uiScript.step.";
|
|
46
|
-
var UI_SCRIPT_STEP_MESSAGES2 = {
|
|
47
|
-
navigate: "Go to {{url}}",
|
|
48
|
-
goBack: "Go back",
|
|
49
|
-
reload: "Reload the page",
|
|
50
|
-
closeTab: "Close the tab",
|
|
51
|
-
click: "Click {{target}}",
|
|
52
|
-
rightClick: "Right-click {{target}}",
|
|
53
|
-
doubleClick: "Double-click {{target}}",
|
|
54
|
-
rightDoubleClick: "Right double-click {{target}}",
|
|
55
|
-
hover: "Point at {{target}}",
|
|
56
|
-
type: "Type {{value}} into {{target}}",
|
|
57
|
-
typeFocused: "Type {{value}}",
|
|
58
|
-
typeMasked: "Type a hidden value into {{target}}",
|
|
59
|
-
typeMaskedFocused: "Type a hidden value",
|
|
60
|
-
typeSecret: "Type a secret into {{target}}",
|
|
61
|
-
clear: "Clear {{target}}",
|
|
62
|
-
select: "Choose {{value}} in {{target}}",
|
|
63
|
-
check: "Tick {{target}}",
|
|
64
|
-
uncheck: "Untick {{target}}",
|
|
65
|
-
pressKey: "Press {{keys}}",
|
|
66
|
-
scrollTop: "Scroll to the top",
|
|
67
|
-
scrollBottom: "Scroll to the bottom",
|
|
68
|
-
scrollTo: "Scroll to {{target}}",
|
|
69
|
-
scrollBy: "Scroll by {{dx}}, {{dy}}",
|
|
70
|
-
scrollInside: "Scroll {{target}} by {{dx}}, {{dy}}",
|
|
71
|
-
waitFor: "Wait for {{target}}",
|
|
72
|
-
waitForGone: "Wait for {{target}} to go away",
|
|
73
|
-
waitForText: "Wait for the text {{value}}",
|
|
74
|
-
waitForUrl: "Wait for the address to contain {{value}}",
|
|
75
|
-
waitForTime: "Wait {{milliseconds}} ms",
|
|
76
|
-
extract: "Read {{fields}}",
|
|
77
|
-
extractList: "Read each {{target}}",
|
|
78
|
-
getText: "Read the text of {{target}}",
|
|
79
|
-
getValue: "Read the value of {{target}}",
|
|
80
|
-
getAttribute: "Read {{attribute}} of {{target}}",
|
|
81
|
-
elementExists: "Check whether {{target}} is there",
|
|
82
|
-
getPageText: "Read the page text",
|
|
83
|
-
getPageHtml: "Read the page HTML",
|
|
84
|
-
screenshot: "Take a screenshot",
|
|
85
|
-
screenshotOf: "Take a screenshot of {{target}}",
|
|
86
|
-
login: "Sign in",
|
|
87
|
-
focusWindow: "Switch to {{app}}",
|
|
88
|
-
if: "If {{condition}}",
|
|
89
|
-
ifElement: "If {{target}} is there",
|
|
90
|
-
forEach: "For each item in {{value}}",
|
|
91
|
-
forEachElement: "For each {{target}}",
|
|
92
|
-
while: "While {{condition}}, at most {{max}} times",
|
|
93
|
-
whileElement: "While {{target}} is there, at most {{max}} times",
|
|
94
|
-
retryScope: "Try up to {{attempts}} times",
|
|
95
|
-
set: "Set {{name}} to {{value}}",
|
|
96
|
-
log: "Log {{value}}",
|
|
97
|
-
call: "Run the shared sequence {{sequence}}"
|
|
98
|
-
};
|
|
99
|
-
function stepMessageKey2(name) {
|
|
100
|
-
return `${UI_SCRIPT_STEP_KEY_PREFIX2}${name}`;
|
|
101
|
-
}
|
|
102
|
-
var MAX_SHOWN = 60;
|
|
103
|
-
function shorten(text) {
|
|
104
|
-
const flat = text.replace(/\s+/g, " ").trim();
|
|
105
|
-
return flat.length > MAX_SHOWN ? `${flat.slice(0, MAX_SHOWN - 1)}…` : flat;
|
|
106
|
-
}
|
|
107
|
-
function quoted(text) {
|
|
108
|
-
return `"${shorten(text)}"`;
|
|
109
|
-
}
|
|
110
|
-
function describeTarget2(ref, elements = {}) {
|
|
111
|
-
if (!ref)
|
|
112
|
-
return quoted("?");
|
|
113
|
-
if ("element" in ref) {
|
|
114
|
-
const element = elements[ref.element];
|
|
115
|
-
if (element?.name)
|
|
116
|
-
return quoted(element.name);
|
|
117
|
-
if (!element?.target)
|
|
118
|
-
return quoted(ref.element);
|
|
119
|
-
return describeTarget2(element.target);
|
|
120
|
-
}
|
|
121
|
-
const method = ref.methods.find((item) => item.enabled !== false) ?? ref.methods[0];
|
|
122
|
-
switch (method?.kind) {
|
|
123
|
-
case "role":
|
|
124
|
-
case "fuzzy":
|
|
125
|
-
return quoted(method.name);
|
|
126
|
-
case "text":
|
|
127
|
-
return quoted(method.text);
|
|
128
|
-
case "testId":
|
|
129
|
-
return quoted(method.value);
|
|
130
|
-
case "anchor":
|
|
131
|
-
return quoted(method.anchor.kind === "text" ? method.anchor.text : method.anchor.name);
|
|
132
|
-
case "css":
|
|
133
|
-
return quoted(method.selector);
|
|
134
|
-
case "xpath":
|
|
135
|
-
return quoted(method.xpath);
|
|
136
|
-
default:
|
|
137
|
-
return quoted("?");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function describeExpression2(expression) {
|
|
141
|
-
if (expression === undefined || expression === null)
|
|
142
|
-
return "…";
|
|
143
|
-
if (typeof expression === "string")
|
|
144
|
-
return quoted(expression);
|
|
145
|
-
if (typeof expression === "number" || typeof expression === "boolean")
|
|
146
|
-
return String(expression);
|
|
147
|
-
if ("input" in expression)
|
|
148
|
-
return `[${expression.input}]`;
|
|
149
|
-
if ("var" in expression)
|
|
150
|
-
return `[${expression.var}]`;
|
|
151
|
-
return "…";
|
|
152
|
-
}
|
|
153
|
-
function fill(name, vars) {
|
|
154
|
-
const fallback = UI_SCRIPT_STEP_MESSAGES2[name].replace(/\{\{(\w+)\}\}/g, (_match, variable) => String(vars[variable] ?? ""));
|
|
155
|
-
return { key: stepMessageKey2(name), vars, fallback };
|
|
156
|
-
}
|
|
157
|
-
function describeStep2(step, elements = {}) {
|
|
158
|
-
const target = (ref) => describeTarget2(ref, elements);
|
|
159
|
-
switch (step.action) {
|
|
160
|
-
case "navigate":
|
|
161
|
-
return fill("navigate", { url: describeExpression2(step.url) });
|
|
162
|
-
case "click":
|
|
163
|
-
return fill(step.button === "right" ? "rightClick" : "click", { target: target(step.target) });
|
|
164
|
-
case "doubleClick":
|
|
165
|
-
return fill(step.button === "right" ? "rightDoubleClick" : "doubleClick", { target: target(step.target) });
|
|
166
|
-
case "hover":
|
|
167
|
-
case "clear":
|
|
168
|
-
case "typeSecret":
|
|
169
|
-
case "getText":
|
|
170
|
-
case "getValue":
|
|
171
|
-
case "elementExists":
|
|
172
|
-
return fill(step.action, { target: target(step.target) });
|
|
173
|
-
case "type": {
|
|
174
|
-
if (!step.target)
|
|
175
|
-
return fill(step.masked ? "typeMaskedFocused" : "typeFocused", step.masked ? {} : { value: describeExpression2(step.text) });
|
|
176
|
-
return fill(step.masked ? "typeMasked" : "type", {
|
|
177
|
-
target: target(step.target),
|
|
178
|
-
...step.masked ? {} : { value: describeExpression2(step.text) }
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
case "select":
|
|
182
|
-
return fill("select", {
|
|
183
|
-
value: step.values.map(describeExpression2).join(", "),
|
|
184
|
-
target: target(step.target)
|
|
185
|
-
});
|
|
186
|
-
case "check":
|
|
187
|
-
return fill(step.checked === false ? "uncheck" : "check", { target: target(step.target) });
|
|
188
|
-
case "pressKey":
|
|
189
|
-
return fill("pressKey", { keys: step.keys.join("+") });
|
|
190
|
-
case "scroll":
|
|
191
|
-
if (step.target && (step.dx !== undefined || step.dy !== undefined)) {
|
|
192
|
-
return fill("scrollInside", { target: target(step.target), dx: step.dx ?? 0, dy: step.dy ?? 0 });
|
|
193
|
-
}
|
|
194
|
-
if (step.target)
|
|
195
|
-
return fill("scrollTo", { target: target(step.target) });
|
|
196
|
-
if (step.dx !== undefined || step.dy !== undefined)
|
|
197
|
-
return fill("scrollBy", { dx: step.dx ?? 0, dy: step.dy ?? 0 });
|
|
198
|
-
return fill(step.to === "top" ? "scrollTop" : "scrollBottom", {});
|
|
199
|
-
case "waitFor":
|
|
200
|
-
if (step.target) {
|
|
201
|
-
const gone = step.state === "hidden" || step.state === "detached";
|
|
202
|
-
return fill(gone ? "waitForGone" : "waitFor", { target: target(step.target) });
|
|
203
|
-
}
|
|
204
|
-
if (step.text !== undefined)
|
|
205
|
-
return fill("waitForText", { value: describeExpression2(step.text) });
|
|
206
|
-
if (step.urlContains !== undefined)
|
|
207
|
-
return fill("waitForUrl", { value: describeExpression2(step.urlContains) });
|
|
208
|
-
return fill("waitForTime", { milliseconds: step.milliseconds ?? 0 });
|
|
209
|
-
case "extract":
|
|
210
|
-
return fill("extract", { fields: step.fields.map((field) => field.name).join(", ") });
|
|
211
|
-
case "extractList":
|
|
212
|
-
return fill("extractList", { target: target(step.item) });
|
|
213
|
-
case "getAttribute":
|
|
214
|
-
return fill("getAttribute", { attribute: step.attribute, target: target(step.target) });
|
|
215
|
-
case "screenshot":
|
|
216
|
-
return step.target ? fill("screenshotOf", { target: target(step.target) }) : fill("screenshot", {});
|
|
217
|
-
case "focusWindow":
|
|
218
|
-
return fill("focusWindow", { app: quoted(step.title ?? step.app) });
|
|
219
|
-
case "if":
|
|
220
|
-
return step.elementExists ? fill("ifElement", { target: target(step.elementExists) }) : fill("if", { condition: describeExpression2(step.condition) });
|
|
221
|
-
case "forEach":
|
|
222
|
-
return step.elements ? fill("forEachElement", { target: target(step.elements) }) : fill("forEach", { value: describeExpression2(step.in) });
|
|
223
|
-
case "while":
|
|
224
|
-
return step.elementExists ? fill("whileElement", { target: target(step.elementExists), max: step.maxIterations }) : fill("while", { condition: describeExpression2(step.condition), max: step.maxIterations });
|
|
225
|
-
case "retryScope":
|
|
226
|
-
return fill("retryScope", { attempts: step.attempts });
|
|
227
|
-
case "set":
|
|
228
|
-
return fill("set", { name: `[${step.name}]`, value: describeExpression2(step.value) });
|
|
229
|
-
case "log":
|
|
230
|
-
return fill("log", { value: describeExpression2(step.message) });
|
|
231
|
-
case "call":
|
|
232
|
-
return fill("call", { sequence: quoted(step.sequenceId) });
|
|
233
|
-
default:
|
|
234
|
-
return fill(step.action, {});
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
44
|
// src/script/adapters/browser-action-contract.ts
|
|
238
45
|
var BROWSER_STEP_ACTIONS2 = [
|
|
239
46
|
"navigate",
|
|
@@ -1000,4 +807,4 @@ function toRecordedStep(step, fallbackIntent) {
|
|
|
1000
807
|
return stop2();
|
|
1001
808
|
}
|
|
1002
809
|
}
|
|
1003
|
-
export { UI_SCRIPT_SCHEMA_HASH2, schemaHashOf2, UI_SCRIPT_SCHEMA_TITLE2, uiScriptJsonSchema2,
|
|
810
|
+
export { UI_SCRIPT_SCHEMA_HASH2, schemaHashOf2, UI_SCRIPT_SCHEMA_TITLE2, uiScriptJsonSchema2, BROWSER_STEP_ACTIONS2, fromBrowserActionSteps2, toBrowserActionSteps2, targetFromPlaywrightSelector2, fromRemoteBrowserSteps2, fromRecording2, toRecording2 };
|