@empiricalrun/test-gen 0.52.3 → 0.52.4

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.52.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 85665ef: feat: simplify text editor tool schemas for gemini
8
+ - Updated dependencies [4f8137b]
9
+ - Updated dependencies [85665ef]
10
+ - @empiricalrun/llm@0.13.2
11
+
3
12
  ## 0.52.3
4
13
 
5
14
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAgEA,wBAAsB,SAAS,CAAC,EAC9B,aAA4C,EAC5C,mBAA2B,EAC3B,oBAAoB,GACrB,EAAE;IACD,aAAa,CAAC,EACV,4BAA4B,GAC5B,4BAA4B,GAC5B,8BAA8B,CAAC;IACnC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,mBAsFA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAiFA,wBAAsB,SAAS,CAAC,EAC9B,aAA4C,EAC5C,mBAA2B,EAC3B,oBAAoB,GACrB,EAAE;IACD,aAAa,CAAC,EACV,4BAA4B,GAC5B,4BAA4B,GAC5B,8BAA8B,CAAC;IACnC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,mBAuFA"}
@@ -11,18 +11,27 @@ const test_gen_browser_1 = require("../../tools/test-gen-browser");
11
11
  const test_run_1 = require("../../tools/test-run");
12
12
  const test_run_fetcher_1 = require("../../tools/test-run-fetcher");
13
13
  const prompt_1 = require("./prompt");
14
- // TODO: Add strReplaceEditor for non-Claude models
15
- const tools = [
16
- test_run_1.runTestTool,
17
- test_gen_browser_1.generateTestWithBrowserAgent,
18
- diagnosis_fetcher_1.diagnosisTool,
19
- grep_1.grepTool,
20
- test_run_fetcher_1.testRunTool,
21
- ];
22
- const toolExecutors = {
23
- ...Object.fromEntries(tools.map((tool) => [tool.schema.name, tool.execute])),
24
- str_replace_editor: (input) => (0, chat_1.strReplaceEditorExecutor)(input, web_1.validateTypescript),
25
- };
14
+ function getTools(selectedModel) {
15
+ let tools = [
16
+ grep_1.grepTool,
17
+ test_run_1.runTestTool,
18
+ test_run_fetcher_1.fetchTestRunReportTool,
19
+ diagnosis_fetcher_1.fetchDiagnosisReportTool,
20
+ test_gen_browser_1.generateTestWithBrowserAgent,
21
+ ];
22
+ if (selectedModel.startsWith("gemini")) {
23
+ // Claude will have its own built-in text editor tools
24
+ tools.push(...chat_1.textEditorTools);
25
+ }
26
+ const toolExecutors = {
27
+ // TODO: Add validateTypescript
28
+ ...Object.fromEntries(tools.map((tool) => [tool.schema.name, tool.execute])),
29
+ };
30
+ if (selectedModel.startsWith("claude")) {
31
+ toolExecutors.str_replace_editor = (input) => (0, chat_1.strReplaceEditorExecutor)(input, web_1.validateTypescript);
32
+ }
33
+ return { tools, toolExecutors };
34
+ }
26
35
  function createChatModel(useDiskForChatState, selectedModel) {
27
36
  if (selectedModel.startsWith("claude")) {
28
37
  return new chat_1.ClaudeChatModel(useDiskForChatState);
@@ -68,6 +77,7 @@ async function chatAgent({ selectedModel = "claude-3-7-sonnet-20250219", useDisk
68
77
  }
69
78
  }
70
79
  const systemPrompt = await (0, prompt_1.buildSystemPrompt)();
80
+ const { tools, toolExecutors } = getTools(selectedModel);
71
81
  while (!userPrompt?.toLowerCase().includes("stop")) {
72
82
  if (chatModel.askUserForInput) {
73
83
  try {
@@ -1,3 +1,3 @@
1
1
  import type { Tool } from "@empiricalrun/llm/chat";
2
- export declare const diagnosisTool: Tool;
2
+ export declare const fetchDiagnosisReportTool: Tool;
3
3
  //# sourceMappingURL=diagnosis-fetcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diagnosis-fetcher.d.ts","sourceRoot":"","sources":["../../src/tools/diagnosis-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAanD,eAAO,MAAM,aAAa,EAAE,IAgF3B,CAAC"}
1
+ {"version":3,"file":"diagnosis-fetcher.d.ts","sourceRoot":"","sources":["../../src/tools/diagnosis-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAanD,eAAO,MAAM,wBAAwB,EAAE,IAgFtC,CAAC"}
@@ -3,7 +3,7 @@ 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.diagnosisTool = void 0;
6
+ exports.fetchDiagnosisReportTool = void 0;
7
7
  const promises_1 = __importDefault(require("fs/promises"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const zod_1 = require("zod");
@@ -12,7 +12,7 @@ const DiagnosisSchema = zod_1.z.object({
12
12
  .string()
13
13
  .describe("The full URL of the diagnosis (e.g. https://dash.empirical.run/shopflo-tests/diagnosis/split-cod-place-the-order--byynrPjCml57)"),
14
14
  });
15
- exports.diagnosisTool = {
15
+ exports.fetchDiagnosisReportTool = {
16
16
  schema: {
17
17
  name: "fetchDiagnosisDetails",
18
18
  description: "Fetch details about a test case diagnosis using its URL or slug",
@@ -1,4 +1,4 @@
1
1
  import type { Tool } from "@empiricalrun/llm/chat";
2
2
  export declare function extractPathAfterSourceRepo(fullPath: string): string;
3
- export declare const testRunTool: Tool;
3
+ export declare const fetchTestRunReportTool: Tool;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/test-run-fetcher/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAanD,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOnE;AAED,eAAO,MAAM,WAAW,EAAE,IA4HzB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/test-run-fetcher/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAanD,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOnE;AAED,eAAO,MAAM,sBAAsB,EAAE,IA4HpC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.testRunTool = exports.extractPathAfterSourceRepo = void 0;
3
+ exports.fetchTestRunReportTool = exports.extractPathAfterSourceRepo = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const TestRunSchema = zod_1.z.object({
6
6
  testRunUrl: zod_1.z
@@ -17,7 +17,7 @@ function extractPathAfterSourceRepo(fullPath) {
17
17
  }
18
18
  }
19
19
  exports.extractPathAfterSourceRepo = extractPathAfterSourceRepo;
20
- exports.testRunTool = {
20
+ exports.fetchTestRunReportTool = {
21
21
  schema: {
22
22
  name: "fetchTestRunDetails",
23
23
  description: "Fetch details about a test run using its URL",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.52.3",
3
+ "version": "0.52.4",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -75,7 +75,7 @@
75
75
  "tsx": "^4.16.2",
76
76
  "typescript": "^5.3.3",
77
77
  "zod": "^3.23.8",
78
- "@empiricalrun/llm": "^0.13.1",
78
+ "@empiricalrun/llm": "^0.13.2",
79
79
  "@empiricalrun/r2-uploader": "^0.3.8",
80
80
  "@empiricalrun/test-run": "^0.7.6"
81
81
  },