@empiricalrun/test-gen 0.73.1 → 0.74.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 (313) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/dist/actions/utils/index.d.ts.map +1 -1
  3. package/dist/actions/utils/index.js +1 -2
  4. package/dist/agent/browsing/index.d.ts.map +1 -1
  5. package/dist/agent/browsing/index.js +9 -7
  6. package/dist/agent/browsing/utils.d.ts.map +1 -1
  7. package/dist/agent/browsing/utils.js +3 -4
  8. package/dist/agent/chat/agent-loop.d.ts +7 -8
  9. package/dist/agent/chat/agent-loop.d.ts.map +1 -1
  10. package/dist/agent/chat/agent-loop.js +13 -17
  11. package/dist/agent/chat/exports.d.ts +5 -4
  12. package/dist/agent/chat/exports.d.ts.map +1 -1
  13. package/dist/agent/chat/exports.js +9 -4
  14. package/dist/agent/chat/filesystem-cache.d.ts +12 -0
  15. package/dist/agent/chat/filesystem-cache.d.ts.map +1 -0
  16. package/dist/agent/chat/filesystem-cache.js +101 -0
  17. package/dist/agent/chat/index.d.ts +4 -1
  18. package/dist/agent/chat/index.d.ts.map +1 -1
  19. package/dist/agent/chat/index.js +44 -22
  20. package/dist/agent/chat/models.d.ts +2 -1
  21. package/dist/agent/chat/models.d.ts.map +1 -1
  22. package/dist/agent/chat/models.js +25 -3
  23. package/dist/agent/chat/prompt/index.d.ts +3 -1
  24. package/dist/agent/chat/prompt/index.d.ts.map +1 -1
  25. package/dist/agent/chat/prompt/index.js +77 -2
  26. package/dist/agent/chat/prompt/repo.d.ts.map +1 -1
  27. package/dist/agent/chat/prompt/repo.js +1 -0
  28. package/dist/agent/chat/state.d.ts +6 -5
  29. package/dist/agent/chat/state.d.ts.map +1 -1
  30. package/dist/agent/chat/state.js +35 -5
  31. package/dist/agent/chat/utils.d.ts +1 -0
  32. package/dist/agent/chat/utils.d.ts.map +1 -1
  33. package/dist/agent/chat/utils.js +16 -3
  34. package/dist/agent/cua/index.js +1 -1
  35. package/dist/agent/cua/model.js +1 -1
  36. package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -1
  37. package/dist/agent/cua/pw-codegen/pw-pause/index.js +0 -1
  38. package/dist/agent/master/browser-tests/fixtures.d.ts.map +1 -1
  39. package/dist/agent/master/browser-tests/fixtures.js +0 -1
  40. package/dist/agent/master/element-annotation.d.ts.map +1 -1
  41. package/dist/agent/master/element-annotation.js +1 -2
  42. package/dist/agent/master/execute-browser-action.d.ts.map +1 -1
  43. package/dist/agent/master/execute-browser-action.js +8 -6
  44. package/dist/agent/master/icon-descriptor/index.js +2 -2
  45. package/dist/agent/master/next-action.js +1 -1
  46. package/dist/agent/master/planner.js +1 -1
  47. package/dist/agent/master/scroller.js +2 -2
  48. package/dist/agent/master/with-hints.d.ts.map +1 -1
  49. package/dist/agent/master/with-hints.js +6 -5
  50. package/dist/agent/planner/run-time-planner.js +1 -1
  51. package/dist/agent/planner/run.d.ts.map +1 -1
  52. package/dist/agent/planner/run.js +4 -2
  53. package/dist/auth/cli-auth.js +1 -1
  54. package/dist/auth/token-store.d.ts.map +1 -1
  55. package/dist/auth/token-store.js +4 -6
  56. package/dist/bin/index.js +30 -163
  57. package/dist/bin/utils/context.js +1 -1
  58. package/dist/bin/utils/index.d.ts +0 -12
  59. package/dist/bin/utils/index.d.ts.map +1 -1
  60. package/dist/bin/utils/index.js +0 -70
  61. package/dist/bin/utils/platform/web/index.d.ts +2 -2
  62. package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
  63. package/dist/bin/utils/platform/web/index.js +7 -5
  64. package/dist/bin/utils/scenarios/index.d.ts +11 -3
  65. package/dist/bin/utils/scenarios/index.d.ts.map +1 -1
  66. package/dist/browser-injected-scripts/annotate-elements.spec.js +0 -5
  67. package/dist/browser-injected-scripts/annotate-elements.spec.ts +0 -5
  68. package/dist/dashboard/client.d.ts +2 -2
  69. package/dist/dashboard/client.d.ts.map +1 -1
  70. package/dist/dashboard/client.js +4 -1
  71. package/dist/file-info/adapters/file-system/index.d.ts +9 -0
  72. package/dist/file-info/adapters/file-system/index.d.ts.map +1 -0
  73. package/dist/file-info/adapters/file-system/index.js +25 -0
  74. package/dist/file-info/adapters/file-system/reader.d.ts +6 -0
  75. package/dist/file-info/adapters/file-system/reader.d.ts.map +1 -0
  76. package/dist/file-info/{file-system.js → adapters/file-system/reader.js} +16 -0
  77. package/dist/file-info/adapters/github/index.d.ts +11 -0
  78. package/dist/file-info/adapters/github/index.d.ts.map +1 -0
  79. package/dist/file-info/adapters/github/index.js +29 -0
  80. package/dist/file-info/adapters/github/reader.d.ts +16 -0
  81. package/dist/file-info/adapters/github/reader.d.ts.map +1 -0
  82. package/dist/file-info/adapters/github/reader.js +185 -0
  83. package/dist/file-info/index.d.ts +4 -0
  84. package/dist/file-info/index.d.ts.map +1 -0
  85. package/dist/file-info/index.js +10 -0
  86. package/dist/index.d.ts +2 -0
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +6 -1
  89. package/dist/recorder/index.d.ts +7 -3
  90. package/dist/recorder/index.d.ts.map +1 -1
  91. package/dist/recorder/index.js +181 -64
  92. package/dist/recorder/temp-files.d.ts +1 -1
  93. package/dist/recorder/temp-files.d.ts.map +1 -1
  94. package/dist/recorder/temp-files.js +2 -2
  95. package/dist/recorder/upload.d.ts +1 -1
  96. package/dist/recorder/upload.d.ts.map +1 -1
  97. package/dist/recorder/upload.js +3 -3
  98. package/dist/tools/{commit-and-create-pr.d.ts → commit-and-create-pr/index.d.ts} +1 -1
  99. package/dist/tools/commit-and-create-pr/index.d.ts.map +1 -0
  100. package/dist/tools/{commit-and-create-pr.js → commit-and-create-pr/index.js} +8 -28
  101. package/dist/tools/definitions/commit-and-create-pr.d.ts +3 -0
  102. package/dist/tools/definitions/commit-and-create-pr.d.ts.map +1 -0
  103. package/dist/tools/definitions/commit-and-create-pr.js +31 -0
  104. package/dist/tools/definitions/delete-file.d.ts +3 -0
  105. package/dist/tools/definitions/delete-file.d.ts.map +1 -0
  106. package/dist/tools/definitions/delete-file.js +20 -0
  107. package/dist/tools/{download-build.d.ts → definitions/download-build.d.ts} +2 -2
  108. package/dist/tools/definitions/download-build.d.ts.map +1 -0
  109. package/dist/tools/definitions/download-build.js +18 -0
  110. package/dist/tools/definitions/fetch-video-analysis.d.ts +11 -0
  111. package/dist/tools/definitions/fetch-video-analysis.d.ts.map +1 -0
  112. package/dist/tools/definitions/fetch-video-analysis.js +26 -0
  113. package/dist/tools/definitions/grep.d.ts +3 -0
  114. package/dist/tools/definitions/grep.d.ts.map +1 -0
  115. package/dist/tools/definitions/grep.js +29 -0
  116. package/dist/tools/definitions/merge-conflicts.d.ts +3 -0
  117. package/dist/tools/definitions/merge-conflicts.d.ts.map +1 -0
  118. package/dist/tools/definitions/merge-conflicts.js +24 -0
  119. package/dist/tools/definitions/run-test.d.ts +2 -2
  120. package/dist/tools/definitions/run-test.d.ts.map +1 -1
  121. package/dist/tools/definitions/run-test.js +4 -7
  122. package/dist/tools/definitions/str_replace_editor.d.ts.map +1 -1
  123. package/dist/tools/definitions/str_replace_editor.js +9 -5
  124. package/dist/tools/definitions/test-gen-browser.d.ts +5 -5
  125. package/dist/tools/definitions/test-gen-browser.d.ts.map +1 -1
  126. package/dist/tools/definitions/test-gen-browser.js +4 -7
  127. package/dist/tools/definitions/upgrade-packages.d.ts +36 -0
  128. package/dist/tools/definitions/upgrade-packages.d.ts.map +1 -0
  129. package/dist/tools/definitions/upgrade-packages.js +21 -0
  130. package/dist/tools/definitions/utils.d.ts +15 -0
  131. package/dist/tools/definitions/utils.d.ts.map +1 -0
  132. package/dist/tools/definitions/utils.js +16 -0
  133. package/dist/tools/{delete-file.d.ts → delete-file/index.d.ts} +1 -1
  134. package/dist/tools/delete-file/index.d.ts.map +1 -0
  135. package/dist/tools/{delete-file.js → delete-file/index.js} +4 -16
  136. package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
  137. package/dist/tools/diagnosis-fetcher.js +13 -11
  138. package/dist/tools/download-build/index.d.ts +3 -0
  139. package/dist/tools/download-build/index.d.ts.map +1 -0
  140. package/dist/tools/{download-build.js → download-build/index.js} +4 -14
  141. package/dist/tools/executor/index.d.ts.map +1 -1
  142. package/dist/tools/executor/index.js +19 -4
  143. package/dist/tools/executor/utils/git.js +1 -1
  144. package/dist/tools/executor/utils/pr-description.d.ts +1 -1
  145. package/dist/tools/executor/utils/pr-description.d.ts.map +1 -1
  146. package/dist/tools/fetch-image/index.d.ts +10 -1
  147. package/dist/tools/fetch-image/index.d.ts.map +1 -1
  148. package/dist/tools/fetch-image/index.js +1 -0
  149. package/dist/tools/fetch-last-successful-test-run/index.d.ts +3 -0
  150. package/dist/tools/fetch-last-successful-test-run/index.d.ts.map +1 -0
  151. package/dist/tools/fetch-last-successful-test-run/index.js +60 -0
  152. package/dist/tools/fetch-video-analysis/index.d.ts +5 -0
  153. package/dist/tools/fetch-video-analysis/index.d.ts.map +1 -0
  154. package/dist/tools/fetch-video-analysis/index.js +89 -0
  155. package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts +24 -0
  156. package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts.map +1 -0
  157. package/dist/tools/fetch-video-analysis/local-ffmpeg-client.js +209 -0
  158. package/dist/tools/fetch-video-analysis/utils.d.ts +10 -0
  159. package/dist/tools/fetch-video-analysis/utils.d.ts.map +1 -0
  160. package/dist/tools/fetch-video-analysis/utils.js +72 -0
  161. package/dist/tools/fetch-video-analysis/video-analysis.d.ts +7 -0
  162. package/dist/tools/fetch-video-analysis/video-analysis.d.ts.map +1 -0
  163. package/dist/tools/fetch-video-analysis/video-analysis.js +54 -0
  164. package/dist/tools/file-operations/create.d.ts +11 -0
  165. package/dist/tools/file-operations/create.d.ts.map +1 -0
  166. package/dist/tools/file-operations/create.js +60 -0
  167. package/dist/tools/file-operations/index.d.ts +15 -0
  168. package/dist/tools/file-operations/index.d.ts.map +1 -0
  169. package/dist/tools/file-operations/index.js +143 -0
  170. package/dist/tools/file-operations/insert.d.ts +11 -0
  171. package/dist/tools/file-operations/insert.d.ts.map +1 -0
  172. package/dist/tools/file-operations/insert.js +61 -0
  173. package/dist/tools/file-operations/replace.d.ts +11 -0
  174. package/dist/tools/file-operations/replace.d.ts.map +1 -0
  175. package/dist/tools/file-operations/replace.js +80 -0
  176. package/dist/tools/file-operations/shared/git-helper.d.ts +4 -0
  177. package/dist/tools/file-operations/shared/git-helper.d.ts.map +1 -0
  178. package/dist/tools/file-operations/shared/git-helper.js +29 -0
  179. package/dist/tools/file-operations/shared/helpers.d.ts +19 -0
  180. package/dist/tools/file-operations/shared/helpers.d.ts.map +1 -0
  181. package/dist/tools/file-operations/shared/helpers.js +133 -0
  182. package/dist/tools/file-operations/view/index.d.ts +14 -0
  183. package/dist/tools/file-operations/view/index.d.ts.map +1 -0
  184. package/dist/tools/file-operations/view/index.js +56 -0
  185. package/dist/tools/grep/index.d.ts.map +1 -1
  186. package/dist/tools/grep/index.js +2 -9
  187. package/dist/tools/grep/ripgrep/index.d.ts +2 -2
  188. package/dist/tools/grep/ripgrep/index.d.ts.map +1 -1
  189. package/dist/tools/grep/ripgrep/index.js +3 -3
  190. package/dist/tools/grep/types.d.ts.map +1 -0
  191. package/dist/tools/index.d.ts +7 -2
  192. package/dist/tools/index.d.ts.map +1 -1
  193. package/dist/tools/index.js +66 -22
  194. package/dist/tools/issues/create-issue.d.ts +3 -0
  195. package/dist/tools/issues/create-issue.d.ts.map +1 -0
  196. package/dist/tools/issues/create-issue.js +76 -0
  197. package/dist/tools/issues/index.d.ts +4 -0
  198. package/dist/tools/issues/index.d.ts.map +1 -0
  199. package/dist/tools/issues/index.js +9 -0
  200. package/dist/tools/issues/list-issues.d.ts +3 -0
  201. package/dist/tools/issues/list-issues.d.ts.map +1 -0
  202. package/dist/tools/issues/list-issues.js +32 -0
  203. package/dist/tools/issues/metadata-schema.d.ts +24 -0
  204. package/dist/tools/issues/metadata-schema.d.ts.map +1 -0
  205. package/dist/tools/issues/metadata-schema.js +22 -0
  206. package/dist/tools/issues/update-issue.d.ts +3 -0
  207. package/dist/tools/issues/update-issue.d.ts.map +1 -0
  208. package/dist/tools/issues/update-issue.js +75 -0
  209. package/dist/tools/issues/utils.d.ts +5 -0
  210. package/dist/tools/issues/utils.d.ts.map +1 -0
  211. package/dist/tools/issues/utils.js +26 -0
  212. package/dist/tools/list-environments.d.ts.map +1 -1
  213. package/dist/tools/list-environments.js +4 -0
  214. package/dist/tools/{merge-conflicts.d.ts → merge-conflicts/index.d.ts} +1 -1
  215. package/dist/tools/merge-conflicts/index.d.ts.map +1 -0
  216. package/dist/tools/{merge-conflicts.js → merge-conflicts/index.js} +3 -19
  217. package/dist/tools/test-gen-browser.js +4 -4
  218. package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
  219. package/dist/tools/test-run-fetcher/index.js +4 -0
  220. package/dist/tools/trace-dot-zip/index.d.ts +3 -0
  221. package/dist/tools/trace-dot-zip/index.d.ts.map +1 -0
  222. package/dist/tools/trace-dot-zip/index.js +48 -0
  223. package/dist/tools/trace-dot-zip/types.d.ts +86 -0
  224. package/dist/tools/trace-dot-zip/types.d.ts.map +1 -0
  225. package/dist/tools/trace-dot-zip/types.js +2 -0
  226. package/dist/tools/trace-dot-zip/utils/console-trace.d.ts +7 -0
  227. package/dist/tools/trace-dot-zip/utils/console-trace.d.ts.map +1 -0
  228. package/dist/tools/trace-dot-zip/utils/console-trace.js +34 -0
  229. package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts +21 -0
  230. package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts.map +1 -0
  231. package/dist/tools/trace-dot-zip/utils/extract-zip.js +174 -0
  232. package/dist/tools/trace-dot-zip/utils/network-trace.d.ts +21 -0
  233. package/dist/tools/trace-dot-zip/utils/network-trace.d.ts.map +1 -0
  234. package/dist/tools/trace-dot-zip/utils/network-trace.js +189 -0
  235. package/dist/tools/triage-summary/index.d.ts +3 -0
  236. package/dist/tools/triage-summary/index.d.ts.map +1 -0
  237. package/dist/tools/triage-summary/index.js +51 -0
  238. package/dist/tools/triage-summary/types.d.ts +5 -0
  239. package/dist/tools/triage-summary/types.d.ts.map +1 -0
  240. package/dist/tools/triage-summary/types.js +2 -0
  241. package/dist/tools/triage-summary/utils.d.ts +4 -0
  242. package/dist/tools/triage-summary/utils.d.ts.map +1 -0
  243. package/dist/tools/triage-summary/utils.js +16 -0
  244. package/dist/tools/upgrade-packages/index.d.ts.map +1 -1
  245. package/dist/tools/upgrade-packages/index.js +5 -15
  246. package/dist/tools/view-failed-test-run-report/index.d.ts +12 -0
  247. package/dist/tools/view-failed-test-run-report/index.d.ts.map +1 -0
  248. package/dist/tools/view-failed-test-run-report/index.js +163 -0
  249. package/dist/trace-utils/index.d.ts +4 -0
  250. package/dist/trace-utils/index.d.ts.map +1 -0
  251. package/dist/trace-utils/index.js +10 -0
  252. package/dist/utils/dedup-image-fs.d.ts +27 -0
  253. package/dist/utils/dedup-image-fs.d.ts.map +1 -0
  254. package/dist/utils/dedup-image-fs.js +88 -0
  255. package/dist/utils/dedup-image.d.ts +25 -0
  256. package/dist/utils/dedup-image.d.ts.map +1 -0
  257. package/dist/utils/dedup-image.js +80 -0
  258. package/dist/utils/env.d.ts.map +1 -1
  259. package/dist/utils/env.js +0 -1
  260. package/dist/utils/json.js +1 -1
  261. package/dist/utils/model.d.ts +3 -0
  262. package/dist/utils/model.d.ts.map +1 -0
  263. package/dist/utils/model.js +18 -0
  264. package/dist/utils/playwright-report-parser.d.ts +13 -0
  265. package/dist/utils/playwright-report-parser.d.ts.map +1 -0
  266. package/dist/utils/playwright-report-parser.js +138 -0
  267. package/dist/utils/slug.d.ts +1 -0
  268. package/dist/utils/slug.d.ts.map +1 -1
  269. package/dist/utils/slug.js +9 -1
  270. package/dist/utils/stripAnsi.d.ts.map +1 -1
  271. package/dist/utils/stripAnsi.js +1 -3
  272. package/eslint.config.mjs +43 -0
  273. package/package.json +22 -6
  274. package/tsconfig.tsbuildinfo +1 -1
  275. package/dist/agent/codegen/generate-code-apply-changes.d.ts +0 -13
  276. package/dist/agent/codegen/generate-code-apply-changes.d.ts.map +0 -1
  277. package/dist/agent/codegen/generate-code-apply-changes.js +0 -379
  278. package/dist/agent/codegen/repo-edit.d.ts +0 -23
  279. package/dist/agent/codegen/repo-edit.d.ts.map +0 -1
  280. package/dist/agent/codegen/repo-edit.js +0 -81
  281. package/dist/agent/codegen/run.d.ts +0 -20
  282. package/dist/agent/codegen/run.d.ts.map +0 -1
  283. package/dist/agent/codegen/run.js +0 -116
  284. package/dist/agent/enrich-prompt/index.d.ts +0 -12
  285. package/dist/agent/enrich-prompt/index.d.ts.map +0 -1
  286. package/dist/agent/enrich-prompt/index.js +0 -80
  287. package/dist/agent/enrich-prompt/utils.d.ts +0 -6
  288. package/dist/agent/enrich-prompt/utils.d.ts.map +0 -1
  289. package/dist/agent/enrich-prompt/utils.js +0 -11
  290. package/dist/agent/infer-agent/index.d.ts +0 -10
  291. package/dist/agent/infer-agent/index.d.ts.map +0 -1
  292. package/dist/agent/infer-agent/index.js +0 -60
  293. package/dist/evals/add-scenario-agent.evals.d.ts +0 -4
  294. package/dist/evals/add-scenario-agent.evals.d.ts.map +0 -1
  295. package/dist/evals/add-scenario-agent.evals.js +0 -44
  296. package/dist/evals/infer-master-or-code-agent.evals.d.ts +0 -4
  297. package/dist/evals/infer-master-or-code-agent.evals.d.ts.map +0 -1
  298. package/dist/evals/infer-master-or-code-agent.evals.js +0 -22
  299. package/dist/file-info/file-system.d.ts +0 -3
  300. package/dist/file-info/file-system.d.ts.map +0 -1
  301. package/dist/file-info/github.d.ts +0 -3
  302. package/dist/file-info/github.d.ts.map +0 -1
  303. package/dist/file-info/github.js +0 -107
  304. package/dist/tools/commit-and-create-pr.d.ts.map +0 -1
  305. package/dist/tools/delete-file.d.ts.map +0 -1
  306. package/dist/tools/download-build.d.ts.map +0 -1
  307. package/dist/tools/grep/ripgrep/types.d.ts.map +0 -1
  308. package/dist/tools/merge-conflicts.d.ts.map +0 -1
  309. package/dist/tools/str_replace_editor.d.ts +0 -22
  310. package/dist/tools/str_replace_editor.d.ts.map +0 -1
  311. package/dist/tools/str_replace_editor.js +0 -429
  312. /package/dist/tools/grep/{ripgrep/types.d.ts → types.d.ts} +0 -0
  313. /package/dist/tools/grep/{ripgrep/types.js → types.js} +0 -0
@@ -1,15 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.modelLabels = exports.defaultModel = void 0;
3
+ exports.modelLabels = exports.resolveChatModelBasedOnInput = void 0;
4
+ exports.getDefaultChatModelId = getDefaultChatModelId;
4
5
  const chat_1 = require("@empiricalrun/llm/chat");
5
- const DEFAULT_CHAT_MODEL_ID = "claude-sonnet-4-20250514";
6
+ const model_1 = require("../../utils/model");
6
7
  function getDefaultChatModelId() {
8
+ const DEFAULT_CHAT_MODEL_ID = "claude-sonnet-4-20250514";
7
9
  if (!chat_1.SUPPORTED_CHAT_MODELS.some((m) => m.id === DEFAULT_CHAT_MODEL_ID)) {
8
10
  throw new Error("Default chat model is not in SUPPORTED_CHAT_MODELS");
9
11
  }
10
12
  return DEFAULT_CHAT_MODEL_ID;
11
13
  }
12
- exports.defaultModel = getDefaultChatModelId();
14
+ const resolveChatModelBasedOnInput = (requestedModel) => {
15
+ const sanitizedModelInput = requestedModel?.trim().toLowerCase();
16
+ if (!sanitizedModelInput || sanitizedModelInput === "auto") {
17
+ const autoSelectedModelId = getDefaultChatModelId();
18
+ return autoSelectedModelId;
19
+ }
20
+ // requestedModel is already a valid SupportedChatModels string
21
+ if (sanitizedModelInput &&
22
+ Object.values(chat_1.SUPPORTED_CHAT_MODELS).some((model) => model.id.toLowerCase() === sanitizedModelInput)) {
23
+ const matchedModel = chat_1.SUPPORTED_CHAT_MODELS.find((model) => model.id.toLowerCase() === sanitizedModelInput);
24
+ if (matchedModel) {
25
+ return matchedModel.id;
26
+ }
27
+ }
28
+ const resolvedModelId = model_1.ARGS_TO_MODEL_MAP[sanitizedModelInput];
29
+ if (!resolvedModelId) {
30
+ throw new Error(`Invalid chat model: ${requestedModel}`);
31
+ }
32
+ return resolvedModelId;
33
+ };
34
+ exports.resolveChatModelBasedOnInput = resolveChatModelBasedOnInput;
13
35
  exports.modelLabels = chat_1.SUPPORTED_CHAT_MODELS.reduce((acc, model) => ({
14
36
  ...acc,
15
37
  [model.id]: model.label,
@@ -1,3 +1,5 @@
1
1
  import { FileInfo } from "@empiricalrun/shared-types";
2
- export declare function buildSystemPrompt(repoInfo: FileInfo): Promise<string>;
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>;
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,mBA6GzD"}
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,9 +1,82 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSystemPrompt = void 0;
4
+ exports.buildTriageSystemPrompt = buildTriageSystemPrompt;
3
5
  exports.buildSystemPrompt = buildSystemPrompt;
4
6
  const pw_utils_docs_1 = require("./pw-utils-docs");
5
7
  const repo_1 = require("./repo");
6
- async function buildSystemPrompt(repoInfo) {
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) {
7
80
  const preamble = `
8
81
  You are a helpful assistant that can answer questions and help with tasks related to writing and maintaining Playwright tests.
9
82
 
@@ -102,7 +175,6 @@ if (await saveButton.isVisible()) {
102
175
  \`\`\`
103
176
 
104
177
  `;
105
- const repoContext = await (0, repo_1.getRepoInfoPrompt)(repoInfo);
106
178
  return `${preamble}
107
179
 
108
180
  # Recipes
@@ -110,5 +182,8 @@ ${pw_utils_docs_1.playwrightUtilsDocs}
110
182
 
111
183
  # Repo context
112
184
  ${repoContext}
185
+
186
+ # Reference
187
+ Today's date is ${new Date().toDateString()}
113
188
  `;
114
189
  }
@@ -1 +1 @@
1
- {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/repo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAqDtD,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,mBA0CzD"}
1
+ {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/repo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAsDtD,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,mBA0CzD"}
@@ -18,6 +18,7 @@ async function getAllMarkdownFiles(directory) {
18
18
  .filter((file) => file.type === "file" && file.path.endsWith(".md"))
19
19
  .map(async (file) => {
20
20
  return {
21
+ // TODO: Give full path
21
22
  name: path_1.default.basename(file.path),
22
23
  content: file.type === "file" ? await file.getContent() : "",
23
24
  };
@@ -1,8 +1,9 @@
1
1
  import { IChatModel } from "@empiricalrun/llm/chat";
2
- import { Attachment, CanonicalMessage, ChatState, ChatStateError, ProcessedAttachment, SupportedChatModels } from "@empiricalrun/shared-types";
2
+ import { Attachment, CanonicalMessage, ChatState, ChatStateError, PendingToolCall, ProcessedAttachment, SupportedChatModels, ToolResult } from "@empiricalrun/shared-types";
3
3
  export declare const CHAT_STATE_VERSIONS_MIGRATIONS_MAP: Record<string, (state: any) => any>;
4
4
  export declare const LATEST_CHAT_STATE_VERSION = "0.1";
5
5
  export declare const CHAT_STATE_PATH: string;
6
+ export declare function clearChatState(): void;
6
7
  export declare function processAttachments(attachments: Attachment[], selectedModel: SupportedChatModels): Promise<ProcessedAttachment[]>;
7
8
  export declare function createChatState({ userPrompt, attachments, existingState, selectedModel, error, }: {
8
9
  userPrompt: string | undefined;
@@ -22,6 +23,7 @@ export declare function chatStateFromModel<T>({ chatModel, selectedModel, error,
22
23
  selectedModel: SupportedChatModels;
23
24
  error: ChatStateError | null;
24
25
  }): ChatState;
26
+ export declare function getUsageSummary(chatModel: IChatModel<CanonicalMessage>): string;
25
27
  export declare function loadChatState(): ChatState | undefined;
26
28
  /**
27
29
  * Migrates a chat state object from an old version to the latest version.
@@ -30,10 +32,9 @@ export declare function loadChatState(): ChatState | undefined;
30
32
  export declare function migrateChatState(oldState: any): ChatState;
31
33
  export declare function saveToDisk(messages: Array<CanonicalMessage>, selectedModel: SupportedChatModels, askUserForInput: boolean, error: ChatStateError | null): void;
32
34
  export declare function getLatestDownloadBuildUrl(messages: CanonicalMessage[]): string | null;
33
- export declare function fetchToolCallAvailability(toolCallId: String, messages: CanonicalMessage[]): {
34
- hasToolRequest: boolean;
35
- hasToolResponse: boolean;
36
- toolCallName: string;
35
+ export declare function fetchToolCallFromId(toolCallId: String, messages: CanonicalMessage[]): {
37
36
  toolCallQueuedAt: Date | undefined;
37
+ toolCall: PendingToolCall | undefined;
38
+ toolResult: ToolResult | undefined;
38
39
  };
39
40
  //# sourceMappingURL=state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EAEpB,MAAM,4BAA4B,CAAC;AA+BpC,eAAO,MAAM,kCAAkC,EAAE,MAAM,CACrD,MAAM,EACN,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAIpB,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAQ,CAAC;AAE/C,eAAO,MAAM,eAAe,QAI3B,CAAC;AAEF,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,UAAU,EAAE,EACzB,aAAa,EAAE,mBAAmB,GACjC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAMhC;AAED,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,KAAK,GACN,EAAE;IACD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,aAAa,EAAE,SAAS,GAAG,SAAS,CAAC;IACrC,aAAa,EAAE,mBAAmB,CAAC;IACnC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B,aAYA;AAED,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,aAAa,EACb,eAAe,EACf,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,aAAa,EAAE,mBAAmB,CAAC;IACnC,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B,GAAG,SAAS,CASZ;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,EACpC,SAAS,EACT,aAAa,EACb,KAAK,GACN,EAAE;IACD,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACzB,aAAa,EAAE,mBAAmB,CAAC;IACnC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B,aAOA;AAED,wBAAgB,aAAa,IAAI,SAAS,GAAG,SAAS,CAarD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,SAAS,CAqBzD;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,EACjC,aAAa,EAAE,mBAAmB,EAClC,eAAe,EAAE,OAAO,EACxB,KAAK,EAAE,cAAc,GAAG,IAAI,QAgB7B;AA2BD,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,gBAAgB,EAAE,GAC3B,MAAM,GAAG,IAAI,CAef;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,gBAAgB,EAAE;;;;;EA2B7B"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EAEnB,UAAU,EACX,MAAM,4BAA4B,CAAC;AA+BpC,eAAO,MAAM,kCAAkC,EAAE,MAAM,CACrD,MAAM,EACN,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAIpB,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAQ,CAAC;AAE/C,eAAO,MAAM,eAAe,QAI3B,CAAC;AAEF,wBAAgB,cAAc,SAQ7B;AAED,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,UAAU,EAAE,EACzB,aAAa,EAAE,mBAAmB,GACjC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAMhC;AAED,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,KAAK,GACN,EAAE;IACD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,aAAa,EAAE,SAAS,GAAG,SAAS,CAAC;IACrC,aAAa,EAAE,mBAAmB,CAAC;IACnC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B,aAYA;AAED,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,aAAa,EACb,eAAe,EACf,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,aAAa,EAAE,mBAAmB,CAAC;IACnC,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B,GAAG,SAAS,CASZ;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,EACpC,SAAS,EACT,aAAa,EACb,KAAK,GACN,EAAE;IACD,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACzB,aAAa,EAAE,mBAAmB,CAAC;IACnC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B,aAOA;AAED,wBAAgB,eAAe,CAC7B,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC,GACtC,MAAM,CA0BR;AAED,wBAAgB,aAAa,IAAI,SAAS,GAAG,SAAS,CAarD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,SAAS,CAqBzD;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,EACjC,aAAa,EAAE,mBAAmB,EAClC,eAAe,EAAE,OAAO,EACxB,KAAK,EAAE,cAAc,GAAG,IAAI,QAgB7B;AA2BD,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,gBAAgB,EAAE,GAC3B,MAAM,GAAG,IAAI,CAef;AAED,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,gBAAgB,EAAE,GAC3B;IACD,gBAAgB,EAAE,IAAI,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAC;IACtC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;CACpC,CA0BA"}
@@ -4,15 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CHAT_STATE_PATH = exports.LATEST_CHAT_STATE_VERSION = exports.CHAT_STATE_VERSIONS_MIGRATIONS_MAP = void 0;
7
+ exports.clearChatState = clearChatState;
7
8
  exports.processAttachments = processAttachments;
8
9
  exports.createChatState = createChatState;
9
10
  exports.createChatStateForMessages = createChatStateForMessages;
10
11
  exports.chatStateFromModel = chatStateFromModel;
12
+ exports.getUsageSummary = getUsageSummary;
11
13
  exports.loadChatState = loadChatState;
12
14
  exports.migrateChatState = migrateChatState;
13
15
  exports.saveToDisk = saveToDisk;
14
16
  exports.getLatestDownloadBuildUrl = getLatestDownloadBuildUrl;
15
- exports.fetchToolCallAvailability = fetchToolCallAvailability;
17
+ exports.fetchToolCallFromId = fetchToolCallFromId;
16
18
  const chat_1 = require("@empiricalrun/llm/chat");
17
19
  const fs_1 = __importDefault(require("fs"));
18
20
  const path_1 = __importDefault(require("path"));
@@ -43,6 +45,16 @@ exports.CHAT_STATE_VERSIONS_MIGRATIONS_MAP = {
43
45
  };
44
46
  exports.LATEST_CHAT_STATE_VERSION = "0.1";
45
47
  exports.CHAT_STATE_PATH = path_1.default.join(process.cwd(), ".empiricalrun", "last-chat.json");
48
+ function clearChatState() {
49
+ try {
50
+ if (fs_1.default.existsSync(exports.CHAT_STATE_PATH)) {
51
+ fs_1.default.unlinkSync(exports.CHAT_STATE_PATH);
52
+ }
53
+ }
54
+ catch {
55
+ // Swallow errors to avoid blocking the CLI; deletion is best-effort
56
+ }
57
+ }
46
58
  async function processAttachments(attachments, selectedModel) {
47
59
  const chatModel = (0, chat_1.createChatModel)([], selectedModel);
48
60
  if (attachments.length === 0) {
@@ -81,6 +93,24 @@ function chatStateFromModel({ chatModel, selectedModel, error, }) {
81
93
  error,
82
94
  });
83
95
  }
96
+ function getUsageSummary(chatModel) {
97
+ const messages = chatModel.messages;
98
+ const messageUsages = messages.map((msg) => msg.usage).filter(Boolean);
99
+ const inputTokens = messageUsages.reduce((sum, usage) => sum + (usage?.tokens?.input || 0), 0);
100
+ const outputTokens = messageUsages.reduce((sum, usage) => sum + (usage?.tokens?.output || 0), 0);
101
+ const costs = messageUsages
102
+ .map((usage) => usage?.cost || { input: 0, output: 0 })
103
+ .reduce((acc, cost) => {
104
+ acc.input += cost.input;
105
+ acc.output += cost.output;
106
+ return acc;
107
+ }, { input: 0, output: 0 });
108
+ const { input: inputCost, output: outputCost } = costs;
109
+ const cost = inputCost + outputCost;
110
+ const msgsSummary = `Cost: $${cost.toFixed(2)}
111
+ Input: ${inputTokens.toLocaleString()} tokens / Output: ${outputTokens.toLocaleString()} tokens`;
112
+ return msgsSummary;
113
+ }
84
114
  function loadChatState() {
85
115
  if (!fs_1.default.existsSync(exports.CHAT_STATE_PATH)) {
86
116
  return undefined;
@@ -162,7 +192,7 @@ function getLatestDownloadBuildUrl(messages) {
162
192
  const input = toolCallPart.toolCall.input;
163
193
  return input.buildUrl;
164
194
  }
165
- function fetchToolCallAvailability(toolCallId, messages) {
195
+ function fetchToolCallFromId(toolCallId, messages) {
166
196
  const toolCallMessage = messages.find((message) => message.parts.some((part) => {
167
197
  return "toolCall" in part && part.toolCallId === toolCallId;
168
198
  }));
@@ -172,11 +202,11 @@ function fetchToolCallAvailability(toolCallId, messages) {
172
202
  return "toolResult" in part && part.toolCallId === toolCallId;
173
203
  }));
174
204
  return {
175
- hasToolRequest: !!toolCallMessage,
176
- hasToolResponse: !!toolResponseMessage,
177
- toolCallName: toolCallPart?.toolCall?.name || "",
178
205
  toolCallQueuedAt: messageTimestampIso
179
206
  ? new Date(messageTimestampIso)
180
207
  : undefined,
208
+ toolCall: toolCallPart?.toolCall,
209
+ toolResult: toolResponseMessage?.parts.find((part) => "toolResult" in part)
210
+ ?.toolResult,
181
211
  };
182
212
  }
@@ -14,4 +14,5 @@ export declare function extractAttachments(userPrompt: string): {
14
14
  text: string;
15
15
  attachments: Attachment[];
16
16
  };
17
+ export declare const getChatAgentMode: (source: string | undefined) => "triage" | "test_generation";
17
18
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAuB,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EACL,UAAU,EAEV,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAKpC,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,GAAG,EAAE,SAEjC,CAAC;AAcF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,wBAAsB,gBAAgB,CAAC,EACrC,KAAK,EACL,SAAS,EACT,aAAa,EACb,QAAQ,EACR,KAAK,GACN,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAC3B,aAAa,EAAE,mBAAmB,CAAC;IACnC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,iBAgBA;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAsBA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAuB,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EACL,UAAU,EAEV,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAKpC,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,GAAG,EAAE,SAEjC,CAAC;AAcF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,wBAAsB,gBAAgB,CAAC,EACrC,KAAK,EACL,SAAS,EACT,aAAa,EACb,QAAQ,EACR,KAAK,GACN,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAC3B,aAAa,EAAE,mBAAmB,CAAC;IACnC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,iBAgBA;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAsBA;AAED,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,GAAG,SAAS,iCAW1D,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.log = void 0;
3
+ exports.getChatAgentMode = exports.log = void 0;
4
4
  exports.getModelName = getModelName;
5
5
  exports.handleAgentError = handleAgentError;
6
6
  exports.extractAttachments = extractAttachments;
@@ -26,8 +26,8 @@ function getModelName(model) {
26
26
  if (provider === "google")
27
27
  return "Gemini";
28
28
  if (provider === "openai")
29
- return "o4";
30
- return "AI";
29
+ return model;
30
+ return model;
31
31
  }
32
32
  async function handleAgentError({ error, chatModel, selectedModel, reporter, trace, }) {
33
33
  const errorObject = {
@@ -64,3 +64,16 @@ function extractAttachments(userPrompt) {
64
64
  attachments,
65
65
  };
66
66
  }
67
+ const getChatAgentMode = (source) => {
68
+ switch (source) {
69
+ case "triage":
70
+ return "triage";
71
+ case "dashboard":
72
+ return "test_generation";
73
+ case "manual":
74
+ return "test_generation";
75
+ default:
76
+ return "test_generation";
77
+ }
78
+ };
79
+ exports.getChatAgentMode = getChatAgentMode;
@@ -10,7 +10,7 @@ const computer_1 = require("./computer");
10
10
  const model_1 = require("./model");
11
11
  const element_from_point_1 = require("./pw-codegen/element-from-point");
12
12
  const pw_pause_1 = require("./pw-codegen/pw-pause");
13
- const MAX_ITERATIONS = 15;
13
+ const MAX_ITERATIONS = 10;
14
14
  async function getCodegenInstance(prefersElementFromPoint) {
15
15
  const repoDir = process.cwd();
16
16
  const canUsePwPause = !prefersElementFromPoint && (await (0, pw_pause_1.canUsePauseCodegen)(repoDir));
@@ -35,7 +35,7 @@ async function callComputerUseModel({ input, previousResponseId, screenWidth, sc
35
35
  tools: [
36
36
  pageGotoTool,
37
37
  {
38
- type: "computer-preview",
38
+ type: "computer_use_preview",
39
39
  display_width: screenWidth,
40
40
  display_height: screenHeight,
41
41
  environment: "browser",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/agent/cua/pw-codegen/pw-pause/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAKjD,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAE9E,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,oBAyCvD;AAED,qBAAa,sBAAuB,YAAW,qBAAqB;IAClE,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,iBAAiB,CAAqB;;YAMhC,QAAQ;IAUhB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrC,sBAAsB,CAAC,IAAI,EAAE,IAAI;IAqBjC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC;CAU9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/agent/cua/pw-codegen/pw-pause/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAKjD,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAE9E,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,oBAwCvD;AAED,qBAAa,sBAAuB,YAAW,qBAAqB;IAClE,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,iBAAiB,CAAqB;;YAMhC,QAAQ;IAUhB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrC,sBAAsB,CAAC,IAAI,EAAE,IAAI;IAqBjC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC;CAU9C"}
@@ -34,7 +34,6 @@ async function canUsePauseCodegen(repoDir) {
34
34
  logger_1.logger.error("Cannot use pause codegen because RUN_PLAYWRIGHT_HEADED is not true");
35
35
  return false;
36
36
  }
37
- // eslint-disable-next-line turbo/no-undeclared-env-vars
38
37
  if (!process.env.PW_CODEGEN_NO_INSPECTOR) {
39
38
  // PW_CODEGEN_NO_INSPECTOR should be set to true, so that Playwright runs the
40
39
  // EmptyRecorderApp() -- which is the entrypoint to our patched code
@@ -1 +1 @@
1
- {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/agent/master/browser-tests/fixtures.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,MAAM,uCAAc,CAAC;AAClC,eAAO,MAAM,IAAI;YAA6B,aAAa;EAwBzD,CAAC"}
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/agent/master/browser-tests/fixtures.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,MAAM,uCAAc,CAAC;AAClC,eAAO,MAAM,IAAI;YAA6B,aAAa;EAuBzD,CAAC"}
@@ -11,7 +11,6 @@ const serve_handler_1 = __importDefault(require("serve-handler"));
11
11
  exports.expect = test_1.test.expect;
12
12
  exports.test = test_1.test.extend({
13
13
  server: [
14
- // eslint-disable-next-line no-empty-pattern
15
14
  async ({}, use, workerInfo) => {
16
15
  const port = 2345 + workerInfo.workerIndex;
17
16
  const server = http_1.default.createServer((request, response) => {
@@ -1 +1 @@
1
- {"version":3,"file":"element-annotation.d.ts","sourceRoot":"","sources":["../../../src/agent/master/element-annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAQlC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA2DjD,wBAAsB,oBAAoB,CAAC,EACzC,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,KAAK,EACL,GAAG,EACH,OAAO,EACP,UAAU,GACX,EAAE;IACD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,UAAU,EAAE,oBAAoB,CAAC;CAClC,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA8C9B;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EACN,KAAK,GACL,UAAU,CAAC,IAAI,GACf,UAAU,CAAC,WAAW,GACtB,UAAU,CAAC,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAAC;AAgBF,wBAAsB,iBAAiB,CAAC,EACtC,IAAI,EACJ,UAAU,EACV,KAAK,GACN,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,oBAAoB,CAAC;IACjC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC;IACV,cAAc,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtD,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,MAAM,CAAC;CACjC,CAAC,CAoFD"}
1
+ {"version":3,"file":"element-annotation.d.ts","sourceRoot":"","sources":["../../../src/agent/master/element-annotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAQlC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA2DjD,wBAAsB,oBAAoB,CAAC,EACzC,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,KAAK,EACL,GAAG,EACH,OAAO,EACP,UAAU,GACX,EAAE;IACD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,UAAU,EAAE,oBAAoB,CAAC;CAClC,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA8C9B;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EACN,KAAK,GACL,UAAU,CAAC,IAAI,GACf,UAAU,CAAC,WAAW,GACtB,UAAU,CAAC,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAAC;AAgBF,wBAAsB,iBAAiB,CAAC,EACtC,IAAI,EACJ,UAAU,EACV,KAAK,GACN,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,oBAAoB,CAAC;IACjC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC;IACV,cAAc,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtD,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,MAAM,CAAC;CACjC,CAAC,CAmFD"}
@@ -93,7 +93,7 @@ async function getElementAnnotation({ elementDescription, annotations, annotated
93
93
  });
94
94
  const toolCall = completion?.tool_calls?.[0];
95
95
  annotationsSpan?.end({ output: toolCall });
96
- if (toolCall) {
96
+ if (toolCall && "function" in toolCall) {
97
97
  const args = JSON.parse(toolCall.function.arguments);
98
98
  return args.element_annotation;
99
99
  }
@@ -102,7 +102,6 @@ async function getElementAnnotation({ elementDescription, annotations, annotated
102
102
  async function getAnnotationKeys({ page, preference, trace, }) {
103
103
  const annotatedElements = await page.evaluate(({ preference, options }) => {
104
104
  // @ts-ignore
105
- // eslint-disable-next-line no-undef
106
105
  window.annotationInstance = annotateElementsWithPreference({
107
106
  options: options,
108
107
  preference: preference,
@@ -1 +1 @@
1
- {"version":3,"file":"execute-browser-action.d.ts","sourceRoot":"","sources":["../../../src/agent/master/execute-browser-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAUlD,wBAAsB,oBAAoB,CAAC,EACzC,IAAI,EACJ,UAAU,EACV,KAAK,EACL,OAAO,EACP,GAAG,EACH,KAAK,GACN,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,KAAK,EAAE;QACL,4BAA4B,EAAE,OAAO,CAAC;KACvC,CAAC;IACF,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,GAAG,EAAE,GAAG,CAAC;CACV;;;gBAIW,MAAM;gBACN,MAAM;4BACM,MAAM;;GA8H7B"}
1
+ {"version":3,"file":"execute-browser-action.d.ts","sourceRoot":"","sources":["../../../src/agent/master/execute-browser-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAUlD,wBAAsB,oBAAoB,CAAC,EACzC,IAAI,EACJ,UAAU,EACV,KAAK,EACL,OAAO,EACP,GAAG,EACH,KAAK,GACN,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,KAAK,EAAE;QACL,4BAA4B,EAAE,OAAO,CAAC;KACvC,CAAC;IACF,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,GAAG,EAAE,GAAG,CAAC;CACV;;;gBAIW,MAAM;gBACN,MAAM;4BACM,MAAM;;GA+H7B"}
@@ -85,12 +85,14 @@ async function executeBrowserAction({ page, nextAction, flags, actions, llm, tra
85
85
  const toolCalls = hintsExecutionCompletion?.tool_calls || [];
86
86
  for (const i in toolCalls) {
87
87
  const currentToolCall = toolCalls[i];
88
- const code = await actions.executeAction(currentToolCall.function.name, {
89
- ...JSON.parse(currentToolCall.function.arguments),
90
- elementAnnotation,
91
- }, trace);
92
- if (code) {
93
- generatedCodeSteps.push(code);
88
+ if (currentToolCall && "function" in currentToolCall) {
89
+ const code = await actions.executeAction(currentToolCall.function.name, {
90
+ ...JSON.parse(currentToolCall.function.arguments),
91
+ elementAnnotation,
92
+ }, trace);
93
+ if (code) {
94
+ generatedCodeSteps.push(code);
95
+ }
94
96
  }
95
97
  }
96
98
  if (actions.isStuckInLoop()) {
@@ -26,7 +26,7 @@ function loadIconsKnowledge() {
26
26
  try {
27
27
  return JSON.parse(raw);
28
28
  }
29
- catch (err) {
29
+ catch {
30
30
  console.log("error parsing iconsKnowledge json");
31
31
  return [];
32
32
  }
@@ -42,7 +42,7 @@ function loadIconsKnowledge() {
42
42
  try {
43
43
  iconData = JSON.parse(raw);
44
44
  }
45
- catch (err) {
45
+ catch {
46
46
  console.log("error parsing iconsKnowledge json from old location");
47
47
  }
48
48
  }
@@ -55,7 +55,7 @@ async function getNextAction({ page, pageScreenshot, task, executedActions, fail
55
55
  });
56
56
  const toolCall = completion?.tool_calls?.[0];
57
57
  nextActionSpan?.end({ output: toolCall });
58
- if (toolCall) {
58
+ if (toolCall && "function" in toolCall) {
59
59
  const toolCallArgs = JSON.parse(toolCall.function.arguments);
60
60
  const actionType = toolCall.function.name;
61
61
  // If the action type is scroll, we need to scroll the page and get the reference to the frame in which the element is visible
@@ -118,7 +118,7 @@ async function runtimePlannerWithScreenshot({ trace, task, conversation, pages,
118
118
  },
119
119
  });
120
120
  const toolCallResp = (response?.tool_calls || [])[0];
121
- if (toolCallResp) {
121
+ if (toolCallResp && "function" in toolCallResp) {
122
122
  const toolCall = JSON.parse(toolCallResp.function.arguments);
123
123
  const output = {
124
124
  pageName: toolCall.pageName,
@@ -159,7 +159,7 @@ Follow the instructions before responding:
159
159
  let isVisible = false;
160
160
  const toolCall = completion?.tool_calls?.[0];
161
161
  scrollSpan?.end({ output: toolCall });
162
- if (toolCall) {
162
+ if (toolCall && "function" in toolCall) {
163
163
  const args = JSON.parse(toolCall.function.arguments);
164
164
  isVisible = args.is_visible || false;
165
165
  }
@@ -297,7 +297,7 @@ ${annotationKeysString}`,
297
297
  });
298
298
  const toolCall = completion?.tool_calls?.[0];
299
299
  annotationsSpan?.end({ output: toolCall });
300
- if (toolCall) {
300
+ if (toolCall && "function" in toolCall) {
301
301
  const args = JSON.parse(toolCall.function.arguments);
302
302
  const isAnnotationPresentInKeys = annotationKeys.some((annotation) => annotation.elementID === args.element_annotation);
303
303
  if (args.element_annotation !== "NA" && isAnnotationPresentInKeys) {
@@ -1 +1 @@
1
- {"version":3,"file":"with-hints.d.ts","sourceRoot":"","sources":["../../../src/agent/master/with-hints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOlD,eAAO,MAAM,gBAAgB,GAAU,yEAMpC;IACD,uBAAuB,EAAE;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1C,OAAO,EAAE,iBAAiB,CAAC;IAC3B,GAAG,EAAE,GAAG,CAAC;IACT,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,KAAG,OAAO,CAAC;IACV,sBAAsB,EAAE,OAAO,CAAC;IAChC,wBAAwB,EAAE,MAAM,CAAC,qBAAqB,GAAG,SAAS,CAAC;CACpE,CAyGA,CAAC"}
1
+ {"version":3,"file":"with-hints.d.ts","sourceRoot":"","sources":["../../../src/agent/master/with-hints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOlD,eAAO,MAAM,gBAAgB,GAAU,yEAMpC;IACD,uBAAuB,EAAE;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1C,OAAO,EAAE,iBAAiB,CAAC;IAC3B,GAAG,EAAE,GAAG,CAAC;IACT,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,KAAG,OAAO,CAAC;IACV,sBAAsB,EAAE,OAAO,CAAC;IAChC,wBAAwB,EAAE,MAAM,CAAC,qBAAqB,GAAG,SAAS,CAAC;CACpE,CA0GA,CAAC"}
@@ -61,11 +61,12 @@ const triggerHintsFlow = async ({ outputFromGetNextAction, generatedAnnotations,
61
61
  },
62
62
  trace,
63
63
  });
64
- const canTriggerHintsFlow = completion?.tool_calls?.some((currentToolCall) => currentToolCall.function.name === fill_1.PLAYWRIGHT_FILL_ACTION_NAME ||
65
- currentToolCall.function.name === click_1.PLAYWRIGHT_CLICK_ACTION_NAME ||
66
- currentToolCall.function.name === hover_1.PLAYWRIGHT_HOVER_ACTION_NAME ||
67
- currentToolCall.function.name ===
68
- assert_1.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME);
64
+ const canTriggerHintsFlow = completion?.tool_calls?.some((currentToolCall) => "function" in currentToolCall &&
65
+ (currentToolCall.function.name === fill_1.PLAYWRIGHT_FILL_ACTION_NAME ||
66
+ currentToolCall.function.name === click_1.PLAYWRIGHT_CLICK_ACTION_NAME ||
67
+ currentToolCall.function.name === hover_1.PLAYWRIGHT_HOVER_ACTION_NAME ||
68
+ currentToolCall.function.name ===
69
+ assert_1.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME));
69
70
  trace?.event({
70
71
  name: "can-trigger-hints-flow",
71
72
  output: {
@@ -74,7 +74,7 @@ async function runtimePlanner({ trace, task, successfulActions, pages, currentPa
74
74
  },
75
75
  });
76
76
  const toolCallResp = (response?.tool_calls || [])[0];
77
- if (toolCallResp) {
77
+ if (toolCallResp && "function" in toolCallResp) {
78
78
  const toolCall = JSON.parse(toolCallResp.function.arguments);
79
79
  const output = {
80
80
  pageName: toolCall.pageName,
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/planner/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAcpE,wBAAsB,QAAQ,CAAC,EAC7B,IAAI,EACJ,QAAQ,EACR,KAAK,GACN,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,gBAwHA"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/planner/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAcpE,wBAAsB,QAAQ,CAAC,EAC7B,IAAI,EACJ,QAAQ,EACR,KAAK,GACN,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,gBA6HA"}
@@ -91,10 +91,12 @@ ${pomPrompt}
91
91
  },
92
92
  });
93
93
  const toolCall = response?.tool_calls?.[0];
94
- const respStr = toolCall?.function.arguments;
94
+ const respStr = toolCall && "function" in toolCall && toolCall.function.arguments;
95
95
  const resp = JSON.parse(respStr || "{}");
96
96
  // TODO: handle this as a part of actions handler
97
- if (toolCall?.function.name === "send_user_message") {
97
+ if (toolCall &&
98
+ "function" in toolCall &&
99
+ toolCall.function.name === "send_user_message") {
98
100
  const feedback = await human_in_the_loop_1.humanLoop.getFeedback({
99
101
  message: resp.message,
100
102
  });
@@ -151,7 +151,7 @@ async function authenticate() {
151
151
  const { default: open } = await import("open");
152
152
  await open(authUrl);
153
153
  }
154
- catch (err) {
154
+ catch {
155
155
  // Ignoring error
156
156
  }
157
157
  })();
@@ -1 +1 @@
1
- {"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../src/auth/token-store.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,eAAe,EAAE,MAAM,GAAG,YAAY,CAAC;CACzC;AAgCD,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA2CrE;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAqBxE;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CA4CjD;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAUxD"}
1
+ {"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../src/auth/token-store.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,eAAe,EAAE,MAAM,GAAG,YAAY,CAAC;CACzC;AAgCD,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA2CrE;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAqBxE;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CA4CjD;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAUxD"}
@@ -12,9 +12,7 @@ const util_1 = require("util");
12
12
  const CONFIG_DIR = (0, path_1.join)((0, os_1.homedir)(), ".empiricalrun");
13
13
  const TOKEN_FILE = (0, path_1.join)(CONFIG_DIR, "auth.enc");
14
14
  async function getEncryptionKey(salt) {
15
- const machineId =
16
- // eslint-disable-next-line turbo/no-undeclared-env-vars
17
- process.env.HOME || process.env.USERPROFILE || "default-machine";
15
+ const machineId = process.env.HOME || process.env.USERPROFILE || "default-machine";
18
16
  const scryptAsync = (0, util_1.promisify)(crypto_1.scrypt);
19
17
  return (await scryptAsync("empirical-cli-tokens-" + machineId, salt, 32));
20
18
  }
@@ -38,7 +36,7 @@ async function getTokenStorage() {
38
36
  decrypted += decipher.final("utf8");
39
37
  return JSON.parse(decrypted);
40
38
  }
41
- catch (error) {
39
+ catch {
42
40
  // Token file doesn't exist or is corrupted
43
41
  return null;
44
42
  }
@@ -95,7 +93,7 @@ async function getStoredUserTokens() {
95
93
  }
96
94
  return tokens;
97
95
  }
98
- catch (error) {
96
+ catch {
99
97
  // Token file doesn't exist or is corrupted
100
98
  return null;
101
99
  }
@@ -133,7 +131,7 @@ async function clearTokens() {
133
131
  ]);
134
132
  await (0, promises_1.writeFile)(TOKEN_FILE, encryptedData, { mode: 0o600 });
135
133
  }
136
- catch (error) {
134
+ catch {
137
135
  // File doesn't exist, ignore
138
136
  }
139
137
  }