@agent-smith/cli 0.0.85 → 0.0.87
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/cmd/lib/tasks/cmd.js +0 -2
- package/dist/conf.d.ts +1 -2
- package/dist/conf.js +20 -5
- package/dist/db/db.d.ts +1 -2
- package/dist/db/db.js +2 -4
- package/dist/main.d.ts +2 -2
- package/dist/main.js +2 -2
- package/dist/state/state.d.ts +2 -1
- package/dist/state/state.js +6 -1
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Agent } from "@agent-smith/agent";
|
|
2
|
-
import { useTemplateForModel } from "@agent-smith/tfm";
|
|
3
2
|
import { input } from "@inquirer/prompts";
|
|
4
3
|
import { compile, serializeGrammar } from "@intrinsicai/gbnfgen";
|
|
5
4
|
import { default as color, default as colors } from "ansi-colors";
|
|
@@ -15,7 +14,6 @@ import { parseCommandArgs } from "../options_parsers.js";
|
|
|
15
14
|
import { runtimeDataError, runtimeWarning } from "../user_msgs.js";
|
|
16
15
|
import { formatStats, processOutput, readPromptFile } from "../utils.js";
|
|
17
16
|
import { readTask } from "./read.js";
|
|
18
|
-
const tfm = useTemplateForModel();
|
|
19
17
|
async function executeTask(name, payload, options, quiet) {
|
|
20
18
|
const agent = new Agent(backend.value);
|
|
21
19
|
if (options?.debug) {
|
package/dist/conf.d.ts
CHANGED
package/dist/conf.js
CHANGED
|
@@ -1,17 +1,33 @@
|
|
|
1
|
-
import path from "path";
|
|
2
1
|
import { readConf } from "./cmd/sys/read_conf.js";
|
|
3
2
|
import { upsertBackends, insertFeaturesPathIfNotExists, insertPluginIfNotExists } from "./db/write.js";
|
|
4
3
|
import { buildPluginsPaths } from "./state/plugins.js";
|
|
5
4
|
import { runtimeError } from "./cmd/lib/user_msgs.js";
|
|
6
5
|
import { localBackends } from "./const.js";
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { homedir } from 'os';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
function getConfigPath(appName, filename) {
|
|
9
|
+
let confDir;
|
|
10
|
+
let dbPath;
|
|
11
|
+
if (process.platform === 'win32') {
|
|
12
|
+
confDir = join(process.env.APPDATA, appName);
|
|
13
|
+
dbPath = join(process.env.APPDATA, appName, filename);
|
|
14
|
+
}
|
|
15
|
+
else if (process.platform === 'darwin') {
|
|
16
|
+
confDir = join(homedir(), 'Library', 'Application Support', appName);
|
|
17
|
+
dbPath = join(homedir(), 'Library', 'Application Support', appName, filename);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
confDir = join(homedir(), '.config', appName);
|
|
21
|
+
dbPath = join(homedir(), '.config', appName, filename);
|
|
22
|
+
}
|
|
23
|
+
return { confDir: confDir, dbPath: dbPath };
|
|
24
|
+
}
|
|
25
|
+
const { confDir, dbPath } = getConfigPath("agent-smith", "config.db");
|
|
9
26
|
async function processConfPath(confPath) {
|
|
10
27
|
const { found, data } = readConf(confPath);
|
|
11
28
|
if (!found) {
|
|
12
29
|
runtimeError(`Config file ${confPath} not found`);
|
|
13
30
|
}
|
|
14
|
-
console.log(data);
|
|
15
31
|
const allPaths = new Array();
|
|
16
32
|
const backends = {};
|
|
17
33
|
let defaultBackendName = "";
|
|
@@ -53,7 +69,6 @@ async function processConfPath(confPath) {
|
|
|
53
69
|
}
|
|
54
70
|
}
|
|
55
71
|
console.log("Default backend:", defaultBackendName);
|
|
56
|
-
console.dir(backends, { depth: 4 });
|
|
57
72
|
if (!Object.keys(backends).includes(defaultBackendName)) {
|
|
58
73
|
throw new Error(`Undeclared default backend: ${defaultBackendName}`);
|
|
59
74
|
}
|
package/dist/db/db.d.ts
CHANGED
package/dist/db/db.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import DatabaseConstructor from "better-sqlite3";
|
|
2
2
|
import { schemas } from "./schemas.js";
|
|
3
|
-
import path from "path";
|
|
4
3
|
import { createDirectoryIfNotExists } from "../cmd/sys/dirs.js";
|
|
5
|
-
|
|
6
|
-
const dbPath = path.join(confDir, "config.db");
|
|
4
|
+
import { confDir, dbPath } from "../conf.js";
|
|
7
5
|
let db;
|
|
8
6
|
const debugDb = false;
|
|
9
7
|
function initDb(isVerbose, execSchema) {
|
|
@@ -21,4 +19,4 @@ function initDb(isVerbose, execSchema) {
|
|
|
21
19
|
db = new DatabaseConstructor(dbPath);
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
|
-
export { db,
|
|
22
|
+
export { db, initDb, };
|
package/dist/main.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { executeTask } from "./cmd/lib/tasks/cmd.js";
|
|
|
3
3
|
import { executeAction } from "./cmd/lib/actions/cmd.js";
|
|
4
4
|
import { executeWorkflow } from "./cmd/lib/workflows/cmd.js";
|
|
5
5
|
import { writeToClipboard } from "./cmd/sys/clipboard.js";
|
|
6
|
-
import { initState, pluginDataDir } from "./state/state.js";
|
|
6
|
+
import { initState, pluginDataDir, init } from "./state/state.js";
|
|
7
7
|
import { usePerfTimer } from "./utils/perf.js";
|
|
8
8
|
import { parseCommandArgs } from "./cmd/lib/options_parsers.js";
|
|
9
9
|
import { extractToolDoc } from "./cmd/lib/tools.js";
|
|
@@ -13,4 +13,4 @@ import { displayOptions, ioOptions, inferenceOptions, allOptions } from "./cmd/o
|
|
|
13
13
|
import { McpClient } from "./cmd/lib/mcp.js";
|
|
14
14
|
import { readTask } from "./cmd/lib/tasks/read.js";
|
|
15
15
|
import { FeatureType } from "./interfaces.js";
|
|
16
|
-
export { execute, run, executeTask, executeAction, executeWorkflow, writeToClipboard, initState, pluginDataDir, usePerfTimer, parseCommandArgs, extractToolDoc, openTaskSpec, extractBetweenTags, splitThinking, displayOptions, ioOptions, inferenceOptions, allOptions, McpClient, readTask, FeatureType, };
|
|
16
|
+
export { execute, run, executeTask, executeAction, executeWorkflow, writeToClipboard, initState, init, pluginDataDir, usePerfTimer, parseCommandArgs, extractToolDoc, openTaskSpec, extractBetweenTags, splitThinking, displayOptions, ioOptions, inferenceOptions, allOptions, McpClient, readTask, FeatureType, };
|
package/dist/main.js
CHANGED
|
@@ -3,7 +3,7 @@ import { executeTask } from "./cmd/lib/tasks/cmd.js";
|
|
|
3
3
|
import { executeAction } from "./cmd/lib/actions/cmd.js";
|
|
4
4
|
import { executeWorkflow } from "./cmd/lib/workflows/cmd.js";
|
|
5
5
|
import { writeToClipboard } from "./cmd/sys/clipboard.js";
|
|
6
|
-
import { initState, pluginDataDir } from "./state/state.js";
|
|
6
|
+
import { initState, pluginDataDir, init } from "./state/state.js";
|
|
7
7
|
import { usePerfTimer } from "./utils/perf.js";
|
|
8
8
|
import { parseCommandArgs } from "./cmd/lib/options_parsers.js";
|
|
9
9
|
import { extractToolDoc } from "./cmd/lib/tools.js";
|
|
@@ -12,4 +12,4 @@ import { extractBetweenTags, splitThinking } from "./utils/text.js";
|
|
|
12
12
|
import { displayOptions, ioOptions, inferenceOptions, allOptions } from "./cmd/options.js";
|
|
13
13
|
import { McpClient } from "./cmd/lib/mcp.js";
|
|
14
14
|
import { readTask } from "./cmd/lib/tasks/read.js";
|
|
15
|
-
export { execute, run, executeTask, executeAction, executeWorkflow, writeToClipboard, initState, pluginDataDir, usePerfTimer, parseCommandArgs, extractToolDoc, openTaskSpec, extractBetweenTags, splitThinking, displayOptions, ioOptions, inferenceOptions, allOptions, McpClient, readTask, };
|
|
15
|
+
export { execute, run, executeTask, executeAction, executeWorkflow, writeToClipboard, initState, init, pluginDataDir, usePerfTimer, parseCommandArgs, extractToolDoc, openTaskSpec, extractBetweenTags, splitThinking, displayOptions, ioOptions, inferenceOptions, allOptions, McpClient, readTask, };
|
package/dist/state/state.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare const lastCmd: {
|
|
|
14
14
|
args: Array<string>;
|
|
15
15
|
};
|
|
16
16
|
declare function initFilepaths(): void;
|
|
17
|
+
declare function init(): Promise<void>;
|
|
17
18
|
declare function initState(): Promise<void>;
|
|
18
19
|
declare function pluginDataDir(pluginName: string): string;
|
|
19
|
-
export { inputMode, outputMode, isChatMode, runMode, formatMode, lastCmd, promptfilePath, dataDirPath, isStateReady, pluginDataDir, initState, initFilepaths, pyShell, };
|
|
20
|
+
export { inputMode, outputMode, isChatMode, runMode, formatMode, lastCmd, promptfilePath, dataDirPath, isStateReady, pluginDataDir, initState, initFilepaths, init, pyShell, };
|
package/dist/state/state.js
CHANGED
|
@@ -3,6 +3,7 @@ import { initDb } from "../db/db.js";
|
|
|
3
3
|
import { readFilePaths } from "../db/read.js";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { createDirectoryIfNotExists } from "../cmd/sys/dirs.js";
|
|
6
|
+
import { initBackends } from "./backends.js";
|
|
6
7
|
let pyShell;
|
|
7
8
|
const inputMode = ref("manual");
|
|
8
9
|
const outputMode = ref("txt");
|
|
@@ -28,6 +29,10 @@ function initFilepaths() {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
}
|
|
32
|
+
async function init() {
|
|
33
|
+
await initState();
|
|
34
|
+
await initBackends();
|
|
35
|
+
}
|
|
31
36
|
async function initState() {
|
|
32
37
|
if (isStateReady.value) {
|
|
33
38
|
return;
|
|
@@ -48,4 +53,4 @@ function pluginDataDir(pluginName) {
|
|
|
48
53
|
createDirectoryIfNotExists(pluginDatapath);
|
|
49
54
|
return pluginDatapath;
|
|
50
55
|
}
|
|
51
|
-
export { inputMode, outputMode, isChatMode, runMode, formatMode, lastCmd, promptfilePath, dataDirPath, isStateReady, pluginDataDir, initState, initFilepaths, pyShell, };
|
|
56
|
+
export { inputMode, outputMode, isChatMode, runMode, formatMode, lastCmd, promptfilePath, dataDirPath, isStateReady, pluginDataDir, initState, initFilepaths, init, 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.
|
|
5
|
+
"version": "0.0.87",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
8
8
|
"build": "rm -rf dist/* && tsc",
|