dirac-lang 0.1.99 → 0.1.100

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/README.md CHANGED
@@ -252,6 +252,21 @@ Dirac is more than a language—it's a **paradigm shift** in how we think about
252
252
  npm install -g dirac-lang
253
253
  ```
254
254
 
255
+ ## Documentation
256
+
257
+ For detailed guides on using Dirac:
258
+
259
+ - **[Getting Started](GETTING-STARTED.md)** - Installation and first programs
260
+ - **[Quick Start Library Guide](QUICKSTART-LIBRARY.md)** - Building reusable libraries
261
+ - **[LLM Integration](LLM-DIALOG-CONTEXT.md)** - Working with LLMs in Dirac
262
+ - **[Subroutine Management](SUBROUTINE-MANAGEMENT.md)** - Stack operations and subroutine control
263
+ - **[Training Data Export](TRAINING-DATA-EXPORT.md)** - Creating fine-tuning datasets
264
+ - **[Debugging](DEBUGGING.md)** - Debug mode and troubleshooting
265
+ - **[Exception Handling](EXCEPTION-HANDLING.md)** - Error handling and recovery
266
+ - **[Namespaces](NAMESPACES.md)** - Organizing code with namespaces
267
+ - **[Libraries](LIBRARIES.md)** - Using and creating libraries
268
+ - **[Conditional Tags](CONDITIONAL-TAGS.md)** - Control flow patterns
269
+
255
270
  ---
256
271
 
257
272
  *"In the quantum realm, a bra meets a ket to produce reality. In Dirac, a declaration meets an LLM to produce execution."*
@@ -2,8 +2,8 @@ import {
2
2
  SessionServer,
3
3
  getSocketPath,
4
4
  isSessionRunning
5
- } from "./chunk-R6R6OHPA.js";
6
- import "./chunk-3VCKPUTQ.js";
5
+ } from "./chunk-TIQ36H2U.js";
6
+ import "./chunk-OUCAV57A.js";
7
7
  import "./chunk-53QJQ2CC.js";
8
8
  import "./chunk-HRHAMPOB.js";
9
9
  import "./chunk-EAM7IZWA.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-3VCKPUTQ.js";
3
+ } from "./chunk-OUCAV57A.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
@@ -487,12 +487,12 @@ async function executeIf(session, element) {
487
487
  const condition = await evaluatePredicate(session, conditionElement);
488
488
  if (condition) {
489
489
  if (thenElement) {
490
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-ENHZAIWT.js");
490
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
491
491
  await integrateChildren2(session, thenElement);
492
492
  }
493
493
  } else {
494
494
  if (elseElement) {
495
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-ENHZAIWT.js");
495
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
496
496
  await integrateChildren2(session, elseElement);
497
497
  }
498
498
  }
@@ -505,7 +505,7 @@ async function evaluatePredicate(session, predicateElement) {
505
505
  return await evaluateCondition(session, predicateElement);
506
506
  }
507
507
  const outputLengthBefore = session.output.length;
508
- const { integrate: integrate2 } = await import("./interpreter-ENHZAIWT.js");
508
+ const { integrate: integrate2 } = await import("./interpreter-KOWJFLNS.js");
509
509
  await integrate2(session, predicateElement);
510
510
  const newOutputChunks = session.output.slice(outputLengthBefore);
511
511
  const result = newOutputChunks.join("").trim();
@@ -528,11 +528,11 @@ async function evaluateCondition(session, condElement) {
528
528
  }
529
529
  const outputLengthBefore = session.output.length;
530
530
  const args = [];
531
- const { integrate: integrate2 } = await import("./interpreter-ENHZAIWT.js");
531
+ const { integrate: integrate2 } = await import("./interpreter-KOWJFLNS.js");
532
532
  for (const child of condElement.children) {
533
533
  if (child.tag.toLowerCase() === "arg") {
534
534
  const argOutputStart = session.output.length;
535
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-ENHZAIWT.js");
535
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
536
536
  await integrateChildren2(session, child);
537
537
  const newChunks = session.output.slice(argOutputStart);
538
538
  const argValue = newChunks.join("");
@@ -1053,6 +1053,13 @@ ${result}
1053
1053
  const maxRetries = parseInt(element.attributes["max-retries"] || "0", 10);
1054
1054
  const feedbackMode = element.attributes["feedback"] === "true";
1055
1055
  const confirmCorrections = element.attributes["confirm-corrections"] === "true";
1056
+ console.error(`
1057
+ ${"=".repeat(60)}`);
1058
+ console.error(`[LLM Original Response]`);
1059
+ console.error(`${"=".repeat(60)}`);
1060
+ console.error(result);
1061
+ console.error(`${"=".repeat(60)}
1062
+ `);
1056
1063
  console.error(`[LLM] Execute mode - validate: ${validateTags}, autocorrect: ${autocorrect}, feedback: ${feedbackMode}, confirm-corrections: ${confirmCorrections}, debug: ${session.debug}`);
1057
1064
  const maxIterationsAttr = substituteAttribute(session, element.attributes["max-iterations"] || "3");
1058
1065
  const maxIterations = parseInt(maxIterationsAttr, 10);
@@ -1098,7 +1105,7 @@ ${result}
1098
1105
  if (session.debug) {
1099
1106
  console.error(`[LLM] Validation enabled, autocorrect: ${autocorrect}`);
1100
1107
  }
1101
- const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-QS7T4GFE.js");
1108
+ const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-PWJG4OAM.js");
1102
1109
  let validation = await validateDiracCode(session, dynamicAST, { autocorrect, deepValidation: true });
1103
1110
  console.error(`[LLM] Iteration ${iteration}: Validation complete - valid: ${validation.valid}, errors: ${validation.errorMessages.length}`);
1104
1111
  if (session.debug) {
@@ -1132,7 +1139,7 @@ ${result}
1132
1139
  if (correctionMessages.length > 0) {
1133
1140
  console.error("[LLM] Corrections:", correctionMessages.join("; "));
1134
1141
  }
1135
- dynamicAST = applyCorrectedTags(dynamicAST, validation.results);
1142
+ dynamicAST = applyCorrectedTags(session, dynamicAST, validation.results);
1136
1143
  console.error("[LLM] Applied initial auto-corrections to AST");
1137
1144
  validation = await validateDiracCode(session, dynamicAST, { autocorrect: false, deepValidation: true });
1138
1145
  console.error(`[LLM] Re-validation after corrections: valid=${validation.valid}`);
@@ -1183,6 +1190,13 @@ Please fix these errors and generate valid Dirac XML again. Remember to only use
1183
1190
  } else if (saveDialog) {
1184
1191
  setVariable(session, "__llm_dialog__", JSON.stringify(dialogHistory), true);
1185
1192
  }
1193
+ console.error(`
1194
+ ${"=".repeat(60)}`);
1195
+ console.error(`[LLM Original Response - Retry ${retryCount}]`);
1196
+ console.error(`${"=".repeat(60)}`);
1197
+ console.error(result);
1198
+ console.error(`${"=".repeat(60)}
1199
+ `);
1186
1200
  if (session.debug) {
1187
1201
  console.error(`[LLM] Retry ${retryCount} response:
1188
1202
  ${result}
@@ -1266,6 +1280,13 @@ If you resubmit this corrected code, I will execute it for you. Please review an
1266
1280
  } else if (saveDialog) {
1267
1281
  setVariable(session, "__llm_dialog__", JSON.stringify(dialogHistory), true);
1268
1282
  }
1283
+ console.error(`
1284
+ ${"=".repeat(60)}`);
1285
+ console.error(`[LLM Original Response - Confirmation]`);
1286
+ console.error(`${"=".repeat(60)}`);
1287
+ console.error(result);
1288
+ console.error(`${"=".repeat(60)}
1289
+ `);
1269
1290
  console.error(`[LLM] LLM confirmation response:
1270
1291
  ${result}
1271
1292
  `);
@@ -1343,6 +1364,13 @@ Please fix the error and try again.`;
1343
1364
  } else if (saveDialog) {
1344
1365
  setVariable(session, "__llm_dialog__", JSON.stringify(dialogHistory), true);
1345
1366
  }
1367
+ console.error(`
1368
+ ${"=".repeat(60)}`);
1369
+ console.error(`[LLM Original Response - After Error]`);
1370
+ console.error(`${"=".repeat(60)}`);
1371
+ console.error(result);
1372
+ console.error(`${"=".repeat(60)}
1373
+ `);
1346
1374
  continue;
1347
1375
  } else {
1348
1376
  throw execError;
@@ -1428,6 +1456,13 @@ ${feedbackPrompt}
1428
1456
  } else if (saveDialog) {
1429
1457
  setVariable(session, "__llm_dialog__", JSON.stringify(dialogHistory), true);
1430
1458
  }
1459
+ console.error(`
1460
+ ${"=".repeat(60)}`);
1461
+ console.error(`[LLM Original Response - Feedback Loop]`);
1462
+ console.error(`${"=".repeat(60)}`);
1463
+ console.error(result);
1464
+ console.error(`${"=".repeat(60)}
1465
+ `);
1431
1466
  if (session.debug) {
1432
1467
  console.error(`[LLM] Feedback response:
1433
1468
  ${result}
@@ -1494,6 +1529,13 @@ Please fix these errors and generate valid Dirac XML code. Remember:
1494
1529
  } else if (saveDialog) {
1495
1530
  setVariable(session, "__llm_dialog__", JSON.stringify(dialogHistory), true);
1496
1531
  }
1532
+ console.error(`
1533
+ ${"=".repeat(60)}`);
1534
+ console.error(`[LLM Original Response - After Parse Error]`);
1535
+ console.error(`${"=".repeat(60)}`);
1536
+ console.error(result);
1537
+ console.error(`${"=".repeat(60)}
1538
+ `);
1497
1539
  if (session.debug) {
1498
1540
  console.error(`[LLM] LLM correction response:
1499
1541
  ${result}
@@ -2061,7 +2103,7 @@ async function executeTagCheck(session, element) {
2061
2103
  const executeTag = correctedTag || tagName;
2062
2104
  console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
2063
2105
  const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
2064
- const { integrate: integrate2 } = await import("./interpreter-ENHZAIWT.js");
2106
+ const { integrate: integrate2 } = await import("./interpreter-KOWJFLNS.js");
2065
2107
  await integrate2(session, elementToExecute);
2066
2108
  }
2067
2109
  }
@@ -2070,7 +2112,7 @@ async function executeTagCheck(session, element) {
2070
2112
  // src/tags/throw.ts
2071
2113
  async function executeThrow(session, element) {
2072
2114
  const exceptionName = element.attributes?.name || "exception";
2073
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-ENHZAIWT.js");
2115
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
2074
2116
  const exceptionDom = {
2075
2117
  tag: "exception-content",
2076
2118
  attributes: { name: exceptionName },
@@ -2083,7 +2125,7 @@ async function executeThrow(session, element) {
2083
2125
  // src/tags/try.ts
2084
2126
  async function executeTry(session, element) {
2085
2127
  setExceptionBoundary(session);
2086
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-ENHZAIWT.js");
2128
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
2087
2129
  await integrateChildren2(session, element);
2088
2130
  unsetExceptionBoundary(session);
2089
2131
  }
@@ -2093,7 +2135,7 @@ async function executeCatch(session, element) {
2093
2135
  const exceptionName = element.attributes?.name || "exception";
2094
2136
  const caughtCount = lookupException(session, exceptionName);
2095
2137
  if (caughtCount > 0) {
2096
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-ENHZAIWT.js");
2138
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
2097
2139
  await integrateChildren2(session, element);
2098
2140
  }
2099
2141
  flushCurrentException(session);
@@ -2102,7 +2144,7 @@ async function executeCatch(session, element) {
2102
2144
  // src/tags/exception.ts
2103
2145
  async function executeException(session, element) {
2104
2146
  const exceptions = getCurrentExceptions(session);
2105
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-ENHZAIWT.js");
2147
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
2106
2148
  for (const exceptionDom of exceptions) {
2107
2149
  await integrateChildren2(session, exceptionDom);
2108
2150
  }
@@ -2303,7 +2345,7 @@ async function executeLoadContext(session, element) {
2303
2345
  query = element.text.trim();
2304
2346
  }
2305
2347
  if (!query && element.children.length > 0) {
2306
- const { integrate: integrate2 } = await import("./interpreter-ENHZAIWT.js");
2348
+ const { integrate: integrate2 } = await import("./interpreter-KOWJFLNS.js");
2307
2349
  const beforeOutput = session.output.length;
2308
2350
  for (const child of element.children) {
2309
2351
  await integrate2(session, child);
@@ -3147,7 +3189,7 @@ async function executeForeach(session, element) {
3147
3189
  const parser2 = new DiracParser2();
3148
3190
  try {
3149
3191
  const fromElement = parser2.parse(fromAttr);
3150
- const { integrate: integrate2 } = await import("./interpreter-ENHZAIWT.js");
3192
+ const { integrate: integrate2 } = await import("./interpreter-KOWJFLNS.js");
3151
3193
  await integrate2(session, fromElement);
3152
3194
  } catch (e) {
3153
3195
  session.output = savedOutput;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-3VCKPUTQ.js";
3
+ } from "./chunk-OUCAV57A.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
package/dist/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  execute
4
- } from "./chunk-EE3YBMAD.js";
4
+ } from "./chunk-7MSWEFH5.js";
5
5
  import {
6
6
  BraKetParser
7
- } from "./chunk-3VCKPUTQ.js";
7
+ } from "./chunk-OUCAV57A.js";
8
8
  import "./chunk-53QJQ2CC.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
10
  import "./chunk-EAM7IZWA.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.98",
19
+ version: "0.1.99",
20
20
  description: "LLM-Augmented Declarative Execution",
21
21
  type: "module",
22
22
  main: "dist/index.js",
@@ -150,7 +150,7 @@ async function main() {
150
150
  const args = process.argv.slice(2);
151
151
  const calledAs = process.argv[1];
152
152
  if (calledAs && calledAs.endsWith("/dish")) {
153
- const { DiracShell } = await import("./shell-PV6KIJL5.js");
153
+ const { DiracShell } = await import("./shell-GXXSZYY7.js");
154
154
  const shellConfig = loadShellConfig(args);
155
155
  const shell = new DiracShell(shellConfig);
156
156
  await shell.start();
@@ -199,11 +199,11 @@ async function main() {
199
199
  if (args[0] === "agent") {
200
200
  const subcommand = args[1];
201
201
  if (subcommand === "daemon") {
202
- const { runAgentDaemon } = await import("./agent-3SJF56JW.js");
202
+ const { runAgentDaemon } = await import("./agent-CWCOOLLO.js");
203
203
  await runAgentDaemon();
204
204
  return;
205
205
  }
206
- const { AgentCLI } = await import("./agent-3SJF56JW.js");
206
+ const { AgentCLI } = await import("./agent-CWCOOLLO.js");
207
207
  const agent = new AgentCLI();
208
208
  switch (subcommand) {
209
209
  case "start":
@@ -230,8 +230,8 @@ async function main() {
230
230
  return;
231
231
  }
232
232
  if (args[0] === "shell") {
233
- const { DiracShell } = await import("./shell-PV6KIJL5.js");
234
- const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-LMDDND5E.js");
233
+ const { DiracShell } = await import("./shell-GXXSZYY7.js");
234
+ const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-QXL2SQWJ.js");
235
235
  const { SessionClient } = await import("./session-client-3VTC5MLO.js");
236
236
  const daemonMode = args.includes("--daemon") || args.includes("-d");
237
237
  const agentMode = args.includes("--agent") || args.includes("-a");
@@ -277,7 +277,7 @@ async function main() {
277
277
  return;
278
278
  }
279
279
  if (args[0] === "daemon") {
280
- const { SessionServer } = await import("./session-server-LMDDND5E.js");
280
+ const { SessionServer } = await import("./session-server-QXL2SQWJ.js");
281
281
  const server = new SessionServer();
282
282
  await server.start();
283
283
  console.log("Session daemon started");
@@ -3,7 +3,7 @@ import {
3
3
  listCronJobs,
4
4
  stopAllCronJobs,
5
5
  stopCronJob
6
- } from "./chunk-3VCKPUTQ.js";
6
+ } from "./chunk-OUCAV57A.js";
7
7
  import "./chunk-53QJQ2CC.js";
8
8
  import "./chunk-HRHAMPOB.js";
9
9
  import "./chunk-EAM7IZWA.js";
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  createLLMAdapter,
3
3
  execute,
4
4
  executeUserCommand
5
- } from "./chunk-EE3YBMAD.js";
5
+ } from "./chunk-7MSWEFH5.js";
6
6
  import {
7
7
  integrate
8
- } from "./chunk-3VCKPUTQ.js";
8
+ } from "./chunk-OUCAV57A.js";
9
9
  import "./chunk-53QJQ2CC.js";
10
10
  import {
11
11
  DiracParser
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  integrate,
3
3
  integrateChildren
4
- } from "./chunk-3VCKPUTQ.js";
4
+ } from "./chunk-OUCAV57A.js";
5
5
  import "./chunk-53QJQ2CC.js";
6
6
  import "./chunk-HRHAMPOB.js";
7
7
  import "./chunk-EAM7IZWA.js";
@@ -3,7 +3,7 @@ import {
3
3
  cancelScheduledRun,
4
4
  executeRunAt,
5
5
  listScheduledRuns
6
- } from "./chunk-3VCKPUTQ.js";
6
+ } from "./chunk-OUCAV57A.js";
7
7
  import "./chunk-53QJQ2CC.js";
8
8
  import "./chunk-HRHAMPOB.js";
9
9
  import "./chunk-EAM7IZWA.js";
@@ -3,7 +3,7 @@ import {
3
3
  listScheduledTasks,
4
4
  stopAllScheduledTasks,
5
5
  stopScheduledTask
6
- } from "./chunk-3VCKPUTQ.js";
6
+ } from "./chunk-OUCAV57A.js";
7
7
  import "./chunk-53QJQ2CC.js";
8
8
  import "./chunk-HRHAMPOB.js";
9
9
  import "./chunk-EAM7IZWA.js";
@@ -2,8 +2,8 @@ import {
2
2
  SessionServer,
3
3
  getSocketPath,
4
4
  isSessionRunning
5
- } from "./chunk-R6R6OHPA.js";
6
- import "./chunk-3VCKPUTQ.js";
5
+ } from "./chunk-TIQ36H2U.js";
6
+ import "./chunk-OUCAV57A.js";
7
7
  import "./chunk-53QJQ2CC.js";
8
8
  import "./chunk-HRHAMPOB.js";
9
9
  import "./chunk-EAM7IZWA.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  BraKetParser,
4
4
  integrate
5
- } from "./chunk-3VCKPUTQ.js";
5
+ } from "./chunk-OUCAV57A.js";
6
6
  import "./chunk-53QJQ2CC.js";
7
7
  import {
8
8
  DiracParser
@@ -358,7 +358,7 @@ var DiracShell = class {
358
358
  if (this.client) {
359
359
  this.client.disconnect();
360
360
  }
361
- import("./schedule-OYEKDXZV.js").then(({ stopAllScheduledTasks }) => {
361
+ import("./schedule-6RWIIII3.js").then(({ stopAllScheduledTasks }) => {
362
362
  stopAllScheduledTasks();
363
363
  console.log("\nGoodbye!");
364
364
  process.exit(0);
@@ -818,7 +818,7 @@ Examples:
818
818
  break;
819
819
  case "tasks":
820
820
  try {
821
- const { listScheduledTasks } = await import("./schedule-OYEKDXZV.js");
821
+ const { listScheduledTasks } = await import("./schedule-6RWIIII3.js");
822
822
  const tasks = listScheduledTasks();
823
823
  if (tasks.length === 0) {
824
824
  console.log("No scheduled tasks running.");
@@ -837,7 +837,7 @@ Examples:
837
837
  console.log("Usage: :stop <task-name>");
838
838
  } else {
839
839
  try {
840
- const { stopScheduledTask } = await import("./schedule-OYEKDXZV.js");
840
+ const { stopScheduledTask } = await import("./schedule-6RWIIII3.js");
841
841
  const taskName = args[0];
842
842
  const stopped = stopScheduledTask(taskName);
843
843
  if (stopped) {
@@ -852,7 +852,7 @@ Examples:
852
852
  break;
853
853
  case "stopall":
854
854
  try {
855
- const { stopAllScheduledTasks } = await import("./schedule-OYEKDXZV.js");
855
+ const { stopAllScheduledTasks } = await import("./schedule-6RWIIII3.js");
856
856
  stopAllScheduledTasks();
857
857
  console.log("All scheduled tasks stopped.");
858
858
  } catch (error) {
@@ -861,7 +861,7 @@ Examples:
861
861
  break;
862
862
  case "crons":
863
863
  try {
864
- const { listCronJobs } = await import("./cron-TTPFON3Y.js");
864
+ const { listCronJobs } = await import("./cron-3W32GKBD.js");
865
865
  const jobs = listCronJobs();
866
866
  if (jobs.length === 0) {
867
867
  console.log("No cron jobs running.");
@@ -881,7 +881,7 @@ Examples:
881
881
  console.log("Usage: :stopcron <job-name>");
882
882
  } else {
883
883
  try {
884
- const { stopCronJob } = await import("./cron-TTPFON3Y.js");
884
+ const { stopCronJob } = await import("./cron-3W32GKBD.js");
885
885
  const jobName = args[0];
886
886
  const stopped = stopCronJob(jobName);
887
887
  if (stopped) {
@@ -896,7 +896,7 @@ Examples:
896
896
  break;
897
897
  case "stopallcrons":
898
898
  try {
899
- const { stopAllCronJobs } = await import("./cron-TTPFON3Y.js");
899
+ const { stopAllCronJobs } = await import("./cron-3W32GKBD.js");
900
900
  stopAllCronJobs();
901
901
  console.log("All cron jobs stopped.");
902
902
  } catch (error) {
@@ -905,7 +905,7 @@ Examples:
905
905
  break;
906
906
  case "scheduled":
907
907
  try {
908
- const { listScheduledRuns } = await import("./run-at-A3CJX4TR.js");
908
+ const { listScheduledRuns } = await import("./run-at-S37OQ7RA.js");
909
909
  const runs = listScheduledRuns();
910
910
  if (runs.length === 0) {
911
911
  console.log("No scheduled runs pending.");
@@ -925,7 +925,7 @@ Examples:
925
925
  console.log("Usage: :cancel <run-name>");
926
926
  } else {
927
927
  try {
928
- const { cancelScheduledRun } = await import("./run-at-A3CJX4TR.js");
928
+ const { cancelScheduledRun } = await import("./run-at-S37OQ7RA.js");
929
929
  const runName = args[0];
930
930
  const cancelled = cancelScheduledRun(runName);
931
931
  if (cancelled) {
@@ -940,7 +940,7 @@ Examples:
940
940
  break;
941
941
  case "cancelall":
942
942
  try {
943
- const { cancelAllScheduledRuns } = await import("./run-at-A3CJX4TR.js");
943
+ const { cancelAllScheduledRuns } = await import("./run-at-S37OQ7RA.js");
944
944
  cancelAllScheduledRuns();
945
945
  console.log("All scheduled runs cancelled.");
946
946
  } catch (error) {
@@ -108,7 +108,9 @@ async function validateNestedTags(session, element, options = {}) {
108
108
  }
109
109
  async function validateTag(session, element, options = {}) {
110
110
  const { autocorrect = false, similarityCutoff = SIMILARITY_CUTOFF, deepValidation = false } = options;
111
- console.error(`[VALIDATE] Tag: <${element.tag}>, autocorrect: ${autocorrect}, attributes:`, Object.keys(element.attributes));
111
+ if (session.debug) {
112
+ console.error(`[VALIDATE] Tag: <${element.tag}>, autocorrect: ${autocorrect}, attributes:`, Object.keys(element.attributes));
113
+ }
112
114
  const { getAvailableSubroutines } = await import("./session-6WX5O74B.js");
113
115
  const subroutines = getAvailableSubroutines(session);
114
116
  const allowed = new Set(subroutines.map((s) => s.name));
@@ -126,11 +128,15 @@ async function validateTag(session, element, options = {}) {
126
128
  scopeValidation: void 0
127
129
  };
128
130
  if (allowed.has(tagName)) {
129
- console.error(`[VALIDATE] Tag <${tagName}> is valid`);
131
+ if (session.debug) {
132
+ console.error(`[VALIDATE] Tag <${tagName}> is valid`);
133
+ }
130
134
  const sub = subroutines.find((s) => s.name === tagName);
131
135
  if (sub && Array.isArray(sub.parameters)) {
132
136
  const paramNames = sub.parameters.map((p) => p.name);
133
- console.error(`[VALIDATE] Tag <${tagName}> has ${paramNames.length} parameters:`, paramNames);
137
+ if (session.debug) {
138
+ console.error(`[VALIDATE] Tag <${tagName}> has ${paramNames.length} parameters:`, paramNames);
139
+ }
134
140
  for (const param of sub.parameters) {
135
141
  if (param.required && !(param.name in element.attributes)) {
136
142
  result.errors.push(`Missing required parameter: ${param.name}`);
@@ -138,11 +144,15 @@ async function validateTag(session, element, options = {}) {
138
144
  }
139
145
  for (const attr in element.attributes) {
140
146
  if (tagName === "subroutine" && (attr.startsWith("param-") || attr.startsWith("meta-"))) {
141
- console.error(`[VALIDATE] Skipping validation for wildcard attribute '${attr}' on <subroutine>`);
147
+ if (session.debug) {
148
+ console.error(`[VALIDATE] Skipping validation for wildcard attribute '${attr}' on <subroutine>`);
149
+ }
142
150
  continue;
143
151
  }
144
152
  if (!paramNames.includes(attr)) {
145
- console.error(`[VALIDATE] Unknown attribute '${attr}' on <${tagName}>`);
153
+ if (session.debug) {
154
+ console.error(`[VALIDATE] Unknown attribute '${attr}' on <${tagName}>`);
155
+ }
146
156
  if (autocorrect && paramNames.length > 0) {
147
157
  let correctedAttr = null;
148
158
  let similarityScore = 0;
@@ -152,21 +162,31 @@ async function validateTag(session, element, options = {}) {
152
162
  result.attributeCorrections[attr] = correctedAttr;
153
163
  result.corrected = true;
154
164
  result.warnings.push(`Auto-corrected attribute: ${attr}="${element.attributes[attr]}" \u2192 ${correctedAttr}="${element.attributes[attr]}" (only parameter available)`);
155
- console.error(`[VALIDATE] Auto-corrected (single param): ${attr} \u2192 ${correctedAttr}`);
165
+ if (session.debug) {
166
+ console.error(`[VALIDATE] Auto-corrected (single param): ${attr} \u2192 ${correctedAttr}`);
167
+ }
156
168
  } else {
157
- console.error(`[VALIDATE] Checking similarity for '${attr}' against:`, paramNames);
169
+ if (session.debug) {
170
+ console.error(`[VALIDATE] Checking similarity for '${attr}' against:`, paramNames);
171
+ }
158
172
  const best = await getBestTagMatch(attr, paramNames);
159
- console.error(`[VALIDATE] Best match: ${best.tag} with score ${best.score.toFixed(2)}, cutoff: ${similarityCutoff}`);
173
+ if (session.debug) {
174
+ console.error(`[VALIDATE] Best match: ${best.tag} with score ${best.score.toFixed(2)}, cutoff: ${similarityCutoff}`);
175
+ }
160
176
  if (best.score >= similarityCutoff) {
161
177
  correctedAttr = best.tag;
162
178
  similarityScore = best.score;
163
179
  result.attributeCorrections[attr] = correctedAttr;
164
180
  result.corrected = true;
165
181
  result.warnings.push(`Auto-corrected attribute: ${attr}="${element.attributes[attr]}" \u2192 ${correctedAttr}="${element.attributes[attr]}" (similarity: ${similarityScore.toFixed(2)})`);
166
- console.error(`[VALIDATE] Auto-corrected (similarity): ${attr} \u2192 ${correctedAttr}`);
182
+ if (session.debug) {
183
+ console.error(`[VALIDATE] Auto-corrected (similarity): ${attr} \u2192 ${correctedAttr}`);
184
+ }
167
185
  } else {
168
186
  result.warnings.push(`Unknown attribute: ${attr} (no similar match found, best: ${best.tag} with score ${best.score.toFixed(2)})`);
169
- console.error(`[VALIDATE] No correction (score too low): ${attr}, best was ${best.tag} (${best.score.toFixed(2)})`);
187
+ if (session.debug) {
188
+ console.error(`[VALIDATE] No correction (score too low): ${attr}, best was ${best.tag} (${best.score.toFixed(2)})`);
189
+ }
170
190
  }
171
191
  }
172
192
  } else {
@@ -193,7 +213,9 @@ async function validateTag(session, element, options = {}) {
193
213
  }
194
214
  }
195
215
  if (deepValidation && tagName === "subroutine" && element.children && element.children.length > 0) {
196
- console.error(`[VALIDATE] Deep validation of <subroutine name="${element.attributes.name}">`);
216
+ if (session.debug) {
217
+ console.error(`[VALIDATE] Deep validation of <subroutine name="${element.attributes.name}">`);
218
+ }
197
219
  result.nestedValidation = await validateNestedTags(session, element, options);
198
220
  for (const nestedResult of result.nestedValidation) {
199
221
  if (!nestedResult.valid) {
@@ -202,14 +224,16 @@ async function validateTag(session, element, options = {}) {
202
224
  }
203
225
  const { validateSubroutineScope } = await import("./scope-validator-TVQIOEAI.js");
204
226
  result.scopeValidation = validateSubroutineScope(element);
205
- console.error(`[VALIDATE] Scope validation for <subroutine name="${element.attributes.name}">:`, {
206
- errors: result.scopeValidation.errors.length,
207
- warnings: result.scopeValidation.warnings.length,
208
- undefinedParams: result.scopeValidation.undefinedParameters,
209
- undefinedVars: result.scopeValidation.undefinedVariables,
210
- unusedParams: result.scopeValidation.unusedParameters,
211
- unusedVars: result.scopeValidation.unusedVariables
212
- });
227
+ if (session.debug) {
228
+ console.error(`[VALIDATE] Scope validation for <subroutine name="${element.attributes.name}">:`, {
229
+ errors: result.scopeValidation.errors.length,
230
+ warnings: result.scopeValidation.warnings.length,
231
+ undefinedParams: result.scopeValidation.undefinedParameters,
232
+ undefinedVars: result.scopeValidation.undefinedVariables,
233
+ unusedParams: result.scopeValidation.unusedParameters,
234
+ unusedVars: result.scopeValidation.unusedVariables
235
+ });
236
+ }
213
237
  if (result.scopeValidation.warnings.length > 0) {
214
238
  result.warnings.push(...result.scopeValidation.warnings.map((w) => `Scope: ${w}`));
215
239
  }
@@ -282,7 +306,7 @@ async function validateDiracCode(session, ast, options = {}) {
282
306
  }
283
307
  }
284
308
  extractLocalSubroutines(ast);
285
- if (localSubroutineNames.size > 0) {
309
+ if (localSubroutineNames.size > 0 && session.debug) {
286
310
  console.error(`[VALIDATE] Found ${localSubroutineNames.size} local subroutine definitions:`, Array.from(localSubroutineNames));
287
311
  }
288
312
  const tempSubroutines = [];
@@ -303,7 +327,9 @@ async function validateDiracCode(session, ast, options = {}) {
303
327
  });
304
328
  }
305
329
  }
306
- console.error(`[VALIDATE] Temp subroutine '${subName}' has ${parameters.length} parameters:`, parameters.map((p) => p.name));
330
+ if (session.debug) {
331
+ console.error(`[VALIDATE] Temp subroutine '${subName}' has ${parameters.length} parameters:`, parameters.map((p) => p.name));
332
+ }
307
333
  const tempSub = {
308
334
  name: subName,
309
335
  element: subElement,
@@ -342,30 +368,36 @@ async function validateDiracCode(session, ast, options = {}) {
342
368
  typeErrors
343
369
  };
344
370
  }
345
- function applyCorrectedTags(ast, results) {
371
+ function applyCorrectedTags(session, ast, results) {
346
372
  let resultIndex = 0;
347
373
  function correctElement(element) {
348
374
  const shouldProcess = element.tag && element.tag !== "dirac" && element.tag !== "DIRAC-ROOT" && element.tag.trim() !== "";
349
375
  if (shouldProcess && resultIndex < results.length) {
350
376
  const result = results[resultIndex++];
351
- console.error(`[APPLY-CORRECTION] Processing <${element.tag}> with result #${resultIndex - 1} for <${result.originalTag}>, corrected: ${result.corrected}`);
377
+ if (session.debug) {
378
+ console.error(`[APPLY-CORRECTION] Processing <${element.tag}> with result #${resultIndex - 1} for <${result.originalTag}>, corrected: ${result.corrected}`);
379
+ }
352
380
  if (result.corrected && result.tagName !== element.tag) {
353
- console.error(`[APPLY-CORRECTION] Tag: ${element.tag} \u2192 ${result.tagName}`);
381
+ if (session.debug) {
382
+ console.error(`[APPLY-CORRECTION] Tag: ${element.tag} \u2192 ${result.tagName}`);
383
+ }
354
384
  element = { ...element, tag: result.tagName };
355
385
  }
356
386
  if (result.attributeCorrections && Object.keys(result.attributeCorrections).length > 0) {
357
- console.error(`[APPLY-CORRECTION] Attributes on <${element.tag}>:`, result.attributeCorrections);
387
+ if (session.debug) {
388
+ console.error(`[APPLY-CORRECTION] Attributes on <${element.tag}>:`, result.attributeCorrections);
389
+ }
358
390
  const newAttributes = {};
359
391
  for (const [oldAttr, value] of Object.entries(element.attributes)) {
360
392
  const newAttr = result.attributeCorrections[oldAttr] || oldAttr;
361
- if (newAttr !== oldAttr) {
393
+ if (newAttr !== oldAttr && session.debug) {
362
394
  console.error(`[APPLY-CORRECTION] ${oldAttr}="${value}" \u2192 ${newAttr}="${value}"`);
363
395
  }
364
396
  newAttributes[newAttr] = value;
365
397
  }
366
398
  element = { ...element, attributes: newAttributes };
367
399
  }
368
- } else if (shouldProcess) {
400
+ } else if (shouldProcess && session.debug) {
369
401
  console.error(`[APPLY-CORRECTION] WARNING: No result for <${element.tag}> at index ${resultIndex} (total results: ${results.length})`);
370
402
  }
371
403
  return {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-3VCKPUTQ.js";
3
+ } from "./chunk-OUCAV57A.js";
4
4
  import "./chunk-53QJQ2CC.js";
5
5
  import {
6
6
  DiracParser
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirac-lang",
3
- "version": "0.1.99",
3
+ "version": "0.1.100",
4
4
  "description": "LLM-Augmented Declarative Execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",