@empiricalrun/test-gen 0.42.10 → 0.42.11
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/CHANGELOG.md +6 -0
- package/dist/agent/browsing/index.d.ts.map +1 -1
- package/dist/agent/browsing/index.js +6 -5
- package/dist/agent/browsing/o1-completion.d.ts.map +1 -1
- package/dist/agent/browsing/o1-completion.js +2 -1
- package/dist/agent/master/element-annotation.d.ts.map +1 -1
- package/dist/agent/master/element-annotation.js +6 -2
- package/dist/agent/master/planner.d.ts.map +1 -1
- package/dist/agent/master/planner.js +2 -1
- package/dist/agent/planner/run-time-planner.d.ts.map +1 -1
- package/dist/agent/planner/run-time-planner.js +2 -1
- package/dist/agent/utils.js +1 -1
- package/dist/agent/verification/index.d.ts.map +1 -1
- package/dist/agent/verification/index.js +2 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAOnD,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,GAAG;IACjE,YAAY,CAAC,EAAE;QACb,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF,wBAAsB,6BAA6B,CAAC,EAClD,KAAK,EACL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,OAAO,EACP,GAAG,EACH,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,oBAAoB,CAAC;IAC9B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,iBAAiB,CAAC;CAC5B,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAiJhC"}
|
|
@@ -5,9 +5,10 @@ const constants_1 = require("../../constants");
|
|
|
5
5
|
const reporter_1 = require("../../reporter");
|
|
6
6
|
const session_1 = require("../../session");
|
|
7
7
|
const html_1 = require("../../utils/html");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
8
9
|
const verification_1 = require("../verification");
|
|
9
10
|
const o1_completion_1 = require("./o1-completion");
|
|
10
|
-
const
|
|
11
|
+
const utils_2 = require("./utils");
|
|
11
12
|
async function executeTaskUsingBrowsingAgent({ trace, action, logger, page, options, llm, actions, }) {
|
|
12
13
|
let isTaskDone = false;
|
|
13
14
|
const executedActions = [];
|
|
@@ -61,7 +62,7 @@ async function executeTaskUsingBrowsingAgent({ trace, action, logger, page, opti
|
|
|
61
62
|
break;
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
const messages = await (0,
|
|
65
|
+
const messages = await (0, utils_2.getPromptForNextAction)({
|
|
65
66
|
pageSnapshot,
|
|
66
67
|
previousActions: successfulActions,
|
|
67
68
|
task: action,
|
|
@@ -106,13 +107,13 @@ async function executeTaskUsingBrowsingAgent({ trace, action, logger, page, opti
|
|
|
106
107
|
break;
|
|
107
108
|
}
|
|
108
109
|
try {
|
|
109
|
-
const code = await actions.executeAction(toolCall.function.name,
|
|
110
|
+
const code = await actions.executeAction(toolCall.function.name, (0, utils_1.parseJson)(toolCall.function.arguments), toolCallsSpan);
|
|
110
111
|
if (code) {
|
|
111
112
|
generatedCodeSteps.push(code);
|
|
112
113
|
}
|
|
113
114
|
executedActions.push({
|
|
114
115
|
isError: false,
|
|
115
|
-
action:
|
|
116
|
+
action: (0, utils_1.parseJson)(toolCall.function.arguments)?.reason,
|
|
116
117
|
});
|
|
117
118
|
lastActionExecTrace = "";
|
|
118
119
|
}
|
|
@@ -120,7 +121,7 @@ async function executeTaskUsingBrowsingAgent({ trace, action, logger, page, opti
|
|
|
120
121
|
// TODO: implement feedback loop to llm
|
|
121
122
|
executedActions.push({
|
|
122
123
|
isError: true,
|
|
123
|
-
action:
|
|
124
|
+
action: (0, utils_1.parseJson)(toolCall.function.arguments)?.reason,
|
|
124
125
|
});
|
|
125
126
|
lastActionExecTrace = e.message;
|
|
126
127
|
void testgenUpdatesReporter.sendMessage(e.message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o1-completion.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/o1-completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"o1-completion.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/o1-completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAMpC,wBAAsB,eAAe,CAAC,EACpC,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CA8D7C"}
|
|
@@ -7,6 +7,7 @@ exports.getO1Completion = void 0;
|
|
|
7
7
|
const llm_1 = require("@empiricalrun/llm");
|
|
8
8
|
const remove_markdown_1 = __importDefault(require("remove-markdown"));
|
|
9
9
|
const constants_1 = require("../../constants");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
10
11
|
async function getO1Completion({ messages, tools, trace, }) {
|
|
11
12
|
let completion;
|
|
12
13
|
try {
|
|
@@ -42,7 +43,7 @@ async function getO1Completion({ messages, tools, trace, }) {
|
|
|
42
43
|
}));
|
|
43
44
|
o1Span?.end({ output: response });
|
|
44
45
|
const toolResponseStr = (0, remove_markdown_1.default)(response.content);
|
|
45
|
-
const toolRespJSON =
|
|
46
|
+
const toolRespJSON = (0, utils_1.parseJson)(toolResponseStr);
|
|
46
47
|
const parameters = toolRespJSON.function.parameters || toolRespJSON.function.arguments;
|
|
47
48
|
if (!parameters) {
|
|
48
49
|
throw new Error("No parameters found in tool response");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-annotation.d.ts","sourceRoot":"","sources":["../../../src/agent/master/element-annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"element-annotation.d.ts","sourceRoot":"","sources":["../../../src/agent/master/element-annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WA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|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
5
|
const vision_1 = require("@empiricalrun/llm/vision");
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
7
8
|
const annotationToolAction = {
|
|
8
9
|
name: "element_annotation",
|
|
9
10
|
schema: {
|
|
@@ -138,8 +139,11 @@ async function getElementAnnotation({ elementDescription, annotations, annotated
|
|
|
138
139
|
});
|
|
139
140
|
const toolCall = completion?.tool_calls?.[0];
|
|
140
141
|
annotationsSpan?.end({ output: toolCall });
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
if (toolCall) {
|
|
143
|
+
const args = (0, utils_1.parseJson)(toolCall.function.arguments);
|
|
144
|
+
return args.element_annotation;
|
|
145
|
+
}
|
|
146
|
+
return;
|
|
143
147
|
}
|
|
144
148
|
exports.getElementAnnotation = getElementAnnotation;
|
|
145
149
|
async function getAnnotationKeys({ page, preference, options, }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../../src/agent/master/planner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../../src/agent/master/planner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKvC,wBAAsB,4BAA4B,CAAC,EACjD,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,WAAW,GACZ,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;GAwIA"}
|
|
@@ -4,6 +4,7 @@ exports.runtimePlannerWithScreenshot = void 0;
|
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
5
|
const vision_1 = require("@empiricalrun/llm/vision");
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
7
8
|
async function runtimePlannerWithScreenshot({ trace, task, conversation, pages, page, currentPage, }) {
|
|
8
9
|
const buffer = await page.screenshot({
|
|
9
10
|
//This is done to improve element annotation accuracy, anyways it doesn't annotate elements which are out of viewport
|
|
@@ -119,7 +120,7 @@ async function runtimePlannerWithScreenshot({ trace, task, conversation, pages,
|
|
|
119
120
|
});
|
|
120
121
|
const toolCallResp = (response?.tool_calls || [])[0];
|
|
121
122
|
if (toolCallResp) {
|
|
122
|
-
const toolCall =
|
|
123
|
+
const toolCall = (0, utils_1.parseJson)(toolCallResp.function.arguments);
|
|
123
124
|
const output = {
|
|
124
125
|
pageName: toolCall.pageName,
|
|
125
126
|
isDone: toolCall.isDone,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-time-planner.d.ts","sourceRoot":"","sources":["../../../src/agent/planner/run-time-planner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"run-time-planner.d.ts","sourceRoot":"","sources":["../../../src/agent/planner/run-time-planner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKrD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,EACnC,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,WAAW,GACZ,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;GAiHA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runtimePlanner = void 0;
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
5
6
|
/**
|
|
6
7
|
* This agent is used to divide the tasl into individual actions and then
|
|
7
8
|
* compare each action against the actions listed in the conversation.
|
|
@@ -101,7 +102,7 @@ ${currentPage}
|
|
|
101
102
|
});
|
|
102
103
|
const toolCallResp = (response?.tool_calls || [])[0];
|
|
103
104
|
if (toolCallResp) {
|
|
104
|
-
const toolCall =
|
|
105
|
+
const toolCall = (0, utils_1.parseJson)(toolCallResp.function.arguments);
|
|
105
106
|
const output = {
|
|
106
107
|
pageName: toolCall.pageName,
|
|
107
108
|
isDone: toolCall.isDone,
|
package/dist/agent/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/verification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/verification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhE;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,KAAK,EACL,IAAI,EACJ,YAAY,GACb,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;;;GA+EA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.verificationAgent = void 0;
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
5
6
|
/**
|
|
6
7
|
* This agent is used to verify whether the task is done basis the conversation history
|
|
7
8
|
*/
|
|
@@ -61,7 +62,7 @@ async function verificationAgent({ trace, task, conversation, }) {
|
|
|
61
62
|
});
|
|
62
63
|
const toolCallResp = (response?.tool_calls || [])[0];
|
|
63
64
|
if (toolCallResp) {
|
|
64
|
-
const toolCall =
|
|
65
|
+
const toolCall = (0, utils_1.parseJson)(toolCallResp.function.arguments);
|
|
65
66
|
const output = {
|
|
66
67
|
isDone: toolCall.isDone,
|
|
67
68
|
reason: toolCall.reason,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"tsx": "^4.16.2",
|
|
74
74
|
"typescript": "^5.3.3",
|
|
75
75
|
"@empiricalrun/llm": "^0.9.31",
|
|
76
|
-
"@empiricalrun/
|
|
77
|
-
"@empiricalrun/
|
|
76
|
+
"@empiricalrun/r2-uploader": "^0.3.8",
|
|
77
|
+
"@empiricalrun/reporter": "^0.22.1"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@playwright/test": "1.47.1",
|