@agent-smith/cli 0.0.23 → 0.0.24

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.
package/dist/agent.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { LmTaskBuilder } from "@agent-smith/lmtask";
1
+ import { LmTaskBuilder } from "../../lmtask/dist/task.js";
2
2
  import { marked } from 'marked';
3
3
  import { FeatureType } from "./interfaces.js";
4
4
  declare let brain: import("@agent-smith/brain").AgentBrain<Record<string, any>>;
package/dist/agent.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useAgentBrain } from "@agent-smith/brain";
2
- import { LmTaskBuilder } from "@agent-smith/lmtask";
2
+ import { LmTaskBuilder } from "../../lmtask/dist/task.js";
3
3
  import { marked } from 'marked';
4
4
  import { markedTerminal } from "marked-terminal";
5
5
  marked.use(markedTerminal());
@@ -33,7 +33,7 @@ async function executeJobCmd(name, args = [], options = {}) {
33
33
  }
34
34
  const taskSpec = taskBuilder.readFromYaml(tres.ymlTask);
35
35
  let m = taskSpec.model.name;
36
- let t = taskSpec.template.name;
36
+ let t = taskSpec.model.template;
37
37
  if (conf?.model) {
38
38
  m = conf.model;
39
39
  }
@@ -2,6 +2,8 @@ import { brain, initAgent, taskBuilder } from "../../agent.js";
2
2
  import { getFeatureSpec } from "../../state/features.js";
3
3
  import { isChatMode, isDebug } from "../../state/state.js";
4
4
  import { initTaskVars, parseInputOptions, readTask } from "./utils.js";
5
+ import { useTemplateForModel } from "@agent-smith/tfm";
6
+ const tfm = useTemplateForModel();
5
7
  async function executeTaskCmd(args = [], options = {}) {
6
8
  await initAgent();
7
9
  if (isDebug.value) {
@@ -36,12 +38,41 @@ async function executeTaskCmd(args = [], options = {}) {
36
38
  console.log("Task vars:", vars);
37
39
  }
38
40
  let m = taskSpec.model.name;
39
- let t = taskSpec.template.name;
41
+ let t = taskSpec.model.template;
42
+ let c = taskSpec.model.ctx;
40
43
  if (conf?.model) {
41
44
  m = conf.model;
45
+ if (conf?.template) {
46
+ t = conf.template;
47
+ }
48
+ else {
49
+ const gt = tfm.guess(m);
50
+ if (gt == "none") {
51
+ throw new Error(`Unable to guess the template for ${conf.model}: please provide a template name: m="modelname/templatename"`);
52
+ }
53
+ t = gt;
54
+ }
55
+ }
56
+ else {
57
+ if (conf?.size) {
58
+ if (!taskSpec?.models) {
59
+ throw new Error(`Model ${conf.size} not found in task`);
60
+ }
61
+ if (!Object.keys(taskSpec.models).includes(conf.size)) {
62
+ throw new Error(`Model ${conf.size} not found in task`);
63
+ }
64
+ m = taskSpec.models[conf.size].name;
65
+ t = taskSpec.models[conf.size].template;
66
+ c = taskSpec.models[conf.size].ctx;
67
+ }
42
68
  }
43
- if (conf?.template) {
44
- t = conf.template;
69
+ conf.model = {
70
+ name: m,
71
+ template: t,
72
+ ctx: c,
73
+ };
74
+ if (isDebug.value) {
75
+ console.log("Model:", conf.model);
45
76
  }
46
77
  const ex = brain.getOrCreateExpertForModel(m, t);
47
78
  if (!ex) {
@@ -62,9 +93,6 @@ async function executeTaskCmd(args = [], options = {}) {
62
93
  if (isDebug.value) {
63
94
  conf.debug = true;
64
95
  }
65
- if (isDebug.value) {
66
- console.log("Vars", vars);
67
- }
68
96
  const data = await task.run({ prompt: pr, ...vars }, conf);
69
97
  if (data?.error) {
70
98
  return { ok: false, data: "", conf: conf, error: `Error executing task: ${data.error}` };
@@ -99,6 +99,9 @@ function initTaskVars(args) {
99
99
  });
100
100
  conf.inferParams = ip;
101
101
  }
102
+ else if (k == "s") {
103
+ conf.size = v;
104
+ }
102
105
  else {
103
106
  vars[k] = v;
104
107
  }
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.23",
5
+ "version": "0.0.24",
6
6
  "scripts": {
7
7
  "buildrl": "rm -rf dist/* && rollup -c",
8
8
  "build": "rm -rf dist/* && tsc",