dirac-lang 0.1.48 → 0.1.50

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.
@@ -144,8 +144,9 @@ function createSession(config = {}) {
144
144
  isBreak: false,
145
145
  skipSubroutineRegistration: false,
146
146
  debug: config.debug || false,
147
- currentFile: config.filePath
147
+ currentFile: config.filePath,
148
148
  // Set current file from config for proper relative import resolution
149
+ libraryPaths: config.libraryPaths || []
149
150
  };
150
151
  }
151
152
  function setVariable(session, name, value, visible = false) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-TXL3RV74.js";
3
+ } from "./chunk-QVS4OQHX.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-GLXVY235.js";
11
+ } from "./chunk-A4SFB5W4.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-4QLTSCDG.js";
6
+ } from "./chunk-ZY37RS4P.js";
7
7
  import {
8
8
  cleanSubroutinesToBoundary,
9
9
  cleanToBoundary,
@@ -26,7 +26,7 @@ import {
26
26
  substituteVariables,
27
27
  throwException,
28
28
  unsetExceptionBoundary
29
- } from "./chunk-GLXVY235.js";
29
+ } from "./chunk-A4SFB5W4.js";
30
30
 
31
31
  // src/tags/parameters.ts
32
32
  async function executeParameters(session, element) {
@@ -270,7 +270,7 @@ async function executeCall(session, element) {
270
270
  }
271
271
  }
272
272
  async function registerExtendChain(session, subroutine, currentName) {
273
- const { executeSubroutine: executeSubroutine2 } = await import("./subroutine-V4D4LQIH.js");
273
+ const { executeSubroutine: executeSubroutine2 } = await import("./subroutine-VIACWZPF.js");
274
274
  const extendsAttr = subroutine.attributes.extends;
275
275
  let parentName;
276
276
  if (extendsAttr) {
@@ -460,12 +460,12 @@ async function executeIf(session, element) {
460
460
  const condition = await evaluatePredicate(session, conditionElement);
461
461
  if (condition) {
462
462
  if (thenElement) {
463
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-XH3RFKVP.js");
463
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-B2GRYZ27.js");
464
464
  await integrateChildren2(session, thenElement);
465
465
  }
466
466
  } else {
467
467
  if (elseElement) {
468
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-XH3RFKVP.js");
468
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-B2GRYZ27.js");
469
469
  await integrateChildren2(session, elseElement);
470
470
  }
471
471
  }
@@ -478,7 +478,7 @@ async function evaluatePredicate(session, predicateElement) {
478
478
  return await evaluateCondition(session, predicateElement);
479
479
  }
480
480
  const outputLengthBefore = session.output.length;
481
- const { integrate: integrate2 } = await import("./interpreter-XH3RFKVP.js");
481
+ const { integrate: integrate2 } = await import("./interpreter-B2GRYZ27.js");
482
482
  await integrate2(session, predicateElement);
483
483
  const newOutputChunks = session.output.slice(outputLengthBefore);
484
484
  const result = newOutputChunks.join("").trim();
@@ -501,11 +501,11 @@ async function evaluateCondition(session, condElement) {
501
501
  }
502
502
  const outputLengthBefore = session.output.length;
503
503
  const args = [];
504
- const { integrate: integrate2 } = await import("./interpreter-XH3RFKVP.js");
504
+ const { integrate: integrate2 } = await import("./interpreter-B2GRYZ27.js");
505
505
  for (const child of condElement.children) {
506
506
  if (child.tag.toLowerCase() === "arg") {
507
507
  const argOutputStart = session.output.length;
508
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-XH3RFKVP.js");
508
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-B2GRYZ27.js");
509
509
  await integrateChildren2(session, child);
510
510
  const newChunks = session.output.slice(argOutputStart);
511
511
  const argValue = newChunks.join("");
@@ -725,7 +725,7 @@ async function executeLLM(session, element) {
725
725
  let systemPrompt = "";
726
726
  let currentUserPrompt = userPrompt;
727
727
  if (!noExtra) {
728
- const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-UBATJEND.js");
728
+ const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-5PEIMBGV.js");
729
729
  const subroutines = getAvailableSubroutines2(session);
730
730
  if (session.debug) {
731
731
  console.error(
@@ -897,7 +897,7 @@ ${result}
897
897
  const parser = new DiracParser();
898
898
  let dynamicAST = parser.parse(diracCode);
899
899
  if (validateTags) {
900
- const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-3RLLFTY6.js");
900
+ const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-AZXYIKQV.js");
901
901
  let validation = await validateDiracCode(session, dynamicAST, { autocorrect });
902
902
  let retryCount = 0;
903
903
  while (!validation.valid && retryCount < maxRetries) {
@@ -1119,10 +1119,21 @@ async function executeExecute(session, element) {
1119
1119
  if (!diracCode) {
1120
1120
  throw new Error(`<execute> source variable '${sourceAttr}' not found`);
1121
1121
  }
1122
- } else if (element.text) {
1123
- diracCode = substituteVariables(session, element.text);
1124
1122
  } else {
1125
- throw new Error("<execute> requires source attribute or text content");
1123
+ const hasElementChildren = element.children.some((child) => child.tag !== "");
1124
+ if (hasElementChildren) {
1125
+ const beforeOutput = session.output.length;
1126
+ for (const child of element.children) {
1127
+ await integrate(session, child);
1128
+ }
1129
+ const childOutput = session.output.slice(beforeOutput);
1130
+ diracCode = childOutput.join("");
1131
+ session.output = session.output.slice(0, beforeOutput);
1132
+ } else if (element.text) {
1133
+ diracCode = substituteVariables(session, element.text);
1134
+ } else {
1135
+ throw new Error("<execute> requires source attribute or text content");
1136
+ }
1126
1137
  }
1127
1138
  if (session.debug) {
1128
1139
  console.error(`[EXECUTE] Interpreting dynamic code:
@@ -1145,10 +1156,57 @@ ${diracCode}
1145
1156
  // src/tags/import.ts
1146
1157
  import { readFileSync, existsSync as existsSync3 } from "fs";
1147
1158
  import { resolve, dirname as dirname2, join as join2 } from "path";
1148
- function resolveImportPath(src, currentDir) {
1149
- if (src.startsWith("./") || src.startsWith("../") || src.startsWith("/")) {
1150
- const resolved2 = resolve(currentDir, src);
1151
- return resolved2.endsWith(".di") ? resolved2 : resolved2 + ".di";
1159
+ import { homedir as homedir2 } from "os";
1160
+ function resolveImportPath(src, currentDir, libraryPaths = []) {
1161
+ const ensureDiExtension = (path4) => path4.endsWith(".di") ? path4 : path4 + ".di";
1162
+ const tryResolveInBase = (basePath, modulePath) => {
1163
+ const fullPath = join2(basePath, modulePath);
1164
+ const withExtension = ensureDiExtension(fullPath);
1165
+ if (existsSync3(withExtension)) {
1166
+ return withExtension;
1167
+ }
1168
+ return null;
1169
+ };
1170
+ if (src.startsWith("/")) {
1171
+ const resolved = ensureDiExtension(src);
1172
+ if (existsSync3(resolved)) {
1173
+ return resolved;
1174
+ }
1175
+ throw new Error(`Absolute path not found: ${resolved}`);
1176
+ }
1177
+ if (src.startsWith("~/")) {
1178
+ const expanded = join2(homedir2(), src.slice(2));
1179
+ const resolved = ensureDiExtension(expanded);
1180
+ if (existsSync3(resolved)) {
1181
+ return resolved;
1182
+ }
1183
+ throw new Error(`Home path not found: ${resolved}`);
1184
+ }
1185
+ if (src.startsWith("./") || src.startsWith("../")) {
1186
+ const resolved = resolve(currentDir, src);
1187
+ const withExtension = ensureDiExtension(resolved);
1188
+ if (existsSync3(withExtension)) {
1189
+ return withExtension;
1190
+ }
1191
+ throw new Error(`Relative path not found: ${withExtension}`);
1192
+ }
1193
+ const diracLibs = process.env.DIRAC_LIBS;
1194
+ if (diracLibs) {
1195
+ const libPaths = diracLibs.split(":").filter((p) => p.trim());
1196
+ for (const libPath of libPaths) {
1197
+ const expandedLibPath = libPath.startsWith("~") ? join2(homedir2(), libPath.slice(1)) : libPath;
1198
+ const resolved = tryResolveInBase(expandedLibPath, src);
1199
+ if (resolved) {
1200
+ return resolved;
1201
+ }
1202
+ }
1203
+ }
1204
+ for (const libPath of libraryPaths) {
1205
+ const expandedLibPath = libPath.startsWith("~") ? join2(homedir2(), libPath.slice(1)) : libPath;
1206
+ const resolved = tryResolveInBase(expandedLibPath, src);
1207
+ if (resolved) {
1208
+ return resolved;
1209
+ }
1152
1210
  }
1153
1211
  let searchDir = currentDir;
1154
1212
  while (true) {
@@ -1175,7 +1233,7 @@ function resolveImportPath(src, currentDir) {
1175
1233
  return fallback;
1176
1234
  }
1177
1235
  }
1178
- throw new Error(`Package "${src}" found but no entry point (.di file) available`);
1236
+ throw new Error(`Package "${src}" found in node_modules but no entry point (.di file) available`);
1179
1237
  }
1180
1238
  const parentDir = dirname2(searchDir);
1181
1239
  if (parentDir === searchDir) {
@@ -1183,8 +1241,16 @@ function resolveImportPath(src, currentDir) {
1183
1241
  }
1184
1242
  searchDir = parentDir;
1185
1243
  }
1186
- const resolved = resolve(currentDir, src);
1187
- return resolved.endsWith(".di") ? resolved : resolved + ".di";
1244
+ throw new Error(`Module not found: ${src}
1245
+ Searched in:
1246
+ - Absolute/Home paths
1247
+ - Relative to: ${currentDir}
1248
+ - DIRAC_LIBS: ${diracLibs || "(not set)"}
1249
+ - libraryPaths: ${libraryPaths.join(", ") || "(none)"}
1250
+ - node_modules (walked up from ${currentDir})
1251
+
1252
+ Hint: Set DIRAC_LIBS environment variable for development (e.g., export DIRAC_LIBS=~/diraclang)
1253
+ Or add libraryPaths to config.yml for project-specific paths`);
1188
1254
  }
1189
1255
  async function executeImport(session, element) {
1190
1256
  const srcAttr = element.attributes.src;
@@ -1193,9 +1259,10 @@ async function executeImport(session, element) {
1193
1259
  }
1194
1260
  const src = substituteAttribute(session, srcAttr);
1195
1261
  const currentDir = session.currentFile ? dirname2(session.currentFile) : process.cwd();
1196
- const importPath = resolveImportPath(src, currentDir);
1262
+ const libraryPaths = session.libraryPaths || [];
1263
+ const importPath = resolveImportPath(src, currentDir, libraryPaths);
1197
1264
  if (session.debug) {
1198
- console.error(`[IMPORT] Loading: ${importPath}`);
1265
+ console.error(`[IMPORT] Resolved: ${src} -> ${importPath}`);
1199
1266
  }
1200
1267
  if (!session.importedFiles) {
1201
1268
  session.importedFiles = /* @__PURE__ */ new Set();
@@ -1441,7 +1508,7 @@ async function getBestTagMatch(candidate, allowed) {
1441
1508
  return { tag: allowed[bestIdx], score: bestScore };
1442
1509
  }
1443
1510
  async function executeTagCheck(session, element) {
1444
- const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-UBATJEND.js");
1511
+ const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-5PEIMBGV.js");
1445
1512
  const subroutines = getAvailableSubroutines2(session);
1446
1513
  const allowed = new Set(subroutines.map((s) => s.name));
1447
1514
  console.error("[tag-check] Allowed subroutines:", Array.from(allowed));
@@ -1534,7 +1601,7 @@ async function executeTagCheck(session, element) {
1534
1601
  const executeTag = correctedTag || tagName;
1535
1602
  console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
1536
1603
  const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
1537
- const { integrate: integrate2 } = await import("./interpreter-XH3RFKVP.js");
1604
+ const { integrate: integrate2 } = await import("./interpreter-B2GRYZ27.js");
1538
1605
  await integrate2(session, elementToExecute);
1539
1606
  }
1540
1607
  }
@@ -1543,7 +1610,7 @@ async function executeTagCheck(session, element) {
1543
1610
  // src/tags/throw.ts
1544
1611
  async function executeThrow(session, element) {
1545
1612
  const exceptionName = element.attributes?.name || "exception";
1546
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-XH3RFKVP.js");
1613
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-B2GRYZ27.js");
1547
1614
  const exceptionDom = {
1548
1615
  tag: "exception-content",
1549
1616
  attributes: { name: exceptionName },
@@ -1556,7 +1623,7 @@ async function executeThrow(session, element) {
1556
1623
  // src/tags/try.ts
1557
1624
  async function executeTry(session, element) {
1558
1625
  setExceptionBoundary(session);
1559
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-XH3RFKVP.js");
1626
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-B2GRYZ27.js");
1560
1627
  await integrateChildren2(session, element);
1561
1628
  unsetExceptionBoundary(session);
1562
1629
  }
@@ -1566,7 +1633,7 @@ async function executeCatch(session, element) {
1566
1633
  const exceptionName = element.attributes?.name || "exception";
1567
1634
  const caughtCount = lookupException(session, exceptionName);
1568
1635
  if (caughtCount > 0) {
1569
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-XH3RFKVP.js");
1636
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-B2GRYZ27.js");
1570
1637
  await integrateChildren2(session, element);
1571
1638
  }
1572
1639
  flushCurrentException(session);
@@ -1575,7 +1642,7 @@ async function executeCatch(session, element) {
1575
1642
  // src/tags/exception.ts
1576
1643
  async function executeException(session, element) {
1577
1644
  const exceptions = getCurrentExceptions(session);
1578
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-XH3RFKVP.js");
1645
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-B2GRYZ27.js");
1579
1646
  for (const exceptionDom of exceptions) {
1580
1647
  await integrateChildren2(session, exceptionDom);
1581
1648
  }
@@ -1904,14 +1971,18 @@ var SubroutineRegistry = class {
1904
1971
  }
1905
1972
  let tokenMatchCount = 0;
1906
1973
  for (const queryToken of queryTokens) {
1974
+ if (queryToken.length <= 2) {
1975
+ continue;
1976
+ }
1907
1977
  if (nameTokens.some((nt) => nt === queryToken)) {
1908
1978
  score += 40;
1909
1979
  tokenMatchCount++;
1910
- } else if (nameTokens.some((nt) => nt.includes(queryToken))) {
1980
+ } else if (nameTokens.some((nt) => nt.startsWith(queryToken))) {
1911
1981
  score += 20;
1912
1982
  tokenMatchCount++;
1913
1983
  }
1914
- if (lowerDesc.includes(queryToken)) {
1984
+ const descWords = lowerDesc.split(/[\s\-_]+/);
1985
+ if (descWords.some((w) => w === queryToken || w.startsWith(queryToken))) {
1915
1986
  score += 15;
1916
1987
  tokenMatchCount++;
1917
1988
  }
@@ -1920,7 +1991,7 @@ var SubroutineRegistry = class {
1920
1991
  if (lowerParamName === queryToken) {
1921
1992
  score += 10;
1922
1993
  tokenMatchCount++;
1923
- } else if (lowerParamName.includes(queryToken)) {
1994
+ } else if (lowerParamName.startsWith(queryToken)) {
1924
1995
  score += 5;
1925
1996
  }
1926
1997
  }
@@ -2038,7 +2109,7 @@ async function executeLoadContext(session, element) {
2038
2109
  query = element.text.trim();
2039
2110
  }
2040
2111
  if (!query && element.children.length > 0) {
2041
- const { integrate: integrate2 } = await import("./interpreter-XH3RFKVP.js");
2112
+ const { integrate: integrate2 } = await import("./interpreter-B2GRYZ27.js");
2042
2113
  const beforeOutput = session.output.length;
2043
2114
  for (const child of element.children) {
2044
2115
  await integrate2(session, child);
@@ -2107,7 +2178,7 @@ async function executeLoadContext(session, element) {
2107
2178
  parameters: s.parameters.map((p) => p.name),
2108
2179
  filePath: s.filePath
2109
2180
  }));
2110
- const { setVariable: setVariable2 } = await import("./session-UBATJEND.js");
2181
+ const { setVariable: setVariable2 } = await import("./session-5PEIMBGV.js");
2111
2182
  setVariable2(session, outputVar, JSON.stringify(summary, null, 2), false);
2112
2183
  }
2113
2184
  }
@@ -2115,7 +2186,7 @@ async function executeLoadContext(session, element) {
2115
2186
  // src/tags/save-subroutine.ts
2116
2187
  import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, existsSync as existsSync5 } from "fs";
2117
2188
  import { resolve as resolve2, dirname as dirname4, join as join4 } from "path";
2118
- import { homedir as homedir3 } from "os";
2189
+ import { homedir as homedir4 } from "os";
2119
2190
  async function executeSaveSubroutine(session, element) {
2120
2191
  const name = element.attributes.name;
2121
2192
  const file = element.attributes.file;
@@ -2144,11 +2215,11 @@ async function executeSaveSubroutine(session, element) {
2144
2215
  if (file) {
2145
2216
  filePath = resolve2(process.cwd(), file);
2146
2217
  } else if (pathAttr) {
2147
- const targetDir = join4(homedir3(), ".dirac", "lib", pathAttr);
2218
+ const targetDir = join4(homedir4(), ".dirac", "lib", pathAttr);
2148
2219
  filePath = join4(targetDir, `${name}.di`);
2149
2220
  } else {
2150
2221
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, -5);
2151
- const defaultDir = join4(homedir3(), ".dirac", "lib", timestamp);
2222
+ const defaultDir = join4(homedir4(), ".dirac", "lib", timestamp);
2152
2223
  filePath = join4(defaultDir, `${name}.di`);
2153
2224
  }
2154
2225
  const dir = dirname4(filePath);
@@ -2291,7 +2362,7 @@ async function executeForeach(session, element) {
2291
2362
  const parser2 = new DiracParser2();
2292
2363
  try {
2293
2364
  const fromElement = parser2.parse(fromAttr);
2294
- const { integrate: integrate2 } = await import("./interpreter-XH3RFKVP.js");
2365
+ const { integrate: integrate2 } = await import("./interpreter-B2GRYZ27.js");
2295
2366
  await integrate2(session, fromElement);
2296
2367
  } catch (e) {
2297
2368
  session.output = savedOutput;
@@ -2721,25 +2792,38 @@ async function executeSchedule(session, element) {
2721
2792
  }
2722
2793
  const taskElement = element;
2723
2794
  console.log(`[schedule] Starting task "${name}" (every ${intervalSeconds}s)`);
2724
- executeTask(session, taskElement, name).catch((err) => {
2795
+ let isRunning = false;
2796
+ executeTask(session, taskElement, name, () => isRunning, (value) => {
2797
+ isRunning = value;
2798
+ }).catch((err) => {
2725
2799
  console.error(`[schedule] Error in task "${name}":`, err.message);
2726
2800
  });
2727
2801
  const intervalId = setInterval(() => {
2728
- executeTask(session, taskElement, name).catch((err) => {
2802
+ executeTask(session, taskElement, name, () => isRunning, (value) => {
2803
+ isRunning = value;
2804
+ }).catch((err) => {
2729
2805
  console.error(`[schedule] Error in task "${name}":`, err.message);
2730
2806
  });
2731
2807
  }, intervalMs);
2732
2808
  scheduledTasks.set(name, {
2733
2809
  name,
2734
2810
  intervalId,
2735
- interval: intervalSeconds
2811
+ interval: intervalSeconds,
2812
+ isRunning: false
2736
2813
  });
2737
2814
  }
2738
- async function executeTask(session, element, name) {
2815
+ async function executeTask(session, element, name, getIsRunning, setIsRunning) {
2816
+ if (getIsRunning()) {
2817
+ console.log(`[schedule] Skipping task "${name}" - previous execution still running`);
2818
+ return;
2819
+ }
2820
+ setIsRunning(true);
2739
2821
  try {
2740
2822
  await integrateChildren(session, element);
2741
2823
  } catch (error) {
2742
2824
  console.error(`[schedule] Task "${name}" failed:`, error.message);
2825
+ } finally {
2826
+ setIsRunning(false);
2743
2827
  }
2744
2828
  }
2745
2829
  function stopScheduledTask(name) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  registerSubroutine
3
- } from "./chunk-GLXVY235.js";
3
+ } from "./chunk-A4SFB5W4.js";
4
4
 
5
5
  // src/tags/subroutine.ts
6
6
  function executeSubroutine(session, element) {
package/dist/cli.js CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  } from "./chunk-UEFKQRYN.js";
5
5
  import {
6
6
  execute
7
- } from "./chunk-TISVDOGD.js";
8
- import "./chunk-TXL3RV74.js";
7
+ } from "./chunk-OXJPF74W.js";
8
+ import "./chunk-QVS4OQHX.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
- import "./chunk-4QLTSCDG.js";
11
- import "./chunk-GLXVY235.js";
10
+ import "./chunk-ZY37RS4P.js";
11
+ import "./chunk-A4SFB5W4.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.48",
19
+ version: "0.1.50",
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-P52SBQWW.js");
99
+ const { DiracShell } = await import("./shell-PFR2L6TC.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.d.ts CHANGED
@@ -84,6 +84,7 @@ interface DiracSession {
84
84
  debug: boolean;
85
85
  currentFile?: string;
86
86
  importedFiles?: Set<string>;
87
+ libraryPaths?: string[];
87
88
  }
88
89
  interface DiracConfig {
89
90
  apiKey?: string;
@@ -96,6 +97,7 @@ interface DiracConfig {
96
97
  llmModel?: string;
97
98
  customLLMUrl?: string;
98
99
  initScript?: string;
100
+ libraryPaths?: string[];
99
101
  }
100
102
 
101
103
  /**
package/dist/index.js CHANGED
@@ -2,19 +2,19 @@ import {
2
2
  createLLMAdapter,
3
3
  execute,
4
4
  executeUserCommand
5
- } from "./chunk-TISVDOGD.js";
5
+ } from "./chunk-OXJPF74W.js";
6
6
  import {
7
7
  integrate
8
- } from "./chunk-TXL3RV74.js";
8
+ } from "./chunk-QVS4OQHX.js";
9
9
  import {
10
10
  DiracParser
11
11
  } from "./chunk-HRHAMPOB.js";
12
- import "./chunk-4QLTSCDG.js";
12
+ import "./chunk-ZY37RS4P.js";
13
13
  import {
14
14
  createSession,
15
15
  getAvailableSubroutines,
16
16
  getOutput
17
- } from "./chunk-GLXVY235.js";
17
+ } from "./chunk-A4SFB5W4.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-TXL3RV74.js";
4
+ } from "./chunk-QVS4OQHX.js";
5
5
  import "./chunk-HRHAMPOB.js";
6
- import "./chunk-4QLTSCDG.js";
7
- import "./chunk-GLXVY235.js";
6
+ import "./chunk-ZY37RS4P.js";
7
+ import "./chunk-A4SFB5W4.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-TXL3RV74.js";
6
+ } from "./chunk-QVS4OQHX.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
- import "./chunk-4QLTSCDG.js";
9
- import "./chunk-GLXVY235.js";
8
+ import "./chunk-ZY37RS4P.js";
9
+ import "./chunk-A4SFB5W4.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-GLXVY235.js";
29
+ } from "./chunk-A4SFB5W4.js";
30
30
  export {
31
31
  cleanSubroutinesToBoundary,
32
32
  cleanToBoundary,
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-UEFKQRYN.js";
5
5
  import {
6
6
  integrate
7
- } from "./chunk-TXL3RV74.js";
7
+ } from "./chunk-QVS4OQHX.js";
8
8
  import {
9
9
  DiracParser
10
10
  } from "./chunk-HRHAMPOB.js";
11
- import "./chunk-4QLTSCDG.js";
11
+ import "./chunk-ZY37RS4P.js";
12
12
  import {
13
13
  createSession
14
- } from "./chunk-GLXVY235.js";
14
+ } from "./chunk-A4SFB5W4.js";
15
15
 
16
16
  // src/shell.ts
17
17
  import * as readline from "readline";
@@ -131,7 +131,7 @@ var DiracShell = class {
131
131
  });
132
132
  this.rl.on("close", () => {
133
133
  this.saveHistory();
134
- import("./schedule-5HZCREEP.js").then(({ stopAllScheduledTasks }) => {
134
+ import("./schedule-3GZLMGAR.js").then(({ stopAllScheduledTasks }) => {
135
135
  stopAllScheduledTasks();
136
136
  console.log("\nGoodbye!");
137
137
  process.exit(0);
@@ -159,6 +159,13 @@ var DiracShell = class {
159
159
  this.rl.prompt();
160
160
  return;
161
161
  }
162
+ if (this.inputBuffer.length === 0 && input.trim().startsWith("?")) {
163
+ const rest = input.trim().substring(1).trim();
164
+ input = rest ? `|ai>${rest}` : `|ai>`;
165
+ if (this.config.debug) {
166
+ console.log(`[mapped: ? -> ${input}]`);
167
+ }
168
+ }
162
169
  if (this.inputBuffer.length === 0 && !this.isDiracSyntax(input)) {
163
170
  await this.executeShellCommand(input);
164
171
  this.rl.prompt();
@@ -445,7 +452,7 @@ Examples:
445
452
  break;
446
453
  case "tasks":
447
454
  try {
448
- const { listScheduledTasks } = await import("./schedule-5HZCREEP.js");
455
+ const { listScheduledTasks } = await import("./schedule-3GZLMGAR.js");
449
456
  const tasks = listScheduledTasks();
450
457
  if (tasks.length === 0) {
451
458
  console.log("No scheduled tasks running.");
@@ -464,7 +471,7 @@ Examples:
464
471
  console.log("Usage: :stop <task-name>");
465
472
  } else {
466
473
  try {
467
- const { stopScheduledTask } = await import("./schedule-5HZCREEP.js");
474
+ const { stopScheduledTask } = await import("./schedule-3GZLMGAR.js");
468
475
  const taskName = args[0];
469
476
  const stopped = stopScheduledTask(taskName);
470
477
  if (stopped) {
@@ -479,7 +486,7 @@ Examples:
479
486
  break;
480
487
  case "stopall":
481
488
  try {
482
- const { stopAllScheduledTasks } = await import("./schedule-5HZCREEP.js");
489
+ const { stopAllScheduledTasks } = await import("./schedule-3GZLMGAR.js");
483
490
  stopAllScheduledTasks();
484
491
  console.log("All scheduled tasks stopped.");
485
492
  } catch (error) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeSubroutine
3
- } from "./chunk-4QLTSCDG.js";
4
- import "./chunk-GLXVY235.js";
3
+ } from "./chunk-ZY37RS4P.js";
4
+ import "./chunk-A4SFB5W4.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-UBATJEND.js");
52
+ const { getAvailableSubroutines } = await import("./session-5PEIMBGV.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-TXL3RV74.js";
3
+ } from "./chunk-QVS4OQHX.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
7
- import "./chunk-4QLTSCDG.js";
7
+ import "./chunk-ZY37RS4P.js";
8
8
  import {
9
9
  createSession,
10
10
  getOutput
11
- } from "./chunk-GLXVY235.js";
11
+ } from "./chunk-A4SFB5W4.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.48",
3
+ "version": "0.1.50",
4
4
  "description": "LLM-Augmented Declarative Execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",