@sisu-ai/mw-tool-calling 4.0.3 → 6.0.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/dist/index.js +20 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -36,7 +36,16 @@ export const toolCalling = async (ctx, next) => {
|
|
|
36
36
|
if (result === undefined) {
|
|
37
37
|
const args = tool.schema?.parse ? tool.schema.parse(call.arguments) : call.arguments;
|
|
38
38
|
ctx.log.debug?.('[tool-calling] invoking tool', { name: call.name, id: call.id, args });
|
|
39
|
-
|
|
39
|
+
// Create restricted context for tool execution
|
|
40
|
+
const toolCtx = {
|
|
41
|
+
memory: ctx.memory,
|
|
42
|
+
signal: ctx.signal,
|
|
43
|
+
log: ctx.log,
|
|
44
|
+
model: ctx.model,
|
|
45
|
+
// Pass deps from state for dependency injection (testing/configuration)
|
|
46
|
+
deps: ctx.state?.toolDeps,
|
|
47
|
+
};
|
|
48
|
+
result = await tool.handler(args, toolCtx);
|
|
40
49
|
cache.set(key, result);
|
|
41
50
|
lastArgsByName.set(call.name, args);
|
|
42
51
|
}
|
|
@@ -93,7 +102,16 @@ export const iterativeToolCalling = async (ctx, next) => {
|
|
|
93
102
|
if (result === undefined) {
|
|
94
103
|
const args = tool.schema?.parse ? tool.schema.parse(call.arguments) : call.arguments;
|
|
95
104
|
ctx.log.debug?.('[iterative-tool-calling] invoking tool', { name: call.name, id: call.id, args });
|
|
96
|
-
|
|
105
|
+
// Create restricted context for tool execution
|
|
106
|
+
const toolCtx = {
|
|
107
|
+
memory: ctx.memory,
|
|
108
|
+
signal: ctx.signal,
|
|
109
|
+
log: ctx.log,
|
|
110
|
+
model: ctx.model,
|
|
111
|
+
// Pass deps from state for dependency injection (testing/configuration)
|
|
112
|
+
deps: ctx.state?.toolDeps,
|
|
113
|
+
};
|
|
114
|
+
result = await tool.handler(args, toolCtx);
|
|
97
115
|
cache.set(key, result);
|
|
98
116
|
lastArgsByName.set(call.name, args);
|
|
99
117
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sisu-ai/mw-tool-calling",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"build": "tsc -b"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@sisu-ai/core": "
|
|
18
|
+
"@sisu-ai/core": "2.0.0"
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|