dirac-lang 0.1.85 → 0.1.87

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,12 +2,12 @@ import {
2
2
  SessionServer,
3
3
  getSocketPath,
4
4
  isSessionRunning
5
- } from "./chunk-XM5V6O2F.js";
6
- import "./chunk-5ZWDEJPQ.js";
7
- import "./chunk-VC23AJJJ.js";
8
- import "./chunk-FPDW535D.js";
5
+ } from "./chunk-VEFJ4NM3.js";
6
+ import "./chunk-WVFFIHZL.js";
7
+ import "./chunk-HJSHCEK4.js";
8
+ import "./chunk-BGG2SULN.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
- import "./chunk-M57VI7KL.js";
10
+ import "./chunk-2VFQ2YBT.js";
11
11
 
12
12
  // src/agent.ts
13
13
  import fs from "fs";
@@ -150,6 +150,13 @@ function createSession(config = {}) {
150
150
  };
151
151
  }
152
152
  function setVariable(session, name, value, visible = false) {
153
+ for (let i = session.variables.length - 1; i >= 0; i--) {
154
+ if (session.variables[i].name === name && session.variables[i].boundary === session.varBoundary) {
155
+ session.variables[i].value = value;
156
+ session.variables[i].visible = visible;
157
+ return;
158
+ }
159
+ }
153
160
  session.variables.push({
154
161
  name,
155
162
  value,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-5ZWDEJPQ.js";
3
+ } from "./chunk-WVFFIHZL.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
@@ -8,7 +8,7 @@ import {
8
8
  createSession,
9
9
  getAvailableSubroutines,
10
10
  getOutput
11
- } from "./chunk-M57VI7KL.js";
11
+ } from "./chunk-2VFQ2YBT.js";
12
12
 
13
13
  // src/utils/llm-adapter.ts
14
14
  function createLLMAdapter(session) {
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  emit,
6
6
  setVariable
7
- } from "./chunk-M57VI7KL.js";
7
+ } from "./chunk-2VFQ2YBT.js";
8
8
 
9
9
  // src/runtime/subroutine-registry.ts
10
10
  import * as fs from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  registerSubroutine
3
- } from "./chunk-M57VI7KL.js";
3
+ } from "./chunk-2VFQ2YBT.js";
4
4
 
5
5
  // src/tags/subroutine.ts
6
6
  function executeSubroutine(session, element) {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-5ZWDEJPQ.js";
3
+ } from "./chunk-WVFFIHZL.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
7
7
  import {
8
8
  createSession
9
- } from "./chunk-M57VI7KL.js";
9
+ } from "./chunk-2VFQ2YBT.js";
10
10
 
11
11
  // src/session-server.ts
12
12
  import net from "net";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  executeSubroutine
3
- } from "./chunk-VC23AJJJ.js";
3
+ } from "./chunk-HJSHCEK4.js";
4
4
  import {
5
5
  executeIndexSubroutines,
6
6
  executeRegistryStats,
7
7
  executeSearchSubroutines,
8
8
  registry
9
- } from "./chunk-FPDW535D.js";
9
+ } from "./chunk-BGG2SULN.js";
10
10
  import {
11
11
  DiracParser
12
12
  } from "./chunk-HRHAMPOB.js";
@@ -34,7 +34,7 @@ import {
34
34
  substituteVariables,
35
35
  throwException,
36
36
  unsetExceptionBoundary
37
- } from "./chunk-M57VI7KL.js";
37
+ } from "./chunk-2VFQ2YBT.js";
38
38
 
39
39
  // src/tags/parameters.ts
40
40
  async function executeParameters(session, element) {
@@ -297,7 +297,7 @@ async function executeCall(session, element) {
297
297
  }
298
298
  }
299
299
  async function registerExtendChain(session, subroutine, currentName) {
300
- const { executeSubroutine: executeSubroutine2 } = await import("./subroutine-OQJ3AY27.js");
300
+ const { executeSubroutine: executeSubroutine2 } = await import("./subroutine-5SNHBXRN.js");
301
301
  const extendsAttr = subroutine.attributes.extends;
302
302
  let parentName;
303
303
  if (extendsAttr) {
@@ -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-UEVX5OAP.js");
490
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-LTE43E4A.js");
491
491
  await integrateChildren2(session, thenElement);
492
492
  }
493
493
  } else {
494
494
  if (elseElement) {
495
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UEVX5OAP.js");
495
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-LTE43E4A.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-UEVX5OAP.js");
508
+ const { integrate: integrate2 } = await import("./interpreter-LTE43E4A.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-UEVX5OAP.js");
531
+ const { integrate: integrate2 } = await import("./interpreter-LTE43E4A.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-UEVX5OAP.js");
535
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-LTE43E4A.js");
536
536
  await integrateChildren2(session, child);
537
537
  const newChunks = session.output.slice(argOutputStart);
538
538
  const argValue = newChunks.join("");
@@ -821,7 +821,7 @@ async function executeLLM(session, element) {
821
821
  let systemPrompt = "";
822
822
  let currentUserPrompt = userPrompt;
823
823
  if (!noExtra) {
824
- const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-OL5ARO6Q.js");
824
+ const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-YZHVQ4XN.js");
825
825
  const allSubroutines = getAvailableSubroutines2(session);
826
826
  if (session.debug) {
827
827
  console.error(`[LLM] Total subroutines from session: ${allSubroutines.length}`);
@@ -1025,7 +1025,7 @@ ${result}
1025
1025
  const parser = new DiracParser();
1026
1026
  let dynamicAST = parser.parse(diracCode);
1027
1027
  if (validateTags) {
1028
- const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-JZVMOKGK.js");
1028
+ const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-DBQVSG75.js");
1029
1029
  let validation = await validateDiracCode(session, dynamicAST, { autocorrect });
1030
1030
  let retryCount = 0;
1031
1031
  while (!validation.valid && retryCount < maxRetries) {
@@ -1663,7 +1663,7 @@ async function getBestTagMatch(candidate, allowed) {
1663
1663
  return { tag: allowed[bestIdx], score: bestScore };
1664
1664
  }
1665
1665
  async function executeTagCheck(session, element) {
1666
- const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-OL5ARO6Q.js");
1666
+ const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-YZHVQ4XN.js");
1667
1667
  const subroutines = getAvailableSubroutines2(session);
1668
1668
  const allowed = new Set(subroutines.map((s) => s.name));
1669
1669
  console.error("[tag-check] Allowed subroutines:", Array.from(allowed));
@@ -1756,7 +1756,7 @@ async function executeTagCheck(session, element) {
1756
1756
  const executeTag = correctedTag || tagName;
1757
1757
  console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
1758
1758
  const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
1759
- const { integrate: integrate2 } = await import("./interpreter-UEVX5OAP.js");
1759
+ const { integrate: integrate2 } = await import("./interpreter-LTE43E4A.js");
1760
1760
  await integrate2(session, elementToExecute);
1761
1761
  }
1762
1762
  }
@@ -1765,7 +1765,7 @@ async function executeTagCheck(session, element) {
1765
1765
  // src/tags/throw.ts
1766
1766
  async function executeThrow(session, element) {
1767
1767
  const exceptionName = element.attributes?.name || "exception";
1768
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UEVX5OAP.js");
1768
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-LTE43E4A.js");
1769
1769
  const exceptionDom = {
1770
1770
  tag: "exception-content",
1771
1771
  attributes: { name: exceptionName },
@@ -1778,7 +1778,7 @@ async function executeThrow(session, element) {
1778
1778
  // src/tags/try.ts
1779
1779
  async function executeTry(session, element) {
1780
1780
  setExceptionBoundary(session);
1781
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UEVX5OAP.js");
1781
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-LTE43E4A.js");
1782
1782
  await integrateChildren2(session, element);
1783
1783
  unsetExceptionBoundary(session);
1784
1784
  }
@@ -1788,7 +1788,7 @@ async function executeCatch(session, element) {
1788
1788
  const exceptionName = element.attributes?.name || "exception";
1789
1789
  const caughtCount = lookupException(session, exceptionName);
1790
1790
  if (caughtCount > 0) {
1791
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UEVX5OAP.js");
1791
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-LTE43E4A.js");
1792
1792
  await integrateChildren2(session, element);
1793
1793
  }
1794
1794
  flushCurrentException(session);
@@ -1797,7 +1797,7 @@ async function executeCatch(session, element) {
1797
1797
  // src/tags/exception.ts
1798
1798
  async function executeException(session, element) {
1799
1799
  const exceptions = getCurrentExceptions(session);
1800
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-UEVX5OAP.js");
1800
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-LTE43E4A.js");
1801
1801
  for (const exceptionDom of exceptions) {
1802
1802
  await integrateChildren2(session, exceptionDom);
1803
1803
  }
@@ -1998,7 +1998,7 @@ async function executeLoadContext(session, element) {
1998
1998
  query = element.text.trim();
1999
1999
  }
2000
2000
  if (!query && element.children.length > 0) {
2001
- const { integrate: integrate2 } = await import("./interpreter-UEVX5OAP.js");
2001
+ const { integrate: integrate2 } = await import("./interpreter-LTE43E4A.js");
2002
2002
  const beforeOutput = session.output.length;
2003
2003
  for (const child of element.children) {
2004
2004
  await integrate2(session, child);
@@ -2067,7 +2067,7 @@ async function executeLoadContext(session, element) {
2067
2067
  parameters: s.parameters.map((p) => p.name),
2068
2068
  filePath: s.filePath
2069
2069
  }));
2070
- const { setVariable: setVariable2 } = await import("./session-OL5ARO6Q.js");
2070
+ const { setVariable: setVariable2 } = await import("./session-YZHVQ4XN.js");
2071
2071
  setVariable2(session, outputVar, JSON.stringify(summary, null, 2), false);
2072
2072
  }
2073
2073
  }
@@ -2429,7 +2429,7 @@ async function executeForeach(session, element) {
2429
2429
  const parser2 = new DiracParser2();
2430
2430
  try {
2431
2431
  const fromElement = parser2.parse(fromAttr);
2432
- const { integrate: integrate2 } = await import("./interpreter-UEVX5OAP.js");
2432
+ const { integrate: integrate2 } = await import("./interpreter-LTE43E4A.js");
2433
2433
  await integrate2(session, fromElement);
2434
2434
  } catch (e) {
2435
2435
  session.output = savedOutput;
package/dist/cli.js CHANGED
@@ -4,12 +4,12 @@ import {
4
4
  } from "./chunk-AJSYOXXZ.js";
5
5
  import {
6
6
  execute
7
- } from "./chunk-CAPEXLIN.js";
8
- import "./chunk-5ZWDEJPQ.js";
9
- import "./chunk-VC23AJJJ.js";
10
- import "./chunk-FPDW535D.js";
7
+ } from "./chunk-AEYISK7W.js";
8
+ import "./chunk-WVFFIHZL.js";
9
+ import "./chunk-HJSHCEK4.js";
10
+ import "./chunk-BGG2SULN.js";
11
11
  import "./chunk-HRHAMPOB.js";
12
- import "./chunk-M57VI7KL.js";
12
+ import "./chunk-2VFQ2YBT.js";
13
13
 
14
14
  // src/cli.ts
15
15
  import "dotenv/config";
@@ -17,7 +17,7 @@ import "dotenv/config";
17
17
  // package.json
18
18
  var package_default = {
19
19
  name: "dirac-lang",
20
- version: "0.1.84",
20
+ version: "0.1.86",
21
21
  description: "LLM-Augmented Declarative Execution",
22
22
  type: "module",
23
23
  main: "dist/index.js",
@@ -151,7 +151,7 @@ async function main() {
151
151
  const args = process.argv.slice(2);
152
152
  const calledAs = process.argv[1];
153
153
  if (calledAs && calledAs.endsWith("/dish")) {
154
- const { DiracShell } = await import("./shell-I4GW5MNZ.js");
154
+ const { DiracShell } = await import("./shell-I6DVYUOR.js");
155
155
  const shellConfig = loadShellConfig(args);
156
156
  const shell = new DiracShell(shellConfig);
157
157
  await shell.start();
@@ -200,11 +200,11 @@ async function main() {
200
200
  if (args[0] === "agent") {
201
201
  const subcommand = args[1];
202
202
  if (subcommand === "daemon") {
203
- const { runAgentDaemon } = await import("./agent-GEKJQGEE.js");
203
+ const { runAgentDaemon } = await import("./agent-UMP5VWLO.js");
204
204
  await runAgentDaemon();
205
205
  return;
206
206
  }
207
- const { AgentCLI } = await import("./agent-GEKJQGEE.js");
207
+ const { AgentCLI } = await import("./agent-UMP5VWLO.js");
208
208
  const agent = new AgentCLI();
209
209
  switch (subcommand) {
210
210
  case "start":
@@ -231,8 +231,8 @@ async function main() {
231
231
  return;
232
232
  }
233
233
  if (args[0] === "shell") {
234
- const { DiracShell } = await import("./shell-I4GW5MNZ.js");
235
- const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-H5NGDYLR.js");
234
+ const { DiracShell } = await import("./shell-I6DVYUOR.js");
235
+ const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-I3XM7YYC.js");
236
236
  const { SessionClient } = await import("./session-client-3VTC5MLO.js");
237
237
  const daemonMode = args.includes("--daemon") || args.includes("-d");
238
238
  const agentMode = args.includes("--agent") || args.includes("-a");
@@ -278,7 +278,7 @@ async function main() {
278
278
  return;
279
279
  }
280
280
  if (args[0] === "daemon") {
281
- const { SessionServer } = await import("./session-server-H5NGDYLR.js");
281
+ const { SessionServer } = await import("./session-server-I3XM7YYC.js");
282
282
  const server = new SessionServer();
283
283
  await server.start();
284
284
  console.log("Session daemon started");
@@ -3,11 +3,11 @@ import {
3
3
  listCronJobs,
4
4
  stopAllCronJobs,
5
5
  stopCronJob
6
- } from "./chunk-5ZWDEJPQ.js";
7
- import "./chunk-VC23AJJJ.js";
8
- import "./chunk-FPDW535D.js";
6
+ } from "./chunk-WVFFIHZL.js";
7
+ import "./chunk-HJSHCEK4.js";
8
+ import "./chunk-BGG2SULN.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
- import "./chunk-M57VI7KL.js";
10
+ import "./chunk-2VFQ2YBT.js";
11
11
  export {
12
12
  executeCron,
13
13
  listCronJobs,
package/dist/index.js CHANGED
@@ -2,12 +2,12 @@ import {
2
2
  createLLMAdapter,
3
3
  execute,
4
4
  executeUserCommand
5
- } from "./chunk-CAPEXLIN.js";
5
+ } from "./chunk-AEYISK7W.js";
6
6
  import {
7
7
  integrate
8
- } from "./chunk-5ZWDEJPQ.js";
9
- import "./chunk-VC23AJJJ.js";
10
- import "./chunk-FPDW535D.js";
8
+ } from "./chunk-WVFFIHZL.js";
9
+ import "./chunk-HJSHCEK4.js";
10
+ import "./chunk-BGG2SULN.js";
11
11
  import {
12
12
  DiracParser
13
13
  } from "./chunk-HRHAMPOB.js";
@@ -15,7 +15,7 @@ import {
15
15
  createSession,
16
16
  getAvailableSubroutines,
17
17
  getOutput
18
- } from "./chunk-M57VI7KL.js";
18
+ } from "./chunk-2VFQ2YBT.js";
19
19
  export {
20
20
  DiracParser,
21
21
  createLLMAdapter,
@@ -0,0 +1,12 @@
1
+ import {
2
+ integrate,
3
+ integrateChildren
4
+ } from "./chunk-WVFFIHZL.js";
5
+ import "./chunk-HJSHCEK4.js";
6
+ import "./chunk-BGG2SULN.js";
7
+ import "./chunk-HRHAMPOB.js";
8
+ import "./chunk-2VFQ2YBT.js";
9
+ export {
10
+ integrate,
11
+ integrateChildren
12
+ };
@@ -3,11 +3,11 @@ import {
3
3
  cancelScheduledRun,
4
4
  executeRunAt,
5
5
  listScheduledRuns
6
- } from "./chunk-5ZWDEJPQ.js";
7
- import "./chunk-VC23AJJJ.js";
8
- import "./chunk-FPDW535D.js";
6
+ } from "./chunk-WVFFIHZL.js";
7
+ import "./chunk-HJSHCEK4.js";
8
+ import "./chunk-BGG2SULN.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
- import "./chunk-M57VI7KL.js";
10
+ import "./chunk-2VFQ2YBT.js";
11
11
  export {
12
12
  cancelAllScheduledRuns,
13
13
  cancelScheduledRun,
@@ -3,11 +3,11 @@ import {
3
3
  listScheduledTasks,
4
4
  stopAllScheduledTasks,
5
5
  stopScheduledTask
6
- } from "./chunk-5ZWDEJPQ.js";
7
- import "./chunk-VC23AJJJ.js";
8
- import "./chunk-FPDW535D.js";
6
+ } from "./chunk-WVFFIHZL.js";
7
+ import "./chunk-HJSHCEK4.js";
8
+ import "./chunk-BGG2SULN.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
- import "./chunk-M57VI7KL.js";
10
+ import "./chunk-2VFQ2YBT.js";
11
11
  export {
12
12
  executeSchedule,
13
13
  listScheduledTasks,
@@ -26,7 +26,7 @@ import {
26
26
  substituteVariables,
27
27
  throwException,
28
28
  unsetExceptionBoundary
29
- } from "./chunk-M57VI7KL.js";
29
+ } from "./chunk-2VFQ2YBT.js";
30
30
  export {
31
31
  cleanSubroutinesToBoundary,
32
32
  cleanToBoundary,
@@ -2,12 +2,12 @@ import {
2
2
  SessionServer,
3
3
  getSocketPath,
4
4
  isSessionRunning
5
- } from "./chunk-XM5V6O2F.js";
6
- import "./chunk-5ZWDEJPQ.js";
7
- import "./chunk-VC23AJJJ.js";
8
- import "./chunk-FPDW535D.js";
5
+ } from "./chunk-VEFJ4NM3.js";
6
+ import "./chunk-WVFFIHZL.js";
7
+ import "./chunk-HJSHCEK4.js";
8
+ import "./chunk-BGG2SULN.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
- import "./chunk-M57VI7KL.js";
10
+ import "./chunk-2VFQ2YBT.js";
11
11
  export {
12
12
  SessionServer,
13
13
  getSocketPath,
@@ -4,15 +4,15 @@ import {
4
4
  } from "./chunk-AJSYOXXZ.js";
5
5
  import {
6
6
  integrate
7
- } from "./chunk-5ZWDEJPQ.js";
8
- import "./chunk-VC23AJJJ.js";
9
- import "./chunk-FPDW535D.js";
7
+ } from "./chunk-WVFFIHZL.js";
8
+ import "./chunk-HJSHCEK4.js";
9
+ import "./chunk-BGG2SULN.js";
10
10
  import {
11
11
  DiracParser
12
12
  } from "./chunk-HRHAMPOB.js";
13
13
  import {
14
14
  createSession
15
- } from "./chunk-M57VI7KL.js";
15
+ } from "./chunk-2VFQ2YBT.js";
16
16
 
17
17
  // src/shell.ts
18
18
  import * as readline from "readline";
@@ -360,7 +360,7 @@ var DiracShell = class {
360
360
  if (this.client) {
361
361
  this.client.disconnect();
362
362
  }
363
- import("./schedule-IXCATP3Q.js").then(({ stopAllScheduledTasks }) => {
363
+ import("./schedule-JTX4TJ5U.js").then(({ stopAllScheduledTasks }) => {
364
364
  stopAllScheduledTasks();
365
365
  console.log("\nGoodbye!");
366
366
  process.exit(0);
@@ -582,7 +582,18 @@ Examples:
582
582
  console.log("Variables:");
583
583
  for (const v of variables) {
584
584
  if (v.visible) {
585
- 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
+ let formattedValue;
586
+ if (typeof v.value === "object" && v.value !== null) {
587
+ formattedValue = JSON.stringify(v.value, null, 2);
588
+ } else if (typeof v.value === "string" && (v.value.startsWith("[") || v.value.startsWith("{"))) {
589
+ try {
590
+ formattedValue = JSON.stringify(JSON.parse(v.value), null, 2);
591
+ } catch {
592
+ formattedValue = JSON.stringify(v.value);
593
+ }
594
+ } else {
595
+ formattedValue = JSON.stringify(v.value);
596
+ }
586
597
  console.log(` ${v.name} =`);
587
598
  console.log(formattedValue.split("\n").map((line) => ` ${line}`).join("\n"));
588
599
  }
@@ -753,7 +764,7 @@ Examples:
753
764
  break;
754
765
  case "tasks":
755
766
  try {
756
- const { listScheduledTasks } = await import("./schedule-IXCATP3Q.js");
767
+ const { listScheduledTasks } = await import("./schedule-JTX4TJ5U.js");
757
768
  const tasks = listScheduledTasks();
758
769
  if (tasks.length === 0) {
759
770
  console.log("No scheduled tasks running.");
@@ -772,7 +783,7 @@ Examples:
772
783
  console.log("Usage: :stop <task-name>");
773
784
  } else {
774
785
  try {
775
- const { stopScheduledTask } = await import("./schedule-IXCATP3Q.js");
786
+ const { stopScheduledTask } = await import("./schedule-JTX4TJ5U.js");
776
787
  const taskName = args[0];
777
788
  const stopped = stopScheduledTask(taskName);
778
789
  if (stopped) {
@@ -787,7 +798,7 @@ Examples:
787
798
  break;
788
799
  case "stopall":
789
800
  try {
790
- const { stopAllScheduledTasks } = await import("./schedule-IXCATP3Q.js");
801
+ const { stopAllScheduledTasks } = await import("./schedule-JTX4TJ5U.js");
791
802
  stopAllScheduledTasks();
792
803
  console.log("All scheduled tasks stopped.");
793
804
  } catch (error) {
@@ -796,7 +807,7 @@ Examples:
796
807
  break;
797
808
  case "crons":
798
809
  try {
799
- const { listCronJobs } = await import("./cron-PSKTXN2J.js");
810
+ const { listCronJobs } = await import("./cron-UH6AQRDK.js");
800
811
  const jobs = listCronJobs();
801
812
  if (jobs.length === 0) {
802
813
  console.log("No cron jobs running.");
@@ -816,7 +827,7 @@ Examples:
816
827
  console.log("Usage: :stopcron <job-name>");
817
828
  } else {
818
829
  try {
819
- const { stopCronJob } = await import("./cron-PSKTXN2J.js");
830
+ const { stopCronJob } = await import("./cron-UH6AQRDK.js");
820
831
  const jobName = args[0];
821
832
  const stopped = stopCronJob(jobName);
822
833
  if (stopped) {
@@ -831,7 +842,7 @@ Examples:
831
842
  break;
832
843
  case "stopallcrons":
833
844
  try {
834
- const { stopAllCronJobs } = await import("./cron-PSKTXN2J.js");
845
+ const { stopAllCronJobs } = await import("./cron-UH6AQRDK.js");
835
846
  stopAllCronJobs();
836
847
  console.log("All cron jobs stopped.");
837
848
  } catch (error) {
@@ -840,7 +851,7 @@ Examples:
840
851
  break;
841
852
  case "scheduled":
842
853
  try {
843
- const { listScheduledRuns } = await import("./run-at-HH4TEYG7.js");
854
+ const { listScheduledRuns } = await import("./run-at-L2N6DS6Y.js");
844
855
  const runs = listScheduledRuns();
845
856
  if (runs.length === 0) {
846
857
  console.log("No scheduled runs pending.");
@@ -860,7 +871,7 @@ Examples:
860
871
  console.log("Usage: :cancel <run-name>");
861
872
  } else {
862
873
  try {
863
- const { cancelScheduledRun } = await import("./run-at-HH4TEYG7.js");
874
+ const { cancelScheduledRun } = await import("./run-at-L2N6DS6Y.js");
864
875
  const runName = args[0];
865
876
  const cancelled = cancelScheduledRun(runName);
866
877
  if (cancelled) {
@@ -875,7 +886,7 @@ Examples:
875
886
  break;
876
887
  case "cancelall":
877
888
  try {
878
- const { cancelAllScheduledRuns } = await import("./run-at-HH4TEYG7.js");
889
+ const { cancelAllScheduledRuns } = await import("./run-at-L2N6DS6Y.js");
879
890
  cancelAllScheduledRuns();
880
891
  console.log("All scheduled runs cancelled.");
881
892
  } catch (error) {
@@ -910,9 +921,19 @@ Examples:
910
921
  }
911
922
  return false;
912
923
  }
924
+ /**
925
+ * Check if command likely represents natural language based on first word
926
+ */
927
+ isLikelyNaturalLanguage(command) {
928
+ const trimmed = command.trim().toLowerCase();
929
+ if (trimmed.endsWith("?")) return true;
930
+ const nlStarters = /^(what|why|how|where|when|which|who|can|could|would|should|please|may|might|do|does|did|is|are|was|were|will|shall)\s/i;
931
+ return nlStarters.test(trimmed);
932
+ }
913
933
  /**
914
934
  * Execute a Unix shell command
915
935
  * If command is not found, fallback to treating it as an AI query
936
+ * Also fallback if command fails and looks like natural language
916
937
  */
917
938
  async executeShellCommand(command) {
918
939
  const trimmed = command.trim();
@@ -943,8 +964,10 @@ Examples:
943
964
  child.on("close", async (code) => {
944
965
  this.rl.resume();
945
966
  const commandNotFound = code === 127 || stderrData.includes("command not found");
946
- if (commandNotFound) {
947
- console.log(`\u{1F4A1} Command not found, trying as AI query...`);
967
+ const likelyNaturalLanguage = code !== 0 && this.isLikelyNaturalLanguage(trimmed);
968
+ if (commandNotFound || likelyNaturalLanguage) {
969
+ const reason = commandNotFound ? "Command not found" : "Command failed, looks like natural language";
970
+ console.log(`\u{1F4A1} ${reason}, trying as AI query...`);
948
971
  if (this.config.debug) {
949
972
  console.log(`[executing: |ai>${trimmed}]`);
950
973
  }
@@ -972,7 +995,7 @@ Examples:
972
995
  console.log("Set ANTHROPIC_API_KEY or OPENAI_API_KEY environment variable,");
973
996
  console.log("or create ~/.dirac/config.yml with llmProvider and llmModel.\n");
974
997
  }
975
- const { registry } = await import("./subroutine-index-7B5YXKAA.js");
998
+ const { registry } = await import("./subroutine-index-E6XE6XNL.js");
976
999
  const wasIndexed = await registry.autoIndexStdlib();
977
1000
  await this.loadEssentialSubroutines();
978
1001
  if (this.config.initScript) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeSubroutine
3
- } from "./chunk-VC23AJJJ.js";
4
- import "./chunk-M57VI7KL.js";
3
+ } from "./chunk-HJSHCEK4.js";
4
+ import "./chunk-2VFQ2YBT.js";
5
5
  export {
6
6
  executeSubroutine
7
7
  };
@@ -3,9 +3,9 @@ import {
3
3
  executeRegistryStats,
4
4
  executeSearchSubroutines,
5
5
  registry
6
- } from "./chunk-FPDW535D.js";
6
+ } from "./chunk-BGG2SULN.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
- import "./chunk-M57VI7KL.js";
8
+ import "./chunk-2VFQ2YBT.js";
9
9
  export {
10
10
  executeIndexSubroutines,
11
11
  executeRegistryStats,
@@ -49,7 +49,7 @@ async function getBestTagMatch(candidate, allowed) {
49
49
  }
50
50
  async function validateTag(session, element, options = {}) {
51
51
  const { autocorrect = false, similarityCutoff = SIMILARITY_CUTOFF } = options;
52
- const { getAvailableSubroutines } = await import("./session-OL5ARO6Q.js");
52
+ const { getAvailableSubroutines } = await import("./session-YZHVQ4XN.js");
53
53
  const subroutines = getAvailableSubroutines(session);
54
54
  const allowed = new Set(subroutines.map((s) => s.name));
55
55
  const tagName = element.tag;
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-5ZWDEJPQ.js";
4
- import "./chunk-VC23AJJJ.js";
5
- import "./chunk-FPDW535D.js";
3
+ } from "./chunk-WVFFIHZL.js";
4
+ import "./chunk-HJSHCEK4.js";
5
+ import "./chunk-BGG2SULN.js";
6
6
  import {
7
7
  DiracParser
8
8
  } from "./chunk-HRHAMPOB.js";
9
9
  import {
10
10
  createSession,
11
11
  getOutput
12
- } from "./chunk-M57VI7KL.js";
12
+ } from "./chunk-2VFQ2YBT.js";
13
13
 
14
14
  // src/test-runner.ts
15
15
  import fs from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirac-lang",
3
- "version": "0.1.85",
3
+ "version": "0.1.87",
4
4
  "description": "LLM-Augmented Declarative Execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,12 +0,0 @@
1
- import {
2
- integrate,
3
- integrateChildren
4
- } from "./chunk-5ZWDEJPQ.js";
5
- import "./chunk-VC23AJJJ.js";
6
- import "./chunk-FPDW535D.js";
7
- import "./chunk-HRHAMPOB.js";
8
- import "./chunk-M57VI7KL.js";
9
- export {
10
- integrate,
11
- integrateChildren
12
- };