@empiricalrun/test-gen 0.56.1 → 0.56.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 +24 -0
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +3 -2
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +1 -2
- package/dist/agent/chat/exports.d.ts +3 -1
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +32 -1
- package/dist/agent/chat/state.d.ts +1 -1
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/tool-call-service/index.d.ts +2 -1
- package/dist/tool-call-service/index.d.ts.map +1 -1
- package/dist/tool-call-service/index.js +23 -7
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +17 -6
- package/dist/tools/str_replace_editor.d.ts.map +1 -1
- package/dist/tools/str_replace_editor.js +9 -4
- package/package.json +3 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.56.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bf87a3a: fix: grep tool should not return error if no results are found
|
|
8
|
+
- 607ec6d: fix: normalize old_str for newlines before running text editor tools
|
|
9
|
+
- a7f2e24: fix: downgrade tsx logs to warn instead of errors
|
|
10
|
+
- 1728128: feat: nesting of toolCall span under llm generation
|
|
11
|
+
- Updated dependencies [a7f2e24]
|
|
12
|
+
- @empiricalrun/test-run@0.8.4
|
|
13
|
+
|
|
14
|
+
## 0.56.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- d5828e1: feat: including toolCalling in langfuse trace
|
|
19
|
+
- eb84f66: fix: Update environment variable handling
|
|
20
|
+
- 40f6470: feat: added tool execution service
|
|
21
|
+
- f49b645: feat: Add tool response API endpoint
|
|
22
|
+
- Updated dependencies [f8cc82d]
|
|
23
|
+
- Updated dependencies [f49b645]
|
|
24
|
+
- @empiricalrun/llm@0.15.2
|
|
25
|
+
- @empiricalrun/test-run@0.8.3
|
|
26
|
+
|
|
3
27
|
## 0.56.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAIxE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAwBvD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAKhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAIvD;AAiFD,wBAAsB,yBAAyB,CAAC,EAC9C,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,iBA2BA;AAED,wBAAsB,cAAc,CAAC,EACnC,YAAY,EACZ,cAAc,EACd,QAAQ,GACT,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB,iBAoBA;AAED,wBAAsB,yBAAyB,CAAC,EAC9C,QAAQ,EACR,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyDlB;AAyBD,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,iBA2HxD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAIxE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAwBvD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAKhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAIvD;AAiFD,wBAAsB,yBAAyB,CAAC,EAC9C,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,iBA2BA;AAED,wBAAsB,cAAc,CAAC,EACnC,YAAY,EACZ,cAAc,EACd,QAAQ,GACT,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB,iBAoBA;AAED,wBAAsB,yBAAyB,CAAC,EAC9C,QAAQ,EACR,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyDlB;AAyBD,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,iBA2HxD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,CAAC,CA2B/B;AAWD,wBAAsB,oBAAoB,CACxC,gBAAgB,EAAE,oBAAoB,GACrC,OAAO,CAAC,MAAM,EAAE,CAAC,CAQnB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,oBAAoB,EACtC,gBAAgB,GAAE,MAAM,EAAU,GACjC,OAAO,CAAC,MAAM,CAAC,CA+CjB;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,MAAM;IACrC,OAAO,CAAC,aAAa,CAAqB;YAE5B,mBAAmB;YAUnB,gBAAgB;IAsBjB,OAAO;IAoBb,SAAS;CAKjB"}
|
|
@@ -307,11 +307,12 @@ async function readPlaywrightConfig(repoDir) {
|
|
|
307
307
|
tsxImport = module;
|
|
308
308
|
})
|
|
309
309
|
.catch((err) => {
|
|
310
|
-
console.
|
|
310
|
+
console.warn("Failed to import tsx: --->", err.message);
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
313
|
if (!tsxImport) {
|
|
314
|
-
|
|
314
|
+
console.warn("tsx module not available");
|
|
315
|
+
return {};
|
|
315
316
|
}
|
|
316
317
|
const [lastDir] = repoDir.split("/").reverse();
|
|
317
318
|
const playwrightConfig = (await tsxImport.require("./playwright.config.ts", `${repoDir}/${lastDir}`)).default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/agent-loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/agent-loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAmB,MAAM,wBAAwB,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAgBhE,wBAAsB,aAAa,CAAC,EAClC,SAAS,EACT,aAAa,EACb,QAAQ,EACR,KAAK,EACL,eAAe,GAChB,EAAE;IACD,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAC3B,aAAa,EAAE,mBAAmB,CAAC;IACnC,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,iBAoCA"}
|
|
@@ -24,9 +24,8 @@ async function chatAgentLoop({ chatModel, selectedModel, reporter, trace, toolCa
|
|
|
24
24
|
const { tools } = await toolCallService.getTools();
|
|
25
25
|
while (!chatModel.askUserForInput) {
|
|
26
26
|
const toolCalls = chatModel.getPendingToolCalls();
|
|
27
|
-
console.log("toolCalls", toolCalls);
|
|
28
27
|
if (toolCalls.length) {
|
|
29
|
-
const toolResults = await toolCallService.execute(toolCalls, isRemote);
|
|
28
|
+
const toolResults = await toolCallService.execute(toolCalls, isRemote, trace);
|
|
30
29
|
if (isRemote) {
|
|
31
30
|
log(`Tool call remote execution in progress`);
|
|
32
31
|
break;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { IChatModel } from "@empiricalrun/llm/chat";
|
|
2
2
|
import { chatAgentLoop } from "./agent-loop";
|
|
3
3
|
import { createChatModel } from "./model";
|
|
4
|
+
import * as State from "./state";
|
|
4
5
|
import { ChatStateOnDisk } from "./state";
|
|
5
6
|
import { ReporterFunction, SupportedChatModels } from "./types";
|
|
6
|
-
|
|
7
|
+
declare const createChatState: typeof State.createChatState, createChatStateForMessages: typeof State.createChatStateForMessages, chatStateFromModel: typeof State.chatStateFromModel, loadChatState: typeof State.loadChatState, saveToDisk: typeof State.saveToDisk, CURRENT_CHAT_STATE_VERSION: string;
|
|
8
|
+
export { chatAgentLoop, chatStateFromModel, createChatModel, createChatState, createChatStateForMessages, CURRENT_CHAT_STATE_VERSION, loadChatState, saveToDisk, };
|
|
7
9
|
export type { ChatStateOnDisk, IChatModel, ReporterFunction, SupportedChatModels, };
|
|
8
10
|
//# sourceMappingURL=exports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEhE,OAAO,
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEhE,QAAA,MACE,eAAe,gCACf,0BAA0B,2CAC1B,kBAAkB,mCAClB,aAAa,8BACb,UAAU,2BACV,0BAA0B,QACnB,CAAC;AAEV,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,0BAA0B,EAC1B,0BAA0B,EAC1B,aAAa,EACb,UAAU,GACX,CAAC;AAEF,YAAY,EACV,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,mBAAmB,GACpB,CAAC"}
|
|
@@ -1,7 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createChatModel = exports.chatAgentLoop = void 0;
|
|
26
|
+
exports.saveToDisk = exports.loadChatState = exports.CURRENT_CHAT_STATE_VERSION = exports.createChatStateForMessages = exports.createChatState = exports.createChatModel = exports.chatStateFromModel = exports.chatAgentLoop = void 0;
|
|
4
27
|
const agent_loop_1 = require("./agent-loop");
|
|
5
28
|
Object.defineProperty(exports, "chatAgentLoop", { enumerable: true, get: function () { return agent_loop_1.chatAgentLoop; } });
|
|
6
29
|
const model_1 = require("./model");
|
|
7
30
|
Object.defineProperty(exports, "createChatModel", { enumerable: true, get: function () { return model_1.createChatModel; } });
|
|
31
|
+
const State = __importStar(require("./state"));
|
|
32
|
+
const { createChatState, createChatStateForMessages, chatStateFromModel, loadChatState, saveToDisk, CURRENT_CHAT_STATE_VERSION, } = State;
|
|
33
|
+
exports.createChatState = createChatState;
|
|
34
|
+
exports.createChatStateForMessages = createChatStateForMessages;
|
|
35
|
+
exports.chatStateFromModel = chatStateFromModel;
|
|
36
|
+
exports.loadChatState = loadChatState;
|
|
37
|
+
exports.saveToDisk = saveToDisk;
|
|
38
|
+
exports.CURRENT_CHAT_STATE_VERSION = CURRENT_CHAT_STATE_VERSION;
|
|
@@ -3,7 +3,7 @@ import { SupportedChatModels } from "./types";
|
|
|
3
3
|
export declare const CURRENT_CHAT_STATE_VERSION = "20250327.1";
|
|
4
4
|
export declare const CHAT_STATE_PATH: string;
|
|
5
5
|
export type ChatStateOnDisk<T> = {
|
|
6
|
-
version:
|
|
6
|
+
version: string;
|
|
7
7
|
model: SupportedChatModels;
|
|
8
8
|
messages: T[];
|
|
9
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,0BAA0B,eAAe,CAAC;AAEvD,eAAO,MAAM,eAAe,QAI3B,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAC/B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,0BAA0B,eAAe,CAAC;AAEvD,eAAO,MAAM,eAAe,QAI3B,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,QAAQ,EAAE,CAAC,EAAE,CAAC;CACf,CAAC;AAEF,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,eAAe,CAAC,GAAG,CAAC,EACnC,aAAa,EAAE,mBAAmB,4BAMnC;AAED,wBAAgB,0BAA0B,CAAC,CAAC,EAC1C,QAAQ,EAAE,GAAG,EACb,aAAa,EAAE,mBAAmB,GACjC,eAAe,CAAC,CAAC,CAAC,CAOpB;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,EACxB,aAAa,EAAE,mBAAmB,4BAGnC;AAED,wBAAgB,aAAa,CAAC,CAAC,KAAK,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAajE;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAClB,aAAa,EAAE,mBAAmB,QAsBnC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TraceClient } from "@empiricalrun/llm";
|
|
1
2
|
import { PendingToolCall, Tool, ToolResult } from "@empiricalrun/llm/chat";
|
|
2
3
|
import { SupportedChatModels } from "../agent/chat/types";
|
|
3
4
|
export type { SupportedChatModels };
|
|
@@ -13,6 +14,6 @@ export declare class ToolCallService {
|
|
|
13
14
|
getTools(): Promise<{
|
|
14
15
|
tools: Tool[];
|
|
15
16
|
}>;
|
|
16
|
-
execute(toolCalls: PendingToolCall[], isRemote: boolean): Promise<ToolResult[]>;
|
|
17
|
+
execute(toolCalls: PendingToolCall[], isRemote: boolean, trace?: TraceClient): Promise<ToolResult[]>;
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tool-call-service/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAa1D,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC,KAAK,aAAa,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACpD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tool-call-service/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAa1D,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC,KAAK,aAAa,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACpD,CAAC;AA4BF,qBAAa,eAAe;IAC1B,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,aAAa,EAAE,aAAa,CAAM;IAClC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,mBAAmB,CAAC;gBAGjC,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,aAAa,EAAE,mBAAmB;IAgB9B,QAAQ;;;IAaR,OAAO,CACX,SAAS,EAAE,eAAe,EAAE,EAC5B,QAAQ,EAAE,OAAO,EACjB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,UAAU,EAAE,CAAC;CAuDzB"}
|
|
@@ -19,7 +19,10 @@ async function sendToolRequestToRemoteQueue(payload) {
|
|
|
19
19
|
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
|
-
const queueUrl = process.env.
|
|
22
|
+
const queueUrl = process.env.TOOL_EXECUTION_SQS_URL;
|
|
23
|
+
if (!queueUrl) {
|
|
24
|
+
throw new Error("TOOL_EXECUTION_SQS_URL is required for remote execution.");
|
|
25
|
+
}
|
|
23
26
|
await sqs.send(new client_sqs_1.SendMessageCommand({
|
|
24
27
|
QueueUrl: queueUrl,
|
|
25
28
|
MessageBody: JSON.stringify(payload),
|
|
@@ -58,9 +61,8 @@ class ToolCallService {
|
|
|
58
61
|
}
|
|
59
62
|
return { tools: this.tools };
|
|
60
63
|
}
|
|
61
|
-
async execute(toolCalls, isRemote) {
|
|
64
|
+
async execute(toolCalls, isRemote, trace) {
|
|
62
65
|
if (isRemote && this.chatSessionId) {
|
|
63
|
-
console.log("Executing tool remotely", toolCalls);
|
|
64
66
|
await sendToolRequestToRemoteQueue({
|
|
65
67
|
toolCalls,
|
|
66
68
|
requestId: crypto.randomUUID(),
|
|
@@ -73,27 +75,41 @@ class ToolCallService {
|
|
|
73
75
|
}));
|
|
74
76
|
}
|
|
75
77
|
else {
|
|
78
|
+
const executeSpan = trace?.span({
|
|
79
|
+
name: "execute_tools",
|
|
80
|
+
input: { toolCalls: toolCalls.map((tc) => ({ name: tc.name })) },
|
|
81
|
+
});
|
|
76
82
|
const toolResults = [];
|
|
77
83
|
for (const toolCall of toolCalls) {
|
|
84
|
+
const span = executeSpan?.span({
|
|
85
|
+
name: `tool: ${toolCall.name}`,
|
|
86
|
+
input: toolCall.input,
|
|
87
|
+
});
|
|
78
88
|
const toolExecutor = this.toolExecutors[toolCall.name];
|
|
79
89
|
if (!toolExecutor) {
|
|
80
|
-
|
|
90
|
+
const errorResult = {
|
|
81
91
|
isError: true,
|
|
82
92
|
result: `Invalid function/tool call: invalid_tool_call not found`,
|
|
83
|
-
}
|
|
93
|
+
};
|
|
94
|
+
toolResults.push(errorResult);
|
|
95
|
+
span?.end({ output: errorResult });
|
|
84
96
|
continue;
|
|
85
97
|
}
|
|
86
98
|
try {
|
|
87
99
|
const result = await toolExecutor(toolCall.input);
|
|
88
100
|
toolResults.push(result);
|
|
101
|
+
span?.end({ output: result });
|
|
89
102
|
}
|
|
90
103
|
catch (error) {
|
|
91
|
-
|
|
104
|
+
const errorResult = {
|
|
92
105
|
isError: true,
|
|
93
106
|
result: error instanceof Error ? error.message : String(error),
|
|
94
|
-
}
|
|
107
|
+
};
|
|
108
|
+
toolResults.push(errorResult);
|
|
109
|
+
span?.end({ output: errorResult });
|
|
95
110
|
}
|
|
96
111
|
}
|
|
112
|
+
executeSpan?.end({ output: { toolResults } });
|
|
97
113
|
return toolResults;
|
|
98
114
|
}
|
|
99
115
|
}
|
package/dist/tools/grep.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../src/tools/grep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,wBAAwB,CAAC;AAmB/D,eAAO,MAAM,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../src/tools/grep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,wBAAwB,CAAC;AAmB/D,eAAO,MAAM,QAAQ,EAAE,IA0DtB,CAAC"}
|
package/dist/tools/grep.js
CHANGED
|
@@ -36,8 +36,9 @@ exports.grepTool = {
|
|
|
36
36
|
const excludeFind = repo_tree_1.DEFAULT_EXCLUDE.map((pattern) => typeof pattern === "string" ? pattern : pattern.source)
|
|
37
37
|
.map((pattern) => `-not -path "*/${pattern}/*"`)
|
|
38
38
|
.join(" ");
|
|
39
|
-
//
|
|
40
|
-
|
|
39
|
+
// Modified command to ensure filepath is included in the output
|
|
40
|
+
// Using grep with -H to always show filename and the filepath as part of the output
|
|
41
|
+
cmd = `find ${dir} ${excludeFind} -name "${input.filePattern}" | xargs grep -Hn "${input.pattern}"`;
|
|
41
42
|
}
|
|
42
43
|
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
43
44
|
const { stdout, stderr } = await execAsync(cmd);
|
|
@@ -47,12 +48,22 @@ exports.grepTool = {
|
|
|
47
48
|
result: stdout,
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
else if (!stdout && stderr) {
|
|
52
|
+
return {
|
|
53
|
+
isError: true,
|
|
54
|
+
result: stderr,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// Both are empty, which means no results were found
|
|
59
|
+
return {
|
|
60
|
+
isError: false,
|
|
61
|
+
result: "No results found.",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
54
64
|
}
|
|
55
65
|
catch (error) {
|
|
66
|
+
console.error("Error executing grep", error);
|
|
56
67
|
return {
|
|
57
68
|
isError: true,
|
|
58
69
|
result: error instanceof Error ? error.message : String(error),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"str_replace_editor.d.ts","sourceRoot":"","sources":["../../src/tools/str_replace_editor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"str_replace_editor.d.ts","sourceRoot":"","sources":["../../src/tools/str_replace_editor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA2B1D,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAwC1D;AAMD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,UAAU,CAAC,CA6JrB;AA+FD,eAAO,MAAM,eAAe,EAAE,IAAI,EAKjC,CAAC"}
|
|
@@ -141,15 +141,20 @@ async function strReplaceEditorExecutor(input) {
|
|
|
141
141
|
}
|
|
142
142
|
createBackup(filePath);
|
|
143
143
|
content = fs_1.default.readFileSync(filePath, "utf8");
|
|
144
|
-
|
|
144
|
+
// Normalize newlines in both the content and search string
|
|
145
|
+
const normalizedContent = content.replace(/\r\n/g, "\n");
|
|
146
|
+
const normalizedOldStr = input.old_str
|
|
147
|
+
.replace(/\\n/g, "\n")
|
|
148
|
+
.replace(/\r\n/g, "\n");
|
|
149
|
+
if (!normalizedContent.includes(normalizedOldStr)) {
|
|
145
150
|
return {
|
|
146
151
|
result: `old_str not found in file: ${filePath}`,
|
|
147
152
|
isError: true,
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
155
|
else {
|
|
151
|
-
const escapedOldStr = escapeRegExp(
|
|
152
|
-
const occurences =
|
|
156
|
+
const escapedOldStr = escapeRegExp(normalizedOldStr);
|
|
157
|
+
const occurences = normalizedContent.match(new RegExp(escapedOldStr, "g"));
|
|
153
158
|
if (occurences && occurences.length > 1) {
|
|
154
159
|
// TODO: Help find unique matches
|
|
155
160
|
return {
|
|
@@ -157,7 +162,7 @@ async function strReplaceEditorExecutor(input) {
|
|
|
157
162
|
isError: true,
|
|
158
163
|
};
|
|
159
164
|
}
|
|
160
|
-
newContent =
|
|
165
|
+
newContent = normalizedContent.replace(normalizedOldStr, input.new_str);
|
|
161
166
|
fs_1.default.writeFileSync(filePath, newContent);
|
|
162
167
|
typeCheckErrors = (0, web_1.validateTypescript)(filePath);
|
|
163
168
|
if (typeCheckErrors.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.56.
|
|
3
|
+
"version": "0.56.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -14,10 +14,6 @@
|
|
|
14
14
|
"types": "./dist/agent/master/run.d.ts",
|
|
15
15
|
"default": "./dist/agent/master/run.js"
|
|
16
16
|
},
|
|
17
|
-
"./chat/state": {
|
|
18
|
-
"types": "./dist/agent/chat/state.d.ts",
|
|
19
|
-
"default": "./dist/agent/chat/state.js"
|
|
20
|
-
},
|
|
21
17
|
"./chat": {
|
|
22
18
|
"types": "./dist/agent/chat/exports.d.ts",
|
|
23
19
|
"default": "./dist/agent/chat/exports.js"
|
|
@@ -64,9 +60,9 @@
|
|
|
64
60
|
"tsx": "^4.16.2",
|
|
65
61
|
"typescript": "^5.3.3",
|
|
66
62
|
"zod": "^3.23.8",
|
|
67
|
-
"@empiricalrun/llm": "^0.15.
|
|
63
|
+
"@empiricalrun/llm": "^0.15.2",
|
|
68
64
|
"@empiricalrun/r2-uploader": "^0.3.8",
|
|
69
|
-
"@empiricalrun/test-run": "^0.8.
|
|
65
|
+
"@empiricalrun/test-run": "^0.8.4"
|
|
70
66
|
},
|
|
71
67
|
"devDependencies": {
|
|
72
68
|
"@playwright/test": "1.47.1",
|