askui 0.20.9 → 0.21.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/dist/cjs/core/annotation/template.html +470 -10
- package/dist/cjs/execution/dsl.d.ts +80 -7
- package/dist/cjs/execution/dsl.js +118 -10
- package/dist/cjs/execution/execution-runtime.d.ts +2 -1
- package/dist/cjs/execution/execution-runtime.js +10 -10
- package/dist/cjs/execution/inference-client.d.ts +2 -2
- package/dist/cjs/execution/inference-client.js +5 -5
- package/dist/cjs/execution/ui-control-client.d.ts +2 -1
- package/dist/cjs/execution/ui-control-client.js +3 -3
- package/dist/esm/core/annotation/template.html +470 -10
- package/dist/esm/execution/dsl.d.ts +80 -7
- package/dist/esm/execution/dsl.js +118 -10
- package/dist/esm/execution/execution-runtime.d.ts +2 -1
- package/dist/esm/execution/execution-runtime.js +10 -10
- package/dist/esm/execution/inference-client.d.ts +2 -2
- package/dist/esm/execution/inference-client.js +5 -5
- package/dist/esm/execution/ui-control-client.d.ts +2 -1
- package/dist/esm/execution/ui-control-client.js +3 -3
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CustomElementJson } from '../core/model/custom-element-json';
|
|
2
2
|
import { DetectedElement } from '../core/model/annotation-result/detected-element';
|
|
3
|
+
import { ModelCompositionBranch } from './model-composition-branch';
|
|
3
4
|
export declare enum Separators {
|
|
4
5
|
STRING = "<|string|>"
|
|
5
6
|
}
|
|
@@ -19,7 +20,7 @@ declare abstract class FluentBase {
|
|
|
19
20
|
protected _textStr: string;
|
|
20
21
|
protected _params: Map<string, unknown>;
|
|
21
22
|
protected static addParams(paramsList: Map<string, unknown[]>, params: Map<string, unknown>): Map<string, unknown[]>;
|
|
22
|
-
protected fluentCommandStringBuilder(currentInstruction?: string, paramsList?: Map<string, unknown[]>): Promise<void>;
|
|
23
|
+
protected fluentCommandStringBuilder(modelComposition: ModelCompositionBranch[], currentInstruction?: string, paramsList?: Map<string, unknown[]>): Promise<void>;
|
|
23
24
|
protected getterStringBuilder(currentInstruction?: string, paramsList?: Map<string, unknown[]>): Promise<DetectedElement[]>;
|
|
24
25
|
protected get textStr(): string;
|
|
25
26
|
protected get params(): Map<string, unknown>;
|
|
@@ -28,7 +29,7 @@ export interface Executable {
|
|
|
28
29
|
exec(): Promise<void>;
|
|
29
30
|
}
|
|
30
31
|
export declare class Exec extends FluentBase implements Executable {
|
|
31
|
-
exec(): Promise<void>;
|
|
32
|
+
exec(modelComposition?: ModelCompositionBranch[]): Promise<void>;
|
|
32
33
|
}
|
|
33
34
|
export declare class FluentFilters extends FluentBase {
|
|
34
35
|
/**
|
|
@@ -151,6 +152,22 @@ export declare class FluentFilters extends FluentBase {
|
|
|
151
152
|
* @return {FluentFiltersOrRelations}
|
|
152
153
|
*/
|
|
153
154
|
text(text?: string): FluentFiltersOrRelations;
|
|
155
|
+
/**
|
|
156
|
+
* Filters for an UI element 'wordlevel'.
|
|
157
|
+
*
|
|
158
|
+
* Takes an optional parameter to filter for a specific text.
|
|
159
|
+
* See the examples below.
|
|
160
|
+
*
|
|
161
|
+
* **Examples:**
|
|
162
|
+
* ```typescript
|
|
163
|
+
* await aui.fluentCommandExecutor('Click on button right of wordlevel 'User_PRG in:'');
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @param {string} [wordlevel] - A text to be matched.
|
|
167
|
+
*
|
|
168
|
+
* @return {FluentFiltersOrRelations}
|
|
169
|
+
*/
|
|
170
|
+
wordlevel(wordlevel?: string): FluentFiltersOrRelations;
|
|
154
171
|
/**
|
|
155
172
|
* Filters for a UI element 'icon'.
|
|
156
173
|
*
|
|
@@ -211,7 +228,7 @@ export declare class FluentFilters extends FluentBase {
|
|
|
211
228
|
*/
|
|
212
229
|
customElement(customElement: CustomElementJson): FluentFiltersOrRelations;
|
|
213
230
|
/**
|
|
214
|
-
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/
|
|
231
|
+
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/Element%20Selection/aielement#snipping-workflow).
|
|
215
232
|
*
|
|
216
233
|
* **Examples:**
|
|
217
234
|
*
|
|
@@ -362,6 +379,14 @@ export declare class FluentFilters extends FluentBase {
|
|
|
362
379
|
* @return {FluentFiltersOrRelations}
|
|
363
380
|
*/
|
|
364
381
|
containsText(text: string): FluentFiltersOrRelations;
|
|
382
|
+
/**
|
|
383
|
+
* Filters for PTA locating the text provided as an argument.
|
|
384
|
+
*
|
|
385
|
+
* @param {string} text - A text to be located.
|
|
386
|
+
*
|
|
387
|
+
* @return {FluentFiltersOrRelations}
|
|
388
|
+
*/
|
|
389
|
+
pta(text: string): FluentFiltersOrRelations;
|
|
365
390
|
/**
|
|
366
391
|
* Filters elements based on a textual description.
|
|
367
392
|
*
|
|
@@ -838,7 +863,7 @@ export declare class FluentFiltersOrRelations extends FluentFilters {
|
|
|
838
863
|
* @return {FluentFilters}
|
|
839
864
|
*/
|
|
840
865
|
contains(): FluentFilters;
|
|
841
|
-
exec(): Promise<void>;
|
|
866
|
+
exec(modelComposition?: ModelCompositionBranch[]): Promise<void>;
|
|
842
867
|
}
|
|
843
868
|
export declare class FluentFiltersCondition extends FluentBase {
|
|
844
869
|
/**
|
|
@@ -961,6 +986,22 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
961
986
|
* @return {FluentFiltersOrRelationsCondition}
|
|
962
987
|
*/
|
|
963
988
|
text(text?: string): FluentFiltersOrRelationsCondition;
|
|
989
|
+
/**
|
|
990
|
+
* Filters for an UI element 'wordlevel'.
|
|
991
|
+
*
|
|
992
|
+
* Takes an optional parameter to filter for a specific text.
|
|
993
|
+
* See the examples below.
|
|
994
|
+
*
|
|
995
|
+
* **Examples:**
|
|
996
|
+
* ```typescript
|
|
997
|
+
* await aui.fluentCommandExecutor('Click on button right of wordlevel 'User_PRG in:'');
|
|
998
|
+
* ```
|
|
999
|
+
*
|
|
1000
|
+
* @param {string} [wordlevel] - A text to be matched.
|
|
1001
|
+
*
|
|
1002
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1003
|
+
*/
|
|
1004
|
+
wordlevel(wordlevel?: string): FluentFiltersOrRelationsCondition;
|
|
964
1005
|
/**
|
|
965
1006
|
* Filters for a UI element 'icon'.
|
|
966
1007
|
*
|
|
@@ -1021,7 +1062,7 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1021
1062
|
*/
|
|
1022
1063
|
customElement(customElement: CustomElementJson): FluentFiltersOrRelationsCondition;
|
|
1023
1064
|
/**
|
|
1024
|
-
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/
|
|
1065
|
+
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/Element%20Selection/aielement#snipping-workflow).
|
|
1025
1066
|
*
|
|
1026
1067
|
* **Examples:**
|
|
1027
1068
|
*
|
|
@@ -1172,6 +1213,14 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1172
1213
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1173
1214
|
*/
|
|
1174
1215
|
containsText(text: string): FluentFiltersOrRelationsCondition;
|
|
1216
|
+
/**
|
|
1217
|
+
* Filters for PTA locating the text provided as an argument.
|
|
1218
|
+
*
|
|
1219
|
+
* @param {string} text - A text to be located.
|
|
1220
|
+
*
|
|
1221
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1222
|
+
*/
|
|
1223
|
+
pta(text: string): FluentFiltersOrRelationsCondition;
|
|
1175
1224
|
/**
|
|
1176
1225
|
* Filters elements based on a textual description.
|
|
1177
1226
|
*
|
|
@@ -2146,7 +2195,7 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
2146
2195
|
* @return {Exec}
|
|
2147
2196
|
*/
|
|
2148
2197
|
pressAndroidKey(key: ANDROID_KEY): Exec;
|
|
2149
|
-
abstract fluentCommandExecutor(instruction: string, context: CommandExecutorContext): Promise<void>;
|
|
2198
|
+
abstract fluentCommandExecutor(instruction: string, modelComposition: ModelCompositionBranch[], context: CommandExecutorContext): Promise<void>;
|
|
2150
2199
|
}
|
|
2151
2200
|
export interface ExecutableGetter {
|
|
2152
2201
|
exec(): Promise<DetectedElement[]>;
|
|
@@ -2275,6 +2324,22 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
2275
2324
|
* @return {FluentFiltersOrRelationsGetter}
|
|
2276
2325
|
*/
|
|
2277
2326
|
text(text?: string): FluentFiltersOrRelationsGetter;
|
|
2327
|
+
/**
|
|
2328
|
+
* Filters for an UI element 'wordlevel'.
|
|
2329
|
+
*
|
|
2330
|
+
* Takes an optional parameter to filter for a specific text.
|
|
2331
|
+
* See the examples below.
|
|
2332
|
+
*
|
|
2333
|
+
* **Examples:**
|
|
2334
|
+
* ```typescript
|
|
2335
|
+
* await aui.fluentCommandExecutor('Click on button right of wordlevel 'User_PRG in:'');
|
|
2336
|
+
* ```
|
|
2337
|
+
*
|
|
2338
|
+
* @param {string} [wordlevel] - A text to be matched.
|
|
2339
|
+
*
|
|
2340
|
+
* @return {FluentFiltersOrRelationsGetter}
|
|
2341
|
+
*/
|
|
2342
|
+
wordlevel(wordlevel?: string): FluentFiltersOrRelationsGetter;
|
|
2278
2343
|
/**
|
|
2279
2344
|
* Filters for a UI element 'icon'.
|
|
2280
2345
|
*
|
|
@@ -2335,7 +2400,7 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
2335
2400
|
*/
|
|
2336
2401
|
customElement(customElement: CustomElementJson): FluentFiltersOrRelationsGetter;
|
|
2337
2402
|
/**
|
|
2338
|
-
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/
|
|
2403
|
+
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/Element%20Selection/aielement#snipping-workflow).
|
|
2339
2404
|
*
|
|
2340
2405
|
* **Examples:**
|
|
2341
2406
|
*
|
|
@@ -2486,6 +2551,14 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
2486
2551
|
* @return {FluentFiltersOrRelationsGetter}
|
|
2487
2552
|
*/
|
|
2488
2553
|
containsText(text: string): FluentFiltersOrRelationsGetter;
|
|
2554
|
+
/**
|
|
2555
|
+
* Filters for PTA locating the text provided as an argument.
|
|
2556
|
+
*
|
|
2557
|
+
* @param {string} text - A text to be located.
|
|
2558
|
+
*
|
|
2559
|
+
* @return {FluentFiltersOrRelationsGetter}
|
|
2560
|
+
*/
|
|
2561
|
+
pta(text: string): FluentFiltersOrRelationsGetter;
|
|
2489
2562
|
/**
|
|
2490
2563
|
* Filters elements based on a textual description.
|
|
2491
2564
|
*
|
|
@@ -49,14 +49,14 @@ class FluentBase {
|
|
|
49
49
|
});
|
|
50
50
|
return paramsList;
|
|
51
51
|
}
|
|
52
|
-
fluentCommandStringBuilder(currentInstruction = '', paramsList = new Map()) {
|
|
52
|
+
fluentCommandStringBuilder(modelComposition, currentInstruction = '', paramsList = new Map()) {
|
|
53
53
|
const newCurrentInstruction = `${this.textStr} ${currentInstruction}`;
|
|
54
54
|
const newParamsList = FluentBase.addParams(paramsList, this._params);
|
|
55
55
|
if (this instanceof FluentCommand) {
|
|
56
56
|
const fluentCommand = this;
|
|
57
57
|
const customElements = newParamsList.has('customElement') ? newParamsList.get('customElement') : [];
|
|
58
58
|
const aiElementNames = newParamsList.has('aiElementName') ? newParamsList.get('aiElementName') : [];
|
|
59
|
-
return fluentCommand.fluentCommandExecutor(newCurrentInstruction.trim(), {
|
|
59
|
+
return fluentCommand.fluentCommandExecutor(newCurrentInstruction.trim(), modelComposition, {
|
|
60
60
|
customElementsJson: customElements,
|
|
61
61
|
aiElementNames,
|
|
62
62
|
});
|
|
@@ -64,7 +64,7 @@ class FluentBase {
|
|
|
64
64
|
if (!this.prev) {
|
|
65
65
|
throw new Error('Prev element not defined');
|
|
66
66
|
}
|
|
67
|
-
return this.prev.fluentCommandStringBuilder(newCurrentInstruction, newParamsList);
|
|
67
|
+
return this.prev.fluentCommandStringBuilder(modelComposition, newCurrentInstruction, newParamsList);
|
|
68
68
|
}
|
|
69
69
|
getterStringBuilder(currentInstruction = '', paramsList = new Map()) {
|
|
70
70
|
const newCurrentInstruction = `${this.textStr} ${currentInstruction}`;
|
|
@@ -87,10 +87,10 @@ class FluentBase {
|
|
|
87
87
|
get params() { return this._params; }
|
|
88
88
|
}
|
|
89
89
|
export class Exec extends FluentBase {
|
|
90
|
-
exec() {
|
|
90
|
+
exec(modelComposition = []) {
|
|
91
91
|
const originStacktrace = { stack: '' };
|
|
92
92
|
Error.captureStackTrace(originStacktrace, this.exec);
|
|
93
|
-
return this.fluentCommandStringBuilder().catch((err) => Promise.reject(rewriteStackTraceForError(err, originStacktrace.stack)));
|
|
93
|
+
return this.fluentCommandStringBuilder(modelComposition).catch((err) => Promise.reject(rewriteStackTraceForError(err, originStacktrace.stack)));
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
// Filters
|
|
@@ -274,6 +274,29 @@ export class FluentFilters extends FluentBase {
|
|
|
274
274
|
}
|
|
275
275
|
return new FluentFiltersOrRelations(this);
|
|
276
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* Filters for an UI element 'wordlevel'.
|
|
279
|
+
*
|
|
280
|
+
* Takes an optional parameter to filter for a specific text.
|
|
281
|
+
* See the examples below.
|
|
282
|
+
*
|
|
283
|
+
* **Examples:**
|
|
284
|
+
* ```typescript
|
|
285
|
+
* await aui.fluentCommandExecutor('Click on button right of wordlevel 'User_PRG in:'');
|
|
286
|
+
* ```
|
|
287
|
+
*
|
|
288
|
+
* @param {string} [wordlevel] - A text to be matched.
|
|
289
|
+
*
|
|
290
|
+
* @return {FluentFiltersOrRelations}
|
|
291
|
+
*/
|
|
292
|
+
wordlevel(wordlevel) {
|
|
293
|
+
this._textStr = '';
|
|
294
|
+
this._textStr += 'wordlevel';
|
|
295
|
+
if (wordlevel !== undefined) {
|
|
296
|
+
this._textStr += ` ${Separators.STRING}${wordlevel}${Separators.STRING}`;
|
|
297
|
+
}
|
|
298
|
+
return new FluentFiltersOrRelations(this);
|
|
299
|
+
}
|
|
277
300
|
/**
|
|
278
301
|
* Filters for a UI element 'icon'.
|
|
279
302
|
*
|
|
@@ -344,7 +367,7 @@ export class FluentFilters extends FluentBase {
|
|
|
344
367
|
return new FluentFiltersOrRelations(this);
|
|
345
368
|
}
|
|
346
369
|
/**
|
|
347
|
-
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/
|
|
370
|
+
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/Element%20Selection/aielement#snipping-workflow).
|
|
348
371
|
*
|
|
349
372
|
* **Examples:**
|
|
350
373
|
*
|
|
@@ -540,6 +563,19 @@ export class FluentFilters extends FluentBase {
|
|
|
540
563
|
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
541
564
|
return new FluentFiltersOrRelations(this);
|
|
542
565
|
}
|
|
566
|
+
/**
|
|
567
|
+
* Filters for PTA locating the text provided as an argument.
|
|
568
|
+
*
|
|
569
|
+
* @param {string} text - A text to be located.
|
|
570
|
+
*
|
|
571
|
+
* @return {FluentFiltersOrRelations}
|
|
572
|
+
*/
|
|
573
|
+
pta(text) {
|
|
574
|
+
this._textStr = '';
|
|
575
|
+
this._textStr += 'pta';
|
|
576
|
+
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
577
|
+
return new FluentFiltersOrRelations(this);
|
|
578
|
+
}
|
|
543
579
|
/**
|
|
544
580
|
* Filters elements based on a textual description.
|
|
545
581
|
*
|
|
@@ -1085,10 +1121,10 @@ export class FluentFiltersOrRelations extends FluentFilters {
|
|
|
1085
1121
|
this._textStr += 'contains';
|
|
1086
1122
|
return new FluentFilters(this);
|
|
1087
1123
|
}
|
|
1088
|
-
exec() {
|
|
1124
|
+
exec(modelComposition = []) {
|
|
1089
1125
|
const originStacktrace = { stack: '' };
|
|
1090
1126
|
Error.captureStackTrace(originStacktrace, this.exec);
|
|
1091
|
-
return this.fluentCommandStringBuilder().catch((err) => Promise.reject(rewriteStackTraceForError(err, originStacktrace.stack)));
|
|
1127
|
+
return this.fluentCommandStringBuilder(modelComposition).catch((err) => Promise.reject(rewriteStackTraceForError(err, originStacktrace.stack)));
|
|
1092
1128
|
}
|
|
1093
1129
|
}
|
|
1094
1130
|
// Filters
|
|
@@ -1272,6 +1308,29 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1272
1308
|
}
|
|
1273
1309
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1274
1310
|
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Filters for an UI element 'wordlevel'.
|
|
1313
|
+
*
|
|
1314
|
+
* Takes an optional parameter to filter for a specific text.
|
|
1315
|
+
* See the examples below.
|
|
1316
|
+
*
|
|
1317
|
+
* **Examples:**
|
|
1318
|
+
* ```typescript
|
|
1319
|
+
* await aui.fluentCommandExecutor('Click on button right of wordlevel 'User_PRG in:'');
|
|
1320
|
+
* ```
|
|
1321
|
+
*
|
|
1322
|
+
* @param {string} [wordlevel] - A text to be matched.
|
|
1323
|
+
*
|
|
1324
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1325
|
+
*/
|
|
1326
|
+
wordlevel(wordlevel) {
|
|
1327
|
+
this._textStr = '';
|
|
1328
|
+
this._textStr += 'wordlevel';
|
|
1329
|
+
if (wordlevel !== undefined) {
|
|
1330
|
+
this._textStr += ` ${Separators.STRING}${wordlevel}${Separators.STRING}`;
|
|
1331
|
+
}
|
|
1332
|
+
return new FluentFiltersOrRelationsCondition(this);
|
|
1333
|
+
}
|
|
1275
1334
|
/**
|
|
1276
1335
|
* Filters for a UI element 'icon'.
|
|
1277
1336
|
*
|
|
@@ -1342,7 +1401,7 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1342
1401
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1343
1402
|
}
|
|
1344
1403
|
/**
|
|
1345
|
-
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/
|
|
1404
|
+
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/Element%20Selection/aielement#snipping-workflow).
|
|
1346
1405
|
*
|
|
1347
1406
|
* **Examples:**
|
|
1348
1407
|
*
|
|
@@ -1538,6 +1597,19 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1538
1597
|
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1539
1598
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1540
1599
|
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Filters for PTA locating the text provided as an argument.
|
|
1602
|
+
*
|
|
1603
|
+
* @param {string} text - A text to be located.
|
|
1604
|
+
*
|
|
1605
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1606
|
+
*/
|
|
1607
|
+
pta(text) {
|
|
1608
|
+
this._textStr = '';
|
|
1609
|
+
this._textStr += 'pta';
|
|
1610
|
+
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1611
|
+
return new FluentFiltersOrRelationsCondition(this);
|
|
1612
|
+
}
|
|
1541
1613
|
/**
|
|
1542
1614
|
* Filters elements based on a textual description.
|
|
1543
1615
|
*
|
|
@@ -2951,6 +3023,29 @@ export class FluentFiltersGetter extends FluentBase {
|
|
|
2951
3023
|
}
|
|
2952
3024
|
return new FluentFiltersOrRelationsGetter(this);
|
|
2953
3025
|
}
|
|
3026
|
+
/**
|
|
3027
|
+
* Filters for an UI element 'wordlevel'.
|
|
3028
|
+
*
|
|
3029
|
+
* Takes an optional parameter to filter for a specific text.
|
|
3030
|
+
* See the examples below.
|
|
3031
|
+
*
|
|
3032
|
+
* **Examples:**
|
|
3033
|
+
* ```typescript
|
|
3034
|
+
* await aui.fluentCommandExecutor('Click on button right of wordlevel 'User_PRG in:'');
|
|
3035
|
+
* ```
|
|
3036
|
+
*
|
|
3037
|
+
* @param {string} [wordlevel] - A text to be matched.
|
|
3038
|
+
*
|
|
3039
|
+
* @return {FluentFiltersOrRelationsGetter}
|
|
3040
|
+
*/
|
|
3041
|
+
wordlevel(wordlevel) {
|
|
3042
|
+
this._textStr = '';
|
|
3043
|
+
this._textStr += 'wordlevel';
|
|
3044
|
+
if (wordlevel !== undefined) {
|
|
3045
|
+
this._textStr += ` ${Separators.STRING}${wordlevel}${Separators.STRING}`;
|
|
3046
|
+
}
|
|
3047
|
+
return new FluentFiltersOrRelationsGetter(this);
|
|
3048
|
+
}
|
|
2954
3049
|
/**
|
|
2955
3050
|
* Filters for a UI element 'icon'.
|
|
2956
3051
|
*
|
|
@@ -3021,7 +3116,7 @@ export class FluentFiltersGetter extends FluentBase {
|
|
|
3021
3116
|
return new FluentFiltersOrRelationsGetter(this);
|
|
3022
3117
|
}
|
|
3023
3118
|
/**
|
|
3024
|
-
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/
|
|
3119
|
+
* Detects an AI Element created with the [snipping workflow](https://docs.askui.com/docs/general/Element%20Selection/aielement#snipping-workflow).
|
|
3025
3120
|
*
|
|
3026
3121
|
* **Examples:**
|
|
3027
3122
|
*
|
|
@@ -3217,6 +3312,19 @@ export class FluentFiltersGetter extends FluentBase {
|
|
|
3217
3312
|
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
3218
3313
|
return new FluentFiltersOrRelationsGetter(this);
|
|
3219
3314
|
}
|
|
3315
|
+
/**
|
|
3316
|
+
* Filters for PTA locating the text provided as an argument.
|
|
3317
|
+
*
|
|
3318
|
+
* @param {string} text - A text to be located.
|
|
3319
|
+
*
|
|
3320
|
+
* @return {FluentFiltersOrRelationsGetter}
|
|
3321
|
+
*/
|
|
3322
|
+
pta(text) {
|
|
3323
|
+
this._textStr = '';
|
|
3324
|
+
this._textStr += 'pta';
|
|
3325
|
+
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
3326
|
+
return new FluentFiltersOrRelationsGetter(this);
|
|
3327
|
+
}
|
|
3220
3328
|
/**
|
|
3221
3329
|
* Filters elements based on a textual description.
|
|
3222
3330
|
*
|
|
@@ -6,6 +6,7 @@ import { DetectedElement } from '../core/model/annotation-result/detected-elemen
|
|
|
6
6
|
import { UiControllerClientConnectionState } from './ui-controller-client-connection-state';
|
|
7
7
|
import { Instruction, StepReporter } from '../core/reporting';
|
|
8
8
|
import { RetryStrategy } from './retry-strategies/retry-strategy';
|
|
9
|
+
import { ModelCompositionBranch } from './model-composition-branch';
|
|
9
10
|
export declare class ExecutionRuntime {
|
|
10
11
|
private uiControllerClient;
|
|
11
12
|
private inferenceClient;
|
|
@@ -18,7 +19,7 @@ export declare class ExecutionRuntime {
|
|
|
18
19
|
stopVideoRecording(): Promise<void>;
|
|
19
20
|
readVideoRecording(): Promise<string>;
|
|
20
21
|
private requestControl;
|
|
21
|
-
executeInstruction(instruction: Instruction): Promise<void>;
|
|
22
|
+
executeInstruction(instruction: Instruction, modelComposition: ModelCompositionBranch[]): Promise<void>;
|
|
22
23
|
private readonly EXEC_REPETITION_COUNT;
|
|
23
24
|
private executeCommandRepeatedly;
|
|
24
25
|
/**
|
|
@@ -52,21 +52,21 @@ export class ExecutionRuntime {
|
|
|
52
52
|
yield this.uiControllerClient.requestControl(controlCommand);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
executeInstruction(instruction) {
|
|
55
|
+
executeInstruction(instruction, modelComposition) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
57
|
var _a, _b, _c;
|
|
58
|
-
const controlCommand = yield this.predictCommandWithRetry(instruction);
|
|
58
|
+
const controlCommand = yield this.predictCommandWithRetry(instruction, modelComposition);
|
|
59
59
|
if (controlCommand.code === ControlCommandCode.OK) {
|
|
60
60
|
return this.requestControl(controlCommand);
|
|
61
61
|
}
|
|
62
62
|
if (controlCommand.tryToRepeat) {
|
|
63
63
|
yield this.requestControl(controlCommand);
|
|
64
|
-
return this.executeCommandRepeatedly(instruction);
|
|
64
|
+
return this.executeCommandRepeatedly(instruction, modelComposition);
|
|
65
65
|
}
|
|
66
66
|
throw new ControlCommandError((_c = (_b = (_a = controlCommand.actions) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.text) !== null && _c !== void 0 ? _c : '');
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
executeCommandRepeatedly(instruction) {
|
|
69
|
+
executeCommandRepeatedly(instruction, modelComposition) {
|
|
70
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
71
|
var _a, _b, _c;
|
|
72
72
|
/* eslint-disable no-await-in-loop */
|
|
@@ -76,7 +76,7 @@ export class ExecutionRuntime {
|
|
|
76
76
|
+ 'from a single test step reached');
|
|
77
77
|
}
|
|
78
78
|
logger.debug('Repeat command execution....');
|
|
79
|
-
const controlCommand = yield this.predictCommandWithRetry(instruction);
|
|
79
|
+
const controlCommand = yield this.predictCommandWithRetry(instruction, modelComposition);
|
|
80
80
|
if (controlCommand.code === ControlCommandCode.OK) {
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
@@ -95,10 +95,10 @@ export class ExecutionRuntime {
|
|
|
95
95
|
* --> retry with linear back-off
|
|
96
96
|
*/
|
|
97
97
|
/* eslint-disable-next-line consistent-return */
|
|
98
|
-
predictCommandWithRetry(instruction) {
|
|
98
|
+
predictCommandWithRetry(instruction, modelComposition) {
|
|
99
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
100
|
var _a, _b, _c;
|
|
101
|
-
let command = yield this.predictCommand(instruction);
|
|
101
|
+
let command = yield this.predictCommand(instruction, modelComposition);
|
|
102
102
|
/* eslint-disable no-await-in-loop */
|
|
103
103
|
for (let k = 0; k < this.retryStrategy.retryCount; k += 1) {
|
|
104
104
|
if (command.code === ControlCommandCode.OK) {
|
|
@@ -107,7 +107,7 @@ export class ExecutionRuntime {
|
|
|
107
107
|
const msUntilRetry = this.retryStrategy.getDelay(k + 1);
|
|
108
108
|
logger.debug(`Wait ${msUntilRetry} and retry predicting command...`);
|
|
109
109
|
yield delay(msUntilRetry);
|
|
110
|
-
command = yield this.predictCommand(instruction, new ControlCommandError((_c = (_b = (_a = command.actions) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.text) !== null && _c !== void 0 ? _c : ''));
|
|
110
|
+
command = yield this.predictCommand(instruction, modelComposition, new ControlCommandError((_c = (_b = (_a = command.actions) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.text) !== null && _c !== void 0 ? _c : ''));
|
|
111
111
|
}
|
|
112
112
|
/* eslint-enable no-await-in-loop */
|
|
113
113
|
return command;
|
|
@@ -147,14 +147,14 @@ export class ExecutionRuntime {
|
|
|
147
147
|
};
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
predictCommand(instruction, retryError) {
|
|
150
|
+
predictCommand(instruction, modelComposition, retryError) {
|
|
151
151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
152
152
|
const snapshot = yield this.buildSnapshot(instruction.value);
|
|
153
153
|
if (retryError !== undefined)
|
|
154
154
|
this.stepReporter.onStepRetry(snapshot, retryError);
|
|
155
155
|
else
|
|
156
156
|
this.stepReporter.onStepBegin(snapshot);
|
|
157
|
-
const controlCommand = yield this.inferenceClient.predictControlCommand(instruction.value, instruction.customElements, snapshot.screenshot);
|
|
157
|
+
const controlCommand = yield this.inferenceClient.predictControlCommand(instruction.value, modelComposition, instruction.customElements, snapshot.screenshot);
|
|
158
158
|
if (instruction.secretText !== undefined) {
|
|
159
159
|
controlCommand.setTextToBeTyped(instruction.secretText);
|
|
160
160
|
}
|
|
@@ -16,10 +16,10 @@ export declare class InferenceClient {
|
|
|
16
16
|
constructor(baseUrl: string, httpClient: HttpClientGot, resize?: number | undefined, workspaceId?: string | undefined, modelComposition?: ModelCompositionBranch[] | undefined, apiVersion?: string);
|
|
17
17
|
isImageRequired(instruction: string): Promise<boolean>;
|
|
18
18
|
private resizeIfNeeded;
|
|
19
|
-
inference(customElements?: CustomElement[], image?: string, instruction?: string): Promise<ControlCommand | Annotation>;
|
|
19
|
+
inference(customElements?: CustomElement[], image?: string, instruction?: string, modelComposition?: ModelCompositionBranch[]): Promise<ControlCommand | Annotation>;
|
|
20
20
|
vqaInference(image: string, prompt: string, config?: object): Promise<VQAInferenceResponseBody>;
|
|
21
21
|
private static logMetaInformation;
|
|
22
|
-
predictControlCommand(instruction: string, customElements?: CustomElement[], image?: string): Promise<ControlCommand>;
|
|
22
|
+
predictControlCommand(instruction: string, modelComposition: ModelCompositionBranch[], customElements?: CustomElement[], image?: string): Promise<ControlCommand>;
|
|
23
23
|
getDetectedElements(instruction: string, image: string, customElements?: CustomElement[]): Promise<DetectedElement[]>;
|
|
24
24
|
predictImageAnnotation(image: string, customElements?: CustomElement[]): Promise<Annotation>;
|
|
25
25
|
predictVQAAnswer(prompt: string, image: string, config?: object): Promise<any>;
|
|
@@ -55,7 +55,7 @@ export class InferenceClient {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
inference() {
|
|
58
|
-
return __awaiter(this, arguments, void 0, function* (customElements = [], image, instruction) {
|
|
58
|
+
return __awaiter(this, arguments, void 0, function* (customElements = [], image, instruction, modelComposition = []) {
|
|
59
59
|
const resizedImage = yield this.resizeIfNeeded(customElements, image);
|
|
60
60
|
const response = yield this.httpClient.post(this.urls.inference, this.urls.inference.includes('v4-experimental') ? {
|
|
61
61
|
image: resizedImage.base64Image,
|
|
@@ -66,7 +66,7 @@ export class InferenceClient {
|
|
|
66
66
|
customElements,
|
|
67
67
|
image: resizedImage.base64Image,
|
|
68
68
|
instruction,
|
|
69
|
-
modelComposition: this.modelComposition,
|
|
69
|
+
modelComposition: modelComposition.length > 0 ? modelComposition : this.modelComposition,
|
|
70
70
|
});
|
|
71
71
|
InferenceClient.logMetaInformation(response);
|
|
72
72
|
return InferenceResponse.fromJson(response.body, resizedImage.resizeRatio, image);
|
|
@@ -88,9 +88,9 @@ export class InferenceClient {
|
|
|
88
88
|
logger.warn(response.headers['askui-usage-warnings']);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
predictControlCommand(instruction_1) {
|
|
92
|
-
return __awaiter(this, arguments, void 0, function* (instruction, customElements = [], image) {
|
|
93
|
-
const inferenceResponse = yield this.inference(customElements, image, instruction);
|
|
91
|
+
predictControlCommand(instruction_1, modelComposition_1) {
|
|
92
|
+
return __awaiter(this, arguments, void 0, function* (instruction, modelComposition, customElements = [], image) {
|
|
93
|
+
const inferenceResponse = yield this.inference(customElements, image, instruction, modelComposition);
|
|
94
94
|
if (!(inferenceResponse instanceof ControlCommand)) {
|
|
95
95
|
throw new InferenceResponseError('Internal Error. Can not execute command');
|
|
96
96
|
}
|
|
@@ -4,6 +4,7 @@ import { Annotation } from '../core/annotation/annotation';
|
|
|
4
4
|
import { AnnotationRequest } from '../core/model/annotation-result/annotation-interface';
|
|
5
5
|
import { DetectedElement } from '../core/model/annotation-result/detected-element';
|
|
6
6
|
import { ClientArgs } from './ui-controller-client-interface';
|
|
7
|
+
import { ModelCompositionBranch } from './model-composition-branch';
|
|
7
8
|
export type RelationsForConvenienceMethods = 'nearestTo' | 'leftOf' | 'above' | 'rightOf' | 'below' | 'contains';
|
|
8
9
|
export type TextMatchingOption = 'similar' | 'exact' | 'regex';
|
|
9
10
|
export type ElementExistsQueryType = 'otherElement' | 'switch' | 'element' | 'container' | 'checkbox' | 'element' | 'button' | 'table' | 'text' | 'icon' | 'image' | 'textfield';
|
|
@@ -57,7 +58,7 @@ export declare class UiControlClient extends ApiCommands {
|
|
|
57
58
|
private escapeSeparatorString;
|
|
58
59
|
private buildInstruction;
|
|
59
60
|
private getAIElementsByNames;
|
|
60
|
-
fluentCommandExecutor(instructionString: string, context?: CommandExecutorContext): Promise<void>;
|
|
61
|
+
fluentCommandExecutor(instructionString: string, modelComposition: ModelCompositionBranch[], context?: CommandExecutorContext): Promise<void>;
|
|
61
62
|
getterExecutor(instruction: string, context?: CommandExecutorContext): Promise<DetectedElement[]>;
|
|
62
63
|
/**
|
|
63
64
|
* Takes a prompt that contains a question you want to be answered
|
|
@@ -131,8 +131,8 @@ export class UiControlClient extends ApiCommands {
|
|
|
131
131
|
return workspaceAIElementCollection.getByNames(names);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
fluentCommandExecutor(instructionString_1) {
|
|
135
|
-
return __awaiter(this, arguments, void 0, function* (instructionString, context = { customElementsJson: [], aiElementNames: [] }) {
|
|
134
|
+
fluentCommandExecutor(instructionString_1, modelComposition_1) {
|
|
135
|
+
return __awaiter(this, arguments, void 0, function* (instructionString, modelComposition, context = { customElementsJson: [], aiElementNames: [] }) {
|
|
136
136
|
const aiElements = yield this.getAIElementsByNames(context.aiElementNames);
|
|
137
137
|
const instruction = yield this.buildInstruction(instructionString, [
|
|
138
138
|
...context.customElementsJson,
|
|
@@ -141,7 +141,7 @@ export class UiControlClient extends ApiCommands {
|
|
|
141
141
|
logger.debug(instruction);
|
|
142
142
|
try {
|
|
143
143
|
yield this.stepReporter.resetStep(instruction);
|
|
144
|
-
yield this.executionRuntime.executeInstruction(instruction);
|
|
144
|
+
yield this.executionRuntime.executeInstruction(instruction, modelComposition);
|
|
145
145
|
yield this.afterCommandExecution(instruction);
|
|
146
146
|
return yield Promise.resolve();
|
|
147
147
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "askui GmbH <info@askui.com> (http://www.askui.com/)",
|
|
6
6
|
"description": "Reliable, automated end-to-end-testing that depends on what is shown on your screen instead of the technology you are running on",
|