@agent-smith/cli 0.0.111 → 0.0.113

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.
@@ -254,6 +254,7 @@ async function executeTask(name, payload, options) {
254
254
  const onToolsTurnEnd = options?.onToolsTurnEnd ?? undefined;
255
255
  const onTurnEnd = options?.onTurnEnd ?? undefined;
256
256
  const onAssistant = options?.onAssistant ?? undefined;
257
+ const onThink = options?.onThink ?? undefined;
257
258
  //console.log("OOT", options?.onToken, "/", processToken);
258
259
  if (options?.onToken) {
259
260
  task.agent.lm.onToken = options.onToken;
@@ -278,6 +279,7 @@ async function executeTask(name, payload, options) {
278
279
  onToolsTurnEnd: onToolsTurnEnd,
279
280
  onTurnEnd: onTurnEnd,
280
281
  onAssistant: onAssistant,
282
+ onThink: onThink,
281
283
  ...conf,
282
284
  };
283
285
  if (options?.history) {
package/dist/conf.d.ts CHANGED
@@ -3,9 +3,10 @@ declare function getConfigPath(appName: string, filename: string): {
3
3
  dbPath: string;
4
4
  };
5
5
  declare const confDir: string, dbPath: string;
6
+ declare function createConfigFile(cfp?: string): string;
6
7
  declare function processConfPath(confPath: string): Promise<{
7
8
  paths: Array<string>;
8
9
  pf: string;
9
10
  dd: string;
10
11
  }>;
11
- export { confDir, dbPath, processConfPath, getConfigPath, };
12
+ export { confDir, dbPath, processConfPath, getConfigPath, createConfigFile, };
package/dist/conf.js CHANGED
@@ -1,3 +1,4 @@
1
+ import fs from "node:fs";
1
2
  import { readConf } from "./cmd/sys/read_conf.js";
2
3
  import { upsertBackends, insertFeaturesPathIfNotExists, insertPluginIfNotExists, upsertTaskSettings, deleteTaskSettings } from "./db/write.js";
3
4
  import { buildPluginsPaths } from "./state/plugins.js";
@@ -7,6 +8,8 @@ import { homedir } from 'os';
7
8
  import { join } from 'path';
8
9
  import { createDirectoryIfNotExists } from "./cmd/sys/dirs.js";
9
10
  import { initTaskSettings, tasksSettings } from "./state/tasks.js";
11
+ import path from "node:path";
12
+ import yaml from "yaml";
10
13
  function getConfigPath(appName, filename) {
11
14
  let confDir;
12
15
  let dbPath;
@@ -25,6 +28,33 @@ function getConfigPath(appName, filename) {
25
28
  return { confDir: confDir, dbPath: dbPath };
26
29
  }
27
30
  const { confDir, dbPath } = getConfigPath("agent-smith", "config.db");
31
+ function createConfigFile(cfp) {
32
+ createDirectoryIfNotExists(confDir);
33
+ const fp = cfp ? cfp : path.join(confDir, "config.yml");
34
+ const fc = {
35
+ promptfile: "",
36
+ backends: {
37
+ default: "llamacpp",
38
+ local: ["llamacpp", "koboldcpp", "ollama"],
39
+ llamacpp_oai: {
40
+ type: "openai",
41
+ url: "http://localhost:8080/v1"
42
+ }
43
+ }
44
+ };
45
+ const txt = yaml.stringify(fc);
46
+ 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);
52
+ }
53
+ catch (e) {
54
+ throw new Error(`Error creating config file at ${fp}: ${e}`);
55
+ }
56
+ return fp;
57
+ }
28
58
  async function processConfPath(confPath) {
29
59
  createDirectoryIfNotExists(confDir);
30
60
  const { found, data } = readConf(confPath);
@@ -118,4 +148,4 @@ async function processConfPath(confPath) {
118
148
  }
119
149
  return { paths: allPaths, pf: pf, dd: dd };
120
150
  }
121
- export { confDir, dbPath, processConfPath, getConfigPath, };
151
+ export { confDir, dbPath, processConfPath, getConfigPath, createConfigFile, };
package/dist/main.d.ts CHANGED
@@ -13,19 +13,23 @@ import { displayOptions, ioOptions, inferenceOptions, allOptions } from "./cmd/o
13
13
  import { McpClient } from "./cmd/lib/mcp.js";
14
14
  import { readTask } from "./cmd/lib/tasks/read.js";
15
15
  import { FeatureType, TaskSettings } from "./interfaces.js";
16
- import { getConfigPath } from "./conf.js";
17
- import { readFeaturesType, readFilePaths } from "./db/read.js";
16
+ import { getConfigPath, createConfigFile } from "./conf.js";
17
+ import { readFeaturesType, readFilePaths, readTool } from "./db/read.js";
18
18
  import { readConf } from "./cmd/sys/read_conf.js";
19
19
  import { backend } from "./state/backends.js";
20
20
  import { getTaskSettings } from "./state/tasks.js";
21
21
  import { upsertTaskSettings } from "./db/write.js";
22
+ import { initDb } from "./db/db.js";
23
+ import { updateConfCmd } from "./cmd/clicmds/updateconf.js";
22
24
  declare const db: {
25
+ init: typeof initDb;
23
26
  readFilePaths: typeof readFilePaths;
24
27
  readFeaturesType: typeof readFeaturesType;
28
+ readTool: typeof readTool;
25
29
  getTaskSettings: typeof getTaskSettings;
26
30
  upsertTaskSettings: typeof upsertTaskSettings;
27
31
  };
28
32
  declare const fs: {
29
33
  openTaskSpec: typeof openTaskSpec;
30
34
  };
31
- 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, };
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, };
package/dist/main.js CHANGED
@@ -12,19 +12,23 @@ import { extractBetweenTags, splitThinking } from "./utils/text.js";
12
12
  import { displayOptions, ioOptions, inferenceOptions, allOptions } from "./cmd/options.js";
13
13
  import { McpClient } from "./cmd/lib/mcp.js";
14
14
  import { readTask } from "./cmd/lib/tasks/read.js";
15
- import { getConfigPath } from "./conf.js";
16
- import { readFeaturesType, readFilePaths } from "./db/read.js";
15
+ import { getConfigPath, createConfigFile } from "./conf.js";
16
+ import { readFeaturesType, readFilePaths, readTool } from "./db/read.js";
17
17
  import { readConf } from "./cmd/sys/read_conf.js";
18
18
  import { backend } from "./state/backends.js";
19
19
  import { getTaskSettings } from "./state/tasks.js";
20
20
  import { upsertTaskSettings } from "./db/write.js";
21
+ import { initDb } from "./db/db.js";
22
+ import { updateConfCmd } from "./cmd/clicmds/updateconf.js";
21
23
  const db = {
24
+ init: initDb,
22
25
  readFilePaths,
23
26
  readFeaturesType,
27
+ readTool,
24
28
  getTaskSettings,
25
29
  upsertTaskSettings,
26
30
  };
27
31
  const fs = {
28
32
  openTaskSpec,
29
33
  };
30
- 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, };
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, };
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
1
  {
2
2
  "name": "@agent-smith/cli",
3
3
  "description": "Agent Smith: terminal client for language model agents",
4
- "version": "0.0.111",
4
+ "version": "0.0.113",
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.1",
12
- "@agent-smith/nodetask": "^0.2.0",
13
- "@agent-smith/task": "^0.3.1",
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
- "@intrinsicai/gbnfgen": "^0.7.0",
16
+ "@intrinsicai/gbnfgen": "^0.12.0",
17
17
  "@locallm/api": "^0.7.3",
18
- "@modelcontextprotocol/sdk": "^1.27.0",
18
+ "@modelcontextprotocol/sdk": "^1.27.1",
19
19
  "@vue/reactivity": "^3.5.29",
20
20
  "ansi-colors": "^4.1.3",
21
21
  "better-sqlite3": "^12.6.2",
22
- "clipboardy": "^5.3.0",
22
+ "clipboardy": "^5.3.1",
23
23
  "commander": "^14.0.3",
24
24
  "marked-terminal": "^7.3.0",
25
- "modprompt": "^0.14.0",
25
+ "modprompt": "^0.14.2",
26
26
  "ora": "^9.3.0",
27
27
  "python-shell": "^5.0.0",
28
28
  "yaml": "^2.8.2"
@@ -30,13 +30,13 @@
30
30
  "devDependencies": {
31
31
  "@cfworker/json-schema": "^4.1.1",
32
32
  "@commander-js/extra-typings": "^14.0.0",
33
- "@locallm/types": "^0.7.0",
33
+ "@locallm/types": "^0.7.1",
34
34
  "@rollup/plugin-node-resolve": "^16.0.3",
35
35
  "@rollup/plugin-typescript": "^12.3.0",
36
36
  "@types/better-sqlite3": "^7.6.13",
37
37
  "@types/marked-terminal": "^6.1.1",
38
- "@types/node": "^25.3.0",
39
- "openai": "^6.24.0",
38
+ "@types/node": "^25.3.1",
39
+ "openai": "^6.25.0",
40
40
  "restmix": "^0.6.1",
41
41
  "tslib": "2.8.1",
42
42
  "typescript": "^5.9.3"
@@ -64,4 +64,4 @@
64
64
  "url": "git+https://github.com/synw/agent-smith.git"
65
65
  },
66
66
  "license": "MIT"
67
- }
67
+ }