@empiricalrun/test-gen 0.52.2 → 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,25 @@
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
+
12
+ ## 0.52.3
13
+
14
+ ### Patch Changes
15
+
16
+ - 6a19298: feat: changed gemini-2.5pro from exp to preview
17
+ - cbe5823: fix: removed headed default from runTest tool schema and added function in role of toolRes Gemini
18
+ - Updated dependencies [f4f4c5d]
19
+ - Updated dependencies [6a19298]
20
+ - Updated dependencies [cbe5823]
21
+ - @empiricalrun/llm@0.13.1
22
+
3
23
  ## 0.52.2
4
24
 
5
25
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  export declare function chatAgent({ selectedModel, useDiskForChatState, initialPromptContent, }: {
2
- selectedModel?: "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-20241022" | "gemini-2.5-pro-exp-03-25";
2
+ selectedModel?: "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-20241022" | "gemini-2.5-pro-preview-03-25";
3
3
  useDiskForChatState?: boolean;
4
4
  initialPromptContent?: string;
5
5
  }): Promise<string>;
@@ -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,0BAA0B,CAAC;IAC/B,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 {
package/dist/bin/index.js CHANGED
@@ -41,7 +41,7 @@ async function runChatAgent(modelInput, useDiskForChatState, initialPromptPath)
41
41
  "3-7": "claude-3-7-sonnet-20250219",
42
42
  "claude-3-5": "claude-3-5-sonnet-20241022",
43
43
  "3-5": "claude-3-5-sonnet-20241022",
44
- "gemini-2.5-pro-exp-03-25": "gemini-2.5-pro-exp-03-25",
44
+ "gemini-2.5-pro-preview-03-25": "gemini-2.5-pro-preview-03-25",
45
45
  };
46
46
  if (modelInput && !MODEL_MAPPING[modelInput]) {
47
47
  throw new Error(`Invalid chat model: ${modelInput}`);
@@ -199,7 +199,7 @@ async function runAgentsWorkflow(testGenConfig, testGenToken) {
199
199
  .option("--suites <suites>", "Comma separated list of describe blocks")
200
200
  .option("--use-chat", "Use chat agent (and not the workflow)")
201
201
  .option("--use-disk-for-chat-state", "Save and load chat state from disk")
202
- .option("--chat-model <model>", "Chat model to use (claude-3-7-sonnet-20250219 or claude-3-5-sonnet-20241022 or gemini-2.5-pro-exp-03-25)")
202
+ .option("--chat-model <model>", "Chat model to use (claude-3-7-sonnet-20250219 or claude-3-5-sonnet-20241022 or gemini-2.5-pro-preview-03-25)")
203
203
  .option("--initial-prompt <path>", "Path to an initial prompt file (e.g. prompt.md)")
204
204
  .parse(process.argv);
205
205
  const options = program.opts();
@@ -7,7 +7,7 @@ export interface CliOptions {
7
7
  useChat?: boolean;
8
8
  useDiskForChatState?: boolean;
9
9
  initialPrompt?: string;
10
- chatModel?: "claude-3-7" | "3-7" | "claude-3-5" | "3-5" | "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-20241022" | "gemini-2.5-pro-exp-03-25";
10
+ chatModel?: "claude-3-7" | "3-7" | "claude-3-5" | "3-5" | "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-20241022" | "gemini-2.5-pro-preview-03-25";
11
11
  }
12
12
  export declare function validateAndCompleteCliOptions(options: CliOptions): Promise<CliOptions>;
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EACN,YAAY,GACZ,KAAK,GACL,YAAY,GACZ,KAAK,GACL,4BAA4B,GAC5B,4BAA4B,GAC5B,0BAA0B,CAAC;CAChC;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAyDrB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EACN,YAAY,GACZ,KAAK,GACL,YAAY,GACZ,KAAK,GACL,4BAA4B,GAC5B,4BAA4B,GAC5B,8BAA8B,CAAC;CACpC;AAQD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,UAAU,CAAC,CAyDrB"}
@@ -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",
@@ -1 +1 @@
1
- {"version":3,"file":"test-run.d.ts","sourceRoot":"","sources":["../../src/tools/test-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAwBnD,eAAO,MAAM,WAAW,EAAE,IA8BzB,CAAC"}
1
+ {"version":3,"file":"test-run.d.ts","sourceRoot":"","sources":["../../src/tools/test-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAuBnD,eAAO,MAAM,WAAW,EAAE,IA8BzB,CAAC"}
@@ -15,8 +15,7 @@ const RunTestSchema = zod_1.z.object({
15
15
  headed: zod_1.z
16
16
  .boolean()
17
17
  .describe("Whether to run the test in headed mode (default is false, which is headless)")
18
- .optional()
19
- .default(false),
18
+ .optional(),
20
19
  });
21
20
  exports.runTestTool = {
22
21
  schema: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.52.2",
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.0",
78
+ "@empiricalrun/llm": "^0.13.2",
79
79
  "@empiricalrun/r2-uploader": "^0.3.8",
80
80
  "@empiricalrun/test-run": "^0.7.6"
81
81
  },