@agent-smith/cli 0.0.17 → 0.0.19

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 CHANGED
@@ -1,8 +1,7 @@
1
1
  import { LmTaskBuilder } from "@agent-smith/lmtask";
2
2
  import { marked } from 'marked';
3
- import { FeatureType, RunMode } from "./interfaces.js";
4
- declare let brain: import("@agent-smith/brain").AgentBrain;
5
- declare const modelsForExpert: Record<string, string>;
6
- declare const taskBuilder: LmTaskBuilder<FeatureType>;
7
- declare function initAgent(mode: RunMode, isVerbose?: boolean): Promise<boolean>;
8
- export { brain, initAgent, marked, modelsForExpert, taskBuilder };
3
+ import { FeatureType } from "./interfaces.js";
4
+ declare let brain: import("@agent-smith/brain").AgentBrain<Record<string, any>>;
5
+ declare const taskBuilder: LmTaskBuilder<FeatureType, Record<string, any>>;
6
+ declare function initAgent(isVerbose?: boolean): Promise<boolean>;
7
+ export { brain, initAgent, marked, taskBuilder };
package/dist/agent.js CHANGED
@@ -1,36 +1,40 @@
1
1
  import { useAgentBrain } from "@agent-smith/brain";
2
2
  import { LmTaskBuilder } from "@agent-smith/lmtask";
3
3
  import { marked } from 'marked';
4
- import { markedTerminal } from 'marked-terminal';
4
+ import { markedTerminal } from "marked-terminal";
5
5
  marked.use(markedTerminal());
6
6
  let brain = useAgentBrain();
7
- const modelsForExpert = {};
8
7
  const taskBuilder = new LmTaskBuilder(brain);
9
8
  async function initExperts() {
10
9
  brain.experts.forEach((ex) => {
11
- ex.backend.setOnStartEmit(() => console.log(""));
12
10
  ex.backend.setOnToken((t) => {
13
11
  process.stdout.write(t);
14
12
  });
15
13
  });
16
14
  }
17
- async function initAgent(mode, isVerbose = false) {
15
+ async function initAgent(isVerbose = false) {
18
16
  if (!brain.state.get().isOn) {
19
17
  brain.resetExperts();
20
- await brain.initLocal();
18
+ await brain.initLocal(true, isVerbose);
21
19
  await initExperts();
22
20
  }
23
21
  const brainUp = brain.state.get().isOn;
24
22
  if (isVerbose) {
25
23
  if (!brainUp) {
26
- console.log("❌ No experts found for inference");
24
+ console.log("❌ No backends found for inference");
27
25
  }
28
26
  else {
29
- brain.experts.forEach((ex) => {
30
- console.log(`✅ Expert ${ex.name} is up`);
27
+ brain.backends.forEach((b) => {
28
+ console.log(`✅ Backend ${b.name} is up`);
29
+ if (b.lm.providerType == "ollama") {
30
+ console.log(" Models:", b.lm.models.map(x => x.name));
31
+ }
32
+ else {
33
+ console.log(" Model:", b.lm.model.name);
34
+ }
31
35
  });
32
36
  }
33
37
  }
34
38
  return brainUp;
35
39
  }
36
- export { brain, initAgent, marked, modelsForExpert, taskBuilder };
40
+ export { brain, initAgent, marked, taskBuilder };
package/dist/cli.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare function query(_default?: string): Promise<void>;
1
+ declare function query(sign?: string): Promise<void>;
2
2
  export { query };
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { input } from '@inquirer/prompts';
2
- import { runCmd } from './cmd/cmds.js';
3
- import { lastCmd, inputMode } from './state/state.js';
4
- import { readPromptFile } from './cmd/lib/utils.js';
5
- import { readClipboard } from './cmd/sys/clipboard.js';
2
+ import { chat, runCmd } from './cmd/cmds.js';
3
+ import { isChatMode } from './state/state.js';
4
+ import { setOptions } from './cmd/lib/utils.js';
5
+ import { modes } from './cmd/clicmds/modes.js';
6
6
  function parseParams(params) {
7
7
  const regex = /"([^"]*)"|(\S+)/g;
8
8
  let match;
@@ -18,27 +18,38 @@ function parseParams(params) {
18
18
  return result;
19
19
  }
20
20
  async function dispatch(input) {
21
- let buf = new Array();
22
- buf = parseParams(input);
23
- const cmd = buf.shift();
24
- if (inputMode.value == "promptfile") {
25
- const p = readPromptFile();
26
- buf.push(p);
27
- }
28
- else if (inputMode.value == "clipboard") {
29
- const p = await readClipboard();
30
- buf.push(p);
21
+ if (input.startsWith("-")) {
22
+ try {
23
+ const _cmd = modes[input].cmd;
24
+ await _cmd([], {});
25
+ return;
26
+ }
27
+ catch (e) {
28
+ throw new Error(`Option error ${e}`);
29
+ }
31
30
  }
32
- await runCmd(cmd, buf);
31
+ const buf = new Array();
32
+ let params = parseParams(input);
33
+ const cmd = params.shift();
34
+ const opts = {};
35
+ params.forEach((p) => {
36
+ if (p.startsWith("-")) {
37
+ opts[p.substring(1)] = true;
38
+ }
39
+ else {
40
+ buf.push(p);
41
+ }
42
+ });
43
+ const args = await setOptions(buf, opts);
44
+ await runCmd(cmd, args);
33
45
  }
34
- async function query(_default) {
35
- const data = { message: '>', default: "" };
36
- if (_default) {
37
- data.default = _default;
46
+ async function query(sign = "$") {
47
+ const data = { message: sign, default: "" };
48
+ const q = await input(data);
49
+ await dispatch(q);
50
+ if (isChatMode.value) {
51
+ await chat();
38
52
  }
39
- const answer = await input(data);
40
- await dispatch(answer);
41
- const lc = lastCmd.name + " " + lastCmd.args.join(" ");
42
- await query(lc);
53
+ await query(sign);
43
54
  }
44
55
  export { query };
@@ -1,8 +1,8 @@
1
- import { formatMode, initFeatures, runMode } from "../../state/state.js";
1
+ import { formatMode, isChatMode } from "../../state/state.js";
2
2
  import { getFeatureSpec, readFeaturesDirs } from "../../state/features.js";
3
3
  import { readAliases, readFeatures } from "../../db/read.js";
4
- import { updateAliases, updateFeatures } from "../../db/write.js";
5
- import { updateConf } from "../../conf.js";
4
+ import { cleanupFeaturePaths, updateAliases, updateFeatures } from "../../db/write.js";
5
+ import { processConfPath } from "../../conf.js";
6
6
  import { executeActionCmd } from "../lib/execute_action.js";
7
7
  import { initAgent, marked, taskBuilder } from "../../agent.js";
8
8
  import { executeJobCmd, readJob } from "../lib/execute_job.js";
@@ -51,10 +51,6 @@ let cmds = {
51
51
  description: "process config file",
52
52
  args: "arguments: \n-path (required): the path to the config.yml file"
53
53
  },
54
- update: {
55
- cmd: _updateFeaturesCmd,
56
- description: "reparse the features dirs and update the list",
57
- }
58
54
  };
59
55
  function initAliases() {
60
56
  const aliases = readAliases();
@@ -90,26 +86,22 @@ async function initCmds() {
90
86
  return cmds;
91
87
  }
92
88
  async function pingCmd(args = [], options) {
93
- let _isVerbose = false;
94
- if (args.length > 0) {
95
- _isVerbose = args[0] == "verbose";
96
- }
97
- const isUp = await initAgent(runMode.value, _isVerbose);
89
+ const isUp = await initAgent(true);
98
90
  return isUp;
99
91
  }
100
- async function _updateFeaturesCmd(args = [], options) {
101
- await initFeatures();
102
- console.log("Features updated");
103
- }
104
92
  async function _updateConfCmd(args = [], options) {
105
93
  if (args.length == 0) {
106
94
  console.warn("Provide a config.yml file path");
107
95
  return;
108
96
  }
109
- const allPaths = await updateConf(args[0]);
97
+ const allPaths = await processConfPath(args[0]);
110
98
  const feats = readFeaturesDirs(allPaths);
111
99
  updateFeatures(feats);
112
100
  updateAliases(feats);
101
+ const deleted = cleanupFeaturePaths(allPaths);
102
+ for (const el of deleted) {
103
+ console.log("- [feature path]", el);
104
+ }
113
105
  }
114
106
  async function _readJobCmd(args = [], options) {
115
107
  if (args.length == 0) {
@@ -124,7 +116,7 @@ async function _executeTaskCmd(args = [], options) {
124
116
  console.warn("Provide a task name");
125
117
  return;
126
118
  }
127
- const { ok, data, error } = await executeTaskCmd(args, options);
119
+ const { ok, data, conf, error } = await executeTaskCmd(args, options);
128
120
  if (!ok) {
129
121
  console.warn(error);
130
122
  }
@@ -135,6 +127,8 @@ async function _executeTaskCmd(args = [], options) {
135
127
  else {
136
128
  console.log();
137
129
  }
130
+ if (isChatMode.value) {
131
+ }
138
132
  return data;
139
133
  }
140
134
  async function _executeJobCmd(args = [], options) {
@@ -160,8 +154,8 @@ async function _readTaskCmd(args = [], options) {
160
154
  if (!res.found) {
161
155
  throw new Error(`Task ${args[0]}, ${path} not found`);
162
156
  }
163
- const ts = taskBuilder.readFromYaml(path);
164
- console.log(ts);
157
+ const ts = taskBuilder.readFromYaml(res.ymlTask);
158
+ console.log(JSON.stringify(ts, null, " "));
165
159
  }
166
160
  async function _listTasksCmd(args = [], options) {
167
161
  Object.keys(readFeatures().task).forEach((t) => console.log("-", t));
@@ -1,11 +1,23 @@
1
- import { formatMode, inputMode, isDebug, outputMode, runMode } from "../../state/state.js";
1
+ import { formatMode, inputMode, isChatMode, isDebug, outputMode, runMode } from "../../state/state.js";
2
2
  const modes = {
3
3
  "-d": {
4
4
  cmd: async () => {
5
5
  isDebug.value = true;
6
+ if (runMode.value == "cli") {
7
+ console.log("Debug mode is on");
8
+ }
6
9
  },
7
10
  description: "use debug mode",
8
11
  },
12
+ "-c": {
13
+ cmd: async () => {
14
+ isChatMode.value = true;
15
+ if (runMode.value == "cli") {
16
+ console.log("Chat mode is on");
17
+ }
18
+ },
19
+ description: "use chat mode for tasks",
20
+ },
9
21
  "-if": {
10
22
  cmd: async () => {
11
23
  inputMode.value = "promptfile";
@@ -1,6 +1,7 @@
1
1
  import { Command } from "commander";
2
+ declare function chat(): Promise<void>;
2
3
  declare function initCliCmds(): Promise<void>;
3
4
  declare function runCmd(cmdName: string, args?: Array<string>): Promise<void>;
4
5
  declare function buildCmds(): Promise<Command>;
5
6
  declare function parseCmd(): Promise<void>;
6
- export { runCmd, buildCmds, parseCmd, initCliCmds };
7
+ export { buildCmds, initCliCmds, parseCmd, runCmd, chat };
package/dist/cmd/cmds.js CHANGED
@@ -1,11 +1,32 @@
1
+ import { input } from "@inquirer/prompts";
1
2
  import { Command } from "commander";
2
- import { lastCmd } from "../state/state.js";
3
+ import { brain } from "../agent.js";
4
+ import { isChatMode, lastCmd, runMode } from "../state/state.js";
5
+ import { cmds, initAliases, initCmds } from "./clicmds/cmds.js";
3
6
  import { modes } from "./clicmds/modes.js";
4
7
  import { processOutput, setOptions } from "./lib/utils.js";
5
- import { cmds, initAliases, initCmds } from "./clicmds/cmds.js";
8
+ import { query } from "../cli.js";
6
9
  let cliCmds = {};
10
+ async function chat() {
11
+ const data = { message: '>', default: "" };
12
+ const prompt = await input(data);
13
+ if (prompt == "/q") {
14
+ isChatMode.value = false;
15
+ if (runMode.value == "cmd") {
16
+ process.exit(0);
17
+ }
18
+ else {
19
+ await query();
20
+ }
21
+ }
22
+ await brain.ex.think(prompt);
23
+ console.log();
24
+ await chat();
25
+ }
7
26
  async function initCliCmds() {
8
- cliCmds = await initCmds();
27
+ const _cmds = await initCmds();
28
+ const _alias = initAliases();
29
+ cliCmds = { ..._cmds, ..._alias };
9
30
  }
10
31
  async function runCmd(cmdName, args = []) {
11
32
  if (!(cmdName in cliCmds)) {
@@ -23,7 +44,7 @@ async function buildCmds() {
23
44
  for (const [name, spec] of Object.entries({ ...cmds, ...aliases })) {
24
45
  const cmd = program.command(name);
25
46
  const _cmd = async (args = [], options = {}) => {
26
- const _args = await setOptions(options, args);
47
+ const _args = await setOptions(args, options);
27
48
  const res = await spec.cmd(_args, options);
28
49
  await processOutput(res);
29
50
  return res;
@@ -49,5 +70,9 @@ async function buildCmds() {
49
70
  async function parseCmd() {
50
71
  const program = await buildCmds();
51
72
  await program.parseAsync();
73
+ if (isChatMode.value) {
74
+ await chat();
75
+ }
52
76
  }
53
- export { runCmd, buildCmds, parseCmd, initCliCmds };
77
+ export { buildCmds, initCliCmds, parseCmd, runCmd, chat };
78
+ ;
@@ -4,6 +4,7 @@ import { readYmlAction } from "../sys/read_yml_action.js";
4
4
  import { execute } from "../sys/execute.js";
5
5
  import { runPyScript } from "../sys/run_python.js";
6
6
  import { pyShell } from "../../state/state.js";
7
+ import { processOutput } from "./utils.js";
7
8
  function _systemAction(path) {
8
9
  const action = useAgentTask({
9
10
  id: "system_action",
@@ -47,12 +48,12 @@ async function executeActionCmd(args = [], options = {}, quiet = false) {
47
48
  break;
48
49
  default:
49
50
  throw new Error(`Action ext ${ext} not implemented`);
50
- break;
51
51
  }
52
52
  const res = await act.run(args, options);
53
53
  if (!quiet) {
54
54
  console.log(res.data);
55
55
  }
56
+ await processOutput(res);
56
57
  return { ok: true, data: res.data, error: "" };
57
58
  }
58
59
  export { executeActionCmd };
@@ -1,10 +1,14 @@
1
1
  import { brain, initAgent, taskBuilder } from "../../agent.js";
2
2
  import { getFeatureSpec } from "../../state/features.js";
3
- import { inputMode, isDebug, runMode } from "../../state/state.js";
3
+ import { inputMode, isChatMode, isDebug } from "../../state/state.js";
4
4
  import { initTaskVars, readPromptFile, readTask } from "./utils.js";
5
5
  import { readClipboard } from "../sys/clipboard.js";
6
6
  async function executeTaskCmd(args = [], options = {}) {
7
- await initAgent(runMode.value);
7
+ await initAgent();
8
+ if (isDebug.value) {
9
+ console.log("Task args:", args);
10
+ console.log("Task options:", options);
11
+ }
8
12
  const name = args.shift();
9
13
  const params = args.filter((x) => x.length > 0);
10
14
  let pr;
@@ -22,7 +26,7 @@ async function executeTaskCmd(args = [], options = {}) {
22
26
  }
23
27
  const { found, path } = getFeatureSpec(name, "task");
24
28
  if (!found) {
25
- return { ok: false, data: {}, error: `Task ${name} not found` };
29
+ return { ok: false, data: "", conf: {}, error: `Task ${name} not found` };
26
30
  }
27
31
  const res = readTask(path);
28
32
  if (!res.found) {
@@ -31,6 +35,10 @@ async function executeTaskCmd(args = [], options = {}) {
31
35
  const taskSpec = taskBuilder.readFromYaml(res.ymlTask);
32
36
  const task = taskBuilder.fromYaml(res.ymlTask);
33
37
  const { conf, vars } = initTaskVars(args);
38
+ if (isDebug.value) {
39
+ console.log("Task conf:", conf);
40
+ console.log("Task vars:", vars);
41
+ }
34
42
  let m = taskSpec.model.name;
35
43
  let t = taskSpec.template.name;
36
44
  if (conf?.model) {
@@ -51,10 +59,20 @@ async function executeTaskCmd(args = [], options = {}) {
51
59
  if (isDebug.value) {
52
60
  conf.debug = true;
53
61
  }
62
+ if (isDebug.value) {
63
+ console.log("Vars", vars);
64
+ }
54
65
  const data = await task.run({ prompt: pr, ...vars }, conf);
55
66
  if (data?.error) {
56
- return { ok: false, data: {}, error: `Error executing task: ${data.error}` };
67
+ return { ok: false, data: "", conf: conf, error: `Error executing task: ${data.error}` };
68
+ }
69
+ conf.prompt = pr;
70
+ if (isChatMode.value) {
71
+ if (brain.ex.name != ex.name) {
72
+ brain.setDefaultExpert(ex);
73
+ }
74
+ brain.ex.template.pushToHistory({ user: pr, assistant: data.text });
57
75
  }
58
- return { ok: true, data: data.text, error: "" };
76
+ return { ok: true, data: data.text, conf: conf, error: "" };
59
77
  }
60
78
  export { executeTaskCmd };
@@ -1,4 +1,4 @@
1
- declare function setOptions(options: Record<string, any>, args?: Array<string>): Promise<Array<string>>;
1
+ declare function setOptions(args: Array<string> | undefined, options: Record<string, any>): Promise<Array<string>>;
2
2
  declare function readPromptFile(): string;
3
3
  declare function processOutput(res: any): Promise<void>;
4
4
  declare function readTask(taskpath: string): {
@@ -1,14 +1,10 @@
1
1
  import { default as fs } from "fs";
2
2
  import { default as path } from "path";
3
3
  import { outputMode, promptfile } from "../../state/state.js";
4
- import { inputMode, runMode } from "../../state/state.js";
4
+ import { inputMode } from "../../state/state.js";
5
5
  import { readClipboard, writeToClipboard } from "../sys/clipboard.js";
6
6
  import { modes } from "../clicmds/modes.js";
7
- async function setOptions(options, args = []) {
8
- if (runMode.value == "cli") {
9
- return args;
10
- }
11
- ;
7
+ async function setOptions(args = [], options) {
12
8
  for (const k of Object.keys(options)) {
13
9
  const opt = modes["-" + k.toLowerCase()];
14
10
  await opt.cmd([], undefined);
@@ -28,6 +24,9 @@ function readPromptFile() {
28
24
  return res;
29
25
  }
30
26
  async function processOutput(res) {
27
+ if (!(outputMode.value == "clipboard")) {
28
+ return;
29
+ }
31
30
  let data = "";
32
31
  if (typeof res == "object") {
33
32
  let hasOutput = false;
@@ -88,6 +87,14 @@ function initTaskVars(args) {
88
87
  conf.model = v;
89
88
  }
90
89
  }
90
+ else if (k == "ip") {
91
+ const ip = {};
92
+ v.split(",").forEach((p) => {
93
+ const s = p.split(":");
94
+ ip[s[0]] = parseFloat(s[1]);
95
+ });
96
+ conf.inferParams = ip;
97
+ }
91
98
  else {
92
99
  vars[k] = v;
93
100
  }
package/dist/conf.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare const confDir: string;
2
2
  declare const dbPath: string;
3
3
  declare function createConfDirIfNotExists(): boolean;
4
- declare function updateConf(confPath: string): Promise<Array<string>>;
5
- export { confDir, dbPath, createConfDirIfNotExists, updateConf, };
4
+ declare function processConfPath(confPath: string): Promise<Array<string>>;
5
+ export { confDir, dbPath, createConfDirIfNotExists, processConfPath, };
package/dist/conf.js CHANGED
@@ -12,7 +12,7 @@ function createConfDirIfNotExists() {
12
12
  }
13
13
  return true;
14
14
  }
15
- async function updateConf(confPath) {
15
+ async function processConfPath(confPath) {
16
16
  const { found, data } = readConf(confPath);
17
17
  if (!found) {
18
18
  console.warn(`Config file ${confPath} not found`);
@@ -37,4 +37,4 @@ async function updateConf(confPath) {
37
37
  }
38
38
  return allPaths;
39
39
  }
40
- export { confDir, dbPath, createConfDirIfNotExists, updateConf, };
40
+ export { confDir, dbPath, createConfDirIfNotExists, processConfPath, };
@@ -2,6 +2,7 @@ import { Features } from "../interfaces.js";
2
2
  declare function insertDefaultFilepaths(): void;
3
3
  declare function insertFeaturesPathIfNotExists(path: string): boolean;
4
4
  declare function insertPluginIfNotExists(n: string, p: string): boolean;
5
+ declare function cleanupFeaturePaths(paths: Array<string>): Array<string>;
5
6
  declare function updateAliases(feats: Features): void;
6
7
  declare function updateFeatures(feats: Features): void;
7
- export { insertDefaultFilepaths, insertFeaturesPathIfNotExists, insertPluginIfNotExists, updateFeatures, updateAliases, };
8
+ export { insertDefaultFilepaths, insertFeaturesPathIfNotExists, insertPluginIfNotExists, updateFeatures, updateAliases, cleanupFeaturePaths, };
package/dist/db/write.js CHANGED
@@ -29,6 +29,19 @@ function insertPluginIfNotExists(n, p) {
29
29
  stmt.run(n, p);
30
30
  return false;
31
31
  }
32
+ function cleanupFeaturePaths(paths) {
33
+ const stmt = db.prepare("SELECT path FROM featurespath");
34
+ const rows = stmt.all();
35
+ const deleted = new Array();
36
+ for (const entry of rows) {
37
+ if (!paths.includes(entry.path)) {
38
+ const deleteStmt = db.prepare("DELETE FROM featurespath WHERE path = ?");
39
+ deleteStmt.run(entry.path);
40
+ deleted.push(entry.path);
41
+ }
42
+ }
43
+ return deleted;
44
+ }
32
45
  function _updateAlias(existingAliases, name, type) {
33
46
  if (!existingAliases.includes(name)) {
34
47
  const insertStmt = db.prepare("INSERT INTO aliases (name, type) VALUES (?, ?)");
@@ -58,17 +71,19 @@ function upsertAndCleanFeatures(feats, type) {
58
71
  const stmt = db.prepare(`SELECT name FROM ${type}`);
59
72
  const rows = stmt.all();
60
73
  const names = rows.map(row => row.name);
61
- feats.forEach((feat) => {
62
- if (!names.includes(feat.name)) {
63
- const insertStmt = db.prepare(`INSERT INTO ${type} (name, path, ext) VALUES (?, ?, ?)`);
64
- insertStmt.run(feat.name, feat.path, feat.ext);
65
- }
66
- });
67
74
  const availableFeatsNames = feats.map((f) => f.name);
68
75
  names.forEach((name) => {
69
76
  if (!availableFeatsNames.includes(name)) {
70
77
  const deleteStmt = db.prepare(`DELETE FROM ${type} WHERE name = ?`);
71
78
  deleteStmt.run(name);
79
+ console.log("-", "[" + type + "]", name);
80
+ }
81
+ });
82
+ feats.forEach((feat) => {
83
+ if (!names.includes(feat.name)) {
84
+ const insertStmt = db.prepare(`INSERT INTO ${type} (name, path, ext) VALUES (?, ?, ?)`);
85
+ insertStmt.run(feat.name, feat.path, feat.ext);
86
+ console.log("+", "[" + type + "]", feat.name, feat.path);
72
87
  }
73
88
  });
74
89
  }
@@ -78,4 +93,4 @@ function updateFeatures(feats) {
78
93
  upsertAndCleanFeatures(feats.action, "action");
79
94
  upsertAndCleanFeatures(feats.cmd, "cmd");
80
95
  }
81
- export { insertDefaultFilepaths, insertFeaturesPathIfNotExists, insertPluginIfNotExists, updateFeatures, updateAliases, };
96
+ export { insertDefaultFilepaths, insertFeaturesPathIfNotExists, insertPluginIfNotExists, updateFeatures, updateAliases, cleanupFeaturePaths, };
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ async function main() {
9
9
  runMode.value = "cli";
10
10
  }
11
11
  await initState();
12
- await initCliCmds();
13
- await initAgent(runMode.value);
12
+ await initAgent();
14
13
  switch (runMode.value) {
15
14
  case "cli":
15
+ await initCliCmds();
16
16
  await query();
17
17
  break;
18
18
  default:
@@ -5,6 +5,7 @@ declare const inputMode: import("@vue/reactivity").Ref<InputMode, InputMode>;
5
5
  declare const outputMode: import("@vue/reactivity").Ref<OutputMode, OutputMode>;
6
6
  declare const runMode: import("@vue/reactivity").Ref<RunMode, RunMode>;
7
7
  declare const formatMode: import("@vue/reactivity").Ref<FormatMode, FormatMode>;
8
+ declare const isChatMode: import("@vue/reactivity").Ref<boolean, boolean>;
8
9
  declare const isDebug: import("@vue/reactivity").Ref<boolean, boolean>;
9
10
  declare const promptfile: import("@vue/reactivity").Ref<string, string>;
10
11
  declare const lastCmd: {
@@ -13,4 +14,4 @@ declare const lastCmd: {
13
14
  };
14
15
  declare function initFeatures(): Promise<void>;
15
16
  declare function initState(): Promise<void>;
16
- export { inputMode, outputMode, runMode, formatMode, lastCmd, isDebug, promptfile, initState, initFeatures, pyShell, };
17
+ export { inputMode, outputMode, isChatMode, runMode, formatMode, lastCmd, isDebug, promptfile, initState, initFeatures, pyShell, };
@@ -10,6 +10,7 @@ const inputMode = ref("manual");
10
10
  const outputMode = ref("txt");
11
11
  const runMode = ref("cmd");
12
12
  const formatMode = ref("text");
13
+ const isChatMode = ref(false);
13
14
  const isDebug = ref(false);
14
15
  const promptfile = ref("");
15
16
  const lastCmd = reactive({
@@ -35,4 +36,4 @@ async function initState() {
35
36
  initConf();
36
37
  await initFeatures();
37
38
  }
38
- export { inputMode, outputMode, runMode, formatMode, lastCmd, isDebug, promptfile, initState, initFeatures, pyShell, };
39
+ export { inputMode, outputMode, isChatMode, runMode, formatMode, lastCmd, isDebug, promptfile, initState, initFeatures, pyShell, };
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.17",
5
+ "version": "0.0.19",
6
6
  "scripts": {
7
7
  "buildrl": "rm -rf dist/* && rollup -c",
8
8
  "build": "rm -rf dist/* && tsc",
@@ -10,34 +10,34 @@
10
10
  "watch": "tsc -p . -w"
11
11
  },
12
12
  "dependencies": {
13
- "@agent-smith/brain": "^0.0.31",
13
+ "@agent-smith/brain": "^0.0.33",
14
14
  "@agent-smith/jobs": "^0.0.11",
15
- "@agent-smith/lmtask": "^0.0.22",
16
- "@inquirer/prompts": "^7.0.0",
17
- "@inquirer/select": "^4.0.0",
15
+ "@agent-smith/lmtask": "^0.0.24",
16
+ "@inquirer/prompts": "^7.0.1",
17
+ "@inquirer/select": "^4.0.1",
18
18
  "@vue/reactivity": "^3.5.12",
19
- "better-sqlite3": "^11.3.0",
19
+ "better-sqlite3": "^11.5.0",
20
20
  "clipboardy": "^4.0.0",
21
21
  "commander": "^12.1.0",
22
22
  "draftlog": "^1.0.13",
23
- "marked-terminal": "^7.1.0",
24
- "modprompt": "^0.8.1",
23
+ "marked-terminal": "^7.2.1",
24
+ "modprompt": "^0.9.1",
25
25
  "python-shell": "^5.0.0",
26
- "yaml": "^2.5.1"
26
+ "yaml": "^2.6.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@agent-smith/tmem-jobs": "^0.0.4",
30
30
  "@commander-js/extra-typings": "^12.1.0",
31
31
  "@locallm/types": "^0.1.5",
32
32
  "@rollup/plugin-node-resolve": "^15.3.0",
33
- "@rollup/plugin-typescript": "^12.1.0",
33
+ "@rollup/plugin-typescript": "^12.1.1",
34
34
  "@types/better-sqlite3": "^7.6.11",
35
35
  "@types/marked-terminal": "^6.1.1",
36
- "@types/node": "^22.7.5",
36
+ "@types/node": "^22.8.5",
37
37
  "restmix": "^0.5.0",
38
- "rollup": "^4.24.0",
38
+ "rollup": "^4.24.3",
39
39
  "ts-node": "^10.9.2",
40
- "tslib": "2.7.0",
40
+ "tslib": "2.8.0",
41
41
  "typescript": "^5.6.3"
42
42
  },
43
43
  "type": "module",