@empiricalrun/test-gen 0.38.27 → 0.38.29

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.
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createTestUsingMasterAgent = exports.getNextAction = void 0;
3
+ exports.createTestUsingMasterAgent = void 0;
4
4
  const llm_1 = require("@empiricalrun/llm");
5
- const vision_1 = require("@empiricalrun/llm/vision");
6
5
  const actions_1 = require("../../actions");
7
- const next_task_1 = require("../../actions/next-task");
8
6
  const skill_1 = require("../../actions/skill");
9
7
  const utils_1 = require("../../actions/utils");
10
8
  const logger_1 = require("../../bin/logger");
@@ -16,6 +14,8 @@ const browsing_1 = require("../browsing");
16
14
  const utils_2 = require("../browsing/utils");
17
15
  const skills_retriever_1 = require("../codegen/skills-retriever");
18
16
  const run_time_planner_1 = require("../planner/run-time-planner");
17
+ const element_annotation_1 = require("./element-annotation");
18
+ const next_action_1 = require("./next-action");
19
19
  const with_hints_1 = require("./with-hints");
20
20
  const MAX_ERROR_COUNT = 2;
21
21
  function getPageVariables(stateVariables) {
@@ -27,90 +27,6 @@ function getPageVariables(stateVariables) {
27
27
  }, {});
28
28
  return pages;
29
29
  }
30
- async function getNextAction({ task, executedActions, failedActions, pageUrl, trace, llm, options, pageScreenshot, annotatedPageScreenshot, actions, disableSkills, useHints = false, annotations, }) {
31
- const nextActionSpan = trace?.span({
32
- name: "master-agent-next-action",
33
- input: {
34
- task,
35
- executedActions,
36
- failedActions,
37
- pageUrl,
38
- options,
39
- pageScreenshot,
40
- annotatedPageScreenshot,
41
- disableSkills,
42
- useHints,
43
- skills: skill_1.testCaseSkills.getAvailableSkills(),
44
- annotations,
45
- },
46
- });
47
- const promptSpan = nextActionSpan?.span({
48
- name: "master-agent-prompt",
49
- });
50
- const promptMessages = await (0, llm_1.getPrompt)("test-gen", {
51
- task,
52
- failedActions: failedActions.map((a) => a).join("\n"),
53
- executedActions: executedActions.map((a) => a).join("\n"),
54
- pageUrl,
55
- annotations,
56
- }, 24);
57
- // assuming there is only one user message in the prompt. if there is a change in langfuse prompt format, this will need to be updated
58
- const userMessage = promptMessages.filter((m) => m.role === "user")[0];
59
- const systemMessage = promptMessages.filter((m) => m.role === "system")[0];
60
- userMessage.content =
61
- useHints && annotatedPageScreenshot
62
- ? (0, with_hints_1.getUserMessageWithForHints)({
63
- userMessage: userMessage,
64
- options,
65
- pageScreenshot,
66
- annotatedPageScreenshot,
67
- })
68
- : [
69
- {
70
- type: "text",
71
- text: userMessage.content,
72
- },
73
- {
74
- type: "image_url",
75
- image_url: {
76
- url: (0, vision_1.imageFormatForProvider)(options?.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER, pageScreenshot),
77
- },
78
- },
79
- ];
80
- const messages = [
81
- systemMessage,
82
- userMessage,
83
- ];
84
- const actionSchemas = disableSkills || skill_1.testCaseSkills.getAvailableSkills().length === 0
85
- ? []
86
- : actions.getMasterActionSchemas();
87
- const tools = [next_task_1.NextTaskAction.schema, ...actionSchemas];
88
- promptSpan?.end({ output: { messages } });
89
- llm =
90
- llm ||
91
- new llm_1.LLM({
92
- provider: options?.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER,
93
- defaultModel: options?.model || constants_1.DEFAULT_MODEL,
94
- });
95
- const completion = await llm.createChatCompletion({
96
- messages,
97
- modelParameters: {
98
- ...constants_1.DEFAULT_MODEL_PARAMETERS,
99
- ...options?.modelParameters,
100
- tool_choice: "required",
101
- temperature: 1,
102
- },
103
- trace: nextActionSpan,
104
- traceName: "master-agent-llm",
105
- // @ts-ignore
106
- tools,
107
- });
108
- const toolCall = completion?.tool_calls?.[0];
109
- nextActionSpan?.end({ output: toolCall });
110
- return toolCall;
111
- }
112
- exports.getNextAction = getNextAction;
113
- // let screenshotIndex = 0; // keeping this for local debugging
114
30
  async function createTestUsingMasterAgent({ task, page, testCase, options, scopeVars, }) {
115
31
  const useHints = options?.useHints || false;
116
32
  const logger = new logger_1.CustomLogger({ useReporter: false });
@@ -146,6 +62,7 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
146
62
  // we will be using google model for larger context window, in such cases 1 million tokens is not enough
147
63
  maxTokens: options.modelProvider === "google" ? 3000000 : 1000000,
148
64
  });
65
+ //Fetching available skills
149
66
  const skills = await (0, skills_retriever_1.getAppropriateSkills)({
150
67
  testCase,
151
68
  trace,
@@ -160,6 +77,7 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
160
77
  const masterAgentActions = [];
161
78
  let failedActions = [];
162
79
  let disableSkills = false;
80
+ //Run the loop until task is done or we have reached max retry limit
163
81
  while (!isGivenTaskDone) {
164
82
  if (await (0, session_1.shouldStopSession)()) {
165
83
  break;
@@ -172,6 +90,7 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
172
90
  failedActions,
173
91
  },
174
92
  });
93
+ //Provides a plan to master agent to execute, also verifies whether task is done or not
175
94
  const plannerResp = await (0, run_time_planner_1.runtimePlanner)({
176
95
  trace: masterAgentSpan,
177
96
  task,
@@ -202,41 +121,11 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
202
121
  const pageScreenshot = buffer.toString("base64");
203
122
  let output;
204
123
  let generatedCodeSteps = [];
205
- let annotatedPageScreenshot;
206
- let annotationKeys = [];
207
- if (useHints) {
208
- await page.waitForTimeout(2000);
209
- annotationKeys = await page.evaluate(() => {
210
- // @ts-ignore
211
- // eslint-disable-next-line no-undef
212
- window.annotationInstance = annotateClickableElements();
213
- // @ts-ignore
214
- return Object.keys(window.annotationInstance.annotations);
215
- });
216
- await page.waitForTimeout(2000);
217
- const annonationBuffer = await page.screenshot({
218
- //This is done to improve element annotation accuracy, anyways it doesn't annotate elements which are out of viewport
219
- // fullPage: true,
220
- // path: `screenshots/screenshot-${screenshotIndex++}.png`,
221
- });
222
- await page.evaluate(() => {
223
- console.log({
224
- // @ts-ignore
225
- disable: window?.annotationInstance?.disable,
226
- });
227
- // @ts-ignore
228
- if (window?.annotationInstance && window?.annotationInstance?.destroy) {
229
- // @ts-ignore
230
- window?.annotationInstance?.destroy();
231
- }
232
- });
233
- await testGenReporter.sendCurrentView(annonationBuffer);
234
- annotatedPageScreenshot = annonationBuffer.toString("base64");
235
- }
236
124
  if (await (0, session_1.shouldStopSession)()) {
237
125
  break;
238
126
  }
239
- const toolCall = await getNextAction({
127
+ //Provides next action that needs to be taken
128
+ const toolCall = await (0, next_action_1.getNextAction)({
240
129
  task,
241
130
  executedActions: masterAgentActions,
242
131
  failedActions,
@@ -245,11 +134,9 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
245
134
  llm,
246
135
  options,
247
136
  pageScreenshot,
248
- annotatedPageScreenshot,
249
137
  actions,
250
138
  disableSkills,
251
139
  useHints,
252
- annotations: annotationKeys,
253
140
  });
254
141
  if (await (0, session_1.shouldStopSession)()) {
255
142
  break;
@@ -264,32 +151,7 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
264
151
  action: JSON.parse(toolCall.function.arguments).action ||
265
152
  JSON.parse(toolCall.function.arguments).skill,
266
153
  reason: JSON.parse(toolCall.function.arguments).reason,
267
- elementAnnotation: JSON.parse(toolCall.function.arguments)
268
- ?.elementAnnotation,
269
154
  };
270
- let shouldTriggerHintsFlow;
271
- let hintsExecutionCompletion;
272
- if (useHints) {
273
- const triggerHintsFlowSpan = masterAgentActionSpan?.span({
274
- name: "trigger-hints-flow",
275
- input: {
276
- outputFromGetNextAction: output,
277
- generatedAnnotations: annotationKeys,
278
- },
279
- });
280
- const result = await (0, with_hints_1.triggerHintsFlow)({
281
- outputFromGetNextAction: output,
282
- generatedAnnotations: annotationKeys,
283
- page: testGenPage,
284
- llm,
285
- trace: triggerHintsFlowSpan,
286
- });
287
- shouldTriggerHintsFlow = result.shouldTriggerHintsFlow;
288
- hintsExecutionCompletion = result.hintsExecutionCompletion;
289
- triggerHintsFlowSpan?.end({
290
- output: result,
291
- });
292
- }
293
155
  void testGenReporter.sendMessage(output.reason);
294
156
  logger.log(`Next Action: ${output.action}`);
295
157
  if (toolCall.function.name === skill_1.SKILL_USAGE) {
@@ -298,33 +160,117 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
298
160
  generatedCodeSteps.push(code);
299
161
  }
300
162
  }
301
- else if (shouldTriggerHintsFlow && hintsExecutionCompletion) {
302
- const toolCalls = hintsExecutionCompletion?.tool_calls || [];
303
- for (const i in toolCalls) {
304
- const currentToolCall = toolCalls[i];
305
- const code = await actions.executeAction(currentToolCall.function.name, {
306
- ...JSON.parse(currentToolCall.function.arguments),
307
- ...args,
308
- }, masterAgentActionSpan);
309
- if (code) {
310
- generatedCodeSteps.push(code);
163
+ else {
164
+ let shouldTriggerHintsFlow;
165
+ let hintsExecutionCompletion;
166
+ let annotationKeys = [];
167
+ let elementAnnotation;
168
+ if (useHints) {
169
+ await page.waitForTimeout(2000);
170
+ annotationKeys = await page.evaluate(() => {
171
+ // @ts-ignore
172
+ // eslint-disable-next-line no-undef
173
+ window.annotationInstance = annotateClickableElements();
174
+ const annotations = Object.entries(
175
+ // @ts-ignore
176
+ window.annotationInstance.annotations).map(([key, value]) => ({
177
+ elementID: key,
178
+ text:
179
+ //@ts-ignore
180
+ value.node.innerText?.trim() ||
181
+ //@ts-ignore
182
+ value.node.placeholder?.trim() ||
183
+ "NA",
184
+ }));
185
+ return annotations;
186
+ });
187
+ await page.waitForTimeout(2000);
188
+ let annotatedPageScreenshot;
189
+ const annonationBuffer = await page.screenshot({
190
+ //This is done to improve element annotation accuracy, anyways it doesn't annotate elements which are out of viewport
191
+ // fullPage: true,
192
+ // path: `screenshots/screenshot-${screenshotIndex++}.png`,
193
+ });
194
+ annotatedPageScreenshot = annonationBuffer.toString("base64");
195
+ await page.evaluate(() => {
196
+ console.log({
197
+ // @ts-ignore
198
+ disable: window?.annotationInstance?.disable,
199
+ });
200
+ if (
201
+ // @ts-ignore
202
+ window?.annotationInstance &&
203
+ // @ts-ignore
204
+ window?.annotationInstance?.destroy) {
205
+ // @ts-ignore
206
+ window?.annotationInstance?.destroy();
207
+ }
208
+ });
209
+ const annotationMapString = annotationKeys
210
+ ?.map((a) => `${a.elementID}:${a.text}`)
211
+ .join("\n");
212
+ //Provides the annotations for all the element present on screen
213
+ //Also provides the annotation of element on which the action needs to be taken
214
+ elementAnnotation = await (0, element_annotation_1.getElementAnnotation)({
215
+ elementDescription: JSON.parse(toolCall.function.arguments)
216
+ .element_description,
217
+ annotations: annotationMapString,
218
+ annotatedScreenshot: annotatedPageScreenshot,
219
+ trace: masterAgentActionSpan,
220
+ llm,
221
+ });
222
+ output.elementAnnotation = elementAnnotation;
223
+ console.log("Output: ", output);
224
+ await testGenReporter.sendCurrentView(annonationBuffer);
225
+ const triggerHintsFlowSpan = masterAgentActionSpan?.span({
226
+ name: "trigger-hints-flow",
227
+ input: {
228
+ outputFromGetNextAction: output,
229
+ generatedAnnotations: annotationKeys,
230
+ },
231
+ });
232
+ //Provides the action whether its a click, fill etc.
233
+ const result = await (0, with_hints_1.triggerHintsFlow)({
234
+ outputFromGetNextAction: output,
235
+ generatedAnnotations: annotationKeys,
236
+ page: testGenPage,
237
+ llm,
238
+ trace: triggerHintsFlowSpan,
239
+ });
240
+ shouldTriggerHintsFlow = result.shouldTriggerHintsFlow;
241
+ hintsExecutionCompletion = result.hintsExecutionCompletion;
242
+ triggerHintsFlowSpan?.end({
243
+ output: result,
244
+ });
245
+ }
246
+ if (shouldTriggerHintsFlow && hintsExecutionCompletion) {
247
+ const toolCalls = hintsExecutionCompletion?.tool_calls || [];
248
+ for (const i in toolCalls) {
249
+ const currentToolCall = toolCalls[i];
250
+ const code = await actions.executeAction(currentToolCall.function.name, {
251
+ ...JSON.parse(currentToolCall.function.arguments),
252
+ elementAnnotation,
253
+ }, masterAgentActionSpan);
254
+ if (code) {
255
+ generatedCodeSteps.push(code);
256
+ }
257
+ }
258
+ if (actions.isStuckInLoop()) {
259
+ throw new Error("Agent is not able to figure out next action when using hints");
311
260
  }
312
261
  }
313
- if (actions.isStuckInLoop()) {
314
- throw new Error("Agent is not able to figure out next action when using hints");
262
+ else {
263
+ generatedCodeSteps = await (0, browsing_1.executeTaskUsingBrowsingAgent)({
264
+ trace: masterAgentActionSpan,
265
+ action: output.action,
266
+ logger,
267
+ page,
268
+ options,
269
+ llm,
270
+ actions,
271
+ });
315
272
  }
316
273
  }
317
- else {
318
- generatedCodeSteps = await (0, browsing_1.executeTaskUsingBrowsingAgent)({
319
- trace: masterAgentActionSpan,
320
- action: output.action,
321
- logger,
322
- page,
323
- options,
324
- llm,
325
- actions,
326
- });
327
- }
328
274
  // resetting error count as there is a successful action
329
275
  failedActions = [];
330
276
  masterAgentActions.push(output.action);
@@ -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;AAErD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAO5B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,eAAO,MAAM,0BAA0B;iBAMxB,OAAO,8BAA8B;;oBAElC,MAAM;6BACG,MAAM;MAC7B,MAAM,GAAG,OAAO,yBAAyB,EAiC5C,CAAC;AAEF,eAAO,MAAM,gBAAgB;6BAOF;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B;0BACqB,OAAO,MAAM,EAAE,GAAG,CAAC;UACnC,WAAW;SACZ,GAAG;;MAEN,QAAQ;IACV,sBAAsB,EAAE,OAAO,CAAC;IAChC,wBAAwB,EAAE,OAAO,qBAAqB,GAAG,SAAS,CAAC;CACpE,CAwGA,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;AAErD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAO5B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,eAAO,MAAM,0BAA0B;iBAMxB,OAAO,8BAA8B;;oBAElC,MAAM;6BACG,MAAM;MAC7B,MAAM,GAAG,OAAO,yBAAyB,EAiC5C,CAAC;AAEF,eAAO,MAAM,gBAAgB;6BAOF;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B;0BACqB,OAAO,MAAM,EAAE,GAAG,CAAC;UACnC,WAAW;SACZ,GAAG;;MAEN,QAAQ;IACV,sBAAsB,EAAE,OAAO,CAAC;IAChC,wBAAwB,EAAE,OAAO,qBAAqB,GAAG,SAAS,CAAC;CACpE,CA0GA,CAAC"}
@@ -40,7 +40,9 @@ const triggerHintsFlow = async ({ outputFromGetNextAction, generatedAnnotations,
40
40
  try {
41
41
  const hasElementAnnotation = outputFromGetNextAction?.elementAnnotation?.length &&
42
42
  outputFromGetNextAction?.elementAnnotation?.trim()?.length &&
43
- generatedAnnotations?.includes(outputFromGetNextAction?.elementAnnotation);
43
+ generatedAnnotations.some(
44
+ //@ts-ignore
45
+ (annotation) => annotation.elementID === outputFromGetNextAction?.elementAnnotation);
44
46
  trace?.event({
45
47
  name: "has-element-annotation",
46
48
  output: {
package/dist/bin/index.js CHANGED
@@ -36,7 +36,7 @@ async function runAgent(testGenConfig) {
36
36
  const { specPath, testCase } = testGenConfig;
37
37
  if (process.env.LOG_URL) {
38
38
  try {
39
- await new reporter_1.TestGenUpdatesReporter().sendLogUrl(process.env.LOG_URL);
39
+ void new reporter_1.TestGenUpdatesReporter().sendLogUrl(process.env.LOG_URL);
40
40
  }
41
41
  catch (e) {
42
42
  console.warn("Failed to send log url to test gen update", e);
@@ -65,7 +65,7 @@ async function runAgent(testGenConfig) {
65
65
  });
66
66
  if (trace) {
67
67
  try {
68
- await new reporter_1.TestGenUpdatesReporter().sendAgentTraceUrl(trace.getTraceUrl());
68
+ void new reporter_1.TestGenUpdatesReporter().sendAgentTraceUrl(trace.getTraceUrl());
69
69
  }
70
70
  catch (e) {
71
71
  console.warn("Failed to send trace url as test gen update", e);
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.masterGetNextActionEvaluator = void 0;
4
4
  const actions_1 = require("../actions");
5
5
  const skill_1 = require("../actions/skill");
6
- const run_1 = require("../agent/master/run");
6
+ const next_action_1 = require("../agent/master/next-action");
7
7
  const page_1 = require("../page");
8
8
  const masterGetNextActionEvaluator = async ({ item, trace, }) => {
9
9
  const { task, executedActions, failedActions, pageUrl, options, pageScreenshot, annotatedPageScreenshot, disableSkills, useHints, skills = [], annotations, } = item.input;
10
10
  const page = {};
11
11
  skill_1.testCaseSkills.updateSkills(skills);
12
12
  const actions = new actions_1.PlaywrightActions(new page_1.TestGenPage(page, "page"));
13
- const output = await (0, run_1.getNextAction)({
13
+ const output = await (0, next_action_1.getNextAction)({
14
14
  task,
15
15
  executedActions,
16
16
  failedActions,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AASlC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAOpC,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,SAAS,iBAsD3E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAQlC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAOpC,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,SAAS,iBAuC3E"}
package/dist/index.js CHANGED
@@ -7,7 +7,6 @@ exports.createTest = void 0;
7
7
  const llm_1 = require("@empiricalrun/llm");
8
8
  const test_1 = __importDefault(require("playwright/test"));
9
9
  const run_1 = require("./agent/master/run");
10
- const run_v2_1 = require("./agent/master/run-v2");
11
10
  const utils_1 = require("./bin/utils");
12
11
  const client_1 = __importDefault(require("./file/client"));
13
12
  const reporter_1 = require("./reporter");
@@ -34,35 +33,20 @@ async function createTest(task, page, scope) {
34
33
  projectRepoName: testGenConfig.options?.metadata.projectRepoName,
35
34
  });
36
35
  const fileService = new client_1.default(Number(port));
37
- const { code, importPaths } = testGenConfig.options?.useMAV2
38
- ? await (0, run_v2_1.createTestUsingMasterAgentV2)({
39
- testCase: testGenConfig.testCase,
40
- page,
41
- task,
42
- options: {
43
- htmlSanitize: {
44
- disallowedStrings: [
45
- "v-data-table__td v-data-table-column--align-start",
46
- ],
47
- },
48
- ...testGenConfig.options,
49
- },
50
- scopeVars: scope,
51
- })
52
- : await (0, run_1.createTestUsingMasterAgent)({
53
- testCase: testGenConfig.testCase,
54
- page,
55
- task,
56
- options: {
57
- htmlSanitize: {
58
- disallowedStrings: [
59
- "v-data-table__td v-data-table-column--align-start",
60
- ],
61
- },
62
- ...testGenConfig.options,
36
+ const { code, importPaths } = await (0, run_1.createTestUsingMasterAgent)({
37
+ testCase: testGenConfig.testCase,
38
+ page,
39
+ task,
40
+ options: {
41
+ htmlSanitize: {
42
+ disallowedStrings: [
43
+ "v-data-table__td v-data-table-column--align-start",
44
+ ],
63
45
  },
64
- scopeVars: scope,
65
- });
46
+ ...testGenConfig.options,
47
+ },
48
+ scopeVars: scope,
49
+ });
66
50
  await fileService.updateTest({
67
51
  task,
68
52
  generatedCode: code,
@@ -17,7 +17,6 @@ export type TestGenConfigOptions = {
17
17
  modelProvider: LLMProvider;
18
18
  modelParameters?: ModelParameters;
19
19
  useHints?: boolean;
20
- useMAV2?: boolean;
21
20
  metadata: {
22
21
  testSessionId: number;
23
22
  generationId: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAExD,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,QAAQ,CAAC;IAChB,aAAa,EAAE,WAAW,CAAC;IAC3B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE;QACR,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,aAAa,GAAG,YAAY,CAAC;KAC3C,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,a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E,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.38.27",
3
+ "version": "0.38.29",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -1,88 +0,0 @@
1
- import { LLM, TraceClient } from "@empiricalrun/llm";
2
- import OpenAI from "openai";
3
- import { Page } from "playwright";
4
- import { PlaywrightActions } from "../../actions";
5
- import { TestGenPage } from "../../page";
6
- import { ScopeVars, TestCase } from "../../types";
7
- import { BrowsingAgentOptions } from "../browsing";
8
- export declare const AnnotationToolAction: {
9
- name: string;
10
- schema: {
11
- type: string;
12
- function: {
13
- name: string;
14
- description: string;
15
- parameters: {
16
- type: string;
17
- properties: {
18
- enriched_annotations: {
19
- type: string;
20
- description: string;
21
- items: {
22
- type: string;
23
- properties: {
24
- element_id: {
25
- type: string;
26
- description: string;
27
- };
28
- description: {
29
- type: string;
30
- description: string;
31
- };
32
- };
33
- required: string[];
34
- };
35
- };
36
- reason: {
37
- type: string;
38
- description: string;
39
- };
40
- element_annotation: {
41
- type: string;
42
- description: string;
43
- };
44
- };
45
- required: string[];
46
- };
47
- };
48
- };
49
- };
50
- export declare function getNextActionV2({ task, executedActions, failedActions, pageUrl, trace, llm, options, pageScreenshot, actions, disableSkills, useHints, }: {
51
- task: string;
52
- executedActions: string[];
53
- failedActions: any[];
54
- pageUrl: string;
55
- trace?: TraceClient;
56
- llm?: LLM;
57
- options?: BrowsingAgentOptions;
58
- pageScreenshot: string;
59
- annotatedPageScreenshot?: string;
60
- actions: PlaywrightActions;
61
- disableSkills: boolean;
62
- useHints: boolean;
63
- annotations?: string[];
64
- }): Promise<import("openai/resources/index.mjs").ChatCompletionMessageToolCall | undefined>;
65
- export declare const triggerHintsFlowV2: ({ outputFromGetNextAction, generatedAnnotations, page, llm, trace, }: {
66
- outputFromGetNextAction: {
67
- action: string;
68
- elementAnnotation?: string;
69
- };
70
- generatedAnnotations: Record<string, any>;
71
- page: TestGenPage;
72
- llm: LLM;
73
- trace?: TraceClient | undefined;
74
- }) => Promise<{
75
- shouldTriggerHintsFlow: boolean;
76
- hintsExecutionCompletion: OpenAI.ChatCompletionMessage | undefined;
77
- }>;
78
- export declare function createTestUsingMasterAgentV2({ task, page, testCase, options, scopeVars, }: {
79
- task: string;
80
- page: Page;
81
- testCase: TestCase;
82
- options: BrowsingAgentOptions;
83
- scopeVars?: ScopeVars;
84
- }): Promise<{
85
- code: string;
86
- importPaths: string[];
87
- }>;
88
- //# sourceMappingURL=run-v2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-v2.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run-v2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAalD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,oBAAoB,EAErB,MAAM,aAAa,CAAC;AAmBrB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4ChC,CAAC;AA8GF,wBAAsB,eAAe,CAAC,EACpC,IAAI,EACJ,eAAe,EACf,aAAa,EACb,OAAO,EACP,KAAK,EACL,GAAG,EACH,OAAO,EACP,cAAc,EACd,OAAO,EACP,aAAa,EACb,QAAgB,GACjB,EAAE;IACD,IAAI,EA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