@empiricalrun/test-gen 0.70.2 → 0.71.2
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 +34 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +0 -6
- package/dist/agent/browsing/index.d.ts.map +1 -1
- package/dist/agent/browsing/index.js +6 -14
- package/dist/agent/chat/agent-loop.d.ts +3 -2
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +5 -3
- package/dist/agent/chat/state.d.ts +3 -1
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +17 -14
- package/dist/agent/codegen/repo-edit.d.ts.map +1 -1
- package/dist/agent/codegen/repo-edit.js +0 -4
- package/dist/agent/codegen/run.d.ts.map +1 -1
- package/dist/agent/codegen/run.js +0 -4
- package/dist/agent/codegen/utils.d.ts +1 -3
- package/dist/agent/codegen/utils.d.ts.map +1 -1
- package/dist/agent/codegen/utils.js +1 -2
- package/dist/agent/cua/index.d.ts +2 -1
- package/dist/agent/cua/index.d.ts.map +1 -1
- package/dist/agent/cua/index.js +4 -4
- package/dist/agent/master/execute-browser-action.d.ts.map +1 -1
- package/dist/agent/master/execute-browser-action.js +1 -4
- package/dist/agent/master/run.d.ts.map +1 -1
- package/dist/agent/master/run.js +0 -19
- package/dist/agent/master/scroller.d.ts.map +1 -1
- package/dist/agent/master/scroller.js +0 -4
- package/dist/bin/environments.d.ts.map +1 -1
- package/dist/bin/environments.js +1 -0
- package/dist/bin/index.js +36 -36
- package/dist/bin/logger/index.d.ts +0 -1
- package/dist/bin/logger/index.d.ts.map +1 -1
- package/dist/bin/logger/index.js +0 -16
- package/dist/bin/setup.d.ts.map +1 -1
- package/dist/bin/setup.js +42 -1
- package/dist/bin/utils/index.d.ts +2 -0
- package/dist/bin/utils/index.d.ts.map +1 -1
- package/dist/bin/utils/index.js +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -6
- package/dist/recorder/request.js +2 -0
- package/dist/tool-call-service/index.d.ts +1 -1
- package/dist/tool-call-service/index.d.ts.map +1 -1
- package/dist/tool-call-service/index.js +3 -7
- package/dist/tool-call-service/utils.js +2 -2
- package/dist/tools/{test-run.d.ts → run-test.d.ts} +1 -1
- package/dist/tools/run-test.d.ts.map +1 -0
- package/dist/tools/{test-run.js → run-test.js} +3 -1
- package/dist/tools/upgrade-packages/index.js +1 -1
- package/package.json +6 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/reporter/index.d.ts +0 -26
- package/dist/reporter/index.d.ts.map +0 -1
- package/dist/reporter/index.js +0 -149
- package/dist/reporter/lib.d.ts +0 -31
- package/dist/reporter/lib.d.ts.map +0 -1
- package/dist/reporter/lib.js +0 -71
- package/dist/tools/test-run.d.ts.map +0 -1
- package/dist/uploader/index.d.ts +0 -26
- package/dist/uploader/index.d.ts.map +0 -1
- package/dist/uploader/index.js +0 -103
- package/dist/uploader/utils.d.ts +0 -8
- package/dist/uploader/utils.d.ts.map +0 -1
- package/dist/uploader/utils.js +0 -35
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.71.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d7f9025: chore: remove old session reporter which is no longer used
|
|
8
|
+
- f44505a: fix: smaller responses from run-test tool
|
|
9
|
+
- 001b324: fix: enforce codegen approach for overlay dismissals
|
|
10
|
+
- Updated dependencies [f44505a]
|
|
11
|
+
- @empiricalrun/test-run@0.10.8
|
|
12
|
+
- @empiricalrun/llm@0.19.4
|
|
13
|
+
|
|
14
|
+
## 0.71.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- ebafc76: chore: new commits to trigger publish
|
|
19
|
+
- Updated dependencies [ebafc76]
|
|
20
|
+
- @empiricalrun/llm@0.19.4
|
|
21
|
+
|
|
22
|
+
## 0.71.0
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- c2bcc63: feat: github cred to be always alive in cli
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- d326e62: feat: create draft request from cli
|
|
31
|
+
- 6d5a283: fix: pw project resolution in dirs with spaces
|
|
32
|
+
- fc5469c: fix: commit message duplicate skip ci
|
|
33
|
+
- 64f4323: feat: tool call telemetry with posthog
|
|
34
|
+
- Updated dependencies [6d5a283]
|
|
35
|
+
- @empiricalrun/test-run@0.10.7
|
|
36
|
+
|
|
3
37
|
## 0.70.2
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAEL,UAAU,EACV,YAAY,EAEb,MAAM,UAAU,CAAC;AAWlB,qBAAa,iBAAiB;IAQ1B,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,cAAc;IARxB,OAAO,CAAC,gBAAgB,CAAwC;IAChE,OAAO,CAAC,eAAe,CAInB;gBAEM,IAAI,EAAE,WAAW,EACjB,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAgB5C,aAAa,CACjB,IAAI,EAAE,MAAM,YAAK,EACjB,IAAI,EAAE,UAAU,EAChB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAqD9B,wBAAwB,IAAI,YAAY,EAAE;IAoB1C,sBAAsB,IAAI,YAAY,EAAE;IAWxC,YAAY,IAAI;QACd,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB;IAUD,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAK9B;;;;;;OAMG;IACH,aAAa,IAAI,OAAO;IAQxB,UAAU;IAWV,iBAAiB;IAIjB,iBAAiB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAItD"}
|
package/dist/actions/index.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PlaywrightActions = void 0;
|
|
4
4
|
const logger_1 = require("../bin/logger");
|
|
5
5
|
const errors_1 = require("../errors");
|
|
6
|
-
const reporter_1 = require("../reporter");
|
|
7
6
|
const assert_1 = require("./assert");
|
|
8
7
|
const click_1 = require("./click");
|
|
9
8
|
const done_1 = require("./done");
|
|
@@ -45,7 +44,6 @@ class PlaywrightActions {
|
|
|
45
44
|
throw Error(`No action registered for action: ${name}`);
|
|
46
45
|
}
|
|
47
46
|
const logger = new logger_1.CustomLogger({ useReporter: false });
|
|
48
|
-
const testgenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
49
47
|
logger.logEmptyLine();
|
|
50
48
|
const actionSpan = trace?.span({
|
|
51
49
|
name: "execute-action",
|
|
@@ -69,10 +67,6 @@ class PlaywrightActions {
|
|
|
69
67
|
},
|
|
70
68
|
});
|
|
71
69
|
this.recordedActions.push({ name, code, importPath });
|
|
72
|
-
if (code) {
|
|
73
|
-
logger.log(`action: ${name} \ncode: ${code} \nreason: ${args.reason}`);
|
|
74
|
-
void testgenUpdatesReporter.sendMessage("```ts\n" + code + "\n```");
|
|
75
|
-
}
|
|
76
70
|
return code;
|
|
77
71
|
}
|
|
78
72
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAKlD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF,wBAAsB,6BAA6B,CAAC,EAClD,MAAM,EACN,IAAI,EACJ,OAAO,EACP,GAAG,EACH,KAAK,GACN,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,iBAAiB,CAAC;IAC3B,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAwD1C"}
|
|
@@ -4,12 +4,10 @@ exports.executeTaskUsingBrowsingAgent = executeTaskUsingBrowsingAgent;
|
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const promptTemplate_0 = "{{#section \"system\"}}\nYou are a browser automation agent who is given a task to generate code for navigation and assertion. This task is your\ngoal and you must achieve it.\n\nYou will be provided with already executed actions and basis that you need to pick the next step to achieve the task.\nRemember that the goal must be achieved.\n\nYou will be provided with the web page snapshot in the form of Document Object Model. Based on the goal and available\ntool calls you need to pick the appropriate tool call.\n\nInstructions:\n- Take actions one at a time. Do not try to take multiple actions\n- You can respond with multiple assertions in one shot\n- Do not repeat the same actions again otherwise your response will be marked INVALID\n- Avoid repeating errors which we got while executing the last action\n- Stick to the task provided to you and mark the task done once the task is complete\n- Do not execute any action which is not mentioned in the task\n- Do not repeat actions which are already executed more than twice otherwise your response will be marked INVALID\n- Always refer to \"Executed actions\" before deciding your next action for completion of the task.\n- End the task done if all actions required for task are executed\n{{/section}}\n\n{{#section \"user\"}}\nTask:\n{{task}}\n\nCurrent page snapshot:\n{{pageSnapshot}}\n{{/section}}";
|
|
7
|
-
const reporter_1 = require("../../reporter");
|
|
8
7
|
const html_1 = require("../../utils/html");
|
|
9
8
|
async function executeTaskUsingBrowsingAgent({ action, page, actions, llm, trace, }) {
|
|
10
9
|
let generatedCodeSteps;
|
|
11
10
|
const tools = actions.getBrowsingActionSchemas();
|
|
12
|
-
const testgenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
13
11
|
const browsingAgentSpan = trace?.span({
|
|
14
12
|
name: `browsing-agent`,
|
|
15
13
|
input: {
|
|
@@ -48,18 +46,12 @@ async function executeTaskUsingBrowsingAgent({ action, page, actions, llm, trace
|
|
|
48
46
|
for (const i in toolCalls) {
|
|
49
47
|
const toolCall = toolCalls[i];
|
|
50
48
|
const args = JSON.parse(toolCall.function.arguments);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
catch (e) {
|
|
60
|
-
void testgenUpdatesReporter.sendMessage(e.message);
|
|
61
|
-
throw e;
|
|
62
|
-
}
|
|
49
|
+
const code = await actions.executeAction(toolCall.function.name, JSON.parse(toolCall.function.arguments), toolCallsSpan);
|
|
50
|
+
generatedCodeSteps = {
|
|
51
|
+
// Passing reason as action, in order to pass the correct action that took place to runtime planner
|
|
52
|
+
action: args.reason,
|
|
53
|
+
code,
|
|
54
|
+
};
|
|
63
55
|
}
|
|
64
56
|
toolCallsSpan?.end({ output: { toolCalls, generatedCodeSteps } });
|
|
65
57
|
return generatedCodeSteps;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TraceClient } from "@empiricalrun/llm";
|
|
2
2
|
import { IChatModel } from "@empiricalrun/llm/chat";
|
|
3
|
-
import { SupportedChatModels } from "@empiricalrun/shared-types";
|
|
3
|
+
import { PendingToolCall, SupportedChatModels } from "@empiricalrun/shared-types";
|
|
4
4
|
import { ToolCallService } from "../../tool-call-service";
|
|
5
5
|
import { FileInfo } from "../../types";
|
|
6
6
|
import { ReporterFunction } from "./types";
|
|
7
|
-
export declare function chatAgentLoop({ chatModel, selectedModel, reporter, trace, toolCallService, fileInfo, isToolExecutionRemote, }: {
|
|
7
|
+
export declare function chatAgentLoop({ chatModel, selectedModel, reporter, trace, toolCallService, fileInfo, isToolExecutionRemote, onToolCallQueued, }: {
|
|
8
8
|
chatModel: IChatModel<any>;
|
|
9
9
|
selectedModel: SupportedChatModels;
|
|
10
10
|
toolCallService: ToolCallService;
|
|
@@ -12,5 +12,6 @@ export declare function chatAgentLoop({ chatModel, selectedModel, reporter, trac
|
|
|
12
12
|
trace?: TraceClient;
|
|
13
13
|
fileInfo: FileInfo;
|
|
14
14
|
isToolExecutionRemote: boolean;
|
|
15
|
+
onToolCallQueued?: (requestId: string, toolCalls: PendingToolCall[]) => void;
|
|
15
16
|
}): Promise<void>;
|
|
16
17
|
//# sourceMappingURL=agent-loop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/agent-loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAmB,MAAM,wBAAwB,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/agent-loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAmB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EACL,eAAe,EACf,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3C,wBAAsB,aAAa,CAAC,EAClC,SAAS,EACT,aAAa,EACb,QAAQ,EACR,KAAK,EACL,eAAe,EACf,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,GACjB,EAAE;IACD,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAC3B,aAAa,EAAE,mBAAmB,CAAC;IACnC,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;CAC9E,iBAwDA"}
|
|
@@ -5,15 +5,17 @@ const chat_1 = require("@empiricalrun/llm/chat");
|
|
|
5
5
|
const prompt_1 = require("./prompt");
|
|
6
6
|
const state_1 = require("./state");
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
|
-
async function chatAgentLoop({ chatModel, selectedModel, reporter, trace, toolCallService, fileInfo, isToolExecutionRemote, }) {
|
|
8
|
+
async function chatAgentLoop({ chatModel, selectedModel, reporter, trace, toolCallService, fileInfo, isToolExecutionRemote, onToolCallQueued, }) {
|
|
9
9
|
const systemPrompt = await (0, prompt_1.buildSystemPrompt)(fileInfo);
|
|
10
10
|
trace?.update({ input: { systemPrompt } });
|
|
11
11
|
while (!chatModel.askUserForInput) {
|
|
12
12
|
try {
|
|
13
13
|
const toolCalls = chatModel.getPendingToolCalls();
|
|
14
|
-
if (toolCalls.length) {
|
|
14
|
+
if (toolCalls.length > 0) {
|
|
15
15
|
if (isToolExecutionRemote) {
|
|
16
|
-
|
|
16
|
+
const requestId = toolCalls[0].id;
|
|
17
|
+
await toolCallService.sendToQueue(requestId, toolCalls);
|
|
18
|
+
onToolCallQueued?.(requestId, toolCalls);
|
|
17
19
|
(0, utils_1.log)(`Tool call remote execution in progress`);
|
|
18
20
|
break;
|
|
19
21
|
}
|
|
@@ -30,8 +30,10 @@ export declare function loadChatState(): ChatState | undefined;
|
|
|
30
30
|
export declare function migrateChatState(oldState: any): ChatState;
|
|
31
31
|
export declare function saveToDisk<T>(messages: Array<T>, selectedModel: SupportedChatModels, askUserForInput: boolean, error: ChatStateError | null): void;
|
|
32
32
|
export declare function getLatestDownloadBuildUrl(messages: CanonicalMessage[]): string | null;
|
|
33
|
-
export declare function fetchToolCallAvailability(
|
|
33
|
+
export declare function fetchToolCallAvailability(toolCallId: String, messages: CanonicalMessage[]): {
|
|
34
34
|
hasToolRequest: boolean;
|
|
35
35
|
hasToolResponse: boolean;
|
|
36
|
+
toolCallName: string;
|
|
37
|
+
toolCallQueuedAt: Date | undefined;
|
|
36
38
|
};
|
|
37
39
|
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":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AAE,cAAc,GAAG,IAAI,CAAC;CAC9B,aAOA;AAED,wBAAgB,aAAa,IAAI,SAAS,GAAG,SAAS,CAarD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,SAAS,CAqBzD;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAClB,aAAa,EAAE,mBAAmB,EAClC,eAAe,EAAE,OAAO,EACxB,KAAK,EAAE,cAAc,GAAG,IAAI,QAgB7B;AA2BD,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,gBAAgB,EAAE,GAC3B,MAAM,GAAG,IAAI,CAef;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,gBAAgB,EAAE;;;;;EA2B7B"}
|
package/dist/agent/chat/state.js
CHANGED
|
@@ -162,18 +162,21 @@ function getLatestDownloadBuildUrl(messages) {
|
|
|
162
162
|
const input = toolCallPart.toolCall.input;
|
|
163
163
|
return input.buildUrl;
|
|
164
164
|
}
|
|
165
|
-
function fetchToolCallAvailability(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
165
|
+
function fetchToolCallAvailability(toolCallId, messages) {
|
|
166
|
+
const toolCallMessage = messages.find((message) => message.parts.some((part) => {
|
|
167
|
+
return "toolCall" in part && part.toolCallId === toolCallId;
|
|
168
|
+
}));
|
|
169
|
+
const messageTimestampIso = toolCallMessage?.timestamp;
|
|
170
|
+
const toolCallPart = toolCallMessage?.parts.find((part) => "toolCall" in part && part.toolCallId === toolCallId);
|
|
171
|
+
const toolResponseMessage = messages.find((message) => message.parts.some((part) => {
|
|
172
|
+
return "toolResult" in part && part.toolCallId === toolCallId;
|
|
173
|
+
}));
|
|
174
|
+
return {
|
|
175
|
+
hasToolRequest: !!toolCallMessage,
|
|
176
|
+
hasToolResponse: !!toolResponseMessage,
|
|
177
|
+
toolCallName: toolCallPart?.toolCall?.name || "",
|
|
178
|
+
toolCallQueuedAt: messageTimestampIso
|
|
179
|
+
? new Date(messageTimestampIso)
|
|
180
|
+
: undefined,
|
|
181
|
+
};
|
|
179
182
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-edit.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/repo-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"repo-edit.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/repo-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOhD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,wBAAsB,0BAA0B,CAAC,EAC/C,IAAI,EACJ,KAAK,EACL,SAAS,EAET,MAAM,GACP,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,GAAG,OAAO,CAAC;IACV,MAAM,EAAE,0BAA0B,EAAE,CAAC;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAAC,CA6CD;AAED,wBAAsB,aAAa,CAAC,EAClC,KAAK,EACL,IAAI,EACJ,MAAM,GACP,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,GAAG,OAAO,CAAC;IACV,MAAM,EAAE,0BAA0B,EAAE,CAAC;IACrC,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAAC,CA8BD"}
|
|
@@ -8,7 +8,6 @@ exports.repoEditAgent = repoEditAgent;
|
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const context_1 = require("../../bin/utils/context");
|
|
10
10
|
const web_1 = require("../../bin/utils/platform/web");
|
|
11
|
-
const reporter_1 = require("../../reporter");
|
|
12
11
|
const generate_code_apply_changes_1 = require("./generate-code-apply-changes");
|
|
13
12
|
const utils_1 = require("./utils");
|
|
14
13
|
async function generateCodeUsingRepoAgent({ task, trace, repoFiles, logger, }) {
|
|
@@ -56,8 +55,6 @@ If all the changes are done, respond with "exit" tool call otherwise respond wit
|
|
|
56
55
|
};
|
|
57
56
|
}
|
|
58
57
|
async function repoEditAgent({ trace, task, logger, }) {
|
|
59
|
-
const testgenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
60
|
-
void testgenUpdatesReporter.sendMessage(`Updating test code as per the task. \n View [trace](${trace?.getTraceUrl()})`);
|
|
61
58
|
logger?.log(`Starting repo agent: [trace](${trace?.getTraceUrl()})`);
|
|
62
59
|
const { prompt: repoFiles } = await (0, context_1.generateTxtForRepository)();
|
|
63
60
|
const repoAgentOutput = await generateCodeUsingRepoAgent({
|
|
@@ -80,6 +77,5 @@ async function repoEditAgent({ trace, task, logger, }) {
|
|
|
80
77
|
}
|
|
81
78
|
})();
|
|
82
79
|
}));
|
|
83
|
-
await testgenUpdatesReporter.sendMessage(`Successfully generated code for the given task. \n View [trace](${trace?.getTraceUrl()})`);
|
|
84
80
|
return repoAgentOutput;
|
|
85
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,MAAM,MAAM,QAAQ,CAAC;AAa5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAQ/C,wBAAsB,uBAAuB,CAAC,EAC5C,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC;IACV,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,CAAC;IAC7D,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,oBAAoB,EAAE,CAAC;CACrC,CAAC,CAyDD;AAED,wBAAsB,uBAAuB,CAAC,EAC5C,QAAQ,EACR,IAAI,EACJ,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CA2D7B"}
|
|
@@ -12,7 +12,6 @@ const context_1 = require("../../bin/utils/context");
|
|
|
12
12
|
const web_1 = require("../../bin/utils/platform/web");
|
|
13
13
|
const constants_1 = require("../../constants");
|
|
14
14
|
const promptTemplate_0 = "{{#section \"system\"}}\nYou are a software test engineer who is given a task to write test cases in a Playwright test repository.\nYou will be provided with current test files, fixtures and page object models for you to use and update code as per the\ntask provided to you.\nYou need to respond with file path, the new test code block to be updated in the file and the reason for the change.\n\nHere is the list of files:\n\n{{repoFiles}}\n{{/section}}\n\n{{#section \"user\"}}\nTask: {{task}}\n\n## Follow these instructions before responding with output:\n- Scan the file '{{testFilePath}}' and check whether test case with name '{{testCaseName}}' exists in the file\n- If it exists do not update the file\n- else respond with <file_path></file_path>, <code_block></code_block> and <change></change> as xml tags\n- Only respond with single code_block in the response containing only the test code block to be updated\n{{/section}}";
|
|
15
|
-
const reporter_1 = require("../../reporter");
|
|
16
15
|
const update_flow_1 = require("./update-flow");
|
|
17
16
|
const utils_1 = require("./utils");
|
|
18
17
|
async function createTestWithCodeAgent({ testCase, file, repoFiles, trace, }) {
|
|
@@ -88,8 +87,6 @@ async function generateTestWithCodegen({ testCase, file, trace, }) {
|
|
|
88
87
|
trace,
|
|
89
88
|
});
|
|
90
89
|
}
|
|
91
|
-
const testgenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
92
|
-
void testgenUpdatesReporter.sendMessage(`Updating test code as per the task. \n View [trace](${trace?.getTraceUrl()})`);
|
|
93
90
|
logger?.log(`Creating a new test case '${testCase.name}': [trace](${trace?.getTraceUrl()})`);
|
|
94
91
|
// Create the test if it doesn't exist
|
|
95
92
|
const { prompt: repoFiles } = await (0, context_1.generateTxtForRepository)();
|
|
@@ -102,7 +99,6 @@ async function generateTestWithCodegen({ testCase, file, trace, }) {
|
|
|
102
99
|
await (0, utils_1.applyFileChangesForCreateTest)({
|
|
103
100
|
trace,
|
|
104
101
|
fileChanges: updates.fileChanges,
|
|
105
|
-
testgenUpdatesReporter,
|
|
106
102
|
});
|
|
107
103
|
await (0, utils_1.validateTypesAndFormatCode)({
|
|
108
104
|
validateTypes: true,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TraceClient } from "@empiricalrun/llm";
|
|
2
2
|
import type { TestCase } from "@empiricalrun/shared-types";
|
|
3
3
|
import { CustomLogger } from "../../bin/logger";
|
|
4
|
-
import { TestGenUpdatesReporter } from "../../reporter";
|
|
5
4
|
import { CodeUpdate, CreateTestCodeUpdate, FileUpdateResponse } from "./types";
|
|
6
5
|
/**
|
|
7
6
|
*
|
|
@@ -71,10 +70,9 @@ export declare function applyFileChangesUsingStrReplace({ trace, fileChanges, lo
|
|
|
71
70
|
fileChanges: CodeUpdate[];
|
|
72
71
|
logger?: CustomLogger;
|
|
73
72
|
}): Promise<FileUpdateResponse[]>;
|
|
74
|
-
export declare function applyFileChangesForCreateTest({ trace, fileChanges,
|
|
73
|
+
export declare function applyFileChangesForCreateTest({ trace, fileChanges, }: {
|
|
75
74
|
trace?: TraceClient;
|
|
76
75
|
fileChanges: CreateTestCodeUpdate[];
|
|
77
|
-
testgenUpdatesReporter?: TestGenUpdatesReporter;
|
|
78
76
|
}): Promise<void>;
|
|
79
77
|
export declare function searchAndReplaceCode({ logger, fileChange, }: {
|
|
80
78
|
fileChange: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAI3D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAI3D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA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AAG,SAAS,CAAC;KAC5B,EAAE,CAAC;IACJ,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAkIxE"}
|
|
@@ -199,7 +199,7 @@ async function applyFileChangesUsingStrReplace({ trace, fileChanges, logger, })
|
|
|
199
199
|
}
|
|
200
200
|
return results;
|
|
201
201
|
}
|
|
202
|
-
async function applyFileChangesForCreateTest({ trace, fileChanges,
|
|
202
|
+
async function applyFileChangesForCreateTest({ trace, fileChanges, }) {
|
|
203
203
|
const repoEditFileChangesSpan = trace?.span({
|
|
204
204
|
name: "create-test-file-changes",
|
|
205
205
|
});
|
|
@@ -235,7 +235,6 @@ async function applyFileChangesForCreateTest({ trace, fileChanges, testgenUpdate
|
|
|
235
235
|
error: e,
|
|
236
236
|
},
|
|
237
237
|
});
|
|
238
|
-
void testgenUpdatesReporter?.sendMessage(`Error while applying changes to file ${fileChange.filePath}, error: ${e}`);
|
|
239
238
|
console.error(`Error while applying changes to file ${fileChange.filePath}`, e);
|
|
240
239
|
}
|
|
241
240
|
}
|
|
@@ -8,10 +8,11 @@ export type BrowserAgentResult = Array<{
|
|
|
8
8
|
type: "screenshot";
|
|
9
9
|
screenshot: ArtifactInputData;
|
|
10
10
|
}>;
|
|
11
|
-
export declare function createTestUsingComputerUseAgent({ page, task, trace, }: {
|
|
11
|
+
export declare function createTestUsingComputerUseAgent({ page, task, trace, prefersElementFromPointCodegen, }: {
|
|
12
12
|
page: Page;
|
|
13
13
|
task: string;
|
|
14
14
|
trace?: TraceClient;
|
|
15
|
+
prefersElementFromPointCodegen?: boolean;
|
|
15
16
|
}): Promise<{
|
|
16
17
|
code: string;
|
|
17
18
|
importPaths: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/cua/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAStE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/cua/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAStE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAmClC,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAClC;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,iBAAiB,CAAC;CAC/B,CACJ,CAAC;AAEF,wBAAsB,+BAA+B,CAAC,EACpD,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,8BAAsC,GACvC,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC1C,GAAG,OAAO,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;CACd,CAAC,CAuND"}
|
package/dist/agent/cua/index.js
CHANGED
|
@@ -11,9 +11,9 @@ const model_1 = require("./model");
|
|
|
11
11
|
const element_from_point_1 = require("./pw-codegen/element-from-point");
|
|
12
12
|
const pw_pause_1 = require("./pw-codegen/pw-pause");
|
|
13
13
|
const MAX_ITERATIONS = 15;
|
|
14
|
-
async function getCodegenInstance() {
|
|
14
|
+
async function getCodegenInstance(prefersElementFromPoint) {
|
|
15
15
|
const repoDir = process.cwd();
|
|
16
|
-
const canUsePwPause = await (0, pw_pause_1.canUsePauseCodegen)(repoDir);
|
|
16
|
+
const canUsePwPause = !prefersElementFromPoint && (await (0, pw_pause_1.canUsePauseCodegen)(repoDir));
|
|
17
17
|
if (canUsePwPause) {
|
|
18
18
|
console.log("[getCodegen] using PlaywrightPauseCodegen");
|
|
19
19
|
return new pw_pause_1.PlaywrightPauseCodegen();
|
|
@@ -28,8 +28,8 @@ function artifact(screenshot, name) {
|
|
|
28
28
|
data: Buffer.from(screenshot, "base64"),
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
async function createTestUsingComputerUseAgent({ page, task, trace, }) {
|
|
32
|
-
const codegen = await getCodegenInstance();
|
|
31
|
+
async function createTestUsingComputerUseAgent({ page, task, trace, prefersElementFromPointCodegen = false, }) {
|
|
32
|
+
const codegen = await getCodegenInstance(prefersElementFromPointCodegen);
|
|
33
33
|
await codegen.initialize(page);
|
|
34
34
|
const screenshot = await (0, computer_1.getScreenshot)(page);
|
|
35
35
|
const initialArtifact = artifact(screenshot, "Initial screen");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-browser-action.d.ts","sourceRoot":"","sources":["../../../src/agent/master/execute-browser-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"execute-browser-action.d.ts","sourceRoot":"","sources":["../../../src/agent/master/execute-browser-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAUlD,wBAAsB,oBAAoB,CAAC,EACzC,IAAI,EACJ,UAAU,EACV,KAAK,EACL,OAAO,EACP,GAAG,EACH,KAAK,GACN,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,KAAK,EAAE;QACL,4BAA4B,EAAE,OAAO,CAAC;KACvC,CAAC;IACF,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,GAAG,EAAE,GAAG,CAAC;CACV;;;gBAIW,MAAM;gBACN,MAAM;4BACM,MAAM;;GA8H7B"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeBrowserAction = executeBrowserAction;
|
|
4
|
-
const reporter_1 = require("../../reporter");
|
|
5
4
|
const browsing_1 = require("../browsing");
|
|
6
5
|
const action_tool_calls_1 = require("./action-tool-calls");
|
|
7
6
|
const element_annotation_1 = require("./element-annotation");
|
|
@@ -39,7 +38,7 @@ async function executeBrowserAction({ page, nextAction, flags, actions, llm, tra
|
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
|
-
let { annotationKeys, annotatedPageScreenshot
|
|
41
|
+
let { annotationKeys, annotatedPageScreenshot } = await (0, element_annotation_1.getAnnotationKeys)({
|
|
43
42
|
page,
|
|
44
43
|
preference,
|
|
45
44
|
trace,
|
|
@@ -61,8 +60,6 @@ async function executeBrowserAction({ page, nextAction, flags, actions, llm, tra
|
|
|
61
60
|
});
|
|
62
61
|
output.elementAnnotation = elementAnnotation;
|
|
63
62
|
console.log("Output: ", output);
|
|
64
|
-
const testGenReporter = new reporter_1.TestGenUpdatesReporter();
|
|
65
|
-
await testGenReporter.sendCurrentView(annotationBuffer);
|
|
66
63
|
const triggerHintsFlowSpan = trace?.span({
|
|
67
64
|
name: "trigger-hints-flow",
|
|
68
65
|
input: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAclC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAUxC,OAAO,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAKzD,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAqB9C,wBAAsB,0BAA0B,CAAC,EAC/C,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;;;GA4PA"}
|
package/dist/agent/master/run.js
CHANGED
|
@@ -10,7 +10,6 @@ const logger_1 = require("../../bin/logger");
|
|
|
10
10
|
const constants_1 = require("../../constants");
|
|
11
11
|
const errors_1 = require("../../errors");
|
|
12
12
|
const page_1 = require("../../page");
|
|
13
|
-
const reporter_1 = require("../../reporter");
|
|
14
13
|
const session_1 = require("../../session");
|
|
15
14
|
const utils_2 = require("../browsing/utils");
|
|
16
15
|
const skills_retriever_1 = require("../codegen/skills-retriever");
|
|
@@ -41,7 +40,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
|
|
|
41
40
|
const useActionSpecificAnnotations = options?.useActionSpecificAnnotations || false;
|
|
42
41
|
const usePlannerInMaster = options?.usePlannerInMaster || false;
|
|
43
42
|
const logger = new logger_1.CustomLogger({ useReporter: false });
|
|
44
|
-
const testgenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
45
43
|
const session = (0, session_1.getSessionDetails)();
|
|
46
44
|
const testGenPage = new page_1.TestGenPage(page, (0, utils_1.getPageVarName)());
|
|
47
45
|
const trace = llm_1.langfuseInstance?.trace({
|
|
@@ -58,11 +56,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
|
|
|
58
56
|
options.metadata?.environment,
|
|
59
57
|
].filter((s) => !!s),
|
|
60
58
|
});
|
|
61
|
-
if (trace) {
|
|
62
|
-
void testgenUpdatesReporter.sendMessage(`Starting master agent. [view trace](${trace?.getTraceUrl()})`);
|
|
63
|
-
logger.log(`Starting master agent: ${trace?.getTraceUrl()}`);
|
|
64
|
-
void testgenUpdatesReporter.sendAgentTraceUrl(trace.getTraceUrl());
|
|
65
|
-
}
|
|
66
59
|
const llm = new llm_1.LLM({
|
|
67
60
|
trace,
|
|
68
61
|
provider: options.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER,
|
|
@@ -82,14 +75,12 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
|
|
|
82
75
|
}
|
|
83
76
|
skill_1.testCaseSkills.updateSkills(skills);
|
|
84
77
|
if (usePlannerInMaster && testCase && specPath) {
|
|
85
|
-
void testgenUpdatesReporter.sendMessage(`Planner is working on task: ${task}`);
|
|
86
78
|
logger.log(`Planner is working on task: ${task}`);
|
|
87
79
|
const plan = await (0, run_1.planTask)({
|
|
88
80
|
task,
|
|
89
81
|
specPath,
|
|
90
82
|
trace,
|
|
91
83
|
});
|
|
92
|
-
void testgenUpdatesReporter.sendMessage(`Here is the plan:\n${plan}`);
|
|
93
84
|
logger.log(`Here is the plan:\n${plan}`);
|
|
94
85
|
// Will assume this is the task hereon
|
|
95
86
|
task = plan;
|
|
@@ -123,7 +114,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
|
|
|
123
114
|
});
|
|
124
115
|
isGivenTaskDone = plannerResp.isDone;
|
|
125
116
|
if (isGivenTaskDone) {
|
|
126
|
-
await testgenUpdatesReporter.sendMessage(`${plannerResp.reason} Marking the task as done.`);
|
|
127
117
|
break;
|
|
128
118
|
}
|
|
129
119
|
if (actions.getStateVariables()[plannerResp.pageName]) {
|
|
@@ -135,8 +125,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
|
|
|
135
125
|
// inject scripts in the page
|
|
136
126
|
await (0, utils_2.injectPwLocatorGenerator)(testGenPage.pwPageInstance);
|
|
137
127
|
const buffer = await page.screenshot();
|
|
138
|
-
const testGenReporter = new reporter_1.TestGenUpdatesReporter();
|
|
139
|
-
await testGenReporter.sendCurrentView(buffer);
|
|
140
128
|
const pageScreenshot = buffer.toString("base64");
|
|
141
129
|
let output;
|
|
142
130
|
let generatedCodeSteps = [];
|
|
@@ -163,7 +151,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
|
|
|
163
151
|
if (nextAction) {
|
|
164
152
|
if (nextAction.actionType === action_tool_calls_1.ActionType.UNKNOWN) {
|
|
165
153
|
logger.error("Agent is not able to figure out next action since element is not visible on screen.");
|
|
166
|
-
await testgenUpdatesReporter.sendMessage("Agent is not able to figure out next action since element is not visible on screen.");
|
|
167
154
|
break;
|
|
168
155
|
}
|
|
169
156
|
const args = JSON.parse(nextAction.toolCallArgs);
|
|
@@ -175,7 +162,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
|
|
|
175
162
|
reason: args.reason,
|
|
176
163
|
};
|
|
177
164
|
try {
|
|
178
|
-
void testGenReporter.sendMessage(output.reason);
|
|
179
165
|
logger.log(`Next Action: ${output.action}`);
|
|
180
166
|
switch (nextAction.actionType) {
|
|
181
167
|
case skill_1.SKILL_USAGE: {
|
|
@@ -248,7 +234,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
|
|
|
248
234
|
if (failedActions.length >= MAX_ERROR_COUNT) {
|
|
249
235
|
const error = "Agent is not able to figure out next action, marking task as done";
|
|
250
236
|
logger.error(error);
|
|
251
|
-
await testgenUpdatesReporter.sendMessage(error);
|
|
252
237
|
break;
|
|
253
238
|
}
|
|
254
239
|
}
|
|
@@ -265,11 +250,7 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
|
|
|
265
250
|
}
|
|
266
251
|
const { code, importPaths } = actions.generateCode();
|
|
267
252
|
trace?.update({ input: { task }, output: { code } });
|
|
268
|
-
await new reporter_1.TestGenUpdatesReporter().sendCurrentView(await page.screenshot());
|
|
269
253
|
logger.success("Successfully generated code for the given task");
|
|
270
|
-
if (trace) {
|
|
271
|
-
await testgenUpdatesReporter.sendMessage(`Successfully generated code for the given task. \n View [trace](${trace.getTraceUrl()})`);
|
|
272
|
-
}
|
|
273
254
|
return {
|
|
274
255
|
code,
|
|
275
256
|
importPaths,
|
|
@@ -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;AAErE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,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;AAErE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAYhD,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAoZF,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,7 +4,6 @@ exports.scroller = scroller;
|
|
|
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");
|
|
8
7
|
const action_tool_calls_1 = require("./action-tool-calls");
|
|
9
8
|
const element_annotation_1 = require("./element-annotation");
|
|
10
9
|
let usedAnnotations = [];
|
|
@@ -43,9 +42,7 @@ async function isScrollable({ scrollDirection, page, divAnnotation, }) {
|
|
|
43
42
|
// If the div annotation is undefined, we scroll the page
|
|
44
43
|
// else we scroll the element
|
|
45
44
|
async function scroll({ scrollBy, page, direction, divAnnotation, logger, }) {
|
|
46
|
-
const testGenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
47
45
|
if (divAnnotation) {
|
|
48
|
-
await testGenUpdatesReporter.sendMessage("Scrolling the div since element is not in view");
|
|
49
46
|
logger?.log("Scrolling the div since element is not in view");
|
|
50
47
|
return await page.evaluate(({ scrollBy, direction, divAnnotation }) => {
|
|
51
48
|
if (
|
|
@@ -60,7 +57,6 @@ async function scroll({ scrollBy, page, direction, divAnnotation, logger, }) {
|
|
|
60
57
|
return 0;
|
|
61
58
|
}, { scrollBy, direction, divAnnotation });
|
|
62
59
|
}
|
|
63
|
-
await testGenUpdatesReporter.sendMessage("Scrolling the page since element is not in view");
|
|
64
60
|
logger?.log("Scrolling the page since element is not in view");
|
|
65
61
|
return await page.evaluate(({ scrollBy, direction }) => {
|
|
66
62
|
let scrollHeight = scrollBy || window.innerHeight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environments.d.ts","sourceRoot":"","sources":["../../src/bin/environments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"environments.d.ts","sourceRoot":"","sources":["../../src/bin/environments.ts"],"names":[],"mappings":"AASA,wBAAsB,gBAAgB,kBAiErC"}
|
package/dist/bin/environments.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.listEnvironments = listEnvironments;
|
|
4
4
|
const api_client_1 = require("../auth/api-client");
|
|
5
5
|
const validation_1 = require("../recorder/validation");
|
|
6
|
+
// TODO: Match against playwright project names - show that to the user
|
|
6
7
|
async function listEnvironments() {
|
|
7
8
|
try {
|
|
8
9
|
let repoName = await (0, validation_1.validatePackageJson)(process.cwd());
|