@agent-smith/cli 0.0.50 → 0.0.51

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.
@@ -1,12 +1,12 @@
1
1
  import { compile, serializeGrammar } from "@intrinsicai/gbnfgen";
2
2
  import YAML from 'yaml';
3
3
  import { brain, initAgent, taskBuilder } from "../../../agent.js";
4
+ import { readTool } from "../../../db/read.js";
4
5
  import { getFeatureSpec } from "../../../state/features.js";
5
6
  import { isChatMode, isDebug, isShowTokens, isVerbose } from "../../../state/state.js";
6
- import { formatStats, parseInputOptions } from "../utils.js";
7
7
  import { readTask } from "../../sys/read_task.js";
8
- import { readTool } from "../../../db/read.js";
9
8
  import { executeActionCmd, } from "../actions/cmd.js";
9
+ import { formatStats, parseInputOptions } from "../utils.js";
10
10
  import { executeWorkflowCmd } from "../workflows/cmd.js";
11
11
  import { configureTaskModel, parseTaskVars } from "./conf.js";
12
12
  async function executeTaskCmd(args = [], options = {}) {
@@ -1,6 +1,6 @@
1
1
  import { LmTaskConfig, LmTaskFileSpec, ModelSpec } from "../../../interfaces.js";
2
2
  declare function configureTaskModel(itConf: LmTaskConfig, taskSpec: LmTaskFileSpec): ModelSpec;
3
- declare function parseTaskVars(params: Array<any> | Record<string, any>, inferParams: Record<string, any>): {
3
+ declare function parseTaskVars(params: Array<any> | Record<string, any>, inferParams?: Record<string, any>): {
4
4
  conf: LmTaskConfig;
5
5
  vars: Record<string, any>;
6
6
  };
@@ -53,12 +53,13 @@ function configureTaskModel(itConf, taskSpec) {
53
53
  }
54
54
  }
55
55
  }
56
- if (!found) {
57
- const m = readModel(modelName);
58
- if (m.found) {
59
- model = m.modelData;
60
- found = true;
61
- }
56
+ }
57
+ if (!found) {
58
+ const m = readModel(modelName);
59
+ if (m.found) {
60
+ model = m.modelData;
61
+ model.template = m.modelData.template;
62
+ found = true;
62
63
  }
63
64
  }
64
65
  if (!found) {
@@ -82,7 +83,7 @@ function configureTaskModel(itConf, taskSpec) {
82
83
  }
83
84
  return model;
84
85
  }
85
- function parseTaskVars(params, inferParams) {
86
+ function parseTaskVars(params, inferParams = {}) {
86
87
  switch (Array.isArray(params)) {
87
88
  case true:
88
89
  return _initTaskVars(params, inferParams);
@@ -99,13 +100,21 @@ function _initTaskParams(params, inferParams) {
99
100
  conf.inferParams.images = params.images;
100
101
  delete params.images;
101
102
  }
102
- if (params?.model) {
103
- conf.modelname = params.model;
104
- delete params.model;
103
+ if (params?.modelname) {
104
+ conf.modelname = params.modelname;
105
+ delete params.modelname;
105
106
  }
106
107
  if (params?.template) {
107
- conf.templateName = params.template;
108
- delete params.template;
108
+ conf.templateName = params.templateName;
109
+ delete params.templateName;
110
+ }
111
+ const ip = conf.inferParams;
112
+ if (params?.inferParams) {
113
+ for (const [k, v] of Object.entries(params.inferParams)) {
114
+ ip[k] = v;
115
+ }
116
+ conf.inferParams = ip;
117
+ delete params.inferParams;
109
118
  }
110
119
  const res = { conf: conf, vars: params };
111
120
  return res;
@@ -1,5 +1,5 @@
1
1
  function parseInferenceArgs(args) {
2
- const vars = {};
2
+ const vars = { "inferParams": {} };
3
3
  const nargs = new Array();
4
4
  args.forEach((a) => {
5
5
  if (a.includes("=")) {
@@ -10,11 +10,11 @@ function parseInferenceArgs(args) {
10
10
  case "m":
11
11
  if (v.includes("/")) {
12
12
  const _s = v.split("/");
13
- vars.model = _s[0];
14
- vars.template = _s[1];
13
+ vars.modelname = _s[0];
14
+ vars.templateName = _s[1];
15
15
  }
16
16
  else {
17
- vars.model = v;
17
+ vars.modelname = v;
18
18
  }
19
19
  break;
20
20
  case "ip":
@@ -23,12 +23,8 @@ function parseInferenceArgs(args) {
23
23
  vars["inferParams"][s[0]] = parseFloat(s[1]);
24
24
  });
25
25
  break;
26
- case "s":
27
- vars.size = v;
28
- break;
29
26
  default:
30
- vars[k] = v;
31
- break;
27
+ throw new Error(`unknown arg ${a}`);
32
28
  }
33
29
  }
34
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.50",
5
+ "version": "0.0.51",
6
6
  "scripts": {
7
7
  "buildrl": "rm -rf dist/* && rollup -c",
8
8
  "build": "rm -rf dist/* && tsc",