@empiricalrun/test-gen 0.65.0 → 0.66.1

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 (66) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/agent/browsing/run.d.ts.map +1 -1
  3. package/dist/agent/browsing/run.js +1 -0
  4. package/dist/agent/chat/index.d.ts +1 -2
  5. package/dist/agent/chat/index.d.ts.map +1 -1
  6. package/dist/agent/chat/index.js +8 -4
  7. package/dist/agent/chat/{prompt.d.ts → prompt/index.d.ts} +2 -2
  8. package/dist/agent/chat/prompt/index.d.ts.map +1 -0
  9. package/dist/agent/chat/{prompt.js → prompt/index.js} +14 -63
  10. package/dist/agent/chat/prompt/pw-utils-docs.d.ts +2 -0
  11. package/dist/agent/chat/prompt/pw-utils-docs.d.ts.map +1 -0
  12. package/dist/agent/chat/prompt/pw-utils-docs.js +62 -0
  13. package/dist/agent/chat/{repo.d.ts → prompt/repo.d.ts} +1 -1
  14. package/dist/agent/chat/prompt/repo.d.ts.map +1 -0
  15. package/dist/agent/chat/{repo.js → prompt/repo.js} +1 -1
  16. package/dist/agent/cua/computer.js +1 -1
  17. package/dist/agent/cua/index.d.ts.map +1 -1
  18. package/dist/agent/cua/index.js +10 -5
  19. package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts +7 -5
  20. package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -1
  21. package/dist/agent/cua/pw-codegen/pw-pause/index.js +57 -29
  22. package/dist/agent/cua/pw-codegen/pw-pause/ipc.d.ts +3 -0
  23. package/dist/agent/cua/pw-codegen/pw-pause/ipc.d.ts.map +1 -0
  24. package/dist/agent/cua/pw-codegen/pw-pause/ipc.js +13 -0
  25. package/dist/agent/cua/pw-codegen/pw-pause/patch.d.ts +12 -0
  26. package/dist/agent/cua/pw-codegen/pw-pause/patch.d.ts.map +1 -0
  27. package/dist/agent/cua/pw-codegen/pw-pause/{utils.js → patch.js} +85 -12
  28. package/dist/artifacts/utils.d.ts.map +1 -1
  29. package/dist/artifacts/utils.js +14 -3
  30. package/dist/bin/index.js +1 -3
  31. package/dist/bin/utils/index.d.ts +0 -1
  32. package/dist/bin/utils/index.d.ts.map +1 -1
  33. package/dist/bin/utils/index.js +2 -0
  34. package/dist/tool-call-service/index.d.ts.map +1 -1
  35. package/dist/tool-call-service/index.js +2 -0
  36. package/dist/tool-call-service/utils.d.ts +1 -0
  37. package/dist/tool-call-service/utils.d.ts.map +1 -1
  38. package/dist/tool-call-service/utils.js +18 -11
  39. package/dist/tools/commit-and-create-pr.d.ts +0 -6
  40. package/dist/tools/commit-and-create-pr.d.ts.map +1 -1
  41. package/dist/tools/commit-and-create-pr.js +20 -40
  42. package/dist/tools/str_replace_editor.d.ts +3 -2
  43. package/dist/tools/str_replace_editor.d.ts.map +1 -1
  44. package/dist/tools/str_replace_editor.js +44 -7
  45. package/dist/tools/test-gen-browser.d.ts.map +1 -1
  46. package/dist/tools/test-gen-browser.js +8 -0
  47. package/dist/tools/upgrade-packages/index.d.ts +3 -0
  48. package/dist/tools/upgrade-packages/index.d.ts.map +1 -0
  49. package/dist/tools/upgrade-packages/index.js +124 -0
  50. package/dist/tools/upgrade-packages/utils.d.ts +13 -0
  51. package/dist/tools/upgrade-packages/utils.d.ts.map +1 -0
  52. package/dist/tools/upgrade-packages/utils.js +106 -0
  53. package/dist/tools/utils/index.d.ts +50 -2
  54. package/dist/tools/utils/index.d.ts.map +1 -1
  55. package/dist/tools/utils/index.js +87 -0
  56. package/dist/uploader/index.d.ts.map +1 -1
  57. package/dist/uploader/index.js +1 -0
  58. package/dist/utils/git.d.ts +12 -1
  59. package/dist/utils/git.d.ts.map +1 -1
  60. package/dist/utils/git.js +66 -1
  61. package/package.json +6 -6
  62. package/tsconfig.tsbuildinfo +1 -1
  63. package/dist/agent/chat/prompt.d.ts.map +0 -1
  64. package/dist/agent/chat/repo.d.ts.map +0 -1
  65. package/dist/agent/cua/pw-codegen/pw-pause/utils.d.ts +0 -16
  66. package/dist/agent/cua/pw-codegen/pw-pause/utils.d.ts.map +0 -1
@@ -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,35 @@ 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 npmListOutput = await runNpmList(repoDir);
32
+ if (!npmListOutput) {
33
+ return;
34
+ }
35
+ const pwCore = getPlaywrightCoreFromNpmList(npmListOutput);
36
+ const { path: pwCorePath, version: pwVersion } = pwCore;
37
+ const pathToRecorderApp = await getPathToRecorderApp(pwCorePath);
38
+ await createFileBackup(pathToRecorderApp);
39
+ await patchPwCode(pwVersion, pathToRecorderApp, ipc_1.PW_PAUSE_IPC_PORT);
40
+ }
41
+ catch (error) {
42
+ console.error("Error patching Playwright", error);
43
+ throw error;
44
+ }
45
+ }
46
+ async function getPathToRecorderApp(pwCorePath) {
47
+ // Both supported versions have the same path structure
48
+ const pathToRecorderApp = path_1.default.join(pwCorePath, "lib", "server", "recorder", "recorderApp.js");
49
+ if (!pathToRecorderApp) {
50
+ throw new Error("Cannot find path to recorder app");
51
+ }
52
+ if (!fs_1.default.existsSync(pathToRecorderApp)) {
53
+ throw new Error(`${pathToRecorderApp} does not exist`);
54
+ }
55
+ return pathToRecorderApp;
56
+ }
24
57
  async function runNpmList(repoDir) {
25
58
  try {
26
59
  const output = (0, child_process_1.execSync)("npm ls playwright-core --json --long --production=false", {
@@ -46,16 +79,47 @@ function getPlaywrightCoreFromNpmList(output) {
46
79
  if (!playwrightTest) {
47
80
  throw new Error("Could not find @playwright/test in npm dependencies");
48
81
  }
49
- const playwrightTestVersion = playwrightTest.version;
50
- if (playwrightTestVersion !== "1.47.1") {
51
- throw new Error("Unsupported playwright-test version: ${playwrightTestVersion}");
52
- }
53
82
  const playwrightDeps = playwrightTest.dependencies["playwright"];
54
83
  const playwrightCoreDep = playwrightDeps.dependencies["playwright-core"];
55
84
  if (!playwrightCoreDep) {
56
85
  throw new Error("Could not find playwright-core in @playwright/test dependencies");
57
86
  }
58
- return playwrightCoreDep.path;
87
+ function extractMinorVersion(version) {
88
+ const minorVersion = version.split(".").slice(0, 2).join(".");
89
+ if (minorVersion === "1.47") {
90
+ return "1.47";
91
+ }
92
+ else if (minorVersion === "1.53") {
93
+ return "1.53";
94
+ }
95
+ else {
96
+ throw new Error(`Unsupported Playwright version: ${minorVersion}`);
97
+ }
98
+ }
99
+ return {
100
+ path: playwrightCoreDep.path,
101
+ version: extractMinorVersion(playwrightCoreDep.version),
102
+ };
103
+ }
104
+ async function hasPatchedRecorderApp(repoDir) {
105
+ try {
106
+ const npmListOutput = await runNpmList(repoDir);
107
+ if (!npmListOutput) {
108
+ return;
109
+ }
110
+ const pwCore = getPlaywrightCoreFromNpmList(npmListOutput);
111
+ const { path: pwCorePath } = pwCore;
112
+ const pathToRecorderApp = await getPathToRecorderApp(pwCorePath);
113
+ if (!pathToRecorderApp) {
114
+ return false;
115
+ }
116
+ const recorderAppContents = fs_1.default.readFileSync(pathToRecorderApp, "utf-8");
117
+ return recorderAppContents.includes(CUSTOM_PATCH_COMMENT);
118
+ }
119
+ catch (error) {
120
+ console.error("Error checking if recorder app is patched", error);
121
+ return false;
122
+ }
59
123
  }
60
124
  async function revertToOriginalPwCode(repoDir) {
61
125
  try {
@@ -63,8 +127,8 @@ async function revertToOriginalPwCode(repoDir) {
63
127
  if (!npmListOutput) {
64
128
  return;
65
129
  }
66
- const playwrightCorePath = getPlaywrightCoreFromNpmList(npmListOutput);
67
- const pathToRecorderApp = path_1.default.join(playwrightCorePath, "lib", "server", "recorder", "recorderApp.js");
130
+ const { path: pwCorePath } = getPlaywrightCoreFromNpmList(npmListOutput);
131
+ const pathToRecorderApp = path_1.default.join(pwCorePath, "lib", "server", "recorder", "recorderApp.js");
68
132
  const backupPath = `${pathToRecorderApp}.backup`;
69
133
  fs_1.default.copyFileSync(backupPath, pathToRecorderApp);
70
134
  fs_1.default.unlinkSync(backupPath);
@@ -77,14 +141,23 @@ async function createFileBackup(pathToFile) {
77
141
  const backupPath = `${pathToFile}.backup`;
78
142
  fs_1.default.copyFileSync(pathToFile, backupPath);
79
143
  }
80
- async function patchPwCode(pathToRecorderApp, port) {
144
+ async function patchPwCode(pwVersion, pathToRecorderApp, port) {
81
145
  const currentFileContents = fs_1.default.readFileSync(pathToRecorderApp, "utf-8");
82
- const original = `async setSources(sources) {}`;
83
- // TODO: Can we have a request payload and parse it in our code
146
+ let original;
147
+ if (pwVersion === "1.47") {
148
+ original = `async setSources(sources) {}`;
149
+ }
150
+ else if (pwVersion === "1.53") {
151
+ original = `async setSources(sources, primaryPageURL) {\n }`;
152
+ }
153
+ else {
154
+ throw new Error(`Unsupported Playwright version: ${pwVersion}`);
155
+ }
84
156
  const replacement = `async setSources(sources) {
85
- const payload = JSON.stringify(sources.filter(source => source.isRecorded).filter(source => source.id === "javascript").map(source => source.actions));
157
+ ${CUSTOM_PATCH_COMMENT}
158
+ const payload = JSON.stringify(sources.filter(source => source.isRecorded).filter(source => source.id === "javascript"));
86
159
  const body = JSON.stringify({ payload });
87
- await fetch("http://localhost:${port}/test", {
160
+ await fetch("http://localhost:${port}/sources", {
88
161
  method: "POST",
89
162
  headers: {
90
163
  "Content-Type": "application/json",
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/artifacts/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EACL,UAAU,IAAI,oBAAoB,EAGnC,MAAM,2BAA2B,CAAC;AAGnC;;;;GAIG;AACH,wBAAgB,0CAA0C,CACxD,MAAM,EAAE,oBAAoB,GAC3B,iBAAiB,EAAE,CAqErB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAmBxE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/artifacts/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EACL,UAAU,IAAI,oBAAoB,EAGnC,MAAM,2BAA2B,CAAC;AAInC;;;;GAIG;AACH,wBAAgB,0CAA0C,CACxD,MAAM,EAAE,oBAAoB,GAC3B,iBAAiB,EAAE,CAqErB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAmCxE"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.extractAttachmentsFromPlaywrightJSONReport = extractAttachmentsFromPlaywrightJSONReport;
7
7
  exports.findPlaywrightArtifacts = findPlaywrightArtifacts;
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
9
10
  /**
10
11
  * Extracts attachment information from a Playwright JSON report.
11
12
  * @param report The Playwright JSON report to extract attachments from
@@ -84,9 +85,19 @@ function extractAttachmentsFromPlaywrightJSONReport(report) {
84
85
  */
85
86
  function findPlaywrightArtifacts(repoDir) {
86
87
  const artifacts = [];
87
- const reportPath = require("path").join(repoDir, "playwright-report");
88
- const summaryJsonPath = require("path").join(reportPath, "summary.json");
89
- if (fs_1.default.existsSync(summaryJsonPath)) {
88
+ const pathForPlaywright147 = path_1.default.join(repoDir, "playwright-report", "summary.json");
89
+ const pathForPlaywright153 = path_1.default.join(repoDir, "summary.json");
90
+ let summaryJsonPath;
91
+ if (fs_1.default.existsSync(pathForPlaywright147)) {
92
+ summaryJsonPath = pathForPlaywright147;
93
+ }
94
+ else if (fs_1.default.existsSync(pathForPlaywright153)) {
95
+ summaryJsonPath = pathForPlaywright153;
96
+ }
97
+ else {
98
+ console.warn(`[findPlaywrightArtifacts] No Playwright report found in ${repoDir}`);
99
+ }
100
+ if (summaryJsonPath) {
90
101
  try {
91
102
  const summaryJson = JSON.parse(fs_1.default.readFileSync(summaryJsonPath, "utf-8"));
92
103
  const found = extractAttachmentsFromPlaywrightJSONReport(summaryJson);
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) {
@@ -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
  }
@@ -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,4BAA4B,CAAC;AAGjE,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"}
@@ -16,6 +16,8 @@ exports.ARGS_TO_MODEL_MAP = {
16
16
  "gemini-2.5": "gemini-2.5-pro-preview-06-05",
17
17
  "gemini-2.5-pro": "gemini-2.5-pro-preview-06-05",
18
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 +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,UAAU,EACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,mBAAmB,EACnB,IAAI,EACJ,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAkBpC,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;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;CAwEnE"}
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"}
@@ -12,6 +12,7 @@ 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 {
@@ -43,6 +44,7 @@ class ToolCallService {
43
44
  commit_and_create_pr_1.createPullRequestTool,
44
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);
@@ -1,4 +1,5 @@
1
1
  import { PendingToolCall, ServicePayload, Tool } from "@empiricalrun/shared-types";
2
+ export declare function appendBranchNameToQueueUrl(queueUrl: string, branchName: string): string;
2
3
  export declare function getQueueUrl(toolCalls: PendingToolCall[], tools: Tool[]): string;
3
4
  export declare function sendToolRequestToRemoteQueue(queueUrl: string, payload: ServicePayload): Promise<void>;
4
5
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tool-call-service/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,cAAc,EACd,IAAI,EACL,MAAM,4BAA4B,CAAC;AAUpC,wBAAgB,WAAW,CACzB,SAAS,EAAE,eAAe,EAAE,EAC5B,KAAK,EAAE,IAAI,EAAE,GACZ,MAAM,CAwBR;AAED,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,cAAc,iBAiBxB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tool-call-service/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,cAAc,EACd,IAAI,EACL,MAAM,4BAA4B,CAAC;AAEpC,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAOR;AAYD,wBAAgB,WAAW,CACzB,SAAS,EAAE,eAAe,EAAE,EAC5B,KAAK,EAAE,IAAI,EAAE,GACZ,MAAM,CAeR;AAED,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,cAAc,iBAiBxB"}
@@ -1,14 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appendBranchNameToQueueUrl = appendBranchNameToQueueUrl;
3
4
  exports.getQueueUrl = getQueueUrl;
4
5
  exports.sendToolRequestToRemoteQueue = sendToolRequestToRemoteQueue;
5
6
  const client_sqs_1 = require("@aws-sdk/client-sqs");
6
- function appendPrefixToQueueUrl(queueUrl, prefix) {
7
- if (!queueUrl || !prefix) {
8
- throw new Error("queueUrl and prefix must be set");
9
- }
7
+ function appendBranchNameToQueueUrl(queueUrl, branchName) {
8
+ const cleanBranchName = branchName.replace(/[/.]/g, "-");
9
+ const suffix = cleanBranchName.slice(0, 50);
10
10
  const parts = queueUrl.split("/");
11
- return `${parts.slice(0, -1).join("/")}/${prefix}-${parts.pop()}`;
11
+ const queueName = parts.pop();
12
+ const queueNameWithoutFifo = queueName?.replace(/\.fifo$/, "");
13
+ return `${parts.join("/")}/${queueNameWithoutFifo}-${suffix}.fifo`;
14
+ }
15
+ function buildQueueUrlsForPreview(baseQueueUrl) {
16
+ const branch = process.env.VERCEL_GIT_COMMIT_REF;
17
+ if (!branch) {
18
+ throw new Error("VERCEL_GIT_COMMIT_REF is not set");
19
+ }
20
+ const queueUrl = appendBranchNameToQueueUrl(baseQueueUrl, branch);
21
+ console.log("queueUrl for preview", queueUrl);
22
+ return queueUrl;
12
23
  }
13
24
  function getQueueUrl(toolCalls, tools) {
14
25
  const needsBrowser = toolCalls.some((toolCall) => tools.find((t) => t.schema.name === toolCall.name)?.needsBrowser);
@@ -18,13 +29,9 @@ function getQueueUrl(toolCalls, tools) {
18
29
  if (process.env.VERCEL_ENV !== "preview") {
19
30
  return baseQueueUrl;
20
31
  }
21
- const branch = process.env.VERCEL_GIT_COMMIT_REF;
22
- if (!branch) {
23
- throw new Error("VERCEL_GIT_COMMIT_REF is not set");
32
+ else {
33
+ return buildQueueUrlsForPreview(baseQueueUrl);
24
34
  }
25
- const queueUrl = appendPrefixToQueueUrl(baseQueueUrl, `gh-branch-${branch.replace(/\//g, "-")}`);
26
- console.log("queueUrl", queueUrl);
27
- return queueUrl;
28
35
  }
29
36
  async function sendToolRequestToRemoteQueue(queueUrl, payload) {
30
37
  const sqs = new client_sqs_1.SQSClient({
@@ -1,9 +1,3 @@
1
1
  import type { Tool } from "@empiricalrun/shared-types";
2
- interface GitHubRepoInfo {
3
- owner: string;
4
- repo: string;
5
- }
6
- export declare function parseGitHubUrl(url: string): GitHubRepoInfo;
7
2
  export declare const createPullRequestTool: Tool;
8
- export {};
9
3
  //# sourceMappingURL=commit-and-create-pr.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commit-and-create-pr.d.ts","sourceRoot":"","sources":["../../src/tools/commit-and-create-pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EAEL,MAAM,4BAA4B,CAAC;AAOpC,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAiB1D;AAiCD,eAAO,MAAM,qBAAqB,EAAE,IAmFnC,CAAC"}
1
+ {"version":3,"file":"commit-and-create-pr.d.ts","sourceRoot":"","sources":["../../src/tools/commit-and-create-pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EAEL,MAAM,4BAA4B,CAAC;AAoCpC,eAAO,MAAM,qBAAqB,EAAE,IAkFnC,CAAC"}
@@ -1,25 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createPullRequestTool = void 0;
4
- exports.parseGitHubUrl = parseGitHubUrl;
5
4
  const child_process_1 = require("child_process");
6
5
  const zod_1 = require("zod");
7
6
  const git_1 = require("../utils/git");
8
7
  const utils_1 = require("./utils");
9
- function parseGitHubUrl(url) {
10
- const githubIndex = url.indexOf("github.com");
11
- if (githubIndex === -1) {
12
- throw new Error("Invalid GitHub repository URL");
13
- }
14
- const [owner, repo] = url
15
- .substring(githubIndex + "github.com/".length)
16
- .replace(".git", "")
17
- .split("/");
18
- if (!owner || !repo) {
19
- throw new Error("Invalid GitHub repository URL format - missing owner or repo");
20
- }
21
- return { owner, repo };
22
- }
23
8
  const createPullRequestSchema = zod_1.z.object({
24
9
  pullRequestTitle: zod_1.z
25
10
  .string()
@@ -61,25 +46,22 @@ Don't ask the user for this information, just come up with it yourself.
61
46
  })
62
47
  .toString()
63
48
  .trim();
64
- const { owner, repo } = parseGitHubUrl(repoUrl);
65
- const existingPRs = (await (0, utils_1.callGitHubProxy)({
66
- method: "GET",
67
- url: `https://api.github.com/repos/${owner}/${repo}/pulls`,
68
- body: {
69
- head: `${owner}:${branchName}`,
70
- state: "open",
71
- },
72
- apiKey,
73
- }));
49
+ const { owner, repo } = (0, utils_1.parseGitHubUrl)(repoUrl);
74
50
  (0, child_process_1.execSync)(`git push origin ${branchName} --set-upstream`, {
75
51
  cwd: repoPath,
76
52
  });
77
- const existingPR = existingPRs?.find((pr) => pr.head.ref === branchName);
53
+ const existingPR = await (0, utils_1.findExistingPR)({
54
+ owner,
55
+ repo,
56
+ branchName,
57
+ apiKey,
58
+ });
78
59
  if (existingPR) {
79
- await (0, utils_1.callGitHubProxy)({
80
- method: "PATCH",
81
- url: `https://api.github.com/repos/${owner}/${repo}/pulls/${existingPR.number}`,
82
- body: { body: descriptionWithTimestamp(pullRequestDescription) },
60
+ await (0, utils_1.updatePullRequest)({
61
+ owner,
62
+ repo,
63
+ prNumber: existingPR.number,
64
+ body: descriptionWithTimestamp(pullRequestDescription),
83
65
  apiKey,
84
66
  });
85
67
  return {
@@ -87,17 +69,15 @@ Don't ask the user for this information, just come up with it yourself.
87
69
  result: `Committed and pushed changes to existing PR: ${existingPR.html_url}`,
88
70
  };
89
71
  }
90
- const pr = (await (0, utils_1.callGitHubProxy)({
91
- method: "POST",
92
- url: `https://api.github.com/repos/${owner}/${repo}/pulls`,
93
- body: {
94
- title: pullRequestTitle,
95
- head: branchName,
96
- base: "main",
97
- body: descriptionWithTimestamp(pullRequestDescription),
98
- },
72
+ const pr = await (0, utils_1.createPullRequest)({
73
+ owner,
74
+ repo,
75
+ title: pullRequestTitle,
76
+ head: branchName,
77
+ base: "main",
78
+ body: descriptionWithTimestamp(pullRequestDescription),
99
79
  apiKey,
100
- }));
80
+ });
101
81
  return {
102
82
  isError: false,
103
83
  result: `Committed and pushed changes to new PR: ${pr.html_url}`,
@@ -1,4 +1,4 @@
1
- import type { Tool, ToolResult } from "@empiricalrun/shared-types";
1
+ import type { CollectArtifacts, Tool, ToolResult } from "@empiricalrun/shared-types";
2
2
  interface StrReplaceInput {
3
3
  command: string;
4
4
  path: string;
@@ -12,9 +12,10 @@ interface StrReplaceInput {
12
12
  * Our implementation of Claude's built-in text editor tool
13
13
  * https://docs.anthropic.com/en/docs/build-with-claude/tool-use/text-editor-tool
14
14
  */
15
- export declare function strReplaceEditorExecutor({ input, repoPath, }: {
15
+ export declare function strReplaceEditorExecutor({ input, repoPath, collectArtifacts, }: {
16
16
  input: StrReplaceInput;
17
17
  repoPath: string;
18
+ collectArtifacts?: CollectArtifacts;
18
19
  }): Promise<ToolResult>;
19
20
  export declare const textEditorTools: Tool[];
20
21
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"str_replace_editor.d.ts","sourceRoot":"","sources":["../../src/tools/str_replace_editor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAe,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAOhF,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA6UD;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,UAAU,CAAC,CA2CtB;AAkID,eAAO,MAAM,eAAe,EAAE,IAAI,EAKjC,CAAC"}
1
+ {"version":3,"file":"str_replace_editor.d.ts","sourceRoot":"","sources":["../../src/tools/str_replace_editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,gBAAgB,EAChB,IAAI,EAEJ,UAAU,EACX,MAAM,4BAA4B,CAAC;AAsCpC,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAiWD;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,KAAK,EACL,QAAQ,EACR,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,OAAO,CAAC,UAAU,CAAC,CA8CtB;AAqID,eAAO,MAAM,eAAe,EAAE,IAAI,EAKjC,CAAC"}
@@ -9,6 +9,31 @@ const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const zod_1 = require("zod");
11
11
  const web_1 = require("../bin/utils/platform/web");
12
+ const git_1 = require("../utils/git");
13
+ /**
14
+ * Helper function to collect git patch artifacts for file modifications
15
+ */
16
+ async function collectGitPatchArtifact(filePath, repoDir, operation, collectArtifacts) {
17
+ if (!collectArtifacts)
18
+ return;
19
+ try {
20
+ const gitPatch = operation === "create"
21
+ ? (0, git_1.getGitDiffForNewFile)(filePath, repoDir)
22
+ : (0, git_1.getGitDiff)(filePath, repoDir);
23
+ if (gitPatch.trim()) {
24
+ const patchArtifact = {
25
+ name: `${path_1.default.basename(filePath, path_1.default.extname(filePath))}_${operation}.patch`,
26
+ contentType: "text/plain",
27
+ data: Buffer.from(gitPatch, "utf-8"),
28
+ };
29
+ collectArtifacts([patchArtifact]);
30
+ }
31
+ }
32
+ catch (error) {
33
+ // Ignore git diff errors, don't fail the operation
34
+ console.warn(`Failed to generate git patch for ${filePath}:`, error);
35
+ }
36
+ }
12
37
  /**
13
38
  * While running str_replace command, we've seen LLM can struggle to send unique old_str.
14
39
  * This function tries to find unique contexts for each occurrence of old_str, so that the error
@@ -115,7 +140,7 @@ async function fileViewExecutor({ input, filePath, absoluteFilePath, }) {
115
140
  isError: false,
116
141
  };
117
142
  }
118
- async function fileCreateExecutor({ input, filePath, absoluteFilePath, repoDir, }) {
143
+ async function fileCreateExecutor({ input, filePath, absoluteFilePath, repoDir, collectArtifacts, }) {
119
144
  if (input.file_text === undefined || input.file_text === null) {
120
145
  return {
121
146
  result: "Error: file_text is required for create command",
@@ -149,6 +174,8 @@ the required directories recursively for the new file.`,
149
174
  fs_1.default.mkdirSync(parentDir, { recursive: true });
150
175
  }
151
176
  fs_1.default.writeFileSync(absoluteFilePath, input.file_text);
177
+ // Collect git patch artifact
178
+ await collectGitPatchArtifact(filePath, repoDir, "create", collectArtifacts);
152
179
  let createTypescriptResult = await (0, web_1.runTypescriptCompiler)(repoDir);
153
180
  if (!createTypescriptResult.success) {
154
181
  return {
@@ -163,7 +190,7 @@ the required directories recursively for the new file.`,
163
190
  };
164
191
  }
165
192
  }
166
- async function fileStrReplaceExecutor({ input, filePath, absoluteFilePath, repoDir, }) {
193
+ async function fileStrReplaceExecutor({ input, filePath, absoluteFilePath, repoDir, collectArtifacts, }) {
167
194
  if (!fs_1.default.existsSync(absoluteFilePath)) {
168
195
  return {
169
196
  result: `Error: File ${filePath} not found. Please provide relative file path to the Repository.`,
@@ -216,6 +243,8 @@ async function fileStrReplaceExecutor({ input, filePath, absoluteFilePath, repoD
216
243
  }
217
244
  const newContent = normalizedContent.replace(normalizedOldStr, input.new_str);
218
245
  fs_1.default.writeFileSync(absoluteFilePath, newContent);
246
+ // Collect git patch artifact
247
+ await collectGitPatchArtifact(filePath, repoDir, "replace", collectArtifacts);
219
248
  let strReplaceTypescriptResult = await (0, web_1.runTypescriptCompiler)(repoDir);
220
249
  if (!strReplaceTypescriptResult.success) {
221
250
  return {
@@ -231,7 +260,7 @@ async function fileStrReplaceExecutor({ input, filePath, absoluteFilePath, repoD
231
260
  }
232
261
  }
233
262
  }
234
- async function fileInsertExecutor({ input, filePath, absoluteFilePath, repoDir, }) {
263
+ async function fileInsertExecutor({ input, filePath, absoluteFilePath, repoDir, collectArtifacts, }) {
235
264
  if (!fs_1.default.existsSync(absoluteFilePath)) {
236
265
  return {
237
266
  result: `Error: File ${filePath} not found. Please provide relative file path to the Repository.`,
@@ -260,6 +289,8 @@ async function fileInsertExecutor({ input, filePath, absoluteFilePath, repoDir,
260
289
  }
261
290
  lines.splice(input.insert_line - 1, 0, input.new_str);
262
291
  fs_1.default.writeFileSync(absoluteFilePath, lines.join("\n"));
292
+ // Collect git patch artifact
293
+ await collectGitPatchArtifact(filePath, repoDir, "insert", collectArtifacts);
263
294
  let insertTypescriptResult = await (0, web_1.runTypescriptCompiler)(repoDir);
264
295
  if (!insertTypescriptResult.success) {
265
296
  return {
@@ -278,7 +309,7 @@ async function fileInsertExecutor({ input, filePath, absoluteFilePath, repoDir,
278
309
  * Our implementation of Claude's built-in text editor tool
279
310
  * https://docs.anthropic.com/en/docs/build-with-claude/tool-use/text-editor-tool
280
311
  */
281
- async function strReplaceEditorExecutor({ input, repoPath, }) {
312
+ async function strReplaceEditorExecutor({ input, repoPath, collectArtifacts, }) {
282
313
  const repoDir = repoPath;
283
314
  const { path: filePath } = input;
284
315
  const absoluteFilePath = path_1.default.join(repoDir, filePath);
@@ -292,6 +323,7 @@ async function strReplaceEditorExecutor({ input, repoPath, }) {
292
323
  filePath,
293
324
  absoluteFilePath,
294
325
  repoDir,
326
+ collectArtifacts,
295
327
  });
296
328
  case "str_replace":
297
329
  return fileStrReplaceExecutor({
@@ -299,6 +331,7 @@ async function strReplaceEditorExecutor({ input, repoPath, }) {
299
331
  filePath,
300
332
  absoluteFilePath,
301
333
  repoDir,
334
+ collectArtifacts,
302
335
  });
303
336
  case "insert":
304
337
  return fileInsertExecutor({
@@ -306,6 +339,7 @@ async function strReplaceEditorExecutor({ input, repoPath, }) {
306
339
  filePath,
307
340
  absoluteFilePath,
308
341
  repoDir,
342
+ collectArtifacts,
309
343
  });
310
344
  case "undo_edit":
311
345
  return {
@@ -368,7 +402,7 @@ directories "tests", "tests/example", and "tests/example/foo.spec.ts".`,
368
402
  needsBrowser: false,
369
403
  execute: async (params) => {
370
404
  const { input } = params;
371
- const { repoPath } = params;
405
+ const { repoPath, collectArtifacts } = params;
372
406
  return strReplaceEditorExecutor({
373
407
  input: {
374
408
  command: "create",
@@ -376,6 +410,7 @@ directories "tests", "tests/example", and "tests/example/foo.spec.ts".`,
376
410
  file_text: input.file_text,
377
411
  },
378
412
  repoPath,
413
+ collectArtifacts,
379
414
  });
380
415
  },
381
416
  };
@@ -393,7 +428,7 @@ in the file. If old_str is not unique, the tool will return an error.`,
393
428
  needsBrowser: false,
394
429
  execute: async (params) => {
395
430
  const { input } = params;
396
- const { repoPath } = params;
431
+ const { repoPath, collectArtifacts } = params;
397
432
  return strReplaceEditorExecutor({
398
433
  input: {
399
434
  command: "str_replace",
@@ -402,6 +437,7 @@ in the file. If old_str is not unique, the tool will return an error.`,
402
437
  new_str: input.new_str,
403
438
  },
404
439
  repoPath,
440
+ collectArtifacts,
405
441
  });
406
442
  },
407
443
  };
@@ -424,7 +460,7 @@ To insert a string at the end of the file, you should use insert_line = (total l
424
460
  needsBrowser: false,
425
461
  execute: async (params) => {
426
462
  const { input } = params;
427
- const { repoPath } = params;
463
+ const { repoPath, collectArtifacts } = params;
428
464
  return strReplaceEditorExecutor({
429
465
  input: {
430
466
  command: "insert",
@@ -433,6 +469,7 @@ To insert a string at the end of the file, you should use insert_line = (total l
433
469
  new_str: input.new_str,
434
470
  },
435
471
  repoPath,
472
+ collectArtifacts,
436
473
  });
437
474
  },
438
475
  };
@@ -1 +1 @@
1
- {"version":3,"file":"test-gen-browser.d.ts","sourceRoot":"","sources":["../../src/tools/test-gen-browser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,IAAI,EAGL,MAAM,4BAA4B,CAAC;AAoGpC,eAAO,MAAM,4BAA4B,EAAE,IA2L1C,CAAC"}
1
+ {"version":3,"file":"test-gen-browser.d.ts","sourceRoot":"","sources":["../../src/tools/test-gen-browser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,IAAI,EAGL,MAAM,4BAA4B,CAAC;AAoGpC,eAAO,MAAM,4BAA4B,EAAE,IAoM1C,CAAC"}
@@ -160,6 +160,14 @@ exports.generateTestWithBrowserAgent = {
160
160
  BUILD_URL: input.buildUrl,
161
161
  };
162
162
  }
163
+ if (featureFlags.includes("headed_codegen_in_browser_agent")) {
164
+ // Running browser agent in headed implies using page.pause method for codegen
165
+ // which improves codegen quality when script injection fails (iframes, etc.)
166
+ envOverrides = {
167
+ ...envOverrides,
168
+ RUN_PLAYWRIGHT_HEADED: "true",
169
+ };
170
+ }
163
171
  const testGenToken = (0, scenarios_1.buildTokenFromOptions)({ name: testName, file: filePath, prompt: input.changeToMake }, { useComputerUseAgent: true });
164
172
  console.log("[generateTestWithBrowserAgent] Validations passed, starting agent");
165
173
  const agentResult = await (0, run_1.runBrowsingAgent)({
@@ -0,0 +1,3 @@
1
+ import type { Tool } from "@empiricalrun/shared-types";
2
+ export declare const upgradePackagesTool: Tool;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/upgrade-packages/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AA+BvD,eAAO,MAAM,mBAAmB,EAAE,IA+GjC,CAAC"}