dirac-lang 0.1.62 → 0.1.64
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-3VQNLFHO.js → agent-HAYADDBF.js} +2 -2
- package/dist/{chunk-WPEAYK2Q.js → chunk-6GYEZ3Z4.js} +1 -1
- package/dist/{chunk-BAO2WV34.js → chunk-ER6DSG7W.js} +49 -20
- package/dist/{chunk-SVB7OJDA.js → chunk-ZN52C2TW.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/{cron-SUYXFAW7.js → cron-JAWTZUOM.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{interpreter-UFWRGTCM.js → interpreter-P7ZMLP32.js} +1 -1
- package/dist/{run-at-BBMPAVED.js → run-at-BMPXOIW4.js} +1 -1
- package/dist/{schedule-F7JHVWEV.js → schedule-VKPK4DWF.js} +1 -1
- package/dist/{session-server-BQH56RCK.js → session-server-GEISBLMU.js} +2 -2
- package/dist/{shell-KGS3I6WX.js → shell-6NG7WK5Z.js} +117 -12
- 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";
|
|
@@ -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 }))
|
|
@@ -893,9 +921,10 @@ CRITICAL: When defining parameters:
|
|
|
893
921
|
}
|
|
894
922
|
}
|
|
895
923
|
dialogHistory.push({ role: "user", content: currentUserPrompt });
|
|
924
|
+
const prunedDialogHistory = pruneDialogForLLM(dialogHistory, 20);
|
|
896
925
|
if (session.debug) {
|
|
897
926
|
console.error(`[LLM] Calling ${model}`);
|
|
898
|
-
console.error(`[LLM] Dialog history length: ${dialogHistory.length} messages`);
|
|
927
|
+
console.error(`[LLM] Dialog history length: ${dialogHistory.length} messages (full), ${prunedDialogHistory.length} messages (pruned)`);
|
|
899
928
|
console.error(`[LLM] Has existing dialog: ${hasExistingDialog}`);
|
|
900
929
|
}
|
|
901
930
|
try {
|
|
@@ -905,26 +934,26 @@ CRITICAL: When defining parameters:
|
|
|
905
934
|
model,
|
|
906
935
|
max_tokens: maxTokens,
|
|
907
936
|
temperature,
|
|
908
|
-
messages:
|
|
937
|
+
messages: prunedDialogHistory
|
|
909
938
|
});
|
|
910
939
|
result = response.choices[0]?.message?.content || "";
|
|
911
940
|
} else if (isOllama) {
|
|
912
|
-
const ollamaPrompt =
|
|
941
|
+
const ollamaPrompt = prunedDialogHistory.map((m) => `${m.role.charAt(0).toUpperCase() + m.role.slice(1)}: ${m.content}`).join("\n");
|
|
913
942
|
result = await llmClient.complete(ollamaPrompt, {
|
|
914
943
|
model,
|
|
915
944
|
temperature,
|
|
916
945
|
max_tokens: maxTokens
|
|
917
946
|
});
|
|
918
947
|
} else if (isCustom) {
|
|
919
|
-
const customPrompt =
|
|
948
|
+
const customPrompt = prunedDialogHistory.map((m) => `${m.role}: ${m.content}`).join("\n");
|
|
920
949
|
result = await llmClient.complete(customPrompt, {
|
|
921
950
|
model,
|
|
922
951
|
temperature,
|
|
923
952
|
max_tokens: maxTokens,
|
|
924
|
-
messages:
|
|
953
|
+
messages: prunedDialogHistory
|
|
925
954
|
});
|
|
926
955
|
} else {
|
|
927
|
-
result = await callAnthropic(llmClient, model, maxTokens, temperature,
|
|
956
|
+
result = await callAnthropic(llmClient, model, maxTokens, temperature, prunedDialogHistory);
|
|
928
957
|
}
|
|
929
958
|
if (session.debug) {
|
|
930
959
|
console.error(`[LLM] Response length: ${result.length}`);
|
|
@@ -1686,7 +1715,7 @@ async function executeTagCheck(session, element) {
|
|
|
1686
1715
|
const executeTag = correctedTag || tagName;
|
|
1687
1716
|
console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
|
|
1688
1717
|
const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
|
|
1689
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
1718
|
+
const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
|
|
1690
1719
|
await integrate2(session, elementToExecute);
|
|
1691
1720
|
}
|
|
1692
1721
|
}
|
|
@@ -1695,7 +1724,7 @@ async function executeTagCheck(session, element) {
|
|
|
1695
1724
|
// src/tags/throw.ts
|
|
1696
1725
|
async function executeThrow(session, element) {
|
|
1697
1726
|
const exceptionName = element.attributes?.name || "exception";
|
|
1698
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1727
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
|
|
1699
1728
|
const exceptionDom = {
|
|
1700
1729
|
tag: "exception-content",
|
|
1701
1730
|
attributes: { name: exceptionName },
|
|
@@ -1708,7 +1737,7 @@ async function executeThrow(session, element) {
|
|
|
1708
1737
|
// src/tags/try.ts
|
|
1709
1738
|
async function executeTry(session, element) {
|
|
1710
1739
|
setExceptionBoundary(session);
|
|
1711
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1740
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
|
|
1712
1741
|
await integrateChildren2(session, element);
|
|
1713
1742
|
unsetExceptionBoundary(session);
|
|
1714
1743
|
}
|
|
@@ -1718,7 +1747,7 @@ async function executeCatch(session, element) {
|
|
|
1718
1747
|
const exceptionName = element.attributes?.name || "exception";
|
|
1719
1748
|
const caughtCount = lookupException(session, exceptionName);
|
|
1720
1749
|
if (caughtCount > 0) {
|
|
1721
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1750
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
|
|
1722
1751
|
await integrateChildren2(session, element);
|
|
1723
1752
|
}
|
|
1724
1753
|
flushCurrentException(session);
|
|
@@ -1727,7 +1756,7 @@ async function executeCatch(session, element) {
|
|
|
1727
1756
|
// src/tags/exception.ts
|
|
1728
1757
|
async function executeException(session, element) {
|
|
1729
1758
|
const exceptions = getCurrentExceptions(session);
|
|
1730
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1759
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-P7ZMLP32.js");
|
|
1731
1760
|
for (const exceptionDom of exceptions) {
|
|
1732
1761
|
await integrateChildren2(session, exceptionDom);
|
|
1733
1762
|
}
|
|
@@ -2195,7 +2224,7 @@ async function executeLoadContext(session, element) {
|
|
|
2195
2224
|
query = element.text.trim();
|
|
2196
2225
|
}
|
|
2197
2226
|
if (!query && element.children.length > 0) {
|
|
2198
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
2227
|
+
const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
|
|
2199
2228
|
const beforeOutput = session.output.length;
|
|
2200
2229
|
for (const child of element.children) {
|
|
2201
2230
|
await integrate2(session, child);
|
|
@@ -2448,7 +2477,7 @@ async function executeForeach(session, element) {
|
|
|
2448
2477
|
const parser2 = new DiracParser2();
|
|
2449
2478
|
try {
|
|
2450
2479
|
const fromElement = parser2.parse(fromAttr);
|
|
2451
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
2480
|
+
const { integrate: integrate2 } = await import("./interpreter-P7ZMLP32.js");
|
|
2452
2481
|
await integrate2(session, fromElement);
|
|
2453
2482
|
} catch (e) {
|
|
2454
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.63",
|
|
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-6NG7WK5Z.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";
|
|
@@ -68,6 +68,65 @@ var DiracShell = class {
|
|
|
68
68
|
}
|
|
69
69
|
completer(line) {
|
|
70
70
|
const subroutines = this.client ? this.cachedSubroutines : this.session.subroutines;
|
|
71
|
+
const varMatch = line.match(/\$([a-zA-Z0-9_-]*)$/);
|
|
72
|
+
if (varMatch) {
|
|
73
|
+
const partial = varMatch[1];
|
|
74
|
+
const varNames = Object.keys(this.session.variables || {});
|
|
75
|
+
const commonEnvVars = [
|
|
76
|
+
"HOME",
|
|
77
|
+
"PATH",
|
|
78
|
+
"USER",
|
|
79
|
+
"SHELL",
|
|
80
|
+
"PWD",
|
|
81
|
+
"OLDPWD",
|
|
82
|
+
"TERM",
|
|
83
|
+
"LANG",
|
|
84
|
+
"EDITOR",
|
|
85
|
+
"TMPDIR",
|
|
86
|
+
"PS1"
|
|
87
|
+
];
|
|
88
|
+
const envVarNames = Object.keys(process.env).filter(
|
|
89
|
+
(name) => commonEnvVars.includes(name) || name.startsWith("DIRAC_") || name.startsWith("TELEGRAM_")
|
|
90
|
+
);
|
|
91
|
+
const allVars = [...varNames, ...envVarNames];
|
|
92
|
+
const matches = allVars.filter(
|
|
93
|
+
(name) => name.toLowerCase().startsWith(partial.toLowerCase())
|
|
94
|
+
);
|
|
95
|
+
const completions = matches.map((name) => `$${name}`);
|
|
96
|
+
return [completions, varMatch[0]];
|
|
97
|
+
}
|
|
98
|
+
const pathMatch = line.match(/((?:\.\.?\/|~\/|\/)[^\s]*)$/);
|
|
99
|
+
if (pathMatch) {
|
|
100
|
+
const partial = pathMatch[1];
|
|
101
|
+
try {
|
|
102
|
+
let searchPath = partial;
|
|
103
|
+
if (searchPath.startsWith("~/")) {
|
|
104
|
+
searchPath = path.join(os.homedir(), searchPath.slice(2));
|
|
105
|
+
}
|
|
106
|
+
const dirPath = path.dirname(searchPath);
|
|
107
|
+
const filePrefix = path.basename(searchPath);
|
|
108
|
+
if (fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) {
|
|
109
|
+
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
110
|
+
const matches = entries.filter((entry) => entry.name.startsWith(filePrefix)).map((entry) => {
|
|
111
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
112
|
+
let displayPath = fullPath;
|
|
113
|
+
if (partial.startsWith("~/")) {
|
|
114
|
+
displayPath = "~/" + path.relative(os.homedir(), fullPath);
|
|
115
|
+
} else if (partial.startsWith("./") || partial.startsWith("../")) {
|
|
116
|
+
displayPath = path.relative(process.cwd(), fullPath);
|
|
117
|
+
if (!displayPath.startsWith(".")) {
|
|
118
|
+
displayPath = "./" + displayPath;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return entry.isDirectory() ? displayPath + "/" : displayPath;
|
|
122
|
+
});
|
|
123
|
+
if (matches.length > 0) {
|
|
124
|
+
return [matches, pathMatch[0]];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
} catch (error) {
|
|
128
|
+
}
|
|
129
|
+
}
|
|
71
130
|
const attrMatch = line.match(/\|([a-z0-9_-]+)\s+.*?([a-z0-9_-]*)$/i);
|
|
72
131
|
if (attrMatch) {
|
|
73
132
|
const tagName = attrMatch[1];
|
|
@@ -143,11 +202,57 @@ var DiracShell = class {
|
|
|
143
202
|
const commandMatch = line.match(/:([a-z]*)$/i);
|
|
144
203
|
if (commandMatch) {
|
|
145
204
|
const partial = commandMatch[1];
|
|
146
|
-
const commands = ["help", "quit", "exit", "vars", "subs", "clear", "history", "save", "debug", "llm"];
|
|
205
|
+
const commands = ["help", "quit", "exit", "vars", "subs", "clear", "history", "save", "debug", "llm", "index"];
|
|
147
206
|
const matches = commands.filter((cmd) => cmd.startsWith(partial.toLowerCase()));
|
|
148
207
|
const completions = matches.map((cmd) => `:${cmd}`);
|
|
149
208
|
return [completions, commandMatch[0]];
|
|
150
209
|
}
|
|
210
|
+
if (line.includes("<system>") || line.includes("|system>")) {
|
|
211
|
+
const systemMatch = line.match(/(?:<system>|\\|system>)\s*([a-z]*)$/i);
|
|
212
|
+
if (systemMatch) {
|
|
213
|
+
const partial = systemMatch[1];
|
|
214
|
+
const commonCommands = [
|
|
215
|
+
"ls",
|
|
216
|
+
"cd",
|
|
217
|
+
"pwd",
|
|
218
|
+
"cat",
|
|
219
|
+
"grep",
|
|
220
|
+
"find",
|
|
221
|
+
"echo",
|
|
222
|
+
"cp",
|
|
223
|
+
"mv",
|
|
224
|
+
"rm",
|
|
225
|
+
"mkdir",
|
|
226
|
+
"touch",
|
|
227
|
+
"git",
|
|
228
|
+
"npm",
|
|
229
|
+
"node",
|
|
230
|
+
"python",
|
|
231
|
+
"curl",
|
|
232
|
+
"wget",
|
|
233
|
+
"ssh",
|
|
234
|
+
"scp",
|
|
235
|
+
"tar",
|
|
236
|
+
"gzip",
|
|
237
|
+
"diff",
|
|
238
|
+
"ps",
|
|
239
|
+
"top",
|
|
240
|
+
"kill",
|
|
241
|
+
"chmod",
|
|
242
|
+
"chown",
|
|
243
|
+
"ln",
|
|
244
|
+
"du",
|
|
245
|
+
"df",
|
|
246
|
+
"which",
|
|
247
|
+
"man",
|
|
248
|
+
"history"
|
|
249
|
+
];
|
|
250
|
+
const matches = commonCommands.filter((cmd) => cmd.startsWith(partial.toLowerCase()));
|
|
251
|
+
if (matches.length > 0) {
|
|
252
|
+
return [matches, partial];
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
151
256
|
return [[], line];
|
|
152
257
|
}
|
|
153
258
|
loadHistory() {
|
|
@@ -175,7 +280,7 @@ var DiracShell = class {
|
|
|
175
280
|
if (this.client) {
|
|
176
281
|
this.client.disconnect();
|
|
177
282
|
}
|
|
178
|
-
import("./schedule-
|
|
283
|
+
import("./schedule-VKPK4DWF.js").then(({ stopAllScheduledTasks }) => {
|
|
179
284
|
stopAllScheduledTasks();
|
|
180
285
|
console.log("\nGoodbye!");
|
|
181
286
|
process.exit(0);
|
|
@@ -541,7 +646,7 @@ Examples:
|
|
|
541
646
|
break;
|
|
542
647
|
case "tasks":
|
|
543
648
|
try {
|
|
544
|
-
const { listScheduledTasks } = await import("./schedule-
|
|
649
|
+
const { listScheduledTasks } = await import("./schedule-VKPK4DWF.js");
|
|
545
650
|
const tasks = listScheduledTasks();
|
|
546
651
|
if (tasks.length === 0) {
|
|
547
652
|
console.log("No scheduled tasks running.");
|
|
@@ -560,7 +665,7 @@ Examples:
|
|
|
560
665
|
console.log("Usage: :stop <task-name>");
|
|
561
666
|
} else {
|
|
562
667
|
try {
|
|
563
|
-
const { stopScheduledTask } = await import("./schedule-
|
|
668
|
+
const { stopScheduledTask } = await import("./schedule-VKPK4DWF.js");
|
|
564
669
|
const taskName = args[0];
|
|
565
670
|
const stopped = stopScheduledTask(taskName);
|
|
566
671
|
if (stopped) {
|
|
@@ -575,7 +680,7 @@ Examples:
|
|
|
575
680
|
break;
|
|
576
681
|
case "stopall":
|
|
577
682
|
try {
|
|
578
|
-
const { stopAllScheduledTasks } = await import("./schedule-
|
|
683
|
+
const { stopAllScheduledTasks } = await import("./schedule-VKPK4DWF.js");
|
|
579
684
|
stopAllScheduledTasks();
|
|
580
685
|
console.log("All scheduled tasks stopped.");
|
|
581
686
|
} catch (error) {
|
|
@@ -584,7 +689,7 @@ Examples:
|
|
|
584
689
|
break;
|
|
585
690
|
case "crons":
|
|
586
691
|
try {
|
|
587
|
-
const { listCronJobs } = await import("./cron-
|
|
692
|
+
const { listCronJobs } = await import("./cron-JAWTZUOM.js");
|
|
588
693
|
const jobs = listCronJobs();
|
|
589
694
|
if (jobs.length === 0) {
|
|
590
695
|
console.log("No cron jobs running.");
|
|
@@ -604,7 +709,7 @@ Examples:
|
|
|
604
709
|
console.log("Usage: :stopcron <job-name>");
|
|
605
710
|
} else {
|
|
606
711
|
try {
|
|
607
|
-
const { stopCronJob } = await import("./cron-
|
|
712
|
+
const { stopCronJob } = await import("./cron-JAWTZUOM.js");
|
|
608
713
|
const jobName = args[0];
|
|
609
714
|
const stopped = stopCronJob(jobName);
|
|
610
715
|
if (stopped) {
|
|
@@ -619,7 +724,7 @@ Examples:
|
|
|
619
724
|
break;
|
|
620
725
|
case "stopallcrons":
|
|
621
726
|
try {
|
|
622
|
-
const { stopAllCronJobs } = await import("./cron-
|
|
727
|
+
const { stopAllCronJobs } = await import("./cron-JAWTZUOM.js");
|
|
623
728
|
stopAllCronJobs();
|
|
624
729
|
console.log("All cron jobs stopped.");
|
|
625
730
|
} catch (error) {
|
|
@@ -628,7 +733,7 @@ Examples:
|
|
|
628
733
|
break;
|
|
629
734
|
case "scheduled":
|
|
630
735
|
try {
|
|
631
|
-
const { listScheduledRuns } = await import("./run-at-
|
|
736
|
+
const { listScheduledRuns } = await import("./run-at-BMPXOIW4.js");
|
|
632
737
|
const runs = listScheduledRuns();
|
|
633
738
|
if (runs.length === 0) {
|
|
634
739
|
console.log("No scheduled runs pending.");
|
|
@@ -648,7 +753,7 @@ Examples:
|
|
|
648
753
|
console.log("Usage: :cancel <run-name>");
|
|
649
754
|
} else {
|
|
650
755
|
try {
|
|
651
|
-
const { cancelScheduledRun } = await import("./run-at-
|
|
756
|
+
const { cancelScheduledRun } = await import("./run-at-BMPXOIW4.js");
|
|
652
757
|
const runName = args[0];
|
|
653
758
|
const cancelled = cancelScheduledRun(runName);
|
|
654
759
|
if (cancelled) {
|
|
@@ -663,7 +768,7 @@ Examples:
|
|
|
663
768
|
break;
|
|
664
769
|
case "cancelall":
|
|
665
770
|
try {
|
|
666
|
-
const { cancelAllScheduledRuns } = await import("./run-at-
|
|
771
|
+
const { cancelAllScheduledRuns } = await import("./run-at-BMPXOIW4.js");
|
|
667
772
|
cancelAllScheduledRuns();
|
|
668
773
|
console.log("All scheduled runs cancelled.");
|
|
669
774
|
} catch (error) {
|
package/dist/test-runner.js
CHANGED