@empiricalrun/test-gen 0.46.9 → 0.46.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.46.10
4
+
5
+ ### Patch Changes
6
+
7
+ - b3ca74f: fix: bubble up browsing agent execution feedback for runtime planner
8
+ - b484292: fix: pages summary for runtime planner works without scoped vars
9
+
3
10
  ## 0.46.9
4
11
 
5
12
  ### Patch Changes
@@ -1 +1 @@
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
+ {"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,CA0CzE,CAAC"}
@@ -35,7 +35,7 @@ const gotoActionGenerator = (page) => {
35
35
  },
36
36
  url: {
37
37
  type: "string",
38
- description: "URL to navigate page to",
38
+ description: "URL to navigate page to. Must be prefixed with http or https (preferably https)",
39
39
  },
40
40
  },
41
41
  required: ["reason", "url"],
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOlD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF,wBAAsB,6BAA6B,CAAC,EAClD,MAAM,EACN,IAAI,EACJ,OAAO,EACP,GAAG,EACH,KAAK,GACN,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,iBAAiB,CAAC;IAC3B,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CA6D1C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOlD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF,wBAAsB,6BAA6B,CAAC,EAClD,MAAM,EACN,IAAI,EACJ,OAAO,EACP,GAAG,EACH,KAAK,GACN,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,iBAAiB,CAAC;IAC3B,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CA8D1C"}
@@ -59,9 +59,10 @@ async function executeTaskUsingBrowsingAgent({ action, page, actions, llm, trace
59
59
  }
60
60
  catch (e) {
61
61
  void testgenUpdatesReporter.sendMessage(e.message);
62
+ throw e;
62
63
  }
63
64
  }
64
- toolCallsSpan?.end({ output: { toolCalls } });
65
+ toolCallsSpan?.end({ output: { toolCalls, generatedCodeSteps } });
65
66
  return generatedCodeSteps;
66
67
  }
67
68
  exports.executeTaskUsingBrowsingAgent = executeTaskUsingBrowsingAgent;
@@ -15,5 +15,10 @@ export declare function executeBrowserAction({ page, nextAction, flags, actions,
15
15
  llm: LLM;
16
16
  }): Promise<{
17
17
  generatedCodeSteps: string[];
18
+ output: {
19
+ action: string;
20
+ reason: string;
21
+ elementAnnotation?: string | undefined;
22
+ };
18
23
  }>;
19
24
  //# sourceMappingURL=execute-browser-action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute-browser-action.d.ts","sourceRoot":"","sources":["../../../src/agent/master/execute-browser-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAYlD,wBAAsB,oBAAoB,CAAC,EACzC,IAAI,EACJ,UAAU,EACV,KAAK,EACL,OAAO,EACP,GAAG,EACH,KAAK,GACN,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,KAAK,EAAE;QACL,4BAA4B,EAAE,OAAO,CAAC;KACvC,CAAC;IACF,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,GAAG,EAAE,GAAG,CAAC;CACV;;GAsIA"}
1
+ {"version":3,"file":"execute-browser-action.d.ts","sourceRoot":"","sources":["../../../src/agent/master/execute-browser-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAYlD,wBAAsB,oBAAoB,CAAC,EACzC,IAAI,EACJ,UAAU,EACV,KAAK,EACL,OAAO,EACP,GAAG,EACH,KAAK,GACN,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,KAAK,EAAE;QACL,4BAA4B,EAAE,OAAO,CAAC;KACvC,CAAC;IACF,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,GAAG,EAAE,GAAG,CAAC;CACV;;;gBAIW,MAAM;gBACN,MAAM;;;GAkIjB"}
@@ -118,6 +118,7 @@ async function executeBrowserAction({ page, nextAction, flags, actions, llm, tra
118
118
  }
119
119
  return {
120
120
  generatedCodeSteps,
121
+ output,
121
122
  };
122
123
  }
123
124
  exports.executeBrowserAction = executeBrowserAction;
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAelC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAgCxC,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,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;;;GAoRA"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/master/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAelC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAgCxC,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,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;;;GAwRA"}
@@ -115,7 +115,7 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
115
115
  task,
116
116
  successfulActions: [...masterAgentActions],
117
117
  pages: getPageVariables(actions.getStateVariables()),
118
- currentPage: testGenPage.name,
118
+ currentPage: testGenPage,
119
119
  });
120
120
  isGivenTaskDone = plannerResp.isDone;
121
121
  if (isGivenTaskDone) {
@@ -191,7 +191,7 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
191
191
  break;
192
192
  }
193
193
  default: {
194
- const { generatedCodeSteps: codeFromExecuteAction } = await (0, execute_browser_action_1.executeBrowserAction)({
194
+ const result = await (0, execute_browser_action_1.executeBrowserAction)({
195
195
  page,
196
196
  nextAction,
197
197
  flags: {
@@ -201,7 +201,9 @@ async function createTestUsingMasterAgent({ task, page, testCase, specPath, opti
201
201
  llm,
202
202
  trace: masterAgentActionSpan,
203
203
  });
204
+ const { generatedCodeSteps: codeFromExecuteAction, output: outputFromExecuteAction, } = result;
204
205
  generatedCodeSteps.push(...codeFromExecuteAction);
206
+ output = outputFromExecuteAction;
205
207
  }
206
208
  }
207
209
  // resetting error count as there is a successful action
@@ -1,11 +1,12 @@
1
1
  import { TraceClient } from "@empiricalrun/llm";
2
2
  import type { Page } from "playwright";
3
+ import { TestGenPage } from "../../types";
3
4
  export declare function runtimePlanner({ trace, task, successfulActions, pages, currentPage, }: {
4
5
  trace?: TraceClient;
5
6
  successfulActions: string[];
6
7
  task: string;
7
- pages?: Record<string, Page>;
8
- currentPage?: string;
8
+ pages: Record<string, Page>;
9
+ currentPage: TestGenPage;
9
10
  }): Promise<{
10
11
  pageName: string;
11
12
  isDone: boolean;
@@ -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;AAKvC,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,IAAI,CAAC,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;GA4FA"}
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;AAG1C,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"}
@@ -14,9 +14,12 @@ async function runtimePlanner({ trace, task, successfulActions, pages, currentPa
14
14
  },
15
15
  });
16
16
  const llm = new llm_1.LLM({ provider: "openai" });
17
+ // Add the current page to the page state variables
18
+ pages[currentPage.name] = currentPage.pwPageInstance;
17
19
  const pagesSummary = pages
18
20
  ? Object.entries(pages).map(([pageName, page]) => `${pageName}: Currently on ${page.url()}`)
19
21
  : [];
22
+ const pageNamesEnum = Object.keys(pages);
20
23
  const response = await llm.createChatCompletion({
21
24
  trace: runTimePlannerSpan,
22
25
  traceName: "runtime-planner-llm",
@@ -53,7 +56,7 @@ async function runtimePlanner({ trace, task, successfulActions, pages, currentPa
53
56
  },
54
57
  pageName: {
55
58
  type: "string",
56
- enum: pages ? Object.keys(pages) : [],
59
+ enum: pageNamesEnum,
57
60
  description: "page name for the next action.",
58
61
  },
59
62
  isDone: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.46.9",
3
+ "version": "0.46.10",
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",
77
76
  "@empiricalrun/r2-uploader": "^0.3.8",
78
- "@empiricalrun/reporter": "^0.23.1"
77
+ "@empiricalrun/reporter": "^0.23.1",
78
+ "@empiricalrun/llm": "^0.9.35"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@playwright/test": "1.47.1",