ff-automationv2 2.2.29 → 2.2.30
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/ai/llmcalls/llmAction.js +49 -13
- package/dist/ai/llmcalls/parseLlmOputput.js +5 -5
- package/dist/ai/llmprompts/promptRegistry.js +4 -0
- package/dist/ai/llmprompts/systemPrompts/actionExtractorPrompt.js +39 -11
- package/dist/ai/llmprompts/systemPrompts/fireflinkElementIndexExtactors.js +6 -6
- package/dist/ai/llmprompts/systemPrompts/fireflinkElementIndexExtractor_Mob.js +32 -0
- package/dist/ai/llmprompts/systemPrompts/mobileKeywordExtractor.js +17 -8
- package/dist/ai/llmprompts/systemPrompts/otpExtractorPrompt.d.ts +1 -0
- package/dist/ai/llmprompts/systemPrompts/otpExtractorPrompt.js +22 -0
- package/dist/ai/llmprompts/systemPrompts/verifyActionExtractorPrompt.js +3 -1
- package/dist/ai/llmprompts/systemPrompts/visionPrompt.js +14 -6
- package/dist/ai/llmprompts/systemPrompts/visionPromptMobile.js +3 -0
- package/dist/ai/llmprompts/userPrompts/userPrompt.js +1 -0
- package/dist/automation/actions/executor.d.ts +4 -0
- package/dist/automation/actions/executor.js +20 -0
- package/dist/automation/actions/interaction/clear/clear.js +1 -1
- package/dist/automation/actions/interaction/clear/clearAndEnter.js +1 -1
- package/dist/automation/actions/interaction/click/click.js +10 -3
- package/dist/automation/actions/interaction/click/clickNtimes.js +1 -1
- package/dist/automation/actions/interaction/click/doubleClick.js +1 -1
- package/dist/automation/actions/interaction/click/rightClick.js +1 -1
- package/dist/automation/actions/interaction/elementlessActions/getOtp.d.ts +2 -0
- package/dist/automation/actions/interaction/elementlessActions/getOtp.js +101 -0
- package/dist/automation/actions/interaction/enterActions/enterInput.js +11 -6
- package/dist/automation/actions/interaction/enterActions/enterInputAndPress.js +2 -2
- package/dist/automation/actions/interaction/enterActions/enterusingJs.js +2 -2
- package/dist/automation/actions/interaction/enterActions/waitAndEnter.js +1 -1
- package/dist/automation/actions/interaction/upload/uploadfile.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyNavigateURL.js +38 -11
- package/dist/automation/actions/interface/FireFlinkResponseSchema.d.ts +12 -0
- package/dist/automation/actions/interface/FireFlinkResponseSchema.js +19 -3
- package/dist/automation/actions/interface/getOtpInterface.d.ts +15 -0
- package/dist/automation/actions/interface/getOtpInterface.js +2 -0
- package/dist/automation/browserSession/initiateBrowserSession.d.ts +1 -1
- package/dist/automation/browserSession/initiateBrowserSession.js +15 -7
- package/dist/automation/driverState.d.ts +2 -0
- package/dist/automation/driverState.js +4 -0
- package/dist/automation/mobileSession/initiateMobileSession.d.ts +4 -5
- package/dist/automation/mobileSession/initiateMobileSession.js +83 -19
- package/dist/core/constants/allAction.js +5 -1
- package/dist/core/constants/supportedActions.js +5 -2
- package/dist/core/interfaces/actionInterface.d.ts +4 -0
- package/dist/core/interfaces/browserConfigurationInterface.d.ts +0 -4
- package/dist/core/interfaces/browserConfigurationInterface.js +0 -1
- package/dist/core/interfaces/executionDetails.d.ts +6 -3
- package/dist/core/interfaces/fireflinkScriptPayloadInterface.d.ts +22 -16
- package/dist/core/interfaces/llmResponseInterface.d.ts +1 -0
- package/dist/core/interfaces/promptInterface.d.ts +1 -0
- package/dist/core/main/SessionManager.d.ts +9 -0
- package/dist/core/main/SessionManager.js +23 -0
- package/dist/core/main/actionHandlerFactory.js +261 -64
- package/dist/core/main/executionContext.d.ts +7 -1
- package/dist/core/main/executionContext.js +93 -3
- package/dist/core/main/runAutomationScript.d.ts +1 -0
- package/dist/core/main/runAutomationScript.js +912 -304
- package/dist/core/main/stepProcessor.js +7 -2
- package/dist/core/types/browserType.d.ts +3 -3
- package/dist/core/types/browserType.js +2 -2
- package/dist/core/types/messageType.d.ts +13 -0
- package/dist/core/types/messageType.js +15 -0
- package/dist/core/types/promptType.d.ts +2 -1
- package/dist/core/types/promptType.js +1 -0
- package/dist/domAnalysis/searchBest.js +15 -16
- package/dist/domAnalysis/simplifyAndFlatten.js +6 -4
- package/dist/fireflinkData/fireflinkLocators/getListOfLocators.d.ts +3 -0
- package/dist/fireflinkData/fireflinkLocators/getListOfLocators.js +23 -15
- package/dist/fireflinkData/fireflinkLocators/parser/getElementsFromHTML.d.ts +3 -3
- package/dist/fireflinkData/fireflinkLocators/parser/getElementsFromHTML.js +134 -118
- package/dist/fireflinkData/fireflinkLocators/types/locator.d.ts +11 -1
- package/dist/fireflinkData/fireflinkLocators/utils/androidSelector.d.ts +1 -1
- package/dist/fireflinkData/fireflinkLocators/utils/androidSelector.js +35 -9
- package/dist/fireflinkData/fireflinkLocators/utils/cssSelector.d.ts +10 -10
- package/dist/fireflinkData/fireflinkLocators/utils/cssSelector.js +56 -59
- package/dist/fireflinkData/fireflinkLocators/utils/iosSelector.d.ts +1 -1
- package/dist/fireflinkData/fireflinkLocators/utils/iosSelector.js +53 -29
- package/dist/fireflinkData/fireflinkLocators/utils/referenceXpath.d.ts +8 -8
- package/dist/fireflinkData/fireflinkLocators/utils/referenceXpath.js +113 -190
- package/dist/fireflinkData/fireflinkLocators/utils/xpath.d.ts +17 -26
- package/dist/fireflinkData/fireflinkLocators/utils/xpath.js +314 -786
- package/dist/fireflinkData/fireflinkLocators/utils/xpathHelpers.d.ts +68 -70
- package/dist/fireflinkData/fireflinkLocators/utils/xpathHelpers.js +498 -517
- package/dist/fireflinkData/fireflinkScript/appendScriptData.d.ts +1 -1
- package/dist/fireflinkData/fireflinkScript/appendScriptData.js +5 -8
- package/dist/fireflinkData/fireflinkScript/scriptGenrationData.d.ts +2 -2
- package/dist/fireflinkData/fireflinkScript/scriptGenrationData.js +17 -27
- package/dist/llmConfig/llmConfiguration.js +13 -6
- package/dist/service/api/fireflinkApi.service.d.ts +1 -1
- package/dist/service/api/fireflinkApi.service.js +1 -2
- package/dist/service/fireflink.service.d.ts +3 -3
- package/dist/service/fireflink.service.js +23 -21
- package/dist/service/kafka/fireflinkKafka.service.d.ts +1 -2
- package/dist/service/kafka/fireflinkKafka.service.js +6 -4
- package/dist/tests/test12.d.ts +0 -1
- package/dist/tests/test12.js +65 -78
- package/dist/tests/testkaf.d.ts +0 -1
- package/dist/tests/testkaf.js +51 -55
- package/dist/utils/InstancesDetails/getInstancesInfo.js +1 -1
- package/dist/utils/browserCap/capability.d.ts +5 -1
- package/dist/utils/browserCap/capability.js +91 -15
- package/dist/utils/helpers/domSanitizer.d.ts +1 -0
- package/dist/utils/helpers/domSanitizer.js +9 -0
- package/dist/utils/helpers/enterActionHelper.js +23 -4
- package/dist/utils/helpers/xpathcreation.js +2 -2
- package/dist/utils/javascript/jsFindElement.d.ts +1 -1
- package/dist/utils/javascript/jsFindElement.js +2 -2
- package/dist/utils/newTab/newTabTracker.js +18 -6
- package/dist/utils/workers/LocatorWorkerInterface.d.ts +22 -0
- package/dist/utils/workers/LocatorWorkerInterface.js +2 -0
- package/dist/utils/workers/LocatorWorkerPool.d.ts +13 -0
- package/dist/utils/workers/LocatorWorkerPool.js +89 -0
- package/dist/utils/workers/locatorWorker.d.ts +1 -0
- package/dist/utils/workers/locatorWorker.js +44 -0
- package/package.json +3 -1
|
@@ -11,8 +11,13 @@ class StepProcessor {
|
|
|
11
11
|
return this.resultParser.getTokenUsage();
|
|
12
12
|
}
|
|
13
13
|
async getLLMResponse({ platform, type, args, input, isVision = false }) {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
try {
|
|
15
|
+
const response = await this.llm.getLLMResponse(platform, type, args, input, isVision);
|
|
16
|
+
return this.resultParser.fetchResult(response);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
throw new Error("failed to get response from llm", { cause: error });
|
|
20
|
+
}
|
|
16
21
|
}
|
|
17
22
|
}
|
|
18
23
|
exports.StepProcessor = StepProcessor;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const browserName: {
|
|
2
2
|
readonly "Microsoft Edge": "edge";
|
|
3
3
|
readonly "Google Chrome": "chrome";
|
|
4
4
|
readonly "Mozilla Firefox": "firefox";
|
|
5
5
|
readonly Safari: "safari";
|
|
6
6
|
};
|
|
7
|
-
export type BrowserName = keyof typeof
|
|
8
|
-
export type BrowserId = typeof
|
|
7
|
+
export type BrowserName = keyof typeof browserName;
|
|
8
|
+
export type BrowserId = typeof browserName[BrowserName];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.browserName = void 0;
|
|
4
|
+
exports.browserName = {
|
|
5
5
|
"Microsoft Edge": "edge",
|
|
6
6
|
"Google Chrome": "chrome",
|
|
7
7
|
"Mozilla Firefox": "firefox",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const MessageType: {
|
|
2
|
+
readonly LiveLog: {
|
|
3
|
+
readonly Ongoing: "liveLogOngoing";
|
|
4
|
+
readonly Completed: "liveLogCompleted";
|
|
5
|
+
readonly Error: "liveLogError";
|
|
6
|
+
readonly Termination: "termination";
|
|
7
|
+
readonly ExecutionStopped: "executionStopped";
|
|
8
|
+
readonly retry: "retry";
|
|
9
|
+
};
|
|
10
|
+
readonly nextBatch: "nextBatch";
|
|
11
|
+
readonly AutomationScriptMetaData: "AutomationScriptMetaData";
|
|
12
|
+
};
|
|
13
|
+
export type MessageType = typeof MessageType[keyof typeof MessageType] | typeof MessageType.LiveLog[keyof typeof MessageType.LiveLog];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageType = void 0;
|
|
4
|
+
exports.MessageType = {
|
|
5
|
+
LiveLog: {
|
|
6
|
+
Ongoing: "liveLogOngoing",
|
|
7
|
+
Completed: "liveLogCompleted",
|
|
8
|
+
Error: "liveLogError",
|
|
9
|
+
Termination: "termination",
|
|
10
|
+
ExecutionStopped: "executionStopped",
|
|
11
|
+
retry: "retry",
|
|
12
|
+
},
|
|
13
|
+
nextBatch: "nextBatch",
|
|
14
|
+
AutomationScriptMetaData: "AutomationScriptMetaData",
|
|
15
|
+
};
|
|
@@ -7,5 +7,6 @@ export declare enum PromptType {
|
|
|
7
7
|
VERIFY_PROMPT = "verifyActionExtractorPrompt",
|
|
8
8
|
GET_PROMPT = "getActionExtractorPrompt",
|
|
9
9
|
WAIT_ACTION_EXTRACTOR_PROMPT = "waitActionExtractorPrompt",
|
|
10
|
-
COMBINED_ACTION_EXTRACTOR_PROMPT = "combinedActionExtractorPrompt"
|
|
10
|
+
COMBINED_ACTION_EXTRACTOR_PROMPT = "combinedActionExtractorPrompt",
|
|
11
|
+
OTP_EXTRACTOR = "otpExtractorPrompt"
|
|
11
12
|
}
|
|
@@ -12,4 +12,5 @@ var PromptType;
|
|
|
12
12
|
PromptType["GET_PROMPT"] = "getActionExtractorPrompt";
|
|
13
13
|
PromptType["WAIT_ACTION_EXTRACTOR_PROMPT"] = "waitActionExtractorPrompt";
|
|
14
14
|
PromptType["COMBINED_ACTION_EXTRACTOR_PROMPT"] = "combinedActionExtractorPrompt";
|
|
15
|
+
PromptType["OTP_EXTRACTOR"] = "otpExtractorPrompt";
|
|
15
16
|
})(PromptType || (exports.PromptType = PromptType = {}));
|
|
@@ -29,7 +29,7 @@ class DomSearcher {
|
|
|
29
29
|
for (const i of [idx - 1, idx, idx + 1]) {
|
|
30
30
|
if (i >= 0 && i < total) {
|
|
31
31
|
if (nodes[i].node["FF-inspecter"]) {
|
|
32
|
-
collected.
|
|
32
|
+
collected.add(i);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -41,7 +41,7 @@ class DomSearcher {
|
|
|
41
41
|
const nx = nodes[j].node["ff-xpath"];
|
|
42
42
|
if (nx && isChild(cx, nx)) {
|
|
43
43
|
if (nodes[j].node["FF-inspecter"]) {
|
|
44
|
-
collected.
|
|
44
|
+
collected.add(j);
|
|
45
45
|
}
|
|
46
46
|
break;
|
|
47
47
|
}
|
|
@@ -50,7 +50,7 @@ class DomSearcher {
|
|
|
50
50
|
const nx = nodes[j].node["ff-xpath"];
|
|
51
51
|
if (nx && isSibling(cx, nx) && j !== idx) {
|
|
52
52
|
if (nodes[j].node["FF-inspecter"]) {
|
|
53
|
-
collected.
|
|
53
|
+
collected.add(j);
|
|
54
54
|
}
|
|
55
55
|
break;
|
|
56
56
|
}
|
|
@@ -70,33 +70,33 @@ class DomSearcher {
|
|
|
70
70
|
if (searchText === kw) {
|
|
71
71
|
exact.push(i);
|
|
72
72
|
}
|
|
73
|
-
if (searchText.includes(kw)) {
|
|
73
|
+
else if (searchText.includes(kw)) {
|
|
74
74
|
strong.push(i);
|
|
75
75
|
}
|
|
76
|
-
if (kw === tagName || tagName.includes(kw)) {
|
|
76
|
+
else if (kw === tagName || tagName.includes(kw)) {
|
|
77
77
|
tagMatches.push(i);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
const collected =
|
|
80
|
+
const collected = new Set();
|
|
81
81
|
for (const idx of exact) {
|
|
82
82
|
addWithContext(idx, collected);
|
|
83
|
-
if (collected.
|
|
83
|
+
if (collected.size >= topN * 4)
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
for (const idx of strong) {
|
|
87
87
|
addWithContext(idx, collected);
|
|
88
|
-
if (collected.
|
|
88
|
+
if (collected.size >= topN * 4)
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
for (const idx of tagMatches) {
|
|
92
92
|
addWithContext(idx, collected);
|
|
93
|
-
if (collected.
|
|
93
|
+
if (collected.size >= topN * 4)
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
|
-
if (collected.
|
|
96
|
+
if (collected.size > 0) {
|
|
97
97
|
hasAnyMatch = true;
|
|
98
98
|
}
|
|
99
|
-
tempResults[kw] = collected;
|
|
99
|
+
tempResults[kw] = Array.from(collected);
|
|
100
100
|
}
|
|
101
101
|
if (!hasAnyMatch) {
|
|
102
102
|
for (const kw of keywords) {
|
|
@@ -129,21 +129,20 @@ class DomSearcher {
|
|
|
129
129
|
fuzzyList.push([score, i]);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
const collected =
|
|
132
|
+
const collected = new Set();
|
|
133
133
|
fuzzyList
|
|
134
134
|
.sort((a, b) => b[0] - a[0])
|
|
135
135
|
.forEach(([_, idx]) => {
|
|
136
|
-
if (collected.
|
|
136
|
+
if (collected.size < topN * 4) {
|
|
137
137
|
addWithContext(idx, collected);
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
|
-
results[kw] = Array.from(
|
|
140
|
+
results[kw] = Array.from(collected).map(i => nodes[i].node);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
144
|
for (const kw of keywords) {
|
|
145
|
-
|
|
146
|
-
results[kw] = uniqueIdx.map(i => nodes[i].node);
|
|
145
|
+
results[kw] = tempResults[kw].map(i => nodes[i].node);
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
148
|
const seen = new Set();
|
|
@@ -70,9 +70,7 @@ class DomSimplifier {
|
|
|
70
70
|
directText += txt;
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
const cleanText = directText
|
|
74
|
-
.replace(/[^a-zA-Z0-9\s]/g, " ")
|
|
75
|
-
.trim();
|
|
73
|
+
const cleanText = directText.trim();
|
|
76
74
|
if (cleanText)
|
|
77
75
|
simplified["text"] = cleanText.slice(0, 200);
|
|
78
76
|
// -----------------
|
|
@@ -94,7 +92,11 @@ class DomSimplifier {
|
|
|
94
92
|
// -----------------
|
|
95
93
|
const parts = new Set();
|
|
96
94
|
if (cleanText && cleanText.length <= 70) {
|
|
97
|
-
parts.add(cleanText.toLowerCase().replace(/\s+/g, ""));
|
|
95
|
+
// parts.add(cleanText.toLowerCase().replace(/\s+/g, ""));
|
|
96
|
+
parts.add(cleanText
|
|
97
|
+
.toLowerCase()
|
|
98
|
+
.replace(/[^a-zA-Z0-9\s]/g, " ")
|
|
99
|
+
.replace(/\s+/g, " "));
|
|
98
100
|
}
|
|
99
101
|
const SEARCH_EXCLUDED = new Set([
|
|
100
102
|
"class", "style", "onclick", "onchange",
|
|
@@ -2,30 +2,38 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ElementGetter = void 0;
|
|
4
4
|
const logData_js_1 = require("../../utils/logger/logData.js");
|
|
5
|
-
|
|
5
|
+
// import { getAiElementsFromHTML } from "./parser/getElementsFromHTML.js";
|
|
6
6
|
const platformContext_js_1 = require("../../utils/helpers/platformContext.js");
|
|
7
7
|
class ElementGetter {
|
|
8
|
+
constructor(workerPool) {
|
|
9
|
+
this.workerPool = workerPool;
|
|
10
|
+
}
|
|
8
11
|
async getFireFlinkElement(html, attribute) {
|
|
9
12
|
const platform = (0, platformContext_js_1.getPlatform)();
|
|
10
|
-
const formattedAttribute = attribute.replace('[', '//*[@');
|
|
13
|
+
// const formattedAttribute = attribute.replace('[', '//*[@');
|
|
11
14
|
try {
|
|
15
|
+
const result = await this.workerPool.getFireFlinkElement(html, attribute, platform);
|
|
12
16
|
// logger.info("formattedAttribute", formattedAttribute);
|
|
13
|
-
const result =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
// const result = await getFireFlinkElement(
|
|
18
|
+
// {
|
|
19
|
+
// locators: [
|
|
20
|
+
// {
|
|
21
|
+
// name: "xpath",
|
|
22
|
+
// type: "Static",
|
|
23
|
+
// value: formattedAttribute,
|
|
24
|
+
// reference: "local",
|
|
25
|
+
// status: "NOT_USED",
|
|
26
|
+
// isRecorded: "N",
|
|
27
|
+
// }
|
|
28
|
+
// ]
|
|
29
|
+
// },
|
|
30
|
+
// html,
|
|
31
|
+
// platform
|
|
32
|
+
// );
|
|
25
33
|
return Array.isArray(result) && result.length > 0 ? JSON.parse(JSON.stringify(result[0], null, 4)) : null;
|
|
26
34
|
}
|
|
27
35
|
catch (error) {
|
|
28
|
-
logData_js_1.logger.info("
|
|
36
|
+
logData_js_1.logger.info("attribute");
|
|
29
37
|
logData_js_1.logger.error(`[${Object.getPrototypeOf(this).constructor.name}] : `, "Unable to find the element", error);
|
|
30
38
|
return "";
|
|
31
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ElementRecord } from "../types/locator.js";
|
|
2
2
|
import { platform } from "../../../core/types/scriptTypesType.js";
|
|
3
|
-
type
|
|
3
|
+
type AiElementDetails = {
|
|
4
4
|
id?: string | null;
|
|
5
5
|
className?: string | null;
|
|
6
6
|
xpathByText?: string | null;
|
|
@@ -14,5 +14,5 @@ type ElementDetails = {
|
|
|
14
14
|
relativeXpath?: string | null;
|
|
15
15
|
[key: string]: any;
|
|
16
16
|
};
|
|
17
|
-
declare const
|
|
18
|
-
export {
|
|
17
|
+
declare const getAiElementsFromHTML: (record: ElementRecord, htmlString: string, platform: platform) => AiElementDetails | null;
|
|
18
|
+
export { getAiElementsFromHTML };
|