@empiricalrun/test-gen 0.74.2 → 0.75.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 +22 -0
- package/dist/agent/base/index.d.ts +36 -0
- package/dist/agent/base/index.d.ts.map +1 -0
- package/dist/agent/base/index.js +74 -0
- package/dist/agent/chat/agent-loop.d.ts +4 -5
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +2 -9
- package/dist/agent/chat/exports.d.ts +3 -3
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +5 -5
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +8 -11
- package/dist/agent/chat/state.d.ts +2 -3
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +0 -8
- package/dist/agent/chat/utils.d.ts +0 -1
- package/dist/agent/chat/utils.d.ts.map +1 -1
- package/dist/agent/chat/utils.js +1 -14
- 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 +3 -2
- package/dist/file-info/adapters/github/reader.d.ts +3 -3
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
- package/dist/file-info/adapters/github/reader.js +17 -16
- package/dist/tools/commit-and-create-pr/index.js +1 -1
- 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.map +1 -1
- package/dist/tools/executor/index.js +4 -3
- 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/{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-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 +71 -22
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts +8 -9
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts.map +1 -1
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.js +55 -17
- 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 +6 -3
- package/dist/tools/fetch-video-analysis/utils.d.ts.map +1 -1
- package/dist/tools/fetch-video-analysis/utils.js +41 -15
- package/dist/tools/fetch-video-analysis/video-analysis.js +1 -1
- 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 +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +14 -4
- 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/run-test.js +2 -2
- 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/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -3
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/tools/fetch-image/index.d.ts.map +0 -1
- package/dist/tools/fetch-image/index.js +0 -63
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchImageTool = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const SUPPORTED_CONTENT_TYPES = ["image/png", "image/jpeg"];
|
|
6
|
-
const fetchImageSchema = zod_1.z.object({
|
|
7
|
-
url: zod_1.z.string(),
|
|
8
|
-
});
|
|
9
|
-
exports.fetchImageTool = {
|
|
10
|
-
schema: {
|
|
11
|
-
name: "fetchImage",
|
|
12
|
-
description: `Use this tool to fetch image data from any valid URL that responds with a PNG or JPEG image.
|
|
13
|
-
It takes an image URL as input and returns the image in base64 format, for you to view or analyze.
|
|
14
|
-
|
|
15
|
-
## Common scenarios:
|
|
16
|
-
1. Understand a test report (for the runTest tool) by fetching screenshots: test results can have screenshot URLs in the attachments section of the report.
|
|
17
|
-
|
|
18
|
-
2. While adding new tests, if the user message contains image URLs, use this tool to fetch the images, and understand the steps that the user is looking to cover.`,
|
|
19
|
-
parameters: fetchImageSchema,
|
|
20
|
-
},
|
|
21
|
-
needsBrowser: false,
|
|
22
|
-
isInlineTool: true,
|
|
23
|
-
execute: async ({ input }) => {
|
|
24
|
-
const { url } = input;
|
|
25
|
-
try {
|
|
26
|
-
const response = await fetch(url);
|
|
27
|
-
if (!response.ok) {
|
|
28
|
-
console.error(`Failed to fetch image from ${url}: ${response.statusText}`);
|
|
29
|
-
return {
|
|
30
|
-
result: `Failed to fetch image from ${url}: ${response.statusText}`,
|
|
31
|
-
isError: true,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const contentType = response.headers.get("content-type");
|
|
35
|
-
if (!contentType || !SUPPORTED_CONTENT_TYPES.includes(contentType)) {
|
|
36
|
-
const errorMessage = `Invalid content type: ${contentType}. URL must return an image.`;
|
|
37
|
-
console.error(errorMessage);
|
|
38
|
-
return {
|
|
39
|
-
result: errorMessage,
|
|
40
|
-
isError: true,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
const buffer = await response.arrayBuffer();
|
|
44
|
-
const base64 = Buffer.from(buffer).toString("base64");
|
|
45
|
-
return {
|
|
46
|
-
result: [
|
|
47
|
-
{
|
|
48
|
-
type: contentType,
|
|
49
|
-
base64Data: base64,
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
isError: false,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
console.error("Error fetching image", error);
|
|
57
|
-
return {
|
|
58
|
-
result: `Error fetching image: ${error}`,
|
|
59
|
-
isError: true,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
};
|