@empiricalrun/test-gen 0.78.1 → 0.78.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/agent/base/index.d.ts.map +1 -1
- package/dist/agent/base/index.js +1 -0
- package/dist/agent/chat/exports.d.ts +0 -1
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +1 -3
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +2 -0
- package/dist/agent/cua/index.d.ts.map +1 -1
- package/dist/agent/cua/index.js +11 -8
- package/dist/agent/cua/pw-codegen/factory.d.ts +15 -0
- package/dist/agent/cua/pw-codegen/factory.d.ts.map +1 -0
- package/dist/agent/cua/pw-codegen/factory.js +59 -0
- package/dist/agent/cua/pw-codegen/index.d.ts +7 -0
- package/dist/agent/cua/pw-codegen/index.d.ts.map +1 -0
- package/dist/agent/cua/pw-codegen/index.js +14 -0
- package/dist/agent/cua/pw-codegen/pw-event-sink/index.d.ts +43 -0
- package/dist/agent/cua/pw-codegen/pw-event-sink/index.d.ts.map +1 -0
- package/dist/agent/cua/pw-codegen/pw-event-sink/index.js +250 -0
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts +1 -1
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -1
- package/dist/agent/cua/pw-codegen/pw-pause/index.js +6 -2
- package/dist/agent/cua/pw-codegen/pw-pause/patch.d.ts +15 -3
- package/dist/agent/cua/pw-codegen/pw-pause/patch.d.ts.map +1 -1
- package/dist/agent/cua/pw-codegen/pw-pause/patch.js +38 -10
- package/dist/agent/cua/pw-codegen/version.d.ts +25 -0
- package/dist/agent/cua/pw-codegen/version.d.ts.map +1 -0
- package/dist/agent/cua/pw-codegen/version.js +86 -0
- package/dist/agent/triage/index.d.ts.map +1 -1
- package/dist/agent/triage/index.js +2 -0
- package/dist/dashboard/client.d.ts +5 -0
- package/dist/dashboard/client.d.ts.map +1 -1
- package/dist/dashboard/client.js +28 -21
- package/dist/recorder/index.d.ts.map +1 -1
- package/dist/recorder/index.js +7 -2
- package/dist/tools/create-pull-request/utils.d.ts +1 -1
- package/dist/tools/definitions/analyse-video.d.ts +2 -24
- package/dist/tools/definitions/analyse-video.d.ts.map +1 -1
- package/dist/tools/definitions/delete-file.d.ts +1 -5
- package/dist/tools/definitions/delete-file.d.ts.map +1 -1
- package/dist/tools/definitions/download-build.d.ts +1 -5
- package/dist/tools/definitions/download-build.d.ts.map +1 -1
- package/dist/tools/definitions/list-tests-and-projects.d.ts +1 -5
- package/dist/tools/definitions/list-tests-and-projects.d.ts.map +1 -1
- package/dist/tools/definitions/run-test.d.ts +2 -14
- package/dist/tools/definitions/run-test.d.ts.map +1 -1
- package/dist/tools/definitions/safe-bash.d.ts +8 -0
- package/dist/tools/definitions/safe-bash.d.ts.map +1 -0
- package/dist/tools/definitions/safe-bash.js +32 -0
- package/dist/tools/definitions/test-gen-browser.d.ts +2 -14
- package/dist/tools/definitions/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/definitions/upgrade-packages.d.ts +3 -25
- package/dist/tools/definitions/upgrade-packages.d.ts.map +1 -1
- package/dist/tools/definitions/utils.d.ts +2 -10
- package/dist/tools/definitions/utils.d.ts.map +1 -1
- package/dist/tools/executor/index.d.ts.map +1 -1
- package/dist/tools/executor/index.js +2 -0
- package/dist/tools/fetch-file/index.d.ts +1 -5
- package/dist/tools/fetch-file/index.d.ts.map +1 -1
- package/dist/tools/firecrawl-scrape/index.d.ts +9 -0
- package/dist/tools/firecrawl-scrape/index.d.ts.map +1 -0
- package/dist/tools/firecrawl-scrape/index.js +107 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +9 -1
- package/dist/tools/issues-v2/create-issue.d.ts.map +1 -1
- package/dist/tools/issues-v2/create-issue.js +2 -6
- package/dist/tools/issues-v2/set-issue-description.d.ts +3 -0
- package/dist/tools/issues-v2/set-issue-description.d.ts.map +1 -0
- package/dist/tools/issues-v2/set-issue-description.js +59 -0
- package/dist/tools/issues-v2/update-issue.d.ts.map +1 -1
- package/dist/tools/issues-v2/update-issue.js +7 -9
- package/dist/tools/safe-bash/index.d.ts +3 -0
- package/dist/tools/safe-bash/index.d.ts.map +1 -0
- package/dist/tools/safe-bash/index.js +128 -0
- package/dist/tools/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/test-gen-browser.js +12 -5
- package/dist/tools/utils/validate-schema.d.ts.map +1 -1
- package/dist/tools/utils/validate-schema.js +9 -4
- package/dist/utils/model.d.ts.map +1 -1
- package/dist/utils/model.js +3 -8
- package/dist/utils/slug.d.ts +0 -1
- package/dist/utils/slug.d.ts.map +1 -1
- package/dist/utils/slug.js +1 -15
- package/package.json +6 -6
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -3,34 +3,12 @@ import { z } from "zod";
|
|
|
3
3
|
export declare const packageSpecSchema: z.ZodObject<{
|
|
4
4
|
name: z.ZodString;
|
|
5
5
|
version: z.ZodString;
|
|
6
|
-
},
|
|
7
|
-
name: string;
|
|
8
|
-
version: string;
|
|
9
|
-
}, {
|
|
10
|
-
name: string;
|
|
11
|
-
version: string;
|
|
12
|
-
}>;
|
|
6
|
+
}, z.core.$strip>;
|
|
13
7
|
export declare const upgradePackagesSchema: z.ZodObject<{
|
|
14
8
|
packages: z.ZodArray<z.ZodObject<{
|
|
15
9
|
name: z.ZodString;
|
|
16
10
|
version: z.ZodString;
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
version: string;
|
|
20
|
-
}, {
|
|
21
|
-
name: string;
|
|
22
|
-
version: string;
|
|
23
|
-
}>, "many">;
|
|
24
|
-
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
packages: {
|
|
26
|
-
name: string;
|
|
27
|
-
version: string;
|
|
28
|
-
}[];
|
|
29
|
-
}, {
|
|
30
|
-
packages: {
|
|
31
|
-
name: string;
|
|
32
|
-
version: string;
|
|
33
|
-
}[];
|
|
34
|
-
}>;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
35
13
|
export declare const upgradePackagesTool: ToolDefinition;
|
|
36
14
|
//# sourceMappingURL=upgrade-packages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-packages.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/upgrade-packages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"upgrade-packages.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/upgrade-packages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;iBAEhC,CAAC;AAEH,eAAO,MAAM,mBAAmB,EAAE,cASjC,CAAC"}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const getCommonTestNameSuitesFilePathSchema: (testNameDescription?: string) => z.ZodObject<{
|
|
3
3
|
testName: z.ZodString;
|
|
4
|
-
suites: z.ZodArray<z.ZodString
|
|
4
|
+
suites: z.ZodArray<z.ZodString>;
|
|
5
5
|
filePath: z.ZodString;
|
|
6
|
-
},
|
|
7
|
-
suites: string[];
|
|
8
|
-
testName: string;
|
|
9
|
-
filePath: string;
|
|
10
|
-
}, {
|
|
11
|
-
suites: string[];
|
|
12
|
-
testName: string;
|
|
13
|
-
filePath: string;
|
|
14
|
-
}>;
|
|
6
|
+
}, z.core.$strip>;
|
|
15
7
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qCAAqC,GAChD,sBAAsB,MAAM
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qCAAqC,GAChD,sBAAsB,MAAM;;;;iBAgB1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/index.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAEjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,qBAAa,YAAa,SAAQ,gBAAgB;gBACpC,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC;CA+BzD"}
|
|
@@ -17,6 +17,7 @@ const merge_conflicts_1 = require("../merge-conflicts");
|
|
|
17
17
|
const rename_file_1 = require("../rename-file");
|
|
18
18
|
const review_pull_request_1 = require("../review-pull-request");
|
|
19
19
|
const run_test_1 = require("../run-test");
|
|
20
|
+
const safe_bash_1 = require("../safe-bash");
|
|
20
21
|
const test_gen_browser_1 = require("../test-gen-browser");
|
|
21
22
|
const test_run_fetcher_1 = require("../test-run-fetcher");
|
|
22
23
|
const trace_dot_zip_1 = require("../trace-dot-zip");
|
|
@@ -54,6 +55,7 @@ class ToolExecutor extends base_1.BaseToolExecutor {
|
|
|
54
55
|
fetch_session_diff_1.fetchSessionDiffTool,
|
|
55
56
|
review_pull_request_1.reviewPullRequestTool,
|
|
56
57
|
list_tests_and_projects_1.listTestsForProjectTool,
|
|
58
|
+
safe_bash_1.safeBashTool,
|
|
57
59
|
...file_operations_1.textEditorTools,
|
|
58
60
|
];
|
|
59
61
|
super({ ...params, tools });
|
|
@@ -2,11 +2,7 @@ import { Tool } from "@empiricalrun/shared-types/chat-agent";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
declare const fetchFileSchema: z.ZodObject<{
|
|
4
4
|
url: z.ZodString;
|
|
5
|
-
},
|
|
6
|
-
url: string;
|
|
7
|
-
}, {
|
|
8
|
-
url: string;
|
|
9
|
-
}>;
|
|
5
|
+
}, z.core.$strip>;
|
|
10
6
|
export declare const fetchFileTool: Tool<z.infer<typeof fetchFileSchema>>;
|
|
11
7
|
export {};
|
|
12
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/fetch-file/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,IAAI,EAGL,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,QAAA,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/fetch-file/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,IAAI,EAGL,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,QAAA,MAAM,eAAe;;iBAEnB,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAoI/D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Tool } from "@empiricalrun/shared-types/chat-agent";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
declare const ScrapeHtmlInputSchema: z.ZodObject<{
|
|
4
|
+
url: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
type ScrapeHtmlInput = z.infer<typeof ScrapeHtmlInputSchema>;
|
|
7
|
+
export declare const scrapeHtmlTool: Tool<ScrapeHtmlInput>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/firecrawl-scrape/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,qBAAqB;;iBAEzB,CAAC;AAEH,KAAK,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAQ7D,eAAO,MAAM,cAAc,EAAE,IAAI,CAAC,eAAe,CA+GhD,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scrapeHtmlTool = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ScrapeHtmlInputSchema = zod_1.z.object({
|
|
6
|
+
url: zod_1.z.string().describe("The URL of the web page to scrape"),
|
|
7
|
+
});
|
|
8
|
+
exports.scrapeHtmlTool = {
|
|
9
|
+
schema: {
|
|
10
|
+
name: "scrapeHtml",
|
|
11
|
+
description: `Use this tool to scrape the content of a web page and return it as markdown.
|
|
12
|
+
|
|
13
|
+
## When to use this tool
|
|
14
|
+
- When you need to read documentation from external websites
|
|
15
|
+
- When you need to understand content from a web page that is not part of the repository
|
|
16
|
+
- When the user provides a URL and asks you to read or analyze its content`,
|
|
17
|
+
parameters: ScrapeHtmlInputSchema,
|
|
18
|
+
},
|
|
19
|
+
needsBrowser: false,
|
|
20
|
+
isInlineTool: true,
|
|
21
|
+
execute: async ({ input, logger, environmentOverrides, }) => {
|
|
22
|
+
const { url } = input;
|
|
23
|
+
logger?.info("Starting HTML scrape", {
|
|
24
|
+
tool: "scrapeHtmlTool",
|
|
25
|
+
url,
|
|
26
|
+
});
|
|
27
|
+
const apiKey = environmentOverrides?.FIRECRAWL_API_KEY;
|
|
28
|
+
if (!apiKey) {
|
|
29
|
+
logger?.error("Scrape API key not configured", {
|
|
30
|
+
tool: "scrapeHtmlTool",
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
isError: true,
|
|
34
|
+
result: "Scrape API key is not configured",
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const response = await fetch("https://api.firecrawl.dev/v2/scrape", {
|
|
39
|
+
method: "POST",
|
|
40
|
+
headers: {
|
|
41
|
+
Authorization: `Bearer ${apiKey}`,
|
|
42
|
+
"Content-Type": "application/json",
|
|
43
|
+
},
|
|
44
|
+
body: JSON.stringify({
|
|
45
|
+
url,
|
|
46
|
+
onlyMainContent: false,
|
|
47
|
+
maxAge: 172800000,
|
|
48
|
+
formats: ["markdown"],
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
const errorText = await response.text();
|
|
53
|
+
logger?.error("Scrape API request failed", {
|
|
54
|
+
tool: "scrapeHtmlTool",
|
|
55
|
+
url,
|
|
56
|
+
status: response.status,
|
|
57
|
+
error: errorText,
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
isError: true,
|
|
61
|
+
result: `Scrape API error: ${response.status} - ${errorText}`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const data = await response.json();
|
|
65
|
+
if (!data.success) {
|
|
66
|
+
logger?.error("HTML scrape failed", {
|
|
67
|
+
tool: "scrapeHtmlTool",
|
|
68
|
+
url,
|
|
69
|
+
error: data.error,
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
isError: true,
|
|
73
|
+
result: `HTML scrape failed: ${data.error || "Unknown error"}`,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (!data.data) {
|
|
77
|
+
logger?.warn("No data returned", {
|
|
78
|
+
tool: "scrapeHtmlTool",
|
|
79
|
+
url,
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
isError: true,
|
|
83
|
+
result: "No data returned from scrape",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
logger?.info("Successfully scraped web page", {
|
|
87
|
+
tool: "scrapeHtmlTool",
|
|
88
|
+
url,
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
isError: false,
|
|
92
|
+
result: JSON.stringify(data.data, null, 2),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
logger?.error("Error during HTML scrape", {
|
|
97
|
+
tool: "scrapeHtmlTool",
|
|
98
|
+
url,
|
|
99
|
+
error,
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
isError: true,
|
|
103
|
+
result: `Error scraping URL: ${error}`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
};
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PendingToolCall, SupportedChatModels, Tool, ToolDefinition } from "@empiricalrun/shared-types/chat-agent";
|
|
2
2
|
import { ServicePayload } from "@empiricalrun/shared-types/tool-execute-service";
|
|
3
|
+
export { scrapeHtmlTool } from "./firecrawl-scrape";
|
|
4
|
+
export { safeBashTool } from "./safe-bash";
|
|
3
5
|
export { validateToolInput } from "./utils/validate-schema";
|
|
4
6
|
type ToolOrToolDefinition = Tool | ToolDefinition;
|
|
5
7
|
export declare const commonTools: ToolOrToolDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,IAAI,EACJ,cAAc,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,IAAI,EACJ,cAAc,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAkCjF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,KAAK,oBAAoB,GAAG,IAAI,GAAG,cAAc,CAAC;AAIlD,eAAO,MAAM,WAAW,EAAE,oBAAoB,EAS7C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,oBAAoB,EAOrD,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,oBAAoB,EAgBrD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,WAE9D;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,mBAAmB,GACzB,oBAAoB,EAAE,CAExB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,mBAAmB,GACzB,oBAAoB,EAAE,CAExB;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,eAAe,EAAE,WAM5D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAQlE;AAED,wBAAsB,4BAA4B,CAAC,OAAO,EAAE,cAAc,iBAoBzE"}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.allToolsDefinitions = exports.testGenerationTools = exports.commonTools = exports.validateToolInput = void 0;
|
|
3
|
+
exports.allToolsDefinitions = exports.testGenerationTools = exports.commonTools = exports.validateToolInput = exports.safeBashTool = exports.scrapeHtmlTool = void 0;
|
|
4
4
|
exports.hasBuiltInTextEditor = hasBuiltInTextEditor;
|
|
5
5
|
exports.textEditorToolsForModel = textEditorToolsForModel;
|
|
6
6
|
exports.textViewToolsForModel = textViewToolsForModel;
|
|
@@ -24,12 +24,18 @@ const upgrade_packages_1 = require("./definitions/upgrade-packages");
|
|
|
24
24
|
const diagnosis_fetcher_1 = require("./diagnosis-fetcher");
|
|
25
25
|
const fetch_file_1 = require("./fetch-file");
|
|
26
26
|
const fetch_session_diff_1 = require("./fetch-session-diff");
|
|
27
|
+
const firecrawl_scrape_1 = require("./firecrawl-scrape");
|
|
27
28
|
const issues_v1_1 = require("./issues-v1");
|
|
28
29
|
const list_environments_1 = require("./list-environments");
|
|
30
|
+
const safe_bash_1 = require("./safe-bash");
|
|
29
31
|
const test_run_fetcher_1 = require("./test-run-fetcher");
|
|
30
32
|
const trace_dot_zip_1 = require("./trace-dot-zip");
|
|
31
33
|
const triage_summary_1 = require("./triage-summary");
|
|
32
34
|
const queue_1 = require("./utils/queue");
|
|
35
|
+
var firecrawl_scrape_2 = require("./firecrawl-scrape");
|
|
36
|
+
Object.defineProperty(exports, "scrapeHtmlTool", { enumerable: true, get: function () { return firecrawl_scrape_2.scrapeHtmlTool; } });
|
|
37
|
+
var safe_bash_2 = require("./safe-bash");
|
|
38
|
+
Object.defineProperty(exports, "safeBashTool", { enumerable: true, get: function () { return safe_bash_2.safeBashTool; } });
|
|
33
39
|
var validate_schema_1 = require("./utils/validate-schema");
|
|
34
40
|
Object.defineProperty(exports, "validateToolInput", { enumerable: true, get: function () { return validate_schema_1.validateToolInput; } });
|
|
35
41
|
// TODO: Keep this list in sync with the ToolExecutor
|
|
@@ -66,6 +72,8 @@ exports.allToolsDefinitions = [
|
|
|
66
72
|
fetch_session_diff_1.fetchSessionDiffTool,
|
|
67
73
|
list_tests_and_projects_1.listProjectsTool,
|
|
68
74
|
list_tests_and_projects_1.listTestsForProjectTool,
|
|
75
|
+
safe_bash_1.safeBashTool,
|
|
76
|
+
firecrawl_scrape_1.scrapeHtmlTool,
|
|
69
77
|
];
|
|
70
78
|
function hasBuiltInTextEditor(model) {
|
|
71
79
|
return model.includes("claude");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-issue.d.ts","sourceRoot":"","sources":["../../../src/tools/issues-v2/create-issue.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"create-issue.d.ts","sourceRoot":"","sources":["../../../src/tools/issues-v2/create-issue.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAwClE,eAAO,MAAM,eAAe,EAAE,IAsE7B,CAAC"}
|
|
@@ -4,9 +4,6 @@ exports.createIssueTool = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const createIssueSchema = zod_1.z.object({
|
|
6
6
|
title: zod_1.z.string().describe("A short, descriptive title for the issue"),
|
|
7
|
-
description: zod_1.z
|
|
8
|
-
.string()
|
|
9
|
-
.describe("A concise description that includes failing line, diagnosis summary (gathered from going through test run report attachments), and reasoning for issue_type."),
|
|
10
7
|
issue_type: zod_1.z
|
|
11
8
|
.enum(["app", "test", "unknown"])
|
|
12
9
|
.describe("The type of issue. Options: app, test, unknown. You can use 'unknown' if you are unsure about the type."),
|
|
@@ -28,14 +25,14 @@ async function createIssue(apiClient, issueData) {
|
|
|
28
25
|
exports.createIssueTool = {
|
|
29
26
|
schema: {
|
|
30
27
|
name: "createIssue",
|
|
31
|
-
description: `This tool allows you to create an issue in the project's issue tracking system. You MUST check if a similar issue already exists with the list issues tool before creating a new one.`,
|
|
28
|
+
description: `This tool allows you to create an issue in the project's issue tracking system. You MUST check if a similar issue already exists with the list issues tool before creating a new one. After creating an issue, use the setIssueDescription tool to add a detailed description.`,
|
|
32
29
|
parameters: createIssueSchema,
|
|
33
30
|
},
|
|
34
31
|
needsBrowser: false,
|
|
35
32
|
isInlineTool: true,
|
|
36
33
|
execute: async ({ input, apiClient, chatSession }) => {
|
|
37
34
|
try {
|
|
38
|
-
const { title,
|
|
35
|
+
const { title, issue_type = "unknown", test_issue_prompt, diagnosis_id, } = input;
|
|
39
36
|
if (!chatSession?.id) {
|
|
40
37
|
throw new Error("Cannot create issue without a chat session ID.");
|
|
41
38
|
}
|
|
@@ -52,7 +49,6 @@ exports.createIssueTool = {
|
|
|
52
49
|
action: "created",
|
|
53
50
|
title,
|
|
54
51
|
issue_type,
|
|
55
|
-
description,
|
|
56
52
|
diagnosis_id,
|
|
57
53
|
test_issue_prompt,
|
|
58
54
|
triage_session_id: chatSession.id,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-issue-description.d.ts","sourceRoot":"","sources":["../../../src/tools/issues-v2/set-issue-description.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AA+BlE,eAAO,MAAM,uBAAuB,EAAE,IA8CrC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setIssueDescriptionTool = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const setIssueDescriptionSchema = zod_1.z.object({
|
|
6
|
+
issue_id: zod_1.z
|
|
7
|
+
.number()
|
|
8
|
+
.describe("The ID of the issue to set the description for"),
|
|
9
|
+
description: zod_1.z
|
|
10
|
+
.string()
|
|
11
|
+
.describe("A concise description that includes failing line, diagnosis summary (gathered from going through test run report attachments), and reasoning for issue_type."),
|
|
12
|
+
});
|
|
13
|
+
async function setIssueDescription(apiClient, issueId, description) {
|
|
14
|
+
const response = await apiClient.request(`/api/issues/${issueId}`, { method: "PATCH", body: { description } });
|
|
15
|
+
if (!response || !response.data || !response.data.issue) {
|
|
16
|
+
throw new Error("Failed to set issue description: No response data received.");
|
|
17
|
+
}
|
|
18
|
+
return response;
|
|
19
|
+
}
|
|
20
|
+
exports.setIssueDescriptionTool = {
|
|
21
|
+
schema: {
|
|
22
|
+
name: "setIssueDescription",
|
|
23
|
+
description: `This tool allows you to set the description of an existing issue. Use this after creating an issue with createIssue to add a detailed description.`,
|
|
24
|
+
parameters: setIssueDescriptionSchema,
|
|
25
|
+
},
|
|
26
|
+
needsBrowser: false,
|
|
27
|
+
isInlineTool: true,
|
|
28
|
+
execute: async ({ input, apiClient }) => {
|
|
29
|
+
try {
|
|
30
|
+
const { issue_id, description } = input;
|
|
31
|
+
if (!apiClient) {
|
|
32
|
+
throw new Error("Dashboard API client is not available.");
|
|
33
|
+
}
|
|
34
|
+
const response = await setIssueDescription(apiClient, issue_id, description);
|
|
35
|
+
if (!response.data?.issue) {
|
|
36
|
+
return {
|
|
37
|
+
isError: true,
|
|
38
|
+
result: `Failed to set issue description: ${response.error?.message}`,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const issue = response.data?.issue;
|
|
42
|
+
const result = `Successfully set description for issue #${issue?.id}: ${issue?.title}
|
|
43
|
+
|
|
44
|
+
Updated Issue JSON:
|
|
45
|
+
${JSON.stringify(issue, null, 2)}
|
|
46
|
+
`;
|
|
47
|
+
return {
|
|
48
|
+
isError: false,
|
|
49
|
+
result,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return {
|
|
54
|
+
isError: true,
|
|
55
|
+
result: `Failed to set issue description: ${error instanceof Error ? error.message : String(error)}`,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-issue.d.ts","sourceRoot":"","sources":["../../../src/tools/issues-v2/update-issue.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"update-issue.d.ts","sourceRoot":"","sources":["../../../src/tools/issues-v2/update-issue.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAmClE,eAAO,MAAM,eAAe,EAAE,IAoE7B,CAAC"}
|
|
@@ -5,10 +5,6 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const updateIssueSchema = zod_1.z.object({
|
|
6
6
|
id: zod_1.z.number().describe("The ID of the issue to update"),
|
|
7
7
|
title: zod_1.z.string().optional().describe("Updated title of the issue"),
|
|
8
|
-
description: zod_1.z
|
|
9
|
-
.string()
|
|
10
|
-
.optional()
|
|
11
|
-
.describe("Updated description of the issue"),
|
|
12
8
|
issue_type: zod_1.z
|
|
13
9
|
.enum(["app", "test", "unknown"])
|
|
14
10
|
.optional()
|
|
@@ -31,14 +27,19 @@ async function updateIssue(apiClient, issueData) {
|
|
|
31
27
|
exports.updateIssueTool = {
|
|
32
28
|
schema: {
|
|
33
29
|
name: "updateIssue",
|
|
34
|
-
description: `
|
|
30
|
+
description: `
|
|
31
|
+
This tool allows you to update an existing issue in the project's issue tracking system. You can update the title, issue type, or test issue prompt.
|
|
32
|
+
Use setIssueDescription to update the description.
|
|
33
|
+
|
|
34
|
+
IMPORTANT: Call this tool for every unique diagnosis ID. Even if 2 diagnosis IDs have the same issue, you need to use this tool twice, once per unique diagnosis ID.
|
|
35
|
+
`,
|
|
35
36
|
parameters: updateIssueSchema,
|
|
36
37
|
},
|
|
37
38
|
needsBrowser: false,
|
|
38
39
|
isInlineTool: true,
|
|
39
40
|
execute: async ({ input, apiClient }) => {
|
|
40
41
|
try {
|
|
41
|
-
const { id: issue_id, title,
|
|
42
|
+
const { id: issue_id, title, issue_type, test_issue_prompt, diagnosis_id, } = input;
|
|
42
43
|
if (!apiClient) {
|
|
43
44
|
throw new Error("Dashboard API client is not available.");
|
|
44
45
|
}
|
|
@@ -50,9 +51,6 @@ exports.updateIssueTool = {
|
|
|
50
51
|
if (title !== undefined) {
|
|
51
52
|
updateData.title = title;
|
|
52
53
|
}
|
|
53
|
-
if (description !== undefined) {
|
|
54
|
-
updateData.description = description;
|
|
55
|
-
}
|
|
56
54
|
if (issue_type !== undefined) {
|
|
57
55
|
updateData.issue_type = issue_type;
|
|
58
56
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/safe-bash/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,uCAAuC,CAAC;AA4G9E,eAAO,MAAM,YAAY,EAAE,IAuE1B,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.safeBashTool = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const safe_bash_1 = require("../definitions/safe-bash");
|
|
7
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
8
|
+
const DANGEROUS_PATTERNS = [
|
|
9
|
+
/git\s+checkout/i,
|
|
10
|
+
/git\s+switch/i,
|
|
11
|
+
/git\s+reset\s+--hard/i,
|
|
12
|
+
/git\s+push/i,
|
|
13
|
+
/git\s+commit/i,
|
|
14
|
+
/\.git\/HEAD/i,
|
|
15
|
+
/symbolic-ref\s+HEAD/i,
|
|
16
|
+
];
|
|
17
|
+
async function getCurrentBranch(cwd) {
|
|
18
|
+
try {
|
|
19
|
+
const { stdout } = await execAsync("git rev-parse --abbrev-ref HEAD", {
|
|
20
|
+
cwd,
|
|
21
|
+
});
|
|
22
|
+
return stdout.trim();
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function getGitStatus(cwd) {
|
|
29
|
+
try {
|
|
30
|
+
const { stdout: stagedOutput } = await execAsync("git diff --cached --name-status", { cwd });
|
|
31
|
+
const { stdout: unstagedOutput } = await execAsync("git diff --name-status", { cwd });
|
|
32
|
+
const { stdout: untrackedOutput } = await execAsync("git ls-files --others --exclude-standard", { cwd });
|
|
33
|
+
const staged = stagedOutput.trim() || "No staged changes";
|
|
34
|
+
const unstagedLines = unstagedOutput.trim();
|
|
35
|
+
const untrackedLines = untrackedOutput
|
|
36
|
+
.trim()
|
|
37
|
+
.split("\n")
|
|
38
|
+
.filter(Boolean)
|
|
39
|
+
.map((f) => `??\t${f}`)
|
|
40
|
+
.join("\n");
|
|
41
|
+
const unstaged = [unstagedLines, untrackedLines].filter(Boolean).join("\n") ||
|
|
42
|
+
"No unstaged changes";
|
|
43
|
+
return { staged, unstaged };
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return { staged: "Unable to get status", unstaged: "Unable to get status" };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function containsDangerousPattern(script) {
|
|
50
|
+
for (const pattern of DANGEROUS_PATTERNS) {
|
|
51
|
+
if (pattern.test(script)) {
|
|
52
|
+
return pattern.source;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
function formatResult({ stdout, stderr, gitStatus, }) {
|
|
58
|
+
const parts = [];
|
|
59
|
+
if (stdout.trim()) {
|
|
60
|
+
parts.push(`## stdout\n\`\`\`\n${stdout.trim()}\n\`\`\``);
|
|
61
|
+
}
|
|
62
|
+
if (stderr.trim()) {
|
|
63
|
+
parts.push(`## stderr\n\`\`\`\n${stderr.trim()}\n\`\`\``);
|
|
64
|
+
}
|
|
65
|
+
parts.push(`## Staged (will be committed)\n\`\`\`\n${gitStatus.staged}\n\`\`\``);
|
|
66
|
+
parts.push(`## Unstaged\n\`\`\`\n${gitStatus.unstaged}\n\`\`\``);
|
|
67
|
+
return parts.join("\n\n");
|
|
68
|
+
}
|
|
69
|
+
exports.safeBashTool = {
|
|
70
|
+
...safe_bash_1.safeBashTool,
|
|
71
|
+
execute: async ({ input, repoPath, logger }) => {
|
|
72
|
+
const { script, timeout = 60000 } = input;
|
|
73
|
+
const initialBranch = await getCurrentBranch(repoPath);
|
|
74
|
+
if (!initialBranch) {
|
|
75
|
+
return {
|
|
76
|
+
isError: true,
|
|
77
|
+
result: "Not in a git repository or unable to determine branch",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const dangerousPattern = containsDangerousPattern(script);
|
|
81
|
+
if (dangerousPattern) {
|
|
82
|
+
return {
|
|
83
|
+
isError: true,
|
|
84
|
+
result: `Script rejected: contains forbidden pattern '${dangerousPattern}'`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
let stdout = "";
|
|
88
|
+
let stderr = "";
|
|
89
|
+
try {
|
|
90
|
+
const result = await execAsync(script, {
|
|
91
|
+
cwd: repoPath,
|
|
92
|
+
timeout,
|
|
93
|
+
shell: "/bin/bash",
|
|
94
|
+
});
|
|
95
|
+
stdout = result.stdout;
|
|
96
|
+
stderr = result.stderr;
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
const execError = error;
|
|
100
|
+
logger?.error("Error executing safe bash", {
|
|
101
|
+
tool: "safeBashTool",
|
|
102
|
+
error: execError.message || String(error),
|
|
103
|
+
});
|
|
104
|
+
const gitStatus = await getGitStatus(repoPath);
|
|
105
|
+
return {
|
|
106
|
+
isError: true,
|
|
107
|
+
result: formatResult({
|
|
108
|
+
stdout: execError.stdout || "",
|
|
109
|
+
stderr: execError.stderr || execError.message || "Unknown error",
|
|
110
|
+
gitStatus,
|
|
111
|
+
}),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const finalBranch = await getCurrentBranch(repoPath);
|
|
115
|
+
if (finalBranch !== initialBranch) {
|
|
116
|
+
const gitStatus = await getGitStatus(repoPath);
|
|
117
|
+
return {
|
|
118
|
+
isError: true,
|
|
119
|
+
result: `Branch changed from '${initialBranch}' to '${finalBranch}' - execution rejected\n\n${formatResult({ stdout, stderr, gitStatus })}`,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const gitStatus = await getGitStatus(repoPath);
|
|
123
|
+
return {
|
|
124
|
+
isError: false,
|
|
125
|
+
result: formatResult({ stdout, stderr, gitStatus }),
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-gen-browser.d.ts","sourceRoot":"","sources":["../../src/tools/test-gen-browser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,IAAI,EACL,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"test-gen-browser.d.ts","sourceRoot":"","sources":["../../src/tools/test-gen-browser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,IAAI,EACL,MAAM,uCAAuC,CAAC;AAuB/C,eAAO,MAAM,4BAA4B,EAAE,IAyO1C,CAAC"}
|
|
@@ -9,6 +9,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const run_1 = require("../agent/browsing/run");
|
|
11
11
|
const utils_1 = require("../agent/browsing/utils");
|
|
12
|
+
const pw_codegen_1 = require("../agent/cua/pw-codegen");
|
|
12
13
|
const pw_pause_1 = require("../agent/cua/pw-codegen/pw-pause");
|
|
13
14
|
const utils_2 = require("../artifacts/utils");
|
|
14
15
|
const web_1 = require("../bin/utils/platform/web");
|
|
@@ -67,11 +68,17 @@ exports.generateTestWithBrowserAgent = {
|
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
70
|
try {
|
|
70
|
-
// Prepare playwright for codegen
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
// Prepare playwright for codegen (only needed for patch-based approach)
|
|
72
|
+
const version = await (0, pw_codegen_1.detectPlaywrightVersion)(repoPath);
|
|
73
|
+
if (version) {
|
|
74
|
+
const approach = (0, pw_codegen_1.getCodegenApproach)(version);
|
|
75
|
+
logger.info("Preparing playwright for codegen", {
|
|
76
|
+
tool: "generateTestWithBrowserAgent",
|
|
77
|
+
version: version.full,
|
|
78
|
+
approach,
|
|
79
|
+
});
|
|
80
|
+
await (0, pw_codegen_1.prepareCodegenIfNeeded)(repoPath, approach);
|
|
81
|
+
}
|
|
75
82
|
}
|
|
76
83
|
catch (err) {
|
|
77
84
|
logger.warn("Error preparing playwright for codegen", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-schema.d.ts","sourceRoot":"","sources":["../../../src/tools/utils/validate-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACX,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-schema.d.ts","sourceRoot":"","sources":["../../../src/tools/utils/validate-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACX,MAAM,uCAAuC,CAAC;AAG/C,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,CAAC,GACR,UAAU,GAAG,IAAI,CA2BnB"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateToolInput = validateToolInput;
|
|
4
|
+
const zod_1 = require("zod");
|
|
4
5
|
function validateToolInput(toolCall, schema) {
|
|
5
6
|
const { name: toolName, input } = toolCall;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
// Zod v4: Objects use "strip" mode by default (strips unknown keys silently)
|
|
8
|
+
// Apply .strict() to reject unknown keys for tool validation
|
|
9
|
+
let validationSchema = schema;
|
|
10
|
+
// Check if this is a ZodObject and apply strict mode
|
|
11
|
+
if (validationSchema instanceof zod_1.ZodObject) {
|
|
12
|
+
validationSchema = validationSchema.strict();
|
|
13
|
+
}
|
|
14
|
+
const validation = validationSchema.safeParse(input);
|
|
10
15
|
if (!validation.success) {
|
|
11
16
|
const errorMessage = [
|
|
12
17
|
`Schema validation failed for tool "${toolName}".`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/utils/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/utils/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAcrE,CAAC"}
|