@agent-smith/cli 0.0.7 → 0.0.8

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.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { useAgentBrain } from "@agent-smith/brain";
2
2
  import { LmTaskBuilder } from "@agent-smith/lmtask";
3
- ;
4
3
  import { marked } from 'marked';
5
4
  import { markedTerminal } from 'marked-terminal';
6
5
  marked.use(markedTerminal());
@@ -9,8 +8,8 @@ const modelsForExpert = {};
9
8
  const taskBuilder = new LmTaskBuilder(brain);
10
9
  async function initExperts() {
11
10
  brain.experts.forEach((ex) => {
12
- ex.setOnStartEmit(() => console.log(""));
13
- ex.setOnToken((t) => {
11
+ ex.backend.setOnStartEmit(() => console.log(""));
12
+ ex.backend.setOnToken((t) => {
14
13
  process.stdout.write(t);
15
14
  });
16
15
  });
@@ -18,9 +17,8 @@ async function initExperts() {
18
17
  async function initAgent(mode, isVerbose = false) {
19
18
  if (!brain.state.get().isOn) {
20
19
  brain.resetExperts();
21
- await brain.discoverLocal();
20
+ await brain.initLocal();
22
21
  await initExperts();
23
- await brain.expertsForModelsInfo();
24
22
  }
25
23
  const brainUp = brain.state.get().isOn;
26
24
  if (isVerbose) {
@@ -14,8 +14,8 @@ async function executeJobCmd(name, args = []) {
14
14
  await job.start();
15
15
  let params = args;
16
16
  let res = {};
17
+ brain.backendsForModelsInfo();
17
18
  for (const name of Object.keys(job.tasks)) {
18
- brain.expertsForModelsInfo();
19
19
  try {
20
20
  res = await job.runTask(name, params);
21
21
  if ("text" in res) {
@@ -1,4 +1,4 @@
1
- import { initAgent, taskBuilder } from "../../agent.js";
1
+ import { brain, initAgent, taskBuilder } from "../../agent.js";
2
2
  import { getFeatureSpec } from "../../state/features.js";
3
3
  import { runMode } from "../../state/state.js";
4
4
  import { readTask } from "./utils.js";
@@ -13,6 +13,7 @@ async function executeTaskCmd(args = [], options = {}) {
13
13
  if (!res.found) {
14
14
  throw new Error(`Task ${name}, ${path} not found`);
15
15
  }
16
+ const taskSpec = taskBuilder.readFromYaml(res.ymlTask);
16
17
  const task = taskBuilder.fromYaml(res.ymlTask);
17
18
  const pr = args.shift();
18
19
  const vars = {};
@@ -22,6 +23,15 @@ async function executeTaskCmd(args = [], options = {}) {
22
23
  vars[t[0]] = t[1];
23
24
  }
24
25
  });
26
+ const ex = brain.getOrCreateExpertForModel(taskSpec.model.name, taskSpec.template.name);
27
+ if (!ex) {
28
+ throw new Error("No expert found for model " + taskSpec.model.name);
29
+ }
30
+ ex.checkStatus();
31
+ ex.backend.setOnToken((t) => {
32
+ process.stdout.write(t);
33
+ });
34
+ vars["expert"] = ex;
25
35
  console.log("Ingesting prompt ...");
26
36
  const data = await task.run({ prompt: pr, ...vars });
27
37
  if (data?.error) {
@@ -1,3 +1,3 @@
1
- import { Features } from "bin/interfaces";
1
+ import { Features } from "../../interfaces.js";
2
2
  declare function readFeaturesDir(dir: string): Features;
3
3
  export { readFeaturesDir };
package/dist/db/db.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import DatabaseConstructor from "better-sqlite3";
2
2
  import { schemas } from "./schemas.js";
3
3
  import { dbPath } from "../conf.js";
4
- let db;
4
+ let db = new DatabaseConstructor("x", { fileMustExist: false });
5
5
  function initDb(isVerbose = false) {
6
6
  db = new DatabaseConstructor(dbPath);
7
7
  schemas.forEach((s) => {
@@ -9,7 +9,6 @@ function readFeaturesDirs(featuresPaths) {
9
9
  cmd: [],
10
10
  };
11
11
  featuresPaths.forEach((dir) => {
12
- console.log("Reading feats in", dir);
13
12
  const _f = readFeaturesDir(dir);
14
13
  _f.task.forEach((item) => feats.task.push(item));
15
14
  _f.job.forEach((item) => feats.job.push(item));
@@ -1,11 +1,11 @@
1
1
  import { PythonShell } from 'python-shell';
2
2
  import { InputMode, RunMode, FormatMode, OutputMode } from "../interfaces.js";
3
3
  declare let pyShell: PythonShell;
4
- declare const inputMode: import("@vue/reactivity").Ref<InputMode>;
5
- declare const outputMode: import("@vue/reactivity").Ref<OutputMode>;
6
- declare const runMode: import("@vue/reactivity").Ref<RunMode>;
7
- declare const formatMode: import("@vue/reactivity").Ref<FormatMode>;
8
- declare const promptfile: import("@vue/reactivity").Ref<string>;
4
+ declare const inputMode: import("@vue/reactivity").Ref<InputMode, InputMode>;
5
+ declare const outputMode: import("@vue/reactivity").Ref<OutputMode, OutputMode>;
6
+ declare const runMode: import("@vue/reactivity").Ref<RunMode, RunMode>;
7
+ declare const formatMode: import("@vue/reactivity").Ref<FormatMode, FormatMode>;
8
+ declare const promptfile: import("@vue/reactivity").Ref<string, string>;
9
9
  declare const lastCmd: {
10
10
  name: string;
11
11
  args: Array<string>;
@@ -32,5 +32,6 @@ async function initFeatures() {
32
32
  }
33
33
  async function initState() {
34
34
  initConf();
35
+ await initFeatures();
35
36
  }
36
37
  export { inputMode, outputMode, runMode, formatMode, lastCmd, promptfile, initState, initFeatures, pyShell, };
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.7",
5
+ "version": "0.0.8",
6
6
  "scripts": {
7
7
  "buildrl": "rm -rf dist/* && rollup -c",
8
8
  "build": "rm -rf dist/* && tsc",
@@ -10,34 +10,35 @@
10
10
  "watch": "tsc -p . -w"
11
11
  },
12
12
  "dependencies": {
13
- "@agent-smith/brain": "^0.0.18",
13
+ "@agent-smith/brain": "^0.0.24",
14
14
  "@agent-smith/jobs": "^0.0.8",
15
- "@agent-smith/lmtask": "^0.0.13",
16
- "@inquirer/prompts": "^5.3.8",
17
- "@inquirer/select": "^2.4.7",
18
- "@vue/reactivity": "^3.4.38",
19
- "better-sqlite3": "^11.2.1",
15
+ "@agent-smith/lmtask": "^0.0.17",
16
+ "@inquirer/prompts": "^6.0.1",
17
+ "@inquirer/select": "^3.0.1",
18
+ "@vue/reactivity": "^3.5.6",
19
+ "better-sqlite3": "^11.3.0",
20
20
  "clipboardy": "^4.0.0",
21
21
  "commander": "^12.1.0",
22
22
  "draftlog": "^1.0.13",
23
23
  "marked-terminal": "^7.1.0",
24
24
  "modprompt": "^0.7.7",
25
25
  "python-shell": "^5.0.0",
26
- "yaml": "^2.5.0"
26
+ "yaml": "^2.5.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@agent-smith/tmem-jobs": "^0.0.3",
30
30
  "@commander-js/extra-typings": "^12.1.0",
31
- "@locallm/types": "^0.0.17",
31
+ "@locallm/types": "^0.1.5",
32
32
  "@rollup/plugin-node-resolve": "^15.2.3",
33
33
  "@rollup/plugin-typescript": "^11.1.6",
34
34
  "@types/better-sqlite3": "^7.6.11",
35
35
  "@types/marked-terminal": "^6.1.1",
36
- "@types/node": "^22.5.2",
37
- "rollup": "^4.21.2",
36
+ "@types/node": "^22.5.5",
37
+ "restmix": "^0.5.0",
38
+ "rollup": "^4.21.3",
38
39
  "ts-node": "^10.9.2",
39
40
  "tslib": "2.7.0",
40
- "typescript": "^5.5.4"
41
+ "typescript": "^5.6.2"
41
42
  },
42
43
  "type": "module",
43
44
  "preferGlobal": true,