@agent-smith/cli 0.0.63 → 0.0.65

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.
Files changed (54) hide show
  1. package/dist/cli.d.ts +2 -1
  2. package/dist/cli.js +7 -48
  3. package/dist/cmd/clicmds/aliases.d.ts +7 -0
  4. package/dist/cmd/clicmds/aliases.js +43 -0
  5. package/dist/cmd/clicmds/base.d.ts +3 -0
  6. package/dist/cmd/clicmds/base.js +94 -0
  7. package/dist/cmd/clicmds/cmds.d.ts +4 -7
  8. package/dist/cmd/clicmds/cmds.js +6 -184
  9. package/dist/cmd/clicmds/update.d.ts +2 -0
  10. package/dist/cmd/clicmds/update.js +46 -0
  11. package/dist/cmd/cmds.d.ts +3 -5
  12. package/dist/cmd/cmds.js +19 -53
  13. package/dist/cmd/lib/actions/cmd.d.ts +3 -2
  14. package/dist/cmd/lib/actions/cmd.js +67 -50
  15. package/dist/cmd/lib/actions/read.js +2 -2
  16. package/dist/cmd/lib/adaptaters/cmd.d.ts +2 -2
  17. package/dist/cmd/lib/adaptaters/cmd.js +3 -15
  18. package/dist/cmd/lib/models.d.ts +1 -1
  19. package/dist/cmd/lib/models.js +8 -6
  20. package/dist/cmd/lib/options_parsers.d.ts +7 -0
  21. package/dist/cmd/lib/options_parsers.js +41 -0
  22. package/dist/cmd/lib/tasks/cmd.d.ts +3 -2
  23. package/dist/cmd/lib/tasks/cmd.js +105 -63
  24. package/dist/cmd/lib/tasks/mcp.d.ts +13 -0
  25. package/dist/cmd/lib/tasks/mcp.js +57 -0
  26. package/dist/cmd/lib/tools.d.ts +8 -1
  27. package/dist/cmd/lib/tools.js +31 -1
  28. package/dist/cmd/lib/utils.d.ts +1 -2
  29. package/dist/cmd/lib/utils.js +1 -23
  30. package/dist/cmd/lib/workflows/cmd.d.ts +3 -2
  31. package/dist/cmd/lib/workflows/cmd.js +21 -27
  32. package/dist/cmd/options.d.ts +8 -0
  33. package/dist/cmd/options.js +62 -0
  34. package/dist/cmd/sys/read_cmds.d.ts +2 -2
  35. package/dist/cmd/sys/read_cmds.js +2 -2
  36. package/dist/db/db.d.ts +1 -1
  37. package/dist/db/db.js +3 -2
  38. package/dist/db/read.d.ts +3 -2
  39. package/dist/db/read.js +18 -12
  40. package/dist/db/schemas.js +12 -6
  41. package/dist/db/write.js +30 -13
  42. package/dist/index.js +14 -8
  43. package/dist/interfaces.d.ts +23 -6
  44. package/dist/main.d.ts +6 -6
  45. package/dist/main.js +6 -6
  46. package/dist/state/state.d.ts +2 -7
  47. package/dist/state/state.js +3 -11
  48. package/dist/utils/perf.d.ts +1 -1
  49. package/dist/utils/perf.js +6 -6
  50. package/package.json +10 -11
  51. package/dist/cmd/clicmds/modes.d.ts +0 -3
  52. package/dist/cmd/clicmds/modes.js +0 -95
  53. package/dist/utils/args.d.ts +0 -7
  54. package/dist/utils/args.js +0 -85
@@ -1,15 +1,11 @@
1
1
  import { PythonShell } from 'python-shell';
2
- import { InputMode, RunMode, FormatMode, OutputMode, VerbosityMode } from "../interfaces.js";
2
+ import { InputMode, RunMode, FormatMode, OutputMode } from "../interfaces.js";
3
3
  declare let pyShell: PythonShell;
4
4
  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
8
  declare const isChatMode: import("@vue/reactivity").Ref<boolean, boolean>;
9
- declare const isDebug: import("@vue/reactivity").ComputedRef<boolean>;
10
- declare const isVerbose: import("@vue/reactivity").ComputedRef<boolean>;
11
- declare const isQuiet: import("@vue/reactivity").ComputedRef<boolean>;
12
- declare const isShowTokens: import("@vue/reactivity").Ref<boolean, boolean>;
13
9
  declare const promptfilePath: import("@vue/reactivity").Ref<string, string>;
14
10
  declare const dataDirPath: import("@vue/reactivity").Ref<string, string>;
15
11
  declare const lastCmd: {
@@ -19,5 +15,4 @@ declare const lastCmd: {
19
15
  declare function initFilepaths(): void;
20
16
  declare function initState(): Promise<void>;
21
17
  declare function pluginDataDir(pluginName: string): string;
22
- declare function setVerbosity(mode: VerbosityMode): void;
23
- export { inputMode, outputMode, isChatMode, isShowTokens, runMode, formatMode, lastCmd, isDebug, isVerbose, isQuiet, promptfilePath, dataDirPath, pluginDataDir, initState, initFilepaths, setVerbosity, pyShell, };
18
+ export { inputMode, outputMode, isChatMode, runMode, formatMode, lastCmd, promptfilePath, dataDirPath, pluginDataDir, initState, initFilepaths, pyShell, };
@@ -1,4 +1,4 @@
1
- import { computed, reactive, ref } from "@vue/reactivity";
1
+ import { reactive, ref } from "@vue/reactivity";
2
2
  import { initDb } from "../db/db.js";
3
3
  import { readFilePaths } from "../db/read.js";
4
4
  import path from "path";
@@ -9,11 +9,6 @@ const outputMode = ref("txt");
9
9
  const runMode = ref("cmd");
10
10
  const formatMode = ref("text");
11
11
  const isChatMode = ref(false);
12
- const verbosity = ref("quiet");
13
- const isDebug = computed(() => verbosity.value == "debug");
14
- const isVerbose = computed(() => verbosity.value == "verbose");
15
- const isQuiet = computed(() => verbosity.value == "quiet");
16
- const isShowTokens = ref(false);
17
12
  const promptfilePath = ref("");
18
13
  const dataDirPath = ref("");
19
14
  const isStateReady = ref(false);
@@ -37,7 +32,7 @@ async function initState() {
37
32
  if (isStateReady.value) {
38
33
  return;
39
34
  }
40
- initDb(isDebug.value);
35
+ initDb(false, false);
41
36
  initFilepaths();
42
37
  isStateReady.value = true;
43
38
  }
@@ -53,7 +48,4 @@ function pluginDataDir(pluginName) {
53
48
  createDirectoryIfNotExists(pluginDatapath);
54
49
  return pluginDatapath;
55
50
  }
56
- function setVerbosity(mode) {
57
- verbosity.value = mode;
58
- }
59
- export { inputMode, outputMode, isChatMode, isShowTokens, runMode, formatMode, lastCmd, isDebug, isVerbose, isQuiet, promptfilePath, dataDirPath, pluginDataDir, initState, initFilepaths, setVerbosity, pyShell, };
51
+ export { inputMode, outputMode, isChatMode, runMode, formatMode, lastCmd, promptfilePath, dataDirPath, pluginDataDir, initState, initFilepaths, pyShell, };
@@ -1,6 +1,6 @@
1
1
  declare const usePerfTimer: (startTimer?: boolean) => {
2
2
  start: () => number;
3
- time: () => string | number;
3
+ time: () => string;
4
4
  timeRaw: () => string | number;
5
5
  printTime: () => void;
6
6
  };
@@ -16,17 +16,17 @@ const usePerfTimer = (startTimer = true) => {
16
16
  const humanizedTime = _formatDuration(duration);
17
17
  return humanizedTime;
18
18
  };
19
- const time = () => _end(false);
19
+ const time = () => _end(false).toString();
20
20
  const printTime = () => console.log(_end(false));
21
21
  const timeRaw = () => _end(true);
22
22
  const _formatDuration = (ms) => {
23
- const seconds = Math.floor(ms / 1000);
24
- const minutes = Math.floor(seconds / 60);
23
+ const seconds = ms / 1000;
24
+ const minutes = seconds / 60;
25
25
  if (ms < 1000)
26
- return `${ms.toFixed(2)}ms`;
26
+ return `${ms.toFixed(2)} milliseconds`;
27
27
  if (seconds < 60)
28
- return `${seconds.toFixed(2)}s`;
29
- return `${minutes}m ${seconds % 60}s`;
28
+ return `${seconds.toFixed(1)} seconds`;
29
+ return `${minutes.toFixed(1)} minutes ${seconds % 60} seconds`;
30
30
  };
31
31
  return {
32
32
  start,
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.63",
5
+ "version": "0.0.65",
6
6
  "scripts": {
7
7
  "buildrl": "rm -rf dist/* && rollup -c",
8
8
  "build": "rm -rf dist/* && tsc",
@@ -12,34 +12,33 @@
12
12
  "dependencies": {
13
13
  "@agent-smith/brain": "^0.0.43",
14
14
  "@agent-smith/jobs": "^0.0.14",
15
- "@agent-smith/lmtask": "^0.0.43",
15
+ "@agent-smith/lmtask": "^0.0.44",
16
16
  "@agent-smith/tfm": "^0.1.2",
17
- "@inquirer/prompts": "^7.5.0",
18
- "@inquirer/select": "^4.2.0",
19
- "@vue/reactivity": "^3.5.13",
20
- "@wllama/wllama": "^2.3.1",
17
+ "@inquirer/prompts": "^7.5.3",
18
+ "@inquirer/select": "^4.2.3",
19
+ "@vue/reactivity": "^3.5.15",
21
20
  "ansi-colors": "^4.1.3",
22
21
  "better-sqlite3": "^11.10.0",
23
22
  "chalk": "^5.4.1",
24
23
  "clipboardy": "^4.0.0",
25
- "commander": "^13.1.0",
24
+ "commander": "^14.0.0",
26
25
  "marked-terminal": "^7.3.0",
27
26
  "modprompt": "^0.11.7",
28
27
  "ora": "^8.2.0",
29
28
  "python-shell": "^5.0.0",
30
- "yaml": "^2.7.1"
29
+ "yaml": "^2.8.0"
31
30
  },
32
31
  "devDependencies": {
33
32
  "@agent-smith/tmem-jobs": "^0.0.4",
34
- "@commander-js/extra-typings": "^13.1.0",
33
+ "@commander-js/extra-typings": "^14.0.0",
35
34
  "@locallm/types": "^0.1.9",
36
35
  "@rollup/plugin-node-resolve": "^16.0.1",
37
36
  "@rollup/plugin-typescript": "^12.1.2",
38
37
  "@types/better-sqlite3": "^7.6.13",
39
38
  "@types/marked-terminal": "^6.1.1",
40
- "@types/node": "^22.15.17",
39
+ "@types/node": "^22.15.21",
41
40
  "restmix": "^0.5.0",
42
- "rollup": "^4.40.2",
41
+ "rollup": "^4.41.1",
43
42
  "ts-node": "^10.9.2",
44
43
  "tslib": "2.8.1",
45
44
  "typescript": "^5.8.3"
@@ -1,3 +0,0 @@
1
- import { Cmd } from "../../interfaces.js";
2
- declare const modes: Record<string, Cmd>;
3
- export { modes };
@@ -1,95 +0,0 @@
1
- import { formatMode, inputMode, isChatMode, isShowTokens, isVerbose, outputMode, runMode, setVerbosity } from "../../state/state.js";
2
- const modes = {
3
- "-d": {
4
- cmd: async () => {
5
- setVerbosity("debug");
6
- if (runMode.value == "cli") {
7
- console.log("Debug mode is on");
8
- }
9
- },
10
- description: "use debug mode",
11
- },
12
- "-t": {
13
- cmd: async () => {
14
- isShowTokens.value = !isShowTokens.value;
15
- if (runMode.value == "cli") {
16
- console.log("Show tokens mode is", isShowTokens.value ? "on" : "off");
17
- }
18
- },
19
- description: "use verbose mode",
20
- },
21
- "-v": {
22
- cmd: async () => {
23
- setVerbosity("verbose");
24
- ;
25
- if (runMode.value == "cli") {
26
- console.log("Verbose mode is", isVerbose.value ? "on" : "off");
27
- }
28
- },
29
- description: "use verbose mode",
30
- },
31
- "-c": {
32
- cmd: async () => {
33
- isChatMode.value = !isChatMode.value;
34
- if (runMode.value == "cli") {
35
- console.log("Chat mode is", isChatMode.value ? "on" : "off");
36
- }
37
- },
38
- description: "use chat mode for tasks",
39
- },
40
- "--if": {
41
- cmd: async () => {
42
- inputMode.value = "promptfile";
43
- if (runMode.value == "cli") {
44
- console.log("Prompt file input mode is on");
45
- }
46
- },
47
- description: "use promptfile input mode",
48
- },
49
- "--ic": {
50
- cmd: async () => {
51
- inputMode.value = "clipboard";
52
- if (runMode.value == "cli") {
53
- console.log("Clipboard input mode is on");
54
- }
55
- },
56
- description: "use clipboard input mode"
57
- },
58
- "--im": {
59
- cmd: async () => {
60
- inputMode.value = "manual";
61
- if (runMode.value == "cli") {
62
- console.log("Manual inputMode");
63
- }
64
- },
65
- description: "use manual input mode (default)"
66
- },
67
- "--oc": {
68
- cmd: async () => {
69
- outputMode.value = "clipboard";
70
- if (runMode.value == "cli") {
71
- console.log("Clipboard output mode is on");
72
- }
73
- },
74
- description: "use clipboard output mode"
75
- },
76
- "--omd": {
77
- cmd: async () => {
78
- formatMode.value = "markdown";
79
- if (runMode.value == "cli") {
80
- console.log("Markdown output mode");
81
- }
82
- },
83
- description: "use markdown output"
84
- },
85
- "--otxt": {
86
- cmd: async () => {
87
- formatMode.value = "text";
88
- if (runMode.value == "cli") {
89
- console.log("Text output mode (default)");
90
- }
91
- },
92
- description: "use text output "
93
- },
94
- };
95
- export { modes };
@@ -1,7 +0,0 @@
1
- import { LmTaskConfig } from "../interfaces.js";
2
- declare function parseArgs(params: Record<string, any> | Array<any>, checkPrompt?: boolean): {
3
- conf: LmTaskConfig;
4
- vars: Record<string, any>;
5
- args: Array<string>;
6
- };
7
- export { parseArgs, };
@@ -1,85 +0,0 @@
1
- function parseArgs(params, checkPrompt = false) {
2
- switch (Array.isArray(params)) {
3
- case true:
4
- return parseArrayArgs(params);
5
- default:
6
- return { ...parseObjectArgs(params, checkPrompt), args: [] };
7
- }
8
- }
9
- function parseObjectArgs(params, checkPrompt) {
10
- const conf = { inferParams: {}, modelname: "", templateName: "" };
11
- if (checkPrompt) {
12
- if (!params?.prompt) {
13
- throw new Error(`args parsing error: provide a prompt`);
14
- }
15
- }
16
- if (params?.images) {
17
- conf.inferParams.images = params.images;
18
- delete params.images;
19
- }
20
- if (params?.modelname) {
21
- conf.modelname = params.modelname;
22
- delete params.modelname;
23
- }
24
- if (params?.template) {
25
- conf.templateName = params.templateName;
26
- delete params.templateName;
27
- }
28
- if (params?.m) {
29
- if (params.m.includes("/")) {
30
- const _s = params.m.split("/");
31
- conf.modelname = _s[0];
32
- conf.templateName = _s[1];
33
- }
34
- else {
35
- conf.modelname = params.m;
36
- }
37
- }
38
- if (params?.ip) {
39
- conf.inferParams = params.ip;
40
- }
41
- const res = { conf: conf, vars: params };
42
- return res;
43
- }
44
- function parseArrayArgs(args) {
45
- const _vars = {};
46
- const _conf = { inferParams: {} };
47
- const _nargs = new Array();
48
- args.forEach((a) => {
49
- if (a.includes("=")) {
50
- const index = a.indexOf('=');
51
- const t = [
52
- a.slice(0, index),
53
- a.slice(index + 1)
54
- ];
55
- const k = t[0];
56
- const v = t[1];
57
- switch (k) {
58
- case "m":
59
- if (v.includes("/")) {
60
- const _s = v.split("/");
61
- _conf.modelname = _s[0];
62
- _conf.templateName = _s[1];
63
- }
64
- else {
65
- _conf.modelname = v;
66
- }
67
- break;
68
- case "ip":
69
- v.split(",").forEach((p) => {
70
- const s = p.split(":");
71
- _conf.inferParams[s[0]] = parseFloat(s[1]);
72
- });
73
- break;
74
- default:
75
- _vars[k] = v;
76
- break;
77
- }
78
- }
79
- else {
80
- _nargs.push(a);
81
- }
82
- });
83
- return { conf: _conf, vars: _vars, args: _nargs };
84
- }
85
- export { parseArgs, };