@agent-smith/cli 0.0.118 → 0.0.119
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/README.md +27 -24
- package/dist/cmd/build.js +6 -1
- package/dist/cmd/features.d.ts +1 -2
- package/dist/cmd/features.js +17 -19
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -50,29 +50,33 @@ This installs the `lm` command globally.
|
|
|
50
50
|
|
|
51
51
|
## Quick Start
|
|
52
52
|
|
|
53
|
-
### 1.
|
|
53
|
+
### 1. Initialize a config file
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
Run `lm conf` to initialize. A basic config file will be created (`~/.config/agent-smith/config.yml` on Linux):
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
backends:
|
|
59
|
+
default: llamacpp
|
|
60
|
+
llamacpp:
|
|
61
|
+
url: http://localhost:8080/v1
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 2. Configure your backend
|
|
65
|
+
|
|
66
|
+
Customize your config:
|
|
56
67
|
|
|
57
68
|
```yaml
|
|
58
69
|
backends:
|
|
59
70
|
default: "llamacpp"
|
|
60
71
|
llamacpp:
|
|
61
|
-
type: "openai"
|
|
62
72
|
url: "http://localhost:8080/v1"
|
|
63
73
|
openrouter:
|
|
64
74
|
type: "openai"
|
|
65
75
|
url: "https://openrouter.ai/api/v1"
|
|
66
|
-
apiKey: "$OPENROUTER_API_KEY"
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### 2. Sync Configuration
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
lm conf ~/.config/agent-smith/config.yml
|
|
76
|
+
apiKey: "$OPENROUTER_API_KEY" # env variable
|
|
73
77
|
```
|
|
74
78
|
|
|
75
|
-
This processes the YAML config and populates the SQLite database at `~/.config/agent-smith/config.db
|
|
79
|
+
Run `lm conf` again to synchronize. This processes the YAML config and populates the SQLite database (at `~/.config/agent-smith/config.db` on Linux).
|
|
76
80
|
|
|
77
81
|
### 3. Run a Quick Query
|
|
78
82
|
|
|
@@ -161,12 +165,12 @@ lm q "Write a poem" \
|
|
|
161
165
|
|
|
162
166
|
**Clipboard input:**
|
|
163
167
|
```bash
|
|
164
|
-
lm q "Summarize this" --
|
|
168
|
+
lm q "Summarize this" --ic
|
|
165
169
|
```
|
|
166
170
|
|
|
167
171
|
**File input:**
|
|
168
172
|
```bash
|
|
169
|
-
lm q "Analyze" --
|
|
173
|
+
lm q "Analyze" --if
|
|
170
174
|
```
|
|
171
175
|
|
|
172
176
|
**Markdown output:**
|
|
@@ -176,7 +180,7 @@ lm q "Generate a report" --markdown-output
|
|
|
176
180
|
|
|
177
181
|
**Clipboard output:**
|
|
178
182
|
```bash
|
|
179
|
-
lm q "Generate code" --
|
|
183
|
+
lm q "Generate code" --oc
|
|
180
184
|
```
|
|
181
185
|
|
|
182
186
|
### Chat Mode for Tasks
|
|
@@ -219,27 +223,26 @@ backends:
|
|
|
219
223
|
url: "http://localhost:8080/v1"
|
|
220
224
|
```
|
|
221
225
|
|
|
226
|
+
Run `lm conf` to synchronize the conf db
|
|
227
|
+
|
|
222
228
|
### Step 3: Create an Agent
|
|
223
229
|
|
|
224
230
|
Create `~/my-agents/features/agents/shell-demo.yml`:
|
|
225
231
|
|
|
226
232
|
```yaml
|
|
227
|
-
|
|
228
|
-
description: A demo agent with shell tool access
|
|
233
|
+
description: A demo agent
|
|
229
234
|
prompt: |-
|
|
230
|
-
|
|
235
|
+
Custom prompt here.
|
|
236
|
+
User input: {prompt}
|
|
237
|
+
template:
|
|
238
|
+
system: |-
|
|
239
|
+
Custom system prompt here
|
|
231
240
|
model: qwen4b
|
|
232
241
|
inferParams:
|
|
233
242
|
min_p: 0
|
|
234
243
|
top_k: 20
|
|
235
244
|
top_p: 0.95
|
|
236
245
|
temperature: 0.4
|
|
237
|
-
toolsList:
|
|
238
|
-
- shell
|
|
239
|
-
variables:
|
|
240
|
-
required:
|
|
241
|
-
workspace:
|
|
242
|
-
description: The local directory path where to operate
|
|
243
246
|
```
|
|
244
247
|
|
|
245
248
|
### Step 4: Register and Run
|
|
@@ -249,7 +252,7 @@ variables:
|
|
|
249
252
|
lm update
|
|
250
253
|
|
|
251
254
|
# Run with a prompt and variable
|
|
252
|
-
lm
|
|
255
|
+
lm demo "user prompt here" -v # -v is to see thinking tokens
|
|
253
256
|
```
|
|
254
257
|
|
|
255
258
|
## API Reference
|
package/dist/cmd/build.js
CHANGED
|
@@ -21,7 +21,12 @@ async function chat(options, agent, mcpServers) {
|
|
|
21
21
|
await query(program);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
/* console.log("CHAT HISTORY", agent.history.length);
|
|
25
|
+
agent.history.forEach(t => {
|
|
26
|
+
const turn = { ...t };
|
|
27
|
+
delete turn.stats;
|
|
28
|
+
console.log(turn)
|
|
29
|
+
});*/
|
|
25
30
|
//options.history = undefined;
|
|
26
31
|
//console.log("RUN W PROMPT", prompt);
|
|
27
32
|
options.params = chatInferenceParams;
|
package/dist/cmd/features.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { InferenceResult } from "@agent-smith/types";
|
|
2
2
|
declare function executeWorkflowCmd(name: string, wargs: Array<any>): Promise<any>;
|
|
3
|
-
declare function executeTaskCmd(name: string, targs?: Array<any>): Promise<InferenceResult>;
|
|
4
3
|
declare function executeAgentCmd(name: string, targs?: Array<any>): Promise<InferenceResult>;
|
|
5
4
|
declare function executeActionCmd(name: string, aargs: Array<any>, quiet?: boolean): Promise<any>;
|
|
6
|
-
export { executeWorkflowCmd,
|
|
5
|
+
export { executeWorkflowCmd, executeActionCmd, executeAgentCmd, };
|
package/dist/cmd/features.js
CHANGED
|
@@ -4,28 +4,19 @@ import { useInferenceCallbacks } from "./callbacks.js";
|
|
|
4
4
|
import { chat } from "./build.js";
|
|
5
5
|
async function executeWorkflowCmd(name, wargs) {
|
|
6
6
|
//console.log("WF INITIAL ARGS", typeof wargs, wargs.slice(0, -1));
|
|
7
|
-
const
|
|
8
|
-
//console.log("WF ARGS",
|
|
9
|
-
//console.log("WF OPTS", options);
|
|
10
|
-
return await executeWorkflow(name, args, options);
|
|
11
|
-
}
|
|
12
|
-
async function executeTaskCmd(name, targs = []) {
|
|
13
|
-
const ca = parseCommandArgs(targs);
|
|
14
|
-
//console.log("ARGS", ca);
|
|
7
|
+
const ca = parseCommandArgs(wargs);
|
|
8
|
+
//console.log("WF ARGS", ca);
|
|
15
9
|
const inferenceCallbacks = useInferenceCallbacks(name, ca.options);
|
|
16
10
|
const options = { ...ca.options, ...inferenceCallbacks };
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const tr = await tsk.execute();
|
|
20
|
-
//console.log("TR", tr);
|
|
21
|
-
if (ca?.options.chat) {
|
|
11
|
+
return await executeWorkflow(name, wargs, options);
|
|
12
|
+
/*if (ca?.options.chat) {
|
|
22
13
|
await chat(options, tsk.agent, tsk.mcpServers);
|
|
23
|
-
}
|
|
24
|
-
return tr;
|
|
14
|
+
}*/
|
|
25
15
|
}
|
|
26
16
|
async function executeAgentCmd(name, targs = []) {
|
|
27
17
|
//console.log("EXEC AGENT", name);
|
|
28
18
|
const ca = parseCommandArgs(targs);
|
|
19
|
+
//console.log("Agent ARGs", ca);
|
|
29
20
|
ca.options.isAgent = true;
|
|
30
21
|
ca.options.confirmToolUsage = confirmToolUsage;
|
|
31
22
|
const inferenceCallbacks = useInferenceCallbacks(name, ca.options);
|
|
@@ -35,16 +26,23 @@ async function executeAgentCmd(name, targs = []) {
|
|
|
35
26
|
//console.log("CA", ca);
|
|
36
27
|
const tr = await tsk.execute();
|
|
37
28
|
//console.dir(tsk.agent.history, { depth: 6 });
|
|
29
|
+
if (tr?.text) {
|
|
30
|
+
if (!tr.text.endsWith("\n")) {
|
|
31
|
+
console.log();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
38
34
|
if (ca?.options.chat) {
|
|
39
35
|
await chat(options, tsk.agent, tsk.mcpServers);
|
|
40
36
|
}
|
|
41
37
|
return tr;
|
|
42
38
|
}
|
|
43
39
|
async function executeActionCmd(name, aargs, quiet = false) {
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const ca = parseCommandArgs(aargs);
|
|
41
|
+
//console.log("AARGs", ca);
|
|
42
|
+
const inferenceCallbacks = useInferenceCallbacks(name, ca.options);
|
|
43
|
+
const options = { ...ca.options, ...inferenceCallbacks };
|
|
46
44
|
//console.log("CMDA", args)
|
|
47
|
-
const params =
|
|
45
|
+
const params = aargs;
|
|
48
46
|
const ip = await getInputFromOptions(options);
|
|
49
47
|
if (ip !== null) {
|
|
50
48
|
params.push(ip);
|
|
@@ -54,4 +52,4 @@ async function executeActionCmd(name, aargs, quiet = false) {
|
|
|
54
52
|
}
|
|
55
53
|
return await executeAction(name, params, options, quiet);
|
|
56
54
|
}
|
|
57
|
-
export { executeWorkflowCmd,
|
|
55
|
+
export { executeWorkflowCmd, executeActionCmd, executeAgentCmd, };
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-smith/cli",
|
|
3
3
|
"description": "Agent Smith: terminal client for language model agents",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.119",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rm -rf dist/* && tsc",
|
|
7
7
|
"cli": "node --loader ts-node/esm bin/index.ts",
|
|
8
8
|
"watch": "tsc --noCheck -p . -w"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@agent-smith/core": "^0.0.
|
|
12
|
-
"@inquirer/prompts": "^8.
|
|
13
|
-
"@vue/reactivity": "^3.5.
|
|
11
|
+
"@agent-smith/core": "^0.0.3",
|
|
12
|
+
"@inquirer/prompts": "^8.5.2",
|
|
13
|
+
"@vue/reactivity": "^3.5.38",
|
|
14
14
|
"ansi-colors": "^4.1.3",
|
|
15
15
|
"clipboardy": "^5.3.1",
|
|
16
|
-
"commander": "^
|
|
16
|
+
"commander": "^15.0.0",
|
|
17
17
|
"marked-terminal": "^7.3.0",
|
|
18
|
-
"ora": "^9.
|
|
19
|
-
"yaml": "^2.
|
|
18
|
+
"ora": "^9.4.0",
|
|
19
|
+
"yaml": "^2.9.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@agent-smith/agent": "^0.5.
|
|
23
|
-
"@agent-smith/types": "^0.0.
|
|
22
|
+
"@agent-smith/agent": "^0.5.2",
|
|
23
|
+
"@agent-smith/types": "^0.0.6",
|
|
24
24
|
"@cfworker/json-schema": "^4.1.1",
|
|
25
|
-
"@commander-js/extra-typings": "^
|
|
25
|
+
"@commander-js/extra-typings": "^15.0.0",
|
|
26
26
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
27
27
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
28
28
|
"@types/marked-terminal": "^6.1.1",
|
|
29
|
-
"@types/node": "^25.
|
|
29
|
+
"@types/node": "^25.9.3",
|
|
30
30
|
"ts-node": "^10.9.2",
|
|
31
31
|
"tslib": "2.8.1",
|
|
32
|
-
"typescript": "^6.0.
|
|
32
|
+
"typescript": "^6.0.3"
|
|
33
33
|
},
|
|
34
34
|
"type": "module",
|
|
35
35
|
"preferGlobal": true,
|