dirac-lang 0.1.64 → 0.1.65
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 +49 -37
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -16,13 +16,14 @@ import "dotenv/config";
|
|
|
16
16
|
// package.json
|
|
17
17
|
var package_default = {
|
|
18
18
|
name: "dirac-lang",
|
|
19
|
-
version: "0.1.
|
|
19
|
+
version: "0.1.64",
|
|
20
20
|
description: "LLM-Augmented Declarative Execution",
|
|
21
21
|
type: "module",
|
|
22
22
|
main: "dist/index.js",
|
|
23
23
|
types: "dist/index.d.ts",
|
|
24
24
|
bin: {
|
|
25
|
-
dirac: "dist/cli.js"
|
|
25
|
+
dirac: "dist/cli.js",
|
|
26
|
+
dish: "dist/cli.js"
|
|
26
27
|
},
|
|
27
28
|
exports: {
|
|
28
29
|
".": "./dist/index.js"
|
|
@@ -70,11 +71,54 @@ var package_default = {
|
|
|
70
71
|
import fs from "fs";
|
|
71
72
|
import yaml from "js-yaml";
|
|
72
73
|
import { resolve, extname } from "path";
|
|
74
|
+
function loadShellConfig(args = []) {
|
|
75
|
+
const shellConfig = { debug: false };
|
|
76
|
+
for (let i = 0; i < args.length; i++) {
|
|
77
|
+
const arg = args[i];
|
|
78
|
+
if (arg === "--debug") {
|
|
79
|
+
shellConfig.debug = true;
|
|
80
|
+
} else if ((arg === "-f" || arg === "--config") && i + 1 < args.length) {
|
|
81
|
+
const configPath = resolve(args[++i]);
|
|
82
|
+
if (fs.existsSync(configPath)) {
|
|
83
|
+
const configData = yaml.load(fs.readFileSync(configPath, "utf-8"));
|
|
84
|
+
Object.assign(shellConfig, {
|
|
85
|
+
llmProvider: configData.llmProvider,
|
|
86
|
+
llmModel: configData.llmModel,
|
|
87
|
+
customLLMUrl: configData.customLLMUrl,
|
|
88
|
+
initScript: configData.initScript
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (!shellConfig.llmProvider) {
|
|
94
|
+
const defaultConfigPath = resolve(process.cwd(), "config.yml");
|
|
95
|
+
if (fs.existsSync(defaultConfigPath)) {
|
|
96
|
+
try {
|
|
97
|
+
const configData = yaml.load(fs.readFileSync(defaultConfigPath, "utf-8"));
|
|
98
|
+
shellConfig.llmProvider = shellConfig.llmProvider || configData.llmProvider;
|
|
99
|
+
shellConfig.llmModel = shellConfig.llmModel || configData.llmModel;
|
|
100
|
+
shellConfig.customLLMUrl = shellConfig.customLLMUrl || configData.customLLMUrl;
|
|
101
|
+
shellConfig.initScript = shellConfig.initScript || configData.initScript;
|
|
102
|
+
} catch (err) {
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return shellConfig;
|
|
107
|
+
}
|
|
73
108
|
async function main() {
|
|
74
109
|
const args = process.argv.slice(2);
|
|
110
|
+
const calledAs = process.argv[1];
|
|
111
|
+
if (calledAs && calledAs.endsWith("/dish")) {
|
|
112
|
+
const { DiracShell } = await import("./shell-6NG7WK5Z.js");
|
|
113
|
+
const shellConfig = loadShellConfig(args);
|
|
114
|
+
const shell = new DiracShell(shellConfig);
|
|
115
|
+
await shell.start();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
75
118
|
if (args.includes("--help") || args.includes("-h")) {
|
|
76
119
|
console.log("Usage: dirac <file.di|file.bk>");
|
|
77
120
|
console.log(" dirac shell [options]");
|
|
121
|
+
console.log(" dish Start interactive shell (short alias)");
|
|
78
122
|
console.log(" dirac agent <command>");
|
|
79
123
|
console.log("");
|
|
80
124
|
console.log("Commands:");
|
|
@@ -150,41 +194,9 @@ async function main() {
|
|
|
150
194
|
const { SessionClient } = await import("./session-client-3VTC5MLO.js");
|
|
151
195
|
const daemonMode = args.includes("--daemon") || args.includes("-d");
|
|
152
196
|
const agentMode = args.includes("--agent") || args.includes("-a");
|
|
153
|
-
const shellConfig =
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (arg === "--debug") {
|
|
157
|
-
shellConfig.debug = true;
|
|
158
|
-
} else if (arg === "--daemon" || arg === "-d") {
|
|
159
|
-
continue;
|
|
160
|
-
} else if (arg === "--agent" || arg === "-a") {
|
|
161
|
-
continue;
|
|
162
|
-
} else if ((arg === "-f" || arg === "--config") && i + 1 < args.length) {
|
|
163
|
-
const configPath = resolve(args[++i]);
|
|
164
|
-
if (fs.existsSync(configPath)) {
|
|
165
|
-
const configData = yaml.load(fs.readFileSync(configPath, "utf-8"));
|
|
166
|
-
Object.assign(shellConfig, {
|
|
167
|
-
llmProvider: configData.llmProvider,
|
|
168
|
-
llmModel: configData.llmModel,
|
|
169
|
-
customLLMUrl: configData.customLLMUrl,
|
|
170
|
-
initScript: configData.initScript
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
if (!shellConfig.llmProvider) {
|
|
176
|
-
const defaultConfigPath = resolve(process.cwd(), "config.yml");
|
|
177
|
-
if (fs.existsSync(defaultConfigPath)) {
|
|
178
|
-
try {
|
|
179
|
-
const configData = yaml.load(fs.readFileSync(defaultConfigPath, "utf-8"));
|
|
180
|
-
shellConfig.llmProvider = shellConfig.llmProvider || configData.llmProvider;
|
|
181
|
-
shellConfig.llmModel = shellConfig.llmModel || configData.llmModel;
|
|
182
|
-
shellConfig.customLLMUrl = shellConfig.customLLMUrl || configData.customLLMUrl;
|
|
183
|
-
shellConfig.initScript = shellConfig.initScript || configData.initScript;
|
|
184
|
-
} catch (err) {
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
197
|
+
const shellConfig = loadShellConfig(args.slice(1).filter(
|
|
198
|
+
(arg) => arg !== "--daemon" && arg !== "-d" && arg !== "--agent" && arg !== "-a"
|
|
199
|
+
));
|
|
188
200
|
if (agentMode) {
|
|
189
201
|
if (!isSessionRunning()) {
|
|
190
202
|
console.error("Error: No agent is running");
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dirac-lang",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"description": "LLM-Augmented Declarative Execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"bin": {
|
|
9
|
-
"dirac": "dist/cli.js"
|
|
9
|
+
"dirac": "dist/cli.js",
|
|
10
|
+
"dish": "dist/cli.js"
|
|
10
11
|
},
|
|
11
12
|
"exports": {
|
|
12
13
|
".": "./dist/index.js"
|