@empiricalrun/test-gen 0.42.9 → 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 +17 -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/codegen/lexical-scoped-vars.d.ts.map +1 -1
- package/dist/agent/codegen/lexical-scoped-vars.js +2 -3
- package/dist/agent/master/element-annotation.d.ts.map +1 -1
- package/dist/agent/master/element-annotation.js +7 -3
- package/dist/agent/master/planner.d.ts.map +1 -1
- package/dist/agent/master/planner.js +2 -1
- package/dist/agent/master/run.js +1 -1
- package/dist/agent/master/scroller.d.ts.map +1 -1
- package/dist/agent/master/scroller.js +4 -0
- 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/dist/bin/utils/platform/web/index.d.ts.map +1 -1
- package/dist/bin/utils/platform/web/index.js +0 -2
- package/dist/browser-injected-scripts/annotate-elements.js +22 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.42.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 98a8417: fix: handle JSON parse with try and catch
|
|
8
|
+
|
|
9
|
+
## 0.42.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ad2e2c5: fix: annotations for small elements should be outside the container
|
|
14
|
+
- 6471bf9: test: updated timeouts
|
|
15
|
+
- fabdfd6: fix: moved lexical vars check to o3-mini and increased timeout
|
|
16
|
+
- 61bc738: fix: added message for scroll on dashboard
|
|
17
|
+
- Updated dependencies [fabdfd6]
|
|
18
|
+
- @empiricalrun/llm@0.9.31
|
|
19
|
+
|
|
3
20
|
## 0.42.9
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -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":"lexical-scoped-vars.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/lexical-scoped-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"lexical-scoped-vars.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/lexical-scoped-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,wBAAsB,oBAAoB,CAAC,EACzC,KAAK,EACL,IAAI,EACJ,cAAc,EACd,OAAO,GACR,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC,qBAoDA"}
|
|
@@ -16,14 +16,13 @@ async function getLexicalScopedVars({ trace, file, referencePoint, options, }) {
|
|
|
16
16
|
const llm = new llm_1.LLM({
|
|
17
17
|
trace: fetchLexicalScopedVarsSpan,
|
|
18
18
|
provider: options?.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER,
|
|
19
|
-
defaultModel: options?.model ||
|
|
19
|
+
defaultModel: options?.model || "o3-mini-2025-01-31",
|
|
20
20
|
providerApiKey: constants_1.MODEL_API_KEYS[options?.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER],
|
|
21
21
|
});
|
|
22
22
|
const message = await llm.createChatCompletion({
|
|
23
23
|
messages,
|
|
24
24
|
modelParameters: {
|
|
25
|
-
|
|
26
|
-
...options?.modelParameters,
|
|
25
|
+
max_completion_tokens: constants_1.DEFAULT_O1_MODEL_PARAMETERS.max_completion_tokens,
|
|
27
26
|
},
|
|
28
27
|
responseFormat: {
|
|
29
28
|
type: "json_schema",
|
|
@@ -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,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA0DjD,wBAAsB,oBAAoB,CAAC,EACzC,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,KAAK,EACL,GAAG,EACH,OAAO,EACP,UAAU,GACX,EAAE;IACD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,UAAU,EAAE,oBAAoB,CAAC;CAClC,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAgG9B;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EACN,KAAK,GACL,UAAU,CAAC,IAAI,GACf,UAAU,CAAC,WAAW,GACtB,UAAU,CAAC,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,EACtC,IAAI,EACJ,UAAU,EACV,OAAO,GACR,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,oBAAoB,CAAC;IACjC,OAAO,EAAE,oBAAoB,CAAC;CAC/B,GAAG,OAAO,CAAC;IACV,cAAc,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtD,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,MAAM,CAAC;CACjC,CAAC,CAqDD"}
|
|
@@ -4,6 +4,7 @@ exports.getAnnotationKeys = exports.getElementAnnotation = 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
|
const annotationToolAction = {
|
|
8
9
|
name: "element_annotation",
|
|
9
10
|
schema: {
|
|
@@ -129,7 +130,7 @@ async function getElementAnnotation({ elementDescription, annotations, annotated
|
|
|
129
130
|
...constants_1.DEFAULT_MODEL_PARAMETERS,
|
|
130
131
|
...options?.modelParameters,
|
|
131
132
|
tool_choice: "required",
|
|
132
|
-
temperature:
|
|
133
|
+
temperature: 0.5,
|
|
133
134
|
},
|
|
134
135
|
trace: annotationsSpan,
|
|
135
136
|
traceName: "get-element-from-action",
|
|
@@ -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,
|
package/dist/agent/master/run.js
CHANGED
|
@@ -198,7 +198,7 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
|
|
|
198
198
|
});
|
|
199
199
|
if (annotationKeys.length > 0) {
|
|
200
200
|
const annotationMapString = annotationKeys
|
|
201
|
-
?.map((a) => `${a.elementID}
|
|
201
|
+
?.map((a) => `${a.elementID}: ${a.text}`)
|
|
202
202
|
.join("\n");
|
|
203
203
|
// Provides the annotations for all the element present on screen
|
|
204
204
|
// Also provides the annotation of element on which the action needs to be taken
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroller.d.ts","sourceRoot":"","sources":["../../../src/agent/master/scroller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"scroller.d.ts","sourceRoot":"","sources":["../../../src/agent/master/scroller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAchD,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AA2ZF,wBAAsB,QAAQ,CAAC,EAC7B,kBAAkB,EAClB,IAAI,EACJ,KAAK,EACL,cAAc,EACd,MAAM,GACP,EAAE;IACD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CA6D5B"}
|
|
@@ -4,6 +4,7 @@ exports.scroller = 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 reporter_1 = require("../../reporter");
|
|
7
8
|
const utils_1 = require("../utils");
|
|
8
9
|
const action_tool_calls_1 = require("./action-tool-calls");
|
|
9
10
|
const element_annotation_1 = require("./element-annotation");
|
|
@@ -43,7 +44,9 @@ async function isScrollable({ scrollDirection, page, divAnnotation, }) {
|
|
|
43
44
|
// If the div annotation is undefined, we scroll the page
|
|
44
45
|
// else we scroll the element
|
|
45
46
|
async function scroll({ scrollBy, page, direction, divAnnotation, logger, }) {
|
|
47
|
+
const testGenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
46
48
|
if (divAnnotation) {
|
|
49
|
+
await testGenUpdatesReporter.sendMessage("Scrolling the div since element is not in view");
|
|
47
50
|
logger?.log("Scrolling the div since element is not in view");
|
|
48
51
|
return await page.evaluate(({ scrollBy, direction, divAnnotation }) => {
|
|
49
52
|
if (
|
|
@@ -58,6 +61,7 @@ async function scroll({ scrollBy, page, direction, divAnnotation, logger, }) {
|
|
|
58
61
|
return 0;
|
|
59
62
|
}, { scrollBy, direction, divAnnotation });
|
|
60
63
|
}
|
|
64
|
+
await testGenUpdatesReporter.sendMessage("Scrolling the page since element is not in view");
|
|
61
65
|
logger?.log("Scrolling the page since element is not in view");
|
|
62
66
|
return await page.evaluate(({ scrollBy, direction }) => {
|
|
63
67
|
let scrollHeight = scrollBy || window.innerHeight;
|
|
@@ -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,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhD,OAAO,EAGL,IAAI,EAEJ,UAAU,EAEX,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,eAAO,MAAM,gCAAgC,eAC/B,UAAU,KACrB,MAgBF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,MAAM,EACN,OAAO,GACR,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG;IACF,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB,CA2CA;AAwBD,wBAAsB,0CAA0C,CAC9D,QAAQ,EAAE,MAAM,oBA+BjB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,IAAI,GAAG,SAAS,CA4BlB;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAG5E;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CA8C7D;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,mCAWjB;AAED,wBAAsB,UAAU,CAAC,QAAQ,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,8 +229,6 @@ exports.stripAndPrependImports = stripAndPrependImports;
|
|
|
229
229
|
async function lintErrors(filePath) {
|
|
230
230
|
const eslint = new eslint_1.ESLint({
|
|
231
231
|
fix: true,
|
|
232
|
-
// useEslintrc: false,
|
|
233
|
-
// overrideConfigFile: path.join(process.cwd(), ".eslintrc.js"),
|
|
234
232
|
useEslintrc: true,
|
|
235
233
|
});
|
|
236
234
|
const [result] = await eslint.lintFiles(filePath);
|
|
@@ -311,10 +311,7 @@ function annotateElementsWithPreference({
|
|
|
311
311
|
// Style the marker
|
|
312
312
|
Object.assign(marker.style, {
|
|
313
313
|
position: "absolute",
|
|
314
|
-
|
|
315
|
-
left: `${rect.left + windowToAnnotate.scrollX}px`,
|
|
316
|
-
background:
|
|
317
|
-
"-webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(255, 247, 133)), to(rgb(255, 197, 66)))",
|
|
314
|
+
background: "rgb(255, 197, 66)",
|
|
318
315
|
padding: "1px 3px 0px",
|
|
319
316
|
borderRadius: "3px",
|
|
320
317
|
border: "1px solid rgb(227, 190, 35)",
|
|
@@ -331,10 +328,29 @@ function annotateElementsWithPreference({
|
|
|
331
328
|
fontFamily: "Helvetica, Arial, sans-serif",
|
|
332
329
|
fontWeight: "bold",
|
|
333
330
|
textShadow: "rgba(255, 255, 255, 0.6) 0px 1px 0px",
|
|
331
|
+
visibility: "hidden", // Setting the visibility to hidden initially, to get the height and width of marker
|
|
334
332
|
});
|
|
335
333
|
|
|
336
|
-
// Attach the marker to the specified parent element
|
|
337
334
|
parentElement.appendChild(marker);
|
|
335
|
+
let markerRect = marker.getBoundingClientRect();
|
|
336
|
+
let top = rect.top + windowToAnnotate.scrollY;
|
|
337
|
+
let left = rect.left + windowToAnnotate.scrollX;
|
|
338
|
+
|
|
339
|
+
// If the target element is smaller, we annotate outside the container
|
|
340
|
+
if (markerRect.height > rect.height - markerRect.height) {
|
|
341
|
+
top = top - markerRect.height;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (markerRect.width > rect.width - markerRect.width) {
|
|
345
|
+
left = left - markerRect.width / 2;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Applying the position and setting visibility
|
|
349
|
+
marker.style.top = `${top}px`;
|
|
350
|
+
marker.style.left = `${left}px`;
|
|
351
|
+
marker.style.visibility = "visible";
|
|
352
|
+
|
|
353
|
+
// Attach the marker to the specified parent element
|
|
338
354
|
parentElements.push(parentElement);
|
|
339
355
|
return marker;
|
|
340
356
|
}
|
|
@@ -461,7 +477,7 @@ function annotateElementsWithPreference({
|
|
|
461
477
|
|
|
462
478
|
// Use createHintMarker with the specified container
|
|
463
479
|
createHintMarker(el, hint, container, windowToAnnotate);
|
|
464
|
-
el.style.boxShadow = `inset 0 0 0px
|
|
480
|
+
el.style.boxShadow = `inset 0 0 0px 1px red`;
|
|
465
481
|
|
|
466
482
|
// Add element details to the annotations map
|
|
467
483
|
annotationsMap[hint] = {
|
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"
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"ts-morph": "^23.0.0",
|
|
73
73
|
"tsx": "^4.16.2",
|
|
74
74
|
"typescript": "^5.3.3",
|
|
75
|
-
"@empiricalrun/llm": "^0.9.
|
|
75
|
+
"@empiricalrun/llm": "^0.9.31",
|
|
76
76
|
"@empiricalrun/r2-uploader": "^0.3.8",
|
|
77
77
|
"@empiricalrun/reporter": "^0.22.1"
|
|
78
78
|
},
|