@empiricalrun/test-gen 0.69.4 → 0.69.6

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.69.6
4
+
5
+ ### Patch Changes
6
+
7
+ - c0c1a9a: fix: use gemini stable instead of preview
8
+ - d67ca35: feat: add fetch-chat-session command, handle artifacts with same name
9
+ - 9a923e2: chore: preview env resources are in ap-south-1
10
+ - Updated dependencies [c0c1a9a]
11
+ - @empiricalrun/llm@0.19.2
12
+
13
+ ## 0.69.5
14
+
15
+ ### Patch Changes
16
+
17
+ - 385cf7d: fix: ora needs dynamic import for nodejs 20
18
+
3
19
  ## 0.69.4
4
20
 
5
21
  ### Patch Changes
@@ -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,CA6DrB;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,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"}
@@ -167,8 +167,9 @@ async function collectArtifacts(inputs, repoDir, toolCallId) {
167
167
  try {
168
168
  const dirs = { destinationDir, sourceDir: repoDir };
169
169
  const dataArtifactsWithFileName = dataArtifacts.map((a) => {
170
+ const randomSuffix = Math.random().toString(36).substring(2, 15);
170
171
  const fileExt = mime_1.default.getExtension(a.contentType);
171
- const fileName = `${(0, slug_1.slugify)(a.name)}-${Date.now().toString()}.${fileExt}`;
172
+ const fileName = `${(0, slug_1.slugify)(a.name)}-${randomSuffix}.${fileExt}`;
172
173
  return { ...a, fileName };
173
174
  });
174
175
  await Promise.all([
package/dist/bin/index.js CHANGED
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const llm_1 = require("@empiricalrun/llm");
8
8
  const commander_1 = require("commander");
9
9
  const dotenv_1 = __importDefault(require("dotenv"));
10
+ const fs_1 = __importDefault(require("fs"));
10
11
  const run_1 = require("../agent/browsing/run");
11
12
  const utils_1 = require("../agent/browsing/utils");
12
13
  const chat_1 = require("../agent/chat");
@@ -310,6 +311,29 @@ async function main() {
310
311
  await (0, setup_1.runSetup)({ repoName: options.repoName });
311
312
  process.exit(0);
312
313
  });
314
+ program
315
+ .command("fetch-chat-state")
316
+ .description("Fetch chat session state from the dashboard")
317
+ .requiredOption("--id <id>", "Chat session ID")
318
+ .action(async (opts) => {
319
+ try {
320
+ const response = await api_client_1.apiClient.request(`/api/chat-sessions/${opts.id}`);
321
+ if (!response.ok) {
322
+ console.error("❌ Failed to fetch chat session:", response.statusText);
323
+ process.exit(1);
324
+ }
325
+ const responseData = await response.json();
326
+ const chatState = responseData.data.chat_session.chat_state;
327
+ const filename = `chat-session-${opts.id}.json`;
328
+ fs_1.default.writeFileSync(filename, JSON.stringify(chatState, null, 2));
329
+ console.log(`✅ Chat state saved to ${filename}`);
330
+ }
331
+ catch (error) {
332
+ console.error("❌ Error fetching chat session:", error.message);
333
+ process.exit(1);
334
+ }
335
+ process.exit(0);
336
+ });
313
337
  program
314
338
  .command("legacy")
315
339
  .description("Run the legacy workflows")
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAKjE,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAgBjE,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,EACnB,cAAc,GAAE,MAAM,EAA+B,GACpD,OAAO,CAAC,UAAU,CAAC,CAqDrB;AAeD,wBAAsB,WAAW,kBAgDhC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAKjE,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAejE,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,EACnB,cAAc,GAAE,MAAM,EAA+B,GACpD,OAAO,CAAC,UAAU,CAAC,CAqDrB;AAeD,wBAAsB,WAAW,kBAgDhC"}
@@ -14,9 +14,8 @@ exports.ARGS_TO_MODEL_MAP = {
14
14
  "claude-4": "claude-sonnet-4-20250514",
15
15
  "claude-sonnet-4": "claude-sonnet-4-20250514",
16
16
  "claude-opus-4": "claude-opus-4-20250514",
17
- "gemini-2.5": "gemini-2.5-pro-preview-06-05",
18
- "gemini-2.5-pro": "gemini-2.5-pro-preview-06-05",
19
- "gemini-2.5-pro-preview-03-25": "gemini-2.5-pro-preview-06-05",
17
+ "gemini-2.5": "gemini-2.5-pro",
18
+ "gemini-2.5-pro": "gemini-2.5-pro",
20
19
  o3: "o3-2025-04-16",
21
20
  "o3-2025-04-16": "o3-2025-04-16",
22
21
  "o4-mini": "o4-mini-2025-04-16",
@@ -1 +1 @@
1
- {"version":3,"file":"temp-files.d.ts","sourceRoot":"","sources":["../../src/recorder/tem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BAS7B"}
@@ -32,7 +32,6 @@ function getTempTestFileLocation(selectedProject) {
32
32
  ...testMatchPattern,
33
33
  ...testIgnorePattern.map((p) => `!${p}`),
34
34
  ];
35
- console.log("Generated patterns:", patterns);
36
35
  const common = (0, glob_1.generateMatchingString)(patterns);
37
36
  if (!common) {
38
37
  throw new Error("Could not generate a valid test file location. Please check your testMatch and testIgnore patterns.");
@@ -81,6 +80,6 @@ async function deleteTempTestFile(repoDir, tempFileRelativePath) {
81
80
  logger_1.logger.debug("Temporary test file deleted:", tempFilePath);
82
81
  }
83
82
  else {
84
- logger_1.logger.warn("Temporary test file does not exist. Skipping deletion.");
83
+ logger_1.logger.debug("Temporary test file does not exist. Skipping deletion.");
85
84
  }
86
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/recorder/upload.ts"],"names":[],"mappings":"AAcA,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAoBjE;AA6FD,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,MAAM,EAAE,EACpB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,GAAG,MAAM,EAAE,CAAC,CAc1B"}
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/recorder/upload.ts"],"names":[],"mappings":"AAaA,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAoBjE;AA6FD,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,MAAM,EAAE,EACpB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,GAAG,MAAM,EAAE,CAAC,CAiB1B"}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.extractVideoAttachments = extractVideoAttachments;
7
7
  exports.uploadVideosWithSpinner = uploadVideosWithSpinner;
8
8
  const fs_1 = __importDefault(require("fs"));
9
- const ora_1 = __importDefault(require("ora"));
10
9
  const path_1 = __importDefault(require("path"));
11
10
  const utils_1 = require("../artifacts/utils");
12
11
  const api_client_1 = require("../auth/api-client");
@@ -105,7 +104,10 @@ async function uploadVideos(videoPaths, testSlug) {
105
104
  }
106
105
  }
107
106
  async function uploadVideosWithSpinner(videoPaths, testName) {
108
- const uploadSpinner = (0, ora_1.default)("Uploading video recordings...").start();
107
+ // Use dynamic imports to avoid issues with ESM modules
108
+ // https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
109
+ const ora = (await import("ora")).default;
110
+ const uploadSpinner = ora("Uploading video recordings...").start();
109
111
  try {
110
112
  const slugifiedTestName = `${(0, slug_1.slugify)(testName)}-${Math.random().toString(36).substring(2, 8)}`;
111
113
  const uploaded = await uploadVideos(videoPaths, slugifiedTestName);
@@ -1,5 +1,6 @@
1
1
  import { PendingToolCall, ServicePayload, Tool } from "@empiricalrun/shared-types";
2
2
  export declare function appendBranchNameToQueueUrl(queueUrl: string, branchName: string): string;
3
+ export declare function replaceRegionInUrl(url: string, newRegion: string): string;
3
4
  export declare function getQueueUrl(toolCalls: PendingToolCall[], tools: Tool[]): string;
4
5
  export declare function sendToolRequestToRemoteQueue(queueUrl: string, payload: ServicePayload): Promise<void>;
5
6
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tool-call-service/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,cAAc,EACd,IAAI,EACL,MAAM,4BAA4B,CAAC;AAEpC,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAOR;AAYD,wBAAgB,WAAW,CACzB,SAAS,EAAE,eAAe,EAAE,EAC5B,KAAK,EAAE,IAAI,EAAE,GACZ,MAAM,CAeR;AAED,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,cAAc,iBAiBxB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tool-call-service/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,cAAc,EACd,IAAI,EACL,MAAM,4BAA4B,CAAC;AAEpC,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAOR;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAOzE;AAgBD,wBAAgB,WAAW,CACzB,SAAS,EAAE,eAAe,EAAE,EAC5B,KAAK,EAAE,IAAI,EAAE,GACZ,MAAM,CAeR;AAED,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,cAAc,iBAiBxB"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.appendBranchNameToQueueUrl = appendBranchNameToQueueUrl;
4
+ exports.replaceRegionInUrl = replaceRegionInUrl;
4
5
  exports.getQueueUrl = getQueueUrl;
5
6
  exports.sendToolRequestToRemoteQueue = sendToolRequestToRemoteQueue;
6
7
  const client_sqs_1 = require("@aws-sdk/client-sqs");
@@ -12,12 +13,18 @@ function appendBranchNameToQueueUrl(queueUrl, branchName) {
12
13
  const queueNameWithoutFifo = queueName?.replace(/\.fifo$/, "");
13
14
  return `${parts.join("/")}/${queueNameWithoutFifo}-${suffix}.fifo`;
14
15
  }
16
+ function replaceRegionInUrl(url, newRegion) {
17
+ const parsedUrl = new URL(url);
18
+ parsedUrl.hostname = parsedUrl.hostname.replace(/\.([a-z0-9-]+)\.amazonaws\.com$/, `.${newRegion}.amazonaws.com`);
19
+ return parsedUrl.toString();
20
+ }
15
21
  function buildQueueUrlsForPreview(baseQueueUrl) {
16
22
  const branch = process.env.VERCEL_GIT_COMMIT_REF;
17
23
  if (!branch) {
18
24
  throw new Error("VERCEL_GIT_COMMIT_REF is not set");
19
25
  }
20
- const queueUrl = appendBranchNameToQueueUrl(baseQueueUrl, branch);
26
+ const updatedRegionForQueue = replaceRegionInUrl(baseQueueUrl, process.env.AWS_REGION);
27
+ const queueUrl = appendBranchNameToQueueUrl(updatedRegionForQueue, branch);
21
28
  console.log("queueUrl for preview", queueUrl);
22
29
  return queueUrl;
23
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.69.4",
3
+ "version": "0.69.6",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -64,7 +64,7 @@
64
64
  "tsx": "^4.16.2",
65
65
  "typescript": "^5.3.3",
66
66
  "zod": "^3.23.8",
67
- "@empiricalrun/llm": "^0.19.1",
67
+ "@empiricalrun/llm": "^0.19.2",
68
68
  "@empiricalrun/r2-uploader": "^0.3.9",
69
69
  "@empiricalrun/test-run": "^0.10.6"
70
70
  },
@@ -82,7 +82,7 @@
82
82
  "playwright": "1.53.0",
83
83
  "serve-handler": "^6.1.6",
84
84
  "ts-patch": "^3.3.0",
85
- "@empiricalrun/shared-types": "0.6.0"
85
+ "@empiricalrun/shared-types": "0.6.1"
86
86
  },
87
87
  "scripts": {
88
88
  "dev": "tspc --build --watch",