@burdenoff/ui-engine 2026.1203.1 → 2026.1204.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -2
- package/dist/analyze/analyze.d.ts +10 -0
- package/dist/analyze/context.d.ts +25 -9
- package/dist/analyze/index.d.ts +3 -2
- package/dist/analyze/messages.d.ts +2 -0
- package/dist/analyze/rules/run-command-from-variable.d.ts +2 -0
- package/dist/analyze/rules/single-method-image-target.d.ts +7 -0
- package/dist/analyze/sensitive.d.ts +2 -2
- package/dist/analyze/types.d.ts +6 -2
- package/dist/analyze.js +4 -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 +13 -10
- package/dist/heal.js +5 -5
- package/dist/index-0ps53dhe.js +85 -0
- package/dist/{index-qm9nd548.js → index-2q0hh6we.js} +4 -4
- package/dist/index-552x2bnm.js +56 -0
- package/dist/index-6m0chbhq.js +64 -0
- package/dist/{index-xdtanv9b.js → index-7gfzv5n8.js} +97 -54
- package/dist/{index-gvavb597.js → index-93hfbk5c.js} +10 -0
- package/dist/index-a8s39bse.js +920 -0
- package/dist/{index-g7724awk.js → index-axph39g0.js} +22 -0
- package/dist/index-b5a306v7.js +43 -0
- package/dist/index-bx4bsvg0.js +458 -0
- package/dist/{index-6h7ah1dw.js → index-cc49ykn5.js} +4 -4
- package/dist/{index-3hsp44k5.js → index-e557vzdd.js} +221 -36
- package/dist/{index-vnv9tp11.js → index-e7pgqd60.js} +2 -2
- package/dist/index-hdq3y007.js +246 -0
- package/dist/{index-zagmp5ya.js → index-n3nfhjrj.js} +2 -2
- package/dist/{index-rs3yzt5q.js → index-nmsg2wze.js} +4 -4
- 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-y4j6zep8.js → index-wdbn4xjc.js} +6 -6
- package/dist/{index-pfdm8evf.js → index-x8fc4r4h.js} +115 -9
- package/dist/{index-yc0jgph6.js → index-yhzykhdj.js} +6 -43
- package/dist/{index-t55wvhvh.js → index-z2v8prer.js} +1 -61
- package/dist/index-zj3zhbac.js +1123 -0
- package/dist/{index-hw5npwsv.js → index-zpxk3fzd.js} +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +162 -20
- package/dist/interpret/driver.d.ts +109 -18
- package/dist/interpret/errors.d.ts +7 -1
- 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 +125 -0
- package/dist/script/desktop-schema.d.ts +281 -0
- package/dist/script/desktop-types.d.ts +265 -0
- package/dist/script/fingerprint.d.ts +10 -1
- package/dist/script/hash.d.ts +9 -0
- package/dist/script/index.d.ts +14 -4
- package/dist/script/json-schema.d.ts +8 -0
- package/dist/script/parse.d.ts +29 -0
- package/dist/script/schema.d.ts +2098 -1
- package/dist/script/walk.d.ts +18 -4
- package/dist/script.js +118 -8
- package/dist/target/types.d.ts +10 -4
- package/dist/target.js +20 -16
- package/dist/testing.js +5 -3
- package/package.json +9 -3
- package/schema/ui-script-desktop-v1.schema.json +12181 -0
- package/dist/index-68x61c7a.js +0 -743
package/dist/interpret/run.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type UiPopupHandler } from '../heal/popup.js';
|
|
2
2
|
import { type UiHealHook, type UiHealReport, type UiHealSettings } from '../heal/types.js';
|
|
3
3
|
import type { UiTarget } from '../script/types.js';
|
|
4
|
-
import { type UiDriver } from './driver.js';
|
|
4
|
+
import { type UiDeskDriver, type UiDriver } from './driver.js';
|
|
5
5
|
import { type UiErrorCode, type UiErrorFamily } from './errors.js';
|
|
6
6
|
import { type UiRunEvent, type UiStepLogEntry } from './events.js';
|
|
7
7
|
import { type UiValue } from './expr.js';
|
|
@@ -108,3 +108,30 @@ export interface UiRunResult {
|
|
|
108
108
|
}
|
|
109
109
|
/** Run a UI script on a desk. Never throws for a script problem: the result carries it. */
|
|
110
110
|
export declare function runUiScript(script: unknown, driver: UiDriver, options?: RunUiScriptOptions): Promise<UiRunResult>;
|
|
111
|
+
/** The default timeout of a Run command step without its own. */
|
|
112
|
+
export declare const DEFAULT_COMMAND_TIMEOUT_MS = 60000;
|
|
113
|
+
/**
|
|
114
|
+
* Options of a desktop run. Repairs (pop-up handlers, healing and target
|
|
115
|
+
* overrides) are web only: a desktop run never uses them.
|
|
116
|
+
*/
|
|
117
|
+
export interface RunDesktopUiScriptOptions extends Omit<RunUiScriptOptions, 'onTargetNotFound' | 'healing' | 'popupHandlers' | 'targetOverrides'> {
|
|
118
|
+
/**
|
|
119
|
+
* The pool's or the automation grant's `allowShell` (the `run` request's
|
|
120
|
+
* `allowShell`). False refuses a script with Run command or file-write
|
|
121
|
+
* steps with `SHELL_NOT_ALLOWED`; absent leaves it to the desk's own
|
|
122
|
+
* `allowShell` (document 26 DR5b).
|
|
123
|
+
*/
|
|
124
|
+
allowShell?: boolean;
|
|
125
|
+
/** The schema hash the `run` request carries. Absent means `DESKTOP_SCRIPT_SCHEMA_HASH`. */
|
|
126
|
+
schemaHash?: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Run a desktop UI script on a desk driver (RPA plan package P2-03b; desk
|
|
130
|
+
* contract v3 section 7): the same waits, retries, verification, flow steps,
|
|
131
|
+
* clean-up, step ranges and events as a web run. Before any step it parses
|
|
132
|
+
* the script (`parseDesktopUiScript`, compiled: elements carry targets) and
|
|
133
|
+
* checks it against the desk's capabilities (`checkDesktopScriptForDesk`):
|
|
134
|
+
* `INVALID_SCRIPT`, `UNSUPPORTED_ON_DESK`, `SHELL_NOT_ALLOWED`. Never throws
|
|
135
|
+
* for a script problem: the result carries it.
|
|
136
|
+
*/
|
|
137
|
+
export declare function runDesktopUiScript(script: unknown, driver: UiDeskDriver, options?: RunDesktopUiScriptOptions): Promise<UiRunResult>;
|
package/dist/interpret.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import"./index-dcs2pe49.js";
|
|
2
|
-
import"./index-
|
|
3
|
-
import"./index-
|
|
2
|
+
import"./index-zj3zhbac.js";
|
|
3
|
+
import"./index-2q0hh6we.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-
|
|
11
|
+
} from "./index-nmsg2wze.js";
|
|
12
12
|
import {
|
|
13
13
|
MAX_VALUE_TEXT2,
|
|
14
14
|
MAX_VALUE_ITEMS2,
|
|
@@ -30,8 +30,14 @@ import {
|
|
|
30
30
|
MAX_EVENTS_LIMIT2,
|
|
31
31
|
MAX_PAGE_TEXT2,
|
|
32
32
|
DEFAULT_LIST_ITEMS2,
|
|
33
|
-
runUiScript2
|
|
34
|
-
|
|
33
|
+
runUiScript2,
|
|
34
|
+
DEFAULT_COMMAND_TIMEOUT_MS2,
|
|
35
|
+
runDesktopUiScript2
|
|
36
|
+
} from "./index-e557vzdd.js";
|
|
37
|
+
import {
|
|
38
|
+
realClock2,
|
|
39
|
+
createVirtualClock2
|
|
40
|
+
} from "./index-b5a306v7.js";
|
|
35
41
|
import {
|
|
36
42
|
UI_ERROR_FAMILIES2,
|
|
37
43
|
UI_ERROR_CODES2,
|
|
@@ -40,12 +46,12 @@ import {
|
|
|
40
46
|
errorFamilyOf2,
|
|
41
47
|
isRetryableInScript2,
|
|
42
48
|
UiRunError2,
|
|
43
|
-
UiDriverError2
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} from "./index-yc0jgph6.js";
|
|
49
|
+
UiDriverError2
|
|
50
|
+
} from "./index-yhzykhdj.js";
|
|
51
|
+
import"./index-bx4bsvg0.js";
|
|
47
52
|
export {
|
|
48
53
|
COMPILED_NAME_PREFIX2 as COMPILED_NAME_PREFIX,
|
|
54
|
+
DEFAULT_COMMAND_TIMEOUT_MS2 as DEFAULT_COMMAND_TIMEOUT_MS,
|
|
49
55
|
DEFAULT_FIRST_WAIT_MS2 as DEFAULT_FIRST_WAIT_MS,
|
|
50
56
|
DEFAULT_LIST_ITEMS2 as DEFAULT_LIST_ITEMS,
|
|
51
57
|
DEFAULT_MAX_EVENTS2 as DEFAULT_MAX_EVENTS,
|
|
@@ -75,6 +81,7 @@ export {
|
|
|
75
81
|
isUiErrorCode2 as isUiErrorCode,
|
|
76
82
|
readPath2 as readPath,
|
|
77
83
|
realClock2 as realClock,
|
|
84
|
+
runDesktopUiScript2 as runDesktopUiScript,
|
|
78
85
|
runUiScript2 as runUiScript,
|
|
79
86
|
stripBreakpoints2 as stripBreakpoints,
|
|
80
87
|
toNumber2 as toNumber,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stewards saved-step recordings (version 1) to desktop UI scripts with
|
|
3
|
+
* strict selectors (RPA plan package P2-03b; spec 18 section 6; desk contract
|
|
4
|
+
* v3 section 4).
|
|
5
|
+
*
|
|
6
|
+
* A saved step names its element the way a person sees it: the application,
|
|
7
|
+
* the window title, the accessibility role and label, and which of several
|
|
8
|
+
* equal matches it was. `fromRecording` keeps that as a role method, which
|
|
9
|
+
* the engine resolves on a snapshot exactly as Stewards replays it.
|
|
10
|
+
* `fromRecordingForDesk` keeps that role method first and adds the same
|
|
11
|
+
* description as a strict selector in the platform's own role names (UI
|
|
12
|
+
* Automation, macOS Accessibility or AT-SPI), which the desk resolves itself
|
|
13
|
+
* without a snapshot.
|
|
14
|
+
*
|
|
15
|
+
* The selector comes second, and only for a target recorded as the first of
|
|
16
|
+
* its equal matches (`nth` 0), because a saved step does not record the path
|
|
17
|
+
* from the window down to the element: a one-node selector matches the
|
|
18
|
+
* window's direct children only (desk contract v3 section 4), and its
|
|
19
|
+
* position among them is not the recorded position in the whole tree. Left
|
|
20
|
+
* without an `index`, the desk refuses it when several children match, so it
|
|
21
|
+
* never acts on another element than the role method would. It serves a desk
|
|
22
|
+
* that cannot take tree snapshots, and gives the target a second method.
|
|
23
|
+
*
|
|
24
|
+
* The recording is validated first (`parseRecording`: a tampered target fails
|
|
25
|
+
* there). Each converted step is fingerprinted again over both methods
|
|
26
|
+
* (`withDesktopFingerprint`), because the integrity check covers every method
|
|
27
|
+
* of a target. `fromRecording`, `toRecording` and their goldens are unchanged.
|
|
28
|
+
*/
|
|
29
|
+
import { type RecordedTarget } from '../../recording.js';
|
|
30
|
+
import { type DeskRolePlatform } from '../desk-roles.js';
|
|
31
|
+
import type { DesktopUiScript, DesktopUiTarget, DesktopUiTargetMethod } from '../desktop-types.js';
|
|
32
|
+
export interface FromRecordingForDeskOptions {
|
|
33
|
+
/** The accessibility interface of the desk the script will run on. */
|
|
34
|
+
platform: DeskRolePlatform;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The strict selector method for a recorded target on a platform, or
|
|
38
|
+
* undefined when it has no exact form there: a target recorded as one of
|
|
39
|
+
* several equal matches (`nth` above 0), a role with no counterpart on the
|
|
40
|
+
* platform, a label or title longer than a selector string, or an
|
|
41
|
+
* application that is not a plain application name.
|
|
42
|
+
*/
|
|
43
|
+
export declare function selectorMethodOfRecordedTarget(target: RecordedTarget, platform: DeskRolePlatform): DesktopUiTargetMethod | undefined;
|
|
44
|
+
/** A recorded target as a desktop target: the role method first, then the strict selector when there is one. */
|
|
45
|
+
export declare function desktopTargetOfRecordedTarget(target: RecordedTarget, platform: DeskRolePlatform): DesktopUiTarget;
|
|
46
|
+
/**
|
|
47
|
+
* A Stewards recording as a desktop UI script for a desk of the given
|
|
48
|
+
* platform. Every step keeps its id, intent, masked screenshot, masked typing
|
|
49
|
+
* and secret reference; targets gain the strict selector. The result passes
|
|
50
|
+
* `parseDesktopUiScript`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function fromRecordingForDesk(value: unknown, options: FromRecordingForDeskOptions): DesktopUiScript;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* Stewards intents) use the fallback. `UI_SCRIPT_STEP_MESSAGES` holds the
|
|
9
9
|
* English template of every key, with `{{name}}` placeholders.
|
|
10
10
|
*/
|
|
11
|
+
import type { DesktopUiScriptElement, DesktopUiTargetRef } from './desktop-types.js';
|
|
11
12
|
import type { UiExpression, UiScriptElement, UiStep, UiTargetRef } from './types.js';
|
|
12
13
|
/** The prefix of every step message key. */
|
|
13
14
|
export declare const UI_SCRIPT_STEP_KEY_PREFIX = "fluidgrids.uiScript.step.";
|
|
@@ -75,8 +76,12 @@ export interface StepDescription {
|
|
|
75
76
|
/** The English sentence, for consumers that do not translate. */
|
|
76
77
|
fallback: string;
|
|
77
78
|
}
|
|
78
|
-
/**
|
|
79
|
-
|
|
79
|
+
/**
|
|
80
|
+
* How a target reads in a sentence: the element's name, else what its first
|
|
81
|
+
* enabled method looks for. Desktop targets (plan P2-03b) read as the last
|
|
82
|
+
* selector node's name, automation id or role, an OCR text, or "image".
|
|
83
|
+
*/
|
|
84
|
+
export declare function describeTarget(ref: UiTargetRef | DesktopUiTargetRef | undefined, elements?: Readonly<Record<string, UiScriptElement | DesktopUiScriptElement>>): string;
|
|
80
85
|
/** How a value reads in a sentence: literals quoted, inputs and variables as [name], anything else as …. */
|
|
81
86
|
export declare function describeExpression(expression: UiExpression | undefined): string;
|
|
82
87
|
/** The description of one step. `elements` are the script's pinned elements, for their names. */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role names across accessibility interfaces (RPA plan package P2-03b).
|
|
3
|
+
*
|
|
4
|
+
* A Stewards saved step and a web role method name an element by an
|
|
5
|
+
* accessibility role such as `button` or `textbox`; a desktop desk names it
|
|
6
|
+
* by the platform's own role: a UI Automation ControlType (`Button`), a macOS
|
|
7
|
+
* Accessibility role (`AXButton`) or an AT-SPI role (`push button`). The
|
|
8
|
+
* legacy Windows snapshot reports lower-case control types (`edit`,
|
|
9
|
+
* `button`), which are listed here too.
|
|
10
|
+
*
|
|
11
|
+
* `platformRole` turns a recorded role into the platform's role for a strict
|
|
12
|
+
* selector, or returns undefined when there is no exact counterpart (the
|
|
13
|
+
* saved-step adapter then keeps only the role method). `rolesMatch` is the
|
|
14
|
+
* looser comparison the engine uses when it resolves a role method on a desk
|
|
15
|
+
* tree snapshot: equal ignoring case, or the same role across interfaces.
|
|
16
|
+
*/
|
|
17
|
+
import type { DesktopUiOnlyTargetMethodKind } from './desktop-types.js';
|
|
18
|
+
/** The selector platforms a recorded role can map to. */
|
|
19
|
+
export type DeskRolePlatform = Extract<DesktopUiOnlyTargetMethodKind, 'uia' | 'ax' | 'atspi'>;
|
|
20
|
+
/**
|
|
21
|
+
* The platform's own role name for a recorded role, or undefined when the
|
|
22
|
+
* role has no exact counterpart. A role already written in the platform's
|
|
23
|
+
* own form (`Button` for UI Automation, `AXButton` for macOS, `push button`
|
|
24
|
+
* for AT-SPI) is kept as it is.
|
|
25
|
+
*/
|
|
26
|
+
export declare function platformRole(role: string, platform: DeskRolePlatform): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a desk node's role is the role a method names: the same name, or
|
|
29
|
+
* the same role across interfaces (`button`, `Button`, `AXButton` and
|
|
30
|
+
* `push button` all match each other). A role the table does not know
|
|
31
|
+
* matches only itself, ignoring case.
|
|
32
|
+
*/
|
|
33
|
+
export declare function rolesMatch(wanted: string, actual: string): boolean;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { DesktopUiScript, DesktopUiStepAction, DesktopUiTarget, DesktopUiTargetMethod } from './desktop-types.js';
|
|
2
|
+
/** The desk contract version whose `run` entry takes desktop scripts. */
|
|
3
|
+
export declare const DESKTOP_DESK_CONTRACT_VERSION = 3;
|
|
4
|
+
/** Desk contract v3 actions, in `DESK_ACTION_TYPES` order (`@vibecontrols/plugin-sdk/desk-types`). */
|
|
5
|
+
export declare const DESK_ACTION_NAMES: readonly ["screenshot", "snapshot", "click", "type", "secret_fill", "key", "scroll", "navigate", "focus_window", "shell", "read_file", "write_file", "find", "get", "invoke", "set_value", "toggle", "select", "expand", "list_windows", "open_app", "close_app", "window_state", "highlight"];
|
|
6
|
+
export type DeskActionName = (typeof DESK_ACTION_NAMES)[number];
|
|
7
|
+
/** Desk contract v3 target kinds and selector platforms. */
|
|
8
|
+
export declare const DESK_TARGET_KIND_NAMES: readonly ["ref", "point", "window", "selector", "image", "text"];
|
|
9
|
+
export type DeskTargetKindName = (typeof DESK_TARGET_KIND_NAMES)[number];
|
|
10
|
+
export declare const DESK_SELECTOR_PLATFORM_NAMES: readonly ["uia", "ax", "atspi", "css"];
|
|
11
|
+
export type DeskSelectorPlatformName = (typeof DESK_SELECTOR_PLATFORM_NAMES)[number];
|
|
12
|
+
/** One thing a desk may support: a desk action, a target kind or a selector platform. */
|
|
13
|
+
export type DeskFeature = `action:${DeskActionName}` | `target:${DeskTargetKindName}` | `platform:${DeskSelectorPlatformName}`;
|
|
14
|
+
/**
|
|
15
|
+
* The fields of a desk's `capabilities()` this check reads. The plugin SDK's
|
|
16
|
+
* `DeskCapabilities` (`@vibecontrols/plugin-sdk/desk-types`) fits it; the
|
|
17
|
+
* engine does not depend on the SDK at run time.
|
|
18
|
+
*/
|
|
19
|
+
export interface DeskCapabilitiesLike {
|
|
20
|
+
deskContractVersion: number;
|
|
21
|
+
actions: readonly string[];
|
|
22
|
+
targetKinds: readonly string[];
|
|
23
|
+
selectorPlatforms: readonly string[];
|
|
24
|
+
scriptVersions: readonly number[];
|
|
25
|
+
scriptSchemaHashes: readonly string[];
|
|
26
|
+
allowShell: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** What one step, or one of its targets, needs from a desk. */
|
|
29
|
+
export interface DeskNeed {
|
|
30
|
+
path: string;
|
|
31
|
+
stepId: string;
|
|
32
|
+
action: DesktopUiStepAction;
|
|
33
|
+
/** `action` for the step's own action; otherwise the field that holds the target or the option. */
|
|
34
|
+
field: string;
|
|
35
|
+
/** Any one alternative is enough; an alternative needs every feature it lists. Empty: no desk can do it. */
|
|
36
|
+
anyOf: DeskFeature[][];
|
|
37
|
+
/** Why no desk can do it, when `anyOf` is empty. */
|
|
38
|
+
reason?: string;
|
|
39
|
+
}
|
|
40
|
+
/** The actions that run commands or change files on the machine (shell-gated, DR5b). */
|
|
41
|
+
export declare const DESK_SHELL_ACTIONS: readonly ["runCommand", "fileWrite", "fileCopy", "fileDelete", "openApp"];
|
|
42
|
+
export type DeskShellAction = (typeof DESK_SHELL_ACTIONS)[number];
|
|
43
|
+
/**
|
|
44
|
+
* Command interpreters, script hosts and terminals, by lower-case name
|
|
45
|
+
* without `.exe` or `.app`. Opening one is a shell step even without
|
|
46
|
+
* arguments. The desk's own allow list stays the primary control; this list
|
|
47
|
+
* keeps the obvious ones behind `allowShell` too.
|
|
48
|
+
*/
|
|
49
|
+
export declare const COMMAND_INTERPRETER_APPS: readonly string[];
|
|
50
|
+
/** Whether an application name is a command interpreter, script host or terminal. */
|
|
51
|
+
export declare function isCommandInterpreterApp(app: string): boolean;
|
|
52
|
+
/** A step that needs shell steps allowed. */
|
|
53
|
+
export interface DeskShellStep {
|
|
54
|
+
path: string;
|
|
55
|
+
stepId: string;
|
|
56
|
+
action: DeskShellAction;
|
|
57
|
+
}
|
|
58
|
+
/** Something the desk lacks. Desk-level problems have no step. */
|
|
59
|
+
export interface DeskShortfall {
|
|
60
|
+
path?: string;
|
|
61
|
+
stepId?: string;
|
|
62
|
+
action?: DesktopUiStepAction;
|
|
63
|
+
field: string;
|
|
64
|
+
/** The features of the closest alternative that the desk lacks; empty when no desk can do it. */
|
|
65
|
+
missing: DeskFeature[];
|
|
66
|
+
reason: string;
|
|
67
|
+
}
|
|
68
|
+
export type DesktopDeskCheck = {
|
|
69
|
+
ok: true;
|
|
70
|
+
} | {
|
|
71
|
+
ok: false;
|
|
72
|
+
code: 'UNSUPPORTED_ON_DESK';
|
|
73
|
+
message: string;
|
|
74
|
+
shortfalls: DeskShortfall[];
|
|
75
|
+
} | {
|
|
76
|
+
ok: false;
|
|
77
|
+
code: 'SHELL_NOT_ALLOWED';
|
|
78
|
+
message: string;
|
|
79
|
+
steps: DeskShellStep[];
|
|
80
|
+
};
|
|
81
|
+
export interface DesktopDeskCheckOptions {
|
|
82
|
+
/** The pool's or the automation grant's `allowShell` (default off on both). Absent: only the desk decides. */
|
|
83
|
+
allowShell?: boolean;
|
|
84
|
+
/** The schema hash the request carries. Absent means `DESKTOP_SCRIPT_SCHEMA_HASH`. */
|
|
85
|
+
schemaHash?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The desk features one target method needs, or undefined when no desk
|
|
89
|
+
* resolves it (an XPath). The desk driver (P2-03b) skips a method whose
|
|
90
|
+
* features the desk lacks.
|
|
91
|
+
*
|
|
92
|
+
* A `css` or `testId` method is sent to a desk as a `css` selector node,
|
|
93
|
+
* which a desk finds by role first (desk contract v3 section 4): it needs
|
|
94
|
+
* an enabled role method in the same target (pass `target`), and a test id
|
|
95
|
+
* must sit in `data-testid` or `id`, the attributes a desk matches.
|
|
96
|
+
*/
|
|
97
|
+
export declare function deskFeaturesOfMethod(method: DesktopUiTargetMethod, target?: DesktopUiTarget): DeskFeature[] | undefined;
|
|
98
|
+
/** Whether the capabilities include a feature. */
|
|
99
|
+
export declare function deskHasFeature(capabilities: DeskCapabilitiesLike, feature: DeskFeature): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Everything the script needs from a desk, step by step: the step's action,
|
|
102
|
+
* its options and each of its targets. A pinned element needs what its
|
|
103
|
+
* target uses when the script carries it (a compiled script always does).
|
|
104
|
+
*/
|
|
105
|
+
export declare function desktopScriptDeskNeeds(script: DesktopUiScript): DeskNeed[];
|
|
106
|
+
/**
|
|
107
|
+
* The steps that run commands or change files, which need shell steps allowed
|
|
108
|
+
* (DR5b). Check the compiled script: a `call` is refused by
|
|
109
|
+
* `checkDesktopScriptForDesk` until it is inlined.
|
|
110
|
+
*/
|
|
111
|
+
export declare function desktopShellSteps(script: DesktopUiScript): DeskShellStep[];
|
|
112
|
+
/**
|
|
113
|
+
* The shell check alone, for the service at save time and at dispatch: a
|
|
114
|
+
* script with Run command or file-write steps needs `allowShell` on the pool
|
|
115
|
+
* or the grant. Refused with `SHELL_NOT_ALLOWED`. Run it on the compiled
|
|
116
|
+
* script (shared sequences inlined), or the steps of a `call` are not seen.
|
|
117
|
+
*/
|
|
118
|
+
export declare function checkDesktopScriptShell(script: DesktopUiScript, allowShell: boolean): DesktopDeskCheck;
|
|
119
|
+
/**
|
|
120
|
+
* Whether a desk can run the script, before dispatch. `UNSUPPORTED_ON_DESK`
|
|
121
|
+
* comes first (the desk checks capabilities before shell, desk contract v3
|
|
122
|
+
* section 7.1); then `SHELL_NOT_ALLOWED` when the script has shell steps and
|
|
123
|
+
* the desk's `allowShell` or `options.allowShell` is false.
|
|
124
|
+
*/
|
|
125
|
+
export declare function checkDesktopScriptForDesk(script: DesktopUiScript, capabilities: DeskCapabilitiesLike | null | undefined, options?: DesktopDeskCheckOptions): DesktopDeskCheck;
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The zod schema of the desktop UI script (RPA plan package P2-03a; see
|
|
3
|
+
* `desktop-types.ts`). It reuses the web step definitions of `schema.ts`
|
|
4
|
+
* over desktop targets and adds the desktop actions and target methods.
|
|
5
|
+
* `parseDesktopUiScript` adds the checks a schema cannot express.
|
|
6
|
+
*
|
|
7
|
+
* The JSON Schema in `schema/ui-script-desktop-v1.schema.json` is generated
|
|
8
|
+
* from this file (`desktopUiScriptJsonSchema`) and its hash is
|
|
9
|
+
* `DESKTOP_SCRIPT_SCHEMA_HASH` (`hash.ts`). It has its own registry, so its
|
|
10
|
+
* `$defs` names never touch the web schema's.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { type DesktopUiScript, type DesktopUiStep, type DesktopUiTarget, type DesktopUiTargetRef } from './desktop-types.js';
|
|
14
|
+
/** Selector strings (desk contract v3 section 13): at most 256 characters each. */
|
|
15
|
+
export declare const MAX_DESK_SELECTOR_STRING = 256;
|
|
16
|
+
/** Nodes in a selector path. */
|
|
17
|
+
export declare const MAX_DESK_SELECTOR_PATH = 32;
|
|
18
|
+
/** Highest `index` in a selector node (the plugin SDK's bound). */
|
|
19
|
+
export declare const MAX_DESK_SELECTOR_INDEX = 10000;
|
|
20
|
+
/** Image target PNG: at most 64 KiB decoded and 256 by 256 pixels. */
|
|
21
|
+
export declare const MAX_DESK_IMAGE_BYTES: number;
|
|
22
|
+
export declare const MAX_DESK_IMAGE_PIXELS = 256;
|
|
23
|
+
/** The longest base64 text of a 64 KiB PNG. */
|
|
24
|
+
export declare const MAX_DESK_IMAGE_BASE64: number;
|
|
25
|
+
/** Text targets: 1 to 256 characters; the highest occurrence (the plugin SDK's bound). */
|
|
26
|
+
export declare const MAX_DESK_TEXT_TARGET = 256;
|
|
27
|
+
export declare const MAX_DESK_TEXT_OCCURRENCE = 1000;
|
|
28
|
+
/** Highest `recordedScale` (the plugin SDK's bound). */
|
|
29
|
+
export declare const MAX_DESK_RECORDED_SCALE = 8;
|
|
30
|
+
/** Largest screen coordinate (the desk's limit). */
|
|
31
|
+
export declare const MAX_DESK_COORDINATE = 32767;
|
|
32
|
+
/** `open_app` arguments: at most 16. */
|
|
33
|
+
export declare const MAX_DESK_OPEN_APP_ARGS = 16;
|
|
34
|
+
/** Attribute names one `get` step reads. */
|
|
35
|
+
export declare const MAX_DESK_GET_ATTRIBUTES = 32;
|
|
36
|
+
/** The largest file a `fileRead` step reads (the desk's `read_file` limit), and its default. */
|
|
37
|
+
export declare const MAX_DESK_FILE_BYTES: number;
|
|
38
|
+
export declare const DEFAULT_DESK_FILE_BYTES: number;
|
|
39
|
+
/** A literal workspace-relative path or folder, at most. */
|
|
40
|
+
export declare const MAX_DESK_PATH_LENGTH = 1024;
|
|
41
|
+
/** The longest value a desk's `set_value` takes (desk contract v3 section 5). */
|
|
42
|
+
export declare const MAX_DESK_SET_VALUE = 10000;
|
|
43
|
+
/** Ids of the named parts of the desktop schema, used as `$defs` names in its JSON Schema. */
|
|
44
|
+
export declare const desktopUiScriptRegistry: z.core.$ZodRegistry<{
|
|
45
|
+
id: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
}, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
48
|
+
/** The desktop target methods, appended after the web methods. */
|
|
49
|
+
export declare const desktopTargetMethodOptions: readonly [z.ZodObject<{
|
|
50
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
51
|
+
app: z.ZodOptional<z.ZodString>;
|
|
52
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
title: z.ZodOptional<z.ZodString>;
|
|
54
|
+
titleMatch: z.ZodOptional<z.ZodEnum<{
|
|
55
|
+
exact: "exact";
|
|
56
|
+
wildcard: "wildcard";
|
|
57
|
+
}>>;
|
|
58
|
+
class: z.ZodOptional<z.ZodString>;
|
|
59
|
+
processName: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, z.core.$strict>>;
|
|
61
|
+
path: z.ZodArray<z.ZodObject<{
|
|
62
|
+
role: z.ZodString;
|
|
63
|
+
name: z.ZodOptional<z.ZodString>;
|
|
64
|
+
automationId: z.ZodOptional<z.ZodString>;
|
|
65
|
+
className: z.ZodOptional<z.ZodString>;
|
|
66
|
+
index: z.ZodOptional<z.ZodInt>;
|
|
67
|
+
}, z.core.$strict>>;
|
|
68
|
+
kind: z.ZodLiteral<"uia">;
|
|
69
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
70
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
app: z.ZodOptional<z.ZodString>;
|
|
72
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
73
|
+
title: z.ZodOptional<z.ZodString>;
|
|
74
|
+
titleMatch: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
exact: "exact";
|
|
76
|
+
wildcard: "wildcard";
|
|
77
|
+
}>>;
|
|
78
|
+
class: z.ZodOptional<z.ZodString>;
|
|
79
|
+
processName: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$strict>>;
|
|
81
|
+
path: z.ZodArray<z.ZodObject<{
|
|
82
|
+
role: z.ZodString;
|
|
83
|
+
name: z.ZodOptional<z.ZodString>;
|
|
84
|
+
automationId: z.ZodOptional<z.ZodString>;
|
|
85
|
+
className: z.ZodOptional<z.ZodString>;
|
|
86
|
+
index: z.ZodOptional<z.ZodInt>;
|
|
87
|
+
}, z.core.$strict>>;
|
|
88
|
+
kind: z.ZodLiteral<"ax">;
|
|
89
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
90
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
app: z.ZodOptional<z.ZodString>;
|
|
92
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
title: z.ZodOptional<z.ZodString>;
|
|
94
|
+
titleMatch: z.ZodOptional<z.ZodEnum<{
|
|
95
|
+
exact: "exact";
|
|
96
|
+
wildcard: "wildcard";
|
|
97
|
+
}>>;
|
|
98
|
+
class: z.ZodOptional<z.ZodString>;
|
|
99
|
+
processName: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strict>>;
|
|
101
|
+
path: z.ZodArray<z.ZodObject<{
|
|
102
|
+
role: z.ZodString;
|
|
103
|
+
name: z.ZodOptional<z.ZodString>;
|
|
104
|
+
automationId: z.ZodOptional<z.ZodString>;
|
|
105
|
+
className: z.ZodOptional<z.ZodString>;
|
|
106
|
+
index: z.ZodOptional<z.ZodInt>;
|
|
107
|
+
}, z.core.$strict>>;
|
|
108
|
+
kind: z.ZodLiteral<"atspi">;
|
|
109
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
110
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
111
|
+
kind: z.ZodLiteral<"image">;
|
|
112
|
+
pngBase64: z.ZodString;
|
|
113
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
114
|
+
region: z.ZodOptional<z.ZodObject<{
|
|
115
|
+
x: z.ZodInt;
|
|
116
|
+
y: z.ZodInt;
|
|
117
|
+
w: z.ZodInt;
|
|
118
|
+
h: z.ZodInt;
|
|
119
|
+
}, z.core.$strict>>;
|
|
120
|
+
recordedScale: z.ZodOptional<z.ZodNumber>;
|
|
121
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
122
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
kind: z.ZodLiteral<"ocr">;
|
|
124
|
+
text: z.ZodString;
|
|
125
|
+
match: z.ZodOptional<z.ZodEnum<{
|
|
126
|
+
contains: "contains";
|
|
127
|
+
exact: "exact";
|
|
128
|
+
}>>;
|
|
129
|
+
occurrence: z.ZodOptional<z.ZodInt>;
|
|
130
|
+
region: z.ZodOptional<z.ZodObject<{
|
|
131
|
+
x: z.ZodInt;
|
|
132
|
+
y: z.ZodInt;
|
|
133
|
+
w: z.ZodInt;
|
|
134
|
+
h: z.ZodInt;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
}, z.core.$strict>];
|
|
137
|
+
export declare const desktopUiTargetMethodSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
138
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
139
|
+
kind: z.ZodLiteral<"role">;
|
|
140
|
+
role: z.ZodString;
|
|
141
|
+
name: z.ZodString;
|
|
142
|
+
nth: z.ZodOptional<z.ZodInt>;
|
|
143
|
+
app: z.ZodOptional<z.ZodString>;
|
|
144
|
+
window: z.ZodOptional<z.ZodString>;
|
|
145
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
146
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
+
kind: z.ZodLiteral<"css">;
|
|
148
|
+
selector: z.ZodString;
|
|
149
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
150
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
151
|
+
kind: z.ZodLiteral<"testId">;
|
|
152
|
+
value: z.ZodString;
|
|
153
|
+
attribute: z.ZodOptional<z.ZodString>;
|
|
154
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
155
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
kind: z.ZodLiteral<"xpath">;
|
|
157
|
+
xpath: z.ZodString;
|
|
158
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
159
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
160
|
+
kind: z.ZodLiteral<"fuzzy">;
|
|
161
|
+
role: z.ZodOptional<z.ZodString>;
|
|
162
|
+
name: z.ZodString;
|
|
163
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
165
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
166
|
+
kind: z.ZodLiteral<"anchor">;
|
|
167
|
+
anchor: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
168
|
+
kind: z.ZodLiteral<"text">;
|
|
169
|
+
text: z.ZodString;
|
|
170
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
171
|
+
kind: z.ZodLiteral<"role">;
|
|
172
|
+
role: z.ZodString;
|
|
173
|
+
name: z.ZodString;
|
|
174
|
+
}, z.core.$strict>], "kind">;
|
|
175
|
+
relation: z.ZodEnum<{
|
|
176
|
+
leftOf: "leftOf";
|
|
177
|
+
rightOf: "rightOf";
|
|
178
|
+
above: "above";
|
|
179
|
+
below: "below";
|
|
180
|
+
inside: "inside";
|
|
181
|
+
sameRow: "sameRow";
|
|
182
|
+
}>;
|
|
183
|
+
role: z.ZodOptional<z.ZodString>;
|
|
184
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
185
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
186
|
+
kind: z.ZodLiteral<"text">;
|
|
187
|
+
text: z.ZodString;
|
|
188
|
+
exact: z.ZodOptional<z.ZodBoolean>;
|
|
189
|
+
nth: z.ZodOptional<z.ZodInt>;
|
|
190
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
191
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
192
|
+
app: z.ZodOptional<z.ZodString>;
|
|
193
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
194
|
+
title: z.ZodOptional<z.ZodString>;
|
|
195
|
+
titleMatch: z.ZodOptional<z.ZodEnum<{
|
|
196
|
+
exact: "exact";
|
|
197
|
+
wildcard: "wildcard";
|
|
198
|
+
}>>;
|
|
199
|
+
class: z.ZodOptional<z.ZodString>;
|
|
200
|
+
processName: z.ZodOptional<z.ZodString>;
|
|
201
|
+
}, z.core.$strict>>;
|
|
202
|
+
path: z.ZodArray<z.ZodObject<{
|
|
203
|
+
role: z.ZodString;
|
|
204
|
+
name: z.ZodOptional<z.ZodString>;
|
|
205
|
+
automationId: z.ZodOptional<z.ZodString>;
|
|
206
|
+
className: z.ZodOptional<z.ZodString>;
|
|
207
|
+
index: z.ZodOptional<z.ZodInt>;
|
|
208
|
+
}, z.core.$strict>>;
|
|
209
|
+
kind: z.ZodLiteral<"uia">;
|
|
210
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
211
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
212
|
+
app: z.ZodOptional<z.ZodString>;
|
|
213
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
214
|
+
title: z.ZodOptional<z.ZodString>;
|
|
215
|
+
titleMatch: z.ZodOptional<z.ZodEnum<{
|
|
216
|
+
exact: "exact";
|
|
217
|
+
wildcard: "wildcard";
|
|
218
|
+
}>>;
|
|
219
|
+
class: z.ZodOptional<z.ZodString>;
|
|
220
|
+
processName: z.ZodOptional<z.ZodString>;
|
|
221
|
+
}, z.core.$strict>>;
|
|
222
|
+
path: z.ZodArray<z.ZodObject<{
|
|
223
|
+
role: z.ZodString;
|
|
224
|
+
name: z.ZodOptional<z.ZodString>;
|
|
225
|
+
automationId: z.ZodOptional<z.ZodString>;
|
|
226
|
+
className: z.ZodOptional<z.ZodString>;
|
|
227
|
+
index: z.ZodOptional<z.ZodInt>;
|
|
228
|
+
}, z.core.$strict>>;
|
|
229
|
+
kind: z.ZodLiteral<"ax">;
|
|
230
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
231
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
232
|
+
app: z.ZodOptional<z.ZodString>;
|
|
233
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
234
|
+
title: z.ZodOptional<z.ZodString>;
|
|
235
|
+
titleMatch: z.ZodOptional<z.ZodEnum<{
|
|
236
|
+
exact: "exact";
|
|
237
|
+
wildcard: "wildcard";
|
|
238
|
+
}>>;
|
|
239
|
+
class: z.ZodOptional<z.ZodString>;
|
|
240
|
+
processName: z.ZodOptional<z.ZodString>;
|
|
241
|
+
}, z.core.$strict>>;
|
|
242
|
+
path: z.ZodArray<z.ZodObject<{
|
|
243
|
+
role: z.ZodString;
|
|
244
|
+
name: z.ZodOptional<z.ZodString>;
|
|
245
|
+
automationId: z.ZodOptional<z.ZodString>;
|
|
246
|
+
className: z.ZodOptional<z.ZodString>;
|
|
247
|
+
index: z.ZodOptional<z.ZodInt>;
|
|
248
|
+
}, z.core.$strict>>;
|
|
249
|
+
kind: z.ZodLiteral<"atspi">;
|
|
250
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
251
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
252
|
+
kind: z.ZodLiteral<"image">;
|
|
253
|
+
pngBase64: z.ZodString;
|
|
254
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
255
|
+
region: z.ZodOptional<z.ZodObject<{
|
|
256
|
+
x: z.ZodInt;
|
|
257
|
+
y: z.ZodInt;
|
|
258
|
+
w: z.ZodInt;
|
|
259
|
+
h: z.ZodInt;
|
|
260
|
+
}, z.core.$strict>>;
|
|
261
|
+
recordedScale: z.ZodOptional<z.ZodNumber>;
|
|
262
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
263
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
264
|
+
kind: z.ZodLiteral<"ocr">;
|
|
265
|
+
text: z.ZodString;
|
|
266
|
+
match: z.ZodOptional<z.ZodEnum<{
|
|
267
|
+
contains: "contains";
|
|
268
|
+
exact: "exact";
|
|
269
|
+
}>>;
|
|
270
|
+
occurrence: z.ZodOptional<z.ZodInt>;
|
|
271
|
+
region: z.ZodOptional<z.ZodObject<{
|
|
272
|
+
x: z.ZodInt;
|
|
273
|
+
y: z.ZodInt;
|
|
274
|
+
w: z.ZodInt;
|
|
275
|
+
h: z.ZodInt;
|
|
276
|
+
}, z.core.$strict>>;
|
|
277
|
+
}, z.core.$strict>], "kind">;
|
|
278
|
+
export declare const desktopUiTargetSchema: z.ZodType<DesktopUiTarget>;
|
|
279
|
+
export declare const desktopUiTargetRefSchema: z.ZodType<DesktopUiTargetRef>;
|
|
280
|
+
export declare const desktopUiStepSchema: z.ZodType<DesktopUiStep>;
|
|
281
|
+
export declare const desktopUiScriptSchema: z.ZodType<DesktopUiScript>;
|