@empiricalrun/test-gen 0.28.2 → 0.28.3
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 +6 -0
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +1 -0
- package/dist/agent/codegen/fix-ts-errors.d.ts +3 -2
- package/dist/agent/codegen/fix-ts-errors.d.ts.map +1 -1
- package/dist/agent/codegen/fix-ts-errors.js +16 -12
- package/dist/agent/codegen/run.d.ts.map +1 -1
- package/dist/agent/codegen/run.js +1 -0
- package/dist/agent/codegen/update-flow.d.ts.map +1 -1
- package/dist/agent/codegen/update-flow.js +4 -1
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAWvD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAKhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAIvD;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAWvD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAKhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAIvD;AAsDD;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,aAAa,GACvB,OAAO,CAAC,MAAM,CAAC,CAmCjB;AAyBD,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,iBAiBxD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,QA6BjD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAM1E;AAWD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,oBAAoB,GACrC,OAAO,CAAC,MAAM,CAAC,CA8CjB;AAED,wBAAsB,sBAAsB,CAAC,EAC3C,YAAiB,EACjB,IAAS,EACT,eAAoB,EACpB,gBAAqB,EACrB,UAAyC,GAC1C,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,8EASA"}
|
|
@@ -52,6 +52,7 @@ async function prepareFileForUpdateScenario(genConfig) {
|
|
|
52
52
|
testCode: codePrompt,
|
|
53
53
|
pomCode: pomPrompt,
|
|
54
54
|
testCase: testCase,
|
|
55
|
+
options: genConfig.options,
|
|
55
56
|
});
|
|
56
57
|
const testFileContent = await fs_extra_1.default.readFile(specPath, "utf-8");
|
|
57
58
|
const { testBlock, testNode } = (0, web_1.getTypescriptTestBlock)({
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { TraceClient } from "@empiricalrun/llm";
|
|
2
2
|
import { CustomLogger } from "../../bin/logger";
|
|
3
|
-
import { TestCase } from "../../types";
|
|
4
|
-
export declare function validateAndFixTypescriptErrors({ trace, logger, file, testCode, pomCode, testCase, }: {
|
|
3
|
+
import { TestCase, TestGenConfigOptions } from "../../types";
|
|
4
|
+
export declare function validateAndFixTypescriptErrors({ trace, logger, file, testCode, pomCode, testCase, options, }: {
|
|
5
5
|
trace?: TraceClient;
|
|
6
6
|
logger?: CustomLogger;
|
|
7
7
|
file: string;
|
|
8
8
|
testCode: string;
|
|
9
9
|
pomCode: string;
|
|
10
10
|
testCase: TestCase;
|
|
11
|
+
options?: TestGenConfigOptions;
|
|
11
12
|
}): Promise<void>;
|
|
12
13
|
//# sourceMappingURL=fix-ts-errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix-ts-errors.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/fix-ts-errors.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"fix-ts-errors.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/fix-ts-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQhD,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE7D,wBAAsB,8BAA8B,CAAC,EACnD,KAAK,EACL,MAA2B,EAC3B,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,OAAO,GACR,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC,iBAoEA"}
|
|
@@ -5,12 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.validateAndFixTypescriptErrors = void 0;
|
|
7
7
|
const llm_1 = require("@empiricalrun/llm");
|
|
8
|
-
const generative_ai_1 = require("@google/generative-ai");
|
|
9
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
-
const remove_markdown_1 = __importDefault(require("remove-markdown"));
|
|
11
9
|
const logger_1 = require("../../bin/logger");
|
|
12
10
|
const web_1 = require("../../bin/utils/platform/web");
|
|
13
|
-
|
|
11
|
+
const constants_1 = require("../../constants");
|
|
12
|
+
async function validateAndFixTypescriptErrors({ trace, logger = new logger_1.CustomLogger(), file, testCode, pomCode, testCase, options, }) {
|
|
14
13
|
const validateTypesSpan = trace?.span({ name: "detect-type-errors-in-file" });
|
|
15
14
|
logger.log("Validating types...");
|
|
16
15
|
let errors = (0, web_1.validateTypescript)(file);
|
|
@@ -44,15 +43,20 @@ async function validateAndFixTypescriptErrors({ trace, logger = new logger_1.Cus
|
|
|
44
43
|
scenaioName: testCase.name,
|
|
45
44
|
});
|
|
46
45
|
promptSpan?.end({ output: { instruction } });
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
const llm = new llm_1.LLM({
|
|
47
|
+
trace,
|
|
48
|
+
provider: options?.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER,
|
|
49
|
+
defaultModel: options?.model || constants_1.DEFAULT_MODEL,
|
|
50
|
+
providerApiKey: constants_1.MODEL_API_KEYS[options?.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER],
|
|
51
|
+
});
|
|
52
|
+
const message = await llm.createChatCompletion({
|
|
53
|
+
messages: instruction,
|
|
54
|
+
modelParameters: {
|
|
55
|
+
...constants_1.DEFAULT_MODEL_PARAMETERS,
|
|
56
|
+
...options?.modelParameters,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
const response = message?.content || "";
|
|
56
60
|
const readWriteFileSpan = trace?.span({ name: "write-to-file" });
|
|
57
61
|
await fs_extra_1.default.writeFile(file, response, "utf-8");
|
|
58
62
|
readWriteFileSpan?.end({ output: { response } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/run.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAI7D,wBAAsB,YAAY,CAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,QAAQ,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/run.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAI7D,wBAAsB,YAAY,CAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,QAAQ,EAAE,CAAC,CAkGrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-flow.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/update-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAmB3B,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAI7D,KAAK,eAAe,GAAG,QAAQ,GAAG;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"update-flow.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/update-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAmB3B,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAI7D,KAAK,eAAe,GAAG,QAAQ,GAAG;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAmHF,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAAG,SAAS,EACzC,OAAO,GAAE,OAAc,EACvB,QAAQ,GAAE,OAAc,GACvB,OAAO,CAAC,eAAe,EAAE,CAAC,CAuF5B;AAED,wBAAsB,qBAAqB,CAAC,EAC1C,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,KAAK,EACL,aAAoB,GACrB,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAiE7B"}
|
|
@@ -15,7 +15,7 @@ const constants_1 = require("../../constants");
|
|
|
15
15
|
const session_1 = require("../../session");
|
|
16
16
|
const fix_ts_errors_1 = require("./fix-ts-errors");
|
|
17
17
|
const utils_1 = require("./utils");
|
|
18
|
-
async function applyFileChanges({ validateTypes = true, trace, testCase, fileChanges, logger, pomPrompt, codePrompt, }) {
|
|
18
|
+
async function applyFileChanges({ validateTypes = true, trace, testCase, fileChanges, logger, testGenOptions, pomPrompt, codePrompt, }) {
|
|
19
19
|
await Promise.allSettled(fileChanges.map(async (fileChange) => {
|
|
20
20
|
if (!fileChange.filePath) {
|
|
21
21
|
return;
|
|
@@ -77,6 +77,7 @@ async function applyFileChanges({ validateTypes = true, trace, testCase, fileCha
|
|
|
77
77
|
testCode: codePrompt,
|
|
78
78
|
pomCode: pomPrompt,
|
|
79
79
|
testCase: testCase,
|
|
80
|
+
options: testGenOptions,
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
trace.event({ name: "format-file" });
|
|
@@ -152,6 +153,7 @@ async function updateTest(testCase, file, options, logging = true, validate = tr
|
|
|
152
153
|
testCase,
|
|
153
154
|
fileChanges,
|
|
154
155
|
logger,
|
|
156
|
+
testGenOptions: options,
|
|
155
157
|
pomPrompt: pomPrompt,
|
|
156
158
|
codePrompt: codePrompt,
|
|
157
159
|
});
|
|
@@ -216,6 +218,7 @@ async function appendCreateTestBlock({ testCase, file, options, trace, validateT
|
|
|
216
218
|
testCase,
|
|
217
219
|
fileChanges,
|
|
218
220
|
logger,
|
|
221
|
+
testGenOptions: options,
|
|
219
222
|
pomPrompt: pomPrompt,
|
|
220
223
|
codePrompt: codePrompt,
|
|
221
224
|
validateTypes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"@actions/core": "^1.10.1",
|
|
19
19
|
"@aws-sdk/client-s3": "^3.614.0",
|
|
20
20
|
"@aws-sdk/s3-request-presigner": "^3.614.0",
|
|
21
|
-
"@google/generative-ai": "^0.15.0",
|
|
22
21
|
"@playwright/test": "^1.44.1",
|
|
23
22
|
"@types/sanitize-html": "^2.11.0",
|
|
24
23
|
"commander": "^12.1.0",
|
|
@@ -44,9 +43,9 @@
|
|
|
44
43
|
"ts-morph": "^23.0.0",
|
|
45
44
|
"tsx": "^4.16.2",
|
|
46
45
|
"typescript": "^5.3.3",
|
|
47
|
-
"@empiricalrun/llm": "^0.9.2",
|
|
48
46
|
"@empiricalrun/r2-uploader": "^0.3.0",
|
|
49
|
-
"@empiricalrun/reporter": "^0.18.2"
|
|
47
|
+
"@empiricalrun/reporter": "^0.18.2",
|
|
48
|
+
"@empiricalrun/llm": "^0.9.2"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
51
|
"@types/detect-port": "^1.3.5",
|