dirac-lang 0.1.40 → 0.1.42

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.
@@ -405,7 +405,7 @@ async function executeLoop(session, element) {
405
405
  const countAttr = element.attributes.count;
406
406
  const varName = element.attributes.var || "i";
407
407
  if (!countAttr) {
408
- throw new Error("<loop> requires count attribute");
408
+ throw new Error("<loop> requires count attribute. For conditional loops, use <test-if> with <break>.");
409
409
  }
410
410
  const substitutedCount = substituteAttribute(session, countAttr);
411
411
  const count = parseInt(substitutedCount, 10);
@@ -448,12 +448,12 @@ async function executeIf(session, element) {
448
448
  const condition = await evaluatePredicate(session, conditionElement);
449
449
  if (condition) {
450
450
  if (thenElement) {
451
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UCWBT6KP.js");
451
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-U74XE6FV.js");
452
452
  await integrateChildren2(session, thenElement);
453
453
  }
454
454
  } else {
455
455
  if (elseElement) {
456
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UCWBT6KP.js");
456
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-U74XE6FV.js");
457
457
  await integrateChildren2(session, elseElement);
458
458
  }
459
459
  }
@@ -466,7 +466,7 @@ async function evaluatePredicate(session, predicateElement) {
466
466
  return await evaluateCondition(session, predicateElement);
467
467
  }
468
468
  const outputLengthBefore = session.output.length;
469
- const { integrate: integrate2 } = await import("./interpreter-UCWBT6KP.js");
469
+ const { integrate: integrate2 } = await import("./interpreter-U74XE6FV.js");
470
470
  await integrate2(session, predicateElement);
471
471
  const newOutputChunks = session.output.slice(outputLengthBefore);
472
472
  const result = newOutputChunks.join("").trim();
@@ -489,11 +489,11 @@ async function evaluateCondition(session, condElement) {
489
489
  }
490
490
  const outputLengthBefore = session.output.length;
491
491
  const args = [];
492
- const { integrate: integrate2 } = await import("./interpreter-UCWBT6KP.js");
492
+ const { integrate: integrate2 } = await import("./interpreter-U74XE6FV.js");
493
493
  for (const child of condElement.children) {
494
494
  if (child.tag.toLowerCase() === "arg") {
495
495
  const argOutputStart = session.output.length;
496
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UCWBT6KP.js");
496
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-U74XE6FV.js");
497
497
  await integrateChildren2(session, child);
498
498
  const newChunks = session.output.slice(argOutputStart);
499
499
  const argValue = newChunks.join("");
@@ -1378,7 +1378,7 @@ async function executeTagCheck(session, element) {
1378
1378
  const executeTag = correctedTag || tagName;
1379
1379
  console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
1380
1380
  const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
1381
- const { integrate: integrate2 } = await import("./interpreter-UCWBT6KP.js");
1381
+ const { integrate: integrate2 } = await import("./interpreter-U74XE6FV.js");
1382
1382
  await integrate2(session, elementToExecute);
1383
1383
  }
1384
1384
  }
@@ -1387,7 +1387,7 @@ async function executeTagCheck(session, element) {
1387
1387
  // src/tags/throw.ts
1388
1388
  async function executeThrow(session, element) {
1389
1389
  const exceptionName = element.attributes?.name || "exception";
1390
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UCWBT6KP.js");
1390
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-U74XE6FV.js");
1391
1391
  const exceptionDom = {
1392
1392
  tag: "exception-content",
1393
1393
  attributes: { name: exceptionName },
@@ -1400,7 +1400,7 @@ async function executeThrow(session, element) {
1400
1400
  // src/tags/try.ts
1401
1401
  async function executeTry(session, element) {
1402
1402
  setExceptionBoundary(session);
1403
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UCWBT6KP.js");
1403
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-U74XE6FV.js");
1404
1404
  await integrateChildren2(session, element);
1405
1405
  unsetExceptionBoundary(session);
1406
1406
  }
@@ -1410,7 +1410,7 @@ async function executeCatch(session, element) {
1410
1410
  const exceptionName = element.attributes?.name || "exception";
1411
1411
  const caughtCount = lookupException(session, exceptionName);
1412
1412
  if (caughtCount > 0) {
1413
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UCWBT6KP.js");
1413
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-U74XE6FV.js");
1414
1414
  await integrateChildren2(session, element);
1415
1415
  }
1416
1416
  flushCurrentException(session);
@@ -1419,7 +1419,7 @@ async function executeCatch(session, element) {
1419
1419
  // src/tags/exception.ts
1420
1420
  async function executeException(session, element) {
1421
1421
  const exceptions = getCurrentExceptions(session);
1422
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UCWBT6KP.js");
1422
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-U74XE6FV.js");
1423
1423
  for (const exceptionDom of exceptions) {
1424
1424
  await integrateChildren2(session, exceptionDom);
1425
1425
  }
@@ -1882,7 +1882,7 @@ async function executeLoadContext(session, element) {
1882
1882
  query = element.text.trim();
1883
1883
  }
1884
1884
  if (!query && element.children.length > 0) {
1885
- const { integrate: integrate2 } = await import("./interpreter-UCWBT6KP.js");
1885
+ const { integrate: integrate2 } = await import("./interpreter-U74XE6FV.js");
1886
1886
  const beforeOutput = session.output.length;
1887
1887
  for (const child of element.children) {
1888
1888
  await integrate2(session, child);
@@ -1924,8 +1924,8 @@ async function executeLoadContext(session, element) {
1924
1924
  if (shouldImport) {
1925
1925
  for (const filePath of fileMap.keys()) {
1926
1926
  try {
1927
- const { resolve: resolve2 } = await import("path");
1928
- const absolutePath = filePath.startsWith("/") ? filePath : resolve2(process.cwd(), filePath);
1927
+ const { resolve: resolve3 } = await import("path");
1928
+ const absolutePath = filePath.startsWith("/") ? filePath : resolve3(process.cwd(), filePath);
1929
1929
  const importElement = {
1930
1930
  tag: "import",
1931
1931
  attributes: { src: absolutePath },
@@ -1956,6 +1956,151 @@ async function executeLoadContext(session, element) {
1956
1956
  }
1957
1957
  }
1958
1958
 
1959
+ // src/tags/save-subroutine.ts
1960
+ import { writeFileSync as writeFileSync2, mkdirSync as mkdirSync3 } from "fs";
1961
+ import { resolve as resolve2, dirname as dirname4 } from "path";
1962
+ async function executeSaveSubroutine(session, element) {
1963
+ const name = element.attributes.name;
1964
+ const file = element.attributes.file;
1965
+ const format = element.attributes.format || "xml";
1966
+ if (!name) {
1967
+ throw new Error("<save-subroutine> requires name attribute");
1968
+ }
1969
+ if (!file) {
1970
+ throw new Error("<save-subroutine> requires file attribute");
1971
+ }
1972
+ let subroutine = void 0;
1973
+ for (let i = session.subroutines.length - 1; i >= 0; i--) {
1974
+ if (session.subroutines[i].name === name) {
1975
+ subroutine = session.subroutines[i];
1976
+ break;
1977
+ }
1978
+ }
1979
+ if (!subroutine) {
1980
+ throw new Error(`Subroutine '${name}' not found in session`);
1981
+ }
1982
+ let content;
1983
+ if (format === "braket") {
1984
+ content = generateBraKetNotation(subroutine);
1985
+ } else {
1986
+ content = generateXMLNotation(subroutine);
1987
+ }
1988
+ const filePath = resolve2(process.cwd(), file);
1989
+ const dir = dirname4(filePath);
1990
+ mkdirSync3(dir, { recursive: true });
1991
+ writeFileSync2(filePath, content, "utf-8");
1992
+ emit(session, `Subroutine '${name}' saved to: ${filePath}
1993
+ `);
1994
+ }
1995
+ function generateXMLNotation(subroutine) {
1996
+ let xml = "<!-- Exported subroutine -->\n\n";
1997
+ xml += `<subroutine name="${subroutine.name}"`;
1998
+ if (subroutine.description) {
1999
+ xml += `
2000
+ description="${escapeXml3(subroutine.description)}"`;
2001
+ }
2002
+ if (subroutine.parameters && subroutine.parameters.length > 0) {
2003
+ for (const param of subroutine.parameters) {
2004
+ xml += `
2005
+ param-${param.name}="${param.type || "any"}`;
2006
+ if (param.required) {
2007
+ xml += ":required";
2008
+ }
2009
+ if (param.description) {
2010
+ xml += `:${escapeXml3(param.description)}`;
2011
+ }
2012
+ xml += '"';
2013
+ }
2014
+ }
2015
+ xml += ">\n";
2016
+ if (subroutine.element && subroutine.element.children && subroutine.element.children.length > 0) {
2017
+ xml += serializeChildren(subroutine.element.children, 2);
2018
+ } else {
2019
+ xml += " <!-- Subroutine body not available -->\n";
2020
+ }
2021
+ xml += "</subroutine>\n";
2022
+ return xml;
2023
+ }
2024
+ function generateBraKetNotation(subroutine) {
2025
+ let braket = "";
2026
+ braket += `<${subroutine.name}|`;
2027
+ if (subroutine.description) {
2028
+ braket += ` description="${escapeXml3(subroutine.description)}"`;
2029
+ }
2030
+ if (subroutine.parameters && subroutine.parameters.length > 0) {
2031
+ for (const param of subroutine.parameters) {
2032
+ braket += ` ${param.name}=${param.type || "any"}`;
2033
+ }
2034
+ }
2035
+ braket += "\n";
2036
+ if (subroutine.element && subroutine.element.children) {
2037
+ braket += serializeChildrenBraKet(subroutine.element.children, 2);
2038
+ } else if (subroutine.body) {
2039
+ braket += ` ${subroutine.body}
2040
+ `;
2041
+ } else {
2042
+ braket += " # Subroutine body not available\n";
2043
+ }
2044
+ return braket;
2045
+ }
2046
+ function serializeChildren(children, indent) {
2047
+ let xml = "";
2048
+ const indentStr = " ".repeat(indent);
2049
+ for (const child of children) {
2050
+ if (child.text && !child.tag) {
2051
+ xml += indentStr + escapeXml3(child.text) + "\n";
2052
+ } else if (child.tag) {
2053
+ xml += indentStr + `<${child.tag}`;
2054
+ if (child.attributes) {
2055
+ for (const [key, value] of Object.entries(child.attributes)) {
2056
+ xml += ` ${key}="${escapeXml3(String(value))}"`;
2057
+ }
2058
+ }
2059
+ if (child.children && child.children.length > 0) {
2060
+ xml += ">\n";
2061
+ xml += serializeChildren(child.children, indent + 2);
2062
+ xml += indentStr + `</${child.tag}>
2063
+ `;
2064
+ } else if (child.text) {
2065
+ xml += `>${escapeXml3(child.text)}</${child.tag}>
2066
+ `;
2067
+ } else {
2068
+ xml += " />\n";
2069
+ }
2070
+ }
2071
+ }
2072
+ return xml;
2073
+ }
2074
+ function serializeChildrenBraKet(children, indent) {
2075
+ let braket = "";
2076
+ const indentStr = " ".repeat(indent);
2077
+ for (const child of children) {
2078
+ if (child.text && !child.tag) {
2079
+ braket += indentStr + child.text + "\n";
2080
+ } else if (child.tag) {
2081
+ braket += indentStr + `|${child.tag}`;
2082
+ if (child.attributes) {
2083
+ for (const [key, value] of Object.entries(child.attributes)) {
2084
+ braket += ` ${key}="${escapeXml3(String(value))}"`;
2085
+ }
2086
+ }
2087
+ if (child.text) {
2088
+ braket += `>${child.text}
2089
+ `;
2090
+ } else if (child.children && child.children.length > 0) {
2091
+ braket += ">\n";
2092
+ braket += serializeChildrenBraKet(child.children, indent + 2);
2093
+ } else {
2094
+ braket += ">\n";
2095
+ }
2096
+ }
2097
+ }
2098
+ return braket;
2099
+ }
2100
+ function escapeXml3(text) {
2101
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
2102
+ }
2103
+
1959
2104
  // src/tags/foreach.ts
1960
2105
  import { XMLParser } from "fast-xml-parser";
1961
2106
  async function executeForeach(session, element) {
@@ -1976,7 +2121,7 @@ async function executeForeach(session, element) {
1976
2121
  const parser2 = new DiracParser2();
1977
2122
  try {
1978
2123
  const fromElement = parser2.parse(fromAttr);
1979
- const { integrate: integrate2 } = await import("./interpreter-UCWBT6KP.js");
2124
+ const { integrate: integrate2 } = await import("./interpreter-U74XE6FV.js");
1980
2125
  await integrate2(session, fromElement);
1981
2126
  } catch (e) {
1982
2127
  session.output = savedOutput;
@@ -2165,7 +2310,7 @@ async function readAllStdin() {
2165
2310
  process.stdin.removeAllListeners("data");
2166
2311
  process.stdin.removeAllListeners("end");
2167
2312
  process.stdin.removeAllListeners("error");
2168
- return new Promise((resolve2, reject) => {
2313
+ return new Promise((resolve3, reject) => {
2169
2314
  const chunks = [];
2170
2315
  const onData = (chunk) => {
2171
2316
  chunks.push(chunk);
@@ -2175,7 +2320,7 @@ async function readAllStdin() {
2175
2320
  process.stdin.removeListener("data", onData);
2176
2321
  process.stdin.removeListener("end", onEnd);
2177
2322
  process.stdin.removeListener("error", onError);
2178
- resolve2(result);
2323
+ resolve3(result);
2179
2324
  };
2180
2325
  const onError = (err) => {
2181
2326
  process.stdin.removeListener("data", onData);
@@ -2335,6 +2480,9 @@ async function integrate(session, element) {
2335
2480
  case "load-context":
2336
2481
  await executeLoadContext(session, element);
2337
2482
  break;
2483
+ case "save-subroutine":
2484
+ await executeSaveSubroutine(session, element);
2485
+ break;
2338
2486
  case "foreach":
2339
2487
  await executeForeach(session, element);
2340
2488
  break;
@@ -2347,6 +2495,9 @@ async function integrate(session, element) {
2347
2495
  case "input":
2348
2496
  await executeInput(session, element);
2349
2497
  break;
2498
+ case "schedule":
2499
+ await executeSchedule(session, element);
2500
+ break;
2350
2501
  case "require_module":
2351
2502
  await executeRequireModule(session, element);
2352
2503
  break;
@@ -2379,7 +2530,74 @@ async function integrateChildren(session, element) {
2379
2530
  }
2380
2531
  }
2381
2532
 
2533
+ // src/tags/schedule.ts
2534
+ var scheduledTasks = /* @__PURE__ */ new Map();
2535
+ async function executeSchedule(session, element) {
2536
+ const intervalAttr = element.attributes.interval;
2537
+ const name = element.attributes.name || `task-${Date.now()}`;
2538
+ if (!intervalAttr) {
2539
+ throw new Error("<schedule> requires interval attribute (in seconds)");
2540
+ }
2541
+ const substitutedInterval = substituteAttribute(session, intervalAttr);
2542
+ const intervalSeconds = parseInt(substitutedInterval, 10);
2543
+ if (isNaN(intervalSeconds) || intervalSeconds <= 0) {
2544
+ throw new Error(`Invalid schedule interval: ${intervalAttr} (evaluated to: ${substitutedInterval})`);
2545
+ }
2546
+ const intervalMs = intervalSeconds * 1e3;
2547
+ if (scheduledTasks.has(name)) {
2548
+ const existing = scheduledTasks.get(name);
2549
+ clearInterval(existing.intervalId);
2550
+ console.log(`[schedule] Stopped existing task: ${name}`);
2551
+ }
2552
+ const taskElement = element;
2553
+ console.log(`[schedule] Starting task "${name}" (every ${intervalSeconds}s)`);
2554
+ executeTask(session, taskElement, name).catch((err) => {
2555
+ console.error(`[schedule] Error in task "${name}":`, err.message);
2556
+ });
2557
+ const intervalId = setInterval(() => {
2558
+ executeTask(session, taskElement, name).catch((err) => {
2559
+ console.error(`[schedule] Error in task "${name}":`, err.message);
2560
+ });
2561
+ }, intervalMs);
2562
+ scheduledTasks.set(name, {
2563
+ name,
2564
+ intervalId,
2565
+ interval: intervalSeconds
2566
+ });
2567
+ }
2568
+ async function executeTask(session, element, name) {
2569
+ try {
2570
+ await integrateChildren(session, element);
2571
+ } catch (error) {
2572
+ console.error(`[schedule] Task "${name}" failed:`, error.message);
2573
+ }
2574
+ }
2575
+ function stopScheduledTask(name) {
2576
+ const task = scheduledTasks.get(name);
2577
+ if (!task) {
2578
+ return false;
2579
+ }
2580
+ clearInterval(task.intervalId);
2581
+ scheduledTasks.delete(name);
2582
+ console.log(`[schedule] Stopped task: ${name}`);
2583
+ return true;
2584
+ }
2585
+ function stopAllScheduledTasks() {
2586
+ for (const [name, task] of scheduledTasks) {
2587
+ clearInterval(task.intervalId);
2588
+ console.log(`[schedule] Stopped task: ${name}`);
2589
+ }
2590
+ scheduledTasks.clear();
2591
+ }
2592
+ function listScheduledTasks() {
2593
+ return Array.from(scheduledTasks.values());
2594
+ }
2595
+
2382
2596
  export {
2597
+ executeSchedule,
2598
+ stopScheduledTask,
2599
+ stopAllScheduledTasks,
2600
+ listScheduledTasks,
2383
2601
  integrate,
2384
2602
  integrateChildren
2385
2603
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-NWGHO23V.js";
3
+ } from "./chunk-2J7FVKXI.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
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-W6BEEC5D.js";
8
- import "./chunk-NWGHO23V.js";
7
+ } from "./chunk-CRT4U2QX.js";
8
+ import "./chunk-2J7FVKXI.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.39",
19
+ version: "0.1.42",
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-Z7RZRFTV.js");
99
+ const { DiracShell } = await import("./shell-VHD65GUJ.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-W6BEEC5D.js";
5
+ } from "./chunk-CRT4U2QX.js";
6
6
  import {
7
7
  integrate
8
- } from "./chunk-NWGHO23V.js";
8
+ } from "./chunk-2J7FVKXI.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-NWGHO23V.js";
4
+ } from "./chunk-2J7FVKXI.js";
5
5
  import "./chunk-HRHAMPOB.js";
6
6
  import "./chunk-4QLTSCDG.js";
7
7
  import "./chunk-GLXVY235.js";
@@ -0,0 +1,15 @@
1
+ import {
2
+ executeSchedule,
3
+ listScheduledTasks,
4
+ stopAllScheduledTasks,
5
+ stopScheduledTask
6
+ } from "./chunk-2J7FVKXI.js";
7
+ import "./chunk-HRHAMPOB.js";
8
+ import "./chunk-4QLTSCDG.js";
9
+ import "./chunk-GLXVY235.js";
10
+ export {
11
+ executeSchedule,
12
+ listScheduledTasks,
13
+ stopAllScheduledTasks,
14
+ stopScheduledTask
15
+ };
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-UEFKQRYN.js";
5
5
  import {
6
6
  integrate
7
- } from "./chunk-NWGHO23V.js";
7
+ } from "./chunk-2J7FVKXI.js";
8
8
  import {
9
9
  DiracParser
10
10
  } from "./chunk-HRHAMPOB.js";
@@ -66,8 +66,14 @@ var DiracShell = class {
66
66
  });
67
67
  this.rl.on("close", () => {
68
68
  this.saveHistory();
69
- console.log("\nGoodbye!");
70
- process.exit(0);
69
+ import("./schedule-H4R2Z65R.js").then(({ stopAllScheduledTasks }) => {
70
+ stopAllScheduledTasks();
71
+ console.log("\nGoodbye!");
72
+ process.exit(0);
73
+ }).catch(() => {
74
+ console.log("\nGoodbye!");
75
+ process.exit(0);
76
+ });
71
77
  });
72
78
  this.rl.on("SIGINT", () => {
73
79
  if (this.inputBuffer.length > 0) {
@@ -189,7 +195,11 @@ Commands:
189
195
  :index <path> Index subroutines from directory
190
196
  :search <query> Search indexed subroutines
191
197
  :load <query> Load context (search and import subroutines)
198
+ :save <name> <file> Save subroutine to file
192
199
  :stats Show registry statistics
200
+ :tasks List all scheduled tasks
201
+ :stop <name> Stop a scheduled task
202
+ :stopall Stop all scheduled tasks
193
203
  :exit Exit shell
194
204
 
195
205
  Syntax:
@@ -324,6 +334,24 @@ Examples:
324
334
  }
325
335
  }
326
336
  break;
337
+ case "save":
338
+ if (args.length < 2) {
339
+ console.log("Usage: :save <subroutine-name> <file>");
340
+ } else {
341
+ const subName = args[0];
342
+ const fileName = args[1];
343
+ try {
344
+ const xml = `<save-subroutine name="${subName}" file="${fileName}" format="xml" />`;
345
+ const ast = this.xmlParser.parse(xml);
346
+ await integrate(this.session, ast);
347
+ if (this.session.output.length > 0) {
348
+ console.log(this.session.output.join(""));
349
+ }
350
+ } catch (error) {
351
+ console.error("Error saving subroutine:", error instanceof Error ? error.message : String(error));
352
+ }
353
+ }
354
+ break;
327
355
  case "stats":
328
356
  try {
329
357
  const xml = "<registry-stats />";
@@ -336,6 +364,49 @@ Examples:
336
364
  console.error("Error getting stats:", error instanceof Error ? error.message : String(error));
337
365
  }
338
366
  break;
367
+ case "tasks":
368
+ try {
369
+ const { listScheduledTasks } = await import("./schedule-H4R2Z65R.js");
370
+ const tasks = listScheduledTasks();
371
+ if (tasks.length === 0) {
372
+ console.log("No scheduled tasks running.");
373
+ } else {
374
+ console.log("\nScheduled Tasks:");
375
+ for (const task of tasks) {
376
+ console.log(` - ${task.name}: every ${task.interval}s`);
377
+ }
378
+ }
379
+ } catch (error) {
380
+ console.error("Error listing tasks:", error instanceof Error ? error.message : String(error));
381
+ }
382
+ break;
383
+ case "stop":
384
+ if (args.length === 0) {
385
+ console.log("Usage: :stop <task-name>");
386
+ } else {
387
+ try {
388
+ const { stopScheduledTask } = await import("./schedule-H4R2Z65R.js");
389
+ const taskName = args[0];
390
+ const stopped = stopScheduledTask(taskName);
391
+ if (stopped) {
392
+ console.log(`Stopped task: ${taskName}`);
393
+ } else {
394
+ console.log(`Task not found: ${taskName}`);
395
+ }
396
+ } catch (error) {
397
+ console.error("Error stopping task:", error instanceof Error ? error.message : String(error));
398
+ }
399
+ }
400
+ break;
401
+ case "stopall":
402
+ try {
403
+ const { stopAllScheduledTasks } = await import("./schedule-H4R2Z65R.js");
404
+ stopAllScheduledTasks();
405
+ console.log("All scheduled tasks stopped.");
406
+ } catch (error) {
407
+ console.error("Error stopping tasks:", error instanceof Error ? error.message : String(error));
408
+ }
409
+ break;
339
410
  case "exit":
340
411
  case "quit":
341
412
  this.rl.close();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-NWGHO23V.js";
3
+ } from "./chunk-2J7FVKXI.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.40",
3
+ "version": "0.1.42",
4
4
  "description": "LLM-Augmented Declarative Execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",