dirac-lang 0.1.98 → 0.1.100
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/README.md +15 -0
- package/dist/{agent-5Q5MQOV2.js → agent-CWCOOLLO.js} +5 -5
- package/dist/{chunk-SLGJRZ3P.js → chunk-53QJQ2CC.js} +1 -1
- package/dist/{chunk-MYWEN36N.js → chunk-7MSWEFH5.js} +2 -2
- package/dist/{chunk-ECAW4X46.js → chunk-EAM7IZWA.js} +1 -1
- package/dist/{chunk-LAEYP4OQ.js → chunk-OUCAV57A.js} +63 -21
- package/dist/{chunk-33DMGFRM.js → chunk-TIQ36H2U.js} +2 -2
- package/dist/{chunk-PPH7KYKH.js → chunk-ZYSWVMID.js} +6 -0
- package/dist/cli.js +12 -12
- package/dist/{cron-VCUFU2WU.js → cron-3W32GKBD.js} +4 -4
- package/dist/index.js +5 -5
- package/dist/interpreter-KOWJFLNS.js +12 -0
- package/dist/{run-at-P43PK5JU.js → run-at-S37OQ7RA.js} +4 -4
- package/dist/{schedule-3EJJHG3B.js → schedule-6RWIIII3.js} +4 -4
- package/dist/{session-IH5LO7FS.js → session-6WX5O74B.js} +3 -1
- package/dist/{session-server-N53QIJO5.js → session-server-QXL2SQWJ.js} +5 -5
- package/dist/{shell-KNEQHL3Y.js → shell-GXXSZYY7.js} +147 -15
- package/dist/{subroutine-7JJKHTV4.js → subroutine-O3YGYHRZ.js} +2 -2
- package/dist/{subroutine-index-RVJSWWJ7.js → subroutine-index-GB3OSH56.js} +2 -2
- package/dist/subroutine-serializer-LNFHABUC.js +160 -0
- package/dist/{tag-validator-DS7OCXCG.js → tag-validator-PWJG4OAM.js} +60 -28
- package/dist/test-runner.js +4 -4
- package/lib/native-tags.di +2 -1
- package/package.json +1 -1
- package/dist/interpreter-D6ZF3OJA.js +0 -12
package/README.md
CHANGED
|
@@ -252,6 +252,21 @@ Dirac is more than a language—it's a **paradigm shift** in how we think about
|
|
|
252
252
|
npm install -g dirac-lang
|
|
253
253
|
```
|
|
254
254
|
|
|
255
|
+
## Documentation
|
|
256
|
+
|
|
257
|
+
For detailed guides on using Dirac:
|
|
258
|
+
|
|
259
|
+
- **[Getting Started](GETTING-STARTED.md)** - Installation and first programs
|
|
260
|
+
- **[Quick Start Library Guide](QUICKSTART-LIBRARY.md)** - Building reusable libraries
|
|
261
|
+
- **[LLM Integration](LLM-DIALOG-CONTEXT.md)** - Working with LLMs in Dirac
|
|
262
|
+
- **[Subroutine Management](SUBROUTINE-MANAGEMENT.md)** - Stack operations and subroutine control
|
|
263
|
+
- **[Training Data Export](TRAINING-DATA-EXPORT.md)** - Creating fine-tuning datasets
|
|
264
|
+
- **[Debugging](DEBUGGING.md)** - Debug mode and troubleshooting
|
|
265
|
+
- **[Exception Handling](EXCEPTION-HANDLING.md)** - Error handling and recovery
|
|
266
|
+
- **[Namespaces](NAMESPACES.md)** - Organizing code with namespaces
|
|
267
|
+
- **[Libraries](LIBRARIES.md)** - Using and creating libraries
|
|
268
|
+
- **[Conditional Tags](CONDITIONAL-TAGS.md)** - Control flow patterns
|
|
269
|
+
|
|
255
270
|
---
|
|
256
271
|
|
|
257
272
|
*"In the quantum realm, a bra meets a ket to produce reality. In Dirac, a declaration meets an LLM to produce execution."*
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
SessionServer,
|
|
3
3
|
getSocketPath,
|
|
4
4
|
isSessionRunning
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-TIQ36H2U.js";
|
|
6
|
+
import "./chunk-OUCAV57A.js";
|
|
7
|
+
import "./chunk-53QJQ2CC.js";
|
|
8
8
|
import "./chunk-HRHAMPOB.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-EAM7IZWA.js";
|
|
10
|
+
import "./chunk-ZYSWVMID.js";
|
|
11
11
|
|
|
12
12
|
// src/agent.ts
|
|
13
13
|
import fs from "fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
integrate
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OUCAV57A.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-ZYSWVMID.js";
|
|
12
12
|
|
|
13
13
|
// src/utils/llm-adapter.ts
|
|
14
14
|
function createLLMAdapter(session) {
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
executeRegistryStats,
|
|
4
4
|
executeSearchSubroutines,
|
|
5
5
|
registry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-53QJQ2CC.js";
|
|
7
7
|
import {
|
|
8
8
|
DiracParser
|
|
9
9
|
} from "./chunk-HRHAMPOB.js";
|
|
10
10
|
import {
|
|
11
11
|
executeSubroutine
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EAM7IZWA.js";
|
|
13
13
|
import {
|
|
14
14
|
CustomLLMProvider,
|
|
15
15
|
OllamaProvider,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
substituteVariables,
|
|
35
35
|
throwException,
|
|
36
36
|
unsetExceptionBoundary
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-ZYSWVMID.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-
|
|
300
|
+
const { executeSubroutine: executeSubroutine2 } = await import("./subroutine-O3YGYHRZ.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-
|
|
490
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
|
|
491
491
|
await integrateChildren2(session, thenElement);
|
|
492
492
|
}
|
|
493
493
|
} else {
|
|
494
494
|
if (elseElement) {
|
|
495
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
495
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.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-
|
|
508
|
+
const { integrate: integrate2 } = await import("./interpreter-KOWJFLNS.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-
|
|
531
|
+
const { integrate: integrate2 } = await import("./interpreter-KOWJFLNS.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-
|
|
535
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
|
|
536
536
|
await integrateChildren2(session, child);
|
|
537
537
|
const newChunks = session.output.slice(argOutputStart);
|
|
538
538
|
const argValue = newChunks.join("");
|
|
@@ -852,7 +852,7 @@ async function executeLLM(session, element) {
|
|
|
852
852
|
let systemPrompt = "";
|
|
853
853
|
let currentUserPrompt = userPrompt;
|
|
854
854
|
if (!noExtra) {
|
|
855
|
-
const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-
|
|
855
|
+
const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-6WX5O74B.js");
|
|
856
856
|
const allSubroutines = getAvailableSubroutines2(session);
|
|
857
857
|
if (session.debug) {
|
|
858
858
|
console.error(`[LLM] Total subroutines from session: ${allSubroutines.length}`);
|
|
@@ -1053,6 +1053,13 @@ ${result}
|
|
|
1053
1053
|
const maxRetries = parseInt(element.attributes["max-retries"] || "0", 10);
|
|
1054
1054
|
const feedbackMode = element.attributes["feedback"] === "true";
|
|
1055
1055
|
const confirmCorrections = element.attributes["confirm-corrections"] === "true";
|
|
1056
|
+
console.error(`
|
|
1057
|
+
${"=".repeat(60)}`);
|
|
1058
|
+
console.error(`[LLM Original Response]`);
|
|
1059
|
+
console.error(`${"=".repeat(60)}`);
|
|
1060
|
+
console.error(result);
|
|
1061
|
+
console.error(`${"=".repeat(60)}
|
|
1062
|
+
`);
|
|
1056
1063
|
console.error(`[LLM] Execute mode - validate: ${validateTags}, autocorrect: ${autocorrect}, feedback: ${feedbackMode}, confirm-corrections: ${confirmCorrections}, debug: ${session.debug}`);
|
|
1057
1064
|
const maxIterationsAttr = substituteAttribute(session, element.attributes["max-iterations"] || "3");
|
|
1058
1065
|
const maxIterations = parseInt(maxIterationsAttr, 10);
|
|
@@ -1098,7 +1105,7 @@ ${result}
|
|
|
1098
1105
|
if (session.debug) {
|
|
1099
1106
|
console.error(`[LLM] Validation enabled, autocorrect: ${autocorrect}`);
|
|
1100
1107
|
}
|
|
1101
|
-
const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-
|
|
1108
|
+
const { validateDiracCode, applyCorrectedTags } = await import("./tag-validator-PWJG4OAM.js");
|
|
1102
1109
|
let validation = await validateDiracCode(session, dynamicAST, { autocorrect, deepValidation: true });
|
|
1103
1110
|
console.error(`[LLM] Iteration ${iteration}: Validation complete - valid: ${validation.valid}, errors: ${validation.errorMessages.length}`);
|
|
1104
1111
|
if (session.debug) {
|
|
@@ -1132,7 +1139,7 @@ ${result}
|
|
|
1132
1139
|
if (correctionMessages.length > 0) {
|
|
1133
1140
|
console.error("[LLM] Corrections:", correctionMessages.join("; "));
|
|
1134
1141
|
}
|
|
1135
|
-
dynamicAST = applyCorrectedTags(dynamicAST, validation.results);
|
|
1142
|
+
dynamicAST = applyCorrectedTags(session, dynamicAST, validation.results);
|
|
1136
1143
|
console.error("[LLM] Applied initial auto-corrections to AST");
|
|
1137
1144
|
validation = await validateDiracCode(session, dynamicAST, { autocorrect: false, deepValidation: true });
|
|
1138
1145
|
console.error(`[LLM] Re-validation after corrections: valid=${validation.valid}`);
|
|
@@ -1183,6 +1190,13 @@ Please fix these errors and generate valid Dirac XML again. Remember to only use
|
|
|
1183
1190
|
} else if (saveDialog) {
|
|
1184
1191
|
setVariable(session, "__llm_dialog__", JSON.stringify(dialogHistory), true);
|
|
1185
1192
|
}
|
|
1193
|
+
console.error(`
|
|
1194
|
+
${"=".repeat(60)}`);
|
|
1195
|
+
console.error(`[LLM Original Response - Retry ${retryCount}]`);
|
|
1196
|
+
console.error(`${"=".repeat(60)}`);
|
|
1197
|
+
console.error(result);
|
|
1198
|
+
console.error(`${"=".repeat(60)}
|
|
1199
|
+
`);
|
|
1186
1200
|
if (session.debug) {
|
|
1187
1201
|
console.error(`[LLM] Retry ${retryCount} response:
|
|
1188
1202
|
${result}
|
|
@@ -1266,6 +1280,13 @@ If you resubmit this corrected code, I will execute it for you. Please review an
|
|
|
1266
1280
|
} else if (saveDialog) {
|
|
1267
1281
|
setVariable(session, "__llm_dialog__", JSON.stringify(dialogHistory), true);
|
|
1268
1282
|
}
|
|
1283
|
+
console.error(`
|
|
1284
|
+
${"=".repeat(60)}`);
|
|
1285
|
+
console.error(`[LLM Original Response - Confirmation]`);
|
|
1286
|
+
console.error(`${"=".repeat(60)}`);
|
|
1287
|
+
console.error(result);
|
|
1288
|
+
console.error(`${"=".repeat(60)}
|
|
1289
|
+
`);
|
|
1269
1290
|
console.error(`[LLM] LLM confirmation response:
|
|
1270
1291
|
${result}
|
|
1271
1292
|
`);
|
|
@@ -1343,6 +1364,13 @@ Please fix the error and try again.`;
|
|
|
1343
1364
|
} else if (saveDialog) {
|
|
1344
1365
|
setVariable(session, "__llm_dialog__", JSON.stringify(dialogHistory), true);
|
|
1345
1366
|
}
|
|
1367
|
+
console.error(`
|
|
1368
|
+
${"=".repeat(60)}`);
|
|
1369
|
+
console.error(`[LLM Original Response - After Error]`);
|
|
1370
|
+
console.error(`${"=".repeat(60)}`);
|
|
1371
|
+
console.error(result);
|
|
1372
|
+
console.error(`${"=".repeat(60)}
|
|
1373
|
+
`);
|
|
1346
1374
|
continue;
|
|
1347
1375
|
} else {
|
|
1348
1376
|
throw execError;
|
|
@@ -1428,6 +1456,13 @@ ${feedbackPrompt}
|
|
|
1428
1456
|
} else if (saveDialog) {
|
|
1429
1457
|
setVariable(session, "__llm_dialog__", JSON.stringify(dialogHistory), true);
|
|
1430
1458
|
}
|
|
1459
|
+
console.error(`
|
|
1460
|
+
${"=".repeat(60)}`);
|
|
1461
|
+
console.error(`[LLM Original Response - Feedback Loop]`);
|
|
1462
|
+
console.error(`${"=".repeat(60)}`);
|
|
1463
|
+
console.error(result);
|
|
1464
|
+
console.error(`${"=".repeat(60)}
|
|
1465
|
+
`);
|
|
1431
1466
|
if (session.debug) {
|
|
1432
1467
|
console.error(`[LLM] Feedback response:
|
|
1433
1468
|
${result}
|
|
@@ -1494,6 +1529,13 @@ Please fix these errors and generate valid Dirac XML code. Remember:
|
|
|
1494
1529
|
} else if (saveDialog) {
|
|
1495
1530
|
setVariable(session, "__llm_dialog__", JSON.stringify(dialogHistory), true);
|
|
1496
1531
|
}
|
|
1532
|
+
console.error(`
|
|
1533
|
+
${"=".repeat(60)}`);
|
|
1534
|
+
console.error(`[LLM Original Response - After Parse Error]`);
|
|
1535
|
+
console.error(`${"=".repeat(60)}`);
|
|
1536
|
+
console.error(result);
|
|
1537
|
+
console.error(`${"=".repeat(60)}
|
|
1538
|
+
`);
|
|
1497
1539
|
if (session.debug) {
|
|
1498
1540
|
console.error(`[LLM] LLM correction response:
|
|
1499
1541
|
${result}
|
|
@@ -1968,7 +2010,7 @@ async function getBestTagMatch(candidate, allowed) {
|
|
|
1968
2010
|
return { tag: allowed[bestIdx], score: bestScore };
|
|
1969
2011
|
}
|
|
1970
2012
|
async function executeTagCheck(session, element) {
|
|
1971
|
-
const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-
|
|
2013
|
+
const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-6WX5O74B.js");
|
|
1972
2014
|
const subroutines = getAvailableSubroutines2(session);
|
|
1973
2015
|
const allowed = new Set(subroutines.map((s) => s.name));
|
|
1974
2016
|
console.error("[tag-check] Allowed subroutines:", Array.from(allowed));
|
|
@@ -2061,7 +2103,7 @@ async function executeTagCheck(session, element) {
|
|
|
2061
2103
|
const executeTag = correctedTag || tagName;
|
|
2062
2104
|
console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
|
|
2063
2105
|
const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
|
|
2064
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
2106
|
+
const { integrate: integrate2 } = await import("./interpreter-KOWJFLNS.js");
|
|
2065
2107
|
await integrate2(session, elementToExecute);
|
|
2066
2108
|
}
|
|
2067
2109
|
}
|
|
@@ -2070,7 +2112,7 @@ async function executeTagCheck(session, element) {
|
|
|
2070
2112
|
// src/tags/throw.ts
|
|
2071
2113
|
async function executeThrow(session, element) {
|
|
2072
2114
|
const exceptionName = element.attributes?.name || "exception";
|
|
2073
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
2115
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
|
|
2074
2116
|
const exceptionDom = {
|
|
2075
2117
|
tag: "exception-content",
|
|
2076
2118
|
attributes: { name: exceptionName },
|
|
@@ -2083,7 +2125,7 @@ async function executeThrow(session, element) {
|
|
|
2083
2125
|
// src/tags/try.ts
|
|
2084
2126
|
async function executeTry(session, element) {
|
|
2085
2127
|
setExceptionBoundary(session);
|
|
2086
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
2128
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
|
|
2087
2129
|
await integrateChildren2(session, element);
|
|
2088
2130
|
unsetExceptionBoundary(session);
|
|
2089
2131
|
}
|
|
@@ -2093,7 +2135,7 @@ async function executeCatch(session, element) {
|
|
|
2093
2135
|
const exceptionName = element.attributes?.name || "exception";
|
|
2094
2136
|
const caughtCount = lookupException(session, exceptionName);
|
|
2095
2137
|
if (caughtCount > 0) {
|
|
2096
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
2138
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
|
|
2097
2139
|
await integrateChildren2(session, element);
|
|
2098
2140
|
}
|
|
2099
2141
|
flushCurrentException(session);
|
|
@@ -2102,7 +2144,7 @@ async function executeCatch(session, element) {
|
|
|
2102
2144
|
// src/tags/exception.ts
|
|
2103
2145
|
async function executeException(session, element) {
|
|
2104
2146
|
const exceptions = getCurrentExceptions(session);
|
|
2105
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
2147
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-KOWJFLNS.js");
|
|
2106
2148
|
for (const exceptionDom of exceptions) {
|
|
2107
2149
|
await integrateChildren2(session, exceptionDom);
|
|
2108
2150
|
}
|
|
@@ -2303,7 +2345,7 @@ async function executeLoadContext(session, element) {
|
|
|
2303
2345
|
query = element.text.trim();
|
|
2304
2346
|
}
|
|
2305
2347
|
if (!query && element.children.length > 0) {
|
|
2306
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
2348
|
+
const { integrate: integrate2 } = await import("./interpreter-KOWJFLNS.js");
|
|
2307
2349
|
const beforeOutput = session.output.length;
|
|
2308
2350
|
for (const child of element.children) {
|
|
2309
2351
|
await integrate2(session, child);
|
|
@@ -2372,7 +2414,7 @@ async function executeLoadContext(session, element) {
|
|
|
2372
2414
|
parameters: s.parameters.map((p) => p.name),
|
|
2373
2415
|
filePath: s.filePath
|
|
2374
2416
|
}));
|
|
2375
|
-
const { setVariable: setVariable2 } = await import("./session-
|
|
2417
|
+
const { setVariable: setVariable2 } = await import("./session-6WX5O74B.js");
|
|
2376
2418
|
setVariable2(session, outputVar, JSON.stringify(summary, null, 2), false);
|
|
2377
2419
|
}
|
|
2378
2420
|
}
|
|
@@ -3147,7 +3189,7 @@ async function executeForeach(session, element) {
|
|
|
3147
3189
|
const parser2 = new DiracParser2();
|
|
3148
3190
|
try {
|
|
3149
3191
|
const fromElement = parser2.parse(fromAttr);
|
|
3150
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
3192
|
+
const { integrate: integrate2 } = await import("./interpreter-KOWJFLNS.js");
|
|
3151
3193
|
await integrate2(session, fromElement);
|
|
3152
3194
|
} catch (e) {
|
|
3153
3195
|
session.output = savedOutput;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
integrate
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OUCAV57A.js";
|
|
4
4
|
import {
|
|
5
5
|
DiracParser
|
|
6
6
|
} from "./chunk-HRHAMPOB.js";
|
|
7
7
|
import {
|
|
8
8
|
createSession
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZYSWVMID.js";
|
|
10
10
|
|
|
11
11
|
// src/session-server.ts
|
|
12
12
|
import net from "net";
|
|
@@ -260,6 +260,11 @@ function cleanSubroutinesToBoundary(session, callerSubroutine) {
|
|
|
260
260
|
session.subroutines = session.subroutines.slice(0, session.subBoundary);
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
+
function removeSubroutine(session, name) {
|
|
264
|
+
const initialLength = session.subroutines.length;
|
|
265
|
+
session.subroutines = session.subroutines.filter((s) => s.name !== name);
|
|
266
|
+
return session.subroutines.length < initialLength;
|
|
267
|
+
}
|
|
263
268
|
function substituteVariables(session, text) {
|
|
264
269
|
return text.replace(/ /g, "\n").replace(/ /g, "\r").replace(/	/g, " ").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'");
|
|
265
270
|
}
|
|
@@ -351,6 +356,7 @@ export {
|
|
|
351
356
|
setSubroutineBoundary,
|
|
352
357
|
popSubroutinesToBoundary,
|
|
353
358
|
cleanSubroutinesToBoundary,
|
|
359
|
+
removeSubroutine,
|
|
354
360
|
substituteVariables,
|
|
355
361
|
emit,
|
|
356
362
|
getOutput,
|
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
execute
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7MSWEFH5.js";
|
|
5
5
|
import {
|
|
6
6
|
BraKetParser
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-OUCAV57A.js";
|
|
8
|
+
import "./chunk-53QJQ2CC.js";
|
|
9
9
|
import "./chunk-HRHAMPOB.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-EAM7IZWA.js";
|
|
11
|
+
import "./chunk-ZYSWVMID.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.
|
|
19
|
+
version: "0.1.99",
|
|
20
20
|
description: "LLM-Augmented Declarative Execution",
|
|
21
21
|
type: "module",
|
|
22
22
|
main: "dist/index.js",
|
|
@@ -150,7 +150,7 @@ async function main() {
|
|
|
150
150
|
const args = process.argv.slice(2);
|
|
151
151
|
const calledAs = process.argv[1];
|
|
152
152
|
if (calledAs && calledAs.endsWith("/dish")) {
|
|
153
|
-
const { DiracShell } = await import("./shell-
|
|
153
|
+
const { DiracShell } = await import("./shell-GXXSZYY7.js");
|
|
154
154
|
const shellConfig = loadShellConfig(args);
|
|
155
155
|
const shell = new DiracShell(shellConfig);
|
|
156
156
|
await shell.start();
|
|
@@ -199,11 +199,11 @@ async function main() {
|
|
|
199
199
|
if (args[0] === "agent") {
|
|
200
200
|
const subcommand = args[1];
|
|
201
201
|
if (subcommand === "daemon") {
|
|
202
|
-
const { runAgentDaemon } = await import("./agent-
|
|
202
|
+
const { runAgentDaemon } = await import("./agent-CWCOOLLO.js");
|
|
203
203
|
await runAgentDaemon();
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
|
-
const { AgentCLI } = await import("./agent-
|
|
206
|
+
const { AgentCLI } = await import("./agent-CWCOOLLO.js");
|
|
207
207
|
const agent = new AgentCLI();
|
|
208
208
|
switch (subcommand) {
|
|
209
209
|
case "start":
|
|
@@ -230,8 +230,8 @@ async function main() {
|
|
|
230
230
|
return;
|
|
231
231
|
}
|
|
232
232
|
if (args[0] === "shell") {
|
|
233
|
-
const { DiracShell } = await import("./shell-
|
|
234
|
-
const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-
|
|
233
|
+
const { DiracShell } = await import("./shell-GXXSZYY7.js");
|
|
234
|
+
const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-QXL2SQWJ.js");
|
|
235
235
|
const { SessionClient } = await import("./session-client-3VTC5MLO.js");
|
|
236
236
|
const daemonMode = args.includes("--daemon") || args.includes("-d");
|
|
237
237
|
const agentMode = args.includes("--agent") || args.includes("-a");
|
|
@@ -277,7 +277,7 @@ async function main() {
|
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
if (args[0] === "daemon") {
|
|
280
|
-
const { SessionServer } = await import("./session-server-
|
|
280
|
+
const { SessionServer } = await import("./session-server-QXL2SQWJ.js");
|
|
281
281
|
const server = new SessionServer();
|
|
282
282
|
await server.start();
|
|
283
283
|
console.log("Session daemon started");
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
listCronJobs,
|
|
4
4
|
stopAllCronJobs,
|
|
5
5
|
stopCronJob
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-OUCAV57A.js";
|
|
7
|
+
import "./chunk-53QJQ2CC.js";
|
|
8
8
|
import "./chunk-HRHAMPOB.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-EAM7IZWA.js";
|
|
10
|
+
import "./chunk-ZYSWVMID.js";
|
|
11
11
|
export {
|
|
12
12
|
executeCron,
|
|
13
13
|
listCronJobs,
|
package/dist/index.js
CHANGED
|
@@ -2,20 +2,20 @@ import {
|
|
|
2
2
|
createLLMAdapter,
|
|
3
3
|
execute,
|
|
4
4
|
executeUserCommand
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-7MSWEFH5.js";
|
|
6
6
|
import {
|
|
7
7
|
integrate
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-OUCAV57A.js";
|
|
9
|
+
import "./chunk-53QJQ2CC.js";
|
|
10
10
|
import {
|
|
11
11
|
DiracParser
|
|
12
12
|
} from "./chunk-HRHAMPOB.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-EAM7IZWA.js";
|
|
14
14
|
import {
|
|
15
15
|
createSession,
|
|
16
16
|
getAvailableSubroutines,
|
|
17
17
|
getOutput
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ZYSWVMID.js";
|
|
19
19
|
export {
|
|
20
20
|
DiracParser,
|
|
21
21
|
createLLMAdapter,
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
cancelScheduledRun,
|
|
4
4
|
executeRunAt,
|
|
5
5
|
listScheduledRuns
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-OUCAV57A.js";
|
|
7
|
+
import "./chunk-53QJQ2CC.js";
|
|
8
8
|
import "./chunk-HRHAMPOB.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-EAM7IZWA.js";
|
|
10
|
+
import "./chunk-ZYSWVMID.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-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-OUCAV57A.js";
|
|
7
|
+
import "./chunk-53QJQ2CC.js";
|
|
8
8
|
import "./chunk-HRHAMPOB.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-EAM7IZWA.js";
|
|
10
|
+
import "./chunk-ZYSWVMID.js";
|
|
11
11
|
export {
|
|
12
12
|
executeSchedule,
|
|
13
13
|
listScheduledTasks,
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
popToBoundary,
|
|
19
19
|
pushParameters,
|
|
20
20
|
registerSubroutine,
|
|
21
|
+
removeSubroutine,
|
|
21
22
|
setBoundary,
|
|
22
23
|
setExceptionBoundary,
|
|
23
24
|
setSubroutineBoundary,
|
|
@@ -26,7 +27,7 @@ import {
|
|
|
26
27
|
substituteVariables,
|
|
27
28
|
throwException,
|
|
28
29
|
unsetExceptionBoundary
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ZYSWVMID.js";
|
|
30
31
|
export {
|
|
31
32
|
cleanSubroutinesToBoundary,
|
|
32
33
|
cleanToBoundary,
|
|
@@ -47,6 +48,7 @@ export {
|
|
|
47
48
|
popToBoundary,
|
|
48
49
|
pushParameters,
|
|
49
50
|
registerSubroutine,
|
|
51
|
+
removeSubroutine,
|
|
50
52
|
setBoundary,
|
|
51
53
|
setExceptionBoundary,
|
|
52
54
|
setSubroutineBoundary,
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
SessionServer,
|
|
3
3
|
getSocketPath,
|
|
4
4
|
isSessionRunning
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-TIQ36H2U.js";
|
|
6
|
+
import "./chunk-OUCAV57A.js";
|
|
7
|
+
import "./chunk-53QJQ2CC.js";
|
|
8
8
|
import "./chunk-HRHAMPOB.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-EAM7IZWA.js";
|
|
10
|
+
import "./chunk-ZYSWVMID.js";
|
|
11
11
|
export {
|
|
12
12
|
SessionServer,
|
|
13
13
|
getSocketPath,
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BraKetParser,
|
|
4
4
|
integrate
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-OUCAV57A.js";
|
|
6
|
+
import "./chunk-53QJQ2CC.js";
|
|
7
7
|
import {
|
|
8
8
|
DiracParser
|
|
9
9
|
} from "./chunk-HRHAMPOB.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-EAM7IZWA.js";
|
|
11
11
|
import {
|
|
12
12
|
createSession
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZYSWVMID.js";
|
|
14
14
|
|
|
15
15
|
// src/shell.ts
|
|
16
16
|
import * as readline from "readline";
|
|
@@ -358,7 +358,7 @@ var DiracShell = class {
|
|
|
358
358
|
if (this.client) {
|
|
359
359
|
this.client.disconnect();
|
|
360
360
|
}
|
|
361
|
-
import("./schedule-
|
|
361
|
+
import("./schedule-6RWIIII3.js").then(({ stopAllScheduledTasks }) => {
|
|
362
362
|
stopAllScheduledTasks();
|
|
363
363
|
console.log("\nGoodbye!");
|
|
364
364
|
process.exit(0);
|
|
@@ -541,6 +541,8 @@ Commands:
|
|
|
541
541
|
:search <query> Search indexed subroutines
|
|
542
542
|
:load <query> Load context (search and import subroutines)
|
|
543
543
|
:save <name> [file] Save subroutine (default: ~/.dirac/lib/TIMESTAMP/name.di)
|
|
544
|
+
:edit <name> Edit subroutine in external editor
|
|
545
|
+
:remove <name> Remove subroutine from session stack (not from disk)
|
|
544
546
|
:stats Show registry statistics
|
|
545
547
|
:tasks List all scheduled tasks
|
|
546
548
|
:stop <name> Stop a scheduled task
|
|
@@ -552,6 +554,7 @@ Commands:
|
|
|
552
554
|
:cancel <name> Cancel a scheduled run
|
|
553
555
|
:cancelall Cancel all scheduled runs
|
|
554
556
|
:save-training [mode=full|pruned|both] Save LLM dialog as training data (opens in editor)
|
|
557
|
+
:save-subroutine-training <name> Save subroutine as training data with description
|
|
555
558
|
:exit Exit shell
|
|
556
559
|
|
|
557
560
|
Syntax:
|
|
@@ -758,6 +761,49 @@ Examples:
|
|
|
758
761
|
}
|
|
759
762
|
}
|
|
760
763
|
break;
|
|
764
|
+
case "edit":
|
|
765
|
+
if (args.length === 0) {
|
|
766
|
+
console.log("Usage: :edit <subroutine-name>");
|
|
767
|
+
console.log(" Opens the subroutine in your default editor ($EDITOR or vi)");
|
|
768
|
+
console.log("Examples:");
|
|
769
|
+
console.log(" :edit greet # edit greet subroutine in default editor");
|
|
770
|
+
console.log(" Use :save after editing to persist changes to disk");
|
|
771
|
+
} else {
|
|
772
|
+
const subName = args[0];
|
|
773
|
+
try {
|
|
774
|
+
const xml = `<edit-subroutine name="${subName}" />`;
|
|
775
|
+
const ast = this.xmlParser.parse(xml);
|
|
776
|
+
await integrate(this.session, ast);
|
|
777
|
+
if (this.session.output.length > 0) {
|
|
778
|
+
console.log(this.session.output.join(""));
|
|
779
|
+
}
|
|
780
|
+
} catch (error) {
|
|
781
|
+
console.error("Error editing subroutine:", error instanceof Error ? error.message : String(error));
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
break;
|
|
785
|
+
case "remove":
|
|
786
|
+
if (args.length === 0) {
|
|
787
|
+
console.log("Usage: :remove <subroutine-name>");
|
|
788
|
+
console.log(" Removes all instances of the subroutine from the session stack");
|
|
789
|
+
console.log(" Note: This does NOT delete the subroutine from disk");
|
|
790
|
+
console.log("Examples:");
|
|
791
|
+
console.log(" :remove greet # remove greet subroutine from session");
|
|
792
|
+
} else {
|
|
793
|
+
const subName = args[0];
|
|
794
|
+
try {
|
|
795
|
+
const { removeSubroutine } = await import("./session-6WX5O74B.js");
|
|
796
|
+
const removed = removeSubroutine(this.session, subName);
|
|
797
|
+
if (removed) {
|
|
798
|
+
console.log(`Removed subroutine '${subName}' from session stack`);
|
|
799
|
+
} else {
|
|
800
|
+
console.log(`Subroutine '${subName}' not found in session`);
|
|
801
|
+
}
|
|
802
|
+
} catch (error) {
|
|
803
|
+
console.error("Error removing subroutine:", error instanceof Error ? error.message : String(error));
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
break;
|
|
761
807
|
case "stats":
|
|
762
808
|
try {
|
|
763
809
|
const xml = "<registry-stats />";
|
|
@@ -772,7 +818,7 @@ Examples:
|
|
|
772
818
|
break;
|
|
773
819
|
case "tasks":
|
|
774
820
|
try {
|
|
775
|
-
const { listScheduledTasks } = await import("./schedule-
|
|
821
|
+
const { listScheduledTasks } = await import("./schedule-6RWIIII3.js");
|
|
776
822
|
const tasks = listScheduledTasks();
|
|
777
823
|
if (tasks.length === 0) {
|
|
778
824
|
console.log("No scheduled tasks running.");
|
|
@@ -791,7 +837,7 @@ Examples:
|
|
|
791
837
|
console.log("Usage: :stop <task-name>");
|
|
792
838
|
} else {
|
|
793
839
|
try {
|
|
794
|
-
const { stopScheduledTask } = await import("./schedule-
|
|
840
|
+
const { stopScheduledTask } = await import("./schedule-6RWIIII3.js");
|
|
795
841
|
const taskName = args[0];
|
|
796
842
|
const stopped = stopScheduledTask(taskName);
|
|
797
843
|
if (stopped) {
|
|
@@ -806,7 +852,7 @@ Examples:
|
|
|
806
852
|
break;
|
|
807
853
|
case "stopall":
|
|
808
854
|
try {
|
|
809
|
-
const { stopAllScheduledTasks } = await import("./schedule-
|
|
855
|
+
const { stopAllScheduledTasks } = await import("./schedule-6RWIIII3.js");
|
|
810
856
|
stopAllScheduledTasks();
|
|
811
857
|
console.log("All scheduled tasks stopped.");
|
|
812
858
|
} catch (error) {
|
|
@@ -815,7 +861,7 @@ Examples:
|
|
|
815
861
|
break;
|
|
816
862
|
case "crons":
|
|
817
863
|
try {
|
|
818
|
-
const { listCronJobs } = await import("./cron-
|
|
864
|
+
const { listCronJobs } = await import("./cron-3W32GKBD.js");
|
|
819
865
|
const jobs = listCronJobs();
|
|
820
866
|
if (jobs.length === 0) {
|
|
821
867
|
console.log("No cron jobs running.");
|
|
@@ -835,7 +881,7 @@ Examples:
|
|
|
835
881
|
console.log("Usage: :stopcron <job-name>");
|
|
836
882
|
} else {
|
|
837
883
|
try {
|
|
838
|
-
const { stopCronJob } = await import("./cron-
|
|
884
|
+
const { stopCronJob } = await import("./cron-3W32GKBD.js");
|
|
839
885
|
const jobName = args[0];
|
|
840
886
|
const stopped = stopCronJob(jobName);
|
|
841
887
|
if (stopped) {
|
|
@@ -850,7 +896,7 @@ Examples:
|
|
|
850
896
|
break;
|
|
851
897
|
case "stopallcrons":
|
|
852
898
|
try {
|
|
853
|
-
const { stopAllCronJobs } = await import("./cron-
|
|
899
|
+
const { stopAllCronJobs } = await import("./cron-3W32GKBD.js");
|
|
854
900
|
stopAllCronJobs();
|
|
855
901
|
console.log("All cron jobs stopped.");
|
|
856
902
|
} catch (error) {
|
|
@@ -859,7 +905,7 @@ Examples:
|
|
|
859
905
|
break;
|
|
860
906
|
case "scheduled":
|
|
861
907
|
try {
|
|
862
|
-
const { listScheduledRuns } = await import("./run-at-
|
|
908
|
+
const { listScheduledRuns } = await import("./run-at-S37OQ7RA.js");
|
|
863
909
|
const runs = listScheduledRuns();
|
|
864
910
|
if (runs.length === 0) {
|
|
865
911
|
console.log("No scheduled runs pending.");
|
|
@@ -879,7 +925,7 @@ Examples:
|
|
|
879
925
|
console.log("Usage: :cancel <run-name>");
|
|
880
926
|
} else {
|
|
881
927
|
try {
|
|
882
|
-
const { cancelScheduledRun } = await import("./run-at-
|
|
928
|
+
const { cancelScheduledRun } = await import("./run-at-S37OQ7RA.js");
|
|
883
929
|
const runName = args[0];
|
|
884
930
|
const cancelled = cancelScheduledRun(runName);
|
|
885
931
|
if (cancelled) {
|
|
@@ -894,13 +940,99 @@ Examples:
|
|
|
894
940
|
break;
|
|
895
941
|
case "cancelall":
|
|
896
942
|
try {
|
|
897
|
-
const { cancelAllScheduledRuns } = await import("./run-at-
|
|
943
|
+
const { cancelAllScheduledRuns } = await import("./run-at-S37OQ7RA.js");
|
|
898
944
|
cancelAllScheduledRuns();
|
|
899
945
|
console.log("All scheduled runs cancelled.");
|
|
900
946
|
} catch (error) {
|
|
901
947
|
console.error("Error cancelling runs:", error instanceof Error ? error.message : String(error));
|
|
902
948
|
}
|
|
903
949
|
break;
|
|
950
|
+
case "save-subroutine-training":
|
|
951
|
+
if (args.length === 0) {
|
|
952
|
+
console.log("Usage: :save-subroutine-training <subroutine-name>");
|
|
953
|
+
console.log(" Saves a subroutine as training data (opens in editor)");
|
|
954
|
+
console.log(" You will be prompted to provide a description for the training example");
|
|
955
|
+
console.log("Examples:");
|
|
956
|
+
console.log(" :save-subroutine-training greet");
|
|
957
|
+
} else {
|
|
958
|
+
const subName = args[0];
|
|
959
|
+
try {
|
|
960
|
+
let subroutine = void 0;
|
|
961
|
+
const subroutines = this.client ? (await this.client.getState()).subroutines || [] : this.session.subroutines;
|
|
962
|
+
for (let i = subroutines.length - 1; i >= 0; i--) {
|
|
963
|
+
if (subroutines[i].name === subName) {
|
|
964
|
+
subroutine = subroutines[i];
|
|
965
|
+
break;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
if (!subroutine) {
|
|
969
|
+
console.log(`Subroutine '${subName}' not found in session`);
|
|
970
|
+
break;
|
|
971
|
+
}
|
|
972
|
+
const description = await new Promise((resolve2) => {
|
|
973
|
+
this.rl.question(`Enter description (user's request that would generate this subroutine): `, resolve2);
|
|
974
|
+
});
|
|
975
|
+
if (!description.trim()) {
|
|
976
|
+
console.log("Cancelled (no description provided)");
|
|
977
|
+
break;
|
|
978
|
+
}
|
|
979
|
+
const { serializeSubroutineForTraining } = await import("./subroutine-serializer-LNFHABUC.js");
|
|
980
|
+
const subroutineContent = serializeSubroutineForTraining(subroutine);
|
|
981
|
+
const trainingExample = {
|
|
982
|
+
messages: [
|
|
983
|
+
{ role: "user", content: description.trim() },
|
|
984
|
+
{ role: "assistant", content: subroutineContent }
|
|
985
|
+
]
|
|
986
|
+
};
|
|
987
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").split("T")[0] + "-" + Date.now();
|
|
988
|
+
const tempFile = path.join(os.tmpdir(), `dirac-subroutine-training-${timestamp}.jsonl`);
|
|
989
|
+
const tempContent = JSON.stringify(trainingExample, null, 2);
|
|
990
|
+
fs.writeFileSync(tempFile, tempContent, "utf-8");
|
|
991
|
+
console.log("Opening in editor...");
|
|
992
|
+
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
993
|
+
const { spawnSync } = await import("child_process");
|
|
994
|
+
const result = spawnSync(editor, [tempFile], {
|
|
995
|
+
stdio: "inherit",
|
|
996
|
+
shell: true
|
|
997
|
+
});
|
|
998
|
+
if (result.error) {
|
|
999
|
+
fs.unlinkSync(tempFile);
|
|
1000
|
+
console.error(`Failed to open editor: ${result.error.message}`);
|
|
1001
|
+
break;
|
|
1002
|
+
}
|
|
1003
|
+
if (result.status !== 0) {
|
|
1004
|
+
fs.unlinkSync(tempFile);
|
|
1005
|
+
console.error(`Editor exited with code ${result.status}`);
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
const answer = await new Promise((resolve2) => {
|
|
1009
|
+
this.rl.question("Save to file (or press Enter to cancel): ", resolve2);
|
|
1010
|
+
});
|
|
1011
|
+
if (!answer.trim()) {
|
|
1012
|
+
fs.unlinkSync(tempFile);
|
|
1013
|
+
console.log("Cancelled");
|
|
1014
|
+
break;
|
|
1015
|
+
}
|
|
1016
|
+
let savePath;
|
|
1017
|
+
if (answer.startsWith("/") || answer.startsWith("~")) {
|
|
1018
|
+
savePath = answer.replace(/^~/, os.homedir());
|
|
1019
|
+
} else if (answer.includes("/")) {
|
|
1020
|
+
savePath = path.resolve(answer);
|
|
1021
|
+
} else {
|
|
1022
|
+
const trainingDir = path.join(os.homedir(), ".dirac", "training");
|
|
1023
|
+
fs.mkdirSync(trainingDir, { recursive: true });
|
|
1024
|
+
savePath = path.join(trainingDir, answer.endsWith(".jsonl") ? answer : `${answer}.jsonl`);
|
|
1025
|
+
}
|
|
1026
|
+
const editedContent = fs.readFileSync(tempFile, "utf-8");
|
|
1027
|
+
const editedData = JSON.parse(editedContent);
|
|
1028
|
+
fs.appendFileSync(savePath, JSON.stringify(editedData) + "\n");
|
|
1029
|
+
console.log(`\u2713 Saved training example for '${subName}' to ${savePath}`);
|
|
1030
|
+
fs.unlinkSync(tempFile);
|
|
1031
|
+
} catch (error) {
|
|
1032
|
+
console.error("Error saving subroutine training data:", error instanceof Error ? error.message : String(error));
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
break;
|
|
904
1036
|
case "save-training":
|
|
905
1037
|
try {
|
|
906
1038
|
const fullCommand = cmd.slice(1);
|
|
@@ -1162,7 +1294,7 @@ ${JSON.stringify(prunedExample, null, 2)}`;
|
|
|
1162
1294
|
console.log("Set ANTHROPIC_API_KEY or OPENAI_API_KEY environment variable,");
|
|
1163
1295
|
console.log("or create ~/.dirac/config.yml with llmProvider and llmModel.\n");
|
|
1164
1296
|
}
|
|
1165
|
-
const { registry } = await import("./subroutine-index-
|
|
1297
|
+
const { registry } = await import("./subroutine-index-GB3OSH56.js");
|
|
1166
1298
|
const wasIndexed = await registry.autoIndexStdlib();
|
|
1167
1299
|
await this.loadEssentialSubroutines();
|
|
1168
1300
|
if (this.config.initScript) {
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
executeRegistryStats,
|
|
4
4
|
executeSearchSubroutines,
|
|
5
5
|
registry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-53QJQ2CC.js";
|
|
7
7
|
import "./chunk-HRHAMPOB.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-ZYSWVMID.js";
|
|
9
9
|
export {
|
|
10
10
|
executeIndexSubroutines,
|
|
11
11
|
executeRegistryStats,
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// src/utils/subroutine-serializer.ts
|
|
2
|
+
function serializeSubroutineForTraining(sub) {
|
|
3
|
+
const lines = [];
|
|
4
|
+
serializeElement(sub.element, lines, "");
|
|
5
|
+
return lines.join("\n");
|
|
6
|
+
}
|
|
7
|
+
function serializeSubroutineToXML(sub) {
|
|
8
|
+
const lines = [];
|
|
9
|
+
lines.push("<!-- Editing subroutine: " + sub.name + " -->");
|
|
10
|
+
lines.push("");
|
|
11
|
+
serializeElement(sub.element, lines, "");
|
|
12
|
+
return lines.join("\n");
|
|
13
|
+
}
|
|
14
|
+
function serializeElement(el, lines, indent) {
|
|
15
|
+
if (!el.tag || el.tag === "") {
|
|
16
|
+
if (el.text) {
|
|
17
|
+
let lastIdx = lines.length - 1;
|
|
18
|
+
if (lastIdx >= 0 && !lines[lastIdx].endsWith(">")) {
|
|
19
|
+
lines[lastIdx] += el.text;
|
|
20
|
+
} else {
|
|
21
|
+
lines.push(indent + el.text);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
let tag = `${indent}<${el.tag}`;
|
|
27
|
+
if (el.attributes) {
|
|
28
|
+
for (const [key, value] of Object.entries(el.attributes)) {
|
|
29
|
+
if (typeof value === "string") {
|
|
30
|
+
tag += ` ${key}="${value.replace(/"/g, """)}"`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const hasChildren = el.children && el.children.length > 0;
|
|
35
|
+
if (!hasChildren) {
|
|
36
|
+
let lastIdx = lines.length - 1;
|
|
37
|
+
if (lastIdx >= 0 && !lines[lastIdx].endsWith(">") && !lines[lastIdx].trim().startsWith("<")) {
|
|
38
|
+
lines[lastIdx] += tag.slice(indent.length) + " />";
|
|
39
|
+
} else {
|
|
40
|
+
lines.push(tag + " />");
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
let lastIdx = lines.length - 1;
|
|
44
|
+
const shouldInline = lastIdx >= 0 && !lines[lastIdx].endsWith(">");
|
|
45
|
+
if (shouldInline) {
|
|
46
|
+
lines[lastIdx] += tag.slice(indent.length) + ">";
|
|
47
|
+
} else {
|
|
48
|
+
lines.push(tag + ">");
|
|
49
|
+
}
|
|
50
|
+
let allInline = true;
|
|
51
|
+
for (let i = 0; i < el.children.length; i++) {
|
|
52
|
+
const child = el.children[i];
|
|
53
|
+
if (!child.tag || child.tag === "") {
|
|
54
|
+
if (child.text) {
|
|
55
|
+
lastIdx = lines.length - 1;
|
|
56
|
+
lines[lastIdx] += child.text;
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
const isComplex = child.children && child.children.length > 0;
|
|
60
|
+
if (isComplex) {
|
|
61
|
+
allInline = false;
|
|
62
|
+
serializeElement(child, lines, indent + " ");
|
|
63
|
+
} else {
|
|
64
|
+
let childTag = `<${child.tag}`;
|
|
65
|
+
if (child.attributes) {
|
|
66
|
+
for (const [key, value] of Object.entries(child.attributes)) {
|
|
67
|
+
if (typeof value === "string") {
|
|
68
|
+
childTag += ` ${key}="${value.replace(/"/g, """)}"`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
childTag += " />";
|
|
73
|
+
lastIdx = lines.length - 1;
|
|
74
|
+
lines[lastIdx] += childTag;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
lastIdx = lines.length - 1;
|
|
79
|
+
if (allInline && lines[lastIdx].indexOf("<") > 0) {
|
|
80
|
+
lines[lastIdx] += `</${el.tag}>`;
|
|
81
|
+
} else {
|
|
82
|
+
lines.push(`${indent}</${el.tag}>`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function serializeSubroutineToBraKet(sub) {
|
|
87
|
+
const lines = [];
|
|
88
|
+
lines.push("<!-- Editing subroutine: " + sub.name + " -->");
|
|
89
|
+
lines.push("");
|
|
90
|
+
serializeElementToBraKet(sub.element, lines, 0);
|
|
91
|
+
return lines.join("\n");
|
|
92
|
+
}
|
|
93
|
+
function serializeElementToBraKet(el, lines, indent) {
|
|
94
|
+
const indentStr = " ".repeat(indent);
|
|
95
|
+
if (!el.tag || el.tag === "") {
|
|
96
|
+
if (el.text) {
|
|
97
|
+
lines.push(indentStr + el.text);
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (el.tag === "subroutine") {
|
|
102
|
+
const name = el.attributes?.name || "unnamed";
|
|
103
|
+
let braLine = `${indentStr}<${name}|`;
|
|
104
|
+
if (el.attributes) {
|
|
105
|
+
for (const [key, value] of Object.entries(el.attributes)) {
|
|
106
|
+
if (key === "name") continue;
|
|
107
|
+
const needsQuotes = typeof value === "string" && (value.includes(" ") || value.includes("="));
|
|
108
|
+
braLine += ` ${key}=${needsQuotes ? '"' + value + '"' : value}`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
lines.push(braLine);
|
|
112
|
+
if (el.children && el.children.length > 0) {
|
|
113
|
+
for (const child of el.children) {
|
|
114
|
+
serializeElementToBraKet(child, lines, indent + 1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
let ketLine = `${indentStr}|${el.tag}`;
|
|
120
|
+
if (el.attributes) {
|
|
121
|
+
for (const [key, value] of Object.entries(el.attributes)) {
|
|
122
|
+
if (typeof value === "string") {
|
|
123
|
+
const needsQuotes = value.includes(" ") || value.includes("=");
|
|
124
|
+
ketLine += ` ${key}=${needsQuotes ? '"' + value + '"' : value}`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
ketLine += ">";
|
|
129
|
+
if (el.children && el.children.length > 0) {
|
|
130
|
+
const hasComplexChildren = el.children.some(
|
|
131
|
+
(c) => c.tag && c.tag !== "variable" && (c.children?.length > 0 || c.tag === "subroutine")
|
|
132
|
+
);
|
|
133
|
+
if (!hasComplexChildren) {
|
|
134
|
+
let inlineContent = "";
|
|
135
|
+
for (const child of el.children) {
|
|
136
|
+
if (!child.tag || child.tag === "") {
|
|
137
|
+
inlineContent += child.text || "";
|
|
138
|
+
} else if (child.tag === "variable") {
|
|
139
|
+
const varName = child.attributes?.name || "";
|
|
140
|
+
inlineContent += `|variable name=${varName}>`;
|
|
141
|
+
} else {
|
|
142
|
+
inlineContent += `|${child.tag}>`;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
lines.push(ketLine + inlineContent);
|
|
146
|
+
} else {
|
|
147
|
+
lines.push(ketLine);
|
|
148
|
+
for (const child of el.children) {
|
|
149
|
+
serializeElementToBraKet(child, lines, indent + 1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
lines.push(ketLine);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
serializeSubroutineForTraining,
|
|
158
|
+
serializeSubroutineToBraKet,
|
|
159
|
+
serializeSubroutineToXML
|
|
160
|
+
};
|
|
@@ -108,8 +108,10 @@ async function validateNestedTags(session, element, options = {}) {
|
|
|
108
108
|
}
|
|
109
109
|
async function validateTag(session, element, options = {}) {
|
|
110
110
|
const { autocorrect = false, similarityCutoff = SIMILARITY_CUTOFF, deepValidation = false } = options;
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
if (session.debug) {
|
|
112
|
+
console.error(`[VALIDATE] Tag: <${element.tag}>, autocorrect: ${autocorrect}, attributes:`, Object.keys(element.attributes));
|
|
113
|
+
}
|
|
114
|
+
const { getAvailableSubroutines } = await import("./session-6WX5O74B.js");
|
|
113
115
|
const subroutines = getAvailableSubroutines(session);
|
|
114
116
|
const allowed = new Set(subroutines.map((s) => s.name));
|
|
115
117
|
const tagName = element.tag;
|
|
@@ -126,11 +128,15 @@ async function validateTag(session, element, options = {}) {
|
|
|
126
128
|
scopeValidation: void 0
|
|
127
129
|
};
|
|
128
130
|
if (allowed.has(tagName)) {
|
|
129
|
-
|
|
131
|
+
if (session.debug) {
|
|
132
|
+
console.error(`[VALIDATE] Tag <${tagName}> is valid`);
|
|
133
|
+
}
|
|
130
134
|
const sub = subroutines.find((s) => s.name === tagName);
|
|
131
135
|
if (sub && Array.isArray(sub.parameters)) {
|
|
132
136
|
const paramNames = sub.parameters.map((p) => p.name);
|
|
133
|
-
|
|
137
|
+
if (session.debug) {
|
|
138
|
+
console.error(`[VALIDATE] Tag <${tagName}> has ${paramNames.length} parameters:`, paramNames);
|
|
139
|
+
}
|
|
134
140
|
for (const param of sub.parameters) {
|
|
135
141
|
if (param.required && !(param.name in element.attributes)) {
|
|
136
142
|
result.errors.push(`Missing required parameter: ${param.name}`);
|
|
@@ -138,11 +144,15 @@ async function validateTag(session, element, options = {}) {
|
|
|
138
144
|
}
|
|
139
145
|
for (const attr in element.attributes) {
|
|
140
146
|
if (tagName === "subroutine" && (attr.startsWith("param-") || attr.startsWith("meta-"))) {
|
|
141
|
-
|
|
147
|
+
if (session.debug) {
|
|
148
|
+
console.error(`[VALIDATE] Skipping validation for wildcard attribute '${attr}' on <subroutine>`);
|
|
149
|
+
}
|
|
142
150
|
continue;
|
|
143
151
|
}
|
|
144
152
|
if (!paramNames.includes(attr)) {
|
|
145
|
-
|
|
153
|
+
if (session.debug) {
|
|
154
|
+
console.error(`[VALIDATE] Unknown attribute '${attr}' on <${tagName}>`);
|
|
155
|
+
}
|
|
146
156
|
if (autocorrect && paramNames.length > 0) {
|
|
147
157
|
let correctedAttr = null;
|
|
148
158
|
let similarityScore = 0;
|
|
@@ -152,21 +162,31 @@ async function validateTag(session, element, options = {}) {
|
|
|
152
162
|
result.attributeCorrections[attr] = correctedAttr;
|
|
153
163
|
result.corrected = true;
|
|
154
164
|
result.warnings.push(`Auto-corrected attribute: ${attr}="${element.attributes[attr]}" \u2192 ${correctedAttr}="${element.attributes[attr]}" (only parameter available)`);
|
|
155
|
-
|
|
165
|
+
if (session.debug) {
|
|
166
|
+
console.error(`[VALIDATE] Auto-corrected (single param): ${attr} \u2192 ${correctedAttr}`);
|
|
167
|
+
}
|
|
156
168
|
} else {
|
|
157
|
-
|
|
169
|
+
if (session.debug) {
|
|
170
|
+
console.error(`[VALIDATE] Checking similarity for '${attr}' against:`, paramNames);
|
|
171
|
+
}
|
|
158
172
|
const best = await getBestTagMatch(attr, paramNames);
|
|
159
|
-
|
|
173
|
+
if (session.debug) {
|
|
174
|
+
console.error(`[VALIDATE] Best match: ${best.tag} with score ${best.score.toFixed(2)}, cutoff: ${similarityCutoff}`);
|
|
175
|
+
}
|
|
160
176
|
if (best.score >= similarityCutoff) {
|
|
161
177
|
correctedAttr = best.tag;
|
|
162
178
|
similarityScore = best.score;
|
|
163
179
|
result.attributeCorrections[attr] = correctedAttr;
|
|
164
180
|
result.corrected = true;
|
|
165
181
|
result.warnings.push(`Auto-corrected attribute: ${attr}="${element.attributes[attr]}" \u2192 ${correctedAttr}="${element.attributes[attr]}" (similarity: ${similarityScore.toFixed(2)})`);
|
|
166
|
-
|
|
182
|
+
if (session.debug) {
|
|
183
|
+
console.error(`[VALIDATE] Auto-corrected (similarity): ${attr} \u2192 ${correctedAttr}`);
|
|
184
|
+
}
|
|
167
185
|
} else {
|
|
168
186
|
result.warnings.push(`Unknown attribute: ${attr} (no similar match found, best: ${best.tag} with score ${best.score.toFixed(2)})`);
|
|
169
|
-
|
|
187
|
+
if (session.debug) {
|
|
188
|
+
console.error(`[VALIDATE] No correction (score too low): ${attr}, best was ${best.tag} (${best.score.toFixed(2)})`);
|
|
189
|
+
}
|
|
170
190
|
}
|
|
171
191
|
}
|
|
172
192
|
} else {
|
|
@@ -193,7 +213,9 @@ async function validateTag(session, element, options = {}) {
|
|
|
193
213
|
}
|
|
194
214
|
}
|
|
195
215
|
if (deepValidation && tagName === "subroutine" && element.children && element.children.length > 0) {
|
|
196
|
-
|
|
216
|
+
if (session.debug) {
|
|
217
|
+
console.error(`[VALIDATE] Deep validation of <subroutine name="${element.attributes.name}">`);
|
|
218
|
+
}
|
|
197
219
|
result.nestedValidation = await validateNestedTags(session, element, options);
|
|
198
220
|
for (const nestedResult of result.nestedValidation) {
|
|
199
221
|
if (!nestedResult.valid) {
|
|
@@ -202,14 +224,16 @@ async function validateTag(session, element, options = {}) {
|
|
|
202
224
|
}
|
|
203
225
|
const { validateSubroutineScope } = await import("./scope-validator-TVQIOEAI.js");
|
|
204
226
|
result.scopeValidation = validateSubroutineScope(element);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
227
|
+
if (session.debug) {
|
|
228
|
+
console.error(`[VALIDATE] Scope validation for <subroutine name="${element.attributes.name}">:`, {
|
|
229
|
+
errors: result.scopeValidation.errors.length,
|
|
230
|
+
warnings: result.scopeValidation.warnings.length,
|
|
231
|
+
undefinedParams: result.scopeValidation.undefinedParameters,
|
|
232
|
+
undefinedVars: result.scopeValidation.undefinedVariables,
|
|
233
|
+
unusedParams: result.scopeValidation.unusedParameters,
|
|
234
|
+
unusedVars: result.scopeValidation.unusedVariables
|
|
235
|
+
});
|
|
236
|
+
}
|
|
213
237
|
if (result.scopeValidation.warnings.length > 0) {
|
|
214
238
|
result.warnings.push(...result.scopeValidation.warnings.map((w) => `Scope: ${w}`));
|
|
215
239
|
}
|
|
@@ -282,7 +306,7 @@ async function validateDiracCode(session, ast, options = {}) {
|
|
|
282
306
|
}
|
|
283
307
|
}
|
|
284
308
|
extractLocalSubroutines(ast);
|
|
285
|
-
if (localSubroutineNames.size > 0) {
|
|
309
|
+
if (localSubroutineNames.size > 0 && session.debug) {
|
|
286
310
|
console.error(`[VALIDATE] Found ${localSubroutineNames.size} local subroutine definitions:`, Array.from(localSubroutineNames));
|
|
287
311
|
}
|
|
288
312
|
const tempSubroutines = [];
|
|
@@ -303,7 +327,9 @@ async function validateDiracCode(session, ast, options = {}) {
|
|
|
303
327
|
});
|
|
304
328
|
}
|
|
305
329
|
}
|
|
306
|
-
|
|
330
|
+
if (session.debug) {
|
|
331
|
+
console.error(`[VALIDATE] Temp subroutine '${subName}' has ${parameters.length} parameters:`, parameters.map((p) => p.name));
|
|
332
|
+
}
|
|
307
333
|
const tempSub = {
|
|
308
334
|
name: subName,
|
|
309
335
|
element: subElement,
|
|
@@ -342,30 +368,36 @@ async function validateDiracCode(session, ast, options = {}) {
|
|
|
342
368
|
typeErrors
|
|
343
369
|
};
|
|
344
370
|
}
|
|
345
|
-
function applyCorrectedTags(ast, results) {
|
|
371
|
+
function applyCorrectedTags(session, ast, results) {
|
|
346
372
|
let resultIndex = 0;
|
|
347
373
|
function correctElement(element) {
|
|
348
374
|
const shouldProcess = element.tag && element.tag !== "dirac" && element.tag !== "DIRAC-ROOT" && element.tag.trim() !== "";
|
|
349
375
|
if (shouldProcess && resultIndex < results.length) {
|
|
350
376
|
const result = results[resultIndex++];
|
|
351
|
-
|
|
377
|
+
if (session.debug) {
|
|
378
|
+
console.error(`[APPLY-CORRECTION] Processing <${element.tag}> with result #${resultIndex - 1} for <${result.originalTag}>, corrected: ${result.corrected}`);
|
|
379
|
+
}
|
|
352
380
|
if (result.corrected && result.tagName !== element.tag) {
|
|
353
|
-
|
|
381
|
+
if (session.debug) {
|
|
382
|
+
console.error(`[APPLY-CORRECTION] Tag: ${element.tag} \u2192 ${result.tagName}`);
|
|
383
|
+
}
|
|
354
384
|
element = { ...element, tag: result.tagName };
|
|
355
385
|
}
|
|
356
386
|
if (result.attributeCorrections && Object.keys(result.attributeCorrections).length > 0) {
|
|
357
|
-
|
|
387
|
+
if (session.debug) {
|
|
388
|
+
console.error(`[APPLY-CORRECTION] Attributes on <${element.tag}>:`, result.attributeCorrections);
|
|
389
|
+
}
|
|
358
390
|
const newAttributes = {};
|
|
359
391
|
for (const [oldAttr, value] of Object.entries(element.attributes)) {
|
|
360
392
|
const newAttr = result.attributeCorrections[oldAttr] || oldAttr;
|
|
361
|
-
if (newAttr !== oldAttr) {
|
|
393
|
+
if (newAttr !== oldAttr && session.debug) {
|
|
362
394
|
console.error(`[APPLY-CORRECTION] ${oldAttr}="${value}" \u2192 ${newAttr}="${value}"`);
|
|
363
395
|
}
|
|
364
396
|
newAttributes[newAttr] = value;
|
|
365
397
|
}
|
|
366
398
|
element = { ...element, attributes: newAttributes };
|
|
367
399
|
}
|
|
368
|
-
} else if (shouldProcess) {
|
|
400
|
+
} else if (shouldProcess && session.debug) {
|
|
369
401
|
console.error(`[APPLY-CORRECTION] WARNING: No result for <${element.tag}> at index ${resultIndex} (total results: ${results.length})`);
|
|
370
402
|
}
|
|
371
403
|
return {
|
package/dist/test-runner.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
integrate
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-OUCAV57A.js";
|
|
4
|
+
import "./chunk-53QJQ2CC.js";
|
|
5
5
|
import {
|
|
6
6
|
DiracParser
|
|
7
7
|
} from "./chunk-HRHAMPOB.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-EAM7IZWA.js";
|
|
9
9
|
import {
|
|
10
10
|
createSession,
|
|
11
11
|
getOutput
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZYSWVMID.js";
|
|
13
13
|
|
|
14
14
|
// src/test-runner.ts
|
|
15
15
|
import fs from "fs";
|
package/lib/native-tags.di
CHANGED
|
@@ -219,7 +219,8 @@
|
|
|
219
219
|
meta-hide-from-llm="true"
|
|
220
220
|
description="Edit subroutine definition in external editor"
|
|
221
221
|
param-name="string:required:Subroutine name to edit"
|
|
222
|
-
param-editor="string:optional:Editor command (default: $EDITOR or vi)"
|
|
222
|
+
param-editor="string:optional:Editor command (default: $EDITOR or vi)"
|
|
223
|
+
param-format="string:optional:format (braket or xml, default:braket)">
|
|
223
224
|
<!-- Opens subroutine in temp file with editor (blocking) -->
|
|
224
225
|
<!-- After save/exit, automatically re-imports into session -->
|
|
225
226
|
<!-- Changes take effect immediately but are NOT saved to disk -->
|
package/package.json
CHANGED