@agent-smith/cli 0.0.108 → 0.0.110

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 (49) hide show
  1. package/dist/cli.js +1 -0
  2. package/dist/cmd/clicmds/aliases.js +8 -6
  3. package/dist/cmd/clicmds/base.js +5 -2
  4. package/dist/cmd/clicmds/cmds.d.ts +2 -3
  5. package/dist/cmd/clicmds/cmds.js +63 -23
  6. package/dist/cmd/clicmds/updateconf.d.ts +2 -1
  7. package/dist/cmd/clicmds/updateconf.js +39 -9
  8. package/dist/cmd/cmds.js +70 -3
  9. package/dist/cmd/lib/actions/cmd.js +21 -1
  10. package/dist/cmd/lib/actions/read.js +4 -0
  11. package/dist/cmd/lib/adaptaters/cmd.js +8 -1
  12. package/dist/cmd/lib/agents/cmd.js +2 -1
  13. package/dist/cmd/lib/mcp.js +6 -0
  14. package/dist/cmd/lib/options_parsers.js +5 -0
  15. package/dist/cmd/lib/tasks/cmd.js +90 -5
  16. package/dist/cmd/lib/tasks/conf.js +35 -0
  17. package/dist/cmd/lib/tasks/read.js +30 -1
  18. package/dist/cmd/lib/tools.js +10 -4
  19. package/dist/cmd/lib/user_msgs.js +4 -3
  20. package/dist/cmd/lib/utils.js +5 -0
  21. package/dist/cmd/lib/workflows/cmd.js +24 -1
  22. package/dist/cmd/lib/workflows/read.js +5 -0
  23. package/dist/cmd/options.js +1 -0
  24. package/dist/cmd/sys/clipboard.js +25 -0
  25. package/dist/cmd/sys/execute.js +1 -0
  26. package/dist/cmd/sys/read_cmds.d.ts +7 -3
  27. package/dist/cmd/sys/read_cmds.js +21 -3
  28. package/dist/cmd/sys/read_conf.js +1 -0
  29. package/dist/cmd/sys/read_features.js +1 -0
  30. package/dist/cmd/sys/run_python.js +4 -0
  31. package/dist/conf.d.ts +5 -2
  32. package/dist/conf.js +6 -3
  33. package/dist/db/db.js +1 -0
  34. package/dist/db/read.js +1 -0
  35. package/dist/db/write.js +50 -2
  36. package/dist/index.js +8 -0
  37. package/dist/interfaces.d.ts +13 -2
  38. package/dist/main.d.ts +18 -3
  39. package/dist/main.js +17 -2
  40. package/dist/state/backends.js +14 -0
  41. package/dist/state/plugins.js +3 -0
  42. package/dist/state/state.js +21 -2
  43. package/dist/state/tasks.d.ts +2 -1
  44. package/dist/state/tasks.js +8 -1
  45. package/dist/utils/text.js +4 -0
  46. package/dist/utils/user_msgs.js +2 -0
  47. package/package.json +15 -15
  48. package/dist/state/auto/usercmds.d.ts +0 -4
  49. package/dist/state/auto/usercmds.js +0 -3
@@ -5,21 +5,25 @@ import path from "path";
5
5
  import { createDirectoryIfNotExists } from "../cmd/sys/dirs.js";
6
6
  import { backend, initBackends } from "./backends.js";
7
7
  import { runtimeDataError } from "../utils/user_msgs.js";
8
+ //import { usePerfTimer } from "../main.js";
8
9
  let pyShell;
9
10
  const inputMode = ref("manual");
10
11
  const outputMode = ref("txt");
11
12
  const runMode = ref("cmd");
12
13
  const formatMode = ref("text");
13
14
  const isChatMode = ref(false);
15
+ //const verbosity = ref<VerbosityMode>("quiet");
14
16
  const promptfilePath = ref("");
15
17
  const dataDirPath = ref("");
16
18
  const isStateReady = ref(false);
19
+ const isReady = ref(false);
17
20
  const lastCmd = reactive({
18
21
  name: "",
19
22
  args: [],
20
23
  });
21
24
  function initFilepaths() {
22
25
  const filePaths = readFilePaths();
26
+ //console.log("FP", filePaths);
23
27
  for (const fp of filePaths) {
24
28
  switch (fp.name) {
25
29
  case "promptfile":
@@ -31,20 +35,30 @@ function initFilepaths() {
31
35
  }
32
36
  }
33
37
  async function init() {
38
+ //const perf = usePerfTimer();
34
39
  await initState();
35
- await initBackends();
40
+ //perf.measure("initState");
41
+ if (!isReady.value) {
42
+ await initBackends();
43
+ }
44
+ //perf.measure("initBackends");
36
45
  if (!backend.value) {
37
46
  runtimeDataError("No backend found, can not initialize agent");
38
47
  return;
39
48
  }
49
+ isReady.value = true;
50
+ //perf.final("init")
51
+ //console.log("Agent", agent);
40
52
  }
41
53
  async function initState() {
42
54
  if (isStateReady.value) {
43
55
  return;
44
56
  }
57
+ //sconsole.log("INIT STATE");
45
58
  initDb(false, false);
46
59
  initFilepaths();
47
60
  isStateReady.value = true;
61
+ //console.log("State ready, available features:", readFeatures())
48
62
  }
49
63
  function _getDataDirPath() {
50
64
  if (dataDirPath.value.length == 0) {
@@ -58,4 +72,9 @@ function pluginDataDir(pluginName) {
58
72
  createDirectoryIfNotExists(pluginDatapath);
59
73
  return pluginDatapath;
60
74
  }
61
- export { inputMode, outputMode, isChatMode, runMode, formatMode, lastCmd, promptfilePath, dataDirPath, isStateReady, pluginDataDir, initState, initFilepaths, init, pyShell, };
75
+ /*function setVerbosity(mode: VerbosityMode) {
76
+ verbosity.value = mode
77
+ }*/
78
+ export { inputMode, outputMode, isChatMode, runMode, formatMode, lastCmd, promptfilePath, dataDirPath, isStateReady, pluginDataDir, initState, initFilepaths, init,
79
+ //setVerbosity,
80
+ pyShell, };
@@ -2,4 +2,5 @@ import { TaskSettings } from "../interfaces.js";
2
2
  declare const tasksSettings: Record<string, TaskSettings>;
3
3
  declare const isTaskSettingsInitialized: import("@vue/reactivity").Ref<boolean, boolean>;
4
4
  declare function initTaskSettings(): void;
5
- export { tasksSettings, initTaskSettings, isTaskSettingsInitialized, };
5
+ declare function getTaskSettings(force?: boolean): Record<string, TaskSettings>;
6
+ export { tasksSettings, isTaskSettingsInitialized, initTaskSettings, getTaskSettings };
@@ -16,6 +16,13 @@ function initTaskSettings() {
16
16
  }
17
17
  tasksSettings[name] = vals;
18
18
  });
19
+ //console.log("TS", tasksSettings);
19
20
  isTaskSettingsInitialized.value = true;
20
21
  }
21
- export { tasksSettings, initTaskSettings, isTaskSettingsInitialized, };
22
+ function getTaskSettings(force = false) {
23
+ if (!isTaskSettingsInitialized.value === true || force) {
24
+ initTaskSettings();
25
+ }
26
+ return tasksSettings;
27
+ }
28
+ export { tasksSettings, isTaskSettingsInitialized, initTaskSettings, getTaskSettings };
@@ -1,8 +1,10 @@
1
1
  function extractBetweenTags(text, startTag, endTag) {
2
2
  try {
3
+ // Find start position
3
4
  const startIndex = text.indexOf(startTag);
4
5
  if (startIndex === -1)
5
6
  return text;
7
+ // Calculate content boundaries
6
8
  let contentStart = startIndex + startTag.length;
7
9
  let contentEnd;
8
10
  if (endTag) {
@@ -11,10 +13,12 @@ function extractBetweenTags(text, startTag, endTag) {
11
13
  return text;
12
14
  }
13
15
  else {
16
+ // Find next newline for self-closing tags
14
17
  contentEnd = text.indexOf('\n', contentStart);
15
18
  if (contentEnd === -1)
16
19
  contentEnd = text.length;
17
20
  }
21
+ // Extract content
18
22
  return text.substring(contentStart, contentEnd).trim();
19
23
  }
20
24
  catch (error) {
@@ -6,12 +6,14 @@ function runtimeError(...msg) {
6
6
  }
7
7
  function runtimeWarning(...msg) {
8
8
  console.warn("⚠️", colors.dim("Runtime warning:"), ...msg);
9
+ //exit(1)
9
10
  }
10
11
  function runtimeDataError(...msg) {
11
12
  console.warn("❌", colors.dim("Runtime data error:"), ...msg);
12
13
  exit(1);
13
14
  }
14
15
  function runtimeInfo(...msg) {
16
+ //console.log("ℹ️ ", colors.dim("Info:"), ...msg);
15
17
  console.log("📫", colors.dim("Info:"), ...msg);
16
18
  }
17
19
  export { runtimeError, runtimeWarning, runtimeDataError, runtimeInfo, };
package/package.json CHANGED
@@ -2,42 +2,42 @@
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.108",
5
+ "version": "0.0.110",
6
6
  "scripts": {
7
7
  "build": "rm -rf dist/* && tsc",
8
8
  "cli": "node --loader ts-node/esm bin/index.ts",
9
9
  "watch": "tsc --noCheck -p . -w"
10
10
  },
11
11
  "dependencies": {
12
- "@agent-smith/agent": "^0.2.3",
13
- "@agent-smith/nodetask": "^0.1.1",
14
- "@agent-smith/task": "^0.2.4",
15
- "modprompt": "0.13.1",
12
+ "@agent-smith/agent": "^0.3.0",
13
+ "@agent-smith/nodetask": "^0.2.0",
14
+ "@agent-smith/task": "^0.3.0",
16
15
  "@agent-smith/tfm": "^0.2.0",
17
- "@inquirer/prompts": "^8.2.0",
18
- "@intrinsicai/gbnfgen": "0.12.0",
16
+ "@inquirer/prompts": "^8.2.1",
17
+ "@intrinsicai/gbnfgen": "^0.7.0",
19
18
  "@locallm/api": "^0.7.3",
20
- "@modelcontextprotocol/sdk": "^1.25.3",
21
- "@vue/reactivity": "^3.5.27",
19
+ "@modelcontextprotocol/sdk": "^1.26.0",
20
+ "@vue/reactivity": "^3.5.28",
22
21
  "ansi-colors": "^4.1.3",
23
22
  "better-sqlite3": "^12.6.2",
24
- "clipboardy": "^5.1.0",
25
- "commander": "^14.0.2",
23
+ "clipboardy": "^5.3.0",
24
+ "commander": "^14.0.3",
26
25
  "marked-terminal": "^7.3.0",
27
- "ora": "^9.1.0",
26
+ "modprompt": "^0.14.0",
27
+ "ora": "^9.3.0",
28
28
  "python-shell": "^5.0.0",
29
29
  "yaml": "^2.8.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@cfworker/json-schema": "^4.1.1",
33
33
  "@commander-js/extra-typings": "^14.0.0",
34
- "@locallm/types": "^0.6.7",
34
+ "@locallm/types": "^0.7.0",
35
35
  "@rollup/plugin-node-resolve": "^16.0.3",
36
36
  "@rollup/plugin-typescript": "^12.3.0",
37
37
  "@types/better-sqlite3": "^7.6.13",
38
38
  "@types/marked-terminal": "^6.1.1",
39
- "@types/node": "^25.0.10",
40
- "openai": "^6.16.0",
39
+ "@types/node": "^25.3.0",
40
+ "openai": "^6.22.0",
41
41
  "restmix": "^0.6.1",
42
42
  "tslib": "2.8.1",
43
43
  "typescript": "^5.9.3"
@@ -1,4 +0,0 @@
1
- import { Command } from "commander";
2
- declare const cmds: Command[];
3
- declare const isCacheReady = false;
4
- export { cmds, isCacheReady, };
@@ -1,3 +0,0 @@
1
- const cmds = new Array();
2
- const isCacheReady = false;
3
- export { cmds, isCacheReady, };