@empiricalrun/test-gen 0.74.2 → 0.76.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 +37 -0
- package/dist/agent/base/index.d.ts +43 -0
- package/dist/agent/base/index.d.ts.map +1 -0
- package/dist/agent/base/index.js +106 -0
- package/dist/agent/chat/agent-loop.d.ts +7 -7
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +5 -18
- package/dist/agent/chat/exports.d.ts +6 -4
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +9 -8
- package/dist/agent/chat/index.d.ts +6 -10
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +130 -200
- package/dist/agent/chat/prompt/index.d.ts +5 -4
- package/dist/agent/chat/prompt/index.d.ts.map +1 -1
- package/dist/agent/chat/prompt/index.js +79 -68
- package/dist/agent/chat/state.d.ts +3 -5
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +2 -10
- package/dist/agent/chat/utils.d.ts +2 -4
- package/dist/agent/chat/utils.d.ts.map +1 -1
- package/dist/agent/chat/utils.js +2 -16
- package/dist/agent/cli.d.ts +11 -0
- package/dist/agent/cli.d.ts.map +1 -0
- package/dist/agent/cli.js +209 -0
- package/dist/agent/code-review/index.d.ts +7 -0
- package/dist/agent/code-review/index.d.ts.map +1 -0
- package/dist/agent/code-review/index.js +65 -0
- package/dist/agent/code-review/prompt.d.ts +1 -1
- package/dist/agent/code-review/prompt.d.ts.map +1 -1
- package/dist/agent/code-review/prompt.js +52 -16
- package/dist/agent/index.d.ts +10 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +19 -0
- package/dist/agent/triage/index.d.ts +7 -0
- package/dist/agent/triage/index.d.ts.map +1 -0
- package/dist/agent/triage/index.js +102 -0
- package/dist/agent/video-analysis/index.d.ts +7 -0
- package/dist/agent/video-analysis/index.d.ts.map +1 -0
- package/dist/agent/video-analysis/index.js +35 -0
- package/dist/bin/index.js +6 -6
- package/dist/file-info/adapters/github/index.d.ts +2 -2
- package/dist/file-info/adapters/github/index.d.ts.map +1 -1
- package/dist/file-info/adapters/github/index.js +4 -4
- package/dist/file-info/adapters/github/reader.d.ts +5 -10
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
- package/dist/file-info/adapters/github/reader.js +168 -138
- package/dist/tools/create-pull-request/index.d.ts.map +1 -0
- package/dist/tools/{definitions/commit-and-create-pr.js → create-pull-request/index.js} +30 -1
- package/dist/tools/create-pull-request/utils.d.ts +21 -0
- package/dist/tools/create-pull-request/utils.d.ts.map +1 -0
- package/dist/tools/create-pull-request/utils.js +83 -0
- package/dist/tools/definitions/extract-frames-from-video.d.ts +39 -0
- package/dist/tools/definitions/extract-frames-from-video.d.ts.map +1 -0
- package/dist/tools/definitions/extract-frames-from-video.js +60 -0
- package/dist/tools/definitions/fetch-video-analysis.d.ts +28 -0
- package/dist/tools/definitions/fetch-video-analysis.d.ts.map +1 -1
- package/dist/tools/definitions/fetch-video-analysis.js +39 -4
- package/dist/tools/definitions/rename-file.d.ts +3 -0
- package/dist/tools/definitions/rename-file.d.ts.map +1 -0
- package/dist/tools/definitions/rename-file.js +23 -0
- package/dist/tools/delete-file/index.d.ts.map +1 -1
- package/dist/tools/delete-file/index.js +13 -1
- package/dist/tools/executor/index.d.ts +1 -1
- package/dist/tools/executor/index.d.ts.map +1 -1
- package/dist/tools/executor/index.js +22 -7
- package/dist/tools/executor/utils/checkpoint.d.ts +1 -3
- package/dist/tools/executor/utils/checkpoint.d.ts.map +1 -1
- package/dist/tools/executor/utils/checkpoint.js +17 -17
- package/dist/tools/executor/utils/git.d.ts +9 -1
- package/dist/tools/executor/utils/git.d.ts.map +1 -1
- package/dist/tools/executor/utils/git.js +72 -2
- package/dist/tools/extract-frames-from-video/index.d.ts +7 -0
- package/dist/tools/extract-frames-from-video/index.d.ts.map +1 -0
- package/dist/tools/extract-frames-from-video/index.js +145 -0
- package/dist/tools/{fetch-image → fetch-file}/index.d.ts +2 -2
- package/dist/tools/fetch-file/index.d.ts.map +1 -0
- package/dist/tools/fetch-file/index.js +97 -0
- package/dist/tools/fetch-session-diff/index.d.ts +3 -0
- package/dist/tools/fetch-session-diff/index.d.ts.map +1 -0
- package/dist/tools/fetch-session-diff/index.js +46 -0
- package/dist/tools/fetch-video-analysis/index.d.ts +3 -3
- package/dist/tools/fetch-video-analysis/index.d.ts.map +1 -1
- package/dist/tools/fetch-video-analysis/index.js +84 -24
- package/dist/tools/fetch-video-analysis/open-ai.d.ts +6 -0
- package/dist/tools/fetch-video-analysis/open-ai.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/open-ai.js +37 -0
- package/dist/tools/fetch-video-analysis/utils.d.ts +9 -3
- package/dist/tools/fetch-video-analysis/utils.d.ts.map +1 -1
- package/dist/tools/fetch-video-analysis/utils.js +64 -15
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts +2 -2
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts.map +1 -1
- package/dist/tools/fetch-video-analysis/video-analysis.js +24 -8
- package/dist/tools/file-operations/create.d.ts.map +1 -1
- package/dist/tools/file-operations/create.js +6 -3
- package/dist/tools/file-operations/insert.d.ts.map +1 -1
- package/dist/tools/file-operations/insert.js +6 -3
- package/dist/tools/file-operations/replace.d.ts.map +1 -1
- package/dist/tools/file-operations/replace.js +6 -3
- package/dist/tools/file-operations/shared/git-helper.d.ts.map +1 -1
- package/dist/tools/file-operations/shared/git-helper.js +1 -1
- package/dist/tools/file-operations/view/index.d.ts +2 -5
- package/dist/tools/file-operations/view/index.d.ts.map +1 -1
- package/dist/tools/file-operations/view/index.js +2 -22
- package/dist/tools/index.d.ts +28 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +50 -22
- package/dist/tools/issues/update-issue.d.ts.map +1 -1
- package/dist/tools/issues/update-issue.js +16 -9
- package/dist/tools/merge-conflicts/index.js +1 -1
- package/dist/tools/rename-file/index.d.ts +3 -0
- package/dist/tools/rename-file/index.d.ts.map +1 -0
- package/dist/tools/rename-file/index.js +88 -0
- package/dist/tools/review-pull-request/index.d.ts +3 -0
- package/dist/tools/review-pull-request/index.d.ts.map +1 -0
- package/dist/tools/review-pull-request/index.js +103 -0
- package/dist/tools/run-test.js +2 -2
- package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
- package/dist/tools/test-run-fetcher/index.js +4 -14
- package/dist/tools/trace-dot-zip/index.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/index.js +2 -1
- package/dist/tools/trace-dot-zip/types.d.ts +35 -3
- package/dist/tools/trace-dot-zip/types.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts +7 -2
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/utils/network-trace.js +130 -10
- package/dist/tools/upgrade-packages/index.js +1 -1
- package/dist/tools/utils/urls.d.ts +5 -0
- package/dist/tools/utils/urls.d.ts.map +1 -0
- package/dist/tools/utils/urls.js +19 -0
- package/dist/tools/view-failed-test-run-report/index.d.ts.map +1 -1
- package/dist/tools/view-failed-test-run-report/index.js +3 -15
- package/dist/utils/file.d.ts +1 -0
- package/dist/utils/file.d.ts.map +1 -1
- package/dist/utils/file.js +45 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -3
- package/dist/utils/local-ffmpeg-client.d.ts +27 -0
- package/dist/utils/local-ffmpeg-client.d.ts.map +1 -0
- package/dist/{tools/fetch-video-analysis → utils}/local-ffmpeg-client.js +117 -27
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/agent/chat/utils/tool-calls.d.ts +0 -21
- package/dist/agent/chat/utils/tool-calls.d.ts.map +0 -1
- package/dist/agent/chat/utils/tool-calls.js +0 -64
- package/dist/tools/commit-and-create-pr/index.d.ts.map +0 -1
- package/dist/tools/commit-and-create-pr/index.js +0 -83
- package/dist/tools/definitions/commit-and-create-pr.d.ts +0 -3
- package/dist/tools/definitions/commit-and-create-pr.d.ts.map +0 -1
- package/dist/tools/fetch-image/index.d.ts.map +0 -1
- package/dist/tools/fetch-image/index.js +0 -63
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts +0 -24
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts.map +0 -1
- /package/dist/tools/{commit-and-create-pr → create-pull-request}/index.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TraceClient } from "@empiricalrun/llm";
|
|
2
|
-
import { SupportedChatModels, Usage } from "@empiricalrun/shared-types";
|
|
3
|
-
export declare function analyzeFramesWithLLM(
|
|
2
|
+
import { SupportedChatModels, UniqueFrameWithMetadata, Usage } from "@empiricalrun/shared-types";
|
|
3
|
+
export declare function analyzeFramesWithLLM(uniqueFrames: UniqueFrameWithMetadata[], trace?: TraceClient, selectedModel?: SupportedChatModels, apiKey?: string): Promise<{
|
|
4
4
|
analysis: string;
|
|
5
5
|
usage: Usage;
|
|
6
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-analysis.d.ts","sourceRoot":"","sources":["../../../src/tools/fetch-video-analysis/video-analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAEL,mBAAmB,EACnB,KAAK,EACN,MAAM,4BAA4B,CAAC;AAIpC,wBAAsB,oBAAoB,CACxC,
|
|
1
|
+
{"version":3,"file":"video-analysis.d.ts","sourceRoot":"","sources":["../../../src/tools/fetch-video-analysis/video-analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAEL,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,EACN,MAAM,4BAA4B,CAAC;AAIpC,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,uBAAuB,EAAE,EACvC,KAAK,CAAC,EAAE,WAAW,EACnB,aAAa,CAAC,EAAE,mBAAmB,EACnC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC,CA8E7C"}
|
|
@@ -3,32 +3,48 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.analyzeFramesWithLLM = analyzeFramesWithLLM;
|
|
4
4
|
const chat_1 = require("@empiricalrun/llm/chat");
|
|
5
5
|
const models_1 = require("../../agent/chat/models");
|
|
6
|
-
async function analyzeFramesWithLLM(
|
|
6
|
+
async function analyzeFramesWithLLM(uniqueFrames, trace, selectedModel, apiKey) {
|
|
7
7
|
const llmSpan = trace?.span({
|
|
8
8
|
name: "llm-frame-analysis",
|
|
9
|
-
input: { frameCount:
|
|
9
|
+
input: { frameCount: uniqueFrames.length },
|
|
10
10
|
});
|
|
11
11
|
const selectedChatModel = selectedModel || (0, models_1.getDefaultChatModelId)();
|
|
12
12
|
try {
|
|
13
13
|
// TODO: Move to canonical chat model
|
|
14
14
|
let chatModel = new chat_1.GeminiChatModel(selectedChatModel, [], apiKey || process.env.GOOGLE_API_KEY);
|
|
15
15
|
chatModel.validateEnvVarsForAuth();
|
|
16
|
-
const frameAttachments =
|
|
17
|
-
|
|
16
|
+
const frameAttachments = uniqueFrames.map((data) => ({
|
|
17
|
+
url: data.image,
|
|
18
18
|
contentType: "image/png",
|
|
19
|
-
name: `
|
|
19
|
+
name: `frame_${data.metadata.index}.png`,
|
|
20
20
|
}));
|
|
21
21
|
const userMessage = `
|
|
22
|
-
Analyze the ${
|
|
22
|
+
Analyze the ${uniqueFrames.length} frames that are extracted from a screen recording.`;
|
|
23
23
|
chatModel.pushUserMessage(userMessage, frameAttachments);
|
|
24
24
|
const systemPrompt = `
|
|
25
|
-
You are given a set of unique frames from a screen recording. Your job is to
|
|
25
|
+
You are given a set of unique frames from a screen recording. Your job is to provide a comprehensive analysis of the video content.
|
|
26
|
+
|
|
27
|
+
REQUIREMENTS:
|
|
28
|
+
1. Provide a detailed verbose bullet list of everything happening in the video
|
|
29
|
+
2. Analyze each frame thoroughly - do not skip any important details
|
|
30
|
+
3. Include UI elements, text content, user interactions, state changes, and visual elements
|
|
31
|
+
4. Be extremely thorough and capture every significant action or change
|
|
32
|
+
|
|
33
|
+
OUTPUT FORMAT:
|
|
34
|
+
- Start with detailed bullet points of your analysis
|
|
35
|
+
- End your response with a dedicated "KEY FRAMES:" section
|
|
36
|
+
- List the most important frame IDs in this exact format: KEY FRAMES: <frame_0>, <frame_5>, <frame_12>
|
|
37
|
+
- The key frames section MUST be the last part of your response
|
|
38
|
+
|
|
39
|
+
STRICT FORMATTING:
|
|
40
|
+
- Use bullet points for the analysis
|
|
41
|
+
- Key frames must be listed at the very end using the exact format specified above
|
|
42
|
+
- Do not include any text after the key frames list
|
|
26
43
|
`;
|
|
27
44
|
// Get LLM response
|
|
28
45
|
const response = await chatModel.getLLMResponse({
|
|
29
46
|
systemPrompt,
|
|
30
47
|
tools: [], // No tools needed for this analysis
|
|
31
|
-
selectedModel: selectedChatModel,
|
|
32
48
|
trace: llmSpan,
|
|
33
49
|
hasThinkingEnabled: false,
|
|
34
50
|
hasInterleavedThinkingEnabled: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAO1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,iBAAe,kBAAkB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,OAAO,CAAC,UAAU,CAAC,CA0DtB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fileCreateExecutor = fileCreateExecutor;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const web_1 = require("../../bin/utils/platform/web");
|
|
@@ -42,12 +43,14 @@ the required directories recursively for the new file.`,
|
|
|
42
43
|
fs_1.default.mkdirSync(parentDir, { recursive: true });
|
|
43
44
|
}
|
|
44
45
|
fs_1.default.writeFileSync(absoluteFilePath, input.file_text);
|
|
46
|
+
// Stage the file
|
|
47
|
+
(0, child_process_1.execSync)(`git add "${filePath}"`, { cwd: repoDir });
|
|
45
48
|
// Collect git patch artifact
|
|
46
49
|
await (0, git_helper_1.collectGitPatchArtifact)(filePath, repoDir, "create", collectArtifacts);
|
|
47
|
-
let
|
|
48
|
-
if (!
|
|
50
|
+
let tscResult = await (0, web_1.runTypescriptCompiler)(repoDir);
|
|
51
|
+
if (!tscResult.success) {
|
|
49
52
|
return {
|
|
50
|
-
result: `File ${filePath} has been created. However, type checks are failing with errors:\n\n${
|
|
53
|
+
result: `File ${filePath} has been created. However, type checks are failing with errors:\n\n${tscResult.errors.join("\n")}`,
|
|
51
54
|
isError: true,
|
|
52
55
|
};
|
|
53
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/insert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/insert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,iBAAe,kBAAkB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,OAAO,CAAC,UAAU,CAAC,CAwDtB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fileInsertExecutor = fileInsertExecutor;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const web_1 = require("../../bin/utils/platform/web");
|
|
9
10
|
const git_helper_1 = require("./shared/git-helper");
|
|
@@ -43,12 +44,14 @@ async function fileInsertExecutor({ input, filePath, absoluteFilePath, repoDir,
|
|
|
43
44
|
}
|
|
44
45
|
lines.splice(input.insert_line, 0, textToInsert);
|
|
45
46
|
fs_1.default.writeFileSync(absoluteFilePath, lines.join("\n"));
|
|
47
|
+
// Stage the file
|
|
48
|
+
(0, child_process_1.execSync)(`git add "${filePath}"`, { cwd: repoDir });
|
|
46
49
|
// Collect git patch artifact
|
|
47
50
|
await (0, git_helper_1.collectGitPatchArtifact)(filePath, repoDir, "insert", collectArtifacts);
|
|
48
|
-
let
|
|
49
|
-
if (!
|
|
51
|
+
let tscResult = await (0, web_1.runTypescriptCompiler)(repoDir);
|
|
52
|
+
if (!tscResult.success) {
|
|
50
53
|
return {
|
|
51
|
-
result: `Insertion in file ${filePath} was applied. However, type checks are failing with errors:\n${
|
|
54
|
+
result: `Insertion in file ${filePath} was applied. However, type checks are failing with errors:\n${tscResult.errors.join("\n")}`,
|
|
52
55
|
isError: true,
|
|
53
56
|
};
|
|
54
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/replace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"replace.d.ts","sourceRoot":"","sources":["../../../src/tools/file-operations/replace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG9D,iBAAe,sBAAsB,CAAC,EACpC,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,OAAO,CAAC,UAAU,CAAC,CAoFtB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fileStrReplaceExecutor = fileStrReplaceExecutor;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const web_1 = require("../../bin/utils/platform/web");
|
|
9
10
|
const git_helper_1 = require("./shared/git-helper");
|
|
@@ -61,12 +62,14 @@ async function fileStrReplaceExecutor({ input, filePath, absoluteFilePath, repoD
|
|
|
61
62
|
}
|
|
62
63
|
const newContent = normalizedContent.replace(normalizedOldStr, input.new_str);
|
|
63
64
|
fs_1.default.writeFileSync(absoluteFilePath, newContent);
|
|
65
|
+
// Stage the file
|
|
66
|
+
(0, child_process_1.execSync)(`git add "${filePath}"`, { cwd: repoDir });
|
|
64
67
|
// Collect git patch artifact
|
|
65
68
|
await (0, git_helper_1.collectGitPatchArtifact)(filePath, repoDir, "replace", collectArtifacts);
|
|
66
|
-
let
|
|
67
|
-
if (!
|
|
69
|
+
let tscResult = await (0, web_1.runTypescriptCompiler)(repoDir);
|
|
70
|
+
if (!tscResult.success) {
|
|
68
71
|
return {
|
|
69
|
-
result: `Edits to file ${filePath} have been applied. However, type checks are failing with errors:\n\n${
|
|
72
|
+
result: `Edits to file ${filePath} have been applied. However, type checks are failing with errors:\n\n${tscResult.errors.join("\n")}`,
|
|
70
73
|
isError: true,
|
|
71
74
|
};
|
|
72
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-helper.d.ts","sourceRoot":"","sources":["../../../../src/tools/file-operations/shared/git-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"git-helper.d.ts","sourceRoot":"","sources":["../../../../src/tools/file-operations/shared/git-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAQpC,iBAAe,uBAAuB,CACpC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,EAC1C,gBAAgB,CAAC,EAAE,gBAAgB,GAClC,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -12,7 +12,7 @@ async function collectGitPatchArtifact(filePath, repoDir, operation, collectArti
|
|
|
12
12
|
try {
|
|
13
13
|
const gitPatch = operation === "create"
|
|
14
14
|
? (0, git_1.getGitDiffForNewFile)(filePath, repoDir)
|
|
15
|
-
: (0, git_1.
|
|
15
|
+
: (0, git_1.getGitDiffStaged)(filePath, repoDir);
|
|
16
16
|
if (gitPatch.trim()) {
|
|
17
17
|
const patchArtifact = {
|
|
18
18
|
name: `${path_1.default.basename(filePath, path_1.default.extname(filePath))}_${operation}.patch`,
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { IDashboardAPIClient, ToolResult } from "@empiricalrun/shared-types";
|
|
2
2
|
import type { StrReplaceInputParams } from "../shared/helpers";
|
|
3
|
-
type FileViewExecutorOptions = {
|
|
4
|
-
use: "fs" | "github";
|
|
5
|
-
};
|
|
6
3
|
type FileViewExecutorParams = {
|
|
7
4
|
input: StrReplaceInputParams;
|
|
8
5
|
repoName?: string;
|
|
9
6
|
apiClient?: IDashboardAPIClient;
|
|
10
7
|
repoPath: string;
|
|
11
8
|
};
|
|
12
|
-
declare function fileViewExecutor(params: FileViewExecutorParams
|
|
13
|
-
export {
|
|
9
|
+
export declare function fileViewExecutor(params: FileViewExecutorParams): Promise<ToolResult>;
|
|
10
|
+
export {};
|
|
14
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/file-operations/view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAI7E,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,CA4BrB"}
|
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.fileViewExecutor = fileViewExecutor;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const file_info_1 = require("../../../file-info");
|
|
9
|
-
const git_1 = require("../../executor/utils/git");
|
|
10
9
|
const helpers_1 = require("../shared/helpers");
|
|
11
|
-
async function fileViewExecutor(params
|
|
12
|
-
const { input,
|
|
10
|
+
async function fileViewExecutor(params) {
|
|
11
|
+
const { input, repoPath } = params;
|
|
13
12
|
const filePath = input.path;
|
|
14
13
|
if (filePath === undefined || filePath === null) {
|
|
15
14
|
return {
|
|
@@ -23,26 +22,7 @@ async function fileViewExecutor(params, options) {
|
|
|
23
22
|
isError: true,
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
|
-
const { use } = options || {};
|
|
27
|
-
const wantsToUseGitHub = use && use === "github";
|
|
28
|
-
const canUseGitHub = wantsToUseGitHub && apiClient && repoName;
|
|
29
|
-
if (wantsToUseGitHub && !canUseGitHub) {
|
|
30
|
-
return {
|
|
31
|
-
result: "Error: GitHub integration is not available",
|
|
32
|
-
isError: true,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
25
|
try {
|
|
36
|
-
if (canUseGitHub) {
|
|
37
|
-
const branchName = await (0, git_1.getCurrentBranchName)(repoName);
|
|
38
|
-
return (0, file_info_1.viewFileUsingGitHub)({
|
|
39
|
-
input,
|
|
40
|
-
filePath,
|
|
41
|
-
repoName,
|
|
42
|
-
apiClient,
|
|
43
|
-
branchName,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
26
|
const absoluteFilePath = path_1.default.join(repoPath, filePath);
|
|
47
27
|
return (0, file_info_1.viewFileUsingFileSystem)({ input, filePath, absoluteFilePath });
|
|
48
28
|
}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
import { PendingToolCall, ServicePayload, SupportedChatModels, Tool, ToolDefinition } from "@empiricalrun/shared-types";
|
|
2
|
+
import { createPullRequestTool } from "./create-pull-request";
|
|
3
|
+
import { deleteFileTool } from "./definitions/delete-file";
|
|
4
|
+
import { downloadBuildTool } from "./definitions/download-build";
|
|
5
|
+
import { extractFramesFromVideo } from "./definitions/extract-frames-from-video";
|
|
6
|
+
import { fetchVideoAnalysis } from "./definitions/fetch-video-analysis";
|
|
7
|
+
import { grepTool } from "./definitions/grep";
|
|
8
|
+
import { listProjectsTool, listTestsForProjectTool } from "./definitions/list-tests-and-projects";
|
|
9
|
+
import { mergeConflictsTool } from "./definitions/merge-conflicts";
|
|
10
|
+
import { renameFileTool } from "./definitions/rename-file";
|
|
11
|
+
import { runTestTool } from "./definitions/run-test";
|
|
12
|
+
import { generateTestWithBrowserAgent } from "./definitions/test-gen-browser";
|
|
13
|
+
import { upgradePackagesTool } from "./definitions/upgrade-packages";
|
|
14
|
+
import { fetchDiagnosisReportTool } from "./diagnosis-fetcher";
|
|
15
|
+
import { fetchFileTool } from "./fetch-file";
|
|
16
|
+
import { fetchLastSuccessfulTestRunTool } from "./fetch-last-successful-test-run";
|
|
17
|
+
import { fetchSessionDiffTool } from "./fetch-session-diff";
|
|
18
|
+
import { createIssueTool, listIssuesTool, updateIssueTool } from "./issues";
|
|
19
|
+
import { listEnvironmentsTool } from "./list-environments";
|
|
20
|
+
import { reviewPullRequestTool } from "./review-pull-request";
|
|
21
|
+
import { fetchTestRunReportTool } from "./test-run-fetcher";
|
|
22
|
+
import { traceDotZipTool } from "./trace-dot-zip";
|
|
23
|
+
import { sendTriageSummaryTool } from "./triage-summary";
|
|
24
|
+
import { viewFailedTestRunReportTool } from "./view-failed-test-run-report";
|
|
2
25
|
type ToolOrToolDefinition = Tool | ToolDefinition;
|
|
26
|
+
export declare const commonTools: ToolOrToolDefinition[];
|
|
27
|
+
export declare const testGenerationTools: ToolOrToolDefinition[];
|
|
28
|
+
export declare const triageOnlyTools: ToolOrToolDefinition[];
|
|
29
|
+
export { createIssueTool, createPullRequestTool, deleteFileTool, downloadBuildTool, extractFramesFromVideo, fetchDiagnosisReportTool, fetchFileTool, fetchLastSuccessfulTestRunTool, fetchSessionDiffTool, fetchTestRunReportTool, fetchVideoAnalysis, generateTestWithBrowserAgent, grepTool, listEnvironmentsTool, listIssuesTool, listProjectsTool, listTestsForProjectTool, mergeConflictsTool, renameFileTool, reviewPullRequestTool, runTestTool, sendTriageSummaryTool, traceDotZipTool, updateIssueTool, upgradePackagesTool, viewFailedTestRunReportTool, };
|
|
3
30
|
export declare const allToolsDefinitions: ToolOrToolDefinition[];
|
|
4
|
-
export declare function
|
|
31
|
+
export declare function textEditorToolsForModel(model: SupportedChatModels): ToolOrToolDefinition[];
|
|
5
32
|
export declare function toolsNeedBrowser(toolCalls: PendingToolCall[]): boolean;
|
|
6
33
|
export declare function nameForTelemetry(toolCall: PendingToolCall): string;
|
|
7
34
|
export declare function sendToolRequestToRemoteQueue(payload: ServicePayload): Promise<void>;
|
|
8
|
-
export {};
|
|
9
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,IAAI,EACJ,cAAc,EACf,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,IAAI,EACJ,cAAc,EACf,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,KAAK,oBAAoB,GAAG,IAAI,GAAG,cAAc,CAAC;AAIlD,eAAO,MAAM,WAAW,EAAE,oBAAoB,EAQ7C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,oBAAoB,EAQrD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,oBAAoB,EASjD,CAAC;AAGF,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EAEjB,sBAAsB,EACtB,wBAAwB,EACxB,aAAa,EACb,8BAA8B,EAE9B,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAElB,4BAA4B,EAC5B,QAAQ,EACR,oBAAoB,EAEpB,cAAc,EAEd,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EAErB,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,2BAA2B,GAC5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,oBAAoB,EASrD,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,mBAAmB,GACzB,oBAAoB,EAAE,CAKxB;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,53 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.allToolsDefinitions = void 0;
|
|
4
|
-
exports.
|
|
3
|
+
exports.allToolsDefinitions = exports.viewFailedTestRunReportTool = exports.upgradePackagesTool = exports.updateIssueTool = exports.traceDotZipTool = exports.sendTriageSummaryTool = exports.runTestTool = exports.reviewPullRequestTool = exports.renameFileTool = exports.mergeConflictsTool = exports.listTestsForProjectTool = exports.listProjectsTool = exports.listIssuesTool = exports.listEnvironmentsTool = exports.grepTool = exports.generateTestWithBrowserAgent = exports.fetchVideoAnalysis = exports.fetchTestRunReportTool = exports.fetchSessionDiffTool = exports.fetchLastSuccessfulTestRunTool = exports.fetchFileTool = exports.fetchDiagnosisReportTool = exports.extractFramesFromVideo = exports.downloadBuildTool = exports.deleteFileTool = exports.createPullRequestTool = exports.createIssueTool = exports.triageOnlyTools = exports.testGenerationTools = exports.commonTools = void 0;
|
|
4
|
+
exports.textEditorToolsForModel = textEditorToolsForModel;
|
|
5
5
|
exports.toolsNeedBrowser = toolsNeedBrowser;
|
|
6
6
|
exports.nameForTelemetry = nameForTelemetry;
|
|
7
7
|
exports.sendToolRequestToRemoteQueue = sendToolRequestToRemoteQueue;
|
|
8
8
|
const chat_1 = require("@empiricalrun/llm/chat");
|
|
9
9
|
const SQSClient_1 = require("../utils/SQSClient");
|
|
10
|
-
const
|
|
10
|
+
const create_pull_request_1 = require("./create-pull-request");
|
|
11
|
+
Object.defineProperty(exports, "createPullRequestTool", { enumerable: true, get: function () { return create_pull_request_1.createPullRequestTool; } });
|
|
11
12
|
const delete_file_1 = require("./definitions/delete-file");
|
|
13
|
+
Object.defineProperty(exports, "deleteFileTool", { enumerable: true, get: function () { return delete_file_1.deleteFileTool; } });
|
|
12
14
|
const download_build_1 = require("./definitions/download-build");
|
|
15
|
+
Object.defineProperty(exports, "downloadBuildTool", { enumerable: true, get: function () { return download_build_1.downloadBuildTool; } });
|
|
16
|
+
const extract_frames_from_video_1 = require("./definitions/extract-frames-from-video");
|
|
17
|
+
Object.defineProperty(exports, "extractFramesFromVideo", { enumerable: true, get: function () { return extract_frames_from_video_1.extractFramesFromVideo; } });
|
|
13
18
|
const fetch_video_analysis_1 = require("./definitions/fetch-video-analysis");
|
|
19
|
+
Object.defineProperty(exports, "fetchVideoAnalysis", { enumerable: true, get: function () { return fetch_video_analysis_1.fetchVideoAnalysis; } });
|
|
14
20
|
const grep_1 = require("./definitions/grep");
|
|
21
|
+
Object.defineProperty(exports, "grepTool", { enumerable: true, get: function () { return grep_1.grepTool; } });
|
|
15
22
|
const list_tests_and_projects_1 = require("./definitions/list-tests-and-projects");
|
|
23
|
+
Object.defineProperty(exports, "listProjectsTool", { enumerable: true, get: function () { return list_tests_and_projects_1.listProjectsTool; } });
|
|
24
|
+
Object.defineProperty(exports, "listTestsForProjectTool", { enumerable: true, get: function () { return list_tests_and_projects_1.listTestsForProjectTool; } });
|
|
16
25
|
const merge_conflicts_1 = require("./definitions/merge-conflicts");
|
|
26
|
+
Object.defineProperty(exports, "mergeConflictsTool", { enumerable: true, get: function () { return merge_conflicts_1.mergeConflictsTool; } });
|
|
27
|
+
const rename_file_1 = require("./definitions/rename-file");
|
|
28
|
+
Object.defineProperty(exports, "renameFileTool", { enumerable: true, get: function () { return rename_file_1.renameFileTool; } });
|
|
17
29
|
const run_test_1 = require("./definitions/run-test");
|
|
30
|
+
Object.defineProperty(exports, "runTestTool", { enumerable: true, get: function () { return run_test_1.runTestTool; } });
|
|
18
31
|
const str_replace_editor_1 = require("./definitions/str_replace_editor");
|
|
19
32
|
const test_gen_browser_1 = require("./definitions/test-gen-browser");
|
|
33
|
+
Object.defineProperty(exports, "generateTestWithBrowserAgent", { enumerable: true, get: function () { return test_gen_browser_1.generateTestWithBrowserAgent; } });
|
|
20
34
|
const upgrade_packages_1 = require("./definitions/upgrade-packages");
|
|
35
|
+
Object.defineProperty(exports, "upgradePackagesTool", { enumerable: true, get: function () { return upgrade_packages_1.upgradePackagesTool; } });
|
|
21
36
|
const diagnosis_fetcher_1 = require("./diagnosis-fetcher");
|
|
22
|
-
|
|
37
|
+
Object.defineProperty(exports, "fetchDiagnosisReportTool", { enumerable: true, get: function () { return diagnosis_fetcher_1.fetchDiagnosisReportTool; } });
|
|
38
|
+
const fetch_file_1 = require("./fetch-file");
|
|
39
|
+
Object.defineProperty(exports, "fetchFileTool", { enumerable: true, get: function () { return fetch_file_1.fetchFileTool; } });
|
|
23
40
|
const fetch_last_successful_test_run_1 = require("./fetch-last-successful-test-run");
|
|
41
|
+
Object.defineProperty(exports, "fetchLastSuccessfulTestRunTool", { enumerable: true, get: function () { return fetch_last_successful_test_run_1.fetchLastSuccessfulTestRunTool; } });
|
|
42
|
+
const fetch_session_diff_1 = require("./fetch-session-diff");
|
|
43
|
+
Object.defineProperty(exports, "fetchSessionDiffTool", { enumerable: true, get: function () { return fetch_session_diff_1.fetchSessionDiffTool; } });
|
|
24
44
|
const issues_1 = require("./issues");
|
|
45
|
+
Object.defineProperty(exports, "createIssueTool", { enumerable: true, get: function () { return issues_1.createIssueTool; } });
|
|
46
|
+
Object.defineProperty(exports, "listIssuesTool", { enumerable: true, get: function () { return issues_1.listIssuesTool; } });
|
|
47
|
+
Object.defineProperty(exports, "updateIssueTool", { enumerable: true, get: function () { return issues_1.updateIssueTool; } });
|
|
25
48
|
const list_environments_1 = require("./list-environments");
|
|
49
|
+
Object.defineProperty(exports, "listEnvironmentsTool", { enumerable: true, get: function () { return list_environments_1.listEnvironmentsTool; } });
|
|
50
|
+
const review_pull_request_1 = require("./review-pull-request");
|
|
51
|
+
Object.defineProperty(exports, "reviewPullRequestTool", { enumerable: true, get: function () { return review_pull_request_1.reviewPullRequestTool; } });
|
|
26
52
|
const test_run_fetcher_1 = require("./test-run-fetcher");
|
|
53
|
+
Object.defineProperty(exports, "fetchTestRunReportTool", { enumerable: true, get: function () { return test_run_fetcher_1.fetchTestRunReportTool; } });
|
|
27
54
|
const trace_dot_zip_1 = require("./trace-dot-zip");
|
|
55
|
+
Object.defineProperty(exports, "traceDotZipTool", { enumerable: true, get: function () { return trace_dot_zip_1.traceDotZipTool; } });
|
|
28
56
|
const triage_summary_1 = require("./triage-summary");
|
|
57
|
+
Object.defineProperty(exports, "sendTriageSummaryTool", { enumerable: true, get: function () { return triage_summary_1.sendTriageSummaryTool; } });
|
|
29
58
|
const queue_1 = require("./utils/queue");
|
|
30
59
|
const view_failed_test_run_report_1 = require("./view-failed-test-run-report");
|
|
60
|
+
Object.defineProperty(exports, "viewFailedTestRunReportTool", { enumerable: true, get: function () { return view_failed_test_run_report_1.viewFailedTestRunReportTool; } });
|
|
31
61
|
// TODO: Keep this list in sync with the ToolExecutor
|
|
32
62
|
// Search for "Tool Executor Tools List"
|
|
33
|
-
|
|
63
|
+
exports.commonTools = [
|
|
34
64
|
run_test_1.runTestTool,
|
|
35
65
|
grep_1.grepTool,
|
|
36
66
|
diagnosis_fetcher_1.fetchDiagnosisReportTool,
|
|
37
67
|
list_environments_1.listEnvironmentsTool,
|
|
38
68
|
download_build_1.downloadBuildTool,
|
|
39
|
-
|
|
69
|
+
fetch_file_1.fetchFileTool,
|
|
40
70
|
trace_dot_zip_1.traceDotZipTool,
|
|
41
71
|
];
|
|
42
|
-
|
|
72
|
+
exports.testGenerationTools = [
|
|
43
73
|
test_gen_browser_1.generateTestWithBrowserAgent,
|
|
44
|
-
|
|
74
|
+
create_pull_request_1.createPullRequestTool,
|
|
45
75
|
merge_conflicts_1.mergeConflictsTool,
|
|
46
76
|
delete_file_1.deleteFileTool,
|
|
77
|
+
rename_file_1.renameFileTool,
|
|
47
78
|
upgrade_packages_1.upgradePackagesTool,
|
|
48
79
|
test_run_fetcher_1.fetchTestRunReportTool,
|
|
49
80
|
];
|
|
50
|
-
|
|
81
|
+
exports.triageOnlyTools = [
|
|
51
82
|
issues_1.listIssuesTool,
|
|
52
83
|
issues_1.createIssueTool,
|
|
53
84
|
issues_1.updateIssueTool,
|
|
@@ -55,26 +86,23 @@ const triageOnlyTools = [
|
|
|
55
86
|
fetch_video_analysis_1.fetchVideoAnalysis,
|
|
56
87
|
fetch_last_successful_test_run_1.fetchLastSuccessfulTestRunTool,
|
|
57
88
|
triage_summary_1.sendTriageSummaryTool,
|
|
89
|
+
review_pull_request_1.reviewPullRequestTool,
|
|
58
90
|
];
|
|
59
91
|
exports.allToolsDefinitions = [
|
|
60
|
-
...commonTools,
|
|
61
|
-
...testGenerationTools,
|
|
62
|
-
...triageOnlyTools,
|
|
92
|
+
...exports.commonTools,
|
|
93
|
+
...exports.testGenerationTools,
|
|
94
|
+
...exports.triageOnlyTools,
|
|
95
|
+
// Individual tools that were in removed arrays
|
|
96
|
+
extract_frames_from_video_1.extractFramesFromVideo,
|
|
97
|
+
fetch_session_diff_1.fetchSessionDiffTool,
|
|
63
98
|
list_tests_and_projects_1.listProjectsTool,
|
|
64
99
|
list_tests_and_projects_1.listTestsForProjectTool,
|
|
65
100
|
];
|
|
66
|
-
function
|
|
67
|
-
let tools = [...commonTools];
|
|
68
|
-
if (isTriage) {
|
|
69
|
-
tools = [...tools, ...triageOnlyTools];
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
tools = [...tools, ...testGenerationTools];
|
|
73
|
-
}
|
|
101
|
+
function textEditorToolsForModel(model) {
|
|
74
102
|
if (model && (0, chat_1.getProviderForModel)(model) !== "claude") {
|
|
75
|
-
|
|
103
|
+
return Object.values(str_replace_editor_1.textEditorTools);
|
|
76
104
|
}
|
|
77
|
-
return
|
|
105
|
+
return [];
|
|
78
106
|
}
|
|
79
107
|
function toolsNeedBrowser(toolCalls) {
|
|
80
108
|
return toolCalls.some((toolCall) => exports.allToolsDefinitions.find((t) => t.schema.name === toolCall.name)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-issue.d.ts","sourceRoot":"","sources":["../../../src/tools/issues/update-issue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"update-issue.d.ts","sourceRoot":"","sources":["../../../src/tools/issues/update-issue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAwB9D,eAAO,MAAM,eAAe,EAAE,IAsE7B,CAAC"}
|
|
@@ -31,22 +31,29 @@ exports.updateIssueTool = {
|
|
|
31
31
|
isInlineTool: true,
|
|
32
32
|
execute: async ({ input, apiClient }) => {
|
|
33
33
|
try {
|
|
34
|
-
const { id, title, description, issue_type, test_issue_prompt, test_cases_affected
|
|
34
|
+
const { id, title, description, issue_type, test_issue_prompt, test_cases_affected, test_run_info, } = input;
|
|
35
35
|
if (!apiClient) {
|
|
36
36
|
throw new Error("Dashboard API client is not available.");
|
|
37
37
|
}
|
|
38
|
-
const updateData = {
|
|
39
|
-
|
|
40
|
-
test_run_info,
|
|
41
|
-
};
|
|
42
|
-
if (title !== undefined)
|
|
38
|
+
const updateData = {};
|
|
39
|
+
if (title !== undefined) {
|
|
43
40
|
updateData.title = title;
|
|
44
|
-
|
|
41
|
+
}
|
|
42
|
+
if (description !== undefined) {
|
|
45
43
|
updateData.description = description;
|
|
46
|
-
|
|
44
|
+
}
|
|
45
|
+
if (issue_type !== undefined) {
|
|
47
46
|
updateData.issue_type = issue_type;
|
|
48
|
-
|
|
47
|
+
}
|
|
48
|
+
if (test_issue_prompt !== undefined) {
|
|
49
49
|
updateData.test_issue_prompt = test_issue_prompt;
|
|
50
|
+
}
|
|
51
|
+
if (test_cases_affected !== undefined && test_cases_affected.length > 0) {
|
|
52
|
+
updateData.test_cases_affected = test_cases_affected;
|
|
53
|
+
}
|
|
54
|
+
if (test_run_info !== undefined && test_run_info.length > 0) {
|
|
55
|
+
updateData.test_run_info = test_run_info;
|
|
56
|
+
}
|
|
50
57
|
const response = await (0, utils_1.updateIssue)(apiClient, id, updateData);
|
|
51
58
|
if (!response.data?.issue) {
|
|
52
59
|
return {
|
|
@@ -59,7 +59,7 @@ exports.mergeConflictsTool = {
|
|
|
59
59
|
}
|
|
60
60
|
else if (mergeResult === "CONFLICTS") {
|
|
61
61
|
const files = getConflictedFilesWithContents(repoPath);
|
|
62
|
-
(0, git_1.
|
|
62
|
+
(0, git_1.stageAndCommitFilesAsBotUser)({
|
|
63
63
|
commitMessage: "Merge from main with conflicts",
|
|
64
64
|
files: Object.keys(files),
|
|
65
65
|
repoPath,
|
|
@@ -0,0 +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,4BAA4B,CAAC;AAQnE,eAAO,MAAM,cAAc,EAAE,IA6E5B,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
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.renameFileTool = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const promises_1 = require("fs/promises");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const web_1 = require("../../bin/utils/platform/web");
|
|
11
|
+
const rename_file_1 = require("../definitions/rename-file");
|
|
12
|
+
exports.renameFileTool = {
|
|
13
|
+
...rename_file_1.renameFileTool,
|
|
14
|
+
execute: async ({ input, repoPath }) => {
|
|
15
|
+
try {
|
|
16
|
+
const oldFilePath = path_1.default.join(repoPath, input.oldPath);
|
|
17
|
+
const newFilePath = path_1.default.join(repoPath, input.newPath);
|
|
18
|
+
try {
|
|
19
|
+
const stats = await (0, promises_1.stat)(oldFilePath);
|
|
20
|
+
if (!stats.isFile()) {
|
|
21
|
+
return {
|
|
22
|
+
isError: true,
|
|
23
|
+
result: `Error: '${input.oldPath}' is not a file. Use a different tool to rename directories.`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return {
|
|
29
|
+
isError: true,
|
|
30
|
+
result: `Error: File '${input.oldPath}' does not exist.`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const resolvedOldPath = path_1.default.resolve(oldFilePath);
|
|
34
|
+
const resolvedNewPath = path_1.default.resolve(newFilePath);
|
|
35
|
+
const resolvedRepoPath = path_1.default.resolve(repoPath);
|
|
36
|
+
if (!resolvedOldPath.startsWith(resolvedRepoPath)) {
|
|
37
|
+
return {
|
|
38
|
+
isError: true,
|
|
39
|
+
result: `Error: Source file is outside the repository root.`,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (!resolvedNewPath.startsWith(resolvedRepoPath)) {
|
|
43
|
+
return {
|
|
44
|
+
isError: true,
|
|
45
|
+
result: `Error: Destination path is outside the repository root.`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
await (0, promises_1.stat)(newFilePath);
|
|
50
|
+
return {
|
|
51
|
+
isError: true,
|
|
52
|
+
result: `Error: Destination file '${input.newPath}' already exists.`,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// File doesn't exist, which is what we want
|
|
57
|
+
}
|
|
58
|
+
const newDir = path_1.default.dirname(newFilePath);
|
|
59
|
+
await (0, promises_1.mkdir)(newDir, { recursive: true });
|
|
60
|
+
await (0, promises_1.rename)(oldFilePath, newFilePath);
|
|
61
|
+
// Stage both files for git porcelain
|
|
62
|
+
function stageFile(filePath) {
|
|
63
|
+
return (0, child_process_1.execSync)(`git add ${filePath}`, { cwd: repoPath });
|
|
64
|
+
}
|
|
65
|
+
stageFile(oldFilePath);
|
|
66
|
+
stageFile(newFilePath);
|
|
67
|
+
// Run TypeScript compilation check
|
|
68
|
+
const tscResult = await (0, web_1.runTypescriptCompiler)(repoPath);
|
|
69
|
+
if (!tscResult.success) {
|
|
70
|
+
return {
|
|
71
|
+
result: `File renamed from '${input.oldPath}' to '${input.newPath}'. However, type checks are failing with errors:\n\n${tscResult.errors.join("\n")}`,
|
|
72
|
+
isError: true,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
isError: false,
|
|
77
|
+
result: `Successfully renamed file from '${input.oldPath}' to '${input.newPath}'`,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.error("Error renaming file", error);
|
|
82
|
+
return {
|
|
83
|
+
isError: true,
|
|
84
|
+
result: error instanceof Error ? error.message : String(error),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/review-pull-request/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAc,MAAM,4BAA4B,CAAC;AAc/E,eAAO,MAAM,qBAAqB,EAAE,IAgGnC,CAAC"}
|