@empiricalrun/test-gen 0.44.0 → 0.45.1

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 (59) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/actions/assert.d.ts +2 -2
  3. package/dist/actions/assert.d.ts.map +1 -1
  4. package/dist/actions/assert.js +1 -2
  5. package/dist/actions/click.d.ts +2 -2
  6. package/dist/actions/click.d.ts.map +1 -1
  7. package/dist/actions/click.js +1 -2
  8. package/dist/actions/done.d.ts +2 -2
  9. package/dist/actions/done.d.ts.map +1 -1
  10. package/dist/actions/fill.d.ts +2 -2
  11. package/dist/actions/fill.d.ts.map +1 -1
  12. package/dist/actions/fill.js +1 -2
  13. package/dist/actions/goto.d.ts +2 -2
  14. package/dist/actions/goto.d.ts.map +1 -1
  15. package/dist/actions/hover.d.ts +2 -2
  16. package/dist/actions/hover.d.ts.map +1 -1
  17. package/dist/actions/hover.js +3 -3
  18. package/dist/actions/index.d.ts +2 -2
  19. package/dist/actions/index.d.ts.map +1 -1
  20. package/dist/actions/index.js +8 -1
  21. package/dist/actions/press.d.ts +2 -2
  22. package/dist/actions/press.d.ts.map +1 -1
  23. package/dist/actions/skill.d.ts +5 -2
  24. package/dist/actions/skill.d.ts.map +1 -1
  25. package/dist/actions/skill.js +10 -3
  26. package/dist/actions/text-content.d.ts +3 -3
  27. package/dist/actions/text-content.d.ts.map +1 -1
  28. package/dist/actions/text-content.js +12 -13
  29. package/dist/agent/codegen/use-skill.d.ts +1 -0
  30. package/dist/agent/codegen/use-skill.d.ts.map +1 -1
  31. package/dist/agent/master/run.d.ts.map +1 -1
  32. package/dist/agent/master/run.js +22 -8
  33. package/dist/agent/planner/run-time-planner.d.ts +2 -9
  34. package/dist/agent/planner/run-time-planner.d.ts.map +1 -1
  35. package/dist/agent/planner/run-time-planner.js +9 -46
  36. package/dist/agent/planner/run.d.ts.map +1 -1
  37. package/dist/agent/planner/run.js +3 -4
  38. package/dist/errors/index.d.ts +5 -0
  39. package/dist/errors/index.d.ts.map +1 -0
  40. package/dist/errors/index.js +9 -0
  41. package/dist/file/client.d.ts +3 -1
  42. package/dist/file/client.d.ts.map +1 -1
  43. package/dist/file/client.js +9 -1
  44. package/dist/human-in-the-loop/index.d.ts +6 -4
  45. package/dist/human-in-the-loop/index.d.ts.map +1 -1
  46. package/dist/human-in-the-loop/index.js +12 -6
  47. package/dist/human-in-the-loop/ipc.d.ts.map +1 -1
  48. package/dist/human-in-the-loop/ipc.js +1 -2
  49. package/dist/index.d.ts +0 -1
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +1 -28
  52. package/dist/session/index.d.ts.map +1 -1
  53. package/dist/session/index.js +2 -1
  54. package/dist/types/index.d.ts +46 -5
  55. package/dist/types/index.d.ts.map +1 -1
  56. package/dist/utils/env.d.ts +2 -0
  57. package/dist/utils/env.d.ts.map +1 -0
  58. package/dist/utils/env.js +7 -0
  59. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.45.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 04db1a6: chore: better types for playwright action generators
8
+ - 1b1815d: chore: move runtime planner to handlebars
9
+ - 62800d7: fix: prevent sending test run events to sentry
10
+
11
+ ## 0.45.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 698ad31: feat: add approval in skill execute
16
+
17
+ ### Patch Changes
18
+
19
+ - 23f875f: fix: abstract the communication method of human in loop
20
+
3
21
  ## 0.44.0
4
22
 
5
23
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- import { PlaywrightActionGenerator } from "../types";
1
+ import { AssertTextVisibilityActionArgs, PlaywrightActionGenerator } from "../types";
2
2
  export declare const PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME = "assert_text_visibility";
3
- export declare const assertTextVisibilityActionGenerator: PlaywrightActionGenerator;
3
+ export declare const assertTextVisibilityActionGenerator: PlaywrightActionGenerator<AssertTextVisibilityActionArgs>;
4
4
  //# sourceMappingURL=assert.d.ts.map
@@ -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;AAIrD,eAAO,MAAM,6CAA6C,2BAChC,CAAC;AAE3B,eAAO,MAAM,mCAAmC,EAAE,yBAuDjD,CAAC"}
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/actions/assert.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,6CAA6C,2BAChC,CAAC;AAE3B,eAAO,MAAM,mCAAmC,EAAE,yBAAyB,CACzE,8BAA8B,CAqD/B,CAAC"}
@@ -14,8 +14,7 @@ const assertTextVisibilityActionGenerator = (page) => {
14
14
  locator,
15
15
  };
16
16
  },
17
- // TODO: args transformer to be kept at a single place
18
- template: (_, options) => {
17
+ template: (args, options) => {
19
18
  return {
20
19
  code: `await expect(${page.name}.${options.locator}).toBeVisible();`,
21
20
  };
@@ -1,4 +1,4 @@
1
- import { PlaywrightActionGenerator } from "../types";
1
+ import { ClickActionArgs, PlaywrightActionGenerator } from "../types";
2
2
  export declare const PLAYWRIGHT_CLICK_ACTION_NAME = "click_element";
3
- export declare const clickActionGenerator: PlaywrightActionGenerator;
3
+ export declare const clickActionGenerator: PlaywrightActionGenerator<ClickActionArgs>;
4
4
  //# sourceMappingURL=click.d.ts.map
@@ -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;AAIrD,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,yBAsDlC,CAAC"}
1
+ {"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../src/actions/click.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAItE,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,CAC1D,eAAe,CAsDhB,CAAC"}
@@ -15,8 +15,7 @@ const clickActionGenerator = (page) => {
15
15
  locator,
16
16
  };
17
17
  },
18
- // TODO: args transformer to be kept at a single place
19
- template: (_, options) => {
18
+ template: (args, options) => {
20
19
  return {
21
20
  code: `await ${page.name}.${options.locator}.click();`,
22
21
  };
@@ -1,4 +1,4 @@
1
- import { PlaywrightActionGenerator } from "../types";
1
+ import { BaseActionArgs, PlaywrightActionGenerator } from "../types";
2
2
  export declare const PLAYWRIGHT_DONE_ACTION_NAME = "task_done";
3
- export declare const doneActionGenerator: PlaywrightActionGenerator;
3
+ export declare const doneActionGenerator: PlaywrightActionGenerator<BaseActionArgs>;
4
4
  //# sourceMappingURL=done.d.ts.map
@@ -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;AAGrD,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,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrE,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CACzD,cAAc,CAwBf,CAAC"}
@@ -1,4 +1,4 @@
1
- import { PlaywrightActionGenerator } from "../types";
1
+ import { FillActionArgs, PlaywrightActionGenerator } from "../types";
2
2
  export declare const PLAYWRIGHT_FILL_ACTION_NAME = "fill_input_element";
3
- export declare const fillActionGenerator: PlaywrightActionGenerator;
3
+ export declare const fillActionGenerator: PlaywrightActionGenerator<FillActionArgs>;
4
4
  //# sourceMappingURL=fill.d.ts.map
@@ -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;AAIrD,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,mBAAmB,EAAE,yBAgGjC,CAAC"}
1
+ {"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../src/actions/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrE,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CAAC,cAAc,CA+FzE,CAAC"}
@@ -25,8 +25,7 @@ const fillActionGenerator = (page, options) => {
25
25
  testCaseLine,
26
26
  };
27
27
  },
28
- // TODO: args transformer to be kept at a single place
29
- template: (_, options) => {
28
+ template: (args, options) => {
30
29
  return {
31
30
  code: `await ${page.name}.${options.testCaseLine}`,
32
31
  };
@@ -1,4 +1,4 @@
1
- import { PlaywrightActionGenerator } from "../types";
1
+ import { GotoActionArgs, PlaywrightActionGenerator } from "../types";
2
2
  export declare const PLAYWRIGHT_GOTO_ACTION_NAME = "page_goto";
3
- export declare const gotoActionGenerator: PlaywrightActionGenerator;
3
+ export declare const gotoActionGenerator: PlaywrightActionGenerator<GotoActionArgs>;
4
4
  //# sourceMappingURL=goto.d.ts.map
@@ -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;AAGrD,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,yBAuCjC,CAAC"}
1
+ {"version":3,"file":"goto.d.ts","sourceRoot":"","sources":["../../src/actions/goto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrE,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CAAC,cAAc,CAyCzE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { PlaywrightActionGenerator } from "../types";
1
+ import { HoverActionArgs, PlaywrightActionGenerator } from "../types";
2
2
  export declare const PLAYWRIGHT_HOVER_ACTION_NAME = "hover_element";
3
- export declare const hoverActionGenerator: PlaywrightActionGenerator;
3
+ export declare const hoverActionGenerator: PlaywrightActionGenerator<HoverActionArgs>;
4
4
  //# sourceMappingURL=hover.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../src/actions/hover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,yBAqDlC,CAAC"}
1
+ {"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../src/actions/hover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAItE,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,CAC1D,eAAe,CAsDhB,CAAC"}
@@ -11,14 +11,14 @@ const hoverActionGenerator = (page) => {
11
11
  const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(selector, args.xpath, page.pwPageInstance, args?.elementAnnotation);
12
12
  const exec = new Function("page", `return page.${locator}.hover({ timeout: 3000 })`);
13
13
  await exec(page.pwPageInstance);
14
- await page.pwPageInstance.waitForTimeout(3000);
15
14
  return {
16
15
  locator,
17
16
  };
18
17
  },
19
- // TODO: args transformer to be kept at a single place
20
18
  template: (args, options) => {
21
- return { code: `await ${page.name}.${options.locator}.hover();` };
19
+ return {
20
+ code: `await ${page.name}.${options.locator}.hover();`,
21
+ };
22
22
  },
23
23
  name: exports.PLAYWRIGHT_HOVER_ACTION_NAME,
24
24
  schema: {
@@ -1,13 +1,13 @@
1
1
  import { TraceClient } from "@empiricalrun/llm";
2
2
  import { TestGenPage } from "../page";
3
- import { ActionSchema } from "../types";
3
+ import { ActionArgs, ActionSchema } from "../types";
4
4
  export declare class PlaywrightActions {
5
5
  private page;
6
6
  private stateVariables;
7
7
  private actionGenerators;
8
8
  private recordedActions;
9
9
  constructor(page: TestGenPage, stateVariables?: Record<string, any>);
10
- executeAction(name: string | undefined, args: Record<string, any>, trace?: TraceClient): Promise<string | undefined>;
10
+ executeAction(name: string | undefined, args: ActionArgs, trace?: TraceClient): Promise<string | undefined>;
11
11
  getBrowsingActionSchemas(): ActionSchema[];
12
12
  getMasterActionSchemas(): ActionSchema[];
13
13
  generateCode(): {
@@ -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,EAEL,UAAU,EACV,YAAY,EAEb,MAAM,UAAU,CAAC;AAWlB,qBAAa,iBAAiB;IAQ1B,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,cAAc;IARxB,OAAO,CAAC,gBAAgB,CAAwC;IAChE,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,UAAU,EAChB,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() {
@@ -1,4 +1,4 @@
1
- import { PlaywrightActionGenerator } from "../types";
1
+ import { PlaywrightActionGenerator, PressActionArgs } from "../types";
2
2
  export declare const PLAYWRIGHT_PRESS_ACTION_NAME = "keyboard_press_on_element";
3
- export declare const pressActionGenerator: PlaywrightActionGenerator;
3
+ export declare const pressActionGenerator: PlaywrightActionGenerator<PressActionArgs>;
4
4
  //# sourceMappingURL=press.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"press.d.ts","sourceRoot":"","sources":["../../src/actions/press.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,eAAO,MAAM,4BAA4B,8BAA8B,CAAC;AAExE,eAAO,MAAM,oBAAoB,EAAE,yBA4DlC,CAAC"}
1
+ {"version":3,"file":"press.d.ts","sourceRoot":"","sources":["../../src/actions/press.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAItE,eAAO,MAAM,4BAA4B,8BAA8B,CAAC;AAExE,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,CAC1D,eAAe,CA6DhB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { PlaywrightActionGenerator } from "../types";
1
+ import { PlaywrightActionGenerator, SkillActionArgs } from "../types";
2
2
  export declare const SKILL_USAGE = "skill_usage";
3
3
  export type Skill = {
4
4
  testStep: string;
@@ -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 const skillActionGenerator: PlaywrightActionGenerator;
16
+ export declare function extractSkillFromArgs(args: Record<string, any>): {
17
+ skillDetails: Skill | undefined;
18
+ };
19
+ export declare const skillActionGenerator: PlaywrightActionGenerator<SkillActionArgs>;
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,eAAe,EAAE,MAAM,UAAU,CAAC;AAGtE,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,yBAAyB,CAC1D,eAAe,CAkHhB,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,6 +23,13 @@ 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 {
@@ -30,7 +37,7 @@ const skillActionGenerator = (page, options) => {
30
37
  const { skill, action } = args;
31
38
  const [skillDetails] = availableSkills.filter((skillDetails) => skillDetails.testStep === skill);
32
39
  if (!skillDetails) {
33
- throw new Error(`No skill found for skill: ${skill}`);
40
+ throw new Error(`No skill found for ${skill}`);
34
41
  }
35
42
  const skillFilePath = skillDetails.filePath;
36
43
  // This assumes repoDir is process.cwd()
@@ -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,
@@ -78,7 +86,6 @@ const skillActionGenerator = (page, options) => {
78
86
  };
79
87
  },
80
88
  template: (args, options) => {
81
- // TODO: support for import statement
82
89
  const code = `${options.locator}`;
83
90
  const skill = args.skill;
84
91
  const [skillDetails] = availableSkills.filter((skillDetails) => skillDetails.testStep === skill);
@@ -1,4 +1,4 @@
1
- import { PlaywrightActionGenerator } from "../types";
2
- export declare const PLAYWRIGHT_GOTO_ACTION_NAME = "text_content";
3
- export declare const textContentActionGenerator: PlaywrightActionGenerator;
1
+ import { PlaywrightActionGenerator, TextContentActionArgs } from "../types";
2
+ export declare const PLAYWRIGHT_TEXT_CONTENT_ACTION_NAME = "text_content";
3
+ export declare const textContentActionGenerator: PlaywrightActionGenerator<TextContentActionArgs>;
4
4
  //# sourceMappingURL=text-content.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-content.d.ts","sourceRoot":"","sources":["../../src/actions/text-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,eAAO,MAAM,2BAA2B,iBAAiB,CAAC;AAE1D,eAAO,MAAM,0BAA0B,EAAE,yBA8DxC,CAAC"}
1
+ {"version":3,"file":"text-content.d.ts","sourceRoot":"","sources":["../../src/actions/text-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAI5E,eAAO,MAAM,mCAAmC,iBAAiB,CAAC;AAElE,eAAO,MAAM,0BAA0B,EAAE,yBAAyB,CAChE,qBAAqB,CA2DtB,CAAC"}
@@ -1,34 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textContentActionGenerator = exports.PLAYWRIGHT_GOTO_ACTION_NAME = void 0;
3
+ exports.textContentActionGenerator = exports.PLAYWRIGHT_TEXT_CONTENT_ACTION_NAME = void 0;
4
4
  const constants_1 = require("./constants");
5
5
  const utils_1 = require("./utils");
6
- exports.PLAYWRIGHT_GOTO_ACTION_NAME = "text_content";
6
+ exports.PLAYWRIGHT_TEXT_CONTENT_ACTION_NAME = "text_content";
7
7
  const textContentActionGenerator = (page, options) => {
8
8
  return {
9
- execute: async (args) => {
10
- const css = args.css_selector;
11
- const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(css, args.xpath, page.pwPageInstance, args?.elementAnnotation);
9
+ execute: async ({ args }) => {
10
+ const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(args.css_selector, args.xpath, page.pwPageInstance, args?.elementAnnotation);
12
11
  const exec = new Function("page", `return page.${locator}.textContent()`);
13
- const value = (await exec(page.pwPageInstance));
14
- if (options) {
15
- options.stateVariables[args.variable_name] = value;
16
- }
12
+ const textContent = await exec(page.pwPageInstance);
13
+ options.setStateVariables({
14
+ ...options.stateVariables,
15
+ [args.variable_name]: textContent,
16
+ });
17
17
  return {
18
18
  locator,
19
19
  };
20
20
  },
21
21
  template: (args, options) => {
22
- const code = `const ${args.variable_name} = await ${page.name}.${options.locator}.textContent();`;
23
22
  return {
24
- code,
23
+ code: `const ${args.variable_name} = await ${page.name}.${options.locator}.textContent();`,
25
24
  };
26
25
  },
27
- name: exports.PLAYWRIGHT_GOTO_ACTION_NAME,
26
+ name: exports.PLAYWRIGHT_TEXT_CONTENT_ACTION_NAME,
28
27
  schema: {
29
28
  type: "function",
30
29
  function: {
31
- name: exports.PLAYWRIGHT_GOTO_ACTION_NAME,
30
+ name: exports.PLAYWRIGHT_TEXT_CONTENT_ACTION_NAME,
32
31
  description: "extract text content of the element",
33
32
  parameters: {
34
33
  type: "object",
@@ -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");
@@ -111,7 +114,7 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
111
114
  const plannerResp = await (0, run_time_planner_1.runtimePlanner)({
112
115
  trace: masterAgentSpan,
113
116
  task,
114
- conversation: [...masterAgentActions],
117
+ successfulActions: [...masterAgentActions],
115
118
  pages: getPageVariables(actions.getStateVariables()),
116
119
  currentPage: (0, utils_1.getPageVarName)(),
117
120
  });
@@ -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,14 +1,7 @@
1
1
  import { TraceClient } from "@empiricalrun/llm";
2
- /**
3
- * This agent is used to divide the tasl into individual actions and then
4
- * compare each action against the actions listed in the conversation.
5
- * If the task is not fully completed, identify which specific actions are missing and suggest next steps to complete the task.
6
- *
7
- * This is very initial stage planner and needs iteration and currently forked from verification agent
8
- */
9
- export declare function runtimePlanner({ trace, task, conversation, pages, currentPage, }: {
2
+ export declare function runtimePlanner({ trace, task, successfulActions, pages, currentPage, }: {
10
3
  trace?: TraceClient;
11
- conversation: string[];
4
+ successfulActions: string[];
12
5
  task: string;
13
6
  pages?: Record<string, any>;
14
7
  currentPage?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"run-time-planner.d.ts","sourceRoot":"","sources":["../../../src/agent/planner/run-time-planner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKrD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,EACnC,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,WAAW,GACZ,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;GAkHA"}
1
+ {"version":3,"file":"run-time-planner.d.ts","sourceRoot":"","sources":["../../../src/agent/planner/run-time-planner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKpE,wBAAsB,cAAc,CAAC,EACnC,KAAK,EACL,IAAI,EACJ,iBAAiB,EACjB,KAAK,EACL,WAAW,GACZ,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;GAoFA"}
@@ -2,64 +2,27 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runtimePlanner = void 0;
4
4
  const llm_1 = require("@empiricalrun/llm");
5
+ const promptTemplate_0 = "{{#section \"system\"}}\nGiven a successfully executed actions that lists only the actions that were\nsuccessfully executed and a task comprising multiple actions, your goal is to\nanalyse the list and determine if the entire task is completed.\n\nThese actions are executed by AI agents using Playwright on a browser. These agents\nalready have access to browser tabs to execute actions. The successfully executed\nactions on browser post browser has opened, is provided to you as successfully\nexecuted actions.\n\nIf the task is not fully completed, identify which specific actions are missing\nand suggest next steps to complete the task. Assume that the conversation provided\nis entirely truthful and no additional actions were performed beyond those listed.\n\nTo fulfil your goal, follow these steps:\n- Divide the task into individual actions.\n- Compare each task action against the actions listed in the successfully executed actions list.\n- Identify which actions have been executed and which have not.\n- If all actions are executed, respond with the task as done.\n- If any actions are missing, respond with the task as not done, listing all actions\n and specifying which are complete and which are missing.\n- If provided with list of pages, based on the next pending action and previously executed\n action, identify the page on which next action needs to be taken \n{{/section}}\n\n{{#section \"user\"}}\nTask:\n{{task}}\n\n----\n\nFollowing are successfully executed actions:\n{{successfulActions}}\n\n----\n\nCurrent page:\n{{currentPage}}\n\n{{/section}}\n";
5
6
  const utils_1 = require("../utils");
6
- /**
7
- * This agent is used to divide the tasl into individual actions and then
8
- * compare each action against the actions listed in the conversation.
9
- * If the task is not fully completed, identify which specific actions are missing and suggest next steps to complete the task.
10
- *
11
- * This is very initial stage planner and needs iteration and currently forked from verification agent
12
- */
13
- async function runtimePlanner({ trace, task, conversation, pages, currentPage, }) {
7
+ async function runtimePlanner({ trace, task, successfulActions, pages, currentPage, }) {
14
8
  const runTimePlannerSpan = trace?.span({
15
9
  name: "runtime-planner",
16
10
  input: {
17
11
  task,
18
- conversation,
12
+ successfulActions,
13
+ currentPage,
19
14
  },
20
15
  });
21
16
  const llm = new llm_1.LLM({ provider: "openai" });
22
- const prompt = [
23
- {
24
- role: "system",
25
- content: `
26
- Given a successfully executed actions that lists only the actions that were successfully executed and a task comprising multiple actions, your goal is to analyse the list and determine if the entire task is completed.
27
- These actions are executed by AI agents using Playwright on a browser. These agents already have access to browser tabs to execute actions. The successfully executed actions on browser post browser has opened, is provided to you as successfully executed actions.
28
-
29
- If the task is not fully completed, identify which specific actions are missing and suggest next steps to complete the task. Assume that the conversation provided is entirely truthful and no additional actions were performed beyond those listed.
30
-
31
- To fulfil your goal, follow these steps:
32
- - Divide the task into individual actions.
33
- - Compare each task action against the actions listed in the successfully executed actions list.
34
- - Identify which actions have been executed and which have not.
35
- - If all actions are executed, respond with the task as done.
36
- - If any actions are missing, respond with the task as not done, listing all actions and specifying which are complete and which are missing.
37
- - If provided with list of pages, based on the next pending action and previously executed action, identify the page on which next action needs to be taken
38
- `,
39
- },
40
- {
41
- role: "user",
42
- content: `
43
- Task:
44
- ${task}
45
-
46
- ----
47
-
48
- Following are successfully executed actions:
49
- ${conversation.join("\n")}
50
-
51
- ----
52
-
53
- Current page:
54
- ${currentPage}
55
- `,
56
- },
57
- ];
58
17
  const response = await llm.createChatCompletion({
59
18
  trace: runTimePlannerSpan,
60
19
  traceName: "runtime-planner-llm",
61
20
  model: "gpt-4o",
62
- messages: prompt,
21
+ messages: (0, llm_1.compilePrompt)(promptTemplate_0, {
22
+ task,
23
+ successfulActions: successfulActions.join("\n"),
24
+ currentPage,
25
+ }),
63
26
  tools: [
64
27
  {
65
28
  type: "function",
@@ -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);
@@ -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;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import "./initSentry";
2
1
  import { Page } from "playwright";
3
2
  import { ScopeVars } from "./types";
4
3
  export declare function createTest(task: string, page: Page, scope?: ScopeVars): Promise<void>;
@@ -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":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOlC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAYpC,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,SAAS,iBAsC3E"}
package/dist/index.js CHANGED
@@ -1,35 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.createTest = void 0;
30
- require("./initSentry");
31
7
  const llm_1 = require("@empiricalrun/llm");
32
- const Sentry = __importStar(require("@sentry/node"));
33
8
  const run_1 = require("./agent/master/run");
34
9
  const scenarios_1 = require("./bin/utils/scenarios");
35
10
  const client_1 = __importDefault(require("./file/client"));
@@ -38,14 +13,12 @@ const session_1 = require("./session");
38
13
  const pw_test_1 = require("./utils/pw-test");
39
14
  const flushEvents = async () => {
40
15
  await (0, llm_1.flushAllTraces)();
41
- await Sentry.flush();
42
16
  };
43
17
  process.on("beforeExit", async () => await flushEvents());
44
18
  process.on("exit", async () => await flushEvents());
45
19
  process.on("SIGINT", async () => await flushEvents());
46
20
  process.on("SIGTERM", async () => await flushEvents());
47
21
  async function createTest(task, page, scope) {
48
- const port = process.env.APP_PORT || 3030;
49
22
  const testConfigArg = process.env.TEST_GEN_TOKEN;
50
23
  const testGenConfig = (0, scenarios_1.loadTestConfigs)(testConfigArg);
51
24
  (0, reporter_1.setReporterConfig)({
@@ -59,7 +32,7 @@ async function createTest(task, page, scope) {
59
32
  testCaseId: testGenConfig.testCase.id,
60
33
  projectRepoName: testGenConfig.options?.metadata.projectRepoName,
61
34
  });
62
- const fileService = new client_1.default(Number(port));
35
+ const fileService = new client_1.default();
63
36
  const { testCase, specPath } = testGenConfig;
64
37
  const { code, importPaths } = await (0, run_1.createTestUsingMasterAgent)({
65
38
  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,
@@ -1,22 +1,23 @@
1
1
  import { TraceClient } from "@empiricalrun/llm";
2
2
  import OpenAI from "openai";
3
3
  import { TestGenPage } from "../page";
4
- export type PlaywrightActionGenerator = (page: TestGenPage, options: {
4
+ export type { TestGenPage };
5
+ export type PlaywrightActionGenerator<T extends BaseActionArgs = ActionArgs> = (page: TestGenPage, options: {
5
6
  stateVariables: Record<string, any>;
6
7
  setStateVariables: (stateVariables: Record<string, any>) => void;
7
- }) => Action;
8
+ }) => Action<T>;
8
9
  export type ActionSchema = OpenAI.Chat.Completions.ChatCompletionTool;
9
- export type Action = {
10
+ export type Action<T extends BaseActionArgs = ActionArgs> = {
10
11
  name: string;
11
12
  schema: ActionSchema;
12
13
  execute: (options: {
13
- args: Record<string, any>;
14
+ args: T;
14
15
  trace?: TraceClient;
15
16
  }) => Promise<{
16
17
  locator: string;
17
18
  testCaseLine?: string;
18
19
  } | void>;
19
- template: (args: Record<string, any>, options: {
20
+ template: (args: T, options: {
20
21
  locator: string;
21
22
  testCaseLine?: string;
22
23
  }) => {
@@ -25,4 +26,44 @@ export type Action = {
25
26
  };
26
27
  };
27
28
  export type ScopeVars = Record<string, any>;
29
+ export type BaseActionArgs = {
30
+ reason: string;
31
+ elementAnnotation?: string;
32
+ };
33
+ export type ClickActionArgs = BaseActionArgs & {
34
+ xpath: string;
35
+ css_selector: string;
36
+ };
37
+ export type FillActionArgs = BaseActionArgs & {
38
+ text: string;
39
+ variable_name: string;
40
+ xpath: string;
41
+ css_selector: string;
42
+ };
43
+ export type GotoActionArgs = BaseActionArgs & {
44
+ url: string;
45
+ };
46
+ export type PressActionArgs = BaseActionArgs & {
47
+ key: string;
48
+ xpath: string;
49
+ css_selector: string;
50
+ };
51
+ export type AssertTextVisibilityActionArgs = BaseActionArgs & {
52
+ xpath: string;
53
+ css_selector: string;
54
+ };
55
+ export type TextContentActionArgs = BaseActionArgs & {
56
+ variable_name: string;
57
+ xpath: string;
58
+ css_selector: string;
59
+ };
60
+ export type HoverActionArgs = BaseActionArgs & {
61
+ xpath: string;
62
+ css_selector: string;
63
+ };
64
+ export type SkillActionArgs = BaseActionArgs & {
65
+ skill: string;
66
+ action: string;
67
+ };
68
+ export type ActionArgs = ClickActionArgs | FillActionArgs | GotoActionArgs | PressActionArgs | AssertTextVisibilityActionArgs | TextContentActionArgs | HoverActionArgs | SkillActionArgs;
28
69
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,MAAM,yBAAyB,GAAG,CACtC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE;IACP,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,iBAAiB,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;CAClE,KACE,MAAM,CAAC;AAEZ,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC;AAEtE,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,CAAC,OAAO,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1B,KAAK,CAAC,EAAE,WAAW,CAAC;KACrB,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACjE,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,KAChD;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,cAAc,GAAG,UAAU,IAAI,CAC7E,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE;IACP,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,iBAAiB,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;CAClE,KACE,MAAM,CAAC,CAAC,CAAC,CAAC;AAEf,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC;AAEtE,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,cAAc,GAAG,UAAU,IAAI;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,CAAC,OAAO,EAAE;QACjB,IAAI,EAAE,CAAC,CAAC;QACR,KAAK,CAAC,EAAE,WAAW,CAAC;KACrB,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACjE,QAAQ,EAAE,CACR,IAAI,EAAE,CAAC,EACP,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,KAChD;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,cAAc,GAAG;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,cAAc,GACd,cAAc,GACd,eAAe,GACf,8BAA8B,GAC9B,qBAAqB,GACrB,eAAe,GACf,eAAe,CAAC"}
@@ -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.44.0",
3
+ "version": "0.45.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -73,9 +73,9 @@
73
73
  "ts-morph": "^23.0.0",
74
74
  "tsx": "^4.16.2",
75
75
  "typescript": "^5.3.3",
76
+ "@empiricalrun/llm": "^0.9.35",
76
77
  "@empiricalrun/r2-uploader": "^0.3.8",
77
- "@empiricalrun/reporter": "^0.23.1",
78
- "@empiricalrun/llm": "^0.9.35"
78
+ "@empiricalrun/reporter": "^0.23.1"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@playwright/test": "1.47.1",