@agent-smith/cli 0.0.96 → 0.0.98
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/cli.js +1 -1
- package/dist/cmd/cmds.d.ts +3 -2
- package/dist/cmd/cmds.js +5 -6
- package/dist/cmd/lib/tasks/cmd.js +35 -44
- package/dist/cmd/lib/tasks/read.js +1 -0
- package/dist/cmd/lib/tasks/utils.d.ts +2 -1
- package/dist/cmd/lib/tasks/utils.js +23 -1
- package/dist/cmd/lib/workflows/cmd.d.ts +1 -1
- package/dist/cmd/lib/workflows/cmd.js +31 -9
- package/dist/cmd/lib/workflows/read.d.ts +1 -1
- package/dist/cmd/lib/workflows/read.js +19 -17
- package/dist/db/write.js +0 -1
- package/dist/interfaces.d.ts +1 -0
- package/dist/state/chat.d.ts +7 -27
- package/dist/state/chat.js +10 -3
- package/package.json +11 -12
package/dist/cli.js
CHANGED
package/dist/cmd/cmds.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { InferenceOptions } from "@locallm/types/dist/inference.js";
|
|
1
2
|
import { Command } from "commander";
|
|
2
3
|
declare const program: Command;
|
|
3
|
-
declare function chat(program: Command): Promise<void>;
|
|
4
|
+
declare function chat(program: Command, options: InferenceOptions): Promise<void>;
|
|
4
5
|
declare function buildCmds(): Promise<Command>;
|
|
5
6
|
declare function parseCmd(program: Command): Promise<void>;
|
|
6
|
-
export {
|
|
7
|
+
export { buildCmds, chat, parseCmd, program };
|
package/dist/cmd/cmds.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { input } from "@inquirer/prompts";
|
|
2
|
-
import { toRaw } from "@vue/reactivity";
|
|
3
2
|
import { Command } from "commander";
|
|
4
3
|
import { query } from "../cli.js";
|
|
5
4
|
import { readAliases, readFeatures } from "../db/read.js";
|
|
6
|
-
import { chatInferenceParams } from "../state/chat.js";
|
|
5
|
+
import { chatInferenceParams, chatTemplate } from "../state/chat.js";
|
|
7
6
|
import { agent, isChatMode, runMode } from "../state/state.js";
|
|
8
7
|
import { initCommandsFromAliases } from "./clicmds/aliases.js";
|
|
9
8
|
import { initBaseCommands } from "./clicmds/base.js";
|
|
10
9
|
import { initUserCmds } from "./clicmds/cmds.js";
|
|
11
10
|
const program = new Command();
|
|
12
|
-
async function chat(program) {
|
|
11
|
+
async function chat(program, options) {
|
|
13
12
|
const data = { message: '>', default: "" };
|
|
14
13
|
const prompt = await input(data);
|
|
15
14
|
if (prompt == "/q") {
|
|
@@ -21,9 +20,9 @@ async function chat(program) {
|
|
|
21
20
|
await query(program);
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
|
-
await agent.
|
|
23
|
+
await agent.run(prompt, chatInferenceParams, options, chatTemplate ? chatTemplate : undefined);
|
|
25
24
|
console.log();
|
|
26
|
-
await chat(program);
|
|
25
|
+
await chat(program, options);
|
|
27
26
|
}
|
|
28
27
|
async function buildCmds() {
|
|
29
28
|
initBaseCommands(program);
|
|
@@ -41,4 +40,4 @@ async function parseCmd(program) {
|
|
|
41
40
|
program.description('Terminal agents toolkit');
|
|
42
41
|
await program.parseAsync();
|
|
43
42
|
}
|
|
44
|
-
export {
|
|
43
|
+
export { buildCmds, chat, parseCmd, program };
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { input } from "@inquirer/prompts";
|
|
2
1
|
import { compile, serializeGrammar } from "@intrinsicai/gbnfgen";
|
|
3
2
|
import { default as color, default as colors } from "ansi-colors";
|
|
4
3
|
import { PromptTemplate } from "modprompt";
|
|
5
4
|
import ora from 'ora';
|
|
6
|
-
import { query } from "../../../cli.js";
|
|
7
|
-
import { readClipboard } from "../../../cmd/sys/clipboard.js";
|
|
8
5
|
import { usePerfTimer } from "../../../main.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { backend, backends, listBackends } from "../../../state/backends.js";
|
|
7
|
+
import { setChatInferenceParams, setChatTemplate } from "../../../state/chat.js";
|
|
8
|
+
import { agent, isChatMode } from "../../../state/state.js";
|
|
9
|
+
import { initTaskSettings, isTaskSettingsInitialized, tasksSettings } from "../../../state/tasks.js";
|
|
10
|
+
import { chat, program } from "../../cmds.js";
|
|
11
11
|
import { parseCommandArgs } from "../options_parsers.js";
|
|
12
12
|
import { runtimeDataError, runtimeError, runtimeWarning } from "../user_msgs.js";
|
|
13
|
-
import { formatStats, processOutput
|
|
13
|
+
import { formatStats, processOutput } from "../utils.js";
|
|
14
14
|
import { readTask } from "./read.js";
|
|
15
|
-
import {
|
|
16
|
-
import { isTaskSettingsInitialized, initTaskSettings, tasksSettings } from "../../../state/tasks.js";
|
|
15
|
+
import { getTaskPrompt } from "./utils.js";
|
|
17
16
|
async function executeTask(name, payload, options, quiet) {
|
|
18
17
|
if (!isTaskSettingsInitialized.value) {
|
|
19
18
|
initTaskSettings();
|
|
@@ -99,7 +98,12 @@ async function executeTask(name, payload, options, quiet) {
|
|
|
99
98
|
process.stdout.write(t);
|
|
100
99
|
}
|
|
101
100
|
};
|
|
102
|
-
|
|
101
|
+
let hasTools = false;
|
|
102
|
+
if (task.def?.tools) {
|
|
103
|
+
if (task.def.tools.length > 0) {
|
|
104
|
+
hasTools = true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
103
107
|
let continueWrite = true;
|
|
104
108
|
let skipNextEmptyLinesToken = false;
|
|
105
109
|
const spinner = ora("Thinking ...");
|
|
@@ -147,10 +151,8 @@ async function executeTask(name, payload, options, quiet) {
|
|
|
147
151
|
return;
|
|
148
152
|
}
|
|
149
153
|
else if (t == tpl.tags.toolCall?.end) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
continueWrite = true;
|
|
153
|
-
}
|
|
154
|
+
skipNextEmptyLinesToken = true;
|
|
155
|
+
continueWrite = true;
|
|
154
156
|
return;
|
|
155
157
|
}
|
|
156
158
|
}
|
|
@@ -194,6 +196,8 @@ async function executeTask(name, payload, options, quiet) {
|
|
|
194
196
|
onToolCallEnd: onToolCallEnd,
|
|
195
197
|
...conf,
|
|
196
198
|
};
|
|
199
|
+
const initialInferParams = Object.assign({}, conf.inferParams);
|
|
200
|
+
initialInferParams.model = tconf.model;
|
|
197
201
|
let out;
|
|
198
202
|
try {
|
|
199
203
|
out = await task.run({ prompt: payload.prompt, ...vars }, tconf);
|
|
@@ -225,20 +229,23 @@ async function executeTask(name, payload, options, quiet) {
|
|
|
225
229
|
mcpServers.forEach(async (s) => await s.stop());
|
|
226
230
|
await processOutput(out);
|
|
227
231
|
if (isChatMode.value) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if (prompt == "/q") {
|
|
231
|
-
isChatMode.value = false;
|
|
232
|
-
if (runMode.value == "cmd") {
|
|
233
|
-
process.exit(0);
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
await query(program);
|
|
237
|
-
}
|
|
232
|
+
if (tpl) {
|
|
233
|
+
setChatTemplate(tpl);
|
|
238
234
|
}
|
|
239
|
-
|
|
240
|
-
|
|
235
|
+
if (task.def.tools) {
|
|
236
|
+
options.tools = task.def.tools;
|
|
241
237
|
}
|
|
238
|
+
if (task.def.shots) {
|
|
239
|
+
options.history = task.def.shots;
|
|
240
|
+
}
|
|
241
|
+
if (task.def.template?.system) {
|
|
242
|
+
options.system = task.def.template.system;
|
|
243
|
+
}
|
|
244
|
+
if (task.def.template?.assistant) {
|
|
245
|
+
options.assistant = task.def.template.assistant;
|
|
246
|
+
}
|
|
247
|
+
setChatInferenceParams(initialInferParams);
|
|
248
|
+
await chat(program, options);
|
|
242
249
|
}
|
|
243
250
|
if (options?.debug === true || options?.verbose === true) {
|
|
244
251
|
try {
|
|
@@ -257,24 +264,8 @@ async function executeTask(name, payload, options, quiet) {
|
|
|
257
264
|
return out;
|
|
258
265
|
}
|
|
259
266
|
async function executeTaskCmd(name, targs = []) {
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
pr = await readClipboard();
|
|
264
|
-
}
|
|
265
|
-
else if (options?.inputFile === true) {
|
|
266
|
-
pr = readPromptFile();
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
if (args[0] !== undefined) {
|
|
270
|
-
pr = args[0];
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
runtimeDataError("task", name, "provide a prompt or use input options");
|
|
274
|
-
throw new Error();
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
const params = { args: args, prompt: pr };
|
|
278
|
-
return await executeTask(name, params, options);
|
|
267
|
+
const ca = parseCommandArgs(targs);
|
|
268
|
+
const prompt = await getTaskPrompt(name, ca.args, ca.options);
|
|
269
|
+
return await executeTask(name, { prompt: prompt }, ca.options);
|
|
279
270
|
}
|
|
280
271
|
export { executeTask, executeTaskCmd };
|
|
@@ -92,6 +92,7 @@ async function readTask(name, payload, options, agent) {
|
|
|
92
92
|
}
|
|
93
93
|
;
|
|
94
94
|
const task = new Task(agent, taskSpec);
|
|
95
|
+
task.addTools(taskSpec.tools);
|
|
95
96
|
if (model?.inferParams?.tsGrammar) {
|
|
96
97
|
model.inferParams.grammar = serializeGrammar(await compile(model.inferParams.tsGrammar, "Grammar"));
|
|
97
98
|
delete model.inferParams.tsGrammar;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { LmTaskFileSpec } from "../../../interfaces.js";
|
|
2
2
|
declare function openTaskSpec(name: string): LmTaskFileSpec;
|
|
3
|
-
|
|
3
|
+
declare function getTaskPrompt(name: string, args: Array<string>, options: Record<string, any>): Promise<string>;
|
|
4
|
+
export { openTaskSpec, getTaskPrompt, };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import YAML from 'yaml';
|
|
2
2
|
import { readTask } from "../../../cmd/sys/read_task.js";
|
|
3
3
|
import { getFeatureSpec } from "../../../state/features.js";
|
|
4
|
+
import { readClipboard } from '../../../cmd/sys/clipboard.js';
|
|
5
|
+
import { readPromptFile } from '../utils.js';
|
|
6
|
+
import { runtimeDataError } from '../user_msgs.js';
|
|
4
7
|
function openTaskSpec(name) {
|
|
5
8
|
const { found, path } = getFeatureSpec(name, "task");
|
|
6
9
|
if (!found) {
|
|
@@ -14,4 +17,23 @@ function openTaskSpec(name) {
|
|
|
14
17
|
taskFileSpec.name = name;
|
|
15
18
|
return taskFileSpec;
|
|
16
19
|
}
|
|
17
|
-
|
|
20
|
+
async function getTaskPrompt(name, args, options) {
|
|
21
|
+
let pr;
|
|
22
|
+
if (options?.clipboardInput === true) {
|
|
23
|
+
pr = await readClipboard();
|
|
24
|
+
}
|
|
25
|
+
else if (options?.inputFile === true) {
|
|
26
|
+
pr = readPromptFile();
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
if (args[0] !== undefined) {
|
|
30
|
+
pr = args[0];
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
runtimeDataError("task", name, "provide a prompt or use input options");
|
|
34
|
+
throw new Error();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return pr;
|
|
38
|
+
}
|
|
39
|
+
export { openTaskSpec, getTaskPrompt, };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare function executeWorkflow(
|
|
1
|
+
declare function executeWorkflow(wname: string, args: any, options?: Record<string, any>): Promise<any>;
|
|
2
2
|
declare function executeWorkflowCmd(name: string, wargs: Array<any>): Promise<any>;
|
|
3
3
|
export { executeWorkflow, executeWorkflowCmd, };
|
|
@@ -2,30 +2,51 @@ import { executeAction } from "../actions/cmd.js";
|
|
|
2
2
|
import { executeAdaptater } from "../adaptaters/cmd.js";
|
|
3
3
|
import { parseCommandArgs } from "../options_parsers.js";
|
|
4
4
|
import { executeTask } from "../tasks/cmd.js";
|
|
5
|
+
import { getTaskPrompt } from "../tasks/utils.js";
|
|
5
6
|
import { readWorkflow } from "./read.js";
|
|
6
7
|
import colors from "ansi-colors";
|
|
7
|
-
async function executeWorkflow(
|
|
8
|
-
const { workflow, found } = await readWorkflow(
|
|
8
|
+
async function executeWorkflow(wname, args, options = {}) {
|
|
9
|
+
const { workflow, found } = await readWorkflow(wname);
|
|
9
10
|
if (!found) {
|
|
10
|
-
throw new Error(`Workflow ${
|
|
11
|
+
throw new Error(`Workflow ${wname} not found`);
|
|
11
12
|
}
|
|
12
13
|
const isDebug = options?.debug === true;
|
|
13
14
|
const isVerbose = options?.verbose === true;
|
|
14
15
|
const stepNames = Object.keys(workflow);
|
|
15
16
|
if (isDebug || isVerbose) {
|
|
16
|
-
console.log("Running workflow",
|
|
17
|
+
console.log("Running workflow", wname, stepNames.length, "steps");
|
|
17
18
|
}
|
|
18
19
|
let i = 0;
|
|
19
20
|
const finalTaskIndex = stepNames.length - 1;
|
|
20
21
|
let taskRes = { cmdArgs: args };
|
|
21
|
-
|
|
22
|
+
let prevStepType = null;
|
|
23
|
+
for (const step of workflow) {
|
|
22
24
|
if (isDebug || isVerbose) {
|
|
23
|
-
console.log(i + 1, name, colors.dim(step.type));
|
|
25
|
+
console.log(i + 1, step.name, colors.dim(step.type));
|
|
24
26
|
}
|
|
25
27
|
switch (step.type) {
|
|
26
28
|
case "task":
|
|
27
29
|
try {
|
|
28
|
-
|
|
30
|
+
let pr = null;
|
|
31
|
+
if (i == 0) {
|
|
32
|
+
pr = await getTaskPrompt(step.name, taskRes.cmdArgs, options);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
if (prevStepType) {
|
|
36
|
+
if (prevStepType == "task") {
|
|
37
|
+
pr = taskRes.answer.text;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!pr) {
|
|
41
|
+
if (taskRes?.prompt) {
|
|
42
|
+
pr = taskRes.prompt;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (!pr) {
|
|
47
|
+
throw new Error(`Workflow ${wname} step ${i + 1}: provide a prompt for the task ${step.name}`);
|
|
48
|
+
}
|
|
49
|
+
const tr = await executeTask(step.name, { prompt: pr }, options, true);
|
|
29
50
|
taskRes = { ...tr, ...taskRes };
|
|
30
51
|
}
|
|
31
52
|
catch (e) {
|
|
@@ -35,7 +56,7 @@ async function executeWorkflow(name, args, options = {}) {
|
|
|
35
56
|
case "action":
|
|
36
57
|
try {
|
|
37
58
|
const actArgs = i == 0 ? taskRes.cmdArgs : taskRes;
|
|
38
|
-
const ares = await executeAction(name, actArgs, options, true);
|
|
59
|
+
const ares = await executeAction(step.name, actArgs, options, true);
|
|
39
60
|
if (typeof ares == "string" || Array.isArray(ares)) {
|
|
40
61
|
taskRes.args = ares;
|
|
41
62
|
}
|
|
@@ -53,7 +74,7 @@ async function executeWorkflow(name, args, options = {}) {
|
|
|
53
74
|
case "adaptater":
|
|
54
75
|
try {
|
|
55
76
|
const actArgs = i == 0 ? taskRes.cmdArgs : taskRes;
|
|
56
|
-
const adres = await executeAdaptater(name, actArgs, options);
|
|
77
|
+
const adres = await executeAdaptater(step.name, actArgs, options);
|
|
57
78
|
if (typeof adres == "string" || Array.isArray(adres)) {
|
|
58
79
|
taskRes.args = adres;
|
|
59
80
|
}
|
|
@@ -71,6 +92,7 @@ async function executeWorkflow(name, args, options = {}) {
|
|
|
71
92
|
default:
|
|
72
93
|
throw new Error(`unknown task type ${step.type} in workflow ${name}`);
|
|
73
94
|
}
|
|
95
|
+
prevStepType = step.type;
|
|
74
96
|
++i;
|
|
75
97
|
}
|
|
76
98
|
return taskRes;
|
|
@@ -9,17 +9,12 @@ import { pythonAction, systemAction } from '../actions/cmd.js';
|
|
|
9
9
|
import { createJsAction } from '../actions/read.js';
|
|
10
10
|
import { pathToFileURL } from 'url';
|
|
11
11
|
async function _createWorkflowFromSpec(spec) {
|
|
12
|
-
const steps =
|
|
12
|
+
const steps = [];
|
|
13
|
+
let i = 1;
|
|
13
14
|
for (const step of spec.steps) {
|
|
14
15
|
const type = Object.keys(step)[0];
|
|
15
16
|
const sval = step[type];
|
|
16
|
-
|
|
17
|
-
if (typeof sval == "string") {
|
|
18
|
-
name = sval;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
name = step[type].name;
|
|
22
|
-
}
|
|
17
|
+
const name = sval;
|
|
23
18
|
if (type == "action") {
|
|
24
19
|
const { found, path, ext } = getFeatureSpec(name, "action");
|
|
25
20
|
if (!found) {
|
|
@@ -31,36 +26,40 @@ async function _createWorkflowFromSpec(spec) {
|
|
|
31
26
|
const { action } = await import(url);
|
|
32
27
|
const at = action;
|
|
33
28
|
const wf = {
|
|
29
|
+
name: name,
|
|
34
30
|
type: "action",
|
|
35
31
|
run: at,
|
|
36
32
|
};
|
|
37
|
-
steps
|
|
33
|
+
steps.push(wf);
|
|
38
34
|
break;
|
|
39
35
|
case "mjs":
|
|
40
36
|
const url2 = pathToFileURL(path).href;
|
|
41
37
|
const mjsa = await import(url2);
|
|
42
38
|
const act = createJsAction(mjsa.action);
|
|
43
39
|
const wf2 = {
|
|
40
|
+
name: name,
|
|
44
41
|
type: "action",
|
|
45
42
|
run: act,
|
|
46
43
|
};
|
|
47
|
-
steps
|
|
44
|
+
steps.push(wf2);
|
|
48
45
|
break;
|
|
49
46
|
case "yml":
|
|
50
47
|
const _t1 = systemAction(path);
|
|
51
48
|
const wf3 = {
|
|
49
|
+
name: name,
|
|
52
50
|
type: "action",
|
|
53
51
|
run: _t1,
|
|
54
52
|
};
|
|
55
|
-
steps
|
|
53
|
+
steps.push(wf3);
|
|
56
54
|
break;
|
|
57
55
|
case "py":
|
|
58
56
|
const _t = pythonAction(path);
|
|
59
57
|
const wf4 = {
|
|
58
|
+
name: name,
|
|
60
59
|
type: "action",
|
|
61
60
|
run: _t,
|
|
62
61
|
};
|
|
63
|
-
steps
|
|
62
|
+
steps.push(wf4);
|
|
64
63
|
break;
|
|
65
64
|
default:
|
|
66
65
|
throw new Error(`Unknown feature extension ${ext}`);
|
|
@@ -75,10 +74,11 @@ async function _createWorkflowFromSpec(spec) {
|
|
|
75
74
|
const jsa = await import(url);
|
|
76
75
|
const act = createJsAction(jsa.action);
|
|
77
76
|
const wf = {
|
|
77
|
+
name: name,
|
|
78
78
|
type: "adaptater",
|
|
79
79
|
run: act,
|
|
80
80
|
};
|
|
81
|
-
steps
|
|
81
|
+
steps.push(wf);
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
84
|
const { found, path } = getFeatureSpec(name, "task");
|
|
@@ -92,11 +92,13 @@ async function _createWorkflowFromSpec(spec) {
|
|
|
92
92
|
const agent = new Agent(backend.value);
|
|
93
93
|
const tsk = Task.fromYaml(agent, res.ymlTask);
|
|
94
94
|
const wf = {
|
|
95
|
+
name: name,
|
|
95
96
|
type: "task",
|
|
96
97
|
run: tsk.run,
|
|
97
98
|
};
|
|
98
|
-
steps
|
|
99
|
+
steps.push(wf);
|
|
99
100
|
}
|
|
101
|
+
++i;
|
|
100
102
|
}
|
|
101
103
|
return steps;
|
|
102
104
|
}
|
|
@@ -116,16 +118,16 @@ async function _readWorkflowFromDisk(name) {
|
|
|
116
118
|
async function readWorkflow(name) {
|
|
117
119
|
const { found, ext } = getFeatureSpec(name, "workflow");
|
|
118
120
|
if (!found) {
|
|
119
|
-
return { found: false, workflow:
|
|
121
|
+
return { found: false, workflow: [] };
|
|
120
122
|
}
|
|
121
|
-
let wf =
|
|
123
|
+
let wf = new Array();
|
|
122
124
|
switch (ext) {
|
|
123
125
|
case "yml":
|
|
124
126
|
const { data } = await _readWorkflowFromDisk(name);
|
|
125
127
|
try {
|
|
126
128
|
const workflow = await _createWorkflowFromSpec(data);
|
|
127
129
|
if (!found) {
|
|
128
|
-
return { found: false, workflow:
|
|
130
|
+
return { found: false, workflow: [] };
|
|
129
131
|
}
|
|
130
132
|
wf = workflow;
|
|
131
133
|
}
|
package/dist/db/write.js
CHANGED
|
@@ -297,7 +297,6 @@ function upsertTaskSettings(taskName, settings) {
|
|
|
297
297
|
const nq = new Array("?");
|
|
298
298
|
qnames.forEach(n => nq.push("?"));
|
|
299
299
|
const q = `INSERT INTO tasksettings (name, ${qnames.join(", ")}) VALUES (${nq.join(", ")})`;
|
|
300
|
-
console.log(q);
|
|
301
300
|
const insertStmt = db.prepare(q);
|
|
302
301
|
insertStmt.run(taskName, ...qvalues);
|
|
303
302
|
return true;
|
package/dist/interfaces.d.ts
CHANGED
package/dist/state/chat.d.ts
CHANGED
|
@@ -1,27 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
quant: string;
|
|
9
|
-
} | undefined;
|
|
10
|
-
extra?: Record<string, any> | undefined;
|
|
11
|
-
} | undefined;
|
|
12
|
-
template?: string | undefined;
|
|
13
|
-
max_tokens?: number | undefined;
|
|
14
|
-
top_k?: number | undefined;
|
|
15
|
-
top_p?: number | undefined;
|
|
16
|
-
min_p?: number | undefined;
|
|
17
|
-
temperature?: number | undefined;
|
|
18
|
-
repeat_penalty?: number | undefined;
|
|
19
|
-
tfs?: number | undefined;
|
|
20
|
-
stop?: Array<string> | undefined;
|
|
21
|
-
grammar?: string | undefined;
|
|
22
|
-
tsGrammar?: string | undefined;
|
|
23
|
-
schema?: Record<string, any> | undefined;
|
|
24
|
-
images?: Array<string> | undefined;
|
|
25
|
-
extra?: Record<string, any> | undefined;
|
|
26
|
-
};
|
|
27
|
-
export { chatInferenceParams, };
|
|
1
|
+
import { InferenceParams } from "@locallm/types";
|
|
2
|
+
import { PromptTemplate } from "modprompt";
|
|
3
|
+
declare let chatInferenceParams: InferenceParams;
|
|
4
|
+
declare let chatTemplate: PromptTemplate;
|
|
5
|
+
declare function setChatTemplate(tpl: PromptTemplate): void;
|
|
6
|
+
declare function setChatInferenceParams(ip: InferenceParams): void;
|
|
7
|
+
export { chatInferenceParams, chatTemplate, setChatInferenceParams, setChatTemplate, };
|
package/dist/state/chat.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { PromptTemplate } from "modprompt";
|
|
2
|
+
let chatInferenceParams = { temperature: 0.2, min_p: 0.05, max_tokens: 2048 };
|
|
3
|
+
let chatTemplate = new PromptTemplate("none");
|
|
4
|
+
function setChatTemplate(tpl) {
|
|
5
|
+
chatTemplate = tpl;
|
|
6
|
+
}
|
|
7
|
+
function setChatInferenceParams(ip) {
|
|
8
|
+
chatInferenceParams = ip;
|
|
9
|
+
}
|
|
10
|
+
export { chatInferenceParams, chatTemplate, setChatInferenceParams, setChatTemplate, };
|
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.
|
|
5
|
+
"version": "0.0.98",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
8
8
|
"build": "rm -rf dist/* && tsc",
|
|
@@ -10,20 +10,19 @@
|
|
|
10
10
|
"watch": "tsc --noCheck -p . -w"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@agent-smith/agent": "^0.1.
|
|
14
|
-
"@agent-smith/task": "^0.1.
|
|
13
|
+
"@agent-smith/agent": "^0.1.8",
|
|
14
|
+
"@agent-smith/task": "^0.1.9",
|
|
15
15
|
"@agent-smith/tfm": "^0.2.0",
|
|
16
|
-
"@inquirer/prompts": "^
|
|
16
|
+
"@inquirer/prompts": "^8.1.0",
|
|
17
17
|
"@intrinsicai/gbnfgen": "0.12.0",
|
|
18
|
-
"@locallm/api": "^0.7.
|
|
19
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
20
|
-
"@vue/reactivity": "^3.5.
|
|
18
|
+
"@locallm/api": "^0.7.3",
|
|
19
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
20
|
+
"@vue/reactivity": "^3.5.26",
|
|
21
21
|
"ansi-colors": "^4.1.3",
|
|
22
22
|
"better-sqlite3": "^12.5.0",
|
|
23
23
|
"clipboardy": "^5.0.2",
|
|
24
24
|
"commander": "^14.0.2",
|
|
25
25
|
"marked-terminal": "^7.3.0",
|
|
26
|
-
"modprompt": "^0.12.6",
|
|
27
26
|
"ora": "^9.0.0",
|
|
28
27
|
"python-shell": "^5.0.0",
|
|
29
28
|
"yaml": "^2.8.2"
|
|
@@ -32,15 +31,15 @@
|
|
|
32
31
|
"@agent-smith/tmem-jobs": "^0.0.4",
|
|
33
32
|
"@cfworker/json-schema": "^4.1.1",
|
|
34
33
|
"@commander-js/extra-typings": "^14.0.0",
|
|
35
|
-
"@locallm/types": "^0.6.
|
|
34
|
+
"@locallm/types": "^0.6.5",
|
|
36
35
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
37
36
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
38
37
|
"@types/better-sqlite3": "^7.6.13",
|
|
39
38
|
"@types/marked-terminal": "^6.1.1",
|
|
40
|
-
"@types/node": "^25.0.
|
|
41
|
-
"openai": "^6.
|
|
39
|
+
"@types/node": "^25.0.3",
|
|
40
|
+
"openai": "^6.15.0",
|
|
42
41
|
"restmix": "^0.6.1",
|
|
43
|
-
"rollup": "^4.
|
|
42
|
+
"rollup": "^4.54.0",
|
|
44
43
|
"ts-node": "^10.9.2",
|
|
45
44
|
"tslib": "2.8.1",
|
|
46
45
|
"typescript": "^5.9.3"
|