@empiricalrun/test-gen 0.76.0 → 0.78.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 (237) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/agent/base/index.d.ts +25 -21
  3. package/dist/agent/base/index.d.ts.map +1 -1
  4. package/dist/agent/base/index.js +50 -37
  5. package/dist/agent/browsing/run.d.ts +1 -2
  6. package/dist/agent/browsing/run.d.ts.map +1 -1
  7. package/dist/agent/browsing/run.js +3 -9
  8. package/dist/agent/browsing/utils.d.ts +2 -9
  9. package/dist/agent/browsing/utils.d.ts.map +1 -1
  10. package/dist/agent/browsing/utils.js +5 -109
  11. package/dist/agent/chat/agent-loop.d.ts +5 -5
  12. package/dist/agent/chat/agent-loop.d.ts.map +1 -1
  13. package/dist/agent/chat/agent-loop.js +3 -8
  14. package/dist/agent/chat/exports.d.ts +6 -5
  15. package/dist/agent/chat/exports.d.ts.map +1 -1
  16. package/dist/agent/chat/exports.js +4 -9
  17. package/dist/agent/chat/index.d.ts +2 -2
  18. package/dist/agent/chat/index.d.ts.map +1 -1
  19. package/dist/agent/chat/index.js +23 -35
  20. package/dist/agent/chat/models.d.ts +0 -2
  21. package/dist/agent/chat/models.d.ts.map +1 -1
  22. package/dist/agent/chat/models.js +12 -26
  23. package/dist/agent/chat/prompt/pw-utils-docs.d.ts +1 -1
  24. package/dist/agent/chat/prompt/pw-utils-docs.d.ts.map +1 -1
  25. package/dist/agent/chat/prompt/pw-utils-docs.js +52 -0
  26. package/dist/agent/chat/prompt/repo.d.ts.map +1 -1
  27. package/dist/agent/chat/prompt/repo.js +11 -22
  28. package/dist/agent/chat/prompt/test-case-def.d.ts +2 -0
  29. package/dist/agent/chat/prompt/test-case-def.d.ts.map +1 -0
  30. package/dist/agent/chat/prompt/test-case-def.js +44 -0
  31. package/dist/agent/chat/state.d.ts +8 -14
  32. package/dist/agent/chat/state.d.ts.map +1 -1
  33. package/dist/agent/chat/state.js +15 -60
  34. package/dist/agent/chat/utils.d.ts +2 -2
  35. package/dist/agent/chat/utils.d.ts.map +1 -1
  36. package/dist/agent/chat/utils.js +14 -7
  37. package/dist/agent/cli.d.ts.map +1 -1
  38. package/dist/agent/cli.js +49 -58
  39. package/dist/agent/code-review/executor/index.d.ts +5 -0
  40. package/dist/agent/code-review/executor/index.d.ts.map +1 -0
  41. package/dist/agent/code-review/executor/index.js +13 -0
  42. package/dist/agent/code-review/index.d.ts +8 -3
  43. package/dist/agent/code-review/index.d.ts.map +1 -1
  44. package/dist/agent/code-review/index.js +118 -21
  45. package/dist/agent/code-review/parser.d.ts +5 -0
  46. package/dist/agent/code-review/parser.d.ts.map +1 -0
  47. package/dist/agent/code-review/parser.js +70 -0
  48. package/dist/agent/code-review/types.d.ts +36 -0
  49. package/dist/agent/code-review/types.d.ts.map +1 -0
  50. package/dist/agent/code-review/types.js +13 -0
  51. package/dist/agent/cua/index.d.ts.map +1 -1
  52. package/dist/agent/cua/index.js +18 -2
  53. package/dist/agent/cua/model.d.ts.map +1 -1
  54. package/dist/agent/cua/model.js +4 -1
  55. package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -1
  56. package/dist/agent/triage/index.d.ts +3 -3
  57. package/dist/agent/triage/index.d.ts.map +1 -1
  58. package/dist/agent/triage/index.js +16 -20
  59. package/dist/agent/video-analysis/executor/index.d.ts +5 -0
  60. package/dist/agent/video-analysis/executor/index.d.ts.map +1 -0
  61. package/dist/agent/video-analysis/executor/index.js +10 -0
  62. package/dist/agent/video-analysis/index.d.ts +2 -2
  63. package/dist/agent/video-analysis/index.d.ts.map +1 -1
  64. package/dist/agent/video-analysis/index.js +38 -13
  65. package/dist/artifacts/index.d.ts +1 -1
  66. package/dist/artifacts/index.d.ts.map +1 -1
  67. package/dist/artifacts/index.js +3 -1
  68. package/dist/artifacts/utils.d.ts.map +1 -1
  69. package/dist/bin/index.js +11 -21
  70. package/dist/constants/index.d.ts +14 -0
  71. package/dist/constants/index.d.ts.map +1 -1
  72. package/dist/constants/index.js +33 -1
  73. package/dist/file/server.d.ts +1 -3
  74. package/dist/file/server.d.ts.map +1 -1
  75. package/dist/file/server.js +0 -13
  76. package/dist/file-info/adapters/file-system/index.d.ts.map +1 -1
  77. package/dist/file-info/adapters/file-system/reader.d.ts.map +1 -1
  78. package/dist/file-info/adapters/file-system/reader.js +8 -1
  79. package/dist/file-info/adapters/github/index.d.ts.map +1 -1
  80. package/dist/file-info/adapters/github/reader.d.ts +1 -1
  81. package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
  82. package/dist/file-info/adapters/github/reader.js +8 -5
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/tools/analyse-video/index.d.ts +5 -0
  85. package/dist/tools/analyse-video/index.d.ts.map +1 -0
  86. package/dist/tools/analyse-video/index.js +56 -0
  87. package/dist/tools/create-pull-request/index.js +4 -6
  88. package/dist/tools/create-pull-request/utils.d.ts +1 -1
  89. package/dist/tools/definitions/{fetch-video-analysis.d.ts → analyse-video.d.ts} +17 -12
  90. package/dist/tools/definitions/analyse-video.d.ts.map +1 -0
  91. package/dist/tools/definitions/analyse-video.js +60 -0
  92. package/dist/tools/definitions/review-pull-request.d.ts +3 -0
  93. package/dist/tools/definitions/review-pull-request.d.ts.map +1 -0
  94. package/dist/tools/definitions/review-pull-request.js +16 -0
  95. package/dist/tools/definitions/str_replace_editor.d.ts +1 -0
  96. package/dist/tools/definitions/str_replace_editor.d.ts.map +1 -1
  97. package/dist/tools/definitions/str_replace_editor.js +4 -1
  98. package/dist/tools/definitions/test-gen-browser.d.ts +0 -3
  99. package/dist/tools/definitions/test-gen-browser.d.ts.map +1 -1
  100. package/dist/tools/definitions/test-gen-browser.js +33 -8
  101. package/dist/tools/delete-file/index.d.ts.map +1 -1
  102. package/dist/tools/delete-file/index.js +1 -19
  103. package/dist/tools/executor/base.d.ts +32 -0
  104. package/dist/tools/executor/base.d.ts.map +1 -0
  105. package/dist/tools/executor/base.js +131 -0
  106. package/dist/tools/executor/index.d.ts +3 -22
  107. package/dist/tools/executor/index.d.ts.map +1 -1
  108. package/dist/tools/executor/index.js +7 -100
  109. package/dist/tools/executor/utils/checkpoint.d.ts +1 -1
  110. package/dist/tools/executor/utils/checkpoint.d.ts.map +1 -1
  111. package/dist/tools/executor/utils/checkpoint.js +6 -2
  112. package/dist/tools/executor/utils/git.d.ts +2 -2
  113. package/dist/tools/executor/utils/git.d.ts.map +1 -1
  114. package/dist/tools/executor/utils/git.js +7 -3
  115. package/dist/tools/executor/utils/index.d.ts +5 -3
  116. package/dist/tools/executor/utils/index.d.ts.map +1 -1
  117. package/dist/tools/executor/utils/index.js +23 -2
  118. package/dist/tools/fetch-session-diff/index.js +2 -2
  119. package/dist/tools/file-operations/create.d.ts.map +1 -1
  120. package/dist/tools/file-operations/create.js +1 -4
  121. package/dist/tools/file-operations/index.d.ts +2 -1
  122. package/dist/tools/file-operations/index.d.ts.map +1 -1
  123. package/dist/tools/file-operations/index.js +4 -1
  124. package/dist/tools/file-operations/insert.d.ts +1 -2
  125. package/dist/tools/file-operations/insert.d.ts.map +1 -1
  126. package/dist/tools/file-operations/insert.js +1 -4
  127. package/dist/tools/file-operations/replace.d.ts.map +1 -1
  128. package/dist/tools/file-operations/replace.js +21 -25
  129. package/dist/tools/file-operations/shared/helpers.d.ts +3 -5
  130. package/dist/tools/file-operations/shared/helpers.d.ts.map +1 -1
  131. package/dist/tools/file-operations/shared/helpers.js +1 -5
  132. package/dist/tools/grep/index.d.ts.map +1 -1
  133. package/dist/tools/grep/index.js +18 -11
  134. package/dist/tools/index.d.ts +5 -5
  135. package/dist/tools/index.d.ts.map +1 -1
  136. package/dist/tools/index.js +17 -16
  137. package/dist/tools/merge-conflicts/index.d.ts.map +1 -1
  138. package/dist/tools/merge-conflicts/index.js +1 -1
  139. package/dist/tools/rename-file/index.js +1 -1
  140. package/dist/tools/review-pull-request/index.d.ts.map +1 -1
  141. package/dist/tools/review-pull-request/index.js +44 -65
  142. package/dist/tools/run-test.d.ts.map +1 -1
  143. package/dist/tools/run-test.js +25 -3
  144. package/dist/tools/test-gen-browser.d.ts.map +1 -1
  145. package/dist/tools/test-gen-browser.js +51 -47
  146. package/dist/tools/upgrade-packages/index.d.ts.map +1 -1
  147. package/dist/tools/upgrade-packages/index.js +4 -0
  148. package/dist/tools/upgrade-packages/utils.d.ts +1 -0
  149. package/dist/tools/upgrade-packages/utils.d.ts.map +1 -1
  150. package/dist/tools/upgrade-packages/utils.js +1 -0
  151. package/dist/trace-utils/index.d.ts +1 -1
  152. package/dist/trace-utils/index.d.ts.map +1 -1
  153. package/dist/trace-utils/index.js +1 -1
  154. package/dist/utils/dedup/dedup-image.d.ts +22 -0
  155. package/dist/utils/dedup/dedup-image.d.ts.map +1 -0
  156. package/dist/utils/dedup/dedup-image.js +26 -0
  157. package/dist/utils/dedup/find-threshold.d.ts +2 -0
  158. package/dist/utils/dedup/find-threshold.d.ts.map +1 -0
  159. package/dist/utils/dedup/find-threshold.js +42 -0
  160. package/dist/utils/hash.d.ts +2 -0
  161. package/dist/utils/hash.d.ts.map +1 -0
  162. package/dist/utils/hash.js +24 -0
  163. package/dist/utils/model.d.ts +1 -1
  164. package/dist/utils/model.d.ts.map +1 -1
  165. package/dist/utils/model.js +7 -5
  166. package/dist/utils/repo-tree.d.ts +0 -1
  167. package/dist/utils/repo-tree.d.ts.map +1 -1
  168. package/dist/utils/repo-tree.js +2 -14
  169. package/dist/utils/slug.js +1 -1
  170. package/dist/video-core/agent-orchestrator.d.ts +13 -0
  171. package/dist/video-core/agent-orchestrator.d.ts.map +1 -0
  172. package/dist/video-core/agent-orchestrator.js +59 -0
  173. package/dist/video-core/index.d.ts +39 -0
  174. package/dist/video-core/index.d.ts.map +1 -0
  175. package/dist/video-core/index.js +134 -0
  176. package/dist/video-core/model-limits.d.ts +4 -0
  177. package/dist/video-core/model-limits.d.ts.map +1 -0
  178. package/dist/video-core/model-limits.js +73 -0
  179. package/dist/video-core/storage-manager.d.ts +5 -0
  180. package/dist/video-core/storage-manager.d.ts.map +1 -0
  181. package/dist/video-core/storage-manager.js +62 -0
  182. package/dist/video-core/types.d.ts +13 -0
  183. package/dist/video-core/types.d.ts.map +1 -0
  184. package/dist/video-core/types.js +2 -0
  185. package/dist/video-core/utils.d.ts +15 -0
  186. package/dist/video-core/utils.d.ts.map +1 -0
  187. package/dist/video-core/utils.js +194 -0
  188. package/dist/video-core/xml-parser.d.ts +3 -0
  189. package/dist/video-core/xml-parser.d.ts.map +1 -0
  190. package/dist/video-core/xml-parser.js +27 -0
  191. package/package.json +6 -6
  192. package/tsconfig.tsbuildinfo +1 -1
  193. package/dist/agent/chat/prompt/index.d.ts +0 -6
  194. package/dist/agent/chat/prompt/index.d.ts.map +0 -1
  195. package/dist/agent/chat/prompt/index.js +0 -200
  196. package/dist/agent/code-review/prompt.d.ts +0 -2
  197. package/dist/agent/code-review/prompt.d.ts.map +0 -1
  198. package/dist/agent/code-review/prompt.js +0 -55
  199. package/dist/agent/diagnosis-agent/index.d.ts +0 -11
  200. package/dist/agent/diagnosis-agent/index.d.ts.map +0 -1
  201. package/dist/agent/diagnosis-agent/index.js +0 -88
  202. package/dist/agent/diagnosis-agent/strict-mode-violation.d.ts +0 -10
  203. package/dist/agent/diagnosis-agent/strict-mode-violation.d.ts.map +0 -1
  204. package/dist/agent/diagnosis-agent/strict-mode-violation.js +0 -30
  205. package/dist/tools/definitions/extract-frames-from-video.d.ts +0 -39
  206. package/dist/tools/definitions/extract-frames-from-video.d.ts.map +0 -1
  207. package/dist/tools/definitions/extract-frames-from-video.js +0 -60
  208. package/dist/tools/definitions/fetch-video-analysis.d.ts.map +0 -1
  209. package/dist/tools/definitions/fetch-video-analysis.js +0 -61
  210. package/dist/tools/extract-frames-from-video/index.d.ts +0 -7
  211. package/dist/tools/extract-frames-from-video/index.d.ts.map +0 -1
  212. package/dist/tools/extract-frames-from-video/index.js +0 -145
  213. package/dist/tools/fetch-video-analysis/index.d.ts +0 -5
  214. package/dist/tools/fetch-video-analysis/index.d.ts.map +0 -1
  215. package/dist/tools/fetch-video-analysis/index.js +0 -149
  216. package/dist/tools/fetch-video-analysis/open-ai.d.ts +0 -6
  217. package/dist/tools/fetch-video-analysis/open-ai.d.ts.map +0 -1
  218. package/dist/tools/fetch-video-analysis/open-ai.js +0 -37
  219. package/dist/tools/fetch-video-analysis/utils.d.ts +0 -16
  220. package/dist/tools/fetch-video-analysis/utils.d.ts.map +0 -1
  221. package/dist/tools/fetch-video-analysis/utils.js +0 -121
  222. package/dist/tools/fetch-video-analysis/video-analysis.d.ts +0 -7
  223. package/dist/tools/fetch-video-analysis/video-analysis.d.ts.map +0 -1
  224. package/dist/tools/fetch-video-analysis/video-analysis.js +0 -70
  225. package/dist/tools/file-operations/shared/git-helper.d.ts +0 -4
  226. package/dist/tools/file-operations/shared/git-helper.d.ts.map +0 -1
  227. package/dist/tools/file-operations/shared/git-helper.js +0 -29
  228. package/dist/utils/dedup-image-fs.d.ts +0 -27
  229. package/dist/utils/dedup-image-fs.d.ts.map +0 -1
  230. package/dist/utils/dedup-image-fs.js +0 -88
  231. package/dist/utils/dedup-image.d.ts +0 -25
  232. package/dist/utils/dedup-image.d.ts.map +0 -1
  233. package/dist/utils/dedup-image.js +0 -80
  234. package/dist/utils/local-ffmpeg-client.d.ts +0 -27
  235. package/dist/utils/local-ffmpeg-client.d.ts.map +0 -1
  236. package/dist/utils/local-ffmpeg-client.js +0 -299
  237. package/eslint.config.mjs +0 -43
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ToolExecutor = void 0;
4
- const artifacts_1 = require("../../artifacts");
5
- const file_1 = require("../../utils/file");
4
+ const analyse_video_1 = require("../analyse-video");
6
5
  const create_pull_request_1 = require("../create-pull-request");
7
6
  const delete_file_1 = require("../delete-file");
8
7
  const diagnosis_fetcher_1 = require("../diagnosis-fetcher");
9
8
  const download_build_1 = require("../download-build");
10
- const extract_frames_from_video_1 = require("../extract-frames-from-video");
11
9
  const fetch_file_1 = require("../fetch-file");
12
10
  const fetch_last_successful_test_run_1 = require("../fetch-last-successful-test-run");
13
11
  const fetch_session_diff_1 = require("../fetch-session-diff");
14
- const fetch_video_analysis_1 = require("../fetch-video-analysis");
15
12
  const file_operations_1 = require("../file-operations");
16
13
  const grep_1 = require("../grep");
17
14
  const issues_1 = require("../issues");
@@ -27,24 +24,9 @@ const trace_dot_zip_1 = require("../trace-dot-zip");
27
24
  const triage_summary_1 = require("../triage-summary");
28
25
  const upgrade_packages_1 = require("../upgrade-packages");
29
26
  const view_failed_test_run_report_1 = require("../view-failed-test-run-report");
30
- const checkpoint_1 = require("./utils/checkpoint");
31
- class ToolExecutor {
32
- toolExecutors = {};
33
- chatSession;
34
- branchName;
35
- repoPath;
36
- apiClient;
37
- trace;
38
- featureFlags;
39
- environmentOverrides;
40
- constructor({ chatSession, branchName, repoPath, apiClient, trace, featureFlags, environmentOverrides = {}, }) {
41
- this.chatSession = chatSession;
42
- this.branchName = branchName;
43
- this.trace = trace;
44
- this.repoPath = repoPath;
45
- this.apiClient = apiClient;
46
- this.featureFlags = featureFlags;
47
- this.environmentOverrides = environmentOverrides;
27
+ const base_1 = require("./base");
28
+ class ToolExecutor extends base_1.BaseToolExecutor {
29
+ constructor(params) {
48
30
  // Found for "Tool Executor Tools List" and add any new tools to the list
49
31
  const tools = [
50
32
  grep_1.grepTool,
@@ -60,7 +42,7 @@ class ToolExecutor {
60
42
  download_build_1.downloadBuildTool,
61
43
  upgrade_packages_1.upgradePackagesTool,
62
44
  fetch_file_1.fetchFileTool,
63
- fetch_video_analysis_1.fetchVideoAnalysis,
45
+ analyse_video_1.analyseVideo,
64
46
  delete_file_1.deleteFileTool,
65
47
  rename_file_1.renameFileTool,
66
48
  trace_dot_zip_1.traceDotZipTool,
@@ -69,87 +51,12 @@ class ToolExecutor {
69
51
  fetch_last_successful_test_run_1.fetchLastSuccessfulTestRunTool,
70
52
  triage_summary_1.sendTriageSummaryTool,
71
53
  list_tests_and_projects_1.listProjectsTool,
72
- extract_frames_from_video_1.extractFramesFromVideo,
73
54
  fetch_session_diff_1.fetchSessionDiffTool,
74
55
  review_pull_request_1.reviewPullRequestTool,
56
+ list_tests_and_projects_1.listTestsForProjectTool,
75
57
  ...file_operations_1.textEditorTools,
76
58
  ];
77
- tools.forEach((tool) => {
78
- this.toolExecutors[tool.schema.name] = tool.execute;
79
- });
80
- this.toolExecutors = {
81
- ...this.toolExecutors,
82
- // Support for Claude 3x and 4: They use different tool names
83
- str_replace_editor: file_operations_1.strReplaceEditorExecutor,
84
- str_replace_based_edit_tool: file_operations_1.strReplaceEditorExecutor,
85
- };
86
- }
87
- async execute(toolCalls) {
88
- const executeSpan = this.trace?.span({
89
- name: "execute_tools",
90
- input: { toolCalls: toolCalls.map((tc) => ({ name: tc.name })) },
91
- });
92
- const toolResults = [];
93
- for (const toolCall of toolCalls) {
94
- const span = executeSpan?.span({
95
- name: `tool: ${toolCall.name}`,
96
- input: toolCall.input,
97
- });
98
- const uploadArtifactsQueue = new artifacts_1.UploadArtifactsQueue(this.repoPath, toolCall.id);
99
- const collectArtifactsFn = (artifactsInput, cleanUpDir) => {
100
- uploadArtifactsQueue
101
- .addTask(artifactsInput)
102
- .then(() => {
103
- if (cleanUpDir) {
104
- void (0, file_1.safeCleanupDirectory)(cleanUpDir);
105
- }
106
- })
107
- .catch((error) => {
108
- console.error("Error collecting artifacts:", error);
109
- });
110
- };
111
- const toolExecutor = this.toolExecutors[toolCall.name];
112
- if (!toolExecutor) {
113
- const errorResult = {
114
- isError: true,
115
- result: `Invalid function/tool call: ${toolCall.name} not found`,
116
- artifacts: null,
117
- };
118
- toolResults.push(errorResult);
119
- span?.end({ output: errorResult });
120
- continue;
121
- }
122
- try {
123
- const result = await toolExecutor({
124
- input: toolCall.input,
125
- repoPath: this.repoPath,
126
- apiClient: this.apiClient,
127
- trace: this.trace,
128
- chatSession: this.chatSession,
129
- collectArtifacts: collectArtifactsFn,
130
- environmentOverrides: this.environmentOverrides,
131
- featureFlags: this.featureFlags,
132
- });
133
- const artifacts = await uploadArtifactsQueue.waitForCompletion();
134
- toolResults.push({ ...result, artifacts });
135
- span?.end({ output: result });
136
- }
137
- catch (error) {
138
- const errorResult = {
139
- isError: true,
140
- result: error instanceof Error ? error.message : String(error),
141
- artifacts: null,
142
- };
143
- toolResults.push(errorResult);
144
- span?.end({ output: errorResult });
145
- }
146
- }
147
- (0, checkpoint_1.createCommitCheckpoint)({
148
- branchName: this.branchName,
149
- repoPath: this.repoPath,
150
- });
151
- executeSpan?.end({ output: { toolResults } });
152
- return toolResults;
59
+ super({ ...params, tools });
153
60
  }
154
61
  }
155
62
  exports.ToolExecutor = ToolExecutor;
@@ -1,5 +1,5 @@
1
1
  export declare function createCommitCheckpoint({ branchName, repoPath, }: {
2
2
  branchName: string;
3
3
  repoPath: string;
4
- }): void;
4
+ }): string | null;
5
5
  //# sourceMappingURL=checkpoint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/checkpoint.ts"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,CAAC,EACrC,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,QAsBA"}
1
+ {"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/checkpoint.ts"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,CAAC,EACrC,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,GAAG,IAAI,CA2BhB"}
@@ -20,7 +20,11 @@ function createCommitCheckpoint({ branchName, repoPath, }) {
20
20
  });
21
21
  const commitMessage = commitMessages.join(", ");
22
22
  // Files are already staged by individual tools, just commit
23
- (0, git_1.commitAsBotUser)(commitMessage, repoPath);
24
- (0, child_process_1.execSync)(`git push origin ${branchName}`, { cwd: repoPath });
23
+ const commitSha = (0, git_1.commitAsBotUser)(commitMessage, repoPath);
24
+ if (commitSha) {
25
+ (0, child_process_1.execSync)(`git push origin ${branchName}`, { cwd: repoPath });
26
+ }
27
+ return commitSha;
25
28
  }
29
+ return null;
26
30
  }
@@ -4,14 +4,14 @@ export declare function getGitDiffStaged(filepath: string, cwd: string): string;
4
4
  export declare function getGitDiffForStagedOrUnstaged(filepath: string, cwd: string): string;
5
5
  export declare function getGitDiffForNewFile(filepath: string, cwd: string): string;
6
6
  export declare function checkoutBranch(branchName: string, cwd: string): Promise<void>;
7
- export declare function commitAsBotUser(commitMessage: string, cwd: string): boolean;
7
+ export declare function commitAsBotUser(commitMessage: string, cwd: string): string | null;
8
8
  export declare function getCurrentBranchName(repoPath: string): Promise<string>;
9
9
  export declare function pullBranch(branchName: string, cwd: string): Promise<void>;
10
10
  export declare function stageAndCommitFilesAsBotUser({ commitMessage, files, repoPath, }: {
11
11
  commitMessage: string;
12
12
  files: string[];
13
13
  repoPath: string;
14
- }): void;
14
+ }): string | null;
15
15
  export type FileChange = {
16
16
  type: "added" | "modified" | "removed" | "renamed";
17
17
  path: string;
@@ -1 +1 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAMjE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMhE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMtE;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,CAaR;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM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,SAAS,EAAE,mBAAmB,CAAC;CAChC,oBA8BA"}
@@ -74,11 +74,15 @@ function commitAsBotUser(commitMessage, cwd) {
74
74
  cwd,
75
75
  });
76
76
  if (!status) {
77
- return false;
77
+ return null;
78
78
  }
79
79
  const commitMessageWithSkipCi = `${commitMessage} [skip ci]`;
80
80
  (0, child_process_1.execSync)(`git -c user.name="${GIT_USER_NAME}" -c user.email="${GIT_USER_EMAIL}" commit -m "${commitMessageWithSkipCi}"`, { cwd });
81
- return true;
81
+ const commitSha = (0, child_process_1.execSync)("git rev-parse HEAD", {
82
+ encoding: "utf-8",
83
+ cwd,
84
+ }).trim();
85
+ return commitSha;
82
86
  }
83
87
  async function getCurrentBranchName(repoPath) {
84
88
  const branchName = (0, child_process_1.execSync)("git branch --show-current", {
@@ -93,7 +97,7 @@ async function pullBranch(branchName, cwd) {
93
97
  }
94
98
  function stageAndCommitFilesAsBotUser({ commitMessage, files, repoPath, }) {
95
99
  (0, child_process_1.execSync)(`git add ${files.join(" ")}`, { cwd: repoPath });
96
- commitAsBotUser(commitMessage, repoPath);
100
+ return commitAsBotUser(commitMessage, repoPath);
97
101
  }
98
102
  function getStagedFiles(cwd) {
99
103
  const output = (0, child_process_1.execSync)("git diff --cached --name-status", {
@@ -1,4 +1,4 @@
1
- import { IDashboardAPIClient } from "@empiricalrun/shared-types";
1
+ import { IDashboardAPIClient, PendingToolCall, ToolResult } from "@empiricalrun/shared-types";
2
2
  export interface GitHubRepoInfo {
3
3
  owner: string;
4
4
  repo: string;
@@ -50,7 +50,7 @@ export declare function createPullRequest({ owner, repo, title, head, base, body
50
50
  repo: string;
51
51
  title: string;
52
52
  head: string;
53
- base?: string;
53
+ base: string;
54
54
  body: string;
55
55
  labels?: string[];
56
56
  apiClient: IDashboardAPIClient;
@@ -62,16 +62,18 @@ export declare function updatePullRequest({ owner, repo, prNumber, body, apiClie
62
62
  body?: string;
63
63
  apiClient: IDashboardAPIClient;
64
64
  }): Promise<PullRequestInfo>;
65
- export declare function findOrCreatePullRequest({ owner, repo, branchName, title, body, labels, apiClient, }: {
65
+ export declare function findOrCreatePullRequest({ owner, repo, branchName, title, body, base, labels, apiClient, }: {
66
66
  owner: string;
67
67
  repo: string;
68
68
  branchName: string;
69
69
  title: string;
70
70
  body: string;
71
+ base: string;
71
72
  labels?: string[];
72
73
  apiClient: IDashboardAPIClient;
73
74
  }): Promise<{
74
75
  pr: PullRequestInfo;
75
76
  isNew: boolean;
76
77
  }>;
78
+ export declare function validateToolInput<T>(toolCall: PendingToolCall, schema: T): ToolResult | null;
77
79
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAiB1D;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAA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AChC,GAAG,OAAO,CAAC,eAAe,CAAC,CAoB3B;AAED,wBAAsB,iBAAiB,CAAC,EACtC,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,SAAS,GACV,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,mBAAmB,CAAC;CAChC,GAAG,OAAO,CAAC,eAAe,CAAC,CAS3B;AAED,wBAAsB,uBAAuB,CAAC,EAC5C,KAAK,EACL,IAAI,EACJ,UAAU,EACV,KAAK,EACL,IAAI,EACJ,MAAM,EACN,SAAS,GACV,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,mBAAmB,CAAC;CAChC,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAoBnD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,UAAU,EACX,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAiB1D;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,GA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D;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,CAAC,GACR,UAAU,GAAG,IAAI,CAwBnB"}
@@ -7,6 +7,7 @@ exports.getMergeableStateDescription = getMergeableStateDescription;
7
7
  exports.createPullRequest = createPullRequest;
8
8
  exports.updatePullRequest = updatePullRequest;
9
9
  exports.findOrCreatePullRequest = findOrCreatePullRequest;
10
+ exports.validateToolInput = validateToolInput;
10
11
  function parseGitHubUrl(url) {
11
12
  const githubIndex = url.indexOf("github.com");
12
13
  if (githubIndex === -1) {
@@ -70,7 +71,7 @@ function getMergeableStateDescription(state) {
70
71
  return `The pull request has mergeable state: ${state}.`;
71
72
  }
72
73
  }
73
- async function createPullRequest({ owner, repo, title, head, base = "main", body, labels, apiClient, }) {
74
+ async function createPullRequest({ owner, repo, title, head, base, body, labels, apiClient, }) {
74
75
  const createPrBody = {
75
76
  title,
76
77
  head,
@@ -98,7 +99,7 @@ async function updatePullRequest({ owner, repo, prNumber, body, apiClient, }) {
98
99
  body: updateBody,
99
100
  });
100
101
  }
101
- async function findOrCreatePullRequest({ owner, repo, branchName, title, body, labels, apiClient, }) {
102
+ async function findOrCreatePullRequest({ owner, repo, branchName, title, body, base, labels, apiClient, }) {
102
103
  const existingPR = await getExistingPR({
103
104
  owner,
104
105
  repo,
@@ -113,9 +114,29 @@ async function findOrCreatePullRequest({ owner, repo, branchName, title, body, l
113
114
  repo,
114
115
  title,
115
116
  head: branchName,
117
+ base,
116
118
  body,
117
119
  labels,
118
120
  apiClient,
119
121
  });
120
122
  return { pr: newPR, isNew: true };
121
123
  }
124
+ function validateToolInput(toolCall, schema) {
125
+ const { name: toolName, input } = toolCall;
126
+ const strictSchema = schema._def?.typeName === "ZodObject"
127
+ ? schema.strict()
128
+ : schema;
129
+ const validation = strictSchema.safeParse(input);
130
+ if (!validation.success) {
131
+ const errorMessage = [
132
+ `Schema validation failed for tool "${toolName}".`,
133
+ `\nValidation errors: ${JSON.stringify(validation.error.issues, null, 2)}`,
134
+ ].join("\n");
135
+ return {
136
+ isError: true,
137
+ result: errorMessage,
138
+ artifacts: null,
139
+ };
140
+ }
141
+ return null;
142
+ }
@@ -8,7 +8,7 @@ const SessionDiffInputSchema = zod_1.z.object({
8
8
  exports.fetchSessionDiffTool = {
9
9
  schema: {
10
10
  name: "fetchSessionDiff",
11
- description: `Extracts the session url and returns the code diff for the session.`,
11
+ description: `Extracts the session url and returns the code diff for the session along with pull request title and description, if available.`,
12
12
  parameters: SessionDiffInputSchema,
13
13
  },
14
14
  needsBrowser: false,
@@ -26,7 +26,7 @@ exports.fetchSessionDiffTool = {
26
26
  throw new Error("Dashboard API client is not available.");
27
27
  }
28
28
  const sessionId = sessionUrl.split("/").pop();
29
- const sessionDiffApiUrl = `/api/chat-sessions/${sessionId}/diff`;
29
+ const sessionDiffApiUrl = `/api/chat-sessions/${sessionId}/diff?is_line_annotated=true`;
30
30
  const sessionDiff = await apiClient.request(sessionDiffApiUrl, {
31
31
  method: "GET",
32
32
  });
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAO1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,iBAAe,kBAAkB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,OAAO,CAAC,UAAU,CAAC,CA0DtB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAO1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,iBAAe,kBAAkB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,OAAO,CAAC,UAAU,CAAC,CAuDtB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -8,7 +8,6 @@ const child_process_1 = require("child_process");
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const web_1 = require("../../bin/utils/platform/web");
11
- const git_helper_1 = require("./shared/git-helper");
12
11
  async function fileCreateExecutor({ input, filePath, absoluteFilePath, repoDir, collectArtifacts, }) {
13
12
  if (input.file_text === undefined || input.file_text === null) {
14
13
  return {
@@ -45,13 +44,11 @@ the required directories recursively for the new file.`,
45
44
  fs_1.default.writeFileSync(absoluteFilePath, input.file_text);
46
45
  // Stage the file
47
46
  (0, child_process_1.execSync)(`git add "${filePath}"`, { cwd: repoDir });
48
- // Collect git patch artifact
49
- await (0, git_helper_1.collectGitPatchArtifact)(filePath, repoDir, "create", collectArtifacts);
50
47
  let tscResult = await (0, web_1.runTypescriptCompiler)(repoDir);
51
48
  if (!tscResult.success) {
52
49
  return {
53
50
  result: `File ${filePath} has been created. However, type checks are failing with errors:\n\n${tscResult.errors.join("\n")}`,
54
- isError: true,
51
+ isError: false,
55
52
  };
56
53
  }
57
54
  else {
@@ -11,5 +11,6 @@ declare function strReplaceEditorExecutor({ input, repoPath, collectArtifacts, a
11
11
  apiClient?: IDashboardAPIClient;
12
12
  }): Promise<ToolResult>;
13
13
  declare const textEditorTools: Tool[];
14
- export { strReplaceEditorExecutor, textEditorTools };
14
+ declare const viewOnlyTools: Tool[];
15
+ export { strReplaceEditorExecutor, textEditorTools, viewOnlyTools };
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,IAAI,EAEJ,UAAU,EACX,MAAM,4BAA4B,CAAC;AAQpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD;;;GAGG;AACH,iBAAe,wBAAwB,CAAC,EACtC,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,SAAS,GACV,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,SAAS,CAAC,EAAE,mBAAmB,CAAC;CACjC,GAAG,OAAO,CAAC,UAAU,CAAC,CAoDtB;AA+ED,QAAA,MAAM,eAAe,EAAE,IAAI,EAK1B,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,IAAI,EAEJ,UAAU,EACX,MAAM,4BAA4B,CAAC;AAQpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD;;;GAGG;AACH,iBAAe,wBAAwB,CAAC,EACtC,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,SAAS,GACV,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,SAAS,CAAC,EAAE,mBAAmB,CAAC;CACjC,GAAG,OAAO,CAAC,UAAU,CAAC,CAoDtB;AAgFD,QAAA,MAAM,eAAe,EAAE,IAAI,EAK1B,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,IAAI,EAAmB,CAAC;AAE7C,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC"}
@@ -3,7 +3,7 @@ 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.textEditorTools = void 0;
6
+ exports.viewOnlyTools = exports.textEditorTools = void 0;
7
7
  exports.strReplaceEditorExecutor = strReplaceEditorExecutor;
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const str_replace_editor_1 = require("../definitions/str_replace_editor");
@@ -127,6 +127,7 @@ const stringInsertTool = {
127
127
  command: "insert",
128
128
  path: input.path,
129
129
  insert_line: input.insert_line,
130
+ insert_text: input.insert_text,
130
131
  new_str: input.new_str,
131
132
  },
132
133
  repoPath,
@@ -141,3 +142,5 @@ const textEditorTools = [
141
142
  stringInsertTool,
142
143
  ];
143
144
  exports.textEditorTools = textEditorTools;
145
+ const viewOnlyTools = [fileViewTool];
146
+ exports.viewOnlyTools = viewOnlyTools;
@@ -1,11 +1,10 @@
1
1
  import { CollectArtifacts, ToolResult } from "@empiricalrun/shared-types";
2
2
  import { StrReplaceInputParams } from "./shared/helpers";
3
- declare function fileInsertExecutor({ input, filePath, absoluteFilePath, repoDir, collectArtifacts, }: {
3
+ export declare function fileInsertExecutor({ input, filePath, absoluteFilePath, repoDir, collectArtifacts, }: {
4
4
  input: StrReplaceInputParams;
5
5
  filePath: string;
6
6
  absoluteFilePath: string;
7
7
  repoDir: string;
8
8
  collectArtifacts?: CollectArtifacts;
9
9
  }): Promise<ToolResult>;
10
- export { fileInsertExecutor };
11
10
  //# sourceMappingURL=insert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/insert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,iBAAe,kBAAkB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,OAAO,CAAC,UAAU,CAAC,CAwDtB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/insert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,wBAAsB,kBAAkB,CAAC,EACvC,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,OAAO,CAAC,UAAU,CAAC,CAqDtB"}
@@ -7,7 +7,6 @@ exports.fileInsertExecutor = fileInsertExecutor;
7
7
  const child_process_1 = require("child_process");
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const web_1 = require("../../bin/utils/platform/web");
10
- const git_helper_1 = require("./shared/git-helper");
11
10
  async function fileInsertExecutor({ input, filePath, absoluteFilePath, repoDir, collectArtifacts, }) {
12
11
  if (!fs_1.default.existsSync(absoluteFilePath)) {
13
12
  return {
@@ -46,13 +45,11 @@ async function fileInsertExecutor({ input, filePath, absoluteFilePath, repoDir,
46
45
  fs_1.default.writeFileSync(absoluteFilePath, lines.join("\n"));
47
46
  // Stage the file
48
47
  (0, child_process_1.execSync)(`git add "${filePath}"`, { cwd: repoDir });
49
- // Collect git patch artifact
50
- await (0, git_helper_1.collectGitPatchArtifact)(filePath, repoDir, "insert", collectArtifacts);
51
48
  let tscResult = await (0, web_1.runTypescriptCompiler)(repoDir);
52
49
  if (!tscResult.success) {
53
50
  return {
54
51
  result: `Insertion in file ${filePath} was applied. However, type checks are failing with errors:\n${tscResult.errors.join("\n")}`,
55
- isError: true,
52
+ isError: false,
56
53
  };
57
54
  }
58
55
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"replace.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/replace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG9D,iBAAe,sBAAsB,CAAC,EACpC,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,OAAO,CAAC,UAAU,CAAC,CAoFtB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
1
+ {"version":3,"file":"replace.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/replace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG9D,iBAAe,sBAAsB,CAAC,EACpC,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,OAAO,CAAC,UAAU,CAAC,CAwEtB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
@@ -7,7 +7,6 @@ exports.fileStrReplaceExecutor = fileStrReplaceExecutor;
7
7
  const child_process_1 = require("child_process");
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const web_1 = require("../../bin/utils/platform/web");
10
- const git_helper_1 = require("./shared/git-helper");
11
10
  const helpers_1 = require("./shared/helpers");
12
11
  async function fileStrReplaceExecutor({ input, filePath, absoluteFilePath, repoDir, collectArtifacts, }) {
13
12
  if (!fs_1.default.existsSync(absoluteFilePath)) {
@@ -30,47 +29,44 @@ async function fileStrReplaceExecutor({ input, filePath, absoluteFilePath, repoD
30
29
  };
31
30
  }
32
31
  const content = fs_1.default.readFileSync(absoluteFilePath, "utf8");
33
- // Normalize newlines in both the content and search string
32
+ // Normalize newlines in file content only
34
33
  const normalizedContent = content.replace(/\r\n/g, "\n");
35
- const normalizedOldStr = input.old_str
36
- .replace(/\\n/g, "\n")
37
- .replace(/\r\n/g, "\n");
38
- if (!normalizedContent.includes(normalizedOldStr)) {
34
+ const oldStr = input.old_str;
35
+ // Use literal split/join for replacement to avoid regex and escape sequence issues
36
+ const parts = normalizedContent.split(oldStr);
37
+ const occurrences = parts.length - 1;
38
+ if (occurrences === 0) {
39
39
  return {
40
40
  result: `old_str not found in file: ${filePath}`,
41
41
  isError: true,
42
42
  };
43
43
  }
44
- else {
45
- const escapedOldStr = (0, helpers_1.escapeRegExp)(normalizedOldStr);
46
- const occurences = normalizedContent.match(new RegExp(escapedOldStr, "g"));
47
- if (occurences && occurences.length > 1) {
48
- const uniqueContexts = (0, helpers_1.getUniqueOccurences)(content, input.old_str);
49
- if (uniqueContexts.length === 0) {
50
- return {
51
- result: `Error: old_str found ${occurences.length} times in file: ${filePath}, but no unique contexts could be identified. Try using a more specific string.`,
52
- isError: true,
53
- };
54
- }
55
- const uniqueContextsString = uniqueContexts
56
- .map(({ uniqueContext, lineNumber }, idx) => `${idx + 1}. For occurence at line number ${lineNumber}, unique context is:\n\`\`\`\n${uniqueContext}\n\`\`\`\n`)
57
- .join("\n");
44
+ else if (occurrences > 1) {
45
+ const uniqueContexts = (0, helpers_1.getUniqueOccurences)(content, input.old_str);
46
+ if (uniqueContexts.length === 0) {
58
47
  return {
59
- result: `Error: old_str found ${occurences.length} times in file: ${filePath}. Please use one of these unique contexts instead:\n\n${uniqueContextsString}`,
48
+ result: `Error: old_str found ${occurrences} times in file: ${filePath}. Try using a more specific string.`,
60
49
  isError: true,
61
50
  };
62
51
  }
63
- const newContent = normalizedContent.replace(normalizedOldStr, input.new_str);
52
+ const uniqueContextsString = uniqueContexts
53
+ .map(({ uniqueContext, lineNumber }, idx) => `${idx + 1}. For occurence at line number ${lineNumber}, unique context is:\n\`\`\`\n${uniqueContext}\n\`\`\`\n`)
54
+ .join("\n");
55
+ return {
56
+ result: `Error: old_str found ${occurrences} times in file: ${filePath}. Please use one of these unique contexts instead:\n\n${uniqueContextsString}`,
57
+ isError: true,
58
+ };
59
+ }
60
+ else {
61
+ const newContent = parts.join(input.new_str);
64
62
  fs_1.default.writeFileSync(absoluteFilePath, newContent);
65
63
  // Stage the file
66
64
  (0, child_process_1.execSync)(`git add "${filePath}"`, { cwd: repoDir });
67
- // Collect git patch artifact
68
- await (0, git_helper_1.collectGitPatchArtifact)(filePath, repoDir, "replace", collectArtifacts);
69
65
  let tscResult = await (0, web_1.runTypescriptCompiler)(repoDir);
70
66
  if (!tscResult.success) {
71
67
  return {
72
68
  result: `Edits to file ${filePath} have been applied. However, type checks are failing with errors:\n\n${tscResult.errors.join("\n")}`,
73
- isError: true,
69
+ isError: false,
74
70
  };
75
71
  }
76
72
  else {
@@ -8,12 +8,10 @@ export interface StrReplaceInputParams {
8
8
  insert_line?: number;
9
9
  insert_text?: string;
10
10
  }
11
- declare function formatLinesWithNumbers(content: string, viewRange?: [number, number]): string;
12
- declare function isBinaryFile(filePath: string): boolean;
13
- declare function getUniqueOccurences(contents: string, old_str: string): {
11
+ export declare function formatLinesWithNumbers(content: string, viewRange?: [number, number]): string;
12
+ export declare function isBinaryFile(filePath: string): boolean;
13
+ export declare function getUniqueOccurences(contents: string, old_str: string): {
14
14
  uniqueContext: string;
15
15
  lineNumber: number;
16
16
  }[];
17
- declare function escapeRegExp(text: string): string;
18
- export { escapeRegExp, formatLinesWithNumbers, getUniqueOccurences, isBinaryFile, };
19
17
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/tools/file-operations/shared/helpers.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IAGb,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAG9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAKnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,iBAAS,sBAAsB,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,MAAM,CAaR;AAED,iBAAS,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CA2D/C;AAED,iBAAS,mBAAmB,CAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,CAyDjD;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,MAAM,UAEjC;AAED,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EACnB,YAAY,GACb,CAAC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/tools/file-operations/shared/helpers.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IAGb,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAG9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAKnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,MAAM,CAaR;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CA2DtD;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,CAyDjD"}
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.escapeRegExp = escapeRegExp;
4
3
  exports.formatLinesWithNumbers = formatLinesWithNumbers;
5
- exports.getUniqueOccurences = getUniqueOccurences;
6
4
  exports.isBinaryFile = isBinaryFile;
5
+ exports.getUniqueOccurences = getUniqueOccurences;
7
6
  function formatLinesWithNumbers(content, viewRange) {
8
7
  const lines = content.split("\n");
9
8
  if (viewRange) {
@@ -128,6 +127,3 @@ function getUniqueOccurences(contents, old_str) {
128
127
  }
129
128
  return uniqueContexts;
130
129
  }
131
- function escapeRegExp(text) {
132
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
133
- }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/grep/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,4BAA4B,CAAC;AA+HnE,eAAO,MAAM,QAAQ,EAAE,IAUtB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/grep/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,IAAI,EAAc,MAAM,4BAA4B,CAAC;AAkI3E,eAAO,MAAM,QAAQ,EAAE,IActB,CAAC"}