@empiricalrun/test-gen 0.79.2 → 0.79.3
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 +8 -0
- package/dist/agent/chat/exports.d.ts +1 -0
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +3 -1
- package/dist/agent/chat/index.js +1 -1
- package/dist/agent/chat/prompt/repo.d.ts.map +1 -1
- package/dist/agent/chat/prompt/repo.js +4 -3
- package/dist/agent/fast-triage/index.d.ts +8 -0
- package/dist/agent/fast-triage/index.d.ts.map +1 -0
- package/dist/agent/fast-triage/index.js +51 -0
- package/dist/agent/index.d.ts +2 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +4 -1
- package/dist/agent/triage/index.js +2 -2
- package/dist/bin/index.js +5 -3
- package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
- package/dist/bin/utils/platform/web/index.js +3 -2
- package/dist/dashboard/client.d.ts +11 -1
- package/dist/dashboard/client.d.ts.map +1 -1
- package/dist/dashboard/client.js +22 -9
- package/dist/file-info/adapters/github/index.d.ts.map +1 -1
- package/dist/file-info/adapters/github/index.js +1 -1
- package/dist/generate-summary/frame-sampling.d.ts +12 -0
- package/dist/generate-summary/frame-sampling.d.ts.map +1 -0
- package/dist/generate-summary/frame-sampling.js +72 -0
- package/dist/generate-summary/generate-error-stack-summary.d.ts +11 -0
- package/dist/generate-summary/generate-error-stack-summary.d.ts.map +1 -0
- package/dist/generate-summary/generate-error-stack-summary.js +44 -0
- package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.d.ts +58 -0
- package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.d.ts.map +1 -0
- package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.js +460 -0
- package/dist/generate-summary/generate-grouped-summary.d.ts +18 -0
- package/dist/generate-summary/generate-grouped-summary.d.ts.map +1 -0
- package/dist/generate-summary/generate-grouped-summary.js +91 -0
- package/dist/generate-summary/merge-summary.d.ts +16 -0
- package/dist/generate-summary/merge-summary.d.ts.map +1 -0
- package/dist/generate-summary/merge-summary.js +46 -0
- package/dist/generate-summary/pick-videos-for-comparison.d.ts +9 -0
- package/dist/generate-summary/pick-videos-for-comparison.d.ts.map +1 -0
- package/dist/generate-summary/pick-videos-for-comparison.js +54 -0
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +3 -1
- package/dist/tools/definitions/delete-file.js +1 -1
- package/dist/tools/definitions/grep.d.ts.map +1 -1
- package/dist/tools/definitions/grep.js +1 -1
- package/dist/tools/definitions/rename-file.js +2 -2
- package/dist/tools/definitions/safe-bash.d.ts.map +1 -1
- package/dist/tools/definitions/safe-bash.js +10 -8
- package/dist/tools/definitions/str_replace_editor.d.ts.map +1 -1
- package/dist/tools/definitions/str_replace_editor.js +12 -4
- package/dist/tools/definitions/trace-dot-zip.d.ts +7 -0
- package/dist/tools/definitions/trace-dot-zip.d.ts.map +1 -0
- package/dist/tools/definitions/trace-dot-zip.js +16 -0
- package/dist/tools/definitions/utils.js +1 -1
- package/dist/tools/delete-file/index.d.ts.map +1 -1
- package/dist/tools/delete-file/index.js +9 -6
- package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
- package/dist/tools/diagnosis-fetcher.js +40 -2
- package/dist/tools/fetch-file/index.d.ts.map +1 -1
- package/dist/tools/fetch-file/index.js +102 -3
- package/dist/tools/file-operations/index.d.ts.map +1 -1
- package/dist/tools/file-operations/index.js +7 -5
- package/dist/tools/file-operations/shared/helpers.d.ts +13 -0
- package/dist/tools/file-operations/shared/helpers.d.ts.map +1 -1
- package/dist/tools/file-operations/shared/helpers.js +24 -0
- package/dist/tools/file-operations/view/index.d.ts.map +1 -1
- package/dist/tools/file-operations/view/index.js +9 -3
- package/dist/tools/grep/index.d.ts.map +1 -1
- package/dist/tools/grep/index.js +7 -2
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +6 -6
- package/dist/tools/merge-conflicts/index.d.ts.map +1 -1
- package/dist/tools/merge-conflicts/index.js +8 -8
- package/dist/tools/rename-file/index.d.ts.map +1 -1
- package/dist/tools/rename-file/index.js +11 -7
- package/dist/tools/run-test.d.ts.map +1 -1
- package/dist/tools/run-test.js +12 -7
- package/dist/tools/safe-bash/index.d.ts.map +1 -1
- package/dist/tools/safe-bash/index.js +18 -2
- package/dist/tools/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/test-gen-browser.js +12 -9
- package/dist/tools/trace-dot-zip/index.d.ts +3 -1
- package/dist/tools/trace-dot-zip/index.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/index.js +8 -20
- package/dist/tools/trace-dot-zip/utils/console-trace.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/utils/console-trace.js +11 -5
- package/dist/tools/trace-dot-zip/utils/extract-screenshots.d.ts +27 -0
- package/dist/tools/trace-dot-zip/utils/extract-screenshots.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/utils/extract-screenshots.js +128 -0
- package/dist/tools/trace-dot-zip/utils/extract-steps.d.ts +12 -0
- package/dist/tools/trace-dot-zip/utils/extract-steps.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/utils/extract-steps.js +130 -0
- package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts +13 -16
- package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/utils/extract-zip.js +27 -167
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/utils/network-trace.js +136 -105
- package/dist/trace-utils/cli.d.ts +3 -0
- package/dist/trace-utils/cli.d.ts.map +1 -0
- package/dist/trace-utils/cli.js +302 -0
- package/dist/trace-utils/console.d.ts +11 -0
- package/dist/trace-utils/console.d.ts.map +1 -0
- package/dist/trace-utils/console.js +74 -0
- package/dist/trace-utils/dom-snapshot.d.ts +19 -0
- package/dist/trace-utils/dom-snapshot.d.ts.map +1 -0
- package/dist/trace-utils/dom-snapshot.js +328 -0
- package/dist/trace-utils/index.d.ts +8 -0
- package/dist/trace-utils/index.d.ts.map +1 -1
- package/dist/trace-utils/index.js +19 -1
- package/dist/trace-utils/network.d.ts +16 -0
- package/dist/trace-utils/network.d.ts.map +1 -0
- package/dist/trace-utils/network.js +178 -0
- package/dist/trace-utils/normalize-trace-url.d.ts +2 -0
- package/dist/trace-utils/normalize-trace-url.d.ts.map +1 -0
- package/dist/trace-utils/normalize-trace-url.js +15 -0
- package/dist/trace-utils/screenshots.d.ts +24 -0
- package/dist/trace-utils/screenshots.d.ts.map +1 -0
- package/dist/trace-utils/screenshots.js +197 -0
- package/dist/trace-utils/steps.d.ts +10 -0
- package/dist/trace-utils/steps.d.ts.map +1 -0
- package/dist/trace-utils/steps.js +126 -0
- package/dist/trace-utils/types.d.ts +51 -0
- package/dist/trace-utils/types.d.ts.map +1 -0
- package/dist/trace-utils/types.js +2 -0
- package/dist/utils/playwright-report-parser.d.ts +1 -12
- package/dist/utils/playwright-report-parser.d.ts.map +1 -1
- package/dist/utils/playwright-report-parser.js +8 -136
- package/dist/video-core/index.d.ts.map +1 -1
- package/dist/video-core/index.js +17 -33
- package/package.json +12 -6
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizePath = normalizePath;
|
|
3
4
|
exports.formatLinesWithNumbers = formatLinesWithNumbers;
|
|
4
5
|
exports.isBinaryFile = isBinaryFile;
|
|
5
6
|
exports.getUniqueOccurences = getUniqueOccurences;
|
|
7
|
+
/**
|
|
8
|
+
* Normalizes a path by removing the /repo/ prefix if present.
|
|
9
|
+
* This supports both absolute paths (/repo/...) and relative paths.
|
|
10
|
+
*
|
|
11
|
+
* @param filePath - The path to normalize (can be /repo/path/to/file or path/to/file)
|
|
12
|
+
* @returns The normalized relative path from repository root
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* normalizePath('/repo/tests/foo.spec.ts') // returns 'tests/foo.spec.ts'
|
|
16
|
+
* normalizePath('tests/foo.spec.ts') // returns 'tests/foo.spec.ts'
|
|
17
|
+
* normalizePath('/repo/./tests/foo.spec.ts') // returns 'tests/foo.spec.ts'
|
|
18
|
+
*/
|
|
19
|
+
function normalizePath(filePath) {
|
|
20
|
+
// Remove leading /repo/ or /repo if present
|
|
21
|
+
let normalized = filePath.replace(/^\/repo\/?/, "");
|
|
22
|
+
// Handle edge case where path is exactly '/repo'
|
|
23
|
+
if (filePath === "/repo" || filePath === "/repo/") {
|
|
24
|
+
return ".";
|
|
25
|
+
}
|
|
26
|
+
// Remove leading slash if present (for paths like /tests/foo.spec.ts)
|
|
27
|
+
normalized = normalized.replace(/^\/+/, "");
|
|
28
|
+
return normalized;
|
|
29
|
+
}
|
|
6
30
|
function formatLinesWithNumbers(content, viewRange) {
|
|
7
31
|
const lines = content.split("\n");
|
|
8
32
|
if (viewRange) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/file-operations/view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAInE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG/D,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/file-operations/view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAInE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG/D,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,UAAU,CAAC,CAmCrB"}
|
|
@@ -16,15 +16,21 @@ async function fileViewExecutor(params) {
|
|
|
16
16
|
isError: true,
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
// Normalize the path to support both /repo/... and relative paths
|
|
20
|
+
const normalizedFilePath = (0, helpers_1.normalizePath)(filePath);
|
|
21
|
+
if ((0, helpers_1.isBinaryFile)(normalizedFilePath)) {
|
|
20
22
|
return {
|
|
21
23
|
result: "Error: File is binary, which is not supported",
|
|
22
24
|
isError: true,
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
27
|
try {
|
|
26
|
-
const absoluteFilePath = path_1.default.join(repoPath,
|
|
27
|
-
return (0, file_info_1.viewFileUsingFileSystem)({
|
|
28
|
+
const absoluteFilePath = path_1.default.join(repoPath, normalizedFilePath);
|
|
29
|
+
return (0, file_info_1.viewFileUsingFileSystem)({
|
|
30
|
+
input,
|
|
31
|
+
filePath: normalizedFilePath,
|
|
32
|
+
absoluteFilePath,
|
|
33
|
+
});
|
|
28
34
|
}
|
|
29
35
|
catch (error) {
|
|
30
36
|
const msg = error instanceof Error ? error.message : "Unknown error occurred";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/grep/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EAEL,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/grep/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EAEL,MAAM,uCAAuC,CAAC;AA6I/C,eAAO,MAAM,QAAQ,EAAE,IAYtB,CAAC"}
|
package/dist/tools/grep/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const util_1 = require("util");
|
|
|
10
10
|
const zod_1 = require("zod");
|
|
11
11
|
const constants_1 = require("../../constants");
|
|
12
12
|
const grep_1 = require("../definitions/grep");
|
|
13
|
+
const helpers_1 = require("../file-operations/shared/helpers");
|
|
13
14
|
const ripgrep_1 = require("./ripgrep");
|
|
14
15
|
const GrepInputSchema = zod_1.z.object({
|
|
15
16
|
pattern: zod_1.z
|
|
@@ -26,7 +27,9 @@ const GrepInputSchema = zod_1.z.object({
|
|
|
26
27
|
});
|
|
27
28
|
async function usingSystemGrep(input, repoPath, logger) {
|
|
28
29
|
try {
|
|
29
|
-
|
|
30
|
+
// Normalize the directory path to support both /repo/... and relative paths
|
|
31
|
+
const normalizedDir = input.directory ? (0, helpers_1.normalizePath)(input.directory) : "";
|
|
32
|
+
const dir = path_1.default.join(repoPath, normalizedDir);
|
|
30
33
|
// Create exclude pattern for grep
|
|
31
34
|
const excludePatterns = constants_1.DEFAULT_EXCLUDE.map((pattern) => typeof pattern === "string" ? pattern : pattern.source)
|
|
32
35
|
.map((pattern) => `--exclude-dir="${pattern}"`)
|
|
@@ -78,7 +81,9 @@ async function usingSystemGrep(input, repoPath, logger) {
|
|
|
78
81
|
}
|
|
79
82
|
async function usingRipgrep(input, repoPath, logger) {
|
|
80
83
|
try {
|
|
81
|
-
|
|
84
|
+
// Normalize the directory path to support both /repo/... and relative paths
|
|
85
|
+
const normalizedDir = input.directory ? (0, helpers_1.normalizePath)(input.directory) : "";
|
|
86
|
+
const dir = path_1.default.join(repoPath, normalizedDir);
|
|
82
87
|
const escapedPattern = input.pattern
|
|
83
88
|
.replace(/[.*+?^${}()|[\]\\"'`]/g, "\\$&") // Escape special characters that have meaning in regex/grep/shell
|
|
84
89
|
.replace(/[&;<>]/g, "\\$&") // Escape shell special characters
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PendingToolCall, SupportedChatModels, Tool, ToolDefinition } from "@empiricalrun/shared-types/chat-agent";
|
|
2
2
|
import { ServicePayload } from "@empiricalrun/shared-types/tool-execute-service";
|
|
3
|
+
export { safeBashTool } from "./definitions/safe-bash";
|
|
3
4
|
export { scrapeHtmlTool } from "./firecrawl-scrape";
|
|
4
|
-
export { safeBashTool } from "./safe-bash";
|
|
5
5
|
export { validateToolInput } from "./utils/validate-schema";
|
|
6
6
|
type ToolOrToolDefinition = Tool | ToolDefinition;
|
|
7
7
|
export declare const commonTools: ToolOrToolDefinition[];
|
|
@@ -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;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAiCjF,OAAO,EAAE,
|
|
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;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAiCjF,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;AAIlD,eAAO,MAAM,WAAW,EAAE,oBAAoB,EAS7C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,oBAAoB,EAOrD,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,oBAAoB,EAerD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,WAE9D;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;AAED,wBAAsB,4BAA4B,CAAC,OAAO,EAAE,cAAc,iBAoBzE"}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.allToolsDefinitions = exports.testGenerationTools = exports.commonTools = exports.validateToolInput = exports.
|
|
3
|
+
exports.allToolsDefinitions = exports.testGenerationTools = exports.commonTools = exports.validateToolInput = exports.scrapeHtmlTool = exports.safeBashTool = void 0;
|
|
4
4
|
exports.hasBuiltInTextEditor = hasBuiltInTextEditor;
|
|
5
5
|
exports.textEditorToolsForModel = textEditorToolsForModel;
|
|
6
6
|
exports.textViewToolsForModel = textViewToolsForModel;
|
|
@@ -17,8 +17,10 @@ const list_tests_and_projects_1 = require("./definitions/list-tests-and-projects
|
|
|
17
17
|
const merge_conflicts_1 = require("./definitions/merge-conflicts");
|
|
18
18
|
const rename_file_1 = require("./definitions/rename-file");
|
|
19
19
|
const run_test_1 = require("./definitions/run-test");
|
|
20
|
+
const safe_bash_1 = require("./definitions/safe-bash");
|
|
20
21
|
const str_replace_editor_1 = require("./definitions/str_replace_editor");
|
|
21
22
|
const test_gen_browser_1 = require("./definitions/test-gen-browser");
|
|
23
|
+
const trace_dot_zip_1 = require("./definitions/trace-dot-zip");
|
|
22
24
|
const upgrade_packages_1 = require("./definitions/upgrade-packages");
|
|
23
25
|
const diagnosis_fetcher_1 = require("./diagnosis-fetcher");
|
|
24
26
|
const fetch_file_1 = require("./fetch-file");
|
|
@@ -26,15 +28,13 @@ const fetch_session_diff_1 = require("./fetch-session-diff");
|
|
|
26
28
|
const firecrawl_scrape_1 = require("./firecrawl-scrape");
|
|
27
29
|
const issues_v1_1 = require("./issues-v1");
|
|
28
30
|
const list_environments_1 = require("./list-environments");
|
|
29
|
-
const safe_bash_1 = require("./safe-bash");
|
|
30
31
|
const test_run_fetcher_1 = require("./test-run-fetcher");
|
|
31
|
-
const trace_dot_zip_1 = require("./trace-dot-zip");
|
|
32
32
|
const triage_summary_1 = require("./triage-summary");
|
|
33
33
|
const queue_1 = require("./utils/queue");
|
|
34
|
+
var safe_bash_2 = require("./definitions/safe-bash");
|
|
35
|
+
Object.defineProperty(exports, "safeBashTool", { enumerable: true, get: function () { return safe_bash_2.safeBashTool; } });
|
|
34
36
|
var firecrawl_scrape_2 = require("./firecrawl-scrape");
|
|
35
37
|
Object.defineProperty(exports, "scrapeHtmlTool", { enumerable: true, get: function () { return firecrawl_scrape_2.scrapeHtmlTool; } });
|
|
36
|
-
var safe_bash_2 = require("./safe-bash");
|
|
37
|
-
Object.defineProperty(exports, "safeBashTool", { enumerable: true, get: function () { return safe_bash_2.safeBashTool; } });
|
|
38
38
|
var validate_schema_1 = require("./utils/validate-schema");
|
|
39
39
|
Object.defineProperty(exports, "validateToolInput", { enumerable: true, get: function () { return validate_schema_1.validateToolInput; } });
|
|
40
40
|
// TODO: Keep this list in sync with the ToolExecutor
|
|
@@ -45,7 +45,7 @@ exports.commonTools = [
|
|
|
45
45
|
list_environments_1.listEnvironmentsTool,
|
|
46
46
|
download_build_1.downloadBuildTool,
|
|
47
47
|
fetch_file_1.fetchFileTool,
|
|
48
|
-
trace_dot_zip_1.
|
|
48
|
+
trace_dot_zip_1.traceDotZip,
|
|
49
49
|
list_tests_and_projects_1.listProjectsTool,
|
|
50
50
|
list_tests_and_projects_1.listTestsForProjectTool,
|
|
51
51
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/merge-conflicts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAgDlE,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/merge-conflicts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAgDlE,eAAO,MAAM,kBAAkB,EAAE,IAmEhC,CAAC"}
|
|
@@ -43,24 +43,23 @@ function getConflictedFilesWithContents(repoPath) {
|
|
|
43
43
|
exports.mergeConflictsTool = {
|
|
44
44
|
...merge_conflicts_1.mergeConflictsTool,
|
|
45
45
|
execute: async ({ repoPath, chatSession }) => {
|
|
46
|
-
const
|
|
46
|
+
const baseBranch = chatSession?.baseBranchName || "main";
|
|
47
47
|
try {
|
|
48
|
-
|
|
49
|
-
(0, child_process_1.execSync)(`git remote set-branches --add origin ${targetBranch}`, {
|
|
48
|
+
(0, child_process_1.execSync)(`git remote set-branches --add origin ${baseBranch}`, {
|
|
50
49
|
cwd: repoPath,
|
|
51
50
|
});
|
|
52
|
-
(0, child_process_1.execSync)(`git fetch origin ${
|
|
51
|
+
(0, child_process_1.execSync)(`git fetch origin ${baseBranch}`, { cwd: repoPath });
|
|
53
52
|
// Configure git user for merge
|
|
54
53
|
(0, child_process_1.execSync)(`git config user.name "${git_1.GIT_USER_NAME}"`, { cwd: repoPath });
|
|
55
54
|
(0, child_process_1.execSync)(`git config user.email "${git_1.GIT_USER_EMAIL}"`, { cwd: repoPath });
|
|
56
55
|
// Run merge command and commit (with or without conflict)
|
|
57
|
-
const mergeResult = runMerge(repoPath,
|
|
56
|
+
const mergeResult = runMerge(repoPath, baseBranch);
|
|
58
57
|
const branchName = await (0, git_1.getCurrentBranchName)(repoPath);
|
|
59
58
|
if (mergeResult === "CLEAN") {
|
|
60
59
|
(0, child_process_1.execSync)(`git push origin ${branchName}`, { cwd: repoPath });
|
|
61
60
|
return {
|
|
62
61
|
isError: false,
|
|
63
|
-
result: `Merge from ${
|
|
62
|
+
result: `Merge from ${baseBranch} was successful, without any conflicts.`,
|
|
64
63
|
};
|
|
65
64
|
}
|
|
66
65
|
else if (mergeResult === "CONFLICTS") {
|
|
@@ -72,8 +71,9 @@ exports.mergeConflictsTool = {
|
|
|
72
71
|
result: `Merge failed with exit code 1, but no conflicted files were found.`,
|
|
73
72
|
};
|
|
74
73
|
}
|
|
74
|
+
// TODO(now): Should avoid the commit and let executor do it?
|
|
75
75
|
(0, git_1.stageAndCommitFilesAsBotUser)({
|
|
76
|
-
commitMessage: `Merge from ${
|
|
76
|
+
commitMessage: `Merge from ${baseBranch} with conflicts`,
|
|
77
77
|
files: filePaths,
|
|
78
78
|
repoPath,
|
|
79
79
|
});
|
|
@@ -84,7 +84,7 @@ exports.mergeConflictsTool = {
|
|
|
84
84
|
.join("\n\n");
|
|
85
85
|
return {
|
|
86
86
|
isError: false,
|
|
87
|
-
result: `Merge from ${
|
|
87
|
+
result: `Merge from ${baseBranch} is committed, with conflicts. Use text edit tools to resolve them.\n\n${filesResult}`,
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/rename-file/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/rename-file/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,uCAAuC,CAAC;AAS9E,eAAO,MAAM,cAAc,EAAE,IA+E5B,CAAC"}
|
|
@@ -9,25 +9,29 @@ const promises_1 = require("fs/promises");
|
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const web_1 = require("../../bin/utils/platform/web");
|
|
11
11
|
const rename_file_1 = require("../definitions/rename-file");
|
|
12
|
+
const helpers_1 = require("../file-operations/shared/helpers");
|
|
12
13
|
exports.renameFileTool = {
|
|
13
14
|
...rename_file_1.renameFileTool,
|
|
14
15
|
execute: async ({ input, repoPath }) => {
|
|
15
16
|
try {
|
|
16
|
-
|
|
17
|
-
const
|
|
17
|
+
// Normalize both paths to support both /repo/... and relative paths
|
|
18
|
+
const normalizedOldPath = (0, helpers_1.normalizePath)(input.oldPath);
|
|
19
|
+
const normalizedNewPath = (0, helpers_1.normalizePath)(input.newPath);
|
|
20
|
+
const oldFilePath = path_1.default.join(repoPath, normalizedOldPath);
|
|
21
|
+
const newFilePath = path_1.default.join(repoPath, normalizedNewPath);
|
|
18
22
|
try {
|
|
19
23
|
const stats = await (0, promises_1.stat)(oldFilePath);
|
|
20
24
|
if (!stats.isFile()) {
|
|
21
25
|
return {
|
|
22
26
|
isError: true,
|
|
23
|
-
result: `Error: '${
|
|
27
|
+
result: `Error: '${normalizedOldPath}' is not a file. Use a different tool to rename directories.`,
|
|
24
28
|
};
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
catch {
|
|
28
32
|
return {
|
|
29
33
|
isError: true,
|
|
30
|
-
result: `Error: File '${
|
|
34
|
+
result: `Error: File '${normalizedOldPath}' does not exist.`,
|
|
31
35
|
};
|
|
32
36
|
}
|
|
33
37
|
const resolvedOldPath = path_1.default.resolve(oldFilePath);
|
|
@@ -49,7 +53,7 @@ exports.renameFileTool = {
|
|
|
49
53
|
await (0, promises_1.stat)(newFilePath);
|
|
50
54
|
return {
|
|
51
55
|
isError: true,
|
|
52
|
-
result: `Error: Destination file '${
|
|
56
|
+
result: `Error: Destination file '${normalizedNewPath}' already exists.`,
|
|
53
57
|
};
|
|
54
58
|
}
|
|
55
59
|
catch {
|
|
@@ -67,13 +71,13 @@ exports.renameFileTool = {
|
|
|
67
71
|
const tscResult = await (0, web_1.runTypescriptCompiler)(repoPath);
|
|
68
72
|
if (!tscResult.success) {
|
|
69
73
|
return {
|
|
70
|
-
result: `File renamed from '${
|
|
74
|
+
result: `File renamed from '${normalizedOldPath}' to '${normalizedNewPath}'. However, type checks are failing with errors:\n\n${tscResult.errors.join("\n")}`,
|
|
71
75
|
isError: false,
|
|
72
76
|
};
|
|
73
77
|
}
|
|
74
78
|
return {
|
|
75
79
|
isError: false,
|
|
76
|
-
result: `Successfully renamed file from '${
|
|
80
|
+
result: `Successfully renamed file from '${normalizedOldPath}' to '${normalizedNewPath}'`,
|
|
77
81
|
};
|
|
78
82
|
}
|
|
79
83
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-test.d.ts","sourceRoot":"","sources":["../../src/tools/run-test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EAEL,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"run-test.d.ts","sourceRoot":"","sources":["../../src/tools/run-test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EAEL,MAAM,uCAAuC,CAAC;AA2C/C,eAAO,MAAM,WAAW,EAAE,IAsIzB,CAAC"}
|
package/dist/tools/run-test.js
CHANGED
|
@@ -11,6 +11,7 @@ const artifacts_1 = require("../artifacts");
|
|
|
11
11
|
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
|
+
const helpers_1 = require("./file-operations/shared/helpers");
|
|
14
15
|
function buildReportUrl(projectName, testRunId) {
|
|
15
16
|
return `https://reports-r2.empirical.run/${projectName}/${testRunId}/index.html`;
|
|
16
17
|
}
|
|
@@ -47,11 +48,15 @@ exports.runTestTool = {
|
|
|
47
48
|
logger?.warn(warnMsg) || console.warn(warnMsg);
|
|
48
49
|
}
|
|
49
50
|
const { filePath, project } = input;
|
|
50
|
-
|
|
51
|
+
// Normalize the path to support both /repo/... and relative paths
|
|
52
|
+
const normalizedFilePath = (0, helpers_1.normalizePath)(filePath);
|
|
53
|
+
const absoluteFilePath = path_1.default.join(repoPath, normalizedFilePath);
|
|
51
54
|
if (!fs_1.default.existsSync(absoluteFilePath)) {
|
|
52
|
-
const errorMsg = `File ${
|
|
53
|
-
logger?.error("Test file not found", {
|
|
54
|
-
|
|
55
|
+
const errorMsg = `File ${normalizedFilePath} does not exist.`;
|
|
56
|
+
logger?.error("Test file not found", {
|
|
57
|
+
filePath: normalizedFilePath,
|
|
58
|
+
absoluteFilePath,
|
|
59
|
+
}) || console.error("Test file not found:", normalizedFilePath);
|
|
55
60
|
return {
|
|
56
61
|
isError: true,
|
|
57
62
|
result: errorMsg,
|
|
@@ -88,14 +93,14 @@ exports.runTestTool = {
|
|
|
88
93
|
try {
|
|
89
94
|
logger?.info("Starting test execution", {
|
|
90
95
|
testName: input.testName,
|
|
91
|
-
filePath,
|
|
96
|
+
filePath: normalizedFilePath,
|
|
92
97
|
project: input.project,
|
|
93
98
|
suites: input.suites,
|
|
94
99
|
}) || console.log("Starting test execution:", input.testName);
|
|
95
100
|
const result = await (0, test_run_1.runSingleTest)({
|
|
96
101
|
testName: input.testName,
|
|
97
102
|
suites: input.suites,
|
|
98
|
-
filePath,
|
|
103
|
+
filePath: normalizedFilePath,
|
|
99
104
|
repoDir: repoPath,
|
|
100
105
|
projects: [input.project],
|
|
101
106
|
envOverrides,
|
|
@@ -124,7 +129,7 @@ exports.runTestTool = {
|
|
|
124
129
|
logger?.error("Test execution failed", {
|
|
125
130
|
error: errorMessage,
|
|
126
131
|
testName: input.testName,
|
|
127
|
-
filePath,
|
|
132
|
+
filePath: normalizedFilePath,
|
|
128
133
|
}) || console.error("Test execution failed:", errorMessage);
|
|
129
134
|
return {
|
|
130
135
|
artifacts: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/safe-bash/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/safe-bash/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,uCAAuC,CAAC;AA2H9E,eAAO,MAAM,YAAY,EAAE,IA6E1B,CAAC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.safeBashTool = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const util_1 = require("util");
|
|
6
|
+
const web_1 = require("../../bin/utils/platform/web");
|
|
6
7
|
const safe_bash_1 = require("../definitions/safe-bash");
|
|
7
8
|
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
8
9
|
const DANGEROUS_PATTERNS = [
|
|
@@ -54,7 +55,7 @@ function containsDangerousPattern(script) {
|
|
|
54
55
|
}
|
|
55
56
|
return null;
|
|
56
57
|
}
|
|
57
|
-
function formatResult({ stdout, stderr, gitStatus, }) {
|
|
58
|
+
function formatResult({ stdout, stderr, gitStatus, tscResult, }) {
|
|
58
59
|
const parts = [];
|
|
59
60
|
if (stdout.trim()) {
|
|
60
61
|
parts.push(`## stdout\n\`\`\`\n${stdout.trim()}\n\`\`\``);
|
|
@@ -62,6 +63,15 @@ function formatResult({ stdout, stderr, gitStatus, }) {
|
|
|
62
63
|
if (stderr.trim()) {
|
|
63
64
|
parts.push(`## stderr\n\`\`\`\n${stderr.trim()}\n\`\`\``);
|
|
64
65
|
}
|
|
66
|
+
if (tscResult) {
|
|
67
|
+
if (!tscResult.success) {
|
|
68
|
+
const errors = tscResult.errors;
|
|
69
|
+
parts.push(`## tsc result: Errors\n\`\`\`\n${errors.join("\n")}\n\`\`\``);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
parts.push(`## tsc result: No errors`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
65
75
|
parts.push(`## Staged (will be committed)\n\`\`\`\n${gitStatus.staged}\n\`\`\``);
|
|
66
76
|
parts.push(`## Unstaged\n\`\`\`\n${gitStatus.unstaged}\n\`\`\``);
|
|
67
77
|
return parts.join("\n\n");
|
|
@@ -120,9 +130,15 @@ exports.safeBashTool = {
|
|
|
120
130
|
};
|
|
121
131
|
}
|
|
122
132
|
const gitStatus = await getGitStatus(repoPath);
|
|
133
|
+
const tscResult = await (0, web_1.runTypescriptCompiler)(repoPath);
|
|
123
134
|
return {
|
|
124
135
|
isError: false,
|
|
125
|
-
result: formatResult({
|
|
136
|
+
result: formatResult({
|
|
137
|
+
stdout,
|
|
138
|
+
stderr,
|
|
139
|
+
gitStatus,
|
|
140
|
+
tscResult,
|
|
141
|
+
}),
|
|
126
142
|
};
|
|
127
143
|
},
|
|
128
144
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-gen-browser.d.ts","sourceRoot":"","sources":["../../src/tools/test-gen-browser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,IAAI,EACL,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"test-gen-browser.d.ts","sourceRoot":"","sources":["../../src/tools/test-gen-browser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,IAAI,EACL,MAAM,uCAAuC,CAAC;AA0B/C,eAAO,MAAM,4BAA4B,EAAE,IAsP1C,CAAC"}
|
|
@@ -17,15 +17,18 @@ const web_1 = require("../bin/utils/platform/web");
|
|
|
17
17
|
const scenarios_1 = require("../bin/utils/scenarios");
|
|
18
18
|
const telemetry_1 = require("../telemetry");
|
|
19
19
|
const test_gen_browser_1 = require("./definitions/test-gen-browser");
|
|
20
|
+
const helpers_1 = require("./file-operations/shared/helpers");
|
|
20
21
|
exports.generateTestWithBrowserAgent = {
|
|
21
22
|
...test_gen_browser_1.generateTestWithBrowserAgent,
|
|
22
23
|
execute: async ({ input, repoPath, trace, collectArtifacts, environmentOverrides = {}, chatSession, logger, }) => {
|
|
23
|
-
const {
|
|
24
|
-
|
|
24
|
+
const { project } = input;
|
|
25
|
+
// Normalize the path to support both /repo/... and relative paths
|
|
26
|
+
const normalizedFilePath = (0, helpers_1.normalizePath)(input.filePath);
|
|
27
|
+
const absoluteFilePath = path_1.default.join(repoPath, normalizedFilePath);
|
|
25
28
|
if (!fs_1.default.existsSync(absoluteFilePath)) {
|
|
26
29
|
return {
|
|
27
30
|
isError: true,
|
|
28
|
-
result: `Could not find file in repository: ${
|
|
31
|
+
result: `Could not find file in repository: ${normalizedFilePath}. Did you use the full path relative to the root of the repository?`,
|
|
29
32
|
};
|
|
30
33
|
}
|
|
31
34
|
try {
|
|
@@ -52,14 +55,14 @@ exports.generateTestWithBrowserAgent = {
|
|
|
52
55
|
})) {
|
|
53
56
|
return {
|
|
54
57
|
isError: true,
|
|
55
|
-
result: `Test block not found for test name: "${testName}" in file: "${
|
|
58
|
+
result: `Test block not found for test name: "${testName}" in file: "${normalizedFilePath}" with describe blocks: "${suites.join(", ")}"`,
|
|
56
59
|
};
|
|
57
60
|
}
|
|
58
61
|
// Prepare the file for the browser agent
|
|
59
62
|
const fileBackup = fs_1.default.readFileSync(absoluteFilePath, "utf-8");
|
|
60
63
|
let todoContent;
|
|
61
64
|
try {
|
|
62
|
-
todoContent = (0, utils_1.replaceTodoWithCreateTest)(
|
|
65
|
+
todoContent = (0, utils_1.replaceTodoWithCreateTest)(normalizedFilePath, repoPath);
|
|
63
66
|
}
|
|
64
67
|
catch (error) {
|
|
65
68
|
// Undo the TODO -> createTest and test.only changes
|
|
@@ -99,17 +102,17 @@ exports.generateTestWithBrowserAgent = {
|
|
|
99
102
|
BUILD_URL: input.buildUrl,
|
|
100
103
|
};
|
|
101
104
|
}
|
|
102
|
-
const testGenToken = (0, scenarios_1.buildTokenFromOptions)({ name: testName, file:
|
|
105
|
+
const testGenToken = (0, scenarios_1.buildTokenFromOptions)({ name: testName, file: normalizedFilePath }, { useComputerUseAgent: true });
|
|
103
106
|
logger.info("Validations passed, starting agent", {
|
|
104
107
|
tool: "generateTestWithBrowserAgent",
|
|
105
108
|
testName,
|
|
106
|
-
filePath,
|
|
109
|
+
filePath: normalizedFilePath,
|
|
107
110
|
});
|
|
108
111
|
const agentResult = await (0, run_1.runBrowsingAgent)({
|
|
109
112
|
testCaseName: testName,
|
|
110
113
|
testCaseSuites: suites,
|
|
111
|
-
testFilePath:
|
|
112
|
-
filePathToUpdate:
|
|
114
|
+
testFilePath: normalizedFilePath,
|
|
115
|
+
filePathToUpdate: normalizedFilePath,
|
|
113
116
|
projectName: project,
|
|
114
117
|
traceId: trace?.id,
|
|
115
118
|
testGenToken,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Tool } from "@empiricalrun/shared-types/chat-agent";
|
|
2
|
-
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { traceDotZipSchema } from "../definitions/trace-dot-zip";
|
|
4
|
+
export declare const traceDotZipTool: Tool<z.infer<typeof traceDotZipSchema>>;
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/trace-dot-zip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/trace-dot-zip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,iBAAiB,EAClB,MAAM,8BAA8B,CAAC;AAEtC,eAAO,MAAM,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CA4CnE,CAAC"}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.traceDotZipTool = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const network_trace_1 = require("./utils/network-trace");
|
|
7
|
-
const TraceDotZipFileInputSchema = zod_1.z.object({
|
|
8
|
-
url: zod_1.z.string().describe(`The URL to the "trace.zip" file.`),
|
|
9
|
-
});
|
|
4
|
+
const trace_utils_1 = require("../../trace-utils");
|
|
5
|
+
const trace_dot_zip_1 = require("../definitions/trace-dot-zip");
|
|
10
6
|
exports.traceDotZipTool = {
|
|
11
|
-
|
|
12
|
-
name: "traceDotZip",
|
|
13
|
-
description: `Extracts failed network request and console error traces from a Playwright trace zip file. Pass a trace.zip URL to this tool and get a summary of failed network calls (by status codes) and console error logs (by "messageType") to understand network activity and console logs during the test run.`,
|
|
14
|
-
parameters: TraceDotZipFileInputSchema,
|
|
15
|
-
},
|
|
16
|
-
needsBrowser: false,
|
|
17
|
-
isInlineTool: false, // TODO: Can be true if we can pass the trace.zip file content directly by preprocessing it
|
|
7
|
+
...trace_dot_zip_1.traceDotZip,
|
|
18
8
|
execute: async ({ input, }) => {
|
|
19
9
|
try {
|
|
20
10
|
const traceFileUrl = input.url;
|
|
@@ -24,17 +14,15 @@ exports.traceDotZipTool = {
|
|
|
24
14
|
result: "No trace.zip URL provided",
|
|
25
15
|
};
|
|
26
16
|
}
|
|
27
|
-
const [
|
|
28
|
-
(0,
|
|
29
|
-
(0,
|
|
17
|
+
const [networkResult, consoleResult] = await Promise.all([
|
|
18
|
+
(0, trace_utils_1.searchNetwork)({ file: traceFileUrl, errors: true }),
|
|
19
|
+
(0, trace_utils_1.getConsoleLogs)({ file: traceFileUrl, level: "error" }),
|
|
30
20
|
]);
|
|
31
|
-
const cleanNetworkTraceOutput = (0, network_trace_1.stripIrrelevantInfoFromNetworkFailureArray)(networkTraceOutput.hydratedFailedCalls);
|
|
32
21
|
return {
|
|
33
22
|
isError: false,
|
|
34
23
|
result: JSON.stringify({
|
|
35
|
-
failed_network_requests:
|
|
36
|
-
|
|
37
|
-
console_error_logs: consoleTraceOutput,
|
|
24
|
+
failed_network_requests: networkResult.matches,
|
|
25
|
+
console_error_logs: consoleResult.logs,
|
|
38
26
|
}, null, 2),
|
|
39
27
|
};
|
|
40
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console-trace.d.ts","sourceRoot":"","sources":["../../../../src/tools/trace-dot-zip/utils/console-trace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAK9C,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAU,UAElD,KAAK,KAAG,OAAO,CAAC,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"console-trace.d.ts","sourceRoot":"","sources":["../../../../src/tools/trace-dot-zip/utils/console-trace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAK9C,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAU,UAElD,KAAK,KAAG,OAAO,CAAC,kBAAkB,EAAE,CAkCtC,CAAC"}
|
|
@@ -12,12 +12,18 @@ const generateConsoleTraceFromZipUrl = async ({ url, }) => {
|
|
|
12
12
|
chunkProcessor: () => {
|
|
13
13
|
let tempBuffer = "";
|
|
14
14
|
return (chunk) => {
|
|
15
|
-
tempBuffer += chunk;
|
|
16
|
-
|
|
15
|
+
tempBuffer += chunk.toString("utf-8");
|
|
16
|
+
const lines = tempBuffer.split("\n");
|
|
17
17
|
lines.slice(0, -1).forEach((line) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
try {
|
|
19
|
+
const parsed = JSON.parse(line);
|
|
20
|
+
if (parsed?.type === "console" &&
|
|
21
|
+
parsed?.messageType === "error") {
|
|
22
|
+
consoleErrors.push(parsed);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// skip malformed lines
|
|
21
27
|
}
|
|
22
28
|
});
|
|
23
29
|
tempBuffer = lines[lines.length - 1] || "";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TraceStep } from "./extract-steps";
|
|
2
|
+
export type ExtractedScreenshot = {
|
|
3
|
+
sha1: string;
|
|
4
|
+
timestamp: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
base64: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function extractScreenshotsAroundStep(opts: {
|
|
10
|
+
zipUrl: string;
|
|
11
|
+
stepId: string;
|
|
12
|
+
beforeMs?: number;
|
|
13
|
+
afterMs?: number;
|
|
14
|
+
maxScreenshots?: number;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
step: TraceStep | undefined;
|
|
17
|
+
screenshots: ExtractedScreenshot[];
|
|
18
|
+
}>;
|
|
19
|
+
export declare function extractScreenshotsInRange(opts: {
|
|
20
|
+
zipUrl: string;
|
|
21
|
+
startTime: number;
|
|
22
|
+
endTime: number;
|
|
23
|
+
maxScreenshots?: number;
|
|
24
|
+
}): Promise<ExtractedScreenshot[]>;
|
|
25
|
+
export declare function parseTimeToMs(timeStr: string): number;
|
|
26
|
+
export declare function saveScreenshotsToDir(screenshots: ExtractedScreenshot[], outputDir: string, stepId: string): Promise<string[]>;
|
|
27
|
+
//# sourceMappingURL=extract-screenshots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-screenshots.d.ts","sourceRoot":"","sources":["../../../../src/tools/trace-dot-zip/utils/extract-screenshots.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAanE,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,4BAA4B,CAAC,IAAI,EAAE;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,OAAO,CAAC;IACV,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,WAAW,EAAE,mBAAmB,EAAE,CAAC;CACpC,CAAC,CA2BD;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAyBjC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAcrD;AA0ED,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,mBAAmB,EAAE,EAClC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,EAAE,CAAC,CAenB"}
|