dirac-lang 0.1.64 → 0.1.66

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.
@@ -2,8 +2,8 @@ import {
2
2
  SessionServer,
3
3
  getSocketPath,
4
4
  isSessionRunning
5
- } from "./chunk-6GYEZ3Z4.js";
6
- import "./chunk-ER6DSG7W.js";
5
+ } from "./chunk-FYOJQTDE.js";
6
+ import "./chunk-YM4HLLAJ.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-NKA6ZJDV.js";
9
9
  import "./chunk-3UW6GWYQ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-ER6DSG7W.js";
3
+ } from "./chunk-YM4HLLAJ.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-ER6DSG7W.js";
3
+ } from "./chunk-YM4HLLAJ.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
@@ -474,12 +474,12 @@ async function executeIf(session, element) {
474
474
  const condition = await evaluatePredicate(session, conditionElement);
475
475
  if (condition) {
476
476
  if (thenElement) {
477
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
477
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-WTIAZW6A.js");
478
478
  await integrateChildren2(session, thenElement);
479
479
  }
480
480
  } else {
481
481
  if (elseElement) {
482
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
482
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-WTIAZW6A.js");
483
483
  await integrateChildren2(session, elseElement);
484
484
  }
485
485
  }
@@ -492,7 +492,7 @@ async function evaluatePredicate(session, predicateElement) {
492
492
  return await evaluateCondition(session, predicateElement);
493
493
  }
494
494
  const outputLengthBefore = session.output.length;
495
- const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
495
+ const { integrate: integrate2 } = await import("./interpreter-WTIAZW6A.js");
496
496
  await integrate2(session, predicateElement);
497
497
  const newOutputChunks = session.output.slice(outputLengthBefore);
498
498
  const result = newOutputChunks.join("").trim();
@@ -515,11 +515,11 @@ async function evaluateCondition(session, condElement) {
515
515
  }
516
516
  const outputLengthBefore = session.output.length;
517
517
  const args = [];
518
- const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
518
+ const { integrate: integrate2 } = await import("./interpreter-WTIAZW6A.js");
519
519
  for (const child of condElement.children) {
520
520
  if (child.tag.toLowerCase() === "arg") {
521
521
  const argOutputStart = session.output.length;
522
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
522
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-WTIAZW6A.js");
523
523
  await integrateChildren2(session, child);
524
524
  const newChunks = session.output.slice(argOutputStart);
525
525
  const argValue = newChunks.join("");
@@ -1209,6 +1209,8 @@ ${expr}
1209
1209
  const params = session.parameterStack[session.parameterStack.length - 1];
1210
1210
  return params && params[0] ? params[0] : null;
1211
1211
  };
1212
+ context.getVariable = (name2) => getVariable(session, name2);
1213
+ context.setVariable = (name2, value, global = false) => setVariable(session, name2, value, global);
1212
1214
  context.session = session;
1213
1215
  let result;
1214
1216
  const func = new AsyncFunction(...Object.keys(context), expr);
@@ -1715,7 +1717,7 @@ async function executeTagCheck(session, element) {
1715
1717
  const executeTag = correctedTag || tagName;
1716
1718
  console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
1717
1719
  const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
1718
- const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
1720
+ const { integrate: integrate2 } = await import("./interpreter-WTIAZW6A.js");
1719
1721
  await integrate2(session, elementToExecute);
1720
1722
  }
1721
1723
  }
@@ -1724,7 +1726,7 @@ async function executeTagCheck(session, element) {
1724
1726
  // src/tags/throw.ts
1725
1727
  async function executeThrow(session, element) {
1726
1728
  const exceptionName = element.attributes?.name || "exception";
1727
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
1729
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-WTIAZW6A.js");
1728
1730
  const exceptionDom = {
1729
1731
  tag: "exception-content",
1730
1732
  attributes: { name: exceptionName },
@@ -1737,7 +1739,7 @@ async function executeThrow(session, element) {
1737
1739
  // src/tags/try.ts
1738
1740
  async function executeTry(session, element) {
1739
1741
  setExceptionBoundary(session);
1740
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
1742
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-WTIAZW6A.js");
1741
1743
  await integrateChildren2(session, element);
1742
1744
  unsetExceptionBoundary(session);
1743
1745
  }
@@ -1747,7 +1749,7 @@ async function executeCatch(session, element) {
1747
1749
  const exceptionName = element.attributes?.name || "exception";
1748
1750
  const caughtCount = lookupException(session, exceptionName);
1749
1751
  if (caughtCount > 0) {
1750
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
1752
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-WTIAZW6A.js");
1751
1753
  await integrateChildren2(session, element);
1752
1754
  }
1753
1755
  flushCurrentException(session);
@@ -1756,7 +1758,7 @@ async function executeCatch(session, element) {
1756
1758
  // src/tags/exception.ts
1757
1759
  async function executeException(session, element) {
1758
1760
  const exceptions = getCurrentExceptions(session);
1759
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
1761
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-WTIAZW6A.js");
1760
1762
  for (const exceptionDom of exceptions) {
1761
1763
  await integrateChildren2(session, exceptionDom);
1762
1764
  }
@@ -2224,7 +2226,7 @@ async function executeLoadContext(session, element) {
2224
2226
  query = element.text.trim();
2225
2227
  }
2226
2228
  if (!query && element.children.length > 0) {
2227
- const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
2229
+ const { integrate: integrate2 } = await import("./interpreter-WTIAZW6A.js");
2228
2230
  const beforeOutput = session.output.length;
2229
2231
  for (const child of element.children) {
2230
2232
  await integrate2(session, child);
@@ -2477,7 +2479,7 @@ async function executeForeach(session, element) {
2477
2479
  const parser2 = new DiracParser2();
2478
2480
  try {
2479
2481
  const fromElement = parser2.parse(fromAttr);
2480
- const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
2482
+ const { integrate: integrate2 } = await import("./interpreter-WTIAZW6A.js");
2481
2483
  await integrate2(session, fromElement);
2482
2484
  } catch (e) {
2483
2485
  session.output = savedOutput;
package/dist/cli.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  } from "./chunk-AJSYOXXZ.js";
5
5
  import {
6
6
  execute
7
- } from "./chunk-ZN52C2TW.js";
8
- import "./chunk-ER6DSG7W.js";
7
+ } from "./chunk-4IFJOZTM.js";
8
+ import "./chunk-YM4HLLAJ.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
10
  import "./chunk-NKA6ZJDV.js";
11
11
  import "./chunk-3UW6GWYQ.js";
@@ -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.63",
19
+ version: "0.1.66",
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-UYCIYNMN.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:");
@@ -114,11 +158,11 @@ async function main() {
114
158
  if (args[0] === "agent") {
115
159
  const subcommand = args[1];
116
160
  if (subcommand === "daemon") {
117
- const { runAgentDaemon } = await import("./agent-HAYADDBF.js");
161
+ const { runAgentDaemon } = await import("./agent-MRVK3EEX.js");
118
162
  await runAgentDaemon();
119
163
  return;
120
164
  }
121
- const { AgentCLI } = await import("./agent-HAYADDBF.js");
165
+ const { AgentCLI } = await import("./agent-MRVK3EEX.js");
122
166
  const agent = new AgentCLI();
123
167
  switch (subcommand) {
124
168
  case "start":
@@ -145,46 +189,14 @@ async function main() {
145
189
  return;
146
190
  }
147
191
  if (args[0] === "shell") {
148
- const { DiracShell } = await import("./shell-6NG7WK5Z.js");
149
- const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-GEISBLMU.js");
192
+ const { DiracShell } = await import("./shell-UYCIYNMN.js");
193
+ const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-FWNQKCMU.js");
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 = { debug: false };
154
- for (let i = 1; i < args.length; i++) {
155
- const arg = args[i];
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");
@@ -224,7 +236,7 @@ async function main() {
224
236
  return;
225
237
  }
226
238
  if (args[0] === "daemon") {
227
- const { SessionServer } = await import("./session-server-GEISBLMU.js");
239
+ const { SessionServer } = await import("./session-server-FWNQKCMU.js");
228
240
  const server = new SessionServer();
229
241
  await server.start();
230
242
  console.log("Session daemon started");
@@ -3,7 +3,7 @@ import {
3
3
  listCronJobs,
4
4
  stopAllCronJobs,
5
5
  stopCronJob
6
- } from "./chunk-ER6DSG7W.js";
6
+ } from "./chunk-YM4HLLAJ.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-NKA6ZJDV.js";
9
9
  import "./chunk-3UW6GWYQ.js";
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  createLLMAdapter,
3
3
  execute,
4
4
  executeUserCommand
5
- } from "./chunk-ZN52C2TW.js";
5
+ } from "./chunk-4IFJOZTM.js";
6
6
  import {
7
7
  integrate
8
- } from "./chunk-ER6DSG7W.js";
8
+ } from "./chunk-YM4HLLAJ.js";
9
9
  import {
10
10
  DiracParser
11
11
  } from "./chunk-HRHAMPOB.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  integrate,
3
3
  integrateChildren
4
- } from "./chunk-ER6DSG7W.js";
4
+ } from "./chunk-YM4HLLAJ.js";
5
5
  import "./chunk-HRHAMPOB.js";
6
6
  import "./chunk-NKA6ZJDV.js";
7
7
  import "./chunk-3UW6GWYQ.js";
@@ -3,7 +3,7 @@ import {
3
3
  cancelScheduledRun,
4
4
  executeRunAt,
5
5
  listScheduledRuns
6
- } from "./chunk-ER6DSG7W.js";
6
+ } from "./chunk-YM4HLLAJ.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-NKA6ZJDV.js";
9
9
  import "./chunk-3UW6GWYQ.js";
@@ -3,7 +3,7 @@ import {
3
3
  listScheduledTasks,
4
4
  stopAllScheduledTasks,
5
5
  stopScheduledTask
6
- } from "./chunk-ER6DSG7W.js";
6
+ } from "./chunk-YM4HLLAJ.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-NKA6ZJDV.js";
9
9
  import "./chunk-3UW6GWYQ.js";
@@ -2,8 +2,8 @@ import {
2
2
  SessionServer,
3
3
  getSocketPath,
4
4
  isSessionRunning
5
- } from "./chunk-6GYEZ3Z4.js";
6
- import "./chunk-ER6DSG7W.js";
5
+ } from "./chunk-FYOJQTDE.js";
6
+ import "./chunk-YM4HLLAJ.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-NKA6ZJDV.js";
9
9
  import "./chunk-3UW6GWYQ.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-AJSYOXXZ.js";
5
5
  import {
6
6
  integrate
7
- } from "./chunk-ER6DSG7W.js";
7
+ } from "./chunk-YM4HLLAJ.js";
8
8
  import {
9
9
  DiracParser
10
10
  } from "./chunk-HRHAMPOB.js";
@@ -280,7 +280,7 @@ var DiracShell = class {
280
280
  if (this.client) {
281
281
  this.client.disconnect();
282
282
  }
283
- import("./schedule-VKPK4DWF.js").then(({ stopAllScheduledTasks }) => {
283
+ import("./schedule-UZKFXZQD.js").then(({ stopAllScheduledTasks }) => {
284
284
  stopAllScheduledTasks();
285
285
  console.log("\nGoodbye!");
286
286
  process.exit(0);
@@ -646,7 +646,7 @@ Examples:
646
646
  break;
647
647
  case "tasks":
648
648
  try {
649
- const { listScheduledTasks } = await import("./schedule-VKPK4DWF.js");
649
+ const { listScheduledTasks } = await import("./schedule-UZKFXZQD.js");
650
650
  const tasks = listScheduledTasks();
651
651
  if (tasks.length === 0) {
652
652
  console.log("No scheduled tasks running.");
@@ -665,7 +665,7 @@ Examples:
665
665
  console.log("Usage: :stop <task-name>");
666
666
  } else {
667
667
  try {
668
- const { stopScheduledTask } = await import("./schedule-VKPK4DWF.js");
668
+ const { stopScheduledTask } = await import("./schedule-UZKFXZQD.js");
669
669
  const taskName = args[0];
670
670
  const stopped = stopScheduledTask(taskName);
671
671
  if (stopped) {
@@ -680,7 +680,7 @@ Examples:
680
680
  break;
681
681
  case "stopall":
682
682
  try {
683
- const { stopAllScheduledTasks } = await import("./schedule-VKPK4DWF.js");
683
+ const { stopAllScheduledTasks } = await import("./schedule-UZKFXZQD.js");
684
684
  stopAllScheduledTasks();
685
685
  console.log("All scheduled tasks stopped.");
686
686
  } catch (error) {
@@ -689,7 +689,7 @@ Examples:
689
689
  break;
690
690
  case "crons":
691
691
  try {
692
- const { listCronJobs } = await import("./cron-JAWTZUOM.js");
692
+ const { listCronJobs } = await import("./cron-UXGC3YC4.js");
693
693
  const jobs = listCronJobs();
694
694
  if (jobs.length === 0) {
695
695
  console.log("No cron jobs running.");
@@ -709,7 +709,7 @@ Examples:
709
709
  console.log("Usage: :stopcron <job-name>");
710
710
  } else {
711
711
  try {
712
- const { stopCronJob } = await import("./cron-JAWTZUOM.js");
712
+ const { stopCronJob } = await import("./cron-UXGC3YC4.js");
713
713
  const jobName = args[0];
714
714
  const stopped = stopCronJob(jobName);
715
715
  if (stopped) {
@@ -724,7 +724,7 @@ Examples:
724
724
  break;
725
725
  case "stopallcrons":
726
726
  try {
727
- const { stopAllCronJobs } = await import("./cron-JAWTZUOM.js");
727
+ const { stopAllCronJobs } = await import("./cron-UXGC3YC4.js");
728
728
  stopAllCronJobs();
729
729
  console.log("All cron jobs stopped.");
730
730
  } catch (error) {
@@ -733,7 +733,7 @@ Examples:
733
733
  break;
734
734
  case "scheduled":
735
735
  try {
736
- const { listScheduledRuns } = await import("./run-at-BMPXOIW4.js");
736
+ const { listScheduledRuns } = await import("./run-at-PGD5BY5C.js");
737
737
  const runs = listScheduledRuns();
738
738
  if (runs.length === 0) {
739
739
  console.log("No scheduled runs pending.");
@@ -753,7 +753,7 @@ Examples:
753
753
  console.log("Usage: :cancel <run-name>");
754
754
  } else {
755
755
  try {
756
- const { cancelScheduledRun } = await import("./run-at-BMPXOIW4.js");
756
+ const { cancelScheduledRun } = await import("./run-at-PGD5BY5C.js");
757
757
  const runName = args[0];
758
758
  const cancelled = cancelScheduledRun(runName);
759
759
  if (cancelled) {
@@ -768,7 +768,7 @@ Examples:
768
768
  break;
769
769
  case "cancelall":
770
770
  try {
771
- const { cancelAllScheduledRuns } = await import("./run-at-BMPXOIW4.js");
771
+ const { cancelAllScheduledRuns } = await import("./run-at-PGD5BY5C.js");
772
772
  cancelAllScheduledRuns();
773
773
  console.log("All scheduled runs cancelled.");
774
774
  } catch (error) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-ER6DSG7W.js";
3
+ } from "./chunk-YM4HLLAJ.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "dirac-lang",
3
- "version": "0.1.64",
3
+ "version": "0.1.66",
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"