@agent-smith/cli 0.0.65 → 0.0.66
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/cmds.d.ts +2 -1
- package/dist/cmd/cmds.js +2 -5
- package/dist/cmd/lib/tasks/cmd.d.ts +2 -1
- package/dist/cmd/lib/tasks/cmd.js +20 -7
- package/package.json +5 -5
package/dist/cmd/cmds.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
declare const program: Command;
|
|
2
3
|
declare function chat(program: Command): Promise<void>;
|
|
3
4
|
declare function buildCmds(): Promise<Command>;
|
|
4
5
|
declare function parseCmd(program: Command): Promise<void>;
|
|
5
|
-
export { buildCmds, chat, parseCmd, };
|
|
6
|
+
export { program, buildCmds, chat, parseCmd, };
|
package/dist/cmd/cmds.js
CHANGED
|
@@ -9,6 +9,7 @@ import { isChatMode, runMode } from "../state/state.js";
|
|
|
9
9
|
import { initCommandsFromAliases } from "./clicmds/aliases.js";
|
|
10
10
|
import { initBaseCommands } from "./clicmds/base.js";
|
|
11
11
|
import { initUserCmds } from "./clicmds/cmds.js";
|
|
12
|
+
const program = new Command();
|
|
12
13
|
async function chat(program) {
|
|
13
14
|
const data = { message: '>', default: "" };
|
|
14
15
|
const prompt = await input(data);
|
|
@@ -26,7 +27,6 @@ async function chat(program) {
|
|
|
26
27
|
await chat(program);
|
|
27
28
|
}
|
|
28
29
|
async function buildCmds() {
|
|
29
|
-
const program = new Command();
|
|
30
30
|
initBaseCommands(program);
|
|
31
31
|
const aliases = readAliases();
|
|
32
32
|
const feats = readFeatures();
|
|
@@ -39,8 +39,5 @@ async function buildCmds() {
|
|
|
39
39
|
}
|
|
40
40
|
async function parseCmd(program) {
|
|
41
41
|
await program.parseAsync();
|
|
42
|
-
if (isChatMode.value) {
|
|
43
|
-
await chat(program);
|
|
44
|
-
}
|
|
45
42
|
}
|
|
46
|
-
export { buildCmds, chat, parseCmd, };
|
|
43
|
+
export { program, buildCmds, chat, parseCmd, };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LmTaskOutput } from "@agent-smith/lmtask";
|
|
2
|
-
|
|
2
|
+
import { LmExpert } from "@agent-smith/brain";
|
|
3
|
+
declare function executeTask(name: string, payload: Record<string, any>, options: Record<string, any>, quiet?: boolean, expert?: LmExpert): Promise<LmTaskOutput>;
|
|
3
4
|
declare function executeTaskCmd(name: string, targs?: Array<any>): Promise<LmTaskOutput>;
|
|
4
5
|
export { executeTask, executeTaskCmd };
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
+
import { input } from "@inquirer/prompts";
|
|
1
2
|
import { compile, serializeGrammar } from "@intrinsicai/gbnfgen";
|
|
2
3
|
import color from "ansi-colors";
|
|
3
4
|
import ora from 'ora';
|
|
4
5
|
import { brain, initAgent, taskBuilder } from "../../../agent.js";
|
|
6
|
+
import { query } from "../../../cli.js";
|
|
5
7
|
import { readClipboard } from "../../../cmd/sys/clipboard.js";
|
|
6
8
|
import { readTool } from "../../../db/read.js";
|
|
7
9
|
import { usePerfTimer } from "../../../main.js";
|
|
8
|
-
import { isChatMode } from "../../../state/state.js";
|
|
10
|
+
import { isChatMode, runMode } from "../../../state/state.js";
|
|
11
|
+
import { program } from "../../cmds.js";
|
|
9
12
|
import { executeAction } from "../actions/cmd.js";
|
|
10
13
|
import { parseCommandArgs, parseTaskConfigOptions } from "../options_parsers.js";
|
|
11
14
|
import { runtimeDataError } from "../user_msgs.js";
|
|
12
15
|
import { formatStats, readPromptFile } from "../utils.js";
|
|
13
16
|
import { executeWorkflow } from "../workflows/cmd.js";
|
|
14
17
|
import { configureTaskModel, mergeInferParams } from "./conf.js";
|
|
15
|
-
import { openTaskSpec } from "./utils.js";
|
|
16
18
|
import { McpServer } from "./mcp.js";
|
|
17
|
-
|
|
19
|
+
import { openTaskSpec } from "./utils.js";
|
|
20
|
+
async function executeTask(name, payload, options, quiet, expert) {
|
|
18
21
|
await initAgent();
|
|
19
22
|
if (options.debug) {
|
|
20
23
|
console.log("Payload:", payload);
|
|
@@ -94,7 +97,7 @@ async function executeTask(name, payload, options, quiet = false) {
|
|
|
94
97
|
if (options.debug) {
|
|
95
98
|
console.log("Task model:", model);
|
|
96
99
|
}
|
|
97
|
-
const ex = brain.getOrCreateExpertForModel(model.name, model.template);
|
|
100
|
+
const ex = expert ?? brain.getOrCreateExpertForModel(model.name, model.template);
|
|
98
101
|
if (!ex) {
|
|
99
102
|
throw new Error("No expert found for model " + model.name);
|
|
100
103
|
}
|
|
@@ -210,10 +213,20 @@ async function executeTask(name, payload, options, quiet = false) {
|
|
|
210
213
|
}
|
|
211
214
|
mcpServers.forEach(async (s) => await s.stop());
|
|
212
215
|
if (isChatMode.value) {
|
|
213
|
-
|
|
214
|
-
|
|
216
|
+
const data = { message: '>', default: "" };
|
|
217
|
+
const prompt = await input(data);
|
|
218
|
+
if (prompt == "/q") {
|
|
219
|
+
isChatMode.value = false;
|
|
220
|
+
if (runMode.value == "cmd") {
|
|
221
|
+
process.exit(0);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
await query(program);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
await executeTask(name, { ...vars, prompt: prompt }, options, quiet, ex);
|
|
215
229
|
}
|
|
216
|
-
brain.ex.template.pushToHistory({ user: payload.prompt, assistant: out.answer.text });
|
|
217
230
|
}
|
|
218
231
|
if (options?.debug === true || options?.verbose === true) {
|
|
219
232
|
console.log("\n", formatStats(out.answer.stats));
|
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.66",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
8
8
|
"build": "rm -rf dist/* && tsc",
|
|
@@ -12,18 +12,18 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@agent-smith/brain": "^0.0.43",
|
|
14
14
|
"@agent-smith/jobs": "^0.0.14",
|
|
15
|
-
"@agent-smith/lmtask": "^0.0.
|
|
15
|
+
"@agent-smith/lmtask": "^0.0.45",
|
|
16
16
|
"@agent-smith/tfm": "^0.1.2",
|
|
17
17
|
"@inquirer/prompts": "^7.5.3",
|
|
18
18
|
"@inquirer/select": "^4.2.3",
|
|
19
|
-
"@vue/reactivity": "^3.5.
|
|
19
|
+
"@vue/reactivity": "^3.5.16",
|
|
20
20
|
"ansi-colors": "^4.1.3",
|
|
21
21
|
"better-sqlite3": "^11.10.0",
|
|
22
22
|
"chalk": "^5.4.1",
|
|
23
23
|
"clipboardy": "^4.0.0",
|
|
24
24
|
"commander": "^14.0.0",
|
|
25
25
|
"marked-terminal": "^7.3.0",
|
|
26
|
-
"modprompt": "^0.11.
|
|
26
|
+
"modprompt": "^0.11.8",
|
|
27
27
|
"ora": "^8.2.0",
|
|
28
28
|
"python-shell": "^5.0.0",
|
|
29
29
|
"yaml": "^2.8.0"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
37
37
|
"@types/better-sqlite3": "^7.6.13",
|
|
38
38
|
"@types/marked-terminal": "^6.1.1",
|
|
39
|
-
"@types/node": "^22.15.
|
|
39
|
+
"@types/node": "^22.15.27",
|
|
40
40
|
"restmix": "^0.5.0",
|
|
41
41
|
"rollup": "^4.41.1",
|
|
42
42
|
"ts-node": "^10.9.2",
|