dirac-lang 0.1.71 → 0.1.73

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-YVI7T3DS.js";
6
- import "./chunk-QPO3WKH2.js";
5
+ } from "./chunk-KIIETJFM.js";
6
+ import "./chunk-YCUHRNXQ.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-VC23AJJJ.js";
9
9
  import "./chunk-M57VI7KL.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-QPO3WKH2.js";
3
+ } from "./chunk-YCUHRNXQ.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-QPO3WKH2.js";
3
+ } from "./chunk-YCUHRNXQ.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
@@ -481,12 +481,12 @@ async function executeIf(session, element) {
481
481
  const condition = await evaluatePredicate(session, conditionElement);
482
482
  if (condition) {
483
483
  if (thenElement) {
484
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2AU6RG6.js");
484
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QVHRO4LN.js");
485
485
  await integrateChildren2(session, thenElement);
486
486
  }
487
487
  } else {
488
488
  if (elseElement) {
489
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2AU6RG6.js");
489
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QVHRO4LN.js");
490
490
  await integrateChildren2(session, elseElement);
491
491
  }
492
492
  }
@@ -499,7 +499,7 @@ async function evaluatePredicate(session, predicateElement) {
499
499
  return await evaluateCondition(session, predicateElement);
500
500
  }
501
501
  const outputLengthBefore = session.output.length;
502
- const { integrate: integrate2 } = await import("./interpreter-Y2AU6RG6.js");
502
+ const { integrate: integrate2 } = await import("./interpreter-QVHRO4LN.js");
503
503
  await integrate2(session, predicateElement);
504
504
  const newOutputChunks = session.output.slice(outputLengthBefore);
505
505
  const result = newOutputChunks.join("").trim();
@@ -522,11 +522,11 @@ async function evaluateCondition(session, condElement) {
522
522
  }
523
523
  const outputLengthBefore = session.output.length;
524
524
  const args = [];
525
- const { integrate: integrate2 } = await import("./interpreter-Y2AU6RG6.js");
525
+ const { integrate: integrate2 } = await import("./interpreter-QVHRO4LN.js");
526
526
  for (const child of condElement.children) {
527
527
  if (child.tag.toLowerCase() === "arg") {
528
528
  const argOutputStart = session.output.length;
529
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2AU6RG6.js");
529
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QVHRO4LN.js");
530
530
  await integrateChildren2(session, child);
531
531
  const newChunks = session.output.slice(argOutputStart);
532
532
  const argValue = newChunks.join("");
@@ -1124,6 +1124,9 @@ ${validation.errorMessages.join("\n")}`);
1124
1124
  if (feedbackMode) {
1125
1125
  const outputAfter = session.output.slice();
1126
1126
  const executionOutput = outputAfter.slice(outputBefore.length).join("");
1127
+ if (executionOutput) {
1128
+ process.stdout.write(executionOutput);
1129
+ }
1127
1130
  if (session.debug) {
1128
1131
  console.error(`[LLM] Execution output (${executionOutput.length} chars):
1129
1132
  ${executionOutput}
@@ -1747,7 +1750,7 @@ async function executeTagCheck(session, element) {
1747
1750
  const executeTag = correctedTag || tagName;
1748
1751
  console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
1749
1752
  const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
1750
- const { integrate: integrate2 } = await import("./interpreter-Y2AU6RG6.js");
1753
+ const { integrate: integrate2 } = await import("./interpreter-QVHRO4LN.js");
1751
1754
  await integrate2(session, elementToExecute);
1752
1755
  }
1753
1756
  }
@@ -1756,7 +1759,7 @@ async function executeTagCheck(session, element) {
1756
1759
  // src/tags/throw.ts
1757
1760
  async function executeThrow(session, element) {
1758
1761
  const exceptionName = element.attributes?.name || "exception";
1759
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2AU6RG6.js");
1762
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QVHRO4LN.js");
1760
1763
  const exceptionDom = {
1761
1764
  tag: "exception-content",
1762
1765
  attributes: { name: exceptionName },
@@ -1769,7 +1772,7 @@ async function executeThrow(session, element) {
1769
1772
  // src/tags/try.ts
1770
1773
  async function executeTry(session, element) {
1771
1774
  setExceptionBoundary(session);
1772
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2AU6RG6.js");
1775
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QVHRO4LN.js");
1773
1776
  await integrateChildren2(session, element);
1774
1777
  unsetExceptionBoundary(session);
1775
1778
  }
@@ -1779,7 +1782,7 @@ async function executeCatch(session, element) {
1779
1782
  const exceptionName = element.attributes?.name || "exception";
1780
1783
  const caughtCount = lookupException(session, exceptionName);
1781
1784
  if (caughtCount > 0) {
1782
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2AU6RG6.js");
1785
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QVHRO4LN.js");
1783
1786
  await integrateChildren2(session, element);
1784
1787
  }
1785
1788
  flushCurrentException(session);
@@ -1788,7 +1791,7 @@ async function executeCatch(session, element) {
1788
1791
  // src/tags/exception.ts
1789
1792
  async function executeException(session, element) {
1790
1793
  const exceptions = getCurrentExceptions(session);
1791
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2AU6RG6.js");
1794
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QVHRO4LN.js");
1792
1795
  for (const exceptionDom of exceptions) {
1793
1796
  await integrateChildren2(session, exceptionDom);
1794
1797
  }
@@ -2256,7 +2259,7 @@ async function executeLoadContext(session, element) {
2256
2259
  query = element.text.trim();
2257
2260
  }
2258
2261
  if (!query && element.children.length > 0) {
2259
- const { integrate: integrate2 } = await import("./interpreter-Y2AU6RG6.js");
2262
+ const { integrate: integrate2 } = await import("./interpreter-QVHRO4LN.js");
2260
2263
  const beforeOutput = session.output.length;
2261
2264
  for (const child of element.children) {
2262
2265
  await integrate2(session, child);
@@ -2361,6 +2364,8 @@ async function executeSaveSubroutine(session, element) {
2361
2364
  let filePath;
2362
2365
  if (file) {
2363
2366
  filePath = resolve3(process.cwd(), file);
2367
+ } else if (subroutine.sourcePath && existsSync5(dirname4(subroutine.sourcePath))) {
2368
+ filePath = subroutine.sourcePath;
2364
2369
  } else if (pathAttr) {
2365
2370
  const targetDir = join4(homedir4(), ".dirac", "lib", pathAttr);
2366
2371
  filePath = join4(targetDir, `${name}.di`);
@@ -2578,12 +2583,18 @@ async function executeEditSubroutine(session, element) {
2578
2583
  if (session.debug) {
2579
2584
  console.error(`[edit-subroutine] Editor closed, re-importing subroutine`);
2580
2585
  }
2586
+ const originalSourcePath = subroutine.sourcePath;
2587
+ const oldIndex = session.subroutines.findIndex((s) => s.name === name);
2588
+ if (oldIndex !== -1) {
2589
+ session.subroutines.splice(oldIndex, 1);
2590
+ }
2581
2591
  const parser = new DiracParser();
2582
2592
  const ast = parser.parse(editedContent);
2583
2593
  await integrate(session, ast);
2584
2594
  const editedSub = session.subroutines.find((s) => s.name === name);
2585
2595
  if (editedSub) {
2586
2596
  editedSub.modified = true;
2597
+ editedSub.sourcePath = originalSourcePath;
2587
2598
  }
2588
2599
  emit(session, `Subroutine '${name}' updated in session (use save-subroutine to persist)
2589
2600
  `);
@@ -2679,7 +2690,7 @@ async function executeForeach(session, element) {
2679
2690
  const parser2 = new DiracParser2();
2680
2691
  try {
2681
2692
  const fromElement = parser2.parse(fromAttr);
2682
- const { integrate: integrate2 } = await import("./interpreter-Y2AU6RG6.js");
2693
+ const { integrate: integrate2 } = await import("./interpreter-QVHRO4LN.js");
2683
2694
  await integrate2(session, fromElement);
2684
2695
  } catch (e) {
2685
2696
  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-PLH7YN7I.js";
8
- import "./chunk-QPO3WKH2.js";
7
+ } from "./chunk-2EUVDYHX.js";
8
+ import "./chunk-YCUHRNXQ.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
10
  import "./chunk-VC23AJJJ.js";
11
11
  import "./chunk-M57VI7KL.js";
@@ -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.70",
19
+ version: "0.1.72",
20
20
  description: "LLM-Augmented Declarative Execution",
21
21
  type: "module",
22
22
  main: "dist/index.js",
@@ -109,7 +109,7 @@ async function main() {
109
109
  const args = process.argv.slice(2);
110
110
  const calledAs = process.argv[1];
111
111
  if (calledAs && calledAs.endsWith("/dish")) {
112
- const { DiracShell } = await import("./shell-BTRWJIV3.js");
112
+ const { DiracShell } = await import("./shell-EB5Z2U45.js");
113
113
  const shellConfig = loadShellConfig(args);
114
114
  const shell = new DiracShell(shellConfig);
115
115
  await shell.start();
@@ -158,11 +158,11 @@ async function main() {
158
158
  if (args[0] === "agent") {
159
159
  const subcommand = args[1];
160
160
  if (subcommand === "daemon") {
161
- const { runAgentDaemon } = await import("./agent-WJUVRA6D.js");
161
+ const { runAgentDaemon } = await import("./agent-TC34E2DB.js");
162
162
  await runAgentDaemon();
163
163
  return;
164
164
  }
165
- const { AgentCLI } = await import("./agent-WJUVRA6D.js");
165
+ const { AgentCLI } = await import("./agent-TC34E2DB.js");
166
166
  const agent = new AgentCLI();
167
167
  switch (subcommand) {
168
168
  case "start":
@@ -189,8 +189,8 @@ async function main() {
189
189
  return;
190
190
  }
191
191
  if (args[0] === "shell") {
192
- const { DiracShell } = await import("./shell-BTRWJIV3.js");
193
- const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-L5HBRT5P.js");
192
+ const { DiracShell } = await import("./shell-EB5Z2U45.js");
193
+ const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-K6OZRYTZ.js");
194
194
  const { SessionClient } = await import("./session-client-3VTC5MLO.js");
195
195
  const daemonMode = args.includes("--daemon") || args.includes("-d");
196
196
  const agentMode = args.includes("--agent") || args.includes("-a");
@@ -236,7 +236,7 @@ async function main() {
236
236
  return;
237
237
  }
238
238
  if (args[0] === "daemon") {
239
- const { SessionServer } = await import("./session-server-L5HBRT5P.js");
239
+ const { SessionServer } = await import("./session-server-K6OZRYTZ.js");
240
240
  const server = new SessionServer();
241
241
  await server.start();
242
242
  console.log("Session daemon started");
@@ -3,7 +3,7 @@ import {
3
3
  listCronJobs,
4
4
  stopAllCronJobs,
5
5
  stopCronJob
6
- } from "./chunk-QPO3WKH2.js";
6
+ } from "./chunk-YCUHRNXQ.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-VC23AJJJ.js";
9
9
  import "./chunk-M57VI7KL.js";
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  createLLMAdapter,
3
3
  execute,
4
4
  executeUserCommand
5
- } from "./chunk-PLH7YN7I.js";
5
+ } from "./chunk-2EUVDYHX.js";
6
6
  import {
7
7
  integrate
8
- } from "./chunk-QPO3WKH2.js";
8
+ } from "./chunk-YCUHRNXQ.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-QPO3WKH2.js";
4
+ } from "./chunk-YCUHRNXQ.js";
5
5
  import "./chunk-HRHAMPOB.js";
6
6
  import "./chunk-VC23AJJJ.js";
7
7
  import "./chunk-M57VI7KL.js";
@@ -3,7 +3,7 @@ import {
3
3
  cancelScheduledRun,
4
4
  executeRunAt,
5
5
  listScheduledRuns
6
- } from "./chunk-QPO3WKH2.js";
6
+ } from "./chunk-YCUHRNXQ.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-VC23AJJJ.js";
9
9
  import "./chunk-M57VI7KL.js";
@@ -3,7 +3,7 @@ import {
3
3
  listScheduledTasks,
4
4
  stopAllScheduledTasks,
5
5
  stopScheduledTask
6
- } from "./chunk-QPO3WKH2.js";
6
+ } from "./chunk-YCUHRNXQ.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-VC23AJJJ.js";
9
9
  import "./chunk-M57VI7KL.js";
@@ -2,8 +2,8 @@ import {
2
2
  SessionServer,
3
3
  getSocketPath,
4
4
  isSessionRunning
5
- } from "./chunk-YVI7T3DS.js";
6
- import "./chunk-QPO3WKH2.js";
5
+ } from "./chunk-KIIETJFM.js";
6
+ import "./chunk-YCUHRNXQ.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-VC23AJJJ.js";
9
9
  import "./chunk-M57VI7KL.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-AJSYOXXZ.js";
5
5
  import {
6
6
  integrate
7
- } from "./chunk-QPO3WKH2.js";
7
+ } from "./chunk-YCUHRNXQ.js";
8
8
  import {
9
9
  DiracParser
10
10
  } from "./chunk-HRHAMPOB.js";
@@ -359,7 +359,7 @@ var DiracShell = class {
359
359
  if (this.client) {
360
360
  this.client.disconnect();
361
361
  }
362
- import("./schedule-R3ZBENYA.js").then(({ stopAllScheduledTasks }) => {
362
+ import("./schedule-FWAU6HDT.js").then(({ stopAllScheduledTasks }) => {
363
363
  stopAllScheduledTasks();
364
364
  console.log("\nGoodbye!");
365
365
  process.exit(0);
@@ -581,7 +581,9 @@ Examples:
581
581
  console.log("Variables:");
582
582
  for (const v of variables) {
583
583
  if (v.visible) {
584
- console.log(` ${v.name} = ${JSON.stringify(v.value)}`);
584
+ const formattedValue = typeof v.value === "string" && (v.value.startsWith("[") || v.value.startsWith("{")) ? JSON.stringify(JSON.parse(v.value), null, 2) : JSON.stringify(v.value);
585
+ console.log(` ${v.name} =`);
586
+ console.log(formattedValue.split("\n").map((line) => ` ${line}`).join("\n"));
585
587
  }
586
588
  }
587
589
  }
@@ -750,7 +752,7 @@ Examples:
750
752
  break;
751
753
  case "tasks":
752
754
  try {
753
- const { listScheduledTasks } = await import("./schedule-R3ZBENYA.js");
755
+ const { listScheduledTasks } = await import("./schedule-FWAU6HDT.js");
754
756
  const tasks = listScheduledTasks();
755
757
  if (tasks.length === 0) {
756
758
  console.log("No scheduled tasks running.");
@@ -769,7 +771,7 @@ Examples:
769
771
  console.log("Usage: :stop <task-name>");
770
772
  } else {
771
773
  try {
772
- const { stopScheduledTask } = await import("./schedule-R3ZBENYA.js");
774
+ const { stopScheduledTask } = await import("./schedule-FWAU6HDT.js");
773
775
  const taskName = args[0];
774
776
  const stopped = stopScheduledTask(taskName);
775
777
  if (stopped) {
@@ -784,7 +786,7 @@ Examples:
784
786
  break;
785
787
  case "stopall":
786
788
  try {
787
- const { stopAllScheduledTasks } = await import("./schedule-R3ZBENYA.js");
789
+ const { stopAllScheduledTasks } = await import("./schedule-FWAU6HDT.js");
788
790
  stopAllScheduledTasks();
789
791
  console.log("All scheduled tasks stopped.");
790
792
  } catch (error) {
@@ -793,7 +795,7 @@ Examples:
793
795
  break;
794
796
  case "crons":
795
797
  try {
796
- const { listCronJobs } = await import("./cron-HFJ3HK5G.js");
798
+ const { listCronJobs } = await import("./cron-M5HO2H5T.js");
797
799
  const jobs = listCronJobs();
798
800
  if (jobs.length === 0) {
799
801
  console.log("No cron jobs running.");
@@ -813,7 +815,7 @@ Examples:
813
815
  console.log("Usage: :stopcron <job-name>");
814
816
  } else {
815
817
  try {
816
- const { stopCronJob } = await import("./cron-HFJ3HK5G.js");
818
+ const { stopCronJob } = await import("./cron-M5HO2H5T.js");
817
819
  const jobName = args[0];
818
820
  const stopped = stopCronJob(jobName);
819
821
  if (stopped) {
@@ -828,7 +830,7 @@ Examples:
828
830
  break;
829
831
  case "stopallcrons":
830
832
  try {
831
- const { stopAllCronJobs } = await import("./cron-HFJ3HK5G.js");
833
+ const { stopAllCronJobs } = await import("./cron-M5HO2H5T.js");
832
834
  stopAllCronJobs();
833
835
  console.log("All cron jobs stopped.");
834
836
  } catch (error) {
@@ -837,7 +839,7 @@ Examples:
837
839
  break;
838
840
  case "scheduled":
839
841
  try {
840
- const { listScheduledRuns } = await import("./run-at-JFHLEZNU.js");
842
+ const { listScheduledRuns } = await import("./run-at-GP5XZP5W.js");
841
843
  const runs = listScheduledRuns();
842
844
  if (runs.length === 0) {
843
845
  console.log("No scheduled runs pending.");
@@ -857,7 +859,7 @@ Examples:
857
859
  console.log("Usage: :cancel <run-name>");
858
860
  } else {
859
861
  try {
860
- const { cancelScheduledRun } = await import("./run-at-JFHLEZNU.js");
862
+ const { cancelScheduledRun } = await import("./run-at-GP5XZP5W.js");
861
863
  const runName = args[0];
862
864
  const cancelled = cancelScheduledRun(runName);
863
865
  if (cancelled) {
@@ -872,7 +874,7 @@ Examples:
872
874
  break;
873
875
  case "cancelall":
874
876
  try {
875
- const { cancelAllScheduledRuns } = await import("./run-at-JFHLEZNU.js");
877
+ const { cancelAllScheduledRuns } = await import("./run-at-GP5XZP5W.js");
876
878
  cancelAllScheduledRuns();
877
879
  console.log("All scheduled runs cancelled.");
878
880
  } catch (error) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-QPO3WKH2.js";
3
+ } from "./chunk-YCUHRNXQ.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirac-lang",
3
- "version": "0.1.71",
3
+ "version": "0.1.73",
4
4
  "description": "LLM-Augmented Declarative Execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",