@agent-smith/cli 0.0.92 → 0.0.93
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.
|
@@ -9,7 +9,7 @@ import { usePerfTimer } from "../../../main.js";
|
|
|
9
9
|
import { isChatMode, runMode, agent } from "../../../state/state.js";
|
|
10
10
|
import { program } from "../../cmds.js";
|
|
11
11
|
import { parseCommandArgs } from "../options_parsers.js";
|
|
12
|
-
import { runtimeDataError, runtimeWarning } from "../user_msgs.js";
|
|
12
|
+
import { runtimeDataError, runtimeError, runtimeWarning } from "../user_msgs.js";
|
|
13
13
|
import { formatStats, processOutput, readPromptFile } from "../utils.js";
|
|
14
14
|
import { readTask } from "./read.js";
|
|
15
15
|
async function executeTask(name, payload, options, quiet) {
|
|
@@ -141,7 +141,30 @@ async function executeTask(name, payload, options, quiet) {
|
|
|
141
141
|
...conf,
|
|
142
142
|
};
|
|
143
143
|
let out;
|
|
144
|
-
|
|
144
|
+
try {
|
|
145
|
+
out = await task.run({ prompt: payload.prompt, ...vars }, tconf);
|
|
146
|
+
}
|
|
147
|
+
catch (e) {
|
|
148
|
+
const errMsg = `${e}`;
|
|
149
|
+
if (errMsg.includes("502 Bad Gateway")) {
|
|
150
|
+
runtimeError("The server answered with a 502 Bad Gateway error. It might be down or misconfigured. Check your inference server.");
|
|
151
|
+
if (options?.debug) {
|
|
152
|
+
throw new Error(errMsg);
|
|
153
|
+
}
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
else if (errMsg.includes("404 Not Found")) {
|
|
157
|
+
runtimeError("The server answered with a 404 Not Found error. That usually mean that the model you are requesting does not exist on the server.");
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
else if (errMsg.includes("fetch failed")) {
|
|
161
|
+
runtimeError("The server is not responding. Check if your inference backend is running.");
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
throw new Error(errMsg);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
145
168
|
if (!out.answer.text.endsWith("\n")) {
|
|
146
169
|
console.log();
|
|
147
170
|
}
|
|
@@ -17,22 +17,24 @@ function configureTaskModel(itConf, taskSpec) {
|
|
|
17
17
|
model.template = itConf.templateName;
|
|
18
18
|
foundTemplate = true;
|
|
19
19
|
}
|
|
20
|
-
if (
|
|
21
|
-
if (itConf?.model?.name
|
|
22
|
-
|
|
20
|
+
if (!foundTemplate) {
|
|
21
|
+
if (itConf?.model?.name) {
|
|
22
|
+
if (itConf?.model?.name != taskSpec.model.name) {
|
|
23
|
+
const gt = guessTemplate(itConf.model.name);
|
|
24
|
+
model.template = gt;
|
|
25
|
+
foundTemplate = true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else if (taskSpec?.model?.template) {
|
|
29
|
+
model.template = taskSpec.model.template;
|
|
30
|
+
foundTemplate = true;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
const gt = guessTemplate(taskSpec.model.name);
|
|
23
34
|
model.template = gt;
|
|
24
35
|
foundTemplate = true;
|
|
25
36
|
}
|
|
26
37
|
}
|
|
27
|
-
else if (taskSpec?.model?.template) {
|
|
28
|
-
model.template = taskSpec.model.template;
|
|
29
|
-
foundTemplate = true;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
const gt = guessTemplate(taskSpec.model.name);
|
|
33
|
-
model.template = gt;
|
|
34
|
-
foundTemplate = true;
|
|
35
|
-
}
|
|
36
38
|
if (itConf?.model?.name) {
|
|
37
39
|
if (taskSpec?.models && Object.keys(taskSpec.models).includes(itConf.model.name)) {
|
|
38
40
|
for (const [k, v] of Object.entries(taskSpec.models)) {
|
|
@@ -18,7 +18,7 @@ async function readTask(name, payload, options, agent) {
|
|
|
18
18
|
const opts = payload?.inferParams ? { ...options, ...payload.inferParams } : options;
|
|
19
19
|
const conf = parseTaskConfigOptions(opts);
|
|
20
20
|
if (options?.debug) {
|
|
21
|
-
console.log("conf:", conf);
|
|
21
|
+
console.log("Task conf:", conf);
|
|
22
22
|
conf.debug = true;
|
|
23
23
|
}
|
|
24
24
|
conf.inferParams = mergeInferParams(conf.inferParams, taskFileSpec.inferParams ?? {});
|
package/dist/state/backends.js
CHANGED
|
@@ -55,8 +55,8 @@ const probeBackend = async (lm, isVerbose) => {
|
|
|
55
55
|
switch (lm.providerType) {
|
|
56
56
|
case "llamacpp":
|
|
57
57
|
try {
|
|
58
|
-
const info = await lm.info();
|
|
59
58
|
if (isVerbose) {
|
|
59
|
+
const info = await lm.modelInfo();
|
|
60
60
|
console.log(`Provider ${lm.name} up`, info);
|
|
61
61
|
}
|
|
62
62
|
isUp = true;
|
|
@@ -69,9 +69,9 @@ const probeBackend = async (lm, isVerbose) => {
|
|
|
69
69
|
break;
|
|
70
70
|
case "koboldcpp":
|
|
71
71
|
try {
|
|
72
|
-
const info = await lm.info();
|
|
73
72
|
if (lm.model.name.length > 0) {
|
|
74
73
|
if (isVerbose) {
|
|
74
|
+
const info = await lm.modelInfo();
|
|
75
75
|
console.log(`Provider ${lm.name} up`, info);
|
|
76
76
|
}
|
|
77
77
|
isUp = true;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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.93",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
8
8
|
"build": "rm -rf dist/* && tsc",
|
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
"watch": "tsc --noCheck -p . -w"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@agent-smith/agent": "^0.1.
|
|
14
|
-
"@agent-smith/task": "^0.1.
|
|
13
|
+
"@agent-smith/agent": "^0.1.4",
|
|
14
|
+
"@agent-smith/task": "^0.1.5",
|
|
15
15
|
"@agent-smith/tfm": "^0.2.0",
|
|
16
16
|
"@inquirer/prompts": "^7.10.1",
|
|
17
17
|
"@intrinsicai/gbnfgen": "0.12.0",
|
|
18
|
-
"@locallm/api": "^0.
|
|
19
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
20
|
-
"@vue/reactivity": "^3.5.
|
|
18
|
+
"@locallm/api": "^0.7.0",
|
|
19
|
+
"@modelcontextprotocol/sdk": "^1.23.0",
|
|
20
|
+
"@vue/reactivity": "^3.5.25",
|
|
21
21
|
"ansi-colors": "^4.1.3",
|
|
22
|
-
"better-sqlite3": "^12.4.
|
|
22
|
+
"better-sqlite3": "^12.4.6",
|
|
23
23
|
"clipboardy": "^5.0.1",
|
|
24
24
|
"commander": "^14.0.2",
|
|
25
25
|
"marked-terminal": "^7.3.0",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"@agent-smith/tmem-jobs": "^0.0.4",
|
|
33
33
|
"@cfworker/json-schema": "^4.1.1",
|
|
34
34
|
"@commander-js/extra-typings": "^14.0.0",
|
|
35
|
-
"@locallm/types": "^0.
|
|
35
|
+
"@locallm/types": "^0.6.2",
|
|
36
36
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
37
37
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
38
38
|
"@types/better-sqlite3": "^7.6.13",
|
|
39
39
|
"@types/marked-terminal": "^6.1.1",
|
|
40
40
|
"@types/node": "^24.10.1",
|
|
41
|
-
"restmix": "^0.
|
|
41
|
+
"restmix": "^0.6.1",
|
|
42
42
|
"rollup": "^4.53.3",
|
|
43
43
|
"ts-node": "^10.9.2",
|
|
44
44
|
"tslib": "2.8.1",
|