@empiricalrun/test-gen 0.69.1 → 0.69.2

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,13 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.69.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e2f72b5: fix: handle video processing time and large uploads
8
+ - Updated dependencies [e2f72b5]
9
+ - @empiricalrun/llm@0.19.1
10
+
3
11
  ## 0.69.1
4
12
 
5
13
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"for-recorder.d.ts","sourceRoot":"","sources":["../../../../../src/agent/cua/pw-codegen/pw-pause/for-recorder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,qBAAa,iCAAiC;IAO1C,OAAO,CAAC,eAAe;IANzB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,iBAAiB,CAAqB;gBAGpC,eAAe,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC;YAKtD,QAAQ;IAWhB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrC,sBAAsB,CAAC,IAAI,EAAE,IAAI;CAmCxC"}
1
+ {"version":3,"file":"for-recorder.d.ts","sourceRoot":"","sources":["../../../../../src/agent/cua/pw-codegen/pw-pause/for-recorder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,qBAAa,iCAAiC;IAO1C,OAAO,CAAC,eAAe;IANzB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,iBAAiB,CAAqB;gBAGpC,eAAe,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC;YAKtD,QAAQ;IAWhB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrC,sBAAsB,CAAC,IAAI,EAAE,IAAI;CA4CxC"}
@@ -69,13 +69,22 @@ class PlaywrightPauseCodegenForRecorder {
69
69
  }
70
70
  });
71
71
  await page.addInitScript(() => {
72
- setInterval(() => {
72
+ let displayNoneSet = false;
73
+ function setDisplayNone() {
73
74
  const glassPane = document.querySelector("x-pw-glass");
74
75
  if (glassPane) {
75
76
  const styles = glassPane.getAttribute("style") || "";
76
77
  glassPane.setAttribute("style", styles + "; display: none;");
78
+ displayNoneSet = true;
77
79
  }
78
- }, 300);
80
+ }
81
+ let interval = setInterval(() => {
82
+ if (displayNoneSet) {
83
+ clearInterval(interval);
84
+ return;
85
+ }
86
+ setDisplayNone();
87
+ }, 100);
79
88
  });
80
89
  await Promise.all([pausePromise, evaluatePromise]);
81
90
  }
@@ -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;AA4DD,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":"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"}
@@ -47,30 +47,56 @@ async function uploadVideos(videoPaths, testSlug) {
47
47
  const uploadDestinationDir = `recorder-uploads/${testSlug}`;
48
48
  const bucket = ASSETS_PRODUCTION_BUCKET;
49
49
  try {
50
- const formData = new FormData();
51
- formData.append("destination_dir", uploadDestinationDir);
52
- formData.append("bucket", bucket);
53
- for (const videoPath of videoPaths) {
54
- if (fs_1.default.existsSync(videoPath)) {
55
- const fileBuffer = fs_1.default.readFileSync(videoPath);
56
- const fileName = path_1.default.basename(videoPath);
57
- const blob = new Blob([fileBuffer], { type: "video/webm" });
58
- formData.append("files", blob, fileName);
59
- }
50
+ // Step 1: Get pre-signed URLs from the API
51
+ const files = videoPaths
52
+ .filter((videoPath) => fs_1.default.existsSync(videoPath))
53
+ .map((videoPath) => ({
54
+ name: path_1.default.basename(videoPath),
55
+ type: "video/webm",
56
+ }));
57
+ if (files.length === 0) {
58
+ return null;
60
59
  }
61
- const response = await api_client_1.apiClient.request("/api/upload", {
60
+ const presignedResponse = await api_client_1.apiClient.request("/api/upload", {
62
61
  method: "POST",
63
- body: formData,
62
+ headers: {
63
+ "Content-Type": "application/json",
64
+ },
65
+ body: JSON.stringify({
66
+ files,
67
+ destination_dir: uploadDestinationDir,
68
+ bucket,
69
+ }),
64
70
  });
65
- if (!response.ok) {
66
- console.warn(`Failed to upload videos: ${response.status} ${response.statusText}`);
71
+ if (!presignedResponse.ok) {
72
+ console.warn(`Failed to get pre-signed URLs: ${presignedResponse.status} ${presignedResponse.statusText}`);
67
73
  return null;
68
74
  }
69
- const result = await response.json();
70
- if (result.error) {
71
- console.warn("Video upload error:", result.error.message);
75
+ const presignedResult = await presignedResponse.json();
76
+ if (presignedResult.error) {
77
+ console.warn("Pre-signed URL error:", presignedResult.error.message);
72
78
  return null;
73
79
  }
80
+ // Step 2: Upload files directly to R2 using pre-signed URLs
81
+ const uploadPromises = presignedResult.data.presigned_urls.map(async (urlInfo) => {
82
+ const videoPath = videoPaths.find((p) => path_1.default.basename(p) === urlInfo.file_name);
83
+ if (!videoPath || !fs_1.default.existsSync(videoPath)) {
84
+ throw new Error(`Video file not found: ${urlInfo.file_name}`);
85
+ }
86
+ const fileBuffer = fs_1.default.readFileSync(videoPath);
87
+ const uploadResponse = await fetch(urlInfo.upload_url, {
88
+ method: "PUT",
89
+ body: fileBuffer,
90
+ headers: {
91
+ "Content-Type": "video/webm",
92
+ },
93
+ });
94
+ if (!uploadResponse.ok) {
95
+ throw new Error(`Failed to upload ${urlInfo.file_name}: ${uploadResponse.status} ${uploadResponse.statusText}`);
96
+ }
97
+ return urlInfo.key;
98
+ });
99
+ await Promise.all(uploadPromises);
74
100
  return videoPaths.map((p) => buildVideoUrl(p, uploadDestinationDir, bucket));
75
101
  }
76
102
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.69.1",
3
+ "version": "0.69.2",
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.0",
67
+ "@empiricalrun/llm": "^0.19.1",
68
68
  "@empiricalrun/r2-uploader": "^0.3.9",
69
69
  "@empiricalrun/test-run": "^0.10.5"
70
70
  },