@agent-smith/cli 0.0.107 → 0.0.108
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/cmd/lib/mcp.js +18 -4
- package/dist/cmd/lib/tasks/cmd.js +17 -5
- package/package.json +4 -6
package/dist/cmd/lib/mcp.js
CHANGED
|
@@ -50,17 +50,31 @@ class McpClient {
|
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
const
|
|
53
|
+
const defargs = {};
|
|
54
|
+
const argsTypes = {};
|
|
54
55
|
if (tool.inputSchema.properties) {
|
|
55
56
|
for (const [k, v] of Object.entries(tool.inputSchema.properties)) {
|
|
56
57
|
const vv = v;
|
|
57
|
-
|
|
58
|
+
defargs[k] = { description: vv.description + " (" + vv.type + ")" };
|
|
59
|
+
argsTypes[k] = vv.type;
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
const exec = async (args) => {
|
|
63
|
+
const _iargs = args;
|
|
64
|
+
for (const [k, v] of Object.entries(_iargs)) {
|
|
65
|
+
if (argsTypes[k] == "array") {
|
|
66
|
+
try {
|
|
67
|
+
_iargs[k] = JSON.parse(v);
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
console.warn("Error parsing array data from model for tool call", k, "Data:", v);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
;
|
|
61
75
|
const payload = {
|
|
62
76
|
name: tool.name,
|
|
63
|
-
arguments:
|
|
77
|
+
arguments: _iargs,
|
|
64
78
|
};
|
|
65
79
|
const res = await this.client.callTool(payload);
|
|
66
80
|
return res;
|
|
@@ -68,7 +82,7 @@ class McpClient {
|
|
|
68
82
|
const t = {
|
|
69
83
|
name: tool.name,
|
|
70
84
|
description: tool.description ?? "",
|
|
71
|
-
arguments:
|
|
85
|
+
arguments: defargs,
|
|
72
86
|
execute: exec
|
|
73
87
|
};
|
|
74
88
|
if (this.askUserTools) {
|
|
@@ -164,26 +164,38 @@ async function executeTask(name, payload, options) {
|
|
|
164
164
|
}
|
|
165
165
|
if (hasTools && tpl) {
|
|
166
166
|
if (t == tpl.tags.toolCall?.start) {
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
if (!options?.debug) {
|
|
168
|
+
continueWrite = false;
|
|
169
|
+
if (emittedTokens > 0) {
|
|
170
|
+
console.log();
|
|
171
|
+
}
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
169
174
|
}
|
|
170
175
|
else if (t == tpl.tags.toolCall?.end) {
|
|
171
176
|
skipNextEmptyLinesToken = true;
|
|
172
177
|
continueWrite = true;
|
|
173
|
-
|
|
178
|
+
if (!options?.debug) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
174
181
|
}
|
|
175
182
|
}
|
|
176
183
|
if (continueWrite) {
|
|
177
184
|
if (skipNextEmptyLinesToken) {
|
|
178
|
-
if (t == "\n\n") {
|
|
185
|
+
if (t == "\n\n" || t == "\n") {
|
|
179
186
|
skipNextEmptyLinesToken = false;
|
|
180
187
|
return;
|
|
181
188
|
}
|
|
182
189
|
}
|
|
183
190
|
if (!options?.quiet) {
|
|
184
|
-
if (!options?.isToolCall
|
|
191
|
+
if (!options?.isToolCall) {
|
|
185
192
|
printToken(t);
|
|
186
193
|
}
|
|
194
|
+
else {
|
|
195
|
+
if (options?.debug) {
|
|
196
|
+
printToken(t);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
187
199
|
}
|
|
188
200
|
}
|
|
189
201
|
++emittedTokens;
|
package/package.json
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
"name": "@agent-smith/cli",
|
|
3
3
|
"description": "Agent Smith: terminal client for language model agents",
|
|
4
4
|
"repository": "https://github.com/synw/agent-smith",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.108",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"buildrl": "rm -rf dist/* && rollup -c",
|
|
8
7
|
"build": "rm -rf dist/* && tsc",
|
|
9
8
|
"cli": "node --loader ts-node/esm bin/index.ts",
|
|
10
9
|
"watch": "tsc --noCheck -p . -w"
|
|
11
10
|
},
|
|
12
11
|
"dependencies": {
|
|
13
|
-
"@agent-smith/agent": "^0.2.
|
|
12
|
+
"@agent-smith/agent": "^0.2.3",
|
|
14
13
|
"@agent-smith/nodetask": "^0.1.1",
|
|
15
|
-
"@agent-smith/task": "^0.2.
|
|
14
|
+
"@agent-smith/task": "^0.2.4",
|
|
15
|
+
"modprompt": "0.13.1",
|
|
16
16
|
"@agent-smith/tfm": "^0.2.0",
|
|
17
17
|
"@inquirer/prompts": "^8.2.0",
|
|
18
18
|
"@intrinsicai/gbnfgen": "0.12.0",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"clipboardy": "^5.1.0",
|
|
25
25
|
"commander": "^14.0.2",
|
|
26
26
|
"marked-terminal": "^7.3.0",
|
|
27
|
-
"modprompt": "0.13.1",
|
|
28
27
|
"ora": "^9.1.0",
|
|
29
28
|
"python-shell": "^5.0.0",
|
|
30
29
|
"yaml": "^2.8.2"
|
|
@@ -40,7 +39,6 @@
|
|
|
40
39
|
"@types/node": "^25.0.10",
|
|
41
40
|
"openai": "^6.16.0",
|
|
42
41
|
"restmix": "^0.6.1",
|
|
43
|
-
"rollup": "^4.56.0",
|
|
44
42
|
"tslib": "2.8.1",
|
|
45
43
|
"typescript": "^5.9.3"
|
|
46
44
|
},
|