@empiricalrun/test-gen 0.21.2 → 0.21.5

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,26 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.21.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 83d1382: fix: test code getting empty when using code gen
8
+ - Updated dependencies [83d1382]
9
+ - @empiricalrun/llm@0.4.5
10
+
11
+ ## 0.21.4
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [09edb5f]
16
+ - @empiricalrun/reporter@0.14.3
17
+
18
+ ## 0.21.3
19
+
20
+ ### Patch Changes
21
+
22
+ - c92362f: fix: verification agent hallucination
23
+
3
24
  ## 0.21.2
4
25
 
5
26
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/actions/assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD,eAAO,MAAM,6CAA6C,2BAChC,CAAC;AAE3B,eAAO,MAAM,mCAAmC,EAAE,yBA8CjD,CAAC"}
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/actions/assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,eAAO,MAAM,6CAA6C,2BAChC,CAAC;AAE3B,eAAO,MAAM,mCAAmC,EAAE,yBA8CjD,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assertTextVisibilityActionGenerator = exports.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME = void 0;
4
+ const constants_1 = require("./constants");
4
5
  const utils_1 = require("./utils");
5
6
  exports.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME = "assert_text_visibility";
6
7
  const assertTextVisibilityActionGenerator = (page) => {
@@ -32,7 +33,7 @@ const assertTextVisibilityActionGenerator = (page) => {
32
33
  },
33
34
  reason: {
34
35
  type: "string",
35
- description: "reason for calling this function",
36
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
36
37
  },
37
38
  },
38
39
  required: ["css_selector", "reason"],
@@ -1 +1 @@
1
- {"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../src/actions/click.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,yBA8ClC,CAAC"}
1
+ {"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../src/actions/click.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,yBA8ClC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.clickActionGenerator = exports.PLAYWRIGHT_CLICK_ACTION_NAME = void 0;
4
+ const constants_1 = require("./constants");
4
5
  const utils_1 = require("./utils");
5
6
  exports.PLAYWRIGHT_CLICK_ACTION_NAME = "click_element";
6
7
  const clickActionGenerator = (page) => {
@@ -34,7 +35,7 @@ const clickActionGenerator = (page) => {
34
35
  },
35
36
  reason: {
36
37
  type: "string",
37
- description: "reason for calling this function",
38
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
38
39
  },
39
40
  },
40
41
  required: ["css_selector", "reason"],
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_ACTION_REASON_PROMPT = "reason for calling this function. the reason should align with the task provided";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,qFAC2C,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_ACTION_REASON_PROMPT = void 0;
4
+ exports.DEFAULT_ACTION_REASON_PROMPT = "reason for calling this function. the reason should align with the task provided";
@@ -1 +1 @@
1
- {"version":3,"file":"done.d.ts","sourceRoot":"","sources":["../../src/actions/done.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAErD,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,yBAuBjC,CAAC"}
1
+ {"version":3,"file":"done.d.ts","sourceRoot":"","sources":["../../src/actions/done.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,yBAuBjC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doneActionGenerator = exports.PLAYWRIGHT_DONE_ACTION_NAME = void 0;
4
+ const constants_1 = require("./constants");
4
5
  exports.PLAYWRIGHT_DONE_ACTION_NAME = "task_done";
5
6
  const doneActionGenerator = () => {
6
7
  return {
@@ -17,7 +18,7 @@ const doneActionGenerator = () => {
17
18
  properties: {
18
19
  reason: {
19
20
  type: "string",
20
- description: "reason for declaring the task is complete",
21
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
21
22
  },
22
23
  },
23
24
  required: [],
@@ -1 +1 @@
1
- {"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../src/actions/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAEhE,eAAO,MAAM,mBAAmB,EAAE,yBA8CjC,CAAC"}
1
+ {"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../src/actions/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAEhE,eAAO,MAAM,mBAAmB,EAAE,yBA8CjC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fillActionGenerator = exports.PLAYWRIGHT_FILL_ACTION_NAME = void 0;
4
+ const constants_1 = require("./constants");
4
5
  const utils_1 = require("./utils");
5
6
  exports.PLAYWRIGHT_FILL_ACTION_NAME = "fill_input_element";
6
7
  const fillActionGenerator = (page) => {
@@ -33,11 +34,11 @@ const fillActionGenerator = (page) => {
33
34
  },
34
35
  css_selector: {
35
36
  type: "string",
36
- description: "CSS selector to identify the element uniquely.When creating CSS selectors, ensure they are unique to the page and specific enough to select only one element",
37
+ description: "CSS selector to identify the element uniquely.When creating CSS selectors, ensure they are unique to the page and specific enough to select only one element.",
37
38
  },
38
39
  reason: {
39
40
  type: "string",
40
- description: "reason for calling this function",
41
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
41
42
  },
42
43
  },
43
44
  required: ["text", "css_selector", "reason"],
@@ -1 +1 @@
1
- {"version":3,"file":"goto.d.ts","sourceRoot":"","sources":["../../src/actions/goto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAErD,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,yBAqCjC,CAAC"}
1
+ {"version":3,"file":"goto.d.ts","sourceRoot":"","sources":["../../src/actions/goto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,yBAqCjC,CAAC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.gotoActionGenerator = exports.PLAYWRIGHT_GOTO_ACTION_NAME = void 0;
4
4
  const utils_1 = require("../agent/browsing/utils");
5
+ const constants_1 = require("./constants");
5
6
  exports.PLAYWRIGHT_GOTO_ACTION_NAME = "page_goto";
6
7
  const gotoActionGenerator = (page) => {
7
8
  return {
@@ -32,7 +33,7 @@ const gotoActionGenerator = (page) => {
32
33
  },
33
34
  reason: {
34
35
  type: "string",
35
- description: "reason for calling this function",
36
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
36
37
  },
37
38
  },
38
39
  required: ["url", "reason"],
@@ -20,7 +20,7 @@ Each action should take the task to completion, if not the action is invalid.`,
20
20
  },
21
21
  reason: {
22
22
  type: "string",
23
- description: "explain how this action will help to complete the task",
23
+ description: "explain how this action will help to complete the task. the reason should align with the task provided",
24
24
  },
25
25
  },
26
26
  required: ["action", "reason"],
@@ -1 +1 @@
1
- {"version":3,"file":"reload-page.d.ts","sourceRoot":"","sources":["../../src/actions/reload-page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAErD,eAAO,MAAM,6BAA6B,gBAAgB,CAAC;AAE3D,eAAO,MAAM,qBAAqB,EAAE,yBA+BnC,CAAC"}
1
+ {"version":3,"file":"reload-page.d.ts","sourceRoot":"","sources":["../../src/actions/reload-page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD,eAAO,MAAM,6BAA6B,gBAAgB,CAAC;AAE3D,eAAO,MAAM,qBAAqB,EAAE,yBA+BnC,CAAC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.reloadActionGenerator = exports.PLAYWRIGHT_RELOAD_ACTION_NAME = void 0;
4
4
  const utils_1 = require("../agent/browsing/utils");
5
+ const constants_1 = require("./constants");
5
6
  exports.PLAYWRIGHT_RELOAD_ACTION_NAME = "page_reload";
6
7
  const reloadActionGenerator = (page) => {
7
8
  return {
@@ -25,7 +26,7 @@ const reloadActionGenerator = (page) => {
25
26
  properties: {
26
27
  reason: {
27
28
  type: "string",
28
- description: "reason for calling this function",
29
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
29
30
  },
30
31
  },
31
32
  required: ["reason"],
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/verification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,GAAG,EACH,KAAK,EACL,IAAI,EACJ,YAAY,GACb,EAAE;IACD,GAAG,EAAE,GAAG,CAAC;IACT,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;;;GA4DA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/verification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,GAAG,EACH,KAAK,EACL,IAAI,EACJ,YAAY,GACb,EAAE;IACD,GAAG,EAAE,GAAG,CAAC;IACT,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;;;GA8DA"}
@@ -10,7 +10,10 @@ async function verificationAgent({ llm, trace, task, conversation, }) {
10
10
  messages: [
11
11
  {
12
12
  role: "system",
13
- content: "Given a conversation and a task, your task is to analyse the conversation and tell if the task is completed. If not, you need to tell what is not completed and suggest next steps to complete the task.",
13
+ content: `Given a conversation and a task, your task is to analyse the conversation and tell if the task is completed.
14
+ If not, you need to tell what is not completed and suggest next steps to complete the task.
15
+ You need to respond assuming the conversation provided to you is truthful.
16
+ `,
14
17
  },
15
18
  {
16
19
  role: "user",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AAMA,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAYpB;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAG5E;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAiD7D;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,qBAM3D;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,iBAOhD;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,iBAQhD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,UAE5E;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,iBAIpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AAMA,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAYpB;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAG5E;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAmD7D;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,qBAM3D;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,iBAShD;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,iBAQhD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,UAE5E;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,iBAIpD"}
@@ -25,7 +25,9 @@ function appendToTestBlock(testBlock, content) {
25
25
  exports.appendToTestBlock = appendToTestBlock;
26
26
  function validateTypescript(filePath) {
27
27
  // Create a compiler host to read files
28
- const compilerHost = typescript_1.default.createCompilerHost({});
28
+ const compilerHost = typescript_1.default.createCompilerHost({
29
+ esModuleInterop: true,
30
+ });
29
31
  compilerHost.readFile = (file) => fs_extra_1.default.readFileSync(file, "utf8");
30
32
  // Create a program with a single source file
31
33
  const program = typescript_1.default.createProgram([filePath], {}, compilerHost);
@@ -85,7 +87,9 @@ async function lintErrors(filePath) {
85
87
  useEslintrc: true,
86
88
  });
87
89
  const [result] = await eslint.lintFiles(filePath);
88
- fs_extra_1.default.writeFileSync(filePath, result?.output || "");
90
+ if (result?.output) {
91
+ fs_extra_1.default.writeFileSync(filePath, result.output);
92
+ }
89
93
  }
90
94
  exports.lintErrors = lintErrors;
91
95
  async function formatCode(filePath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.21.2",
3
+ "version": "0.21.5",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -41,8 +41,8 @@
41
41
  "ts-morph": "^23.0.0",
42
42
  "tsx": "^4.16.2",
43
43
  "typescript": "^5.3.3",
44
- "@empiricalrun/llm": "^0.4.4",
45
- "@empiricalrun/reporter": "^0.14.2"
44
+ "@empiricalrun/llm": "^0.4.5",
45
+ "@empiricalrun/reporter": "^0.14.3"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/detect-port": "^1.3.5",