@agent-smith/cli 0.0.41 → 0.0.43
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 +1 -1
- package/dist/agent.js +4 -17
- package/dist/cmd/clicmds/cmds.js +4 -3
- package/dist/cmd/lib/tasks/cmd.d.ts +1 -1
- package/dist/cmd/lib/tasks/cmd.js +49 -6
- package/dist/cmd/lib/utils.d.ts +5 -3
- package/dist/cmd/lib/utils.js +30 -4
- package/dist/cmd/sys/read_features.js +15 -0
- package/dist/cmd/sys/read_models.d.ts +7 -0
- package/dist/cmd/sys/read_models.js +21 -0
- package/dist/cmd/sys/run_python.d.ts +4 -2
- package/dist/db/read.js +2 -1
- package/dist/db/schemas.js +3 -3
- package/dist/db/write.js +1 -0
- package/dist/interfaces.d.ts +8 -2
- package/dist/main.d.ts +2 -1
- package/dist/main.js +2 -1
- package/dist/state/features.js +2 -0
- package/dist/state/state.js +5 -0
- package/package.json +7 -7
package/dist/agent.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { marked } from 'marked';
|
|
|
3
3
|
import { FeatureType } from "./interfaces.js";
|
|
4
4
|
declare let brain: import("@agent-smith/brain").AgentBrain<Record<string, any>>;
|
|
5
5
|
declare const taskBuilder: LmTaskBuilder<FeatureType, Record<string, any>>;
|
|
6
|
-
declare function initAgent(
|
|
6
|
+
declare function initAgent(): Promise<boolean>;
|
|
7
7
|
export { brain, initAgent, marked, taskBuilder };
|
package/dist/agent.js
CHANGED
|
@@ -12,28 +12,15 @@ async function initExperts() {
|
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
async function initAgent(
|
|
15
|
+
async function initAgent() {
|
|
16
16
|
if (!brain.state.get().isOn) {
|
|
17
17
|
brain.resetExperts();
|
|
18
|
-
await brain.initLocal(true
|
|
18
|
+
await brain.initLocal(true);
|
|
19
19
|
await initExperts();
|
|
20
20
|
}
|
|
21
21
|
const brainUp = brain.state.get().isOn;
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
console.log("❌ No backends found for inference");
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
brain.backends.forEach((b) => {
|
|
28
|
-
console.log(`✅ Backend ${b.name} is up`);
|
|
29
|
-
if (b.lm.providerType == "ollama") {
|
|
30
|
-
console.log(" Models:", b.lm.models.map(x => x.name));
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
console.log(" Model:", b.lm.model.name);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
22
|
+
if (!brainUp) {
|
|
23
|
+
console.log("❌ No backends found for inference");
|
|
37
24
|
}
|
|
38
25
|
return brainUp;
|
|
39
26
|
}
|
package/dist/cmd/clicmds/cmds.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import YAML from 'yaml';
|
|
2
|
+
import { formatMode, isChatMode, promptfilePath, runMode } from "../../state/state.js";
|
|
2
3
|
import { getFeatureSpec, readFeaturesDirs } from "../../state/features.js";
|
|
3
4
|
import { readAliases, readFeatures } from "../../db/read.js";
|
|
4
5
|
import { cleanupFeaturePaths, updateAliases, updateFeatures, updatePromptfilePath } from "../../db/write.js";
|
|
@@ -87,7 +88,7 @@ async function initCmds() {
|
|
|
87
88
|
return cmds;
|
|
88
89
|
}
|
|
89
90
|
async function pingCmd(args = [], options) {
|
|
90
|
-
const isUp = await initAgent(
|
|
91
|
+
const isUp = await initAgent();
|
|
91
92
|
return isUp;
|
|
92
93
|
}
|
|
93
94
|
async function _updateConfCmd(args = [], options) {
|
|
@@ -157,7 +158,7 @@ async function _readTaskCmd(args = [], options) {
|
|
|
157
158
|
throw new Error(`Task ${args[0]}, ${path} not found`);
|
|
158
159
|
}
|
|
159
160
|
const ts = taskBuilder.readFromYaml(res.ymlTask);
|
|
160
|
-
console.log(
|
|
161
|
+
console.log(YAML.stringify(ts));
|
|
161
162
|
}
|
|
162
163
|
async function _listTasksCmd(args = [], options) {
|
|
163
164
|
Object.keys(readFeatures().task).forEach((t) => console.log("-", t));
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { brain, initAgent, taskBuilder } from "../../../agent.js";
|
|
2
2
|
import { getFeatureSpec } from "../../../state/features.js";
|
|
3
3
|
import { isChatMode, isDebug, isShowTokens, isVerbose } from "../../../state/state.js";
|
|
4
|
-
import { initTaskConf, initTaskParams, initTaskVars, parseInputOptions } from "../utils.js";
|
|
4
|
+
import { formatStats, initTaskConf, initTaskParams, initTaskVars, parseInputOptions } from "../utils.js";
|
|
5
5
|
import { readTask } from "../../sys/read_task.js";
|
|
6
|
-
import { readTool } from "../../../db/read.js";
|
|
6
|
+
import { readFeature, readTool } from "../../../db/read.js";
|
|
7
|
+
import { LmTaskBuilder } from "../../../../../lmtask/dist/main.js";
|
|
7
8
|
import { executeActionCmd, } from "../actions/cmd.js";
|
|
8
9
|
import { executeWorkflowCmd } from "../workflows/cmd.js";
|
|
10
|
+
import { readModelsFile } from "../../../cmd/sys/read_models.js";
|
|
9
11
|
async function executeTaskCmd(args = [], options = {}) {
|
|
10
12
|
await initAgent();
|
|
11
13
|
if (isDebug.value) {
|
|
@@ -51,7 +53,48 @@ async function executeTaskCmd(args = [], options = {}) {
|
|
|
51
53
|
if (!res.found) {
|
|
52
54
|
throw new Error(`Task ${name}, ${path} not found`);
|
|
53
55
|
}
|
|
54
|
-
const
|
|
56
|
+
const taskRawSpec = taskBuilder.readSpecFromYaml(res.ymlTask);
|
|
57
|
+
let taskSpec;
|
|
58
|
+
let defaultCtx;
|
|
59
|
+
if (taskRawSpec?.modelset) {
|
|
60
|
+
const modelsFeat = readFeature(taskRawSpec.modelset.name, "modelset");
|
|
61
|
+
if (!modelsFeat.found) {
|
|
62
|
+
throw new Error(`modelset feature ${taskRawSpec.modelset.name} not found in conf db`);
|
|
63
|
+
}
|
|
64
|
+
const { found, ctx, max_tokens, models } = readModelsFile(modelsFeat.feature.path + "/" + modelsFeat.feature.name + "." + modelsFeat.feature.ext);
|
|
65
|
+
if (!found) {
|
|
66
|
+
throw new Error(`modelset ${taskRawSpec.modelset.name} not found`);
|
|
67
|
+
}
|
|
68
|
+
defaultCtx = ctx;
|
|
69
|
+
for (const [k, v] of Object.entries(models)) {
|
|
70
|
+
if (!v?.ctx) {
|
|
71
|
+
v.ctx = ctx;
|
|
72
|
+
models[k] = v;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
taskRawSpec.model = models[taskRawSpec.modelset.default];
|
|
76
|
+
if (!taskRawSpec.model) {
|
|
77
|
+
throw new Error(`model ${taskRawSpec.modelset.default} not found`);
|
|
78
|
+
}
|
|
79
|
+
if (!taskRawSpec.model?.ctx) {
|
|
80
|
+
taskRawSpec.model.ctx = ctx;
|
|
81
|
+
}
|
|
82
|
+
if (!taskRawSpec?.inferParams?.max_tokens) {
|
|
83
|
+
if (!taskRawSpec?.inferParams) {
|
|
84
|
+
taskRawSpec.inferParams = {};
|
|
85
|
+
}
|
|
86
|
+
taskRawSpec.inferParams.max_tokens = max_tokens;
|
|
87
|
+
}
|
|
88
|
+
taskRawSpec.models = models;
|
|
89
|
+
taskSpec = LmTaskBuilder.fromRawSpec(taskRawSpec);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
taskSpec = taskRawSpec;
|
|
93
|
+
if (!taskSpec.model?.ctx) {
|
|
94
|
+
throw new Error(`provide a ctx parameter in the task default model`);
|
|
95
|
+
}
|
|
96
|
+
defaultCtx = taskSpec.model.ctx;
|
|
97
|
+
}
|
|
55
98
|
if (taskSpec.toolsList) {
|
|
56
99
|
taskSpec.tools = [];
|
|
57
100
|
for (const toolName of taskSpec.toolsList) {
|
|
@@ -96,7 +139,7 @@ async function executeTaskCmd(args = [], options = {}) {
|
|
|
96
139
|
conf = tv.conf;
|
|
97
140
|
vars = tv.vars;
|
|
98
141
|
}
|
|
99
|
-
conf = initTaskConf(conf, taskSpec);
|
|
142
|
+
conf = initTaskConf(conf, taskSpec, defaultCtx);
|
|
100
143
|
if (isDebug.value) {
|
|
101
144
|
console.log("Task conf:", conf);
|
|
102
145
|
console.log("Task vars:", vars);
|
|
@@ -136,8 +179,8 @@ async function executeTaskCmd(args = [], options = {}) {
|
|
|
136
179
|
}
|
|
137
180
|
brain.ex.template.pushToHistory({ user: pr, assistant: out.answer.text });
|
|
138
181
|
}
|
|
139
|
-
if (isDebug.value) {
|
|
140
|
-
console.log("\n", out.answer.stats);
|
|
182
|
+
if (isDebug.value || isVerbose.value) {
|
|
183
|
+
console.log("\n", formatStats(out.answer.stats));
|
|
141
184
|
}
|
|
142
185
|
return out;
|
|
143
186
|
}
|
package/dist/cmd/lib/utils.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { LmTask } from "
|
|
1
|
+
import { LmTask } from "@agent-smith/lmtask";
|
|
2
|
+
import { InferenceStats } from "@locallm/types/dist/interfaces.js";
|
|
2
3
|
declare function setOptions(args: Array<string> | undefined, options: Record<string, any>): Promise<Array<string>>;
|
|
3
4
|
declare function readPromptFile(): string;
|
|
4
5
|
declare function processOutput(res: any): Promise<void>;
|
|
5
|
-
declare function initTaskConf(conf: Record<string, any>, taskSpec: LmTask): Record<string, any>;
|
|
6
|
+
declare function initTaskConf(conf: Record<string, any>, taskSpec: LmTask, defaultCtx: number): Record<string, any>;
|
|
6
7
|
declare function initTaskParams(params: Record<string, any>, inferParams: Record<string, any>): {
|
|
7
8
|
conf: Record<string, any>;
|
|
8
9
|
vars: Record<string, any>;
|
|
@@ -13,4 +14,5 @@ declare function initTaskVars(args: Array<any>, inferParams: Record<string, any>
|
|
|
13
14
|
vars: Record<string, any>;
|
|
14
15
|
};
|
|
15
16
|
declare function parseInputOptions(options: any): Promise<string | null>;
|
|
16
|
-
|
|
17
|
+
declare function formatStats(stats: InferenceStats): string;
|
|
18
|
+
export { initTaskConf, initTaskParams, initTaskVars, initActionVars, parseInputOptions, processOutput, readPromptFile, setOptions, formatStats, };
|
package/dist/cmd/lib/utils.js
CHANGED
|
@@ -48,11 +48,14 @@ async function processOutput(res) {
|
|
|
48
48
|
await writeToClipboard(data);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
function initTaskConf(conf, taskSpec) {
|
|
51
|
+
function initTaskConf(conf, taskSpec, defaultCtx) {
|
|
52
52
|
const _conf = conf;
|
|
53
53
|
let m = taskSpec.model.name;
|
|
54
54
|
let t = taskSpec.model.template;
|
|
55
|
-
let c = taskSpec.model
|
|
55
|
+
let c = taskSpec.model?.ctx ?? defaultCtx;
|
|
56
|
+
let ip = conf.inferParams;
|
|
57
|
+
let system = taskSpec.model?.system;
|
|
58
|
+
let assistant = taskSpec.model?.assistant;
|
|
56
59
|
if (conf?.model) {
|
|
57
60
|
m = conf.model;
|
|
58
61
|
if (conf?.template) {
|
|
@@ -76,7 +79,15 @@ function initTaskConf(conf, taskSpec) {
|
|
|
76
79
|
}
|
|
77
80
|
m = taskSpec.models[conf.size].name;
|
|
78
81
|
t = taskSpec.models[conf.size].template;
|
|
79
|
-
c = taskSpec.models[conf.size]
|
|
82
|
+
c = taskSpec.models[conf.size]?.ctx ?? defaultCtx;
|
|
83
|
+
if (taskSpec.models[conf.size]?.inferParams) {
|
|
84
|
+
const tip = taskSpec.models[conf.size].inferParams;
|
|
85
|
+
for (const [k, v] of Object.entries(tip)) {
|
|
86
|
+
ip[k] = v;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
system = taskSpec.models[conf.size]?.system;
|
|
90
|
+
assistant = taskSpec.models[conf.size]?.assistant;
|
|
80
91
|
}
|
|
81
92
|
}
|
|
82
93
|
_conf.model = {
|
|
@@ -84,6 +95,13 @@ function initTaskConf(conf, taskSpec) {
|
|
|
84
95
|
template: t,
|
|
85
96
|
ctx: c,
|
|
86
97
|
};
|
|
98
|
+
if (system) {
|
|
99
|
+
_conf.model.system = system;
|
|
100
|
+
}
|
|
101
|
+
if (assistant) {
|
|
102
|
+
_conf.model.assistant = assistant;
|
|
103
|
+
}
|
|
104
|
+
_conf.inferParams = ip;
|
|
87
105
|
if (_conf?.template) {
|
|
88
106
|
delete conf.template;
|
|
89
107
|
}
|
|
@@ -205,4 +223,12 @@ async function parseInputOptions(options) {
|
|
|
205
223
|
}
|
|
206
224
|
return out;
|
|
207
225
|
}
|
|
208
|
-
|
|
226
|
+
function formatStats(stats) {
|
|
227
|
+
const buf = new Array();
|
|
228
|
+
buf.push(`${stats.tokensPerSecond} tps`);
|
|
229
|
+
buf.push(`- ${stats.totalTimeSeconds}s`);
|
|
230
|
+
buf.push(`(${stats.ingestionTimeSeconds}s ingestion /`);
|
|
231
|
+
buf.push(`${stats.inferenceTimeSeconds}s inference)`);
|
|
232
|
+
return buf.join(" ");
|
|
233
|
+
}
|
|
234
|
+
export { initTaskConf, initTaskParams, initTaskVars, initActionVars, parseInputOptions, processOutput, readPromptFile, setOptions, formatStats, };
|
|
@@ -22,6 +22,7 @@ function readFeaturesDir(dir) {
|
|
|
22
22
|
cmd: [],
|
|
23
23
|
workflow: [],
|
|
24
24
|
adaptater: [],
|
|
25
|
+
modelset: []
|
|
25
26
|
};
|
|
26
27
|
let dirpath = path.join(dir, "tasks");
|
|
27
28
|
if (fs.existsSync(dirpath)) {
|
|
@@ -93,6 +94,20 @@ function readFeaturesDir(dir) {
|
|
|
93
94
|
});
|
|
94
95
|
});
|
|
95
96
|
}
|
|
97
|
+
dirpath = path.join(dir, "models");
|
|
98
|
+
if (fs.existsSync(dirpath)) {
|
|
99
|
+
const data = _readDir(dirpath, [".yml"]);
|
|
100
|
+
data.forEach((filename) => {
|
|
101
|
+
const parts = filename.split(".");
|
|
102
|
+
const ext = parts.pop();
|
|
103
|
+
const name = parts.join("");
|
|
104
|
+
feats.modelset.push({
|
|
105
|
+
name: name,
|
|
106
|
+
path: path.join(dirpath),
|
|
107
|
+
ext: ext,
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
96
111
|
return feats;
|
|
97
112
|
}
|
|
98
113
|
export { readFeaturesDir };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as fs } from "fs";
|
|
2
|
+
import YAML from 'yaml';
|
|
3
|
+
function readModelsFile(dir) {
|
|
4
|
+
if (!fs.existsSync(dir)) {
|
|
5
|
+
return { models: {}, ctx: 0, max_tokens: 0, found: false };
|
|
6
|
+
}
|
|
7
|
+
const data = fs.readFileSync(dir, 'utf8');
|
|
8
|
+
const m = YAML.parse(data);
|
|
9
|
+
if (!m?.ctx) {
|
|
10
|
+
throw new Error(`provide a ctx param in models file`);
|
|
11
|
+
}
|
|
12
|
+
if (!m?.max_tokens) {
|
|
13
|
+
throw new Error(`provide a max_tokens param in models file`);
|
|
14
|
+
}
|
|
15
|
+
const ctx = m.ctx;
|
|
16
|
+
const max_tokens = m.max_tokens;
|
|
17
|
+
delete m.ctx;
|
|
18
|
+
delete m.max_tokens;
|
|
19
|
+
return { models: m, ctx: ctx, max_tokens: max_tokens, found: true };
|
|
20
|
+
}
|
|
21
|
+
export { readModelsFile, };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { NodeReturnType } from '../../interfaces.js';
|
|
2
1
|
import { PythonShell } from 'python-shell';
|
|
3
|
-
declare function runPyScript(rsShell: PythonShell, pythonPath: string, scriptPath: string, scriptArgs: Array<string>, onEmitLine?: CallableFunction): Promise<
|
|
2
|
+
declare function runPyScript(rsShell: PythonShell, pythonPath: string, scriptPath: string, scriptArgs: Array<string>, onEmitLine?: CallableFunction): Promise<{
|
|
3
|
+
data: any;
|
|
4
|
+
error?: Error;
|
|
5
|
+
}>;
|
|
4
6
|
export { runPyScript };
|
package/dist/db/read.js
CHANGED
|
@@ -27,12 +27,13 @@ function _readFeaturesType(type) {
|
|
|
27
27
|
return f;
|
|
28
28
|
}
|
|
29
29
|
function readFeatures() {
|
|
30
|
-
const feats = { task: {}, action: {}, cmd: {}, workflow: {}, adaptater: {} };
|
|
30
|
+
const feats = { task: {}, action: {}, cmd: {}, workflow: {}, adaptater: {}, modelset: {} };
|
|
31
31
|
feats.task = _readFeaturesType("task");
|
|
32
32
|
feats.action = _readFeaturesType("action");
|
|
33
33
|
feats.cmd = _readFeaturesType("cmd");
|
|
34
34
|
feats.workflow = _readFeaturesType("workflow");
|
|
35
35
|
feats.adaptater = _readFeaturesType("adaptater");
|
|
36
|
+
feats.modelset = _readFeaturesType("modelset");
|
|
36
37
|
return feats;
|
|
37
38
|
}
|
|
38
39
|
function readAliases() {
|
package/dist/db/schemas.js
CHANGED
|
@@ -53,11 +53,11 @@ const alias = `CREATE TABLE IF NOT EXISTS aliases (
|
|
|
53
53
|
name TEXT UNIQUE NOT NULL,
|
|
54
54
|
type TEXT NOT NULL CHECK ( type IN ('task', 'action', 'workflow') )
|
|
55
55
|
);`;
|
|
56
|
-
const model = `CREATE TABLE IF NOT EXISTS
|
|
56
|
+
const model = `CREATE TABLE IF NOT EXISTS modelset (
|
|
57
57
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
58
58
|
name TEXT UNIQUE NOT NULL,
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
path TEXT NOT NULL,
|
|
60
|
+
ext TEXT NOT NULL CHECK ( ext IN ('yml') )
|
|
61
61
|
);`;
|
|
62
62
|
const schemas = [
|
|
63
63
|
filepath,
|
package/dist/db/write.js
CHANGED
|
@@ -118,5 +118,6 @@ function updateFeatures(feats) {
|
|
|
118
118
|
upsertAndCleanFeatures(feats.cmd, "cmd");
|
|
119
119
|
upsertAndCleanFeatures(feats.workflow, "workflow");
|
|
120
120
|
upsertAndCleanFeatures(feats.adaptater, "adaptater");
|
|
121
|
+
upsertAndCleanFeatures(feats.modelset, "modelset");
|
|
121
122
|
}
|
|
122
123
|
export { updatePromptfilePath, insertFeaturesPathIfNotExists, insertPluginIfNotExists, updateFeatures, updateAliases, cleanupFeaturePaths, };
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -34,6 +34,11 @@ interface Features {
|
|
|
34
34
|
path: string;
|
|
35
35
|
ext: AdaptaterExtension;
|
|
36
36
|
}>;
|
|
37
|
+
modelset: Array<{
|
|
38
|
+
name: string;
|
|
39
|
+
path: string;
|
|
40
|
+
ext: ModelsetExtension;
|
|
41
|
+
}>;
|
|
37
42
|
}
|
|
38
43
|
interface ConfigFile {
|
|
39
44
|
promptfile?: string;
|
|
@@ -56,13 +61,14 @@ type InputMode = "manual" | "promptfile" | "clipboard";
|
|
|
56
61
|
type OutputMode = "txt" | "clipboard";
|
|
57
62
|
type RunMode = "cli" | "cmd";
|
|
58
63
|
type FormatMode = "text" | "markdown";
|
|
59
|
-
type FeatureType = "task" | "action" | "cmd" | "workflow" | "adaptater";
|
|
64
|
+
type FeatureType = "task" | "action" | "cmd" | "workflow" | "adaptater" | "modelset";
|
|
60
65
|
type ToolType = "task" | "action" | "cmd" | "workflow";
|
|
61
66
|
type ActionExtension = "js" | "mjs" | "py" | "yml";
|
|
62
67
|
type TaskExtension = "yml";
|
|
63
68
|
type AdaptaterExtension = "js";
|
|
64
69
|
type WorkflowExtension = "yml";
|
|
65
70
|
type CmdExtension = "js";
|
|
71
|
+
type ModelsetExtension = "yml";
|
|
66
72
|
type FeatureExtension = TaskExtension | CmdExtension | ActionExtension | WorkflowExtension;
|
|
67
73
|
type AliasType = "task" | "action" | "workflow";
|
|
68
|
-
export { Cmd, CmdExecutor, InputMode, OutputMode, RunMode, FormatMode, FeatureType, ActionExtension, TaskExtension, WorkflowExtension, AdaptaterExtension, CmdExtension, FeatureSpec, Features, ConfigFile, FeatureExtension, AliasType, ToolType, Settings, };
|
|
74
|
+
export { Cmd, CmdExecutor, InputMode, OutputMode, RunMode, FormatMode, FeatureType, ActionExtension, TaskExtension, WorkflowExtension, AdaptaterExtension, CmdExtension, ModelsetExtension, FeatureSpec, Features, ConfigFile, FeatureExtension, AliasType, ToolType, Settings, };
|
package/dist/main.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ import { executeWorkflowCmd } from "./cmd/lib/workflows/cmd.js";
|
|
|
5
5
|
import { writeToClipboard } from "./cmd/sys/clipboard.js";
|
|
6
6
|
import { pingCmd } from "./cmd/clicmds/cmds.js";
|
|
7
7
|
import { initAgent } from "./agent.js";
|
|
8
|
-
|
|
8
|
+
import { initState } from "./state/state.js";
|
|
9
|
+
export { execute, run, pingCmd, executeWorkflowCmd, executeActionCmd, executeTaskCmd, writeToClipboard, initAgent, initState, };
|
package/dist/main.js
CHANGED
|
@@ -5,4 +5,5 @@ import { executeWorkflowCmd } from "./cmd/lib/workflows/cmd.js";
|
|
|
5
5
|
import { writeToClipboard } from "./cmd/sys/clipboard.js";
|
|
6
6
|
import { pingCmd } from "./cmd/clicmds/cmds.js";
|
|
7
7
|
import { initAgent } from "./agent.js";
|
|
8
|
-
|
|
8
|
+
import { initState } from "./state/state.js";
|
|
9
|
+
export { execute, run, pingCmd, executeWorkflowCmd, executeActionCmd, executeTaskCmd, writeToClipboard, initAgent, initState, };
|
package/dist/state/features.js
CHANGED
|
@@ -8,6 +8,7 @@ function readFeaturesDirs(featuresPaths) {
|
|
|
8
8
|
cmd: [],
|
|
9
9
|
workflow: [],
|
|
10
10
|
adaptater: [],
|
|
11
|
+
modelset: [],
|
|
11
12
|
};
|
|
12
13
|
featuresPaths.forEach((dir) => {
|
|
13
14
|
const _f = readFeaturesDir(dir);
|
|
@@ -16,6 +17,7 @@ function readFeaturesDirs(featuresPaths) {
|
|
|
16
17
|
_f.cmd.forEach((item) => feats.cmd.push(item));
|
|
17
18
|
_f.workflow.forEach((item) => feats.workflow.push(item));
|
|
18
19
|
_f.adaptater.forEach((item) => feats.adaptater.push(item));
|
|
20
|
+
_f.modelset.forEach((item) => feats.modelset.push(item));
|
|
19
21
|
});
|
|
20
22
|
return feats;
|
|
21
23
|
}
|
package/dist/state/state.js
CHANGED
|
@@ -15,6 +15,7 @@ const isDebug = ref(false);
|
|
|
15
15
|
const isVerbose = ref(false);
|
|
16
16
|
const isShowTokens = ref(false);
|
|
17
17
|
const promptfilePath = ref("");
|
|
18
|
+
const isStateReady = ref(false);
|
|
18
19
|
const lastCmd = reactive({
|
|
19
20
|
name: "",
|
|
20
21
|
args: [],
|
|
@@ -36,7 +37,11 @@ async function initFeatures() {
|
|
|
36
37
|
promptfilePath.value = readPromptFilePath();
|
|
37
38
|
}
|
|
38
39
|
async function initState() {
|
|
40
|
+
if (isStateReady.value) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
39
43
|
initConf();
|
|
40
44
|
await initFeatures();
|
|
45
|
+
isStateReady.value = true;
|
|
41
46
|
}
|
|
42
47
|
export { inputMode, outputMode, isChatMode, isShowTokens, runMode, formatMode, lastCmd, isDebug, isVerbose, promptfilePath, initState, initFeatures, pyShell, };
|
package/package.json
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
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.
|
|
5
|
+
"version": "0.0.43",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
8
|
-
"build": "rm -rf dist/* && tsc
|
|
8
|
+
"build": "rm -rf dist/* && tsc",
|
|
9
9
|
"cli": "node --loader ts-node/esm bin/index.ts",
|
|
10
10
|
"watch": "tsc --noCheck -p . -w"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@agent-smith/brain": "^0.0.41",
|
|
14
14
|
"@agent-smith/jobs": "^0.0.14",
|
|
15
|
-
"@agent-smith/lmtask": "^0.0.
|
|
15
|
+
"@agent-smith/lmtask": "^0.0.35",
|
|
16
16
|
"@agent-smith/tfm": "^0.1.2",
|
|
17
17
|
"@inquirer/prompts": "^7.4.0",
|
|
18
18
|
"@inquirer/select": "^4.1.0",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"clipboardy": "^4.0.0",
|
|
23
23
|
"commander": "^13.1.0",
|
|
24
24
|
"marked-terminal": "^7.3.0",
|
|
25
|
-
"modprompt": "^0.10.
|
|
25
|
+
"modprompt": "^0.10.9",
|
|
26
26
|
"python-shell": "^5.0.0",
|
|
27
|
-
"yaml": "^2.7.
|
|
27
|
+
"yaml": "^2.7.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@agent-smith/tmem-jobs": "^0.0.4",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
35
35
|
"@types/better-sqlite3": "^7.6.12",
|
|
36
36
|
"@types/marked-terminal": "^6.1.1",
|
|
37
|
-
"@types/node": "^22.13.
|
|
37
|
+
"@types/node": "^22.13.14",
|
|
38
38
|
"restmix": "^0.5.0",
|
|
39
|
-
"rollup": "^4.
|
|
39
|
+
"rollup": "^4.38.0",
|
|
40
40
|
"ts-node": "^10.9.2",
|
|
41
41
|
"tslib": "2.8.1",
|
|
42
42
|
"typescript": "^5.8.2"
|