@agent-smith/agent 0.1.7 → 0.2.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.
Files changed (2) hide show
  1. package/dist/agent.js +20 -2
  2. package/package.json +2 -2
package/dist/agent.js CHANGED
@@ -72,7 +72,7 @@ class Agent {
72
72
  const tool = this.tools[tc.name];
73
73
  let canRun = true;
74
74
  if (tool?.canRun) {
75
- canRun = await tool.canRun(tool);
75
+ canRun = await tool.canRun(tc);
76
76
  }
77
77
  if (canRun) {
78
78
  if (options?.onToolCall) {
@@ -97,6 +97,15 @@ class Agent {
97
97
  if (options?.tools) {
98
98
  options.tools = Object.values(this.tools);
99
99
  }
100
+ if (options?.isToolsRouter) {
101
+ const fres = {
102
+ text: JSON.stringify(toolsResults.map(tr => tr.response)),
103
+ stats: res.stats,
104
+ serverStats: res.serverStats,
105
+ toolCalls: res.toolCalls,
106
+ };
107
+ return fres;
108
+ }
100
109
  const nit = it + 1;
101
110
  _res = await this.runAgentNoTemplate(nit, "", params, options);
102
111
  }
@@ -138,7 +147,7 @@ class Agent {
138
147
  }
139
148
  let canRun = true;
140
149
  if (tool?.canRun) {
141
- canRun = await tool.canRun(tool);
150
+ canRun = await tool.canRun(toolCall);
142
151
  }
143
152
  if (!canRun) {
144
153
  if (options?.debug || options?.verbose) {
@@ -182,6 +191,15 @@ class Agent {
182
191
  tools: toolResults,
183
192
  });
184
193
  }
194
+ if (options?.isToolsRouter) {
195
+ const fres = {
196
+ text: JSON.stringify(toolResults.map(tr => tr.response)),
197
+ stats: res.stats,
198
+ serverStats: res.serverStats,
199
+ toolCalls: res.toolCalls,
200
+ };
201
+ return fres;
202
+ }
185
203
  return await this.runAgentWithTemplate(it + 1, prompt, params, options, tpl);
186
204
  }
187
205
  else {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/synw/agent-smith.git"
7
7
  },
8
- "version": "0.1.7",
8
+ "version": "0.2.0",
9
9
  "scripts": {
10
10
  "buildrl": "rm -rf dist/* && rollup -c",
11
11
  "build": "rm -rf dist/* && tsc"
@@ -16,7 +16,7 @@
16
16
  "restmix": "^0.6.1"
17
17
  },
18
18
  "devDependencies": {
19
- "@locallm/types": "file:/home/ggg/dev/js/locallm/packages/types",
19
+ "@locallm/types": "^0.6.7",
20
20
  "@rollup/plugin-node-resolve": "^16.0.3",
21
21
  "@rollup/plugin-typescript": "^12.3.0",
22
22
  "@types/node": "^25.0.3",