@empiricalrun/test-gen 0.57.2 → 0.59.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 (147) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/actions/index.d.ts.map +1 -1
  3. package/dist/actions/skill.js +2 -2
  4. package/dist/actions/utils/index.js +2 -3
  5. package/dist/agent/browsing/index.js +1 -2
  6. package/dist/agent/browsing/run.d.ts +3 -1
  7. package/dist/agent/browsing/run.d.ts.map +1 -1
  8. package/dist/agent/browsing/run.js +24 -27
  9. package/dist/agent/browsing/utils.d.ts +1 -14
  10. package/dist/agent/browsing/utils.d.ts.map +1 -1
  11. package/dist/agent/browsing/utils.js +10 -67
  12. package/dist/agent/chat/agent-loop.d.ts +6 -3
  13. package/dist/agent/chat/agent-loop.d.ts.map +1 -1
  14. package/dist/agent/chat/agent-loop.js +43 -27
  15. package/dist/agent/chat/exports.d.ts +7 -8
  16. package/dist/agent/chat/exports.d.ts.map +1 -1
  17. package/dist/agent/chat/exports.js +14 -34
  18. package/dist/agent/chat/index.d.ts +1 -1
  19. package/dist/agent/chat/index.d.ts.map +1 -1
  20. package/dist/agent/chat/index.js +20 -10
  21. package/dist/agent/chat/models.d.ts +6 -0
  22. package/dist/agent/chat/models.d.ts.map +1 -0
  23. package/dist/agent/chat/models.js +37 -0
  24. package/dist/agent/chat/prompt.d.ts +2 -1
  25. package/dist/agent/chat/prompt.d.ts.map +1 -1
  26. package/dist/agent/chat/prompt.js +40 -12
  27. package/dist/agent/chat/repo.d.ts +2 -1
  28. package/dist/agent/chat/repo.d.ts.map +1 -1
  29. package/dist/agent/chat/repo.js +32 -36
  30. package/dist/agent/chat/state.d.ts +15 -7
  31. package/dist/agent/chat/state.d.ts.map +1 -1
  32. package/dist/agent/chat/state.js +95 -32
  33. package/dist/agent/chat/types.d.ts +0 -1
  34. package/dist/agent/chat/types.d.ts.map +1 -1
  35. package/dist/agent/codegen/create-test-block.js +1 -2
  36. package/dist/agent/codegen/fix-ts-errors.js +1 -2
  37. package/dist/agent/codegen/generate-code-apply-changes.js +2 -3
  38. package/dist/agent/codegen/lexical-scoped-vars.js +1 -2
  39. package/dist/agent/codegen/repo-edit.js +2 -3
  40. package/dist/agent/codegen/run.js +2 -3
  41. package/dist/agent/codegen/skills-retriever.d.ts +3 -3
  42. package/dist/agent/codegen/skills-retriever.d.ts.map +1 -1
  43. package/dist/agent/codegen/skills-retriever.js +2 -2
  44. package/dist/agent/codegen/test-update-feedback.js +1 -2
  45. package/dist/agent/codegen/update-flow.js +4 -5
  46. package/dist/agent/codegen/use-skill.js +1 -2
  47. package/dist/agent/codegen/utils.js +9 -10
  48. package/dist/agent/cua/computer.js +3 -4
  49. package/dist/agent/cua/index.js +2 -3
  50. package/dist/agent/cua/model.js +1 -2
  51. package/dist/agent/diagnosis-agent/index.js +2 -3
  52. package/dist/agent/diagnosis-agent/strict-mode-violation.js +1 -2
  53. package/dist/agent/enrich-prompt/index.d.ts +1 -1
  54. package/dist/agent/enrich-prompt/index.d.ts.map +1 -1
  55. package/dist/agent/enrich-prompt/utils.js +1 -2
  56. package/dist/agent/infer-agent/index.js +1 -2
  57. package/dist/agent/master/action-tool-calls.js +3 -3
  58. package/dist/agent/master/browser-tests/index.spec.js +6 -6
  59. package/dist/agent/master/element-annotation.js +2 -3
  60. package/dist/agent/master/execute-browser-action.d.ts +1 -1
  61. package/dist/agent/master/execute-browser-action.d.ts.map +1 -1
  62. package/dist/agent/master/execute-browser-action.js +1 -2
  63. package/dist/agent/master/execute-skill-action.js +1 -2
  64. package/dist/agent/master/icon-descriptor/index.js +6 -7
  65. package/dist/agent/master/icon-descriptor/normalize-svg.js +1 -2
  66. package/dist/agent/master/next-action.js +1 -2
  67. package/dist/agent/master/planner.d.ts.map +1 -1
  68. package/dist/agent/master/planner.js +1 -2
  69. package/dist/agent/master/run.js +3 -3
  70. package/dist/agent/master/scroller.js +1 -2
  71. package/dist/agent/master/with-hints.d.ts +1 -1
  72. package/dist/agent/master/with-hints.d.ts.map +1 -1
  73. package/dist/agent/planner/run-time-planner.d.ts.map +1 -1
  74. package/dist/agent/planner/run-time-planner.js +1 -2
  75. package/dist/agent/planner/run.js +1 -2
  76. package/dist/bin/index.js +4 -0
  77. package/dist/bin/logger/index.js +2 -2
  78. package/dist/bin/utils/context.js +5 -6
  79. package/dist/bin/utils/fs/index.d.ts.map +1 -1
  80. package/dist/bin/utils/fs/index.js +4 -5
  81. package/dist/bin/utils/index.d.ts +1 -0
  82. package/dist/bin/utils/index.d.ts.map +1 -1
  83. package/dist/bin/utils/index.js +2 -3
  84. package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
  85. package/dist/bin/utils/platform/web/index.js +21 -21
  86. package/dist/bin/utils/scenarios/index.js +3 -4
  87. package/dist/constants/index.js +1 -1
  88. package/dist/file/server.js +2 -2
  89. package/dist/human-in-the-loop/cli.js +1 -2
  90. package/dist/human-in-the-loop/ipc.js +2 -3
  91. package/dist/index.d.ts +1 -0
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +4 -2
  94. package/dist/prompts/lib/ts-transformer.js +17 -7
  95. package/dist/reporter/index.js +3 -3
  96. package/dist/reporter/lib.js +1 -1
  97. package/dist/session/index.js +6 -7
  98. package/dist/test-build/index.js +3 -4
  99. package/dist/tool-call-service/index.d.ts +3 -3
  100. package/dist/tool-call-service/index.d.ts.map +1 -1
  101. package/dist/tool-call-service/index.js +51 -71
  102. package/dist/tool-call-service/utils.d.ts +10 -0
  103. package/dist/tool-call-service/utils.d.ts.map +1 -0
  104. package/dist/tool-call-service/utils.js +23 -0
  105. package/dist/tools/commit-and-create-pr.js +2 -2
  106. package/dist/tools/download-build.d.ts +9 -0
  107. package/dist/tools/download-build.d.ts.map +1 -1
  108. package/dist/tools/download-build.js +5 -4
  109. package/dist/tools/grep/ripgrep/index.js +2 -3
  110. package/dist/tools/grep/ripgrep/types.d.ts +0 -2
  111. package/dist/tools/grep/ripgrep/types.d.ts.map +1 -1
  112. package/dist/tools/str_replace_editor.js +3 -3
  113. package/dist/tools/test-gen-browser.d.ts.map +1 -1
  114. package/dist/tools/test-gen-browser.js +8 -13
  115. package/dist/tools/test-run-fetcher/index.js +2 -2
  116. package/dist/tools/test-run.d.ts.map +1 -1
  117. package/dist/tools/test-run.js +8 -13
  118. package/dist/tools/utils/index.js +2 -3
  119. package/dist/types/index.d.ts +8 -0
  120. package/dist/types/index.d.ts.map +1 -1
  121. package/dist/uploader/index.js +6 -6
  122. package/dist/uploader/utils.d.ts.map +1 -1
  123. package/dist/uploader/utils.js +2 -2
  124. package/dist/utils/checkpoint.d.ts.map +1 -1
  125. package/dist/utils/checkpoint.js +4 -3
  126. package/dist/utils/env.js +1 -2
  127. package/dist/utils/exec.d.ts +2 -2
  128. package/dist/utils/exec.d.ts.map +1 -1
  129. package/dist/utils/exec.js +7 -6
  130. package/dist/utils/file-tree.d.ts +3 -0
  131. package/dist/utils/file-tree.d.ts.map +1 -0
  132. package/dist/utils/file-tree.js +42 -0
  133. package/dist/utils/file.js +1 -2
  134. package/dist/utils/git.js +7 -8
  135. package/dist/utils/html.d.ts.map +1 -1
  136. package/dist/utils/pw-test.js +1 -2
  137. package/dist/utils/repo-tree.d.ts +2 -1
  138. package/dist/utils/repo-tree.d.ts.map +1 -1
  139. package/dist/utils/repo-tree.js +62 -53
  140. package/dist/utils/slug.d.ts.map +1 -1
  141. package/dist/utils/slug.js +1 -1
  142. package/dist/utils/string.js +1 -2
  143. package/package.json +5 -5
  144. package/tsconfig.tsbuildinfo +1 -0
  145. package/dist/agent/chat/model.d.ts +0 -4
  146. package/dist/agent/chat/model.d.ts.map +0 -1
  147. package/dist/agent/chat/model.js +0 -17
@@ -3,7 +3,12 @@ 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.getIconDescription = exports.createNodeFromHTML = exports.reverseKey = exports.generateKey = exports.saveIconsKnowledge = exports.loadIconsKnowledge = void 0;
6
+ exports.loadIconsKnowledge = loadIconsKnowledge;
7
+ exports.saveIconsKnowledge = saveIconsKnowledge;
8
+ exports.generateKey = generateKey;
9
+ exports.reverseKey = reverseKey;
10
+ exports.createNodeFromHTML = createNodeFromHTML;
11
+ exports.getIconDescription = getIconDescription;
7
12
  const llm_1 = require("@empiricalrun/llm");
8
13
  const fs_1 = __importDefault(require("fs"));
9
14
  const jsdom_1 = require("jsdom");
@@ -58,7 +63,6 @@ function loadIconsKnowledge() {
58
63
  }
59
64
  return [];
60
65
  }
61
- exports.loadIconsKnowledge = loadIconsKnowledge;
62
66
  async function saveIconsKnowledge(iconsData) {
63
67
  // Ensure the directory exists
64
68
  if (!fs_1.default.existsSync(EMPIRICAL_RUN_DIR)) {
@@ -71,19 +75,16 @@ async function saveIconsKnowledge(iconsData) {
71
75
  fs_1.default.unlinkSync(OLD_ICONS_KNOWLEDGE_PATH);
72
76
  }
73
77
  }
74
- exports.saveIconsKnowledge = saveIconsKnowledge;
75
78
  function generateKey(htmlString) {
76
79
  const normalized = (0, normalize_svg_1.normalizeSVG)(htmlString);
77
80
  // generate base64 string
78
81
  const encoded = Buffer.from(normalized).toString("base64");
79
82
  return `icon_${encoded}`;
80
83
  }
81
- exports.generateKey = generateKey;
82
84
  function reverseKey(hash) {
83
85
  const encoded = hash.replace(/^icon_/, "");
84
86
  return Buffer.from(encoded, "base64").toString();
85
87
  }
86
- exports.reverseKey = reverseKey;
87
88
  function createNodeFromHTML(htmlString) {
88
89
  const dom = new jsdom_1.JSDOM(htmlString);
89
90
  const document = dom.window.document;
@@ -93,7 +94,6 @@ function createNodeFromHTML(htmlString) {
93
94
  descendant: node ? Array.from(node.querySelectorAll("*")) : [], // Convert HTMLCollection to array
94
95
  };
95
96
  }
96
- exports.createNodeFromHTML = createNodeFromHTML;
97
97
  function processSvgWithUseElements(svgElement, document) {
98
98
  try {
99
99
  const useElements = svgElement.querySelectorAll("use");
@@ -247,4 +247,3 @@ async function getIconDescription({ htmlString, pageHtml, trace, }) {
247
247
  }
248
248
  return description;
249
249
  }
250
- exports.getIconDescription = getIconDescription;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeSVG = void 0;
3
+ exports.normalizeSVG = normalizeSVG;
4
4
  const jsdom_1 = require("jsdom");
5
5
  function normalizeSVG(svgHtml) {
6
6
  // Parse the SVG HTML into a DOM structure using JSDOM
@@ -25,7 +25,6 @@ function normalizeSVG(svgHtml) {
25
25
  // Return the normalized SVG string
26
26
  return svgElement.outerHTML;
27
27
  }
28
- exports.normalizeSVG = normalizeSVG;
29
28
  /**
30
29
  * Normalizes whitespace in SVG element
31
30
  * @param element - The element to normalize
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNextAction = void 0;
3
+ exports.getNextAction = getNextAction;
4
4
  const llm_1 = require("@empiricalrun/llm");
5
5
  const skill_1 = require("../../actions/skill");
6
6
  const constants_1 = require("../../constants");
@@ -100,4 +100,3 @@ async function getNextAction({ page, pageScreenshot, task, executedActions, fail
100
100
  };
101
101
  }
102
102
  }
103
- exports.getNextAction = getNextAction;
@@ -1 +1 @@
1
- {"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../../src/agent/master/planner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAIvC,wBAAsB,4BAA4B,CAAC,EACjD,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,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,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;GAwIA"}
1
+ {"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../../src/agent/master/planner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAIvC,wBAAsB,4BAA4B,CAAC,EACjD,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,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,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;cAsHoC,MAAM;YACV,OAAO;YACP,MAAM;GAgBtC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runtimePlannerWithScreenshot = void 0;
3
+ exports.runtimePlannerWithScreenshot = runtimePlannerWithScreenshot;
4
4
  const llm_1 = require("@empiricalrun/llm");
5
5
  const vision_1 = require("@empiricalrun/llm/vision");
6
6
  const constants_1 = require("../../constants");
@@ -140,4 +140,3 @@ async function runtimePlannerWithScreenshot({ trace, task, conversation, pages,
140
140
  });
141
141
  return output;
142
142
  }
143
- exports.runtimePlannerWithScreenshot = runtimePlannerWithScreenshot;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createTestUsingMasterAgent = exports.IS_ALLOWED_TO_USE_SKILLS = exports.createTestUsingComputerUseAgent = void 0;
3
+ exports.IS_ALLOWED_TO_USE_SKILLS = exports.createTestUsingComputerUseAgent = void 0;
4
+ exports.createTestUsingMasterAgent = createTestUsingMasterAgent;
4
5
  const llm_1 = require("@empiricalrun/llm");
5
6
  const actions_1 = require("../../actions");
6
7
  const skill_1 = require("../../actions/skill");
@@ -68,7 +69,7 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
68
69
  defaultModel: options.model || constants_1.DEFAULT_MODEL,
69
70
  providerApiKey: constants_1.MODEL_API_KEYS[options.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER],
70
71
  // we will be using google model for larger context window, in such cases 1 million tokens is not enough
71
- maxTokens: options.modelProvider === "google" ? 3000000 : 1000000,
72
+ maxTokens: options.modelProvider === "google" ? 3_000_000 : 1_000_000,
72
73
  });
73
74
  let skills = [];
74
75
  if (testCase && exports.IS_ALLOWED_TO_USE_SKILLS) {
@@ -274,4 +275,3 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
274
275
  importPaths,
275
276
  };
276
277
  }
277
- exports.createTestUsingMasterAgent = createTestUsingMasterAgent;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scroller = void 0;
3
+ exports.scroller = scroller;
4
4
  const llm_1 = require("@empiricalrun/llm");
5
5
  const vision_1 = require("@empiricalrun/llm/vision");
6
6
  const constants_1 = require("../../constants");
@@ -371,4 +371,3 @@ async function scroller({ elementDescription, page, trace, frameReference, logge
371
371
  await (0, llm_1.flushAllTraces)();
372
372
  return referenceImages;
373
373
  }
374
- exports.scroller = scroller;
@@ -9,7 +9,7 @@ export declare const triggerHintsFlow: ({ outputFromGetNextAction, generatedAnno
9
9
  generatedAnnotations: Record<string, any>;
10
10
  actions: PlaywrightActions;
11
11
  llm: LLM;
12
- trace?: TraceClient | undefined;
12
+ trace?: TraceClient;
13
13
  }) => Promise<{
14
14
  shouldTriggerHintsFlow: boolean;
15
15
  hintsExecutionCompletion: OpenAI.ChatCompletionMessage | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"with-hints.d.ts","sourceRoot":"","sources":["../../../src/agent/master/with-hints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOlD,eAAO,MAAM,gBAAgB;6BAOF;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B;0BACqB,OAAO,MAAM,EAAE,GAAG,CAAC;aAChC,iBAAiB;SACrB,GAAG;;MAEN,QAAQ;IACV,sBAAsB,EAAE,OAAO,CAAC;IAChC,wBAAwB,EAAE,OAAO,qBAAqB,GAAG,SAAS,CAAC;CACpE,CAyGA,CAAC"}
1
+ {"version":3,"file":"with-hints.d.ts","sourceRoot":"","sources":["../../../src/agent/master/with-hints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOlD,eAAO,MAAM,gBAAgB,GAAU,yEAMpC;IACD,uBAAuB,EAAE;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1C,OAAO,EAAE,iBAAiB,CAAC;IAC3B,GAAG,EAAE,GAAG,CAAC;IACT,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,KAAG,OAAO,CAAC;IACV,sBAAsB,EAAE,OAAO,CAAC;IAChC,wBAAwB,EAAE,MAAM,CAAC,qBAAqB,GAAG,SAAS,CAAC;CACpE,CAyGA,CAAC"}
@@ -1 +1 @@
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;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,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,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5B,WAAW,EAAE,WAAW,CAAC;CAC1B;;;;GA+FA"}
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;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,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,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5B,WAAW,EAAE,WAAW,CAAC;CAC1B;cA6EoC,MAAM;YACV,OAAO;YACP,MAAM;GAgBtC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runtimePlanner = void 0;
3
+ exports.runtimePlanner = runtimePlanner;
4
4
  const llm_1 = require("@empiricalrun/llm");
5
5
  const promptTemplate_0 = "{{#section \"system\"}}\nYou are given a list of successfully executed actions that are done towards completing a task (which\nis also provided to you). Your goal is to analyse the list and determine if the task is completed.\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\nThese actions were executed by AI agents using Playwright on a browser. These agents\nalready have access to browser tabs to execute actions. If there is a pending action,\none of the agents will execute it in the browser. However, they need your help to\nchoose which browser tab (= page) to use for the next action.\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\nSuccessfully executed actions:\n{{successfulActions}}\n\n----\n\nList of pages with their current URLs:\n{{pagesSummary}}\n\n\n{{/section}}\n";
6
6
  async function runtimePlanner({ trace, task, successfulActions, pages, currentPage, }) {
@@ -96,4 +96,3 @@ async function runtimePlanner({ trace, task, successfulActions, pages, currentPa
96
96
  });
97
97
  return output;
98
98
  }
99
- exports.runtimePlanner = runtimePlanner;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.planTask = void 0;
3
+ exports.planTask = planTask;
4
4
  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");
@@ -124,4 +124,3 @@ ${pomPrompt}
124
124
  });
125
125
  return "";
126
126
  }
127
- exports.planTask = planTask;
package/dist/bin/index.js CHANGED
@@ -185,6 +185,8 @@ async function runAgentsWorkflow(testGenConfig, testGenToken) {
185
185
  status: "agent_live_session_started",
186
186
  });
187
187
  const { isError, error } = await (0, run_1.generateTestsUsingMasterAgent)({
188
+ testCaseName: testCase.name,
189
+ testCaseSuites: testCase.suites,
188
190
  testFilePath: specPath,
189
191
  filePathToUpdate,
190
192
  pwProjectsFilter: testGenConfig.environment?.playwrightProjects,
@@ -213,6 +215,7 @@ async function main() {
213
215
  .option("--use-disk-for-chat-state", "Save and load chat state from disk")
214
216
  .option("--chat-model <model>", "Chat model to use (claude-3-7-sonnet-20250219 or claude-3-5-sonnet-20241022 or gemini-2.5-pro-preview-03-25)")
215
217
  .option("--initial-prompt <path>", "Path to an initial prompt file (e.g. prompt.md)")
218
+ .option("--use-transform", "Use the new message transform strategy")
216
219
  .parse(process.argv);
217
220
  const options = program.opts();
218
221
  const completedOptions = await (0, utils_2.validateAndCompleteCliOptions)(options);
@@ -243,6 +246,7 @@ async function main() {
243
246
  modelInput: completedOptions.chatModel,
244
247
  useDiskForChatState: completedOptions.useDiskForChatState,
245
248
  initialPromptPath: completedOptions.initialPrompt,
249
+ useTransform: completedOptions.useTransform,
246
250
  });
247
251
  return;
248
252
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.waitForLogsToFlush = exports.CustomLogger = void 0;
3
+ exports.CustomLogger = void 0;
4
+ exports.waitForLogsToFlush = waitForLogsToFlush;
4
5
  const picocolors_1 = require("picocolors");
5
6
  const reporter_1 = require("../../reporter");
6
7
  const lib_1 = require("../../reporter/lib");
@@ -54,4 +55,3 @@ async function waitForLogsToFlush() {
54
55
  return Promise.resolve();
55
56
  }
56
57
  }
57
- exports.waitForLogsToFlush = waitForLogsToFlush;
@@ -3,7 +3,11 @@ 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.fetchAppKnowledge = exports.generateTxtForRepository = exports.createRepoEditFilter = exports.contextForGeneration = exports.createGitIgnoreFileFilter = void 0;
6
+ exports.createGitIgnoreFileFilter = createGitIgnoreFileFilter;
7
+ exports.contextForGeneration = contextForGeneration;
8
+ exports.createRepoEditFilter = createRepoEditFilter;
9
+ exports.generateTxtForRepository = generateTxtForRepository;
10
+ exports.fetchAppKnowledge = fetchAppKnowledge;
7
11
  const fs_1 = __importDefault(require("fs"));
8
12
  const ignore_1 = __importDefault(require("ignore"));
9
13
  const fs_2 = require("./fs");
@@ -23,7 +27,6 @@ package-lock.json
23
27
  const filter = ignoreFn.createFilter();
24
28
  return filter;
25
29
  }
26
- exports.createGitIgnoreFileFilter = createGitIgnoreFileFilter;
27
30
  async function contextForGeneration(file) {
28
31
  const filter = await createGitIgnoreFileFilter();
29
32
  return {
@@ -33,7 +36,6 @@ async function contextForGeneration(file) {
33
36
  testFileContent: file ? fs_1.default.readFileSync(file, "utf-8") : "",
34
37
  };
35
38
  }
36
- exports.contextForGeneration = contextForGeneration;
37
39
  async function createRepoEditFilter() {
38
40
  const allowedExtensions = /\.(ts|js|mjs|json|md)$/i;
39
41
  const gitIgnoreFilter = await createGitIgnoreFileFilter();
@@ -42,14 +44,12 @@ async function createRepoEditFilter() {
42
44
  (fs_1.default.statSync(filePath).isDirectory() || allowedExtensions.test(filePath)));
43
45
  };
44
46
  }
45
- exports.createRepoEditFilter = createRepoEditFilter;
46
47
  async function generateTxtForRepository() {
47
48
  const filter = await createRepoEditFilter();
48
49
  return {
49
50
  prompt: await (0, fs_2.generatePromptFromDirectory)(".", filter),
50
51
  };
51
52
  }
52
- exports.generateTxtForRepository = generateTxtForRepository;
53
53
  async function fetchAppKnowledge() {
54
54
  let fileExists = true;
55
55
  const appKnowledgePath = "./app_knowledge.md";
@@ -64,4 +64,3 @@ async function fetchAppKnowledge() {
64
64
  }
65
65
  return fs_1.default.readFileSync(appKnowledgePath, "utf-8");
66
66
  }
67
- exports.fetchAppKnowledge = fetchAppKnowledge;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/utils/fs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI9D,wBAAsB,oBAAoB,CACxC,GAAG,oBAAa,EAChB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,0BAgBtC;AAED,wBAAgB,2BAA2B,CAAC,KAAK,GAAE,WAAW,EAAO,UAQpE;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,oBAAK,EACR,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,+BAStC;AAED,wBAAsB,8BAA8B,CAClD,GAAG,oBAAa,EAChB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,+BAgBtC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/utils/fs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI9D,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,MAAM,YAAK,EAChB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,0BAgBtC;AAED,wBAAgB,2BAA2B,CAAC,KAAK,GAAE,WAAW,EAAO,UAQpE;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,oBAAK,EACR,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,+BAStC;AAED,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,MAAM,YAAK,EAChB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,+BAgBtC"}
@@ -3,7 +3,10 @@ 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.generatePromptFromNonSpecFiles = exports.generatePromptFromDirectory = exports.convertFileContentsToString = exports.readFilesInDirectory = void 0;
6
+ exports.readFilesInDirectory = readFilesInDirectory;
7
+ exports.convertFileContentsToString = convertFileContentsToString;
8
+ exports.generatePromptFromDirectory = generatePromptFromDirectory;
9
+ exports.generatePromptFromNonSpecFiles = generatePromptFromNonSpecFiles;
7
10
  const fs_1 = __importDefault(require("fs"));
8
11
  const path_1 = __importDefault(require("path"));
9
12
  async function readFilesInDirectory(dir = "", filterFunc) {
@@ -22,7 +25,6 @@ async function readFilesInDirectory(dir = "", filterFunc) {
22
25
  }
23
26
  return files;
24
27
  }
25
- exports.readFilesInDirectory = readFilesInDirectory;
26
28
  function convertFileContentsToString(files = []) {
27
29
  let prompt = "";
28
30
  files.forEach((file) => {
@@ -32,7 +34,6 @@ function convertFileContentsToString(files = []) {
32
34
  });
33
35
  return prompt;
34
36
  }
35
- exports.convertFileContentsToString = convertFileContentsToString;
36
37
  async function generatePromptFromDirectory(dir = "", filterFunc) {
37
38
  try {
38
39
  const files = await readFilesInDirectory(dir, filterFunc);
@@ -43,7 +44,6 @@ async function generatePromptFromDirectory(dir = "", filterFunc) {
43
44
  console.error("Error reading directory:", error);
44
45
  }
45
46
  }
46
- exports.generatePromptFromDirectory = generatePromptFromDirectory;
47
47
  async function generatePromptFromNonSpecFiles(dir = "", filterFunc) {
48
48
  try {
49
49
  let nonSpecFiles = [];
@@ -60,4 +60,3 @@ async function generatePromptFromNonSpecFiles(dir = "", filterFunc) {
60
60
  console.error("Error reading directory:", error);
61
61
  }
62
62
  }
63
- exports.generatePromptFromNonSpecFiles = generatePromptFromNonSpecFiles;
@@ -9,6 +9,7 @@ export interface CliOptions {
9
9
  initialPrompt?: string;
10
10
  chatSessionId?: string;
11
11
  chatModel?: "claude-3-7" | "claude-3-5" | "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-20241022" | "gemini-2.5-pro" | "gemini-2.5-pro-preview-03-25" | "o4-mini" | "o4-mini-2025-04-16";
12
+ useTransform?: boolean;
12
13
  }
13
14
  export declare function validateAndCompleteCliOptions(options: CliOptions): Promise<CliOptions>;
14
15
  export declare function printBanner(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EACN,YAAY,GACZ,YAAY,GACZ,4BAA4B,GAC5B,4BAA4B,GAC5B,gBAAgB,GAChB,8BAA8B,GAC9B,SAAS,GACT,oBAAoB,CAAC;CAC1B;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAyDrB;AAED,wBAAgB,WAAW,SAgC1B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EACN,YAAY,GACZ,YAAY,GACZ,4BAA4B,GAC5B,4BAA4B,GAC5B,gBAAgB,GAChB,8BAA8B,GAC9B,SAAS,GACT,oBAAoB,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAyDrB;AAED,wBAAgB,WAAW,SAgC1B"}
@@ -3,7 +3,8 @@ 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.printBanner = exports.validateAndCompleteCliOptions = void 0;
6
+ exports.validateAndCompleteCliOptions = validateAndCompleteCliOptions;
7
+ exports.printBanner = printBanner;
7
8
  const inquirer_1 = __importDefault(require("inquirer"));
8
9
  async function validateAndCompleteCliOptions(options) {
9
10
  // For existing flow between dashboard <> test-gen (via ci-worker)
@@ -60,7 +61,6 @@ async function validateAndCompleteCliOptions(options) {
60
61
  }
61
62
  return options;
62
63
  }
63
- exports.validateAndCompleteCliOptions = validateAndCompleteCliOptions;
64
64
  function printBanner() {
65
65
  const gray = "\x1b[90m";
66
66
  const reset = "\x1b[0m";
@@ -96,4 +96,3 @@ function printBanner() {
96
96
  }
97
97
  });
98
98
  }
99
- exports.printBanner = printBanner;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAK3D,OAAO,EAGL,IAAI,EAEJ,UAAU,EAEX,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,gCAAgC,eAC/B,UAAU,KACrB,MAgBF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,MAAM,EACN,OAAO,GACR,EAAE;I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AAM,GAAG,OAAO,CAQnD"}
@@ -3,7 +3,27 @@ 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.isSyntaxValid = exports.getVariableDeclarationsFromCode = exports.buildTestNamePrompt = exports.isTestPresent = exports.appendScopeToCreateTest = exports.addUserContextFixture = exports.importAllExportsStmtFromFilePaths = exports.injectCodeSnippetBySuiteChain = exports.replaceCreateTestWithNewCode = exports.getPageVariableNameFromCreateTest = exports.getFixtureImportPath = exports.removeTestOnly = exports.addNewImport = exports.formatCode = exports.lintErrors = exports.stripAndPrependImports = exports.validateTypescript = exports.appendToTestBlock = exports.findFirstSerialDescribeBlock = exports.hasTopLevelDescribeConfigureWithSerialMode = exports.hasTestBlock = exports.getTypescriptTestBlock = exports.getTestModuleAliasFromSourceFile = void 0;
6
+ exports.importAllExportsStmtFromFilePaths = exports.injectCodeSnippetBySuiteChain = exports.getTestModuleAliasFromSourceFile = void 0;
7
+ exports.getTypescriptTestBlock = getTypescriptTestBlock;
8
+ exports.hasTestBlock = hasTestBlock;
9
+ exports.hasTopLevelDescribeConfigureWithSerialMode = hasTopLevelDescribeConfigureWithSerialMode;
10
+ exports.findFirstSerialDescribeBlock = findFirstSerialDescribeBlock;
11
+ exports.appendToTestBlock = appendToTestBlock;
12
+ exports.validateTypescript = validateTypescript;
13
+ exports.stripAndPrependImports = stripAndPrependImports;
14
+ exports.lintErrors = lintErrors;
15
+ exports.formatCode = formatCode;
16
+ exports.addNewImport = addNewImport;
17
+ exports.removeTestOnly = removeTestOnly;
18
+ exports.getFixtureImportPath = getFixtureImportPath;
19
+ exports.getPageVariableNameFromCreateTest = getPageVariableNameFromCreateTest;
20
+ exports.replaceCreateTestWithNewCode = replaceCreateTestWithNewCode;
21
+ exports.addUserContextFixture = addUserContextFixture;
22
+ exports.appendScopeToCreateTest = appendScopeToCreateTest;
23
+ exports.isTestPresent = isTestPresent;
24
+ exports.buildTestNamePrompt = buildTestNamePrompt;
25
+ exports.getVariableDeclarationsFromCode = getVariableDeclarationsFromCode;
26
+ exports.isSyntaxValid = isSyntaxValid;
7
27
  const parser_1 = require("@babel/parser");
8
28
  const eslint_1 = require("eslint");
9
29
  const fs_1 = __importDefault(require("fs"));
@@ -71,7 +91,6 @@ function getTypescriptTestBlock({ scenarioName, suites, content, }) {
71
91
  testAlias,
72
92
  };
73
93
  }
74
- exports.getTypescriptTestBlock = getTypescriptTestBlock;
75
94
  function hasTestBlock({ testName, testSuites, filePath, }) {
76
95
  if (!fs_1.default.existsSync(filePath)) {
77
96
  return false;
@@ -83,7 +102,6 @@ function hasTestBlock({ testName, testSuites, filePath, }) {
83
102
  });
84
103
  return Boolean(testBlock);
85
104
  }
86
- exports.hasTestBlock = hasTestBlock;
87
105
  // get the names of parent describe blocks
88
106
  function getParentDescribeNames(node) {
89
107
  const names = [];
@@ -132,7 +150,6 @@ async function hasTopLevelDescribeConfigureWithSerialMode(filePath) {
132
150
  }
133
151
  return false;
134
152
  }
135
- exports.hasTopLevelDescribeConfigureWithSerialMode = hasTopLevelDescribeConfigureWithSerialMode;
136
153
  /**
137
154
  * Function to find the first 'describe' block configured with 'serial: true'
138
155
  *
@@ -179,12 +196,10 @@ function findFirstSerialDescribeBlock(node) {
179
196
  }
180
197
  return undefined; // Return undefined if no 'describe' with serial: true is found
181
198
  }
182
- exports.findFirstSerialDescribeBlock = findFirstSerialDescribeBlock;
183
199
  function appendToTestBlock(testBlock, content) {
184
200
  const updateTestBlock = testBlock.replace(/\}\)$/, `\n\n${content}\n\n })`);
185
201
  return updateTestBlock;
186
202
  }
187
- exports.appendToTestBlock = appendToTestBlock;
188
203
  function validateTypescript(filePath) {
189
204
  // Create a compiler host to read files
190
205
  const compilerHost = typescript_1.default.createCompilerHost({});
@@ -225,7 +240,6 @@ function validateTypescript(filePath) {
225
240
  }
226
241
  return errors;
227
242
  }
228
- exports.validateTypescript = validateTypescript;
229
243
  async function stripAndPrependImports(content, testName) {
230
244
  const importRegexp = /import\s+\{[^}]*\}\s+from\s+["'][^"']+["'];?/g;
231
245
  const imports = content.match(importRegexp);
@@ -237,7 +251,6 @@ async function stripAndPrependImports(content, testName) {
237
251
  const prependContent = (imports?.join("\n") || "") + "\n\n";
238
252
  return [prependContent, strippedContent];
239
253
  }
240
- exports.stripAndPrependImports = stripAndPrependImports;
241
254
  async function lintErrors(filePath) {
242
255
  const eslint = new eslint_1.ESLint({
243
256
  fix: true,
@@ -248,7 +261,6 @@ async function lintErrors(filePath) {
248
261
  fs_1.default.writeFileSync(filePath, result.output);
249
262
  }
250
263
  }
251
- exports.lintErrors = lintErrors;
252
264
  async function formatCode(filePath, trace) {
253
265
  const fileContent = fs_1.default.readFileSync(filePath, "utf8");
254
266
  if (!fileContent) {
@@ -266,11 +278,9 @@ async function formatCode(filePath, trace) {
266
278
  trace?.span({ name: "prettier-format-output", output: formattedContent });
267
279
  fs_1.default.writeFileSync(filePath, formattedContent);
268
280
  }
269
- exports.formatCode = formatCode;
270
281
  function addNewImport(contents, modules, pkg) {
271
282
  return `import { ${modules.join(", ")} } from "${pkg}";\n${contents}`;
272
283
  }
273
- exports.addNewImport = addNewImport;
274
284
  async function removeTestOnly(filePath) {
275
285
  const contents = fs_1.default.readFileSync(filePath, "utf8");
276
286
  const updatedContent = contents
@@ -278,7 +288,6 @@ async function removeTestOnly(filePath) {
278
288
  .replace("test.describe.only(", "test.describe(");
279
289
  fs_1.default.writeFileSync(filePath, updatedContent);
280
290
  }
281
- exports.removeTestOnly = removeTestOnly;
282
291
  function getFixtureImportPath(filePath) {
283
292
  // get the depth from the tests folder
284
293
  // assumption fixtures are always int the folder tests/fixtures
@@ -294,7 +303,6 @@ function getFixtureImportPath(filePath) {
294
303
  ].join("");
295
304
  return fixturesPath;
296
305
  }
297
- exports.getFixtureImportPath = getFixtureImportPath;
298
306
  async function getPageVariableNameFromCreateTest(filePath) {
299
307
  const contents = fs_1.default.readFileSync(filePath, "utf-8");
300
308
  const project = new ts_morph_1.Project();
@@ -311,7 +319,6 @@ async function getPageVariableNameFromCreateTest(filePath) {
311
319
  // handle cases like "page as Page"
312
320
  return pageVariableName?.split(" ")[0];
313
321
  }
314
- exports.getPageVariableNameFromCreateTest = getPageVariableNameFromCreateTest;
315
322
  function resolveImportsFromFixtures({ fixtureImportNode, testAlias, filePath, updatedTestFile, }) {
316
323
  const imports = {};
317
324
  const importClause = fixtureImportNode.getImportClause();
@@ -365,7 +372,6 @@ function replaceCreateTestWithNewCode(filePath, contents, generatedCode) {
365
372
  }
366
373
  return updatedTestFile;
367
374
  }
368
- exports.replaceCreateTestWithNewCode = replaceCreateTestWithNewCode;
369
375
  const injectCodeSnippetBySuiteChain = ({ testFileContent, codeSnippet, suites, }) => {
370
376
  const project = new ts_morph_1.Project();
371
377
  // Add the source file content directly into memory
@@ -474,7 +480,6 @@ async function addUserContextFixture({ scenarioName, filePath, suites, }) {
474
480
  }
475
481
  }
476
482
  }
477
- exports.addUserContextFixture = addUserContextFixture;
478
483
  async function appendScopeToCreateTest(filePath, scopeVariables) {
479
484
  const contents = fs_1.default.readFileSync(filePath, "utf-8");
480
485
  const project = new ts_morph_1.Project();
@@ -493,7 +498,6 @@ async function appendScopeToCreateTest(filePath, scopeVariables) {
493
498
  createTestNode.insertArgument(args.length, scopeArgStr);
494
499
  fs_1.default.writeFileSync(filePath, sourceFile.getFullText());
495
500
  }
496
- exports.appendScopeToCreateTest = appendScopeToCreateTest;
497
501
  function isTestPresent({ specPath, testCase, }) {
498
502
  let isTestPresent = true;
499
503
  isTestPresent = fs_1.default.existsSync(specPath);
@@ -507,7 +511,6 @@ function isTestPresent({ specPath, testCase, }) {
507
511
  }
508
512
  return isTestPresent;
509
513
  }
510
- exports.isTestPresent = isTestPresent;
511
514
  function buildTestNamePrompt({ testName, suites, }) {
512
515
  return suites?.length
513
516
  ? suites.reduce((text, suite) => {
@@ -516,7 +519,6 @@ function buildTestNamePrompt({ testName, suites, }) {
516
519
  }, "") + testName
517
520
  : testName;
518
521
  }
519
- exports.buildTestNamePrompt = buildTestNamePrompt;
520
522
  function getVariableDeclarationsFromCode(sourceCode) {
521
523
  const project = new ts_morph_1.Project();
522
524
  const sourceFile = project.createSourceFile("temp.ts", sourceCode);
@@ -542,7 +544,6 @@ function getVariableDeclarationsFromCode(sourceCode) {
542
544
  const allVariables = variables.flatMap((variable) => extractVariables(variable));
543
545
  return allVariables;
544
546
  }
545
- exports.getVariableDeclarationsFromCode = getVariableDeclarationsFromCode;
546
547
  function isSyntaxValid(code) {
547
548
  let isSyntaxValid = true;
548
549
  try {
@@ -553,4 +554,3 @@ function isSyntaxValid(code) {
553
554
  }
554
555
  return isSyntaxValid;
555
556
  }
556
- exports.isSyntaxValid = isSyntaxValid;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadTestConfigs = exports.buildTestConfigFromOptions = exports.buildTokenFromOptions = void 0;
3
+ exports.buildTokenFromOptions = buildTokenFromOptions;
4
+ exports.buildTestConfigFromOptions = buildTestConfigFromOptions;
5
+ exports.loadTestConfigs = loadTestConfigs;
4
6
  function buildTokenFromOptions(options, featureFlags) {
5
7
  const genConfig = buildTestConfigFromOptions(options);
6
8
  const requestConfig = {
@@ -23,7 +25,6 @@ function buildTokenFromOptions(options, featureFlags) {
23
25
  };
24
26
  return btoa(encodeURIComponent(JSON.stringify(requestConfig)));
25
27
  }
26
- exports.buildTokenFromOptions = buildTokenFromOptions;
27
28
  function buildTestConfigFromOptions(options) {
28
29
  return {
29
30
  specPath: `./tests/${options.file}`,
@@ -38,7 +39,6 @@ function buildTestConfigFromOptions(options) {
38
39
  },
39
40
  };
40
41
  }
41
- exports.buildTestConfigFromOptions = buildTestConfigFromOptions;
42
42
  function loadTestConfigs(testGenToken) {
43
43
  const str = decodeURIComponent(atob(testGenToken));
44
44
  const config = JSON.parse(str);
@@ -59,4 +59,3 @@ function loadTestConfigs(testGenToken) {
59
59
  environment: config.environment,
60
60
  };
61
61
  }
62
- exports.loadTestConfigs = loadTestConfigs;
@@ -14,5 +14,5 @@ exports.DEFAULT_MODEL_PARAMETERS = {
14
14
  };
15
15
  exports.DEFAULT_O1_MODEL_PARAMETERS = {
16
16
  temperature: 1,
17
- max_completion_tokens: 35000,
17
+ max_completion_tokens: 35_000,
18
18
  };
@@ -3,7 +3,8 @@ 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.startFileService = exports.FileServiceServer = void 0;
6
+ exports.FileServiceServer = void 0;
7
+ exports.startFileService = startFileService;
7
8
  const express_1 = __importDefault(require("express"));
8
9
  const fs_1 = __importDefault(require("fs"));
9
10
  const path_1 = __importDefault(require("path"));
@@ -83,4 +84,3 @@ class FileServiceServer {
83
84
  }
84
85
  exports.FileServiceServer = FileServiceServer;
85
86
  async function startFileService() { }
86
- exports.startFileService = startFileService;
@@ -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.getFeedbackUsingCli = void 0;
6
+ exports.getFeedbackUsingCli = getFeedbackUsingCli;
7
7
  const inquirer_1 = __importDefault(require("inquirer"));
8
8
  async function getFeedbackUsingCli(message) {
9
9
  const answers = await inquirer_1.default.prompt([
@@ -21,4 +21,3 @@ async function getFeedbackUsingCli(message) {
21
21
  ]);
22
22
  return answers.feedback;
23
23
  }
24
- exports.getFeedbackUsingCli = getFeedbackUsingCli;
@@ -3,7 +3,8 @@ 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.getFeedbackUsingIPC = exports.humanLoopRoute = void 0;
6
+ exports.humanLoopRoute = humanLoopRoute;
7
+ exports.getFeedbackUsingIPC = getFeedbackUsingIPC;
7
8
  const inquirer_1 = __importDefault(require("inquirer"));
8
9
  const client_1 = __importDefault(require("../file/client"));
9
10
  function humanLoopRoute(app) {
@@ -32,7 +33,6 @@ function humanLoopRoute(app) {
32
33
  }
33
34
  });
34
35
  }
35
- exports.humanLoopRoute = humanLoopRoute;
36
36
  async function getFeedbackUsingIPC(message) {
37
37
  const fileService = new client_1.default();
38
38
  try {
@@ -44,4 +44,3 @@ async function getFeedbackUsingIPC(message) {
44
44
  throw e;
45
45
  }
46
46
  }
47
- exports.getFeedbackUsingIPC = getFeedbackUsingIPC;