@empiricalrun/test-gen 0.75.0 → 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 +15 -0
- package/dist/agent/base/index.d.ts +26 -19
- package/dist/agent/base/index.d.ts.map +1 -1
- package/dist/agent/base/index.js +88 -56
- package/dist/agent/chat/agent-loop.d.ts +4 -3
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +4 -10
- package/dist/agent/chat/exports.d.ts +4 -2
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +8 -7
- 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 +129 -196
- 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 +1 -2
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +2 -2
- package/dist/agent/chat/utils.d.ts +2 -3
- package/dist/agent/chat/utils.d.ts.map +1 -1
- package/dist/agent/chat/utils.js +1 -2
- 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.map +1 -1
- package/dist/file-info/adapters/github/index.js +1 -2
- package/dist/file-info/adapters/github/reader.d.ts +4 -9
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
- package/dist/file-info/adapters/github/reader.js +163 -134
- 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 +4 -4
- 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 +18 -4
- 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-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.map +1 -1
- package/dist/tools/fetch-video-analysis/index.js +18 -7
- package/dist/tools/fetch-video-analysis/utils.d.ts +5 -2
- package/dist/tools/fetch-video-analysis/utils.d.ts.map +1 -1
- package/dist/tools/fetch-video-analysis/utils.js +34 -11
- 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/index.d.ts +28 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +46 -28
- 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/test-run-fetcher/index.d.ts.map +1 -1
- package/dist/tools/test-run-fetcher/index.js +4 -14
- 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/{tools/fetch-video-analysis → utils}/local-ffmpeg-client.d.ts +4 -0
- package/dist/utils/local-ffmpeg-client.d.ts.map +1 -0
- package/dist/{tools/fetch-video-analysis → utils}/local-ffmpeg-client.js +63 -11
- package/package.json +2 -2
- 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-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
|
@@ -9,29 +9,29 @@ export declare const videoAnalysisSchema: z.ZodObject<{
|
|
|
9
9
|
featureFlag: z.ZodOptional<z.ZodDefault<z.ZodEnum<["none", "send-all-frames", "separate-threshold", "ai-based-frames"]>>>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
model?: string | undefined;
|
|
12
|
-
fps?: number | undefined;
|
|
13
12
|
threshold?: number | undefined;
|
|
13
|
+
fps?: number | undefined;
|
|
14
14
|
featureFlag?: "none" | "send-all-frames" | "separate-threshold" | "ai-based-frames" | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
model?: string | undefined;
|
|
17
|
-
fps?: number | undefined;
|
|
18
17
|
threshold?: number | undefined;
|
|
18
|
+
fps?: number | undefined;
|
|
19
19
|
featureFlag?: "none" | "send-all-frames" | "separate-threshold" | "ai-based-frames" | undefined;
|
|
20
20
|
}>>;
|
|
21
21
|
}, "strip", z.ZodTypeAny, {
|
|
22
22
|
videoUrl: string;
|
|
23
23
|
params?: {
|
|
24
24
|
model?: string | undefined;
|
|
25
|
-
fps?: number | undefined;
|
|
26
25
|
threshold?: number | undefined;
|
|
26
|
+
fps?: number | undefined;
|
|
27
27
|
featureFlag?: "none" | "send-all-frames" | "separate-threshold" | "ai-based-frames" | undefined;
|
|
28
28
|
} | undefined;
|
|
29
29
|
}, {
|
|
30
30
|
videoUrl: string;
|
|
31
31
|
params?: {
|
|
32
32
|
model?: string | undefined;
|
|
33
|
-
fps?: number | undefined;
|
|
34
33
|
threshold?: number | undefined;
|
|
34
|
+
fps?: number | undefined;
|
|
35
35
|
featureFlag?: "none" | "send-all-frames" | "separate-threshold" | "ai-based-frames" | undefined;
|
|
36
36
|
} | undefined;
|
|
37
37
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TraceClient } from "@empiricalrun/llm";
|
|
2
2
|
import { PendingToolCall, ToolResult } from "@empiricalrun/llm/chat";
|
|
3
|
-
import { ChatSessionInfo, IDashboardAPIClient, ToolExecute } from "@empiricalrun/shared-types";
|
|
3
|
+
import type { ChatSessionInfo, IDashboardAPIClient, ToolExecute } from "@empiricalrun/shared-types";
|
|
4
4
|
export declare class ToolExecutor {
|
|
5
5
|
toolExecutors: Record<string, ToolExecute>;
|
|
6
6
|
chatSession: ChatSessionInfo | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAEV,eAAe,EACf,mBAAmB,EACnB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AA8BpC,qBAAa,YAAY;IACvB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAM;IAChD,WAAW,EAAE,eAAe,GAAG,IAAI,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAEjC,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,KAAK,EACL,YAAY,EACZ,oBAAyB,GAC1B,EAAE;QACD,WAAW,EAAE,eAAe,GAAG,IAAI,CAAC;QACpC,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,mBAAmB,CAAC;QAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/C;IAiDK,OAAO,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CA8EnE"}
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ToolExecutor = void 0;
|
|
4
4
|
const artifacts_1 = require("../../artifacts");
|
|
5
|
-
const
|
|
5
|
+
const file_1 = require("../../utils/file");
|
|
6
|
+
const create_pull_request_1 = require("../create-pull-request");
|
|
6
7
|
const delete_file_1 = require("../delete-file");
|
|
7
8
|
const diagnosis_fetcher_1 = require("../diagnosis-fetcher");
|
|
8
9
|
const download_build_1 = require("../download-build");
|
|
10
|
+
const extract_frames_from_video_1 = require("../extract-frames-from-video");
|
|
9
11
|
const fetch_file_1 = require("../fetch-file");
|
|
10
12
|
const fetch_last_successful_test_run_1 = require("../fetch-last-successful-test-run");
|
|
13
|
+
const fetch_session_diff_1 = require("../fetch-session-diff");
|
|
11
14
|
const fetch_video_analysis_1 = require("../fetch-video-analysis");
|
|
12
15
|
const file_operations_1 = require("../file-operations");
|
|
13
16
|
const grep_1 = require("../grep");
|
|
@@ -16,6 +19,7 @@ const list_environments_1 = require("../list-environments");
|
|
|
16
19
|
const list_tests_and_projects_1 = require("../list-tests-and-projects");
|
|
17
20
|
const merge_conflicts_1 = require("../merge-conflicts");
|
|
18
21
|
const rename_file_1 = require("../rename-file");
|
|
22
|
+
const review_pull_request_1 = require("../review-pull-request");
|
|
19
23
|
const run_test_1 = require("../run-test");
|
|
20
24
|
const test_gen_browser_1 = require("../test-gen-browser");
|
|
21
25
|
const test_run_fetcher_1 = require("../test-run-fetcher");
|
|
@@ -48,7 +52,7 @@ class ToolExecutor {
|
|
|
48
52
|
test_run_fetcher_1.fetchTestRunReportTool,
|
|
49
53
|
diagnosis_fetcher_1.fetchDiagnosisReportTool,
|
|
50
54
|
test_gen_browser_1.generateTestWithBrowserAgent,
|
|
51
|
-
|
|
55
|
+
create_pull_request_1.createPullRequestTool,
|
|
52
56
|
merge_conflicts_1.mergeConflictsTool,
|
|
53
57
|
list_environments_1.listEnvironmentsTool,
|
|
54
58
|
issues_1.listIssuesTool,
|
|
@@ -65,6 +69,9 @@ class ToolExecutor {
|
|
|
65
69
|
fetch_last_successful_test_run_1.fetchLastSuccessfulTestRunTool,
|
|
66
70
|
triage_summary_1.sendTriageSummaryTool,
|
|
67
71
|
list_tests_and_projects_1.listProjectsTool,
|
|
72
|
+
extract_frames_from_video_1.extractFramesFromVideo,
|
|
73
|
+
fetch_session_diff_1.fetchSessionDiffTool,
|
|
74
|
+
review_pull_request_1.reviewPullRequestTool,
|
|
68
75
|
...file_operations_1.textEditorTools,
|
|
69
76
|
];
|
|
70
77
|
tools.forEach((tool) => {
|
|
@@ -89,8 +96,15 @@ class ToolExecutor {
|
|
|
89
96
|
input: toolCall.input,
|
|
90
97
|
});
|
|
91
98
|
const uploadArtifactsQueue = new artifacts_1.UploadArtifactsQueue(this.repoPath, toolCall.id);
|
|
92
|
-
const collectArtifactsFn = (artifactsInput) => {
|
|
93
|
-
uploadArtifactsQueue
|
|
99
|
+
const collectArtifactsFn = (artifactsInput, cleanUpDir) => {
|
|
100
|
+
uploadArtifactsQueue
|
|
101
|
+
.addTask(artifactsInput)
|
|
102
|
+
.then(() => {
|
|
103
|
+
if (cleanUpDir) {
|
|
104
|
+
void (0, file_1.safeCleanupDirectory)(cleanUpDir);
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
.catch((error) => {
|
|
94
108
|
console.error("Error collecting artifacts:", error);
|
|
95
109
|
});
|
|
96
110
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Tool } from "@empiricalrun/shared-types";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import { type extractFramesFromVideoSchema } from "../definitions/extract-frames-from-video";
|
|
4
|
+
type ExtractFramesInput = z.infer<typeof extractFramesFromVideoSchema>;
|
|
5
|
+
export declare const extractFramesFromVideo: Tool<ExtractFramesInput>;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/extract-frames-from-video/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,IAAI,EAEL,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,0CAA0C,CAAC;AAElD,KAAK,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AA0EvE,eAAO,MAAM,sBAAsB,EAAE,IAAI,CAAC,kBAAkB,CAkH3D,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
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.extractFramesFromVideo = void 0;
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const file_1 = require("../../utils/file");
|
|
10
|
+
const local_ffmpeg_client_1 = require("../../utils/local-ffmpeg-client");
|
|
11
|
+
const extract_frames_from_video_1 = require("../definitions/extract-frames-from-video");
|
|
12
|
+
function parseTimeToSeconds(timeString) {
|
|
13
|
+
const timeRegex = /^(\d{1,2}):(\d{2})$/;
|
|
14
|
+
const match = timeString.match(timeRegex);
|
|
15
|
+
if (!match || match.length < 3) {
|
|
16
|
+
throw new Error(`Invalid time format: ${timeString}. Expected MM:SS format (e.g., "01:32")`);
|
|
17
|
+
}
|
|
18
|
+
const minutesStr = match[1];
|
|
19
|
+
const secondsStr = match[2];
|
|
20
|
+
if (!minutesStr || !secondsStr) {
|
|
21
|
+
throw new Error(`Invalid time format: ${timeString}. Expected MM:SS format (e.g., "01:32")`);
|
|
22
|
+
}
|
|
23
|
+
const minutes = parseInt(minutesStr, 10);
|
|
24
|
+
const seconds = parseInt(secondsStr, 10);
|
|
25
|
+
if (seconds >= 60) {
|
|
26
|
+
throw new Error(`Invalid seconds: ${seconds}. Seconds must be 0-59`);
|
|
27
|
+
}
|
|
28
|
+
return minutes * 60 + seconds;
|
|
29
|
+
}
|
|
30
|
+
function getExtractFramesParams(params) {
|
|
31
|
+
return {
|
|
32
|
+
fps: params?.fps ?? 30,
|
|
33
|
+
threshold: params?.threshold ?? 0.001,
|
|
34
|
+
startTime: params?.startTime
|
|
35
|
+
? parseTimeToSeconds(params.startTime)
|
|
36
|
+
: undefined,
|
|
37
|
+
duration: params?.duration
|
|
38
|
+
? parseTimeToSeconds(params.duration)
|
|
39
|
+
: undefined,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function hashExtractParams(videoUrl, params) {
|
|
43
|
+
const sortedParams = Object.keys(params)
|
|
44
|
+
.sort()
|
|
45
|
+
.reduce((acc, key) => {
|
|
46
|
+
acc[key] = params[key];
|
|
47
|
+
return acc;
|
|
48
|
+
}, {});
|
|
49
|
+
const json = JSON.stringify({ videoUrl, ...sortedParams });
|
|
50
|
+
return node_crypto_1.default
|
|
51
|
+
.createHash("sha256")
|
|
52
|
+
.update(json)
|
|
53
|
+
.digest("hex")
|
|
54
|
+
.substring(0, 16);
|
|
55
|
+
}
|
|
56
|
+
exports.extractFramesFromVideo = {
|
|
57
|
+
...extract_frames_from_video_1.extractFramesFromVideo,
|
|
58
|
+
execute: async ({ input, trace, }) => {
|
|
59
|
+
const { videoUrl } = input;
|
|
60
|
+
const params = getExtractFramesParams(input.params);
|
|
61
|
+
const videoUrlHash = hashExtractParams(videoUrl, params);
|
|
62
|
+
const WORKING_DIR = `./extract-frames-artifacts/${videoUrlHash}`;
|
|
63
|
+
// const R2_BASE_URL = `https://video-analysis.empirical.run/${videoUrlHash}`;
|
|
64
|
+
const extractionSpan = trace?.span({
|
|
65
|
+
name: "extract-frames-from-video",
|
|
66
|
+
input: { videoUrl, params },
|
|
67
|
+
});
|
|
68
|
+
try {
|
|
69
|
+
const response = await fetch(videoUrl, { method: "HEAD" });
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
return {
|
|
72
|
+
result: `Failed to access video: ${response.statusText}`,
|
|
73
|
+
isError: true,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const ffmpegClient = new local_ffmpeg_client_1.LocalFFmpegClient();
|
|
77
|
+
const extractionResult = await ffmpegClient.extractVideoFrames(videoUrl, WORKING_DIR, {
|
|
78
|
+
fps: params.fps,
|
|
79
|
+
threshold: params.threshold,
|
|
80
|
+
startTime: params.startTime,
|
|
81
|
+
duration: params.duration,
|
|
82
|
+
});
|
|
83
|
+
const { totalFramesCount, uniqueFrames, videoDurationSeconds } = extractionResult;
|
|
84
|
+
// Create response metadata
|
|
85
|
+
const extractFramesResponse = {
|
|
86
|
+
videoUrl,
|
|
87
|
+
videoDurationSeconds,
|
|
88
|
+
totalFramesCount,
|
|
89
|
+
extractedFramesCount: uniqueFrames.length,
|
|
90
|
+
timeRange: params.startTime !== undefined || params.duration !== undefined
|
|
91
|
+
? {
|
|
92
|
+
startTime: params.startTime || 0,
|
|
93
|
+
duration: params.duration || 0,
|
|
94
|
+
endTime: (params.startTime || 0) + (params.duration || 0),
|
|
95
|
+
}
|
|
96
|
+
: undefined,
|
|
97
|
+
frames: uniqueFrames.map((frame) => ({
|
|
98
|
+
index: frame.metadata.index,
|
|
99
|
+
path: frame.metadata.path,
|
|
100
|
+
frameId: `frame_${frame.metadata.index}`,
|
|
101
|
+
})),
|
|
102
|
+
};
|
|
103
|
+
// Convert frames to base64 images for multimodal response
|
|
104
|
+
const frameImageParts = await Promise.all(uniqueFrames.map(async (frame) => {
|
|
105
|
+
try {
|
|
106
|
+
const imageBuffer = await fs_1.promises.readFile(frame.metadata.path);
|
|
107
|
+
const base64Data = imageBuffer.toString("base64");
|
|
108
|
+
return {
|
|
109
|
+
type: "image/png",
|
|
110
|
+
base64Data: base64Data,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
console.warn(`Failed to read frame ${frame.metadata.path}:`, error);
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
await (0, file_1.safeCleanupDirectory)(WORKING_DIR, "extract-frames-tool");
|
|
119
|
+
// Filter out any failed frame reads
|
|
120
|
+
const validFrameImageParts = frameImageParts.filter((part) => part !== null);
|
|
121
|
+
return {
|
|
122
|
+
result: [
|
|
123
|
+
{
|
|
124
|
+
type: "text",
|
|
125
|
+
text: JSON.stringify(extractFramesResponse, null, 2),
|
|
126
|
+
},
|
|
127
|
+
...validFrameImageParts,
|
|
128
|
+
],
|
|
129
|
+
isError: false,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
console.error("Error in extractFramesFromVideo", error);
|
|
134
|
+
extractionSpan?.end();
|
|
135
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
136
|
+
return {
|
|
137
|
+
result: `Error extracting frames from video: ${message}`,
|
|
138
|
+
isError: true,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
finally {
|
|
142
|
+
extractionSpan?.end();
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/fetch-session-diff/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,4BAA4B,CAAC;AAO9D,eAAO,MAAM,oBAAoB,EAAE,IA0ClC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchSessionDiffTool = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const SessionDiffInputSchema = zod_1.z.object({
|
|
6
|
+
url: zod_1.z.string().describe(`The URL of the chat session.`),
|
|
7
|
+
});
|
|
8
|
+
exports.fetchSessionDiffTool = {
|
|
9
|
+
schema: {
|
|
10
|
+
name: "fetchSessionDiff",
|
|
11
|
+
description: `Extracts the session url and returns the code diff for the session.`,
|
|
12
|
+
parameters: SessionDiffInputSchema,
|
|
13
|
+
},
|
|
14
|
+
needsBrowser: false,
|
|
15
|
+
isInlineTool: true,
|
|
16
|
+
execute: async ({ input, apiClient }) => {
|
|
17
|
+
try {
|
|
18
|
+
const sessionUrl = input.url;
|
|
19
|
+
if (!sessionUrl) {
|
|
20
|
+
return {
|
|
21
|
+
isError: true,
|
|
22
|
+
result: "No session URL provided",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (!apiClient) {
|
|
26
|
+
throw new Error("Dashboard API client is not available.");
|
|
27
|
+
}
|
|
28
|
+
const sessionId = sessionUrl.split("/").pop();
|
|
29
|
+
const sessionDiffApiUrl = `/api/chat-sessions/${sessionId}/diff`;
|
|
30
|
+
const sessionDiff = await apiClient.request(sessionDiffApiUrl, {
|
|
31
|
+
method: "GET",
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
isError: false,
|
|
35
|
+
result: JSON.stringify(sessionDiff, null, 2),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error("Error fetching session diff", error);
|
|
40
|
+
return {
|
|
41
|
+
isError: true,
|
|
42
|
+
result: error instanceof Error ? error.message : String(error),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/fetch-video-analysis/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/fetch-video-analysis/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,IAAI,EAKL,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,qCAAqC,CAAC;AAuC7C,eAAO,MAAM,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAsKxE,CAAC"}
|
|
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.fetchVideoAnalysis = void 0;
|
|
7
7
|
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const file_1 = require("../../utils/file");
|
|
10
|
+
const local_ffmpeg_client_1 = require("../../utils/local-ffmpeg-client");
|
|
9
11
|
const fetch_video_analysis_1 = require("../definitions/fetch-video-analysis");
|
|
10
|
-
const local_ffmpeg_client_1 = require("./local-ffmpeg-client");
|
|
11
12
|
const utils_1 = require("./utils");
|
|
12
13
|
const video_analysis_1 = require("./video-analysis");
|
|
13
14
|
function getVideoAnalysisParams(params) {
|
|
@@ -34,7 +35,7 @@ function hashObject(obj) {
|
|
|
34
35
|
}
|
|
35
36
|
exports.fetchVideoAnalysis = {
|
|
36
37
|
...fetch_video_analysis_1.fetchVideoAnalysis,
|
|
37
|
-
execute: async ({ input, trace, }) => {
|
|
38
|
+
execute: async ({ input, trace, featureFlags, }) => {
|
|
38
39
|
const { videoUrl } = input;
|
|
39
40
|
const params = getVideoAnalysisParams(input.params);
|
|
40
41
|
const videoUrlHash = hashObject({
|
|
@@ -82,8 +83,15 @@ exports.fetchVideoAnalysis = {
|
|
|
82
83
|
const zipUploadPromise = (0, utils_1.zipAndUploadFramesToR2)(uniqueFrames, outputZipPath, videoUrlHash).catch((error) => {
|
|
83
84
|
throw error; // Re-throw to maintain error in Promise.all
|
|
84
85
|
});
|
|
85
|
-
const { analysis: llmAnalysis, usage } = await (0, video_analysis_1.analyzeFramesWithLLM)(uniqueFrames
|
|
86
|
+
const { analysis: llmAnalysis, usage } = await (0, video_analysis_1.analyzeFramesWithLLM)(uniqueFrames, videoAnalysisSpan, selectedModel);
|
|
86
87
|
console.log(`[video-analysis] Finished Analyzing ${uniqueFrames.length} frames with LLM`);
|
|
88
|
+
let finalAnalysis = llmAnalysis;
|
|
89
|
+
let finalKeyFramesData = [];
|
|
90
|
+
if (featureFlags.includes("enableFetchVideoAnalysisToolMultiModal")) {
|
|
91
|
+
const { updatedAnalysis, keyFramesData } = await (0, utils_1.getUpdatedAnalysisAndToolResultImagePart)(llmAnalysis, uniqueFrames);
|
|
92
|
+
finalAnalysis = updatedAnalysis;
|
|
93
|
+
finalKeyFramesData = [...keyFramesData];
|
|
94
|
+
}
|
|
87
95
|
const videoInfo = {
|
|
88
96
|
total_frames_count: totalFramesCount,
|
|
89
97
|
unique_frames_count: uniqueFrames.length,
|
|
@@ -99,20 +107,23 @@ exports.fetchVideoAnalysis = {
|
|
|
99
107
|
usage,
|
|
100
108
|
langfuse_trace_id: trace?.id || undefined,
|
|
101
109
|
frames_zip_url: `${R2_BASE_URL}frames.zip`,
|
|
102
|
-
analysis:
|
|
110
|
+
analysis: finalAnalysis,
|
|
103
111
|
};
|
|
104
112
|
await Promise.all([
|
|
105
113
|
zipUploadPromise,
|
|
106
114
|
(0, utils_1.uploadSummaryToR2)(videoInfo, R2_BASE_URL),
|
|
107
115
|
]);
|
|
108
|
-
await (0,
|
|
116
|
+
await (0, file_1.safeCleanupDirectory)(WORKING_DIR, "video-analysis-cleanup");
|
|
109
117
|
const toolResult = {
|
|
110
118
|
video_url: videoUrl,
|
|
111
|
-
analysis: llmAnalysis,
|
|
112
119
|
analysis_id: videoUrlHash,
|
|
120
|
+
analysis: finalAnalysis,
|
|
113
121
|
};
|
|
114
122
|
return {
|
|
115
|
-
result:
|
|
123
|
+
result: [
|
|
124
|
+
{ type: "text", text: JSON.stringify(toolResult, null, 2) },
|
|
125
|
+
...finalKeyFramesData,
|
|
126
|
+
],
|
|
116
127
|
isError: false,
|
|
117
128
|
usage,
|
|
118
129
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type FileMap } from "@empiricalrun/r2-uploader";
|
|
2
|
-
import { UniqueFrameInfo, UniqueFrameWithMetadata, VideoAnalysisSummary } from "@empiricalrun/shared-types";
|
|
3
|
-
export declare const safeCleanupDirectory: (dirPath: string, label?: string) => Promise<void>;
|
|
2
|
+
import { ToolResultImagePart, UniqueFrameInfo, UniqueFrameWithMetadata, VideoAnalysisSummary } from "@empiricalrun/shared-types";
|
|
4
3
|
export declare const uploadFramesToR2: (videoInfo: Omit<VideoAnalysisSummary, "analysis">, frames: {
|
|
5
4
|
metadata: {
|
|
6
5
|
index: number;
|
|
@@ -10,4 +9,8 @@ export declare const uploadFramesToR2: (videoInfo: Omit<VideoAnalysisSummary, "a
|
|
|
10
9
|
}[], r2BaseUrl: string) => Promise<UniqueFrameInfo[]>;
|
|
11
10
|
export declare const uploadSummaryToR2: (videoInfo: VideoAnalysisSummary, r2BaseUrl: string) => Promise<string>;
|
|
12
11
|
export declare const zipAndUploadFramesToR2: (uniqueFrames: UniqueFrameWithMetadata[], outputZipPath: string, videoUrlHash: string) => Promise<FileMap>;
|
|
12
|
+
export declare const getUpdatedAnalysisAndToolResultImagePart: (llmAnalysis: string, uniqueFrames: UniqueFrameWithMetadata[]) => Promise<{
|
|
13
|
+
updatedAnalysis: string;
|
|
14
|
+
keyFramesData: ToolResultImagePart[];
|
|
15
|
+
}>;
|
|
13
16
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tools/fetch-video-analysis/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tools/fetch-video-analysis/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAuCpC,eAAO,MAAM,gBAAgB,GAC3B,WAAW,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,EACjD,QAAQ;IACN,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf,EAAE,EACH,WAAW,MAAM,KAChB,OAAO,CAAC,eAAe,EAAE,CAqB3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,WAAW,oBAAoB,EAC/B,WAAW,MAAM,KAChB,OAAO,CAAC,MAAM,CAsBhB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,cAAc,uBAAuB,EAAE,EACvC,eAAe,MAAM,EACrB,cAAc,MAAM,KACnB,OAAO,CAAC,OAAO,CAsBjB,CAAC;AAEF,eAAO,MAAM,wCAAwC,GACnD,aAAa,MAAM,EACnB,cAAc,uBAAuB,EAAE,KACtC,OAAO,CAAC;IACT,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACtC,CA2CA,CAAC"}
|
|
@@ -3,21 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getUpdatedAnalysisAndToolResultImagePart = exports.zipAndUploadFramesToR2 = exports.uploadSummaryToR2 = exports.uploadFramesToR2 = void 0;
|
|
7
7
|
const r2_uploader_1 = require("@empiricalrun/r2-uploader");
|
|
8
8
|
const child_process_1 = require("child_process");
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const safeCleanupDirectory = async (dirPath, label = "cleanup") => {
|
|
12
|
-
try {
|
|
13
|
-
console.log(`[${label}] Cleaning up directory: ${dirPath}`);
|
|
14
|
-
await fs_1.promises.rm(dirPath, { recursive: true });
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
console.warn(`[${label}] Failed to cleanup directory ${dirPath}:`, error instanceof Error ? error.message : String(error));
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.safeCleanupDirectory = safeCleanupDirectory;
|
|
21
11
|
const uploadFilesToR2 = async (files, videoUrlHash) => {
|
|
22
12
|
const label = `video-analysis-upload:${videoUrlHash}`;
|
|
23
13
|
const start = Date.now();
|
|
@@ -96,3 +86,36 @@ const zipAndUploadFramesToR2 = async (uniqueFrames, outputZipPath, videoUrlHash)
|
|
|
96
86
|
});
|
|
97
87
|
};
|
|
98
88
|
exports.zipAndUploadFramesToR2 = zipAndUploadFramesToR2;
|
|
89
|
+
const getUpdatedAnalysisAndToolResultImagePart = async (llmAnalysis, uniqueFrames) => {
|
|
90
|
+
const keyFramesMatch = llmAnalysis.match(/KEY FRAMES:\s*(.+)$/);
|
|
91
|
+
const updatedAnalysis = keyFramesMatch
|
|
92
|
+
? llmAnalysis.replace(/\n\nKEY FRAMES:\s*(.+)$/, "")
|
|
93
|
+
: llmAnalysis;
|
|
94
|
+
const keyFrameIndices = keyFramesMatch?.[1]
|
|
95
|
+
?.match(/<frame_(\d+)>/g)
|
|
96
|
+
?.map((match) => parseInt(match.match(/<frame_(\d+)>/)?.[1] || "0", 10)) || [];
|
|
97
|
+
const frameDataMap = new Map();
|
|
98
|
+
await Promise.all(uniqueFrames.map(async (frame) => {
|
|
99
|
+
try {
|
|
100
|
+
const fileBuffer = await fs_1.promises.readFile(frame.metadata.path);
|
|
101
|
+
const base64Data = fileBuffer.toString("base64");
|
|
102
|
+
frameDataMap.set(frame.metadata.index, base64Data);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
console.error(`Failed to read frame file ${frame.metadata.path}:`, error);
|
|
106
|
+
}
|
|
107
|
+
}));
|
|
108
|
+
const keyFramesData = keyFrameIndices
|
|
109
|
+
.map((frameIndex) => {
|
|
110
|
+
const base64Data = frameDataMap.get(frameIndex);
|
|
111
|
+
return base64Data
|
|
112
|
+
? {
|
|
113
|
+
type: "image/png",
|
|
114
|
+
base64Data: base64Data,
|
|
115
|
+
}
|
|
116
|
+
: null;
|
|
117
|
+
})
|
|
118
|
+
.filter(Boolean);
|
|
119
|
+
return { updatedAnalysis, keyFramesData };
|
|
120
|
+
};
|
|
121
|
+
exports.getUpdatedAnalysisAndToolResultImagePart = getUpdatedAnalysisAndToolResultImagePart;
|
|
@@ -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
|
-
url:
|
|
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,
|
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"}
|