@burdenoff/ui-engine 2026.1127.1 → 2026.1127.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 +68 -3
- package/dist/capture.js +3 -2
- package/dist/dom-runtime/actions.d.ts +65 -0
- package/dist/dom-runtime/iife.d.ts +1 -0
- package/dist/dom-runtime/index.d.ts +7 -0
- package/dist/dom-runtime/runtime.d.ts +79 -0
- package/dist/dom-runtime.d.ts +2 -0
- package/dist/dom-runtime.iife.js +1 -0
- package/dist/dom-runtime.js +535 -0
- package/dist/{index-05zgh18g.js → index-2kgsgn1c.js} +1 -1
- package/dist/{index-phd8yhyg.js → index-bnvmt4wf.js} +7 -5
- package/dist/{index-c6pmt2rg.js → index-cs6acyjn.js} +6 -59
- package/dist/index-mgztm37r.js +57 -0
- package/dist/index-q1b0j9yr.js +1349 -0
- package/dist/index-zwrxw3zp.js +1988 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +180 -6
- package/dist/recording.js +1 -1
- package/dist/replay.js +2 -2
- package/dist/script/adapters/browser-action-contract.d.ts +22 -0
- package/dist/script/adapters/from-browser-action.d.ts +7 -0
- package/dist/script/adapters/from-remote-browser.d.ts +7 -0
- package/dist/script/adapters/recording.d.ts +25 -0
- package/dist/script/adapters/to-browser-action.d.ts +8 -0
- package/dist/script/canonical.d.ts +6 -0
- package/dist/script/capabilities.d.ts +29 -0
- package/dist/script/describe.d.ts +83 -0
- package/dist/script/fingerprint.d.ts +9 -0
- package/dist/script/hash.d.ts +3 -0
- package/dist/script/index.d.ts +22 -0
- package/dist/script/json-schema.d.ts +4 -0
- package/dist/script/limits.d.ts +61 -0
- package/dist/script/parse.d.ts +31 -0
- package/dist/script/schema.d.ts +87 -0
- package/dist/script/types.d.ts +489 -0
- package/dist/script/walk.d.ts +29 -0
- package/dist/script.d.ts +2 -0
- package/dist/script.js +175 -0
- package/dist/target/aria.d.ts +31 -0
- package/dist/target/dom.d.ts +35 -0
- package/dist/target/index.d.ts +13 -0
- package/dist/target/markers.d.ts +18 -0
- package/dist/target/methods.d.ts +52 -0
- package/dist/target/resolve.d.ts +46 -0
- package/dist/target/snapshot.d.ts +57 -0
- package/dist/target/text.d.ts +23 -0
- package/dist/target/types.d.ts +88 -0
- package/dist/target.d.ts +2 -0
- package/dist/target.js +92 -0
- package/dist/testing/fixtures/ambiguous.d.ts +7 -0
- package/dist/testing/fixtures/iframe.d.ts +6 -0
- package/dist/testing/fixtures/index.d.ts +26 -0
- package/dist/testing/fixtures/invoices-v2.d.ts +8 -0
- package/dist/testing/fixtures/invoices-v3.d.ts +7 -0
- package/dist/testing/fixtures/invoices.d.ts +6 -0
- package/dist/testing/fixtures/login.d.ts +6 -0
- package/dist/testing/fixtures/shadow.d.ts +7 -0
- package/dist/testing/index.d.ts +6 -0
- package/dist/testing/mount.d.ts +18 -0
- package/dist/testing.d.ts +2 -0
- package/dist/testing.js +324 -0
- package/package.json +28 -5
- package/schema/ui-script-v1.schema.json +8199 -0
package/dist/index.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export { MAX_RECORDED_STEPS, RECORDING_VERSION, REPLAYABLE_ACTIONS, type Recorde
|
|
|
8
8
|
export { type CaptureResult, REDACTED, type RecorderElement, type RecorderEvent, type RecorderScreenshot, captureRecording, maskUrl, redactCredentials, } from './capture.js';
|
|
9
9
|
export { MAX_SNAPSHOT_NODES, type ResolveOutcome, type SnapshotNode, readSnapshotNodes, resolveTarget, } from './resolve.js';
|
|
10
10
|
export { type FallbackReason, type ReplayCallKind, type ReplayCallOutcome, type ReplayChatMessage, type ReplayFunctionCall, type ReplayOptions, type ReplayPlan, type ReplaySource, type ReplayState, afterReplayCall, finishFallback, markFallbackAsked, planReplay, readReplayState, replayReasons, replayStateFrom, } from './replay.js';
|
|
11
|
+
export * from './script.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
REDACTED2,
|
|
3
|
-
redactCredentials2,
|
|
4
2
|
sha256Hex2,
|
|
5
3
|
RECORDING_VERSION2,
|
|
6
4
|
MAX_RECORDED_STEPS2,
|
|
@@ -13,11 +11,11 @@ import {
|
|
|
13
11
|
RecordingError2,
|
|
14
12
|
parseRecording2,
|
|
15
13
|
isSavedStepAuthor2
|
|
16
|
-
} from "./index-
|
|
14
|
+
} from "./index-cs6acyjn.js";
|
|
17
15
|
import {
|
|
18
16
|
maskUrl2,
|
|
19
17
|
captureRecording2
|
|
20
|
-
} from "./index-
|
|
18
|
+
} from "./index-bnvmt4wf.js";
|
|
21
19
|
import {
|
|
22
20
|
MAX_SNAPSHOT_NODES2,
|
|
23
21
|
readSnapshotNodes2,
|
|
@@ -31,22 +29,176 @@ import {
|
|
|
31
29
|
finishFallback2,
|
|
32
30
|
markFallbackAsked2,
|
|
33
31
|
replayReasons2
|
|
34
|
-
} from "./index-
|
|
32
|
+
} from "./index-2kgsgn1c.js";
|
|
33
|
+
import {
|
|
34
|
+
UI_EXPRESSION_OPS2,
|
|
35
|
+
UI_ANCHOR_RELATIONS2,
|
|
36
|
+
UI_TARGET_METHOD_KINDS2,
|
|
37
|
+
UI_WEB_ACTIONS2,
|
|
38
|
+
UI_DESKTOP_ACTIONS2,
|
|
39
|
+
UI_FLOW_ACTIONS2,
|
|
40
|
+
UI_STEP_ACTIONS2,
|
|
41
|
+
UI_VALUE_TYPES2,
|
|
42
|
+
UI_SCRIPT_VERSION2,
|
|
43
|
+
MAX_SCRIPT_STEPS2,
|
|
44
|
+
MAX_SCRIPT_BYTES2,
|
|
45
|
+
MAX_FLOW_DEPTH2,
|
|
46
|
+
MAX_EXPRESSION_DEPTH2,
|
|
47
|
+
MAX_EXPRESSION_ITEMS2,
|
|
48
|
+
MAX_OPERATOR_ARGS2,
|
|
49
|
+
MAX_SCRIPT_INPUTS2,
|
|
50
|
+
MAX_SCRIPT_OUTPUTS2,
|
|
51
|
+
MAX_SCRIPT_VARIABLES2,
|
|
52
|
+
MAX_SCRIPT_ELEMENTS2,
|
|
53
|
+
MAX_TARGET_METHODS2,
|
|
54
|
+
MAX_FRAME_DEPTH2,
|
|
55
|
+
MAX_EXTRACT_FIELDS2,
|
|
56
|
+
MAX_LIST_ITEMS2,
|
|
57
|
+
MAX_LIST_PAGES2,
|
|
58
|
+
MAX_LOOP_ITERATIONS2,
|
|
59
|
+
MAX_RETRY_ATTEMPTS2,
|
|
60
|
+
MAX_STEP_TIMEOUT_MS2,
|
|
61
|
+
MAX_DELAY_MS2,
|
|
62
|
+
MAX_KEYS2,
|
|
63
|
+
MAX_SELECT_VALUES2,
|
|
64
|
+
MAX_SELECTOR_LENGTH2,
|
|
65
|
+
MAX_URL_LENGTH2,
|
|
66
|
+
MAX_LABEL_LENGTH2,
|
|
67
|
+
MAX_TEXT_LENGTH2,
|
|
68
|
+
MAX_INTENT_LENGTH2,
|
|
69
|
+
MAX_NAME_LENGTH2,
|
|
70
|
+
LEGACY_MAX_BROWSER_STEPS2,
|
|
71
|
+
LEGACY_MAX_STEPS_BYTES2,
|
|
72
|
+
jsonByteLength2,
|
|
73
|
+
uiScriptRegistry2,
|
|
74
|
+
NAME_PATTERN2,
|
|
75
|
+
STEP_ID_PATTERN2,
|
|
76
|
+
ELEMENT_KEY_PATTERN2,
|
|
77
|
+
uiExpressionSchema2,
|
|
78
|
+
uiTargetMethodSchema2,
|
|
79
|
+
uiTargetSchema2,
|
|
80
|
+
uiTargetRefSchema2,
|
|
81
|
+
uiStepSchema2,
|
|
82
|
+
uiScriptSchema2,
|
|
83
|
+
canonicalJson2,
|
|
84
|
+
childBlocks2,
|
|
85
|
+
walkSteps2,
|
|
86
|
+
countSteps2,
|
|
87
|
+
stepAtPath2,
|
|
88
|
+
stepTargets2,
|
|
89
|
+
stepExpressions2,
|
|
90
|
+
visitExpression2,
|
|
91
|
+
RECORDING_ACTION_OF2,
|
|
92
|
+
uiStepFingerprint2,
|
|
93
|
+
withFingerprint2,
|
|
94
|
+
UiScriptError2,
|
|
95
|
+
UI_EXPRESSION_ARITY2,
|
|
96
|
+
parseUiScript2,
|
|
97
|
+
safeParseUiScript2,
|
|
98
|
+
UI_SCRIPT_SCHEMA_HASH2,
|
|
99
|
+
schemaHashOf2,
|
|
100
|
+
UI_SCRIPT_SCHEMA_TITLE2,
|
|
101
|
+
uiScriptJsonSchema2,
|
|
102
|
+
CAPABILITY_IDS2,
|
|
103
|
+
SCRIPT_CAPABILITY2,
|
|
104
|
+
requiredCapabilities2,
|
|
105
|
+
missingCapabilities2,
|
|
106
|
+
UI_SCRIPT_STEP_KEY_PREFIX2,
|
|
107
|
+
UI_SCRIPT_STEP_MESSAGES2,
|
|
108
|
+
stepMessageKey2,
|
|
109
|
+
describeTarget2,
|
|
110
|
+
describeExpression2,
|
|
111
|
+
describeStep2,
|
|
112
|
+
BROWSER_STEP_ACTIONS2,
|
|
113
|
+
fromBrowserActionSteps2,
|
|
114
|
+
toBrowserActionSteps2,
|
|
115
|
+
targetFromPlaywrightSelector2,
|
|
116
|
+
fromRemoteBrowserSteps2,
|
|
117
|
+
fromRecording2,
|
|
118
|
+
toRecording2
|
|
119
|
+
} from "./index-zwrxw3zp.js";
|
|
120
|
+
import {
|
|
121
|
+
REDACTED2,
|
|
122
|
+
redactCredentials2
|
|
123
|
+
} from "./index-mgztm37r.js";
|
|
35
124
|
export {
|
|
125
|
+
BROWSER_STEP_ACTIONS2 as BROWSER_STEP_ACTIONS,
|
|
126
|
+
CAPABILITY_IDS2 as CAPABILITY_IDS,
|
|
127
|
+
ELEMENT_KEY_PATTERN2 as ELEMENT_KEY_PATTERN,
|
|
128
|
+
LEGACY_MAX_BROWSER_STEPS2 as LEGACY_MAX_BROWSER_STEPS,
|
|
129
|
+
LEGACY_MAX_STEPS_BYTES2 as LEGACY_MAX_STEPS_BYTES,
|
|
130
|
+
MAX_DELAY_MS2 as MAX_DELAY_MS,
|
|
131
|
+
MAX_EXPRESSION_DEPTH2 as MAX_EXPRESSION_DEPTH,
|
|
132
|
+
MAX_EXPRESSION_ITEMS2 as MAX_EXPRESSION_ITEMS,
|
|
133
|
+
MAX_EXTRACT_FIELDS2 as MAX_EXTRACT_FIELDS,
|
|
134
|
+
MAX_FLOW_DEPTH2 as MAX_FLOW_DEPTH,
|
|
135
|
+
MAX_FRAME_DEPTH2 as MAX_FRAME_DEPTH,
|
|
136
|
+
MAX_INTENT_LENGTH2 as MAX_INTENT_LENGTH,
|
|
137
|
+
MAX_KEYS2 as MAX_KEYS,
|
|
138
|
+
MAX_LABEL_LENGTH2 as MAX_LABEL_LENGTH,
|
|
139
|
+
MAX_LIST_ITEMS2 as MAX_LIST_ITEMS,
|
|
140
|
+
MAX_LIST_PAGES2 as MAX_LIST_PAGES,
|
|
141
|
+
MAX_LOOP_ITERATIONS2 as MAX_LOOP_ITERATIONS,
|
|
142
|
+
MAX_NAME_LENGTH2 as MAX_NAME_LENGTH,
|
|
143
|
+
MAX_OPERATOR_ARGS2 as MAX_OPERATOR_ARGS,
|
|
36
144
|
MAX_RECORDED_STEPS2 as MAX_RECORDED_STEPS,
|
|
145
|
+
MAX_RETRY_ATTEMPTS2 as MAX_RETRY_ATTEMPTS,
|
|
146
|
+
MAX_SCRIPT_BYTES2 as MAX_SCRIPT_BYTES,
|
|
147
|
+
MAX_SCRIPT_ELEMENTS2 as MAX_SCRIPT_ELEMENTS,
|
|
148
|
+
MAX_SCRIPT_INPUTS2 as MAX_SCRIPT_INPUTS,
|
|
149
|
+
MAX_SCRIPT_OUTPUTS2 as MAX_SCRIPT_OUTPUTS,
|
|
150
|
+
MAX_SCRIPT_STEPS2 as MAX_SCRIPT_STEPS,
|
|
151
|
+
MAX_SCRIPT_VARIABLES2 as MAX_SCRIPT_VARIABLES,
|
|
152
|
+
MAX_SELECTOR_LENGTH2 as MAX_SELECTOR_LENGTH,
|
|
153
|
+
MAX_SELECT_VALUES2 as MAX_SELECT_VALUES,
|
|
37
154
|
MAX_SNAPSHOT_NODES2 as MAX_SNAPSHOT_NODES,
|
|
155
|
+
MAX_STEP_TIMEOUT_MS2 as MAX_STEP_TIMEOUT_MS,
|
|
156
|
+
MAX_TARGET_METHODS2 as MAX_TARGET_METHODS,
|
|
157
|
+
MAX_TEXT_LENGTH2 as MAX_TEXT_LENGTH,
|
|
158
|
+
MAX_URL_LENGTH2 as MAX_URL_LENGTH,
|
|
159
|
+
NAME_PATTERN2 as NAME_PATTERN,
|
|
160
|
+
RECORDING_ACTION_OF2 as RECORDING_ACTION_OF,
|
|
38
161
|
RECORDING_VERSION2 as RECORDING_VERSION,
|
|
39
162
|
REDACTED2 as REDACTED,
|
|
40
163
|
REPLAYABLE_ACTIONS2 as REPLAYABLE_ACTIONS,
|
|
41
164
|
RecordingError2 as RecordingError,
|
|
42
165
|
SAVED_STEP_AUTHORS2 as SAVED_STEP_AUTHORS,
|
|
166
|
+
SCRIPT_CAPABILITY2 as SCRIPT_CAPABILITY,
|
|
167
|
+
STEP_ID_PATTERN2 as STEP_ID_PATTERN,
|
|
168
|
+
UI_ANCHOR_RELATIONS2 as UI_ANCHOR_RELATIONS,
|
|
169
|
+
UI_DESKTOP_ACTIONS2 as UI_DESKTOP_ACTIONS,
|
|
170
|
+
UI_EXPRESSION_ARITY2 as UI_EXPRESSION_ARITY,
|
|
171
|
+
UI_EXPRESSION_OPS2 as UI_EXPRESSION_OPS,
|
|
172
|
+
UI_FLOW_ACTIONS2 as UI_FLOW_ACTIONS,
|
|
173
|
+
UI_SCRIPT_SCHEMA_HASH2 as UI_SCRIPT_SCHEMA_HASH,
|
|
174
|
+
UI_SCRIPT_SCHEMA_TITLE2 as UI_SCRIPT_SCHEMA_TITLE,
|
|
175
|
+
UI_SCRIPT_STEP_KEY_PREFIX2 as UI_SCRIPT_STEP_KEY_PREFIX,
|
|
176
|
+
UI_SCRIPT_STEP_MESSAGES2 as UI_SCRIPT_STEP_MESSAGES,
|
|
177
|
+
UI_SCRIPT_VERSION2 as UI_SCRIPT_VERSION,
|
|
178
|
+
UI_STEP_ACTIONS2 as UI_STEP_ACTIONS,
|
|
179
|
+
UI_TARGET_METHOD_KINDS2 as UI_TARGET_METHOD_KINDS,
|
|
180
|
+
UI_VALUE_TYPES2 as UI_VALUE_TYPES,
|
|
181
|
+
UI_WEB_ACTIONS2 as UI_WEB_ACTIONS,
|
|
182
|
+
UiScriptError2 as UiScriptError,
|
|
43
183
|
afterReplayCall2 as afterReplayCall,
|
|
184
|
+
canonicalJson2 as canonicalJson,
|
|
44
185
|
captureRecording2 as captureRecording,
|
|
186
|
+
childBlocks2 as childBlocks,
|
|
187
|
+
countSteps2 as countSteps,
|
|
188
|
+
describeExpression2 as describeExpression,
|
|
189
|
+
describeStep2 as describeStep,
|
|
190
|
+
describeTarget2 as describeTarget,
|
|
45
191
|
finishFallback2 as finishFallback,
|
|
192
|
+
fromBrowserActionSteps2 as fromBrowserActionSteps,
|
|
193
|
+
fromRecording2 as fromRecording,
|
|
194
|
+
fromRemoteBrowserSteps2 as fromRemoteBrowserSteps,
|
|
46
195
|
isSavedStepAuthor2 as isSavedStepAuthor,
|
|
196
|
+
jsonByteLength2 as jsonByteLength,
|
|
47
197
|
markFallbackAsked2 as markFallbackAsked,
|
|
48
198
|
maskUrl2 as maskUrl,
|
|
199
|
+
missingCapabilities2 as missingCapabilities,
|
|
49
200
|
parseRecording2 as parseRecording,
|
|
201
|
+
parseUiScript2 as parseUiScript,
|
|
50
202
|
planReplay2 as planReplay,
|
|
51
203
|
readReplayState2 as readReplayState,
|
|
52
204
|
readSnapshotNodes2 as readSnapshotNodes,
|
|
@@ -56,7 +208,29 @@ export {
|
|
|
56
208
|
redactCredentials2 as redactCredentials,
|
|
57
209
|
replayReasons2 as replayReasons,
|
|
58
210
|
replayStateFrom2 as replayStateFrom,
|
|
211
|
+
requiredCapabilities2 as requiredCapabilities,
|
|
59
212
|
resolveTarget2 as resolveTarget,
|
|
213
|
+
safeParseUiScript2 as safeParseUiScript,
|
|
214
|
+
schemaHashOf2 as schemaHashOf,
|
|
60
215
|
sha256Hex2 as sha256Hex,
|
|
61
|
-
|
|
216
|
+
stepAtPath2 as stepAtPath,
|
|
217
|
+
stepExpressions2 as stepExpressions,
|
|
218
|
+
stepMessageKey2 as stepMessageKey,
|
|
219
|
+
stepTargets2 as stepTargets,
|
|
220
|
+
targetFingerprint2 as targetFingerprint,
|
|
221
|
+
targetFromPlaywrightSelector2 as targetFromPlaywrightSelector,
|
|
222
|
+
toBrowserActionSteps2 as toBrowserActionSteps,
|
|
223
|
+
toRecording2 as toRecording,
|
|
224
|
+
uiExpressionSchema2 as uiExpressionSchema,
|
|
225
|
+
uiScriptJsonSchema2 as uiScriptJsonSchema,
|
|
226
|
+
uiScriptRegistry2 as uiScriptRegistry,
|
|
227
|
+
uiScriptSchema2 as uiScriptSchema,
|
|
228
|
+
uiStepFingerprint2 as uiStepFingerprint,
|
|
229
|
+
uiStepSchema2 as uiStepSchema,
|
|
230
|
+
uiTargetMethodSchema2 as uiTargetMethodSchema,
|
|
231
|
+
uiTargetRefSchema2 as uiTargetRefSchema,
|
|
232
|
+
uiTargetSchema2 as uiTargetSchema,
|
|
233
|
+
visitExpression2 as visitExpression,
|
|
234
|
+
walkSteps2 as walkSteps,
|
|
235
|
+
withFingerprint2 as withFingerprint
|
|
62
236
|
};
|
package/dist/recording.js
CHANGED
package/dist/replay.js
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
finishFallback2,
|
|
7
7
|
markFallbackAsked2,
|
|
8
8
|
replayReasons2
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-c6pmt2rg.js";
|
|
9
|
+
} from "./index-2kgsgn1c.js";
|
|
11
10
|
import"./index-3v887c75.js";
|
|
11
|
+
import"./index-cs6acyjn.js";
|
|
12
12
|
export {
|
|
13
13
|
afterReplayCall2 as afterReplayCall,
|
|
14
14
|
finishFallback2 as finishFallback,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The legacy Run in Browser step contract, mirrored from wspace-workflow-svc
|
|
3
|
+
* `src/modules/runs/services/browser/browser-contract.ts` (the 14 actions, at
|
|
4
|
+
* most 100 steps, at most 256 KB) and fluidgrids-workers
|
|
5
|
+
* `src/internalnodes/services/browser-action.ts` (each action's fields).
|
|
6
|
+
* `tests/fixtures/browser-contract.json` pins the service's list, so a change
|
|
7
|
+
* there fails this package's tests until the mirror follows.
|
|
8
|
+
*/
|
|
9
|
+
/** The step actions a 0.3.0 extension runs, in the order the service lists them. */
|
|
10
|
+
export declare const BROWSER_STEP_ACTIONS: readonly ["navigate", "waitFor", "click", "type", "select", "check", "pressKey", "scroll", "extract", "extractList", "getPageText", "getPageHtml", "screenshot", "closeTab"];
|
|
11
|
+
export type BrowserStepAction = (typeof BROWSER_STEP_ACTIONS)[number];
|
|
12
|
+
/** A legacy Run in Browser step: `{ action, name?, ...params }`. */
|
|
13
|
+
export type BrowserActionStep = Record<string, unknown> & {
|
|
14
|
+
action: BrowserStepAction;
|
|
15
|
+
};
|
|
16
|
+
/** A legacy extract field. */
|
|
17
|
+
export interface BrowserActionField {
|
|
18
|
+
name: string;
|
|
19
|
+
selector: string;
|
|
20
|
+
attribute?: string;
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UiScript } from '../types.js';
|
|
2
|
+
/** Read the steps parameter: an array, or the JSON text the builder's form saved. */
|
|
3
|
+
export declare function readStepList(value: unknown, what: string): unknown[];
|
|
4
|
+
/** Convert a Run in Browser step list to a UI script. Throws `UiScriptError` naming the step at fault. */
|
|
5
|
+
export declare function fromBrowserActionSteps(steps: unknown, options?: {
|
|
6
|
+
name?: string;
|
|
7
|
+
}): UiScript;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UiScript, UiTarget } from '../types.js';
|
|
2
|
+
/** A Playwright selector as a v1 target; throws through `refuse` when it has no equivalent. */
|
|
3
|
+
export declare function targetFromPlaywrightSelector(raw: string, refuse: (message: string) => never): UiTarget;
|
|
4
|
+
/** Convert a Remote Browser step list to a UI script. Throws `UiScriptError` naming the step at fault. */
|
|
5
|
+
export declare function fromRemoteBrowserSteps(steps: unknown, options?: {
|
|
6
|
+
name?: string;
|
|
7
|
+
}): UiScript;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stewards saved-step recordings (version 1) to and from UI scripts
|
|
3
|
+
* (spec 18 section 6, rule 1: every valid recording maps onto a script
|
|
4
|
+
* without loss).
|
|
5
|
+
*
|
|
6
|
+
* `fromRecording` keeps every field: step ids, intents, masked screenshots,
|
|
7
|
+
* masked typing, secret references and fingerprints (the strict role method
|
|
8
|
+
* is fingerprinted exactly as Stewards does). `toRecording` gives the same
|
|
9
|
+
* recording back, and returns null for a script a recording cannot express
|
|
10
|
+
* (web-only actions, flow steps, other target methods, expressions).
|
|
11
|
+
*/
|
|
12
|
+
import { type Recording } from '../../recording.js';
|
|
13
|
+
import type { UiScript, UiStep } from '../types.js';
|
|
14
|
+
/** A Stewards recording as a UI script. The recording is validated first (`parseRecording`). */
|
|
15
|
+
export declare function fromRecording(value: unknown): UiScript;
|
|
16
|
+
/**
|
|
17
|
+
* The Stewards recording a script corresponds to, or null when the script
|
|
18
|
+
* uses something a recording cannot express: v1-only actions, options or
|
|
19
|
+
* script settings, or more than the recording format allows (200 steps,
|
|
20
|
+
* 4,000-character text). A step without an intent gets
|
|
21
|
+
* `fallbackIntent(step)` (for example the step's `describeStep` fallback),
|
|
22
|
+
* since every saved step needs one. The script's name and application are
|
|
23
|
+
* descriptive and are not carried. The result passes `parseRecording`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function toRecording(script: UiScript, fallbackIntent?: (step: UiStep) => string): Recording | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UiScript } from '../types.js';
|
|
2
|
+
import type { BrowserActionStep } from './browser-action-contract.js';
|
|
3
|
+
export interface LowerOptions {
|
|
4
|
+
/** Input values supplied at dispatch, used for `{ input }` references. */
|
|
5
|
+
inputs?: Readonly<Record<string, unknown>>;
|
|
6
|
+
}
|
|
7
|
+
/** The Run in Browser steps for a script, or null when the script does not fit the legacy contract. */
|
|
8
|
+
export declare function toBrowserActionSteps(script: UiScript, options?: LowerOptions): BrowserActionStep[] | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON: object keys sorted (by UTF-16 code unit), no whitespace,
|
|
3
|
+
* array order kept. Two values that are equal as JSON data serialise to the
|
|
4
|
+
* same text, which is what the schema hash and the fingerprints hash.
|
|
5
|
+
*/
|
|
6
|
+
export declare function canonicalJson(value: unknown): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capabilities: what a desk must support to run a script (spec 03 section
|
|
3
|
+
* 5.2). A desk (the extension, the remote-browser executor, later a robot)
|
|
4
|
+
* announces the capability ids it supports; the service hands a script only
|
|
5
|
+
* to a desk whose capabilities cover `requiredCapabilities(script)`, and the
|
|
6
|
+
* compiler refuses a script a desk cannot run with `UNSUPPORTED_ON_DESK`
|
|
7
|
+
* before any step runs.
|
|
8
|
+
*
|
|
9
|
+
* Ids:
|
|
10
|
+
* - `script:1`: reads UI script v1 (always required);
|
|
11
|
+
* - `action:<action>`: runs that step action, flow actions included;
|
|
12
|
+
* - `target:<kind>`: resolves that target method;
|
|
13
|
+
* - `target:frame`: follows a target's frame and shadow-root chain;
|
|
14
|
+
* - `step:verify`, `step:retry`, `step:breakpoint`: the matching step options;
|
|
15
|
+
* - `input:direct`, `input:hardware`: an explicit input method.
|
|
16
|
+
*/
|
|
17
|
+
import { type UiScript } from './types.js';
|
|
18
|
+
/** Every capability id of v1, sorted. */
|
|
19
|
+
export declare const CAPABILITY_IDS: readonly string[];
|
|
20
|
+
/** The capability every script requires: reading UI script v1. */
|
|
21
|
+
export declare const SCRIPT_CAPABILITY = "script:1";
|
|
22
|
+
/**
|
|
23
|
+
* The sorted capability ids a desk needs to run the script. Disabled steps
|
|
24
|
+
* and disabled target methods need nothing. A step that names a pinned
|
|
25
|
+
* element needs what the element's target uses, when the script carries it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function requiredCapabilities(script: UiScript): string[];
|
|
28
|
+
/** The required capabilities a desk lacks, sorted; empty when the desk can run the script. */
|
|
29
|
+
export declare function missingCapabilities(script: UiScript, supported: Iterable<string>): string[];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-line descriptions of steps for the editor, the recording review and the
|
|
3
|
+
* run view (plan P0-04, P1-12, P1-14).
|
|
4
|
+
*
|
|
5
|
+
* `describeStep` returns a message key under `fluidgrids.uiScript.step.*`,
|
|
6
|
+
* its variables, and an English fallback. The front end translates the key
|
|
7
|
+
* with `tr(key, vars)` so `i18n:extract` sees it; non-UI consumers (logs,
|
|
8
|
+
* Stewards intents) use the fallback. `UI_SCRIPT_STEP_MESSAGES` holds the
|
|
9
|
+
* English template of every key, with `{{name}}` placeholders.
|
|
10
|
+
*/
|
|
11
|
+
import type { UiExpression, UiScriptElement, UiStep, UiTargetRef } from './types.js';
|
|
12
|
+
/** The prefix of every step message key. */
|
|
13
|
+
export declare const UI_SCRIPT_STEP_KEY_PREFIX = "fluidgrids.uiScript.step.";
|
|
14
|
+
/** English templates of every step message, by name; the key is the prefix plus the name. */
|
|
15
|
+
export declare const UI_SCRIPT_STEP_MESSAGES: {
|
|
16
|
+
readonly navigate: "Go to {{url}}";
|
|
17
|
+
readonly goBack: "Go back";
|
|
18
|
+
readonly reload: "Reload the page";
|
|
19
|
+
readonly closeTab: "Close the tab";
|
|
20
|
+
readonly click: "Click {{target}}";
|
|
21
|
+
readonly rightClick: "Right-click {{target}}";
|
|
22
|
+
readonly doubleClick: "Double-click {{target}}";
|
|
23
|
+
readonly rightDoubleClick: "Right double-click {{target}}";
|
|
24
|
+
readonly hover: "Point at {{target}}";
|
|
25
|
+
readonly type: "Type {{value}} into {{target}}";
|
|
26
|
+
readonly typeFocused: "Type {{value}}";
|
|
27
|
+
readonly typeMasked: "Type a hidden value into {{target}}";
|
|
28
|
+
readonly typeMaskedFocused: "Type a hidden value";
|
|
29
|
+
readonly typeSecret: "Type a secret into {{target}}";
|
|
30
|
+
readonly clear: "Clear {{target}}";
|
|
31
|
+
readonly select: "Choose {{value}} in {{target}}";
|
|
32
|
+
readonly check: "Tick {{target}}";
|
|
33
|
+
readonly uncheck: "Untick {{target}}";
|
|
34
|
+
readonly pressKey: "Press {{keys}}";
|
|
35
|
+
readonly scrollTop: "Scroll to the top";
|
|
36
|
+
readonly scrollBottom: "Scroll to the bottom";
|
|
37
|
+
readonly scrollTo: "Scroll to {{target}}";
|
|
38
|
+
readonly scrollBy: "Scroll by {{dx}}, {{dy}}";
|
|
39
|
+
readonly scrollInside: "Scroll {{target}} by {{dx}}, {{dy}}";
|
|
40
|
+
readonly waitFor: "Wait for {{target}}";
|
|
41
|
+
readonly waitForGone: "Wait for {{target}} to go away";
|
|
42
|
+
readonly waitForText: "Wait for the text {{value}}";
|
|
43
|
+
readonly waitForUrl: "Wait for the address to contain {{value}}";
|
|
44
|
+
readonly waitForTime: "Wait {{milliseconds}} ms";
|
|
45
|
+
readonly extract: "Read {{fields}}";
|
|
46
|
+
readonly extractList: "Read each {{target}}";
|
|
47
|
+
readonly getText: "Read the text of {{target}}";
|
|
48
|
+
readonly getValue: "Read the value of {{target}}";
|
|
49
|
+
readonly getAttribute: "Read {{attribute}} of {{target}}";
|
|
50
|
+
readonly elementExists: "Check whether {{target}} is there";
|
|
51
|
+
readonly getPageText: "Read the page text";
|
|
52
|
+
readonly getPageHtml: "Read the page HTML";
|
|
53
|
+
readonly screenshot: "Take a screenshot";
|
|
54
|
+
readonly screenshotOf: "Take a screenshot of {{target}}";
|
|
55
|
+
readonly login: "Sign in";
|
|
56
|
+
readonly focusWindow: "Switch to {{app}}";
|
|
57
|
+
readonly if: "If {{condition}}";
|
|
58
|
+
readonly ifElement: "If {{target}} is there";
|
|
59
|
+
readonly forEach: "For each item in {{value}}";
|
|
60
|
+
readonly forEachElement: "For each {{target}}";
|
|
61
|
+
readonly while: "While {{condition}}, at most {{max}} times";
|
|
62
|
+
readonly whileElement: "While {{target}} is there, at most {{max}} times";
|
|
63
|
+
readonly retryScope: "Try up to {{attempts}} times";
|
|
64
|
+
readonly set: "Set {{name}} to {{value}}";
|
|
65
|
+
readonly log: "Log {{value}}";
|
|
66
|
+
readonly call: "Run the shared sequence {{sequence}}";
|
|
67
|
+
};
|
|
68
|
+
export type UiScriptStepMessageName = keyof typeof UI_SCRIPT_STEP_MESSAGES;
|
|
69
|
+
export type UiScriptStepMessageKey = `fluidgrids.uiScript.step.${UiScriptStepMessageName}`;
|
|
70
|
+
/** The full message key of a message name. */
|
|
71
|
+
export declare function stepMessageKey(name: UiScriptStepMessageName): UiScriptStepMessageKey;
|
|
72
|
+
export interface StepDescription {
|
|
73
|
+
key: UiScriptStepMessageKey;
|
|
74
|
+
vars: Record<string, string | number>;
|
|
75
|
+
/** The English sentence, for consumers that do not translate. */
|
|
76
|
+
fallback: string;
|
|
77
|
+
}
|
|
78
|
+
/** How a target reads in a sentence: the element's name, else what its first enabled method looks for. */
|
|
79
|
+
export declare function describeTarget(ref: UiTargetRef | undefined, elements?: Readonly<Record<string, UiScriptElement>>): string;
|
|
80
|
+
/** How a value reads in a sentence: literals quoted, inputs and variables as [name], anything else as …. */
|
|
81
|
+
export declare function describeExpression(expression: UiExpression | undefined): string;
|
|
82
|
+
/** The description of one step. `elements` are the script's pinned elements, for their names. */
|
|
83
|
+
export declare function describeStep(step: UiStep, elements?: Readonly<Record<string, UiScriptElement>>): StepDescription;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UiRoleMethod, UiStep, UiStepAction, UiTargetRef } from './types.js';
|
|
2
|
+
/** The Stewards saved-step action each recordable script action corresponds to. */
|
|
3
|
+
export declare const RECORDING_ACTION_OF: Partial<Record<UiStepAction, string>>;
|
|
4
|
+
/** The single accessibility method of an inline target, when that is all the target holds. */
|
|
5
|
+
export declare function soleRoleMethod(ref: UiTargetRef | undefined): UiRoleMethod | undefined;
|
|
6
|
+
/** The fingerprint of a step (lower-case hex sha256). */
|
|
7
|
+
export declare function uiStepFingerprint(step: UiStep): string;
|
|
8
|
+
/** The step with its fingerprint set. Call it after editing a step's target. */
|
|
9
|
+
export declare function withFingerprint<S extends UiStep>(step: S): S;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const UI_SCRIPT_SCHEMA_HASH = "e6860649ad1cba906fb704ce4b62b3ea4380203e6628c809571602f4d0947884";
|
|
2
|
+
/** The schema hash of a JSON Schema document (the same function the constant was computed with). */
|
|
3
|
+
export declare function schemaHashOf(jsonSchema: unknown): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI script v1 (plan P0-04): the contract every RPA component shares. See
|
|
3
|
+
* `types.ts` for the format, `parse.ts` for validation, `capabilities.ts` for
|
|
4
|
+
* what a desk must support, `adapters/` for the conversions from and to the
|
|
5
|
+
* existing step vocabularies, and `describe.ts` for step descriptions.
|
|
6
|
+
*/
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './limits.js';
|
|
9
|
+
export { ELEMENT_KEY_PATTERN, NAME_PATTERN, STEP_ID_PATTERN, uiExpressionSchema, uiScriptRegistry, uiScriptSchema, uiStepSchema, uiTargetMethodSchema, uiTargetRefSchema, uiTargetSchema, } from './schema.js';
|
|
10
|
+
export { type ParseUiScriptOptions, UI_EXPRESSION_ARITY, UiScriptError, type UiScriptErrorCode, parseUiScript, safeParseUiScript, } from './parse.js';
|
|
11
|
+
export { RECORDING_ACTION_OF, uiStepFingerprint, withFingerprint } from './fingerprint.js';
|
|
12
|
+
export { canonicalJson } from './canonical.js';
|
|
13
|
+
export { UI_SCRIPT_SCHEMA_HASH, schemaHashOf } from './hash.js';
|
|
14
|
+
export { UI_SCRIPT_SCHEMA_TITLE, uiScriptJsonSchema } from './json-schema.js';
|
|
15
|
+
export { CAPABILITY_IDS, SCRIPT_CAPABILITY, missingCapabilities, requiredCapabilities } from './capabilities.js';
|
|
16
|
+
export { type WalkedStep, childBlocks, countSteps, stepAtPath, stepExpressions, stepTargets, visitExpression, walkSteps, } from './walk.js';
|
|
17
|
+
export { type StepDescription, UI_SCRIPT_STEP_KEY_PREFIX, UI_SCRIPT_STEP_MESSAGES, type UiScriptStepMessageKey, type UiScriptStepMessageName, describeExpression, describeStep, describeTarget, stepMessageKey, } from './describe.js';
|
|
18
|
+
export { BROWSER_STEP_ACTIONS, type BrowserActionField, type BrowserActionStep, type BrowserStepAction, } from './adapters/browser-action-contract.js';
|
|
19
|
+
export { fromBrowserActionSteps } from './adapters/from-browser-action.js';
|
|
20
|
+
export { type LowerOptions, toBrowserActionSteps } from './adapters/to-browser-action.js';
|
|
21
|
+
export { fromRemoteBrowserSteps, targetFromPlaywrightSelector } from './adapters/from-remote-browser.js';
|
|
22
|
+
export { fromRecording, toRecording } from './adapters/recording.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The title the committed JSON Schema carries. */
|
|
2
|
+
export declare const UI_SCRIPT_SCHEMA_TITLE = "FluidGrids UI script v1";
|
|
3
|
+
/** The JSON Schema (draft 2020-12) of UI script v1, as accepted on input. */
|
|
4
|
+
export declare function uiScriptJsonSchema(): Record<string, unknown>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Limits of a UI script v1 (spec 12 section 8, plan P0-04).
|
|
3
|
+
*
|
|
4
|
+
* The schema enforces the per-field limits; `parseUiScript` enforces the
|
|
5
|
+
* whole-script ones (total step count, nesting depth, serialised size).
|
|
6
|
+
* Each limit is a constant so the service, the workers, the extension and the
|
|
7
|
+
* builder refuse the same scripts.
|
|
8
|
+
*/
|
|
9
|
+
/** The only UI script version this engine reads and writes. */
|
|
10
|
+
export declare const UI_SCRIPT_VERSION = 1;
|
|
11
|
+
/** Steps in one script, counting every nested step and the clean-up block. */
|
|
12
|
+
export declare const MAX_SCRIPT_STEPS = 500;
|
|
13
|
+
/** The script serialised as UTF-8 JSON, at most (1 MiB). */
|
|
14
|
+
export declare const MAX_SCRIPT_BYTES: number;
|
|
15
|
+
/** Flow blocks (if, for each, while, retry scope) nested inside each other, at most. */
|
|
16
|
+
export declare const MAX_FLOW_DEPTH = 8;
|
|
17
|
+
/** Nesting of one expression, at most. */
|
|
18
|
+
export declare const MAX_EXPRESSION_DEPTH = 16;
|
|
19
|
+
/** Items in one list literal of an expression, at most. */
|
|
20
|
+
export declare const MAX_EXPRESSION_ITEMS = 1000;
|
|
21
|
+
/** Arguments of one operator, at most (each operator's own arity is in `UI_EXPRESSION_ARITY`). */
|
|
22
|
+
export declare const MAX_OPERATOR_ARGS = 16;
|
|
23
|
+
/** Inputs, outputs and variables a script declares, each at most. */
|
|
24
|
+
export declare const MAX_SCRIPT_INPUTS = 100;
|
|
25
|
+
export declare const MAX_SCRIPT_OUTPUTS = 100;
|
|
26
|
+
export declare const MAX_SCRIPT_VARIABLES = 100;
|
|
27
|
+
/** Library elements a script pins, at most. */
|
|
28
|
+
export declare const MAX_SCRIPT_ELEMENTS = 500;
|
|
29
|
+
/** Methods in one target, at most. */
|
|
30
|
+
export declare const MAX_TARGET_METHODS = 8;
|
|
31
|
+
/** Frames and shadow roots in a target's frame chain, at most. */
|
|
32
|
+
export declare const MAX_FRAME_DEPTH = 8;
|
|
33
|
+
/** Fields of one extract or extract list step, at most. */
|
|
34
|
+
export declare const MAX_EXTRACT_FIELDS = 50;
|
|
35
|
+
/** Items an extract list step may return and pages it may follow. */
|
|
36
|
+
export declare const MAX_LIST_ITEMS = 5000;
|
|
37
|
+
export declare const MAX_LIST_PAGES = 50;
|
|
38
|
+
/** Iterations of a for each or while block, at most. */
|
|
39
|
+
export declare const MAX_LOOP_ITERATIONS = 10000;
|
|
40
|
+
/** Attempts of a step retry or a retry scope, at most. */
|
|
41
|
+
export declare const MAX_RETRY_ATTEMPTS = 10;
|
|
42
|
+
/** Longest wait one step may set (10 minutes). */
|
|
43
|
+
export declare const MAX_STEP_TIMEOUT_MS = 600000;
|
|
44
|
+
/** Longest delay between retries and between typed characters. */
|
|
45
|
+
export declare const MAX_DELAY_MS = 60000;
|
|
46
|
+
/** Keys pressed together in one press keys step, at most. */
|
|
47
|
+
export declare const MAX_KEYS = 8;
|
|
48
|
+
/** Values one select step may choose, at most. */
|
|
49
|
+
export declare const MAX_SELECT_VALUES = 50;
|
|
50
|
+
/** Text limits. */
|
|
51
|
+
export declare const MAX_SELECTOR_LENGTH = 500;
|
|
52
|
+
export declare const MAX_URL_LENGTH = 4096;
|
|
53
|
+
export declare const MAX_LABEL_LENGTH = 512;
|
|
54
|
+
export declare const MAX_TEXT_LENGTH = 10000;
|
|
55
|
+
export declare const MAX_INTENT_LENGTH = 500;
|
|
56
|
+
export declare const MAX_NAME_LENGTH = 64;
|
|
57
|
+
/** The legacy Run in Browser contract a lowered script must fit (wspace-workflow-svc `browser-contract.ts`). */
|
|
58
|
+
export declare const LEGACY_MAX_BROWSER_STEPS = 100;
|
|
59
|
+
export declare const LEGACY_MAX_STEPS_BYTES: number;
|
|
60
|
+
/** UTF-8 byte length of a value serialised as JSON (browser safe, no Buffer). */
|
|
61
|
+
export declare function jsonByteLength(value: unknown): number;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { UiExpressionOp, UiScript } from './types.js';
|
|
2
|
+
export type UiScriptErrorCode = 'INVALID_SCRIPT' | 'SCRIPT_TOO_LARGE' | 'TOO_MANY_STEPS' | 'DUPLICATE_STEP_ID' | 'UNKNOWN_ELEMENT' | 'UNKNOWN_INPUT' | 'FINGERPRINT_MISMATCH' | 'CREDENTIAL_IN_SCRIPT' | 'UNRESOLVED';
|
|
3
|
+
/** A script that cannot be used. `path` names the step (see `walk.ts`) or the field at fault. */
|
|
4
|
+
export declare class UiScriptError extends Error {
|
|
5
|
+
readonly code: UiScriptErrorCode;
|
|
6
|
+
readonly path?: string | undefined;
|
|
7
|
+
constructor(code: UiScriptErrorCode, message: string, path?: string | undefined);
|
|
8
|
+
}
|
|
9
|
+
export interface ParseUiScriptOptions {
|
|
10
|
+
/**
|
|
11
|
+
* The script is compiled for a desk: every pinned element carries its
|
|
12
|
+
* target and no `call` step is left (the worker has inlined them).
|
|
13
|
+
* Refused with `UNRESOLVED` otherwise.
|
|
14
|
+
*/
|
|
15
|
+
resolved?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Arguments each operator takes: [fewest, most]. */
|
|
18
|
+
export declare const UI_EXPRESSION_ARITY: Readonly<Record<UiExpressionOp, readonly [number, number]>>;
|
|
19
|
+
/**
|
|
20
|
+
* Parse a stored script (an object, or its JSON text) and check it. Returns
|
|
21
|
+
* the script unchanged; throws `UiScriptError`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseUiScript(value: unknown, options?: ParseUiScriptOptions): UiScript;
|
|
24
|
+
/** `parseUiScript` without throwing. */
|
|
25
|
+
export declare function safeParseUiScript(value: unknown, options?: ParseUiScriptOptions): {
|
|
26
|
+
success: true;
|
|
27
|
+
script: UiScript;
|
|
28
|
+
} | {
|
|
29
|
+
success: false;
|
|
30
|
+
error: UiScriptError;
|
|
31
|
+
};
|