@empiricalrun/test-gen 0.57.2 → 0.58.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.
- package/CHANGELOG.md +16 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/skill.js +2 -2
- package/dist/actions/utils/index.js +2 -3
- package/dist/agent/browsing/index.js +1 -2
- package/dist/agent/browsing/run.js +1 -2
- package/dist/agent/browsing/utils.js +10 -10
- package/dist/agent/chat/agent-loop.d.ts +5 -3
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +3 -4
- package/dist/agent/chat/exports.d.ts +4 -4
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +19 -9
- package/dist/agent/chat/index.d.ts +1 -1
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +10 -6
- package/dist/agent/chat/prompt.d.ts +2 -1
- package/dist/agent/chat/prompt.d.ts.map +1 -1
- package/dist/agent/chat/prompt.js +3 -4
- package/dist/agent/chat/repo.d.ts +2 -1
- package/dist/agent/chat/repo.d.ts.map +1 -1
- package/dist/agent/chat/repo.js +32 -36
- package/dist/agent/chat/state.d.ts +1 -2
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +8 -8
- package/dist/agent/codegen/create-test-block.js +1 -2
- package/dist/agent/codegen/fix-ts-errors.js +1 -2
- package/dist/agent/codegen/generate-code-apply-changes.js +2 -3
- package/dist/agent/codegen/lexical-scoped-vars.js +1 -2
- package/dist/agent/codegen/repo-edit.js +2 -3
- package/dist/agent/codegen/run.js +2 -3
- package/dist/agent/codegen/skills-retriever.d.ts +3 -3
- package/dist/agent/codegen/skills-retriever.d.ts.map +1 -1
- package/dist/agent/codegen/skills-retriever.js +2 -2
- package/dist/agent/codegen/test-update-feedback.js +1 -2
- package/dist/agent/codegen/update-flow.js +4 -5
- package/dist/agent/codegen/use-skill.js +1 -2
- package/dist/agent/codegen/utils.js +9 -10
- package/dist/agent/cua/computer.js +3 -4
- package/dist/agent/cua/index.js +2 -3
- package/dist/agent/cua/model.js +1 -2
- package/dist/agent/diagnosis-agent/index.js +2 -3
- package/dist/agent/diagnosis-agent/strict-mode-violation.js +1 -2
- package/dist/agent/enrich-prompt/index.d.ts +1 -1
- package/dist/agent/enrich-prompt/index.d.ts.map +1 -1
- package/dist/agent/enrich-prompt/utils.js +1 -2
- package/dist/agent/infer-agent/index.js +1 -2
- package/dist/agent/master/action-tool-calls.js +3 -3
- package/dist/agent/master/element-annotation.js +2 -3
- package/dist/agent/master/execute-browser-action.d.ts +1 -1
- package/dist/agent/master/execute-browser-action.d.ts.map +1 -1
- package/dist/agent/master/execute-browser-action.js +1 -2
- package/dist/agent/master/execute-skill-action.js +1 -2
- package/dist/agent/master/icon-descriptor/index.js +6 -7
- package/dist/agent/master/icon-descriptor/normalize-svg.js +1 -2
- package/dist/agent/master/next-action.js +1 -2
- package/dist/agent/master/planner.d.ts.map +1 -1
- package/dist/agent/master/planner.js +1 -2
- package/dist/agent/master/run.js +3 -3
- package/dist/agent/master/scroller.js +1 -2
- package/dist/agent/master/with-hints.d.ts +1 -1
- package/dist/agent/master/with-hints.d.ts.map +1 -1
- package/dist/agent/planner/run-time-planner.d.ts.map +1 -1
- package/dist/agent/planner/run-time-planner.js +1 -2
- package/dist/agent/planner/run.js +1 -2
- package/dist/bin/logger/index.js +2 -2
- package/dist/bin/utils/context.js +5 -6
- package/dist/bin/utils/fs/index.d.ts.map +1 -1
- package/dist/bin/utils/fs/index.js +4 -5
- package/dist/bin/utils/index.js +2 -3
- package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
- package/dist/bin/utils/platform/web/index.js +21 -21
- package/dist/bin/utils/scenarios/index.js +3 -4
- package/dist/constants/index.js +1 -1
- package/dist/file/server.js +2 -2
- package/dist/human-in-the-loop/cli.js +1 -2
- package/dist/human-in-the-loop/ipc.js +2 -3
- package/dist/index.js +1 -2
- package/dist/prompts/lib/ts-transformer.js +17 -7
- package/dist/reporter/index.js +3 -3
- package/dist/reporter/lib.js +1 -1
- package/dist/session/index.js +6 -7
- package/dist/test-build/index.js +2 -3
- package/dist/tool-call-service/index.d.ts +1 -2
- package/dist/tool-call-service/index.d.ts.map +1 -1
- package/dist/tools/commit-and-create-pr.js +2 -2
- package/dist/tools/grep/ripgrep/index.js +2 -3
- package/dist/tools/grep/ripgrep/types.d.ts +0 -2
- package/dist/tools/grep/ripgrep/types.d.ts.map +1 -1
- package/dist/tools/str_replace_editor.js +3 -3
- package/dist/tools/test-run-fetcher/index.js +2 -2
- package/dist/tools/utils/index.js +2 -3
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/uploader/index.js +6 -6
- package/dist/uploader/utils.d.ts.map +1 -1
- package/dist/uploader/utils.js +2 -2
- package/dist/utils/checkpoint.js +1 -2
- package/dist/utils/env.js +1 -2
- package/dist/utils/exec.js +2 -2
- package/dist/utils/file-tree.d.ts +3 -0
- package/dist/utils/file-tree.d.ts.map +1 -0
- package/dist/utils/file-tree.js +42 -0
- package/dist/utils/file.js +1 -2
- package/dist/utils/git.js +7 -8
- package/dist/utils/html.d.ts.map +1 -1
- package/dist/utils/pw-test.js +1 -2
- package/dist/utils/repo-tree.d.ts +2 -1
- package/dist/utils/repo-tree.d.ts.map +1 -1
- package/dist/utils/repo-tree.js +62 -53
- package/dist/utils/slug.d.ts.map +1 -1
- package/dist/utils/slug.js +1 -1
- package/dist/utils/string.js +1 -2
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -0
- package/dist/agent/chat/model.d.ts +0 -4
- package/dist/agent/chat/model.d.ts.map +0 -1
- package/dist/agent/chat/model.js +0 -17
|
@@ -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.
|
|
6
|
+
exports.systemPromptBuilderForRepoEdit = systemPromptBuilderForRepoEdit;
|
|
7
|
+
exports.generateCodeAndApplyChanges = generateCodeAndApplyChanges;
|
|
7
8
|
const llm_1 = require("@empiricalrun/llm");
|
|
8
9
|
const fs_1 = __importDefault(require("fs"));
|
|
9
10
|
const path_1 = require("path");
|
|
@@ -214,7 +215,6 @@ ${files}
|
|
|
214
215
|
`;
|
|
215
216
|
return prompt;
|
|
216
217
|
}
|
|
217
|
-
exports.systemPromptBuilderForRepoEdit = systemPromptBuilderForRepoEdit;
|
|
218
218
|
function userPromptBuilderForStrReplace(plan) {
|
|
219
219
|
const prompt = `
|
|
220
220
|
You need to work to achieve the plan provided to you.
|
|
@@ -377,4 +377,3 @@ async function generateCodeAndApplyChanges({ task, trace, logger, getRelevantFil
|
|
|
377
377
|
}
|
|
378
378
|
return deDupUpdatedFiles(updatedFiles);
|
|
379
379
|
}
|
|
380
|
-
exports.generateCodeAndApplyChanges = generateCodeAndApplyChanges;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLexicalScopedVars =
|
|
3
|
+
exports.getLexicalScopedVars = getLexicalScopedVars;
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const promptTemplate_0 = "{{#section \"system\"}}\nYou are a software engineer tasked with analysing Typescript code to identify all variables available in the lexical\nscope at a specific reference point within a file. You will be given a file that contains multiple Playwright tests or\npage object models, along with a reference point inside the file. Your goal is to evaluate the list of all variables\navailable in the lexical scope at that reference point.\n\nTo accomplish this, you need to evaluate the Abstract Syntax Tree (AST) and accumulate all variables that are in the\nlexical scope, which includes:\n1. Variables declared within the test before the reference point.\n2. Arguments of the function.\n3. Variables defined in the parent scope. Identify all variables available in the lexical scope at a specific execution\nreference point within a file, considering only those variables that have been declared and assigned prior to the\nexecution of this point in the code.\n4. Global variables defined in the file.\n\nBefore responding:\n- Ignore variables imported from the `\"./pages\"` path.\n- keep in mind temporal dead zone phenomenon before responding with variables\n{{/section}}\n\n{{#section \"user\"}}\nFile:\n{{testFile}}\n\nReference point:\n{{referencePoint}}\n{{/section}}";
|
|
@@ -53,4 +53,3 @@ async function getLexicalScopedVars({ trace, file, referencePoint, options, }) {
|
|
|
53
53
|
fetchLexicalScopedVarsSpan?.end({ output: { response } });
|
|
54
54
|
return response.variables;
|
|
55
55
|
}
|
|
56
|
-
exports.getLexicalScopedVars = getLexicalScopedVars;
|
|
@@ -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.
|
|
6
|
+
exports.generateCodeUsingRepoAgent = generateCodeUsingRepoAgent;
|
|
7
|
+
exports.repoEditAgent = repoEditAgent;
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const context_1 = require("../../bin/utils/context");
|
|
9
10
|
const web_1 = require("../../bin/utils/platform/web");
|
|
@@ -54,7 +55,6 @@ If all the changes are done, respond with "exit" tool call otherwise respond wit
|
|
|
54
55
|
agentResponse: "",
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
|
-
exports.generateCodeUsingRepoAgent = generateCodeUsingRepoAgent;
|
|
58
58
|
async function repoEditAgent({ trace, task, logger, }) {
|
|
59
59
|
const testgenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
60
60
|
void testgenUpdatesReporter.sendMessage(`Updating test code as per the task. \n View [trace](${trace?.getTraceUrl()})`);
|
|
@@ -83,4 +83,3 @@ async function repoEditAgent({ trace, task, logger, }) {
|
|
|
83
83
|
await testgenUpdatesReporter.sendMessage(`Successfully generated code for the given task. \n View [trace](${trace?.getTraceUrl()})`);
|
|
84
84
|
return repoAgentOutput;
|
|
85
85
|
}
|
|
86
|
-
exports.repoEditAgent = repoEditAgent;
|
|
@@ -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.
|
|
6
|
+
exports.createTestWithCodeAgent = createTestWithCodeAgent;
|
|
7
|
+
exports.generateTestWithCodegen = generateTestWithCodegen;
|
|
7
8
|
const llm_1 = require("@empiricalrun/llm");
|
|
8
9
|
const fs_1 = __importDefault(require("fs"));
|
|
9
10
|
const logger_1 = require("../../bin/logger");
|
|
@@ -64,7 +65,6 @@ ${testCase.steps.join("\n")}`;
|
|
|
64
65
|
fileChanges: updates,
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
|
-
exports.createTestWithCodeAgent = createTestWithCodeAgent;
|
|
68
68
|
async function generateTestWithCodegen({ testCase, file, trace, }) {
|
|
69
69
|
const logger = new logger_1.CustomLogger();
|
|
70
70
|
if (!fs_1.default.existsSync(file)) {
|
|
@@ -118,4 +118,3 @@ async function generateTestWithCodegen({ testCase, file, trace, }) {
|
|
|
118
118
|
})();
|
|
119
119
|
}));
|
|
120
120
|
}
|
|
121
|
-
exports.generateTestWithCodegen = generateTestWithCodegen;
|
|
@@ -2,9 +2,9 @@ import { TraceClient } from "@empiricalrun/llm";
|
|
|
2
2
|
import type { TestCase, TestGenConfigOptions } from "@empiricalrun/shared-types";
|
|
3
3
|
export declare const fetchPomSkills: ({ testCase, pomFiles, options, trace, }: {
|
|
4
4
|
testCase: TestCase;
|
|
5
|
-
pomFiles?: string
|
|
6
|
-
trace?: TraceClient
|
|
7
|
-
options?: TestGenConfigOptions
|
|
5
|
+
pomFiles?: string;
|
|
6
|
+
trace?: TraceClient;
|
|
7
|
+
options?: TestGenConfigOptions;
|
|
8
8
|
}) => Promise<{
|
|
9
9
|
testStep: string;
|
|
10
10
|
filePath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills-retriever.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/skills-retriever.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAmBpC,eAAO,MAAM,cAAc;
|
|
1
|
+
{"version":3,"file":"skills-retriever.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/skills-retriever.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAmBpC,eAAO,MAAM,cAAc,GAAU,yCAKlC;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;;;;;;IAoDA,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,EACzC,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;;;;;;KA6BA"}
|
|
@@ -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.
|
|
6
|
+
exports.fetchPomSkills = void 0;
|
|
7
|
+
exports.getAppropriateSkills = getAppropriateSkills;
|
|
7
8
|
const llm_1 = require("@empiricalrun/llm");
|
|
8
9
|
const fs_1 = __importDefault(require("fs"));
|
|
9
10
|
const logger_1 = require("../../bin/logger");
|
|
@@ -90,4 +91,3 @@ async function getAppropriateSkills({ testCase, options, trace, }) {
|
|
|
90
91
|
fetchSkillsSpan?.end({ output: { validatedSkills } });
|
|
91
92
|
return validatedSkills;
|
|
92
93
|
}
|
|
93
|
-
exports.getAppropriateSkills = getAppropriateSkills;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyTestUpdateFeedbacks =
|
|
3
|
+
exports.applyTestUpdateFeedbacks = applyTestUpdateFeedbacks;
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const utils_1 = require("./utils");
|
|
@@ -47,4 +47,3 @@ Fix the above failures and respond with same format as the previous response`,
|
|
|
47
47
|
applyTestUpdateFeedbacksSpan?.end({ output: { fileChanges } });
|
|
48
48
|
return filteredFileChanges;
|
|
49
49
|
}
|
|
50
|
-
exports.applyTestUpdateFeedbacks = applyTestUpdateFeedbacks;
|
|
@@ -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.
|
|
6
|
+
exports.getUpdateTestCodeCompletion = getUpdateTestCodeCompletion;
|
|
7
|
+
exports.updateTest = updateTest;
|
|
8
|
+
exports.getAppendCreateTestBlockCompletion = getAppendCreateTestBlockCompletion;
|
|
9
|
+
exports.appendCreateTestBlock = appendCreateTestBlock;
|
|
7
10
|
const llm_1 = require("@empiricalrun/llm");
|
|
8
11
|
const fs_1 = __importDefault(require("fs"));
|
|
9
12
|
const logger_1 = require("../../bin/logger");
|
|
@@ -62,7 +65,6 @@ async function getUpdateTestCodeCompletion({ testCase, testFileContent, testFile
|
|
|
62
65
|
agentResponse: response,
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
|
-
exports.getUpdateTestCodeCompletion = getUpdateTestCodeCompletion;
|
|
66
68
|
async function updateTest({ testCase, file, trace, }) {
|
|
67
69
|
const logger = new logger_1.CustomLogger({ useReporter: true });
|
|
68
70
|
const context = await (0, context_1.contextForGeneration)(file);
|
|
@@ -134,7 +136,6 @@ async function updateTest({ testCase, file, trace, }) {
|
|
|
134
136
|
await (0, llm_1.flushAllTraces)();
|
|
135
137
|
return generatedTestCases;
|
|
136
138
|
}
|
|
137
|
-
exports.updateTest = updateTest;
|
|
138
139
|
async function getAppendCreateTestBlockCompletion({ testFiles, pageFiles, testCase, testFilePath, trace, }) {
|
|
139
140
|
const appendCreateTestSpan = trace?.span({
|
|
140
141
|
name: "append-create-test-block",
|
|
@@ -209,7 +210,6 @@ Respond with the same xml format which was originally expected.
|
|
|
209
210
|
appendCreateTestSpan?.end({ output: response });
|
|
210
211
|
return response;
|
|
211
212
|
}
|
|
212
|
-
exports.getAppendCreateTestBlockCompletion = getAppendCreateTestBlockCompletion;
|
|
213
213
|
async function appendCreateTestBlock({ testCase, file, trace, validateTypes = true, }) {
|
|
214
214
|
const logger = new logger_1.CustomLogger({ useReporter: false });
|
|
215
215
|
logger.log("Appending create test block");
|
|
@@ -257,4 +257,3 @@ async function appendCreateTestBlock({ testCase, file, trace, validateTypes = tr
|
|
|
257
257
|
});
|
|
258
258
|
return generatedTestCases;
|
|
259
259
|
}
|
|
260
|
-
exports.appendCreateTestBlock = appendCreateTestBlock;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateSkillUsageCode =
|
|
3
|
+
exports.generateSkillUsageCode = generateSkillUsageCode;
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
5
|
const logger_1 = require("../../bin/logger");
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
@@ -51,4 +51,3 @@ async function generateSkillUsageCode({ task, sampleUsageMethod, scopeVariablesM
|
|
|
51
51
|
console.log(`generated usage code`, response);
|
|
52
52
|
return response;
|
|
53
53
|
}
|
|
54
|
-
exports.generateSkillUsageCode = generateSkillUsageCode;
|
|
@@ -3,7 +3,15 @@ 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.
|
|
6
|
+
exports.extractTestUpdates = extractTestUpdates;
|
|
7
|
+
exports.extractCreateTestUpdates = extractCreateTestUpdates;
|
|
8
|
+
exports.extractAppendTestUpdates = extractAppendTestUpdates;
|
|
9
|
+
exports.extractTestStepsSuggestions = extractTestStepsSuggestions;
|
|
10
|
+
exports.validateTypesAndFormatCode = validateTypesAndFormatCode;
|
|
11
|
+
exports.applyFileChangesUsingStrReplace = applyFileChangesUsingStrReplace;
|
|
12
|
+
exports.applyFileChangesForCreateTest = applyFileChangesForCreateTest;
|
|
13
|
+
exports.searchAndReplaceCode = searchAndReplaceCode;
|
|
14
|
+
exports.applyFileChanges = applyFileChanges;
|
|
7
15
|
const llm_1 = require("@empiricalrun/llm");
|
|
8
16
|
const fs_1 = __importDefault(require("fs"));
|
|
9
17
|
const ts_morph_1 = require("ts-morph");
|
|
@@ -37,7 +45,6 @@ function extractTestUpdates(input) {
|
|
|
37
45
|
}
|
|
38
46
|
return result;
|
|
39
47
|
}
|
|
40
|
-
exports.extractTestUpdates = extractTestUpdates;
|
|
41
48
|
/**
|
|
42
49
|
*
|
|
43
50
|
* method to extract file path and code updates for the LLM response of create flow
|
|
@@ -64,7 +71,6 @@ function extractCreateTestUpdates(input) {
|
|
|
64
71
|
}
|
|
65
72
|
return result;
|
|
66
73
|
}
|
|
67
|
-
exports.extractCreateTestUpdates = extractCreateTestUpdates;
|
|
68
74
|
/**
|
|
69
75
|
*
|
|
70
76
|
* method to extract append create test updates
|
|
@@ -98,7 +104,6 @@ function extractAppendTestUpdates(input) {
|
|
|
98
104
|
}
|
|
99
105
|
return result;
|
|
100
106
|
}
|
|
101
|
-
exports.extractAppendTestUpdates = extractAppendTestUpdates;
|
|
102
107
|
function extractTestStepsSuggestions(input) {
|
|
103
108
|
const result = [];
|
|
104
109
|
// Extract all sections with their subtask tags first
|
|
@@ -126,7 +131,6 @@ function extractTestStepsSuggestions(input) {
|
|
|
126
131
|
}
|
|
127
132
|
return result.filter((r) => !!r.filePath && !!r.usageExample);
|
|
128
133
|
}
|
|
129
|
-
exports.extractTestStepsSuggestions = extractTestStepsSuggestions;
|
|
130
134
|
async function validateTypesAndFormatCode({ validateTypes = true, trace, testCase, filePaths, logger, pomPrompt, nonSpecFilePrompt, }) {
|
|
131
135
|
for (let filePath of filePaths) {
|
|
132
136
|
if (!filePath) {
|
|
@@ -153,7 +157,6 @@ async function validateTypesAndFormatCode({ validateTypes = true, trace, testCas
|
|
|
153
157
|
}
|
|
154
158
|
await (0, llm_1.flushAllTraces)();
|
|
155
159
|
}
|
|
156
|
-
exports.validateTypesAndFormatCode = validateTypesAndFormatCode;
|
|
157
160
|
async function applyFileChangesUsingStrReplace({ trace, fileChanges, logger, }) {
|
|
158
161
|
const repoEditFileChangesSpan = trace?.span({
|
|
159
162
|
name: "repo-edit-file-changes",
|
|
@@ -196,7 +199,6 @@ async function applyFileChangesUsingStrReplace({ trace, fileChanges, logger, })
|
|
|
196
199
|
}
|
|
197
200
|
return results;
|
|
198
201
|
}
|
|
199
|
-
exports.applyFileChangesUsingStrReplace = applyFileChangesUsingStrReplace;
|
|
200
202
|
async function applyFileChangesForCreateTest({ trace, fileChanges, testgenUpdatesReporter, }) {
|
|
201
203
|
const repoEditFileChangesSpan = trace?.span({
|
|
202
204
|
name: "create-test-file-changes",
|
|
@@ -238,7 +240,6 @@ async function applyFileChangesForCreateTest({ trace, fileChanges, testgenUpdate
|
|
|
238
240
|
}
|
|
239
241
|
}
|
|
240
242
|
}
|
|
241
|
-
exports.applyFileChangesForCreateTest = applyFileChangesForCreateTest;
|
|
242
243
|
async function searchAndReplaceCode({ logger, fileChange, }) {
|
|
243
244
|
let contents = fs_1.default.readFileSync(fileChange.filePath, "utf-8");
|
|
244
245
|
// since we dont know what is getting updated,
|
|
@@ -266,7 +267,6 @@ async function searchAndReplaceCode({ logger, fileChange, }) {
|
|
|
266
267
|
updatedContent: contents,
|
|
267
268
|
};
|
|
268
269
|
}
|
|
269
|
-
exports.searchAndReplaceCode = searchAndReplaceCode;
|
|
270
270
|
async function applyFileChanges({ trace, testCase, fileChanges, logger, }) {
|
|
271
271
|
const results = [];
|
|
272
272
|
for (const fileChange of fileChanges) {
|
|
@@ -375,4 +375,3 @@ async function applyFileChanges({ trace, testCase, fileChanges, logger, }) {
|
|
|
375
375
|
}
|
|
376
376
|
return results;
|
|
377
377
|
}
|
|
378
|
-
exports.applyFileChanges = applyFileChanges;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getScreenshot = getScreenshot;
|
|
4
|
+
exports.handlePageGoto = handlePageGoto;
|
|
5
|
+
exports.handleModelAction = handleModelAction;
|
|
4
6
|
const utils_1 = require("../browsing/utils");
|
|
5
7
|
async function getScreenshot(page) {
|
|
6
8
|
const screenshotBytes = await page.screenshot();
|
|
7
9
|
return Buffer.from(screenshotBytes).toString("base64");
|
|
8
10
|
}
|
|
9
|
-
exports.getScreenshot = getScreenshot;
|
|
10
11
|
const CUA_KEY_TO_PLAYWRIGHT_KEY = {
|
|
11
12
|
"/": "Divide",
|
|
12
13
|
"\\": "Backslash",
|
|
@@ -43,7 +44,6 @@ async function handlePageGoto(page, url) {
|
|
|
43
44
|
actionCode: `await page.goto("${url}");\n`,
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
exports.handlePageGoto = handlePageGoto;
|
|
47
47
|
async function getLocatorForClick(page, { x, y }) {
|
|
48
48
|
const locator = await page.evaluate(([x, y]) => {
|
|
49
49
|
const element = document.elementFromPoint(x, y);
|
|
@@ -213,4 +213,3 @@ async function handleModelAction(page, action) {
|
|
|
213
213
|
}
|
|
214
214
|
return { actionSummary, actionCode };
|
|
215
215
|
}
|
|
216
|
-
exports.handleModelAction = handleModelAction;
|
package/dist/agent/cua/index.js
CHANGED
|
@@ -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.
|
|
6
|
+
exports.startPlaywrightCodegen = startPlaywrightCodegen;
|
|
7
|
+
exports.createTestUsingComputerUseAgent = createTestUsingComputerUseAgent;
|
|
7
8
|
const llm_1 = require("@empiricalrun/llm");
|
|
8
9
|
const openai_1 = __importDefault(require("openai"));
|
|
9
10
|
const utils_1 = require("../browsing/utils");
|
|
@@ -30,7 +31,6 @@ async function startPlaywrightCodegen(page) {
|
|
|
30
31
|
});
|
|
31
32
|
await page.pause();
|
|
32
33
|
}
|
|
33
|
-
exports.startPlaywrightCodegen = startPlaywrightCodegen;
|
|
34
34
|
async function createTestUsingComputerUseAgent({ page, task, trace, }) {
|
|
35
35
|
await (0, utils_1.injectPwLocatorGenerator)(page);
|
|
36
36
|
const screenshotBytes = await (0, computer_1.getScreenshot)(page);
|
|
@@ -178,4 +178,3 @@ async function createTestUsingComputerUseAgent({ page, task, trace, }) {
|
|
|
178
178
|
importPaths: [],
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
exports.createTestUsingComputerUseAgent = createTestUsingComputerUseAgent;
|
package/dist/agent/cua/model.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.callComputerUseModel =
|
|
3
|
+
exports.callComputerUseModel = callComputerUseModel;
|
|
4
4
|
const INSTRUCTIONS = `You will be asked to execute some actions in a browser context.
|
|
5
5
|
Don't ask the user for confirmations - just execute the actions.
|
|
6
6
|
|
|
@@ -50,4 +50,3 @@ async function callComputerUseModel({ input, previousResponseId, screenWidth, sc
|
|
|
50
50
|
});
|
|
51
51
|
return response;
|
|
52
52
|
}
|
|
53
|
-
exports.callComputerUseModel = callComputerUseModel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTaskUsingFailureDiagnosis =
|
|
3
|
+
exports.createTaskUsingFailureDiagnosis = createTaskUsingFailureDiagnosis;
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
5
|
const session_1 = require("../../session");
|
|
6
6
|
const strict_mode_violation_1 = require("./strict-mode-violation");
|
|
@@ -75,7 +75,7 @@ async function createTaskUsingFailureDiagnosis({ trace, diagnosis, logger, }) {
|
|
|
75
75
|
const llmResponse = await llm.createChatCompletion({
|
|
76
76
|
messages: prompt,
|
|
77
77
|
modelParameters: {
|
|
78
|
-
max_completion_tokens:
|
|
78
|
+
max_completion_tokens: 40_000,
|
|
79
79
|
},
|
|
80
80
|
responseFormat,
|
|
81
81
|
});
|
|
@@ -95,4 +95,3 @@ async function createTaskUsingFailureDiagnosis({ trace, diagnosis, logger, }) {
|
|
|
95
95
|
task: "",
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
exports.createTaskUsingFailureDiagnosis = createTaskUsingFailureDiagnosis;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fixStrictModeViolationPrompt =
|
|
3
|
+
exports.fixStrictModeViolationPrompt = fixStrictModeViolationPrompt;
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
5
|
const promptTemplate_0 = "{{#section \"system\"}}\nAs a software engineer, your task is to identify a fix for a failing Playwright test by analyzing screenshots of both the failed and successful test steps.\n\nKey issues for test failures include:\n- Duplicate elements for the same Playwright selector.\n\nInstructions:\n1. Examine the provided successful and failed test screenshots.\n2. Identify the correct element for action based on these observations on the successful test run screenshots.\n3. Sometimes the exact same locator is not available on failed test run screenshot, you need to identify the intent from successful test screenshots and apply that intent in failed test run screenshot to identify the right locator to interact with\n4. Evaluate the playwright selector options provided to you to execute the action. Pick the selector which best matches the intent of the test.\n5. Propose a precise action that addresses the issue.\n\nExample:\n- observation: \n - Current step failure: await page.getByText(\"Audience\").click()\n - Two similar buttons named \"Audience\" exist in the failed run screenshots\n - The successful test run clicked on \"Untracked Audience\"\n - The failed test run should click on \"Untracked Audience\"\n - Available locators: await page.getByText(\"Untracked Audience\").click() contain the selector for Untracked Audience\n- action: Replace failing line with await page.getByText(\"Untracked Audience\").click()\n\nYour action should:\n- Be directly actionable and free of ambiguity, as it will guide another LLM to generate code.\n- Be in natural language and not just code snippet.\n- Be verified as feasible on the failure screen before responding.\n- Choose from the provided possible actions that can be executed on the failure screen.\n- Action should adhere to the format mentioned in the example, i.e. it should start with \"Replace the failing line\" and the updated code with replaced selector following it.\n\nEnsure the action is executable based on the failure screen context before providing it.\n{{/section}}\n\n{{#section \"user\"}}\nSuccessful test screenshots\n\n{{images successScreenshots}}\n\nFailed test screenshots\n\n{{images failedScreenshots}}\n\nStep where test failed:\n{{failingLine}}\n\nOptions for Playwright selectors to perform actions on a failed test screen:\n{{selectorOptions}}\n\n{{/section}}\n\n";
|
|
6
6
|
function extractLocatorOptions(errorStack) {
|
|
@@ -28,4 +28,3 @@ function fixStrictModeViolationPrompt({ screenshotsData, diagnosis, }) {
|
|
|
28
28
|
});
|
|
29
29
|
return compiledPrompt;
|
|
30
30
|
}
|
|
31
|
-
exports.fixStrictModeViolationPrompt = fixStrictModeViolationPrompt;
|
|
@@ -3,7 +3,7 @@ export declare const enrichPromptWithFailingLine: ({ trace, testBlock, testFileP
|
|
|
3
3
|
testBlock: string;
|
|
4
4
|
testFilePath: string;
|
|
5
5
|
suggestionForFix: string;
|
|
6
|
-
trace?: TraceClient
|
|
6
|
+
trace?: TraceClient;
|
|
7
7
|
}) => Promise<{
|
|
8
8
|
output: string;
|
|
9
9
|
is_user_message_enriched: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/enrich-prompt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAmCpE,eAAO,MAAM,2BAA2B;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/enrich-prompt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAmCpE,eAAO,MAAM,2BAA2B,GAAU,uDAK/C;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,KAAG,OAAO,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB,EAAE,OAAO,CAAC;IAClC,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAwDA,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractGenerateRequestedChange =
|
|
3
|
+
exports.extractGenerateRequestedChange = extractGenerateRequestedChange;
|
|
4
4
|
function extractGenerateRequestedChange(input) {
|
|
5
5
|
const regex = /<reason_for_output>([\s\S]*?)<\/reason_for_output>[\s\S]*?<is_user_message_enriched>([\s\S]*?)<\/is_user_message_enriched>[\s\S]*?<output>([\s\S]*?)<\/output>/g;
|
|
6
6
|
const match = regex.exec(input);
|
|
@@ -9,4 +9,3 @@ function extractGenerateRequestedChange(input) {
|
|
|
9
9
|
const output = match[3]?.trim() || "";
|
|
10
10
|
return { reason_for_output, is_user_message_enriched, output };
|
|
11
11
|
}
|
|
12
|
-
exports.extractGenerateRequestedChange = extractGenerateRequestedChange;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.inferAgentBasedTask =
|
|
3
|
+
exports.inferAgentBasedTask = inferAgentBasedTask;
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const promptTemplate_0 = "{{#section \"system\"}}\nYou are a software test engineer specializing in Playwright end-to-end tests. You are given a task which is a part of an\nend-to-end test scenario. The task may involve updating an existing end-to-end test case or writing a new test case from\nscratch. Tests involve user interactions (e.g. click on element) or other actions supported by Playwright (e.g.\nintercept network requests)\n\nYour objective is to identify whether the task requires accessing a web browser or not.\n\nTo fulfill your objective, answer the following questions:\n\n1. Does it require you to interact with a UI element in the browser? Examples of interactions are click, fill, type, key\npress, assert visibility of the element. Actions that interact with network requests are not UI element interactions.\n\n2. Is the locator of this UI element given to you in the task? Locators look like `getByText(...)`, `getByTestId(...)`\nand other locator methods in Playwright\n\n3. Decide if you need a browser: if you need to interact with a UI element AND you are NOT given the locator for that\nelement, you WILL NEED a browser.\n\n4. If you NEED a browser, then respond with answer as \"master\", otherwise respond with \"code\"\n\n\n# Example 1\n## Input\nTask:\nin this test don't delete the agent and remove steps after that\n\n## Output\n- ui_interaction_to_be_performed: There is no interaction here\n- ui_element_to_interact_with: No element specified\n- has_locator_for_that_element: No element specified\n- reasoning_for_browser_required: No interaction hence browser is not required\n- answer: code\n\n# Example 2\n## Input\nTask:\nin the swapfast test, replace the selectTokenForSwap method. Instead we will do this\\nclick on token button - this will\nshow a drawer\\nEnter usd in the search field that shows up in the drawer\\nSelect USDC.axl for Cosmos Hub - very\nimportant to choose this instead of USDC.axl on Osmosis\n\n## Output\n- ui_interaction_to_be_performed: Click on token button\n- ui_element_to_interact_with: Token button\n- has_locator_for_that_element: false\n- reasoning_for_browser_required: Task requires interacting with a UI element and identifying its locator which needs a\nbrowser\n- answer: master\n{{/section}}\n\n{{#section \"user\"}}\nTask:\n{{task}}\n{{/section}}";
|
|
@@ -58,4 +58,3 @@ async function inferAgentBasedTask({ task, options, trace, }) {
|
|
|
58
58
|
response: output.response,
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
exports.inferAgentBasedTask = inferAgentBasedTask;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ActionType = void 0;
|
|
4
|
+
exports.isValidActionType = isValidActionType;
|
|
5
|
+
exports.getActionToolCalls = getActionToolCalls;
|
|
4
6
|
var ActionType;
|
|
5
7
|
(function (ActionType) {
|
|
6
8
|
ActionType["FILL"] = "fill";
|
|
@@ -16,7 +18,6 @@ var ActionType;
|
|
|
16
18
|
function isValidActionType(value) {
|
|
17
19
|
return Object.values(ActionType).includes(value);
|
|
18
20
|
}
|
|
19
|
-
exports.isValidActionType = isValidActionType;
|
|
20
21
|
const createActionCall = (name, description, additionalProperties = {}) => ({
|
|
21
22
|
type: "function",
|
|
22
23
|
function: {
|
|
@@ -84,4 +85,3 @@ function getActionToolCalls() {
|
|
|
84
85
|
}),
|
|
85
86
|
];
|
|
86
87
|
}
|
|
87
|
-
exports.getActionToolCalls = getActionToolCalls;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getElementAnnotation = getElementAnnotation;
|
|
4
|
+
exports.getAnnotationKeys = getAnnotationKeys;
|
|
4
5
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
6
|
const constants_1 = require("../../constants");
|
|
6
7
|
const promptTemplate_0 = "{{#section \"system\"}}\nYou are an expert in describing the images and it's content. You need to provide the descriptions of annotated elements\npresent in the image.\n\nYou will be provided with an annotated screenshot where interact-able / clickable elements are annotated. The annotation\nis done by drawing a red box around the element and a small yellow box on it which contains unique element id.\n\nYou are given a Annotations which contains list of unique element id and description of the element separated by \":\".\n\nYou are also given the description of the element on which the action needs to be taken. The description includes\ninformation about how the element looks, it's position etc.\n\nYour task is to provide the annotation of the element on which the action needs to be performed based on the element\ndescription.\n\nFollow steps to fulfil your task:\n- Using the list of all element Ids provided to you, map all the element Ids on the annotated screen and describe each\nelement.\n- For describing each element Id\n-- iterate over each element Id in annotation list\n-- check if the description is already present for the element Id in the Annotation provided to you. If present skip\ndescribing it and use it as is.\n-- if the description is NA, then identify the element in the annotated screenshot and describe it using the image or\nicon enclosed in the element.\n- Respond with the mapped element Ids as \"enriched_annotations\"\n- Based on the description provided to you and the enriched annotations, first identify the element Id whose description\nmatches the task provided\n\nNote:\n- Ensure providing the description of all the elements in the list.\n- Don't update the description if its already present in the given annotations\n- Replace all the \"NA\" with description of the element. Its position, how does it look like etc.\n- There should be no \"NA\" present in any of the element description\n{{/section}}\n\n{{#section \"user\"}}\nElement description:\n{{elementDescription}}\n\nAnnotations:\n{{annotations}}\n\n{{image annotatedScreenshot}}\n{{/section}}";
|
|
@@ -98,7 +99,6 @@ async function getElementAnnotation({ elementDescription, annotations, annotated
|
|
|
98
99
|
}
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
|
-
exports.getElementAnnotation = getElementAnnotation;
|
|
102
102
|
async function getAnnotationKeys({ page, preference, trace, }) {
|
|
103
103
|
const annotatedElements = await page.evaluate(({ preference, options }) => {
|
|
104
104
|
// @ts-ignore
|
|
@@ -164,7 +164,6 @@ async function getAnnotationKeys({ page, preference, trace, }) {
|
|
|
164
164
|
annotatedPageScreenshot,
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
|
-
exports.getAnnotationKeys = getAnnotationKeys;
|
|
168
167
|
async function enrichAnnotations(annotatedElements, pageHtml, trace) {
|
|
169
168
|
// create icon descriptor span
|
|
170
169
|
const iconDescriptionSpan = trace?.span({
|
|
@@ -18,7 +18,7 @@ export declare function executeBrowserAction({ page, nextAction, flags, actions,
|
|
|
18
18
|
output: {
|
|
19
19
|
action: string;
|
|
20
20
|
reason: string;
|
|
21
|
-
elementAnnotation?: string
|
|
21
|
+
elementAnnotation?: string;
|
|
22
22
|
};
|
|
23
23
|
}>;
|
|
24
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;AAWlD,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
|
|
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;AAWlD,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;4BACM,MAAM;;GAiI7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executeBrowserAction =
|
|
3
|
+
exports.executeBrowserAction = executeBrowserAction;
|
|
4
4
|
const reporter_1 = require("../../reporter");
|
|
5
5
|
const browsing_1 = require("../browsing");
|
|
6
6
|
const action_tool_calls_1 = require("./action-tool-calls");
|
|
@@ -120,4 +120,3 @@ async function executeBrowserAction({ page, nextAction, flags, actions, llm, tra
|
|
|
120
120
|
output,
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
exports.executeBrowserAction = executeBrowserAction;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executeSkillAction =
|
|
3
|
+
exports.executeSkillAction = executeSkillAction;
|
|
4
4
|
const skill_1 = require("../../actions/skill");
|
|
5
5
|
const errors_1 = require("../../errors");
|
|
6
6
|
const human_in_the_loop_1 = require("../../human-in-the-loop");
|
|
@@ -21,4 +21,3 @@ async function executeSkillAction({ actions, nextAction, trace, }) {
|
|
|
21
21
|
return code;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
exports.executeSkillAction = executeSkillAction;
|
|
@@ -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.
|
|
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 =
|
|
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 =
|
|
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
|
|
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 =
|
|
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;
|