@agent-smith/cli 0.0.105 → 0.0.106
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/clicmds/cmds.js +6 -10
- package/dist/cmd/lib/actions/cmd.js +1 -0
- package/dist/cmd/lib/tasks/cmd.js +4 -2
- package/dist/cmd/lib/workflows/cmd.d.ts +1 -1
- package/dist/cmd/lib/workflows/cmd.js +19 -5
- package/dist/cmd/sys/read_cmds.d.ts +1 -1
- package/dist/cmd/sys/read_cmds.js +13 -6
- package/dist/index.js +2 -2
- package/dist/state/auto/usercmds.js +3 -12
- package/package.json +7 -7
package/dist/cmd/clicmds/cmds.js
CHANGED
|
@@ -4,7 +4,6 @@ import YAML from 'yaml';
|
|
|
4
4
|
import { cacheFilePath, dbPath } from "../../conf.js";
|
|
5
5
|
import { readFeaturePaths, readFeaturesType, readTaskSetting } from "../../db/read.js";
|
|
6
6
|
import { cleanupFeaturePaths, deleteTaskSetting, updateAliases, updateFeatures, upsertTaskSettings } from "../../db/write.js";
|
|
7
|
-
import { isCacheReady, cmds } from "../../state/auto/usercmds.js";
|
|
8
7
|
import { getFeatureSpec, readFeaturesDirs } from "../../state/features.js";
|
|
9
8
|
import { readPluginsPaths } from "../../state/plugins.js";
|
|
10
9
|
import { runMode } from "../../state/state.js";
|
|
@@ -15,18 +14,15 @@ import { readTask } from "../sys/read_task.js";
|
|
|
15
14
|
import { updateUserCmdsCache } from './cache.js';
|
|
16
15
|
async function initUserCmds(cmdFeats) {
|
|
17
16
|
const features = Object.values(cmdFeats);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const cmdPath = path.join(feat.path, feat.name + "." + feat.ext);
|
|
24
|
-
const c = await readCmd(feat.name, cmdPath);
|
|
17
|
+
const usrCmds = [];
|
|
18
|
+
for (const feat of features) {
|
|
19
|
+
const cmdPath = path.join(feat.path, feat.name + "." + feat.ext);
|
|
20
|
+
const c = await readCmd(feat.name, cmdPath);
|
|
21
|
+
if (c) {
|
|
25
22
|
usrCmds.push(c);
|
|
26
23
|
}
|
|
27
|
-
endCmds = usrCmds;
|
|
28
24
|
}
|
|
29
|
-
return
|
|
25
|
+
return usrCmds;
|
|
30
26
|
}
|
|
31
27
|
async function resetDbCmd() {
|
|
32
28
|
if (runMode.value == "cli") {
|
|
@@ -176,7 +176,9 @@ async function executeTask(name, payload, options) {
|
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
if (!options?.quiet) {
|
|
180
|
+
printToken(t);
|
|
181
|
+
}
|
|
180
182
|
}
|
|
181
183
|
++emittedTokens;
|
|
182
184
|
};
|
|
@@ -241,7 +243,7 @@ async function executeTask(name, payload, options) {
|
|
|
241
243
|
}
|
|
242
244
|
}
|
|
243
245
|
if (!isChatMode.value || options?.isToolCall) {
|
|
244
|
-
if (options?.debug) {
|
|
246
|
+
if (options?.debug && mcpServers.length > 0) {
|
|
245
247
|
console.log("Closing", mcpServers.length, "mcp server(s)");
|
|
246
248
|
}
|
|
247
249
|
mcpServers.forEach((s) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
declare function executeWorkflow(wname: string, args: any, options?: Record<string, any>): Promise<any>;
|
|
2
2
|
declare function executeWorkflowCmd(name: string, wargs: Array<any>): Promise<any>;
|
|
3
|
-
export { executeWorkflow, executeWorkflowCmd
|
|
3
|
+
export { executeWorkflow, executeWorkflowCmd };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import colors from "ansi-colors";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { getFeatureSpec } from "../../../state/features.js";
|
|
1
4
|
import { executeAction } from "../actions/cmd.js";
|
|
2
5
|
import { executeAdaptater } from "../adaptaters/cmd.js";
|
|
3
6
|
import { parseCommandArgs } from "../options_parsers.js";
|
|
4
7
|
import { executeTask } from "../tasks/cmd.js";
|
|
5
8
|
import { getTaskPrompt } from "../tasks/utils.js";
|
|
6
|
-
import { readWorkflow } from "./read.js";
|
|
7
|
-
import colors from "ansi-colors";
|
|
8
|
-
import { getFeatureSpec } from "../../../state/features.js";
|
|
9
|
-
import { pathToFileURL } from "node:url";
|
|
10
9
|
import { runtimeError } from "../user_msgs.js";
|
|
10
|
+
import { readWorkflow } from "./read.js";
|
|
11
11
|
async function executeWorkflow(wname, args, options = {}) {
|
|
12
12
|
const { workflow, found } = await readWorkflow(wname);
|
|
13
13
|
if (!found) {
|
|
@@ -39,6 +39,13 @@ async function executeWorkflow(wname, args, options = {}) {
|
|
|
39
39
|
if (prevStepType == "task") {
|
|
40
40
|
tdata.prompt = taskRes.answer.text;
|
|
41
41
|
}
|
|
42
|
+
else if (prevStepType == "action") {
|
|
43
|
+
if (taskRes?.args) {
|
|
44
|
+
if (typeof taskRes.args == "string") {
|
|
45
|
+
tdata.prompt = taskRes.args;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
if (!tdata?.prompt) {
|
|
@@ -62,6 +69,13 @@ async function executeWorkflow(wname, args, options = {}) {
|
|
|
62
69
|
if (prevStepType == "task") {
|
|
63
70
|
tdata.prompt = taskRes.answer.text;
|
|
64
71
|
}
|
|
72
|
+
else if (prevStepType == "action") {
|
|
73
|
+
if (taskRes?.args) {
|
|
74
|
+
if (typeof taskRes.args == "string") {
|
|
75
|
+
tdata.prompt = taskRes.args;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
65
79
|
}
|
|
66
80
|
}
|
|
67
81
|
if (!tdata?.prompt) {
|
|
@@ -148,4 +162,4 @@ async function executeWorkflowCmd(name, wargs) {
|
|
|
148
162
|
const { args, options } = parseCommandArgs(wargs);
|
|
149
163
|
return await executeWorkflow(name, args, options);
|
|
150
164
|
}
|
|
151
|
-
export { executeWorkflow, executeWorkflowCmd
|
|
165
|
+
export { executeWorkflow, executeWorkflowCmd };
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { pathToFileURL } from 'url';
|
|
2
|
+
import { runtimeWarning } from "../lib/user_msgs.js";
|
|
2
3
|
async function readCmd(name, cmdPath) {
|
|
3
|
-
const cmds = new Array();
|
|
4
4
|
const url = pathToFileURL(cmdPath).href;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
let _cmd = null;
|
|
6
|
+
try {
|
|
7
|
+
const mod = await import(url);
|
|
8
|
+
_cmd = mod.cmd;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
catch (e) {
|
|
11
|
+
runtimeWarning(`command ${name} not found at ${cmdPath}, ${e}`);
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
if (!_cmd) {
|
|
15
|
+
throw new Error("no cmd");
|
|
16
|
+
}
|
|
17
|
+
return _cmd;
|
|
11
18
|
}
|
|
12
19
|
export { readCmd };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { argv } from 'process';
|
|
3
3
|
import { query } from "./cli.js";
|
|
4
|
+
import { resetDbCmd } from './cmd/clicmds/cmds.js';
|
|
5
|
+
import { updateConfCmd } from './cmd/clicmds/updateconf.js';
|
|
4
6
|
import { buildCmds, parseCmd } from './cmd/cmds.js';
|
|
5
7
|
import { formatMode, init, inputMode, isChatMode, outputMode, runMode } from './state/state.js';
|
|
6
|
-
import { updateConfCmd } from './cmd/clicmds/updateconf.js';
|
|
7
|
-
import { resetDbCmd } from './cmd/clicmds/cmds.js';
|
|
8
8
|
async function main() {
|
|
9
9
|
const nargs = argv.length;
|
|
10
10
|
if (nargs == 2) {
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { cmd as c4 } from "file:///home/ggg/dev/js/agent-smith-plugins/code/git/dist/cmds/commita.js";
|
|
5
|
-
import { cmd as c5 } from "file:///home/ggg/dev/js/agent-smith-plugins/vision/dist/cmds/imgs2base64.js";
|
|
6
|
-
import { cmd as c6 } from "file:///home/ggg/dev/js/snowind-astro/features/cmds/design-component.js";
|
|
7
|
-
import { cmd as c7 } from "file:///home/ggg/dev/js/docdundee/package/features/dist/cmds/tsdoccmd.js";
|
|
8
|
-
|
|
9
|
-
const cmds = [ c1, c2, c3, c4, c5, c6, c7 ];
|
|
10
|
-
const isCacheReady = true;
|
|
11
|
-
|
|
12
|
-
export { isCacheReady, cmds }
|
|
1
|
+
const cmds = new Array();
|
|
2
|
+
const isCacheReady = false;
|
|
3
|
+
export { cmds, isCacheReady, };
|
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.106",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
8
8
|
"build": "rm -rf dist/* && tsc",
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@agent-smith/agent": "^0.2.1",
|
|
14
|
-
"@agent-smith/task": "^0.2.1",
|
|
15
14
|
"@agent-smith/nodetask": "^0.1.0",
|
|
15
|
+
"@agent-smith/task": "^0.2.2",
|
|
16
16
|
"@agent-smith/tfm": "^0.2.0",
|
|
17
17
|
"@inquirer/prompts": "^8.2.0",
|
|
18
18
|
"@intrinsicai/gbnfgen": "0.12.0",
|
|
19
19
|
"@locallm/api": "^0.7.3",
|
|
20
20
|
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
21
|
-
"@vue/reactivity": "^3.5.
|
|
21
|
+
"@vue/reactivity": "^3.5.27",
|
|
22
22
|
"ansi-colors": "^4.1.3",
|
|
23
|
-
"better-sqlite3": "^12.6.
|
|
23
|
+
"better-sqlite3": "^12.6.2",
|
|
24
24
|
"clipboardy": "^5.0.2",
|
|
25
25
|
"commander": "^14.0.2",
|
|
26
26
|
"marked-terminal": "^7.3.0",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
37
37
|
"@types/better-sqlite3": "^7.6.13",
|
|
38
38
|
"@types/marked-terminal": "^6.1.1",
|
|
39
|
-
"@types/node": "^25.0.
|
|
39
|
+
"@types/node": "^25.0.9",
|
|
40
40
|
"openai": "^6.16.0",
|
|
41
41
|
"restmix": "^0.6.1",
|
|
42
|
-
"rollup": "^4.55.
|
|
43
|
-
"ts-node": "^
|
|
42
|
+
"rollup": "^4.55.2",
|
|
43
|
+
"ts-node": "^1.7.1",
|
|
44
44
|
"tslib": "2.8.1",
|
|
45
45
|
"typescript": "^5.9.3"
|
|
46
46
|
},
|