@empiricalrun/test-gen 0.60.0 → 0.62.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.
- package/CHANGELOG.md +52 -0
- package/dist/agent/browsing/run.d.ts +2 -0
- package/dist/agent/browsing/run.d.ts.map +1 -1
- package/dist/agent/browsing/run.js +11 -7
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +1 -1
- package/dist/agent/chat/agent-loop.js +2 -3
- package/dist/agent/chat/exports.d.ts +2 -2
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +1 -1
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +16 -2
- package/dist/agent/chat/models.d.ts +1 -3
- package/dist/agent/chat/models.d.ts.map +1 -1
- package/dist/agent/chat/models.js +4 -25
- package/dist/agent/chat/prompt.d.ts.map +1 -1
- package/dist/agent/chat/prompt.js +58 -0
- package/dist/agent/cua/computer.d.ts +6 -6
- package/dist/agent/cua/computer.d.ts.map +1 -1
- package/dist/agent/cua/computer.js +38 -83
- package/dist/agent/cua/index.d.ts +2 -1
- package/dist/agent/cua/index.d.ts.map +1 -1
- package/dist/agent/cua/index.js +26 -33
- package/dist/agent/cua/pw-codegen/element-from-point.d.ts +8 -0
- package/dist/agent/cua/pw-codegen/element-from-point.d.ts.map +1 -0
- package/dist/agent/cua/pw-codegen/element-from-point.js +118 -0
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts +15 -0
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -0
- package/dist/agent/cua/pw-codegen/pw-pause/index.js +84 -0
- package/dist/agent/cua/pw-codegen/pw-pause/utils.d.ts +16 -0
- package/dist/agent/cua/pw-codegen/pw-pause/utils.d.ts.map +1 -0
- package/dist/agent/cua/pw-codegen/pw-pause/utils.js +98 -0
- package/dist/agent/cua/pw-codegen/types.d.ts +46 -0
- package/dist/agent/cua/pw-codegen/types.d.ts.map +1 -0
- package/dist/agent/cua/pw-codegen/types.js +2 -0
- package/dist/agent/master/browser-tests/cua.spec.js +13 -1
- package/dist/artifacts/index.d.ts +43 -0
- package/dist/artifacts/index.d.ts.map +1 -0
- package/dist/artifacts/index.js +209 -0
- package/dist/bin/index.js +7 -11
- package/dist/bin/utils/index.d.ts +5 -3
- package/dist/bin/utils/index.d.ts.map +1 -1
- package/dist/bin/utils/index.js +13 -0
- package/dist/bin/utils/platform/web/index.d.ts +4 -1
- package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
- package/dist/bin/utils/platform/web/index.js +24 -8
- package/dist/bin/utils/scenarios/index.d.ts +3 -3
- package/dist/file/client.d.ts +2 -0
- package/dist/file/client.d.ts.map +1 -1
- package/dist/file/client.js +16 -0
- package/dist/file/server.d.ts +3 -1
- package/dist/file/server.d.ts.map +1 -1
- package/dist/file/server.js +27 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/test-build/index.d.ts +6 -2
- package/dist/test-build/index.d.ts.map +1 -1
- package/dist/test-build/index.js +9 -7
- package/dist/tool-call-service/index.d.ts +14 -7
- package/dist/tool-call-service/index.d.ts.map +1 -1
- package/dist/tool-call-service/index.js +19 -8
- package/dist/tools/commit-and-create-pr.d.ts.map +1 -1
- package/dist/tools/commit-and-create-pr.js +5 -1
- package/dist/tools/download-build.d.ts.map +1 -1
- package/dist/tools/download-build.js +3 -3
- package/dist/tools/grep/index.d.ts.map +1 -1
- package/dist/tools/grep/index.js +4 -2
- package/dist/tools/str_replace_editor.d.ts.map +1 -1
- package/dist/tools/str_replace_editor.js +25 -8
- package/dist/tools/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/test-gen-browser.js +21 -4
- package/dist/tools/test-run.d.ts.map +1 -1
- package/dist/tools/test-run.js +11 -8
- package/dist/tools/utils/index.d.ts +13 -0
- package/dist/tools/utils/index.d.ts.map +1 -1
- package/dist/tools/utils/index.js +47 -0
- package/dist/utils/exec.d.ts +2 -0
- package/dist/utils/exec.d.ts.map +1 -1
- package/dist/utils/exec.js +4 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +1 -1
- package/dist/utils/slug.d.ts +16 -0
- package/dist/utils/slug.d.ts.map +1 -1
- package/dist/utils/slug.js +27 -1
- package/dist/utils/stripAnsi.d.ts +2 -0
- package/dist/utils/stripAnsi.d.ts.map +1 -0
- package/dist/utils/stripAnsi.js +9 -0
- package/package.json +6 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/pw-test.d.ts +0 -2
- package/dist/utils/pw-test.d.ts.map +0 -1
- package/dist/utils/pw-test.js +0 -13
|
@@ -0,0 +1,209 @@
|
|
|
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.isArtifactCollectionEnabled = isArtifactCollectionEnabled;
|
|
7
|
+
exports.collectArtifacts = collectArtifacts;
|
|
8
|
+
const r2_uploader_1 = require("@empiricalrun/r2-uploader");
|
|
9
|
+
const mime_1 = __importDefault(require("mime"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const slug_1 = require("../utils/slug");
|
|
12
|
+
function isArtifactInputData(artifact) {
|
|
13
|
+
return "data" in artifact;
|
|
14
|
+
}
|
|
15
|
+
function isArtifactInputPath(artifact) {
|
|
16
|
+
return "path" in artifact;
|
|
17
|
+
}
|
|
18
|
+
function isArtifactCollectionEnabled() {
|
|
19
|
+
return (process.env.R2_ACCOUNT_ID &&
|
|
20
|
+
process.env.R2_ACCESS_KEY_ID &&
|
|
21
|
+
process.env.R2_SECRET_ACCESS_KEY);
|
|
22
|
+
}
|
|
23
|
+
const UPLOAD_BUCKET = "test-report";
|
|
24
|
+
async function collectInMemoryArtifacts(artifacts, { destinationDir, }) {
|
|
25
|
+
const dataFiles = artifacts.reduce((acc, a) => {
|
|
26
|
+
if (!Buffer.isBuffer(a.data)) {
|
|
27
|
+
console.error("Invalid buffer data:", {
|
|
28
|
+
fileName: a.fileName,
|
|
29
|
+
contentType: a.contentType,
|
|
30
|
+
dataType: typeof a.data,
|
|
31
|
+
data: a.data,
|
|
32
|
+
});
|
|
33
|
+
return acc;
|
|
34
|
+
}
|
|
35
|
+
return [
|
|
36
|
+
...acc,
|
|
37
|
+
{
|
|
38
|
+
buffer: a.data,
|
|
39
|
+
fileName: a.fileName,
|
|
40
|
+
mimeType: a.contentType,
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
}, []);
|
|
44
|
+
console.log(`Starting upload of ${dataFiles.length} in-memory files`);
|
|
45
|
+
return (0, r2_uploader_1.uploadInMemoryFiles)({
|
|
46
|
+
files: dataFiles,
|
|
47
|
+
destinationDir,
|
|
48
|
+
uploadBucket: UPLOAD_BUCKET,
|
|
49
|
+
accountId: process.env.R2_ACCOUNT_ID,
|
|
50
|
+
accessKeyId: process.env.R2_ACCESS_KEY_ID,
|
|
51
|
+
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,
|
|
52
|
+
}).catch((error) => {
|
|
53
|
+
console.error("Failed to upload in-memory files:", {
|
|
54
|
+
error,
|
|
55
|
+
files: dataFiles.map((f) => ({
|
|
56
|
+
name: f.fileName,
|
|
57
|
+
type: f.mimeType,
|
|
58
|
+
})),
|
|
59
|
+
});
|
|
60
|
+
throw error;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
async function collectFilePathArtifacts(artifacts, { destinationDir, sourceDir, }) {
|
|
64
|
+
const filePaths = artifacts.map((artifact) => artifact.path);
|
|
65
|
+
console.log(`Starting upload of ${filePaths.length} path-based artifacts`);
|
|
66
|
+
const urls = await (0, r2_uploader_1.uploadDirectory)({
|
|
67
|
+
fileList: filePaths,
|
|
68
|
+
sourceDir,
|
|
69
|
+
destinationDir,
|
|
70
|
+
uploadBucket: UPLOAD_BUCKET,
|
|
71
|
+
accountId: process.env.R2_ACCOUNT_ID,
|
|
72
|
+
accessKeyId: process.env.R2_ACCESS_KEY_ID,
|
|
73
|
+
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,
|
|
74
|
+
}).catch((error) => {
|
|
75
|
+
console.error("Failed to upload path-based files:", {
|
|
76
|
+
error,
|
|
77
|
+
files: filePaths,
|
|
78
|
+
sourceDir,
|
|
79
|
+
destinationDir,
|
|
80
|
+
bucket: UPLOAD_BUCKET,
|
|
81
|
+
});
|
|
82
|
+
throw error;
|
|
83
|
+
});
|
|
84
|
+
console.log("Uploaded path-based files:", urls);
|
|
85
|
+
return urls;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Checks if a given path is a full (absolute) path that starts with the repository directory.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* // Valid full path
|
|
92
|
+
* const repoDir = "/Users/aashishwork/flash-tests";
|
|
93
|
+
* const path1 = "/Users/aashishwork/flash-tests/src/test.spec.ts";
|
|
94
|
+
* isFullPath(path1, repoDir); // Returns true
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Invalid - relative path
|
|
98
|
+
* const path2 = "src/test.spec.ts";
|
|
99
|
+
* isFullPath(path2, repoDir); // Returns false
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* // Invalid - absolute path but outside repo
|
|
103
|
+
* const path3 = "/Users/otheruser/project/test.spec.ts";
|
|
104
|
+
* isFullPath(path3, repoDir); // Returns false
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* // Valid full path with trailing slash
|
|
108
|
+
* const path4 = "/Users/aashishwork/flash-tests/";
|
|
109
|
+
* isFullPath(path4, repoDir); // Returns true
|
|
110
|
+
*/
|
|
111
|
+
function isFullPath(path, repoDir) {
|
|
112
|
+
return path.startsWith("/") && path.startsWith(repoDir);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Collects artifacts from the repository directory and returns their URLs.
|
|
116
|
+
*
|
|
117
|
+
* @param inputs - An array of artifact inputs.
|
|
118
|
+
* @param repoDir - The absolute path to the repository directory.
|
|
119
|
+
* @param toolCallId - Unique identifier for the tool call.
|
|
120
|
+
* @returns An array of artifacts with their URLs.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* // Collect artifacts from both file paths and in-memory data
|
|
124
|
+
* const artifacts = await collectArtifacts([
|
|
125
|
+
* {
|
|
126
|
+
* name: "screenshot.png",
|
|
127
|
+
* contentType: "image/png",
|
|
128
|
+
* path: "/Users/project/screenshots/test.png"
|
|
129
|
+
* },
|
|
130
|
+
* {
|
|
131
|
+
* name: "log.txt",
|
|
132
|
+
* contentType: "text/plain",
|
|
133
|
+
* data: Buffer.from("test log content")
|
|
134
|
+
* }
|
|
135
|
+
* ], "/Users/project", "tool-123");
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* // Returns empty array when artifact collection is disabled
|
|
139
|
+
* const artifacts = await collectArtifacts([], "/Users/project", "tool-123");
|
|
140
|
+
* // Returns: []
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* // Throws error for invalid file paths
|
|
144
|
+
* await collectArtifacts([
|
|
145
|
+
* {
|
|
146
|
+
* name: "test.png",
|
|
147
|
+
* contentType: "image/png",
|
|
148
|
+
* path: "relative/path/test.png" // Invalid - not absolute path
|
|
149
|
+
* }
|
|
150
|
+
* ], "/Users/project", "tool-123");
|
|
151
|
+
* // Throws: "Invalid path: relative/path/test.png..."
|
|
152
|
+
*/
|
|
153
|
+
async function collectArtifacts(inputs, repoDir, toolCallId) {
|
|
154
|
+
if (!isArtifactCollectionEnabled())
|
|
155
|
+
return [];
|
|
156
|
+
const destinationDir = path_1.default.join("artifacts", toolCallId);
|
|
157
|
+
if (inputs.length === 0)
|
|
158
|
+
return [];
|
|
159
|
+
const dataArtifacts = inputs.filter(isArtifactInputData);
|
|
160
|
+
const pathArtifacts = inputs.filter(isArtifactInputPath);
|
|
161
|
+
for (const artifact of pathArtifacts) {
|
|
162
|
+
if (!isFullPath(artifact.path, repoDir)) {
|
|
163
|
+
throw new Error(`Invalid path: "${artifact.path}". Path should be a full path relative to the repo directory: "${repoDir}"`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
try {
|
|
167
|
+
const dirs = { destinationDir, sourceDir: repoDir };
|
|
168
|
+
const dataArtifactsWithFileName = dataArtifacts.map((a) => {
|
|
169
|
+
const fileExt = mime_1.default.getExtension(a.contentType);
|
|
170
|
+
const fileName = `${(0, slug_1.slugify)(a.name)}-${Date.now().toString()}.${fileExt}`;
|
|
171
|
+
return { ...a, fileName };
|
|
172
|
+
});
|
|
173
|
+
await Promise.all([
|
|
174
|
+
collectInMemoryArtifacts(dataArtifactsWithFileName, dirs),
|
|
175
|
+
collectFilePathArtifacts(pathArtifacts, dirs),
|
|
176
|
+
]);
|
|
177
|
+
const inputsWithFileNames = [
|
|
178
|
+
...pathArtifacts,
|
|
179
|
+
...dataArtifactsWithFileName,
|
|
180
|
+
];
|
|
181
|
+
const results = inputsWithFileNames.map((artifact) => {
|
|
182
|
+
const isPathArtifact = isArtifactInputPath(artifact);
|
|
183
|
+
const relativePath = isPathArtifact
|
|
184
|
+
? path_1.default.relative(repoDir, artifact.path)
|
|
185
|
+
: artifact.fileName;
|
|
186
|
+
const pathInBucket = path_1.default.join(destinationDir, relativePath);
|
|
187
|
+
const url = `https://reports.empirical.run/${pathInBucket}`;
|
|
188
|
+
return {
|
|
189
|
+
name: artifact.name,
|
|
190
|
+
contentType: artifact.contentType,
|
|
191
|
+
url,
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
return results;
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
console.error("Error in collectArtifacts:", {
|
|
198
|
+
error,
|
|
199
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
200
|
+
artifacts: inputs.map((a) => ({
|
|
201
|
+
name: a.name,
|
|
202
|
+
type: a.contentType,
|
|
203
|
+
hasData: isArtifactInputData(a),
|
|
204
|
+
hasPath: isArtifactInputPath(a),
|
|
205
|
+
})),
|
|
206
|
+
});
|
|
207
|
+
return [];
|
|
208
|
+
}
|
|
209
|
+
}
|
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
|
-
|
|
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 &&
|
|
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)(
|
|
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
|
-
|
|
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?:
|
|
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:
|
|
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":"
|
|
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"}
|
package/dist/bin/utils/index.js
CHANGED
|
@@ -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,12 +49,15 @@ 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(repoDir: string): Promise<{
|
|
53
|
+
success: boolean;
|
|
54
|
+
errors: string[];
|
|
55
|
+
}>;
|
|
52
56
|
export declare function validateTypescript(filePath: string): string[];
|
|
53
57
|
export declare function stripAndPrependImports(content: string, testName: string): Promise<(string | undefined)[]>;
|
|
54
58
|
export declare function lintErrors(filePath: string): Promise<void>;
|
|
55
59
|
export declare function formatCode(filePath: string, trace?: TraceClient): Promise<void>;
|
|
56
60
|
export declare function addNewImport(contents: string, modules: string[], pkg: string): string;
|
|
57
|
-
export declare function removeTestOnly(filePath: string): Promise<void>;
|
|
58
61
|
export declare function getFixtureImportPath(filePath: string): string;
|
|
59
62
|
export declare function getPageVariableNameFromCreateTest(filePath: string): Promise<string | undefined>;
|
|
60
63
|
export declare function replaceCreateTestWithNewCode(filePath: string, contents: string, generatedCode: string): string;
|
|
@@ -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;
|
|
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,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAG5E;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACpE,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC,CAwBD;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CA8C7D;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,mCAWjB;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,iBAShD;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,iBAgBrE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,UAE5E;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,UAcpD;AAED,wBAAsB,iCAAiC,CAAC,QAAQ,EAAE,MAAM,+BAoBvE;AA+CD,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,UAoCtB;AAED,eAAO,MAAM,6BAA6B,GAAI,2CAI3C;IACD,eAAe,EAAE,MAAM,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"}
|
|
@@ -9,12 +9,12 @@ exports.hasTestBlock = hasTestBlock;
|
|
|
9
9
|
exports.hasTopLevelDescribeConfigureWithSerialMode = hasTopLevelDescribeConfigureWithSerialMode;
|
|
10
10
|
exports.findFirstSerialDescribeBlock = findFirstSerialDescribeBlock;
|
|
11
11
|
exports.appendToTestBlock = appendToTestBlock;
|
|
12
|
+
exports.runTypescriptCompiler = runTypescriptCompiler;
|
|
12
13
|
exports.validateTypescript = validateTypescript;
|
|
13
14
|
exports.stripAndPrependImports = stripAndPrependImports;
|
|
14
15
|
exports.lintErrors = lintErrors;
|
|
15
16
|
exports.formatCode = formatCode;
|
|
16
17
|
exports.addNewImport = addNewImport;
|
|
17
|
-
exports.removeTestOnly = removeTestOnly;
|
|
18
18
|
exports.getFixtureImportPath = getFixtureImportPath;
|
|
19
19
|
exports.getPageVariableNameFromCreateTest = getPageVariableNameFromCreateTest;
|
|
20
20
|
exports.replaceCreateTestWithNewCode = replaceCreateTestWithNewCode;
|
|
@@ -25,6 +25,7 @@ exports.buildTestNamePrompt = buildTestNamePrompt;
|
|
|
25
25
|
exports.getVariableDeclarationsFromCode = getVariableDeclarationsFromCode;
|
|
26
26
|
exports.isSyntaxValid = isSyntaxValid;
|
|
27
27
|
const parser_1 = require("@babel/parser");
|
|
28
|
+
const test_run_1 = require("@empiricalrun/test-run");
|
|
28
29
|
const eslint_1 = require("eslint");
|
|
29
30
|
const fs_1 = __importDefault(require("fs"));
|
|
30
31
|
const path_1 = __importDefault(require("path"));
|
|
@@ -32,6 +33,7 @@ const prettier_1 = __importDefault(require("prettier"));
|
|
|
32
33
|
const ts_morph_1 = require("ts-morph");
|
|
33
34
|
const typescript_1 = __importDefault(require("typescript"));
|
|
34
35
|
const util_1 = require("util");
|
|
36
|
+
const stripAnsi_1 = require("../../../../utils/stripAnsi");
|
|
35
37
|
const getTestModuleAliasFromSourceFile = (sourceFile) => {
|
|
36
38
|
return (sourceFile
|
|
37
39
|
.getImportDeclarations()
|
|
@@ -200,6 +202,27 @@ function appendToTestBlock(testBlock, content) {
|
|
|
200
202
|
const updateTestBlock = testBlock.replace(/\}\)$/, `\n\n${content}\n\n })`);
|
|
201
203
|
return updateTestBlock;
|
|
202
204
|
}
|
|
205
|
+
async function runTypescriptCompiler(repoDir) {
|
|
206
|
+
let { code, output } = await (0, test_run_1.spawnCmd)("npx", ["tsc", "--noEmit", "--pretty"], {
|
|
207
|
+
cwd: repoDir,
|
|
208
|
+
envOverrides: {},
|
|
209
|
+
captureOutput: true,
|
|
210
|
+
throwOnError: false,
|
|
211
|
+
});
|
|
212
|
+
if (code === 0) {
|
|
213
|
+
return {
|
|
214
|
+
success: true,
|
|
215
|
+
errors: [],
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
if (!output) {
|
|
219
|
+
throw new Error("No output from typescript compiler");
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
success: false,
|
|
223
|
+
errors: (0, stripAnsi_1.stripAnsiEscapes)(output).split("\n"),
|
|
224
|
+
};
|
|
225
|
+
}
|
|
203
226
|
function validateTypescript(filePath) {
|
|
204
227
|
// Create a compiler host to read files
|
|
205
228
|
const compilerHost = typescript_1.default.createCompilerHost({});
|
|
@@ -281,13 +304,6 @@ async function formatCode(filePath, trace) {
|
|
|
281
304
|
function addNewImport(contents, modules, pkg) {
|
|
282
305
|
return `import { ${modules.join(", ")} } from "${pkg}";\n${contents}`;
|
|
283
306
|
}
|
|
284
|
-
async function removeTestOnly(filePath) {
|
|
285
|
-
const contents = fs_1.default.readFileSync(filePath, "utf8");
|
|
286
|
-
const updatedContent = contents
|
|
287
|
-
.replace("test.only(", "test(")
|
|
288
|
-
.replace("test.describe.only(", "test.describe(");
|
|
289
|
-
fs_1.default.writeFileSync(filePath, updatedContent);
|
|
290
|
-
}
|
|
291
307
|
function getFixtureImportPath(filePath) {
|
|
292
308
|
// get the depth from the tests folder
|
|
293
309
|
// assumption fixtures are always int the folder tests/fixtures
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { TestGenConfig } from "@empiricalrun/shared-types";
|
|
2
|
-
import {
|
|
3
|
-
export declare function buildTokenFromOptions(options: Omit<
|
|
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<
|
|
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
|
package/dist/file/client.d.ts
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/file/client.js
CHANGED
|
@@ -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;
|
package/dist/file/server.d.ts
CHANGED
|
@@ -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":"
|
|
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"}
|
package/dist/file/server.js
CHANGED
|
@@ -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() { }
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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
|
|
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":"
|
|
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"}
|
package/dist/test-build/index.js
CHANGED
|
@@ -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
|
-
|
|
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]:
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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[]
|
|
25
|
+
execute(toolCalls: PendingToolCall[]): Promise<ToolResult[]>;
|
|
19
26
|
}
|
|
20
27
|
//# sourceMappingURL=index.d.ts.map
|