@empiricalrun/test-gen 0.72.0 → 0.73.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 (123) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/agent/chat/index.d.ts.map +1 -1
  3. package/dist/agent/chat/index.js +12 -22
  4. package/dist/agent/chat/prompt/index.d.ts.map +1 -1
  5. package/dist/agent/chat/prompt/index.js +3 -2
  6. package/dist/agent/code-review/prompt.d.ts +2 -0
  7. package/dist/agent/code-review/prompt.d.ts.map +1 -0
  8. package/dist/agent/code-review/prompt.js +19 -0
  9. package/dist/agent/codegen/create-test-block.d.ts.map +1 -1
  10. package/dist/agent/codegen/create-test-block.js +0 -10
  11. package/dist/agent/diagnosis-agent/index.d.ts.map +1 -1
  12. package/dist/agent/diagnosis-agent/index.js +0 -9
  13. package/dist/agent/master/execute-browser-action.d.ts +1 -1
  14. package/dist/agent/master/execute-browser-action.d.ts.map +1 -1
  15. package/dist/agent/master/execute-skill-action.d.ts +1 -1
  16. package/dist/agent/master/execute-skill-action.d.ts.map +1 -1
  17. package/dist/agent/master/run.d.ts.map +1 -1
  18. package/dist/agent/master/run.js +0 -74
  19. package/dist/artifacts/index.d.ts.map +1 -1
  20. package/dist/artifacts/index.js +18 -6
  21. package/dist/artifacts/utils.d.ts +2 -2
  22. package/dist/artifacts/utils.d.ts.map +1 -1
  23. package/dist/artifacts/utils.js +16 -5
  24. package/dist/auth/cli-auth.d.ts.map +1 -1
  25. package/dist/auth/cli-auth.js +3 -7
  26. package/dist/auth/index.d.ts +1 -2
  27. package/dist/auth/index.d.ts.map +1 -1
  28. package/dist/auth/index.js +2 -4
  29. package/dist/auth/token-store.d.ts +1 -1
  30. package/dist/auth/token-store.d.ts.map +1 -1
  31. package/dist/auth/token-store.js +3 -3
  32. package/dist/bin/environments.d.ts +5 -1
  33. package/dist/bin/environments.d.ts.map +1 -1
  34. package/dist/bin/environments.js +9 -11
  35. package/dist/bin/index.js +33 -74
  36. package/dist/bin/setup.d.ts +3 -1
  37. package/dist/bin/setup.d.ts.map +1 -1
  38. package/dist/bin/setup.js +6 -10
  39. package/dist/dashboard/client.d.ts +26 -0
  40. package/dist/dashboard/client.d.ts.map +1 -0
  41. package/dist/dashboard/client.js +185 -0
  42. package/dist/dashboard/index.d.ts +2 -20
  43. package/dist/dashboard/index.d.ts.map +1 -1
  44. package/dist/dashboard/index.js +7 -81
  45. package/dist/dashboard/totp.d.ts +1 -1
  46. package/dist/dashboard/totp.d.ts.map +1 -1
  47. package/dist/dashboard/totp.js +2 -6
  48. package/dist/dashboard/types.d.ts +9 -0
  49. package/dist/dashboard/types.d.ts.map +1 -0
  50. package/dist/dashboard/types.js +17 -0
  51. package/dist/file-info/github.d.ts +2 -2
  52. package/dist/file-info/github.d.ts.map +1 -1
  53. package/dist/file-info/github.js +9 -10
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +0 -9
  56. package/dist/recorder/env-variables.d.ts.map +1 -1
  57. package/dist/recorder/env-variables.js +3 -7
  58. package/dist/recorder/index.js +5 -5
  59. package/dist/recorder/request.js +4 -9
  60. package/dist/recorder/upload.d.ts +3 -2
  61. package/dist/recorder/upload.d.ts.map +1 -1
  62. package/dist/recorder/upload.js +20 -22
  63. package/dist/tools/commit-and-create-pr.d.ts.map +1 -1
  64. package/dist/tools/commit-and-create-pr.js +42 -35
  65. package/dist/tools/delete-file.d.ts +3 -0
  66. package/dist/tools/delete-file.d.ts.map +1 -0
  67. package/dist/tools/delete-file.js +83 -0
  68. package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
  69. package/dist/tools/diagnosis-fetcher.js +3 -7
  70. package/dist/tools/executor/index.d.ts +6 -9
  71. package/dist/tools/executor/index.d.ts.map +1 -1
  72. package/dist/tools/executor/index.js +23 -29
  73. package/dist/tools/executor/utils/checkpoint.d.ts +2 -2
  74. package/dist/tools/executor/utils/checkpoint.d.ts.map +1 -1
  75. package/dist/tools/executor/utils/checkpoint.js +6 -5
  76. package/dist/tools/executor/utils/git.d.ts +7 -12
  77. package/dist/tools/executor/utils/git.d.ts.map +1 -1
  78. package/dist/tools/executor/utils/git.js +11 -36
  79. package/dist/tools/executor/utils/index.d.ts +37 -21
  80. package/dist/tools/executor/utils/index.d.ts.map +1 -1
  81. package/dist/tools/executor/utils/index.js +57 -58
  82. package/dist/tools/executor/utils/pr-description.d.ts +4 -0
  83. package/dist/tools/executor/utils/pr-description.d.ts.map +1 -0
  84. package/dist/tools/executor/utils/pr-description.js +24 -0
  85. package/dist/tools/fetch-image/index.d.ts +3 -0
  86. package/dist/tools/fetch-image/index.d.ts.map +1 -0
  87. package/dist/tools/fetch-image/index.js +56 -0
  88. package/dist/tools/grep/index.d.ts.map +1 -1
  89. package/dist/tools/grep/index.js +1 -1
  90. package/dist/tools/index.d.ts +4 -0
  91. package/dist/tools/index.d.ts.map +1 -0
  92. package/dist/tools/index.js +60 -0
  93. package/dist/tools/list-environments.d.ts.map +1 -1
  94. package/dist/tools/list-environments.js +2 -5
  95. package/dist/tools/merge-conflicts.d.ts +3 -0
  96. package/dist/tools/merge-conflicts.d.ts.map +1 -0
  97. package/dist/tools/merge-conflicts.js +107 -0
  98. package/dist/tools/run-test.d.ts.map +1 -1
  99. package/dist/tools/run-test.js +2 -2
  100. package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
  101. package/dist/tools/test-run-fetcher/index.js +2 -6
  102. package/dist/tools/upgrade-packages/index.d.ts.map +1 -1
  103. package/dist/tools/upgrade-packages/index.js +10 -11
  104. package/dist/tools/upgrade-packages/utils.d.ts +3 -2
  105. package/dist/tools/upgrade-packages/utils.d.ts.map +1 -1
  106. package/dist/tools/upgrade-packages/utils.js +5 -8
  107. package/dist/tools/utils/queue.d.ts +5 -0
  108. package/dist/tools/utils/queue.d.ts.map +1 -0
  109. package/dist/tools/utils/queue.js +41 -0
  110. package/package.json +5 -5
  111. package/tsconfig.tsbuildinfo +1 -1
  112. package/dist/auth/api-client.d.ts +0 -13
  113. package/dist/auth/api-client.d.ts.map +0 -1
  114. package/dist/auth/api-client.js +0 -107
  115. package/dist/session/index.d.ts +0 -20
  116. package/dist/session/index.d.ts.map +0 -1
  117. package/dist/session/index.js +0 -104
  118. package/dist/tools/definitions/index.d.ts +0 -22
  119. package/dist/tools/definitions/index.d.ts.map +0 -1
  120. package/dist/tools/definitions/index.js +0 -61
  121. package/dist/tools/definitions/utils/queue.d.ts +0 -8
  122. package/dist/tools/definitions/utils/queue.d.ts.map +0 -1
  123. package/dist/tools/definitions/utils/queue.js +0 -58
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.73.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 81be84b: feat: use origin url for dashboard requests
8
+ - b15ecf8: feat: using hash to generate sqs url for preview env
9
+ - 0d3ea8d: feat: add fetchImageTool, update image check in claude
10
+ - d5e16dc: refactor: unified dashboard api client
11
+
12
+ ### Patch Changes
13
+
14
+ - 643e859: fix: image type check in llm package, fetchImageTool description updated, image rendering fix in message component
15
+ - d5a5ec7: fix: support artifacts with urls from json report
16
+ - f8a4374: feat: add delete file tool, some clean up
17
+ - 6423dcb: chore: cleaner tools API for chat agent loop
18
+ - Updated dependencies [643e859]
19
+ - Updated dependencies [0d3ea8d]
20
+ - @empiricalrun/llm@0.20.1
21
+
3
22
  ## 0.72.0
4
23
 
5
24
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAoCpC,wBAAsB,yBAAyB,IAAI,OAAO,CACxD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CACvB,CAwBA;AAED,wBAAsB,kBAAkB,CAAC,EACvC,mBAAmB,EACnB,aAAa,EACb,oBAAoB,GACrB,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,iBAmKA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAkCpC,wBAAsB,yBAAyB,IAAI,OAAO,CACxD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CACvB,CAqBA;AAED,wBAAsB,kBAAkB,CAAC,EACvC,mBAAmB,EACnB,aAAa,EACb,oBAAoB,GACrB,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,iBA4JA"}
@@ -5,15 +5,15 @@ exports.runChatAgentForCLI = runChatAgentForCLI;
5
5
  const llm_1 = require("@empiricalrun/llm");
6
6
  const chat_1 = require("@empiricalrun/llm/chat");
7
7
  const picocolors_1 = require("picocolors");
8
+ const client_1 = require("../../dashboard/client");
8
9
  const file_system_1 = require("../../file-info/file-system");
9
10
  const human_in_the_loop_1 = require("../../human-in-the-loop");
10
- const definitions_1 = require("../../tools/definitions");
11
+ const tools_1 = require("../../tools");
11
12
  const executor_1 = require("../../tools/executor");
12
13
  const git_1 = require("../../tools/executor/utils/git");
13
14
  const agent_loop_1 = require("./agent-loop");
14
15
  const state_1 = require("./state");
15
16
  const utils_1 = require("./utils");
16
- const DASHBOARD_DOMAIN = process.env.DASHBOARD_DOMAIN || "https://dash.empirical.run";
17
17
  function stopCriteria(userPrompt) {
18
18
  return userPrompt?.toLowerCase() === "stop";
19
19
  }
@@ -24,15 +24,12 @@ function concludeAgent(chatModel, useDiskForChatState, selectedModel, error) {
24
24
  }
25
25
  }
26
26
  async function fetchEnvironmentVariables() {
27
- // TODO: Wrap in try-catch and log error
28
- const response = await fetch(`${DASHBOARD_DOMAIN}/api/environment-variables`, {
29
- headers: {
30
- "Content-Type": "application/json",
31
- Authorization: `Bearer ${process.env.EMPIRICALRUN_API_KEY}`,
32
- },
27
+ const apiClient = new client_1.DashboardAPIClient({
28
+ authType: "project-api-key",
29
+ projectApiKey: process.env.EMPIRICALRUN_API_KEY,
33
30
  });
34
- const data = await response.json();
35
- if (!data.data) {
31
+ const data = await apiClient.request("/api/environment-variables", { method: "GET" });
32
+ if (!data.data || !data.data.environment_variables) {
36
33
  console.error("Failed to fetch environment variables:", data);
37
34
  throw new Error("Failed to fetch environment variables");
38
35
  }
@@ -131,24 +128,17 @@ async function runChatAgentForCLI({ useDiskForChatState, selectedModel, initialP
131
128
  }
132
129
  }
133
130
  else {
134
- if (!process.env.EMPIRICALRUN_API_KEY) {
135
- throw new Error("EMPIRICALRUN_API_KEY is not set");
136
- }
137
131
  const toolExecutor = new executor_1.ToolExecutor({
138
- chatSessionId: null,
139
- selectedModel,
132
+ chatSession: null,
140
133
  branchName,
141
134
  repoPath: process.cwd(),
142
- apiKey: process.env.EMPIRICALRUN_API_KEY,
135
+ apiClient: new client_1.DashboardAPIClient({
136
+ authType: "user-access-token",
137
+ }),
143
138
  trace,
144
139
  featureFlags: [],
145
140
  environmentOverrides: await fetchEnvironmentVariables(),
146
141
  });
147
- const toolCaller = new definitions_1.ToolCaller({
148
- chatSessionId: null,
149
- selectedModel,
150
- branchName,
151
- });
152
142
  const fileInfo = await (0, file_system_1.getFileInfoFromFS)(process.cwd());
153
143
  await (0, agent_loop_1.chatAgentLoop)({
154
144
  chatModel,
@@ -182,7 +172,7 @@ async function runChatAgentForCLI({ useDiskForChatState, selectedModel, initialP
182
172
  repoInfo: fileInfo,
183
173
  isToolExecutionRemote: false,
184
174
  toolExecutor,
185
- tools: toolCaller.tools,
175
+ tools: (0, tools_1.availableTools)(selectedModel),
186
176
  onPendingToolCall: async () => { },
187
177
  featureFlags: ["extendedThinkingClaude"],
188
178
  });
@@ -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,mBA4GzD"}
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"}
@@ -7,8 +7,9 @@ async function buildSystemPrompt(repoInfo) {
7
7
  const preamble = `
8
8
  You are a helpful assistant that can answer questions and help with tasks related to writing and maintaining Playwright tests.
9
9
 
10
- You are working on a test code repository that contains Playwright tests and other related files. If you have modified
11
- any files, your end output should be a pull request that will be reviewed and merged by a human.
10
+ You are working on a test code repository that contains Playwright tests and other related files. Your working directory
11
+ has been checked out on a git branch, and your actions that edit files will be automatically committed. If you make any
12
+ file edits, you must create a pull request after your work is done, to get your work reviewed and merged by a human.
12
13
 
13
14
  # Your capabilities
14
15
 
@@ -0,0 +1,2 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/agent/code-review/prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,8YAelB,CAAC"}
@@ -0,0 +1,19 @@
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 +1 @@
1
- {"version":3,"file":"create-test-block.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/create-test-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAc3D,wBAAsB,wBAAwB,CAAC,EAC7C,QAAQ,EACR,IAAI,EACJ,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,+BA+CA"}
1
+ {"version":3,"file":"create-test-block.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/create-test-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAa3D,wBAAsB,wBAAwB,CAAC,EAC7C,QAAQ,EACR,IAAI,EACJ,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,+BAsCA"}
@@ -7,20 +7,10 @@ const context_1 = require("../../bin/utils/context");
7
7
  const web_1 = require("../../bin/utils/platform/web");
8
8
  const constants_1 = require("../../constants");
9
9
  const promptTemplate_0 = "{{#section \"system\"}}\nYou are a software test engineer who is given a task to write an empty test block.\nBased on the inputs you need to create an empty playwright test block with correctly imported fixture.\n\nThe test will contain a test name which you will need to use to build the empty test case block.\n\nYou will be provided with current tests, fixtures and page object models for you to use and create test case block as\nper the task provided to you.\n\nBefore responding you need to ensure that the code change is minimal and the change is reusable across tests. You need\nto ensure the code follows DRY principle.\n\nHere is the list of current tests and fixtures:\n\n{{testFiles}}\n\nHere is the list of current page object models:\n\n{{pageFiles}}\n{{/section}}\n\n{{#section \"user\"}}\nFollowing is the test scenario for which you need to write the empty test case block:\ntest name:\n{{scenarioName}}\n\ntask:\ncreate an empty test case block for the following test steps:\n{{scenario}}\n\ntest file path: {{scenarioFile}}\n\n------\n\nYou also need to ensure that the empty test case block has a starting page to begin test.\n\nIn order to identify the right page with which the test should start, follow the steps:\n- based on the similarities with other test cases mentioned in the file, identify the right page fixture to be imported\n- Read the page fixture methods step by step. Identify whether the fixture handles navigating to a page.\n- Identify whether other tests using the page fixture had to add separate steps for navigation or not\n- Based on the above analysis there will be following cases and choose either for the given test scenario:\n-- Case 1: if the test case scenario provided inside the task mentions about page navigation, then use that page\nnavigation. skip other cases if this case is satisfied.\n-- Case 2: refer other test cases which import similar fixtures and infer the first page navigation of this test case.\nYou should prefer tests which are in the same file. Tests within same file have higher overlaps in first page\nnavigation.\n- Once the page fixture is decided, look for userContext fixture in files. If its available then add \"userContext\" to\nthe test case block\n\n\n\nFollow these instructions before responding with output:\n- Read the code line by line and achieve the task provided to you\n- Read the dependencies of the code block by scanning through file paths and file provided to you. refer the same file\npath while responding with update\n- Focus only on the test case provided and associated JS methods called from the test case.\n- Respond only with the new empty test case block to be created and nothing else.\n- DO NOT respond with any backticks or markdown syntax\n- If \"userContext\" fixture is available in fixtures file, ensure importing that fixture in the test case block.\n- Provide a reason based on the test steps provided to you on why you chose the fixture or page.goto statement. The\nreason should be one of the list steps provided to you and mention why the case was chosen\n{{/section}}";
10
- const session_1 = require("../../session");
11
10
  async function createEmptyTestCaseBlock({ testCase, file, trace, }) {
12
11
  const logger = new logger_1.CustomLogger({ useReporter: false });
13
12
  logger.log("Creating new test block");
14
13
  const context = await (0, context_1.contextForGeneration)(file);
15
- // TODO: move this to a common place
16
- const session = (0, session_1.getSessionDetails)();
17
- trace =
18
- trace ||
19
- llm_1.langfuseInstance?.trace({
20
- name: "create-empty-test-block",
21
- id: crypto.randomUUID(),
22
- release: session.version,
23
- });
24
14
  const promptSpan = trace?.span({
25
15
  name: "build-create-empty-test-case-prompt",
26
16
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/diagnosis-agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAuChD,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,CA6E5B"}
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"}
@@ -2,9 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createTaskUsingFailureDiagnosis = createTaskUsingFailureDiagnosis;
4
4
  const llm_1 = require("@empiricalrun/llm");
5
- const session_1 = require("../../session");
6
5
  const strict_mode_violation_1 = require("./strict-mode-violation");
7
- const session = (0, session_1.getSessionDetails)();
8
6
  const responseFormat = {
9
7
  type: "json_schema",
10
8
  json_schema: {
@@ -31,13 +29,6 @@ const responseFormat = {
31
29
  },
32
30
  };
33
31
  async function createTaskUsingFailureDiagnosis({ trace, diagnosis, logger, }) {
34
- trace =
35
- trace ||
36
- llm_1.langfuseInstance?.trace({
37
- name: "infer-agent-task",
38
- id: crypto.randomUUID(),
39
- release: session.version,
40
- });
41
32
  const failureDiagnosisSpan = trace?.span({
42
33
  name: "auto-fix",
43
34
  input: {
@@ -11,7 +11,7 @@ export declare function executeBrowserAction({ page, nextAction, flags, actions,
11
11
  useActionSpecificAnnotations: boolean;
12
12
  };
13
13
  actions: PlaywrightActions;
14
- trace: TraceClient | undefined;
14
+ trace?: TraceClient | undefined;
15
15
  llm: LLM;
16
16
  }): Promise<{
17
17
  generatedCodeSteps: string[];
@@ -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,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,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;;GA8H7B"}
@@ -6,6 +6,6 @@ export declare function executeSkillAction({ actions, nextAction, trace, }: {
6
6
  actionType: string;
7
7
  toolCallArgs: string;
8
8
  };
9
- trace: TraceClient | undefined;
9
+ trace?: TraceClient | undefined;
10
10
  }): Promise<string | undefined>;
11
11
  //# sourceMappingURL=execute-skill-action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute-skill-action.d.ts","sourceRoot":"","sources":["../../../src/agent/master/execute-skill-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAMlD,wBAAsB,kBAAkB,CAAC,EACvC,OAAO,EACP,UAAU,EACV,KAAK,GACN,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;CAChC,+BAeA"}
1
+ {"version":3,"file":"execute-skill-action.d.ts","sourceRoot":"","sources":["../../../src/agent/master/execute-skill-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAMlD,wBAAsB,kBAAkB,CAAC,EACvC,OAAO,EACP,UAAU,EACV,KAAK,GACN,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACjC,+BAeA"}
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAclC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAUxC,OAAO,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAKzD,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAqB9C,wBAAsB,0BAA0B,CAAC,EAC/C,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;;;GA4PA"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAalC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAUxC,OAAO,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAKzD,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAqB9C,wBAAsB,0BAA0B,CAAC,EAC/C,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;;;GAiLA"}
@@ -10,7 +10,6 @@ const logger_1 = require("../../bin/logger");
10
10
  const constants_1 = require("../../constants");
11
11
  const errors_1 = require("../../errors");
12
12
  const page_1 = require("../../page");
13
- const session_1 = require("../../session");
14
13
  const utils_2 = require("../browsing/utils");
15
14
  const skills_retriever_1 = require("../codegen/skills-retriever");
16
15
  const run_1 = require("../planner/run");
@@ -40,24 +39,8 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
40
39
  const useActionSpecificAnnotations = options?.useActionSpecificAnnotations || false;
41
40
  const usePlannerInMaster = options?.usePlannerInMaster || false;
42
41
  const logger = new logger_1.CustomLogger({ useReporter: false });
43
- const session = (0, session_1.getSessionDetails)();
44
42
  const testGenPage = new page_1.TestGenPage(page, (0, utils_1.getPageVarName)());
45
- const trace = llm_1.langfuseInstance?.trace({
46
- name: "test-generator",
47
- id: crypto.randomUUID(),
48
- version: session.version,
49
- metadata: {
50
- generationId: session.generationId,
51
- sessionId: session.sessionId,
52
- testUrl: session.testUrl,
53
- },
54
- tags: [
55
- options.metadata?.projectName,
56
- options.metadata?.environment,
57
- ].filter((s) => !!s),
58
- });
59
43
  const llm = new llm_1.LLM({
60
- trace,
61
44
  provider: options.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER,
62
45
  defaultModel: options.model || constants_1.DEFAULT_MODEL,
63
46
  providerApiKey: constants_1.MODEL_API_KEYS[options.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER],
@@ -68,7 +51,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
68
51
  if (testCase && exports.IS_ALLOWED_TO_USE_SKILLS) {
69
52
  skills = await (0, skills_retriever_1.getAppropriateSkills)({
70
53
  testCase,
71
- trace,
72
54
  //@ts-ignore
73
55
  options,
74
56
  });
@@ -79,7 +61,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
79
61
  const plan = await (0, run_1.planTask)({
80
62
  task,
81
63
  specPath,
82
- trace,
83
64
  });
84
65
  logger.log(`Here is the plan:\n${plan}`);
85
66
  // Will assume this is the task hereon
@@ -87,26 +68,13 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
87
68
  }
88
69
  const actions = new actions_1.PlaywrightActions(testGenPage, scopeVars);
89
70
  await (0, utils_2.injectPwLocatorGenerator)(page);
90
- trace?.update({ input: { task } });
91
71
  let isGivenTaskDone = false;
92
72
  const masterAgentActions = [];
93
73
  let failedActions = [];
94
74
  let disableSkills = false;
95
75
  // Run the loop until task is done or we have reached max retry limit
96
76
  while (!isGivenTaskDone) {
97
- if (await (0, session_1.shouldStopSession)()) {
98
- break;
99
- }
100
- const masterAgentSpan = trace?.span({
101
- name: "master-agent",
102
- input: {
103
- task,
104
- executedActions: masterAgentActions,
105
- failedActions,
106
- },
107
- });
108
77
  const plannerResp = await (0, run_time_planner_1.runtimePlanner)({
109
- trace: masterAgentSpan,
110
78
  task,
111
79
  successfulActions: [...masterAgentActions],
112
80
  pages: getPageVariables(actions.getStateVariables()),
@@ -128,9 +96,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
128
96
  const pageScreenshot = buffer.toString("base64");
129
97
  let output;
130
98
  let generatedCodeSteps = [];
131
- if (await (0, session_1.shouldStopSession)()) {
132
- break;
133
- }
134
99
  // Provides next action that needs to be taken
135
100
  const nextAction = await (0, next_action_1.getNextAction)({
136
101
  page,
@@ -138,25 +103,18 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
138
103
  task,
139
104
  executedActions: masterAgentActions,
140
105
  failedActions,
141
- trace: masterAgentSpan,
142
106
  llm,
143
107
  options,
144
108
  actions,
145
109
  disableSkills,
146
110
  logger,
147
111
  });
148
- if (await (0, session_1.shouldStopSession)()) {
149
- break;
150
- }
151
112
  if (nextAction) {
152
113
  if (nextAction.actionType === action_tool_calls_1.ActionType.UNKNOWN) {
153
114
  logger.error("Agent is not able to figure out next action since element is not visible on screen.");
154
115
  break;
155
116
  }
156
117
  const args = JSON.parse(nextAction.toolCallArgs);
157
- const masterAgentActionSpan = masterAgentSpan?.span({
158
- name: "master-agent-execute-action",
159
- });
160
118
  output = {
161
119
  action: args.action || args.skill,
162
120
  reason: args.reason,
@@ -168,7 +126,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
168
126
  const code = await (0, execute_skill_action_1.executeSkillAction)({
169
127
  actions,
170
128
  nextAction,
171
- trace: masterAgentActionSpan,
172
129
  });
173
130
  if (code) {
174
131
  generatedCodeSteps.push(code);
@@ -189,7 +146,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
189
146
  },
190
147
  actions,
191
148
  llm,
192
- trace: masterAgentActionSpan,
193
149
  });
194
150
  const { generatedCodeSteps: codeFromExecuteAction, output: outputFromExecuteAction, } = result;
195
151
  generatedCodeSteps.push(...codeFromExecuteAction);
@@ -199,16 +155,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
199
155
  // resetting error count as there is a successful action
200
156
  failedActions = [];
201
157
  masterAgentActions.push(output.action);
202
- masterAgentActionSpan?.end({
203
- input: {
204
- action: output.action,
205
- reason: output.reason,
206
- type: nextAction.actionType,
207
- },
208
- output: {
209
- success: true,
210
- },
211
- });
212
158
  // enable skills after success
213
159
  disableSkills = false;
214
160
  }
@@ -217,17 +163,6 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
217
163
  logger.log("Disabling skill usage for next retry");
218
164
  disableSkills = true;
219
165
  }
220
- masterAgentActionSpan?.end({
221
- input: {
222
- action: output.action,
223
- reason: output.reason,
224
- type: nextAction.actionType,
225
- },
226
- output: {
227
- error: true,
228
- errorSummary: e.message,
229
- },
230
- });
231
166
  if (!(e instanceof errors_1.HumanApprovalDenied)) {
232
167
  logger.error("Failed to run master agent's next task", JSON.stringify(nextAction, null, 2), e);
233
168
  failedActions.push(output.action);
@@ -239,17 +174,8 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
239
174
  }
240
175
  }
241
176
  }
242
- trace?.update({ input: { task }, output: { output } });
243
- masterAgentSpan?.end({
244
- output: {
245
- action: output?.action,
246
- reason: output?.reason,
247
- code: generatedCodeSteps,
248
- },
249
- });
250
177
  }
251
178
  const { code, importPaths } = actions.generateCode();
252
- trace?.update({ input: { task }, output: { code } });
253
179
  logger.success("Successfully generated code for the given task");
254
180
  return {
255
181
  code,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EACR,aAAa,EAGd,MAAM,4BAA4B,CAAC;AAkBpC,wBAAgB,2BAA2B,uBAM1C;AA6HD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,EAAE,EACvB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,QAAQ,EAAE,CAAC,CA8DrB;AAED,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,aAAa,CAA8B;gBAEvC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAKvC,OAAO,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAelD,iBAAiB,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;CAMtD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EACR,aAAa,EAId,MAAM,4BAA4B,CAAC;AAwBpC,wBAAgB,2BAA2B,uBAM1C;AA6HD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,EAAE,EACvB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAsErB;AAED,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,aAAa,CAA8B;gBAEvC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAKvC,OAAO,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAelD,iBAAiB,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;CAMtD"}
@@ -16,6 +16,9 @@ function isArtifactInputData(artifact) {
16
16
  function isArtifactInputPath(artifact) {
17
17
  return "path" in artifact;
18
18
  }
19
+ function isArtifactInputUrl(artifact) {
20
+ return "url" in artifact;
21
+ }
19
22
  function isArtifactCollectionEnabled() {
20
23
  return (process.env.R2_ACCOUNT_ID &&
21
24
  process.env.R2_ACCESS_KEY_ID &&
@@ -159,6 +162,7 @@ async function collectArtifacts(inputs, repoDir, toolCallId) {
159
162
  return [];
160
163
  const dataArtifacts = inputs.filter(isArtifactInputData);
161
164
  const pathArtifacts = inputs.filter(isArtifactInputPath);
165
+ const urlArtifacts = inputs.filter(isArtifactInputUrl);
162
166
  for (const artifact of pathArtifacts) {
163
167
  if (!isFullPath(artifact.path, repoDir)) {
164
168
  throw new Error(`Invalid path: "${artifact.path}". Path should be a full path relative to the repo directory: "${repoDir}"`);
@@ -179,14 +183,22 @@ async function collectArtifacts(inputs, repoDir, toolCallId) {
179
183
  const inputsWithFileNames = [
180
184
  ...pathArtifacts,
181
185
  ...dataArtifactsWithFileName,
186
+ ...urlArtifacts,
182
187
  ];
183
188
  const results = inputsWithFileNames.map((artifact) => {
184
- const isPathArtifact = isArtifactInputPath(artifact);
185
- const relativePath = isPathArtifact
186
- ? path_1.default.relative(repoDir, artifact.path)
187
- : artifact.fileName;
188
- const pathInBucket = path_1.default.join(destinationDir, relativePath);
189
- const url = `https://reports.empirical.run/${pathInBucket}`;
189
+ let url;
190
+ if (isArtifactInputUrl(artifact)) {
191
+ // url artifacts are passthrough
192
+ url = artifact.url;
193
+ }
194
+ else {
195
+ const isPathArtifact = isArtifactInputPath(artifact);
196
+ const relativePath = isPathArtifact
197
+ ? path_1.default.relative(repoDir, artifact.path)
198
+ : artifact.fileName;
199
+ const pathInBucket = path_1.default.join(destinationDir, relativePath);
200
+ url = `https://reports.empirical.run/${pathInBucket}`;
201
+ }
190
202
  return {
191
203
  name: artifact.name,
192
204
  contentType: artifact.contentType,
@@ -1,11 +1,11 @@
1
- import { ArtifactInput, ArtifactInputPath } from "@empiricalrun/shared-types";
1
+ import { ArtifactInput, ArtifactInputPath, ArtifactInputUrl } from "@empiricalrun/shared-types";
2
2
  import { JSONReport as PlaywrightJSONReport } from "@playwright/test/reporter";
3
3
  /**
4
4
  * Extracts attachment information from a Playwright JSON report.
5
5
  * @param report The Playwright JSON report to extract attachments from
6
6
  * @returns An array of objects containing path and contentType for each attachment
7
7
  */
8
- export declare function extractAttachmentsFromPlaywrightJSONReport(report: PlaywrightJSONReport, testNameFilter?: string): ArtifactInputPath[];
8
+ export declare function extractAttachmentsFromPlaywrightJSONReport(report: PlaywrightJSONReport, testNameFilter?: string): Array<ArtifactInputUrl | ArtifactInputPath>;
9
9
  /**
10
10
  * Scans the given repository directory for Playwright artifacts (attachments) by:
11
11
  * - Constructing the path to the Playwright report directory using the provided repoDir.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/artifacts/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EACL,UAAU,IAAI,oBAAoB,EAGnC,MAAM,2BAA2B,CAAC;AAInC;;;;GAIG;AACH,wBAAgB,0CAA0C,CACxD,MAAM,EAAE,oBAAoB,EAC5B,cAAc,CAAC,EAAE,MAAM,GACtB,iBAAiB,EAAE,CA2DrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAmCxE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/artifacts/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,UAAU,IAAI,oBAAoB,EAGnC,MAAM,2BAA2B,CAAC;AAInC;;;;GAIG;AACH,wBAAgB,0CAA0C,CACxD,MAAM,EAAE,oBAAoB,EAC5B,cAAc,CAAC,EAAE,MAAM,GACtB,KAAK,CAAC,gBAAgB,GAAG,iBAAiB,CAAC,CAsE7C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAmCxE"}
@@ -40,11 +40,22 @@ function extractAttachmentsFromPlaywrightJSONReport(report, testNameFilter) {
40
40
  for (const attachment of result.attachments) {
41
41
  // Only collect attachments that have a 'path' (i.e., not embedded content)
42
42
  if (attachment.path && attachment.contentType) {
43
- attachments.push({
44
- name: `${testTitle} - ${attachment.name}`,
45
- path: attachment.path,
46
- contentType: attachment.contentType,
47
- });
43
+ const isUrl = attachment.path.startsWith("http://") ||
44
+ attachment.path.startsWith("https://");
45
+ if (isUrl) {
46
+ attachments.push({
47
+ name: `${testTitle} - ${attachment.name}`,
48
+ url: attachment.path,
49
+ contentType: attachment.contentType,
50
+ });
51
+ }
52
+ else {
53
+ attachments.push({
54
+ name: `${testTitle} - ${attachment.name}`,
55
+ path: attachment.path,
56
+ contentType: attachment.contentType,
57
+ });
58
+ }
48
59
  }
49
60
  }
50
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cli-auth.d.ts","sourceRoot":"","sources":["../../src/auth/cli-auth.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,UAAU,CAAC,CAwKxD;AAED,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5C;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC;IAC7C,aAAa,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC,CAAC,CAeD"}
1
+ {"version":3,"file":"cli-auth.d.ts","sourceRoot":"","sources":["../../src/auth/cli-auth.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,UAAU,CAAC,CAwKxD;AAED,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5C;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC;IAC7C,aAAa,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC,CAAC,CAeD"}
@@ -11,14 +11,10 @@ const http_1 = require("http");
11
11
  const url_1 = require("url");
12
12
  const token_store_1 = require("./token-store");
13
13
  const CLIENT_PORT_DEFAULT = 8080;
14
- // Get dashboard URL
15
- const getDashboardUrl = () => {
16
- return process.env.DASHBOARD_DOMAIN || "https://dash.empirical.run";
17
- };
18
14
  async function authenticate() {
19
15
  // Check if already authenticated
20
16
  if (await (0, token_store_1.isAuthenticated)()) {
21
- const tokens = await (0, token_store_1.getStoredTokens)();
17
+ const tokens = await (0, token_store_1.getStoredUserTokens)();
22
18
  if (tokens) {
23
19
  return {
24
20
  success: true,
@@ -29,7 +25,7 @@ async function authenticate() {
29
25
  };
30
26
  }
31
27
  }
32
- const appUrl = getDashboardUrl();
28
+ const appUrl = process.env.DASHBOARD_DOMAIN || "https://dash.empirical.run";
33
29
  const clientPort = await (0, detect_port_1.default)(CLIENT_PORT_DEFAULT);
34
30
  const redirectUri = `http://localhost:${clientPort}/callback`;
35
31
  return new Promise((resolve) => {
@@ -175,7 +171,7 @@ async function logout() {
175
171
  }
176
172
  async function getAuthStatus() {
177
173
  if (await (0, token_store_1.isAuthenticated)()) {
178
- const tokens = await (0, token_store_1.getStoredTokens)();
174
+ const tokens = await (0, token_store_1.getStoredUserTokens)();
179
175
  if (tokens) {
180
176
  return {
181
177
  authenticated: true,
@@ -1,4 +1,3 @@
1
- export { apiClient } from "./api-client";
2
1
  export { authenticate, getAuthStatus, logout } from "./cli-auth";
3
- export { clearTokens, getStoredTokens, isAuthenticated, type StoredTokens, storeTokens, } from "./token-store";
2
+ export { clearTokens, getStoredUserTokens as getStoredTokens, isAuthenticated, type StoredTokens, storeTokens, } from "./token-store";
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,EACf,KAAK,YAAY,EACjB,WAAW,GACZ,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EACL,WAAW,EACX,mBAAmB,IAAI,eAAe,EACtC,eAAe,EACf,KAAK,YAAY,EACjB,WAAW,GACZ,MAAM,eAAe,CAAC"}
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.storeTokens = exports.isAuthenticated = exports.getStoredTokens = exports.clearTokens = exports.logout = exports.getAuthStatus = exports.authenticate = exports.apiClient = void 0;
4
- var api_client_1 = require("./api-client");
5
- Object.defineProperty(exports, "apiClient", { enumerable: true, get: function () { return api_client_1.apiClient; } });
3
+ exports.storeTokens = exports.isAuthenticated = exports.getStoredTokens = exports.clearTokens = exports.logout = exports.getAuthStatus = exports.authenticate = void 0;
6
4
  var cli_auth_1 = require("./cli-auth");
7
5
  Object.defineProperty(exports, "authenticate", { enumerable: true, get: function () { return cli_auth_1.authenticate; } });
8
6
  Object.defineProperty(exports, "getAuthStatus", { enumerable: true, get: function () { return cli_auth_1.getAuthStatus; } });
9
7
  Object.defineProperty(exports, "logout", { enumerable: true, get: function () { return cli_auth_1.logout; } });
10
8
  var token_store_1 = require("./token-store");
11
9
  Object.defineProperty(exports, "clearTokens", { enumerable: true, get: function () { return token_store_1.clearTokens; } });
12
- Object.defineProperty(exports, "getStoredTokens", { enumerable: true, get: function () { return token_store_1.getStoredTokens; } });
10
+ Object.defineProperty(exports, "getStoredTokens", { enumerable: true, get: function () { return token_store_1.getStoredUserTokens; } });
13
11
  Object.defineProperty(exports, "isAuthenticated", { enumerable: true, get: function () { return token_store_1.isAuthenticated; } });
14
12
  Object.defineProperty(exports, "storeTokens", { enumerable: true, get: function () { return token_store_1.storeTokens; } });
@@ -9,7 +9,7 @@ export interface TokenStorage {
9
9
  [dashboardDomain: string]: StoredTokens;
10
10
  }
11
11
  export declare function storeTokens(tokens: StoredTokens): Promise<void>;
12
- export declare function getStoredTokens(): Promise<StoredTokens | null>;
12
+ export declare function getStoredUserTokens(): Promise<StoredTokens | null>;
13
13
  export declare function clearTokens(): Promise<void>;
14
14
  export declare function isAuthenticated(): Promise<boolean>;
15
15
  //# sourceMappingURL=token-store.d.ts.map
@@ -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,eAAe,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAqBpE;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":"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"}