@empiricalrun/test-gen 0.43.3 → 0.45.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 (38) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/actions/index.d.ts.map +1 -1
  3. package/dist/actions/index.js +8 -1
  4. package/dist/actions/skill.d.ts +3 -0
  5. package/dist/actions/skill.d.ts.map +1 -1
  6. package/dist/actions/skill.js +10 -2
  7. package/dist/agent/codegen/run.d.ts.map +1 -1
  8. package/dist/agent/codegen/run.js +3 -1
  9. package/dist/agent/codegen/use-skill.d.ts +1 -0
  10. package/dist/agent/codegen/use-skill.d.ts.map +1 -1
  11. package/dist/agent/master/run.d.ts.map +1 -1
  12. package/dist/agent/master/run.js +21 -7
  13. package/dist/agent/planner/run.d.ts.map +1 -1
  14. package/dist/agent/planner/run.js +3 -4
  15. package/dist/bin/index.js +1 -0
  16. package/dist/bin/utils/index.d.ts +1 -0
  17. package/dist/bin/utils/index.d.ts.map +1 -1
  18. package/dist/bin/utils/scenarios/index.d.ts.map +1 -1
  19. package/dist/bin/utils/scenarios/index.js +3 -2
  20. package/dist/errors/index.d.ts +5 -0
  21. package/dist/errors/index.d.ts.map +1 -0
  22. package/dist/errors/index.js +9 -0
  23. package/dist/file/client.d.ts +3 -1
  24. package/dist/file/client.d.ts.map +1 -1
  25. package/dist/file/client.js +9 -1
  26. package/dist/human-in-the-loop/index.d.ts +6 -4
  27. package/dist/human-in-the-loop/index.d.ts.map +1 -1
  28. package/dist/human-in-the-loop/index.js +12 -6
  29. package/dist/human-in-the-loop/ipc.d.ts.map +1 -1
  30. package/dist/human-in-the-loop/ipc.js +1 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +1 -2
  33. package/dist/session/index.d.ts.map +1 -1
  34. package/dist/session/index.js +2 -1
  35. package/dist/utils/env.d.ts +2 -0
  36. package/dist/utils/env.d.ts.map +1 -0
  37. package/dist/utils/env.js +7 -0
  38. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.45.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 698ad31: feat: add approval in skill execute
8
+
9
+ ### Patch Changes
10
+
11
+ - 23f875f: fix: abstract the communication method of human in loop
12
+
13
+ ## 0.44.0
14
+
15
+ ### Minor Changes
16
+
17
+ - c206ea8: feat: Add suites CLI flag for test generation
18
+
19
+ ### Patch Changes
20
+
21
+ - 57ea65d: fix: prompt for create test using code agent to honour the file name and test case name
22
+
3
23
  ## 0.43.3
4
24
 
5
25
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAAE,YAAY,EAA6B,MAAM,UAAU,CAAC;AAWnE,qBAAa,iBAAiB;IAQ1B,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,cAAc;IARxB,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,eAAe,CAInB;gBAEM,IAAI,EAAE,WAAW,EACjB,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAgB5C,aAAa,CACjB,IAAI,oBAAa,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAqD9B,wBAAwB,IAAI,YAAY,EAAE;IAoB1C,sBAAsB,IAAI,YAAY,EAAE;IAWxC,YAAY,IAAI;QACd,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB;IAUD,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAK9B;;;;;;OAMG;IACH,aAAa,IAAI,OAAO;IAQxB,UAAU;IAWV,iBAAiB;IAIjB,iBAAiB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAItD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAAE,YAAY,EAA6B,MAAM,UAAU,CAAC;AAWnE,qBAAa,iBAAiB;IAQ1B,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,cAAc;IARxB,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,eAAe,CAInB;gBAEM,IAAI,EAAE,WAAW,EACjB,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAgB5C,aAAa,CACjB,IAAI,oBAAa,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IA0D9B,wBAAwB,IAAI,YAAY,EAAE;IAoB1C,sBAAsB,IAAI,YAAY,EAAE;IAWxC,YAAY,IAAI;QACd,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB;IAUD,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAK9B;;;;;;OAMG;IACH,aAAa,IAAI,OAAO;IAQxB,UAAU;IAWV,iBAAiB;IAIjB,iBAAiB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAItD"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PlaywrightActions = void 0;
4
4
  const logger_1 = require("../bin/logger");
5
+ const errors_1 = require("../errors");
5
6
  const reporter_1 = require("../reporter");
6
7
  const assert_1 = require("./assert");
7
8
  const click_1 = require("./click");
@@ -81,7 +82,13 @@ class PlaywrightActions {
81
82
  },
82
83
  });
83
84
  logger.log(`action: ${name} \nreason: ${args.reason}`);
84
- throw Error(`Error executing ${name} action: ${e.message}`);
85
+ // if its already parsed error throw it as is
86
+ if (e instanceof errors_1.TestGenError) {
87
+ throw e;
88
+ }
89
+ else {
90
+ throw new errors_1.TestGenError(`Error executing ${name} action: ${e.message}`);
91
+ }
85
92
  }
86
93
  }
87
94
  getBrowsingActionSchemas() {
@@ -13,6 +13,9 @@ declare class TestCaseSkills {
13
13
  updateSkills(skills: Skill[]): void;
14
14
  }
15
15
  export declare const testCaseSkills: TestCaseSkills;
16
+ export declare function extractSkillFromArgs(args: Record<string, any>): {
17
+ skillDetails: Skill | undefined;
18
+ };
16
19
  export declare const skillActionGenerator: PlaywrightActionGenerator;
17
20
  export {};
18
21
  //# sourceMappingURL=skill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/actions/skill.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,cAAM,cAAc;IACN,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,KAAK,EAAE;IAEnC,kBAAkB;IAIlB,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE;CAG7B;AAED,eAAO,MAAM,cAAc,gBAAyB,CAAC;AAErD,eAAO,MAAM,oBAAoB,EAAE,yBAoHlC,CAAC"}
1
+ {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/actions/skill.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,cAAM,cAAc;IACN,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,KAAK,EAAE;IAEnC,kBAAkB;IAIlB,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE;CAG7B;AAED,eAAO,MAAM,cAAc,gBAAyB,CAAC;AAErD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;EAO7D;AAED,eAAO,MAAM,oBAAoB,EAAE,yBAmHlC,CAAC"}
@@ -3,7 +3,7 @@ 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.skillActionGenerator = exports.testCaseSkills = exports.SKILL_USAGE = void 0;
6
+ exports.skillActionGenerator = exports.extractSkillFromArgs = exports.testCaseSkills = exports.SKILL_USAGE = void 0;
7
7
  const promises_1 = __importDefault(require("fs/promises"));
8
8
  const api_1 = __importDefault(require("tsx/cjs/api"));
9
9
  const use_skill_1 = require("../agent/codegen/use-skill");
@@ -23,12 +23,19 @@ class TestCaseSkills {
23
23
  }
24
24
  }
25
25
  exports.testCaseSkills = new TestCaseSkills([]);
26
+ function extractSkillFromArgs(args) {
27
+ const availableSkills = exports.testCaseSkills.getAvailableSkills();
28
+ const { skill } = args;
29
+ const [skillDetails] = availableSkills.filter((skillDetails) => skillDetails.testStep === skill);
30
+ return { skillDetails };
31
+ }
32
+ exports.extractSkillFromArgs = extractSkillFromArgs;
26
33
  const skillActionGenerator = (page, options) => {
27
34
  const availableSkills = exports.testCaseSkills.getAvailableSkills();
28
35
  return {
29
36
  execute: async ({ args, trace }) => {
30
37
  const { skill, action } = args;
31
- const [skillDetails] = availableSkills.filter((skillDetails) => skillDetails.testStep === skill);
38
+ const { skillDetails } = extractSkillFromArgs(args);
32
39
  if (!skillDetails) {
33
40
  throw new Error(`No skill found for skill: ${skill}`);
34
41
  }
@@ -42,6 +49,7 @@ const skillActionGenerator = (page, options) => {
42
49
  const code = await (0, use_skill_1.generateSkillUsageCode)({
43
50
  task: action,
44
51
  sampleUsageMethod: skillDetails.usageExample,
52
+ importPathForSkill: skillFilePath,
45
53
  scopeVariablesMapStr: JSON.stringify(options.stateVariables || {}, null, 2),
46
54
  pageVariableName: (0, utils_1.getPageVarName)(),
47
55
  skillMethodDefinition: skillFile,
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAmBhD,wBAAsB,uBAAuB,CAAC,EAC5C,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;;;;GAuDA;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,EAC7B,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CA8D5B"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAmBhD,wBAAsB,uBAAuB,CAAC,EAC5C,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;;;;GAyDA;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,EAC7B,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CA8D5B"}
@@ -10,7 +10,7 @@ const logger_1 = require("../../bin/logger");
10
10
  const context_1 = require("../../bin/utils/context");
11
11
  const web_1 = require("../../bin/utils/platform/web");
12
12
  const constants_1 = require("../../constants");
13
- const promptTemplate_0 = "{{#section \"system\"}}\nYou are a software test engineer who is given a task to write test cases in a Playwright test repository.\nYou will be provided with current test files, fixtures and page object models for you to use and update code as per the\ntask provided to you.\nYou need to respond with file path, the new test code block to be updated in the file and the reason for the change.\n\nHere is the list of files:\n\n{{repoFiles}}\n{{/section}}\n\n{{#section \"user\"}}\nTask: {{task}}\n\n## Follow these instructions before responding with output:\n- Respond with <file_path></file_path>, <code_block></code_block> and <change></change> as xml tags\n- Only respond with single code_block in the response containing only the test code block to be updated\n- If the test already exists, do not update the file\n{{/section}}";
13
+ const promptTemplate_0 = "{{#section \"system\"}}\nYou are a software test engineer who is given a task to write test cases in a Playwright test repository.\nYou will be provided with current test files, fixtures and page object models for you to use and update code as per the\ntask provided to you.\nYou need to respond with file path, the new test code block to be updated in the file and the reason for the change.\n\nHere is the list of files:\n\n{{repoFiles}}\n{{/section}}\n\n{{#section \"user\"}}\nTask: {{task}}\n\n## Follow these instructions before responding with output:\n- Scan the file '{{testFilePath}}' and check whether test case with name '{{testCaseName}}' exists in the file\n- If it exists do not update the file\n- else respond with <file_path></file_path>, <code_block></code_block> and <change></change> as xml tags\n- Only respond with single code_block in the response containing only the test code block to be updated\n{{/section}}";
14
14
  const reporter_1 = require("../../reporter");
15
15
  const update_flow_1 = require("./update-flow");
16
16
  const utils_1 = require("./utils");
@@ -27,6 +27,8 @@ ${testCase.steps.join("\n")}`;
27
27
  const prompt = (0, llm_1.compilePrompt)(promptTemplate_0, {
28
28
  task,
29
29
  repoFiles,
30
+ testCaseName: testCase.name,
31
+ testFilePath: file,
30
32
  });
31
33
  const createTestSpan = trace?.span({
32
34
  name: "create-test",
@@ -5,6 +5,7 @@ export declare function generateSkillUsageCode({ task, sampleUsageMethod, scopeV
5
5
  scopeVariablesMapStr: string;
6
6
  pageVariableName: string;
7
7
  skillMethodDefinition: string;
8
+ importPathForSkill: string;
8
9
  trace?: TraceClient;
9
10
  }): Promise<string>;
10
11
  //# sourceMappingURL=use-skill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-skill.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/use-skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWpE,wBAAsB,sBAAsB,CAAC,EAC3C,IAAI,EACJ,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,GACN,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,mBA6CA"}
1
+ {"version":3,"file":"use-skill.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/use-skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWpE,wBAAsB,sBAAsB,CAAC,EAC3C,IAAI,EACJ,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,GACN,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,mBA6CA"}
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAclC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,oBAAoB,EAErB,MAAM,aAAa,CAAC;AA6BrB,wBAAsB,0BAA0B,CAAC,EAC/C,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;;;GA+WA"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAqBlC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EACL,oBAAoB,EAErB,MAAM,aAAa,CAAC;AA6BrB,wBAAsB,0BAA0B,CAAC,EAC/C,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;;;GA4XA"}
@@ -7,9 +7,12 @@ const skill_1 = require("../../actions/skill");
7
7
  const utils_1 = require("../../actions/utils");
8
8
  const logger_1 = require("../../bin/logger");
9
9
  const constants_1 = require("../../constants");
10
+ const errors_1 = require("../../errors");
11
+ const human_in_the_loop_1 = require("../../human-in-the-loop");
10
12
  const page_1 = require("../../page");
11
13
  const reporter_1 = require("../../reporter");
12
14
  const session_1 = require("../../session");
15
+ const env_1 = require("../../utils/env");
13
16
  const browsing_1 = require("../browsing");
14
17
  const utils_2 = require("../browsing/utils");
15
18
  const skills_retriever_1 = require("../codegen/skills-retriever");
@@ -176,6 +179,15 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
176
179
  void testGenReporter.sendMessage(output.reason);
177
180
  logger.log(`Next Action: ${output.action}`);
178
181
  if (toolCall.actionType === skill_1.SKILL_USAGE) {
182
+ if (!(0, env_1.isRunningOnCloud)()) {
183
+ const { skillDetails } = (0, skill_1.extractSkillFromArgs)(args);
184
+ const feedback = await human_in_the_loop_1.humanLoop.getFeedback({
185
+ message: `Should I use this skill?\n\n${skillDetails?.usageExample}\n\nfrom: ${skillDetails?.filePath}\n\nAnswer with "yes" or "no"`,
186
+ });
187
+ if (feedback.toLowerCase().trim().includes("no")) {
188
+ throw new errors_1.HumanApprovalDenied("Skill usage approval not provided");
189
+ }
190
+ }
179
191
  const code = await actions.executeAction(toolCall.actionType, args, masterAgentActionSpan);
180
192
  if (code) {
181
193
  generatedCodeSteps.push(code);
@@ -311,13 +323,15 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
311
323
  errorSummary: e.message,
312
324
  },
313
325
  });
314
- logger.error("Failed to run master agent's next task", JSON.stringify(toolCall, null, 2), e);
315
- failedActions.push(output.action);
316
- if (failedActions.length >= MAX_ERROR_COUNT) {
317
- const error = "Agent is not able to figure out next action, marking task as done";
318
- logger.error(error);
319
- await testgenUpdatesReporter.sendMessage(error);
320
- break;
326
+ if (!(e instanceof errors_1.HumanApprovalDenied)) {
327
+ logger.error("Failed to run master agent's next task", JSON.stringify(toolCall, null, 2), e);
328
+ failedActions.push(output.action);
329
+ if (failedActions.length >= MAX_ERROR_COUNT) {
330
+ const error = "Agent is not able to figure out next action, marking task as done";
331
+ logger.error(error);
332
+ await testgenUpdatesReporter.sendMessage(error);
333
+ break;
334
+ }
321
335
  }
322
336
  }
323
337
  }
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/planner/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAapE,wBAAsB,QAAQ,CAAC,EAC7B,IAAI,EACJ,QAAQ,EACR,KAAK,GACN,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,gBA0HA"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/planner/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAcpE,wBAAsB,QAAQ,CAAC,EAC7B,IAAI,EACJ,QAAQ,EACR,KAAK,GACN,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,gBAwHA"}
@@ -5,6 +5,7 @@ const llm_1 = require("@empiricalrun/llm");
5
5
  const context_1 = require("../../bin/utils/context");
6
6
  const human_in_the_loop_1 = require("../../human-in-the-loop");
7
7
  const promptTemplate_0 = "{{#section \"system\"}}\nYou are an expert software engineer in test and have capability to collaborate with user to generate a test plan.\nYou are given a task to provide a high level plan to create a test for a given scenario.\n\nYou will be provided with already added Playwright tests and page object object models which you can use generate the test plan.\nTest plan should be a list of bullet points and each bullet point representing each test step.\nYou will be provided with app knowledge which can help you groom the steps in the plan.\n\n{{#if humanLoopRequired}}\nDo NOT finish until you have a complete understanding of the plan and have all the minute details of how the test should look like.\n\nALWAYS VERIFY THE PLAN WITH USER BEFORE FINISHING. THE USER SHOULD BE ABLE TO REVIEW AND GIVE GO AHEAD TO THE PLAN.\n\nDO NOT FINISH UNTIL USER EXPLICITLY CONFIRMS THE PLAN IS GOOD TO GO.\n{{/if}}\n\n### Test Plan Creation Guidelines\n\n- **Create Subtasks:**\n - Read the task step by step and create subtasks from the given task.\n - Do not add any new steps that are not mentioned in the task.\n\n- **Enrich Subtasks:**\n - Read the provided app knowledge.\n - Enrich the subtasks based on the information from the app knowledge.\n\n- **Plan:**\n - Once all subtasks are enriched, list them as bullet points.\n - Each bullet point must start with one of the following actions: \n - Open page \n - Click on \n - Fill in \n - Assert \n - Hover on \n - Press \n - Extract textContent\n - Do not include any bullet points that do not start with the above actions.\n\n- **Additional Notes:**\n - The final output should only contain bullet points listing the test steps.\n - Do not add any assertions that are not mentioned in the task or app knowledge.\n - The plan should not reference the knowledge base used to generate it.\n\n{{/section}}\n\n{{#section \"user\"}}\n\nApp knowledge:\n{{appKnowledge}}\n\n-----\n\nCurrent tests and page object model references:\n{{fileContext}}\n\n------\n\nTask:\n{{task}}\n\n------\n{{/section}}";
8
+ const env_1 = require("../../utils/env");
8
9
  async function planTask({ task, specPath, trace, }) {
9
10
  let fileContext = "";
10
11
  try {
@@ -24,7 +25,7 @@ ${pomPrompt}
24
25
  },
25
26
  });
26
27
  // if the code in running in ci worker or github actions, disable human loop
27
- const humanLoopRequired = process.env.CI !== "true";
28
+ const humanLoopRequired = !(0, env_1.isRunningOnCloud)();
28
29
  const appKnowledge = await (0, context_1.fetchAppKnowledge)();
29
30
  const messages = (0, llm_1.compilePrompt)(promptTemplate_0, {
30
31
  appKnowledge,
@@ -37,8 +38,6 @@ ${pomPrompt}
37
38
  defaultModel: "gpt-4o",
38
39
  });
39
40
  let maxRetries = 10;
40
- // TODO: this should be environment driven
41
- const hl = new human_in_the_loop_1.HumanLoop({ method: "ipc" });
42
41
  const tools = [
43
42
  {
44
43
  type: "function",
@@ -96,7 +95,7 @@ ${pomPrompt}
96
95
  const resp = JSON.parse(respStr || "{}");
97
96
  // TODO: handle this as a part of actions handler
98
97
  if (toolCall?.function.name === "send_user_message") {
99
- const feedback = await hl.getFeedback({
98
+ const feedback = await human_in_the_loop_1.humanLoop.getFeedback({
100
99
  message: resp.message,
101
100
  });
102
101
  messages.push(response);
package/dist/bin/index.js CHANGED
@@ -186,6 +186,7 @@ async function runAgent(testGenConfig, testGenToken, span) {
186
186
  .option("--name <test-name>", "Name of the test case")
187
187
  .option("--prompt <prompt>", "Prompt for the test case")
188
188
  .option("--file <test-file>", "File path of the test case (inside tests dir)")
189
+ .option("--suites <suites>", "Comma separated list of describe blocks")
189
190
  .parse(process.argv);
190
191
  const options = program.opts();
191
192
  (0, utils_2.validateCliOptions)(options);
@@ -5,6 +5,7 @@ export interface CliOptions {
5
5
  name?: string;
6
6
  file?: string;
7
7
  prompt?: string;
8
+ suites?: string;
8
9
  }
9
10
  export declare function validateCliOptions(options: CliOptions): void;
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,oBAA2B,CAAC;AACpD,eAAO,MAAM,OAAO,oBAA6B,CAAC;AAElD,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;CACjB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAS5D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,oBAA2B,CAAC;AACpD,eAAO,MAAM,OAAO,oBAA6B,CAAC;AAElD,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;CACjB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAS5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/utils/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,aAAa,EAEd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAetC,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,GACjC,MAAM,CAgBR;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,GACjC,aAAa,CAYf;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAmBnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/utils/scenarios/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,aAAa,EAEd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAetC,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,GACjC,MAAM,CAgBR;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,GACjC,aAAa,CAaf;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAmBnE"}
@@ -27,8 +27,9 @@ function buildTestConfigFromOptions(options) {
27
27
  name: options.name,
28
28
  steps: [options.prompt],
29
29
  filePath: options.file,
30
- // TODO: Support suites in this flow
31
- suites: [],
30
+ suites: options.suites
31
+ ? options.suites.split(",").map((s) => s.trim())
32
+ : [],
32
33
  },
33
34
  };
34
35
  }
@@ -0,0 +1,5 @@
1
+ export declare class TestGenError extends Error {
2
+ }
3
+ export declare class HumanApprovalDenied extends TestGenError {
4
+ }
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;CAAG;AAC1C,qBAAa,mBAAoB,SAAQ,YAAY;CAAG"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HumanApprovalDenied = exports.TestGenError = void 0;
4
+ class TestGenError extends Error {
5
+ }
6
+ exports.TestGenError = TestGenError;
7
+ class HumanApprovalDenied extends TestGenError {
8
+ }
9
+ exports.HumanApprovalDenied = HumanApprovalDenied;
@@ -1,6 +1,8 @@
1
1
  declare class TestFileService {
2
2
  baseUrl: string;
3
- constructor(port: number);
3
+ port: number | undefined;
4
+ constructor();
5
+ static isAvailable(): boolean;
4
6
  updateTest({ generatedCode, task, importPaths, }: {
5
7
  generatedCode: string;
6
8
  task: string;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/file/client.ts"],"names":[],"mappings":"AAAA,cAAM,eAAe;IACnB,OAAO,EAAE,MAAM,CAAC;gBACJ,IAAI,EAAE,MAAM;IAIlB,UAAU,CAAC,EACf,aAAa,EACb,IAAI,EACJ,WAAW,GACZ,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB;IAgBK,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;CAgBnC;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/file/client.ts"],"names":[],"mappings":"AAAA,cAAM,eAAe;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;;IASzB,MAAM,CAAC,WAAW;IAIZ,UAAU,CAAC,EACf,aAAa,EACb,IAAI,EACJ,WAAW,GACZ,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB;IAgBK,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;CAgBnC;AAED,eAAe,eAAe,CAAC"}
@@ -2,9 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class TestFileService {
4
4
  baseUrl;
5
- constructor(port) {
5
+ port;
6
+ constructor() {
7
+ const port = Number(process.env.APP_PORT);
8
+ if (port && !isNaN(port)) {
9
+ this.port = port;
10
+ }
6
11
  this.baseUrl = `http://localhost:${port}`;
7
12
  }
13
+ static isAvailable() {
14
+ return !!Number(process.env.APP_PORT);
15
+ }
8
16
  async updateTest({ generatedCode, task, importPaths, }) {
9
17
  const resp = await fetch(`${this.baseUrl}/test`, {
10
18
  method: "POST",
@@ -1,10 +1,12 @@
1
- export declare class HumanLoop {
2
- private options;
3
- constructor(options: {
1
+ declare class HumanLoop {
2
+ options: {
4
3
  method: "ipc" | "cli";
5
- });
4
+ } | undefined;
5
+ constructor();
6
6
  getFeedback({ message }: {
7
7
  message: string;
8
8
  }): Promise<string>;
9
9
  }
10
+ export declare const humanLoop: HumanLoop;
11
+ export {};
10
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/human-in-the-loop/index.ts"],"names":[],"mappings":"AAQA,qBAAa,SAAS;IAER,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE;QAAE,MAAM,EAAE,KAAK,GAAG,KAAK,CAAA;KAAE;IAChD,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;CAOnD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/human-in-the-loop/index.ts"],"names":[],"mappings":"AASA,cAAM,SAAS;IAEb,OAAO,EAAE;QAAE,MAAM,EAAE,KAAK,GAAG,KAAK,CAAA;KAAE,GAAG,SAAS,CAAC;;IAMzC,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;CAOnD;AAED,eAAO,MAAM,SAAS,WAAkB,CAAC"}
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HumanLoop = void 0;
6
+ exports.humanLoop = void 0;
7
+ const client_1 = __importDefault(require("../file/client"));
4
8
  const cli_1 = require("./cli");
5
9
  const ipc_1 = require("./ipc");
6
10
  // TODO: how to make this more conversational
@@ -8,17 +12,19 @@ const ipc_1 = require("./ipc");
8
12
  // we need a layer to put the feedback in the context again
9
13
  // and then we need to generate final output which the user can review
10
14
  class HumanLoop {
11
- options;
12
15
  // TODO: have a better name for this
13
- constructor(options) {
14
- this.options = options;
16
+ options;
17
+ constructor() {
18
+ this.options = {
19
+ method: client_1.default.isAvailable() ? "ipc" : "cli",
20
+ };
15
21
  }
16
22
  async getFeedback({ message }) {
17
23
  // this needs to have a provider based on environment
18
- if (this.options.method === "ipc") {
24
+ if (this.options?.method === "ipc") {
19
25
  return await (0, ipc_1.getFeedbackUsingIPC)(message);
20
26
  }
21
27
  return await (0, cli_1.getFeedbackUsingCli)(message);
22
28
  }
23
29
  }
24
- exports.HumanLoop = HumanLoop;
30
+ exports.humanLoop = new HumanLoop();
@@ -1 +1 @@
1
- {"version":3,"file":"ipc.d.ts","sourceRoot":"","sources":["../../src/human-in-the-loop/ipc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAKvC,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,QAwB1C;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAa1E"}
1
+ {"version":3,"file":"ipc.d.ts","sourceRoot":"","sources":["../../src/human-in-the-loop/ipc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAKvC,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,QAwB1C;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY1E"}
@@ -34,8 +34,7 @@ function humanLoopRoute(app) {
34
34
  }
35
35
  exports.humanLoopRoute = humanLoopRoute;
36
36
  async function getFeedbackUsingIPC(message) {
37
- const port = process.env.APP_PORT || 3030;
38
- const fileService = new client_1.default(Number(port));
37
+ const fileService = new client_1.default();
39
38
  try {
40
39
  const resp = await fileService.post("/converse", { message });
41
40
  return resp.feedback;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAItB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOlC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAapC,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,SAAS,iBAuC3E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAItB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOlC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAapC,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,SAAS,iBAsC3E"}
package/dist/index.js CHANGED
@@ -45,7 +45,6 @@ process.on("exit", async () => await flushEvents());
45
45
  process.on("SIGINT", async () => await flushEvents());
46
46
  process.on("SIGTERM", async () => await flushEvents());
47
47
  async function createTest(task, page, scope) {
48
- const port = process.env.APP_PORT || 3030;
49
48
  const testConfigArg = process.env.TEST_GEN_TOKEN;
50
49
  const testGenConfig = (0, scenarios_1.loadTestConfigs)(testConfigArg);
51
50
  (0, reporter_1.setReporterConfig)({
@@ -59,7 +58,7 @@ async function createTest(task, page, scope) {
59
58
  testCaseId: testGenConfig.testCase.id,
60
59
  projectRepoName: testGenConfig.options?.metadata.projectRepoName,
61
60
  });
62
- const fileService = new client_1.default(Number(port));
61
+ const fileService = new client_1.default();
63
62
  const { testCase, specPath } = testGenConfig;
64
63
  const { code, importPaths } = await (0, run_1.createTestUsingMasterAgent)({
65
64
  testCase,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAkBA,iBAAS,iBAAiB;;;;;EAOzB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,YAAY,EACZ,UAAU,EACV,eAAe,GAChB,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB,QAIA;AAED,wBAAsB,iBAAiB,qBAItC;AAED,wBAAsB,eAAe,0DA0BpC;AAED,wBAAsB,UAAU,kBAyB/B;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IACP,MAAM,EAAE,MAAM,CAAC;CAChB,iBAmBF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAmBA,iBAAS,iBAAiB;;;;;EAOzB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,YAAY,EACZ,UAAU,EACV,eAAe,GAChB,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB,QAIA;AAED,wBAAsB,iBAAiB,qBAItC;AAED,wBAAsB,eAAe,0DA0BpC;AAED,wBAAsB,UAAU,kBAyB/B;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IACP,MAAM,EAAE,MAAM,CAAC;CAChB,iBAmBF"}
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.updateSessionStatus = exports.getSessionDetails = exports.endSession = exports.getSessionState = exports.shouldStopSession = exports.setSessionDetails = void 0;
7
7
  const package_json_1 = __importDefault(require("../../package.json"));
8
+ const env_1 = require("../utils/env");
8
9
  const sessionDetails = {
9
10
  sessionId: undefined,
10
11
  version: package_json_1.default.version,
@@ -12,7 +13,7 @@ const sessionDetails = {
12
13
  testUrl: undefined,
13
14
  };
14
15
  const DASHBOARD_DOMAIN = process.env.DASHBOARD_DOMAIN ||
15
- (process.env.CI === "true" ? "https://dash.empirical.run" : "");
16
+ ((0, env_1.isRunningOnCloud)() ? "https://dash.empirical.run" : "");
16
17
  function getSessionDetails() {
17
18
  return {
18
19
  generationId: sessionDetails.generationId,
@@ -0,0 +1,2 @@
1
+ export declare function isRunningOnCloud(): boolean;
2
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/utils/env.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,YAE/B"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isRunningOnCloud = void 0;
4
+ function isRunningOnCloud() {
5
+ return process.env.CI === "true";
6
+ }
7
+ exports.isRunningOnCloud = isRunningOnCloud;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.43.3",
3
+ "version": "0.45.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -74,8 +74,8 @@
74
74
  "tsx": "^4.16.2",
75
75
  "typescript": "^5.3.3",
76
76
  "@empiricalrun/llm": "^0.9.35",
77
- "@empiricalrun/r2-uploader": "^0.3.8",
78
- "@empiricalrun/reporter": "^0.23.1"
77
+ "@empiricalrun/reporter": "^0.23.1",
78
+ "@empiricalrun/r2-uploader": "^0.3.8"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@playwright/test": "1.47.1",