@empiricalrun/test-gen 0.80.3 → 0.81.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.
- package/CHANGELOG.md +31 -0
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +1 -9
- package/dist/agent/chat/prompt/pw-utils-docs.d.ts +1 -1
- package/dist/agent/chat/prompt/pw-utils-docs.d.ts.map +1 -1
- package/dist/agent/chat/prompt/pw-utils-docs.js +0 -56
- package/dist/agent/chat/prompt/skills.d.ts +1 -2
- package/dist/agent/chat/prompt/skills.d.ts.map +1 -1
- package/dist/agent/chat/prompt/skills.js +34 -20
- package/dist/recorder/index.d.ts.map +1 -1
- package/dist/recorder/index.js +5 -3
- package/dist/tools/diagnosis-fetcher.d.ts +6 -2
- package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
- package/dist/tools/diagnosis-fetcher.js +1 -1
- package/dist/tools/executor/index.d.ts.map +1 -1
- package/dist/tools/executor/index.js +0 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -1
- package/dist/tools/run-test.js +2 -2
- package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
- package/package.json +11 -11
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/agent/browsing/index.d.ts +0 -15
- package/dist/agent/browsing/index.d.ts.map +0 -1
- package/dist/agent/browsing/index.js +0 -60
- package/dist/agent/master/action-tool-calls.d.ts +0 -42
- package/dist/agent/master/action-tool-calls.d.ts.map +0 -1
- package/dist/agent/master/action-tool-calls.js +0 -87
- package/dist/agent/master/element-annotation.d.ts +0 -30
- package/dist/agent/master/element-annotation.d.ts.map +0 -1
- package/dist/agent/master/element-annotation.js +0 -175
- package/dist/agent/master/execute-browser-action.d.ts +0 -24
- package/dist/agent/master/execute-browser-action.d.ts.map +0 -1
- package/dist/agent/master/execute-browser-action.js +0 -121
- package/dist/agent/master/next-action.d.ts +0 -22
- package/dist/agent/master/next-action.d.ts.map +0 -1
- package/dist/agent/master/next-action.js +0 -97
- package/dist/agent/master/planner.d.ts +0 -15
- package/dist/agent/master/planner.d.ts.map +0 -1
- package/dist/agent/master/planner.js +0 -142
- package/dist/agent/master/run.d.ts +0 -17
- package/dist/agent/master/run.d.ts.map +0 -1
- package/dist/agent/master/run.js +0 -156
- package/dist/agent/master/scroller.d.ts +0 -15
- package/dist/agent/master/scroller.d.ts.map +0 -1
- package/dist/agent/master/scroller.js +0 -369
- package/dist/agent/master/with-hints.d.ts +0 -17
- package/dist/agent/master/with-hints.d.ts.map +0 -1
- package/dist/agent/master/with-hints.js +0 -103
- package/dist/agent/planner/run-time-planner.d.ts +0 -15
- package/dist/agent/planner/run-time-planner.d.ts.map +0 -1
- package/dist/agent/planner/run-time-planner.js +0 -98
- package/dist/agent/planner/run.d.ts +0 -7
- package/dist/agent/planner/run.d.ts.map +0 -1
- package/dist/agent/planner/run.js +0 -128
- package/dist/browser-injected-scripts/annotate-elements.js +0 -612
- package/dist/browser-injected-scripts/annotate-elements.spec.d.ts +0 -2
- package/dist/browser-injected-scripts/annotate-elements.spec.d.ts.map +0 -1
- package/dist/browser-injected-scripts/annotate-elements.spec.js +0 -202
- package/dist/browser-injected-scripts/annotate-elements.spec.ts +0 -327
- package/dist/generate-summary/frame-sampling.d.ts +0 -12
- package/dist/generate-summary/frame-sampling.d.ts.map +0 -1
- package/dist/generate-summary/frame-sampling.js +0 -72
- package/dist/generate-summary/generate-error-stack-summary.d.ts +0 -11
- package/dist/generate-summary/generate-error-stack-summary.d.ts.map +0 -1
- package/dist/generate-summary/generate-error-stack-summary.js +0 -41
- package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.d.ts +0 -58
- package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.d.ts.map +0 -1
- package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.js +0 -460
- package/dist/generate-summary/generate-grouped-summary.d.ts +0 -18
- package/dist/generate-summary/generate-grouped-summary.d.ts.map +0 -1
- package/dist/generate-summary/generate-grouped-summary.js +0 -88
- package/dist/generate-summary/merge-summary.d.ts +0 -16
- package/dist/generate-summary/merge-summary.d.ts.map +0 -1
- package/dist/generate-summary/merge-summary.js +0 -43
- package/dist/generate-summary/pick-videos-for-comparison.d.ts +0 -9
- package/dist/generate-summary/pick-videos-for-comparison.d.ts.map +0 -1
- package/dist/generate-summary/pick-videos-for-comparison.js +0 -54
- package/dist/tools/slack-message/index.d.ts +0 -3
- package/dist/tools/slack-message/index.d.ts.map +0 -1
- package/dist/tools/slack-message/index.js +0 -69
- package/dist/tools/test-run-fetcher/types.d.ts +0 -79
- package/dist/tools/test-run-fetcher/types.d.ts.map +0 -1
- package/dist/tools/test-run-fetcher/types.js +0 -2
- package/dist/utils/env.d.ts +0 -2
- package/dist/utils/env.d.ts.map +0 -1
- package/dist/utils/env.js +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.81.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [76d0872]
|
|
8
|
+
- @empiricalrun/shared-types@0.14.0
|
|
9
|
+
- @empiricalrun/llm@0.27.0
|
|
10
|
+
- @empiricalrun/cua@0.4.1
|
|
11
|
+
- @empiricalrun/dashboard-client@0.3.0
|
|
12
|
+
- @empiricalrun/reporter@0.29.0
|
|
13
|
+
- @empiricalrun/test-run@0.17.0
|
|
14
|
+
- videostil@0.3.6
|
|
15
|
+
|
|
16
|
+
## 0.81.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 6fb8170: feat: playwright utils upgraded to use new core
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [6fb8170]
|
|
25
|
+
- Updated dependencies [aa78c40]
|
|
26
|
+
- @empiricalrun/cua@0.4.0
|
|
27
|
+
- @empiricalrun/reporter@0.29.0
|
|
28
|
+
- @empiricalrun/shared-types@0.13.0
|
|
29
|
+
- @empiricalrun/test-run@0.17.0
|
|
30
|
+
- @empiricalrun/dashboard-client@0.3.0
|
|
31
|
+
- @empiricalrun/llm@0.26.0
|
|
32
|
+
- videostil@0.3.5
|
|
33
|
+
|
|
3
34
|
## 0.80.3
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAoBpE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAOpC,qBAAa,SAAS,CAAC,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAC5C,SAAS,CAAC,QAAQ,IAAI,WAAW;IA2B3B,iBAAiB,CACrB,eAAe,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,GACvC,OAAO,CAAC,MAAM,CAAC;CA2GnB"}
|
package/dist/agent/chat/index.js
CHANGED
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChatAgent = void 0;
|
|
4
4
|
const tools_1 = require("../../tools");
|
|
5
|
-
const api_client_1 = require("../../tools/api-client");
|
|
6
5
|
const analyse_video_1 = require("../../tools/definitions/analyse-video");
|
|
7
6
|
const grep_1 = require("../../tools/definitions/grep");
|
|
8
7
|
const list_tests_and_projects_1 = require("../../tools/definitions/list-tests-and-projects");
|
|
9
8
|
const run_test_1 = require("../../tools/definitions/run-test");
|
|
10
|
-
const test_gen_browser_1 = require("../../tools/definitions/test-gen-browser");
|
|
11
9
|
const diagnosis_fetcher_1 = require("../../tools/diagnosis-fetcher");
|
|
12
10
|
const fetch_file_1 = require("../../tools/fetch-file");
|
|
13
|
-
const slack_message_1 = require("../../tools/slack-message");
|
|
14
11
|
const base_1 = require("../base");
|
|
15
12
|
const pw_utils_docs_1 = require("./prompt/pw-utils-docs");
|
|
16
13
|
const repo_1 = require("./prompt/repo");
|
|
@@ -19,14 +16,11 @@ const test_case_def_1 = require("./prompt/test-case-def");
|
|
|
19
16
|
const trace_utils_docs_1 = require("./prompt/trace-utils-docs");
|
|
20
17
|
class ChatAgent extends base_1.BaseAgent {
|
|
21
18
|
getTools() {
|
|
22
|
-
const hasSlackTool = this.featureFlags.includes("has_slack_tool");
|
|
23
|
-
const hasSkills = this.featureFlags.includes("useSkills");
|
|
24
19
|
const hasAnalyseVideoTool = this.featureFlags.includes("has_analyse_video_tool");
|
|
25
20
|
const custom = [
|
|
26
21
|
...(hasAnalyseVideoTool ? [analyse_video_1.analyseVideo] : []),
|
|
27
22
|
run_test_1.runTestTool,
|
|
28
23
|
grep_1.grepTool,
|
|
29
|
-
...(hasSlackTool ? [slack_message_1.slackMessageTool] : []),
|
|
30
24
|
fetch_file_1.fetchFileTool,
|
|
31
25
|
list_tests_and_projects_1.listProjectsTool,
|
|
32
26
|
list_tests_and_projects_1.listTestsForProjectTool,
|
|
@@ -35,7 +29,6 @@ class ChatAgent extends base_1.BaseAgent {
|
|
|
35
29
|
tools_1.safeBashTool,
|
|
36
30
|
...(!(0, tools_1.hasBuiltInWebFetch)(this.selectedModel) ? [tools_1.scrapeHtmlTool] : []),
|
|
37
31
|
...tools_1.testGenerationToolsWithoutBrowserAgent,
|
|
38
|
-
...(!hasSkills ? [api_client_1.apiClientTool, test_gen_browser_1.generateTestWithBrowserAgent] : []),
|
|
39
32
|
];
|
|
40
33
|
return {
|
|
41
34
|
custom,
|
|
@@ -48,8 +41,7 @@ class ChatAgent extends base_1.BaseAgent {
|
|
|
48
41
|
async buildSystemPrompt(repoInfoBuilder) {
|
|
49
42
|
const repoInfo = await repoInfoBuilder();
|
|
50
43
|
const repoContext = await (0, repo_1.getRepoContextPrompt)(repoInfo);
|
|
51
|
-
const
|
|
52
|
-
const skillsInToolsPrompt = hasSkills ? skills_1.skillsToolsPrompt : "";
|
|
44
|
+
const skillsInToolsPrompt = await (0, skills_1.getSkillsToolsPrompt)(this.workerEnv?.HIVE_API_KEY);
|
|
53
45
|
const preamble = `
|
|
54
46
|
You are a helpful assistant that can answer questions and help with tasks related to writing and maintaining Playwright tests.
|
|
55
47
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const playwrightUtilsDocs = "\nYou can refer to the following recipes to learn how to write or diagnose tests for different scenarios.\n\n<
|
|
1
|
+
export declare const playwrightUtilsDocs = "\nYou can refer to the following recipes to learn how to write or diagnose tests for different scenarios.\n\n<fixtures>\n\nThe playwright-utils package provides fixtures that wrap around Playwright's built-in\n`page`, `context` fixtures to provide a mouse highlighter (which makes it easier to\nsee actions taken in a video).\n\nTo use this, you can use the `baseTestFixture` and `extendExpect` imports\nin your fixtures file.\n\n```ts\nimport { test as base, expect as baseExpect } from \"@playwright/test\";\nimport { baseTestFixture, extendExpect } from \"@empiricalrun/playwright-utils/test\";\n\nexport const test = baseTestFixture(base);\nexport const expect = extendExpect(baseExpect);\n```\n\n### Get a new browser context\n\nThis package provides a fixture `customContextPageProvider` which is a good way to create\na fresh, new browser context, and a page inside it.\n\nThere are two benefits of using this to create contexts or pages:\n1. Videos get recorded and attached to the test report\n2. Mouse highlights are available\n\n```ts\nimport { test, expect } from \"./fixtures\";\n\ntest(\"Example test\", async ({ page: builtInPage, customContextPageProvider }) => {\n // builtInPage is from default browser context\n const { page: newPage, context } = await customContextPageProvider();\n // newPage is from this other browser context\n});\n```\n\ncustomContextPageProvider can accept options to customize the browser context.\n\n```\n customContextPageProvider: (\n options?: BrowserContextOptions,\n ) => Promise<{ context: BrowserContext; page: Page }>;\n```\n\nFor example, pass { storageState: undefined } to create a new browser context without\nthe auth state of the current browser context. This is useful for multi-user scenarios.\n\n</fixtures>\n\n<video-labels>\n\n# Video Labels\n\nPages generate video recordings after test execution, with 1 page generating 1 video file (webm). \n\nIf your test case relies on multiple pages (e.g. for multi-user or multi-app flows), it can get difficult to\nknow which page does \"video-1.webm\" belong to.\n\nTo solve this, you should set video labels for pages. This will enable you to identify videos faster.\n\n## Usage\n\n```typescript\nimport { setVideoLabel } from '@empiricalrun/playwright-utils/test';\n\ntest('my test', async ({ page }) => {\n setVideoLabel(page, 'checkout-flow');\n // Video will be saved as 'checkout-flow.webm'\n});\n```\n\n## Multiple Contexts\n\n```typescript\ntest('multi-user scenario', async ({ page, customContextPageProvider }) => {\n setVideoLabel(page, 'host-page');\n\n const { page: guestPage } = await customContextPageProvider({ storageState: undefined });\n setVideoLabel(guestPage, 'guest-page');\n // Videos saved as 'guest-page.webm' and 'host-page.webm'\n});\n```\n\n## Notes\n\n- The default behavior is to label videos for multiple pages as: `video-0.webm`, `video-1.webm`, etc.\n- If setVideoLabel is called twice for the same page, the last label will be set\n\n</video-labels>\n\n";
|
|
2
2
|
//# sourceMappingURL=pw-utils-docs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pw-utils-docs.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/pw-utils-docs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pw-utils-docs.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/pw-utils-docs.ts"],"names":[],"mappings":"AAuFA,eAAO,MAAM,mBAAmB,s8FAW/B,CAAC"}
|
|
@@ -1,58 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.playwrightUtilsDocs = void 0;
|
|
4
|
-
// Ref: packages/playwright-utils/docs/email.md
|
|
5
|
-
const emailRecipe = `
|
|
6
|
-
# Email automation
|
|
7
|
-
|
|
8
|
-
## Example usage
|
|
9
|
-
|
|
10
|
-
### Dynamic email
|
|
11
|
-
|
|
12
|
-
This dynamically generates a random email address that can
|
|
13
|
-
be used for the test (e.g. invite a new user).
|
|
14
|
-
|
|
15
|
-
\`\`\`ts
|
|
16
|
-
import { EmailClient } from "@empiricalrun/playwright-utils";
|
|
17
|
-
import { expect } from "@playwright/test";
|
|
18
|
-
|
|
19
|
-
const client = new EmailClient();
|
|
20
|
-
const address = client.getAddress();
|
|
21
|
-
|
|
22
|
-
// Input the \`address\` in the application
|
|
23
|
-
// that sends the email.
|
|
24
|
-
|
|
25
|
-
// Get email received on the \`address\`
|
|
26
|
-
const email = await client.waitForEmail();
|
|
27
|
-
expect(
|
|
28
|
-
email.links.find((l) => l.text === "Join your team")
|
|
29
|
-
).toBeTruthy();
|
|
30
|
-
\`\`\`
|
|
31
|
-
|
|
32
|
-
### Static email
|
|
33
|
-
|
|
34
|
-
This uses a known (static) email that can be used to login
|
|
35
|
-
into an application.
|
|
36
|
-
|
|
37
|
-
This needs an email id (e.g. \`test-login-user\`). The email id
|
|
38
|
-
is appended with the domain (managed internally) to get the full
|
|
39
|
-
email address.
|
|
40
|
-
|
|
41
|
-
\`\`\`ts
|
|
42
|
-
import { EmailClient } from "@empiricalrun/playwright-utils";
|
|
43
|
-
|
|
44
|
-
const emailId = \`test-login-user\`;
|
|
45
|
-
|
|
46
|
-
const client = new EmailClient({ emailId });
|
|
47
|
-
const address = client.getAddress(); // Returns full address with domain
|
|
48
|
-
|
|
49
|
-
// Get email received on the \`address\`
|
|
50
|
-
const email = await client.waitForEmail();
|
|
51
|
-
|
|
52
|
-
// Get login OTP
|
|
53
|
-
const loginCode = email.codes[0];
|
|
54
|
-
\`\`\`
|
|
55
|
-
`;
|
|
56
4
|
// Ref: packages/playwright-utils/docs/fixtures.md
|
|
57
5
|
const fixturesRecipe = `
|
|
58
6
|
The playwright-utils package provides fixtures that wrap around Playwright's built-in
|
|
@@ -141,10 +89,6 @@ test('multi-user scenario', async ({ page, customContextPageProvider }) => {
|
|
|
141
89
|
exports.playwrightUtilsDocs = `
|
|
142
90
|
You can refer to the following recipes to learn how to write or diagnose tests for different scenarios.
|
|
143
91
|
|
|
144
|
-
<email-automation>
|
|
145
|
-
${emailRecipe}
|
|
146
|
-
</email-automation>
|
|
147
|
-
|
|
148
92
|
<fixtures>
|
|
149
93
|
${fixturesRecipe}
|
|
150
94
|
</fixtures>
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
export declare const skillsProactivenessPrompt = "\nIf your listed tools don't seem sufficient for a task, load a relevant skill file using the bash tool to learn how to accomplish the task with your existing tools.\n";
|
|
1
|
+
export declare function getSkillsToolsPrompt(hiveApiKey?: string): Promise<string>;
|
|
3
2
|
//# sourceMappingURL=skills.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/skills.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/skills.ts"],"names":[],"mappings":"AAiEA,wBAAsB,oBAAoB,CACxC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
];
|
|
3
|
+
exports.getSkillsToolsPrompt = getSkillsToolsPrompt;
|
|
4
|
+
const HIVE_URL = process.env.HIVE_URL || "https://hive.empirical.run";
|
|
5
|
+
async function fetchSkillCatalog(hiveApiKey) {
|
|
6
|
+
const apiKey = hiveApiKey || process.env.HIVE_API_KEY;
|
|
7
|
+
if (!apiKey) {
|
|
8
|
+
console.warn("[skills] HIVE_API_KEY not set, no skills available");
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
const res = await fetch(`${HIVE_URL}/api/skills`, {
|
|
12
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
13
|
+
});
|
|
14
|
+
if (!res.ok) {
|
|
15
|
+
console.error(`[skills] Failed to fetch skill catalog: ${res.status} ${res.statusText}`);
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const { data } = (await res.json());
|
|
19
|
+
return data.map((s) => ({
|
|
20
|
+
name: s.name,
|
|
21
|
+
description: s.description || "",
|
|
22
|
+
location: `/opt/skills/${s.name}/SKILL.md`,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
16
25
|
const skillToXml = (s) => {
|
|
17
26
|
return `<skill>
|
|
18
27
|
<name>${s.name}</name>
|
|
@@ -20,17 +29,22 @@ const skillToXml = (s) => {
|
|
|
20
29
|
<location>${s.location}</location>
|
|
21
30
|
</skill>`;
|
|
22
31
|
};
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
function buildSkillsPrompt(skills) {
|
|
33
|
+
if (skills.length === 0)
|
|
34
|
+
return "";
|
|
35
|
+
const catalogXml = `<available_skills>
|
|
36
|
+
${skills.map(skillToXml).join("\n")}
|
|
25
37
|
</available_skills>`;
|
|
26
|
-
|
|
38
|
+
return `
|
|
27
39
|
You have access to **skill files** — documentation that teaches you how to accomplish tasks using your existing safeBash tool.
|
|
28
40
|
Skills are NOT callable functions. To use a skill, read its file with bash, then follow the instructions inside.
|
|
29
41
|
|
|
30
|
-
${
|
|
42
|
+
${catalogXml}
|
|
31
43
|
|
|
32
44
|
To use a skill: run \`cat <location>\` using the bash tool, then follow the instructions in the output.
|
|
33
45
|
`;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
}
|
|
47
|
+
async function getSkillsToolsPrompt(hiveApiKey) {
|
|
48
|
+
const skills = await fetchSkillCatalog(hiveApiKey);
|
|
49
|
+
return buildSkillsPrompt(skills);
|
|
50
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recorder/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recorder/index.ts"],"names":[],"mappings":"AAuEA,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACzB;AAiUD,wBAAsB,WAAW,CAAC,EAChC,QAAQ,EACR,OAAO,EACP,GAAG,GACJ,EAAE,kBAAkB,iBAGpB"}
|
package/dist/recorder/index.js
CHANGED
|
@@ -99,9 +99,9 @@ async function collectTestInfo({ testName, project, repoDir, }) {
|
|
|
99
99
|
}
|
|
100
100
|
async function collectTestInfoFromDiagnosis(url) {
|
|
101
101
|
const slug = (0, slug_1.extractSlugFromDiagnosisUrl)(url);
|
|
102
|
-
const data =
|
|
102
|
+
const data = await client_1.apiClient.request(`/api/diagnosis/${slug}/detailed`, {
|
|
103
103
|
method: "GET",
|
|
104
|
-
})
|
|
104
|
+
});
|
|
105
105
|
if (!data.data ||
|
|
106
106
|
!data.data.error_stack?.file_info ||
|
|
107
107
|
data.data.error_stack.file_info.length === 0) {
|
|
@@ -111,7 +111,9 @@ async function collectTestInfoFromDiagnosis(url) {
|
|
|
111
111
|
? data.data.test_case.file_path
|
|
112
112
|
: `tests/${data.data.test_case.file_path}`;
|
|
113
113
|
const testName = data.data.test_case.name;
|
|
114
|
-
const selectedProjects =
|
|
114
|
+
const selectedProjects = data.data.diagnosis.test_project
|
|
115
|
+
? [data.data.diagnosis.test_project]
|
|
116
|
+
: [];
|
|
115
117
|
const fileInfo = data.data.error_stack.file_info.map((file) => ({
|
|
116
118
|
fileName: file.file_name,
|
|
117
119
|
filePath: file.file_path,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type { TestCaseTestRunMetadataEntry
|
|
1
|
+
import type { TestCaseTestRunMetadataEntry } from "@empiricalrun/shared-types/api/test-cases";
|
|
2
2
|
import type { Tool } from "@empiricalrun/shared-types/chat-agent";
|
|
3
|
+
import { getDiagnosisDetailedContract, type InferResponse } from "@empiricalrun/shared-types/external-api";
|
|
3
4
|
import type { PlaywrightMatchingTest } from "@empiricalrun/shared-types/playwright-utils";
|
|
5
|
+
type DiagnosisData = InferResponse<typeof getDiagnosisDetailedContract>;
|
|
6
|
+
type DiagnosisDetailedTestCase = DiagnosisData["test_case"];
|
|
4
7
|
export declare const fetchDiagnosisReportTool: Tool;
|
|
5
|
-
export declare function getDataForLastSuccessfulRuns(testCase:
|
|
8
|
+
export declare function getDataForLastSuccessfulRuns(testCase: DiagnosisDetailedTestCase): Promise<never[] | Record<string, TestCaseTestRunMetadataEntry & {
|
|
6
9
|
test_case: PlaywrightMatchingTest;
|
|
7
10
|
}>>;
|
|
11
|
+
export {};
|
|
8
12
|
//# sourceMappingURL=diagnosis-fetcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnosis-fetcher.d.ts","sourceRoot":"","sources":["../../src/tools/diagnosis-fetcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"diagnosis-fetcher.d.ts","sourceRoot":"","sources":["../../src/tools/diagnosis-fetcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAE9F,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EACL,4BAA4B,EAC5B,KAAK,aAAa,EACnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAG1F,KAAK,aAAa,GAAG,aAAa,CAAC,OAAO,4BAA4B,CAAC,CAAC;AACxE,KAAK,yBAAyB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAgB5D,eAAO,MAAM,wBAAwB,EAAE,IAwItC,CAAC;AAEF,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,yBAAyB;eAKW,sBAAsB;IAkDrE"}
|
|
@@ -104,7 +104,7 @@ In the above, the diagnosis id is after the double hyphen, which is "ULRHHNwiGZ2
|
|
|
104
104
|
# Test Case Information
|
|
105
105
|
- **Name**: ${test_case.name}
|
|
106
106
|
- **Test suite** (Describe blocks): ${test_case.suites}
|
|
107
|
-
- **File path**:
|
|
107
|
+
- **File path**: ${test_case.file_path}
|
|
108
108
|
- **Playwright project**: ${project}
|
|
109
109
|
|
|
110
110
|
# Test Run #${test_run.id}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/index.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAEjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,YAAY,EACV,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,qBAAa,YAAa,SAAQ,gBAAgB;gBACpC,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/index.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAEjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,YAAY,EACV,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,qBAAa,YAAa,SAAQ,gBAAgB;gBACpC,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC;CAgCzD"}
|
|
@@ -22,7 +22,6 @@ const publish_markdown_report_1 = require("../publish-markdown-report");
|
|
|
22
22
|
const rename_file_1 = require("../rename-file");
|
|
23
23
|
const run_test_1 = require("../run-test");
|
|
24
24
|
const safe_bash_1 = require("../safe-bash");
|
|
25
|
-
const slack_message_1 = require("../slack-message");
|
|
26
25
|
const test_gen_browser_1 = require("../test-gen-browser");
|
|
27
26
|
const test_run_fetcher_1 = require("../test-run-fetcher");
|
|
28
27
|
const trace_dot_zip_1 = require("../trace-dot-zip");
|
|
@@ -61,7 +60,6 @@ class ToolExecutor extends base_1.BaseToolExecutor {
|
|
|
61
60
|
set_issue_description_1.setIssueDescriptionTool,
|
|
62
61
|
update_issue_1.updateIssueTool,
|
|
63
62
|
firecrawl_scrape_1.scrapeHtmlTool,
|
|
64
|
-
slack_message_1.slackMessageTool,
|
|
65
63
|
...file_operations_1.textEditorTools,
|
|
66
64
|
];
|
|
67
65
|
super({ ...params, tools });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,IAAI,EACJ,cAAc,EACf,MAAM,uCAAuC,CAAC;AA+B/C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,KAAK,oBAAoB,GAAG,IAAI,GAAG,cAAc,CAAC;AAclD,eAAO,MAAM,sCAAsC,EAAE,oBAAoB,EAKxE,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,oBAAoB,EAGrD,CAAC;AAkBF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,WAE9D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,IAAI,EACJ,cAAc,EACf,MAAM,uCAAuC,CAAC;AA+B/C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,KAAK,oBAAoB,GAAG,IAAI,GAAG,cAAc,CAAC;AAclD,eAAO,MAAM,sCAAsC,EAAE,oBAAoB,EAKxE,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,oBAAoB,EAGrD,CAAC;AAkBF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,WAE9D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,WAM5D;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,mBAAmB,GACzB,oBAAoB,EAAE,CAExB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,mBAAmB,GACzB,oBAAoB,EAAE,CAExB;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,eAAe,EAAE,WAM5D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAQlE"}
|
package/dist/tools/index.js
CHANGED
|
@@ -74,7 +74,9 @@ function hasBuiltInTextEditor(model) {
|
|
|
74
74
|
return model.includes("claude");
|
|
75
75
|
}
|
|
76
76
|
function hasBuiltInWebFetch(model) {
|
|
77
|
-
return model.includes("claude")
|
|
77
|
+
return (model.includes("claude") &&
|
|
78
|
+
!model.includes(":vertex") &&
|
|
79
|
+
!model.includes(":bedrock"));
|
|
78
80
|
}
|
|
79
81
|
function textEditorToolsForModel(model) {
|
|
80
82
|
return !hasBuiltInTextEditor(model) ? Object.values(str_replace_editor_1.textEditorTools) : [];
|
package/dist/tools/run-test.js
CHANGED
|
@@ -12,8 +12,8 @@ const utils_1 = require("../artifacts/utils");
|
|
|
12
12
|
const json_1 = require("../utils/json");
|
|
13
13
|
const run_test_1 = require("./definitions/run-test");
|
|
14
14
|
const helpers_1 = require("./file-operations/shared/helpers");
|
|
15
|
-
function buildReportUrl(
|
|
16
|
-
return `https://reports-r2.empirical.run/${
|
|
15
|
+
function buildReportUrl(projectSlug, testRunId) {
|
|
16
|
+
return `https://reports-r2.empirical.run/${projectSlug}/${testRunId}/index.html`;
|
|
17
17
|
}
|
|
18
18
|
function buildResult({ hasTestPassed, summaryJson, reportUrl, }) {
|
|
19
19
|
const summaryWithoutConfig = { ...summaryJson, config: undefined };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/test-run-fetcher/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/test-run-fetcher/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAUlE,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOnE;AAED,eAAO,MAAM,uBAAuB,EAAE,IAgHrC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.81.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -89,18 +89,18 @@
|
|
|
89
89
|
"typescript": "^5.3.3",
|
|
90
90
|
"zod": "^4.0.1",
|
|
91
91
|
"@empiricalrun/ast-parser": "^0.0.10",
|
|
92
|
-
"@empiricalrun/cua": "^0.
|
|
92
|
+
"@empiricalrun/cua": "^0.4.1",
|
|
93
93
|
"@empiricalrun/dashboard-client": "^0.3.0",
|
|
94
|
-
"@empiricalrun/shared-types": "0.
|
|
95
|
-
"@empiricalrun/llm": "^0.
|
|
94
|
+
"@empiricalrun/shared-types": "0.14.0",
|
|
95
|
+
"@empiricalrun/llm": "^0.27.0",
|
|
96
96
|
"@empiricalrun/r2-uploader": "^0.9.1",
|
|
97
97
|
"@empiricalrun/trace-utils": "^0.1.0",
|
|
98
|
-
"@empiricalrun/reporter": "^0.
|
|
99
|
-
"@empiricalrun/test-run": "^0.
|
|
100
|
-
"videostil": "0.3.
|
|
98
|
+
"@empiricalrun/reporter": "^0.29.0",
|
|
99
|
+
"@empiricalrun/test-run": "^0.17.0",
|
|
100
|
+
"videostil": "0.3.6"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@playwright/test": "1.
|
|
103
|
+
"@playwright/test": "1.60.0",
|
|
104
104
|
"@types/async-retry": "^1.4.8",
|
|
105
105
|
"@types/console-log-level": "^1.4.5",
|
|
106
106
|
"@types/detect-port": "^1.3.5",
|
|
@@ -113,17 +113,17 @@
|
|
|
113
113
|
"@types/pixelmatch": "^5.2.6",
|
|
114
114
|
"@types/serve-handler": "^6.1.4",
|
|
115
115
|
"js-levenshtein": "^1.1.6",
|
|
116
|
-
"playwright": "1.
|
|
116
|
+
"playwright": "1.60.0",
|
|
117
117
|
"serve-handler": "^6.1.6",
|
|
118
118
|
"ts-patch": "^3.3.0"
|
|
119
119
|
},
|
|
120
120
|
"scripts": {
|
|
121
121
|
"dev": "tspc --build --watch",
|
|
122
|
-
"build": "tspc --build
|
|
122
|
+
"build": "tspc --build",
|
|
123
123
|
"clean": "tspc --build --clean",
|
|
124
124
|
"lint": "biome check --unsafe",
|
|
125
125
|
"test": "vitest run",
|
|
126
|
-
"test-browser": "pnpm build &&
|
|
126
|
+
"test-browser": "pnpm build && npx playwright test",
|
|
127
127
|
"test:watch": "vitest",
|
|
128
128
|
"test:watch-files": "vitest $0 --watch"
|
|
129
129
|
}
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/index.ts","./src/logger.ts","./src/actions/assert.ts","./src/actions/click.ts","./src/actions/done.ts","./src/actions/fill.ts","./src/actions/goto.ts","./src/actions/hover.ts","./src/actions/index.ts","./src/actions/next-task.ts","./src/actions/press.ts","./src/actions/text-content.ts","./src/actions/constants/index.ts","./src/actions/utils/index.ts","./src/agent/cli.ts","./src/agent/index.ts","./src/agent/base/index.ts","./src/agent/browsing/
|
|
1
|
+
{"root":["./src/index.ts","./src/logger.ts","./src/actions/assert.ts","./src/actions/click.ts","./src/actions/done.ts","./src/actions/fill.ts","./src/actions/goto.ts","./src/actions/hover.ts","./src/actions/index.ts","./src/actions/next-task.ts","./src/actions/press.ts","./src/actions/text-content.ts","./src/actions/constants/index.ts","./src/actions/utils/index.ts","./src/agent/cli.ts","./src/agent/index.ts","./src/agent/base/index.ts","./src/agent/browsing/run.ts","./src/agent/browsing/utils.ts","./src/agent/chat/agent-loop.ts","./src/agent/chat/exports.ts","./src/agent/chat/index.ts","./src/agent/chat/models.ts","./src/agent/chat/state.ts","./src/agent/chat/types.ts","./src/agent/chat/utils.ts","./src/agent/chat/prompt/pw-utils-docs.ts","./src/agent/chat/prompt/repo.ts","./src/agent/chat/prompt/skills.ts","./src/agent/chat/prompt/test-case-def.ts","./src/agent/chat/prompt/trace-utils-docs.ts","./src/agent/code-review/index.ts","./src/agent/code-review/types.ts","./src/agent/code-review/xml-parser.ts","./src/agent/code-review/executor/index.ts","./src/agent/fast-triage/index.ts","./src/agent/master/browser-tests/cua.spec.ts","./src/agent/master/browser-tests/fixtures.ts","./src/agent/master/browser-tests/index.spec.ts","./src/agent/triage/index.ts","./src/artifacts/index.ts","./src/artifacts/utils.ts","./src/auth/cli-auth.ts","./src/auth/index.ts","./src/auth/token-store.ts","./src/bin/index.ts","./src/bin/setup.ts","./src/bin/logger/index.ts","./src/bin/utils/context.ts","./src/bin/utils/index.ts","./src/bin/utils/fs/index.ts","./src/bin/utils/platform/web/index.ts","./src/bin/utils/platform/web/test-files/ts-path-import-validate.ts","./src/bin/utils/scenarios/index.ts","./src/constants/index.ts","./src/dashboard/client.ts","./src/dashboard/index.ts","./src/dashboard/tool-response-from-sandbox.ts","./src/dashboard/tool-response.ts","./src/dashboard/totp.ts","./src/dashboard/types.ts","./src/errors/index.ts","./src/file/client.ts","./src/file/server.ts","./src/file-info/index.ts","./src/file-info/adapters/file-system/index.ts","./src/file-info/adapters/file-system/reader.ts","./src/file-info/adapters/github/reader.ts","./src/human-in-the-loop/cli.ts","./src/human-in-the-loop/index.ts","./src/human-in-the-loop/ipc.ts","./src/page/index.ts","./src/prompts/lib/ts-transformer.ts","./src/recorder/env-variables.ts","./src/recorder/index.ts","./src/recorder/request.ts","./src/recorder/temp-files.ts","./src/recorder/upload.ts","./src/recorder/validation.ts","./src/telemetry/index.ts","./src/test-build/index.ts","./src/tools/diagnosis-fetcher.ts","./src/tools/index.ts","./src/tools/list-environments.ts","./src/tools/run-test.ts","./src/tools/test-gen-browser.ts","./src/tools/analyse-video/index.ts","./src/tools/api-client/index.ts","./src/tools/create-pull-request/index.ts","./src/tools/create-pull-request/utils.ts","./src/tools/definitions/analyse-video.ts","./src/tools/definitions/delete-file.ts","./src/tools/definitions/download-build.ts","./src/tools/definitions/grep.ts","./src/tools/definitions/list-tests-and-projects.ts","./src/tools/definitions/merge-conflicts.ts","./src/tools/definitions/publish-markdown-report.ts","./src/tools/definitions/rename-file.ts","./src/tools/definitions/run-test.ts","./src/tools/definitions/safe-bash.ts","./src/tools/definitions/str_replace_editor.ts","./src/tools/definitions/test-gen-browser.ts","./src/tools/definitions/trace-dot-zip.ts","./src/tools/definitions/utils.ts","./src/tools/delete-file/index.ts","./src/tools/download-build/index.ts","./src/tools/executor/base.ts","./src/tools/executor/index.ts","./src/tools/executor/types.ts","./src/tools/executor/utils/checkpoint.ts","./src/tools/executor/utils/git.ts","./src/tools/executor/utils/index.ts","./src/tools/executor/utils/pr-description.ts","./src/tools/fetch-file/index.ts","./src/tools/fetch-file/utils.ts","./src/tools/fetch-session-diff/index.ts","./src/tools/file-operations/create.ts","./src/tools/file-operations/index.ts","./src/tools/file-operations/insert.ts","./src/tools/file-operations/replace.ts","./src/tools/file-operations/shared/helpers.ts","./src/tools/file-operations/view/index.ts","./src/tools/firecrawl-scrape/index.ts","./src/tools/grep/index.ts","./src/tools/grep/types.ts","./src/tools/grep/ripgrep/index.ts","./src/tools/issues-v1/index.ts","./src/tools/issues-v1/list-issues.ts","./src/tools/issues-v1/utils.ts","./src/tools/issues-v2/create-issue.ts","./src/tools/issues-v2/set-issue-description.ts","./src/tools/issues-v2/update-issue.ts","./src/tools/list-tests-and-projects/index.ts","./src/tools/merge-conflicts/index.ts","./src/tools/publish-markdown-report/index.ts","./src/tools/rename-file/index.ts","./src/tools/safe-bash/index.ts","./src/tools/test-run-fetcher/index.ts","./src/tools/trace-dot-zip/index.ts","./src/tools/trace-dot-zip/types.ts","./src/tools/trace-dot-zip/utils/console-trace.ts","./src/tools/trace-dot-zip/utils/extract-screenshots.ts","./src/tools/trace-dot-zip/utils/extract-steps.ts","./src/tools/trace-dot-zip/utils/extract-zip.ts","./src/tools/trace-dot-zip/utils/network-trace.ts","./src/tools/triage-summary/index.ts","./src/tools/triage-summary/types.ts","./src/tools/triage-summary/utils.ts","./src/tools/utils/apply-line-limit.ts","./src/tools/utils/validate-schema.ts","./src/tools/utils/validators.ts","./src/types/handlebars.d.ts","./src/types/index.ts","./src/utils/exec.ts","./src/utils/file.ts","./src/utils/hash.ts","./src/utils/html.ts","./src/utils/index.ts","./src/utils/json.ts","./src/utils/model.ts","./src/utils/playwright-test-id.ts","./src/utils/repo-tree.ts","./src/utils/slug.ts","./src/utils/string.ts","./src/utils/stripAnsi.ts","./src/utils/url-validation.ts","./src/utils/dedup/dedup-image.ts","./src/utils/dedup/find-threshold.ts","./src/video-core/index.ts","./src/video-core/model-limits.ts","./src/video-core/storage-manager.ts","./src/video-core/types.ts","./src/video-core/utils.ts"],"version":"5.8.3"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { LLM, TraceClient } from "@empiricalrun/llm";
|
|
2
|
-
import { Page } from "playwright";
|
|
3
|
-
import { PlaywrightActions } from "../../actions";
|
|
4
|
-
export type BrowserAgentAction = {
|
|
5
|
-
action: string;
|
|
6
|
-
code: string | undefined;
|
|
7
|
-
};
|
|
8
|
-
export declare function executeTaskUsingBrowsingAgent({ action, page, actions, llm, trace, }: {
|
|
9
|
-
action: string;
|
|
10
|
-
page: Page;
|
|
11
|
-
actions: PlaywrightActions;
|
|
12
|
-
llm?: LLM;
|
|
13
|
-
trace?: TraceClient;
|
|
14
|
-
}): Promise<BrowserAgentAction | undefined>;
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAKlD,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,CA0D1C"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executeTaskUsingBrowsingAgent = executeTaskUsingBrowsingAgent;
|
|
4
|
-
const llm_1 = require("@empiricalrun/llm");
|
|
5
|
-
const constants_1 = require("../../constants");
|
|
6
|
-
const promptTemplate_0 = "{{#section \"system\"}}\nYou are a browser automation agent who is given a task to generate code for navigation and assertion. This task is your\ngoal and you must achieve it.\n\nYou will be provided with already executed actions and basis that you need to pick the next step to achieve the task.\nRemember that the goal must be achieved.\n\nYou will be provided with the web page snapshot in the form of Document Object Model. Based on the goal and available\ntool calls you need to pick the appropriate tool call.\n\nInstructions:\n- Take actions one at a time. Do not try to take multiple actions\n- You can respond with multiple assertions in one shot\n- Do not repeat the same actions again otherwise your response will be marked INVALID\n- Avoid repeating errors which we got while executing the last action\n- Stick to the task provided to you and mark the task done once the task is complete\n- Do not execute any action which is not mentioned in the task\n- Do not repeat actions which are already executed more than twice otherwise your response will be marked INVALID\n- Always refer to \"Executed actions\" before deciding your next action for completion of the task.\n- End the task done if all actions required for task are executed\n{{/section}}\n\n{{#section \"user\"}}\nTask:\n{{task}}\n\nCurrent page snapshot:\n{{pageSnapshot}}\n{{/section}}";
|
|
7
|
-
const html_1 = require("../../utils/html");
|
|
8
|
-
async function executeTaskUsingBrowsingAgent({ action, page, actions, llm, trace, }) {
|
|
9
|
-
let generatedCodeSteps;
|
|
10
|
-
const tools = actions.getBrowsingActionSchemas();
|
|
11
|
-
const browsingAgentSpan = trace?.span({
|
|
12
|
-
name: `browsing-agent`,
|
|
13
|
-
input: {
|
|
14
|
-
action,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
const pageContentSpan = browsingAgentSpan?.span({
|
|
18
|
-
name: "page-content",
|
|
19
|
-
});
|
|
20
|
-
const pageContent = await page.content();
|
|
21
|
-
pageContentSpan?.end({ output: { pageContent } });
|
|
22
|
-
const sanitizationSpan = browsingAgentSpan?.span({
|
|
23
|
-
name: "page-sanitization",
|
|
24
|
-
});
|
|
25
|
-
const pageSnapshot = (0, html_1.sanitizeHtml)(pageContent);
|
|
26
|
-
sanitizationSpan?.end({ output: { pageSnapshot } });
|
|
27
|
-
const promptSpan = browsingAgentSpan?.span({ name: "page-prompt" });
|
|
28
|
-
const messages = (0, llm_1.compilePrompt)(promptTemplate_0, { pageSnapshot, task: action });
|
|
29
|
-
promptSpan?.end({ output: { messages } });
|
|
30
|
-
llm =
|
|
31
|
-
llm ||
|
|
32
|
-
new llm_1.LLM({
|
|
33
|
-
provider: constants_1.DEFAULT_MODEL_PROVIDER,
|
|
34
|
-
});
|
|
35
|
-
const completion = await llm.createChatCompletion({
|
|
36
|
-
model: "o3-mini-2025-01-31",
|
|
37
|
-
messages,
|
|
38
|
-
tools,
|
|
39
|
-
trace: browsingAgentSpan,
|
|
40
|
-
modelParameters: {
|
|
41
|
-
tool_choice: "required",
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
const toolCalls = completion?.tool_calls || [];
|
|
45
|
-
const toolCallsSpan = browsingAgentSpan?.span({ name: "tool-calls" });
|
|
46
|
-
for (const i in toolCalls) {
|
|
47
|
-
const toolCall = toolCalls[i];
|
|
48
|
-
if ("function" in toolCall) {
|
|
49
|
-
const args = JSON.parse(toolCall.function.arguments);
|
|
50
|
-
const code = await actions.executeAction(toolCall.function.name, JSON.parse(toolCall.function.arguments), toolCallsSpan);
|
|
51
|
-
generatedCodeSteps = {
|
|
52
|
-
// Passing reason as action, in order to pass the correct action that took place to runtime planner
|
|
53
|
-
action: args.reason,
|
|
54
|
-
code,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
toolCallsSpan?.end({ output: { toolCalls, generatedCodeSteps } });
|
|
59
|
-
return generatedCodeSteps;
|
|
60
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export declare enum ActionType {
|
|
2
|
-
FILL = "fill",
|
|
3
|
-
PAGE_GOTO = "page_goto",
|
|
4
|
-
CLICK = "click",
|
|
5
|
-
PRESS_ACTION = "keyboard_press_on_element",
|
|
6
|
-
ASSERT_TEXT = "assert_text",
|
|
7
|
-
HOVER = "hover_element",
|
|
8
|
-
SCROLL = "scroll",
|
|
9
|
-
OBSERVATION = "observation",
|
|
10
|
-
UNKNOWN = "unknown"
|
|
11
|
-
}
|
|
12
|
-
export declare function isValidActionType(value: string): value is ActionType;
|
|
13
|
-
export declare function getActionToolCalls(): {
|
|
14
|
-
type: string;
|
|
15
|
-
function: {
|
|
16
|
-
name: string;
|
|
17
|
-
description: string;
|
|
18
|
-
parameters: {
|
|
19
|
-
type: string;
|
|
20
|
-
properties: {
|
|
21
|
-
reason: {
|
|
22
|
-
type: string;
|
|
23
|
-
description: string;
|
|
24
|
-
};
|
|
25
|
-
action: {
|
|
26
|
-
type: string;
|
|
27
|
-
description: string;
|
|
28
|
-
};
|
|
29
|
-
element_description: {
|
|
30
|
-
type: string;
|
|
31
|
-
description: string;
|
|
32
|
-
};
|
|
33
|
-
is_element_visible: {
|
|
34
|
-
type: string;
|
|
35
|
-
description: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
required: string[];
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
}[];
|
|
42
|
-
//# sourceMappingURL=action-tool-calls.d.ts.map
|