dirac-lang 0.1.48 → 0.1.49
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-GLXVY235.js → chunk-A4SFB5W4.js} +2 -1
- package/dist/{chunk-TISVDOGD.js → chunk-GKUTLPQJ.js} +2 -2
- package/dist/{chunk-TXL3RV74.js → chunk-IWNHCL6E.js} +118 -38
- package/dist/{chunk-4QLTSCDG.js → chunk-ZY37RS4P.js} +1 -1
- package/dist/cli.js +5 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -4
- package/dist/{interpreter-XH3RFKVP.js → interpreter-54YLI2PC.js} +3 -3
- package/dist/{schedule-5HZCREEP.js → schedule-TRNPB73K.js} +3 -3
- package/dist/{session-UBATJEND.js → session-5PEIMBGV.js} +1 -1
- package/dist/{shell-P52SBQWW.js → shell-S5BLB32A.js} +7 -7
- package/dist/{subroutine-V4D4LQIH.js → subroutine-VIACWZPF.js} +2 -2
- package/dist/{tag-validator-3RLLFTY6.js → tag-validator-AZXYIKQV.js} +1 -1
- package/dist/test-runner.js +3 -3
- package/package.json +1 -1
|
@@ -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-
|
|
3
|
+
} from "./chunk-IWNHCL6E.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-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-
|
|
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-
|
|
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-
|
|
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-
|
|
463
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-54YLI2PC.js");
|
|
464
464
|
await integrateChildren2(session, thenElement);
|
|
465
465
|
}
|
|
466
466
|
} else {
|
|
467
467
|
if (elseElement) {
|
|
468
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
468
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-54YLI2PC.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-
|
|
481
|
+
const { integrate: integrate2 } = await import("./interpreter-54YLI2PC.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-
|
|
504
|
+
const { integrate: integrate2 } = await import("./interpreter-54YLI2PC.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-
|
|
508
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-54YLI2PC.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-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
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
|
-
|
|
1187
|
-
|
|
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
|
|
1262
|
+
const libraryPaths = session.libraryPaths || [];
|
|
1263
|
+
const importPath = resolveImportPath(src, currentDir, libraryPaths);
|
|
1197
1264
|
if (session.debug) {
|
|
1198
|
-
console.error(`[IMPORT]
|
|
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-
|
|
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-
|
|
1604
|
+
const { integrate: integrate2 } = await import("./interpreter-54YLI2PC.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-
|
|
1613
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-54YLI2PC.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-
|
|
1626
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-54YLI2PC.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-
|
|
1636
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-54YLI2PC.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-
|
|
1645
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-54YLI2PC.js");
|
|
1579
1646
|
for (const exceptionDom of exceptions) {
|
|
1580
1647
|
await integrateChildren2(session, exceptionDom);
|
|
1581
1648
|
}
|
|
@@ -2038,7 +2105,7 @@ async function executeLoadContext(session, element) {
|
|
|
2038
2105
|
query = element.text.trim();
|
|
2039
2106
|
}
|
|
2040
2107
|
if (!query && element.children.length > 0) {
|
|
2041
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
2108
|
+
const { integrate: integrate2 } = await import("./interpreter-54YLI2PC.js");
|
|
2042
2109
|
const beforeOutput = session.output.length;
|
|
2043
2110
|
for (const child of element.children) {
|
|
2044
2111
|
await integrate2(session, child);
|
|
@@ -2107,7 +2174,7 @@ async function executeLoadContext(session, element) {
|
|
|
2107
2174
|
parameters: s.parameters.map((p) => p.name),
|
|
2108
2175
|
filePath: s.filePath
|
|
2109
2176
|
}));
|
|
2110
|
-
const { setVariable: setVariable2 } = await import("./session-
|
|
2177
|
+
const { setVariable: setVariable2 } = await import("./session-5PEIMBGV.js");
|
|
2111
2178
|
setVariable2(session, outputVar, JSON.stringify(summary, null, 2), false);
|
|
2112
2179
|
}
|
|
2113
2180
|
}
|
|
@@ -2115,7 +2182,7 @@ async function executeLoadContext(session, element) {
|
|
|
2115
2182
|
// src/tags/save-subroutine.ts
|
|
2116
2183
|
import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, existsSync as existsSync5 } from "fs";
|
|
2117
2184
|
import { resolve as resolve2, dirname as dirname4, join as join4 } from "path";
|
|
2118
|
-
import { homedir as
|
|
2185
|
+
import { homedir as homedir4 } from "os";
|
|
2119
2186
|
async function executeSaveSubroutine(session, element) {
|
|
2120
2187
|
const name = element.attributes.name;
|
|
2121
2188
|
const file = element.attributes.file;
|
|
@@ -2144,11 +2211,11 @@ async function executeSaveSubroutine(session, element) {
|
|
|
2144
2211
|
if (file) {
|
|
2145
2212
|
filePath = resolve2(process.cwd(), file);
|
|
2146
2213
|
} else if (pathAttr) {
|
|
2147
|
-
const targetDir = join4(
|
|
2214
|
+
const targetDir = join4(homedir4(), ".dirac", "lib", pathAttr);
|
|
2148
2215
|
filePath = join4(targetDir, `${name}.di`);
|
|
2149
2216
|
} else {
|
|
2150
2217
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, -5);
|
|
2151
|
-
const defaultDir = join4(
|
|
2218
|
+
const defaultDir = join4(homedir4(), ".dirac", "lib", timestamp);
|
|
2152
2219
|
filePath = join4(defaultDir, `${name}.di`);
|
|
2153
2220
|
}
|
|
2154
2221
|
const dir = dirname4(filePath);
|
|
@@ -2291,7 +2358,7 @@ async function executeForeach(session, element) {
|
|
|
2291
2358
|
const parser2 = new DiracParser2();
|
|
2292
2359
|
try {
|
|
2293
2360
|
const fromElement = parser2.parse(fromAttr);
|
|
2294
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
2361
|
+
const { integrate: integrate2 } = await import("./interpreter-54YLI2PC.js");
|
|
2295
2362
|
await integrate2(session, fromElement);
|
|
2296
2363
|
} catch (e) {
|
|
2297
2364
|
session.output = savedOutput;
|
|
@@ -2721,25 +2788,38 @@ async function executeSchedule(session, element) {
|
|
|
2721
2788
|
}
|
|
2722
2789
|
const taskElement = element;
|
|
2723
2790
|
console.log(`[schedule] Starting task "${name}" (every ${intervalSeconds}s)`);
|
|
2724
|
-
|
|
2791
|
+
let isRunning = false;
|
|
2792
|
+
executeTask(session, taskElement, name, () => isRunning, (value) => {
|
|
2793
|
+
isRunning = value;
|
|
2794
|
+
}).catch((err) => {
|
|
2725
2795
|
console.error(`[schedule] Error in task "${name}":`, err.message);
|
|
2726
2796
|
});
|
|
2727
2797
|
const intervalId = setInterval(() => {
|
|
2728
|
-
executeTask(session, taskElement, name)
|
|
2798
|
+
executeTask(session, taskElement, name, () => isRunning, (value) => {
|
|
2799
|
+
isRunning = value;
|
|
2800
|
+
}).catch((err) => {
|
|
2729
2801
|
console.error(`[schedule] Error in task "${name}":`, err.message);
|
|
2730
2802
|
});
|
|
2731
2803
|
}, intervalMs);
|
|
2732
2804
|
scheduledTasks.set(name, {
|
|
2733
2805
|
name,
|
|
2734
2806
|
intervalId,
|
|
2735
|
-
interval: intervalSeconds
|
|
2807
|
+
interval: intervalSeconds,
|
|
2808
|
+
isRunning: false
|
|
2736
2809
|
});
|
|
2737
2810
|
}
|
|
2738
|
-
async function executeTask(session, element, name) {
|
|
2811
|
+
async function executeTask(session, element, name, getIsRunning, setIsRunning) {
|
|
2812
|
+
if (getIsRunning()) {
|
|
2813
|
+
console.log(`[schedule] Skipping task "${name}" - previous execution still running`);
|
|
2814
|
+
return;
|
|
2815
|
+
}
|
|
2816
|
+
setIsRunning(true);
|
|
2739
2817
|
try {
|
|
2740
2818
|
await integrateChildren(session, element);
|
|
2741
2819
|
} catch (error) {
|
|
2742
2820
|
console.error(`[schedule] Task "${name}" failed:`, error.message);
|
|
2821
|
+
} finally {
|
|
2822
|
+
setIsRunning(false);
|
|
2743
2823
|
}
|
|
2744
2824
|
}
|
|
2745
2825
|
function stopScheduledTask(name) {
|
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-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-GKUTLPQJ.js";
|
|
8
|
+
import "./chunk-IWNHCL6E.js";
|
|
9
9
|
import "./chunk-HRHAMPOB.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-ZY37RS4P.js";
|
|
11
|
+
import "./chunk-A4SFB5W4.js";
|
|
12
12
|
|
|
13
13
|
// src/cli.ts
|
|
14
14
|
import "dotenv/config";
|
|
@@ -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-
|
|
99
|
+
const { DiracShell } = await import("./shell-S5BLB32A.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-
|
|
5
|
+
} from "./chunk-GKUTLPQJ.js";
|
|
6
6
|
import {
|
|
7
7
|
integrate
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IWNHCL6E.js";
|
|
9
9
|
import {
|
|
10
10
|
DiracParser
|
|
11
11
|
} from "./chunk-HRHAMPOB.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-ZY37RS4P.js";
|
|
13
13
|
import {
|
|
14
14
|
createSession,
|
|
15
15
|
getAvailableSubroutines,
|
|
16
16
|
getOutput
|
|
17
|
-
} from "./chunk-
|
|
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-
|
|
4
|
+
} from "./chunk-IWNHCL6E.js";
|
|
5
5
|
import "./chunk-HRHAMPOB.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
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-
|
|
6
|
+
} from "./chunk-IWNHCL6E.js";
|
|
7
7
|
import "./chunk-HRHAMPOB.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-ZY37RS4P.js";
|
|
9
|
+
import "./chunk-A4SFB5W4.js";
|
|
10
10
|
export {
|
|
11
11
|
executeSchedule,
|
|
12
12
|
listScheduledTasks,
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
} from "./chunk-UEFKQRYN.js";
|
|
5
5
|
import {
|
|
6
6
|
integrate
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IWNHCL6E.js";
|
|
8
8
|
import {
|
|
9
9
|
DiracParser
|
|
10
10
|
} from "./chunk-HRHAMPOB.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-ZY37RS4P.js";
|
|
12
12
|
import {
|
|
13
13
|
createSession
|
|
14
|
-
} from "./chunk-
|
|
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-
|
|
134
|
+
import("./schedule-TRNPB73K.js").then(({ stopAllScheduledTasks }) => {
|
|
135
135
|
stopAllScheduledTasks();
|
|
136
136
|
console.log("\nGoodbye!");
|
|
137
137
|
process.exit(0);
|
|
@@ -445,7 +445,7 @@ Examples:
|
|
|
445
445
|
break;
|
|
446
446
|
case "tasks":
|
|
447
447
|
try {
|
|
448
|
-
const { listScheduledTasks } = await import("./schedule-
|
|
448
|
+
const { listScheduledTasks } = await import("./schedule-TRNPB73K.js");
|
|
449
449
|
const tasks = listScheduledTasks();
|
|
450
450
|
if (tasks.length === 0) {
|
|
451
451
|
console.log("No scheduled tasks running.");
|
|
@@ -464,7 +464,7 @@ Examples:
|
|
|
464
464
|
console.log("Usage: :stop <task-name>");
|
|
465
465
|
} else {
|
|
466
466
|
try {
|
|
467
|
-
const { stopScheduledTask } = await import("./schedule-
|
|
467
|
+
const { stopScheduledTask } = await import("./schedule-TRNPB73K.js");
|
|
468
468
|
const taskName = args[0];
|
|
469
469
|
const stopped = stopScheduledTask(taskName);
|
|
470
470
|
if (stopped) {
|
|
@@ -479,7 +479,7 @@ Examples:
|
|
|
479
479
|
break;
|
|
480
480
|
case "stopall":
|
|
481
481
|
try {
|
|
482
|
-
const { stopAllScheduledTasks } = await import("./schedule-
|
|
482
|
+
const { stopAllScheduledTasks } = await import("./schedule-TRNPB73K.js");
|
|
483
483
|
stopAllScheduledTasks();
|
|
484
484
|
console.log("All scheduled tasks stopped.");
|
|
485
485
|
} catch (error) {
|
|
@@ -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-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;
|
package/dist/test-runner.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
integrate
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IWNHCL6E.js";
|
|
4
4
|
import {
|
|
5
5
|
DiracParser
|
|
6
6
|
} from "./chunk-HRHAMPOB.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-ZY37RS4P.js";
|
|
8
8
|
import {
|
|
9
9
|
createSession,
|
|
10
10
|
getOutput
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-A4SFB5W4.js";
|
|
12
12
|
|
|
13
13
|
// src/test-runner.ts
|
|
14
14
|
import fs from "fs";
|