dirac-lang 0.1.43 → 0.1.44

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-BN7IKYVP.js";
3
+ } from "./chunk-4ROK7OUQ.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
@@ -175,20 +175,32 @@ function executeVariable(session, element) {
175
175
  }
176
176
 
177
177
  // src/tags/assign.ts
178
- function executeAssign(session, element) {
178
+ async function executeAssign(session, element) {
179
179
  const name = element.attributes.name;
180
180
  const valueAttr = element.attributes.value;
181
+ const trimAttr = element.attributes.trim;
181
182
  if (!name) {
182
183
  throw new Error("<assign> requires name attribute");
183
184
  }
184
185
  let value;
185
186
  if (valueAttr !== void 0) {
186
187
  value = substituteVariables(session, valueAttr);
188
+ } else if (element.children && element.children.length > 0) {
189
+ const prevOutput = session.output;
190
+ session.output = [];
191
+ for (const child of element.children) {
192
+ await integrate(session, child);
193
+ }
194
+ value = session.output.join("");
195
+ session.output = prevOutput;
187
196
  } else if (element.text) {
188
197
  value = substituteVariables(session, element.text);
189
198
  } else {
190
199
  value = "";
191
200
  }
201
+ if (trimAttr === "true" && typeof value === "string") {
202
+ value = value.trim();
203
+ }
192
204
  for (let i = session.variables.length - 1; i >= 0; i--) {
193
205
  if (session.variables[i].name === name) {
194
206
  session.variables[i].value = value;
@@ -448,12 +460,12 @@ async function executeIf(session, element) {
448
460
  const condition = await evaluatePredicate(session, conditionElement);
449
461
  if (condition) {
450
462
  if (thenElement) {
451
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-7N52YTBH.js");
463
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2BOWVF4.js");
452
464
  await integrateChildren2(session, thenElement);
453
465
  }
454
466
  } else {
455
467
  if (elseElement) {
456
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-7N52YTBH.js");
468
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2BOWVF4.js");
457
469
  await integrateChildren2(session, elseElement);
458
470
  }
459
471
  }
@@ -466,7 +478,7 @@ async function evaluatePredicate(session, predicateElement) {
466
478
  return await evaluateCondition(session, predicateElement);
467
479
  }
468
480
  const outputLengthBefore = session.output.length;
469
- const { integrate: integrate2 } = await import("./interpreter-7N52YTBH.js");
481
+ const { integrate: integrate2 } = await import("./interpreter-Y2BOWVF4.js");
470
482
  await integrate2(session, predicateElement);
471
483
  const newOutputChunks = session.output.slice(outputLengthBefore);
472
484
  const result = newOutputChunks.join("").trim();
@@ -489,11 +501,11 @@ async function evaluateCondition(session, condElement) {
489
501
  }
490
502
  const outputLengthBefore = session.output.length;
491
503
  const args = [];
492
- const { integrate: integrate2 } = await import("./interpreter-7N52YTBH.js");
504
+ const { integrate: integrate2 } = await import("./interpreter-Y2BOWVF4.js");
493
505
  for (const child of condElement.children) {
494
506
  if (child.tag.toLowerCase() === "arg") {
495
507
  const argOutputStart = session.output.length;
496
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-7N52YTBH.js");
508
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2BOWVF4.js");
497
509
  await integrateChildren2(session, child);
498
510
  const newChunks = session.output.slice(argOutputStart);
499
511
  const argValue = newChunks.join("");
@@ -1382,7 +1394,7 @@ async function executeTagCheck(session, element) {
1382
1394
  const executeTag = correctedTag || tagName;
1383
1395
  console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
1384
1396
  const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
1385
- const { integrate: integrate2 } = await import("./interpreter-7N52YTBH.js");
1397
+ const { integrate: integrate2 } = await import("./interpreter-Y2BOWVF4.js");
1386
1398
  await integrate2(session, elementToExecute);
1387
1399
  }
1388
1400
  }
@@ -1391,7 +1403,7 @@ async function executeTagCheck(session, element) {
1391
1403
  // src/tags/throw.ts
1392
1404
  async function executeThrow(session, element) {
1393
1405
  const exceptionName = element.attributes?.name || "exception";
1394
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-7N52YTBH.js");
1406
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2BOWVF4.js");
1395
1407
  const exceptionDom = {
1396
1408
  tag: "exception-content",
1397
1409
  attributes: { name: exceptionName },
@@ -1404,7 +1416,7 @@ async function executeThrow(session, element) {
1404
1416
  // src/tags/try.ts
1405
1417
  async function executeTry(session, element) {
1406
1418
  setExceptionBoundary(session);
1407
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-7N52YTBH.js");
1419
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2BOWVF4.js");
1408
1420
  await integrateChildren2(session, element);
1409
1421
  unsetExceptionBoundary(session);
1410
1422
  }
@@ -1414,7 +1426,7 @@ async function executeCatch(session, element) {
1414
1426
  const exceptionName = element.attributes?.name || "exception";
1415
1427
  const caughtCount = lookupException(session, exceptionName);
1416
1428
  if (caughtCount > 0) {
1417
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-7N52YTBH.js");
1429
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2BOWVF4.js");
1418
1430
  await integrateChildren2(session, element);
1419
1431
  }
1420
1432
  flushCurrentException(session);
@@ -1423,7 +1435,7 @@ async function executeCatch(session, element) {
1423
1435
  // src/tags/exception.ts
1424
1436
  async function executeException(session, element) {
1425
1437
  const exceptions = getCurrentExceptions(session);
1426
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-7N52YTBH.js");
1438
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2BOWVF4.js");
1427
1439
  for (const exceptionDom of exceptions) {
1428
1440
  await integrateChildren2(session, exceptionDom);
1429
1441
  }
@@ -1886,7 +1898,7 @@ async function executeLoadContext(session, element) {
1886
1898
  query = element.text.trim();
1887
1899
  }
1888
1900
  if (!query && element.children.length > 0) {
1889
- const { integrate: integrate2 } = await import("./interpreter-7N52YTBH.js");
1901
+ const { integrate: integrate2 } = await import("./interpreter-Y2BOWVF4.js");
1890
1902
  const beforeOutput = session.output.length;
1891
1903
  for (const child of element.children) {
1892
1904
  await integrate2(session, child);
@@ -2125,7 +2137,7 @@ async function executeForeach(session, element) {
2125
2137
  const parser2 = new DiracParser2();
2126
2138
  try {
2127
2139
  const fromElement = parser2.parse(fromAttr);
2128
- const { integrate: integrate2 } = await import("./interpreter-7N52YTBH.js");
2140
+ const { integrate: integrate2 } = await import("./interpreter-Y2BOWVF4.js");
2129
2141
  await integrate2(session, fromElement);
2130
2142
  } catch (e) {
2131
2143
  session.output = savedOutput;
package/dist/cli.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  } from "./chunk-UEFKQRYN.js";
5
5
  import {
6
6
  execute
7
- } from "./chunk-G5UIFJ5I.js";
8
- import "./chunk-BN7IKYVP.js";
7
+ } from "./chunk-2SNN7MBU.js";
8
+ import "./chunk-4ROK7OUQ.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
10
  import "./chunk-4QLTSCDG.js";
11
11
  import "./chunk-GLXVY235.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.42",
19
+ version: "0.1.44",
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-HPRM7WFE.js");
99
+ const { DiracShell } = await import("./shell-3ZZUMKP3.js");
100
100
  const shellConfig = { debug: false };
101
101
  for (let i = 1; i < args.length; i++) {
102
102
  const arg = args[i];
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  createLLMAdapter,
3
3
  execute,
4
4
  executeUserCommand
5
- } from "./chunk-G5UIFJ5I.js";
5
+ } from "./chunk-2SNN7MBU.js";
6
6
  import {
7
7
  integrate
8
- } from "./chunk-BN7IKYVP.js";
8
+ } from "./chunk-4ROK7OUQ.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-BN7IKYVP.js";
4
+ } from "./chunk-4ROK7OUQ.js";
5
5
  import "./chunk-HRHAMPOB.js";
6
6
  import "./chunk-4QLTSCDG.js";
7
7
  import "./chunk-GLXVY235.js";
@@ -3,7 +3,7 @@ import {
3
3
  listScheduledTasks,
4
4
  stopAllScheduledTasks,
5
5
  stopScheduledTask
6
- } from "./chunk-BN7IKYVP.js";
6
+ } from "./chunk-4ROK7OUQ.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-4QLTSCDG.js";
9
9
  import "./chunk-GLXVY235.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-UEFKQRYN.js";
5
5
  import {
6
6
  integrate
7
- } from "./chunk-BN7IKYVP.js";
7
+ } from "./chunk-4ROK7OUQ.js";
8
8
  import {
9
9
  DiracParser
10
10
  } from "./chunk-HRHAMPOB.js";
@@ -66,7 +66,7 @@ var DiracShell = class {
66
66
  });
67
67
  this.rl.on("close", () => {
68
68
  this.saveHistory();
69
- import("./schedule-CROFBEVH.js").then(({ stopAllScheduledTasks }) => {
69
+ import("./schedule-DZ2SPHSX.js").then(({ stopAllScheduledTasks }) => {
70
70
  stopAllScheduledTasks();
71
71
  console.log("\nGoodbye!");
72
72
  process.exit(0);
@@ -366,7 +366,7 @@ Examples:
366
366
  break;
367
367
  case "tasks":
368
368
  try {
369
- const { listScheduledTasks } = await import("./schedule-CROFBEVH.js");
369
+ const { listScheduledTasks } = await import("./schedule-DZ2SPHSX.js");
370
370
  const tasks = listScheduledTasks();
371
371
  if (tasks.length === 0) {
372
372
  console.log("No scheduled tasks running.");
@@ -385,7 +385,7 @@ Examples:
385
385
  console.log("Usage: :stop <task-name>");
386
386
  } else {
387
387
  try {
388
- const { stopScheduledTask } = await import("./schedule-CROFBEVH.js");
388
+ const { stopScheduledTask } = await import("./schedule-DZ2SPHSX.js");
389
389
  const taskName = args[0];
390
390
  const stopped = stopScheduledTask(taskName);
391
391
  if (stopped) {
@@ -400,7 +400,7 @@ Examples:
400
400
  break;
401
401
  case "stopall":
402
402
  try {
403
- const { stopAllScheduledTasks } = await import("./schedule-CROFBEVH.js");
403
+ const { stopAllScheduledTasks } = await import("./schedule-DZ2SPHSX.js");
404
404
  stopAllScheduledTasks();
405
405
  console.log("All scheduled tasks stopped.");
406
406
  } catch (error) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-BN7IKYVP.js";
3
+ } from "./chunk-4ROK7OUQ.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.43",
3
+ "version": "0.1.44",
4
4
  "description": "LLM-Augmented Declarative Execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",