@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
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,7 @@ export type { AgentParams, OnToolCallCallback } from "../base";
|
|
|
6
6
|
export { BaseAgent } from "../base";
|
|
7
7
|
export type { CodeReviewResultV0, CodeReviewResultV1, CodeReviewResultV2, CodeReviewVersionedResult, } from "../code-review";
|
|
8
8
|
export { CodeReviewAgent } from "../code-review";
|
|
9
|
+
export { FastTriageAgent } from "../fast-triage";
|
|
9
10
|
export { TriageAgent } from "../triage";
|
|
10
11
|
export { ChatAgent } from "./index";
|
|
11
12
|
export { fetchToolCallFromId, getLatestDownloadBuildUrl, LATEST_CHAT_STATE_VERSION, } from "./state";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/exports.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AAEzC,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/exports.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AAEzC,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractAttachments = exports.LATEST_CHAT_STATE_VERSION = exports.getLatestDownloadBuildUrl = exports.fetchToolCallFromId = exports.ChatAgent = exports.TriageAgent = exports.CodeReviewAgent = exports.BaseAgent = exports.viewFileUsingGitHub = exports.getFileInfoFromGitHub = exports.SUPPORTED_CHAT_MODELS = exports.createChatModel = void 0;
|
|
3
|
+
exports.extractAttachments = exports.LATEST_CHAT_STATE_VERSION = exports.getLatestDownloadBuildUrl = exports.fetchToolCallFromId = exports.ChatAgent = exports.TriageAgent = exports.FastTriageAgent = exports.CodeReviewAgent = exports.BaseAgent = exports.viewFileUsingGitHub = exports.getFileInfoFromGitHub = exports.SUPPORTED_CHAT_MODELS = exports.createChatModel = void 0;
|
|
4
4
|
var chat_1 = require("@empiricalrun/llm/chat");
|
|
5
5
|
Object.defineProperty(exports, "createChatModel", { enumerable: true, get: function () { return chat_1.createChatModel; } });
|
|
6
6
|
var constants_1 = require("@empiricalrun/llm/chat/constants");
|
|
@@ -12,6 +12,8 @@ var base_1 = require("../base");
|
|
|
12
12
|
Object.defineProperty(exports, "BaseAgent", { enumerable: true, get: function () { return base_1.BaseAgent; } });
|
|
13
13
|
var code_review_1 = require("../code-review");
|
|
14
14
|
Object.defineProperty(exports, "CodeReviewAgent", { enumerable: true, get: function () { return code_review_1.CodeReviewAgent; } });
|
|
15
|
+
var fast_triage_1 = require("../fast-triage");
|
|
16
|
+
Object.defineProperty(exports, "FastTriageAgent", { enumerable: true, get: function () { return fast_triage_1.FastTriageAgent; } });
|
|
15
17
|
var triage_1 = require("../triage");
|
|
16
18
|
Object.defineProperty(exports, "TriageAgent", { enumerable: true, get: function () { return triage_1.TriageAgent; } });
|
|
17
19
|
var index_1 = require("./index");
|
package/dist/agent/chat/index.js
CHANGED
|
@@ -18,7 +18,7 @@ class ChatAgent extends base_1.BaseAgent {
|
|
|
18
18
|
test_run_fetcher_1.fetchTestRunDetailsTool,
|
|
19
19
|
diagnosis_fetcher_1.fetchDiagnosisReportTool,
|
|
20
20
|
...(0, tools_1.textEditorToolsForModel)(this.selectedModel),
|
|
21
|
-
|
|
21
|
+
tools_1.safeBashTool,
|
|
22
22
|
...(this.featureFlags.includes("useScrapeHtml") ? [tools_1.scrapeHtmlTool] : []),
|
|
23
23
|
];
|
|
24
24
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/repo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAuD/D,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../../src/agent/chat/prompt/repo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAuD/D,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,mBA4B5D"}
|
|
@@ -56,9 +56,10 @@ Here is the repo directory structure:
|
|
|
56
56
|
|
|
57
57
|
${(0, repo_tree_1.generateAsciiTree)(repoInfo)}
|
|
58
58
|
|
|
59
|
-
While specifying paths to files,
|
|
60
|
-
-
|
|
61
|
-
-
|
|
59
|
+
While specifying paths to files, prefer using absolute paths with the /repo/ prefix. Both absolute and relative paths are supported. For example:
|
|
60
|
+
- Preferred: "/repo/tests/lesson.spec.ts" (absolute path with /repo/ prefix)
|
|
61
|
+
- Also supported: "tests/lesson.spec.ts" (relative path from repository root)
|
|
62
|
+
- Incorrect: "/${repoInfo.name}/tests/lesson.spec.ts" (wrong prefix)
|
|
62
63
|
`;
|
|
63
64
|
const knowledge = await knowledgeContext(repoInfo);
|
|
64
65
|
if (knowledge.length > 0) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolsForLLM } from "@empiricalrun/shared-types/chat-agent";
|
|
2
|
+
import type { FileInfo } from "@empiricalrun/shared-types/test-gen";
|
|
3
|
+
import { BaseAgent } from "../base";
|
|
4
|
+
export declare class FastTriageAgent<T> extends BaseAgent<T> {
|
|
5
|
+
protected getTools(): ToolsForLLM;
|
|
6
|
+
protected buildSystemPrompt(repoInfoBuilder: () => Promise<FileInfo>): Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/fast-triage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AASpE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,qBAAa,eAAe,CAAC,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAClD,SAAS,CAAC,QAAQ,IAAI,WAAW;cAiBjB,iBAAiB,CAC/B,eAAe,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,GACvC,OAAO,CAAC,MAAM,CAAC;CAqBnB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FastTriageAgent = void 0;
|
|
4
|
+
const tools_1 = require("../../tools");
|
|
5
|
+
// import { traceUtils } from "../../tools/definitions/trace-utils";
|
|
6
|
+
// import { grepTool } from "../../tools/definitions/grep";
|
|
7
|
+
const diagnosis_fetcher_1 = require("../../tools/diagnosis-fetcher");
|
|
8
|
+
const fetch_file_1 = require("../../tools/fetch-file");
|
|
9
|
+
const list_environments_1 = require("../../tools/list-environments");
|
|
10
|
+
const test_run_fetcher_1 = require("../../tools/test-run-fetcher");
|
|
11
|
+
const base_1 = require("../base");
|
|
12
|
+
class FastTriageAgent extends base_1.BaseAgent {
|
|
13
|
+
getTools() {
|
|
14
|
+
const tools = [
|
|
15
|
+
diagnosis_fetcher_1.fetchDiagnosisReportTool,
|
|
16
|
+
test_run_fetcher_1.fetchTestRunDetailsTool,
|
|
17
|
+
list_environments_1.listEnvironmentsTool,
|
|
18
|
+
fetch_file_1.fetchFileTool,
|
|
19
|
+
// TODO: Bring these back - once we have a remote tool executor for them
|
|
20
|
+
// traceUtils,
|
|
21
|
+
// grepTool,
|
|
22
|
+
...(0, tools_1.textEditorToolsForModel)(this.selectedModel),
|
|
23
|
+
];
|
|
24
|
+
return {
|
|
25
|
+
custom: tools,
|
|
26
|
+
builtInTextEditor: (0, tools_1.hasBuiltInTextEditor)(this.selectedModel),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
async buildSystemPrompt(repoInfoBuilder) {
|
|
30
|
+
const _repoInfo = await repoInfoBuilder();
|
|
31
|
+
return `
|
|
32
|
+
You are a fast triage agent that quickly analyzes test failures. [PLACEHOLDER - to be refined]
|
|
33
|
+
|
|
34
|
+
Your goal is to analyze the provided test failure and identify the root cause as quickly as possible.
|
|
35
|
+
|
|
36
|
+
Use the available tools to:
|
|
37
|
+
1. Fetch the diagnosis report for the failing test
|
|
38
|
+
2. Fetch test run details to understand the context
|
|
39
|
+
3. Review the test code and related files to understand what the test is doing
|
|
40
|
+
4. Identify the root cause of the failure
|
|
41
|
+
|
|
42
|
+
Provide a concise summary of:
|
|
43
|
+
- What failed
|
|
44
|
+
- Why it failed (root cause)
|
|
45
|
+
- Whether this is an app issue or a test issue
|
|
46
|
+
|
|
47
|
+
Today's date is ${new Date().toDateString()}
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.FastTriageAgent = FastTriageAgent;
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import type { AgentModeEnum } from "@empiricalrun/shared-types/chat-agent";
|
|
|
2
2
|
import { type AgentParams, BaseAgent } from "./base";
|
|
3
3
|
import { ChatAgent } from "./chat";
|
|
4
4
|
import { CodeReviewAgent } from "./code-review";
|
|
5
|
+
import { FastTriageAgent } from "./fast-triage";
|
|
5
6
|
import { TriageAgent } from "./triage";
|
|
6
7
|
export declare function createAgent<T>(mode: AgentModeEnum, params: AgentParams<T>): BaseAgent<T>;
|
|
7
|
-
export { BaseAgent, ChatAgent, CodeReviewAgent, TriageAgent };
|
|
8
|
+
export { BaseAgent, ChatAgent, CodeReviewAgent, FastTriageAgent, TriageAgent };
|
|
8
9
|
export type { AgentParams };
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,KAAK,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,KAAK,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAWvC,wBAAgB,WAAW,CAAC,CAAC,EAC3B,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GACrB,SAAS,CAAC,CAAC,CAAC,CAMd;AAED,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/agent/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TriageAgent = exports.CodeReviewAgent = exports.ChatAgent = exports.BaseAgent = void 0;
|
|
3
|
+
exports.TriageAgent = exports.FastTriageAgent = exports.CodeReviewAgent = exports.ChatAgent = exports.BaseAgent = void 0;
|
|
4
4
|
exports.createAgent = createAgent;
|
|
5
5
|
const base_1 = require("./base");
|
|
6
6
|
Object.defineProperty(exports, "BaseAgent", { enumerable: true, get: function () { return base_1.BaseAgent; } });
|
|
@@ -8,12 +8,15 @@ const chat_1 = require("./chat");
|
|
|
8
8
|
Object.defineProperty(exports, "ChatAgent", { enumerable: true, get: function () { return chat_1.ChatAgent; } });
|
|
9
9
|
const code_review_1 = require("./code-review");
|
|
10
10
|
Object.defineProperty(exports, "CodeReviewAgent", { enumerable: true, get: function () { return code_review_1.CodeReviewAgent; } });
|
|
11
|
+
const fast_triage_1 = require("./fast-triage");
|
|
12
|
+
Object.defineProperty(exports, "FastTriageAgent", { enumerable: true, get: function () { return fast_triage_1.FastTriageAgent; } });
|
|
11
13
|
const triage_1 = require("./triage");
|
|
12
14
|
Object.defineProperty(exports, "TriageAgent", { enumerable: true, get: function () { return triage_1.TriageAgent; } });
|
|
13
15
|
const agentRegistry = {
|
|
14
16
|
chat: chat_1.ChatAgent,
|
|
15
17
|
triage: triage_1.TriageAgent,
|
|
16
18
|
"code-review": code_review_1.CodeReviewAgent,
|
|
19
|
+
"fast-triage": fast_triage_1.FastTriageAgent,
|
|
17
20
|
};
|
|
18
21
|
function createAgent(mode, params) {
|
|
19
22
|
const AgentClass = agentRegistry[mode];
|
|
@@ -4,6 +4,7 @@ exports.TriageAgent = void 0;
|
|
|
4
4
|
const tools_1 = require("../../tools");
|
|
5
5
|
const analyse_video_1 = require("../../tools/definitions/analyse-video");
|
|
6
6
|
const grep_1 = require("../../tools/definitions/grep");
|
|
7
|
+
const trace_dot_zip_1 = require("../../tools/definitions/trace-dot-zip");
|
|
7
8
|
const diagnosis_fetcher_1 = require("../../tools/diagnosis-fetcher");
|
|
8
9
|
const fetch_file_1 = require("../../tools/fetch-file");
|
|
9
10
|
const list_issues_1 = require("../../tools/issues-v1/list-issues");
|
|
@@ -12,7 +13,6 @@ const set_issue_description_1 = require("../../tools/issues-v2/set-issue-descrip
|
|
|
12
13
|
const update_issue_1 = require("../../tools/issues-v2/update-issue");
|
|
13
14
|
const list_environments_1 = require("../../tools/list-environments");
|
|
14
15
|
const test_run_fetcher_1 = require("../../tools/test-run-fetcher");
|
|
15
|
-
const trace_dot_zip_1 = require("../../tools/trace-dot-zip");
|
|
16
16
|
const triage_summary_1 = require("../../tools/triage-summary");
|
|
17
17
|
const base_1 = require("../base");
|
|
18
18
|
const repo_1 = require("../chat/prompt/repo");
|
|
@@ -27,7 +27,7 @@ class TriageAgent extends base_1.BaseAgent {
|
|
|
27
27
|
// Tools to analyse report artifacts
|
|
28
28
|
fetch_file_1.fetchFileTool,
|
|
29
29
|
analyse_video_1.analyseVideo,
|
|
30
|
-
trace_dot_zip_1.
|
|
30
|
+
trace_dot_zip_1.traceDotZip,
|
|
31
31
|
// Tools to get test case context from the repo
|
|
32
32
|
grep_1.grepTool,
|
|
33
33
|
...(0, tools_1.textEditorToolsForModel)(this.selectedModel),
|
package/dist/bin/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const
|
|
7
|
+
const extra_typings_1 = require("@commander-js/extra-typings");
|
|
8
8
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const models_1 = require("../agent/chat/models");
|
|
@@ -14,6 +14,7 @@ const client_1 = require("../dashboard/client");
|
|
|
14
14
|
const recorder_1 = require("../recorder");
|
|
15
15
|
const validation_1 = require("../recorder/validation");
|
|
16
16
|
const test_build_1 = require("../test-build");
|
|
17
|
+
const cli_2 = require("../trace-utils/cli");
|
|
17
18
|
const environments_1 = require("./environments");
|
|
18
19
|
const setup_1 = require("./setup");
|
|
19
20
|
const utils_1 = require("./utils");
|
|
@@ -25,7 +26,7 @@ async function main() {
|
|
|
25
26
|
if (!rawMode) {
|
|
26
27
|
await (0, utils_1.printBanner)();
|
|
27
28
|
}
|
|
28
|
-
const program = new
|
|
29
|
+
const program = new extra_typings_1.Command();
|
|
29
30
|
program
|
|
30
31
|
.command("login")
|
|
31
32
|
.description("Authenticate with your Empirical account")
|
|
@@ -176,7 +177,7 @@ async function main() {
|
|
|
176
177
|
selectedModel: resolvedModel,
|
|
177
178
|
useDiskForChatState: options.useDisk || false,
|
|
178
179
|
initialPromptContent: options.prompt,
|
|
179
|
-
agentMode: options.agentMode || "chat",
|
|
180
|
+
agentMode: (options.agentMode || "chat"),
|
|
180
181
|
resetChat: options.resetState || false,
|
|
181
182
|
useFSCache: options.useCache || false,
|
|
182
183
|
});
|
|
@@ -225,6 +226,7 @@ async function main() {
|
|
|
225
226
|
}
|
|
226
227
|
process.exit(0);
|
|
227
228
|
});
|
|
229
|
+
program.addCommand((0, cli_2.buildTraceUtilsCommand)());
|
|
228
230
|
program.parse(process.argv);
|
|
229
231
|
}
|
|
230
232
|
main().catch((error) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAM3F,OAAO,EAGL,IAAI,EAEJ,UAAU,EAEX,MAAM,UAAU,CAAC;AAMlB,eAAO,MAAM,gCAAgC,GAC3C,YAAY,UAAU,KACrB,MAgBF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,MAAM,EACN,OAAO,GACR,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG;IACF,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB,CA2CA;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,MAAM,EACN,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,WAUA;AAwBD,wBAAsB,0CAA0C,CAC9D,QAAQ,EAAE,MAAM,oBA+BjB;AAED;;;;;;;;;;;;;;;;;;;;;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D,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,WA0DA,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAC5C,SAAS,MAAM,EACf,WAAW,MAAM,EAAE,EACnB,cAAc,MAAM,sBAyBrB,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,EAC1C,YAAY,EACZ,QAAQ,EACR,MAAM,GACP,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,iBAgDA;AAED,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EAAE,iBAsBzB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,yBAAyB,CAAC;CACrC,WAYA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,MAAM,GACP,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,UAOA;AAED,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CA4B5E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQnD"}
|
|
@@ -26,7 +26,6 @@ exports.getVariableDeclarationsFromCode = getVariableDeclarationsFromCode;
|
|
|
26
26
|
exports.isSyntaxValid = isSyntaxValid;
|
|
27
27
|
const parser_1 = require("@babel/parser");
|
|
28
28
|
const cmd_1 = require("@empiricalrun/test-run/cmd");
|
|
29
|
-
const eslint_1 = require("eslint");
|
|
30
29
|
const fs_1 = __importDefault(require("fs"));
|
|
31
30
|
const path_1 = __importDefault(require("path"));
|
|
32
31
|
const prettier_1 = __importDefault(require("prettier"));
|
|
@@ -276,7 +275,9 @@ async function stripAndPrependImports(content, testName) {
|
|
|
276
275
|
}
|
|
277
276
|
async function lintErrors(filePath) {
|
|
278
277
|
// TODO: use in new tools - return result/error?
|
|
279
|
-
|
|
278
|
+
// Dynamic import to avoid bundling ESLint in Workers (uses Node.js-specific globals)
|
|
279
|
+
const { ESLint } = (await import("eslint"));
|
|
280
|
+
const eslint = new ESLint({
|
|
280
281
|
fix: true,
|
|
281
282
|
// Had to comment this out with upgrade to eslint 9.30.0
|
|
282
283
|
// TODO: check if this is still needed with new tools/chat agent
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import { IDashboardAPIClient, RequestOptions } from "@empiricalrun/shared-types/api/base";
|
|
2
2
|
export type AuthenticationType = "user-access-token" | "project-api-key" | "admin-totp";
|
|
3
|
+
export type TokenProvider = () => Promise<{
|
|
4
|
+
access_token: string;
|
|
5
|
+
refresh_token: string;
|
|
6
|
+
expires_at: number;
|
|
7
|
+
user_id?: string;
|
|
8
|
+
user_email?: string;
|
|
9
|
+
} | null>;
|
|
3
10
|
export declare class DashboardAPIClient implements IDashboardAPIClient {
|
|
4
11
|
private baseUrl;
|
|
5
12
|
private authType;
|
|
6
13
|
private projectApiKey?;
|
|
7
14
|
private secretKey?;
|
|
8
|
-
|
|
15
|
+
private tokenProvider?;
|
|
16
|
+
constructor({ authType, projectApiKey, secretKey, baseUrl, tokenProvider, }: {
|
|
9
17
|
authType: AuthenticationType;
|
|
10
18
|
projectApiKey?: string;
|
|
11
19
|
secretKey?: string;
|
|
12
20
|
baseUrl?: string;
|
|
21
|
+
tokenProvider?: TokenProvider;
|
|
13
22
|
});
|
|
23
|
+
private getTokens;
|
|
14
24
|
request<T>(endpoint: string, options: RequestOptions): Promise<T>;
|
|
15
25
|
callGitHubProxy<T>({ method, url, body, }: {
|
|
16
26
|
method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/dashboard/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,cAAc,EACf,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/dashboard/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,cAAc,EACf,MAAM,qCAAqC,CAAC;AAY7C,MAAM,MAAM,kBAAkB,GAC1B,mBAAmB,GACnB,iBAAiB,GACjB,YAAY,CAAC;AAEjB,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,IAAI,CAAC,CAAC;AAEV,qBAAa,kBAAmB,YAAW,mBAAmB;IAC5D,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAC,CAAgB;gBAE1B,EACV,QAAQ,EACR,aAAa,EACb,SAAS,EACT,OAAO,EACP,aAAa,GACd,EAAE;QACD,QAAQ,EAAE,kBAAkB,CAAC;QAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,aAAa,CAAC;KAC/B;YAwBa,SAAS;IAOjB,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IA+CjE,eAAe,CAAC,CAAC,EAAE,EACvB,MAAM,EACN,GAAG,EACH,IAAI,GACL,EAAE;QACD,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;QACpD,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,CAAC,EAAE,GAAG,CAAC;KACZ,GAAG,OAAO,CAAC,CAAC,CAAC;IAYR,kBAAkB,CAAC,CAAC,EAAE,EAC1B,MAAM,EACN,IAAI,EACJ,IAAI,GACL,EAAE;QACD,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;QACpD,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,GAAG,CAAC;KACZ,GAAG,OAAO,CAAC,CAAC,CAAC;IAYd,UAAU,IAAI,MAAM;IAId,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC;YAmBlC,YAAY;YAoDZ,gBAAgB;CAyC/B;AAED,eAAO,MAAM,SAAS,oBAEpB,CAAC"}
|
package/dist/dashboard/client.js
CHANGED
|
@@ -14,7 +14,8 @@ class DashboardAPIClient {
|
|
|
14
14
|
authType;
|
|
15
15
|
projectApiKey;
|
|
16
16
|
secretKey;
|
|
17
|
-
|
|
17
|
+
tokenProvider;
|
|
18
|
+
constructor({ authType, projectApiKey, secretKey, baseUrl, tokenProvider, }) {
|
|
18
19
|
this.baseUrl =
|
|
19
20
|
baseUrl || process.env.DASHBOARD_DOMAIN || "https://dash.empirical.run";
|
|
20
21
|
this.authType = authType;
|
|
@@ -30,6 +31,13 @@ class DashboardAPIClient {
|
|
|
30
31
|
}
|
|
31
32
|
this.secretKey = secretKey || process.env.EMPIRICAL_TOTP_SK;
|
|
32
33
|
}
|
|
34
|
+
this.tokenProvider = tokenProvider;
|
|
35
|
+
}
|
|
36
|
+
async getTokens() {
|
|
37
|
+
if (this.tokenProvider) {
|
|
38
|
+
return this.tokenProvider();
|
|
39
|
+
}
|
|
40
|
+
return (0, token_store_1.getStoredUserTokens)();
|
|
33
41
|
}
|
|
34
42
|
async request(endpoint, options) {
|
|
35
43
|
let response;
|
|
@@ -46,7 +54,7 @@ class DashboardAPIClient {
|
|
|
46
54
|
}
|
|
47
55
|
else {
|
|
48
56
|
await this.ensureUserIsAuthenticated();
|
|
49
|
-
const tokens = await
|
|
57
|
+
const tokens = await this.getTokens();
|
|
50
58
|
if (!tokens) {
|
|
51
59
|
throw new Error("Not authenticated. Please run the login command first.");
|
|
52
60
|
}
|
|
@@ -57,7 +65,7 @@ class DashboardAPIClient {
|
|
|
57
65
|
logger_1.logger.debug("Access token expired, attempting to refresh...");
|
|
58
66
|
const refreshed = await this.refreshUserToken();
|
|
59
67
|
if (refreshed) {
|
|
60
|
-
const newTokens = await
|
|
68
|
+
const newTokens = await this.getTokens();
|
|
61
69
|
if (newTokens) {
|
|
62
70
|
response = this._makeRequest(endpoint, options, async () => ({
|
|
63
71
|
Authorization: `Bearer ${newTokens.access_token}`,
|
|
@@ -98,11 +106,16 @@ class DashboardAPIClient {
|
|
|
98
106
|
return this.baseUrl;
|
|
99
107
|
}
|
|
100
108
|
async ensureUserIsAuthenticated() {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
const tokens = await this.getTokens();
|
|
110
|
+
if (!tokens) {
|
|
111
|
+
throw new Error("Not authenticated. Please run the login command first.");
|
|
112
|
+
}
|
|
113
|
+
// Check if token is expired (with 5 minute buffer)
|
|
114
|
+
const expirationBuffer = 5 * 60;
|
|
115
|
+
const now = Math.floor(Date.now() / 1000);
|
|
116
|
+
const isExpired = tokens.expires_at <= now + expirationBuffer;
|
|
117
|
+
if (isExpired && !this.tokenProvider) {
|
|
118
|
+
// Only attempt refresh if using file-based token store
|
|
106
119
|
const refreshed = await this.refreshUserToken();
|
|
107
120
|
if (!refreshed) {
|
|
108
121
|
throw new Error("Session expired. Please run the login command again.");
|
|
@@ -151,7 +164,7 @@ class DashboardAPIClient {
|
|
|
151
164
|
});
|
|
152
165
|
}
|
|
153
166
|
async refreshUserToken() {
|
|
154
|
-
const tokens = await
|
|
167
|
+
const tokens = await this.getTokens();
|
|
155
168
|
if (!tokens || !tokens.refresh_token) {
|
|
156
169
|
return false;
|
|
157
170
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/file-info/adapters/github/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAEnE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/file-info/adapters/github/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAEnE,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,wBAAsB,mBAAmB,CAAC,EACxC,KAAK,EACL,QAAQ,EACR,SAAS,EACT,UAAU,EACV,UAAU,GACX,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,UAAU,CAAC,CA2BtB"}
|
|
@@ -7,7 +7,7 @@ const reader_1 = require("./reader");
|
|
|
7
7
|
var reader_2 = require("./reader");
|
|
8
8
|
Object.defineProperty(exports, "getFileInfoFromGitHub", { enumerable: true, get: function () { return reader_2.getFileInfoFromGitHub; } });
|
|
9
9
|
async function viewFileUsingGitHub({ input, repoName, apiClient, branchName, baseBranch, }) {
|
|
10
|
-
const filePath = input.path;
|
|
10
|
+
const filePath = (0, helpers_1.normalizePath)(input.path);
|
|
11
11
|
const githubReader = new reader_1.GitHubFileReader(repoName, apiClient);
|
|
12
12
|
const fileData = await githubReader.readFile(filePath, branchName, baseBranch);
|
|
13
13
|
if (!fileData) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Samples two arrays proportionally to ensure their combined length does not exceed maxCombinedLength.
|
|
3
|
+
* @param {any[]} list1 - The first array of base64 image strings.
|
|
4
|
+
* @param {any[]} list2 - The second array of base64 image strings.
|
|
5
|
+
* @param {number} maxCombinedLength - The maximum allowed combined length of both arrays.
|
|
6
|
+
* @returns {{ list1: any[], list2: any[] }} - An object containing the sampled arrays.
|
|
7
|
+
*/
|
|
8
|
+
export declare const sampleCombinedList: (list1: any[], list2: any[], maxCombinedLength: number) => {
|
|
9
|
+
list1: any[];
|
|
10
|
+
list2: any[];
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=frame-sampling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame-sampling.d.ts","sourceRoot":"","sources":["../../src/generate-summary/frame-sampling.ts"],"names":[],"mappings":"AAqBA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,GAAG,EAAE,EACZ,OAAO,GAAG,EAAE,EACZ,mBAAmB,MAAM,KACxB;IAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IAAC,KAAK,EAAE,GAAG,EAAE,CAAA;CA+C9B,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sampleCombinedList = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Samples an array to a desired size by selecting elements uniformly.
|
|
6
|
+
* @param {string[]} list - The original array to sample from.
|
|
7
|
+
* @param {number} size - The desired size of the sampled array.
|
|
8
|
+
* @returns {string[]} - The sampled array.
|
|
9
|
+
*/
|
|
10
|
+
const sampleList = (list, size) => {
|
|
11
|
+
// Return a copy if no sampling needed
|
|
12
|
+
if (size >= list.length) {
|
|
13
|
+
return list;
|
|
14
|
+
}
|
|
15
|
+
const sampled = [];
|
|
16
|
+
const step = list.length / size;
|
|
17
|
+
for (let i = 0; i < size; i++) {
|
|
18
|
+
const index = Math.floor(i * step);
|
|
19
|
+
sampled.push(list[index]);
|
|
20
|
+
}
|
|
21
|
+
return sampled;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Samples two arrays proportionally to ensure their combined length does not exceed maxCombinedLength.
|
|
25
|
+
* @param {any[]} list1 - The first array of base64 image strings.
|
|
26
|
+
* @param {any[]} list2 - The second array of base64 image strings.
|
|
27
|
+
* @param {number} maxCombinedLength - The maximum allowed combined length of both arrays.
|
|
28
|
+
* @returns {{ list1: any[], list2: any[] }} - An object containing the sampled arrays.
|
|
29
|
+
*/
|
|
30
|
+
const sampleCombinedList = (list1, list2, maxCombinedLength) => {
|
|
31
|
+
const len1 = list1.length;
|
|
32
|
+
const len2 = list2.length;
|
|
33
|
+
const total = len1 + len2;
|
|
34
|
+
// If combined length is within the limit, return copies of the original arrays
|
|
35
|
+
if (total <= maxCombinedLength) {
|
|
36
|
+
return { list1: list1.slice(), list2: list2.slice() };
|
|
37
|
+
}
|
|
38
|
+
// Calculate scaling factor
|
|
39
|
+
const scalingFactor = maxCombinedLength / total;
|
|
40
|
+
// Determine new sizes based on scaling factor
|
|
41
|
+
let newSize1 = Math.round(len1 * scalingFactor);
|
|
42
|
+
let newSize2 = Math.round(len2 * scalingFactor);
|
|
43
|
+
// Adjust sizes to ensure the combined length matches maxCombinedLength
|
|
44
|
+
let adjustedTotal = newSize1 + newSize2;
|
|
45
|
+
if (adjustedTotal > maxCombinedLength) {
|
|
46
|
+
const excess = adjustedTotal - maxCombinedLength;
|
|
47
|
+
// Reduce the larger array first
|
|
48
|
+
if (newSize2 > newSize1) {
|
|
49
|
+
newSize2 = Math.max(newSize2 - excess, 0);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
newSize1 = Math.max(newSize1 - excess, 0);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else if (adjustedTotal < maxCombinedLength) {
|
|
56
|
+
const deficit = maxCombinedLength - adjustedTotal;
|
|
57
|
+
// Increase the larger array first, if possible
|
|
58
|
+
if (len2 > len1 && newSize2 < len2) {
|
|
59
|
+
newSize2 = Math.min(newSize2 + deficit, len2);
|
|
60
|
+
}
|
|
61
|
+
else if (newSize1 < len1) {
|
|
62
|
+
newSize1 = Math.min(newSize1 + deficit, len1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Final safeguard to ensure sizes do not exceed original lengths
|
|
66
|
+
newSize1 = Math.min(newSize1, len1);
|
|
67
|
+
newSize2 = Math.min(newSize2, len2);
|
|
68
|
+
const sampled1 = sampleList(list1, newSize1);
|
|
69
|
+
const sampled2 = sampleList(list2, newSize2);
|
|
70
|
+
return { list1: sampled1, list2: sampled2 };
|
|
71
|
+
};
|
|
72
|
+
exports.sampleCombinedList = sampleCombinedList;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TraceClient } from "@empiricalrun/llm";
|
|
2
|
+
import { TestGroup } from "@empiricalrun/shared-types/failure-workflow";
|
|
3
|
+
type ArgsT = {
|
|
4
|
+
testRunId: number;
|
|
5
|
+
test: TestGroup;
|
|
6
|
+
trace?: TraceClient;
|
|
7
|
+
};
|
|
8
|
+
type Summary = string;
|
|
9
|
+
export declare const generateErrorStackSummary: ({ testRunId, test, trace, }: ArgsT) => Promise<Summary>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=generate-error-stack-summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-error-stack-summary.d.ts","sourceRoot":"","sources":["../../src/generate-summary/generate-error-stack-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAGxE,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AACF,KAAK,OAAO,GAAG,MAAM,CAAC;AACtB,eAAO,MAAM,yBAAyB,GAAU,6BAI7C,KAAK,KAAG,OAAO,CAAC,OAAO,CAwCzB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateErrorStackSummary = void 0;
|
|
7
|
+
const llm_1 = require("@empiricalrun/llm");
|
|
8
|
+
const generate_failure_summary_with_texts_handlebars_1 = __importDefault(require("@/prompts/generate-failure-summary-with-texts.handlebars"));
|
|
9
|
+
const generateErrorStackSummary = async ({ testRunId, test, trace, }) => {
|
|
10
|
+
let output = "";
|
|
11
|
+
try {
|
|
12
|
+
const messages = (0, llm_1.compilePrompt)(promptTemplate_0, {
|
|
13
|
+
testName: test.title,
|
|
14
|
+
errorStack: test.failure.stack,
|
|
15
|
+
testFileCode: test.testFileCode,
|
|
16
|
+
});
|
|
17
|
+
trace?.event({
|
|
18
|
+
input: {
|
|
19
|
+
testName: test.title,
|
|
20
|
+
errorStack: test.failure.stack,
|
|
21
|
+
testFileCode: test.testFileCode,
|
|
22
|
+
},
|
|
23
|
+
output: { messages },
|
|
24
|
+
});
|
|
25
|
+
const llm = new llm_1.LLM({
|
|
26
|
+
trace,
|
|
27
|
+
provider: "openai",
|
|
28
|
+
defaultModel: "gpt-4o",
|
|
29
|
+
});
|
|
30
|
+
const llmResponse = await llm.createChatCompletion({
|
|
31
|
+
messages,
|
|
32
|
+
trace,
|
|
33
|
+
modelParameters: {
|
|
34
|
+
temperature: 0.5,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
output = llmResponse?.content ?? "";
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.error(`Error generating error stack summary for test - "${test.title}", testRunId - "${testRunId}"`, e);
|
|
41
|
+
}
|
|
42
|
+
return output;
|
|
43
|
+
};
|
|
44
|
+
exports.generateErrorStackSummary = generateErrorStackSummary;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { LLMModel, LLMProvider, TraceClient } from "@empiricalrun/llm";
|
|
2
|
+
import { Project } from "@empiricalrun/shared-types/api/projects";
|
|
3
|
+
import { TestGroup } from "@empiricalrun/shared-types/failure-workflow";
|
|
4
|
+
type ArgsT = {
|
|
5
|
+
testRunId: number;
|
|
6
|
+
test: TestGroup;
|
|
7
|
+
trace?: TraceClient;
|
|
8
|
+
project: Project;
|
|
9
|
+
modelConfig?: {
|
|
10
|
+
provider?: LLMProvider;
|
|
11
|
+
providerApiKey?: string;
|
|
12
|
+
model?: LLMModel;
|
|
13
|
+
temperature?: number;
|
|
14
|
+
prompt?: string;
|
|
15
|
+
promptVersion?: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
type BeforeAction = {
|
|
19
|
+
apiName: string;
|
|
20
|
+
params: Record<string, any>;
|
|
21
|
+
callId: string;
|
|
22
|
+
type: "before";
|
|
23
|
+
startTime: number;
|
|
24
|
+
wallTime?: number;
|
|
25
|
+
parentId?: string;
|
|
26
|
+
stack?: {
|
|
27
|
+
file: string;
|
|
28
|
+
line: number;
|
|
29
|
+
column: number;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
type ScreenshotsWithBase64 = {
|
|
33
|
+
type: string;
|
|
34
|
+
pageId: string;
|
|
35
|
+
sha1: string;
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
timestamp: number;
|
|
39
|
+
base64?: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const findSimilarActionFromList: ({ actionList, actionToFind, }: {
|
|
42
|
+
actionList: BeforeAction[];
|
|
43
|
+
actionToFind: BeforeAction;
|
|
44
|
+
}) => BeforeAction;
|
|
45
|
+
export declare const getFailedStep: ({ zipUrl, sendParentForBeforeAction, }: {
|
|
46
|
+
testRunId?: number;
|
|
47
|
+
zipUrl: string;
|
|
48
|
+
sendParentForBeforeAction?: boolean;
|
|
49
|
+
}) => Promise<BeforeAction>;
|
|
50
|
+
export declare const getScreenshotsInFailedStepWindow: ({ failedStep, testRunId, zipUrl, isSuccessRun, }: {
|
|
51
|
+
failedStep: BeforeAction;
|
|
52
|
+
testRunId: number;
|
|
53
|
+
zipUrl: string;
|
|
54
|
+
isSuccessRun?: boolean;
|
|
55
|
+
}) => Promise<ScreenshotsWithBase64[]>;
|
|
56
|
+
export declare const generateFailedStepScreenshotDiffSummary: ({ testRunId, test, modelConfig, trace, project, }: ArgsT) => Promise<string>;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=generate-failed-step-screenshot-diff-summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-failed-step-screenshot-diff-summary.d.ts","sourceRoot":"","sources":["../../src/generate-summary/generate-failed-step-screenshot-diff-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,WAAW,EACX,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAUxE,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE;QACZ,QAAQ,CAAC,EAAE,WAAW,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,KAAK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