@agent-smith/cli 0.0.4 → 0.0.5
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 -2
- package/dist/agent.js +3 -12
- package/dist/cmd/clicmds/cmds.js +3 -3
- package/dist/cmd/clicmds/modes.js +2 -2
- package/dist/cmd/lib/execute_job.js +8 -1
- package/dist/cmd/lib/execute_task.js +1 -2
- package/dist/cmd/lib/utils.js +1 -1
- package/dist/state/state.js +1 -1
- package/package.json +2 -2
package/dist/agent.d.ts
CHANGED
|
@@ -10,6 +10,5 @@ declare const taskReader: {
|
|
|
10
10
|
};
|
|
11
11
|
readDir: (dir: string) => Array<string>;
|
|
12
12
|
};
|
|
13
|
-
declare function clearOutput(): void;
|
|
14
13
|
declare function initAgent(mode: RunMode, isVerbose?: boolean): Promise<boolean>;
|
|
15
|
-
export { brain, initAgent,
|
|
14
|
+
export { brain, initAgent, marked, modelsForExpert, taskReader };
|
package/dist/agent.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useAgentBrain } from "@agent-smith/brain";
|
|
2
2
|
import { useLmTask } from "@agent-smith/lmtask";
|
|
3
|
-
|
|
3
|
+
;
|
|
4
4
|
import { marked } from 'marked';
|
|
5
5
|
import { markedTerminal } from 'marked-terminal';
|
|
6
|
-
import { formatMode } from "./state/state.js";
|
|
7
6
|
marked.use(markedTerminal());
|
|
8
7
|
let brain = useAgentBrain();
|
|
9
8
|
const modelsForExpert = {};
|
|
@@ -12,18 +11,10 @@ async function initExperts() {
|
|
|
12
11
|
brain.experts.forEach((ex) => {
|
|
13
12
|
ex.setOnStartEmit(() => console.log(""));
|
|
14
13
|
ex.setOnToken((t) => {
|
|
15
|
-
|
|
16
|
-
logUpdate(marked.parse(ex.stream.get() + t).trim());
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
logUpdate((ex.stream.get() + t).trim());
|
|
20
|
-
}
|
|
14
|
+
process.stdout.write(t);
|
|
21
15
|
});
|
|
22
16
|
});
|
|
23
17
|
}
|
|
24
|
-
function clearOutput() {
|
|
25
|
-
logUpdate.clear();
|
|
26
|
-
}
|
|
27
18
|
async function initAgent(mode, isVerbose = false) {
|
|
28
19
|
if (!brain.state.get().isOn) {
|
|
29
20
|
brain.resetExperts();
|
|
@@ -44,4 +35,4 @@ async function initAgent(mode, isVerbose = false) {
|
|
|
44
35
|
}
|
|
45
36
|
return brainUp;
|
|
46
37
|
}
|
|
47
|
-
export { brain, initAgent,
|
|
38
|
+
export { brain, initAgent, marked, modelsForExpert, taskReader };
|
package/dist/cmd/clicmds/cmds.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readFeatures } from "../../db/read.js";
|
|
|
4
4
|
import { updateFeatures } from "../../db/write.js";
|
|
5
5
|
import { updateConf } from "../../conf.js";
|
|
6
6
|
import { executeActionCmd } from "../lib/execute_action.js";
|
|
7
|
-
import {
|
|
7
|
+
import { initAgent, marked, taskReader } from "../../agent.js";
|
|
8
8
|
import { executeJobCmd, readJob } from "../lib/execute_job.js";
|
|
9
9
|
import { executeTaskCmd } from "../lib/execute_task.js";
|
|
10
10
|
import { readCmds } from "../sys/read_cmds.js";
|
|
@@ -101,12 +101,12 @@ async function _executeTaskCmd(args = [], options) {
|
|
|
101
101
|
if (!ok) {
|
|
102
102
|
console.warn(error);
|
|
103
103
|
}
|
|
104
|
-
clearOutput();
|
|
105
104
|
if (formatMode.value == "markdown") {
|
|
105
|
+
console.log("\n\n------------------\n");
|
|
106
106
|
console.log(marked.parse(data).trim());
|
|
107
107
|
}
|
|
108
108
|
else {
|
|
109
|
-
console.log(
|
|
109
|
+
console.log();
|
|
110
110
|
}
|
|
111
111
|
return data;
|
|
112
112
|
}
|
|
@@ -43,13 +43,13 @@ const modes = {
|
|
|
43
43
|
console.log("Markdown output mode");
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
description: "use markdown output
|
|
46
|
+
description: "use markdown output"
|
|
47
47
|
},
|
|
48
48
|
"-otxt": {
|
|
49
49
|
cmd: async () => {
|
|
50
50
|
formatMode.value = "text";
|
|
51
51
|
if (runMode.value == "cli") {
|
|
52
|
-
console.log("Text output mode");
|
|
52
|
+
console.log("Text output mode (default)");
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
description: "use text output "
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import YAML from 'yaml';
|
|
2
2
|
import { default as fs } from "fs";
|
|
3
3
|
import { useAgentJob } from "@agent-smith/jobs";
|
|
4
|
-
import { brain, taskReader } from '../../agent.js';
|
|
4
|
+
import { brain, marked, taskReader } from '../../agent.js';
|
|
5
5
|
import { getFeatureSpec } from '../../state/features.js';
|
|
6
|
+
import { formatMode } from '../../state/state.js';
|
|
6
7
|
async function executeJobCmd(name, args = []) {
|
|
7
8
|
const { job, found } = await _dispatchReadJob(name);
|
|
8
9
|
if (!found) {
|
|
@@ -16,6 +17,12 @@ async function executeJobCmd(name, args = []) {
|
|
|
16
17
|
brain.expertsForModelsInfo();
|
|
17
18
|
try {
|
|
18
19
|
res = await job.runTask(name, params);
|
|
20
|
+
if ("text" in res) {
|
|
21
|
+
if (formatMode.value == "markdown") {
|
|
22
|
+
console.log("\n\n------------------\n");
|
|
23
|
+
console.log(marked.parse(res.text).trim());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
27
|
catch (err) {
|
|
21
28
|
console.log("ERR", err);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { initAgent, taskReader } from "../../agent.js";
|
|
2
|
-
import logUpdate from "log-update";
|
|
3
2
|
import { getFeatureSpec } from "../../state/features.js";
|
|
4
3
|
import { runMode } from "../../state/state.js";
|
|
5
4
|
async function executeTaskCmd(args = [], options = {}) {
|
|
@@ -18,7 +17,7 @@ async function executeTaskCmd(args = [], options = {}) {
|
|
|
18
17
|
vars[t[0]] = t[1];
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
|
-
|
|
20
|
+
console.log("Ingesting prompt ...");
|
|
22
21
|
const data = await task.run({ prompt: pr, ...vars });
|
|
23
22
|
if (data?.error) {
|
|
24
23
|
return { ok: false, data: {}, error: `Error executing task: ${data.error}` };
|
package/dist/cmd/lib/utils.js
CHANGED
package/dist/state/state.js
CHANGED
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.5",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
8
8
|
"build": "rm -rf dist/* && tsc",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"better-sqlite3": "^11.2.1",
|
|
20
20
|
"clipboardy": "^4.0.0",
|
|
21
21
|
"commander": "^12.1.0",
|
|
22
|
-
"
|
|
22
|
+
"draftlog": "^1.0.13",
|
|
23
23
|
"marked-terminal": "^7.1.0",
|
|
24
24
|
"modprompt": "^0.7.7",
|
|
25
25
|
"python-shell": "^5.0.0",
|