@agent-smith/cli 0.0.15 → 0.0.17

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.
@@ -71,14 +71,12 @@ function initAliases() {
71
71
  _cmds[alias.name] = {
72
72
  cmd: (args = [], options = {}, quiet = false) => executeActionCmd([alias.name, ...args], options, quiet),
73
73
  description: "action: " + alias.name,
74
- args: "arguments: \n-args: other arguments if any for the action"
75
74
  };
76
75
  break;
77
76
  case "job":
78
77
  _cmds[alias.name] = {
79
78
  cmd: (args = [], options) => _executeJobCmd([alias.name, ...args], options),
80
79
  description: "job: " + alias.name,
81
- args: "arguments: \n-args: other arguments if any for the job"
82
80
  };
83
81
  }
84
82
  });
@@ -145,7 +143,7 @@ async function _executeJobCmd(args = [], options) {
145
143
  return;
146
144
  }
147
145
  const name = args.shift();
148
- const res = await executeJobCmd(name, args);
146
+ const res = await executeJobCmd(name, args, options);
149
147
  return res;
150
148
  }
151
149
  async function _readTaskCmd(args = [], options) {
@@ -49,7 +49,7 @@ async function executeActionCmd(args = [], options = {}, quiet = false) {
49
49
  throw new Error(`Action ext ${ext} not implemented`);
50
50
  break;
51
51
  }
52
- const res = await act.run(args);
52
+ const res = await act.run(args, options);
53
53
  if (!quiet) {
54
54
  console.log(res.data);
55
55
  }
@@ -1,4 +1,4 @@
1
- declare function executeJobCmd(name: string, args?: Array<any>): Promise<Record<string, any>>;
1
+ declare function executeJobCmd(name: string, args?: Array<any>, options?: any): Promise<Record<string, any>>;
2
2
  declare function readJob(name: string): Promise<{
3
3
  found: boolean;
4
4
  data: Record<string, any>;
@@ -5,7 +5,7 @@ import { brain, marked, taskBuilder } from '../../agent.js';
5
5
  import { getFeatureSpec } from '../../state/features.js';
6
6
  import { formatMode } from '../../state/state.js';
7
7
  import { initTaskVars, readTask } from './utils.js';
8
- async function executeJobCmd(name, args = []) {
8
+ async function executeJobCmd(name, args = [], options = {}) {
9
9
  const { job, found } = await _dispatchReadJob(name);
10
10
  if (!found) {
11
11
  console.log(`Job ${name} not found`);
@@ -20,15 +20,9 @@ async function executeJobCmd(name, args = []) {
20
20
  if (task.type == "task") {
21
21
  let conf = {};
22
22
  let vars = {};
23
- if (i == 0) {
24
- const tv = initTaskVars(args);
25
- conf = tv.conf;
26
- vars = tv.vars;
27
- }
28
- else {
29
- conf = {};
30
- vars = params;
31
- }
23
+ const tv = initTaskVars(args);
24
+ conf = tv.conf;
25
+ vars = i == 0 ? tv.vars : params;
32
26
  const { found, path } = getFeatureSpec(name, "task");
33
27
  if (!found) {
34
28
  return { ok: false, data: {}, error: `Task ${name} not found` };
@@ -38,9 +32,17 @@ async function executeJobCmd(name, args = []) {
38
32
  throw new Error(`Task ${name}, ${path} not found`);
39
33
  }
40
34
  const taskSpec = taskBuilder.readFromYaml(tres.ymlTask);
41
- const ex = brain.getOrCreateExpertForModel(taskSpec.model.name, taskSpec.template.name);
35
+ let m = taskSpec.model.name;
36
+ let t = taskSpec.template.name;
37
+ if (conf?.model) {
38
+ m = conf.model;
39
+ }
40
+ if (conf?.template) {
41
+ t = conf.template;
42
+ }
43
+ const ex = brain.getOrCreateExpertForModel(m, t);
42
44
  if (!ex) {
43
- throw new Error("No expert found for model " + taskSpec.model.name);
45
+ throw new Error("No expert found for model " + m);
44
46
  }
45
47
  ex.checkStatus();
46
48
  ex.backend.setOnToken((t) => {
@@ -64,10 +66,10 @@ async function executeJobCmd(name, args = []) {
64
66
  else {
65
67
  try {
66
68
  if (i == 0) {
67
- res = await job.runTask(name, args);
69
+ res = await job.runTask(name, args, options);
68
70
  }
69
71
  else {
70
- res = await job.runTask(name, params);
72
+ res = await job.runTask(name, params, options);
71
73
  }
72
74
  params = res.data;
73
75
  }
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.15",
5
+ "version": "0.0.17",
6
6
  "scripts": {
7
7
  "buildrl": "rm -rf dist/* && rollup -c",
8
8
  "build": "rm -rf dist/* && tsc",