@empiricalrun/test-gen 0.61.0 → 0.63.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 (98) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/agent/browsing/run.d.ts +2 -0
  3. package/dist/agent/browsing/run.d.ts.map +1 -1
  4. package/dist/agent/browsing/run.js +11 -8
  5. package/dist/agent/browsing/utils.d.ts.map +1 -1
  6. package/dist/agent/browsing/utils.js +1 -1
  7. package/dist/agent/chat/agent-loop.js +2 -3
  8. package/dist/agent/chat/exports.d.ts +2 -2
  9. package/dist/agent/chat/exports.d.ts.map +1 -1
  10. package/dist/agent/chat/exports.js +1 -1
  11. package/dist/agent/chat/index.d.ts.map +1 -1
  12. package/dist/agent/chat/index.js +24 -4
  13. package/dist/agent/chat/models.d.ts +1 -3
  14. package/dist/agent/chat/models.d.ts.map +1 -1
  15. package/dist/agent/chat/models.js +4 -25
  16. package/dist/agent/cua/computer.d.ts +6 -6
  17. package/dist/agent/cua/computer.d.ts.map +1 -1
  18. package/dist/agent/cua/computer.js +38 -83
  19. package/dist/agent/cua/index.d.ts +2 -1
  20. package/dist/agent/cua/index.d.ts.map +1 -1
  21. package/dist/agent/cua/index.js +26 -33
  22. package/dist/agent/cua/pw-codegen/element-from-point.d.ts +8 -0
  23. package/dist/agent/cua/pw-codegen/element-from-point.d.ts.map +1 -0
  24. package/dist/agent/cua/pw-codegen/element-from-point.js +118 -0
  25. package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts +15 -0
  26. package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -0
  27. package/dist/agent/cua/pw-codegen/pw-pause/index.js +84 -0
  28. package/dist/agent/cua/pw-codegen/pw-pause/utils.d.ts +16 -0
  29. package/dist/agent/cua/pw-codegen/pw-pause/utils.d.ts.map +1 -0
  30. package/dist/agent/cua/pw-codegen/pw-pause/utils.js +98 -0
  31. package/dist/agent/cua/pw-codegen/types.d.ts +46 -0
  32. package/dist/agent/cua/pw-codegen/types.d.ts.map +1 -0
  33. package/dist/agent/cua/pw-codegen/types.js +2 -0
  34. package/dist/agent/master/browser-tests/cua.spec.js +13 -1
  35. package/dist/artifacts/index.d.ts +52 -0
  36. package/dist/artifacts/index.d.ts.map +1 -0
  37. package/dist/artifacts/index.js +237 -0
  38. package/dist/bin/index.js +7 -11
  39. package/dist/bin/utils/index.d.ts +5 -3
  40. package/dist/bin/utils/index.d.ts.map +1 -1
  41. package/dist/bin/utils/index.js +13 -0
  42. package/dist/bin/utils/platform/web/index.d.ts +1 -1
  43. package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
  44. package/dist/bin/utils/platform/web/index.js +3 -2
  45. package/dist/bin/utils/scenarios/index.d.ts +3 -3
  46. package/dist/file/client.d.ts +2 -0
  47. package/dist/file/client.d.ts.map +1 -1
  48. package/dist/file/client.js +16 -0
  49. package/dist/file/server.d.ts +3 -1
  50. package/dist/file/server.d.ts.map +1 -1
  51. package/dist/file/server.js +27 -3
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +4 -1
  54. package/dist/test-build/index.d.ts +6 -2
  55. package/dist/test-build/index.d.ts.map +1 -1
  56. package/dist/test-build/index.js +9 -7
  57. package/dist/tool-call-service/index.d.ts +14 -7
  58. package/dist/tool-call-service/index.d.ts.map +1 -1
  59. package/dist/tool-call-service/index.js +36 -10
  60. package/dist/tools/commit-and-create-pr.d.ts.map +1 -1
  61. package/dist/tools/commit-and-create-pr.js +11 -4
  62. package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
  63. package/dist/tools/diagnosis-fetcher.js +4 -3
  64. package/dist/tools/download-build.d.ts.map +1 -1
  65. package/dist/tools/download-build.js +3 -3
  66. package/dist/tools/environment-crud.d.ts.map +1 -1
  67. package/dist/tools/environment-crud.js +6 -4
  68. package/dist/tools/grep/index.d.ts.map +1 -1
  69. package/dist/tools/grep/index.js +13 -11
  70. package/dist/tools/str_replace_editor.d.ts +1 -1
  71. package/dist/tools/str_replace_editor.d.ts.map +1 -1
  72. package/dist/tools/str_replace_editor.js +38 -28
  73. package/dist/tools/test-gen-browser.d.ts.map +1 -1
  74. package/dist/tools/test-gen-browser.js +18 -4
  75. package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
  76. package/dist/tools/test-run-fetcher/index.js +2 -1
  77. package/dist/tools/test-run.d.ts.map +1 -1
  78. package/dist/tools/test-run.js +10 -8
  79. package/dist/tools/utils/index.d.ts +17 -2
  80. package/dist/tools/utils/index.d.ts.map +1 -1
  81. package/dist/tools/utils/index.js +51 -7
  82. package/dist/utils/checkpoint.d.ts +5 -1
  83. package/dist/utils/checkpoint.d.ts.map +1 -1
  84. package/dist/utils/checkpoint.js +8 -3
  85. package/dist/utils/exec.d.ts +2 -0
  86. package/dist/utils/exec.d.ts.map +1 -1
  87. package/dist/utils/exec.js +4 -1
  88. package/dist/utils/git.d.ts +12 -7
  89. package/dist/utils/git.d.ts.map +1 -1
  90. package/dist/utils/git.js +27 -17
  91. package/dist/utils/slug.d.ts +16 -0
  92. package/dist/utils/slug.d.ts.map +1 -1
  93. package/dist/utils/slug.js +27 -1
  94. package/package.json +6 -4
  95. package/tsconfig.tsbuildinfo +1 -1
  96. package/dist/utils/pw-test.d.ts +0 -2
  97. package/dist/utils/pw-test.d.ts.map +0 -1
  98. package/dist/utils/pw-test.js +0 -13
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UploadArtifactsQueue = void 0;
7
+ exports.isArtifactCollectionEnabled = isArtifactCollectionEnabled;
8
+ exports.collectArtifacts = collectArtifacts;
9
+ const r2_uploader_1 = require("@empiricalrun/r2-uploader");
10
+ const mime_1 = __importDefault(require("mime"));
11
+ const path_1 = __importDefault(require("path"));
12
+ const slug_1 = require("../utils/slug");
13
+ function isArtifactInputData(artifact) {
14
+ return "data" in artifact;
15
+ }
16
+ function isArtifactInputPath(artifact) {
17
+ return "path" in artifact;
18
+ }
19
+ function isArtifactCollectionEnabled() {
20
+ return (process.env.R2_ACCOUNT_ID &&
21
+ process.env.R2_ACCESS_KEY_ID &&
22
+ process.env.R2_SECRET_ACCESS_KEY);
23
+ }
24
+ const UPLOAD_BUCKET = "test-report";
25
+ async function collectInMemoryArtifacts(artifacts, { destinationDir, }) {
26
+ const dataFiles = artifacts.reduce((acc, a) => {
27
+ if (!Buffer.isBuffer(a.data)) {
28
+ console.error("Invalid buffer data:", {
29
+ fileName: a.fileName,
30
+ contentType: a.contentType,
31
+ dataType: typeof a.data,
32
+ data: a.data,
33
+ });
34
+ return acc;
35
+ }
36
+ return [
37
+ ...acc,
38
+ {
39
+ buffer: a.data,
40
+ fileName: a.fileName,
41
+ mimeType: a.contentType,
42
+ },
43
+ ];
44
+ }, []);
45
+ console.log(`Starting upload of ${dataFiles.length} in-memory files`);
46
+ return (0, r2_uploader_1.uploadInMemoryFiles)({
47
+ files: dataFiles,
48
+ destinationDir,
49
+ uploadBucket: UPLOAD_BUCKET,
50
+ accountId: process.env.R2_ACCOUNT_ID,
51
+ accessKeyId: process.env.R2_ACCESS_KEY_ID,
52
+ secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,
53
+ }).catch((error) => {
54
+ console.error("Failed to upload in-memory files:", {
55
+ error,
56
+ files: dataFiles.map((f) => ({
57
+ name: f.fileName,
58
+ type: f.mimeType,
59
+ })),
60
+ });
61
+ throw error;
62
+ });
63
+ }
64
+ async function collectFilePathArtifacts(artifacts, { destinationDir, sourceDir, }) {
65
+ const filePaths = artifacts.map((artifact) => artifact.path);
66
+ console.log(`Starting upload of ${filePaths.length} path-based artifacts`);
67
+ const urls = await (0, r2_uploader_1.uploadDirectory)({
68
+ fileList: filePaths,
69
+ sourceDir,
70
+ destinationDir,
71
+ uploadBucket: UPLOAD_BUCKET,
72
+ accountId: process.env.R2_ACCOUNT_ID,
73
+ accessKeyId: process.env.R2_ACCESS_KEY_ID,
74
+ secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,
75
+ }).catch((error) => {
76
+ console.error("Failed to upload path-based files:", {
77
+ error,
78
+ files: filePaths,
79
+ sourceDir,
80
+ destinationDir,
81
+ bucket: UPLOAD_BUCKET,
82
+ });
83
+ throw error;
84
+ });
85
+ console.log("Uploaded path-based files:", urls);
86
+ return urls;
87
+ }
88
+ /**
89
+ * Checks if a given path is a full (absolute) path that starts with the repository directory.
90
+ *
91
+ * @example
92
+ * // Valid full path
93
+ * const repoDir = "/Users/aashishwork/flash-tests";
94
+ * const path1 = "/Users/aashishwork/flash-tests/src/test.spec.ts";
95
+ * isFullPath(path1, repoDir); // Returns true
96
+ *
97
+ * @example
98
+ * // Invalid - relative path
99
+ * const path2 = "src/test.spec.ts";
100
+ * isFullPath(path2, repoDir); // Returns false
101
+ *
102
+ * @example
103
+ * // Invalid - absolute path but outside repo
104
+ * const path3 = "/Users/otheruser/project/test.spec.ts";
105
+ * isFullPath(path3, repoDir); // Returns false
106
+ *
107
+ * @example
108
+ * // Valid full path with trailing slash
109
+ * const path4 = "/Users/aashishwork/flash-tests/";
110
+ * isFullPath(path4, repoDir); // Returns true
111
+ */
112
+ function isFullPath(path, repoDir) {
113
+ return path.startsWith("/") && path.startsWith(repoDir);
114
+ }
115
+ /**
116
+ * Collects artifacts from the repository directory and returns their URLs.
117
+ *
118
+ * @param inputs - An array of artifact inputs.
119
+ * @param repoDir - The absolute path to the repository directory.
120
+ * @param toolCallId - Unique identifier for the tool call.
121
+ * @returns An array of artifacts with their URLs.
122
+ *
123
+ * @example
124
+ * // Collect artifacts from both file paths and in-memory data
125
+ * const artifacts = await collectArtifacts([
126
+ * {
127
+ * name: "screenshot.png",
128
+ * contentType: "image/png",
129
+ * path: "/Users/project/screenshots/test.png"
130
+ * },
131
+ * {
132
+ * name: "log.txt",
133
+ * contentType: "text/plain",
134
+ * data: Buffer.from("test log content")
135
+ * }
136
+ * ], "/Users/project", "tool-123");
137
+ *
138
+ * @example
139
+ * // Returns empty array when artifact collection is disabled
140
+ * const artifacts = await collectArtifacts([], "/Users/project", "tool-123");
141
+ * // Returns: []
142
+ *
143
+ * @example
144
+ * // Throws error for invalid file paths
145
+ * await collectArtifacts([
146
+ * {
147
+ * name: "test.png",
148
+ * contentType: "image/png",
149
+ * path: "relative/path/test.png" // Invalid - not absolute path
150
+ * }
151
+ * ], "/Users/project", "tool-123");
152
+ * // Throws: "Invalid path: relative/path/test.png..."
153
+ */
154
+ async function collectArtifacts(inputs, repoDir, toolCallId) {
155
+ if (!isArtifactCollectionEnabled())
156
+ return [];
157
+ const destinationDir = path_1.default.join("artifacts", toolCallId);
158
+ if (inputs.length === 0)
159
+ return [];
160
+ const dataArtifacts = inputs.filter(isArtifactInputData);
161
+ const pathArtifacts = inputs.filter(isArtifactInputPath);
162
+ for (const artifact of pathArtifacts) {
163
+ if (!isFullPath(artifact.path, repoDir)) {
164
+ throw new Error(`Invalid path: "${artifact.path}". Path should be a full path relative to the repo directory: "${repoDir}"`);
165
+ }
166
+ }
167
+ try {
168
+ const dirs = { destinationDir, sourceDir: repoDir };
169
+ const dataArtifactsWithFileName = dataArtifacts.map((a) => {
170
+ const fileExt = mime_1.default.getExtension(a.contentType);
171
+ const fileName = `${(0, slug_1.slugify)(a.name)}-${Date.now().toString()}.${fileExt}`;
172
+ return { ...a, fileName };
173
+ });
174
+ await Promise.all([
175
+ collectInMemoryArtifacts(dataArtifactsWithFileName, dirs),
176
+ collectFilePathArtifacts(pathArtifacts, dirs),
177
+ ]);
178
+ const inputsWithFileNames = [
179
+ ...pathArtifacts,
180
+ ...dataArtifactsWithFileName,
181
+ ];
182
+ const results = inputsWithFileNames.map((artifact) => {
183
+ const isPathArtifact = isArtifactInputPath(artifact);
184
+ const relativePath = isPathArtifact
185
+ ? path_1.default.relative(repoDir, artifact.path)
186
+ : artifact.fileName;
187
+ const pathInBucket = path_1.default.join(destinationDir, relativePath);
188
+ const url = `https://reports.empirical.run/${pathInBucket}`;
189
+ return {
190
+ name: artifact.name,
191
+ contentType: artifact.contentType,
192
+ url,
193
+ };
194
+ });
195
+ return results;
196
+ }
197
+ catch (error) {
198
+ console.error("Error in collectArtifacts:", {
199
+ error,
200
+ errorMessage: error instanceof Error ? error.message : String(error),
201
+ artifacts: inputs.map((a) => ({
202
+ name: a.name,
203
+ type: a.contentType,
204
+ hasData: isArtifactInputData(a),
205
+ hasPath: isArtifactInputPath(a),
206
+ })),
207
+ });
208
+ return [];
209
+ }
210
+ }
211
+ class UploadArtifactsQueue {
212
+ toolCallId;
213
+ baseRepoPath;
214
+ artifactResults = [];
215
+ uploadPromise = null;
216
+ constructor(baseRepoPath, toolCallId) {
217
+ this.baseRepoPath = baseRepoPath;
218
+ this.toolCallId = toolCallId;
219
+ }
220
+ async addTask(artifacts) {
221
+ this.uploadPromise = collectArtifacts(artifacts, this.baseRepoPath, this.toolCallId)
222
+ .then((results) => {
223
+ this.artifactResults.push(...results);
224
+ })
225
+ .catch((error) => {
226
+ console.error("Error processing artifact upload task:", error);
227
+ throw error;
228
+ });
229
+ }
230
+ async waitForCompletion() {
231
+ if (this.uploadPromise) {
232
+ await this.uploadPromise;
233
+ }
234
+ return this.artifactResults;
235
+ }
236
+ }
237
+ exports.UploadArtifactsQueue = UploadArtifactsQueue;
package/dist/bin/index.js CHANGED
@@ -36,19 +36,11 @@ function setupProcessListeners(cleanup) {
36
36
  };
37
37
  }
38
38
  async function runChatAgent({ modelInput, chatSessionId, useDiskForChatState, initialPromptPath, withRetry, }) {
39
- const MODEL_MAPPING = {
40
- "claude-3-7": "claude-3-7-sonnet-20250219",
41
- "claude-3-5": "claude-3-5-sonnet-20241022",
42
- "gemini-2.5-pro-preview-03-25": "gemini-2.5-pro-preview-03-25",
43
- "gemini-2.5-pro": "gemini-2.5-pro-preview-03-25",
44
- "o4-mini": "o4-mini-2025-04-16",
45
- "o4-mini-2025-04-16": "o4-mini-2025-04-16",
46
- };
47
- if (modelInput && !MODEL_MAPPING[modelInput]) {
39
+ if (modelInput && !utils_2.ARGS_TO_MODEL_MAP[modelInput]) {
48
40
  throw new Error(`Invalid chat model: ${modelInput}`);
49
41
  }
50
42
  const defaultModel = "claude-3-7-sonnet-20250219";
51
- const specifiedModel = modelInput && MODEL_MAPPING[modelInput];
43
+ const specifiedModel = modelInput && utils_2.ARGS_TO_MODEL_MAP[modelInput];
52
44
  if (chatSessionId) {
53
45
  // If --chat-session-id is provided, we run the chat agent for the dashboard
54
46
  // and not CLI (where user can input their own prompt)
@@ -244,7 +236,11 @@ async function main() {
244
236
  });
245
237
  if (testGenConfig.build?.url) {
246
238
  // Download the build if repo has a download script
247
- await (0, test_build_1.downloadBuild)(testGenConfig.build.url);
239
+ await (0, test_build_1.downloadBuild)({
240
+ buildUrl: testGenConfig.build.url,
241
+ repoPath: process.cwd(),
242
+ apiKey: process.env.EMPIRICALRUN_API_KEY,
243
+ });
248
244
  }
249
245
  if (completedOptions.useChat) {
250
246
  await runChatAgent({
@@ -1,4 +1,6 @@
1
- export interface CliOptions {
1
+ import { SupportedChatModels } from "@empiricalrun/llm/chat";
2
+ export declare const ARGS_TO_MODEL_MAP: Record<string, SupportedChatModels>;
3
+ export interface CLIOptions {
2
4
  token?: string;
3
5
  name?: string;
4
6
  file?: string;
@@ -8,9 +10,9 @@ export interface CliOptions {
8
10
  useDiskForChatState?: boolean;
9
11
  initialPrompt?: string;
10
12
  chatSessionId?: string;
11
- chatModel?: "claude-3-7" | "claude-3-5" | "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-20241022" | "gemini-2.5-pro" | "gemini-2.5-pro-preview-03-25" | "o4-mini" | "o4-mini-2025-04-16";
13
+ chatModel?: (typeof ARGS_TO_MODEL_MAP)[keyof typeof ARGS_TO_MODEL_MAP];
12
14
  withRetry?: boolean;
13
15
  }
14
- export declare function validateAndCompleteCliOptions(options: CliOptions): Promise<CliOptions>;
16
+ export declare function validateAndCompleteCliOptions(options: CLIOptions): Promise<CLIOptions>;
15
17
  export declare function printBanner(): void;
16
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAEA,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,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EACN,YAAY,GACZ,YAAY,GACZ,4BAA4B,GAC5B,4BAA4B,GAC5B,gBAAgB,GAChB,8BAA8B,GAC9B,SAAS,GACT,oBAAoB,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAyDrB;AAED,wBAAgB,WAAW,SAgC1B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAajE,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,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;IACvE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAyDrB;AAED,wBAAgB,WAAW,SAgC1B"}
@@ -3,9 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ARGS_TO_MODEL_MAP = void 0;
6
7
  exports.validateAndCompleteCliOptions = validateAndCompleteCliOptions;
7
8
  exports.printBanner = printBanner;
8
9
  const inquirer_1 = __importDefault(require("inquirer"));
10
+ exports.ARGS_TO_MODEL_MAP = {
11
+ "claude-3-5": "claude-3-5-sonnet-20241022",
12
+ "claude-3-7": "claude-3-7-sonnet-20250219",
13
+ "claude-4": "claude-sonnet-4-20250514",
14
+ "claude-sonnet-4": "claude-sonnet-4-20250514",
15
+ "claude-opus-4": "claude-opus-4-20250514",
16
+ "gemini-2.5": "gemini-2.5-pro-preview-03-25",
17
+ "gemini-2.5-pro": "gemini-2.5-pro-preview-03-25",
18
+ "gemini-2.5-pro-preview-03-25": "gemini-2.5-pro-preview-03-25",
19
+ "o4-mini": "o4-mini-2025-04-16",
20
+ "o4-mini-2025-04-16": "o4-mini-2025-04-16",
21
+ };
9
22
  async function validateAndCompleteCliOptions(options) {
10
23
  // For existing flow between dashboard <> test-gen (via ci-worker)
11
24
  const hasToken = !!options.token;
@@ -49,7 +49,7 @@ export declare function hasTopLevelDescribeConfigureWithSerialMode(filePath: str
49
49
  */
50
50
  export declare function findFirstSerialDescribeBlock(node: Node | undefined): Node | undefined;
51
51
  export declare function appendToTestBlock(testBlock: string, content: string): string;
52
- export declare function runTypescriptCompiler(): Promise<{
52
+ export declare function runTypescriptCompiler(repoDir: string): Promise<{
53
53
  success: boolean;
54
54
  errors: string[];
55
55
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAM3D,OAAO,EAGL,IAAI,EAEJ,UAAU,EAEX,MAAM,UAAU,CAAC;AAMlB,eAAO,MAAM,gCAAgC,GAC3C,YAAY,UAAU,KACrB,MAgBF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,MAAM,EACN,OAAO,GACR,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG;IACF,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB,CA2CA;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,UAAU,EACV,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB,WAUA;AAwBD,wBAAsB,0CAA0C,CAC9D,QAAQ,EAAE,MAAM,oBA+BjB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,IAAI,GAAG,SAAS,CA4BlB;AAED,wBAAgB,i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AM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,WA0DA,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAC5C,SAAS,MAAM,EACf,WAAW,MAAM,EAAE,EACnB,cAAc,MAAM,sBAyBrB,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,EAC1C,YAAY,EACZ,QAAQ,EACR,MAAM,GACP,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,iBAgDA;AAED,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EAAE,iBAsBzB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;CACpB,WAYA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,MAAM,GACP,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,UAOA;AAED,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CA4B5E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQnD"}
@@ -202,9 +202,10 @@ function appendToTestBlock(testBlock, content) {
202
202
  const updateTestBlock = testBlock.replace(/\}\)$/, `\n\n${content}\n\n })`);
203
203
  return updateTestBlock;
204
204
  }
205
- async function runTypescriptCompiler() {
205
+ async function runTypescriptCompiler(repoDir) {
206
206
  let { code, output } = await (0, test_run_1.spawnCmd)("npx", ["tsc", "--noEmit", "--pretty"], {
207
- env: {},
207
+ cwd: repoDir,
208
+ envOverrides: {},
208
209
  captureOutput: true,
209
210
  throwOnError: false,
210
211
  });
@@ -1,8 +1,8 @@
1
1
  import type { TestGenConfig } from "@empiricalrun/shared-types";
2
- import { CliOptions } from "../index";
3
- export declare function buildTokenFromOptions(options: Omit<CliOptions, "token">, featureFlags?: {
2
+ import { CLIOptions } from "../index";
3
+ export declare function buildTokenFromOptions(options: Omit<CLIOptions, "token">, featureFlags?: {
4
4
  useComputerUseAgent?: boolean;
5
5
  }): string;
6
- export declare function buildTestConfigFromOptions(options: Omit<CliOptions, "token">): TestGenConfig;
6
+ export declare function buildTestConfigFromOptions(options: Omit<CLIOptions, "token">): TestGenConfig;
7
7
  export declare function loadTestConfigs(testGenToken: string): TestGenConfig;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { ArtifactInput } from "@empiricalrun/shared-types";
1
2
  declare class FileServiceClient {
2
3
  baseUrl: string;
3
4
  port: number | undefined;
@@ -10,6 +11,7 @@ declare class FileServiceClient {
10
11
  actionsSummary?: string;
11
12
  }): Promise<any>;
12
13
  post(path: string, body: any): Promise<any>;
14
+ sendArtifactInputsToServer(artifacts: ArtifactInput[]): Promise<any>;
13
15
  }
14
16
  export default FileServiceClient;
15
17
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/file/client.ts"],"names":[],"mappings":"AAAA,cAAM,iBAAiB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;;IAUzB,MAAM,CAAC,WAAW;IAIZ,UAAU,CAAC,EACf,aAAa,EACb,IAAI,EACJ,WAAW,EACX,cAAc,GACf,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB;IASK,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;CAgBnC;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/file/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,cAAM,iBAAiB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;;IAUzB,MAAM,CAAC,WAAW;IAIZ,UAAU,CAAC,EACf,aAAa,EACb,IAAI,EACJ,WAAW,EACX,cAAc,GACf,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB;IASK,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;IAiB5B,0BAA0B,CAAC,SAAS,EAAE,aAAa,EAAE;CAgB5D;AAED,eAAe,iBAAiB,CAAC"}
@@ -37,5 +37,21 @@ class FileServiceClient {
37
37
  return data;
38
38
  }
39
39
  }
40
+ async sendArtifactInputsToServer(artifacts) {
41
+ const resp = await fetch(`${this.baseUrl}/artifact`, {
42
+ method: "POST",
43
+ headers: {
44
+ "Content-Type": "application/json",
45
+ },
46
+ body: JSON.stringify(artifacts),
47
+ });
48
+ if (!resp.ok) {
49
+ throw new Error(`API failed with status ${resp.statusText}`);
50
+ }
51
+ else {
52
+ const data = await resp.json();
53
+ return data;
54
+ }
55
+ }
40
56
  }
41
57
  exports.default = FileServiceClient;
@@ -1,3 +1,4 @@
1
+ import { ArtifactInput } from "@empiricalrun/shared-types";
1
2
  export declare class FileServiceServer {
2
3
  private port;
3
4
  private filePath;
@@ -6,6 +7,7 @@ export declare class FileServiceServer {
6
7
  private actionsSummary;
7
8
  private updateFile;
8
9
  private onComplete?;
10
+ private artifactsInputs;
9
11
  constructor({ port, repoDir, updateFile, onComplete, }: {
10
12
  port: number;
11
13
  repoDir: string;
@@ -13,9 +15,9 @@ export declare class FileServiceServer {
13
15
  onComplete?: () => void;
14
16
  });
15
17
  getActionsSummary(): string | undefined;
18
+ getArtifactInputsFromServer(): ArtifactInput[];
16
19
  setFilePath(filePath: string): void;
17
20
  startFileService(): Promise<number>;
18
21
  stop(): Promise<void>;
19
22
  }
20
- export declare function startFileService(): Promise<void>;
21
23
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/file/server.ts"],"names":[],"mappings":"AAWA,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAC,CAAa;gBAEpB,EACV,IAAI,EACJ,OAAO,EACP,UAAU,EACV,UAAU,GACX,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;KACzB;IAOD,iBAAiB;IAIjB,WAAW,CAAC,QAAQ,EAAE,MAAM;IAItB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAmDnC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB5B;AAED,wBAAsB,gBAAgB,kBAAK"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/file/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAY3D,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAC,CAAa;IAChC,OAAO,CAAC,eAAe,CAAuB;gBAClC,EACV,IAAI,EACJ,OAAO,EACP,UAAU,EACV,UAAU,GACX,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;KACzB;IAOD,iBAAiB;IAIjB,2BAA2B;IAI3B,WAAW,CAAC,QAAQ,EAAE,MAAM;IAItB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IA4EnC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB5B"}
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FileServiceServer = void 0;
7
- exports.startFileService = startFileService;
8
7
  const express_1 = __importDefault(require("express"));
9
8
  const fs_1 = __importDefault(require("fs"));
10
9
  const path_1 = __importDefault(require("path"));
@@ -18,6 +17,7 @@ class FileServiceServer {
18
17
  actionsSummary;
19
18
  updateFile = false;
20
19
  onComplete;
20
+ artifactsInputs = [];
21
21
  constructor({ port, repoDir, updateFile, onComplete, }) {
22
22
  this.port = port;
23
23
  this.repoDir = repoDir;
@@ -27,12 +27,15 @@ class FileServiceServer {
27
27
  getActionsSummary() {
28
28
  return this.actionsSummary;
29
29
  }
30
+ getArtifactInputsFromServer() {
31
+ return this.artifactsInputs;
32
+ }
30
33
  setFilePath(filePath) {
31
34
  this.filePath = filePath;
32
35
  }
33
36
  async startFileService() {
34
37
  const app = (0, express_1.default)();
35
- app.use(express_1.default.json());
38
+ app.use(express_1.default.json({ limit: "50mb" }));
36
39
  (0, ipc_1.humanLoopRoute)(app);
37
40
  app.post("/test", async (req, res) => {
38
41
  const { generatedCode, importPaths, actionsSummary } = req.body;
@@ -61,6 +64,28 @@ class FileServiceServer {
61
64
  }
62
65
  return res.send({ success: false });
63
66
  });
67
+ app.post("/artifact", async (req, res) => {
68
+ const artifactInputs = Array.isArray(req.body) ? req.body : [req.body];
69
+ for (const artifactInput of artifactInputs) {
70
+ const { name, contentType, data } = artifactInput;
71
+ if (!data) {
72
+ console.error("No data in artifact", artifactInput);
73
+ continue;
74
+ }
75
+ // Passing buffer data to the server
76
+ // Serialises the buffer data to an obbject
77
+ // Which needs to be converted back to a buffer
78
+ const bufferData = Buffer.isBuffer(data)
79
+ ? data
80
+ : Buffer.from(data.data);
81
+ this.artifactsInputs.push({
82
+ name,
83
+ contentType,
84
+ data: bufferData,
85
+ });
86
+ }
87
+ return res.send({ success: true });
88
+ });
64
89
  return new Promise((resolve) => {
65
90
  this.server = app.listen(this.port, () => resolve(this.port));
66
91
  });
@@ -83,4 +108,3 @@ class FileServiceServer {
83
108
  }
84
109
  }
85
110
  exports.FileServiceServer = FileServiceServer;
86
- async function startFileService() { }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAQhD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAoB7C,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,IAAI,GAAG,YAAY,EAC5B,KAAK,CAAC,EAAE,SAAS,iBA0ElB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAQhD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAqB7C,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,IAAI,GAAG,YAAY,EAC5B,KAAK,CAAC,EAAE,SAAS,iBA+ElB"}
package/dist/index.js CHANGED
@@ -78,7 +78,10 @@ async function createTest(task, pageRef, scope) {
78
78
  scopeVars: scope,
79
79
  });
80
80
  }
81
- const { code, importPaths, actionsSummary } = agentResult;
81
+ const { code, importPaths, actionsSummary, artifacts } = agentResult;
82
+ if (artifacts && artifacts.length > 0) {
83
+ await fileServiceClient.sendArtifactInputsToServer(artifacts);
84
+ }
82
85
  await fileServiceClient.updateTest({
83
86
  task,
84
87
  generatedCode: code,
@@ -1,3 +1,7 @@
1
- export declare function hasDownloadScript(): Promise<boolean>;
2
- export declare function downloadBuild(buildUrl: string): Promise<void>;
1
+ export declare function hasDownloadScript(repoPath: string): Promise<boolean>;
2
+ export declare function downloadBuild({ buildUrl, repoPath, apiKey, }: {
3
+ buildUrl: string;
4
+ repoPath: string;
5
+ apiKey: string | undefined;
6
+ }): Promise<void>;
3
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-build/index.ts"],"names":[],"mappings":"AAeA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAG1D;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-build/index.ts"],"names":[],"mappings":"AAgBA,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG1E;AAED,wBAAsB,aAAa,CAAC,EAClC,QAAQ,EACR,QAAQ,EACR,MAAM,GACP,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhB"}
@@ -6,25 +6,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.hasDownloadScript = hasDownloadScript;
7
7
  exports.downloadBuild = downloadBuild;
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
9
10
  const logger_1 = require("../bin/logger");
10
11
  const exec_1 = require("../utils/exec");
11
- async function getPackageJSON() {
12
- const packageJSONPath = "package.json";
12
+ async function getPackageJSON(repoPath) {
13
+ const packageJSONPath = path_1.default.join(repoPath, "package.json");
13
14
  const packageJsonStr = fs_1.default.readFileSync(packageJSONPath, "utf-8");
14
15
  return JSON.parse(packageJsonStr);
15
16
  }
16
- async function hasDownloadScript() {
17
- const packageJSON = await getPackageJSON();
17
+ async function hasDownloadScript(repoPath) {
18
+ const packageJSON = await getPackageJSON(repoPath);
18
19
  return !!packageJSON.scripts["download"];
19
20
  }
20
- async function downloadBuild(buildUrl) {
21
+ async function downloadBuild({ buildUrl, repoPath, apiKey, }) {
21
22
  const logger = new logger_1.CustomLogger({ useReporter: false });
22
- const packageJSON = await getPackageJSON();
23
+ const packageJSON = await getPackageJSON(repoPath);
23
24
  const buildDownloadScript = packageJSON.scripts["download"];
24
25
  if (buildDownloadScript && buildUrl) {
25
26
  logger.log(`Downloading build from ${buildUrl}`);
26
27
  await (0, exec_1.cmd)(`npm`, ["run", "download", buildUrl], {
27
- env: { ...Object(process.env) },
28
+ cwd: repoPath,
29
+ env: { ...Object(process.env), EMPIRICALRUN_API_KEY: apiKey },
28
30
  });
29
31
  }
30
32
  }
@@ -1,8 +1,8 @@
1
1
  import { TraceClient } from "@empiricalrun/llm";
2
- import { PendingToolCall, SupportedChatModels, Tool, ToolResult } from "@empiricalrun/llm/chat";
2
+ import { PendingToolCall, SupportedChatModels, Tool, ToolExecute, ToolResult } from "@empiricalrun/llm/chat";
3
3
  export type { SupportedChatModels };
4
4
  type ToolExecutors = {
5
- [key: string]: (input: any, trace?: TraceClient) => Promise<ToolResult>;
5
+ [key: string]: ToolExecute;
6
6
  };
7
7
  export declare class ToolCallService {
8
8
  tools: Tool[];
@@ -10,11 +10,18 @@ export declare class ToolCallService {
10
10
  chatSessionId: number | null;
11
11
  selectedModel: SupportedChatModels;
12
12
  branchName: string;
13
- constructor(chatSessionId: number | null, selectedModel: SupportedChatModels, branchName: string);
14
- getTools(): Promise<{
15
- tools: Tool[];
16
- }>;
13
+ repoPath: string;
14
+ apiKey: string | undefined;
15
+ trace?: TraceClient;
16
+ constructor({ chatSessionId, selectedModel, branchName, repoPath, apiKey, trace, }: {
17
+ chatSessionId: number | null;
18
+ selectedModel: SupportedChatModels;
19
+ branchName: string;
20
+ repoPath: string;
21
+ apiKey: string | undefined;
22
+ trace?: TraceClient;
23
+ });
17
24
  sendToQueue(toolCalls: PendingToolCall[]): Promise<void>;
18
- execute(toolCalls: PendingToolCall[], trace?: TraceClient): Promise<ToolResult[]>;
25
+ execute(toolCalls: PendingToolCall[]): Promise<ToolResult[]>;
19
26
  }
20
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tool-call-service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAEL,eAAe,EACf,mBAAmB,EACnB,IAAI,EACJ,UAAU,EACX,MAAM,wBAAwB,CAAC;AAiBhC,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC,KAAK,aAAa,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACzE,CAAC;AAEF,qBAAa,eAAe;IAC1B,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,aAAa,EAAE,aAAa,CAAM;IAClC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAA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