dirac-lang 0.1.58 → 0.1.59

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.
@@ -264,7 +264,8 @@ function getAvailableSubroutines(session) {
264
264
  name: sub.name,
265
265
  description: sub.description,
266
266
  parameters: sub.parameters,
267
- meta: sub.meta
267
+ meta: sub.meta,
268
+ boundary: sub.boundary
268
269
  }));
269
270
  }
270
271
  function throwException(session, name, dom) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  registerSubroutine
3
- } from "./chunk-IN55WRFB.js";
3
+ } from "./chunk-3UW6GWYQ.js";
4
4
 
5
5
  // src/tags/subroutine.ts
6
6
  function executeSubroutine(session, element) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-WQ2KRQAR.js";
3
+ } from "./chunk-RDVNX3JG.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-IN55WRFB.js";
11
+ } from "./chunk-3UW6GWYQ.js";
12
12
 
13
13
  // src/utils/llm-adapter.ts
14
14
  function createLLMAdapter(session) {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-HRHAMPOB.js";
4
4
  import {
5
5
  executeSubroutine
6
- } from "./chunk-WX7VHQYL.js";
6
+ } from "./chunk-NKA6ZJDV.js";
7
7
  import {
8
8
  CustomLLMProvider,
9
9
  OllamaProvider,
@@ -28,7 +28,7 @@ import {
28
28
  substituteVariables,
29
29
  throwException,
30
30
  unsetExceptionBoundary
31
- } from "./chunk-IN55WRFB.js";
31
+ } from "./chunk-3UW6GWYQ.js";
32
32
 
33
33
  // src/tags/parameters.ts
34
34
  async function executeParameters(session, element) {
@@ -284,7 +284,7 @@ async function executeCall(session, element) {
284
284
  }
285
285
  }
286
286
  async function registerExtendChain(session, subroutine, currentName) {
287
- const { executeSubroutine: executeSubroutine2 } = await import("./subroutine-RBTBNR2T.js");
287
+ const { executeSubroutine: executeSubroutine2 } = await import("./subroutine-WJU6SDRC.js");
288
288
  const extendsAttr = subroutine.attributes.extends;
289
289
  let parentName;
290
290
  if (extendsAttr) {
@@ -474,12 +474,12 @@ async function executeIf(session, element) {
474
474
  const condition = await evaluatePredicate(session, conditionElement);
475
475
  if (condition) {
476
476
  if (thenElement) {
477
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-WVPCPGVL.js");
477
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QC6Z7Y6R.js");
478
478
  await integrateChildren2(session, thenElement);
479
479
  }
480
480
  } else {
481
481
  if (elseElement) {
482
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-WVPCPGVL.js");
482
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QC6Z7Y6R.js");
483
483
  await integrateChildren2(session, elseElement);
484
484
  }
485
485
  }
@@ -492,7 +492,7 @@ async function evaluatePredicate(session, predicateElement) {
492
492
  return await evaluateCondition(session, predicateElement);
493
493
  }
494
494
  const outputLengthBefore = session.output.length;
495
- const { integrate: integrate2 } = await import("./interpreter-WVPCPGVL.js");
495
+ const { integrate: integrate2 } = await import("./interpreter-QC6Z7Y6R.js");
496
496
  await integrate2(session, predicateElement);
497
497
  const newOutputChunks = session.output.slice(outputLengthBefore);
498
498
  const result = newOutputChunks.join("").trim();
@@ -515,11 +515,11 @@ async function evaluateCondition(session, condElement) {
515
515
  }
516
516
  const outputLengthBefore = session.output.length;
517
517
  const args = [];
518
- const { integrate: integrate2 } = await import("./interpreter-WVPCPGVL.js");
518
+ const { integrate: integrate2 } = await import("./interpreter-QC6Z7Y6R.js");
519
519
  for (const child of condElement.children) {
520
520
  if (child.tag.toLowerCase() === "arg") {
521
521
  const argOutputStart = session.output.length;
522
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-WVPCPGVL.js");
522
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QC6Z7Y6R.js");
523
523
  await integrateChildren2(session, child);
524
524
  const newChunks = session.output.slice(argOutputStart);
525
525
  const argValue = newChunks.join("");
@@ -735,6 +735,7 @@ async function executeLLM(session, element) {
735
735
  const executeMode = element.attributes.execute === "true";
736
736
  const temperature = parseFloat(element.attributes.temperature || "1.0");
737
737
  const maxTokens = parseInt(element.attributes.maxTokens || "4096", 10);
738
+ const showMode = element.attributes.show || "all";
738
739
  let userPrompt = "";
739
740
  if (element.children.length > 0) {
740
741
  const beforeOutput = session.output.length;
@@ -784,9 +785,26 @@ async function executeLLM(session, element) {
784
785
  let systemPrompt = "";
785
786
  let currentUserPrompt = userPrompt;
786
787
  if (!noExtra) {
787
- const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-MRU57VMJ.js");
788
+ const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-AZIX6ILU.js");
788
789
  const allSubroutines = getAvailableSubroutines2(session);
789
- const subroutines = allSubroutines.filter((sub) => {
790
+ let boundaryFilteredSubroutines = allSubroutines;
791
+ if (showMode === "boundary") {
792
+ const currentBoundary = session.subBoundary;
793
+ if (session.debug) {
794
+ console.error(`[LLM] Current boundary: ${currentBoundary}`);
795
+ console.error(
796
+ `[LLM] All subroutines before boundary filter:`,
797
+ allSubroutines.map((s) => ({ name: s.name, boundary: s.boundary }))
798
+ );
799
+ }
800
+ boundaryFilteredSubroutines = allSubroutines.filter((sub) => {
801
+ return sub.boundary >= currentBoundary;
802
+ });
803
+ if (session.debug && allSubroutines.length !== boundaryFilteredSubroutines.length) {
804
+ console.error(`[LLM] Filtered to boundary ${currentBoundary}: ${boundaryFilteredSubroutines.length}/${allSubroutines.length} subroutines visible`);
805
+ }
806
+ }
807
+ const subroutines = boundaryFilteredSubroutines.filter((sub) => {
790
808
  const hideMeta = sub.meta?.["hide-from-llm"];
791
809
  return hideMeta !== "true" && hideMeta !== true;
792
810
  });
@@ -796,7 +814,7 @@ async function executeLLM(session, element) {
796
814
  subroutines.map((s) => ({ name: s.name, description: s.description, parameters: s.parameters }))
797
815
  );
798
816
  if (allSubroutines.length !== subroutines.length) {
799
- console.error(`[LLM] Filtered out ${allSubroutines.length - subroutines.length} subroutine(s) with hide-from-llm metadata`);
817
+ console.error(`[LLM] Filtered out ${allSubroutines.length - subroutines.length} subroutine(s) (boundary + hide-from-llm)`);
800
818
  }
801
819
  }
802
820
  if (hasExistingDialog && (contextVar || saveDialog)) {
@@ -963,7 +981,7 @@ ${result}
963
981
  const parser = new DiracParser();
964
982
  let dynamicAST = parser.parse(diracCode);
965
983
  if (validateTags) {
966
- const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-BTBNFPJD.js");
984
+ const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-PEBTT5HJ.js");
967
985
  let validation = await validateDiracCode(session, dynamicAST, { autocorrect });
968
986
  let retryCount = 0;
969
987
  while (!validation.valid && retryCount < maxRetries) {
@@ -1574,7 +1592,7 @@ async function getBestTagMatch(candidate, allowed) {
1574
1592
  return { tag: allowed[bestIdx], score: bestScore };
1575
1593
  }
1576
1594
  async function executeTagCheck(session, element) {
1577
- const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-MRU57VMJ.js");
1595
+ const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-AZIX6ILU.js");
1578
1596
  const subroutines = getAvailableSubroutines2(session);
1579
1597
  const allowed = new Set(subroutines.map((s) => s.name));
1580
1598
  console.error("[tag-check] Allowed subroutines:", Array.from(allowed));
@@ -1667,7 +1685,7 @@ async function executeTagCheck(session, element) {
1667
1685
  const executeTag = correctedTag || tagName;
1668
1686
  console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
1669
1687
  const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
1670
- const { integrate: integrate2 } = await import("./interpreter-WVPCPGVL.js");
1688
+ const { integrate: integrate2 } = await import("./interpreter-QC6Z7Y6R.js");
1671
1689
  await integrate2(session, elementToExecute);
1672
1690
  }
1673
1691
  }
@@ -1676,7 +1694,7 @@ async function executeTagCheck(session, element) {
1676
1694
  // src/tags/throw.ts
1677
1695
  async function executeThrow(session, element) {
1678
1696
  const exceptionName = element.attributes?.name || "exception";
1679
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-WVPCPGVL.js");
1697
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QC6Z7Y6R.js");
1680
1698
  const exceptionDom = {
1681
1699
  tag: "exception-content",
1682
1700
  attributes: { name: exceptionName },
@@ -1689,7 +1707,7 @@ async function executeThrow(session, element) {
1689
1707
  // src/tags/try.ts
1690
1708
  async function executeTry(session, element) {
1691
1709
  setExceptionBoundary(session);
1692
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-WVPCPGVL.js");
1710
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QC6Z7Y6R.js");
1693
1711
  await integrateChildren2(session, element);
1694
1712
  unsetExceptionBoundary(session);
1695
1713
  }
@@ -1699,7 +1717,7 @@ async function executeCatch(session, element) {
1699
1717
  const exceptionName = element.attributes?.name || "exception";
1700
1718
  const caughtCount = lookupException(session, exceptionName);
1701
1719
  if (caughtCount > 0) {
1702
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-WVPCPGVL.js");
1720
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QC6Z7Y6R.js");
1703
1721
  await integrateChildren2(session, element);
1704
1722
  }
1705
1723
  flushCurrentException(session);
@@ -1708,7 +1726,7 @@ async function executeCatch(session, element) {
1708
1726
  // src/tags/exception.ts
1709
1727
  async function executeException(session, element) {
1710
1728
  const exceptions = getCurrentExceptions(session);
1711
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-WVPCPGVL.js");
1729
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-QC6Z7Y6R.js");
1712
1730
  for (const exceptionDom of exceptions) {
1713
1731
  await integrateChildren2(session, exceptionDom);
1714
1732
  }
@@ -2176,7 +2194,7 @@ async function executeLoadContext(session, element) {
2176
2194
  query = element.text.trim();
2177
2195
  }
2178
2196
  if (!query && element.children.length > 0) {
2179
- const { integrate: integrate2 } = await import("./interpreter-WVPCPGVL.js");
2197
+ const { integrate: integrate2 } = await import("./interpreter-QC6Z7Y6R.js");
2180
2198
  const beforeOutput = session.output.length;
2181
2199
  for (const child of element.children) {
2182
2200
  await integrate2(session, child);
@@ -2245,7 +2263,7 @@ async function executeLoadContext(session, element) {
2245
2263
  parameters: s.parameters.map((p) => p.name),
2246
2264
  filePath: s.filePath
2247
2265
  }));
2248
- const { setVariable: setVariable2 } = await import("./session-MRU57VMJ.js");
2266
+ const { setVariable: setVariable2 } = await import("./session-AZIX6ILU.js");
2249
2267
  setVariable2(session, outputVar, JSON.stringify(summary, null, 2), false);
2250
2268
  }
2251
2269
  }
@@ -2429,7 +2447,7 @@ async function executeForeach(session, element) {
2429
2447
  const parser2 = new DiracParser2();
2430
2448
  try {
2431
2449
  const fromElement = parser2.parse(fromAttr);
2432
- const { integrate: integrate2 } = await import("./interpreter-WVPCPGVL.js");
2450
+ const { integrate: integrate2 } = await import("./interpreter-QC6Z7Y6R.js");
2433
2451
  await integrate2(session, fromElement);
2434
2452
  } catch (e) {
2435
2453
  session.output = savedOutput;
package/dist/cli.js CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  } from "./chunk-AJSYOXXZ.js";
5
5
  import {
6
6
  execute
7
- } from "./chunk-5FKZ3N7C.js";
8
- import "./chunk-WQ2KRQAR.js";
7
+ } from "./chunk-NVKBCTEU.js";
8
+ import "./chunk-RDVNX3JG.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
- import "./chunk-WX7VHQYL.js";
11
- import "./chunk-IN55WRFB.js";
10
+ import "./chunk-NKA6ZJDV.js";
11
+ import "./chunk-3UW6GWYQ.js";
12
12
 
13
13
  // src/cli.ts
14
14
  import "dotenv/config";
@@ -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.57",
19
+ version: "0.1.58",
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-QA7NY73L.js");
99
+ const { DiracShell } = await import("./shell-LPNBQPXC.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,19 +2,19 @@ import {
2
2
  createLLMAdapter,
3
3
  execute,
4
4
  executeUserCommand
5
- } from "./chunk-5FKZ3N7C.js";
5
+ } from "./chunk-NVKBCTEU.js";
6
6
  import {
7
7
  integrate
8
- } from "./chunk-WQ2KRQAR.js";
8
+ } from "./chunk-RDVNX3JG.js";
9
9
  import {
10
10
  DiracParser
11
11
  } from "./chunk-HRHAMPOB.js";
12
- import "./chunk-WX7VHQYL.js";
12
+ import "./chunk-NKA6ZJDV.js";
13
13
  import {
14
14
  createSession,
15
15
  getAvailableSubroutines,
16
16
  getOutput
17
- } from "./chunk-IN55WRFB.js";
17
+ } from "./chunk-3UW6GWYQ.js";
18
18
  export {
19
19
  DiracParser,
20
20
  createLLMAdapter,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  integrate,
3
3
  integrateChildren
4
- } from "./chunk-WQ2KRQAR.js";
4
+ } from "./chunk-RDVNX3JG.js";
5
5
  import "./chunk-HRHAMPOB.js";
6
- import "./chunk-WX7VHQYL.js";
7
- import "./chunk-IN55WRFB.js";
6
+ import "./chunk-NKA6ZJDV.js";
7
+ import "./chunk-3UW6GWYQ.js";
8
8
  export {
9
9
  integrate,
10
10
  integrateChildren
@@ -3,10 +3,10 @@ import {
3
3
  listScheduledTasks,
4
4
  stopAllScheduledTasks,
5
5
  stopScheduledTask
6
- } from "./chunk-WQ2KRQAR.js";
6
+ } from "./chunk-RDVNX3JG.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
- import "./chunk-WX7VHQYL.js";
9
- import "./chunk-IN55WRFB.js";
8
+ import "./chunk-NKA6ZJDV.js";
9
+ import "./chunk-3UW6GWYQ.js";
10
10
  export {
11
11
  executeSchedule,
12
12
  listScheduledTasks,
@@ -26,7 +26,7 @@ import {
26
26
  substituteVariables,
27
27
  throwException,
28
28
  unsetExceptionBoundary
29
- } from "./chunk-IN55WRFB.js";
29
+ } from "./chunk-3UW6GWYQ.js";
30
30
  export {
31
31
  cleanSubroutinesToBoundary,
32
32
  cleanToBoundary,
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-AJSYOXXZ.js";
5
5
  import {
6
6
  integrate
7
- } from "./chunk-WQ2KRQAR.js";
7
+ } from "./chunk-RDVNX3JG.js";
8
8
  import {
9
9
  DiracParser
10
10
  } from "./chunk-HRHAMPOB.js";
11
- import "./chunk-WX7VHQYL.js";
11
+ import "./chunk-NKA6ZJDV.js";
12
12
  import {
13
13
  createSession
14
- } from "./chunk-IN55WRFB.js";
14
+ } from "./chunk-3UW6GWYQ.js";
15
15
 
16
16
  // src/shell.ts
17
17
  import * as readline from "readline";
@@ -150,7 +150,7 @@ var DiracShell = class {
150
150
  });
151
151
  this.rl.on("close", () => {
152
152
  this.saveHistory();
153
- import("./schedule-VYFEIUQE.js").then(({ stopAllScheduledTasks }) => {
153
+ import("./schedule-2NDGR5S5.js").then(({ stopAllScheduledTasks }) => {
154
154
  stopAllScheduledTasks();
155
155
  console.log("\nGoodbye!");
156
156
  process.exit(0);
@@ -471,7 +471,7 @@ Examples:
471
471
  break;
472
472
  case "tasks":
473
473
  try {
474
- const { listScheduledTasks } = await import("./schedule-VYFEIUQE.js");
474
+ const { listScheduledTasks } = await import("./schedule-2NDGR5S5.js");
475
475
  const tasks = listScheduledTasks();
476
476
  if (tasks.length === 0) {
477
477
  console.log("No scheduled tasks running.");
@@ -490,7 +490,7 @@ Examples:
490
490
  console.log("Usage: :stop <task-name>");
491
491
  } else {
492
492
  try {
493
- const { stopScheduledTask } = await import("./schedule-VYFEIUQE.js");
493
+ const { stopScheduledTask } = await import("./schedule-2NDGR5S5.js");
494
494
  const taskName = args[0];
495
495
  const stopped = stopScheduledTask(taskName);
496
496
  if (stopped) {
@@ -505,7 +505,7 @@ Examples:
505
505
  break;
506
506
  case "stopall":
507
507
  try {
508
- const { stopAllScheduledTasks } = await import("./schedule-VYFEIUQE.js");
508
+ const { stopAllScheduledTasks } = await import("./schedule-2NDGR5S5.js");
509
509
  stopAllScheduledTasks();
510
510
  console.log("All scheduled tasks stopped.");
511
511
  } catch (error) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeSubroutine
3
- } from "./chunk-WX7VHQYL.js";
4
- import "./chunk-IN55WRFB.js";
3
+ } from "./chunk-NKA6ZJDV.js";
4
+ import "./chunk-3UW6GWYQ.js";
5
5
  export {
6
6
  executeSubroutine
7
7
  };
@@ -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-MRU57VMJ.js");
52
+ const { getAvailableSubroutines } = await import("./session-AZIX6ILU.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,14 +1,14 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-WQ2KRQAR.js";
3
+ } from "./chunk-RDVNX3JG.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
7
- import "./chunk-WX7VHQYL.js";
7
+ import "./chunk-NKA6ZJDV.js";
8
8
  import {
9
9
  createSession,
10
10
  getOutput
11
- } from "./chunk-IN55WRFB.js";
11
+ } from "./chunk-3UW6GWYQ.js";
12
12
 
13
13
  // src/test-runner.ts
14
14
  import fs from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirac-lang",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "description": "LLM-Augmented Declarative Execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",