dirac-lang 0.1.39 → 0.1.40
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
CHANGED
|
@@ -16,7 +16,7 @@ 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.39",
|
|
20
20
|
description: "LLM-Augmented Declarative Execution",
|
|
21
21
|
type: "module",
|
|
22
22
|
main: "dist/index.js",
|
|
@@ -96,7 +96,7 @@ async function main() {
|
|
|
96
96
|
process.exit(0);
|
|
97
97
|
}
|
|
98
98
|
if (args[0] === "shell") {
|
|
99
|
-
const { DiracShell } = await import("./shell-
|
|
99
|
+
const { DiracShell } = await import("./shell-Z7RZRFTV.js");
|
|
100
100
|
const shellConfig = { debug: false };
|
|
101
101
|
for (let i = 1; i < args.length; i++) {
|
|
102
102
|
const arg = args[i];
|
|
@@ -185,6 +185,7 @@ Commands:
|
|
|
185
185
|
:clear Clear session (reset variables and subroutines)
|
|
186
186
|
:debug Toggle debug mode
|
|
187
187
|
:config Show current configuration
|
|
188
|
+
:reload Reload config.yml and reinitialize LLM
|
|
188
189
|
:index <path> Index subroutines from directory
|
|
189
190
|
:search <query> Search indexed subroutines
|
|
190
191
|
:load <query> Load context (search and import subroutines)
|
|
@@ -259,6 +260,19 @@ Examples:
|
|
|
259
260
|
console.log(` Custom LLM URL: ${this.config.customLLMUrl}`);
|
|
260
261
|
}
|
|
261
262
|
break;
|
|
263
|
+
case "reload":
|
|
264
|
+
try {
|
|
265
|
+
await this.reloadConfig();
|
|
266
|
+
console.log("Configuration reloaded successfully");
|
|
267
|
+
console.log(` LLM Provider: ${this.config.llmProvider || "none"}`);
|
|
268
|
+
console.log(` LLM Model: ${this.config.llmModel || "default"}`);
|
|
269
|
+
if (this.config.customLLMUrl) {
|
|
270
|
+
console.log(` Custom LLM URL: ${this.config.customLLMUrl}`);
|
|
271
|
+
}
|
|
272
|
+
} catch (error) {
|
|
273
|
+
console.error("Error reloading config:", error instanceof Error ? error.message : String(error));
|
|
274
|
+
}
|
|
275
|
+
break;
|
|
262
276
|
case "index":
|
|
263
277
|
if (args.length === 0) {
|
|
264
278
|
console.log("Usage: :index <path>");
|
|
@@ -368,7 +382,7 @@ Examples:
|
|
|
368
382
|
}
|
|
369
383
|
const { spawn } = await import("child_process");
|
|
370
384
|
this.rl.pause();
|
|
371
|
-
return new Promise((
|
|
385
|
+
return new Promise((resolve2) => {
|
|
372
386
|
const shell = process.env.SHELL || "/bin/sh";
|
|
373
387
|
const child = spawn(shell, ["-c", command], {
|
|
374
388
|
stdio: "inherit",
|
|
@@ -376,12 +390,12 @@ Examples:
|
|
|
376
390
|
});
|
|
377
391
|
child.on("close", () => {
|
|
378
392
|
this.rl.resume();
|
|
379
|
-
|
|
393
|
+
resolve2();
|
|
380
394
|
});
|
|
381
395
|
child.on("error", (err) => {
|
|
382
396
|
console.error(`Shell error: ${err.message}`);
|
|
383
397
|
this.rl.resume();
|
|
384
|
-
|
|
398
|
+
resolve2();
|
|
385
399
|
});
|
|
386
400
|
});
|
|
387
401
|
}
|
|
@@ -419,6 +433,26 @@ Examples:
|
|
|
419
433
|
`);
|
|
420
434
|
}
|
|
421
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* Reload configuration from config.yml
|
|
438
|
+
*/
|
|
439
|
+
async reloadConfig() {
|
|
440
|
+
const configPath = path.resolve(process.cwd(), "config.yml");
|
|
441
|
+
if (!fs.existsSync(configPath)) {
|
|
442
|
+
throw new Error("config.yml not found in current directory");
|
|
443
|
+
}
|
|
444
|
+
const configData = yaml.load(fs.readFileSync(configPath, "utf-8"));
|
|
445
|
+
this.config.llmProvider = configData.llmProvider || process.env.LLM_PROVIDER;
|
|
446
|
+
this.config.llmModel = configData.llmModel || process.env.LLM_MODEL;
|
|
447
|
+
this.config.customLLMUrl = configData.customLLMUrl || process.env.CUSTOM_LLM_URL;
|
|
448
|
+
const oldVariables = this.session.variables;
|
|
449
|
+
const oldSubroutines = this.session.subroutines;
|
|
450
|
+
const oldImportedFiles = this.session.importedFiles;
|
|
451
|
+
this.session = createSession(this.config);
|
|
452
|
+
this.session.variables = oldVariables;
|
|
453
|
+
this.session.subroutines = oldSubroutines;
|
|
454
|
+
this.session.importedFiles = oldImportedFiles;
|
|
455
|
+
}
|
|
422
456
|
};
|
|
423
457
|
async function main() {
|
|
424
458
|
let config = {
|