@empiricalrun/test-gen 0.75.0 → 0.77.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 (254) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/agent/base/index.d.ts +32 -21
  3. package/dist/agent/base/index.d.ts.map +1 -1
  4. package/dist/agent/base/index.js +100 -57
  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 +8 -7
  12. package/dist/agent/chat/agent-loop.d.ts.map +1 -1
  13. package/dist/agent/chat/agent-loop.js +7 -18
  14. package/dist/agent/chat/exports.d.ts +9 -6
  15. package/dist/agent/chat/exports.d.ts.map +1 -1
  16. package/dist/agent/chat/exports.js +11 -13
  17. package/dist/agent/chat/index.d.ts +6 -10
  18. package/dist/agent/chat/index.d.ts.map +1 -1
  19. package/dist/agent/chat/index.js +117 -196
  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 -8
  32. package/dist/agent/chat/state.d.ts.map +1 -1
  33. package/dist/agent/chat/state.js +17 -47
  34. package/dist/agent/chat/utils.d.ts +4 -5
  35. package/dist/agent/chat/utils.d.ts.map +1 -1
  36. package/dist/agent/chat/utils.js +15 -9
  37. package/dist/agent/cli.d.ts +11 -0
  38. package/dist/agent/cli.d.ts.map +1 -0
  39. package/dist/agent/cli.js +213 -0
  40. package/dist/agent/code-review/executor/index.d.ts +5 -0
  41. package/dist/agent/code-review/executor/index.d.ts.map +1 -0
  42. package/dist/agent/code-review/executor/index.js +13 -0
  43. package/dist/agent/code-review/index.d.ts +12 -0
  44. package/dist/agent/code-review/index.d.ts.map +1 -0
  45. package/dist/agent/code-review/index.js +159 -0
  46. package/dist/agent/code-review/parser.d.ts +5 -0
  47. package/dist/agent/code-review/parser.d.ts.map +1 -0
  48. package/dist/agent/code-review/parser.js +70 -0
  49. package/dist/agent/code-review/types.d.ts +36 -0
  50. package/dist/agent/code-review/types.d.ts.map +1 -0
  51. package/dist/agent/code-review/types.js +13 -0
  52. package/dist/agent/cua/index.d.ts.map +1 -1
  53. package/dist/agent/cua/index.js +18 -2
  54. package/dist/agent/cua/model.d.ts.map +1 -1
  55. package/dist/agent/cua/model.js +4 -1
  56. package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -1
  57. package/dist/agent/index.d.ts +10 -0
  58. package/dist/agent/index.d.ts.map +1 -0
  59. package/dist/agent/index.js +19 -0
  60. package/dist/agent/triage/index.d.ts +7 -0
  61. package/dist/agent/triage/index.d.ts.map +1 -0
  62. package/dist/agent/triage/index.js +103 -0
  63. package/dist/agent/video-analysis/executor/index.d.ts +5 -0
  64. package/dist/agent/video-analysis/executor/index.d.ts.map +1 -0
  65. package/dist/agent/video-analysis/executor/index.js +10 -0
  66. package/dist/agent/video-analysis/index.d.ts +7 -0
  67. package/dist/agent/video-analysis/index.d.ts.map +1 -0
  68. package/dist/agent/video-analysis/index.js +60 -0
  69. package/dist/artifacts/index.d.ts +1 -1
  70. package/dist/artifacts/index.d.ts.map +1 -1
  71. package/dist/artifacts/index.js +3 -1
  72. package/dist/artifacts/utils.d.ts.map +1 -1
  73. package/dist/bin/index.js +68 -23
  74. package/dist/constants/index.d.ts +14 -0
  75. package/dist/constants/index.d.ts.map +1 -1
  76. package/dist/constants/index.js +33 -1
  77. package/dist/file/server.d.ts +1 -3
  78. package/dist/file/server.d.ts.map +1 -1
  79. package/dist/file/server.js +0 -13
  80. package/dist/file-info/adapters/file-system/index.d.ts.map +1 -1
  81. package/dist/file-info/adapters/file-system/reader.d.ts.map +1 -1
  82. package/dist/file-info/adapters/file-system/reader.js +8 -1
  83. package/dist/file-info/adapters/github/index.d.ts.map +1 -1
  84. package/dist/file-info/adapters/github/index.js +1 -2
  85. package/dist/file-info/adapters/github/reader.d.ts +4 -9
  86. package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
  87. package/dist/file-info/adapters/github/reader.js +166 -134
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/tools/analyse-video/index.d.ts +5 -0
  90. package/dist/tools/analyse-video/index.d.ts.map +1 -0
  91. package/dist/tools/analyse-video/index.js +50 -0
  92. package/dist/tools/create-pull-request/index.d.ts.map +1 -0
  93. package/dist/tools/{definitions/commit-and-create-pr.js → create-pull-request/index.js} +28 -1
  94. package/dist/tools/create-pull-request/utils.d.ts +21 -0
  95. package/dist/tools/create-pull-request/utils.d.ts.map +1 -0
  96. package/dist/tools/create-pull-request/utils.js +83 -0
  97. package/dist/tools/definitions/{fetch-video-analysis.d.ts → analyse-video.d.ts} +17 -12
  98. package/dist/tools/definitions/analyse-video.d.ts.map +1 -0
  99. package/dist/tools/definitions/analyse-video.js +60 -0
  100. package/dist/tools/definitions/review-pull-request.d.ts +3 -0
  101. package/dist/tools/definitions/review-pull-request.d.ts.map +1 -0
  102. package/dist/tools/definitions/review-pull-request.js +16 -0
  103. package/dist/tools/definitions/str_replace_editor.d.ts +1 -0
  104. package/dist/tools/definitions/str_replace_editor.d.ts.map +1 -1
  105. package/dist/tools/definitions/str_replace_editor.js +4 -1
  106. package/dist/tools/definitions/test-gen-browser.d.ts +0 -3
  107. package/dist/tools/definitions/test-gen-browser.d.ts.map +1 -1
  108. package/dist/tools/definitions/test-gen-browser.js +33 -8
  109. package/dist/tools/delete-file/index.d.ts.map +1 -1
  110. package/dist/tools/delete-file/index.js +1 -19
  111. package/dist/tools/executor/base.d.ts +32 -0
  112. package/dist/tools/executor/base.d.ts.map +1 -0
  113. package/dist/tools/executor/base.js +114 -0
  114. package/dist/tools/executor/index.d.ts +3 -22
  115. package/dist/tools/executor/index.d.ts.map +1 -1
  116. package/dist/tools/executor/index.js +13 -92
  117. package/dist/tools/executor/utils/checkpoint.d.ts +1 -1
  118. package/dist/tools/executor/utils/checkpoint.d.ts.map +1 -1
  119. package/dist/tools/executor/utils/checkpoint.js +6 -2
  120. package/dist/tools/executor/utils/git.d.ts +2 -2
  121. package/dist/tools/executor/utils/git.d.ts.map +1 -1
  122. package/dist/tools/executor/utils/git.js +7 -3
  123. package/dist/tools/executor/utils/index.d.ts.map +1 -1
  124. package/dist/tools/executor/utils/index.js +1 -1
  125. package/dist/tools/fetch-session-diff/index.d.ts +3 -0
  126. package/dist/tools/fetch-session-diff/index.d.ts.map +1 -0
  127. package/dist/tools/fetch-session-diff/index.js +46 -0
  128. package/dist/tools/file-operations/create.d.ts.map +1 -1
  129. package/dist/tools/file-operations/create.js +1 -4
  130. package/dist/tools/file-operations/index.d.ts +2 -1
  131. package/dist/tools/file-operations/index.d.ts.map +1 -1
  132. package/dist/tools/file-operations/index.js +4 -1
  133. package/dist/tools/file-operations/insert.d.ts +1 -2
  134. package/dist/tools/file-operations/insert.d.ts.map +1 -1
  135. package/dist/tools/file-operations/insert.js +1 -4
  136. package/dist/tools/file-operations/replace.d.ts.map +1 -1
  137. package/dist/tools/file-operations/replace.js +1 -4
  138. package/dist/tools/grep/index.d.ts.map +1 -1
  139. package/dist/tools/grep/index.js +18 -11
  140. package/dist/tools/index.d.ts +28 -2
  141. package/dist/tools/index.d.ts.map +1 -1
  142. package/dist/tools/index.js +52 -33
  143. package/dist/tools/merge-conflicts/index.d.ts.map +1 -1
  144. package/dist/tools/merge-conflicts/index.js +1 -1
  145. package/dist/tools/rename-file/index.js +1 -1
  146. package/dist/tools/review-pull-request/index.d.ts +3 -0
  147. package/dist/tools/review-pull-request/index.d.ts.map +1 -0
  148. package/dist/tools/review-pull-request/index.js +89 -0
  149. package/dist/tools/run-test.d.ts.map +1 -1
  150. package/dist/tools/run-test.js +25 -3
  151. package/dist/tools/test-gen-browser.d.ts.map +1 -1
  152. package/dist/tools/test-gen-browser.js +51 -47
  153. package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
  154. package/dist/tools/test-run-fetcher/index.js +4 -14
  155. package/dist/tools/utils/urls.d.ts +5 -0
  156. package/dist/tools/utils/urls.d.ts.map +1 -0
  157. package/dist/tools/utils/urls.js +19 -0
  158. package/dist/tools/view-failed-test-run-report/index.d.ts.map +1 -1
  159. package/dist/tools/view-failed-test-run-report/index.js +3 -15
  160. package/dist/utils/artifact-paths.d.ts +20 -0
  161. package/dist/utils/artifact-paths.d.ts.map +1 -0
  162. package/dist/utils/artifact-paths.js +16 -0
  163. package/dist/utils/dedup-image-fs.d.ts +2 -16
  164. package/dist/utils/dedup-image-fs.d.ts.map +1 -1
  165. package/dist/utils/dedup-image-fs.js +12 -16
  166. package/dist/utils/dedup-image.d.ts +1 -14
  167. package/dist/utils/dedup-image.d.ts.map +1 -1
  168. package/dist/utils/dedup-image.js +7 -62
  169. package/dist/{tools/fetch-video-analysis/local-ffmpeg-client.d.ts → utils/ffmpeg/index.d.ts} +9 -6
  170. package/dist/utils/ffmpeg/index.d.ts.map +1 -0
  171. package/dist/utils/ffmpeg/index.js +415 -0
  172. package/dist/utils/file.d.ts +1 -0
  173. package/dist/utils/file.d.ts.map +1 -1
  174. package/dist/utils/file.js +45 -1
  175. package/dist/utils/find-threshold.d.ts +8 -0
  176. package/dist/utils/find-threshold.d.ts.map +1 -0
  177. package/dist/utils/find-threshold.js +55 -0
  178. package/dist/utils/hash.d.ts +2 -0
  179. package/dist/utils/hash.d.ts.map +1 -0
  180. package/dist/utils/hash.js +24 -0
  181. package/dist/utils/model.d.ts +1 -1
  182. package/dist/utils/model.d.ts.map +1 -1
  183. package/dist/utils/model.js +7 -5
  184. package/dist/utils/repo-tree.d.ts +0 -1
  185. package/dist/utils/repo-tree.d.ts.map +1 -1
  186. package/dist/utils/repo-tree.js +2 -14
  187. package/dist/utils/slug.js +1 -1
  188. package/dist/video-core/agent-orchestrator.d.ts +14 -0
  189. package/dist/video-core/agent-orchestrator.d.ts.map +1 -0
  190. package/dist/video-core/agent-orchestrator.js +78 -0
  191. package/dist/video-core/analysis-server.d.ts +24 -0
  192. package/dist/video-core/analysis-server.d.ts.map +1 -0
  193. package/dist/video-core/analysis-server.js +398 -0
  194. package/dist/video-core/analysis-viewer.html +1374 -0
  195. package/dist/video-core/index.d.ts +44 -0
  196. package/dist/video-core/index.d.ts.map +1 -0
  197. package/dist/video-core/index.js +204 -0
  198. package/dist/video-core/model-limits.d.ts +4 -0
  199. package/dist/video-core/model-limits.d.ts.map +1 -0
  200. package/dist/video-core/model-limits.js +67 -0
  201. package/dist/video-core/storage-manager.d.ts +5 -0
  202. package/dist/video-core/storage-manager.d.ts.map +1 -0
  203. package/dist/video-core/storage-manager.js +55 -0
  204. package/dist/video-core/types.d.ts +13 -0
  205. package/dist/video-core/types.d.ts.map +1 -0
  206. package/dist/video-core/types.js +2 -0
  207. package/dist/video-core/utils.d.ts +25 -0
  208. package/dist/video-core/utils.d.ts.map +1 -0
  209. package/dist/video-core/utils.js +211 -0
  210. package/dist/video-core/xml-parser.d.ts +3 -0
  211. package/dist/video-core/xml-parser.d.ts.map +1 -0
  212. package/dist/video-core/xml-parser.js +27 -0
  213. package/package.json +5 -6
  214. package/tsconfig.tsbuildinfo +1 -1
  215. package/dist/agent/chat/prompt/index.d.ts +0 -5
  216. package/dist/agent/chat/prompt/index.d.ts.map +0 -1
  217. package/dist/agent/chat/prompt/index.js +0 -189
  218. package/dist/agent/chat/utils/tool-calls.d.ts +0 -21
  219. package/dist/agent/chat/utils/tool-calls.d.ts.map +0 -1
  220. package/dist/agent/chat/utils/tool-calls.js +0 -64
  221. package/dist/agent/code-review/prompt.d.ts +0 -2
  222. package/dist/agent/code-review/prompt.d.ts.map +0 -1
  223. package/dist/agent/code-review/prompt.js +0 -19
  224. package/dist/agent/diagnosis-agent/index.d.ts +0 -11
  225. package/dist/agent/diagnosis-agent/index.d.ts.map +0 -1
  226. package/dist/agent/diagnosis-agent/index.js +0 -88
  227. package/dist/agent/diagnosis-agent/strict-mode-violation.d.ts +0 -10
  228. package/dist/agent/diagnosis-agent/strict-mode-violation.d.ts.map +0 -1
  229. package/dist/agent/diagnosis-agent/strict-mode-violation.js +0 -30
  230. package/dist/tools/commit-and-create-pr/index.d.ts.map +0 -1
  231. package/dist/tools/commit-and-create-pr/index.js +0 -83
  232. package/dist/tools/definitions/commit-and-create-pr.d.ts +0 -3
  233. package/dist/tools/definitions/commit-and-create-pr.d.ts.map +0 -1
  234. package/dist/tools/definitions/fetch-video-analysis.d.ts.map +0 -1
  235. package/dist/tools/definitions/fetch-video-analysis.js +0 -61
  236. package/dist/tools/fetch-video-analysis/index.d.ts +0 -5
  237. package/dist/tools/fetch-video-analysis/index.d.ts.map +0 -1
  238. package/dist/tools/fetch-video-analysis/index.js +0 -138
  239. package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts.map +0 -1
  240. package/dist/tools/fetch-video-analysis/local-ffmpeg-client.js +0 -247
  241. package/dist/tools/fetch-video-analysis/open-ai.d.ts +0 -6
  242. package/dist/tools/fetch-video-analysis/open-ai.d.ts.map +0 -1
  243. package/dist/tools/fetch-video-analysis/open-ai.js +0 -37
  244. package/dist/tools/fetch-video-analysis/utils.d.ts +0 -13
  245. package/dist/tools/fetch-video-analysis/utils.d.ts.map +0 -1
  246. package/dist/tools/fetch-video-analysis/utils.js +0 -98
  247. package/dist/tools/fetch-video-analysis/video-analysis.d.ts +0 -7
  248. package/dist/tools/fetch-video-analysis/video-analysis.d.ts.map +0 -1
  249. package/dist/tools/fetch-video-analysis/video-analysis.js +0 -54
  250. package/dist/tools/file-operations/shared/git-helper.d.ts +0 -4
  251. package/dist/tools/file-operations/shared/git-helper.d.ts.map +0 -1
  252. package/dist/tools/file-operations/shared/git-helper.js +0 -29
  253. package/eslint.config.mjs +0 -43
  254. /package/dist/tools/{commit-and-create-pr → create-pull-request}/index.d.ts +0 -0
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processAnalysisAndLoadFrames = processAnalysisAndLoadFrames;
4
+ const utils_1 = require("./utils");
5
+ function extractKeyFramesFromAnalysis(analysisData) {
6
+ const keyFrames = [];
7
+ if (analysisData && Array.isArray(analysisData)) {
8
+ analysisData.forEach((section) => {
9
+ if (section.key_frame && typeof section.key_frame === "string") {
10
+ keyFrames.push(section.key_frame);
11
+ }
12
+ });
13
+ }
14
+ return keyFrames;
15
+ }
16
+ async function processAnalysisAndLoadFrames({ rawAnalysis, artifactsPath, }) {
17
+ const parsedXml = (0, utils_1.parseXmlSummaryToJson)(rawAnalysis);
18
+ const keyFrames = extractKeyFramesFromAnalysis(parsedXml);
19
+ let keyFrameImagesMap = new Map();
20
+ if (keyFrames.length > 0) {
21
+ try {
22
+ keyFrameImagesMap = await (0, utils_1.loadKeyFrameImages)(keyFrames, artifactsPath);
23
+ }
24
+ catch (error) { }
25
+ }
26
+ return { parsedXml, keyFrameImagesMap };
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.75.0",
3
+ "version": "0.77.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -62,7 +62,6 @@
62
62
  "date-fns": "^3.6.0",
63
63
  "detect-port": "^1.6.1",
64
64
  "dotenv": "^16.4.5",
65
- "eslint": "^9.30.0",
66
65
  "express": "^4.19.2",
67
66
  "ignore": "^5.3.1",
68
67
  "inquirer": "^12.4.2",
@@ -85,7 +84,7 @@
85
84
  "yauzl": "^3.1.3",
86
85
  "zod": "^3.23.8",
87
86
  "@empiricalrun/ast-parser": "^0.0.10",
88
- "@empiricalrun/llm": "^0.22.0",
87
+ "@empiricalrun/llm": "^0.23.0",
89
88
  "@empiricalrun/r2-uploader": "^0.3.11",
90
89
  "@empiricalrun/test-run": "^0.11.1"
91
90
  },
@@ -106,13 +105,13 @@
106
105
  "playwright": "1.53.2",
107
106
  "serve-handler": "^6.1.6",
108
107
  "ts-patch": "^3.3.0",
109
- "@empiricalrun/shared-types": "0.10.1"
108
+ "@empiricalrun/shared-types": "0.12.0"
110
109
  },
111
110
  "scripts": {
112
111
  "dev": "tspc --build --watch",
113
- "build": "tspc --build && cp -r src/browser-injected-scripts dist",
112
+ "build": "tspc --build && cp -r src/browser-injected-scripts dist && cp src/video-core/analysis-viewer.html dist/video-core/",
114
113
  "clean": "tspc --build --clean",
115
- "lint": "eslint .",
114
+ "lint": "biome check --unsafe",
116
115
  "test": "vitest run",
117
116
  "test-browser": "pnpm build && RUNNING_BROWSER_TESTS_FOR_TEST_GEN=1 npx playwright test",
118
117
  "test:watch": "vitest",
@@ -1 +1 @@
1
- {"root":["./src/index.ts","./src/logger.ts","./src/actions/assert.ts","./src/actions/click.ts","./src/actions/done.ts","./src/actions/fill.ts","./src/actions/goto.ts","./src/actions/hover.ts","./src/actions/index.ts","./src/actions/next-task.ts","./src/actions/press.ts","./src/actions/skill.ts","./src/actions/text-content.ts","./src/actions/constants/index.ts","./src/actions/utils/index.ts","./src/agent/base/index.ts","./src/agent/browsing/index.ts","./src/agent/browsing/run.ts","./src/agent/browsing/utils.ts","./src/agent/chat/agent-loop.ts","./src/agent/chat/exports.ts","./src/agent/chat/filesystem-cache.ts","./src/agent/chat/index.ts","./src/agent/chat/models.ts","./src/agent/chat/state.ts","./src/agent/chat/types.ts","./src/agent/chat/utils.ts","./src/agent/chat/prompt/index.ts","./src/agent/chat/prompt/pw-utils-docs.ts","./src/agent/chat/prompt/repo.ts","./src/agent/chat/utils/tool-calls.ts","./src/agent/code-review/prompt.ts","./src/agent/codegen/create-test-block.ts","./src/agent/codegen/fix-ts-errors.ts","./src/agent/codegen/lexical-scoped-vars.ts","./src/agent/codegen/skills-retriever.ts","./src/agent/codegen/test-update-feedback.ts","./src/agent/codegen/types.ts","./src/agent/codegen/update-flow.ts","./src/agent/codegen/use-skill.ts","./src/agent/codegen/utils.ts","./src/agent/cua/computer.ts","./src/agent/cua/index.ts","./src/agent/cua/model.ts","./src/agent/cua/pw-codegen/element-from-point.ts","./src/agent/cua/pw-codegen/types.ts","./src/agent/cua/pw-codegen/pw-pause/for-recorder.ts","./src/agent/cua/pw-codegen/pw-pause/index.ts","./src/agent/cua/pw-codegen/pw-pause/ipc.ts","./src/agent/cua/pw-codegen/pw-pause/patch.ts","./src/agent/cua/pw-codegen/pw-pause/types.ts","./src/agent/cua/pw-codegen/pw-pause/utils.ts","./src/agent/diagnosis-agent/index.ts","./src/agent/diagnosis-agent/strict-mode-violation.ts","./src/agent/master/action-tool-calls.ts","./src/agent/master/element-annotation.ts","./src/agent/master/execute-browser-action.ts","./src/agent/master/execute-skill-action.ts","./src/agent/master/next-action.ts","./src/agent/master/planner.ts","./src/agent/master/run.ts","./src/agent/master/scroller.ts","./src/agent/master/with-hints.ts","./src/agent/master/browser-tests/cua.spec.ts","./src/agent/master/browser-tests/fixtures.ts","./src/agent/master/browser-tests/index.spec.ts","./src/agent/master/browser-tests/skills.spec.ts","./src/agent/master/icon-descriptor/index.ts","./src/agent/master/icon-descriptor/normalize-svg.ts","./src/agent/planner/run-time-planner.ts","./src/agent/planner/run.ts","./src/artifacts/index.ts","./src/artifacts/utils.ts","./src/auth/cli-auth.ts","./src/auth/index.ts","./src/auth/token-store.ts","./src/bin/environments.ts","./src/bin/index.ts","./src/bin/setup.ts","./src/bin/logger/index.ts","./src/bin/utils/context.ts","./src/bin/utils/index.ts","./src/bin/utils/fs/index.ts","./src/bin/utils/platform/web/index.ts","./src/bin/utils/platform/web/test-files/ts-path-import-validate.ts","./src/bin/utils/scenarios/index.ts","./src/browser-injected-scripts/annotate-elements.spec.ts","./src/constants/index.ts","./src/dashboard/client.ts","./src/dashboard/index.ts","./src/dashboard/totp.ts","./src/dashboard/types.ts","./src/errors/index.ts","./src/evals/append-create-test-agent.evals.ts","./src/evals/fetch-pom-skills-agent.evals.ts","./src/evals/master-agent.evals.ts","./src/evals/type.ts","./src/evals/update-scenario-agent.evals.ts","./src/file/client.ts","./src/file/server.ts","./src/file-info/index.ts","./src/file-info/adapters/file-system/index.ts","./src/file-info/adapters/file-system/reader.ts","./src/file-info/adapters/github/index.ts","./src/file-info/adapters/github/reader.ts","./src/human-in-the-loop/cli.ts","./src/human-in-the-loop/index.ts","./src/human-in-the-loop/ipc.ts","./src/page/index.ts","./src/prompts/lib/ts-transformer.ts","./src/recorder/env-variables.ts","./src/recorder/index.ts","./src/recorder/request.ts","./src/recorder/temp-files.ts","./src/recorder/upload.ts","./src/recorder/validation.ts","./src/test-build/index.ts","./src/tools/diagnosis-fetcher.ts","./src/tools/index.ts","./src/tools/list-environments.ts","./src/tools/run-test.ts","./src/tools/test-gen-browser.ts","./src/tools/commit-and-create-pr/index.ts","./src/tools/definitions/commit-and-create-pr.ts","./src/tools/definitions/delete-file.ts","./src/tools/definitions/download-build.ts","./src/tools/definitions/fetch-video-analysis.ts","./src/tools/definitions/grep.ts","./src/tools/definitions/list-tests-and-projects.ts","./src/tools/definitions/merge-conflicts.ts","./src/tools/definitions/rename-file.ts","./src/tools/definitions/run-test.ts","./src/tools/definitions/str_replace_editor.ts","./src/tools/definitions/test-gen-browser.ts","./src/tools/definitions/upgrade-packages.ts","./src/tools/definitions/utils.ts","./src/tools/delete-file/index.ts","./src/tools/download-build/index.ts","./src/tools/executor/index.ts","./src/tools/executor/utils/checkpoint.ts","./src/tools/executor/utils/git.ts","./src/tools/executor/utils/index.ts","./src/tools/executor/utils/pr-description.ts","./src/tools/fetch-file/index.ts","./src/tools/fetch-last-successful-test-run/index.ts","./src/tools/fetch-video-analysis/index.ts","./src/tools/fetch-video-analysis/local-ffmpeg-client.ts","./src/tools/fetch-video-analysis/open-ai.ts","./src/tools/fetch-video-analysis/utils.ts","./src/tools/fetch-video-analysis/video-analysis.ts","./src/tools/file-operations/create.ts","./src/tools/file-operations/index.ts","./src/tools/file-operations/insert.ts","./src/tools/file-operations/replace.ts","./src/tools/file-operations/shared/git-helper.ts","./src/tools/file-operations/shared/helpers.ts","./src/tools/file-operations/view/index.ts","./src/tools/grep/index.ts","./src/tools/grep/types.ts","./src/tools/grep/ripgrep/index.ts","./src/tools/issues/create-issue.ts","./src/tools/issues/index.ts","./src/tools/issues/list-issues.ts","./src/tools/issues/metadata-schema.ts","./src/tools/issues/update-issue.ts","./src/tools/issues/utils.ts","./src/tools/list-tests-and-projects/index.ts","./src/tools/merge-conflicts/index.ts","./src/tools/rename-file/index.ts","./src/tools/test-run-fetcher/index.ts","./src/tools/test-run-fetcher/types.ts","./src/tools/trace-dot-zip/index.ts","./src/tools/trace-dot-zip/types.ts","./src/tools/trace-dot-zip/utils/console-trace.ts","./src/tools/trace-dot-zip/utils/extract-zip.ts","./src/tools/trace-dot-zip/utils/network-trace.ts","./src/tools/triage-summary/index.ts","./src/tools/triage-summary/types.ts","./src/tools/triage-summary/utils.ts","./src/tools/upgrade-packages/index.ts","./src/tools/upgrade-packages/utils.ts","./src/tools/utils/queue.ts","./src/tools/view-failed-test-run-report/index.ts","./src/trace-utils/index.ts","./src/types/handlebars.d.ts","./src/types/index.ts","./src/utils/SQSClient.ts","./src/utils/dedup-image-fs.ts","./src/utils/dedup-image.ts","./src/utils/env.ts","./src/utils/exec.ts","./src/utils/file.ts","./src/utils/html.ts","./src/utils/index.ts","./src/utils/json.ts","./src/utils/model.ts","./src/utils/playwright-report-parser.ts","./src/utils/repo-tree.ts","./src/utils/slug.ts","./src/utils/string.ts","./src/utils/stripAnsi.ts"],"version":"5.8.3"}
1
+ {"root":["./src/index.ts","./src/logger.ts","./src/actions/assert.ts","./src/actions/click.ts","./src/actions/done.ts","./src/actions/fill.ts","./src/actions/goto.ts","./src/actions/hover.ts","./src/actions/index.ts","./src/actions/next-task.ts","./src/actions/press.ts","./src/actions/skill.ts","./src/actions/text-content.ts","./src/actions/constants/index.ts","./src/actions/utils/index.ts","./src/agent/cli.ts","./src/agent/index.ts","./src/agent/base/index.ts","./src/agent/browsing/index.ts","./src/agent/browsing/run.ts","./src/agent/browsing/utils.ts","./src/agent/chat/agent-loop.ts","./src/agent/chat/exports.ts","./src/agent/chat/filesystem-cache.ts","./src/agent/chat/index.ts","./src/agent/chat/models.ts","./src/agent/chat/state.ts","./src/agent/chat/types.ts","./src/agent/chat/utils.ts","./src/agent/chat/prompt/pw-utils-docs.ts","./src/agent/chat/prompt/repo.ts","./src/agent/chat/prompt/test-case-def.ts","./src/agent/code-review/index.ts","./src/agent/code-review/parser.ts","./src/agent/code-review/types.ts","./src/agent/code-review/executor/index.ts","./src/agent/codegen/create-test-block.ts","./src/agent/codegen/fix-ts-errors.ts","./src/agent/codegen/lexical-scoped-vars.ts","./src/agent/codegen/skills-retriever.ts","./src/agent/codegen/test-update-feedback.ts","./src/agent/codegen/types.ts","./src/agent/codegen/update-flow.ts","./src/agent/codegen/use-skill.ts","./src/agent/codegen/utils.ts","./src/agent/cua/computer.ts","./src/agent/cua/index.ts","./src/agent/cua/model.ts","./src/agent/cua/pw-codegen/element-from-point.ts","./src/agent/cua/pw-codegen/types.ts","./src/agent/cua/pw-codegen/pw-pause/for-recorder.ts","./src/agent/cua/pw-codegen/pw-pause/index.ts","./src/agent/cua/pw-codegen/pw-pause/ipc.ts","./src/agent/cua/pw-codegen/pw-pause/patch.ts","./src/agent/cua/pw-codegen/pw-pause/types.ts","./src/agent/cua/pw-codegen/pw-pause/utils.ts","./src/agent/master/action-tool-calls.ts","./src/agent/master/element-annotation.ts","./src/agent/master/execute-browser-action.ts","./src/agent/master/execute-skill-action.ts","./src/agent/master/next-action.ts","./src/agent/master/planner.ts","./src/agent/master/run.ts","./src/agent/master/scroller.ts","./src/agent/master/with-hints.ts","./src/agent/master/browser-tests/cua.spec.ts","./src/agent/master/browser-tests/fixtures.ts","./src/agent/master/browser-tests/index.spec.ts","./src/agent/master/browser-tests/skills.spec.ts","./src/agent/master/icon-descriptor/index.ts","./src/agent/master/icon-descriptor/normalize-svg.ts","./src/agent/planner/run-time-planner.ts","./src/agent/planner/run.ts","./src/agent/triage/index.ts","./src/agent/video-analysis/index.ts","./src/agent/video-analysis/executor/index.ts","./src/artifacts/index.ts","./src/artifacts/utils.ts","./src/auth/cli-auth.ts","./src/auth/index.ts","./src/auth/token-store.ts","./src/bin/environments.ts","./src/bin/index.ts","./src/bin/setup.ts","./src/bin/logger/index.ts","./src/bin/utils/context.ts","./src/bin/utils/index.ts","./src/bin/utils/fs/index.ts","./src/bin/utils/platform/web/index.ts","./src/bin/utils/platform/web/test-files/ts-path-import-validate.ts","./src/bin/utils/scenarios/index.ts","./src/browser-injected-scripts/annotate-elements.spec.ts","./src/constants/index.ts","./src/dashboard/client.ts","./src/dashboard/index.ts","./src/dashboard/totp.ts","./src/dashboard/types.ts","./src/errors/index.ts","./src/evals/append-create-test-agent.evals.ts","./src/evals/fetch-pom-skills-agent.evals.ts","./src/evals/master-agent.evals.ts","./src/evals/type.ts","./src/evals/update-scenario-agent.evals.ts","./src/file/client.ts","./src/file/server.ts","./src/file-info/index.ts","./src/file-info/adapters/file-system/index.ts","./src/file-info/adapters/file-system/reader.ts","./src/file-info/adapters/github/index.ts","./src/file-info/adapters/github/reader.ts","./src/human-in-the-loop/cli.ts","./src/human-in-the-loop/index.ts","./src/human-in-the-loop/ipc.ts","./src/page/index.ts","./src/prompts/lib/ts-transformer.ts","./src/recorder/env-variables.ts","./src/recorder/index.ts","./src/recorder/request.ts","./src/recorder/temp-files.ts","./src/recorder/upload.ts","./src/recorder/validation.ts","./src/test-build/index.ts","./src/tools/diagnosis-fetcher.ts","./src/tools/index.ts","./src/tools/list-environments.ts","./src/tools/run-test.ts","./src/tools/test-gen-browser.ts","./src/tools/analyse-video/index.ts","./src/tools/create-pull-request/index.ts","./src/tools/create-pull-request/utils.ts","./src/tools/definitions/analyse-video.ts","./src/tools/definitions/delete-file.ts","./src/tools/definitions/download-build.ts","./src/tools/definitions/grep.ts","./src/tools/definitions/list-tests-and-projects.ts","./src/tools/definitions/merge-conflicts.ts","./src/tools/definitions/rename-file.ts","./src/tools/definitions/review-pull-request.ts","./src/tools/definitions/run-test.ts","./src/tools/definitions/str_replace_editor.ts","./src/tools/definitions/test-gen-browser.ts","./src/tools/definitions/upgrade-packages.ts","./src/tools/definitions/utils.ts","./src/tools/delete-file/index.ts","./src/tools/download-build/index.ts","./src/tools/executor/base.ts","./src/tools/executor/index.ts","./src/tools/executor/utils/checkpoint.ts","./src/tools/executor/utils/git.ts","./src/tools/executor/utils/index.ts","./src/tools/executor/utils/pr-description.ts","./src/tools/fetch-file/index.ts","./src/tools/fetch-last-successful-test-run/index.ts","./src/tools/fetch-session-diff/index.ts","./src/tools/file-operations/create.ts","./src/tools/file-operations/index.ts","./src/tools/file-operations/insert.ts","./src/tools/file-operations/replace.ts","./src/tools/file-operations/shared/helpers.ts","./src/tools/file-operations/view/index.ts","./src/tools/grep/index.ts","./src/tools/grep/types.ts","./src/tools/grep/ripgrep/index.ts","./src/tools/issues/create-issue.ts","./src/tools/issues/index.ts","./src/tools/issues/list-issues.ts","./src/tools/issues/metadata-schema.ts","./src/tools/issues/update-issue.ts","./src/tools/issues/utils.ts","./src/tools/list-tests-and-projects/index.ts","./src/tools/merge-conflicts/index.ts","./src/tools/rename-file/index.ts","./src/tools/review-pull-request/index.ts","./src/tools/test-run-fetcher/index.ts","./src/tools/test-run-fetcher/types.ts","./src/tools/trace-dot-zip/index.ts","./src/tools/trace-dot-zip/types.ts","./src/tools/trace-dot-zip/utils/console-trace.ts","./src/tools/trace-dot-zip/utils/extract-zip.ts","./src/tools/trace-dot-zip/utils/network-trace.ts","./src/tools/triage-summary/index.ts","./src/tools/triage-summary/types.ts","./src/tools/triage-summary/utils.ts","./src/tools/upgrade-packages/index.ts","./src/tools/upgrade-packages/utils.ts","./src/tools/utils/queue.ts","./src/tools/utils/urls.ts","./src/tools/view-failed-test-run-report/index.ts","./src/trace-utils/index.ts","./src/types/handlebars.d.ts","./src/types/index.ts","./src/utils/SQSClient.ts","./src/utils/artifact-paths.ts","./src/utils/dedup-image-fs.ts","./src/utils/dedup-image.ts","./src/utils/env.ts","./src/utils/exec.ts","./src/utils/file.ts","./src/utils/find-threshold.ts","./src/utils/hash.ts","./src/utils/html.ts","./src/utils/index.ts","./src/utils/json.ts","./src/utils/model.ts","./src/utils/playwright-report-parser.ts","./src/utils/repo-tree.ts","./src/utils/slug.ts","./src/utils/string.ts","./src/utils/stripAnsi.ts","./src/utils/ffmpeg/index.ts","./src/video-core/agent-orchestrator.ts","./src/video-core/analysis-server.ts","./src/video-core/index.ts","./src/video-core/model-limits.ts","./src/video-core/storage-manager.ts","./src/video-core/types.ts","./src/video-core/utils.ts","./src/video-core/xml-parser.ts"],"version":"5.8.3"}
@@ -1,5 +0,0 @@
1
- import { FileInfo } from "@empiricalrun/shared-types";
2
- export declare const getSystemPrompt: (repoInfo: FileInfo, mode?: string) => Promise<string>;
3
- export declare function buildTriageSystemPrompt(repoContext: string): Promise<string>;
4
- export declare function buildSystemPrompt(repoContext: string): Promise<string>;
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAKtD,eAAO,MAAM,eAAe,GAAU,UAAU,QAAQ,EAAE,OAAO,MAAM,oBAMtE,CAAC;AAEF,wBAAsB,uBAAuB,CAAC,WAAW,EAAE,MAAM,mBA8DhE;AAED,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,mBA8G1D"}
@@ -1,189 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSystemPrompt = void 0;
4
- exports.buildTriageSystemPrompt = buildTriageSystemPrompt;
5
- exports.buildSystemPrompt = buildSystemPrompt;
6
- const pw_utils_docs_1 = require("./pw-utils-docs");
7
- const repo_1 = require("./repo");
8
- const getSystemPrompt = async (repoInfo, mode) => {
9
- const repoContext = await (0, repo_1.getRepoInfoPrompt)(repoInfo);
10
- if (mode === "triage") {
11
- return await buildTriageSystemPrompt(repoContext);
12
- }
13
- return await buildSystemPrompt(repoContext);
14
- };
15
- exports.getSystemPrompt = getSystemPrompt;
16
- async function buildTriageSystemPrompt(repoContext) {
17
- return `
18
- You are a helpful assistant that help with analysis of Playwright test reports. Your goal is to help the user analyse a test report and identify the root cause of the test failures, and log the unique failuers as issues so that the user can keep a track and fix them.
19
-
20
- You are working on a test code repository that contains Playwright tests and other related files. Your working directory has been checked out on a git branch.
21
-
22
- # Your capabilities
23
-
24
- When provided with a test report URL, you can use these capabilities to triage the test failures in the report:
25
-
26
- ## Fetch and view the test report
27
-
28
- - Use viewFailedTestRunReportTool tool to get more information about all tests that failed in the run
29
-
30
- ## Analyze each test case
31
-
32
- You are provided with multiple tools to help you understand each failing test case better. Understanding each test case allows you to identify the root cause and create more accurate issues. These tools can also be called in parallel.
33
-
34
- - Each test case generates artifacts: images, videos, playwright trace zip file. With your tools, you can fetch image, analyze the video frames and trace.zip to find out failing network requests and console logs
35
- - Each video represents one browser tab of the test case (so multiple videos implies the test had multiple tabs or browser windows)
36
- - Read the error stack and test file to understand what the test is doing
37
- - Fetch the last successful run of the test case to understand the earlier flow. This report will contain image and video URLs that can also be analyzed with your available tools.
38
- - If you think the issue is explained by a timing or intermittent issue, you can also re-run the test case
39
-
40
- ## Listing, updating and creating issues
41
-
42
- - Test failures will become issues that can be assigned to developers to fix the app or update the test. Similar test failures should be grouped into one issue to avoid duplicates.
43
- - Before you create a new issue, you MUST list existing issues that have been created for this repo, to avoid creating duplicate issues.
44
- - If you find duplicates, use the update issue tool to update the existing issue with new information from the test report
45
- - When you are creating a new issue, use the description and title to clearly call out the error reason (share error stack, error message, relevant lines of code, etc.) so that a follow-up triaging session can match the issue against a new failure and avoid duplicate issues.
46
- - What makes a good issue: accurate classification between app or test issue, accurate grouping, and a good auto-fix prompt - see more about this below
47
-
48
- ## Classify tests as app or test issues
49
- - An app issue is an issue in the application that is being tested. This often shows up as a network failure, or error message in the console log, or an error toast in the UI. Use the last successful run artifacts to compare the app state between the successful and failed run.
50
- - A test issue is an issue in the test code. If the application has changed the UI, a selector in the test may no longer work. Or if the application has changed the flow, the test may need to be updated to reflect the new flow.
51
-
52
- ## Grouping test failures
53
- - Before you create issues, group the failures together so that we create useful issues
54
- - What makes a good group: failures that have the same root cause - because of similar error stacks - and can be fixed with the same change to the app or test
55
- - Both "type of failure" and "proposed fix" are important to determine if two failures belong to the same group
56
- - Example: if two tests fail with strict mode violations, but for 2 different selectors, they are different groups because the proposed fixes are different
57
- - What does not make a good group: the location of the test or the name of the test. Two tests that are located in the same file or have similar names should ONLY be grouped together if the root cause of failures is same
58
-
59
- ## Crafting a good auto-fix prompt for test issues
60
- - When you create issues with type "test", you are expected to share a test_issue_prompt which is your proposed change to the test to adapt to the new app state.
61
- - This prompt is handed over to another agent to update the test code, and your prompt is the ONLY context that the agent has to update the test.
62
- - Therefore, your prompt must contain:
63
- - Which test cases to be updated - with test and describe block names, file name
64
- - What failed in the test - error message, error stack, relevant lines of code, or bits to locate the failure
65
- - Your suggested change to the test
66
- - Emphasis to re-run the test after making the change, to ensure that the change works
67
-
68
- ## Conclusion
69
- - After you are done with triaging and creating issues, summarize the work done with a list of created issues for the user to review. Don't be too verbose - a bullet list of issues created or updated, with a small description is enough.
70
- - It is important to show proof that you have gone through all of the failures in the test run report, so use numbers to call out 1. total failures, and 2. failures associated with each issue.
71
-
72
- # Repo context
73
- ${repoContext}
74
-
75
- # Reference
76
- Today's date is ${new Date().toDateString()}
77
- `;
78
- }
79
- async function buildSystemPrompt(repoContext) {
80
- const preamble = `
81
- You are a helpful assistant that can answer questions and help with tasks related to writing and maintaining Playwright tests.
82
-
83
- You are working on a test code repository that contains Playwright tests and other related files. Your working directory
84
- has been checked out on a git branch, and your actions that edit files will be automatically committed. If you make any
85
- file edits, you must create a pull request after your work is done, to get your work reviewed and merged by a human.
86
-
87
- # Your capabilities
88
-
89
- - Adding new Playwright tests or helper methods
90
- - Going through test reports and identifying app issues versus test issues
91
- - Modifying existing tests to adapt to changes in the application
92
- - Modifying repo configuration (e.g. in playwright.config.ts) and dependencies (e.g. in package.json)
93
-
94
- # Going through test reports
95
-
96
- - App issues: app issues caught by test failures, like UI issues, API endpoint issues, etc. These are issues that
97
- will be reported to an app developer to investigate and fix.
98
- - Test issues: Playwright tests can become outdated when app code changes. These are issues that need to be
99
- fixed with modifications to the test code, and it is your job to do that.
100
-
101
- # Tools
102
-
103
- You are given a set of tools to help you fulfill the user's request. Read their descriptions to
104
- understand what each tool does.
105
-
106
- For example, if the user asks you to run a test, you could use the runTest tool.
107
- Once the test is run, you will receive the results in the form of a JSON object.
108
- Summarize the results in a few sentences.
109
-
110
- If the user provides a diagnosis URL, you can use the fetchDiagnosisDetails tool
111
- to get more information about the test case and its results.
112
-
113
- If the user provides a test run URL, you can use the fetchTestRunDetails tool
114
- to get detailed information about a specific test run.
115
-
116
- Or if the user asks you to modify a test, you could use the generateTestWithBrowserAgent tool. If you suspect
117
- that a UI selector needs to be updated, using the browser agent is a good idea.
118
-
119
- Before using generateTestWithBrowserAgent, you need to prepare the test code for the browser agent.
120
- You can do this by using the strReplaceEditor or the text editor tool to add a TODO comment to the test
121
- code. This comment explains to the browser agent what it needs to do.
122
-
123
- For example, if the expected modification is to click on a login button, you could add the following comment.
124
-
125
- // TODO(agent): Click on the login button
126
-
127
- The position of the comment is important: the browser agent will look for this comment and replace it with
128
- the actual code to click on the login button. If you are fixing a failing test, your comment should be
129
- around the failing line of code, so that it can be replaced/modified.
130
-
131
- # Proactiveness
132
-
133
- 1. You are allowed to be proactive, but ONLY for read-only tool calls: like searching for content, reading files, fetching data from tools, and
134
- running Playwright tests.
135
- 2. For any read-write tool calls (e.g. modifying any file), you should share your plan and get the user's approval before proceeding.
136
-
137
- # Rules to follow
138
-
139
- You must follow these rules while adding new tests or modifying existing tests. There can be exceptions to these rules, but
140
- ONLY when explicitly asked for by the user.
141
-
142
- 1. You can't delete some steps from the test to make it pass. The test needs to accomplish its objective (which is to validate a particular user scenario)
143
- 2. Do not add any conditional logic or try catch blocks in a test. A good test deterministically tests a user scenario
144
- 3. Trust Playwright's ability to auto-wait while taking actions on elements.
145
- - Example 1: Do not add checks on locator.isVisible() before clicking on it: Playwright already waits for visibility on locator.click()
146
- - Example 2: Do not add page.waitForLoadState after a page.goto: Playwright already waits for page "load" event in page.goto()
147
- 4. Do not add waitForTimeout or waitForLoadState in a test. Playwright will automatically wait for the page to load.
148
- 5. Try/catch blocks are a code smell for tests: you should not use them.
149
- 6. Do not use then() or catch() syntax in a test. Use async/await only
150
-
151
- There are few exceptions to these rules. BEFORE applying any of the following exceptions, you MUST share your plan with the user and get their approval.
152
-
153
- ## Exceptions for conditional logic
154
-
155
- There are few exceptions where you can add conditional logic to a test. If the application UI reveals some UI elements on certain conditions, we can add conditional logic.
156
-
157
- For example, a form view shows a "Save" button only when the form is dirty. In this case, we will have to check if the "Save" button is visible before clicking on it. To do this,
158
- follow this pattern:
159
-
160
- \`\`\`
161
- const saveButton = page.getByRole('button', { name: 'Save' });
162
- if (await saveButton.isVisible()) {
163
- await saveButton.click();
164
- }
165
- \`\`\`
166
-
167
- Note that locator.isVisible() DOES NOT wait for the element to be visible. If the element in question shows up after a delay, we have no option but to add a waitForTimeout.
168
-
169
- \`\`\`
170
- const saveButton = page.getByRole('button', { name: 'Save' });
171
- await page.waitForTimeout(100); // Wait for the element to be visible -- only if necessary.
172
- if (await saveButton.isVisible()) {
173
- await saveButton.click();
174
- }
175
- \`\`\`
176
-
177
- `;
178
- return `${preamble}
179
-
180
- # Recipes
181
- ${pw_utils_docs_1.playwrightUtilsDocs}
182
-
183
- # Repo context
184
- ${repoContext}
185
-
186
- # Reference
187
- Today's date is ${new Date().toDateString()}
188
- `;
189
- }
@@ -1,21 +0,0 @@
1
- import { IChatModel } from "@empiricalrun/llm/chat";
2
- import type { ChatState, PendingToolCall, SupportedChatModels, ToolResult } from "@empiricalrun/shared-types";
3
- export declare function rejectPendingToolCalls({ chatState, chatModel, }: {
4
- chatState: ChatState;
5
- chatModel: IChatModel<any>;
6
- }): ChatState;
7
- export declare function filterPendingToolCalls({ toolCalls, toolResults, pendingToolCalls, }: {
8
- toolCalls: PendingToolCall[];
9
- toolResults: ToolResult[];
10
- pendingToolCalls: PendingToolCall[];
11
- }): {
12
- filteredToolCalls: PendingToolCall[];
13
- filteredToolResults: ToolResult[];
14
- };
15
- export declare function processToolCallsAndUpdateChatState({ toolCalls, toolResults, chatModel, selectedModel, }: {
16
- toolCalls: PendingToolCall[];
17
- toolResults: ToolResult[];
18
- chatModel: IChatModel<any>;
19
- selectedModel: SupportedChatModels;
20
- }): ChatState | undefined;
21
- //# sourceMappingURL=tool-calls.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tool-calls.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/utils/tool-calls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,UAAU,EACX,MAAM,4BAA4B,CAAC;AAOpC,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,SAAS,GACV,EAAE;IACD,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;CAC5B,GAAG,SAAS,CA8BZ;AAED,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,WAAW,EACX,gBAAgB,GACjB,EAAE;IACD,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,gBAAgB,EAAE,eAAe,EAAE,CAAC;CACrC;;;EAgBA;AAED,wBAAgB,kCAAkC,CAAC,EACjD,SAAS,EACT,WAAW,EACX,SAAS,EACT,aAAa,GACd,EAAE;IACD,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAC3B,aAAa,EAAE,mBAAmB,CAAC;CACpC,GAAG,SAAS,GAAG,SAAS,CAkBxB"}
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rejectPendingToolCalls = rejectPendingToolCalls;
4
- exports.filterPendingToolCalls = filterPendingToolCalls;
5
- exports.processToolCallsAndUpdateChatState = processToolCallsAndUpdateChatState;
6
- const state_1 = require("../state");
7
- const TOOL_CALL_REJECTED_BY_USER_ERROR = "This tool call was rejected by the user.";
8
- function rejectPendingToolCalls({ chatState, chatModel, }) {
9
- const pendingToolCalls = chatModel.getPendingToolCalls();
10
- let updatedChatState = {
11
- ...chatState,
12
- // When tool calls are rejected, we reset askUserForInput to true
13
- // so that the user can provide input for the next tool call. The agent
14
- // loop is not run again until the user provides input.
15
- askUserForInput: true,
16
- };
17
- if (pendingToolCalls.length > 0) {
18
- const toolResults = pendingToolCalls.map((toolCall) => {
19
- console.log(`Rejecting pending tool calls with toolCallId: ${toolCall.id} `);
20
- return {
21
- isError: true,
22
- result: TOOL_CALL_REJECTED_BY_USER_ERROR,
23
- };
24
- });
25
- chatModel.pushToolResultsMessage(pendingToolCalls, toolResults);
26
- return {
27
- ...updatedChatState,
28
- messages: chatModel.messages,
29
- };
30
- }
31
- return updatedChatState;
32
- }
33
- function filterPendingToolCalls({ toolCalls, toolResults, pendingToolCalls, }) {
34
- const filteredToolResults = [];
35
- const filteredToolCalls = toolCalls.filter((call, index) => {
36
- if (pendingToolCalls.some((p) => p.id === call.id)) {
37
- filteredToolResults.push(toolResults[index]);
38
- return true;
39
- }
40
- return false;
41
- });
42
- return {
43
- filteredToolCalls,
44
- filteredToolResults,
45
- };
46
- }
47
- function processToolCallsAndUpdateChatState({ toolCalls, toolResults, chatModel, selectedModel, }) {
48
- const pendingToolCalls = chatModel.getPendingToolCalls() || [];
49
- const { filteredToolCalls, filteredToolResults } = filterPendingToolCalls({
50
- toolCalls,
51
- toolResults,
52
- pendingToolCalls,
53
- });
54
- if (filteredToolCalls.length > 0) {
55
- chatModel.pushToolResultsMessage(filteredToolCalls, filteredToolResults);
56
- const newChatState = (0, state_1.createChatStateForMessages)({
57
- messages: chatModel.messages || [],
58
- selectedModel,
59
- askUserForInput: chatModel.askUserForInput,
60
- error: null,
61
- });
62
- return newChatState;
63
- }
64
- }
@@ -1,2 +0,0 @@
1
- export declare const PROMPT = "\nIdentify code smells in tests\n- try-catch\n- conditionals added without a comment\n\nPlaywright gotchas\n- isVisible(), count() do not auto-wait\n\nPlaywright code smells\n- waitForLoadState is not required\n - Especially with \"networkidle\", because modern webapps keep doing network activity\n\nIdentify test assumptions\n- What data does the test require?\n- Clean up test entities\n";
2
- //# sourceMappingURL=prompt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/agent/code-review/prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,8YAelB,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PROMPT = void 0;
4
- exports.PROMPT = `
5
- Identify code smells in tests
6
- - try-catch
7
- - conditionals added without a comment
8
-
9
- Playwright gotchas
10
- - isVisible(), count() do not auto-wait
11
-
12
- Playwright code smells
13
- - waitForLoadState is not required
14
- - Especially with "networkidle", because modern webapps keep doing network activity
15
-
16
- Identify test assumptions
17
- - What data does the test require?
18
- - Clean up test entities
19
- `;
@@ -1,11 +0,0 @@
1
- import { TraceClient } from "@empiricalrun/llm";
2
- import { TestErrorDiagnosisDetails } from "@empiricalrun/shared-types";
3
- import { CustomLogger } from "../../bin/logger";
4
- export declare function createTaskUsingFailureDiagnosis({ trace, diagnosis, logger, }: {
5
- trace?: TraceClient;
6
- diagnosis: TestErrorDiagnosisDetails;
7
- logger?: CustomLogger;
8
- }): Promise<{
9
- task: string;
10
- }>;
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/diagnosis-agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAoChD,wBAAsB,+BAA+B,CAAC,EACpD,KAAK,EACL,SAAS,EACT,MAAM,GACP,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,yBAAyB,CAAC;IACrC,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAqE5B"}
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createTaskUsingFailureDiagnosis = createTaskUsingFailureDiagnosis;
4
- const llm_1 = require("@empiricalrun/llm");
5
- const strict_mode_violation_1 = require("./strict-mode-violation");
6
- const responseFormat = {
7
- type: "json_schema",
8
- json_schema: {
9
- name: "test-case-auto-fix-summary",
10
- strict: true,
11
- schema: {
12
- type: "object",
13
- properties: {
14
- observation: {
15
- type: "array",
16
- items: {
17
- type: "string",
18
- },
19
- description: "Detailed observation of what changed between successful and failed test screenshots",
20
- },
21
- action: {
22
- type: "string",
23
- description: "Direct action to fix the test in natural language without code snippets or options",
24
- },
25
- },
26
- required: ["observation", "action"],
27
- additionalProperties: false,
28
- },
29
- },
30
- };
31
- async function createTaskUsingFailureDiagnosis({ trace, diagnosis, logger, }) {
32
- const failureDiagnosisSpan = trace?.span({
33
- name: "auto-fix",
34
- input: {
35
- diagnosisId: diagnosis.diagnosisId,
36
- },
37
- });
38
- logger?.log("Trying to fix the test using failure diagnosis. Fetching key moments of the diagnosis");
39
- const resp = await fetch(diagnosis.keyMomentsUrl);
40
- // TODO: check for response to be not ok
41
- if (resp.ok) {
42
- logger?.success("Successfully fetched key moments of the diagnosis");
43
- }
44
- else {
45
- logger?.warn("Failed to fetch key moments of the diagnosis");
46
- }
47
- const screenshotsData = await resp.json();
48
- const llm = new llm_1.LLM({
49
- provider: "openai",
50
- defaultModel: "o1",
51
- trace: failureDiagnosisSpan,
52
- });
53
- // TODO: make this dynamic in nature. the prompts should be made receipe
54
- // which will help to get rid of if else logic
55
- // receipe to have:
56
- // 1. selection criteria
57
- // 2. job to be done - in this case generate a prompt
58
- let prompt;
59
- if (diagnosis.failed_run_metadata.stack.includes("strict mode violation")) {
60
- prompt = (0, strict_mode_violation_1.fixStrictModeViolationPrompt)({
61
- screenshotsData,
62
- diagnosis,
63
- });
64
- }
65
- if (prompt) {
66
- const llmResponse = await llm.createChatCompletion({
67
- messages: prompt,
68
- modelParameters: {
69
- max_completion_tokens: 40_000,
70
- },
71
- responseFormat,
72
- });
73
- const { observation, action } = JSON.parse(llmResponse?.content);
74
- failureDiagnosisSpan?.update({
75
- output: {
76
- observation,
77
- action,
78
- },
79
- });
80
- return {
81
- task: action,
82
- };
83
- }
84
- // TODO: handle default prompt
85
- return {
86
- task: "",
87
- };
88
- }
@@ -1,10 +0,0 @@
1
- import { TestErrorDiagnosisDetails } from "@empiricalrun/shared-types";
2
- import OpenAI from "openai";
3
- export declare function fixStrictModeViolationPrompt({ screenshotsData, diagnosis, }: {
4
- screenshotsData: {
5
- success: string[];
6
- failure: string[];
7
- };
8
- diagnosis: TestErrorDiagnosisDetails;
9
- }): OpenAI.Chat.Completions.ChatCompletionMessageParam[];
10
- //# sourceMappingURL=strict-mode-violation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strict-mode-violation.d.ts","sourceRoot":"","sources":["../../../src/agent/diagnosis-agent/strict-mode-violation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAoB5B,wBAAgB,4BAA4B,CAAC,EAC3C,eAAe,EACf,SAAS,GACV,EAAE;IACD,eAAe,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC1D,SAAS,EAAE,yBAAyB,CAAC;CACtC,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,CAiBvD"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fixStrictModeViolationPrompt = fixStrictModeViolationPrompt;
4
- const llm_1 = require("@empiricalrun/llm");
5
- const promptTemplate_0 = "{{#section \"system\"}}\nAs a software engineer, your task is to identify a fix for a failing Playwright test by analyzing screenshots of both the failed and successful test steps.\n\nKey issues for test failures include:\n- Duplicate elements for the same Playwright selector.\n\nInstructions:\n1. Examine the provided successful and failed test screenshots.\n2. Identify the correct element for action based on these observations on the successful test run screenshots.\n3. Sometimes the exact same locator is not available on failed test run screenshot, you need to identify the intent from successful test screenshots and apply that intent in failed test run screenshot to identify the right locator to interact with\n4. Evaluate the playwright selector options provided to you to execute the action. Pick the selector which best matches the intent of the test.\n5. Propose a precise action that addresses the issue.\n\nExample:\n- observation: \n - Current step failure: await page.getByText(\"Audience\").click()\n - Two similar buttons named \"Audience\" exist in the failed run screenshots\n - The successful test run clicked on \"Untracked Audience\"\n - The failed test run should click on \"Untracked Audience\"\n - Available locators: await page.getByText(\"Untracked Audience\").click() contain the selector for Untracked Audience\n- action: Replace failing line with await page.getByText(\"Untracked Audience\").click()\n\nYour action should:\n- Be directly actionable and free of ambiguity, as it will guide another LLM to generate code.\n- Be in natural language and not just code snippet.\n- Be verified as feasible on the failure screen before responding.\n- Choose from the provided possible actions that can be executed on the failure screen.\n- Action should adhere to the format mentioned in the example, i.e. it should start with \"Replace the failing line\" and the updated code with replaced selector following it.\n\nEnsure the action is executable based on the failure screen context before providing it.\n{{/section}}\n\n{{#section \"user\"}}\nSuccessful test screenshots\n\n{{images successScreenshots}}\n\nFailed test screenshots\n\n{{images failedScreenshots}}\n\nStep where test failed:\n{{failingLine}}\n\nOptions for Playwright selectors to perform actions on a failed test screen:\n{{selectorOptions}}\n\n{{/section}}\n\n";
6
- function extractLocatorOptions(errorStack) {
7
- // This regex matches a chain of locator API calls following the pattern:
8
- // functionName(arguments) optionally chained with .functionName(arguments)
9
- const regex = /aka\s+((?:[A-Za-z0-9_]+\([^)]*\)(?:\.[A-Za-z0-9_]+\([^)]*\))*))/g;
10
- const options = [];
11
- let match;
12
- while ((match = regex.exec(errorStack)) !== null) {
13
- if (match[1]) {
14
- options.push(match[1]);
15
- }
16
- }
17
- return options;
18
- }
19
- function fixStrictModeViolationPrompt({ screenshotsData, diagnosis, }) {
20
- const compiledPrompt = (0, llm_1.compilePrompt)(promptTemplate_0, {
21
- failingLine: diagnosis.failingLine,
22
- successScreenshots: screenshotsData.success,
23
- failedScreenshots: screenshotsData.failure,
24
- selectorOptions: extractLocatorOptions(diagnosis.failed_run_metadata.stack).join("\n"),
25
- }, {
26
- imageDetail: "high",
27
- modelProvider: "openai",
28
- });
29
- return compiledPrompt;
30
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/commit-and-create-pr/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAevD,eAAO,MAAM,qBAAqB,EAAE,IAgFnC,CAAC"}