dirac-lang 0.1.42 → 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-2J7FVKXI.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-U74XE6FV.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-U74XE6FV.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-U74XE6FV.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-U74XE6FV.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-U74XE6FV.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("");
@@ -1154,6 +1166,10 @@ async function executeExpr(session, element) {
1154
1166
  case "strcmp":
1155
1167
  result = stringArgs.length >= 2 ? stringArgs[0] === stringArgs[1] : false;
1156
1168
  break;
1169
+ case "contains":
1170
+ case "includes":
1171
+ result = stringArgs.length >= 2 ? stringArgs[0].includes(stringArgs[1]) : false;
1172
+ break;
1157
1173
  default:
1158
1174
  throw new Error(`<expr> unknown operation: ${op}`);
1159
1175
  }
@@ -1378,7 +1394,7 @@ async function executeTagCheck(session, element) {
1378
1394
  const executeTag = correctedTag || tagName;
1379
1395
  console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
1380
1396
  const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
1381
- const { integrate: integrate2 } = await import("./interpreter-U74XE6FV.js");
1397
+ const { integrate: integrate2 } = await import("./interpreter-Y2BOWVF4.js");
1382
1398
  await integrate2(session, elementToExecute);
1383
1399
  }
1384
1400
  }
@@ -1387,7 +1403,7 @@ async function executeTagCheck(session, element) {
1387
1403
  // src/tags/throw.ts
1388
1404
  async function executeThrow(session, element) {
1389
1405
  const exceptionName = element.attributes?.name || "exception";
1390
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-U74XE6FV.js");
1406
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2BOWVF4.js");
1391
1407
  const exceptionDom = {
1392
1408
  tag: "exception-content",
1393
1409
  attributes: { name: exceptionName },
@@ -1400,7 +1416,7 @@ async function executeThrow(session, element) {
1400
1416
  // src/tags/try.ts
1401
1417
  async function executeTry(session, element) {
1402
1418
  setExceptionBoundary(session);
1403
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-U74XE6FV.js");
1419
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2BOWVF4.js");
1404
1420
  await integrateChildren2(session, element);
1405
1421
  unsetExceptionBoundary(session);
1406
1422
  }
@@ -1410,7 +1426,7 @@ async function executeCatch(session, element) {
1410
1426
  const exceptionName = element.attributes?.name || "exception";
1411
1427
  const caughtCount = lookupException(session, exceptionName);
1412
1428
  if (caughtCount > 0) {
1413
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-U74XE6FV.js");
1429
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2BOWVF4.js");
1414
1430
  await integrateChildren2(session, element);
1415
1431
  }
1416
1432
  flushCurrentException(session);
@@ -1419,7 +1435,7 @@ async function executeCatch(session, element) {
1419
1435
  // src/tags/exception.ts
1420
1436
  async function executeException(session, element) {
1421
1437
  const exceptions = getCurrentExceptions(session);
1422
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-U74XE6FV.js");
1438
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-Y2BOWVF4.js");
1423
1439
  for (const exceptionDom of exceptions) {
1424
1440
  await integrateChildren2(session, exceptionDom);
1425
1441
  }
@@ -1882,7 +1898,7 @@ async function executeLoadContext(session, element) {
1882
1898
  query = element.text.trim();
1883
1899
  }
1884
1900
  if (!query && element.children.length > 0) {
1885
- const { integrate: integrate2 } = await import("./interpreter-U74XE6FV.js");
1901
+ const { integrate: integrate2 } = await import("./interpreter-Y2BOWVF4.js");
1886
1902
  const beforeOutput = session.output.length;
1887
1903
  for (const child of element.children) {
1888
1904
  await integrate2(session, child);
@@ -2121,7 +2137,7 @@ async function executeForeach(session, element) {
2121
2137
  const parser2 = new DiracParser2();
2122
2138
  try {
2123
2139
  const fromElement = parser2.parse(fromAttr);
2124
- const { integrate: integrate2 } = await import("./interpreter-U74XE6FV.js");
2140
+ const { integrate: integrate2 } = await import("./interpreter-Y2BOWVF4.js");
2125
2141
  await integrate2(session, fromElement);
2126
2142
  } catch (e) {
2127
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-CRT4U2QX.js";
8
- import "./chunk-2J7FVKXI.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-VHD65GUJ.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-CRT4U2QX.js";
5
+ } from "./chunk-2SNN7MBU.js";
6
6
  import {
7
7
  integrate
8
- } from "./chunk-2J7FVKXI.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-2J7FVKXI.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-2J7FVKXI.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-2J7FVKXI.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-H4R2Z65R.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-H4R2Z65R.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-H4R2Z65R.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-H4R2Z65R.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-2J7FVKXI.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.42",
3
+ "version": "0.1.44",
4
4
  "description": "LLM-Augmented Declarative Execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",