@burdenoff/ui-engine 2026.1204.2 → 2026.1204.3

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
@@ -28,7 +28,7 @@ Each module is a subpath export. The root entry re-exports the data and planning
28
28
  | `@burdenoff/ui-engine/dom-runtime` | The DOM runtime a desk injects into a page (`createDomRuntime`, `installDomRuntime`): resolve, act, highlight, snapshot |
29
29
  | `@burdenoff/ui-engine/dom-runtime.iife.js` | The same runtime as one self-contained script (at most 60 KB minified) that installs itself on `globalThis.__burdenoffUiRuntime` |
30
30
  | `@burdenoff/ui-engine/interpret` | The UI script interpreter (`runUiScript`), the compiler a worker runs before it parks a node (`compileUiScript`, `applyPins`, `inlineCalls`, `stripBreakpoints`), the expression evaluator, the desk driver interface and every run-time error code with its node error family (`UI_ERROR_CODES`) |
31
- | `@burdenoff/ui-engine/analyze` | The UI script analyzer: `analyzeUiScript` and `analyzeDesktopUiScript`, the 11 rules of v1, the 2 healing rules and the 2 desktop rules (`UI_ANALYZER_RULES`), problem message keys under `fluidgrids.builder.uiScript.problem.*` with English templates (`UI_SCRIPT_PROBLEM_MESSAGES`), and `stepNumber` (see below) |
31
+ | `@burdenoff/ui-engine/analyze` | The UI script analyzer: `analyzeUiScript`, `analyzeDesktopUiScript` and `analyzeAiStep`, the 11 rules of v1, the 2 healing rules, the 2 desktop rules and the 3 phase 5 rules (`UI_ANALYZER_RULES`), problem message keys under `fluidgrids.builder.uiScript.problem.*` with English templates (`UI_SCRIPT_PROBLEM_MESSAGES`), and `stepNumber` (see below) |
32
32
  | `@burdenoff/ui-engine/heal` | UI step healing (plan P4-06a): the heal request and answer types, `buildHealQuestion`, `parseHealAnswer`, `verifyHealCandidate`, `classifyConsequence`, `targetFromSnapshotNode`, `maskSnapshot`, healing modes (`capHealMode`, `decideHeal`) and pop-up handlers (`parseUiPopupHandler`, `analyzeUiPopupHandler`, `matchesUrlPattern`). Needs no DOM (see below) |
33
33
  | `@burdenoff/ui-engine/drivers` | Desk drivers over a DOM: `createDomDriver` (the DOM runtime in the interpreter's own world) and `createSnapshotDriver` with `replayUiScriptOnSnapshot` (snapshot replay with no browser) |
34
34
  | `@burdenoff/ui-engine/desk` | The desk driver for desktop scripts (plan P2-03b): `createDeskDriver` over a `DeskBackend`, `deskBackendFromAct`, the desk contract v3 wire types and the desk error mapping. No DOM (see "Desktop scripts and the desk driver") |
@@ -147,7 +147,7 @@ The runtime must be injected into an isolated world (a content script, or a CDP
147
147
 
148
148
  ## The analyzer
149
149
 
150
- `analyzeUiScript(script, options?)` reads a parsed UI script (call `parseUiScript` first) and returns the problems an author should know about before it runs (spec 14 section 3). It is pure, browser-safe and service-safe, never throws for a script that parsed, and gives the same problems in the builder and in the workflow service. Every problem is advice: the builder shows it on save and never blocks a save (spec 19, M1), and the service reports it as a validation warning. A script that cannot run fails to parse instead, so there is no error severity.
150
+ `analyzeUiScript(script, options?)` reads a parsed UI script (call `parseUiScript` first) and returns the problems an author should know about before it runs (spec 14 section 3). It is pure, browser-safe and service-safe, never throws for a script that parsed, and gives the same problems in the builder and in the workflow service. Every problem is advice: the builder shows it on save and never blocks a save (spec 19, M1), and the service reports it as a validation warning. A script that cannot run fails to parse instead. The `error` severity marks a script that runs but should not be promoted: the workflow service's promotion gate (RPA plan P5-05b) refuses a promotion while an `error` problem exists, where the workspace turns the gate on. Only `aiStepNoAllowlist` defaults to `error`; a workspace may raise any rule to it.
151
151
 
152
152
  A problem is `{ rule, group, severity, messageKey, vars, message, path?, stepId?, field? }`. `messageKey` sits under `fluidgrids.builder.uiScript.problem.*`; the front end translates it with `tr(messageKey, vars)`, and the service, the CLI and logs use the English `message`. `vars.step` is the step number as an author reads it (`stepNumber`: `"5.then.1"` reads `6.2`, `"5.else.0"` reads `6.else.1`, `"cleanup.0"` reads `cleanup.1`), and `vars.target` a quoted target description. Problems are listed with the whole script's first, then each step's in document order (main steps, then clean-up), then the outputs'; within one step, in rule order. Disabled steps, and every step inside a disabled block, are skipped.
153
153
 
@@ -167,16 +167,22 @@ A problem is `{ rule, group, severity, messageKey, vars, message, path?, stepId?
167
167
  | `popupHandlerLoop` | reliability | warning | Only with `popupHandler` (set by `analyzeUiPopupHandler`): a pop-up handler step that is a flow block (`popupHandlerFlow`), takes an action a handler may not take (`popupHandlerAction`), acts on a consequential control (`popupHandlerConsequential`), waits longer than 5,000 ms (`popupHandlerWait`), or a handler with no step that clicks, checks or presses a key (`popupHandlerNoAction`) |
168
168
  | `runCommandFromVariable` | security | warning | Desktop scripts: a Run command step whose command reads a variable or an input, so a value from the screen, a file or another node could change what the command does |
169
169
  | `singleMethodImageTarget` | reliability | warning | Desktop scripts: a target whose only enabled method is an image (reported instead of `singleMethodTarget`); a library element is reported once |
170
+ | `aiStepNoAllowlist` | security | **error** | Only with `aiStep` options (set by `analyzeAiStep`): an AI Step whose allowed sites are missing, null or of another type, a blank expression, or a list with no entry that restricts the sites (blank entries, entries that are not text, `*`, a wildcard over one label such as `*.com`, or a `*` anywhere but a leading `*.` do not restrict). The settings are read as stored and never make the analyzer throw. Reported once for the whole script (`field: 'allowedHosts'`). A non-blank expression is not reported: the worker evaluates it and refuses an empty or invalid list at run time |
171
+ | `unnamedStep` | maintainability | info | A step that runs and has no name (`intent`), once per step |
172
+ | `sequenceTooLong` | maintainability | warning | A sequence with more than `UI_ANALYZER_SEQUENCE_LIMIT` (200) steps that run, once, at its first step past the limit. A sequence is one list of steps: the main steps, the clean-up block, or a block of a flow step; a nested block's steps count towards that block only |
170
173
  | `unusedValue` | maintainability | info | A declared variable nothing reads (`unusedVariable`), and a `set` or `saveAs` value no step, output or later node reads (`unusedValue`). A `set` or `saveAs` value is a key of the node's results, so it is reported only when `externalReads` is given, except a `__` name, which never reaches the results |
171
174
 
172
175
  Options:
173
176
 
174
- - `severity`: a workspace's setting per rule, `warning`, `info` or `off` (drops the rule's problems). Any other stored value is ignored and the rule keeps its default. `UI_ANALYZER_DEFAULT_SEVERITY` holds the defaults.
177
+ - `severity`: a workspace's setting per rule, `error`, `warning`, `info` or `off` (drops the rule's problems). Any other stored value is ignored and the rule keeps its default. `UI_ANALYZER_DEFAULT_SEVERITY` holds the defaults.
175
178
  - `externalReads`: the result names other nodes of the workflow read. A `set` or `saveAs` value is a key of the node's results, so without this list it is never reported as unused; the builder passes it, the service may leave it out.
176
179
  - `healing`: `{ alwaysAskStepIds?, keywords? }`, the node's and workspace's healing settings, for `healConsequential`.
177
180
  - `popupHandler`: `{ match }`, set when the script is a pop-up handler's steps, for `popupHandlerLoop`.
181
+ - `aiStep`: `{ allowedHosts }`, the AI Step's `args.state.aiStep.allowedHosts` as stored (a literal list or an expression string; any other shape counts as no list), for `aiStepNoAllowlist`. The full host rules (IP addresses, `localhost`, single-label hosts, wildcards on a public suffix) stay with the save-time check and the worker.
178
182
 
179
- `analyzeDesktopUiScript(script, options?)` does the same for a desktop script (call `parseDesktopUiScript` first). It takes `severity` and `externalReads`; the healing and pop-up handler rules are web only and never run on a desktop script. A web script gets exactly the problems it got before the desktop rules existed.
183
+ `analyzeAiStep(settings, savedScript?, options?)` analyses an AI Step: `aiStepNoAllowlist` for `settings.allowedHosts`, then the problems of its saved script (parsed with `parseUiScript`) when it has one. It takes every option except `aiStep` and `popupHandler`.
184
+
185
+ `analyzeDesktopUiScript(script, options?)` does the same for a desktop script (call `parseDesktopUiScript` first). It takes `severity` and `externalReads`; the healing, pop-up handler and AI Step rules are web only and never run on a desktop script. The desktop rules report nothing on a web script; `unnamedStep` and `sequenceTooLong` apply to both.
180
186
 
181
187
  ## Desktop scripts and the desk driver
182
188
 
@@ -1,15 +1,17 @@
1
1
  /**
2
2
  * `analyzeUiScript`: runs every analyzer rule over a parsed UI script
3
- * (spec 14 section 3, plan P1-02b).
3
+ * (spec 14 section 3, plan P1-02b); `analyzeDesktopUiScript` for desktop
4
+ * scripts (P2-03b) and `analyzeAiStep` for an AI Step (P5-05a).
4
5
  *
5
6
  * The analyzer is pure: it reads the script and nothing else, never throws
6
7
  * for a script `parseUiScript` accepted, and returns the same problems in the
7
8
  * browser (the builder) and on the server (the workflow service validator).
8
- * Problems are advice; none blocks a save.
9
+ * Problems are advice; none blocks a save. An `error` problem is what the
10
+ * promotion gate (plan P5-05b) blocks on, where a workspace turns it on.
9
11
  */
10
12
  import type { DesktopUiScript } from '../script/desktop-types.js';
11
13
  import type { UiScript } from '../script/types.js';
12
- import { type UiAnalyzeOptions, type UiAnalyzerRuleId, type UiProblemSeverity, type UiScriptProblem } from './types.js';
14
+ import { type UiAiStepSettings, type UiAnalyzeOptions, type UiAnalyzerRuleId, type UiProblemSeverity, type UiScriptProblem } from './types.js';
13
15
  /** The default severity of every rule, by id. */
14
16
  export declare const UI_ANALYZER_DEFAULT_SEVERITY: Readonly<Record<UiAnalyzerRuleId, UiProblemSeverity>>;
15
17
  /**
@@ -18,8 +20,8 @@ export declare const UI_ANALYZER_DEFAULT_SEVERITY: Readonly<Record<UiAnalyzerRul
18
20
  * within one place, in rule order. Pass the script `parseUiScript` returned.
19
21
  */
20
22
  export declare function analyzeUiScript(script: UiScript, options?: UiAnalyzeOptions): UiScriptProblem[];
21
- /** Options of `analyzeDesktopUiScript`: healing and pop-up handlers are web only. */
22
- export type UiDesktopAnalyzeOptions = Omit<UiAnalyzeOptions, 'healing' | 'popupHandler'>;
23
+ /** Options of `analyzeDesktopUiScript`: healing, pop-up handlers and the AI Step are web only. */
24
+ export type UiDesktopAnalyzeOptions = Omit<UiAnalyzeOptions, 'healing' | 'popupHandler' | 'aiStep'>;
23
25
  /**
24
26
  * The problems of a desktop script (plan P2-03b), as `analyzeUiScript` lists
25
27
  * them: every rule that applies to a desktop script, the desktop rules
@@ -27,3 +29,13 @@ export type UiDesktopAnalyzeOptions = Omit<UiAnalyzeOptions, 'healing' | 'popupH
27
29
  * script `parseDesktopUiScript` returned.
28
30
  */
29
31
  export declare function analyzeDesktopUiScript(script: DesktopUiScript, options?: UiDesktopAnalyzeOptions): UiScriptProblem[];
32
+ /** Options of `analyzeAiStep`: everything `analyzeUiScript` takes except the AI Step and pop-up handler settings. */
33
+ export type UiAiStepAnalyzeOptions = Omit<UiAnalyzeOptions, 'aiStep' | 'popupHandler'>;
34
+ /**
35
+ * The problems of an AI Step (plan P5-05a): `aiStepNoAllowlist` for its
36
+ * allowed sites, then the problems of its saved script (`savedScript`, from
37
+ * Save as steps, parsed by `parseUiScript`) when it has one, as
38
+ * `analyzeUiScript` lists them. The AI Step runs on a remote browser only, so
39
+ * its saved script is always a web script.
40
+ */
41
+ export declare function analyzeAiStep(settings: UiAiStepSettings, savedScript?: UiScript, options?: UiAiStepAnalyzeOptions): UiScriptProblem[];
@@ -1,11 +1,12 @@
1
1
  /**
2
- * The UI script analyzer (plan P1-02b): `analyzeUiScript` and, for desktop
3
- * scripts (plan P2-03b), `analyzeDesktopUiScript`, the rules,
2
+ * The UI script analyzer (plan P1-02b): `analyzeUiScript`, for desktop
3
+ * scripts (plan P2-03b) `analyzeDesktopUiScript`, for an AI Step (plan
4
+ * P5-05a) `analyzeAiStep`, the rules,
4
5
  * their message keys under `fluidgrids.builder.uiScript.problem.*` and the
5
6
  * English templates.
6
7
  */
7
- export { UI_ANALYZER_DEFAULT_SEVERITY, type UiDesktopAnalyzeOptions, analyzeDesktopUiScript, analyzeUiScript, } from './analyze.js';
8
- export { UI_ANALYZER_RULE_GROUPS, UI_ANALYZER_RULE_IDS, UI_PROBLEM_SEVERITIES, type UiAnalyzeOptions, type UiAnalyzerRuleGroup, type UiAnalyzerRuleId, type UiProblemSeverity, type UiProblemSeveritySetting, type UiRuleFinding, type UiScriptProblem, } from './types.js';
8
+ export { UI_ANALYZER_DEFAULT_SEVERITY, type UiAiStepAnalyzeOptions, type UiDesktopAnalyzeOptions, analyzeAiStep, analyzeDesktopUiScript, analyzeUiScript, } from './analyze.js';
9
+ export { UI_ANALYZER_RULE_GROUPS, UI_ANALYZER_RULE_IDS, UI_PROBLEM_SEVERITIES, type UiAiStepSettings, type UiAnalyzeOptions, type UiAnalyzerRuleGroup, type UiAnalyzerRuleId, type UiProblemSeverity, type UiProblemSeveritySetting, type UiRuleFinding, type UiScriptProblem, } from './types.js';
9
10
  export { UI_SCRIPT_PROBLEM_KEY_PREFIX, UI_SCRIPT_PROBLEM_MESSAGES, type UiScriptProblemMessageKey, type UiScriptProblemMessageName, problemMessage, problemMessageKey, } from './messages.js';
10
- export { UI_ANALYZER_RULES, type UiAnalyzerRule } from './rules/index.js';
11
+ export { UI_ANALYZER_RULES, UI_ANALYZER_SEQUENCE_LIMIT, type UiAnalyzerRule } from './rules/index.js';
11
12
  export { type ActiveStep, type AnalyzeContext, stepNumber } from './context.js';
@@ -39,6 +39,9 @@ export declare const UI_SCRIPT_PROBLEM_MESSAGES: {
39
39
  readonly popupHandlerNoAction: "The pop-up handler has no step that clicks, checks or presses a key, so it cannot clear the pop-up.";
40
40
  readonly runCommandFromVariable: "Step {{step}} runs a command built from {{name}}. A value read from the screen, a file or another node could change what the command does. Use a fixed command, or check the value in an earlier step.";
41
41
  readonly singleMethodImageTarget: "Step {{step}} finds {{target}} by an image only. An image match breaks when the theme, the display scale or the resolution changes. Add a selector or a text method.";
42
+ readonly aiStepNoAllowlist: "The AI Step has no allowed sites that limit where it may go, so it could go to any site a page or the model sends it to. Add the sites it may visit.";
43
+ readonly unnamedStep: "Step {{step}} has no name. Name it after what it does, so the run log and the problems list say which step is meant.";
44
+ readonly sequenceTooLong: "The sequence that holds step {{step}} has {{count}} steps that run, more than {{limit}}. Split it into shared sequences or several nodes, so it stays easy to read and to fix.";
42
45
  };
43
46
  export type UiScriptProblemMessageName = keyof typeof UI_SCRIPT_PROBLEM_MESSAGES;
44
47
  export type UiScriptProblemMessageKey = `fluidgrids.builder.uiScript.problem.${UiScriptProblemMessageName}`;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Security (spec 13 section 6.1, spec 14 section 3; plan P5-05a; contracts
3
+ * README sections 22.3 and 46.1): an AI Step with no allowed-site list. A
4
+ * model drives the remote browser, so without the list a page that carries
5
+ * injected instructions, or the model itself, could send it to any public
6
+ * site with the person's connections. The save-time preset check
7
+ * (`AI_STEP_INVALID`) already refuses an empty list on new nodes; this rule
8
+ * also reports nodes saved before that check, and is the finding the
9
+ * promotion gate (P5-05b) blocks on. Its default severity is `error`.
10
+ *
11
+ * Runs only when the analyzer is given the AI Step's settings
12
+ * (`options.aiStep`, which `analyzeAiStep` sets); a plain UI script and a
13
+ * desktop script are never reported. The settings are read as stored, so
14
+ * any shape is accepted and none throws. The list is missing when the
15
+ * setting is absent, null or of another type, when the expression is blank,
16
+ * or when a literal list holds no entry that restricts the sites: blank
17
+ * entries, entries that are not text, `*`, and wildcards over one label
18
+ * (`*.com`) or with a `*` anywhere but a leading `*.` do not. A non-blank
19
+ * expression is not reported: the worker evaluates it and refuses an empty
20
+ * or invalid list at run time (threat I2). The full host rules (no IP
21
+ * address, `localhost`, single-label host or wildcard on a public suffix)
22
+ * stay with the save-time check and the worker, which hold the public-suffix
23
+ * list.
24
+ */
25
+ import type { UiAiStepSettings } from '../types.js';
26
+ import type { UiAnalyzerRule } from './rule.js';
27
+ export declare const aiStepNoAllowlistRule: UiAnalyzerRule;
28
+ /** True when the AI Step names at least one site that restricts where it may go, or an expression that will. */
29
+ export declare function hasAllowedSites(settings: UiAiStepSettings): boolean;
@@ -1,3 +1,4 @@
1
1
  import type { UiAnalyzerRule } from './rule.js';
2
2
  export type { UiAnalyzerRule } from './rule.js';
3
+ export { UI_ANALYZER_SEQUENCE_LIMIT } from './sequence-too-long.js';
3
4
  export declare const UI_ANALYZER_RULES: readonly UiAnalyzerRule[];
@@ -0,0 +1,4 @@
1
+ import type { UiAnalyzerRule } from './rule.js';
2
+ /** Steps that run in one sequence, at most, before `sequenceTooLong` reports it. */
3
+ export declare const UI_ANALYZER_SEQUENCE_LIMIT = 200;
4
+ export declare const sequenceTooLongRule: UiAnalyzerRule;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Maintainability (spec 14 section 3, "unnamed steps"; plan P5-05a): a step
3
+ * that runs and has no name. A step's name is its `intent`, the author's own
4
+ * words for what it does (the Stewards saved-step intent). Without one, the
5
+ * run log, the problems list and the review of a failed run show only the
6
+ * generated description, which reads the same for every click on a similar
7
+ * control. Reported once per step, as information.
8
+ */
9
+ import type { UiAnalyzerRule } from './rule.js';
10
+ export declare const unnamedStepRule: UiAnalyzerRule;
@@ -8,8 +8,14 @@
8
8
  */
9
9
  import type { UiTarget } from '../script/types.js';
10
10
  import type { UiScriptProblemMessageKey, UiScriptProblemMessageName } from './messages.js';
11
- /** How much a problem matters. Analyzer v1 never reports an error: a script that cannot run fails to parse instead. */
12
- export declare const UI_PROBLEM_SEVERITIES: readonly ["warning", "info"];
11
+ /**
12
+ * How much a problem matters. A script that cannot run fails to parse
13
+ * instead, so `error` marks a script that runs but should not be promoted:
14
+ * the promotion gate (plan P5-05b) blocks while an `error` problem exists.
15
+ * Only `aiStepNoAllowlist` defaults to `error`; a workspace may raise any
16
+ * rule to it (contracts README section 46.1).
17
+ */
18
+ export declare const UI_PROBLEM_SEVERITIES: readonly ["error", "warning", "info"];
13
19
  export type UiProblemSeverity = (typeof UI_PROBLEM_SEVERITIES)[number];
14
20
  /** A workspace's setting for one rule: a severity, or `off` to drop the rule's problems. */
15
21
  export type UiProblemSeveritySetting = UiProblemSeverity | 'off';
@@ -18,10 +24,11 @@ export declare const UI_ANALYZER_RULE_GROUPS: readonly ["reliability", "security
18
24
  export type UiAnalyzerRuleGroup = (typeof UI_ANALYZER_RULE_GROUPS)[number];
19
25
  /**
20
26
  * The analyzer's rules, in the order their problems are listed within one
21
- * step: the 11 of v1, the two healing rules (P4-06a) and the two desktop
22
- * rules (P2-03b), which report nothing on a web script.
27
+ * step: the 11 of v1, the two healing rules (P4-06a), the two desktop rules
28
+ * (P2-03b), which report nothing on a web script, and the three phase 5
29
+ * rules (P5-05a; contracts README section 46.1).
23
30
  */
24
- export declare const UI_ANALYZER_RULE_IDS: readonly ["fixedWait", "singleMethodTarget", "hardwareInput", "unknownVariable", "maskedValue", "noCleanup", "plainTextSecret", "secretOrigin", "sensitiveScreenshot", "inlineTarget", "unusedValue", "healConsequential", "popupHandlerLoop", "runCommandFromVariable", "singleMethodImageTarget"];
31
+ export declare const UI_ANALYZER_RULE_IDS: readonly ["fixedWait", "singleMethodTarget", "hardwareInput", "unknownVariable", "maskedValue", "noCleanup", "plainTextSecret", "secretOrigin", "sensitiveScreenshot", "inlineTarget", "unusedValue", "healConsequential", "popupHandlerLoop", "runCommandFromVariable", "singleMethodImageTarget", "aiStepNoAllowlist", "unnamedStep", "sequenceTooLong"];
25
32
  export type UiAnalyzerRuleId = (typeof UI_ANALYZER_RULE_IDS)[number];
26
33
  /** One problem the analyzer found. */
27
34
  export interface UiScriptProblem {
@@ -77,6 +84,24 @@ export interface UiAnalyzeOptions {
77
84
  target: UiTarget;
78
85
  };
79
86
  };
87
+ /**
88
+ * The script belongs to an AI Step (plan P5-05a; contracts README section
89
+ * 22.3), or the analysis is of an AI Step with no saved script. When given,
90
+ * the `aiStepNoAllowlist` rule checks its allowed sites; absent means the
91
+ * rule reports nothing. `analyzeAiStep` sets it.
92
+ */
93
+ aiStep?: UiAiStepSettings;
94
+ }
95
+ /**
96
+ * The AI Step settings the analyzer reads: `args.state.aiStep.allowedHosts`
97
+ * of a `store/ai-agent` node with `data.preset = "ai-step"`, as stored. A
98
+ * list is literal host names (or `*.host` wildcards); a string is an
99
+ * expression the worker evaluates and re-validates at run time (threat I2).
100
+ * The value comes from a store, so the analyzer checks its shape at run time
101
+ * and treats any other shape as no list.
102
+ */
103
+ export interface UiAiStepSettings {
104
+ allowedHosts?: unknown;
80
105
  }
81
106
  /** A problem as a rule reports it, before the analyzer adds the severity and the message. */
82
107
  export interface UiRuleFinding {
package/dist/analyze.js CHANGED
@@ -4,22 +4,26 @@ import {
4
4
  UI_SCRIPT_PROBLEM_MESSAGES2,
5
5
  problemMessageKey2,
6
6
  problemMessage2,
7
+ UI_ANALYZER_SEQUENCE_LIMIT2,
7
8
  UI_ANALYZER_RULES2,
8
9
  UI_PROBLEM_SEVERITIES2,
9
10
  UI_ANALYZER_RULE_GROUPS2,
10
11
  UI_ANALYZER_RULE_IDS2,
11
12
  UI_ANALYZER_DEFAULT_SEVERITY2,
12
13
  analyzeUiScript2,
13
- analyzeDesktopUiScript2
14
- } from "./index-7gfzv5n8.js";
14
+ analyzeDesktopUiScript2,
15
+ analyzeAiStep2
16
+ } from "./index-v3nw2n2g.js";
15
17
  export {
16
18
  UI_ANALYZER_DEFAULT_SEVERITY2 as UI_ANALYZER_DEFAULT_SEVERITY,
17
19
  UI_ANALYZER_RULES2 as UI_ANALYZER_RULES,
18
20
  UI_ANALYZER_RULE_GROUPS2 as UI_ANALYZER_RULE_GROUPS,
19
21
  UI_ANALYZER_RULE_IDS2 as UI_ANALYZER_RULE_IDS,
22
+ UI_ANALYZER_SEQUENCE_LIMIT2 as UI_ANALYZER_SEQUENCE_LIMIT,
20
23
  UI_PROBLEM_SEVERITIES2 as UI_PROBLEM_SEVERITIES,
21
24
  UI_SCRIPT_PROBLEM_KEY_PREFIX2 as UI_SCRIPT_PROBLEM_KEY_PREFIX,
22
25
  UI_SCRIPT_PROBLEM_MESSAGES2 as UI_SCRIPT_PROBLEM_MESSAGES,
26
+ analyzeAiStep2 as analyzeAiStep,
23
27
  analyzeDesktopUiScript2 as analyzeDesktopUiScript,
24
28
  analyzeUiScript2 as analyzeUiScript,
25
29
  problemMessage2 as problemMessage,
package/dist/drivers.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  parseUiScript2
3
3
  } from "./index-zj3zhbac.js";
4
4
  import"./index-dcs2pe49.js";
5
- import"./index-2q0hh6we.js";
5
+ import"./index-wk6416m8.js";
6
6
  import {
7
7
  DOM_DRIVER_CAPABILITIES2,
8
8
  safePageText2,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./index-wdbn4xjc.js";
12
12
  import {
13
13
  runUiScript2
14
- } from "./index-e557vzdd.js";
14
+ } from "./index-mv0r8wrh.js";
15
15
  import {
16
16
  createVirtualClock2
17
17
  } from "./index-b5a306v7.js";
package/dist/heal.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  matchesUrlPattern2,
18
18
  HEAL_POSITION_TOLERANCE_PX2,
19
19
  verifyHealCandidate2
20
- } from "./index-2q0hh6we.js";
20
+ } from "./index-wk6416m8.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-cc49ykn5.js";
29
+ } from "./index-e2pk74e6.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-7gfzv5n8.js";
46
+ } from "./index-v3nw2n2g.js";
47
47
  import {
48
48
  SNAPSHOT_ROOT_PATH2,
49
49
  MAX_SNAPSHOT_PATH_LENGTH2,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  compatibleRoles2,
3
3
  ACTIONABLE_ROLES
4
- } from "./index-7gfzv5n8.js";
4
+ } from "./index-v3nw2n2g.js";
5
5
  import {
6
6
  describeTarget2
7
7
  } from "./index-93hfbk5c.js";
@@ -14,7 +14,7 @@ import {
14
14
  usablePopupHandlers2,
15
15
  matchesUrlPattern2,
16
16
  verifyHealCandidate2
17
- } from "./index-2q0hh6we.js";
17
+ } from "./index-wk6416m8.js";
18
18
  import {
19
19
  isActingStep,
20
20
  classifyConsequence2,
@@ -22,7 +22,7 @@ import {
22
22
  HEALABLE_ACTIONS2,
23
23
  MAX_POPUP_HANDLERS_PER_STEP2,
24
24
  POPUP_HANDLER_STEP_WAIT_MS2
25
- } from "./index-7gfzv5n8.js";
25
+ } from "./index-v3nw2n2g.js";
26
26
  import {
27
27
  realClock2
28
28
  } from "./index-b5a306v7.js";
@@ -308,7 +308,10 @@ var UI_SCRIPT_PROBLEM_MESSAGES2 = {
308
308
  popupHandlerWait: "Pop-up handler step {{step}} waits {{milliseconds}} ms. A handler step waits at most 5,000 ms, so a pop-up never holds up a run.",
309
309
  popupHandlerNoAction: "The pop-up handler has no step that clicks, checks or presses a key, so it cannot clear the pop-up.",
310
310
  runCommandFromVariable: "Step {{step}} runs a command built from {{name}}. A value read from the screen, a file or another node could change what the command does. Use a fixed command, or check the value in an earlier step.",
311
- singleMethodImageTarget: "Step {{step}} finds {{target}} by an image only. An image match breaks when the theme, the display scale or the resolution changes. Add a selector or a text method."
311
+ singleMethodImageTarget: "Step {{step}} finds {{target}} by an image only. An image match breaks when the theme, the display scale or the resolution changes. Add a selector or a text method.",
312
+ aiStepNoAllowlist: "The AI Step has no allowed sites that limit where it may go, so it could go to any site a page or the model sends it to. Add the sites it may visit.",
313
+ unnamedStep: "Step {{step}} has no name. Name it after what it does, so the run log and the problems list say which step is meant.",
314
+ sequenceTooLong: "The sequence that holds step {{step}} has {{count}} steps that run, more than {{limit}}. Split it into shared sequences or several nodes, so it stays easy to read and to fix."
312
315
  };
313
316
  function problemMessageKey2(name) {
314
317
  return `${UI_SCRIPT_PROBLEM_KEY_PREFIX2}${name}`;
@@ -317,6 +320,37 @@ function problemMessage2(name, vars) {
317
320
  return UI_SCRIPT_PROBLEM_MESSAGES2[name].replace(/\{\{(\w+)\}\}/g, (_match, variable) => String(vars[variable] ?? ""));
318
321
  }
319
322
 
323
+ // src/analyze/rules/ai-step-no-allowlist.ts
324
+ var aiStepNoAllowlistRule = {
325
+ id: "aiStepNoAllowlist",
326
+ group: "security",
327
+ severity: "error",
328
+ description: "An AI Step whose allowed-site list is missing, empty or allows every site.",
329
+ check: (context) => {
330
+ const aiStep = context.options.aiStep;
331
+ if (aiStep === undefined || hasAllowedSites(aiStep))
332
+ return [];
333
+ return [{ message: "aiStepNoAllowlist", vars: {}, field: "allowedHosts", order: -1 }];
334
+ }
335
+ };
336
+ function hasAllowedSites(settings) {
337
+ const hosts = settings.allowedHosts;
338
+ if (typeof hosts === "string")
339
+ return hosts.trim().length > 0;
340
+ if (!Array.isArray(hosts))
341
+ return false;
342
+ return hosts.some(restrictsSites);
343
+ }
344
+ function restrictsSites(entry) {
345
+ if (typeof entry !== "string")
346
+ return false;
347
+ const host = entry.trim();
348
+ const rest = host.startsWith("*.") ? host.slice(2) : host;
349
+ if (rest.length === 0 || rest.includes("*"))
350
+ return false;
351
+ return rest === host || rest.includes(".");
352
+ }
353
+
320
354
  // src/analyze/rules/rule.ts
321
355
  function stepFinding(active, message, vars = {}, field) {
322
356
  return {
@@ -601,6 +635,38 @@ var secretOriginRule = {
601
635
  check: (context) => context.steps.flatMap((active) => active.step.action === "typeSecret" && active.step.expectedOrigin === undefined ? [stepFinding(active, "secretOrigin", {}, "expectedOrigin")] : [])
602
636
  };
603
637
 
638
+ // src/analyze/rules/sequence-too-long.ts
639
+ var UI_ANALYZER_SEQUENCE_LIMIT2 = 200;
640
+ var sequenceTooLongRule = {
641
+ id: "sequenceTooLong",
642
+ group: "maintainability",
643
+ severity: "warning",
644
+ description: `A sequence (the main steps, the clean-up block or a block of a flow step) with more than ${UI_ANALYZER_SEQUENCE_LIMIT2} steps that run.`,
645
+ check: (context) => {
646
+ const sequences = new Map;
647
+ for (const active of context.steps) {
648
+ const key = sequenceOf(active.path);
649
+ const list = sequences.get(key);
650
+ if (list === undefined)
651
+ sequences.set(key, [active]);
652
+ else
653
+ list.push(active);
654
+ }
655
+ const findings = [];
656
+ for (const list of sequences.values()) {
657
+ const first = list[UI_ANALYZER_SEQUENCE_LIMIT2];
658
+ if (first === undefined)
659
+ continue;
660
+ findings.push(stepFinding(first, "sequenceTooLong", { count: list.length, limit: UI_ANALYZER_SEQUENCE_LIMIT2 }));
661
+ }
662
+ return findings;
663
+ }
664
+ };
665
+ function sequenceOf(path) {
666
+ const cut = path.lastIndexOf(".");
667
+ return cut === -1 ? "" : path.slice(0, cut);
668
+ }
669
+
604
670
  // src/analyze/rules/sensitive-screenshot.ts
605
671
  var sensitiveScreenshotRule = {
606
672
  id: "sensitiveScreenshot",
@@ -742,6 +808,15 @@ var unknownVariableRule = {
742
808
  }
743
809
  };
744
810
 
811
+ // src/analyze/rules/unnamed-step.ts
812
+ var unnamedStepRule = {
813
+ id: "unnamedStep",
814
+ group: "maintainability",
815
+ severity: "info",
816
+ description: "A step with no name (intent) of its own.",
817
+ check: (context) => context.steps.filter((active) => (active.step.intent ?? "").trim().length === 0).map((active) => stepFinding(active, "unnamedStep", {}, "intent"))
818
+ };
819
+
745
820
  // src/analyze/rules/unused-value.ts
746
821
  var LOCAL_PREFIX = "__";
747
822
  var unusedValueRule = {
@@ -814,11 +889,14 @@ var UI_ANALYZER_RULES2 = [
814
889
  healConsequentialRule,
815
890
  popupHandlerLoopRule,
816
891
  runCommandFromVariableRule,
817
- singleMethodImageTargetRule
892
+ singleMethodImageTargetRule,
893
+ aiStepNoAllowlistRule,
894
+ unnamedStepRule,
895
+ sequenceTooLongRule
818
896
  ];
819
897
 
820
898
  // src/analyze/types.ts
821
- var UI_PROBLEM_SEVERITIES2 = ["warning", "info"];
899
+ var UI_PROBLEM_SEVERITIES2 = ["error", "warning", "info"];
822
900
  var UI_ANALYZER_RULE_GROUPS2 = ["reliability", "security", "maintainability"];
823
901
  var UI_ANALYZER_RULE_IDS2 = [
824
902
  "fixedWait",
@@ -835,7 +913,10 @@ var UI_ANALYZER_RULE_IDS2 = [
835
913
  "healConsequential",
836
914
  "popupHandlerLoop",
837
915
  "runCommandFromVariable",
838
- "singleMethodImageTarget"
916
+ "singleMethodImageTarget",
917
+ "aiStepNoAllowlist",
918
+ "unnamedStep",
919
+ "sequenceTooLong"
839
920
  ];
840
921
 
841
922
  // src/analyze/analyze.ts
@@ -854,6 +935,10 @@ function analyzeDesktopUiScript2(script, options = {}) {
854
935
  ...options.externalReads === undefined ? {} : { externalReads: options.externalReads }
855
936
  });
856
937
  }
938
+ var NO_SAVED_SCRIPT = Object.freeze({ scriptVersion: 1, steps: [] });
939
+ function analyzeAiStep2(settings, savedScript, options = {}) {
940
+ return analyze(savedScript ?? NO_SAVED_SCRIPT, { ...options, aiStep: settings });
941
+ }
857
942
  function analyze(script, options) {
858
943
  const context = createContext(script, options);
859
944
  const found = [];
@@ -883,4 +968,4 @@ function analyze(script, options) {
883
968
  return found.sort((a, b) => a.order - b.order || a.rank - b.rank || a.seq - b.seq).map(({ problem }) => problem);
884
969
  }
885
970
 
886
- export { MAX_HEAL_KEYWORDS2, MAX_HEAL_KEYWORD_LENGTH2, CONSEQUENCE_KEYWORDS2, keywordWords2, usableKeywords2, isActingStep, classifyConsequence2, elementInfoFromTarget2, stepNumber2, UI_SCRIPT_PROBLEM_KEY_PREFIX2, UI_SCRIPT_PROBLEM_MESSAGES2, problemMessageKey2, problemMessage2, HEALABLE_ACTIONS2, compatibleRoles2, VALUE_ACTIONS2, ACTIONABLE_ROLES, MAX_POPUP_HANDLERS_PER_STEP2, MAX_POPUP_HANDLERS_PER_APPLICATION2, MAX_POPUP_HANDLER_STEPS2, MAX_POPUP_URL_PATTERN2, POPUP_HANDLER_STEP_WAIT_MS2, UI_ANALYZER_RULES2, UI_PROBLEM_SEVERITIES2, UI_ANALYZER_RULE_GROUPS2, UI_ANALYZER_RULE_IDS2, UI_ANALYZER_DEFAULT_SEVERITY2, analyzeUiScript2, analyzeDesktopUiScript2 };
971
+ export { MAX_HEAL_KEYWORDS2, MAX_HEAL_KEYWORD_LENGTH2, CONSEQUENCE_KEYWORDS2, keywordWords2, usableKeywords2, isActingStep, classifyConsequence2, elementInfoFromTarget2, stepNumber2, UI_SCRIPT_PROBLEM_KEY_PREFIX2, UI_SCRIPT_PROBLEM_MESSAGES2, problemMessageKey2, problemMessage2, HEALABLE_ACTIONS2, compatibleRoles2, VALUE_ACTIONS2, ACTIONABLE_ROLES, MAX_POPUP_HANDLERS_PER_STEP2, MAX_POPUP_HANDLERS_PER_APPLICATION2, MAX_POPUP_HANDLER_STEPS2, MAX_POPUP_URL_PATTERN2, POPUP_HANDLER_STEP_WAIT_MS2, UI_ANALYZER_SEQUENCE_LIMIT2, UI_ANALYZER_RULES2, UI_PROBLEM_SEVERITIES2, UI_ANALYZER_RULE_GROUPS2, UI_ANALYZER_RULE_IDS2, UI_ANALYZER_DEFAULT_SEVERITY2, analyzeUiScript2, analyzeDesktopUiScript2, analyzeAiStep2 };
@@ -12,7 +12,7 @@ import {
12
12
  MAX_POPUP_HANDLER_STEPS2,
13
13
  MAX_POPUP_URL_PATTERN2,
14
14
  analyzeUiScript2
15
- } from "./index-7gfzv5n8.js";
15
+ } from "./index-v3nw2n2g.js";
16
16
  import {
17
17
  stepTargets2
18
18
  } from "./index-axph39g0.js";
package/dist/index.js CHANGED
@@ -124,7 +124,7 @@ import {
124
124
  matchesUrlPattern2,
125
125
  HEAL_POSITION_TOLERANCE_PX2,
126
126
  verifyHealCandidate2
127
- } from "./index-2q0hh6we.js";
127
+ } from "./index-wk6416m8.js";
128
128
  import {
129
129
  engineCodeOfDeskError2,
130
130
  engineDetailOfDeskError2,
@@ -154,7 +154,7 @@ import {
154
154
  targetFromSnapshotNode2,
155
155
  MAX_HEAL_ANSWER_LENGTH2,
156
156
  parseHealAnswer2
157
- } from "./index-cc49ykn5.js";
157
+ } from "./index-e2pk74e6.js";
158
158
  import {
159
159
  MAX_VALUE_TEXT2,
160
160
  MAX_VALUE_ITEMS2,
@@ -179,7 +179,7 @@ import {
179
179
  runUiScript2,
180
180
  DEFAULT_COMMAND_TIMEOUT_MS2,
181
181
  runDesktopUiScript2
182
- } from "./index-e557vzdd.js";
182
+ } from "./index-mv0r8wrh.js";
183
183
  import {
184
184
  MAX_HEAL_KEYWORDS2,
185
185
  MAX_HEAL_KEYWORD_LENGTH2,
@@ -201,14 +201,16 @@ import {
201
201
  MAX_POPUP_HANDLER_STEPS2,
202
202
  MAX_POPUP_URL_PATTERN2,
203
203
  POPUP_HANDLER_STEP_WAIT_MS2,
204
+ UI_ANALYZER_SEQUENCE_LIMIT2,
204
205
  UI_ANALYZER_RULES2,
205
206
  UI_PROBLEM_SEVERITIES2,
206
207
  UI_ANALYZER_RULE_GROUPS2,
207
208
  UI_ANALYZER_RULE_IDS2,
208
209
  UI_ANALYZER_DEFAULT_SEVERITY2,
209
210
  analyzeUiScript2,
210
- analyzeDesktopUiScript2
211
- } from "./index-7gfzv5n8.js";
211
+ analyzeDesktopUiScript2,
212
+ analyzeAiStep2
213
+ } from "./index-v3nw2n2g.js";
212
214
  import {
213
215
  realClock2,
214
216
  createVirtualClock2
@@ -441,6 +443,7 @@ export {
441
443
  UI_ANALYZER_RULES2 as UI_ANALYZER_RULES,
442
444
  UI_ANALYZER_RULE_GROUPS2 as UI_ANALYZER_RULE_GROUPS,
443
445
  UI_ANALYZER_RULE_IDS2 as UI_ANALYZER_RULE_IDS,
446
+ UI_ANALYZER_SEQUENCE_LIMIT2 as UI_ANALYZER_SEQUENCE_LIMIT,
444
447
  UI_ANCHOR_RELATIONS2 as UI_ANCHOR_RELATIONS,
445
448
  UI_CONSEQUENCES2 as UI_CONSEQUENCES,
446
449
  UI_DESKTOP_ACTIONS2 as UI_DESKTOP_ACTIONS,
@@ -476,6 +479,7 @@ export {
476
479
  UiScriptError2 as UiScriptError,
477
480
  VALUE_ACTIONS2 as VALUE_ACTIONS,
478
481
  afterReplayCall2 as afterReplayCall,
482
+ analyzeAiStep2 as analyzeAiStep,
479
483
  analyzeDesktopUiScript2 as analyzeDesktopUiScript,
480
484
  analyzeUiPopupHandler2 as analyzeUiPopupHandler,
481
485
  analyzeUiScript2 as analyzeUiScript,
package/dist/interpret.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import"./index-dcs2pe49.js";
2
2
  import"./index-zj3zhbac.js";
3
- import"./index-2q0hh6we.js";
3
+ import"./index-wk6416m8.js";
4
4
  import {
5
5
  MAX_CALL_DEPTH2,
6
6
  COMPILED_NAME_PREFIX2,
@@ -33,7 +33,7 @@ import {
33
33
  runUiScript2,
34
34
  DEFAULT_COMMAND_TIMEOUT_MS2,
35
35
  runDesktopUiScript2
36
- } from "./index-e557vzdd.js";
36
+ } from "./index-mv0r8wrh.js";
37
37
  import {
38
38
  realClock2,
39
39
  createVirtualClock2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/ui-engine",
3
- "version": "2026.1204.2",
3
+ "version": "2026.1204.3",
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, UI step healing, the desktop script schema with its desk capability check, and the desk driver that runs desktop scripts for FluidGrids RPA and BotManor Stewards.",
5
5
  "license": "MIT",
6
6
  "author": "Burdenoff Consultancy Services Pvt. Ltd.",