@agent-smith/cli 0.0.101 → 0.0.102

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.
@@ -37,7 +37,7 @@ async function executeTask(name, payload, options) {
37
37
  if (options?.debug || options?.backend) {
38
38
  console.log("Agent:", colors.bold(agent.lm.name), "( " + agent.lm.providerType + " backend type)");
39
39
  }
40
- const { task, model, conf, vars, mcpServers } = await readTask(name, payload, options, agent);
40
+ const { task, model, conf, vars, mcpServers, taskDir } = await readTask(name, payload, options, agent);
41
41
  if (hasSettings) {
42
42
  if (!model?.inferParams) {
43
43
  model.inferParams = {};
@@ -191,6 +191,7 @@ async function executeTask(name, payload, options) {
191
191
  delete conf.model;
192
192
  }
193
193
  const tconf = {
194
+ baseDir: taskDir,
194
195
  model: model,
195
196
  onToolCall: onToolCall,
196
197
  onToolCallEnd: onToolCallEnd,
@@ -1,11 +1,14 @@
1
1
  import { Agent } from "@agent-smith/agent";
2
- import { ModelSpec, Task, TaskConf } from "@agent-smith/task";
2
+ import { ModelSpec } from "@agent-smith/task";
3
+ import { NodeTask } from "@agent-smith/nodetask";
3
4
  import { McpClient } from "../mcp.js";
5
+ import type { LmTaskConfig } from "../../../interfaces.js";
4
6
  declare function readTask(name: string, payload: Record<string, any>, options: Record<string, any>, agent: Agent): Promise<{
5
- task: Task;
7
+ task: NodeTask;
6
8
  model: ModelSpec;
7
- conf: TaskConf;
9
+ conf: LmTaskConfig;
8
10
  vars: Record<string, any>;
9
11
  mcpServers: Array<McpClient>;
12
+ taskDir: string;
10
13
  }>;
11
14
  export { readTask };
@@ -1,4 +1,5 @@
1
- import { Task } from "@agent-smith/task";
1
+ import path from "path";
2
+ import { NodeTask } from "@agent-smith/nodetask";
2
3
  import { compile, serializeGrammar } from "@intrinsicai/gbnfgen";
3
4
  import { readTool } from "../../../db/read.js";
4
5
  import { executeAction } from "../actions/cmd.js";
@@ -15,7 +16,8 @@ async function readTask(name, payload, options, agent) {
15
16
  console.log("Payload:", payload);
16
17
  console.log("Task options:", options);
17
18
  }
18
- const taskFileSpec = openTaskSpec(name);
19
+ const { taskFileSpec, taskPath } = openTaskSpec(name);
20
+ const taskDir = path.dirname(taskPath);
19
21
  const opts = payload?.inferParams ? { ...options, ...payload.inferParams } : options;
20
22
  const conf = parseTaskConfigOptions(opts);
21
23
  if (options?.debug) {
@@ -115,11 +117,11 @@ async function readTask(name, payload, options, agent) {
115
117
  delete taskSpec.toolsList;
116
118
  }
117
119
  ;
118
- const task = new Task(agent, taskSpec);
120
+ const task = new NodeTask(agent, taskSpec);
119
121
  if (model?.inferParams?.tsGrammar) {
120
122
  model.inferParams.grammar = serializeGrammar(await compile(model.inferParams.tsGrammar, "Grammar"));
121
123
  delete model.inferParams.tsGrammar;
122
124
  }
123
- return { task, model, conf, vars, mcpServers };
125
+ return { task, model, conf, vars, mcpServers, taskDir };
124
126
  }
125
127
  export { readTask };
@@ -1,4 +1,7 @@
1
1
  import { LmTaskFileSpec } from "../../../interfaces.js";
2
- declare function openTaskSpec(name: string): LmTaskFileSpec;
2
+ declare function openTaskSpec(name: string): {
3
+ taskFileSpec: LmTaskFileSpec;
4
+ taskPath: string;
5
+ };
3
6
  declare function getTaskPrompt(name: string, args: Array<string>, options: Record<string, any>): Promise<string>;
4
- export { openTaskSpec, getTaskPrompt, };
7
+ export { getTaskPrompt, openTaskSpec };
@@ -1,9 +1,9 @@
1
1
  import YAML from 'yaml';
2
+ import { readClipboard } from '../../../cmd/sys/clipboard.js';
2
3
  import { readTask } from "../../../cmd/sys/read_task.js";
3
4
  import { getFeatureSpec } from "../../../state/features.js";
4
- import { readClipboard } from '../../../cmd/sys/clipboard.js';
5
- import { readPromptFile } from '../utils.js';
6
5
  import { runtimeDataError } from '../user_msgs.js';
6
+ import { readPromptFile } from '../utils.js';
7
7
  function openTaskSpec(name) {
8
8
  const { found, path } = getFeatureSpec(name, "task");
9
9
  if (!found) {
@@ -15,7 +15,7 @@ function openTaskSpec(name) {
15
15
  }
16
16
  const taskFileSpec = YAML.parse(res.ymlTask);
17
17
  taskFileSpec.name = name;
18
- return taskFileSpec;
18
+ return { taskFileSpec: taskFileSpec, taskPath: path };
19
19
  }
20
20
  async function getTaskPrompt(name, args, options) {
21
21
  let pr;
@@ -36,4 +36,4 @@ async function getTaskPrompt(name, args, options) {
36
36
  }
37
37
  return pr;
38
38
  }
39
- export { openTaskSpec, getTaskPrompt, };
39
+ export { getTaskPrompt, openTaskSpec };
@@ -66,7 +66,7 @@ function _parseToolDoc(rawTxt, name) {
66
66
  return res;
67
67
  }
68
68
  catch (e) {
69
- throw new Error(`Error parsing tool ${name}: data:\n${rawTxt}\n`);
69
+ throw new Error(`Error parsing tool ${name}: ${e} \nData:\n${rawTxt}\n`);
70
70
  }
71
71
  }
72
72
  function _parseTaskVariables(data) {
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.101",
5
+ "version": "0.0.102",
6
6
  "scripts": {
7
7
  "buildrl": "rm -rf dist/* && rollup -c",
8
8
  "build": "rm -rf dist/* && tsc",
@@ -11,7 +11,8 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@agent-smith/agent": "^0.2.0",
14
- "@agent-smith/task": "^0.2.0",
14
+ "@agent-smith/task": "^0.2.1",
15
+ "@agent-smith/nodetask": "^0.1.0",
15
16
  "@agent-smith/tfm": "^0.2.0",
16
17
  "@inquirer/prompts": "^8.1.0",
17
18
  "@intrinsicai/gbnfgen": "0.12.0",