@agent-smith/cli 0.0.22 → 0.0.24
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/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/cmd/cmds.d.ts +1 -1
- package/dist/cmd/cmds.js +5 -4
- package/dist/cmd/lib/execute_job.js +1 -1
- package/dist/cmd/lib/execute_task.js +34 -6
- package/dist/cmd/lib/utils.js +3 -0
- package/dist/main.d.ts +3 -1
- package/dist/main.js +3 -1
- package/dist/state/chat.d.ts +25 -0
- package/dist/state/chat.js +3 -0
- package/package.json +11 -10
package/dist/agent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LmTaskBuilder } from "
|
|
1
|
+
import { LmTaskBuilder } from "../../lmtask/dist/task.js";
|
|
2
2
|
import { marked } from 'marked';
|
|
3
3
|
import { FeatureType } from "./interfaces.js";
|
|
4
4
|
declare let brain: import("@agent-smith/brain").AgentBrain<Record<string, any>>;
|
package/dist/agent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useAgentBrain } from "@agent-smith/brain";
|
|
2
|
-
import { LmTaskBuilder } from "
|
|
2
|
+
import { LmTaskBuilder } from "../../lmtask/dist/task.js";
|
|
3
3
|
import { marked } from 'marked';
|
|
4
4
|
import { markedTerminal } from "marked-terminal";
|
|
5
5
|
marked.use(markedTerminal());
|
package/dist/cmd/cmds.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ declare function initCliCmds(): Promise<void>;
|
|
|
4
4
|
declare function runCmd(cmdName: string, args?: Array<string>): Promise<void>;
|
|
5
5
|
declare function buildCmds(): Promise<Command>;
|
|
6
6
|
declare function parseCmd(): Promise<void>;
|
|
7
|
-
export { buildCmds, initCliCmds, parseCmd, runCmd
|
|
7
|
+
export { buildCmds, chat, initCliCmds, parseCmd, runCmd };
|
package/dist/cmd/cmds.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { input } from "@inquirer/prompts";
|
|
2
|
+
import { toRaw } from "@vue/reactivity";
|
|
2
3
|
import { Command } from "commander";
|
|
3
4
|
import { brain } from "../agent.js";
|
|
5
|
+
import { query } from "../cli.js";
|
|
6
|
+
import { chatInferenceParams } from "../state/chat.js";
|
|
4
7
|
import { isChatMode, lastCmd, runMode } from "../state/state.js";
|
|
5
8
|
import { cmds, initAliases, initCmds } from "./clicmds/cmds.js";
|
|
6
9
|
import { modes } from "./clicmds/modes.js";
|
|
7
10
|
import { processOutput, setOptions } from "./lib/utils.js";
|
|
8
|
-
import { query } from "../cli.js";
|
|
9
11
|
let cliCmds = {};
|
|
10
12
|
async function chat() {
|
|
11
13
|
const data = { message: '>', default: "" };
|
|
@@ -19,7 +21,7 @@ async function chat() {
|
|
|
19
21
|
await query();
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
|
-
await brain.ex.think(prompt);
|
|
24
|
+
await brain.ex.think(prompt, toRaw(chatInferenceParams));
|
|
23
25
|
console.log();
|
|
24
26
|
await chat();
|
|
25
27
|
}
|
|
@@ -75,5 +77,4 @@ async function parseCmd() {
|
|
|
75
77
|
await chat();
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
|
-
export { buildCmds, initCliCmds, parseCmd, runCmd
|
|
79
|
-
;
|
|
80
|
+
export { buildCmds, chat, initCliCmds, parseCmd, runCmd };
|
|
@@ -33,7 +33,7 @@ async function executeJobCmd(name, args = [], options = {}) {
|
|
|
33
33
|
}
|
|
34
34
|
const taskSpec = taskBuilder.readFromYaml(tres.ymlTask);
|
|
35
35
|
let m = taskSpec.model.name;
|
|
36
|
-
let t = taskSpec.template
|
|
36
|
+
let t = taskSpec.model.template;
|
|
37
37
|
if (conf?.model) {
|
|
38
38
|
m = conf.model;
|
|
39
39
|
}
|
|
@@ -2,6 +2,8 @@ import { brain, initAgent, taskBuilder } from "../../agent.js";
|
|
|
2
2
|
import { getFeatureSpec } from "../../state/features.js";
|
|
3
3
|
import { isChatMode, isDebug } from "../../state/state.js";
|
|
4
4
|
import { initTaskVars, parseInputOptions, readTask } from "./utils.js";
|
|
5
|
+
import { useTemplateForModel } from "@agent-smith/tfm";
|
|
6
|
+
const tfm = useTemplateForModel();
|
|
5
7
|
async function executeTaskCmd(args = [], options = {}) {
|
|
6
8
|
await initAgent();
|
|
7
9
|
if (isDebug.value) {
|
|
@@ -36,12 +38,41 @@ async function executeTaskCmd(args = [], options = {}) {
|
|
|
36
38
|
console.log("Task vars:", vars);
|
|
37
39
|
}
|
|
38
40
|
let m = taskSpec.model.name;
|
|
39
|
-
let t = taskSpec.template
|
|
41
|
+
let t = taskSpec.model.template;
|
|
42
|
+
let c = taskSpec.model.ctx;
|
|
40
43
|
if (conf?.model) {
|
|
41
44
|
m = conf.model;
|
|
45
|
+
if (conf?.template) {
|
|
46
|
+
t = conf.template;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const gt = tfm.guess(m);
|
|
50
|
+
if (gt == "none") {
|
|
51
|
+
throw new Error(`Unable to guess the template for ${conf.model}: please provide a template name: m="modelname/templatename"`);
|
|
52
|
+
}
|
|
53
|
+
t = gt;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
if (conf?.size) {
|
|
58
|
+
if (!taskSpec?.models) {
|
|
59
|
+
throw new Error(`Model ${conf.size} not found in task`);
|
|
60
|
+
}
|
|
61
|
+
if (!Object.keys(taskSpec.models).includes(conf.size)) {
|
|
62
|
+
throw new Error(`Model ${conf.size} not found in task`);
|
|
63
|
+
}
|
|
64
|
+
m = taskSpec.models[conf.size].name;
|
|
65
|
+
t = taskSpec.models[conf.size].template;
|
|
66
|
+
c = taskSpec.models[conf.size].ctx;
|
|
67
|
+
}
|
|
42
68
|
}
|
|
43
|
-
|
|
44
|
-
|
|
69
|
+
conf.model = {
|
|
70
|
+
name: m,
|
|
71
|
+
template: t,
|
|
72
|
+
ctx: c,
|
|
73
|
+
};
|
|
74
|
+
if (isDebug.value) {
|
|
75
|
+
console.log("Model:", conf.model);
|
|
45
76
|
}
|
|
46
77
|
const ex = brain.getOrCreateExpertForModel(m, t);
|
|
47
78
|
if (!ex) {
|
|
@@ -62,9 +93,6 @@ async function executeTaskCmd(args = [], options = {}) {
|
|
|
62
93
|
if (isDebug.value) {
|
|
63
94
|
conf.debug = true;
|
|
64
95
|
}
|
|
65
|
-
if (isDebug.value) {
|
|
66
|
-
console.log("Vars", vars);
|
|
67
|
-
}
|
|
68
96
|
const data = await task.run({ prompt: pr, ...vars }, conf);
|
|
69
97
|
if (data?.error) {
|
|
70
98
|
return { ok: false, data: "", conf: conf, error: `Error executing task: ${data.error}` };
|
package/dist/cmd/lib/utils.js
CHANGED
package/dist/main.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { execute, run } from "./cmd/sys/execute.js";
|
|
2
2
|
import { executeJobCmd } from "./cmd/lib/execute_job.js";
|
|
3
|
+
import { executeActionCmd } from "./cmd/lib/execute_action.js";
|
|
4
|
+
import { executeTaskCmd } from "./cmd/lib/execute_task.js";
|
|
3
5
|
import { writeToClipboard } from "./cmd/sys/clipboard.js";
|
|
4
6
|
import { pingCmd } from "./cmd/clicmds/cmds.js";
|
|
5
7
|
import { initAgent } from "./agent.js";
|
|
6
|
-
export { execute, run, pingCmd, executeJobCmd, writeToClipboard, initAgent, };
|
|
8
|
+
export { execute, run, pingCmd, executeJobCmd, executeActionCmd, executeTaskCmd, writeToClipboard, initAgent, };
|
package/dist/main.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { execute, run } from "./cmd/sys/execute.js";
|
|
2
2
|
import { executeJobCmd } from "./cmd/lib/execute_job.js";
|
|
3
|
+
import { executeActionCmd } from "./cmd/lib/execute_action.js";
|
|
4
|
+
import { executeTaskCmd } from "./cmd/lib/execute_task.js";
|
|
3
5
|
import { writeToClipboard } from "./cmd/sys/clipboard.js";
|
|
4
6
|
import { pingCmd } from "./cmd/clicmds/cmds.js";
|
|
5
7
|
import { initAgent } from "./agent.js";
|
|
6
|
-
export { execute, run, pingCmd, executeJobCmd, writeToClipboard, initAgent, };
|
|
8
|
+
export { execute, run, pingCmd, executeJobCmd, executeActionCmd, executeTaskCmd, writeToClipboard, initAgent, };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const chatInferenceParams: {
|
|
2
|
+
stream?: boolean | undefined;
|
|
3
|
+
model?: {
|
|
4
|
+
name: string;
|
|
5
|
+
ctx: number;
|
|
6
|
+
info?: {
|
|
7
|
+
size: string;
|
|
8
|
+
quant: string;
|
|
9
|
+
} | undefined;
|
|
10
|
+
extra?: Record<string, any> | undefined;
|
|
11
|
+
} | undefined;
|
|
12
|
+
template?: string | undefined;
|
|
13
|
+
max_tokens?: number | undefined;
|
|
14
|
+
top_k?: number | undefined;
|
|
15
|
+
top_p?: number | undefined;
|
|
16
|
+
min_p?: number | undefined;
|
|
17
|
+
temperature?: number | undefined;
|
|
18
|
+
repeat_penalty?: number | undefined;
|
|
19
|
+
tfs?: number | undefined;
|
|
20
|
+
stop?: Array<string> | undefined;
|
|
21
|
+
grammar?: string | undefined;
|
|
22
|
+
images?: Array<string> | undefined;
|
|
23
|
+
extra?: Record<string, any> | undefined;
|
|
24
|
+
};
|
|
25
|
+
export { chatInferenceParams, };
|
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.24",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
8
8
|
"build": "rm -rf dist/* && tsc",
|
|
@@ -12,17 +12,18 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@agent-smith/brain": "^0.0.33",
|
|
14
14
|
"@agent-smith/jobs": "^0.0.11",
|
|
15
|
-
"@agent-smith/lmtask": "^0.0.
|
|
16
|
-
"@
|
|
17
|
-
"@inquirer/
|
|
18
|
-
"@
|
|
15
|
+
"@agent-smith/lmtask": "^0.0.25",
|
|
16
|
+
"@agent-smith/tfm": "^0.1.1",
|
|
17
|
+
"@inquirer/prompts": "^7.1.0",
|
|
18
|
+
"@inquirer/select": "^4.0.2",
|
|
19
|
+
"@vue/reactivity": "^3.5.13",
|
|
19
20
|
"better-sqlite3": "^11.5.0",
|
|
20
21
|
"clipboardy": "^4.0.0",
|
|
21
22
|
"commander": "^12.1.0",
|
|
22
23
|
"marked-terminal": "^7.2.1",
|
|
23
24
|
"modprompt": "^0.9.1",
|
|
24
25
|
"python-shell": "^5.0.0",
|
|
25
|
-
"yaml": "^2.6.
|
|
26
|
+
"yaml": "^2.6.1"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"@agent-smith/tmem-jobs": "^0.0.4",
|
|
@@ -30,13 +31,13 @@
|
|
|
30
31
|
"@locallm/types": "^0.1.5",
|
|
31
32
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
32
33
|
"@rollup/plugin-typescript": "^12.1.1",
|
|
33
|
-
"@types/better-sqlite3": "^7.6.
|
|
34
|
+
"@types/better-sqlite3": "^7.6.12",
|
|
34
35
|
"@types/marked-terminal": "^6.1.1",
|
|
35
|
-
"@types/node": "^22.
|
|
36
|
+
"@types/node": "^22.9.1",
|
|
36
37
|
"restmix": "^0.5.0",
|
|
37
|
-
"rollup": "^4.
|
|
38
|
+
"rollup": "^4.27.3",
|
|
38
39
|
"ts-node": "^10.9.2",
|
|
39
|
-
"tslib": "2.8.
|
|
40
|
+
"tslib": "2.8.1",
|
|
40
41
|
"typescript": "^5.6.3"
|
|
41
42
|
},
|
|
42
43
|
"type": "module",
|