askui 0.21.2 → 0.22.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/ai-element/ai-element-collection.d.ts +3 -1
- package/dist/cjs/core/ai-element/ai-element-collection.js +47 -24
- package/dist/cjs/core/ai-element/ai-elements-args.d.ts +20 -0
- package/dist/cjs/core/ai-element/ai-elements-args.js +2 -0
- package/dist/cjs/execution/ui-control-client-dependency-builder.js +7 -4
- package/dist/cjs/execution/ui-control-client.d.ts +1 -0
- package/dist/cjs/execution/ui-control-client.js +4 -3
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +5 -0
- package/dist/esm/core/ai-element/ai-element-collection.d.ts +3 -1
- package/dist/esm/core/ai-element/ai-element-collection.js +47 -24
- package/dist/esm/core/ai-element/ai-elements-args.d.ts +20 -0
- package/dist/esm/core/ai-element/ai-elements-args.js +1 -0
- package/dist/esm/execution/ui-control-client-dependency-builder.js +7 -4
- package/dist/esm/execution/ui-control-client.d.ts +1 -0
- package/dist/esm/execution/ui-control-client.js +4 -3
- package/dist/esm/execution/ui-controller-client-interface.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AIElement } from './ai-element';
|
|
2
2
|
import { CustomElementJson } from '../model/custom-element-json';
|
|
3
|
+
import { AIElementArgs } from './ai-elements-args';
|
|
3
4
|
export declare class AIElementCollection {
|
|
4
5
|
private elements;
|
|
5
6
|
static AI_ELEMENT_FOLDER: string;
|
|
6
7
|
constructor(elements: AIElement[]);
|
|
7
|
-
static
|
|
8
|
+
static collectAIElements(workspaceId: string | undefined, aiElementArgs: AIElementArgs): Promise<AIElementCollection>;
|
|
8
9
|
getByName(name: string): CustomElementJson[];
|
|
9
10
|
getByNames(names: string[]): CustomElementJson[];
|
|
11
|
+
private static CollectAiElementsFromLocation;
|
|
10
12
|
}
|
|
@@ -23,37 +23,37 @@ class AIElementCollection {
|
|
|
23
23
|
constructor(elements) {
|
|
24
24
|
this.elements = elements;
|
|
25
25
|
}
|
|
26
|
-
static
|
|
26
|
+
static collectAIElements(workspaceId, aiElementArgs) {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
|
|
29
|
-
if (workspaceId === undefined) {
|
|
28
|
+
if (!workspaceId) {
|
|
30
29
|
throw new ai_element_error_1.AIElementError("Value of 'workspaceId' must be defined.");
|
|
31
30
|
}
|
|
32
31
|
const workspaceAIElementFolder = path_1.default.join(AIElementCollection.AI_ELEMENT_FOLDER, workspaceId);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
32
|
+
const aiElementsLocations = [
|
|
33
|
+
workspaceAIElementFolder,
|
|
34
|
+
...aiElementArgs.additionalLocations.map((userPath) => path_1.default.resolve(userPath)),
|
|
35
|
+
];
|
|
36
|
+
const aiElements = [];
|
|
37
|
+
yield Promise.all(aiElementsLocations.map((aiElementLocation) => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if (yield fs_extra_1.default.pathExists(aiElementLocation)) {
|
|
39
|
+
aiElements.push(...AIElementCollection.CollectAiElementsFromLocation(aiElementLocation));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const errorMessage = `AIElements location '${aiElementLocation}' does not exist.`;
|
|
43
|
+
if (aiElementArgs.onLocationNotExist === 'error') {
|
|
44
|
+
throw new ai_element_error_1.AIElementError(errorMessage);
|
|
45
|
+
}
|
|
46
|
+
else if (aiElementArgs.onLocationNotExist === 'warn') {
|
|
47
|
+
lib_1.logger.warn(errorMessage);
|
|
48
|
+
}
|
|
49
49
|
}
|
|
50
|
-
return null;
|
|
51
50
|
})));
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
if (aiElements.length === 0) {
|
|
52
|
+
const formattedLocations = aiElementsLocations.map((aiElementsLocation) => `"${aiElementsLocation}"`).join(', ');
|
|
53
|
+
const errorMessage = `No AIElements found in the following location${aiElementsLocations.length > 1 ? 's' : ''}: [${formattedLocations}].`;
|
|
54
|
+
throw new ai_element_error_1.AIElementError(errorMessage);
|
|
55
55
|
}
|
|
56
|
-
return new AIElementCollection(
|
|
56
|
+
return new AIElementCollection(aiElements);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
getByName(name) {
|
|
@@ -73,6 +73,29 @@ class AIElementCollection {
|
|
|
73
73
|
}
|
|
74
74
|
return names.flatMap((name) => this.getByName(name));
|
|
75
75
|
}
|
|
76
|
+
static CollectAiElementsFromLocation(aiElementLocation) {
|
|
77
|
+
const files = fs_extra_1.default.readdirSync(aiElementLocation);
|
|
78
|
+
if (files.length === 0) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
const aiElements = files
|
|
82
|
+
.filter((file) => path_1.default.extname(file) === '.json')
|
|
83
|
+
.map((file) => {
|
|
84
|
+
const jsonFile = path_1.default.join(aiElementLocation, file);
|
|
85
|
+
const baseName = path_1.default.basename(jsonFile, '.json');
|
|
86
|
+
const pngFile = path_1.default.join(aiElementLocation, `${baseName}.png`);
|
|
87
|
+
if (fs_extra_1.default.existsSync(pngFile)) {
|
|
88
|
+
const metadata = JSON.parse(fs_extra_1.default.readFileSync(jsonFile, 'utf-8'));
|
|
89
|
+
return ai_element_1.AIElement.fromJson(metadata, pngFile);
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
});
|
|
93
|
+
const validAIElements = aiElements.filter((element) => element !== null);
|
|
94
|
+
if (validAIElements.length === 0) {
|
|
95
|
+
lib_1.logger.debug(`No valid AIElements found in '${aiElementLocation}'.`);
|
|
96
|
+
}
|
|
97
|
+
return validAIElements;
|
|
98
|
+
}
|
|
76
99
|
}
|
|
77
100
|
exports.AIElementCollection = AIElementCollection;
|
|
78
101
|
AIElementCollection.AI_ELEMENT_FOLDER = path_1.default.join(os_1.default.homedir(), '.askui', 'SnippingTool', 'AIElement');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for configuring how AI elements are collected.
|
|
3
|
+
*
|
|
4
|
+
* @interface AIElementArgs
|
|
5
|
+
*
|
|
6
|
+
* @property {string[]} additionalLocations - Additional directories to search for AI elements.
|
|
7
|
+
* These directories will be checked for the presence of AI element files.
|
|
8
|
+
*
|
|
9
|
+
* @property {'Warn' | 'Error' | 'Ignore'} onLocationNotExist - Action to take when
|
|
10
|
+
* one or more specified directories do not exist.
|
|
11
|
+
* - `'warn'` → Logs a warning if a directory is missing.
|
|
12
|
+
* - `'error'` → Throws an error if a directory is missing.
|
|
13
|
+
* - `'igone'` → Skips missing directories without logging anything.
|
|
14
|
+
* This action is triggered when specified directories do not exist,
|
|
15
|
+
* not when AI elements within those directories are missing.
|
|
16
|
+
*/
|
|
17
|
+
export interface AIElementArgs {
|
|
18
|
+
additionalLocations: string[];
|
|
19
|
+
onLocationNotExist?: 'warn' | 'error' | 'ignore';
|
|
20
|
+
}
|
|
@@ -59,10 +59,13 @@ class UiControlClientDependencyBuilder {
|
|
|
59
59
|
}
|
|
60
60
|
static getClientArgsWithDefaults(clientArgs) {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
var _a, _b, _c, _d, _e, _f;
|
|
63
|
-
return Object.assign(Object.assign({}, clientArgs), {
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
63
|
+
return Object.assign(Object.assign({}, clientArgs), { aiElementArgs: {
|
|
64
|
+
additionalLocations: (_b = (_a = clientArgs.aiElementArgs) === null || _a === void 0 ? void 0 : _a.additionalLocations) !== null && _b !== void 0 ? _b : [],
|
|
65
|
+
onLocationNotExist: (_d = (_c = clientArgs.aiElementArgs) === null || _c === void 0 ? void 0 : _c.onLocationNotExist) !== null && _d !== void 0 ? _d : 'error',
|
|
66
|
+
}, context: {
|
|
67
|
+
isCi: (_f = (_e = clientArgs.context) === null || _e === void 0 ? void 0 : _e.isCi) !== null && _f !== void 0 ? _f : is_ci_1.default,
|
|
68
|
+
}, credentials: (0, read_credentials_1.readCredentials)(clientArgs), inferenceServerApiVersion: (_g = clientArgs.inferenceServerApiVersion) !== null && _g !== void 0 ? _g : 'v3', inferenceServerUrl: (_h = clientArgs.inferenceServerUrl) !== null && _h !== void 0 ? _h : 'https://inference.askui.com', proxyAgents: (_j = clientArgs.proxyAgents) !== null && _j !== void 0 ? _j : (yield (0, proxy_builder_1.envProxyAgents)()), uiControllerUrl: (_k = clientArgs.uiControllerUrl) !== null && _k !== void 0 ? _k : 'http://127.0.0.1:6769' });
|
|
66
69
|
});
|
|
67
70
|
}
|
|
68
71
|
}
|
|
@@ -32,6 +32,7 @@ export declare class UiControlClient extends ApiCommands {
|
|
|
32
32
|
private workspaceId;
|
|
33
33
|
private executionRuntime;
|
|
34
34
|
private stepReporter;
|
|
35
|
+
private aiElementArgs;
|
|
35
36
|
private constructor();
|
|
36
37
|
static build(clientArgs?: ClientArgs): Promise<UiControlClient>;
|
|
37
38
|
/**
|
|
@@ -18,11 +18,12 @@ const logger_1 = require("../lib/logger");
|
|
|
18
18
|
const ui_control_client_dependency_builder_1 = require("./ui-control-client-dependency-builder");
|
|
19
19
|
const ai_element_collection_1 = require("../core/ai-element/ai-element-collection");
|
|
20
20
|
class UiControlClient extends dsl_1.ApiCommands {
|
|
21
|
-
constructor(workspaceId, executionRuntime, stepReporter) {
|
|
21
|
+
constructor(workspaceId, executionRuntime, stepReporter, aiElementArgs) {
|
|
22
22
|
super();
|
|
23
23
|
this.workspaceId = workspaceId;
|
|
24
24
|
this.executionRuntime = executionRuntime;
|
|
25
25
|
this.stepReporter = stepReporter;
|
|
26
|
+
this.aiElementArgs = aiElementArgs;
|
|
26
27
|
this.secretText = undefined;
|
|
27
28
|
}
|
|
28
29
|
static build() {
|
|
@@ -30,7 +31,7 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
30
31
|
const builder = ui_control_client_dependency_builder_1.UiControlClientDependencyBuilder;
|
|
31
32
|
const clientArgsWithDefaults = yield builder.getClientArgsWithDefaults(clientArgs);
|
|
32
33
|
const { workspaceId, executionRuntime, stepReporter, } = yield builder.build(clientArgsWithDefaults);
|
|
33
|
-
return new UiControlClient(workspaceId, executionRuntime, stepReporter);
|
|
34
|
+
return new UiControlClient(workspaceId, executionRuntime, stepReporter, clientArgsWithDefaults.aiElementArgs);
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
@@ -130,7 +131,7 @@ class UiControlClient extends dsl_1.ApiCommands {
|
|
|
130
131
|
return [];
|
|
131
132
|
}
|
|
132
133
|
// eslint-disable-next-line max-len
|
|
133
|
-
const workspaceAIElementCollection = yield ai_element_collection_1.AIElementCollection.
|
|
134
|
+
const workspaceAIElementCollection = yield ai_element_collection_1.AIElementCollection.collectAIElements(this.workspaceId, this.aiElementArgs);
|
|
134
135
|
return workspaceAIElementCollection.getByNames(names);
|
|
135
136
|
});
|
|
136
137
|
}
|
|
@@ -4,6 +4,7 @@ import { ModelCompositionBranch } from './model-composition-branch';
|
|
|
4
4
|
import { Reporter } from '../core/reporting';
|
|
5
5
|
import { Context } from './context';
|
|
6
6
|
import { RetryStrategy } from './retry-strategies/retry-strategy';
|
|
7
|
+
import { AIElementArgs } from '../core/ai-element/ai-elements-args';
|
|
7
8
|
/**
|
|
8
9
|
* Context object to provide additional information about the context of (test) automation.
|
|
9
10
|
*
|
|
@@ -47,6 +48,8 @@ export interface ContextArgs {
|
|
|
47
48
|
* @property {(RetryStrategy | undefined)} [retryStrategy] - Default: `new LinearRetryStrategy()`.
|
|
48
49
|
* Strategy for retrying failed requests to the inference server. This can help manage transient
|
|
49
50
|
* errors or network issues, improving the reliability of interactions with the server.
|
|
51
|
+
* @property {AIElementArgs} [aiElementArgs] - Options for configuring how AI elements are
|
|
52
|
+
* collected.
|
|
50
53
|
*/
|
|
51
54
|
export interface ClientArgs {
|
|
52
55
|
readonly uiControllerUrl?: string;
|
|
@@ -59,11 +62,13 @@ export interface ClientArgs {
|
|
|
59
62
|
readonly context?: ContextArgs | undefined;
|
|
60
63
|
readonly inferenceServerApiVersion?: string;
|
|
61
64
|
readonly retryStrategy?: RetryStrategy;
|
|
65
|
+
readonly aiElementArgs?: AIElementArgs;
|
|
62
66
|
}
|
|
63
67
|
export interface ClientArgsWithDefaults extends ClientArgs {
|
|
64
68
|
readonly uiControllerUrl: string;
|
|
65
69
|
readonly inferenceServerUrl: string;
|
|
66
70
|
readonly context: Context;
|
|
67
71
|
readonly inferenceServerApiVersion: string;
|
|
72
|
+
readonly aiElementArgs: AIElementArgs;
|
|
68
73
|
readonly retryStrategy?: RetryStrategy;
|
|
69
74
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AIElement } from './ai-element';
|
|
2
2
|
import { CustomElementJson } from '../model/custom-element-json';
|
|
3
|
+
import { AIElementArgs } from './ai-elements-args';
|
|
3
4
|
export declare class AIElementCollection {
|
|
4
5
|
private elements;
|
|
5
6
|
static AI_ELEMENT_FOLDER: string;
|
|
6
7
|
constructor(elements: AIElement[]);
|
|
7
|
-
static
|
|
8
|
+
static collectAIElements(workspaceId: string | undefined, aiElementArgs: AIElementArgs): Promise<AIElementCollection>;
|
|
8
9
|
getByName(name: string): CustomElementJson[];
|
|
9
10
|
getByNames(names: string[]): CustomElementJson[];
|
|
11
|
+
private static CollectAiElementsFromLocation;
|
|
10
12
|
}
|
|
@@ -17,37 +17,37 @@ export class AIElementCollection {
|
|
|
17
17
|
constructor(elements) {
|
|
18
18
|
this.elements = elements;
|
|
19
19
|
}
|
|
20
|
-
static
|
|
20
|
+
static collectAIElements(workspaceId, aiElementArgs) {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
|
|
23
|
-
if (workspaceId === undefined) {
|
|
22
|
+
if (!workspaceId) {
|
|
24
23
|
throw new AIElementError("Value of 'workspaceId' must be defined.");
|
|
25
24
|
}
|
|
26
25
|
const workspaceAIElementFolder = path.join(AIElementCollection.AI_ELEMENT_FOLDER, workspaceId);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
const aiElementsLocations = [
|
|
27
|
+
workspaceAIElementFolder,
|
|
28
|
+
...aiElementArgs.additionalLocations.map((userPath) => path.resolve(userPath)),
|
|
29
|
+
];
|
|
30
|
+
const aiElements = [];
|
|
31
|
+
yield Promise.all(aiElementsLocations.map((aiElementLocation) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
if (yield fs.pathExists(aiElementLocation)) {
|
|
33
|
+
aiElements.push(...AIElementCollection.CollectAiElementsFromLocation(aiElementLocation));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
const errorMessage = `AIElements location '${aiElementLocation}' does not exist.`;
|
|
37
|
+
if (aiElementArgs.onLocationNotExist === 'error') {
|
|
38
|
+
throw new AIElementError(errorMessage);
|
|
39
|
+
}
|
|
40
|
+
else if (aiElementArgs.onLocationNotExist === 'warn') {
|
|
41
|
+
logger.warn(errorMessage);
|
|
42
|
+
}
|
|
43
43
|
}
|
|
44
|
-
return null;
|
|
45
44
|
})));
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
if (aiElements.length === 0) {
|
|
46
|
+
const formattedLocations = aiElementsLocations.map((aiElementsLocation) => `"${aiElementsLocation}"`).join(', ');
|
|
47
|
+
const errorMessage = `No AIElements found in the following location${aiElementsLocations.length > 1 ? 's' : ''}: [${formattedLocations}].`;
|
|
48
|
+
throw new AIElementError(errorMessage);
|
|
49
49
|
}
|
|
50
|
-
return new AIElementCollection(
|
|
50
|
+
return new AIElementCollection(aiElements);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
getByName(name) {
|
|
@@ -67,5 +67,28 @@ export class AIElementCollection {
|
|
|
67
67
|
}
|
|
68
68
|
return names.flatMap((name) => this.getByName(name));
|
|
69
69
|
}
|
|
70
|
+
static CollectAiElementsFromLocation(aiElementLocation) {
|
|
71
|
+
const files = fs.readdirSync(aiElementLocation);
|
|
72
|
+
if (files.length === 0) {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
const aiElements = files
|
|
76
|
+
.filter((file) => path.extname(file) === '.json')
|
|
77
|
+
.map((file) => {
|
|
78
|
+
const jsonFile = path.join(aiElementLocation, file);
|
|
79
|
+
const baseName = path.basename(jsonFile, '.json');
|
|
80
|
+
const pngFile = path.join(aiElementLocation, `${baseName}.png`);
|
|
81
|
+
if (fs.existsSync(pngFile)) {
|
|
82
|
+
const metadata = JSON.parse(fs.readFileSync(jsonFile, 'utf-8'));
|
|
83
|
+
return AIElement.fromJson(metadata, pngFile);
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
});
|
|
87
|
+
const validAIElements = aiElements.filter((element) => element !== null);
|
|
88
|
+
if (validAIElements.length === 0) {
|
|
89
|
+
logger.debug(`No valid AIElements found in '${aiElementLocation}'.`);
|
|
90
|
+
}
|
|
91
|
+
return validAIElements;
|
|
92
|
+
}
|
|
70
93
|
}
|
|
71
94
|
AIElementCollection.AI_ELEMENT_FOLDER = path.join(os.homedir(), '.askui', 'SnippingTool', 'AIElement');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for configuring how AI elements are collected.
|
|
3
|
+
*
|
|
4
|
+
* @interface AIElementArgs
|
|
5
|
+
*
|
|
6
|
+
* @property {string[]} additionalLocations - Additional directories to search for AI elements.
|
|
7
|
+
* These directories will be checked for the presence of AI element files.
|
|
8
|
+
*
|
|
9
|
+
* @property {'Warn' | 'Error' | 'Ignore'} onLocationNotExist - Action to take when
|
|
10
|
+
* one or more specified directories do not exist.
|
|
11
|
+
* - `'warn'` → Logs a warning if a directory is missing.
|
|
12
|
+
* - `'error'` → Throws an error if a directory is missing.
|
|
13
|
+
* - `'igone'` → Skips missing directories without logging anything.
|
|
14
|
+
* This action is triggered when specified directories do not exist,
|
|
15
|
+
* not when AI elements within those directories are missing.
|
|
16
|
+
*/
|
|
17
|
+
export interface AIElementArgs {
|
|
18
|
+
additionalLocations: string[];
|
|
19
|
+
onLocationNotExist?: 'warn' | 'error' | 'ignore';
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -53,10 +53,13 @@ export class UiControlClientDependencyBuilder {
|
|
|
53
53
|
}
|
|
54
54
|
static getClientArgsWithDefaults(clientArgs) {
|
|
55
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
var _a, _b, _c, _d, _e, _f;
|
|
57
|
-
return Object.assign(Object.assign({}, clientArgs), {
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
57
|
+
return Object.assign(Object.assign({}, clientArgs), { aiElementArgs: {
|
|
58
|
+
additionalLocations: (_b = (_a = clientArgs.aiElementArgs) === null || _a === void 0 ? void 0 : _a.additionalLocations) !== null && _b !== void 0 ? _b : [],
|
|
59
|
+
onLocationNotExist: (_d = (_c = clientArgs.aiElementArgs) === null || _c === void 0 ? void 0 : _c.onLocationNotExist) !== null && _d !== void 0 ? _d : 'error',
|
|
60
|
+
}, context: {
|
|
61
|
+
isCi: (_f = (_e = clientArgs.context) === null || _e === void 0 ? void 0 : _e.isCi) !== null && _f !== void 0 ? _f : isCI,
|
|
62
|
+
}, credentials: readCredentials(clientArgs), inferenceServerApiVersion: (_g = clientArgs.inferenceServerApiVersion) !== null && _g !== void 0 ? _g : 'v3', inferenceServerUrl: (_h = clientArgs.inferenceServerUrl) !== null && _h !== void 0 ? _h : 'https://inference.askui.com', proxyAgents: (_j = clientArgs.proxyAgents) !== null && _j !== void 0 ? _j : (yield envProxyAgents()), uiControllerUrl: (_k = clientArgs.uiControllerUrl) !== null && _k !== void 0 ? _k : 'http://127.0.0.1:6769' });
|
|
60
63
|
});
|
|
61
64
|
}
|
|
62
65
|
}
|
|
@@ -32,6 +32,7 @@ export declare class UiControlClient extends ApiCommands {
|
|
|
32
32
|
private workspaceId;
|
|
33
33
|
private executionRuntime;
|
|
34
34
|
private stepReporter;
|
|
35
|
+
private aiElementArgs;
|
|
35
36
|
private constructor();
|
|
36
37
|
static build(clientArgs?: ClientArgs): Promise<UiControlClient>;
|
|
37
38
|
/**
|
|
@@ -15,11 +15,12 @@ import { logger } from '../lib/logger';
|
|
|
15
15
|
import { UiControlClientDependencyBuilder } from './ui-control-client-dependency-builder';
|
|
16
16
|
import { AIElementCollection } from '../core/ai-element/ai-element-collection';
|
|
17
17
|
export class UiControlClient extends ApiCommands {
|
|
18
|
-
constructor(workspaceId, executionRuntime, stepReporter) {
|
|
18
|
+
constructor(workspaceId, executionRuntime, stepReporter, aiElementArgs) {
|
|
19
19
|
super();
|
|
20
20
|
this.workspaceId = workspaceId;
|
|
21
21
|
this.executionRuntime = executionRuntime;
|
|
22
22
|
this.stepReporter = stepReporter;
|
|
23
|
+
this.aiElementArgs = aiElementArgs;
|
|
23
24
|
this.secretText = undefined;
|
|
24
25
|
}
|
|
25
26
|
static build() {
|
|
@@ -27,7 +28,7 @@ export class UiControlClient extends ApiCommands {
|
|
|
27
28
|
const builder = UiControlClientDependencyBuilder;
|
|
28
29
|
const clientArgsWithDefaults = yield builder.getClientArgsWithDefaults(clientArgs);
|
|
29
30
|
const { workspaceId, executionRuntime, stepReporter, } = yield builder.build(clientArgsWithDefaults);
|
|
30
|
-
return new UiControlClient(workspaceId, executionRuntime, stepReporter);
|
|
31
|
+
return new UiControlClient(workspaceId, executionRuntime, stepReporter, clientArgsWithDefaults.aiElementArgs);
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
@@ -127,7 +128,7 @@ export class UiControlClient extends ApiCommands {
|
|
|
127
128
|
return [];
|
|
128
129
|
}
|
|
129
130
|
// eslint-disable-next-line max-len
|
|
130
|
-
const workspaceAIElementCollection = yield AIElementCollection.
|
|
131
|
+
const workspaceAIElementCollection = yield AIElementCollection.collectAIElements(this.workspaceId, this.aiElementArgs);
|
|
131
132
|
return workspaceAIElementCollection.getByNames(names);
|
|
132
133
|
});
|
|
133
134
|
}
|
|
@@ -4,6 +4,7 @@ import { ModelCompositionBranch } from './model-composition-branch';
|
|
|
4
4
|
import { Reporter } from '../core/reporting';
|
|
5
5
|
import { Context } from './context';
|
|
6
6
|
import { RetryStrategy } from './retry-strategies/retry-strategy';
|
|
7
|
+
import { AIElementArgs } from '../core/ai-element/ai-elements-args';
|
|
7
8
|
/**
|
|
8
9
|
* Context object to provide additional information about the context of (test) automation.
|
|
9
10
|
*
|
|
@@ -47,6 +48,8 @@ export interface ContextArgs {
|
|
|
47
48
|
* @property {(RetryStrategy | undefined)} [retryStrategy] - Default: `new LinearRetryStrategy()`.
|
|
48
49
|
* Strategy for retrying failed requests to the inference server. This can help manage transient
|
|
49
50
|
* errors or network issues, improving the reliability of interactions with the server.
|
|
51
|
+
* @property {AIElementArgs} [aiElementArgs] - Options for configuring how AI elements are
|
|
52
|
+
* collected.
|
|
50
53
|
*/
|
|
51
54
|
export interface ClientArgs {
|
|
52
55
|
readonly uiControllerUrl?: string;
|
|
@@ -59,11 +62,13 @@ export interface ClientArgs {
|
|
|
59
62
|
readonly context?: ContextArgs | undefined;
|
|
60
63
|
readonly inferenceServerApiVersion?: string;
|
|
61
64
|
readonly retryStrategy?: RetryStrategy;
|
|
65
|
+
readonly aiElementArgs?: AIElementArgs;
|
|
62
66
|
}
|
|
63
67
|
export interface ClientArgsWithDefaults extends ClientArgs {
|
|
64
68
|
readonly uiControllerUrl: string;
|
|
65
69
|
readonly inferenceServerUrl: string;
|
|
66
70
|
readonly context: Context;
|
|
67
71
|
readonly inferenceServerApiVersion: string;
|
|
72
|
+
readonly aiElementArgs: AIElementArgs;
|
|
68
73
|
readonly retryStrategy?: RetryStrategy;
|
|
69
74
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.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",
|