@burdenoff/ui-engine 2026.1204.1 → 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 +28 -4
- package/dist/analyze/analyze.d.ts +25 -3
- package/dist/analyze/context.d.ts +25 -9
- package/dist/analyze/index.d.ts +6 -4
- package/dist/analyze/messages.d.ts +5 -0
- package/dist/analyze/rules/ai-step-no-allowlist.d.ts +29 -0
- package/dist/analyze/rules/index.d.ts +1 -0
- package/dist/analyze/rules/run-command-from-variable.d.ts +2 -0
- package/dist/analyze/rules/sequence-too-long.d.ts +4 -0
- package/dist/analyze/rules/single-method-image-target.d.ts +7 -0
- package/dist/analyze/rules/unnamed-step.d.ts +10 -0
- package/dist/analyze/sensitive.d.ts +2 -2
- package/dist/analyze/types.d.ts +33 -4
- package/dist/analyze.js +8 -2
- package/dist/desk.d.ts +13 -0
- package/dist/desk.js +29 -0
- package/dist/dom-runtime.iife.js +1 -1
- package/dist/dom-runtime.js +2 -2
- package/dist/drivers/desk-backend.d.ts +40 -0
- package/dist/drivers/desk-driver.d.ts +41 -0
- package/dist/drivers/desk-errors.d.ts +19 -0
- package/dist/drivers/desk-tree.d.ts +28 -0
- package/dist/drivers/desk-wire.d.ts +237 -0
- package/dist/drivers/index.d.ts +3 -1
- package/dist/drivers.js +10 -7
- package/dist/heal.js +5 -5
- package/dist/index-0ps53dhe.js +85 -0
- package/dist/index-552x2bnm.js +56 -0
- package/dist/index-6m0chbhq.js +64 -0
- package/dist/{index-gvavb597.js → index-93hfbk5c.js} +10 -0
- package/dist/index-a8s39bse.js +920 -0
- package/dist/index-b5a306v7.js +43 -0
- package/dist/index-bx4bsvg0.js +458 -0
- package/dist/{index-9xgz8dxt.js → index-e2pk74e6.js} +4 -4
- package/dist/{index-vnv9tp11.js → index-e7pgqd60.js} +2 -2
- package/dist/index-hdq3y007.js +246 -0
- package/dist/{index-vpm1gnmy.js → index-mv0r8wrh.js} +219 -34
- package/dist/{index-zagmp5ya.js → index-n3nfhjrj.js} +2 -2
- package/dist/{index-wnch00m6.js → index-nmsg2wze.js} +2 -2
- package/dist/{index-zhbwhdya.js → index-q2jbva7c.js} +5 -3
- package/dist/{index-n7ah1jn7.js → index-rbem2yms.js} +16 -243
- package/dist/{index-mhv6a02p.js → index-reef7e8m.js} +1 -1
- package/dist/{index-dwp10g62.js → index-v3nw2n2g.js} +182 -54
- package/dist/{index-3r2y0mnc.js → index-wdbn4xjc.js} +5 -5
- package/dist/{index-ptrmf779.js → index-wk6416m8.js} +3 -3
- package/dist/{index-8eb4xd1j.js → index-x8fc4r4h.js} +101 -426
- package/dist/{index-0tfzfxx9.js → index-yhzykhdj.js} +1 -43
- package/dist/{index-t55wvhvh.js → index-z2v8prer.js} +1 -61
- package/dist/{index-5pv673wd.js → index-zj3zhbac.js} +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +83 -31
- package/dist/interpret/driver.d.ts +109 -18
- package/dist/interpret/events.d.ts +5 -2
- package/dist/interpret/index.d.ts +4 -3
- package/dist/interpret/run.d.ts +28 -1
- package/dist/interpret.js +16 -9
- package/dist/script/adapters/recording-desktop.d.ts +52 -0
- package/dist/script/describe.d.ts +7 -2
- package/dist/script/desk-roles.d.ts +33 -0
- package/dist/script/desktop-capabilities.d.ts +7 -2
- package/dist/script/desktop-schema.d.ts +2 -0
- package/dist/script/index.d.ts +3 -1
- package/dist/script.js +35 -19
- package/dist/target/types.d.ts +10 -4
- package/dist/target.js +20 -16
- package/dist/testing.js +5 -3
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ bun add @burdenoff/ui-engine zod
|
|
|
14
14
|
|
|
15
15
|
## Modules
|
|
16
16
|
|
|
17
|
-
Each module is a subpath export. The root entry re-exports the data and planning modules (`recording` to `script`, `interpret`, `analyze` and `
|
|
17
|
+
Each module is a subpath export. The root entry re-exports the data and planning modules (`recording` to `script`, `interpret`, `analyze`, `heal` and `desk`); the DOM modules (`target`, `dom-runtime`, `drivers`, `testing`) are subpath-only, so a consumer without DOM types, such as a service, never loads them through the root.
|
|
18
18
|
|
|
19
19
|
| Import | What it holds |
|
|
20
20
|
|---|---|
|
|
@@ -28,9 +28,10 @@ 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`, the 11 rules of v1
|
|
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
|
+
| `@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") |
|
|
34
35
|
| `@burdenoff/ui-engine/testing` | Copies of the RPA playground fixture pages (`RPA_FIXTURES`), `mountFixture` for test DOMs, and `createFakeWebDriver`, a fake web desk over them |
|
|
35
36
|
|
|
36
37
|
## UI script v1
|
|
@@ -146,7 +147,7 @@ The runtime must be injected into an isolated world (a content script, or a CDP
|
|
|
146
147
|
|
|
147
148
|
## The analyzer
|
|
148
149
|
|
|
149
|
-
`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,
|
|
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.
|
|
150
151
|
|
|
151
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.
|
|
152
153
|
|
|
@@ -164,14 +165,37 @@ A problem is `{ rule, group, severity, messageKey, vars, message, path?, stepId?
|
|
|
164
165
|
| `inlineTarget` | maintainability | info | A step's first inline target, which could be an Element library element |
|
|
165
166
|
| `healConsequential` | security | info | Only with `healing` options: a step whose control looks like a payment, delete, send-outside or security control (`healConsequential`), or matches a workspace always-ask phrase (`healAlwaysAskKeyword`). Healing never changes such a step's target without a person's approval. Steps listed in `alwaysAskStepIds` are not reported |
|
|
166
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
|
+
| `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
|
+
| `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 |
|
|
167
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 |
|
|
168
174
|
|
|
169
175
|
Options:
|
|
170
176
|
|
|
171
|
-
- `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.
|
|
172
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.
|
|
173
179
|
- `healing`: `{ alwaysAskStepIds?, keywords? }`, the node's and workspace's healing settings, for `healConsequential`.
|
|
174
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.
|
|
182
|
+
|
|
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.
|
|
186
|
+
|
|
187
|
+
## Desktop scripts and the desk driver
|
|
188
|
+
|
|
189
|
+
A desktop script (`surface: "desktop"`, `parseDesktopUiScript`, `DESKTOP_SCRIPT_SCHEMA_HASH`) runs next to the screen through a desk's `run` entry (desk contract v3 section 7). `checkDesktopScriptForDesk` decides before dispatch whether a desk can run it; the desk driver runs it.
|
|
190
|
+
|
|
191
|
+
- `runDesktopUiScript(script, createDeskDriver(backend, options?), runOptions?)` runs the script with the interpreter's waits, retries, verification, flow steps, clean-up, step ranges and events. Before any step it parses the script (compiled: elements carry their targets, calls are inlined) and checks it against the desk's capabilities: `INVALID_SCRIPT`, `UNSUPPORTED_ON_DESK`, or `SHELL_NOT_ALLOWED` when Run command or file-write steps meet `allowShell: false` on the request (`runOptions.allowShell`, the pool or grant) or on the machine. Repairs (healing, pop-up handlers, target overrides) are web only.
|
|
192
|
+
- `deskBackendFromAct({ capabilities, act })` wraps one guarded desk action, such as the plugin SDK's `DeskRunContext.act`; the driver never reaches a provider around the guard.
|
|
193
|
+
- **Targets.** A target's enabled methods are tried in order; the first that finds exactly one element in the state the step needs wins. `uia`, `ax` and `atspi` are selectors the desk resolves (`find`); `css` and `testId` are sent as `css` selectors with the role of the target's role method (without one they are skipped, and `checkDesktopScriptForDesk` does not count them); `image`, `text` and `ocr` are `find` with an image or text target; `role`, `fuzzy` and `anchor` are resolved by the engine on the desk's `desk-tree-v1` snapshot, with role names compared across interfaces (`button`, `Button`, `AXButton` and `push button` match). The element is then acted on as a `ref`. Several matches are `ELEMENT_AMBIGUOUS` (up to five candidates) and nothing is acted on; so is a single match on a capped answer (a `find` with `truncated`, or a tree snapshot over its node limit), because it does not prove the element is unique.
|
|
194
|
+
- **Input methods.** With `direct` input a click is `invoke` and typing that replaces a value is `set_value`; with `hardware` a click is `click`, and typing empties the field with `set_value`, then types with `type` (as the web clears a field before typing); `auto` prefers the pattern actions when the desk has them, and clicks with the pointer when the desk refuses `invoke` for a control without the pattern (`UNSUPPORTED_ON_DESK`). A pattern takes at most 10,000 characters: longer text is typed with hardware input, and refused (`ACTION_FAILED`) with `direct` or `auto`. Emptying a field needs `set_value`, also for hardware typing. `checkDesktopScriptForDesk` asks for these actions; a literal Wait for text or text check longer than 256 characters needs `snapshot`, because the driver looks for it in the screen text.
|
|
195
|
+
- **Reads.** A read of every match reads each element by its ref, as a single read does. The text, value and attributes of a password or code field (a secure text role, or an editable field whose name reads like a secret) are never read: `SENSITIVE_ELEMENT`, `null` in a read of every match, and left out of the screen text.
|
|
196
|
+
- **Errors.** Desk codes become engine codes with the desk code in `detail.deskCode`: `TARGET_NOT_FOUND` is `ELEMENT_NOT_FOUND` or `ELEMENT_AMBIGUOUS` (by `detail.matches`); a stale fence, a takeover, the kill switch, missing consent and an offline desk are `DESK_UNAVAILABLE`; `URL_BLOCKED` is `URL_NOT_ALLOWED`; `ORIGIN_MISMATCH` is `SECRET_UNAVAILABLE`; `TIMEOUT` is `APPLICATION_NOT_RESPONDING`; `OUTSIDE_WORKSPACE_FOLDER` is `ACTION_FAILED` with `detail.problem`. An application or window the desk cannot find is `WINDOW_NOT_FOUND`.
|
|
197
|
+
- **Files and secrets.** A file path or working folder that is absolute, has a `..` segment or a drive letter is refused before it reaches the desk (`ACTION_FAILED`, `OUTSIDE_WORKSPACE_FOLDER`). `fileCopy` reads and writes text (desk contract v3 has no copy action), and fails rather than write a partial copy of a file that fills the 10 MiB read limit; `fileList` and `fileDelete` are refused until it has actions for them (BOFF-18562). Type secret sends the run's one-time reference for the step (`options.secretRefFor`), never a value. Screenshots go to `options.storeScreenshot`.
|
|
198
|
+
- **Saved steps.** `fromRecordingForDesk(recording, { platform })` turns a Stewards recording into a desktop script: each target keeps its role method first and gains a one-node strict selector in the platform's role names when the recorded target is the first of its equal matches (a saved step does not record the path from the window). `fromRecording` and its goldens are unchanged.
|
|
175
199
|
|
|
176
200
|
## Healing
|
|
177
201
|
|
|
@@ -1,14 +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
|
*/
|
|
12
|
+
import type { DesktopUiScript } from '../script/desktop-types.js';
|
|
10
13
|
import type { UiScript } from '../script/types.js';
|
|
11
|
-
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';
|
|
12
15
|
/** The default severity of every rule, by id. */
|
|
13
16
|
export declare const UI_ANALYZER_DEFAULT_SEVERITY: Readonly<Record<UiAnalyzerRuleId, UiProblemSeverity>>;
|
|
14
17
|
/**
|
|
@@ -17,3 +20,22 @@ export declare const UI_ANALYZER_DEFAULT_SEVERITY: Readonly<Record<UiAnalyzerRul
|
|
|
17
20
|
* within one place, in rule order. Pass the script `parseUiScript` returned.
|
|
18
21
|
*/
|
|
19
22
|
export declare function analyzeUiScript(script: UiScript, options?: UiAnalyzeOptions): UiScriptProblem[];
|
|
23
|
+
/** Options of `analyzeDesktopUiScript`: healing, pop-up handlers and the AI Step are web only. */
|
|
24
|
+
export type UiDesktopAnalyzeOptions = Omit<UiAnalyzeOptions, 'healing' | 'popupHandler' | 'aiStep'>;
|
|
25
|
+
/**
|
|
26
|
+
* The problems of a desktop script (plan P2-03b), as `analyzeUiScript` lists
|
|
27
|
+
* them: every rule that applies to a desktop script, the desktop rules
|
|
28
|
+
* `runCommandFromVariable` and `singleMethodImageTarget` included. Pass the
|
|
29
|
+
* script `parseDesktopUiScript` returned.
|
|
30
|
+
*/
|
|
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,8 +1,22 @@
|
|
|
1
|
+
import type { DesktopUiScript, DesktopUiScriptElement, DesktopUiStep, DesktopUiTarget, DesktopUiTargetRef } from '../script/desktop-types.js';
|
|
1
2
|
import type { UiExpression, UiScript, UiScriptElement, UiStep, UiTarget, UiTargetRef } from '../script/types.js';
|
|
3
|
+
/** A web or a desktop script, and their parts: the analyzer reads both (desktop through `analyzeDesktopUiScript`). */
|
|
4
|
+
export type AnalyzedScript = UiScript | DesktopUiScript;
|
|
5
|
+
export type AnalyzedStep = UiStep | DesktopUiStep;
|
|
6
|
+
export type AnalyzedTargetRef = UiTargetRef | DesktopUiTargetRef;
|
|
2
7
|
import type { UiAnalyzeOptions } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* A step of a web script, for the web-only rules (`healConsequential`,
|
|
10
|
+
* `popupHandlerLoop`): they run only with web options (healing settings, a
|
|
11
|
+
* pop-up handler), which `analyzeDesktopUiScript` never takes, so the steps
|
|
12
|
+
* they see were parsed by `parseUiScript`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function webOnlyStep(step: AnalyzedStep): UiStep;
|
|
15
|
+
/** A target of a web script, for the web-only rules (see `webOnlyStep`). */
|
|
16
|
+
export declare function webOnlyTarget(target: DesktopUiTarget): UiTarget;
|
|
3
17
|
/** A step that runs (not disabled, and not inside a disabled block), with where it sits. */
|
|
4
18
|
export interface ActiveStep {
|
|
5
|
-
step:
|
|
19
|
+
step: AnalyzedStep;
|
|
6
20
|
path: string;
|
|
7
21
|
/** The step's number as an author reads it (`stepNumber`). */
|
|
8
22
|
number: string;
|
|
@@ -10,17 +24,17 @@ export interface ActiveStep {
|
|
|
10
24
|
order: number;
|
|
11
25
|
}
|
|
12
26
|
export interface AnalyzeContext {
|
|
13
|
-
script:
|
|
27
|
+
script: AnalyzedScript;
|
|
14
28
|
options: UiAnalyzeOptions;
|
|
15
|
-
elements: Readonly<Record<string, UiScriptElement>>;
|
|
29
|
+
elements: Readonly<Record<string, UiScriptElement | DesktopUiScriptElement>>;
|
|
16
30
|
/** The steps that run, in document order: the main steps, then the clean-up block. */
|
|
17
31
|
steps: readonly ActiveStep[];
|
|
18
32
|
/** Every step, disabled ones included; outputs sort after the last. */
|
|
19
33
|
totalSteps: number;
|
|
20
34
|
/** The target a reference stands for: the inline target, or the pinned element's target when the script carries it. */
|
|
21
|
-
targetOf(ref:
|
|
35
|
+
targetOf(ref: AnalyzedTargetRef): DesktopUiTarget | undefined;
|
|
22
36
|
/** A quoted, short description of a target, for messages. */
|
|
23
|
-
describeTarget(ref:
|
|
37
|
+
describeTarget(ref: AnalyzedTargetRef): string;
|
|
24
38
|
}
|
|
25
39
|
/**
|
|
26
40
|
* The number of a step as an author reads it: positions count from 1, the
|
|
@@ -29,12 +43,14 @@ export interface AnalyzeContext {
|
|
|
29
43
|
* `"5.else.0"` is `"6.else.1"` and `"cleanup.0"` is `"cleanup.1"`.
|
|
30
44
|
*/
|
|
31
45
|
export declare function stepNumber(path: string): string;
|
|
32
|
-
export declare function createContext(script:
|
|
46
|
+
export declare function createContext(script: AnalyzedScript, options: UiAnalyzeOptions): AnalyzeContext;
|
|
33
47
|
/** The names of the variables an expression reads. */
|
|
34
48
|
export declare function variablesRead(expression: UiExpression): string[];
|
|
49
|
+
/** The names of the script inputs an expression reads. */
|
|
50
|
+
export declare function inputsRead(expression: UiExpression): string[];
|
|
35
51
|
/** The variables a step reads through its own expressions (its nested blocks excluded). */
|
|
36
|
-
export declare function stepVariablesRead(step:
|
|
52
|
+
export declare function stepVariablesRead(step: AnalyzedStep): string[];
|
|
37
53
|
/** The variable names a step sets: its `saveAs`, a `set` name, and a for-each item and index. */
|
|
38
|
-
export declare function stepVariablesSet(step:
|
|
54
|
+
export declare function stepVariablesSet(step: AnalyzedStep): string[];
|
|
39
55
|
/** True for a step that signs in: a sign-in step or a secret typed into a field. */
|
|
40
|
-
export declare function signsIn(step:
|
|
56
|
+
export declare function signsIn(step: AnalyzedStep): boolean;
|
package/dist/analyze/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The UI script analyzer (plan P1-02b): `analyzeUiScript`,
|
|
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,
|
|
3
5
|
* their message keys under `fluidgrids.builder.uiScript.problem.*` and the
|
|
4
6
|
* English templates.
|
|
5
7
|
*/
|
|
6
|
-
export { UI_ANALYZER_DEFAULT_SEVERITY, analyzeUiScript } from './analyze.js';
|
|
7
|
-
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';
|
|
8
10
|
export { UI_SCRIPT_PROBLEM_KEY_PREFIX, UI_SCRIPT_PROBLEM_MESSAGES, type UiScriptProblemMessageKey, type UiScriptProblemMessageName, problemMessage, problemMessageKey, } from './messages.js';
|
|
9
|
-
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';
|
|
10
12
|
export { type ActiveStep, type AnalyzeContext, stepNumber } from './context.js';
|
|
@@ -37,6 +37,11 @@ export declare const UI_SCRIPT_PROBLEM_MESSAGES: {
|
|
|
37
37
|
readonly popupHandlerConsequential: "Pop-up handler step {{step}} acts on {{target}}, which looks like a {{consequence}} control. A handler never acts on such a control.";
|
|
38
38
|
readonly 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.";
|
|
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
|
+
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
|
+
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.";
|
|
40
45
|
};
|
|
41
46
|
export type UiScriptProblemMessageName = keyof typeof UI_SCRIPT_PROBLEM_MESSAGES;
|
|
42
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;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UiAnalyzerRule } from './rule.js';
|
|
2
|
+
export declare const singleMethodImageTargetRule: UiAnalyzerRule;
|
|
3
|
+
/** True when the only enabled method is an image. */
|
|
4
|
+
export declare function isImageOnly(methods: ReadonlyArray<{
|
|
5
|
+
kind: string;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
}>): boolean;
|
|
@@ -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;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* reads whole selectors and labels, where they also occur inside other words
|
|
8
8
|
* ("footprint", "hotpot", "secretary").
|
|
9
9
|
*/
|
|
10
|
-
import type {
|
|
10
|
+
import type { DesktopUiTarget } from '../script/desktop-types.js';
|
|
11
11
|
/** True when a name, label or selector reads like a secret field. */
|
|
12
12
|
export declare function readsLikeSecret(text: string): boolean;
|
|
13
13
|
/** True when a target, or the library element's name, reads like a password or code field. */
|
|
14
|
-
export declare function looksLikeSecretField(target:
|
|
14
|
+
export declare function looksLikeSecretField(target: DesktopUiTarget | undefined, elementName?: string): boolean;
|
package/dist/analyze/types.d.ts
CHANGED
|
@@ -8,16 +8,27 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { UiTarget } from '../script/types.js';
|
|
10
10
|
import type { UiScriptProblemMessageKey, UiScriptProblemMessageName } from './messages.js';
|
|
11
|
-
/**
|
|
12
|
-
|
|
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';
|
|
16
22
|
/** The rule groups of spec 14 section 3 that v1 covers. */
|
|
17
23
|
export declare const UI_ANALYZER_RULE_GROUPS: readonly ["reliability", "security", "maintainability"];
|
|
18
24
|
export type UiAnalyzerRuleGroup = (typeof UI_ANALYZER_RULE_GROUPS)[number];
|
|
19
|
-
/**
|
|
20
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The analyzer's rules, in the order their problems are listed within one
|
|
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).
|
|
30
|
+
*/
|
|
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"];
|
|
21
32
|
export type UiAnalyzerRuleId = (typeof UI_ANALYZER_RULE_IDS)[number];
|
|
22
33
|
/** One problem the analyzer found. */
|
|
23
34
|
export interface UiScriptProblem {
|
|
@@ -73,6 +84,24 @@ export interface UiAnalyzeOptions {
|
|
|
73
84
|
target: UiTarget;
|
|
74
85
|
};
|
|
75
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;
|
|
76
105
|
}
|
|
77
106
|
/** A problem as a rule reports it, before the analyzer adds the severity and the message. */
|
|
78
107
|
export interface UiRuleFinding {
|
package/dist/analyze.js
CHANGED
|
@@ -4,21 +4,27 @@ 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
|
-
analyzeUiScript2
|
|
13
|
-
|
|
13
|
+
analyzeUiScript2,
|
|
14
|
+
analyzeDesktopUiScript2,
|
|
15
|
+
analyzeAiStep2
|
|
16
|
+
} from "./index-v3nw2n2g.js";
|
|
14
17
|
export {
|
|
15
18
|
UI_ANALYZER_DEFAULT_SEVERITY2 as UI_ANALYZER_DEFAULT_SEVERITY,
|
|
16
19
|
UI_ANALYZER_RULES2 as UI_ANALYZER_RULES,
|
|
17
20
|
UI_ANALYZER_RULE_GROUPS2 as UI_ANALYZER_RULE_GROUPS,
|
|
18
21
|
UI_ANALYZER_RULE_IDS2 as UI_ANALYZER_RULE_IDS,
|
|
22
|
+
UI_ANALYZER_SEQUENCE_LIMIT2 as UI_ANALYZER_SEQUENCE_LIMIT,
|
|
19
23
|
UI_PROBLEM_SEVERITIES2 as UI_PROBLEM_SEVERITIES,
|
|
20
24
|
UI_SCRIPT_PROBLEM_KEY_PREFIX2 as UI_SCRIPT_PROBLEM_KEY_PREFIX,
|
|
21
25
|
UI_SCRIPT_PROBLEM_MESSAGES2 as UI_SCRIPT_PROBLEM_MESSAGES,
|
|
26
|
+
analyzeAiStep2 as analyzeAiStep,
|
|
27
|
+
analyzeDesktopUiScript2 as analyzeDesktopUiScript,
|
|
22
28
|
analyzeUiScript2 as analyzeUiScript,
|
|
23
29
|
problemMessage2 as problemMessage,
|
|
24
30
|
problemMessageKey2 as problemMessageKey,
|
package/dist/desk.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@burdenoff/ui-engine/desk`: the desk driver (RPA plan package P2-03b).
|
|
3
|
+
* `createDeskDriver` runs a desktop script's steps on a desk through desk
|
|
4
|
+
* contract v3 actions, over a `DeskBackend` (`deskBackendFromAct` wraps the
|
|
5
|
+
* desk's guarded per-action `act`); `runDesktopUiScript` (`./interpret`) is
|
|
6
|
+
* the run entry. No DOM dependency: the desk meta plugin, a service and a
|
|
7
|
+
* test load it without the DOM runtime.
|
|
8
|
+
*/
|
|
9
|
+
export { type CreateDeskDriverOptions, DEFAULT_DESK_SNAPSHOT_NODES, DESK_FIND_ALL_MAX, DESK_FIND_MAX, createDeskDriver, deskTargetOfMethod, } from './drivers/desk-driver.js';
|
|
10
|
+
export { type DeskBackend, type DeskBackendFromActOptions, type DeskCallContext, deskBackendFromAct, } from './drivers/desk-backend.js';
|
|
11
|
+
export { engineCodeOfDeskError, engineDetailOfDeskError } from './drivers/desk-errors.js';
|
|
12
|
+
export { type DeskTreeMethod, type DeskTreePick, deskNodeInState, matchDeskTreeMethod } from './drivers/desk-tree.js';
|
|
13
|
+
export { type DeskWireAction, type DeskWireActionType, type DeskWireBounds, type DeskWireError, type DeskWireGetValue, type DeskWireGetWhat, type DeskWireMatch, type DeskWireResult, type DeskWireSelectorNode, type DeskWireSelectorTarget, type DeskWireSnapshotOptions, type DeskWireTarget, type DeskWireTreeNode, type DeskWireTreeSnapshot, type DeskWireWindow, isDeskWireTreeSnapshot, } from './drivers/desk-wire.js';
|
package/dist/desk.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
engineCodeOfDeskError2,
|
|
3
|
+
engineDetailOfDeskError2,
|
|
4
|
+
deskNodeInState2,
|
|
5
|
+
matchDeskTreeMethod2,
|
|
6
|
+
isDeskWireTreeSnapshot2,
|
|
7
|
+
DESK_FIND_MAX2,
|
|
8
|
+
DESK_FIND_ALL_MAX2,
|
|
9
|
+
DEFAULT_DESK_SNAPSHOT_NODES2,
|
|
10
|
+
deskTargetOfMethod2,
|
|
11
|
+
createDeskDriver2,
|
|
12
|
+
deskBackendFromAct2
|
|
13
|
+
} from "./index-a8s39bse.js";
|
|
14
|
+
import"./index-bx4bsvg0.js";
|
|
15
|
+
import"./index-zj3zhbac.js";
|
|
16
|
+
import"./index-dcs2pe49.js";
|
|
17
|
+
export {
|
|
18
|
+
DEFAULT_DESK_SNAPSHOT_NODES2 as DEFAULT_DESK_SNAPSHOT_NODES,
|
|
19
|
+
DESK_FIND_ALL_MAX2 as DESK_FIND_ALL_MAX,
|
|
20
|
+
DESK_FIND_MAX2 as DESK_FIND_MAX,
|
|
21
|
+
createDeskDriver2 as createDeskDriver,
|
|
22
|
+
deskBackendFromAct2 as deskBackendFromAct,
|
|
23
|
+
deskNodeInState2 as deskNodeInState,
|
|
24
|
+
deskTargetOfMethod2 as deskTargetOfMethod,
|
|
25
|
+
engineCodeOfDeskError2 as engineCodeOfDeskError,
|
|
26
|
+
engineDetailOfDeskError2 as engineDetailOfDeskError,
|
|
27
|
+
isDeskWireTreeSnapshot2 as isDeskWireTreeSnapshot,
|
|
28
|
+
matchDeskTreeMethod2 as matchDeskTreeMethod
|
|
29
|
+
};
|