@burdenoff/ui-engine 2026.1201.1 → 2026.1202.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 CHANGED
@@ -18,8 +18,8 @@ Each module is a subpath export. The root entry re-exports the data and planning
18
18
 
19
19
  | Import | What it holds |
20
20
  |---|---|
21
- | `@burdenoff/ui-engine/recording` | Recording v1 schema (`recordingSchema`, `recordedStepSchema`, `recordedTargetSchema`), `targetFingerprint`, `parseRecording`, `RecordingError`, `sha256Hex` |
22
- | `@burdenoff/ui-engine/capture` | `captureRecording` (turns recorder events into a masked recording), `maskUrl`, `redactCredentials`, `REDACTED` |
21
+ | `@burdenoff/ui-engine/recording` | Recording v1 schema (`recordingSchema`, `recordedStepSchema`, `recordedTargetSchema`), `targetFingerprint`, `parseRecording` (with the optional `{ enforceCaptureRules: true }`, see below), `RecordingError`, `sha256Hex` |
22
+ | `@burdenoff/ui-engine/capture` | `captureRecording` (turns recorder events into a masked recording), `maskUrl`, `unmaskedSecretStep` (the first step of a stored recording that holds a value capture would have masked), `redactCredentials`, `REDACTED` |
23
23
  | `@burdenoff/ui-engine/resolve` | `readSnapshotNodes` (array, `{ nodes }` or `{ elements }` snapshots), `resolveTarget` (exact role and label match, `nth` among equals) |
24
24
  | `@burdenoff/ui-engine/replay` | The pure replay planner: `replayStateFrom`, `planReplay`, `afterReplayCall`, `finishFallback`, `markFallbackAsked`, `replayReasons`, `readReplayState` |
25
25
  | `@burdenoff/ui-engine/script` | UI script v1: types, `uiScriptSchema`, `parseUiScript`, `UI_SCRIPT_SCHEMA_HASH`, `requiredCapabilities`, the adapters and `describeStep` (see below) |
@@ -60,8 +60,8 @@ A UI script is the portable form of a UI sequence that a desk runs: a paired bro
60
60
  | Function | From and to | Notes |
61
61
  |---|---|---|
62
62
  | `fromRecording`, `toRecording` | Stewards saved-step recording v1 | Lossless both ways, fingerprints included; `toRecording` returns null for a script a recording cannot express |
63
- | `fromBrowserActionSteps` | Run in Browser steps (`internal:browser-action`) | Keeps every field a 0.3.0 extension reads |
64
- | `toBrowserActionSteps` | Lowering to Run in Browser steps | Null unless the script fits the legacy contract: at most 100 steps and 256 KB, only the 14 legacy actions, one CSS selector per target (or one text for click and wait), step waits of at most 60 s (the legacy extension's cap), literal or supplied input values, no script wait or screenshot settings beyond the defaults, and no flow steps, verification, retries or breakpoints |
63
+ | `fromBrowserActionSteps` | Run in Browser steps (`internal:browser-action`) | Keeps every field a 0.3.0 extension reads, the recorder's `note` and a screenshot's `fullPage` (the builder's "Whole page" option; `toBrowserActionSteps` gives it back as the node had it, BOFF-17570) |
64
+ | `toBrowserActionSteps` | Lowering to Run in Browser steps | Null unless the script fits the legacy contract: at most 100 steps and 256 KB, only the 14 legacy actions, one CSS selector per target (or one text for click and wait), step waits of at most 60 s (the legacy extension's cap), literal or supplied input values, no script wait or screenshot settings beyond the defaults, no screenshot of a target, and no flow steps, verification, retries or breakpoints. A screenshot's `fullPage` is lowered as it is: no extension captures more than the viewport today, so legacy and script clients run it the same way |
65
65
  | `fromRemoteBrowserSteps` | Remote Browser `runSteps` (`store/remotebrowser` 1.0.0) | Playwright `css=`, `text=`, `xpath=`, `id=` and `data-testid=` selectors; other engines are refused |
66
66
  | `scriptFromComputerUseActions` | The actions an AI Step took (computer-use tool calls with the worker's `_uiTarget` fingerprints), for Save as steps | Returns `{ script, elements, skipped }` and saves nothing. See below |
67
67
 
@@ -215,13 +215,18 @@ The modules were copied from `wspace-botmanor-svc` `src/modules/stewards/teach/`
215
215
  - `captureRecording` trims labels before taking the fingerprint (the schema trims them on parse, so an untrimmed label used to fail its own fingerprint check), and removes every value it masked from the recording's other text: intents, labels, window titles and plain typed text (a plain typed text that contains one becomes a masked step). Values shorter than four characters are not searched for.
216
216
 
217
217
  - A navigation URL that holds a value masked elsewhere in the same demonstration, as written or percent-encoded, loses its query and fragment, or its path when the value is in the path.
218
- - `maskUrl` also cuts a reset-style link after its reset segment (`/reset/<token>` becomes `/reset`) and drops a path or fragment that holds a recognisable credential. The sensitive values a URL loses (user info, the values of secret-looking parameters, every query value of a reset-style link, and the path segments cut from it) are masked in the rest of the recording too, so a code from a verification link does not survive in an intent or a label.
218
+ - `maskUrl` also cuts a reset-style link after its reset segment (`/reset/<token>` becomes `/reset`) and drops a path or fragment that holds a recognisable credential. The sensitive values a URL loses (the password, the values of secret-looking parameters, values that may be a token or a code, and the path segments cut from a reset-style link) are masked in the rest of the recording too, so a code from a verification link does not survive in an intent or a label.
219
+ - A path whose last segment is a single ordinary word holding a reset stem (`/orders/confirmed`, `/team/invites`, `/settings/presets`) is not a reset-style link, so such a page keeps its query and path (BOFF-18078), as any ordinary page does (`/unsubscribed?email=…` keeps the address), unless a query or fragment value has 16 or more characters without a space (`/team/invites?invite=<uuid>`). The same word before another segment (`/invites/<token>`) or with anything else in its segment (`/invites-QWERTYAB`) still is a reset link, as are plural and joined forms (`/users/password_resets/<token>`, `/confirmations/<token>`, `/pwreset/<token>`). A kept reset segment holds only clean reset words and side words such as `password`, `email` or `accept` (`reset-password`, `verify-email`, `accept-invite`), with no digit or run of 16 or more letters; any other reset segment (`/pwreset`, `/magic-9f8e7d6c`, `/confirmabcdefghijklmnop`) is dropped too. A trailing slash after a kept reset segment stays.
220
+ - A plain-word user name, and the plain-word values of harmless parameters of a reset-style link (`lang`, `locale`, `source`, `ref`, `utm_*`, `page`, `tab` and similar, for example `?lang=english`), are removed from that URL only, not from the rest of the recording: they are not secret, and scrubbing them from every label stopped those labels resolving. A value under any other name, a value with a digit or a symbol, or one of 16 characters or more may be a token or a code and is still scrubbed everywhere.
219
221
  - `parseRecording` refuses a recording whose stored text (intent, target labels, typed text, URL, window app and title) still holds a recognisable credential, with `RecordingError` code `CREDENTIAL_IN_RECORDING`. The Stewards copy documented this check but did not perform it.
222
+ - `parseRecording(value, { enforceCaptureRules: true })` also refuses, with `CREDENTIAL_IN_RECORDING`, a step that holds a value capture would have masked: a code-like typed value, text typed into a field whose label marks it as secret, a masked step that still carries text, a URL whose query, fragment, user info or reset-style path carries a secret, labels and window titles with a credential or a code, and intents with a credential (capture does not mask a code in an intent unless that code was typed in the demonstration, so neither does this check). Use it for every recording that did not come from `captureRecording` (an API, an import, a hand edit). The check is `unmaskedSecretStep` from `./capture`, ported from the Stewards copy at `84fe0aa` (BOFF-17096); markers already in the text are set aside, so every recording capture produces passes. The message names the step and the field, never the value. The default `parseRecording(value)` is unchanged.
220
223
 
221
224
  Recordings that capture produces, in either copy, still parse here, and the golden fingerprints are unchanged.
222
225
 
223
226
  `tests/golden/stewards-6558d8b.json` was generated by running the Stewards code itself. The golden tests prove the fingerprints and a captured recording are identical, so a recording saved by either side parses on the other.
224
227
 
228
+ `tests/golden/stewards-84fe0aa-capture-rules.json` was generated by running the Stewards `unmaskedSecretStep` (`wspace-botmanor-svc` `84fe0aa`, with the engine it pins, `2026.1127.5`). The engine's port gives the same answer on every case except the three ordinary pages that only contain a reset word (`confirmed`, `invites`, `presets`), which the engine no longer treats as reset links.
229
+
225
230
  ## Browser safety
226
231
 
227
232
  Nothing under `src/` may import a Node built-in. ESLint enforces this, `tests/browser-safe.test.ts` checks every source file, and `bun run check:browser-safe` (a `boff sanity` extra step) checks the built `dist/` for Node built-ins and for any bare import other than `zod` and `@noble/hashes`. `bun run check:runtime-size` checks that `dist/dom-runtime.iife.js` is self-contained and within its budget.
@@ -0,0 +1,75 @@
1
+ import type { RecordedStep, Recording } from './recording.js';
2
+ /** Field names and labels of password, one-time-code, card and similar fields. */
3
+ export declare const SECRET_FIELD: RegExp;
4
+ /** A typed value made only of digits (and spaces), 4 to 10 long: treated as a one-time code. */
5
+ export declare const CODE_LIKE: RegExp;
6
+ /**
7
+ * Whether a path segment names a reset-style link: one of its words holds a
8
+ * reset stem (`reset-password`, `password_resets`, `pwreset`, `accept-invite`,
9
+ * `magic-9f8e7d6c`). The one exception is an ordinary page: the last segment
10
+ * of the path (`last`) when it is a single ordinary word and nothing else
11
+ * (`confirmed`, `invites`, `presets`). Any other word in the segment could be
12
+ * a token glued to it (`invites-QWERTYAB`, `confirmed-Zx9KqP2mT7vB4nW8`), and
13
+ * before another segment an ordinary word still counts, because that segment
14
+ * can carry the token (`/invites/<token>`).
15
+ */
16
+ export declare function isResetSegment(segment: string, last?: boolean): boolean;
17
+ /**
18
+ * Replace credential-like fragments; a long digit run in a label about codes
19
+ * is masked too. Not trimmed: `cleanLabel` in `capture.ts` trims the result as
20
+ * the recording schema trims labels.
21
+ */
22
+ export declare function redactLabel(text: string): string;
23
+ /** A URL with its secret parts removed, and the raw values that were removed. */
24
+ export interface MaskedUrl {
25
+ url: string;
26
+ masked: boolean;
27
+ /**
28
+ * Sensitive values the masking removed, to be masked in the rest of the
29
+ * recording too: the password, secret-named or credential-like query and
30
+ * fragment values, and the path segments cut from a reset-style link.
31
+ */
32
+ removed: string[];
33
+ /**
34
+ * Values removed from this URL only: a plain-word user name, and the
35
+ * plain-word values of harmless query and fragment parameters of a
36
+ * reset-style link (`?lang=english`). They are not secrets, and scrubbing
37
+ * them from every label would stop those labels from resolving. Any value
38
+ * that may be a token or a code is in `removed` instead.
39
+ */
40
+ urlOnly: string[];
41
+ }
42
+ /**
43
+ * Masks a URL: user info goes; a URL that carries a secret or is a reset-style
44
+ * link loses its query and fragment; a reset-style link also loses the path
45
+ * after its reset segment, and a path that holds a recognisable credential is
46
+ * dropped whole.
47
+ */
48
+ export declare function maskUrlParts(raw: string): MaskedUrl;
49
+ /**
50
+ * Drop the query and fragment of a URL that carries a secret or is a
51
+ * reset-style link. A reset-style link also loses the path after its reset
52
+ * segment, and a path that holds a recognisable credential is dropped whole.
53
+ */
54
+ export declare function maskUrl(raw: string): {
55
+ url: string;
56
+ masked: boolean;
57
+ };
58
+ /** The field of one step that holds a value capture would have masked, or null. */
59
+ export declare function unmaskedSecretField(step: RecordedStep): string | null;
60
+ /**
61
+ * The first step of a recording that holds a value capture would have masked,
62
+ * or null when there is none.
63
+ *
64
+ * Saved steps that did not pass through `captureRecording` are held to the
65
+ * same masking rules here: typed text that looks like a credential or a
66
+ * one-time code, text typed into a field whose label marks it as secret, a
67
+ * masked step that still carries text, a URL whose query, fragment, user info
68
+ * or reset-style path carries a secret, and labels or intents with
69
+ * credential-like fragments. Only the step id and the field are reported,
70
+ * never the value.
71
+ */
72
+ export declare function unmaskedSecretStep(recording: Recording): {
73
+ stepId: string;
74
+ field: string;
75
+ } | null;
package/dist/capture.d.ts CHANGED
@@ -16,6 +16,13 @@
16
16
  * - a reset-style link loses the path after its reset segment (`/reset/<token>`
17
17
  * kept `<token>` before), and a path holding a recognisable credential is
18
18
  * dropped.
19
+ * - a path that ends at an ordinary word holding a reset stem
20
+ * (`/orders/confirmed`, `/team/invites`) is not a reset-style link, so it
21
+ * keeps its query; a plain-word user name and the plain-word values of
22
+ * harmless parameters of a reset-style link (`?lang=english`) are removed
23
+ * from that URL only, not from every label (D2 follow-ups, BOFF-18078). The rules live in `capture-rules.ts`, which also holds
24
+ * `unmaskedSecretStep`, the check of a recording that did not come from
25
+ * capture.
19
26
  *
20
27
  * The recorder (Track C, BOFF-16146 C4) sends the events of a person's
21
28
  * demonstration. This turns them into saved steps and masks at capture time,
@@ -37,9 +44,10 @@
37
44
  * `capturedSecrets` lists every raw value that was masked, so a caller (and
38
45
  * the tests) can assert none of them appears in the stored recording.
39
46
  */
47
+ import { maskUrl, unmaskedSecretStep } from './capture-rules.js';
40
48
  import { REDACTED, redactCredentials } from './redact-credentials.js';
41
49
  import { type Recording } from './recording.js';
42
- export { REDACTED, redactCredentials };
50
+ export { REDACTED, maskUrl, redactCredentials, unmaskedSecretStep };
43
51
  /** The element a recorder event acted on, as the accessibility tree described it. */
44
52
  export interface RecorderElement {
45
53
  app?: string;
@@ -105,14 +113,5 @@ export interface CaptureResult {
105
113
  /** Raw values that were masked (kept in memory only, for checks; never store this). */
106
114
  capturedSecrets: string[];
107
115
  }
108
- /**
109
- * Drop the query and fragment of a URL that carries a secret or is a
110
- * reset-style link. A reset-style link also loses the path after its reset
111
- * segment, and a path that holds a recognisable credential is dropped whole.
112
- */
113
- export declare function maskUrl(raw: string): {
114
- url: string;
115
- masked: boolean;
116
- };
117
116
  /** Build saved steps from a demonstration, masking at capture. Throws RecordingError on an unusable result. */
118
117
  export declare function captureRecording(events: readonly RecorderEvent[]): CaptureResult;
package/dist/capture.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import {
2
- maskUrl2,
3
2
  captureRecording2
4
- } from "./index-bnvmt4wf.js";
5
- import"./index-cs6acyjn.js";
3
+ } from "./index-8ntwcfb4.js";
4
+ import {
5
+ maskUrl2,
6
+ unmaskedSecretStep2
7
+ } from "./index-qepvchf7.js";
6
8
  import {
7
9
  REDACTED2,
8
10
  redactCredentials2
@@ -11,5 +13,6 @@ export {
11
13
  REDACTED2 as REDACTED,
12
14
  captureRecording2 as captureRecording,
13
15
  maskUrl2 as maskUrl,
14
- redactCredentials2 as redactCredentials
16
+ redactCredentials2 as redactCredentials,
17
+ unmaskedSecretStep2 as unmaskedSecretStep
15
18
  };
package/dist/drivers.js CHANGED
@@ -1,8 +1,8 @@
1
- import"./index-cs6acyjn.js";
1
+ import"./index-qepvchf7.js";
2
2
  import {
3
3
  parseUiScript2
4
- } from "./index-qmv3ar39.js";
5
- import"./index-w9jc25y9.js";
4
+ } from "./index-s2hge7va.js";
5
+ import"./index-nt1xf2w5.js";
6
6
  import {
7
7
  DOM_DRIVER_CAPABILITIES2,
8
8
  safePageText2,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./index-8w31tpfq.js";
12
12
  import {
13
13
  runUiScript2
14
- } from "./index-eff47v1g.js";
14
+ } from "./index-486zee53.js";
15
15
  import {
16
16
  UiDriverError2,
17
17
  createVirtualClock2
package/dist/heal.js CHANGED
@@ -1,5 +1,5 @@
1
- import"./index-cs6acyjn.js";
2
- import"./index-qmv3ar39.js";
1
+ import"./index-qepvchf7.js";
2
+ import"./index-s2hge7va.js";
3
3
  import {
4
4
  UI_HEAL_MODES2,
5
5
  UI_HEAL_MODE_RANK2,
@@ -17,7 +17,7 @@ import {
17
17
  matchesUrlPattern2,
18
18
  HEAL_POSITION_TOLERANCE_PX2,
19
19
  verifyHealCandidate2
20
- } from "./index-w9jc25y9.js";
20
+ } from "./index-nt1xf2w5.js";
21
21
  import {
22
22
  MAX_HEAL_QUESTION_NODES2,
23
23
  MAX_HEAL_NODE_NAME2,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  RecordingError2,
3
3
  parseRecording2
4
- } from "./index-cs6acyjn.js";
4
+ } from "./index-qepvchf7.js";
5
5
  import {
6
6
  readSnapshotNodes2,
7
7
  resolveTarget2
@@ -2,7 +2,7 @@ import {
2
2
  uiTargetSchema2,
3
3
  UiScriptError2,
4
4
  parseUiScript2
5
- } from "./index-qmv3ar39.js";
5
+ } from "./index-s2hge7va.js";
6
6
  import {
7
7
  UI_CONSEQUENCES2,
8
8
  parseHealMode2,
@@ -10,7 +10,7 @@ import {
10
10
  usablePopupHandlers2,
11
11
  matchesUrlPattern2,
12
12
  verifyHealCandidate2
13
- } from "./index-w9jc25y9.js";
13
+ } from "./index-nt1xf2w5.js";
14
14
  import {
15
15
  isActingStep,
16
16
  classifyConsequence2,
@@ -1,23 +1,20 @@
1
1
  import {
2
+ SECRET_FIELD,
3
+ CODE_LIKE,
4
+ redactLabel,
5
+ maskUrlParts,
2
6
  RECORDING_VERSION2,
3
7
  targetFingerprint2,
4
8
  parseRecording2
5
- } from "./index-cs6acyjn.js";
9
+ } from "./index-qepvchf7.js";
6
10
  import {
7
11
  REDACTED2,
8
12
  redactCredentials2,
9
- containsCredential,
10
- decodeUriText,
11
- containsCredentialInUrl
13
+ decodeUriText
12
14
  } from "./index-mgztm37r.js";
13
15
 
14
16
  // src/capture.ts
15
- var SECRET_FIELD = /password|passcode|passwd|\bpin\b|otp|one[\s-]?time|verification|security code|auth(?:entication)? code|\bcvv\b|\bcvc\b|card number|secret|token|recovery/i;
16
17
  var SECRET_AUTOCOMPLETE = /password|one-time-code|^cc-/i;
17
- var SECRET_PARAM = /token|code|key|secret|sig|signature|auth|password|passwd|otp|session|state|reset|nonce|ticket|hash/i;
18
- var RESET_PATH = /reset|recover|verify|verification|magic|confirm|activate|invite|unsubscribe/i;
19
- var SECRET_LABEL = /code|pin|otp|password|passcode|token|verification|one[\s-]?time/i;
20
- var CODE_LIKE = /^[\d ]{4,10}$/;
21
18
  function isSecretField(element) {
22
19
  if (!element)
23
20
  return false;
@@ -28,8 +25,7 @@ function isSecretField(element) {
28
25
  return SECRET_FIELD.test(element.name);
29
26
  }
30
27
  function cleanLabel(text) {
31
- const cleaned = redactCredentials2(text);
32
- return (SECRET_LABEL.test(cleaned) ? cleaned.replace(/\d{4,}/g, REDACTED2) : cleaned).trim();
28
+ return redactLabel(text).trim();
33
29
  }
34
30
  var MIN_SCRUBBED_SECRET = 4;
35
31
  function scrubberFor(secrets) {
@@ -94,49 +90,6 @@ function targetOf(element) {
94
90
  nth: element.nth ?? 0
95
91
  };
96
92
  }
97
- function resetLinkKeep(segments) {
98
- const index = segments.findIndex((segment) => RESET_PATH.test(decodeUriText(segment)));
99
- if (index === -1)
100
- return;
101
- const segment = decodeUriText(segments[index] ?? "");
102
- return /\d/.test(segment) || segment.length > 64 ? index : index + 1;
103
- }
104
- function sensitiveValues(params, everyValue) {
105
- return [...params.entries()].filter(([name, value]) => everyValue || SECRET_PARAM.test(name) || containsCredential(value)).map(([, value]) => value);
106
- }
107
- function maskUrlParts(raw) {
108
- const url = new URL(raw);
109
- const removed = [url.username, url.password].map(decodeUriText);
110
- url.username = "";
111
- url.password = "";
112
- const params = [...url.searchParams.keys()];
113
- const resetLink = RESET_PATH.test(decodeUriText(url.pathname));
114
- const credentialInPath = containsCredentialInUrl(url.pathname);
115
- const carriesSecret = params.some((name) => SECRET_PARAM.test(name)) || resetLink || credentialInPath || SECRET_PARAM.test(url.hash) || containsCredentialInUrl(url.search) || containsCredentialInUrl(url.hash);
116
- if (!carriesSecret) {
117
- return { url: url.toString(), masked: raw !== url.toString(), removed: removed.filter(Boolean) };
118
- }
119
- removed.push(...sensitiveValues(url.searchParams, resetLink));
120
- const fragment = url.hash.slice(1);
121
- if (fragment.includes("="))
122
- removed.push(...sensitiveValues(new URLSearchParams(fragment), resetLink));
123
- else if (fragment && (resetLink || SECRET_PARAM.test(fragment)))
124
- removed.push(decodeUriText(fragment));
125
- url.search = "";
126
- url.hash = "";
127
- const segments = url.pathname.split("/");
128
- const keep = credentialInPath ? 1 : resetLink ? resetLinkKeep(segments) : undefined;
129
- if (keep !== undefined) {
130
- if (!credentialInPath)
131
- removed.push(...segments.slice(keep).map(decodeUriText));
132
- url.pathname = segments.slice(0, keep).join("/") || "/";
133
- }
134
- return { url: url.toString(), masked: true, removed: removed.filter(Boolean) };
135
- }
136
- function maskUrl2(raw) {
137
- const { url, masked } = maskUrlParts(raw);
138
- return { url, masked };
139
- }
140
93
  function captureRecording2(events) {
141
94
  const drafts = [];
142
95
  const capturedSecrets = [];
@@ -223,4 +176,4 @@ function captureRecording2(events) {
223
176
  return { recording, maskedStepIds, capturedSecrets };
224
177
  }
225
178
 
226
- export { maskUrl2, captureRecording2 };
179
+ export { captureRecording2 };
@@ -7,15 +7,13 @@ import {
7
7
  uiStepFingerprint2,
8
8
  UiScriptError2,
9
9
  parseUiScript2
10
- } from "./index-qmv3ar39.js";
10
+ } from "./index-s2hge7va.js";
11
11
  import {
12
+ maskUrl2,
12
13
  sha256Hex2,
13
14
  RecordingError2,
14
15
  parseRecording2
15
- } from "./index-cs6acyjn.js";
16
- import {
17
- maskUrl2
18
- } from "./index-bnvmt4wf.js";
16
+ } from "./index-qepvchf7.js";
19
17
  import {
20
18
  MAX_SCRIPT_STEPS2,
21
19
  MAX_SCRIPT_INPUTS2,
@@ -182,7 +180,7 @@ function convertStep(raw, index) {
182
180
  case "getPageHtml":
183
181
  return { ...base, action: "getPageHtml" };
184
182
  case "screenshot":
185
- return { ...base, action: "screenshot" };
183
+ return { ...base, action: "screenshot", ...raw.fullPage === true ? { fullPage: true } : {} };
186
184
  default:
187
185
  return { ...base, action: "closeTab" };
188
186
  }
@@ -327,9 +325,9 @@ function lowerStep(step, context) {
327
325
  ...step.maxPages === undefined ? {} : { maxPages: step.maxPages }
328
326
  };
329
327
  case "screenshot":
330
- if (step.target || step.fullPage)
328
+ if (step.target)
331
329
  stop();
332
- return { action: "screenshot", ...common };
330
+ return { action: "screenshot", ...common, ...step.fullPage ? { fullPage: true } : {} };
333
331
  case "getPageText":
334
332
  case "getPageHtml":
335
333
  case "closeTab":
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sha256Hex2
3
- } from "./index-cs6acyjn.js";
3
+ } from "./index-qepvchf7.js";
4
4
  import {
5
5
  NAME_PATTERN2,
6
6
  STEP_ID_PATTERN2,
@@ -9,7 +9,7 @@ import {
9
9
  withFingerprint2,
10
10
  UiScriptError2,
11
11
  parseUiScript2
12
- } from "./index-qmv3ar39.js";
12
+ } from "./index-s2hge7va.js";
13
13
  import {
14
14
  UiRunError2
15
15
  } from "./index-yc0jgph6.js";
@@ -3,7 +3,7 @@ import {
3
3
  uiStepSchema2,
4
4
  UiScriptError2,
5
5
  parseUiScript2
6
- } from "./index-qmv3ar39.js";
6
+ } from "./index-s2hge7va.js";
7
7
  import {
8
8
  HEALABLE_ACTIONS2,
9
9
  compatibleRoles2,
@@ -0,0 +1,337 @@
1
+ import {
2
+ REDACTED2,
3
+ redactCredentials2,
4
+ containsCredential,
5
+ decodeUriText,
6
+ containsCredentialInUrl
7
+ } from "./index-mgztm37r.js";
8
+
9
+ // src/recording.ts
10
+ import { sha256 as nobleSha256 } from "@noble/hashes/sha2.js";
11
+ import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
12
+ import { z } from "zod";
13
+
14
+ // src/capture-rules.ts
15
+ var SECRET_FIELD = /password|passcode|passwd|\bpin\b|otp|one[\s-]?time|verification|security code|auth(?:entication)? code|\bcvv\b|\bcvc\b|card number|secret|token|recovery/i;
16
+ var SECRET_PARAM = /token|code|key|secret|sig|signature|auth|password|passwd|otp|session|state|reset|nonce|ticket|hash/i;
17
+ var SECRET_LABEL = /code|pin|otp|password|passcode|token|verification|one[\s-]?time/i;
18
+ var CODE_LIKE = /^[\d ]{4,10}$/;
19
+ var RESET_STEM = /reset|recover|verify|verification|magic|confirm|activate|activation|invite|invitation|unsubscribe/i;
20
+ var ORDINARY_WORDS = new Set([
21
+ "confirmed",
22
+ "unconfirmed",
23
+ "invites",
24
+ "invited",
25
+ "preset",
26
+ "presets",
27
+ "verified",
28
+ "unverified",
29
+ "activated",
30
+ "deactivated",
31
+ "recovered",
32
+ "unsubscribed"
33
+ ]);
34
+ var RESET_AFFIX_WORDS = "password|passwd|pass|pwd|account|email|mail|user|login|link|token|code|key";
35
+ var RESET_AFFIX = `(?:${RESET_AFFIX_WORDS})`;
36
+ var CLEAN_RESET_WORD = new RegExp(`^${RESET_AFFIX}?(?:reset|recover|recovery|verify|verification|magic|confirm|confirmation|activate|activation|invite|invitation|unsubscribe)(?:s|es)?${RESET_AFFIX}?$`, "i");
37
+ var SIDE_WORD = new RegExp(`^(?:${RESET_AFFIX_WORDS}|accept|forgot|forgotten|new|change|request|resend|send|my|your|sign|signup|in|up)$`, "i");
38
+ var PLAIN_WORDS = /^\p{L}[\p{L} ._-]{0,14}$/u;
39
+ var HARMLESS_PARAM = /^(?:lang|language|locale|hl|lc|source|src|ref|referrer|utm_[a-z]+|campaign|medium|theme|view|tab|page|mode|step|flow|channel|platform|display|screen)$/i;
40
+ function segmentWords(segment) {
41
+ return decodeUriText(segment).split(/[^A-Za-z0-9]+/).filter(Boolean);
42
+ }
43
+ function isResetSegment(segment, last = false) {
44
+ const words = segmentWords(segment);
45
+ if (!words.some((word) => RESET_STEM.test(word)))
46
+ return false;
47
+ const [only] = words;
48
+ const ordinaryPage = last && words.length === 1 && only !== undefined && ORDINARY_WORDS.has(only.toLowerCase());
49
+ return !ordinaryPage;
50
+ }
51
+ function resetSegmentIndex(segments, ordinaryPages = true) {
52
+ let lastNonEmpty = -1;
53
+ segments.forEach((segment, index) => {
54
+ if (segment)
55
+ lastNonEmpty = index;
56
+ });
57
+ return segments.findIndex((segment, index) => isResetSegment(segment, ordinaryPages && index === lastNonEmpty));
58
+ }
59
+ var LONG_VALUE = /^\S{16,}$/;
60
+ function holdsLongValue(url) {
61
+ const fragment = decodeUriText(url.hash.slice(1));
62
+ const values = [...url.searchParams.values()];
63
+ if (fragment.includes("="))
64
+ values.push(...new URLSearchParams(fragment).values());
65
+ else
66
+ values.push(fragment);
67
+ return values.some((value) => LONG_VALUE.test(value));
68
+ }
69
+ function redactLabel(text) {
70
+ const cleaned = redactCredentials2(text);
71
+ return SECRET_LABEL.test(cleaned) ? cleaned.replace(/\d{4,}/g, REDACTED2) : cleaned;
72
+ }
73
+ var MARKER_PROBE = "";
74
+ function changedBy(redact, text) {
75
+ const probe = text.replaceAll(REDACTED2, MARKER_PROBE);
76
+ return redact(probe).replaceAll(MARKER_PROBE, REDACTED2) !== text;
77
+ }
78
+ function resetLinkKeep(segments, index) {
79
+ const segment = decodeUriText(segments[index] ?? "");
80
+ const clean = segmentWords(segment).every((word) => CLEAN_RESET_WORD.test(word) || SIDE_WORD.test(word));
81
+ const keep = clean && !/\d|[A-Za-z]{16}/.test(segment) && segment.length <= 64 ? index + 1 : index;
82
+ return segments.slice(keep).some(Boolean) || keep === index ? keep : segments.length;
83
+ }
84
+ function sortRemoved(target, value, mayStayInLabels) {
85
+ if (!value)
86
+ return;
87
+ if (mayStayInLabels && PLAIN_WORDS.test(value))
88
+ target.urlOnly.push(value);
89
+ else
90
+ target.removed.push(value);
91
+ }
92
+ function sortParams(target, params, resetLink) {
93
+ for (const [name, value] of params.entries()) {
94
+ if (SECRET_PARAM.test(name) || containsCredential(value))
95
+ sortRemoved(target, value, false);
96
+ else if (resetLink)
97
+ sortRemoved(target, value, HARMLESS_PARAM.test(name));
98
+ }
99
+ }
100
+ function maskUrlParts(raw) {
101
+ const url = new URL(raw);
102
+ const result = { url: "", masked: false, removed: [], urlOnly: [] };
103
+ sortRemoved(result, decodeUriText(url.username), true);
104
+ sortRemoved(result, decodeUriText(url.password), false);
105
+ url.username = "";
106
+ url.password = "";
107
+ const params = [...url.searchParams.keys()];
108
+ const segments = url.pathname.split("/");
109
+ const resetIndex = resetSegmentIndex(segments, !holdsLongValue(url));
110
+ const resetLink = resetIndex !== -1;
111
+ const credentialInPath = containsCredentialInUrl(url.pathname);
112
+ const carriesSecret = params.some((name) => SECRET_PARAM.test(name)) || resetLink || credentialInPath || SECRET_PARAM.test(url.hash) || containsCredentialInUrl(url.search) || containsCredentialInUrl(url.hash);
113
+ if (!carriesSecret) {
114
+ result.url = url.toString();
115
+ result.masked = raw !== result.url;
116
+ return result;
117
+ }
118
+ sortParams(result, url.searchParams, resetLink);
119
+ const fragment = url.hash.slice(1);
120
+ if (fragment.includes("="))
121
+ sortParams(result, new URLSearchParams(fragment), resetLink);
122
+ else if (fragment && (resetLink || SECRET_PARAM.test(fragment)))
123
+ sortRemoved(result, decodeUriText(fragment), false);
124
+ url.search = "";
125
+ url.hash = "";
126
+ const keep = credentialInPath ? 1 : resetLink ? resetLinkKeep(segments, resetIndex) : undefined;
127
+ if (keep !== undefined) {
128
+ if (!credentialInPath)
129
+ segments.slice(keep).forEach((segment) => sortRemoved(result, decodeUriText(segment), false));
130
+ url.pathname = segments.slice(0, keep).join("/") || "/";
131
+ }
132
+ result.url = url.toString();
133
+ result.masked = true;
134
+ return result;
135
+ }
136
+ function maskUrl2(raw) {
137
+ const { url, masked } = maskUrlParts(raw);
138
+ return { url, masked };
139
+ }
140
+ function labelHoldsSecret(text) {
141
+ return text !== undefined && changedBy(redactLabel, text);
142
+ }
143
+ function targetHoldsSecret(target) {
144
+ if (!target)
145
+ return false;
146
+ return [target.app, target.window, target.role, target.name].some(labelHoldsSecret);
147
+ }
148
+ function unmaskedSecretField(step) {
149
+ if (changedBy(redactCredentials2, step.intent))
150
+ return "intent";
151
+ if ("target" in step && targetHoldsSecret(step.target))
152
+ return "target";
153
+ switch (step.action) {
154
+ case "type": {
155
+ if (step.text === undefined || step.text === "")
156
+ return null;
157
+ if (step.masked)
158
+ return "text";
159
+ const secretField = step.target !== undefined && SECRET_FIELD.test(step.target.name);
160
+ const secretText = CODE_LIKE.test(step.text) || changedBy(redactCredentials2, step.text);
161
+ return secretField || secretText ? "text" : null;
162
+ }
163
+ case "navigate":
164
+ return maskUrl2(step.url).url !== new URL(step.url).toString() ? "url" : null;
165
+ case "focus_window":
166
+ if (labelHoldsSecret(step.app))
167
+ return "app";
168
+ return labelHoldsSecret(step.title) ? "title" : null;
169
+ default:
170
+ return null;
171
+ }
172
+ }
173
+ function unmaskedSecretStep2(recording) {
174
+ for (const step of recording.steps) {
175
+ const field = unmaskedSecretField(step);
176
+ if (field)
177
+ return { stepId: step.id, field };
178
+ }
179
+ return null;
180
+ }
181
+
182
+ // src/recording.ts
183
+ function sha256Hex2(text) {
184
+ return bytesToHex(nobleSha256(utf8ToBytes(text)));
185
+ }
186
+ var RECORDING_VERSION2 = 1;
187
+ var MAX_RECORDED_STEPS2 = 200;
188
+ var MAX_LABEL = 512;
189
+ var MAX_TEXT = 4000;
190
+ var MAX_INTENT = 500;
191
+ var SAVED_STEP_AUTHORS2 = ["PERSON", "TEACH_MODE", "IMPORT"];
192
+ var REPLAYABLE_ACTIONS2 = [
193
+ "click",
194
+ "type",
195
+ "secret_fill",
196
+ "key",
197
+ "scroll",
198
+ "navigate",
199
+ "focus_window"
200
+ ];
201
+ var label = z.string().trim().min(1).max(MAX_LABEL);
202
+ var recordedTargetSchema2 = z.strictObject({
203
+ app: label.optional(),
204
+ window: label.optional(),
205
+ role: label,
206
+ name: label,
207
+ nth: z.int().min(0).max(50).default(0)
208
+ });
209
+ var stepBase = {
210
+ id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/),
211
+ intent: z.string().trim().min(1).max(MAX_INTENT),
212
+ screenshotRef: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9:/._-]{0,511}$/).optional(),
213
+ fingerprint: z.string().regex(/^[0-9a-f]{64}$/)
214
+ };
215
+ var targeted = { ...stepBase, target: recordedTargetSchema2 };
216
+ var recordedStepSchema2 = z.discriminatedUnion("action", [
217
+ z.strictObject({
218
+ ...targeted,
219
+ action: z.literal("click"),
220
+ button: z.enum(["left", "right"]).default("left"),
221
+ count: z.union([z.literal(1), z.literal(2)]).default(1)
222
+ }),
223
+ z.strictObject({
224
+ ...stepBase,
225
+ action: z.literal("type"),
226
+ target: recordedTargetSchema2.optional(),
227
+ text: z.string().max(MAX_TEXT).optional(),
228
+ masked: z.boolean().default(false)
229
+ }),
230
+ z.strictObject({
231
+ ...targeted,
232
+ action: z.literal("secret_fill"),
233
+ secretRef: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9:/._-]{0,254}$/),
234
+ expectedOrigin: z.url({ protocol: /^https?$/ })
235
+ }),
236
+ z.strictObject({ ...stepBase, action: z.literal("key"), keys: z.array(z.string().min(1).max(32)).min(1).max(8) }),
237
+ z.strictObject({
238
+ ...stepBase,
239
+ action: z.literal("scroll"),
240
+ target: recordedTargetSchema2.optional(),
241
+ dx: z.int().min(-1e4).max(1e4),
242
+ dy: z.int().min(-1e4).max(1e4)
243
+ }),
244
+ z.strictObject({ ...stepBase, action: z.literal("navigate"), url: z.url({ protocol: /^https?$/ }).max(2048) }),
245
+ z.strictObject({
246
+ ...stepBase,
247
+ action: z.literal("focus_window"),
248
+ app: label,
249
+ title: label.optional()
250
+ })
251
+ ]);
252
+ var recordingSchema2 = z.strictObject({
253
+ version: z.literal(RECORDING_VERSION2),
254
+ steps: z.array(recordedStepSchema2).min(1).max(MAX_RECORDED_STEPS2)
255
+ });
256
+ function targetFingerprint2(step) {
257
+ const target = "target" in step && step.target ? step.target : undefined;
258
+ return sha256Hex2(JSON.stringify([
259
+ step.action,
260
+ target?.app ?? null,
261
+ target?.window ?? null,
262
+ target?.role ?? null,
263
+ target?.name ?? null,
264
+ target?.nth ?? 0,
265
+ "url" in step ? step.url ?? null : null,
266
+ "app" in step ? step.app ?? null : null,
267
+ "title" in step ? step.title ?? null : null
268
+ ]));
269
+ }
270
+
271
+ class RecordingError2 extends Error {
272
+ code;
273
+ constructor(code, message) {
274
+ super(message);
275
+ this.code = code;
276
+ this.name = "RecordingError";
277
+ }
278
+ }
279
+ function parseRecording2(value, options = {}) {
280
+ const parsed = recordingSchema2.safeParse(value);
281
+ if (!parsed.success) {
282
+ const issue = parsed.error.issues[0];
283
+ const where = issue?.path.map(String).join(".") ?? "";
284
+ throw new RecordingError2("INVALID_RECORDING", `Recording is not valid at ${where || "the top"}: ${issue?.message}`);
285
+ }
286
+ const ids = new Set;
287
+ for (const step of parsed.data.steps) {
288
+ if (ids.has(step.id))
289
+ throw new RecordingError2("DUPLICATE_STEP_ID", `Step id ${step.id} is used twice.`);
290
+ ids.add(step.id);
291
+ if (targetFingerprint2(step) !== step.fingerprint) {
292
+ throw new RecordingError2("FINGERPRINT_MISMATCH", `Step ${step.id} was changed after it was recorded.`);
293
+ }
294
+ const field = credentialField(step);
295
+ if (field) {
296
+ throw new RecordingError2("CREDENTIAL_IN_RECORDING", `Step ${step.id} holds a credential in its ${field}.`);
297
+ }
298
+ const unmasked = options.enforceCaptureRules ? unmaskedSecretField(step) : null;
299
+ if (unmasked) {
300
+ throw new RecordingError2("CREDENTIAL_IN_RECORDING", `Step ${step.id} holds a value that capture would have masked in its ${unmasked}.`);
301
+ }
302
+ }
303
+ return parsed.data;
304
+ }
305
+ function storedText(step) {
306
+ const target = "target" in step ? step.target : undefined;
307
+ const fields = [
308
+ ["intent", step.intent],
309
+ ["target app", target?.app],
310
+ ["target window", target?.window],
311
+ ["target role", target?.role],
312
+ ["target name", target?.name]
313
+ ];
314
+ switch (step.action) {
315
+ case "type":
316
+ return [...fields, ["text", step.text]];
317
+ case "navigate":
318
+ return fields;
319
+ case "focus_window":
320
+ return [...fields, ["app", step.app], ["title", step.title]];
321
+ default:
322
+ return fields;
323
+ }
324
+ }
325
+ function credentialField(step) {
326
+ if (step.action === "navigate") {
327
+ const url = new URL(step.url);
328
+ if (url.username || url.password || containsCredentialInUrl(step.url))
329
+ return "url";
330
+ }
331
+ return storedText(step).find(([, value]) => value !== undefined && containsCredential(value))?.[0];
332
+ }
333
+ function isSavedStepAuthor2(value) {
334
+ return typeof value === "string" && SAVED_STEP_AUTHORS2.includes(value);
335
+ }
336
+
337
+ export { SECRET_FIELD, CODE_LIKE, redactLabel, maskUrlParts, maskUrl2, unmaskedSecretStep2, sha256Hex2, RECORDING_VERSION2, MAX_RECORDED_STEPS2, SAVED_STEP_AUTHORS2, REPLAYABLE_ACTIONS2, recordedTargetSchema2, recordedStepSchema2, recordingSchema2, targetFingerprint2, RecordingError2, parseRecording2, isSavedStepAuthor2 };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  sha256Hex2,
3
3
  targetFingerprint2
4
- } from "./index-cs6acyjn.js";
4
+ } from "./index-qepvchf7.js";
5
5
  import {
6
6
  UI_SCRIPT_VERSION2,
7
7
  MAX_SCRIPT_STEPS2,
package/dist/index.d.ts CHANGED
@@ -4,8 +4,8 @@
4
4
  * Each module is also published as its own subpath (`@burdenoff/ui-engine/recording`,
5
5
  * `/capture`, `/resolve`, `/replay`), so a consumer can load only what it uses.
6
6
  */
7
- export { MAX_RECORDED_STEPS, RECORDING_VERSION, REPLAYABLE_ACTIONS, type RecordedStep, type RecordedTarget, type Recording, RecordingError, type ReplayableAction, SAVED_STEP_AUTHORS, type SavedStepAuthor, isSavedStepAuthor, parseRecording, recordedStepSchema, recordedTargetSchema, recordingSchema, sha256Hex, targetFingerprint, } from './recording.js';
8
- export { type CaptureResult, REDACTED, type RecorderElement, type RecorderEvent, type RecorderScreenshot, captureRecording, maskUrl, redactCredentials, } from './capture.js';
7
+ export { MAX_RECORDED_STEPS, RECORDING_VERSION, REPLAYABLE_ACTIONS, type ParseRecordingOptions, type RecordedStep, type RecordedTarget, type Recording, RecordingError, type ReplayableAction, SAVED_STEP_AUTHORS, type SavedStepAuthor, isSavedStepAuthor, parseRecording, recordedStepSchema, recordedTargetSchema, recordingSchema, sha256Hex, targetFingerprint, } from './recording.js';
8
+ export { type CaptureResult, REDACTED, type RecorderElement, type RecorderEvent, type RecorderScreenshot, captureRecording, maskUrl, redactCredentials, unmaskedSecretStep, } from './capture.js';
9
9
  export { MAX_SNAPSHOT_NODES, type ResolveOutcome, type SnapshotNode, readSnapshotNodes, resolveTarget, } from './resolve.js';
10
10
  export { type FallbackReason, type ReplayCallKind, type ReplayCallOutcome, type ReplayChatMessage, type ReplayFunctionCall, type ReplayOptions, type ReplayPlan, type ReplaySource, type ReplayState, afterReplayCall, finishFallback, markFallbackAsked, planReplay, readReplayState, replayReasons, replayStateFrom, } from './replay.js';
11
11
  export * from './script.js';
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import {
2
+ maskUrl2,
3
+ unmaskedSecretStep2,
2
4
  sha256Hex2,
3
5
  RECORDING_VERSION2,
4
6
  MAX_RECORDED_STEPS2,
@@ -11,11 +13,10 @@ import {
11
13
  RecordingError2,
12
14
  parseRecording2,
13
15
  isSavedStepAuthor2
14
- } from "./index-cs6acyjn.js";
16
+ } from "./index-qepvchf7.js";
15
17
  import {
16
- maskUrl2,
17
18
  captureRecording2
18
- } from "./index-bnvmt4wf.js";
19
+ } from "./index-8ntwcfb4.js";
19
20
  import {
20
21
  MAX_SNAPSHOT_NODES2,
21
22
  readSnapshotNodes2,
@@ -29,7 +30,7 @@ import {
29
30
  finishFallback2,
30
31
  markFallbackAsked2,
31
32
  replayReasons2
32
- } from "./index-2kgsgn1c.js";
33
+ } from "./index-0vj2y9fd.js";
33
34
  import {
34
35
  uiScriptRegistry2,
35
36
  NAME_PATTERN2,
@@ -49,7 +50,7 @@ import {
49
50
  UI_EXPRESSION_ARITY2,
50
51
  parseUiScript2,
51
52
  safeParseUiScript2
52
- } from "./index-qmv3ar39.js";
53
+ } from "./index-s2hge7va.js";
53
54
  import {
54
55
  UI_SCRIPT_SCHEMA_HASH2,
55
56
  schemaHashOf2,
@@ -70,7 +71,7 @@ import {
70
71
  COMPUTER_USE_SKIP_REASONS2,
71
72
  targetFromUiFingerprint2,
72
73
  scriptFromComputerUseActions2
73
- } from "./index-ntg7r3f3.js";
74
+ } from "./index-hvdh7yx9.js";
74
75
  import {
75
76
  UI_HEAL_MODES2,
76
77
  UI_HEAL_MODE_RANK2,
@@ -88,7 +89,7 @@ import {
88
89
  matchesUrlPattern2,
89
90
  HEAL_POSITION_TOLERANCE_PX2,
90
91
  verifyHealCandidate2
91
- } from "./index-w9jc25y9.js";
92
+ } from "./index-nt1xf2w5.js";
92
93
  import {
93
94
  MAX_CALL_DEPTH2,
94
95
  COMPILED_NAME_PREFIX2,
@@ -96,7 +97,7 @@ import {
96
97
  stripBreakpoints2,
97
98
  inlineCalls2,
98
99
  compileUiScript2
99
- } from "./index-6kva2gvd.js";
100
+ } from "./index-k7wfq22w.js";
100
101
  import {
101
102
  MAX_HEAL_QUESTION_NODES2,
102
103
  MAX_HEAL_NODE_NAME2,
@@ -128,7 +129,7 @@ import {
128
129
  MAX_PAGE_TEXT2,
129
130
  DEFAULT_LIST_ITEMS2,
130
131
  runUiScript2
131
- } from "./index-eff47v1g.js";
132
+ } from "./index-486zee53.js";
132
133
  import {
133
134
  MAX_HEAL_KEYWORDS2,
134
135
  MAX_HEAL_KEYWORD_LENGTH2,
@@ -457,6 +458,7 @@ export {
457
458
  uiTargetMethodSchema2 as uiTargetMethodSchema,
458
459
  uiTargetRefSchema2 as uiTargetRefSchema,
459
460
  uiTargetSchema2 as uiTargetSchema,
461
+ unmaskedSecretStep2 as unmaskedSecretStep,
460
462
  usableKeywords2 as usableKeywords,
461
463
  usablePopupHandlers2 as usablePopupHandlers,
462
464
  valuesEqual2 as valuesEqual,
package/dist/interpret.js CHANGED
@@ -1,6 +1,6 @@
1
- import"./index-cs6acyjn.js";
2
- import"./index-qmv3ar39.js";
3
- import"./index-w9jc25y9.js";
1
+ import"./index-qepvchf7.js";
2
+ import"./index-s2hge7va.js";
3
+ import"./index-nt1xf2w5.js";
4
4
  import {
5
5
  MAX_CALL_DEPTH2,
6
6
  COMPILED_NAME_PREFIX2,
@@ -8,7 +8,7 @@ import {
8
8
  stripBreakpoints2,
9
9
  inlineCalls2,
10
10
  compileUiScript2
11
- } from "./index-6kva2gvd.js";
11
+ } from "./index-k7wfq22w.js";
12
12
  import {
13
13
  MAX_VALUE_TEXT2,
14
14
  MAX_VALUE_ITEMS2,
@@ -31,7 +31,7 @@ import {
31
31
  MAX_PAGE_TEXT2,
32
32
  DEFAULT_LIST_ITEMS2,
33
33
  runUiScript2
34
- } from "./index-eff47v1g.js";
34
+ } from "./index-486zee53.js";
35
35
  import {
36
36
  UI_ERROR_FAMILIES2,
37
37
  UI_ERROR_CODES2,
@@ -208,7 +208,21 @@ export declare class RecordingError extends Error {
208
208
  readonly code: 'INVALID_RECORDING' | 'FINGERPRINT_MISMATCH' | 'DUPLICATE_STEP_ID' | 'CREDENTIAL_IN_RECORDING';
209
209
  constructor(code: 'INVALID_RECORDING' | 'FINGERPRINT_MISMATCH' | 'DUPLICATE_STEP_ID' | 'CREDENTIAL_IN_RECORDING', message: string);
210
210
  }
211
- /** A stored recording, validated: shape, unique step ids, and every fingerprint. Throws RecordingError. */
212
- export declare function parseRecording(value: unknown): Recording;
211
+ export interface ParseRecordingOptions {
212
+ /**
213
+ * Also refuse a step that holds a value capture would have masked
214
+ * (`unmaskedSecretStep`), with `CREDENTIAL_IN_RECORDING`. Off by default, so
215
+ * existing callers parse exactly as before; turn it on for recordings that
216
+ * did not come from `captureRecording`. Every recording capture produces passes.
217
+ */
218
+ enforceCaptureRules?: boolean;
219
+ }
220
+ /**
221
+ * A stored recording, validated: shape, unique step ids, every fingerprint and
222
+ * no recognisable credential; with `enforceCaptureRules`, the capture rules
223
+ * too. Throws RecordingError. Error messages name the step and the field,
224
+ * never the value.
225
+ */
226
+ export declare function parseRecording(value: unknown, options?: ParseRecordingOptions): Recording;
213
227
  export declare function isSavedStepAuthor(value: unknown): value is SavedStepAuthor;
214
228
  export {};
package/dist/recording.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  RecordingError2,
12
12
  parseRecording2,
13
13
  isSavedStepAuthor2
14
- } from "./index-cs6acyjn.js";
14
+ } from "./index-qepvchf7.js";
15
15
  export {
16
16
  MAX_RECORDED_STEPS2 as MAX_RECORDED_STEPS,
17
17
  RECORDING_VERSION2 as RECORDING_VERSION,
package/dist/replay.js CHANGED
@@ -6,9 +6,9 @@ import {
6
6
  finishFallback2,
7
7
  markFallbackAsked2,
8
8
  replayReasons2
9
- } from "./index-2kgsgn1c.js";
9
+ } from "./index-0vj2y9fd.js";
10
10
  import"./index-3v887c75.js";
11
- import"./index-cs6acyjn.js";
11
+ import"./index-qepvchf7.js";
12
12
  export {
13
13
  afterReplayCall2 as afterReplayCall,
14
14
  finishFallback2 as finishFallback,
@@ -12,7 +12,11 @@
12
12
  /** The step actions a 0.3.0 extension runs, in the order the service lists them. */
13
13
  export declare const BROWSER_STEP_ACTIONS: readonly ["navigate", "waitFor", "click", "type", "select", "check", "pressKey", "scroll", "extract", "extractList", "getPageText", "getPageHtml", "screenshot", "closeTab"];
14
14
  export type BrowserStepAction = (typeof BROWSER_STEP_ACTIONS)[number];
15
- /** A legacy Run in Browser step: `{ action, name?, ...params }`. */
15
+ /**
16
+ * A legacy Run in Browser step: `{ action, name?, ...params }`. The service and
17
+ * workers validate only the fields an action needs, so other keys a builder
18
+ * sets (a screenshot's `fullPage`, the recorder's `note`) pass through.
19
+ */
16
20
  export type BrowserActionStep = Record<string, unknown> & {
17
21
  action: BrowserStepAction;
18
22
  };
package/dist/script.js CHANGED
@@ -17,8 +17,8 @@ import {
17
17
  UI_EXPRESSION_ARITY2,
18
18
  parseUiScript2,
19
19
  safeParseUiScript2
20
- } from "./index-qmv3ar39.js";
21
- import"./index-cs6acyjn.js";
20
+ } from "./index-s2hge7va.js";
21
+ import"./index-qepvchf7.js";
22
22
  import {
23
23
  UI_SCRIPT_SCHEMA_HASH2,
24
24
  schemaHashOf2,
@@ -39,8 +39,8 @@ import {
39
39
  COMPUTER_USE_SKIP_REASONS2,
40
40
  targetFromUiFingerprint2,
41
41
  scriptFromComputerUseActions2
42
- } from "./index-ntg7r3f3.js";
43
- import"./index-bnvmt4wf.js";
42
+ } from "./index-hvdh7yx9.js";
43
+ import"./index-8ntwcfb4.js";
44
44
  import {
45
45
  UI_SCRIPT_STEP_KEY_PREFIX2,
46
46
  UI_SCRIPT_STEP_MESSAGES2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/ui-engine",
3
- "version": "2026.1201.1",
3
+ "version": "2026.1202.1",
4
4
  "description": "Shared, browser-safe UI automation engine: recordings, capture-time masking, target resolution, replay, the UI script v1 contract, the multi-method web target resolver and DOM runtime, the UI script interpreter, the UI script analyzer and UI step healing for FluidGrids RPA and BotManor Stewards.",
5
5
  "license": "MIT",
6
6
  "author": "Burdenoff Consultancy Services Pvt. Ltd.",
@@ -1,160 +0,0 @@
1
- import {
2
- containsCredential,
3
- containsCredentialInUrl
4
- } from "./index-mgztm37r.js";
5
-
6
- // src/recording.ts
7
- import { sha256 as nobleSha256 } from "@noble/hashes/sha2.js";
8
- import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
9
- import { z } from "zod";
10
- function sha256Hex2(text) {
11
- return bytesToHex(nobleSha256(utf8ToBytes(text)));
12
- }
13
- var RECORDING_VERSION2 = 1;
14
- var MAX_RECORDED_STEPS2 = 200;
15
- var MAX_LABEL = 512;
16
- var MAX_TEXT = 4000;
17
- var MAX_INTENT = 500;
18
- var SAVED_STEP_AUTHORS2 = ["PERSON", "TEACH_MODE", "IMPORT"];
19
- var REPLAYABLE_ACTIONS2 = [
20
- "click",
21
- "type",
22
- "secret_fill",
23
- "key",
24
- "scroll",
25
- "navigate",
26
- "focus_window"
27
- ];
28
- var label = z.string().trim().min(1).max(MAX_LABEL);
29
- var recordedTargetSchema2 = z.strictObject({
30
- app: label.optional(),
31
- window: label.optional(),
32
- role: label,
33
- name: label,
34
- nth: z.int().min(0).max(50).default(0)
35
- });
36
- var stepBase = {
37
- id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/),
38
- intent: z.string().trim().min(1).max(MAX_INTENT),
39
- screenshotRef: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9:/._-]{0,511}$/).optional(),
40
- fingerprint: z.string().regex(/^[0-9a-f]{64}$/)
41
- };
42
- var targeted = { ...stepBase, target: recordedTargetSchema2 };
43
- var recordedStepSchema2 = z.discriminatedUnion("action", [
44
- z.strictObject({
45
- ...targeted,
46
- action: z.literal("click"),
47
- button: z.enum(["left", "right"]).default("left"),
48
- count: z.union([z.literal(1), z.literal(2)]).default(1)
49
- }),
50
- z.strictObject({
51
- ...stepBase,
52
- action: z.literal("type"),
53
- target: recordedTargetSchema2.optional(),
54
- text: z.string().max(MAX_TEXT).optional(),
55
- masked: z.boolean().default(false)
56
- }),
57
- z.strictObject({
58
- ...targeted,
59
- action: z.literal("secret_fill"),
60
- secretRef: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9:/._-]{0,254}$/),
61
- expectedOrigin: z.url({ protocol: /^https?$/ })
62
- }),
63
- z.strictObject({ ...stepBase, action: z.literal("key"), keys: z.array(z.string().min(1).max(32)).min(1).max(8) }),
64
- z.strictObject({
65
- ...stepBase,
66
- action: z.literal("scroll"),
67
- target: recordedTargetSchema2.optional(),
68
- dx: z.int().min(-1e4).max(1e4),
69
- dy: z.int().min(-1e4).max(1e4)
70
- }),
71
- z.strictObject({ ...stepBase, action: z.literal("navigate"), url: z.url({ protocol: /^https?$/ }).max(2048) }),
72
- z.strictObject({
73
- ...stepBase,
74
- action: z.literal("focus_window"),
75
- app: label,
76
- title: label.optional()
77
- })
78
- ]);
79
- var recordingSchema2 = z.strictObject({
80
- version: z.literal(RECORDING_VERSION2),
81
- steps: z.array(recordedStepSchema2).min(1).max(MAX_RECORDED_STEPS2)
82
- });
83
- function targetFingerprint2(step) {
84
- const target = "target" in step && step.target ? step.target : undefined;
85
- return sha256Hex2(JSON.stringify([
86
- step.action,
87
- target?.app ?? null,
88
- target?.window ?? null,
89
- target?.role ?? null,
90
- target?.name ?? null,
91
- target?.nth ?? 0,
92
- "url" in step ? step.url ?? null : null,
93
- "app" in step ? step.app ?? null : null,
94
- "title" in step ? step.title ?? null : null
95
- ]));
96
- }
97
-
98
- class RecordingError2 extends Error {
99
- code;
100
- constructor(code, message) {
101
- super(message);
102
- this.code = code;
103
- this.name = "RecordingError";
104
- }
105
- }
106
- function parseRecording2(value) {
107
- const parsed = recordingSchema2.safeParse(value);
108
- if (!parsed.success) {
109
- const issue = parsed.error.issues[0];
110
- const where = issue?.path.map(String).join(".") ?? "";
111
- throw new RecordingError2("INVALID_RECORDING", `Recording is not valid at ${where || "the top"}: ${issue?.message}`);
112
- }
113
- const ids = new Set;
114
- for (const step of parsed.data.steps) {
115
- if (ids.has(step.id))
116
- throw new RecordingError2("DUPLICATE_STEP_ID", `Step id ${step.id} is used twice.`);
117
- ids.add(step.id);
118
- if (targetFingerprint2(step) !== step.fingerprint) {
119
- throw new RecordingError2("FINGERPRINT_MISMATCH", `Step ${step.id} was changed after it was recorded.`);
120
- }
121
- const field = credentialField(step);
122
- if (field) {
123
- throw new RecordingError2("CREDENTIAL_IN_RECORDING", `Step ${step.id} holds a credential in its ${field}.`);
124
- }
125
- }
126
- return parsed.data;
127
- }
128
- function storedText(step) {
129
- const target = "target" in step ? step.target : undefined;
130
- const fields = [
131
- ["intent", step.intent],
132
- ["target app", target?.app],
133
- ["target window", target?.window],
134
- ["target role", target?.role],
135
- ["target name", target?.name]
136
- ];
137
- switch (step.action) {
138
- case "type":
139
- return [...fields, ["text", step.text]];
140
- case "navigate":
141
- return fields;
142
- case "focus_window":
143
- return [...fields, ["app", step.app], ["title", step.title]];
144
- default:
145
- return fields;
146
- }
147
- }
148
- function credentialField(step) {
149
- if (step.action === "navigate") {
150
- const url = new URL(step.url);
151
- if (url.username || url.password || containsCredentialInUrl(step.url))
152
- return "url";
153
- }
154
- return storedText(step).find(([, value]) => value !== undefined && containsCredential(value))?.[0];
155
- }
156
- function isSavedStepAuthor2(value) {
157
- return typeof value === "string" && SAVED_STEP_AUTHORS2.includes(value);
158
- }
159
-
160
- export { sha256Hex2, RECORDING_VERSION2, MAX_RECORDED_STEPS2, SAVED_STEP_AUTHORS2, REPLAYABLE_ACTIONS2, recordedTargetSchema2, recordedStepSchema2, recordingSchema2, targetFingerprint2, RecordingError2, parseRecording2, isSavedStepAuthor2 };