@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.
Files changed (63) hide show
  1. package/README.md +20 -2
  2. package/dist/analyze/analyze.d.ts +10 -0
  3. package/dist/analyze/context.d.ts +25 -9
  4. package/dist/analyze/index.d.ts +3 -2
  5. package/dist/analyze/messages.d.ts +2 -0
  6. package/dist/analyze/rules/run-command-from-variable.d.ts +2 -0
  7. package/dist/analyze/rules/single-method-image-target.d.ts +7 -0
  8. package/dist/analyze/sensitive.d.ts +2 -2
  9. package/dist/analyze/types.d.ts +6 -2
  10. package/dist/analyze.js +4 -2
  11. package/dist/desk.d.ts +13 -0
  12. package/dist/desk.js +29 -0
  13. package/dist/dom-runtime.iife.js +1 -1
  14. package/dist/dom-runtime.js +2 -2
  15. package/dist/drivers/desk-backend.d.ts +40 -0
  16. package/dist/drivers/desk-driver.d.ts +41 -0
  17. package/dist/drivers/desk-errors.d.ts +19 -0
  18. package/dist/drivers/desk-tree.d.ts +28 -0
  19. package/dist/drivers/desk-wire.d.ts +237 -0
  20. package/dist/drivers/index.d.ts +3 -1
  21. package/dist/drivers.js +10 -7
  22. package/dist/heal.js +5 -5
  23. package/dist/index-0ps53dhe.js +85 -0
  24. package/dist/{index-ptrmf779.js → index-2q0hh6we.js} +3 -3
  25. package/dist/index-552x2bnm.js +56 -0
  26. package/dist/index-6m0chbhq.js +64 -0
  27. package/dist/{index-dwp10g62.js → index-7gfzv5n8.js} +96 -53
  28. package/dist/{index-gvavb597.js → index-93hfbk5c.js} +10 -0
  29. package/dist/index-a8s39bse.js +920 -0
  30. package/dist/index-b5a306v7.js +43 -0
  31. package/dist/index-bx4bsvg0.js +458 -0
  32. package/dist/{index-9xgz8dxt.js → index-cc49ykn5.js} +4 -4
  33. package/dist/{index-vpm1gnmy.js → index-e557vzdd.js} +219 -34
  34. package/dist/{index-vnv9tp11.js → index-e7pgqd60.js} +2 -2
  35. package/dist/index-hdq3y007.js +246 -0
  36. package/dist/{index-zagmp5ya.js → index-n3nfhjrj.js} +2 -2
  37. package/dist/{index-wnch00m6.js → index-nmsg2wze.js} +2 -2
  38. package/dist/{index-zhbwhdya.js → index-q2jbva7c.js} +5 -3
  39. package/dist/{index-n7ah1jn7.js → index-rbem2yms.js} +16 -243
  40. package/dist/{index-mhv6a02p.js → index-reef7e8m.js} +1 -1
  41. package/dist/{index-3r2y0mnc.js → index-wdbn4xjc.js} +5 -5
  42. package/dist/{index-8eb4xd1j.js → index-x8fc4r4h.js} +101 -426
  43. package/dist/{index-0tfzfxx9.js → index-yhzykhdj.js} +1 -43
  44. package/dist/{index-t55wvhvh.js → index-z2v8prer.js} +1 -61
  45. package/dist/{index-5pv673wd.js → index-zj3zhbac.js} +2 -1
  46. package/dist/index.d.ts +1 -0
  47. package/dist/index.js +79 -31
  48. package/dist/interpret/driver.d.ts +109 -18
  49. package/dist/interpret/events.d.ts +5 -2
  50. package/dist/interpret/index.d.ts +4 -3
  51. package/dist/interpret/run.d.ts +28 -1
  52. package/dist/interpret.js +16 -9
  53. package/dist/script/adapters/recording-desktop.d.ts +52 -0
  54. package/dist/script/describe.d.ts +7 -2
  55. package/dist/script/desk-roles.d.ts +33 -0
  56. package/dist/script/desktop-capabilities.d.ts +7 -2
  57. package/dist/script/desktop-schema.d.ts +2 -0
  58. package/dist/script/index.d.ts +3 -1
  59. package/dist/script.js +35 -19
  60. package/dist/target/types.d.ts +10 -4
  61. package/dist/target.js +20 -16
  62. package/dist/testing.js +5 -3
  63. package/package.json +7 -3
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Desk error codes as engine error codes (desk contract v3 section 11;
3
+ * document 05 section 10; RPA plan package P2-03b).
4
+ *
5
+ * The desk speaks its own vocabulary (`TARGET_NOT_FOUND`, `DESK_UNAVAILABLE`,
6
+ * ...); a run's step events and node failures speak the engine's. The desk
7
+ * code is kept in `detail.deskCode`, so nothing is lost. Codes with no engine
8
+ * counterpart of their own map to the nearest engine code of the same
9
+ * family: a refusal that means "this desk cannot be used now" (a stale fence,
10
+ * a takeover, the kill switch, missing consent, an offline provider) is
11
+ * `DESK_UNAVAILABLE` (DISPATCH_FAILED); a path outside the workspace folder is
12
+ * `ACTION_FAILED` with `detail.problem = 'OUTSIDE_WORKSPACE_FOLDER'`.
13
+ */
14
+ import type { UiErrorCode } from '../interpret/errors.js';
15
+ import type { DeskWireError } from './desk-wire.js';
16
+ /** The engine code for a desk error code. `TARGET_NOT_FOUND` depends on `detail.matches`. */
17
+ export declare function engineCodeOfDeskError(error: DeskWireError): UiErrorCode;
18
+ /** The engine detail of a desk error: the desk code, and the few detail fields that are safe to report. */
19
+ export declare function engineDetailOfDeskError(error: DeskWireError): Record<string, unknown>;
@@ -0,0 +1,28 @@
1
+ import type { WebElementState, WebRect } from '../target/types.js';
2
+ import type { UiAnchorMethod, UiFuzzyMethod, UiRoleMethod } from '../script/types.js';
3
+ import type { DeskWireBounds, DeskWireTreeNode, DeskWireTreeSnapshot } from './desk-wire.js';
4
+ /** The methods the engine resolves on a desk tree. */
5
+ export type DeskTreeMethod = UiRoleMethod | UiFuzzyMethod | UiAnchorMethod;
6
+ /** What a method found on the tree, before the state filter picks one. */
7
+ export type DeskTreePick = {
8
+ outcome: 'found';
9
+ node: DeskWireTreeNode;
10
+ matches: number;
11
+ } | {
12
+ outcome: 'ambiguous';
13
+ nodes: DeskWireTreeNode[];
14
+ matches: number;
15
+ } | {
16
+ outcome: 'none';
17
+ matches: 0;
18
+ } | {
19
+ outcome: 'notInteractable';
20
+ nodes: DeskWireTreeNode[];
21
+ matches: 0;
22
+ };
23
+ /** Screen bounds as the web resolver measures them. */
24
+ export declare function webRectOf(bounds: DeskWireBounds): WebRect;
25
+ /** Whether a node is in the state a step needs: `interactable` is visible and enabled, `visible` is visible. */
26
+ export declare function deskNodeInState(node: Pick<DeskWireTreeNode, 'visible' | 'enabled'>, state: WebElementState): boolean;
27
+ /** Resolve one engine method on a desk tree snapshot, in the state the step needs. */
28
+ export declare function matchDeskTreeMethod(method: DeskTreeMethod, snapshot: DeskWireTreeSnapshot, state: WebElementState): DeskTreePick;
@@ -0,0 +1,237 @@
1
+ /**
2
+ * The desk contract v3 shapes the desk driver sends and reads (fluidgrids-specs
3
+ * `contracts/desk-contract-v3.md` sections 4, 5 and 11; RPA plan package
4
+ * P2-03b).
5
+ *
6
+ * These are structural copies of the types in `@vibecontrols/plugin-sdk/desk-types`,
7
+ * kept here so the engine has no run-time dependency on the SDK and stays
8
+ * browser safe. A test (`tests/drivers/desk-parts.test.ts`) checks that the
9
+ * SDK's `DeskAction`, `DeskActResult` and `DeskCapabilities` fit them, so the
10
+ * desk meta plugin can pass its guarded `act` to the driver unchanged.
11
+ */
12
+ import type { DeskSelectorPlatformName } from '../script/desktop-capabilities.js';
13
+ /** Screen pixels, per-monitor aware. */
14
+ export interface DeskWireBounds {
15
+ x: number;
16
+ y: number;
17
+ w: number;
18
+ h: number;
19
+ }
20
+ /** One node of a selector path (contract section 4). */
21
+ export interface DeskWireSelectorNode {
22
+ role: string;
23
+ name?: string;
24
+ automationId?: string;
25
+ className?: string;
26
+ index?: number;
27
+ /** css only: the CSS selector for the final node. */
28
+ css?: string;
29
+ }
30
+ /** A strict selector the desk resolves itself, scoped to the window first. */
31
+ export interface DeskWireSelectorTarget {
32
+ by: 'selector';
33
+ app?: string;
34
+ window?: {
35
+ title?: string;
36
+ titleMatch?: 'exact' | 'wildcard';
37
+ class?: string;
38
+ processName?: string;
39
+ };
40
+ path: DeskWireSelectorNode[];
41
+ platform: DeskSelectorPlatformName;
42
+ }
43
+ /** Every target kind of desk contract v3. */
44
+ export type DeskWireTarget = {
45
+ by: 'ref';
46
+ ref: string;
47
+ } | {
48
+ by: 'point';
49
+ x: number;
50
+ y: number;
51
+ } | {
52
+ by: 'window';
53
+ app: string;
54
+ title?: string;
55
+ } | DeskWireSelectorTarget | {
56
+ by: 'image';
57
+ pngBase64: string;
58
+ threshold?: number;
59
+ region?: DeskWireBounds;
60
+ recordedScale?: number;
61
+ } | {
62
+ by: 'text';
63
+ text: string;
64
+ match?: 'exact' | 'contains';
65
+ occurrence?: number;
66
+ source?: 'accessibility' | 'ocr';
67
+ region?: DeskWireBounds;
68
+ };
69
+ /** What a `get` reads. */
70
+ export type DeskWireGetWhat = 'text' | 'value' | 'name' | 'state' | 'bounds' | 'attributes';
71
+ /** The `snapshot` options that switch the result to `desk-tree-v1` (contract section 5.2). */
72
+ export interface DeskWireSnapshotOptions {
73
+ scope?: {
74
+ app?: string;
75
+ title?: string;
76
+ } | {
77
+ target: DeskWireTarget;
78
+ };
79
+ depth?: number;
80
+ attributes?: string[];
81
+ maxNodes?: number;
82
+ }
83
+ /** The actions the desk driver sends: every desk contract v3 action. */
84
+ export type DeskWireAction = {
85
+ type: 'screenshot';
86
+ } | ({
87
+ type: 'snapshot';
88
+ } & DeskWireSnapshotOptions) | {
89
+ type: 'click';
90
+ target: DeskWireTarget;
91
+ button?: 'left' | 'right';
92
+ count?: 1 | 2;
93
+ } | {
94
+ type: 'type';
95
+ target?: DeskWireTarget;
96
+ text: string;
97
+ } | {
98
+ type: 'secret_fill';
99
+ target: DeskWireTarget;
100
+ secretRef: string;
101
+ expectedOrigin: string;
102
+ } | {
103
+ type: 'key';
104
+ keys: string[];
105
+ } | {
106
+ type: 'scroll';
107
+ target?: DeskWireTarget;
108
+ dx: number;
109
+ dy: number;
110
+ } | {
111
+ type: 'navigate';
112
+ url: string;
113
+ } | {
114
+ type: 'focus_window';
115
+ app: string;
116
+ title?: string;
117
+ } | {
118
+ type: 'shell';
119
+ command: string;
120
+ cwd?: string;
121
+ timeoutMs: number;
122
+ } | {
123
+ type: 'read_file';
124
+ path: string;
125
+ maxBytes: number;
126
+ } | {
127
+ type: 'write_file';
128
+ path: string;
129
+ content: string;
130
+ } | {
131
+ type: 'find';
132
+ target: DeskWireTarget;
133
+ max?: number;
134
+ } | {
135
+ type: 'get';
136
+ target: DeskWireTarget;
137
+ what: DeskWireGetWhat;
138
+ attributes?: string[];
139
+ } | {
140
+ type: 'invoke';
141
+ target: DeskWireTarget;
142
+ } | {
143
+ type: 'set_value';
144
+ target: DeskWireTarget;
145
+ value: string;
146
+ } | {
147
+ type: 'toggle';
148
+ target: DeskWireTarget;
149
+ state?: 'on' | 'off';
150
+ } | {
151
+ type: 'select';
152
+ target: DeskWireTarget;
153
+ item?: string;
154
+ } | {
155
+ type: 'expand';
156
+ target: DeskWireTarget;
157
+ state?: 'expanded' | 'collapsed';
158
+ } | {
159
+ type: 'list_windows';
160
+ app?: string;
161
+ } | {
162
+ type: 'open_app';
163
+ app: string;
164
+ args?: string[];
165
+ waitForTitle?: string;
166
+ } | {
167
+ type: 'close_app';
168
+ app: string;
169
+ title?: string;
170
+ } | {
171
+ type: 'window_state';
172
+ app: string;
173
+ title?: string;
174
+ state: 'normal' | 'minimized' | 'maximized';
175
+ } | {
176
+ type: 'highlight';
177
+ target: DeskWireTarget;
178
+ durationMs?: number;
179
+ };
180
+ export type DeskWireActionType = DeskWireAction['type'];
181
+ /** One element a desk found (contract section 5.1). */
182
+ export interface DeskWireMatch {
183
+ ref: string;
184
+ role: string;
185
+ name?: string;
186
+ automationId?: string;
187
+ className?: string;
188
+ value?: string;
189
+ enabled: boolean;
190
+ visible: boolean;
191
+ bounds: DeskWireBounds;
192
+ selector?: DeskWireSelectorTarget;
193
+ }
194
+ /** One node of a `desk-tree-v1` snapshot. */
195
+ export interface DeskWireTreeNode extends DeskWireMatch {
196
+ depth: number;
197
+ parentRef?: string;
198
+ }
199
+ /** An open window. */
200
+ export interface DeskWireWindow {
201
+ app: string;
202
+ title: string;
203
+ processName?: string;
204
+ pid?: number;
205
+ bounds: DeskWireBounds;
206
+ state: 'normal' | 'minimized' | 'maximized';
207
+ focused: boolean;
208
+ }
209
+ /** The `snapshot` result for a request with any option. */
210
+ export interface DeskWireTreeSnapshot {
211
+ format: 'desk-tree-v1';
212
+ nodes: DeskWireTreeNode[];
213
+ truncated: boolean;
214
+ window?: DeskWireWindow;
215
+ }
216
+ /** A desk refusal or failure. `code` is a desk error code (contract section 11). */
217
+ export interface DeskWireError {
218
+ code: string;
219
+ message: string;
220
+ detail?: Record<string, unknown>;
221
+ }
222
+ /** What `get` returns. */
223
+ export type DeskWireGetValue = string | boolean | number | DeskWireBounds | Record<string, string> | null;
224
+ /** The result of one desk action (the SDK's `DeskActResult`). */
225
+ export interface DeskWireResult {
226
+ ok: boolean;
227
+ screenshotPng?: Uint8Array;
228
+ snapshot?: unknown;
229
+ text?: string;
230
+ error?: DeskWireError;
231
+ matches?: DeskWireMatch[];
232
+ truncated?: boolean;
233
+ value?: DeskWireGetValue;
234
+ windows?: DeskWireWindow[];
235
+ }
236
+ /** Whether a snapshot result is the `desk-tree-v1` format. */
237
+ export declare function isDeskWireTreeSnapshot(value: unknown): value is DeskWireTreeSnapshot;
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * `@burdenoff/ui-engine/drivers`: desk drivers over a DOM (plan P1-02). The
3
3
  * DOM driver runs the P1-01 runtime in the interpreter's own world; the
4
- * snapshot driver replays a script on a stored tree snapshot (P1-05).
4
+ * snapshot driver replays a script on a stored tree snapshot (P1-05). The
5
+ * desk driver for desktop scripts (P2-03b) has no DOM dependency and is
6
+ * published on its own subpath, `@burdenoff/ui-engine/desk`.
5
7
  */
6
8
  export { type CreateDomDriverOptions, DOM_DRIVER_CAPABILITIES, type DomDriverNavigation, createDomDriver, safePageHtml, safePageText, } from './dom-driver.js';
7
9
  export { type CreateSnapshotDriverOptions, type ReplayUiScriptOnSnapshotOptions, SNAPSHOT_DRIVER_CAPABILITIES, type UiReplayStepVerdict, type UiSnapshotReplayResult, createSnapshotDriver, replayUiScriptOnSnapshot, } from './snapshot-driver.js';
package/dist/drivers.js CHANGED
@@ -1,21 +1,24 @@
1
1
  import {
2
2
  parseUiScript2
3
- } from "./index-5pv673wd.js";
3
+ } from "./index-zj3zhbac.js";
4
4
  import"./index-dcs2pe49.js";
5
- import"./index-ptrmf779.js";
5
+ import"./index-2q0hh6we.js";
6
6
  import {
7
7
  DOM_DRIVER_CAPABILITIES2,
8
8
  safePageText2,
9
9
  safePageHtml2,
10
10
  createDomDriver2
11
- } from "./index-3r2y0mnc.js";
11
+ } from "./index-wdbn4xjc.js";
12
12
  import {
13
13
  runUiScript2
14
- } from "./index-vpm1gnmy.js";
14
+ } from "./index-e557vzdd.js";
15
15
  import {
16
- UiDriverError2,
17
16
  createVirtualClock2
18
- } from "./index-0tfzfxx9.js";
17
+ } from "./index-b5a306v7.js";
18
+ import {
19
+ UiDriverError2
20
+ } from "./index-yhzykhdj.js";
21
+ import"./index-bx4bsvg0.js";
19
22
  import {
20
23
  CAPABILITY_IDS2
21
24
  } from "./index-zpxk3fzd.js";
@@ -25,7 +28,7 @@ import {
25
28
  } from "./index-axph39g0.js";
26
29
  import {
27
30
  hydrateTreeSnapshot2
28
- } from "./index-n7ah1jn7.js";
31
+ } from "./index-rbem2yms.js";
29
32
  // src/drivers/snapshot-driver.ts
30
33
  var SNAPSHOT_DRIVER_CAPABILITIES = CAPABILITY_IDS2.filter((id) => id !== "action:focusWindow");
31
34
  var ignore = () => {
package/dist/heal.js CHANGED
@@ -1,4 +1,4 @@
1
- import"./index-5pv673wd.js";
1
+ import"./index-zj3zhbac.js";
2
2
  import"./index-dcs2pe49.js";
3
3
  import {
4
4
  UI_HEAL_MODES2,
@@ -17,7 +17,7 @@ import {
17
17
  matchesUrlPattern2,
18
18
  HEAL_POSITION_TOLERANCE_PX2,
19
19
  verifyHealCandidate2
20
- } from "./index-ptrmf779.js";
20
+ } from "./index-2q0hh6we.js";
21
21
  import {
22
22
  MAX_HEAL_QUESTION_NODES2,
23
23
  MAX_HEAL_NODE_NAME2,
@@ -26,7 +26,7 @@ import {
26
26
  targetFromSnapshotNode2,
27
27
  MAX_HEAL_ANSWER_LENGTH2,
28
28
  parseHealAnswer2
29
- } from "./index-9xgz8dxt.js";
29
+ } from "./index-cc49ykn5.js";
30
30
  import {
31
31
  MAX_HEAL_KEYWORDS2,
32
32
  MAX_HEAL_KEYWORD_LENGTH2,
@@ -43,7 +43,7 @@ import {
43
43
  MAX_POPUP_HANDLER_STEPS2,
44
44
  MAX_POPUP_URL_PATTERN2,
45
45
  POPUP_HANDLER_STEP_WAIT_MS2
46
- } from "./index-dwp10g62.js";
46
+ } from "./index-7gfzv5n8.js";
47
47
  import {
48
48
  SNAPSHOT_ROOT_PATH2,
49
49
  MAX_SNAPSHOT_PATH_LENGTH2,
@@ -54,7 +54,7 @@ import {
54
54
  MASKED_MARKER2,
55
55
  MAX_MASKED_PATHS2,
56
56
  maskSnapshot2
57
- } from "./index-zhbwhdya.js";
57
+ } from "./index-q2jbva7c.js";
58
58
  export {
59
59
  CONSEQUENCE_KEYWORDS2 as CONSEQUENCE_KEYWORDS,
60
60
  HEALABLE_ACTIONS2 as HEALABLE_ACTIONS,
@@ -0,0 +1,85 @@
1
+ // src/script/desk-roles.ts
2
+ var ROLE_ROWS = [
3
+ { names: ["button", "push button"], platform: { uia: "Button", ax: "AXButton", atspi: "push button" } },
4
+ { names: ["textbox", "edit", "entry"], platform: { uia: "Edit", ax: "AXTextField", atspi: "text" } },
5
+ { names: ["document"], platform: { uia: "Document", ax: "AXTextArea", atspi: "document text" } },
6
+ { names: ["link", "hyperlink"], platform: { uia: "Hyperlink", ax: "AXLink", atspi: "link" } },
7
+ { names: ["checkbox", "check box"], platform: { uia: "CheckBox", ax: "AXCheckBox", atspi: "check box" } },
8
+ { names: ["radio", "radio button"], platform: { uia: "RadioButton", ax: "AXRadioButton", atspi: "radio button" } },
9
+ { names: ["combobox", "combo box"], platform: { uia: "ComboBox", ax: "AXComboBox", atspi: "combo box" } },
10
+ { names: ["list"], platform: { uia: "List", ax: "AXList", atspi: "list" } },
11
+ { names: ["listitem", "list item"], platform: { uia: "ListItem", atspi: "list item" } },
12
+ { names: ["menu"], platform: { uia: "Menu", ax: "AXMenu", atspi: "menu" } },
13
+ { names: ["menubar", "menu bar"], platform: { uia: "MenuBar", ax: "AXMenuBar", atspi: "menu bar" } },
14
+ { names: ["menuitem", "menu item"], platform: { uia: "MenuItem", ax: "AXMenuItem", atspi: "menu item" } },
15
+ { names: ["tab", "tabitem", "page tab"], platform: { uia: "TabItem", atspi: "page tab" } },
16
+ { names: ["tablist", "page tab list"], platform: { uia: "Tab", ax: "AXTabGroup", atspi: "page tab list" } },
17
+ { names: ["tree"], platform: { uia: "Tree", ax: "AXOutline", atspi: "tree" } },
18
+ { names: ["treeitem", "tree item"], platform: { uia: "TreeItem", ax: "AXRow", atspi: "tree item" } },
19
+ { names: ["table", "grid", "datagrid"], platform: { uia: "DataGrid", ax: "AXTable", atspi: "table" } },
20
+ { names: ["row", "dataitem"], platform: { uia: "DataItem", ax: "AXRow", atspi: "table row" } },
21
+ { names: ["cell", "gridcell"], platform: { ax: "AXCell", atspi: "table cell" } },
22
+ { names: ["slider"], platform: { uia: "Slider", ax: "AXSlider", atspi: "slider" } },
23
+ {
24
+ names: ["spinbutton", "spinner", "spin button"],
25
+ platform: { uia: "Spinner", ax: "AXIncrementor", atspi: "spin button" }
26
+ },
27
+ {
28
+ names: ["progressbar", "progress bar"],
29
+ platform: { uia: "ProgressBar", ax: "AXProgressIndicator", atspi: "progress bar" }
30
+ },
31
+ { names: ["statictext", "label"], platform: { uia: "Text", ax: "AXStaticText", atspi: "label" } },
32
+ { names: ["heading"], platform: { uia: "Text", ax: "AXHeading", atspi: "heading" } },
33
+ { names: ["img", "image"], platform: { uia: "Image", ax: "AXImage", atspi: "image" } },
34
+ { names: ["toolbar", "tool bar"], platform: { uia: "ToolBar", ax: "AXToolbar", atspi: "tool bar" } },
35
+ { names: ["group", "grouping"], platform: { uia: "Group", ax: "AXGroup", atspi: "panel" } },
36
+ { names: ["window", "frame"], platform: { uia: "Window", ax: "AXWindow", atspi: "frame" } },
37
+ { names: ["dialog", "alertdialog"], platform: { uia: "Window", atspi: "dialog" } },
38
+ { names: ["pane"], platform: { uia: "Pane", atspi: "panel" } },
39
+ { names: ["scrollbar", "scroll bar"], platform: { uia: "ScrollBar", ax: "AXScrollBar", atspi: "scroll bar" } },
40
+ { names: ["statusbar", "status bar", "status"], platform: { uia: "StatusBar", atspi: "status bar" } },
41
+ { names: ["titlebar", "title bar"], platform: { uia: "TitleBar", atspi: "title bar" } }
42
+ ];
43
+ function key(role) {
44
+ return role.trim().toLowerCase().replace(/[\s_-]+/g, " ");
45
+ }
46
+ function addRow(map, name, row) {
47
+ const rows = map.get(name) ?? [];
48
+ if (!rows.includes(row))
49
+ rows.push(row);
50
+ map.set(name, rows);
51
+ }
52
+ var ROWS_BY_PLATFORM_NAME = new Map;
53
+ var ROWS_BY_ACCESSIBLE_NAME = new Map;
54
+ for (const row of ROLE_ROWS) {
55
+ for (const name of [row.platform.uia, row.platform.ax, row.platform.atspi]) {
56
+ if (name !== undefined)
57
+ addRow(ROWS_BY_PLATFORM_NAME, name, row);
58
+ }
59
+ for (const name of row.names)
60
+ addRow(ROWS_BY_ACCESSIBLE_NAME, key(name), row);
61
+ }
62
+ function rowsOf(role) {
63
+ return ROWS_BY_PLATFORM_NAME.get(role.trim()) ?? ROWS_BY_ACCESSIBLE_NAME.get(key(role)) ?? [];
64
+ }
65
+ function platformRole2(role, platform) {
66
+ const trimmed = role.trim();
67
+ if (trimmed.length === 0)
68
+ return;
69
+ if (ROLE_ROWS.some((row) => row.platform[platform] === trimmed))
70
+ return trimmed;
71
+ const rows = ROWS_BY_ACCESSIBLE_NAME.get(key(trimmed));
72
+ return rows?.[0]?.platform[platform];
73
+ }
74
+ function rolesMatch2(wanted, actual) {
75
+ if (wanted.trim() === actual.trim())
76
+ return true;
77
+ const wantedRows = rowsOf(wanted);
78
+ const actualRows = rowsOf(actual);
79
+ if (wantedRows.length === 0 || actualRows.length === 0) {
80
+ return wantedRows.length === 0 && actualRows.length === 0 && key(wanted) === key(actual);
81
+ }
82
+ return wantedRows.some((row) => actualRows.includes(row));
83
+ }
84
+
85
+ export { platformRole2, rolesMatch2 };
@@ -3,7 +3,7 @@ import {
3
3
  uiStepSchema2,
4
4
  UiScriptError2,
5
5
  parseUiScript2
6
- } from "./index-5pv673wd.js";
6
+ } from "./index-zj3zhbac.js";
7
7
  import {
8
8
  HEALABLE_ACTIONS2,
9
9
  compatibleRoles2,
@@ -12,7 +12,7 @@ import {
12
12
  MAX_POPUP_HANDLER_STEPS2,
13
13
  MAX_POPUP_URL_PATTERN2,
14
14
  analyzeUiScript2
15
- } from "./index-dwp10g62.js";
15
+ } from "./index-7gfzv5n8.js";
16
16
  import {
17
17
  stepTargets2
18
18
  } from "./index-axph39g0.js";
@@ -24,7 +24,7 @@ import {
24
24
  indexSnapshot2,
25
25
  snapshotName2,
26
26
  snapshotFrameDepth2
27
- } from "./index-zhbwhdya.js";
27
+ } from "./index-q2jbva7c.js";
28
28
 
29
29
  // src/heal/types.ts
30
30
  var UI_HEAL_MODES2 = ["off", "suggest", "heal_with_approval", "heal_and_continue"];
@@ -0,0 +1,56 @@
1
+ // src/analyze/sensitive.ts
2
+ 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;
3
+ var PASSWORD_TYPE = /type\s*=\s*["']?password/i;
4
+ function words(text) {
5
+ return text.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[^\p{L}\p{N}]+/gu, " ").trim();
6
+ }
7
+ function readsLikeSecret(text) {
8
+ return PASSWORD_TYPE.test(text) || SECRET_FIELD.test(words(text));
9
+ }
10
+ function targetWords(target) {
11
+ const texts = [];
12
+ for (const method of target.methods) {
13
+ switch (method.kind) {
14
+ case "role":
15
+ case "fuzzy":
16
+ texts.push(method.name);
17
+ break;
18
+ case "css":
19
+ texts.push(method.selector);
20
+ break;
21
+ case "testId":
22
+ texts.push(method.value);
23
+ break;
24
+ case "xpath":
25
+ texts.push(method.xpath);
26
+ break;
27
+ case "anchor":
28
+ texts.push(method.anchor.kind === "text" ? method.anchor.text : method.anchor.name);
29
+ break;
30
+ case "text":
31
+ case "ocr":
32
+ texts.push(method.text);
33
+ break;
34
+ case "uia":
35
+ case "ax":
36
+ case "atspi":
37
+ for (const node of method.path) {
38
+ if (node.name !== undefined)
39
+ texts.push(node.name);
40
+ if (node.automationId !== undefined)
41
+ texts.push(node.automationId);
42
+ }
43
+ break;
44
+ default:
45
+ break;
46
+ }
47
+ }
48
+ return texts;
49
+ }
50
+ function looksLikeSecretField(target, elementName) {
51
+ if (elementName !== undefined && readsLikeSecret(elementName))
52
+ return true;
53
+ return target !== undefined && targetWords(target).some(readsLikeSecret);
54
+ }
55
+
56
+ export { readsLikeSecret, looksLikeSecretField };
@@ -0,0 +1,64 @@
1
+ import {
2
+ clip2
3
+ } from "./index-z2v8prer.js";
4
+ import {
5
+ REDACTED2,
6
+ containsCredential,
7
+ decodeUriText,
8
+ containsCredentialInUrl
9
+ } from "./index-mgztm37r.js";
10
+
11
+ // src/target/snapshot-url.ts
12
+ var MAX_URL_TEXT = 500;
13
+ var RESET_SEGMENT = /reset|recover|verify|verification|magic|confirm|activate|invite|unsubscribe/i;
14
+ function decodeSegment(segment) {
15
+ let current = segment;
16
+ for (let round = 0;round < 3; round += 1) {
17
+ const next = decodeUriText(current);
18
+ if (next === current)
19
+ break;
20
+ current = next;
21
+ }
22
+ return current;
23
+ }
24
+ function resetPrefix(decoded) {
25
+ const parts = decoded.split(/[/?#;]/);
26
+ const index = parts.findIndex((part) => RESET_SEGMENT.test(part));
27
+ const kept = parts.slice(0, index + 1).map((part) => containsCredential(part) ? REDACTED2 : part);
28
+ return kept.join("/");
29
+ }
30
+ function snapshotUrl2(raw) {
31
+ const value = raw.trim();
32
+ if (value === "")
33
+ return null;
34
+ const absolute = /^[a-z][a-z0-9+.-]*:/i.test(value) || value.startsWith("//");
35
+ let origin = "";
36
+ let path;
37
+ if (absolute) {
38
+ let url;
39
+ try {
40
+ url = new URL(value.startsWith("//") ? `https:${value}` : value);
41
+ } catch {
42
+ return null;
43
+ }
44
+ if (url.protocol !== "http:" && url.protocol !== "https:")
45
+ return null;
46
+ origin = value.startsWith("//") ? `//${url.host}` : url.origin;
47
+ path = url.pathname;
48
+ } else {
49
+ path = value.split(/[?#]/)[0] ?? "";
50
+ }
51
+ const segments = path.split("/");
52
+ const decoded = segments.map(decodeSegment);
53
+ const reset = decoded.findIndex((segment) => RESET_SEGMENT.test(segment));
54
+ const kept = reset >= 0 ? segments.slice(0, reset + 1) : segments;
55
+ const cleaned = kept.map((segment, index) => {
56
+ const plain = decoded[index] ?? segment;
57
+ if (index === reset)
58
+ return resetPrefix(plain);
59
+ return containsCredential(plain) || containsCredentialInUrl(segment) ? REDACTED2 : segment;
60
+ }).join("/");
61
+ return clip2(`${origin}${cleaned}`, MAX_URL_TEXT);
62
+ }
63
+
64
+ export { snapshotUrl2 };