@agent-smith/cli 0.0.112 → 0.0.114

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.
@@ -59,8 +59,8 @@ async function updateConfCmd(args) {
59
59
  else {
60
60
  confPath = path;
61
61
  }
62
- console.log("Using", confPath, "to update features");
63
62
  const { paths, pf, dd } = await processConfPath(confPath);
63
+ console.log("Using", confPath, "to update features at", paths);
64
64
  if (pf.length > 0) {
65
65
  updatePromptfilePath(pf);
66
66
  promptfilePath.value = pf;
@@ -246,7 +246,7 @@ async function executeTask(name, payload, options) {
246
246
  const onToolCall = options?.onToolCall ?? _onToolCall;
247
247
  const _onToolCallEnd = (tr) => {
248
248
  if (options?.debug) {
249
- console.log(tr);
249
+ console.log("TOOL RESULT", tr);
250
250
  }
251
251
  };
252
252
  const onToolCallEnd = options?.onToolCallEnd ?? _onToolCallEnd;
package/dist/conf.d.ts CHANGED
@@ -1,12 +1,14 @@
1
+ import { type ConfigFile } from "./interfaces.js";
1
2
  declare function getConfigPath(appName: string, filename: string): {
2
3
  confDir: string;
3
4
  dbPath: string;
4
5
  };
5
6
  declare const confDir: string, dbPath: string;
7
+ declare function updateConfigFile(conf: ConfigFile, cfp?: string): string;
6
8
  declare function createConfigFile(cfp?: string): string;
7
9
  declare function processConfPath(confPath: string): Promise<{
8
10
  paths: Array<string>;
9
11
  pf: string;
10
12
  dd: string;
11
13
  }>;
12
- export { confDir, dbPath, processConfPath, getConfigPath, createConfigFile, };
14
+ export { confDir, dbPath, processConfPath, getConfigPath, createConfigFile, updateConfigFile, };
package/dist/conf.js CHANGED
@@ -28,11 +28,25 @@ function getConfigPath(appName, filename) {
28
28
  return { confDir: confDir, dbPath: dbPath };
29
29
  }
30
30
  const { confDir, dbPath } = getConfigPath("agent-smith", "config.db");
31
+ function updateConfigFile(conf, cfp) {
32
+ const fp = cfp ? cfp : path.join(confDir, "config.yml");
33
+ const txt = yaml.stringify(conf);
34
+ if (!fs.existsSync(fp)) {
35
+ const err = `Config file ${fp} does not exist`;
36
+ throw new Error(err);
37
+ }
38
+ try {
39
+ fs.writeFileSync(fp, txt, { encoding: 'utf8' });
40
+ }
41
+ catch (e) {
42
+ throw new Error(`Error creating config file at ${fp}: ${e}`);
43
+ }
44
+ return fp;
45
+ }
31
46
  function createConfigFile(cfp) {
32
47
  createDirectoryIfNotExists(confDir);
33
48
  const fp = cfp ? cfp : path.join(confDir, "config.yml");
34
49
  const fc = {
35
- promptfile: "",
36
50
  backends: {
37
51
  default: "llamacpp",
38
52
  local: ["llamacpp", "koboldcpp", "ollama"],
@@ -40,15 +54,16 @@ function createConfigFile(cfp) {
40
54
  type: "openai",
41
55
  url: "http://localhost:8080/v1"
42
56
  }
43
- }
57
+ },
58
+ promptfile: "",
44
59
  };
45
60
  const txt = yaml.stringify(fc);
61
+ if (fs.existsSync(fp)) {
62
+ const err = `Config file ${fp} already exists`;
63
+ throw new Error(err);
64
+ }
46
65
  try {
47
- if (fs.existsSync(fp)) {
48
- const err = `Config file ${fp} already exists`;
49
- throw new Error(err);
50
- }
51
- fs.writeFileSync(fp, txt);
66
+ fs.writeFileSync(fp, txt, { encoding: 'utf8' });
52
67
  }
53
68
  catch (e) {
54
69
  throw new Error(`Error creating config file at ${fp}: ${e}`);
@@ -148,4 +163,4 @@ async function processConfPath(confPath) {
148
163
  }
149
164
  return { paths: allPaths, pf: pf, dd: dd };
150
165
  }
151
- export { confDir, dbPath, processConfPath, getConfigPath, createConfigFile, };
166
+ export { confDir, dbPath, processConfPath, getConfigPath, createConfigFile, updateConfigFile, };
package/dist/main.d.ts CHANGED
@@ -21,6 +21,7 @@ import { getTaskSettings } from "./state/tasks.js";
21
21
  import { upsertTaskSettings } from "./db/write.js";
22
22
  import { initDb } from "./db/db.js";
23
23
  import { updateConfCmd } from "./cmd/clicmds/updateconf.js";
24
+ import { updateConfigFile, processConfPath } from "./conf.js";
24
25
  declare const db: {
25
26
  init: typeof initDb;
26
27
  readFilePaths: typeof readFilePaths;
@@ -32,4 +33,4 @@ declare const db: {
32
33
  declare const fs: {
33
34
  openTaskSpec: typeof openTaskSpec;
34
35
  };
35
- export { execute, run, executeTask, executeAction, executeWorkflow, writeToClipboard, initState, init, pluginDataDir, usePerfTimer, parseCommandArgs, extractToolDoc, openTaskSpec, extractBetweenTags, splitThinking, displayOptions, ioOptions, inferenceOptions, allOptions, isStateReady, backend, McpClient, readTask, FeatureType, getConfigPath, readConf, TaskSettings, db, fs, createConfigFile, updateConfCmd, };
36
+ export { execute, run, executeTask, executeAction, executeWorkflow, writeToClipboard, initState, init, pluginDataDir, usePerfTimer, parseCommandArgs, extractToolDoc, openTaskSpec, extractBetweenTags, splitThinking, displayOptions, ioOptions, inferenceOptions, allOptions, isStateReady, backend, McpClient, readTask, FeatureType, getConfigPath, readConf, TaskSettings, db, fs, createConfigFile, updateConfCmd, updateConfigFile, processConfPath, };
package/dist/main.js CHANGED
@@ -20,6 +20,7 @@ import { getTaskSettings } from "./state/tasks.js";
20
20
  import { upsertTaskSettings } from "./db/write.js";
21
21
  import { initDb } from "./db/db.js";
22
22
  import { updateConfCmd } from "./cmd/clicmds/updateconf.js";
23
+ import { updateConfigFile, processConfPath } from "./conf.js";
23
24
  const db = {
24
25
  init: initDb,
25
26
  readFilePaths,
@@ -31,4 +32,4 @@ const db = {
31
32
  const fs = {
32
33
  openTaskSpec,
33
34
  };
34
- export { execute, run, executeTask, executeAction, executeWorkflow, writeToClipboard, initState, init, pluginDataDir, usePerfTimer, parseCommandArgs, extractToolDoc, openTaskSpec, extractBetweenTags, splitThinking, displayOptions, ioOptions, inferenceOptions, allOptions, isStateReady, backend, McpClient, readTask, getConfigPath, readConf, db, fs, createConfigFile, updateConfCmd, };
35
+ export { execute, run, executeTask, executeAction, executeWorkflow, writeToClipboard, initState, init, pluginDataDir, usePerfTimer, parseCommandArgs, extractToolDoc, openTaskSpec, extractBetweenTags, splitThinking, displayOptions, ioOptions, inferenceOptions, allOptions, isStateReady, backend, McpClient, readTask, getConfigPath, readConf, db, fs, createConfigFile, updateConfCmd, updateConfigFile, processConfPath, };
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@agent-smith/cli",
3
3
  "description": "Agent Smith: terminal client for language model agents",
4
- "version": "0.0.112",
4
+ "version": "0.0.114",
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/agent": "^0.3.2",
12
- "@agent-smith/nodetask": "^0.2.0",
13
- "@agent-smith/task": "^0.3.2",
11
+ "@agent-smith/agent": "^0.3.3",
12
+ "@agent-smith/nodetask": "^0.2.1",
13
+ "@agent-smith/task": "^0.3.3",
14
14
  "@agent-smith/tfm": "^0.2.0",
15
15
  "@inquirer/prompts": "^8.3.0",
16
16
  "@intrinsicai/gbnfgen": "^0.12.0",
@@ -22,7 +22,7 @@
22
22
  "clipboardy": "^5.3.1",
23
23
  "commander": "^14.0.3",
24
24
  "marked-terminal": "^7.3.0",
25
- "modprompt": "^0.14.1",
25
+ "modprompt": "^0.14.2",
26
26
  "ora": "^9.3.0",
27
27
  "python-shell": "^5.0.0",
28
28
  "yaml": "^2.8.2"