@olib-ai/owl-browser-sdk 2.0.9 → 2.1.0
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 +14 -104
- package/dist/flow/conditions.d.ts +2 -2
- package/dist/flow/conditions.d.ts.map +1 -1
- package/dist/flow/conditions.js +25 -5
- package/dist/flow/conditions.js.map +1 -1
- package/dist/flow/executor.d.ts +44 -2
- package/dist/flow/executor.d.ts.map +1 -1
- package/dist/flow/executor.js +441 -51
- package/dist/flow/executor.js.map +1 -1
- package/dist/flow/expectations.d.ts.map +1 -1
- package/dist/flow/expectations.js +42 -4
- package/dist/flow/expectations.js.map +1 -1
- package/dist/flow/extraction.d.ts +32 -0
- package/dist/flow/extraction.d.ts.map +1 -0
- package/dist/flow/extraction.js +56 -0
- package/dist/flow/extraction.js.map +1 -0
- package/dist/flow/index.d.ts +2 -0
- package/dist/flow/index.d.ts.map +1 -1
- package/dist/flow/index.js +1 -0
- package/dist/flow/index.js.map +1 -1
- package/dist/flow/notifications.d.ts +97 -0
- package/dist/flow/notifications.d.ts.map +1 -0
- package/dist/flow/notifications.js +249 -0
- package/dist/flow/notifications.js.map +1 -0
- package/dist/flow/variables.d.ts +7 -1
- package/dist/flow/variables.d.ts.map +1 -1
- package/dist/flow/variables.js +90 -33
- package/dist/flow/variables.js.map +1 -1
- package/dist/types.d.ts +100 -2
- package/dist/types.d.ts.map +1 -1
- package/openapi.json +16 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -125,7 +125,9 @@ await browser.findElement({ context_id: ctx, description: 'login button' });
|
|
|
125
125
|
|
|
126
126
|
## Flow Execution
|
|
127
127
|
|
|
128
|
-
Execute
|
|
128
|
+
Execute JSON-described automation flows with declarative assertions,
|
|
129
|
+
variable resolution, conditional branching, loops, retries, and
|
|
130
|
+
notifications.
|
|
129
131
|
|
|
130
132
|
```typescript
|
|
131
133
|
import { OwlBrowser, FlowExecutor } from '@olib-ai/owl-browser-sdk';
|
|
@@ -136,7 +138,6 @@ await browser.connect();
|
|
|
136
138
|
const ctx = await browser.createContext();
|
|
137
139
|
const executor = new FlowExecutor(browser, ctx.context_id);
|
|
138
140
|
|
|
139
|
-
// Load flow from JSON file
|
|
140
141
|
const flow = FlowExecutor.loadFlow('test-flows/navigation.json');
|
|
141
142
|
const result = await executor.execute(flow);
|
|
142
143
|
|
|
@@ -147,107 +148,12 @@ if (result.success) {
|
|
|
147
148
|
}
|
|
148
149
|
```
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"steps": [
|
|
157
|
-
{
|
|
158
|
-
"type": "browser_navigate",
|
|
159
|
-
"url": "https://example.com/login"
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
"type": "browser_type",
|
|
163
|
-
"selector": "#email",
|
|
164
|
-
"text": "user@example.com"
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
"type": "browser_type",
|
|
168
|
-
"selector": "#password",
|
|
169
|
-
"text": "secret123"
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
"type": "browser_click",
|
|
173
|
-
"selector": "#submit",
|
|
174
|
-
"expected": {
|
|
175
|
-
"notEmpty": true
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"type": "browser_wait_for_selector",
|
|
180
|
-
"selector": ".dashboard",
|
|
181
|
-
"expected": {
|
|
182
|
-
"equals": true,
|
|
183
|
-
"field": "found"
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Variable Resolution
|
|
191
|
-
|
|
192
|
-
Use `${prev}` to reference previous step results:
|
|
193
|
-
|
|
194
|
-
```json
|
|
195
|
-
{
|
|
196
|
-
"steps": [
|
|
197
|
-
{
|
|
198
|
-
"type": "browser_evaluate",
|
|
199
|
-
"script": "document.querySelector('.user-id').textContent"
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
"type": "browser_navigate",
|
|
203
|
-
"url": "https://example.com/users/${prev}"
|
|
204
|
-
}
|
|
205
|
-
]
|
|
206
|
-
}
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
Supported syntax:
|
|
210
|
-
- `${prev}` - Entire previous result
|
|
211
|
-
- `${prev.field}` - Field in previous result
|
|
212
|
-
- `${prev[0]}` - Array element
|
|
213
|
-
- `${prev[0].id}` - Nested access
|
|
214
|
-
|
|
215
|
-
### Expectations
|
|
216
|
-
|
|
217
|
-
Validate step results:
|
|
218
|
-
|
|
219
|
-
```typescript
|
|
220
|
-
const expectation = {
|
|
221
|
-
equals: 'expected value', // Exact match
|
|
222
|
-
contains: 'substring', // String contains
|
|
223
|
-
length: 5, // Array/string length
|
|
224
|
-
greaterThan: 10, // Numeric comparison
|
|
225
|
-
lessThan: 100, // Numeric comparison
|
|
226
|
-
notEmpty: true, // Not null/empty
|
|
227
|
-
matches: '^[A-Z]+$', // Regex pattern
|
|
228
|
-
field: 'data.items' // Nested field to check
|
|
229
|
-
};
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### Conditional Branching
|
|
233
|
-
|
|
234
|
-
```json
|
|
235
|
-
{
|
|
236
|
-
"type": "condition",
|
|
237
|
-
"condition": {
|
|
238
|
-
"source": "previous",
|
|
239
|
-
"operator": "equals",
|
|
240
|
-
"field": "success",
|
|
241
|
-
"value": true
|
|
242
|
-
},
|
|
243
|
-
"onTrue": [
|
|
244
|
-
{ "type": "browser_click", "selector": "#continue" }
|
|
245
|
-
],
|
|
246
|
-
"onFalse": [
|
|
247
|
-
{ "type": "browser_screenshot" }
|
|
248
|
-
]
|
|
249
|
-
}
|
|
250
|
-
```
|
|
151
|
+
For the full reference — flow file schema, every step-level field
|
|
152
|
+
(`expected`, `condition`, `for_each`, `capture`, `optional`, `timeoutMs`,
|
|
153
|
+
`retry`), variable scopes (`${prev}`, `${vars}`, `${params}`), the
|
|
154
|
+
`FlowNotifier` API, troubleshooting, and ~30 worked examples drawn from
|
|
155
|
+
`enterprise/test-flows/` — see
|
|
156
|
+
[**docs/FLOW_EXECUTOR.md**](docs/FLOW_EXECUTOR.md).
|
|
251
157
|
|
|
252
158
|
## Playwright-Compatible API
|
|
253
159
|
|
|
@@ -413,10 +319,14 @@ for (const [name, tool] of loader.tools) {
|
|
|
413
319
|
|
|
414
320
|
- `execute(flow): Promise<FlowResult>` - Execute a flow
|
|
415
321
|
- `abort(): void` - Abort current execution
|
|
416
|
-
- `reset(): void` - Reset abort flag
|
|
322
|
+
- `reset(): void` - Reset abort flag and clear vars/params
|
|
323
|
+
- `setParams(params): void` - Override flow `${params.NAME}` defaults
|
|
324
|
+
- `setEventMetadata(metadata): void` - Attach metadata to every emitted FlowEvent
|
|
417
325
|
- `static loadFlow(path): Flow` - Load flow from JSON file
|
|
418
326
|
- `static parseFlow(data): Flow` - Parse flow from object
|
|
419
327
|
|
|
328
|
+
Full reference: [docs/FLOW_EXECUTOR.md](docs/FLOW_EXECUTOR.md).
|
|
329
|
+
|
|
420
330
|
### Extractor
|
|
421
331
|
|
|
422
332
|
- `goto(url, options?): Promise<void>` - Navigate to URL
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides condition evaluation logic for conditional branching
|
|
5
5
|
* in flows.
|
|
6
6
|
*/
|
|
7
|
-
import type { FlowCondition } from '../types.js';
|
|
7
|
+
import type { FlowCondition, StepResult } from '../types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Evaluate a condition against a value.
|
|
10
10
|
*
|
|
@@ -30,5 +30,5 @@ import type { FlowCondition } from '../types.js';
|
|
|
30
30
|
* evaluateCondition(cond2, result); // true
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
export declare function evaluateCondition(condition: FlowCondition, value: unknown): boolean;
|
|
33
|
+
export declare function evaluateCondition(condition: FlowCondition, value: unknown, priorResults?: readonly StepResult[]): boolean;
|
|
34
34
|
//# sourceMappingURL=conditions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../src/flow/conditions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../src/flow/conditions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI7D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,OAAO,EACd,YAAY,CAAC,EAAE,SAAS,UAAU,EAAE,GACnC,OAAO,CAwHT"}
|
package/dist/flow/conditions.js
CHANGED
|
@@ -31,10 +31,20 @@ import { getValueAtPath } from './variables.js';
|
|
|
31
31
|
* evaluateCondition(cond2, result); // true
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
export function evaluateCondition(condition, value) {
|
|
35
|
-
|
|
34
|
+
export function evaluateCondition(condition, value, priorResults) {
|
|
35
|
+
// Source resolution: when source === 'step' + sourceStepId is set, look up
|
|
36
|
+
// the referenced step's result instead of using `value` (the prev result).
|
|
37
|
+
// Earlier code parsed sourceStepId off the JSON but never used it.
|
|
38
|
+
let sourceValue = value;
|
|
39
|
+
if (condition.source === 'step' && condition.sourceStepId && priorResults) {
|
|
40
|
+
const found = priorResults.find((r) => r.stepId === condition.sourceStepId);
|
|
41
|
+
if (found) {
|
|
42
|
+
sourceValue = found.result;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
let checkValue = sourceValue;
|
|
36
46
|
if (condition.field) {
|
|
37
|
-
checkValue = getValueAtPath(
|
|
47
|
+
checkValue = getValueAtPath(sourceValue, condition.field);
|
|
38
48
|
}
|
|
39
49
|
switch (condition.operator) {
|
|
40
50
|
case ConditionOperator.EQUALS:
|
|
@@ -88,7 +98,14 @@ export function evaluateCondition(condition, value) {
|
|
|
88
98
|
if (typeof checkValue === 'string') {
|
|
89
99
|
return checkValue.length === 0;
|
|
90
100
|
}
|
|
91
|
-
|
|
101
|
+
// Arrays must be checked BEFORE the generic object branch — Object.keys on
|
|
102
|
+
// an Array returns ['0','1',…] for populated arrays but [] for typed arrays
|
|
103
|
+
// and would also return [] for arrays in some legacy engines, so .length
|
|
104
|
+
// is the only reliable signal.
|
|
105
|
+
if (Array.isArray(checkValue)) {
|
|
106
|
+
return checkValue.length === 0;
|
|
107
|
+
}
|
|
108
|
+
if (typeof checkValue === 'object') {
|
|
92
109
|
return Object.keys(checkValue).length === 0;
|
|
93
110
|
}
|
|
94
111
|
return false;
|
|
@@ -99,7 +116,10 @@ export function evaluateCondition(condition, value) {
|
|
|
99
116
|
if (typeof checkValue === 'string') {
|
|
100
117
|
return checkValue.length > 0;
|
|
101
118
|
}
|
|
102
|
-
if (Array.isArray(checkValue)
|
|
119
|
+
if (Array.isArray(checkValue)) {
|
|
120
|
+
return checkValue.length > 0;
|
|
121
|
+
}
|
|
122
|
+
if (typeof checkValue === 'object') {
|
|
103
123
|
return Object.keys(checkValue).length > 0;
|
|
104
124
|
}
|
|
105
125
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../src/flow/conditions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,iBAAiB,
|
|
1
|
+
{"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../src/flow/conditions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,iBAAiB,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CAAC;YACD,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;gBACnC,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;YAC5C,CAAC;YACD,OAAO,IAAI,CAAC;QAEd,KAAK,iBAAiB,CAAC,WAAW;YAChC,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC1E,IAAI,CAAC;oBACH,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;oBAC5C,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAClC,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC;QAEf;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
package/dist/flow/executor.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* expectation validation, and conditional branching support.
|
|
6
6
|
*/
|
|
7
7
|
import type { Flow, FlowStep, FlowResult } from '../types.js';
|
|
8
|
+
import { FlowNotifier } from './notifications.js';
|
|
8
9
|
import type { OwlBrowser } from '../client.js';
|
|
9
10
|
/**
|
|
10
11
|
* Flow execution engine that runs a series of browser tool steps.
|
|
@@ -40,20 +41,61 @@ export declare class FlowExecutor {
|
|
|
40
41
|
private readonly _client;
|
|
41
42
|
private readonly _contextId;
|
|
42
43
|
private _abortFlag;
|
|
43
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Flow-scoped variables captured by `step.capture = "name"`. Resolved via
|
|
46
|
+
* `${vars.NAME}` in any later step's params, regardless of how many
|
|
47
|
+
* steps separate the capture from the use.
|
|
48
|
+
*/
|
|
49
|
+
private _vars;
|
|
50
|
+
/**
|
|
51
|
+
* Flow-scoped read-only parameters. Seeded from `flow.parameters`, may be
|
|
52
|
+
* overridden via setParams() (runner CLI). Resolved via `${params.NAME}`.
|
|
53
|
+
*/
|
|
54
|
+
private _params;
|
|
55
|
+
private _notifier?;
|
|
56
|
+
private _eventMetadata;
|
|
57
|
+
constructor(client: OwlBrowser, contextId: string, options?: {
|
|
58
|
+
notifier?: FlowNotifier;
|
|
59
|
+
});
|
|
60
|
+
/** Attach metadata to every FlowEvent this executor emits. */
|
|
61
|
+
setEventMetadata(metadata: Record<string, unknown>): void;
|
|
62
|
+
/** Override flow parameters; merged with declared defaults at execute() time. */
|
|
63
|
+
setParams(params: Record<string, unknown>): void;
|
|
44
64
|
/**
|
|
45
65
|
* Signal to abort the current flow execution.
|
|
46
66
|
*/
|
|
47
67
|
abort(): void;
|
|
48
68
|
/**
|
|
49
|
-
* Reset the abort flag for a new execution.
|
|
69
|
+
* Reset the abort flag and clear flow-scoped vars for a new execution.
|
|
50
70
|
*/
|
|
51
71
|
reset(): void;
|
|
52
72
|
/**
|
|
53
73
|
* Execute a flow and return the results.
|
|
74
|
+
*
|
|
75
|
+
* Honours the flow's top-level `requiredEnv` and `timeoutSeconds`
|
|
76
|
+
* directly — embedders that drive `FlowExecutor` from their own code
|
|
77
|
+
* get the same gates the bundled runner provides, without having to
|
|
78
|
+
* reimplement them. When `requiredEnv` is unmet, the executor returns
|
|
79
|
+
* `success: true, skipped: true` and emits `flow.skipped` (no
|
|
80
|
+
* `flow.started` is emitted in that case so subscribers never see a
|
|
81
|
+
* started event without a terminal counterpart).
|
|
54
82
|
*/
|
|
55
83
|
execute(flow: Flow): Promise<FlowResult>;
|
|
84
|
+
private _emitStarted;
|
|
85
|
+
/** Emit `flow.skipped` when `requiredEnv` is unmet. */
|
|
86
|
+
private _emitSkipped;
|
|
87
|
+
private _emitTerminal;
|
|
56
88
|
private _executeSteps;
|
|
89
|
+
/**
|
|
90
|
+
* Execute a `for_each` step: iterate an array source, run a body per item.
|
|
91
|
+
*
|
|
92
|
+
* Schema (under step.params):
|
|
93
|
+
* source `${...}` ref or literal array
|
|
94
|
+
* body array of step JSON to run per item
|
|
95
|
+
* item_var capture name for the current item (default 'item')
|
|
96
|
+
* index_var capture name for the index (default 'index')
|
|
97
|
+
*/
|
|
98
|
+
private _executeForEachStep;
|
|
57
99
|
private _executeConditionStep;
|
|
58
100
|
private _executeToolStep;
|
|
59
101
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/flow/executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/flow/executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAEV,IAAI,EACJ,QAAQ,EACR,UAAU,EAMX,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,YAAY,EAAa,MAAM,oBAAoB,CAAC;AAG7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA+G/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,UAAU,CAAS;IAC3B;;;;OAIG;IACH,OAAO,CAAC,KAAK,CAA+B;IAC5C;;;OAGG;IACH,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,SAAS,CAAC,CAAe;IACjC,OAAO,CAAC,cAAc,CAA+B;gBAGnD,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,YAAY,CAAA;KAAE;IAOvC,8DAA8D;IAC9D,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIzD,iFAAiF;IACjF,SAAS,CAAC,MAAM,EA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