dirac-lang 0.1.61 → 0.1.63
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/{agent-OXQZBLNQ.js → agent-HAYADDBF.js} +4 -3
- package/dist/{chunk-AU3YU63U.js → chunk-6GYEZ3Z4.js} +1 -1
- package/dist/{chunk-ZAA6R2TC.js → chunk-ER6DSG7W.js} +52 -22
- package/dist/{chunk-BMKPKK7M.js → chunk-ZN52C2TW.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/{cron-BQIWLGQY.js → cron-JAWTZUOM.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{interpreter-NPXTWPHN.js → interpreter-P7ZMLP32.js} +1 -1
- package/dist/{run-at-KDJYTEOD.js → run-at-BMPXOIW4.js} +1 -1
- package/dist/{schedule-QZ5U3YBS.js → schedule-VKPK4DWF.js} +1 -1
- package/dist/{session-server-QZN2RMYD.js → session-server-GEISBLMU.js} +2 -2
- package/dist/{shell-OFBL57OA.js → shell-SN7XYIDA.js} +31 -15
- package/dist/test-runner.js +1 -1
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
SessionServer,
|
|
3
3
|
getSocketPath,
|
|
4
4
|
isSessionRunning
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-6GYEZ3Z4.js";
|
|
6
|
+
import "./chunk-ER6DSG7W.js";
|
|
7
7
|
import "./chunk-HRHAMPOB.js";
|
|
8
8
|
import "./chunk-NKA6ZJDV.js";
|
|
9
9
|
import "./chunk-3UW6GWYQ.js";
|
|
@@ -195,7 +195,8 @@ async function runAgentDaemon() {
|
|
|
195
195
|
llmProvider: configData.llmProvider,
|
|
196
196
|
llmModel: configData.llmModel,
|
|
197
197
|
customLLMUrl: configData.customLLMUrl,
|
|
198
|
-
initScript: configData.initScript
|
|
198
|
+
initScript: configData.initScript,
|
|
199
|
+
libraryPaths: configData.libraryPaths
|
|
199
200
|
};
|
|
200
201
|
console.log(`[${(/* @__PURE__ */ new Date()).toISOString()}] Loaded config: LLM=${config.llmProvider}/${config.llmModel}`);
|
|
201
202
|
}
|
|
@@ -474,12 +474,12 @@ async function executeIf(session, element) {
|
|
|
474
474
|
const condition = await evaluatePredicate(session, conditionElement);
|
|
475
475
|
if (condition) {
|
|
476
476
|
if (thenElement) {
|
|
477
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
477
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
|
|
478
478
|
await integrateChildren2(session, thenElement);
|
|
479
479
|
}
|
|
480
480
|
} else {
|
|
481
481
|
if (elseElement) {
|
|
482
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
482
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
|
|
483
483
|
await integrateChildren2(session, elseElement);
|
|
484
484
|
}
|
|
485
485
|
}
|
|
@@ -492,7 +492,7 @@ async function evaluatePredicate(session, predicateElement) {
|
|
|
492
492
|
return await evaluateCondition(session, predicateElement);
|
|
493
493
|
}
|
|
494
494
|
const outputLengthBefore = session.output.length;
|
|
495
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
495
|
+
const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
|
|
496
496
|
await integrate2(session, predicateElement);
|
|
497
497
|
const newOutputChunks = session.output.slice(outputLengthBefore);
|
|
498
498
|
const result = newOutputChunks.join("").trim();
|
|
@@ -515,11 +515,11 @@ async function evaluateCondition(session, condElement) {
|
|
|
515
515
|
}
|
|
516
516
|
const outputLengthBefore = session.output.length;
|
|
517
517
|
const args = [];
|
|
518
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
518
|
+
const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
|
|
519
519
|
for (const child of condElement.children) {
|
|
520
520
|
if (child.tag.toLowerCase() === "arg") {
|
|
521
521
|
const argOutputStart = session.output.length;
|
|
522
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
522
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
|
|
523
523
|
await integrateChildren2(session, child);
|
|
524
524
|
const newChunks = session.output.slice(argOutputStart);
|
|
525
525
|
const argValue = newChunks.join("");
|
|
@@ -583,6 +583,29 @@ import OpenAI from "openai";
|
|
|
583
583
|
import * as fs2 from "fs";
|
|
584
584
|
import * as path2 from "path";
|
|
585
585
|
import * as os from "os";
|
|
586
|
+
function pruneDialogForLLM(dialogHistory, keepRecentCount = 20) {
|
|
587
|
+
if (dialogHistory.length <= keepRecentCount) {
|
|
588
|
+
return dialogHistory;
|
|
589
|
+
}
|
|
590
|
+
const firstSystemMsg = dialogHistory.find((m) => m.role === "system");
|
|
591
|
+
const lastSystemMsg = dialogHistory.slice().reverse().find((m) => m.role === "system");
|
|
592
|
+
const recentMessages = dialogHistory.slice(-keepRecentCount);
|
|
593
|
+
const prunedRecent = recentMessages.filter((msg) => {
|
|
594
|
+
if (msg.role !== "system") return true;
|
|
595
|
+
return msg === lastSystemMsg;
|
|
596
|
+
});
|
|
597
|
+
const result = [];
|
|
598
|
+
if (firstSystemMsg && !prunedRecent.includes(firstSystemMsg)) {
|
|
599
|
+
result.push(firstSystemMsg);
|
|
600
|
+
}
|
|
601
|
+
result.push(...prunedRecent);
|
|
602
|
+
if (lastSystemMsg && lastSystemMsg !== result[result.length - 1]) {
|
|
603
|
+
const filtered = result.filter((m) => m !== lastSystemMsg);
|
|
604
|
+
filtered.push(lastSystemMsg);
|
|
605
|
+
return filtered;
|
|
606
|
+
}
|
|
607
|
+
return result;
|
|
608
|
+
}
|
|
586
609
|
function createLLMClient(provider, model) {
|
|
587
610
|
const anthropicKey = process.env.ANTHROPIC_API_KEY;
|
|
588
611
|
const openaiKey = process.env.OPENAI_API_KEY;
|
|
@@ -787,6 +810,10 @@ async function executeLLM(session, element) {
|
|
|
787
810
|
if (!noExtra) {
|
|
788
811
|
const { getAvailableSubroutines: getAvailableSubroutines2 } = await import("./session-AZIX6ILU.js");
|
|
789
812
|
const allSubroutines = getAvailableSubroutines2(session);
|
|
813
|
+
if (session.debug) {
|
|
814
|
+
console.error(`[LLM] Total subroutines from session: ${allSubroutines.length}`);
|
|
815
|
+
console.error(`[LLM] Has existing dialog: ${hasExistingDialog}`);
|
|
816
|
+
}
|
|
790
817
|
let boundaryFilteredSubroutines = allSubroutines;
|
|
791
818
|
if (showMode === "boundary") {
|
|
792
819
|
const currentBoundary = session.subBoundary;
|
|
@@ -794,11 +821,11 @@ async function executeLLM(session, element) {
|
|
|
794
821
|
console.error(`[LLM] Current boundary: ${currentBoundary}`);
|
|
795
822
|
console.error(
|
|
796
823
|
`[LLM] All subroutines before boundary filter:`,
|
|
797
|
-
allSubroutines.map((s) => ({ name: s.name, boundary: s.boundary }))
|
|
824
|
+
allSubroutines.slice(0, 5).map((s) => ({ name: s.name, boundary: s.boundary }))
|
|
798
825
|
);
|
|
799
826
|
}
|
|
800
827
|
boundaryFilteredSubroutines = allSubroutines.filter((sub) => {
|
|
801
|
-
return sub.boundary
|
|
828
|
+
return sub.boundary <= currentBoundary;
|
|
802
829
|
});
|
|
803
830
|
if (session.debug && allSubroutines.length !== boundaryFilteredSubroutines.length) {
|
|
804
831
|
console.error(`[LLM] Filtered to boundary ${currentBoundary}: ${boundaryFilteredSubroutines.length}/${allSubroutines.length} subroutines visible`);
|
|
@@ -809,6 +836,7 @@ async function executeLLM(session, element) {
|
|
|
809
836
|
return hideMeta !== "true" && hideMeta !== true;
|
|
810
837
|
});
|
|
811
838
|
if (session.debug) {
|
|
839
|
+
console.error(`[LLM] After hide-from-llm filter: ${subroutines.length} subroutines`);
|
|
812
840
|
console.error(
|
|
813
841
|
"[LLM] Subroutines available at prompt composition:",
|
|
814
842
|
subroutines.map((s) => ({ name: s.name, description: s.description, parameters: s.parameters }))
|
|
@@ -833,9 +861,10 @@ async function executeLLM(session, element) {
|
|
|
833
861
|
example = example.replace(/"/g, '"').replace(/:/g, ":");
|
|
834
862
|
systemPrompt += ">" + example + "</" + sub.name + ">";
|
|
835
863
|
}
|
|
836
|
-
|
|
864
|
+
dialogHistory.push({ role: "system", content: systemPrompt });
|
|
865
|
+
currentUserPrompt = userPrompt;
|
|
837
866
|
if (session.debug || process.env.DIRAC_LOG_PROMPT === "1") {
|
|
838
|
-
console.error("[LLM] Continuing dialog with updated subroutines\n");
|
|
867
|
+
console.error("[LLM] Continuing dialog with updated subroutines (as system message)\n");
|
|
839
868
|
}
|
|
840
869
|
} else {
|
|
841
870
|
systemPrompt = `Dirac is a XML-based language. To define a subroutine with parameters:
|
|
@@ -892,9 +921,10 @@ CRITICAL: When defining parameters:
|
|
|
892
921
|
}
|
|
893
922
|
}
|
|
894
923
|
dialogHistory.push({ role: "user", content: currentUserPrompt });
|
|
924
|
+
const prunedDialogHistory = pruneDialogForLLM(dialogHistory, 20);
|
|
895
925
|
if (session.debug) {
|
|
896
926
|
console.error(`[LLM] Calling ${model}`);
|
|
897
|
-
console.error(`[LLM] Dialog history length: ${dialogHistory.length} messages`);
|
|
927
|
+
console.error(`[LLM] Dialog history length: ${dialogHistory.length} messages (full), ${prunedDialogHistory.length} messages (pruned)`);
|
|
898
928
|
console.error(`[LLM] Has existing dialog: ${hasExistingDialog}`);
|
|
899
929
|
}
|
|
900
930
|
try {
|
|
@@ -904,26 +934,26 @@ CRITICAL: When defining parameters:
|
|
|
904
934
|
model,
|
|
905
935
|
max_tokens: maxTokens,
|
|
906
936
|
temperature,
|
|
907
|
-
messages:
|
|
937
|
+
messages: prunedDialogHistory
|
|
908
938
|
});
|
|
909
939
|
result = response.choices[0]?.message?.content || "";
|
|
910
940
|
} else if (isOllama) {
|
|
911
|
-
const ollamaPrompt =
|
|
941
|
+
const ollamaPrompt = prunedDialogHistory.map((m) => `${m.role.charAt(0).toUpperCase() + m.role.slice(1)}: ${m.content}`).join("\n");
|
|
912
942
|
result = await llmClient.complete(ollamaPrompt, {
|
|
913
943
|
model,
|
|
914
944
|
temperature,
|
|
915
945
|
max_tokens: maxTokens
|
|
916
946
|
});
|
|
917
947
|
} else if (isCustom) {
|
|
918
|
-
const customPrompt =
|
|
948
|
+
const customPrompt = prunedDialogHistory.map((m) => `${m.role}: ${m.content}`).join("\n");
|
|
919
949
|
result = await llmClient.complete(customPrompt, {
|
|
920
950
|
model,
|
|
921
951
|
temperature,
|
|
922
952
|
max_tokens: maxTokens,
|
|
923
|
-
messages:
|
|
953
|
+
messages: prunedDialogHistory
|
|
924
954
|
});
|
|
925
955
|
} else {
|
|
926
|
-
result = await callAnthropic(llmClient, model, maxTokens, temperature,
|
|
956
|
+
result = await callAnthropic(llmClient, model, maxTokens, temperature, prunedDialogHistory);
|
|
927
957
|
}
|
|
928
958
|
if (session.debug) {
|
|
929
959
|
console.error(`[LLM] Response length: ${result.length}`);
|
|
@@ -1685,7 +1715,7 @@ async function executeTagCheck(session, element) {
|
|
|
1685
1715
|
const executeTag = correctedTag || tagName;
|
|
1686
1716
|
console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
|
|
1687
1717
|
const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
|
|
1688
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
1718
|
+
const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
|
|
1689
1719
|
await integrate2(session, elementToExecute);
|
|
1690
1720
|
}
|
|
1691
1721
|
}
|
|
@@ -1694,7 +1724,7 @@ async function executeTagCheck(session, element) {
|
|
|
1694
1724
|
// src/tags/throw.ts
|
|
1695
1725
|
async function executeThrow(session, element) {
|
|
1696
1726
|
const exceptionName = element.attributes?.name || "exception";
|
|
1697
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1727
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
|
|
1698
1728
|
const exceptionDom = {
|
|
1699
1729
|
tag: "exception-content",
|
|
1700
1730
|
attributes: { name: exceptionName },
|
|
@@ -1707,7 +1737,7 @@ async function executeThrow(session, element) {
|
|
|
1707
1737
|
// src/tags/try.ts
|
|
1708
1738
|
async function executeTry(session, element) {
|
|
1709
1739
|
setExceptionBoundary(session);
|
|
1710
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1740
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
|
|
1711
1741
|
await integrateChildren2(session, element);
|
|
1712
1742
|
unsetExceptionBoundary(session);
|
|
1713
1743
|
}
|
|
@@ -1717,7 +1747,7 @@ async function executeCatch(session, element) {
|
|
|
1717
1747
|
const exceptionName = element.attributes?.name || "exception";
|
|
1718
1748
|
const caughtCount = lookupException(session, exceptionName);
|
|
1719
1749
|
if (caughtCount > 0) {
|
|
1720
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1750
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
|
|
1721
1751
|
await integrateChildren2(session, element);
|
|
1722
1752
|
}
|
|
1723
1753
|
flushCurrentException(session);
|
|
@@ -1726,7 +1756,7 @@ async function executeCatch(session, element) {
|
|
|
1726
1756
|
// src/tags/exception.ts
|
|
1727
1757
|
async function executeException(session, element) {
|
|
1728
1758
|
const exceptions = getCurrentExceptions(session);
|
|
1729
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1759
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
|
|
1730
1760
|
for (const exceptionDom of exceptions) {
|
|
1731
1761
|
await integrateChildren2(session, exceptionDom);
|
|
1732
1762
|
}
|
|
@@ -2194,7 +2224,7 @@ async function executeLoadContext(session, element) {
|
|
|
2194
2224
|
query = element.text.trim();
|
|
2195
2225
|
}
|
|
2196
2226
|
if (!query && element.children.length > 0) {
|
|
2197
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
2227
|
+
const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
|
|
2198
2228
|
const beforeOutput = session.output.length;
|
|
2199
2229
|
for (const child of element.children) {
|
|
2200
2230
|
await integrate2(session, child);
|
|
@@ -2447,7 +2477,7 @@ async function executeForeach(session, element) {
|
|
|
2447
2477
|
const parser2 = new DiracParser2();
|
|
2448
2478
|
try {
|
|
2449
2479
|
const fromElement = parser2.parse(fromAttr);
|
|
2450
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
2480
|
+
const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
|
|
2451
2481
|
await integrate2(session, fromElement);
|
|
2452
2482
|
} catch (e) {
|
|
2453
2483
|
session.output = savedOutput;
|
package/dist/cli.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "./chunk-AJSYOXXZ.js";
|
|
5
5
|
import {
|
|
6
6
|
execute
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-ZN52C2TW.js";
|
|
8
|
+
import "./chunk-ER6DSG7W.js";
|
|
9
9
|
import "./chunk-HRHAMPOB.js";
|
|
10
10
|
import "./chunk-NKA6ZJDV.js";
|
|
11
11
|
import "./chunk-3UW6GWYQ.js";
|
|
@@ -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.62",
|
|
20
20
|
description: "LLM-Augmented Declarative Execution",
|
|
21
21
|
type: "module",
|
|
22
22
|
main: "dist/index.js",
|
|
@@ -114,11 +114,11 @@ async function main() {
|
|
|
114
114
|
if (args[0] === "agent") {
|
|
115
115
|
const subcommand = args[1];
|
|
116
116
|
if (subcommand === "daemon") {
|
|
117
|
-
const { runAgentDaemon } = await import("./agent-
|
|
117
|
+
const { runAgentDaemon } = await import("./agent-HAYADDBF.js");
|
|
118
118
|
await runAgentDaemon();
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
const { AgentCLI } = await import("./agent-
|
|
121
|
+
const { AgentCLI } = await import("./agent-HAYADDBF.js");
|
|
122
122
|
const agent = new AgentCLI();
|
|
123
123
|
switch (subcommand) {
|
|
124
124
|
case "start":
|
|
@@ -145,8 +145,8 @@ async function main() {
|
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
if (args[0] === "shell") {
|
|
148
|
-
const { DiracShell } = await import("./shell-
|
|
149
|
-
const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-
|
|
148
|
+
const { DiracShell } = await import("./shell-SN7XYIDA.js");
|
|
149
|
+
const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-GEISBLMU.js");
|
|
150
150
|
const { SessionClient } = await import("./session-client-3VTC5MLO.js");
|
|
151
151
|
const daemonMode = args.includes("--daemon") || args.includes("-d");
|
|
152
152
|
const agentMode = args.includes("--agent") || args.includes("-a");
|
|
@@ -224,7 +224,7 @@ async function main() {
|
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
if (args[0] === "daemon") {
|
|
227
|
-
const { SessionServer } = await import("./session-server-
|
|
227
|
+
const { SessionServer } = await import("./session-server-GEISBLMU.js");
|
|
228
228
|
const server = new SessionServer();
|
|
229
229
|
await server.start();
|
|
230
230
|
console.log("Session daemon started");
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
createLLMAdapter,
|
|
3
3
|
execute,
|
|
4
4
|
executeUserCommand
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZN52C2TW.js";
|
|
6
6
|
import {
|
|
7
7
|
integrate
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ER6DSG7W.js";
|
|
9
9
|
import {
|
|
10
10
|
DiracParser
|
|
11
11
|
} from "./chunk-HRHAMPOB.js";
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
SessionServer,
|
|
3
3
|
getSocketPath,
|
|
4
4
|
isSessionRunning
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-6GYEZ3Z4.js";
|
|
6
|
+
import "./chunk-ER6DSG7W.js";
|
|
7
7
|
import "./chunk-HRHAMPOB.js";
|
|
8
8
|
import "./chunk-NKA6ZJDV.js";
|
|
9
9
|
import "./chunk-3UW6GWYQ.js";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-AJSYOXXZ.js";
|
|
5
5
|
import {
|
|
6
6
|
integrate
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ER6DSG7W.js";
|
|
8
8
|
import {
|
|
9
9
|
DiracParser
|
|
10
10
|
} from "./chunk-HRHAMPOB.js";
|
|
@@ -24,6 +24,8 @@ var MAX_HISTORY = 1e3;
|
|
|
24
24
|
var DiracShell = class {
|
|
25
25
|
session;
|
|
26
26
|
client = null;
|
|
27
|
+
cachedSubroutines = [];
|
|
28
|
+
// Cache for agent mode tab completion
|
|
27
29
|
braketParser;
|
|
28
30
|
xmlParser;
|
|
29
31
|
rl;
|
|
@@ -51,13 +53,26 @@ var DiracShell = class {
|
|
|
51
53
|
*/
|
|
52
54
|
setClient(client) {
|
|
53
55
|
this.client = client;
|
|
56
|
+
this.updateCachedSubroutines();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Update cached subroutines from agent
|
|
60
|
+
*/
|
|
61
|
+
async updateCachedSubroutines() {
|
|
62
|
+
if (!this.client) return;
|
|
63
|
+
try {
|
|
64
|
+
const state = await this.client.getState();
|
|
65
|
+
this.cachedSubroutines = state.subroutines || [];
|
|
66
|
+
} catch (error) {
|
|
67
|
+
}
|
|
54
68
|
}
|
|
55
69
|
completer(line) {
|
|
70
|
+
const subroutines = this.client ? this.cachedSubroutines : this.session.subroutines;
|
|
56
71
|
const attrMatch = line.match(/\|([a-z0-9_-]+)\s+.*?([a-z0-9_-]*)$/i);
|
|
57
72
|
if (attrMatch) {
|
|
58
73
|
const tagName = attrMatch[1];
|
|
59
74
|
const attrPartial = attrMatch[2];
|
|
60
|
-
const subroutine =
|
|
75
|
+
const subroutine = subroutines.find((sub) => sub.name === tagName);
|
|
61
76
|
if (subroutine && subroutine.parameters && subroutine.parameters.length > 0) {
|
|
62
77
|
const matches = subroutine.parameters.filter(
|
|
63
78
|
(p) => p.name.toLowerCase().startsWith(attrPartial.toLowerCase())
|
|
@@ -82,7 +97,7 @@ var DiracShell = class {
|
|
|
82
97
|
const tagCompleteMatch = line.match(/\|([a-z0-9_-]+)$/i);
|
|
83
98
|
if (tagCompleteMatch) {
|
|
84
99
|
const tagName = tagCompleteMatch[1];
|
|
85
|
-
const subroutine =
|
|
100
|
+
const subroutine = subroutines.find((sub) => sub.name === tagName);
|
|
86
101
|
if (subroutine && subroutine.parameters && subroutine.parameters.length > 0) {
|
|
87
102
|
console.log("\n");
|
|
88
103
|
subroutine.parameters.forEach((p) => {
|
|
@@ -98,13 +113,13 @@ var DiracShell = class {
|
|
|
98
113
|
const paramSuggestions = subroutine.parameters.map((p) => `${p.name}=`);
|
|
99
114
|
return [paramSuggestions, ""];
|
|
100
115
|
}
|
|
101
|
-
const subroutineNames =
|
|
116
|
+
const subroutineNames = subroutines.map((sub) => sub.name);
|
|
102
117
|
const matches = subroutineNames.filter(
|
|
103
118
|
(name) => name.toLowerCase().startsWith(tagName.toLowerCase())
|
|
104
119
|
);
|
|
105
120
|
if (matches.length > 0) {
|
|
106
121
|
const completions = matches.map((name) => {
|
|
107
|
-
const sub =
|
|
122
|
+
const sub = subroutines.find((s) => s.name === name);
|
|
108
123
|
const hasParams = sub && sub.parameters && sub.parameters.length > 0;
|
|
109
124
|
return hasParams ? `|${name} ` : `|${name}>`;
|
|
110
125
|
});
|
|
@@ -160,7 +175,7 @@ var DiracShell = class {
|
|
|
160
175
|
if (this.client) {
|
|
161
176
|
this.client.disconnect();
|
|
162
177
|
}
|
|
163
|
-
import("./schedule-
|
|
178
|
+
import("./schedule-VKPK4DWF.js").then(({ stopAllScheduledTasks }) => {
|
|
164
179
|
stopAllScheduledTasks();
|
|
165
180
|
console.log("\nGoodbye!");
|
|
166
181
|
process.exit(0);
|
|
@@ -268,6 +283,7 @@ var DiracShell = class {
|
|
|
268
283
|
if (output) {
|
|
269
284
|
console.log(output);
|
|
270
285
|
}
|
|
286
|
+
await this.updateCachedSubroutines();
|
|
271
287
|
return;
|
|
272
288
|
}
|
|
273
289
|
this.session.output = [];
|
|
@@ -525,7 +541,7 @@ Examples:
|
|
|
525
541
|
break;
|
|
526
542
|
case "tasks":
|
|
527
543
|
try {
|
|
528
|
-
const { listScheduledTasks } = await import("./schedule-
|
|
544
|
+
const { listScheduledTasks } = await import("./schedule-VKPK4DWF.js");
|
|
529
545
|
const tasks = listScheduledTasks();
|
|
530
546
|
if (tasks.length === 0) {
|
|
531
547
|
console.log("No scheduled tasks running.");
|
|
@@ -544,7 +560,7 @@ Examples:
|
|
|
544
560
|
console.log("Usage: :stop <task-name>");
|
|
545
561
|
} else {
|
|
546
562
|
try {
|
|
547
|
-
const { stopScheduledTask } = await import("./schedule-
|
|
563
|
+
const { stopScheduledTask } = await import("./schedule-VKPK4DWF.js");
|
|
548
564
|
const taskName = args[0];
|
|
549
565
|
const stopped = stopScheduledTask(taskName);
|
|
550
566
|
if (stopped) {
|
|
@@ -559,7 +575,7 @@ Examples:
|
|
|
559
575
|
break;
|
|
560
576
|
case "stopall":
|
|
561
577
|
try {
|
|
562
|
-
const { stopAllScheduledTasks } = await import("./schedule-
|
|
578
|
+
const { stopAllScheduledTasks } = await import("./schedule-VKPK4DWF.js");
|
|
563
579
|
stopAllScheduledTasks();
|
|
564
580
|
console.log("All scheduled tasks stopped.");
|
|
565
581
|
} catch (error) {
|
|
@@ -568,7 +584,7 @@ Examples:
|
|
|
568
584
|
break;
|
|
569
585
|
case "crons":
|
|
570
586
|
try {
|
|
571
|
-
const { listCronJobs } = await import("./cron-
|
|
587
|
+
const { listCronJobs } = await import("./cron-JAWTZUOM.js");
|
|
572
588
|
const jobs = listCronJobs();
|
|
573
589
|
if (jobs.length === 0) {
|
|
574
590
|
console.log("No cron jobs running.");
|
|
@@ -588,7 +604,7 @@ Examples:
|
|
|
588
604
|
console.log("Usage: :stopcron <job-name>");
|
|
589
605
|
} else {
|
|
590
606
|
try {
|
|
591
|
-
const { stopCronJob } = await import("./cron-
|
|
607
|
+
const { stopCronJob } = await import("./cron-JAWTZUOM.js");
|
|
592
608
|
const jobName = args[0];
|
|
593
609
|
const stopped = stopCronJob(jobName);
|
|
594
610
|
if (stopped) {
|
|
@@ -603,7 +619,7 @@ Examples:
|
|
|
603
619
|
break;
|
|
604
620
|
case "stopallcrons":
|
|
605
621
|
try {
|
|
606
|
-
const { stopAllCronJobs } = await import("./cron-
|
|
622
|
+
const { stopAllCronJobs } = await import("./cron-JAWTZUOM.js");
|
|
607
623
|
stopAllCronJobs();
|
|
608
624
|
console.log("All cron jobs stopped.");
|
|
609
625
|
} catch (error) {
|
|
@@ -612,7 +628,7 @@ Examples:
|
|
|
612
628
|
break;
|
|
613
629
|
case "scheduled":
|
|
614
630
|
try {
|
|
615
|
-
const { listScheduledRuns } = await import("./run-at-
|
|
631
|
+
const { listScheduledRuns } = await import("./run-at-BMPXOIW4.js");
|
|
616
632
|
const runs = listScheduledRuns();
|
|
617
633
|
if (runs.length === 0) {
|
|
618
634
|
console.log("No scheduled runs pending.");
|
|
@@ -632,7 +648,7 @@ Examples:
|
|
|
632
648
|
console.log("Usage: :cancel <run-name>");
|
|
633
649
|
} else {
|
|
634
650
|
try {
|
|
635
|
-
const { cancelScheduledRun } = await import("./run-at-
|
|
651
|
+
const { cancelScheduledRun } = await import("./run-at-BMPXOIW4.js");
|
|
636
652
|
const runName = args[0];
|
|
637
653
|
const cancelled = cancelScheduledRun(runName);
|
|
638
654
|
if (cancelled) {
|
|
@@ -647,7 +663,7 @@ Examples:
|
|
|
647
663
|
break;
|
|
648
664
|
case "cancelall":
|
|
649
665
|
try {
|
|
650
|
-
const { cancelAllScheduledRuns } = await import("./run-at-
|
|
666
|
+
const { cancelAllScheduledRuns } = await import("./run-at-BMPXOIW4.js");
|
|
651
667
|
cancelAllScheduledRuns();
|
|
652
668
|
console.log("All scheduled runs cancelled.");
|
|
653
669
|
} catch (error) {
|
package/dist/test-runner.js
CHANGED