@agent-smith/cli 0.0.52 → 0.0.54

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.
@@ -57,7 +57,7 @@ async function executeActionCmd(args = [], options = {}, quiet = false) {
57
57
  }
58
58
  const { found, path, ext } = getFeatureSpec(name, "action");
59
59
  if (!found) {
60
- throw new Error("Action not found");
60
+ throw new Error(`Action ${name} not found at ${path}`);
61
61
  }
62
62
  let act;
63
63
  switch (ext) {
@@ -72,28 +72,27 @@ async function executeTaskCmd(args = [], options = {}) {
72
72
  taskSpec.tools = [];
73
73
  for (const toolName of taskSpec.toolsList) {
74
74
  const { found, tool, type } = readTool(toolName);
75
+ if (!found) {
76
+ throw new Error(`tool ${toolName} not found for task ${taskSpec.name}`);
77
+ }
75
78
  const lmTool = {
76
79
  ...tool,
77
- execute: async (name, args) => {
80
+ execute: async (args) => {
78
81
  switch (type) {
79
82
  case "action":
80
- const res = await executeActionCmd([name, ...Object.values(args)], options, true);
83
+ const res = await executeActionCmd([toolName, ...Object.values(args)], options, true);
81
84
  return res;
82
85
  case "task":
83
- const tres = await executeTaskCmd([name, args], options);
86
+ const tres = await executeTaskCmd([toolName, args], options);
84
87
  return tres;
85
88
  case "workflow":
86
- const wres = await executeWorkflowCmd(name, ...Object.values(args), options);
89
+ const wres = await executeWorkflowCmd(toolName, ...Object.values(args), options);
87
90
  return wres;
88
91
  default:
89
- throw new Error(`unknown tool execution function type: ${type}`);
92
+ throw new Error(`unknown tool execution function type: ${type} for ${toolName}`);
90
93
  }
91
94
  }
92
95
  };
93
- if (!found) {
94
- console.warn(`Problem: tool ${toolName} not found for task ${taskSpec.name}`);
95
- continue;
96
- }
97
96
  taskSpec.tools.push(lmTool);
98
97
  }
99
98
  delete taskSpec.toolsList;
@@ -108,6 +108,16 @@ function _initTaskParams(params, inferParams) {
108
108
  conf.templateName = params.templateName;
109
109
  delete params.templateName;
110
110
  }
111
+ if (params?.m) {
112
+ if (params.m.includes("/")) {
113
+ const _s = params.m.split("/");
114
+ conf.modelname = _s[0];
115
+ conf.templateName = _s[1];
116
+ }
117
+ else {
118
+ conf.modelname = params.m;
119
+ }
120
+ }
111
121
  const ip = conf.inferParams;
112
122
  if (params?.inferParams) {
113
123
  for (const [k, v] of Object.entries(params.inferParams)) {
@@ -1,2 +1,2 @@
1
- declare function executeWorkflowCmd(name: string, args?: Array<any>, options?: any): Promise<any>;
1
+ declare function executeWorkflowCmd(name: string, args?: Array<any> | Record<string, any>, options?: any): Promise<any>;
2
2
  export { executeWorkflowCmd, };
@@ -12,7 +12,7 @@ async function executeWorkflowCmd(name, args = [], options = {}) {
12
12
  if (isDebug.value || isVerbose.value) {
13
13
  console.log("Running workflow", name, stepNames.length, "steps");
14
14
  }
15
- let params = {};
15
+ let params = Array.isArray(args) ? {} : args;
16
16
  let i = 0;
17
17
  const finalTaskIndex = stepNames.length + 1;
18
18
  let taskRes = {};
@@ -61,7 +61,7 @@ const modelfile = `CREATE TABLE IF NOT EXISTS modelfile (
61
61
  );`;
62
62
  const model = `CREATE TABLE IF NOT EXISTS model (
63
63
  id INTEGER PRIMARY KEY AUTOINCREMENT,
64
- name TEXT UNIQUE NOT NULL,
64
+ name TEXT NOT NULL,
65
65
  shortname TEXT UNIQUE NOT NULL,
66
66
  data TEXT NOT NULL
67
67
  );`;
package/dist/main.d.ts CHANGED
@@ -10,4 +10,5 @@ import { usePerfTimer } from "./primitives/perf.js";
10
10
  import { parseInferenceArgs } from "./primitives/args.js";
11
11
  import { parseTaskVars } from "./cmd/lib/tasks/conf.js";
12
12
  import { LmTaskConf } from "@agent-smith/lmtask/dist/interfaces.js";
13
- export { execute, run, pingCmd, executeWorkflowCmd, executeActionCmd, executeTaskCmd, writeToClipboard, initAgent, initState, pluginDataDir, usePerfTimer, parseInferenceArgs, parseTaskVars, LmTaskConf, };
13
+ import { extractToolDoc } from "./cmd/lib/tools.js";
14
+ export { execute, run, pingCmd, executeWorkflowCmd, executeActionCmd, executeTaskCmd, writeToClipboard, initAgent, initState, pluginDataDir, usePerfTimer, parseInferenceArgs, parseTaskVars, extractToolDoc, LmTaskConf, };
package/dist/main.js CHANGED
@@ -9,4 +9,5 @@ import { initState, pluginDataDir } from "./state/state.js";
9
9
  import { usePerfTimer } from "./primitives/perf.js";
10
10
  import { parseInferenceArgs } from "./primitives/args.js";
11
11
  import { parseTaskVars } from "./cmd/lib/tasks/conf.js";
12
- export { execute, run, pingCmd, executeWorkflowCmd, executeActionCmd, executeTaskCmd, writeToClipboard, initAgent, initState, pluginDataDir, usePerfTimer, parseInferenceArgs, parseTaskVars, };
12
+ import { extractToolDoc } from "./cmd/lib/tools.js";
13
+ export { execute, run, pingCmd, executeWorkflowCmd, executeActionCmd, executeTaskCmd, writeToClipboard, initAgent, initState, pluginDataDir, usePerfTimer, parseInferenceArgs, parseTaskVars, extractToolDoc, };
@@ -24,7 +24,7 @@ function parseInferenceArgs(args) {
24
24
  });
25
25
  break;
26
26
  default:
27
- throw new Error(`unknown arg ${a}`);
27
+ vars[k] = v;
28
28
  }
29
29
  }
30
30
  else {
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.52",
5
+ "version": "0.0.54",
6
6
  "scripts": {
7
7
  "buildrl": "rm -rf dist/* && rollup -c",
8
8
  "build": "rm -rf dist/* && tsc",
@@ -12,18 +12,18 @@
12
12
  "dependencies": {
13
13
  "@agent-smith/brain": "^0.0.42",
14
14
  "@agent-smith/jobs": "^0.0.14",
15
- "@agent-smith/lmtask": "^0.0.37",
15
+ "@agent-smith/lmtask": "^0.0.38",
16
16
  "@agent-smith/tfm": "^0.1.2",
17
- "@inquirer/prompts": "^7.4.1",
18
- "@inquirer/select": "^4.1.1",
17
+ "@inquirer/prompts": "^7.5.0",
18
+ "@inquirer/select": "^4.2.0",
19
19
  "@vue/reactivity": "^3.5.13",
20
- "@wllama/wllama": "^2.3.0",
20
+ "@wllama/wllama": "^2.3.1",
21
21
  "ansi-colors": "^4.1.3",
22
22
  "better-sqlite3": "^11.9.1",
23
23
  "clipboardy": "^4.0.0",
24
24
  "commander": "^13.1.0",
25
25
  "marked-terminal": "^7.3.0",
26
- "modprompt": "^0.10.9",
26
+ "modprompt": "^0.11.0",
27
27
  "python-shell": "^5.0.0",
28
28
  "yaml": "^2.7.1"
29
29
  },
@@ -35,9 +35,9 @@
35
35
  "@rollup/plugin-typescript": "^12.1.2",
36
36
  "@types/better-sqlite3": "^7.6.13",
37
37
  "@types/marked-terminal": "^6.1.1",
38
- "@types/node": "^22.14.0",
38
+ "@types/node": "^22.15.3",
39
39
  "restmix": "^0.5.0",
40
- "rollup": "^4.39.0",
40
+ "rollup": "^4.40.1",
41
41
  "ts-node": "^10.9.2",
42
42
  "tslib": "2.8.1",
43
43
  "typescript": "^5.8.3"