@empiricalrun/test-gen 0.64.3 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/agent/browsing/run.d.ts +6 -4
  3. package/dist/agent/browsing/run.d.ts.map +1 -1
  4. package/dist/agent/browsing/run.js +10 -9
  5. package/dist/agent/chat/agent-loop.d.ts +2 -1
  6. package/dist/agent/chat/agent-loop.d.ts.map +1 -1
  7. package/dist/agent/chat/exports.d.ts +2 -2
  8. package/dist/agent/chat/exports.d.ts.map +1 -1
  9. package/dist/agent/chat/index.d.ts +2 -3
  10. package/dist/agent/chat/index.d.ts.map +1 -1
  11. package/dist/agent/chat/index.js +23 -5
  12. package/dist/agent/chat/models.d.ts +1 -1
  13. package/dist/agent/chat/models.d.ts.map +1 -1
  14. package/dist/agent/chat/state.d.ts +2 -2
  15. package/dist/agent/chat/state.d.ts.map +1 -1
  16. package/dist/agent/chat/utils.d.ts +2 -1
  17. package/dist/agent/chat/utils.d.ts.map +1 -1
  18. package/dist/agent/cua/computer.js +1 -1
  19. package/dist/agent/cua/index.d.ts +10 -3
  20. package/dist/agent/cua/index.d.ts.map +1 -1
  21. package/dist/agent/cua/index.js +71 -34
  22. package/dist/agent/cua/model.d.ts +7 -0
  23. package/dist/agent/cua/model.d.ts.map +1 -1
  24. package/dist/agent/cua/model.js +10 -0
  25. package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts +7 -5
  26. package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -1
  27. package/dist/agent/cua/pw-codegen/pw-pause/index.js +57 -29
  28. package/dist/agent/cua/pw-codegen/pw-pause/ipc.d.ts +3 -0
  29. package/dist/agent/cua/pw-codegen/pw-pause/ipc.d.ts.map +1 -0
  30. package/dist/agent/cua/pw-codegen/pw-pause/ipc.js +13 -0
  31. package/dist/agent/cua/pw-codegen/pw-pause/{utils.d.ts → patch.d.ts} +4 -11
  32. package/dist/agent/cua/pw-codegen/pw-pause/patch.d.ts.map +1 -0
  33. package/dist/agent/cua/pw-codegen/pw-pause/{utils.js → patch.js} +49 -3
  34. package/dist/bin/index.js +3 -5
  35. package/dist/bin/utils/index.d.ts +1 -2
  36. package/dist/bin/utils/index.d.ts.map +1 -1
  37. package/dist/bin/utils/index.js +5 -3
  38. package/dist/file/client.d.ts +2 -8
  39. package/dist/file/client.d.ts.map +1 -1
  40. package/dist/file/client.js +2 -23
  41. package/dist/file/server.d.ts +15 -3
  42. package/dist/file/server.d.ts.map +1 -1
  43. package/dist/file/server.js +17 -28
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +6 -13
  46. package/dist/tool-call-service/index.d.ts +3 -3
  47. package/dist/tool-call-service/index.d.ts.map +1 -1
  48. package/dist/tool-call-service/index.js +6 -3
  49. package/dist/tool-call-service/utils.d.ts +4 -10
  50. package/dist/tool-call-service/utils.d.ts.map +1 -1
  51. package/dist/tool-call-service/utils.js +28 -5
  52. package/dist/tools/commit-and-create-pr.d.ts +0 -6
  53. package/dist/tools/commit-and-create-pr.d.ts.map +1 -1
  54. package/dist/tools/commit-and-create-pr.js +21 -40
  55. package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
  56. package/dist/tools/diagnosis-fetcher.js +1 -0
  57. package/dist/tools/download-build.d.ts.map +1 -1
  58. package/dist/tools/download-build.js +1 -0
  59. package/dist/tools/grep/index.d.ts.map +1 -1
  60. package/dist/tools/grep/index.js +1 -0
  61. package/dist/tools/list-environments.d.ts +3 -0
  62. package/dist/tools/list-environments.d.ts.map +1 -0
  63. package/dist/tools/list-environments.js +49 -0
  64. package/dist/tools/str_replace_editor.d.ts +3 -2
  65. package/dist/tools/str_replace_editor.d.ts.map +1 -1
  66. package/dist/tools/str_replace_editor.js +48 -7
  67. package/dist/tools/test-gen-browser.d.ts +1 -1
  68. package/dist/tools/test-gen-browser.d.ts.map +1 -1
  69. package/dist/tools/test-gen-browser.js +58 -12
  70. package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
  71. package/dist/tools/test-run-fetcher/index.js +1 -0
  72. package/dist/tools/test-run.d.ts.map +1 -1
  73. package/dist/tools/test-run.js +1 -0
  74. package/dist/tools/upgrade-packages/index.d.ts +3 -0
  75. package/dist/tools/upgrade-packages/index.d.ts.map +1 -0
  76. package/dist/tools/upgrade-packages/index.js +124 -0
  77. package/dist/tools/upgrade-packages/utils.d.ts +13 -0
  78. package/dist/tools/upgrade-packages/utils.d.ts.map +1 -0
  79. package/dist/tools/upgrade-packages/utils.js +106 -0
  80. package/dist/tools/utils/index.d.ts +50 -2
  81. package/dist/tools/utils/index.d.ts.map +1 -1
  82. package/dist/tools/utils/index.js +87 -0
  83. package/dist/utils/git.d.ts +12 -1
  84. package/dist/utils/git.d.ts.map +1 -1
  85. package/dist/utils/git.js +66 -1
  86. package/package.json +4 -4
  87. package/tsconfig.tsbuildinfo +1 -1
  88. package/dist/agent/cua/pw-codegen/pw-pause/utils.d.ts.map +0 -1
  89. package/dist/tools/environment-crud.d.ts +0 -4
  90. package/dist/tools/environment-crud.d.ts.map +0 -1
  91. package/dist/tools/environment-crud.js +0 -100
@@ -3,45 +3,67 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PlaywrightPauseCodegen = exports.PW_PAUSE_IPC_PORT = exports.revertToOriginalPwCode = void 0;
7
- exports.preparePlaywrightForCodegen = preparePlaywrightForCodegen;
6
+ exports.PlaywrightPauseCodegen = exports.revertToOriginalPwCode = exports.preparePlaywrightForCodegen = void 0;
7
+ exports.canUsePauseCodegen = canUsePauseCodegen;
8
8
  const express_1 = __importDefault(require("express"));
9
- const fs_1 = __importDefault(require("fs"));
10
- const path_1 = __importDefault(require("path"));
11
- const utils_1 = require("./utils");
12
- var utils_2 = require("./utils");
13
- Object.defineProperty(exports, "revertToOriginalPwCode", { enumerable: true, get: function () { return utils_2.revertToOriginalPwCode; } });
14
- exports.PW_PAUSE_IPC_PORT = 3039;
15
- async function preparePlaywrightForCodegen(repoDir) {
16
- const npmListOutput = await (0, utils_1.runNpmList)(repoDir);
17
- if (!npmListOutput) {
18
- return;
9
+ const ipc_1 = require("./ipc");
10
+ const patch_1 = require("./patch");
11
+ var patch_2 = require("./patch");
12
+ Object.defineProperty(exports, "preparePlaywrightForCodegen", { enumerable: true, get: function () { return patch_2.preparePlaywrightForCodegen; } });
13
+ Object.defineProperty(exports, "revertToOriginalPwCode", { enumerable: true, get: function () { return patch_2.revertToOriginalPwCode; } });
14
+ async function canUsePauseCodegen(repoDir) {
15
+ const hasPatchedPwCode = await (0, patch_1.hasPatchedRecorderApp)(repoDir);
16
+ if (!hasPatchedPwCode) {
17
+ // This codegen approach requires patching the playwright code to setup an
18
+ // IPC server <> client that passes generated code from Playwright to @empiricalrun/test-gen
19
+ console.log("Cannot use pause codegen because recorder app is not patched");
20
+ return false;
19
21
  }
20
- const playwrightCorePath = (0, utils_1.getPlaywrightCoreFromNpmList)(npmListOutput);
21
- const pathToRecorderApp = path_1.default.join(playwrightCorePath, "lib", "server", "recorder", "recorderApp.js");
22
- if (!fs_1.default.existsSync(pathToRecorderApp)) {
23
- const errMsg = `Cannot patch Playwright: ${pathToRecorderApp} does not exist`;
24
- throw new Error(errMsg);
22
+ if (!(await (0, ipc_1.isIPCPortAvailable)())) {
23
+ // The IPC port is hardcoded, and it should be available for IPC to work
24
+ console.log("Cannot use pause codegen because IPC port is not available");
25
+ return false;
25
26
  }
26
- await (0, utils_1.createFileBackup)(pathToRecorderApp);
27
- const port = exports.PW_PAUSE_IPC_PORT;
28
- await (0, utils_1.patchPwCode)(pathToRecorderApp, port);
27
+ const isRunningHeaded = process.env.RUN_PLAYWRIGHT_HEADED &&
28
+ process.env.RUN_PLAYWRIGHT_HEADED === "true";
29
+ if (!isRunningHeaded) {
30
+ // This codegen approach requires running Playwright in headed mode because
31
+ // it depends on the page.pause() API, which is no-op in headless mode
32
+ console.log("Cannot use pause codegen because RUN_PLAYWRIGHT_HEADED is not true");
33
+ return false;
34
+ }
35
+ // eslint-disable-next-line turbo/no-undeclared-env-vars
36
+ if (!process.env.PW_CODEGEN_NO_INSPECTOR) {
37
+ // PW_CODEGEN_NO_INSPECTOR should be set to true, so that Playwright runs the
38
+ // EmptyRecorderApp() -- which is the entrypoint to our patched code
39
+ // Ref: https://github.com/microsoft/playwright/blob/c96558d0691c0377dbc0c772a1bd8120d546e6d7/packages/playwright-core/src/server/recorder/recorderApp.ts#L98
40
+ console.log("Cannot use pause codegen because PW_CODEGEN_NO_INSPECTOR is not set");
41
+ return false;
42
+ }
43
+ // Need all conditions to be met to use pause codegen
44
+ return true;
29
45
  }
30
- // TODO: Fix this to implement BasePlaywrightCodegen
31
46
  class PlaywrightPauseCodegen {
32
47
  port = 0;
33
48
  page;
34
49
  server;
50
+ codeForLastAction;
35
51
  constructor() {
36
- this.port = exports.PW_PAUSE_IPC_PORT;
52
+ this.port = ipc_1.PW_PAUSE_IPC_PORT;
53
+ }
54
+ async saveCode(code) {
55
+ const generatedCode = code.map((c) => c.actions.join("\n")).join("\n");
56
+ if (generatedCode) {
57
+ this.codeForLastAction = generatedCode;
58
+ }
37
59
  }
38
60
  async initialize(page) {
39
61
  // Start server to receive generated code from patch
40
62
  const app = (0, express_1.default)();
41
63
  app.use(express_1.default.json());
42
- app.post("/test", async (req, res) => {
43
- console.log("--- Received request in PlaywrightPatchCodegen ---");
44
- console.log(req.body);
64
+ app.post("/sources", async (req, res) => {
65
+ const { payload } = req.body;
66
+ await this.saveCode(JSON.parse(payload));
45
67
  return res.send({ success: true });
46
68
  });
47
69
  await new Promise((resolve) => {
@@ -74,11 +96,17 @@ class PlaywrightPauseCodegen {
74
96
  await page.pause();
75
97
  }
76
98
  async recordAction() {
77
- console.log("Record action is no-op");
99
+ // Record action is no-op
78
100
  }
79
- async getCodegenResult() {
80
- console.log("Get codegen result is no-op");
81
- return "";
101
+ async getCodeForLastAction() {
102
+ // Wait for the server to send the code
103
+ await new Promise((resolve) => setTimeout(resolve, 1000));
104
+ let codeToReturn = this.codeForLastAction;
105
+ this.codeForLastAction = undefined;
106
+ if (!codeToReturn) {
107
+ throw new Error("No code for last action");
108
+ }
109
+ return codeToReturn;
82
110
  }
83
111
  }
84
112
  exports.PlaywrightPauseCodegen = PlaywrightPauseCodegen;
@@ -0,0 +1,3 @@
1
+ export declare const PW_PAUSE_IPC_PORT = 3039;
2
+ export declare function isIPCPortAvailable(): Promise<boolean>;
3
+ //# sourceMappingURL=ipc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ipc.d.ts","sourceRoot":"","sources":["../../../../../src/agent/cua/pw-codegen/pw-pause/ipc.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC,wBAAsB,kBAAkB,qBAGvC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PW_PAUSE_IPC_PORT = void 0;
7
+ exports.isIPCPortAvailable = isIPCPortAvailable;
8
+ const detect_port_1 = __importDefault(require("detect-port"));
9
+ exports.PW_PAUSE_IPC_PORT = 3039;
10
+ async function isIPCPortAvailable() {
11
+ const portAvailable = await (0, detect_port_1.default)(exports.PW_PAUSE_IPC_PORT);
12
+ return portAvailable === exports.PW_PAUSE_IPC_PORT;
13
+ }
@@ -1,16 +1,9 @@
1
- /**
2
- * Helpful commands for debugging:
3
- *
4
- * 1. Find playwright-core path
5
- * cd `npm ls playwright-core --json --long | jq -r '.dependencies["@playwright/test"].dependencies.playwright.dependencies["playwright-core"].path'`
6
- *
7
- * 2. Find the path to the recorder app
8
- * cat lib/server/recorder/recorderApp.js
9
- *
10
- */
1
+ export declare function preparePlaywrightForCodegen(repoDir: string): Promise<void>;
2
+ export declare function getPathToRecorderApp(repoDir: string): Promise<string | undefined>;
11
3
  export declare function runNpmList(repoDir: string): Promise<string | undefined>;
12
4
  export declare function getPlaywrightCoreFromNpmList(output: string): any;
5
+ export declare function hasPatchedRecorderApp(repoDir: string): Promise<boolean>;
13
6
  export declare function revertToOriginalPwCode(repoDir: string): Promise<void>;
14
7
  export declare function createFileBackup(pathToFile: string): Promise<void>;
15
8
  export declare function patchPwCode(pathToRecorderApp: string, port: number): Promise<void>;
16
- //# sourceMappingURL=utils.d.ts.map
9
+ //# sourceMappingURL=patch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../../../src/agent/cua/pw-codegen/pw-pause/patch.ts"],"names":[],"mappings":"AAmBA,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,MAAM,iBAgBhE;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,+BAczD;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,+BAiB/C;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,OAuB1D;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,oBAY1D;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,iBAoB3D;AAED,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,iBAGxD;AAED,wBAAsB,WAAW,CAAC,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAkBxE"}
@@ -3,14 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.preparePlaywrightForCodegen = preparePlaywrightForCodegen;
7
+ exports.getPathToRecorderApp = getPathToRecorderApp;
6
8
  exports.runNpmList = runNpmList;
7
9
  exports.getPlaywrightCoreFromNpmList = getPlaywrightCoreFromNpmList;
10
+ exports.hasPatchedRecorderApp = hasPatchedRecorderApp;
8
11
  exports.revertToOriginalPwCode = revertToOriginalPwCode;
9
12
  exports.createFileBackup = createFileBackup;
10
13
  exports.patchPwCode = patchPwCode;
11
14
  const child_process_1 = require("child_process");
12
15
  const fs_1 = __importDefault(require("fs"));
13
16
  const path_1 = __importDefault(require("path"));
17
+ const ipc_1 = require("./ipc");
14
18
  /**
15
19
  * Helpful commands for debugging:
16
20
  *
@@ -21,6 +25,34 @@ const path_1 = __importDefault(require("path"));
21
25
  * cat lib/server/recorder/recorderApp.js
22
26
  *
23
27
  */
28
+ const CUSTOM_PATCH_COMMENT = `// Custom patch code set by @empiricalrun/test-gen`;
29
+ async function preparePlaywrightForCodegen(repoDir) {
30
+ try {
31
+ const pathToRecorderApp = await getPathToRecorderApp(repoDir);
32
+ if (!pathToRecorderApp) {
33
+ throw new Error("Cannot find path to recorder app");
34
+ }
35
+ if (!fs_1.default.existsSync(pathToRecorderApp)) {
36
+ const errMsg = `Cannot patch Playwright: ${pathToRecorderApp} does not exist`;
37
+ throw new Error(errMsg);
38
+ }
39
+ await createFileBackup(pathToRecorderApp);
40
+ await patchPwCode(pathToRecorderApp, ipc_1.PW_PAUSE_IPC_PORT);
41
+ }
42
+ catch (error) {
43
+ console.error("Error patching Playwright", error);
44
+ throw error;
45
+ }
46
+ }
47
+ async function getPathToRecorderApp(repoDir) {
48
+ const npmListOutput = await runNpmList(repoDir);
49
+ if (!npmListOutput) {
50
+ return;
51
+ }
52
+ const playwrightCorePath = getPlaywrightCoreFromNpmList(npmListOutput);
53
+ const pathToRecorderApp = path_1.default.join(playwrightCorePath, "lib", "server", "recorder", "recorderApp.js");
54
+ return pathToRecorderApp;
55
+ }
24
56
  async function runNpmList(repoDir) {
25
57
  try {
26
58
  const output = (0, child_process_1.execSync)("npm ls playwright-core --json --long --production=false", {
@@ -57,6 +89,20 @@ function getPlaywrightCoreFromNpmList(output) {
57
89
  }
58
90
  return playwrightCoreDep.path;
59
91
  }
92
+ async function hasPatchedRecorderApp(repoDir) {
93
+ try {
94
+ const pathToRecorderApp = await getPathToRecorderApp(repoDir);
95
+ if (!pathToRecorderApp) {
96
+ return false;
97
+ }
98
+ const recorderAppContents = fs_1.default.readFileSync(pathToRecorderApp, "utf-8");
99
+ return recorderAppContents.includes(CUSTOM_PATCH_COMMENT);
100
+ }
101
+ catch (error) {
102
+ console.error("Error checking if recorder app is patched", error);
103
+ return false;
104
+ }
105
+ }
60
106
  async function revertToOriginalPwCode(repoDir) {
61
107
  try {
62
108
  const npmListOutput = await runNpmList(repoDir);
@@ -80,11 +126,11 @@ async function createFileBackup(pathToFile) {
80
126
  async function patchPwCode(pathToRecorderApp, port) {
81
127
  const currentFileContents = fs_1.default.readFileSync(pathToRecorderApp, "utf-8");
82
128
  const original = `async setSources(sources) {}`;
83
- // TODO: Can we have a request payload and parse it in our code
84
129
  const replacement = `async setSources(sources) {
85
- const payload = JSON.stringify(sources.filter(source => source.isRecorded).filter(source => source.id === "javascript").map(source => source.actions));
130
+ ${CUSTOM_PATCH_COMMENT}
131
+ const payload = JSON.stringify(sources.filter(source => source.isRecorded).filter(source => source.id === "javascript"));
86
132
  const body = JSON.stringify({ payload });
87
- await fetch("http://localhost:${port}/test", {
133
+ await fetch("http://localhost:${port}/sources", {
88
134
  method: "POST",
89
135
  headers: {
90
136
  "Content-Type": "application/json",
package/dist/bin/index.js CHANGED
@@ -35,7 +35,7 @@ function setupProcessListeners(cleanup) {
35
35
  events.forEach((event) => process.removeListener(event, cleanup));
36
36
  };
37
37
  }
38
- async function runChatAgent({ modelInput, chatSessionId, useDiskForChatState, initialPromptPath, withRetry, }) {
38
+ async function runChatAgent({ modelInput, chatSessionId, useDiskForChatState, initialPromptPath, }) {
39
39
  if (modelInput && !utils_2.ARGS_TO_MODEL_MAP[modelInput]) {
40
40
  throw new Error(`Invalid chat model: ${modelInput}`);
41
41
  }
@@ -63,7 +63,6 @@ async function runChatAgent({ modelInput, chatSessionId, useDiskForChatState, in
63
63
  selectedModel: specifiedModel || defaultModel,
64
64
  useDiskForChatState: useDiskForChatState || false,
65
65
  initialPromptContent,
66
- withRetry,
67
66
  });
68
67
  }
69
68
  async function runAgentsWorkflow(testGenConfig, testGenToken) {
@@ -182,7 +181,7 @@ async function runAgentsWorkflow(testGenConfig, testGenToken) {
182
181
  repoDir: process.cwd(),
183
182
  testFilePath: specPath,
184
183
  });
185
- const { isError, error } = await (0, run_1.generateTestsUsingMasterAgent)({
184
+ const { isError, error } = await (0, run_1.runBrowsingAgent)({
186
185
  testCaseName: testCase.name,
187
186
  testCaseSuites: testCase.suites,
188
187
  testFilePath: specPath,
@@ -212,7 +211,7 @@ async function main() {
212
211
  .option("--use-chat", "Use chat agent (and not the workflow)")
213
212
  .option("--chat-session-id <chat-session-id>", "Identifier for chat session (fetched from dash.empirical.run)")
214
213
  .option("--use-disk-for-chat-state", "Save and load chat state from disk")
215
- .option("--chat-model <model>", "Chat model to use (claude-3-7-sonnet-20250219 or claude-3-5-sonnet-20241022 or gemini-2.5-pro-preview-03-25)")
214
+ .option("--chat-model <model>", "Chat model to use (claude-3-7-sonnet-20250219 or claude-3-5-sonnet-20241022 or gemini-2.5-pro-preview-06-05)")
216
215
  .option("--initial-prompt <path>", "Path to an initial prompt file (e.g. prompt.md)")
217
216
  .option("--with-retry", "Use the retry strategy")
218
217
  .parse(process.argv);
@@ -249,7 +248,6 @@ async function main() {
249
248
  modelInput: completedOptions.chatModel,
250
249
  useDiskForChatState: completedOptions.useDiskForChatState,
251
250
  initialPromptPath: completedOptions.initialPrompt,
252
- withRetry: completedOptions.withRetry,
253
251
  });
254
252
  return;
255
253
  }
@@ -1,4 +1,4 @@
1
- import { SupportedChatModels } from "@empiricalrun/llm/chat";
1
+ import { SupportedChatModels } from "@empiricalrun/shared-types";
2
2
  export declare const ARGS_TO_MODEL_MAP: Record<string, SupportedChatModels>;
3
3
  export interface CLIOptions {
4
4
  token?: string;
@@ -11,7 +11,6 @@ export interface CLIOptions {
11
11
  initialPrompt?: string;
12
12
  chatSessionId?: string;
13
13
  chatModel?: (typeof ARGS_TO_MODEL_MAP)[keyof typeof ARGS_TO_MODEL_MAP];
14
- withRetry?: boolean;
15
14
  }
16
15
  export declare function validateAndCompleteCliOptions(options: CLIOptions): Promise<CLIOptions>;
17
16
  export declare function printBanner(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAajE,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;IACvE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAyDrB;AAED,wBAAgB,WAAW,SAgC1B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAgBjE,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;CACxE;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAyDrB;AAED,wBAAgB,WAAW,SAgC1B"}
@@ -13,9 +13,11 @@ exports.ARGS_TO_MODEL_MAP = {
13
13
  "claude-4": "claude-sonnet-4-20250514",
14
14
  "claude-sonnet-4": "claude-sonnet-4-20250514",
15
15
  "claude-opus-4": "claude-opus-4-20250514",
16
- "gemini-2.5": "gemini-2.5-pro-preview-03-25",
17
- "gemini-2.5-pro": "gemini-2.5-pro-preview-03-25",
18
- "gemini-2.5-pro-preview-03-25": "gemini-2.5-pro-preview-03-25",
16
+ "gemini-2.5": "gemini-2.5-pro-preview-06-05",
17
+ "gemini-2.5-pro": "gemini-2.5-pro-preview-06-05",
18
+ "gemini-2.5-pro-preview-03-25": "gemini-2.5-pro-preview-06-05",
19
+ o3: "o3-2025-04-16",
20
+ "o3-2025-04-16": "o3-2025-04-16",
19
21
  "o4-mini": "o4-mini-2025-04-16",
20
22
  "o4-mini-2025-04-16": "o4-mini-2025-04-16",
21
23
  };
@@ -1,17 +1,11 @@
1
- import { ArtifactInput } from "@empiricalrun/shared-types";
1
+ import { BrowserAgentIPCPayload } from "./server";
2
2
  declare class FileServiceClient {
3
3
  baseUrl: string;
4
4
  port: number | undefined;
5
5
  constructor();
6
6
  static isAvailable(): boolean;
7
- updateTest({ generatedCode, task, importPaths, actionsSummary, }: {
8
- generatedCode: string;
9
- task: string;
10
- importPaths: string[];
11
- actionsSummary?: string;
12
- }): Promise<any>;
7
+ sendAgentResult(payload: BrowserAgentIPCPayload): Promise<any>;
13
8
  post(path: string, body: any): Promise<any>;
14
- sendArtifactInputsToServer(artifacts: ArtifactInput[]): Promise<any>;
15
9
  }
16
10
  export default FileServiceClient;
17
11
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/file/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,cAAM,iBAAiB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;;IAUzB,MAAM,CAAC,WAAW;IAIZ,UAAU,CAAC,EACf,aAAa,EACb,IAAI,EACJ,WAAW,EACX,cAAc,GACf,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB;IASK,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;IAiB5B,0BAA0B,CAAC,SAAS,EAAE,aAAa,EAAE;CAgB5D;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/file/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,cAAM,iBAAiB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;;IAUzB,MAAM,CAAC,WAAW;IAIZ,eAAe,CAAC,OAAO,EAAE,sBAAsB;IAI/C,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;CAgBnC;AAED,eAAe,iBAAiB,CAAC"}
@@ -13,13 +13,8 @@ class FileServiceClient {
13
13
  static isAvailable() {
14
14
  return !!Number(process.env.IPC_FILE_SERVICE_PORT);
15
15
  }
16
- async updateTest({ generatedCode, task, importPaths, actionsSummary, }) {
17
- return this.post("/test", {
18
- generatedCode,
19
- task,
20
- importPaths,
21
- actionsSummary,
22
- });
16
+ async sendAgentResult(payload) {
17
+ return this.post("/agent-results", payload);
23
18
  }
24
19
  async post(path, body) {
25
20
  const resp = await fetch(`${this.baseUrl}${path}`, {
@@ -37,21 +32,5 @@ class FileServiceClient {
37
32
  return data;
38
33
  }
39
34
  }
40
- async sendArtifactInputsToServer(artifacts) {
41
- const resp = await fetch(`${this.baseUrl}/artifact`, {
42
- method: "POST",
43
- headers: {
44
- "Content-Type": "application/json",
45
- },
46
- body: JSON.stringify(artifacts),
47
- });
48
- if (!resp.ok) {
49
- throw new Error(`API failed with status ${resp.statusText}`);
50
- }
51
- else {
52
- const data = await resp.json();
53
- return data;
54
- }
55
- }
56
35
  }
57
36
  exports.default = FileServiceClient;
@@ -1,20 +1,32 @@
1
- import { ArtifactInput } from "@empiricalrun/shared-types";
1
+ import { ArtifactInput, Usage } from "@empiricalrun/shared-types";
2
+ import { BrowserAgentResult } from "../agent/cua";
3
+ export type BrowserAgentIPCPayload = {
4
+ task: string;
5
+ result: BrowserAgentResult;
6
+ usage: Usage;
7
+ generatedCode: string;
8
+ importPaths: string[];
9
+ };
2
10
  export declare class FileServiceServer {
3
11
  private port;
4
12
  private filePath;
5
13
  private repoDir;
6
14
  private server;
7
- private actionsSummary;
8
15
  private updateFile;
9
16
  private onComplete?;
10
17
  private artifactsInputs;
18
+ private result;
19
+ private usage;
11
20
  constructor({ port, repoDir, updateFile, onComplete, }: {
12
21
  port: number;
13
22
  repoDir: string;
14
23
  updateFile: boolean;
15
24
  onComplete?: () => void;
16
25
  });
17
- getActionsSummary(): string | undefined;
26
+ getResultAndUsage(): {
27
+ result: BrowserAgentResult | undefined;
28
+ usage: Usage | undefined;
29
+ };
18
30
  getArtifactInputsFromServer(): ArtifactInput[];
19
31
  setFilePath(filePath: string): void;
20
32
  startFileService(): Promise<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/file/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAY3D,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAC,CAAa;IAChC,OAAO,CAAC,eAAe,CAAuB;gBAClC,EACV,IAAI,EACJ,OAAO,EACP,UAAU,EACV,UAAU,GACX,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;KACzB;IAOD,iBAAiB;IAIjB,2BAA2B;IAI3B,WAAW,CAAC,QAAQ,EAAE,MAAM;IAItB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IA4EnC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB5B"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/file/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAKlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAQlD,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAC,CAAa;IAEhC,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,KAAK,CAAoB;gBAErB,EACV,IAAI,EACJ,OAAO,EACP,UAAU,EACV,UAAU,GACX,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;KACzB;IAOD,iBAAiB;;;;IAIjB,2BAA2B;IAI3B,WAAW,CAAC,QAAQ,EAAE,MAAM;IAItB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IA4DnC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB5B"}
@@ -14,18 +14,19 @@ class FileServiceServer {
14
14
  filePath = "";
15
15
  repoDir = "";
16
16
  server;
17
- actionsSummary;
18
17
  updateFile = false;
19
18
  onComplete;
20
19
  artifactsInputs = [];
20
+ result;
21
+ usage;
21
22
  constructor({ port, repoDir, updateFile, onComplete, }) {
22
23
  this.port = port;
23
24
  this.repoDir = repoDir;
24
25
  this.updateFile = updateFile;
25
26
  this.onComplete = onComplete;
26
27
  }
27
- getActionsSummary() {
28
- return this.actionsSummary;
28
+ getResultAndUsage() {
29
+ return { result: this.result, usage: this.usage };
29
30
  }
30
31
  getArtifactInputsFromServer() {
31
32
  return this.artifactsInputs;
@@ -37,9 +38,19 @@ class FileServiceServer {
37
38
  const app = (0, express_1.default)();
38
39
  app.use(express_1.default.json({ limit: "50mb" }));
39
40
  (0, ipc_1.humanLoopRoute)(app);
40
- app.post("/test", async (req, res) => {
41
- const { generatedCode, importPaths, actionsSummary } = req.body;
42
- this.actionsSummary = actionsSummary;
41
+ app.post("/agent-results", async (req, res) => {
42
+ const { generatedCode, importPaths, result, usage } = req.body;
43
+ this.result = result;
44
+ this.usage = usage;
45
+ this.artifactsInputs = this.result
46
+ .filter((item) => item.type === "screenshot")
47
+ .map((item) => item.screenshot)
48
+ .map((artifact) => ({
49
+ ...artifact,
50
+ data: Buffer.isBuffer(artifact.data)
51
+ ? artifact.data
52
+ : Buffer.from(artifact.data),
53
+ }));
43
54
  if (!this.updateFile) {
44
55
  // Not updating the file in this scenario
45
56
  if (this.onComplete)
@@ -64,28 +75,6 @@ class FileServiceServer {
64
75
  }
65
76
  return res.send({ success: false });
66
77
  });
67
- app.post("/artifact", async (req, res) => {
68
- const artifactInputs = Array.isArray(req.body) ? req.body : [req.body];
69
- for (const artifactInput of artifactInputs) {
70
- const { name, contentType, data } = artifactInput;
71
- if (!data) {
72
- console.error("No data in artifact", artifactInput);
73
- continue;
74
- }
75
- // Passing buffer data to the server
76
- // Serialises the buffer data to an obbject
77
- // Which needs to be converted back to a buffer
78
- const bufferData = Buffer.isBuffer(data)
79
- ? data
80
- : Buffer.from(data.data);
81
- this.artifactsInputs.push({
82
- name,
83
- contentType,
84
- data: bufferData,
85
- });
86
- }
87
- return res.send({ success: true });
88
- });
89
78
  return new Promise((resolve) => {
90
79
  this.server = app.listen(this.port, () => resolve(this.port));
91
80
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAQhD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAqB7C,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,IAAI,GAAG,YAAY,EAC5B,KAAK,CAAC,EAAE,SAAS,iBA+ElB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAWhD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAsB7C,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,IAAI,GAAG,YAAY,EAC5B,KAAK,CAAC,EAAE,SAAS,iBAwElB"}
package/dist/index.js CHANGED
@@ -78,21 +78,14 @@ async function createTest(task, pageRef, scope) {
78
78
  scopeVars: scope,
79
79
  });
80
80
  }
81
- const { code, importPaths, actionsSummary, artifacts } = agentResult;
82
- if (artifacts && artifacts.length > 0) {
83
- await fileServiceClient.sendArtifactInputsToServer(artifacts);
84
- }
85
- await fileServiceClient.updateTest({
81
+ await fileServiceClient.sendAgentResult({
86
82
  task,
87
- generatedCode: code,
88
- importPaths,
89
- actionsSummary,
90
- });
91
- span?.end({
92
- output: {
93
- actionsSummary,
94
- },
83
+ result: agentResult.result,
84
+ usage: agentResult.usage,
85
+ generatedCode: agentResult.code,
86
+ importPaths: agentResult.importPaths,
95
87
  });
88
+ span?.end({ output: { agentResult } });
96
89
  }
97
90
  finally {
98
91
  // Ensure listeners are removed even if an error occurs
@@ -1,7 +1,6 @@
1
1
  import { TraceClient } from "@empiricalrun/llm";
2
- import { PendingToolCall, SupportedChatModels, ToolResult } from "@empiricalrun/llm/chat";
3
- import { Tool, ToolExecute } from "@empiricalrun/shared-types";
4
- export type { SupportedChatModels };
2
+ import { PendingToolCall, ToolResult } from "@empiricalrun/llm/chat";
3
+ import { SupportedChatModels, Tool, ToolExecute } from "@empiricalrun/shared-types";
5
4
  type ToolExecutors = {
6
5
  [key: string]: ToolExecute;
7
6
  };
@@ -29,4 +28,5 @@ export declare class ToolCallService {
29
28
  sendToQueue(toolCalls: PendingToolCall[]): Promise<void>;
30
29
  execute(toolCalls: PendingToolCall[]): Promise<ToolResult[]>;
31
30
  }
31
+ export {};
32
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tool-call-service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAEL,eAAe,EACf,mBAAmB,EACnB,UAAU,EACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAiB,IAAI,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAiB9E,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC,KAAK,aAAa,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;CAC5B,CAAC;AAEF,qBAAa,eAAe;IAC1B,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,aAAa,EAAE,aAAa,CAAM;IAClC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,mBAAmB,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBACjC,EACV,aAAa,EACb,aAAa,EACb,UAAU,EACV,QAAQ,EACR,MAAM,EACN,KAAK,EACL,YAAY,EACZ,oBAAyB,GAC1B,EAAE;QACD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,aAAa,EAAE,mBAAmB,CAAC;QACnC,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/C;IAmCK,WAAW,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBxD,OAAO,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CAuEnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tool-call-service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAEL,eAAe,EACf,UAAU,EACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,mBAAmB,EACnB,IAAI,EACJ,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAmBpC,KAAK,aAAa,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;CAC5B,CAAC;AAEF,qBAAa,eAAe;IAC1B,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,aAAa,EAAE,aAAa,CAAM;IAClC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,mBAAmB,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAEjC,EACV,aAAa,EACb,aAAa,EACb,UAAU,EACV,QAAQ,EACR,MAAM,EACN,KAAK,EACL,YAAY,EACZ,oBAAyB,GAC1B,EAAE;QACD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,aAAa,EAAE,mBAAmB,CAAC;QACnC,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/C;IAoCK,WAAW,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBxD,OAAO,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CAwEnE"}
@@ -6,12 +6,13 @@ const artifacts_1 = require("../artifacts");
6
6
  const commit_and_create_pr_1 = require("../tools/commit-and-create-pr");
7
7
  const diagnosis_fetcher_1 = require("../tools/diagnosis-fetcher");
8
8
  const download_build_1 = require("../tools/download-build");
9
- const environment_crud_1 = require("../tools/environment-crud");
10
9
  const grep_1 = require("../tools/grep");
10
+ const list_environments_1 = require("../tools/list-environments");
11
11
  const str_replace_editor_1 = require("../tools/str_replace_editor");
12
12
  const test_gen_browser_1 = require("../tools/test-gen-browser");
13
13
  const test_run_1 = require("../tools/test-run");
14
14
  const test_run_fetcher_1 = require("../tools/test-run-fetcher");
15
+ const upgrade_packages_1 = require("../tools/upgrade-packages");
15
16
  const checkpoint_1 = require("../utils/checkpoint");
16
17
  const utils_1 = require("./utils");
17
18
  class ToolCallService {
@@ -41,8 +42,9 @@ class ToolCallService {
41
42
  diagnosis_fetcher_1.fetchDiagnosisReportTool,
42
43
  test_gen_browser_1.generateTestWithBrowserAgent,
43
44
  commit_and_create_pr_1.createPullRequestTool,
44
- environment_crud_1.getEnvironmentTool,
45
+ list_environments_1.listEnvironmentsTool,
45
46
  download_build_1.downloadBuildTool,
47
+ upgrade_packages_1.upgradePackagesTool,
46
48
  ];
47
49
  if ((0, chat_1.getProviderForModel)(this.selectedModel) !== "claude") {
48
50
  this.tools.push(...str_replace_editor_1.textEditorTools);
@@ -64,7 +66,7 @@ class ToolCallService {
64
66
  if (!requestId) {
65
67
  throw new Error("Could not find an id for the tool call.");
66
68
  }
67
- const queueUrl = (0, utils_1.getQueueUrl)(this.featureFlags);
69
+ const queueUrl = (0, utils_1.getQueueUrl)(toolCalls, this.tools);
68
70
  if (!queueUrl) {
69
71
  throw new Error(`queueUrl is required for remote execution.`);
70
72
  }
@@ -116,6 +118,7 @@ class ToolCallService {
116
118
  trace: this.trace,
117
119
  collectArtifacts: collectArtifactsFn,
118
120
  environmentOverrides: this.environmentOverrides,
121
+ featureFlags: this.featureFlags,
119
122
  });
120
123
  const artifacts = await uploadArtifactsQueue.waitForCompletion();
121
124
  toolResults.push({ ...result, artifacts });
@@ -1,11 +1,5 @@
1
- import { SupportedChatModels } from "@empiricalrun/llm/chat";
2
- import { PendingToolCall } from "@empiricalrun/shared-types";
3
- export declare function getQueueUrl(featureFlags: string[]): string | undefined;
4
- export declare function sendToolRequestToRemoteQueue(queueUrl: string, payload: {
5
- toolCalls: PendingToolCall[];
6
- requestId: string;
7
- chatSessionId: number;
8
- selectedModel: SupportedChatModels;
9
- branchName: string;
10
- }): Promise<void>;
1
+ import { PendingToolCall, ServicePayload, Tool } from "@empiricalrun/shared-types";
2
+ export declare function appendBranchNameToQueueUrl(queueUrl: string, branchName: string): string;
3
+ export declare function getQueueUrl(toolCalls: PendingToolCall[], tools: Tool[]): string;
4
+ export declare function sendToolRequestToRemoteQueue(queueUrl: string, payload: ServicePayload): Promise<void>;
11
5
  //# sourceMappingURL=utils.d.ts.map