dirac-lang 0.1.31 → 0.1.32
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.
- package/dist/{chunk-SIGINKX3.js → chunk-JIWLKB5O.js} +3 -1
- package/dist/{chunk-FWD3RMQ7.js → chunk-JMUUPZZA.js} +1 -1
- package/dist/{chunk-MAPD5UUF.js → chunk-UYDP4ZFS.js} +2 -2
- package/dist/{chunk-YAGJPLVS.js → chunk-YRJ3SODI.js} +20 -19
- package/dist/cli.js +5 -5
- package/dist/index.js +4 -4
- package/dist/{interpreter-CEGW4F6U.js → interpreter-WP3KMLST.js} +3 -3
- package/dist/{session-2OG5LRD4.js → session-UIWHLPTR.js} +1 -1
- package/dist/{subroutine-W2MI62EG.js → subroutine-I5XXJMFL.js} +2 -2
- package/dist/{tag-validator-3GP2CEDC.js → tag-validator-QX47WU2J.js} +1 -1
- package/dist/test-runner.js +3 -3
- package/package.json +1 -1
|
@@ -107,7 +107,9 @@ function createSession(config = {}) {
|
|
|
107
107
|
isReturn: false,
|
|
108
108
|
isBreak: false,
|
|
109
109
|
skipSubroutineRegistration: false,
|
|
110
|
-
debug: config.debug || false
|
|
110
|
+
debug: config.debug || false,
|
|
111
|
+
currentFile: config.filePath
|
|
112
|
+
// Set current file from config for proper relative import resolution
|
|
111
113
|
};
|
|
112
114
|
}
|
|
113
115
|
function setVariable(session, name, value, visible = false) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
integrate
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YRJ3SODI.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-
|
|
11
|
+
} from "./chunk-JIWLKB5O.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-
|
|
6
|
+
} from "./chunk-JMUUPZZA.js";
|
|
7
7
|
import {
|
|
8
8
|
cleanSubroutinesToBoundary,
|
|
9
9
|
cleanToBoundary,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
substituteVariables,
|
|
26
26
|
throwException,
|
|
27
27
|
unsetExceptionBoundary
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-JIWLKB5O.js";
|
|
29
29
|
|
|
30
30
|
// src/tags/parameters.ts
|
|
31
31
|
async function executeParameters(session, element) {
|
|
@@ -257,7 +257,7 @@ async function executeCall(session, element) {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
async function registerExtendChain(session, subroutine, currentName) {
|
|
260
|
-
const { executeSubroutine: executeSubroutine2 } = await import("./subroutine-
|
|
260
|
+
const { executeSubroutine: executeSubroutine2 } = await import("./subroutine-I5XXJMFL.js");
|
|
261
261
|
const extendsAttr = subroutine.attributes.extends;
|
|
262
262
|
let parentName;
|
|
263
263
|
if (extendsAttr) {
|
|
@@ -425,12 +425,12 @@ async function executeIf(session, element) {
|
|
|
425
425
|
const condition = await evaluatePredicate(session, conditionElement);
|
|
426
426
|
if (condition) {
|
|
427
427
|
if (thenElement) {
|
|
428
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
428
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-WP3KMLST.js");
|
|
429
429
|
await integrateChildren2(session, thenElement);
|
|
430
430
|
}
|
|
431
431
|
} else {
|
|
432
432
|
if (elseElement) {
|
|
433
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
433
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-WP3KMLST.js");
|
|
434
434
|
await integrateChildren2(session, elseElement);
|
|
435
435
|
}
|
|
436
436
|
}
|
|
@@ -443,7 +443,7 @@ async function evaluatePredicate(session, predicateElement) {
|
|
|
443
443
|
return await evaluateCondition(session, predicateElement);
|
|
444
444
|
}
|
|
445
445
|
const outputLengthBefore = session.output.length;
|
|
446
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
446
|
+
const { integrate: integrate2 } = await import("./interpreter-WP3KMLST.js");
|
|
447
447
|
await integrate2(session, predicateElement);
|
|
448
448
|
const newOutputChunks = session.output.slice(outputLengthBefore);
|
|
449
449
|
const result = newOutputChunks.join("").trim();
|
|
@@ -466,11 +466,11 @@ async function evaluateCondition(session, condElement) {
|
|
|
466
466
|
}
|
|
467
467
|
const outputLengthBefore = session.output.length;
|
|
468
468
|
const args = [];
|
|
469
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
469
|
+
const { integrate: integrate2 } = await import("./interpreter-WP3KMLST.js");
|
|
470
470
|
for (const child of condElement.children) {
|
|
471
471
|
if (child.tag.toLowerCase() === "arg") {
|
|
472
472
|
const argOutputStart = session.output.length;
|
|
473
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
473
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-WP3KMLST.js");
|
|
474
474
|
await integrateChildren2(session, child);
|
|
475
475
|
const newChunks = session.output.slice(argOutputStart);
|
|
476
476
|
const argValue = newChunks.join("");
|
|
@@ -579,7 +579,7 @@ async function executeLLM(session, element) {
|
|
|
579
579
|
console.error("[LLM] Full prompt sent to LLM (noextra):\n" + prompt + "\n");
|
|
580
580
|
}
|
|
581
581
|
} else {
|
|
582
|
-
const { getAvailableSubroutines } = await import("./session-
|
|
582
|
+
const { getAvailableSubroutines } = await import("./session-UIWHLPTR.js");
|
|
583
583
|
const subroutines = getAvailableSubroutines(session);
|
|
584
584
|
if (session.debug) {
|
|
585
585
|
console.error(
|
|
@@ -706,7 +706,7 @@ ${result}
|
|
|
706
706
|
const parser = new DiracParser();
|
|
707
707
|
let dynamicAST = parser.parse(diracCode);
|
|
708
708
|
if (validateTags) {
|
|
709
|
-
const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-
|
|
709
|
+
const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-QX47WU2J.js");
|
|
710
710
|
let validation = await validateDiracCode(session, dynamicAST, { autocorrect });
|
|
711
711
|
let retryCount = 0;
|
|
712
712
|
while (!validation.valid && retryCount < maxRetries) {
|
|
@@ -987,10 +987,11 @@ function resolveImportPath(src, currentDir) {
|
|
|
987
987
|
return resolved.endsWith(".di") ? resolved : resolved + ".di";
|
|
988
988
|
}
|
|
989
989
|
async function executeImport(session, element) {
|
|
990
|
-
const
|
|
991
|
-
if (!
|
|
990
|
+
const srcAttr = element.attributes.src;
|
|
991
|
+
if (!srcAttr) {
|
|
992
992
|
throw new Error("<import> requires src attribute");
|
|
993
993
|
}
|
|
994
|
+
const src = substituteAttribute(session, srcAttr);
|
|
994
995
|
const currentDir = session.currentFile ? dirname2(session.currentFile) : process.cwd();
|
|
995
996
|
const importPath = resolveImportPath(src, currentDir);
|
|
996
997
|
if (session.debug) {
|
|
@@ -1236,7 +1237,7 @@ async function getBestTagMatch(candidate, allowed) {
|
|
|
1236
1237
|
return { tag: allowed[bestIdx], score: bestScore };
|
|
1237
1238
|
}
|
|
1238
1239
|
async function executeTagCheck(session, element) {
|
|
1239
|
-
const { getAvailableSubroutines } = await import("./session-
|
|
1240
|
+
const { getAvailableSubroutines } = await import("./session-UIWHLPTR.js");
|
|
1240
1241
|
const subroutines = getAvailableSubroutines(session);
|
|
1241
1242
|
const allowed = new Set(subroutines.map((s) => s.name));
|
|
1242
1243
|
console.error("[tag-check] Allowed subroutines:", Array.from(allowed));
|
|
@@ -1329,7 +1330,7 @@ async function executeTagCheck(session, element) {
|
|
|
1329
1330
|
const executeTag = correctedTag || tagName;
|
|
1330
1331
|
console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
|
|
1331
1332
|
const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
|
|
1332
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
1333
|
+
const { integrate: integrate2 } = await import("./interpreter-WP3KMLST.js");
|
|
1333
1334
|
await integrate2(session, elementToExecute);
|
|
1334
1335
|
}
|
|
1335
1336
|
}
|
|
@@ -1338,7 +1339,7 @@ async function executeTagCheck(session, element) {
|
|
|
1338
1339
|
// src/tags/throw.ts
|
|
1339
1340
|
async function executeThrow(session, element) {
|
|
1340
1341
|
const exceptionName = element.attributes?.name || "exception";
|
|
1341
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1342
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-WP3KMLST.js");
|
|
1342
1343
|
const exceptionDom = {
|
|
1343
1344
|
tag: "exception-content",
|
|
1344
1345
|
attributes: { name: exceptionName },
|
|
@@ -1351,7 +1352,7 @@ async function executeThrow(session, element) {
|
|
|
1351
1352
|
// src/tags/try.ts
|
|
1352
1353
|
async function executeTry(session, element) {
|
|
1353
1354
|
setExceptionBoundary(session);
|
|
1354
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1355
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-WP3KMLST.js");
|
|
1355
1356
|
await integrateChildren2(session, element);
|
|
1356
1357
|
unsetExceptionBoundary(session);
|
|
1357
1358
|
}
|
|
@@ -1361,7 +1362,7 @@ async function executeCatch(session, element) {
|
|
|
1361
1362
|
const exceptionName = element.attributes?.name || "exception";
|
|
1362
1363
|
const caughtCount = lookupException(session, exceptionName);
|
|
1363
1364
|
if (caughtCount > 0) {
|
|
1364
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1365
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-WP3KMLST.js");
|
|
1365
1366
|
await integrateChildren2(session, element);
|
|
1366
1367
|
}
|
|
1367
1368
|
flushCurrentException(session);
|
|
@@ -1370,7 +1371,7 @@ async function executeCatch(session, element) {
|
|
|
1370
1371
|
// src/tags/exception.ts
|
|
1371
1372
|
async function executeException(session, element) {
|
|
1372
1373
|
const exceptions = getCurrentExceptions(session);
|
|
1373
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1374
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-WP3KMLST.js");
|
|
1374
1375
|
for (const exceptionDom of exceptions) {
|
|
1375
1376
|
await integrateChildren2(session, exceptionDom);
|
|
1376
1377
|
}
|
|
@@ -1510,7 +1511,7 @@ async function executeForeach(session, element) {
|
|
|
1510
1511
|
const parser2 = new DiracParser2();
|
|
1511
1512
|
try {
|
|
1512
1513
|
const fromElement = parser2.parse(fromAttr);
|
|
1513
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
1514
|
+
const { integrate: integrate2 } = await import("./interpreter-WP3KMLST.js");
|
|
1514
1515
|
await integrate2(session, fromElement);
|
|
1515
1516
|
} catch (e) {
|
|
1516
1517
|
session.output = savedOutput;
|
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
execute
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-UYDP4ZFS.js";
|
|
5
|
+
import "./chunk-YRJ3SODI.js";
|
|
6
6
|
import "./chunk-HRHAMPOB.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-JMUUPZZA.js";
|
|
8
|
+
import "./chunk-JIWLKB5O.js";
|
|
9
9
|
|
|
10
10
|
// src/cli.ts
|
|
11
11
|
import "dotenv/config";
|
|
@@ -13,7 +13,7 @@ import "dotenv/config";
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "dirac-lang",
|
|
16
|
-
version: "0.1.
|
|
16
|
+
version: "0.1.32",
|
|
17
17
|
description: "LLM-Augmented Declarative Execution",
|
|
18
18
|
type: "module",
|
|
19
19
|
main: "dist/index.js",
|
package/dist/index.js
CHANGED
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
createLLMAdapter,
|
|
3
3
|
execute,
|
|
4
4
|
executeUserCommand
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UYDP4ZFS.js";
|
|
6
6
|
import {
|
|
7
7
|
integrate
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YRJ3SODI.js";
|
|
9
9
|
import {
|
|
10
10
|
DiracParser
|
|
11
11
|
} from "./chunk-HRHAMPOB.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-JMUUPZZA.js";
|
|
13
13
|
import {
|
|
14
14
|
createSession,
|
|
15
15
|
getAvailableSubroutines,
|
|
16
16
|
getOutput
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-JIWLKB5O.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-
|
|
4
|
+
} from "./chunk-YRJ3SODI.js";
|
|
5
5
|
import "./chunk-HRHAMPOB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-JMUUPZZA.js";
|
|
7
|
+
import "./chunk-JIWLKB5O.js";
|
|
8
8
|
export {
|
|
9
9
|
integrate,
|
|
10
10
|
integrateChildren
|
|
@@ -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-
|
|
52
|
+
const { getAvailableSubroutines } = await import("./session-UIWHLPTR.js");
|
|
53
53
|
const subroutines = getAvailableSubroutines(session);
|
|
54
54
|
const allowed = new Set(subroutines.map((s) => s.name));
|
|
55
55
|
const tagName = element.tag;
|
package/dist/test-runner.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
integrate
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YRJ3SODI.js";
|
|
4
4
|
import {
|
|
5
5
|
DiracParser
|
|
6
6
|
} from "./chunk-HRHAMPOB.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-JMUUPZZA.js";
|
|
8
8
|
import {
|
|
9
9
|
createSession,
|
|
10
10
|
getOutput
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JIWLKB5O.js";
|
|
12
12
|
|
|
13
13
|
// src/test-runner.ts
|
|
14
14
|
import fs from "fs";
|