@burdenoff/ui-engine 2026.1127.5 → 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.
Files changed (57) hide show
  1. package/README.md +42 -4
  2. package/dist/analyze/messages.d.ts +7 -0
  3. package/dist/analyze/rules/heal-consequential.d.ts +2 -0
  4. package/dist/analyze/rules/popup-handler-loop.d.ts +2 -0
  5. package/dist/analyze/types.d.ts +24 -1
  6. package/dist/analyze.js +1 -1
  7. package/dist/dom-runtime.iife.js +1 -1
  8. package/dist/dom-runtime.js +2 -2
  9. package/dist/drivers.js +9 -7
  10. package/dist/heal/answer.d.ts +26 -0
  11. package/dist/heal/consequence.d.ts +74 -0
  12. package/dist/heal/index.d.ts +19 -0
  13. package/dist/heal/modes.d.ts +25 -0
  14. package/dist/heal/popup-limits.d.ts +11 -0
  15. package/dist/heal/popup.d.ts +48 -0
  16. package/dist/heal/question.d.ts +41 -0
  17. package/dist/heal/target-from-node.d.ts +9 -0
  18. package/dist/heal/types.d.ts +134 -0
  19. package/dist/heal/verify-rules.d.ts +19 -0
  20. package/dist/heal/verify.d.ts +52 -0
  21. package/dist/heal.d.ts +2 -0
  22. package/dist/heal.js +106 -0
  23. package/dist/index-20bbwwc9.js +37 -0
  24. package/dist/{index-xner4tgb.js → index-2g060ryg.js} +2 -2
  25. package/dist/index-6h7ah1dw.js +328 -0
  26. package/dist/{index-8w0f6rsz.js → index-6kva2gvd.js} +3 -3
  27. package/dist/{index-ct2xctrq.js → index-70vm0qz8.js} +2 -2
  28. package/dist/{index-21hvbvx1.js → index-8w31tpfq.js} +21 -8
  29. package/dist/{index-r2a9rftv.js → index-eff47v1g.js} +424 -17
  30. package/dist/{index-9s5nphx0.js → index-hw5npwsv.js} +1 -37
  31. package/dist/{index-ycs2bz1a.js → index-mhv6a02p.js} +11 -166
  32. package/dist/index-p5823rpv.js +0 -0
  33. package/dist/{index-5k26keah.js → index-qg9yfr7r.js} +16 -67
  34. package/dist/{index-c88tvyj1.js → index-qmv3ar39.js} +1 -1
  35. package/dist/index-t55wvhvh.js +229 -0
  36. package/dist/{index-77pcz6n3.js → index-vnv9tp11.js} +4 -2
  37. package/dist/index-w9jc25y9.js +306 -0
  38. package/dist/{index-s7qdecev.js → index-xdtanv9b.js} +358 -4
  39. package/dist/{index-vg8r40y7.js → index-yc0jgph6.js} +7 -0
  40. package/dist/index-zhbwhdya.js +407 -0
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.js +125 -23
  43. package/dist/interpret/driver.d.ts +14 -0
  44. package/dist/interpret/errors.d.ts +11 -2
  45. package/dist/interpret/events.d.ts +4 -0
  46. package/dist/interpret/run.d.ts +33 -0
  47. package/dist/interpret.js +5 -4
  48. package/dist/script.js +10 -8
  49. package/dist/target/index.d.ts +2 -0
  50. package/dist/target/roles.d.ts +11 -0
  51. package/dist/target/snapshot-mask.d.ts +49 -0
  52. package/dist/target/snapshot-tree.d.ts +65 -0
  53. package/dist/target/snapshot-url.d.ts +6 -0
  54. package/dist/target/snapshot.d.ts +1 -6
  55. package/dist/target.js +55 -13
  56. package/dist/testing.js +2 -2
  57. package/package.json +7 -3
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  UI_EXPRESSION_ARITY2,
50
50
  parseUiScript2,
51
51
  safeParseUiScript2
52
- } from "./index-c88tvyj1.js";
52
+ } from "./index-qmv3ar39.js";
53
53
  import {
54
54
  UI_SCRIPT_SCHEMA_HASH2,
55
55
  schemaHashOf2,
@@ -62,7 +62,25 @@ import {
62
62
  fromRemoteBrowserSteps2,
63
63
  fromRecording2,
64
64
  toRecording2
65
- } from "./index-xner4tgb.js";
65
+ } from "./index-2g060ryg.js";
66
+ import {
67
+ UI_HEAL_MODES2,
68
+ UI_HEAL_MODE_RANK2,
69
+ UI_CONSEQUENCES2,
70
+ UI_HEAL_FAILURE_CODES2,
71
+ UI_HEAL_CHECK_REASONS2,
72
+ parseHealMode2,
73
+ capHealMode2,
74
+ decideHeal2,
75
+ POPUP_HANDLER_ACTIONS2,
76
+ popupHandlerScript2,
77
+ parseUiPopupHandler2,
78
+ analyzeUiPopupHandler2,
79
+ usablePopupHandlers2,
80
+ matchesUrlPattern2,
81
+ HEAL_POSITION_TOLERANCE_PX2,
82
+ verifyHealCandidate2
83
+ } from "./index-w9jc25y9.js";
66
84
  import {
67
85
  MAX_CALL_DEPTH2,
68
86
  COMPILED_NAME_PREFIX2,
@@ -70,20 +88,16 @@ import {
70
88
  stripBreakpoints2,
71
89
  inlineCalls2,
72
90
  compileUiScript2
73
- } from "./index-8w0f6rsz.js";
91
+ } from "./index-6kva2gvd.js";
74
92
  import {
75
- stepNumber2,
76
- UI_SCRIPT_PROBLEM_KEY_PREFIX2,
77
- UI_SCRIPT_PROBLEM_MESSAGES2,
78
- problemMessageKey2,
79
- problemMessage2,
80
- UI_ANALYZER_RULES2,
81
- UI_PROBLEM_SEVERITIES2,
82
- UI_ANALYZER_RULE_GROUPS2,
83
- UI_ANALYZER_RULE_IDS2,
84
- UI_ANALYZER_DEFAULT_SEVERITY2,
85
- analyzeUiScript2
86
- } from "./index-s7qdecev.js";
93
+ MAX_HEAL_QUESTION_NODES2,
94
+ MAX_HEAL_NODE_NAME2,
95
+ HEAL_SYSTEM_PROMPT2,
96
+ buildHealQuestion2,
97
+ targetFromSnapshotNode2,
98
+ MAX_HEAL_ANSWER_LENGTH2,
99
+ parseHealAnswer2
100
+ } from "./index-6h7ah1dw.js";
87
101
  import {
88
102
  MAX_VALUE_TEXT2,
89
103
  MAX_VALUE_ITEMS2,
@@ -106,7 +120,35 @@ import {
106
120
  MAX_PAGE_TEXT2,
107
121
  DEFAULT_LIST_ITEMS2,
108
122
  runUiScript2
109
- } from "./index-r2a9rftv.js";
123
+ } from "./index-eff47v1g.js";
124
+ import {
125
+ MAX_HEAL_KEYWORDS2,
126
+ MAX_HEAL_KEYWORD_LENGTH2,
127
+ CONSEQUENCE_KEYWORDS2,
128
+ keywordWords2,
129
+ usableKeywords2,
130
+ classifyConsequence2,
131
+ elementInfoFromTarget2,
132
+ stepNumber2,
133
+ UI_SCRIPT_PROBLEM_KEY_PREFIX2,
134
+ UI_SCRIPT_PROBLEM_MESSAGES2,
135
+ problemMessageKey2,
136
+ problemMessage2,
137
+ HEALABLE_ACTIONS2,
138
+ compatibleRoles2,
139
+ VALUE_ACTIONS2,
140
+ MAX_POPUP_HANDLERS_PER_STEP2,
141
+ MAX_POPUP_HANDLERS_PER_APPLICATION2,
142
+ MAX_POPUP_HANDLER_STEPS2,
143
+ MAX_POPUP_URL_PATTERN2,
144
+ POPUP_HANDLER_STEP_WAIT_MS2,
145
+ UI_ANALYZER_RULES2,
146
+ UI_PROBLEM_SEVERITIES2,
147
+ UI_ANALYZER_RULE_GROUPS2,
148
+ UI_ANALYZER_RULE_IDS2,
149
+ UI_ANALYZER_DEFAULT_SEVERITY2,
150
+ analyzeUiScript2
151
+ } from "./index-xdtanv9b.js";
110
152
  import {
111
153
  UI_ERROR_FAMILIES2,
112
154
  UI_ERROR_CODES2,
@@ -118,7 +160,7 @@ import {
118
160
  UiDriverError2,
119
161
  realClock2,
120
162
  createVirtualClock2
121
- } from "./index-vg8r40y7.js";
163
+ } from "./index-yc0jgph6.js";
122
164
  import {
123
165
  UI_SCRIPT_STEP_KEY_PREFIX2,
124
166
  UI_SCRIPT_STEP_MESSAGES2,
@@ -127,6 +169,12 @@ import {
127
169
  describeExpression2,
128
170
  describeStep2
129
171
  } from "./index-gvavb597.js";
172
+ import {
173
+ CAPABILITY_IDS2,
174
+ SCRIPT_CAPABILITY2,
175
+ requiredCapabilities2,
176
+ missingCapabilities2
177
+ } from "./index-hw5npwsv.js";
130
178
  import {
131
179
  UI_SCRIPT_VERSION2,
132
180
  MAX_SCRIPT_STEPS2,
@@ -159,12 +207,8 @@ import {
159
207
  LEGACY_MAX_BROWSER_STEPS2,
160
208
  LEGACY_MAX_STEPS_BYTES2,
161
209
  LEGACY_MAX_STEP_TIMEOUT_MS2,
162
- jsonByteLength2,
163
- CAPABILITY_IDS2,
164
- SCRIPT_CAPABILITY2,
165
- requiredCapabilities2,
166
- missingCapabilities2
167
- } from "./index-9s5nphx0.js";
210
+ jsonByteLength2
211
+ } from "./index-20bbwwc9.js";
168
212
  import {
169
213
  UI_EXPRESSION_OPS2,
170
214
  UI_ANCHOR_RELATIONS2,
@@ -182,6 +226,17 @@ import {
182
226
  stepExpressions2,
183
227
  visitExpression2
184
228
  } from "./index-g7724awk.js";
229
+ import {
230
+ SNAPSHOT_ROOT_PATH2,
231
+ MAX_SNAPSHOT_PATH_LENGTH2,
232
+ isSnapshotPath2,
233
+ walkSnapshot2,
234
+ snapshotNodeAt2,
235
+ indexSnapshot2,
236
+ MASKED_MARKER2,
237
+ MAX_MASKED_PATHS2,
238
+ maskSnapshot2
239
+ } from "./index-zhbwhdya.js";
185
240
  import {
186
241
  REDACTED2,
187
242
  redactCredentials2
@@ -190,6 +245,7 @@ export {
190
245
  BROWSER_STEP_ACTIONS2 as BROWSER_STEP_ACTIONS,
191
246
  CAPABILITY_IDS2 as CAPABILITY_IDS,
192
247
  COMPILED_NAME_PREFIX2 as COMPILED_NAME_PREFIX,
248
+ CONSEQUENCE_KEYWORDS2 as CONSEQUENCE_KEYWORDS,
193
249
  DEFAULT_FIRST_WAIT_MS2 as DEFAULT_FIRST_WAIT_MS,
194
250
  DEFAULT_LIST_ITEMS2 as DEFAULT_LIST_ITEMS,
195
251
  DEFAULT_MAX_EVENTS2 as DEFAULT_MAX_EVENTS,
@@ -197,9 +253,13 @@ export {
197
253
  DEFAULT_RETRY_DELAY_MS2 as DEFAULT_RETRY_DELAY_MS,
198
254
  DEFAULT_WAIT_MS2 as DEFAULT_WAIT_MS,
199
255
  ELEMENT_KEY_PATTERN2 as ELEMENT_KEY_PATTERN,
256
+ HEALABLE_ACTIONS2 as HEALABLE_ACTIONS,
257
+ HEAL_POSITION_TOLERANCE_PX2 as HEAL_POSITION_TOLERANCE_PX,
258
+ HEAL_SYSTEM_PROMPT2 as HEAL_SYSTEM_PROMPT,
200
259
  LEGACY_MAX_BROWSER_STEPS2 as LEGACY_MAX_BROWSER_STEPS,
201
260
  LEGACY_MAX_STEPS_BYTES2 as LEGACY_MAX_STEPS_BYTES,
202
261
  LEGACY_MAX_STEP_TIMEOUT_MS2 as LEGACY_MAX_STEP_TIMEOUT_MS,
262
+ MASKED_MARKER2 as MASKED_MARKER,
203
263
  MAX_CALL_DEPTH2 as MAX_CALL_DEPTH,
204
264
  MAX_DELAY_MS2 as MAX_DELAY_MS,
205
265
  MAX_EVENTS_LIMIT2 as MAX_EVENTS_LIMIT,
@@ -209,15 +269,25 @@ export {
209
269
  MAX_EXTRACT_FIELDS2 as MAX_EXTRACT_FIELDS,
210
270
  MAX_FLOW_DEPTH2 as MAX_FLOW_DEPTH,
211
271
  MAX_FRAME_DEPTH2 as MAX_FRAME_DEPTH,
272
+ MAX_HEAL_ANSWER_LENGTH2 as MAX_HEAL_ANSWER_LENGTH,
273
+ MAX_HEAL_KEYWORDS2 as MAX_HEAL_KEYWORDS,
274
+ MAX_HEAL_KEYWORD_LENGTH2 as MAX_HEAL_KEYWORD_LENGTH,
275
+ MAX_HEAL_NODE_NAME2 as MAX_HEAL_NODE_NAME,
276
+ MAX_HEAL_QUESTION_NODES2 as MAX_HEAL_QUESTION_NODES,
212
277
  MAX_INTENT_LENGTH2 as MAX_INTENT_LENGTH,
213
278
  MAX_KEYS2 as MAX_KEYS,
214
279
  MAX_LABEL_LENGTH2 as MAX_LABEL_LENGTH,
215
280
  MAX_LIST_ITEMS2 as MAX_LIST_ITEMS,
216
281
  MAX_LIST_PAGES2 as MAX_LIST_PAGES,
217
282
  MAX_LOOP_ITERATIONS2 as MAX_LOOP_ITERATIONS,
283
+ MAX_MASKED_PATHS2 as MAX_MASKED_PATHS,
218
284
  MAX_NAME_LENGTH2 as MAX_NAME_LENGTH,
219
285
  MAX_OPERATOR_ARGS2 as MAX_OPERATOR_ARGS,
220
286
  MAX_PAGE_TEXT2 as MAX_PAGE_TEXT,
287
+ MAX_POPUP_HANDLERS_PER_APPLICATION2 as MAX_POPUP_HANDLERS_PER_APPLICATION,
288
+ MAX_POPUP_HANDLERS_PER_STEP2 as MAX_POPUP_HANDLERS_PER_STEP,
289
+ MAX_POPUP_HANDLER_STEPS2 as MAX_POPUP_HANDLER_STEPS,
290
+ MAX_POPUP_URL_PATTERN2 as MAX_POPUP_URL_PATTERN,
221
291
  MAX_RECORDED_STEPS2 as MAX_RECORDED_STEPS,
222
292
  MAX_RETRY_ATTEMPTS2 as MAX_RETRY_ATTEMPTS,
223
293
  MAX_SCRIPT_BYTES2 as MAX_SCRIPT_BYTES,
@@ -229,6 +299,7 @@ export {
229
299
  MAX_SELECTOR_LENGTH2 as MAX_SELECTOR_LENGTH,
230
300
  MAX_SELECT_VALUES2 as MAX_SELECT_VALUES,
231
301
  MAX_SNAPSHOT_NODES2 as MAX_SNAPSHOT_NODES,
302
+ MAX_SNAPSHOT_PATH_LENGTH2 as MAX_SNAPSHOT_PATH_LENGTH,
232
303
  MAX_STEP_LOG_ENTRIES2 as MAX_STEP_LOG_ENTRIES,
233
304
  MAX_STEP_TIMEOUT_MS2 as MAX_STEP_TIMEOUT_MS,
234
305
  MAX_TARGET_METHODS2 as MAX_TARGET_METHODS,
@@ -237,6 +308,8 @@ export {
237
308
  MAX_VALUE_ITEMS2 as MAX_VALUE_ITEMS,
238
309
  MAX_VALUE_TEXT2 as MAX_VALUE_TEXT,
239
310
  NAME_PATTERN2 as NAME_PATTERN,
311
+ POPUP_HANDLER_ACTIONS2 as POPUP_HANDLER_ACTIONS,
312
+ POPUP_HANDLER_STEP_WAIT_MS2 as POPUP_HANDLER_STEP_WAIT_MS,
240
313
  RECORDING_ACTION_OF2 as RECORDING_ACTION_OF,
241
314
  RECORDING_VERSION2 as RECORDING_VERSION,
242
315
  REDACTED2 as REDACTED,
@@ -244,12 +317,14 @@ export {
244
317
  RecordingError2 as RecordingError,
245
318
  SAVED_STEP_AUTHORS2 as SAVED_STEP_AUTHORS,
246
319
  SCRIPT_CAPABILITY2 as SCRIPT_CAPABILITY,
320
+ SNAPSHOT_ROOT_PATH2 as SNAPSHOT_ROOT_PATH,
247
321
  STEP_ID_PATTERN2 as STEP_ID_PATTERN,
248
322
  UI_ANALYZER_DEFAULT_SEVERITY2 as UI_ANALYZER_DEFAULT_SEVERITY,
249
323
  UI_ANALYZER_RULES2 as UI_ANALYZER_RULES,
250
324
  UI_ANALYZER_RULE_GROUPS2 as UI_ANALYZER_RULE_GROUPS,
251
325
  UI_ANALYZER_RULE_IDS2 as UI_ANALYZER_RULE_IDS,
252
326
  UI_ANCHOR_RELATIONS2 as UI_ANCHOR_RELATIONS,
327
+ UI_CONSEQUENCES2 as UI_CONSEQUENCES,
253
328
  UI_DESKTOP_ACTIONS2 as UI_DESKTOP_ACTIONS,
254
329
  UI_ERROR_CODES2 as UI_ERROR_CODES,
255
330
  UI_ERROR_CODE_LIST2 as UI_ERROR_CODE_LIST,
@@ -257,6 +332,10 @@ export {
257
332
  UI_EXPRESSION_ARITY2 as UI_EXPRESSION_ARITY,
258
333
  UI_EXPRESSION_OPS2 as UI_EXPRESSION_OPS,
259
334
  UI_FLOW_ACTIONS2 as UI_FLOW_ACTIONS,
335
+ UI_HEAL_CHECK_REASONS2 as UI_HEAL_CHECK_REASONS,
336
+ UI_HEAL_FAILURE_CODES2 as UI_HEAL_FAILURE_CODES,
337
+ UI_HEAL_MODES2 as UI_HEAL_MODES,
338
+ UI_HEAL_MODE_RANK2 as UI_HEAL_MODE_RANK,
260
339
  UI_PROBLEM_SEVERITIES2 as UI_PROBLEM_SEVERITIES,
261
340
  UI_RUN_EVENT_KINDS2 as UI_RUN_EVENT_KINDS,
262
341
  UI_SCRIPT_PROBLEM_KEY_PREFIX2 as UI_SCRIPT_PROBLEM_KEY_PREFIX,
@@ -273,35 +352,52 @@ export {
273
352
  UiDriverError2 as UiDriverError,
274
353
  UiRunError2 as UiRunError,
275
354
  UiScriptError2 as UiScriptError,
355
+ VALUE_ACTIONS2 as VALUE_ACTIONS,
276
356
  afterReplayCall2 as afterReplayCall,
357
+ analyzeUiPopupHandler2 as analyzeUiPopupHandler,
277
358
  analyzeUiScript2 as analyzeUiScript,
278
359
  applyPins2 as applyPins,
360
+ buildHealQuestion2 as buildHealQuestion,
279
361
  canonicalJson2 as canonicalJson,
362
+ capHealMode2 as capHealMode,
280
363
  captureRecording2 as captureRecording,
281
364
  childBlocks2 as childBlocks,
365
+ classifyConsequence2 as classifyConsequence,
366
+ compatibleRoles2 as compatibleRoles,
282
367
  compileUiScript2 as compileUiScript,
283
368
  countSteps2 as countSteps,
284
369
  createVirtualClock2 as createVirtualClock,
370
+ decideHeal2 as decideHeal,
285
371
  describeExpression2 as describeExpression,
286
372
  describeStep2 as describeStep,
287
373
  describeTarget2 as describeTarget,
374
+ elementInfoFromTarget2 as elementInfoFromTarget,
288
375
  errorFamilyOf2 as errorFamilyOf,
289
376
  evaluateExpression2 as evaluateExpression,
290
377
  finishFallback2 as finishFallback,
291
378
  fromBrowserActionSteps2 as fromBrowserActionSteps,
292
379
  fromRecording2 as fromRecording,
293
380
  fromRemoteBrowserSteps2 as fromRemoteBrowserSteps,
381
+ indexSnapshot2 as indexSnapshot,
294
382
  inlineCalls2 as inlineCalls,
295
383
  isRetryableInScript2 as isRetryableInScript,
296
384
  isSavedStepAuthor2 as isSavedStepAuthor,
385
+ isSnapshotPath2 as isSnapshotPath,
297
386
  isUiErrorCode2 as isUiErrorCode,
298
387
  jsonByteLength2 as jsonByteLength,
388
+ keywordWords2 as keywordWords,
299
389
  markFallbackAsked2 as markFallbackAsked,
390
+ maskSnapshot2 as maskSnapshot,
300
391
  maskUrl2 as maskUrl,
392
+ matchesUrlPattern2 as matchesUrlPattern,
301
393
  missingCapabilities2 as missingCapabilities,
394
+ parseHealAnswer2 as parseHealAnswer,
395
+ parseHealMode2 as parseHealMode,
302
396
  parseRecording2 as parseRecording,
397
+ parseUiPopupHandler2 as parseUiPopupHandler,
303
398
  parseUiScript2 as parseUiScript,
304
399
  planReplay2 as planReplay,
400
+ popupHandlerScript2 as popupHandlerScript,
305
401
  problemMessage2 as problemMessage,
306
402
  problemMessageKey2 as problemMessageKey,
307
403
  readPath2 as readPath,
@@ -320,6 +416,7 @@ export {
320
416
  safeParseUiScript2 as safeParseUiScript,
321
417
  schemaHashOf2 as schemaHashOf,
322
418
  sha256Hex2 as sha256Hex,
419
+ snapshotNodeAt2 as snapshotNodeAt,
323
420
  stepAtPath2 as stepAtPath,
324
421
  stepExpressions2 as stepExpressions,
325
422
  stepMessageKey2 as stepMessageKey,
@@ -328,6 +425,7 @@ export {
328
425
  stripBreakpoints2 as stripBreakpoints,
329
426
  targetFingerprint2 as targetFingerprint,
330
427
  targetFromPlaywrightSelector2 as targetFromPlaywrightSelector,
428
+ targetFromSnapshotNode2 as targetFromSnapshotNode,
331
429
  toBrowserActionSteps2 as toBrowserActionSteps,
332
430
  toNumber2 as toNumber,
333
431
  toRecording2 as toRecording,
@@ -343,8 +441,12 @@ export {
343
441
  uiTargetMethodSchema2 as uiTargetMethodSchema,
344
442
  uiTargetRefSchema2 as uiTargetRefSchema,
345
443
  uiTargetSchema2 as uiTargetSchema,
444
+ usableKeywords2 as usableKeywords,
445
+ usablePopupHandlers2 as usablePopupHandlers,
346
446
  valuesEqual2 as valuesEqual,
447
+ verifyHealCandidate2 as verifyHealCandidate,
347
448
  visitExpression2 as visitExpression,
449
+ walkSnapshot2 as walkSnapshot,
348
450
  walkSteps2 as walkSteps,
349
451
  withFingerprint2 as withFingerprint
350
452
  };
@@ -18,6 +18,7 @@
18
18
  import type { DomAction, DomActionProblem } from '../dom-runtime/actions.js';
19
19
  import type { DomResolution } from '../dom-runtime/runtime.js';
20
20
  import type { UiStepAction, UiTarget } from '../script/types.js';
21
+ import type { UiTreeSnapshot } from '../target/snapshot.js';
21
22
  import type { WebElementState, WebTargetErrorCode } from '../target/types.js';
22
23
  /** Where the interpreter is when it calls the driver. */
23
24
  export interface UiStepContext {
@@ -159,6 +160,19 @@ export interface UiDriver {
159
160
  target?: UiTarget;
160
161
  fullPage?: boolean;
161
162
  }, context: UiStepContext): Promise<string | null>;
163
+ /**
164
+ * The page's tree snapshot now (`serializeTreeSnapshot`), for healing (plan
165
+ * P4-06a). The interpreter masks it before it leaves the desk. Absent, or
166
+ * null, means the desk cannot heal.
167
+ */
168
+ treeSnapshot?(context: UiStepContext): Promise<UiTreeSnapshot | null>;
169
+ /**
170
+ * The origin of the document a frame chain leads to (an empty or absent
171
+ * chain is the top document), or null when the chain cannot be followed. The
172
+ * heal verifier compares origins with it; without it, only identical frame
173
+ * chains count as the same frame.
174
+ */
175
+ frameOrigin?(frame: readonly string[] | undefined, context: UiStepContext): Promise<string | null>;
162
176
  }
163
177
  /** Real time. */
164
178
  export declare const realClock: UiClock;
@@ -31,7 +31,8 @@ export interface UiErrorCodeInfo {
31
31
  /**
32
32
  * Every run-time error code, with its family. Spec 05 section 10 lists the
33
33
  * first ten; the rest are the engine's own codes for web desks, and
34
- * `INTERRUPTED` and `STOPPED_BY_USER` come from the contract (README section 7).
34
+ * `INTERRUPTED` and `STOPPED_BY_USER` come from the contract (README section 7),
35
+ * and `HEAL_APPROVAL_REQUIRED` from the phase 4 contract (README section 24).
35
36
  */
36
37
  export declare const UI_ERROR_CODES: {
37
38
  readonly ELEMENT_NOT_FOUND: {
@@ -164,6 +165,11 @@ export declare const UI_ERROR_CODES: {
164
165
  readonly preflight: false;
165
166
  readonly meaning: "A person sent STOP to a paused TEST run; the clean-up steps ran";
166
167
  };
168
+ readonly HEAL_APPROVAL_REQUIRED: {
169
+ readonly family: "DEPENDENCY";
170
+ readonly preflight: false;
171
+ readonly 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";
172
+ };
167
173
  };
168
174
  export type UiErrorCode = keyof typeof UI_ERROR_CODES;
169
175
  /** Every error code, in table order. */
@@ -172,7 +178,10 @@ export declare const UI_ERROR_CODE_LIST: UiErrorCode[];
172
178
  export declare function isUiErrorCode(value: unknown): value is UiErrorCode;
173
179
  /** The node error family of a code. */
174
180
  export declare function errorFamilyOf(code: UiErrorCode): UiErrorFamily;
175
- /** Whether a failure with this code may be retried by a step `retry` or a retry scope. */
181
+ /**
182
+ * Whether a failure with this code may be retried by a step `retry` or a retry
183
+ * scope. A heal that needs a person's approval is never retried: it ends the run.
184
+ */
176
185
  export declare function isRetryableInScript(code: UiErrorCode): boolean;
177
186
  /** Detail a failure carries: what was looked for and what was found. Plain JSON, never typed values or secrets. */
178
187
  export type UiErrorDetail = Readonly<Record<string, unknown>>;
@@ -55,6 +55,10 @@ export interface UiStepLogEntry {
55
55
  screenshotFileId?: string;
56
56
  /** The short error code of a failed step. */
57
57
  error?: UiErrorCode;
58
+ /** The step passed on a target healing found (plan P4-06a). */
59
+ healed?: boolean;
60
+ /** The pop-up handler that cleared the way before the step passed. */
61
+ popupHandlerId?: string;
58
62
  }
59
63
  /** Numbers, stamps and caps events, and delivers them in order. */
60
64
  export declare class EventEmitter {
@@ -1,3 +1,6 @@
1
+ import { type UiPopupHandler } from '../heal/popup.js';
2
+ import { type UiHealHook, type UiHealReport, type UiHealSettings } from '../heal/types.js';
3
+ import type { UiTarget } from '../script/types.js';
1
4
  import { type UiDriver } from './driver.js';
2
5
  import { type UiErrorCode, type UiErrorFamily } from './errors.js';
3
6
  import { type UiRunEvent, type UiStepLogEntry } from './events.js';
@@ -44,6 +47,26 @@ export interface RunUiScriptOptions {
44
47
  pollIntervalMs?: number;
45
48
  /** Skip the clean-up steps after a cancel (a worker shutting down). Absent means they run. */
46
49
  skipCleanupOnCancel?: boolean;
50
+ /**
51
+ * Heals a step whose own target is not found or ambiguous (plan P4-06a).
52
+ * Called at most once per step id per run, after the step's retries and
53
+ * pop-up handlers, with the masked snapshot. Absent means no healing.
54
+ */
55
+ onTargetNotFound?: UiHealHook;
56
+ /** The node's and workspace's healing settings: always-ask step ids, keyword phrases, extra masked paths. */
57
+ healing?: UiHealSettings;
58
+ /**
59
+ * Pop-up handlers of the application (`workerResolveUiAssets.popupHandlers`).
60
+ * Each is parsed and checked by the `popupHandlerLoop` rule; a handler that
61
+ * fails is not used and is reported in a LOG event. At most 50 are used.
62
+ */
63
+ popupHandlers?: readonly UiPopupHandler[];
64
+ /**
65
+ * Targets that replace steps' own targets, by step id (an approved heal's
66
+ * rerun, D-P4-11). Each must be a valid target of a step healing repairs;
67
+ * otherwise the run fails with INVALID_SCRIPT before any step runs.
68
+ */
69
+ targetOverrides?: Readonly<Record<string, UiTarget>>;
47
70
  }
48
71
  /** Why a run did not succeed. */
49
72
  export interface UiRunFailure {
@@ -52,6 +75,15 @@ export interface UiRunFailure {
52
75
  message: string;
53
76
  stepPath?: string;
54
77
  stepId?: string;
78
+ /** What healing did for the failed step, when it was asked (plan P4-06a). */
79
+ heal?: UiHealReport;
80
+ }
81
+ /** The repairs of a run (plan P4-06a); in the result only when there was one. */
82
+ export interface UiRunRepairs {
83
+ /** Steps (distinct step ids) that passed on a healed target. */
84
+ healed: number;
85
+ /** Pop-up handlers that ran and let a step pass. */
86
+ popupsHandled: number;
55
87
  }
56
88
  export interface UiRunResult {
57
89
  status: 'succeeded' | 'failed' | 'cancelled' | 'stopped';
@@ -72,6 +104,7 @@ export interface UiRunResult {
72
104
  truncated: boolean;
73
105
  };
74
106
  durationMs: number;
107
+ repairs?: UiRunRepairs;
75
108
  }
76
109
  /** Run a UI script on a desk. Never throws for a script problem: the result carries it. */
77
110
  export declare function runUiScript(script: unknown, driver: UiDriver, options?: RunUiScriptOptions): Promise<UiRunResult>;
package/dist/interpret.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import"./index-cs6acyjn.js";
2
- import"./index-c88tvyj1.js";
2
+ import"./index-qmv3ar39.js";
3
+ import"./index-w9jc25y9.js";
3
4
  import {
4
5
  MAX_CALL_DEPTH2,
5
6
  COMPILED_NAME_PREFIX2,
@@ -7,7 +8,7 @@ import {
7
8
  stripBreakpoints2,
8
9
  inlineCalls2,
9
10
  compileUiScript2
10
- } from "./index-8w0f6rsz.js";
11
+ } from "./index-6kva2gvd.js";
11
12
  import {
12
13
  MAX_VALUE_TEXT2,
13
14
  MAX_VALUE_ITEMS2,
@@ -30,7 +31,7 @@ import {
30
31
  MAX_PAGE_TEXT2,
31
32
  DEFAULT_LIST_ITEMS2,
32
33
  runUiScript2
33
- } from "./index-r2a9rftv.js";
34
+ } from "./index-eff47v1g.js";
34
35
  import {
35
36
  UI_ERROR_FAMILIES2,
36
37
  UI_ERROR_CODES2,
@@ -42,7 +43,7 @@ import {
42
43
  UiDriverError2,
43
44
  realClock2,
44
45
  createVirtualClock2
45
- } from "./index-vg8r40y7.js";
46
+ } from "./index-yc0jgph6.js";
46
47
  export {
47
48
  COMPILED_NAME_PREFIX2 as COMPILED_NAME_PREFIX,
48
49
  DEFAULT_FIRST_WAIT_MS2 as DEFAULT_FIRST_WAIT_MS,
package/dist/script.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  UI_EXPRESSION_ARITY2,
18
18
  parseUiScript2,
19
19
  safeParseUiScript2
20
- } from "./index-c88tvyj1.js";
20
+ } from "./index-qmv3ar39.js";
21
21
  import"./index-cs6acyjn.js";
22
22
  import {
23
23
  UI_SCRIPT_SCHEMA_HASH2,
@@ -31,7 +31,7 @@ import {
31
31
  fromRemoteBrowserSteps2,
32
32
  fromRecording2,
33
33
  toRecording2
34
- } from "./index-xner4tgb.js";
34
+ } from "./index-2g060ryg.js";
35
35
  import {
36
36
  UI_SCRIPT_STEP_KEY_PREFIX2,
37
37
  UI_SCRIPT_STEP_MESSAGES2,
@@ -40,6 +40,12 @@ import {
40
40
  describeExpression2,
41
41
  describeStep2
42
42
  } from "./index-gvavb597.js";
43
+ import {
44
+ CAPABILITY_IDS2,
45
+ SCRIPT_CAPABILITY2,
46
+ requiredCapabilities2,
47
+ missingCapabilities2
48
+ } from "./index-hw5npwsv.js";
43
49
  import {
44
50
  UI_SCRIPT_VERSION2,
45
51
  MAX_SCRIPT_STEPS2,
@@ -72,12 +78,8 @@ import {
72
78
  LEGACY_MAX_BROWSER_STEPS2,
73
79
  LEGACY_MAX_STEPS_BYTES2,
74
80
  LEGACY_MAX_STEP_TIMEOUT_MS2,
75
- jsonByteLength2,
76
- CAPABILITY_IDS2,
77
- SCRIPT_CAPABILITY2,
78
- requiredCapabilities2,
79
- missingCapabilities2
80
- } from "./index-9s5nphx0.js";
81
+ jsonByteLength2
82
+ } from "./index-20bbwwc9.js";
81
83
  import {
82
84
  UI_EXPRESSION_OPS2,
83
85
  UI_ANCHOR_RELATIONS2,
@@ -11,3 +11,5 @@ export { type ElementStateProbe, SENSITIVE_MARKERS, type WebSearchRoot, elementR
11
11
  export { ANCHOR_MARGIN_PX, DEFAULT_FUZZY_THRESHOLD, FUZZY_MARGIN, INTERACTIVE_ROLES, MAX_XPATH_RESULTS, type MethodMatch, type ScoredElement, matchMethod, relationDistance, } from './methods.js';
12
12
  export { type ResolveWebTargetOptions, type WebFrameEntry, type WebTargetMatches, describeCandidate, enterFrames, resolveAllWebTargets, resolveWebTarget, } from './resolve.js';
13
13
  export { DEFAULT_SNAPSHOT_MAX_NODES, type HydratedSnapshot, MAX_SNAPSHOT_DEPTH, MAX_SNAPSHOT_TEXT, type SerializeTreeSnapshotOptions, UI_TREE_SNAPSHOT_VERSION, type UiTreeSnapshot, type UiTreeSnapshotChild, type UiTreeSnapshotNode, hydrateTreeSnapshot, serializeTreeSnapshot, snapshotUrl, } from './snapshot.js';
14
+ export { MASKED_MARKER, MAX_MASKED_PATHS, type MaskSnapshotOptions, type MaskedSnapshot, maskSnapshot, } from './snapshot-mask.js';
15
+ export { MAX_SNAPSHOT_NAME, MAX_SNAPSHOT_PATH_LENGTH, MAX_SNAPSHOT_WALK, SNAPSHOT_ROOT_PATH, type SnapshotEdge, type SnapshotEntry, type SnapshotIndex, attributeOf, indexSnapshot, isSensitiveSnapshotEntry, isSnapshotEditingHost, isSnapshotPath, snapshotFrameDepth, snapshotHosts, snapshotName, snapshotNodeAt, snapshotRole, snapshotText, walkSnapshot, } from './snapshot-tree.js';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Implicit ARIA roles by tag and input type, and the roles that take their
3
+ * name from their content (WAI-ARIA 1.2, accname 1.2 step 2F). Pure tables
4
+ * with no DOM use, shared by the DOM role computation (`aria.ts`) and the
5
+ * snapshot role computation the heal question uses (`snapshot-tree.ts`), so
6
+ * both report the same role for the same element.
7
+ */
8
+ export declare const INPUT_ROLES: Record<string, string>;
9
+ export declare const TAG_ROLES: Record<string, string>;
10
+ /** Roles whose accessible name comes from their content (accname step 2F). */
11
+ export declare const NAME_FROM_CONTENT: Set<string>;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * `maskSnapshot` (plan P4-06a, threat R1 of document 24): the copy of a tree
3
+ * snapshot that may leave the desk for healing.
4
+ *
5
+ * A snapshot already holds no form values (`serializeTreeSnapshot`), but it
6
+ * keeps the visible text of the page. Before a heal sends the tree to the
7
+ * service (and from there, masked again, to a model), every element that is
8
+ * masked loses its words and keeps only what places it on the page:
9
+ *
10
+ * - elements named in `maskedPaths` (a desk or a person marked them), and
11
+ * with `sensitive` (the default), every password, one-time-code, card or
12
+ * secret field, anything inside such a field, and anything marked
13
+ * sensitive (`data-fg-sensitive`, `data-sensitive`, `data-private`);
14
+ * - a masked element keeps its tag, bounds, hidden flag and identifying
15
+ * attributes (role, type, id, name, test ids, structural ARIA); it loses
16
+ * its texts (each becomes an empty text, so node paths do not move), its descriptive attributes (labels, titles, placeholders,
17
+ * alt, value, href and free-text ARIA), and so do all its descendants,
18
+ * shadow content and frames included; it gains `data-fg-sensitive` so a
19
+ * later reader (the heal question, a hydrated replay) treats it as sensitive;
20
+ * - the bounds of every outermost masked element are returned as
21
+ * `screenshotMask`, in the top page's coordinates (an element inside a
22
+ * frame is moved by its frame's position; frame borders are not added),
23
+ * for the desk to paint over the screenshot before it uploads it (the
24
+ * worker and the extension do the painting).
25
+ *
26
+ * The input is never changed. Pure: no DOM is needed.
27
+ */
28
+ import type { UiTreeSnapshot } from './snapshot.js';
29
+ import type { WebRect } from './types.js';
30
+ /** The marker a masked element gains. */
31
+ export declare const MASKED_MARKER = "data-fg-sensitive";
32
+ /** Most paths `maskedPaths` may name; more are ignored. */
33
+ export declare const MAX_MASKED_PATHS = 1000;
34
+ export interface MaskSnapshotOptions {
35
+ /** Node paths to mask, with everything inside them. Paths that are not valid or name no element are ignored. */
36
+ maskedPaths?: readonly string[];
37
+ /** Also mask sensitive elements and secret fields. Absent means true. */
38
+ sensitive?: boolean;
39
+ }
40
+ export interface MaskedSnapshot {
41
+ /** The masked copy. */
42
+ snapshot: UiTreeSnapshot;
43
+ /** The paths of the outermost masked elements, in document order. */
44
+ maskedPaths: string[];
45
+ /** The bounds of the outermost masked elements that have bounds: the rectangles to paint over a screenshot. */
46
+ screenshotMask: WebRect[];
47
+ }
48
+ /** Mask a snapshot for healing. See the module comment for what is masked and what is kept. */
49
+ export declare function maskSnapshot(snapshot: UiTreeSnapshot, options?: MaskSnapshotOptions): MaskedSnapshot;
@@ -0,0 +1,65 @@
1
+ import type { UiTreeSnapshot, UiTreeSnapshotNode } from './snapshot.js';
2
+ /** The path of the root element. */
3
+ export declare const SNAPSHOT_ROOT_PATH = "/";
4
+ /** Longest node path accepted. */
5
+ export declare const MAX_SNAPSHOT_PATH_LENGTH = 1024;
6
+ /** Most elements a walk visits; a snapshot holds at most 5,000 nodes by default. */
7
+ export declare const MAX_SNAPSHOT_WALK = 100000;
8
+ /** Longest name or text the snapshot readers return. */
9
+ export declare const MAX_SNAPSHOT_NAME = 200;
10
+ /** How an element was reached from its parent: as a child, a shadow child, or a frame's document element. */
11
+ export type SnapshotEdge = 'root' | 'c' | 's' | 'f';
12
+ /** One element of a snapshot, with where it sits. */
13
+ export interface SnapshotEntry {
14
+ node: UiTreeSnapshotNode;
15
+ path: string;
16
+ edge: SnapshotEdge;
17
+ parent: SnapshotEntry | undefined;
18
+ /**
19
+ * The search root the element belongs to: `/` for the top document, the
20
+ * frame document element's path for a frame, `<host path>#shadow` for a
21
+ * shadow root. Selectors and uniqueness are judged within one scope.
22
+ */
23
+ scope: string;
24
+ /** Position in document order (the walk order). */
25
+ order: number;
26
+ }
27
+ /** True for a path of the node path grammar. */
28
+ export declare function isSnapshotPath(path: unknown): path is string;
29
+ /** Every element of a snapshot in document order: an element, its children, its shadow children, then its frame. */
30
+ export declare function walkSnapshot(snapshot: Pick<UiTreeSnapshot, 'root'>): SnapshotEntry[];
31
+ /** The element at a path, or undefined when the path is not valid or names no element. */
32
+ export declare function snapshotNodeAt(snapshot: Pick<UiTreeSnapshot, 'root'>, path: string): UiTreeSnapshotNode | undefined;
33
+ /** The value of an attribute of a snapshot element, or undefined. */
34
+ export declare function attributeOf(node: UiTreeSnapshotNode, name: string): string | undefined;
35
+ /** The element itself carries a sensitive marker. */
36
+ export declare function hasSnapshotMarker(node: UiTreeSnapshotNode): boolean;
37
+ /** The element or an ancestor (across shadow roots and frames) carries a sensitive marker. */
38
+ export declare function isMarkedInSnapshot(entry: SnapshotEntry): boolean;
39
+ /** True for an element whose own `contenteditable` makes it editable (anything but "false"). */
40
+ export declare function isSnapshotEditingHost(node: UiTreeSnapshotNode): boolean;
41
+ /**
42
+ * True when a snapshot element holds or shows data that must not leave the
43
+ * desk: a password, one-time-code, card or secret field, anything inside
44
+ * such a field, and anything marked sensitive (itself or an ancestor).
45
+ */
46
+ export declare function isSensitiveSnapshotEntry(entry: SnapshotEntry): boolean;
47
+ /** The visible text of an element: its texts and its visible descendants' (shadow content included, frames not). */
48
+ export declare function snapshotText(node: UiTreeSnapshotNode, max?: number): string;
49
+ /** The role of a snapshot element: the first token of `role`, else the implicit role, else ''. */
50
+ export declare function snapshotRole(entry: SnapshotEntry): string;
51
+ /** Index of a scope: the elements of each scope, and its ids. */
52
+ export interface SnapshotIndex {
53
+ entries: SnapshotEntry[];
54
+ byPath: Map<string, SnapshotEntry>;
55
+ /** Elements by scope, in document order. */
56
+ byScope: Map<string, SnapshotEntry[]>;
57
+ }
58
+ /** Walk a snapshot once and index it by path and by scope. */
59
+ export declare function indexSnapshot(snapshot: Pick<UiTreeSnapshot, 'root'>): SnapshotIndex;
60
+ /** The accessible name of a snapshot element, as far as a snapshot allows. Sensitive elements have no name. */
61
+ export declare function snapshotName(entry: SnapshotEntry, index: SnapshotIndex, max?: number): string;
62
+ /** The frame and shadow hosts an element sits in, outermost first (the iframe or host elements). */
63
+ export declare function snapshotHosts(entry: SnapshotEntry): SnapshotEntry[];
64
+ /** How many frames (not shadow roots) an element sits in. */
65
+ export declare function snapshotFrameDepth(entry: SnapshotEntry): number;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A URL as a snapshot keeps it: http(s) and relative URLs only, without user
3
+ * information, query or fragment, cut after a reset-style path segment, and
4
+ * with recognisable credentials replaced. Anything else is dropped (null).
5
+ */
6
+ export declare function snapshotUrl(raw: string): string | null;