askui 0.20.8 → 0.20.9
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/inference-response/model-type.d.ts +1 -1
- package/dist/cjs/core/model/custom-element.d.ts +5 -5
- package/dist/cjs/core/model/custom-element.js +2 -2
- package/dist/cjs/core/reporting/index.js +5 -1
- package/dist/cjs/core/reporting/snapshot-detail-level.d.ts +1 -1
- package/dist/cjs/core/reporting/snapshot-detail-level.js +1 -2
- package/dist/cjs/core/reporting/step-status-end.d.ts +1 -1
- package/dist/cjs/core/reporting/step-status.d.ts +1 -1
- package/dist/cjs/core/runner-protocol/index.js +5 -1
- package/dist/cjs/core/ui-control-commands/action.d.ts +1 -1
- package/dist/cjs/core/ui-control-commands/control-command-code.js +1 -1
- package/dist/cjs/core/ui-control-commands/input-event.js +1 -1
- package/dist/cjs/execution/dsl.d.ts +6 -6
- package/dist/cjs/execution/dsl.js +1 -1
- package/dist/cjs/execution/execution-runtime.d.ts +3 -2
- package/dist/cjs/execution/execution-runtime.js +8 -7
- package/dist/cjs/execution/index.d.ts +1 -0
- package/dist/cjs/execution/index.js +6 -1
- package/dist/cjs/execution/inference-client.js +8 -8
- package/dist/cjs/execution/misc.js +1 -2
- package/dist/cjs/execution/read-credentials.js +1 -2
- package/dist/cjs/execution/read-environment-credentials.js +1 -2
- package/dist/cjs/execution/retry-strategies/exponential-retry-strategy.d.ts +19 -0
- package/dist/cjs/execution/retry-strategies/exponential-retry-strategy.js +25 -0
- package/dist/cjs/execution/retry-strategies/fixed-retry-strategy.d.ts +19 -0
- package/dist/cjs/execution/retry-strategies/fixed-retry-strategy.js +25 -0
- package/dist/cjs/execution/retry-strategies/index.d.ts +4 -0
- package/dist/cjs/execution/retry-strategies/index.js +20 -0
- package/dist/cjs/execution/retry-strategies/linear-retry-strategy.d.ts +19 -0
- package/dist/cjs/execution/retry-strategies/linear-retry-strategy.js +25 -0
- package/dist/cjs/execution/retry-strategies/retry-strategy.d.ts +19 -0
- package/dist/cjs/execution/retry-strategies/retry-strategy.js +2 -0
- package/dist/cjs/execution/ui-control-client-dependency-builder.js +6 -5
- package/dist/cjs/execution/ui-control-client.d.ts +3 -3
- package/dist/cjs/execution/ui-control-client.js +21 -15
- package/dist/cjs/execution/ui-controller-client-connection-state.js +1 -1
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +6 -0
- package/dist/cjs/execution/ui-controller-client.js +2 -1
- package/dist/cjs/lib/download-binaries.d.ts +0 -1
- package/dist/cjs/lib/download-binaries.js +3 -4
- package/dist/cjs/lib/interactive_cli/add-remove-script-package-json.js +2 -3
- package/dist/cjs/lib/interactive_cli/cli.js +1 -2
- package/dist/cjs/lib/logger.d.ts +1 -1
- package/dist/cjs/lib/ui-controller-args.js +2 -3
- package/dist/cjs/lib/ui-controller-facade.js +4 -4
- package/dist/cjs/main.js +5 -1
- package/dist/cjs/shared/log-levels.js +1 -1
- package/dist/cjs/shared/proxy-agent-args.d.ts +0 -1
- package/dist/cjs/utils/analytics/installation-timestamp-create-error.d.ts +0 -1
- package/dist/cjs/utils/analytics/installation-timestamp-get-error.d.ts +0 -1
- package/dist/cjs/utils/base_64_image/sharp.js +6 -3
- package/dist/cjs/utils/http/custom-errors/index.js +2 -2
- package/dist/cjs/utils/http/http-client-got.d.ts +0 -1
- package/dist/cjs/utils/http/http-client-got.js +2 -2
- package/dist/cjs/utils/path.js +1 -2
- package/dist/cjs/utils/proxy/proxy-builder.js +7 -3
- package/dist/cjs/utils/transformations.js +3 -4
- package/dist/esm/core/inference-response/model-type.d.ts +1 -1
- package/dist/esm/core/model/custom-element.d.ts +5 -5
- package/dist/esm/core/model/custom-element.js +2 -2
- package/dist/esm/core/reporting/snapshot-detail-level.d.ts +1 -1
- package/dist/esm/core/reporting/step-status-end.d.ts +1 -1
- package/dist/esm/core/reporting/step-status.d.ts +1 -1
- package/dist/esm/core/ui-control-commands/action.d.ts +1 -1
- package/dist/esm/execution/dsl.d.ts +6 -6
- package/dist/esm/execution/execution-runtime.d.ts +3 -2
- package/dist/esm/execution/execution-runtime.js +8 -7
- package/dist/esm/execution/index.d.ts +1 -0
- package/dist/esm/execution/index.js +1 -0
- package/dist/esm/execution/inference-client.js +8 -8
- package/dist/esm/execution/retry-strategies/exponential-retry-strategy.d.ts +19 -0
- package/dist/esm/execution/retry-strategies/exponential-retry-strategy.js +21 -0
- package/dist/esm/execution/retry-strategies/fixed-retry-strategy.d.ts +19 -0
- package/dist/esm/execution/retry-strategies/fixed-retry-strategy.js +21 -0
- package/dist/esm/execution/retry-strategies/index.d.ts +4 -0
- package/dist/esm/execution/retry-strategies/index.js +4 -0
- package/dist/esm/execution/retry-strategies/linear-retry-strategy.d.ts +19 -0
- package/dist/esm/execution/retry-strategies/linear-retry-strategy.js +21 -0
- package/dist/esm/execution/retry-strategies/retry-strategy.d.ts +19 -0
- package/dist/esm/execution/retry-strategies/retry-strategy.js +1 -0
- package/dist/esm/execution/ui-control-client-dependency-builder.js +6 -5
- package/dist/esm/execution/ui-control-client.d.ts +3 -3
- package/dist/esm/execution/ui-control-client.js +21 -15
- package/dist/esm/execution/ui-controller-client-interface.d.ts +6 -0
- package/dist/esm/execution/ui-controller-client.js +2 -1
- package/dist/esm/lib/download-binaries.d.ts +0 -1
- package/dist/esm/lib/logger.d.ts +1 -1
- package/dist/esm/lib/ui-controller-facade.js +4 -4
- package/dist/esm/shared/proxy-agent-args.d.ts +0 -1
- package/dist/esm/utils/analytics/installation-timestamp-create-error.d.ts +0 -1
- package/dist/esm/utils/analytics/installation-timestamp-get-error.d.ts +0 -1
- package/dist/esm/utils/http/http-client-got.d.ts +0 -1
- package/dist/esm/utils/http/http-client-got.js +2 -2
- package/dist/esm/utils/transformations.js +2 -2
- package/package.json +28 -28
|
@@ -4,9 +4,9 @@ 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
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
7
|
+
export type RelationsForConvenienceMethods = 'nearestTo' | 'leftOf' | 'above' | 'rightOf' | 'below' | 'contains';
|
|
8
|
+
export type TextMatchingOption = 'similar' | 'exact' | 'regex';
|
|
9
|
+
export type ElementExistsQueryType = 'otherElement' | 'switch' | 'element' | 'container' | 'checkbox' | 'element' | 'button' | 'table' | 'text' | 'icon' | 'image' | 'textfield';
|
|
10
10
|
export interface ElementExistsQueryText {
|
|
11
11
|
value: string;
|
|
12
12
|
matching?: TextMatchingOption;
|
|
@@ -25,8 +25,8 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
25
25
|
this.stepReporter = stepReporter;
|
|
26
26
|
this.secretText = undefined;
|
|
27
27
|
}
|
|
28
|
-
static build(
|
|
29
|
-
return __awaiter(this,
|
|
28
|
+
static build() {
|
|
29
|
+
return __awaiter(this, arguments, void 0, function* (clientArgs = {}) {
|
|
30
30
|
const builder = ui_control_client_dependency_builder_1.UiControlClientDependencyBuilder;
|
|
31
31
|
const clientArgsWithDefaults = yield builder.getClientArgsWithDefaults(clientArgs);
|
|
32
32
|
const { workspaceId, executionRuntime, stepReporter, } = yield builder.build(clientArgsWithDefaults);
|
|
@@ -75,8 +75,8 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
75
75
|
|| (this.stepReporter.config.withDetectedElements === 'always');
|
|
76
76
|
}
|
|
77
77
|
afterCommandExecution(instruction, error) {
|
|
78
|
-
var _a;
|
|
79
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
var _a;
|
|
80
80
|
const createdAt = new Date();
|
|
81
81
|
let annotation;
|
|
82
82
|
let screenshot;
|
|
@@ -93,8 +93,8 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
93
93
|
}, error);
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
annotate(
|
|
97
|
-
return __awaiter(this,
|
|
96
|
+
annotate() {
|
|
97
|
+
return __awaiter(this, arguments, void 0, function* (annotationRequest = {}) {
|
|
98
98
|
const annotation = yield this.executionRuntime.annotateImage(annotationRequest.imagePath, annotationRequest.customElements, annotationRequest.elements);
|
|
99
99
|
annotation_writer_1.AnnotationWriter.write(annotation.toHtml(), annotationRequest.outputPath, annotationRequest.fileNamePrefix);
|
|
100
100
|
return annotation;
|
|
@@ -114,8 +114,8 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
114
114
|
escapeSeparatorString(instruction) {
|
|
115
115
|
return instruction.split(dsl_1.Separators.STRING).join('"');
|
|
116
116
|
}
|
|
117
|
-
buildInstruction(
|
|
118
|
-
return __awaiter(this,
|
|
117
|
+
buildInstruction(instructionString_1) {
|
|
118
|
+
return __awaiter(this, arguments, void 0, function* (instructionString, customElementJson = []) {
|
|
119
119
|
return {
|
|
120
120
|
customElements: yield custom_element_1.CustomElement.fromJsonListWithImagePathOrImage(customElementJson),
|
|
121
121
|
secretText: this.getAndResetSecretText(),
|
|
@@ -134,8 +134,8 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
134
134
|
return workspaceAIElementCollection.getByNames(names);
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
fluentCommandExecutor(
|
|
138
|
-
return __awaiter(this,
|
|
137
|
+
fluentCommandExecutor(instructionString_1) {
|
|
138
|
+
return __awaiter(this, arguments, void 0, function* (instructionString, context = { customElementsJson: [], aiElementNames: [] }) {
|
|
139
139
|
const aiElements = yield this.getAIElementsByNames(context.aiElementNames);
|
|
140
140
|
const instruction = yield this.buildInstruction(instructionString, [
|
|
141
141
|
...context.customElementsJson,
|
|
@@ -154,8 +154,8 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
getterExecutor(
|
|
158
|
-
return __awaiter(this,
|
|
157
|
+
getterExecutor(instruction_1) {
|
|
158
|
+
return __awaiter(this, arguments, void 0, function* (instruction, context = { customElementsJson: [], aiElementNames: [] }) {
|
|
159
159
|
const aiElements = yield this.getAIElementsByNames(context.aiElementNames);
|
|
160
160
|
const customElements = yield custom_element_1.CustomElement.fromJsonListWithImagePathOrImage(context.customElementsJson);
|
|
161
161
|
const stringWithoutSeparators = this.escapeSeparatorString(instruction);
|
|
@@ -284,6 +284,9 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
284
284
|
* @return {FluentFilters}
|
|
285
285
|
*/
|
|
286
286
|
typeIn(text, { isSecret = false, secretMask = '****' } = {}) {
|
|
287
|
+
if (text.length === 0) {
|
|
288
|
+
throw new yup_1.ValidationError('Empty string is not allowed. Typing of an empty string was rejected.');
|
|
289
|
+
}
|
|
287
290
|
if (isSecret) {
|
|
288
291
|
this.secretText = text;
|
|
289
292
|
return super.typeIn(secretMask);
|
|
@@ -309,6 +312,9 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
309
312
|
* @return {Exec}
|
|
310
313
|
*/
|
|
311
314
|
type(text, { isSecret = false, secretMask = '****' } = {}) {
|
|
315
|
+
if (text.length === 0) {
|
|
316
|
+
throw new yup_1.ValidationError('Empty string is not allowed. Typing of an empty string was rejected.');
|
|
317
|
+
}
|
|
312
318
|
if (isSecret) {
|
|
313
319
|
this.secretText = text;
|
|
314
320
|
return super.type(secretMask);
|
|
@@ -339,8 +345,8 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
339
345
|
*
|
|
340
346
|
* @param {number} times
|
|
341
347
|
*/
|
|
342
|
-
pressKeyNTimes(
|
|
343
|
-
return __awaiter(this,
|
|
348
|
+
pressKeyNTimes(key_1) {
|
|
349
|
+
return __awaiter(this, arguments, void 0, function* (key, times = 2) {
|
|
344
350
|
/* eslint-disable no-await-in-loop */
|
|
345
351
|
for (let i = 0; i < times; i += 1) {
|
|
346
352
|
yield this.pressKey(key).exec();
|
|
@@ -426,8 +432,8 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
426
432
|
* @param {number} maxTry - Number of maximum retries
|
|
427
433
|
* @param {number} waitTime - Time in milliseconds
|
|
428
434
|
*/
|
|
429
|
-
waitUntil(
|
|
430
|
-
return __awaiter(this,
|
|
435
|
+
waitUntil(AskUICommand_1) {
|
|
436
|
+
return __awaiter(this, arguments, void 0, function* (AskUICommand, maxTry = 5, waitTime = 2000) {
|
|
431
437
|
try {
|
|
432
438
|
yield AskUICommand.exec();
|
|
433
439
|
}
|
|
@@ -7,4 +7,4 @@ var UiControllerClientConnectionState;
|
|
|
7
7
|
UiControllerClientConnectionState[UiControllerClientConnectionState["CONNECTING"] = 1] = "CONNECTING";
|
|
8
8
|
UiControllerClientConnectionState[UiControllerClientConnectionState["CONNECTED"] = 2] = "CONNECTED";
|
|
9
9
|
UiControllerClientConnectionState[UiControllerClientConnectionState["ERROR"] = 3] = "ERROR";
|
|
10
|
-
})(UiControllerClientConnectionState
|
|
10
|
+
})(UiControllerClientConnectionState || (exports.UiControllerClientConnectionState = UiControllerClientConnectionState = {}));
|
|
@@ -3,6 +3,7 @@ import { ProxyAgentArgs } from '../shared/proxy-agent-args';
|
|
|
3
3
|
import { ModelCompositionBranch } from './model-composition-branch';
|
|
4
4
|
import { Reporter } from '../core/reporting';
|
|
5
5
|
import { Context } from './context';
|
|
6
|
+
import { RetryStrategy } from './retry-strategies/retry-strategy';
|
|
6
7
|
/**
|
|
7
8
|
* Context object to provide additional information about the context of (test) automation.
|
|
8
9
|
*
|
|
@@ -43,6 +44,9 @@ export interface ContextArgs {
|
|
|
43
44
|
* @property {(Context | undefined)} [context] - Optional. Context object to provide additional
|
|
44
45
|
* information about the context of (test) automation, e.g., to allow for optimizations based on
|
|
45
46
|
* the environment, e.g., CI/CD.
|
|
47
|
+
* @property {(RetryStrategy | undefined)} [retryStrategy] - Default: `new LinearRetryStrategy()`.
|
|
48
|
+
* Strategy for retrying failed requests to the inference server. This can help manage transient
|
|
49
|
+
* errors or network issues, improving the reliability of interactions with the server.
|
|
46
50
|
*/
|
|
47
51
|
export interface ClientArgs {
|
|
48
52
|
readonly uiControllerUrl?: string;
|
|
@@ -54,10 +58,12 @@ export interface ClientArgs {
|
|
|
54
58
|
readonly reporter?: Reporter | Reporter[] | undefined;
|
|
55
59
|
readonly context?: ContextArgs | undefined;
|
|
56
60
|
readonly inferenceServerApiVersion?: string;
|
|
61
|
+
readonly retryStrategy?: RetryStrategy;
|
|
57
62
|
}
|
|
58
63
|
export interface ClientArgsWithDefaults extends ClientArgs {
|
|
59
64
|
readonly uiControllerUrl: string;
|
|
60
65
|
readonly inferenceServerUrl: string;
|
|
61
66
|
readonly context: Context;
|
|
62
67
|
readonly inferenceServerApiVersion: string;
|
|
68
|
+
readonly retryStrategy?: RetryStrategy;
|
|
63
69
|
}
|
|
@@ -26,7 +26,8 @@ class UiControllerClient {
|
|
|
26
26
|
clearTimeout(this.timeout);
|
|
27
27
|
const response = JSON.parse(data.toString());
|
|
28
28
|
if (response.data.error) {
|
|
29
|
-
|
|
29
|
+
logger_1.logger.error(response.data.error);
|
|
30
|
+
this.currentReject(new ui_controller_client_error_1.UiControllerClientError(response.data.error));
|
|
30
31
|
this.clearResponse();
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
@@ -12,7 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.platform = platform;
|
|
16
|
+
exports.getBinaryFilePath = getBinaryFilePath;
|
|
17
|
+
exports.downloadServerBinaries = downloadServerBinaries;
|
|
16
18
|
const fs_1 = __importDefault(require("fs"));
|
|
17
19
|
const got_1 = __importDefault(require("got"));
|
|
18
20
|
const os_1 = __importDefault(require("os"));
|
|
@@ -42,7 +44,6 @@ function platform() {
|
|
|
42
44
|
}
|
|
43
45
|
throw new Error(`Platform "${pf}" is not supported.`);
|
|
44
46
|
}
|
|
45
|
-
exports.platform = platform;
|
|
46
47
|
function buildBinaryNotAvailableError(binaryVersion) {
|
|
47
48
|
return new Error(`There was an error during downloading and creating the askui UI Controller. You can try a fresh install.
|
|
48
49
|
If you specified a binary version it is possible that the askui UI Controller version "${binaryVersion}"
|
|
@@ -52,7 +53,6 @@ function buildBinaryNotAvailableError(binaryVersion) {
|
|
|
52
53
|
function getBinaryFilePath(version) {
|
|
53
54
|
return path_1.default.join((0, path_2.getPathToNodeModulesRoot)(), 'release', version, ...binarySubPathsByPlatform[platform()]);
|
|
54
55
|
}
|
|
55
|
-
exports.getBinaryFilePath = getBinaryFilePath;
|
|
56
56
|
function getBinaryDownloadUrl(binaryVersion) {
|
|
57
57
|
const baseUrl = `https://files.askui.com/releases/askui-ui-controller/${binaryVersion}`;
|
|
58
58
|
const arch = os_1.default.arch();
|
|
@@ -86,4 +86,3 @@ function downloadServerBinaries(binaryVersion, proxyAgent) {
|
|
|
86
86
|
return Promise.resolve();
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
exports.downloadServerBinaries = downloadServerBinaries;
|
|
@@ -12,7 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.addScript = addScript;
|
|
16
|
+
exports.removeScript = removeScript;
|
|
16
17
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
18
|
const logger_1 = require("../logger");
|
|
18
19
|
function addScript(filePath, name, command) {
|
|
@@ -35,7 +36,6 @@ function addScript(filePath, name, command) {
|
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
|
-
exports.addScript = addScript;
|
|
39
39
|
function removeScript(filePath, name) {
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
41
|
try {
|
|
@@ -54,4 +54,3 @@ function removeScript(filePath, name) {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
exports.removeScript = removeScript;
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.init =
|
|
15
|
+
exports.init = init;
|
|
16
16
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
17
17
|
const commander_1 = require("commander");
|
|
18
18
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
@@ -85,4 +85,3 @@ function init(argv) {
|
|
|
85
85
|
}));
|
|
86
86
|
return program.parse(args);
|
|
87
87
|
}
|
|
88
|
-
exports.init = init;
|
package/dist/cjs/lib/logger.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const logger: import("pino").Logger<"verbose">;
|
|
1
|
+
declare const logger: import("pino").Logger<"verbose", boolean>;
|
|
2
2
|
export { logger };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createArgsWithDefaults = createArgsWithDefaults;
|
|
4
|
+
exports.createCliFlagsFromArgs = createCliFlagsFromArgs;
|
|
4
5
|
function createArgsWithDefaults(args) {
|
|
5
6
|
const defaults = {
|
|
6
7
|
actionDelayInMs: 1000,
|
|
@@ -14,7 +15,6 @@ function createArgsWithDefaults(args) {
|
|
|
14
15
|
};
|
|
15
16
|
return Object.assign(defaults, args);
|
|
16
17
|
}
|
|
17
|
-
exports.createArgsWithDefaults = createArgsWithDefaults;
|
|
18
18
|
function createCliFlagsFromArgs(args) {
|
|
19
19
|
return [
|
|
20
20
|
`-d ${args.display.toString()}`,
|
|
@@ -26,4 +26,3 @@ function createCliFlagsFromArgs(args) {
|
|
|
26
26
|
(args === null || args === void 0 ? void 0 : args.logFilePath) ? `--log-file ${args.logFilePath}` : '',
|
|
27
27
|
].filter((arg) => !!arg);
|
|
28
28
|
}
|
|
29
|
-
exports.createCliFlagsFromArgs = createCliFlagsFromArgs;
|
|
@@ -92,8 +92,8 @@ class UiControllerFacade {
|
|
|
92
92
|
output: (process === null || process === void 0 ? void 0 : process.env['LOG_LEVEL']) === 'verbose' ? 'dots' : 'silent',
|
|
93
93
|
port: args.port,
|
|
94
94
|
timeout: timeoutInMs,
|
|
95
|
-
}).then((
|
|
96
|
-
if (open) {
|
|
95
|
+
}).then((returnObject) => {
|
|
96
|
+
if (returnObject.open) {
|
|
97
97
|
logger_1.logger.info('The Control UI Server has been started.');
|
|
98
98
|
return resolve();
|
|
99
99
|
}
|
|
@@ -105,8 +105,8 @@ class UiControllerFacade {
|
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
-
getBinary(
|
|
109
|
-
return __awaiter(this,
|
|
108
|
+
getBinary(binaryVersion_1) {
|
|
109
|
+
return __awaiter(this, arguments, void 0, function* (binaryVersion, overWriteBinary = false, proxyAgent) {
|
|
110
110
|
if (!fs_extra_1.default.existsSync(this.binaryFilePath) || overWriteBinary) {
|
|
111
111
|
logger_1.logger.debug(`Currently, no binary of the UI Controller is available at "${this.binaryFilePath}"`);
|
|
112
112
|
yield (0, download_binaries_1.downloadServerBinaries)(binaryVersion, proxyAgent);
|
package/dist/cjs/main.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -28,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
28
32
|
});
|
|
29
33
|
};
|
|
30
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.getSharpFactory =
|
|
35
|
+
exports.getSharpFactory = getSharpFactory;
|
|
32
36
|
let lazilyInitializedSharpFactory;
|
|
33
37
|
class SharpImportError extends Error {
|
|
34
38
|
}
|
|
@@ -53,4 +57,3 @@ function getSharpFactory() {
|
|
|
53
57
|
return lazilyInitializedSharpFactory;
|
|
54
58
|
});
|
|
55
59
|
}
|
|
56
|
-
exports.getSharpFactory = getSharpFactory;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.GeneralHttpClientError = void 0;
|
|
4
|
+
exports.httpClientErrorHandler = httpClientErrorHandler;
|
|
4
5
|
const server_http_client_error_1 = require("./server-http-client-error");
|
|
5
6
|
const authentication_http_client_error_1 = require("./authentication-http-client-error");
|
|
6
7
|
const client_http_client_error_1 = require("./client-http-client-error");
|
|
@@ -20,4 +21,3 @@ function httpClientErrorHandler(responseCode, errorMessage) {
|
|
|
20
21
|
}
|
|
21
22
|
return new unkown_http_client_error_1.UnkownHttpClientError(diplayedMessage);
|
|
22
23
|
}
|
|
23
|
-
exports.httpClientErrorHandler = httpClientErrorHandler;
|
|
@@ -133,8 +133,8 @@ class HttpClientGot {
|
|
|
133
133
|
return { body, headers };
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
get(
|
|
137
|
-
return __awaiter(this,
|
|
136
|
+
get(url_1) {
|
|
137
|
+
return __awaiter(this, arguments, void 0, function* (url, options = { responseType: 'json' }) {
|
|
138
138
|
const response = yield this.askuiGot.get(url, this.injectHeadersAndCookies(url, options));
|
|
139
139
|
return response.body;
|
|
140
140
|
});
|
package/dist/cjs/utils/path.js
CHANGED
|
@@ -3,9 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getPathToNodeModulesRoot =
|
|
6
|
+
exports.getPathToNodeModulesRoot = getPathToNodeModulesRoot;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
function getPathToNodeModulesRoot() {
|
|
9
9
|
return path_1.default.join(__dirname, '..', '..');
|
|
10
10
|
}
|
|
11
|
-
exports.getPathToNodeModulesRoot = getPathToNodeModulesRoot;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -28,7 +32,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
28
32
|
});
|
|
29
33
|
};
|
|
30
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.
|
|
35
|
+
exports.ProxyImportError = void 0;
|
|
36
|
+
exports.envProxyAgents = envProxyAgents;
|
|
32
37
|
const logger_1 = require("../../lib/logger");
|
|
33
38
|
class ProxyImportError extends Error {
|
|
34
39
|
}
|
|
@@ -66,4 +71,3 @@ function envProxyAgents() {
|
|
|
66
71
|
};
|
|
67
72
|
});
|
|
68
73
|
}
|
|
69
|
-
exports.envProxyAgents = envProxyAgents;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.resizeBase64ImageWithSameRatio =
|
|
12
|
+
exports.resizeBase64ImageWithSameRatio = resizeBase64ImageWithSameRatio;
|
|
13
13
|
const lib_1 = require("../lib");
|
|
14
14
|
const base_64_image_1 = require("./base_64_image/base-64-image");
|
|
15
15
|
const image_resize_errors_1 = require("./image-resize-errors");
|
|
@@ -23,8 +23,8 @@ const image_resize_errors_1 = require("./image-resize-errors");
|
|
|
23
23
|
* @returns {Promise<ResizedImage>} ResiziedImage Interface,
|
|
24
24
|
* the true pixel values = controlui-api response * resizeRatio.
|
|
25
25
|
*/
|
|
26
|
-
function resizeBase64ImageWithSameRatio(
|
|
27
|
-
return __awaiter(this,
|
|
26
|
+
function resizeBase64ImageWithSameRatio(base64ImageString_1) {
|
|
27
|
+
return __awaiter(this, arguments, void 0, function* (base64ImageString, maxEdge = 1400) {
|
|
28
28
|
lib_1.logger.debug('Image resizing');
|
|
29
29
|
try {
|
|
30
30
|
const image = yield base_64_image_1.Base64Image.fromString(base64ImageString);
|
|
@@ -44,4 +44,3 @@ function resizeBase64ImageWithSameRatio(base64ImageString, maxEdge = 1400) {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
exports.resizeBase64ImageWithSameRatio = resizeBase64ImageWithSameRatio;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ModelType = 'DETECTED_ELEMENTS' | 'COMMANDS';
|
|
@@ -5,16 +5,16 @@ export declare class CustomElement implements CustomElementJson {
|
|
|
5
5
|
threshold?: number | undefined;
|
|
6
6
|
stopThreshold?: number | undefined;
|
|
7
7
|
rotationDegreePerStep?: number | undefined;
|
|
8
|
-
imageCompareFormat?: "RGB" | "grayscale" | "edges" | undefined;
|
|
9
|
-
mask?: {
|
|
8
|
+
imageCompareFormat?: ("RGB" | "grayscale" | "edges") | undefined;
|
|
9
|
+
mask?: ({
|
|
10
10
|
x: number;
|
|
11
11
|
y: number;
|
|
12
|
-
}[] | undefined;
|
|
12
|
+
})[] | undefined;
|
|
13
13
|
private static schema;
|
|
14
|
-
constructor(customImage: string, name?: string | undefined, threshold?: number | undefined, stopThreshold?: number | undefined, rotationDegreePerStep?: number | undefined, imageCompareFormat?: "RGB" | "grayscale" | "edges" | undefined, mask?: {
|
|
14
|
+
constructor(customImage: string, name?: string | undefined, threshold?: number | undefined, stopThreshold?: number | undefined, rotationDegreePerStep?: number | undefined, imageCompareFormat?: ("RGB" | "grayscale" | "edges") | undefined, mask?: ({
|
|
15
15
|
x: number;
|
|
16
16
|
y: number;
|
|
17
|
-
}[] | undefined);
|
|
17
|
+
})[] | undefined);
|
|
18
18
|
static fromJsonListWithImagePathOrImage(ceJson?: CustomElementJson[]): Promise<CustomElement[]>;
|
|
19
19
|
static fromJsonWithImagePathOrImage(ceJson: CustomElementJson): Promise<CustomElement>;
|
|
20
20
|
static fromJson(ceJson: CustomElementJson): CustomElement;
|
|
@@ -19,8 +19,8 @@ export class CustomElement {
|
|
|
19
19
|
this.imageCompareFormat = imageCompareFormat;
|
|
20
20
|
this.mask = mask;
|
|
21
21
|
}
|
|
22
|
-
static fromJsonListWithImagePathOrImage(
|
|
23
|
-
return __awaiter(this,
|
|
22
|
+
static fromJsonListWithImagePathOrImage() {
|
|
23
|
+
return __awaiter(this, arguments, void 0, function* (ceJson = []) {
|
|
24
24
|
return Promise.all(ceJson.map((customElement) => CustomElement.fromJsonWithImagePathOrImage(customElement)));
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type StepStatusEnd = 'passed' | 'failed' | 'erroneous';
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
* e.g., the user has no usage left, response of inference backend cannot be processed,
|
|
11
11
|
* e.g., because lib version is outdated, etc. (currently not supported, everything "failed")
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type StepStatus = 'passed' | 'failed' | 'pending' | 'running' | 'erroneous';
|
|
@@ -3,12 +3,12 @@ import { DetectedElement } from '../core/model/annotation-result/detected-elemen
|
|
|
3
3
|
export declare enum Separators {
|
|
4
4
|
STRING = "<|string|>"
|
|
5
5
|
}
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
6
|
+
export type INTERSECTION_AREA = 'element_center_line' | 'element_edge_area' | 'display_edge_area';
|
|
7
|
+
export type PC_KEY = 'backspace' | 'delete' | 'enter' | 'tab' | 'escape' | 'up' | 'down' | 'right' | 'left' | 'home' | 'end' | 'pageup' | 'pagedown' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'space' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '!' | '"' | '#' | '$' | '%' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~ ';
|
|
8
|
+
export type ANDROID_KEY = 'home' | 'back' | 'call' | 'endcall' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'star' | 'pound' | 'dpad_up' | 'dpad_down' | 'dpad_left' | 'dpad_right' | 'dpad_center' | 'volume_up' | 'volume_down' | 'power' | 'camera' | 'clear' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'comma' | 'period' | 'alt_left' | 'alt_right' | 'shift_left' | 'shift_right' | 'tab' | 'space' | 'sym' | 'explorer' | 'envelope' | 'enter' | 'del' | 'grave' | 'minus' | 'equals' | 'left_bracket' | 'right_bracket' | 'backslash' | 'semicolon' | 'apostrophe' | 'slash' | 'at' | 'num' | 'headsethook' | 'focus' | 'plus' | 'menu' | 'notification' | 'search' | 'media_play_pause' | 'media_stop' | 'media_next' | 'media_previous' | 'media_rewind' | 'media_fast_forward' | 'mute' | 'page_up' | 'page_down' | 'switch_charset' | 'escape' | 'forward_del' | 'ctrl_left' | 'ctrl_right' | 'caps_lock' | 'scroll_lock' | 'function' | 'break' | 'move_home' | 'move_end' | 'insert' | 'forward' | 'media_play' | 'media_pause' | 'media_close' | 'media_eject' | 'media_record' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'num_lock' | 'numpad_0' | 'numpad_1' | 'numpad_2' | 'numpad_3' | 'numpad_4' | 'numpad_5' | 'numpad_6' | 'numpad_7' | 'numpad_8' | 'numpad_9' | 'numpad_divide' | 'numpad_multiply' | 'numpad_subtract' | 'numpad_add' | 'numpad_dot' | 'numpad_comma' | 'numpad_enter' | 'numpad_equals' | 'numpad_left_paren' | 'numpad_right_paren' | 'volume_mute' | 'info' | 'channel_up' | 'channel_down' | 'zoom_in' | 'zoom_out' | 'window' | 'guide' | 'bookmark' | 'captions' | 'settings' | 'app_switch' | 'language_switch' | 'contacts' | 'calendar' | 'music' | 'calculator' | 'assist' | 'brightness_down' | 'brightness_up' | 'media_audio_track' | 'sleep' | 'wakeup' | 'pairing' | 'media_top_menu' | 'last_channel' | 'tv_data_service' | 'voice_assist' | 'help' | 'navigate_previous' | 'navigate_next' | 'navigate_in' | 'navigate_out' | 'dpad_up_left' | 'dpad_down_left' | 'dpad_up_right' | 'dpad_down_right' | 'media_skip_forward' | 'media_skip_backward' | 'media_step_forward' | 'media_step_backward' | 'soft_sleep' | 'cut' | 'copy' | 'paste' | 'all_apps' | 'refresh';
|
|
9
|
+
export type MODIFIER_KEY = 'command' | 'alt' | 'control' | 'shift' | 'right_shift';
|
|
10
|
+
export type COLOR = 'black' | 'white' | 'red' | 'green' | 'yellow green' | 'orange' | 'yellow' | 'purple' | 'pink' | 'gray' | 'lime green' | 'royal blue';
|
|
11
|
+
export type PC_AND_MODIFIER_KEY = 'command' | 'alt' | 'control' | 'shift' | 'right_shift' | 'backspace' | 'delete' | 'enter' | 'tab' | 'escape' | 'up' | 'down' | 'right' | 'left' | 'home' | 'end' | 'pageup' | 'pagedown' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'space' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '!' | '"' | '#' | '$' | '%' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~ ';
|
|
12
12
|
export interface CommandExecutorContext {
|
|
13
13
|
customElementsJson: CustomElementJson[];
|
|
14
14
|
aiElementNames: string[];
|
|
@@ -5,11 +5,13 @@ import { CustomElementJson } from '../core/model/custom-element-json';
|
|
|
5
5
|
import { DetectedElement } from '../core/model/annotation-result/detected-element';
|
|
6
6
|
import { UiControllerClientConnectionState } from './ui-controller-client-connection-state';
|
|
7
7
|
import { Instruction, StepReporter } from '../core/reporting';
|
|
8
|
+
import { RetryStrategy } from './retry-strategies/retry-strategy';
|
|
8
9
|
export declare class ExecutionRuntime {
|
|
9
10
|
private uiControllerClient;
|
|
10
11
|
private inferenceClient;
|
|
11
12
|
private stepReporter;
|
|
12
|
-
|
|
13
|
+
private retryStrategy;
|
|
14
|
+
constructor(uiControllerClient: UiControllerClient, inferenceClient: InferenceClient, stepReporter: StepReporter, retryStrategy: RetryStrategy);
|
|
13
15
|
connect(): Promise<UiControllerClientConnectionState>;
|
|
14
16
|
disconnect(): void;
|
|
15
17
|
startVideoRecording(): Promise<void>;
|
|
@@ -19,7 +21,6 @@ export declare class ExecutionRuntime {
|
|
|
19
21
|
executeInstruction(instruction: Instruction): Promise<void>;
|
|
20
22
|
private readonly EXEC_REPETITION_COUNT;
|
|
21
23
|
private executeCommandRepeatedly;
|
|
22
|
-
private readonly PREDICT_COMMAND_RETRY_COUNT;
|
|
23
24
|
/**
|
|
24
25
|
* Command prediction may fail, e.g., due to application still loading
|
|
25
26
|
* --> retry with linear back-off
|