dirac-lang 0.1.74 → 0.1.77

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/cli.js CHANGED
@@ -4,10 +4,11 @@ import {
4
4
  } from "./chunk-AJSYOXXZ.js";
5
5
  import {
6
6
  execute
7
- } from "./chunk-2EUVDYHX.js";
8
- import "./chunk-YCUHRNXQ.js";
9
- import "./chunk-HRHAMPOB.js";
7
+ } from "./chunk-VUMS53GF.js";
8
+ import "./chunk-TYIDNAZ7.js";
10
9
  import "./chunk-VC23AJJJ.js";
10
+ import "./chunk-FPDW535D.js";
11
+ import "./chunk-HRHAMPOB.js";
11
12
  import "./chunk-M57VI7KL.js";
12
13
 
13
14
  // src/cli.ts
@@ -16,7 +17,7 @@ import "dotenv/config";
16
17
  // package.json
17
18
  var package_default = {
18
19
  name: "dirac-lang",
19
- version: "0.1.72",
20
+ version: "0.1.76",
20
21
  description: "LLM-Augmented Declarative Execution",
21
22
  type: "module",
22
23
  main: "dist/index.js",
@@ -91,15 +92,44 @@ function loadShellConfig(args = []) {
91
92
  }
92
93
  }
93
94
  if (!shellConfig.llmProvider) {
94
- const defaultConfigPath = resolve(process.cwd(), "config.yml");
95
- if (fs.existsSync(defaultConfigPath)) {
96
- try {
97
- const configData = yaml.load(fs.readFileSync(defaultConfigPath, "utf-8"));
98
- shellConfig.llmProvider = shellConfig.llmProvider || configData.llmProvider;
99
- shellConfig.llmModel = shellConfig.llmModel || configData.llmModel;
100
- shellConfig.customLLMUrl = shellConfig.customLLMUrl || configData.customLLMUrl;
101
- shellConfig.initScript = shellConfig.initScript || configData.initScript;
102
- } catch (err) {
95
+ const configPaths = [
96
+ resolve(process.cwd(), "config.yml"),
97
+ resolve(process.env.HOME || "~", ".dirac", "config.yml")
98
+ ];
99
+ for (const configPath of configPaths) {
100
+ if (fs.existsSync(configPath)) {
101
+ try {
102
+ const configData = yaml.load(fs.readFileSync(configPath, "utf-8"));
103
+ shellConfig.llmProvider = shellConfig.llmProvider || configData.llmProvider;
104
+ shellConfig.llmModel = shellConfig.llmModel || configData.llmModel;
105
+ shellConfig.customLLMUrl = shellConfig.customLLMUrl || configData.customLLMUrl;
106
+ if (configData.initScript && !shellConfig.initScript) {
107
+ const configDir = configPath.substring(0, configPath.lastIndexOf("/"));
108
+ shellConfig.initScript = resolve(configDir, configData.initScript);
109
+ }
110
+ break;
111
+ } catch (err) {
112
+ }
113
+ }
114
+ }
115
+ }
116
+ if (!shellConfig.llmProvider) {
117
+ shellConfig.llmProvider = process.env.LLM_PROVIDER;
118
+ shellConfig.llmModel = process.env.LLM_MODEL;
119
+ shellConfig.customLLMUrl = process.env.CUSTOM_LLM_URL;
120
+ if (!shellConfig.llmProvider) {
121
+ if (process.env.ANTHROPIC_API_KEY) {
122
+ shellConfig.llmProvider = "anthropic";
123
+ shellConfig.llmModel = shellConfig.llmModel || "claude-sonnet-4-20250514";
124
+ } else if (process.env.OPENAI_API_KEY) {
125
+ shellConfig.llmProvider = "openai";
126
+ shellConfig.llmModel = shellConfig.llmModel || "gpt-4o";
127
+ }
128
+ }
129
+ if (!shellConfig.initScript) {
130
+ const globalInitScript = resolve(process.env.HOME || "~", ".dirac", "shell-init.di");
131
+ if (fs.existsSync(globalInitScript)) {
132
+ shellConfig.initScript = globalInitScript;
103
133
  }
104
134
  }
105
135
  }
@@ -109,7 +139,7 @@ async function main() {
109
139
  const args = process.argv.slice(2);
110
140
  const calledAs = process.argv[1];
111
141
  if (calledAs && calledAs.endsWith("/dish")) {
112
- const { DiracShell } = await import("./shell-EB5Z2U45.js");
142
+ const { DiracShell } = await import("./shell-IUWCSKPG.js");
113
143
  const shellConfig = loadShellConfig(args);
114
144
  const shell = new DiracShell(shellConfig);
115
145
  await shell.start();
@@ -158,11 +188,11 @@ async function main() {
158
188
  if (args[0] === "agent") {
159
189
  const subcommand = args[1];
160
190
  if (subcommand === "daemon") {
161
- const { runAgentDaemon } = await import("./agent-TC34E2DB.js");
191
+ const { runAgentDaemon } = await import("./agent-VAFUNYDM.js");
162
192
  await runAgentDaemon();
163
193
  return;
164
194
  }
165
- const { AgentCLI } = await import("./agent-TC34E2DB.js");
195
+ const { AgentCLI } = await import("./agent-VAFUNYDM.js");
166
196
  const agent = new AgentCLI();
167
197
  switch (subcommand) {
168
198
  case "start":
@@ -189,8 +219,8 @@ async function main() {
189
219
  return;
190
220
  }
191
221
  if (args[0] === "shell") {
192
- const { DiracShell } = await import("./shell-EB5Z2U45.js");
193
- const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-K6OZRYTZ.js");
222
+ const { DiracShell } = await import("./shell-IUWCSKPG.js");
223
+ const { SessionServer, isSessionRunning, getSocketPath } = await import("./session-server-IDEV4CXY.js");
194
224
  const { SessionClient } = await import("./session-client-3VTC5MLO.js");
195
225
  const daemonMode = args.includes("--daemon") || args.includes("-d");
196
226
  const agentMode = args.includes("--agent") || args.includes("-a");
@@ -236,7 +266,7 @@ async function main() {
236
266
  return;
237
267
  }
238
268
  if (args[0] === "daemon") {
239
- const { SessionServer } = await import("./session-server-K6OZRYTZ.js");
269
+ const { SessionServer } = await import("./session-server-IDEV4CXY.js");
240
270
  const server = new SessionServer();
241
271
  await server.start();
242
272
  console.log("Session daemon started");
@@ -3,9 +3,10 @@ import {
3
3
  listCronJobs,
4
4
  stopAllCronJobs,
5
5
  stopCronJob
6
- } from "./chunk-YCUHRNXQ.js";
7
- import "./chunk-HRHAMPOB.js";
6
+ } from "./chunk-TYIDNAZ7.js";
8
7
  import "./chunk-VC23AJJJ.js";
8
+ import "./chunk-FPDW535D.js";
9
+ import "./chunk-HRHAMPOB.js";
9
10
  import "./chunk-M57VI7KL.js";
10
11
  export {
11
12
  executeCron,
package/dist/index.js CHANGED
@@ -2,14 +2,15 @@ import {
2
2
  createLLMAdapter,
3
3
  execute,
4
4
  executeUserCommand
5
- } from "./chunk-2EUVDYHX.js";
5
+ } from "./chunk-VUMS53GF.js";
6
6
  import {
7
7
  integrate
8
- } from "./chunk-YCUHRNXQ.js";
8
+ } from "./chunk-TYIDNAZ7.js";
9
+ import "./chunk-VC23AJJJ.js";
10
+ import "./chunk-FPDW535D.js";
9
11
  import {
10
12
  DiracParser
11
13
  } from "./chunk-HRHAMPOB.js";
12
- import "./chunk-VC23AJJJ.js";
13
14
  import {
14
15
  createSession,
15
16
  getAvailableSubroutines,
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  integrate,
3
3
  integrateChildren
4
- } from "./chunk-YCUHRNXQ.js";
5
- import "./chunk-HRHAMPOB.js";
4
+ } from "./chunk-TYIDNAZ7.js";
6
5
  import "./chunk-VC23AJJJ.js";
6
+ import "./chunk-FPDW535D.js";
7
+ import "./chunk-HRHAMPOB.js";
7
8
  import "./chunk-M57VI7KL.js";
8
9
  export {
9
10
  integrate,
@@ -3,9 +3,10 @@ import {
3
3
  cancelScheduledRun,
4
4
  executeRunAt,
5
5
  listScheduledRuns
6
- } from "./chunk-YCUHRNXQ.js";
7
- import "./chunk-HRHAMPOB.js";
6
+ } from "./chunk-TYIDNAZ7.js";
8
7
  import "./chunk-VC23AJJJ.js";
8
+ import "./chunk-FPDW535D.js";
9
+ import "./chunk-HRHAMPOB.js";
9
10
  import "./chunk-M57VI7KL.js";
10
11
  export {
11
12
  cancelAllScheduledRuns,
@@ -3,9 +3,10 @@ import {
3
3
  listScheduledTasks,
4
4
  stopAllScheduledTasks,
5
5
  stopScheduledTask
6
- } from "./chunk-YCUHRNXQ.js";
7
- import "./chunk-HRHAMPOB.js";
6
+ } from "./chunk-TYIDNAZ7.js";
8
7
  import "./chunk-VC23AJJJ.js";
8
+ import "./chunk-FPDW535D.js";
9
+ import "./chunk-HRHAMPOB.js";
9
10
  import "./chunk-M57VI7KL.js";
10
11
  export {
11
12
  executeSchedule,
@@ -2,10 +2,11 @@ import {
2
2
  SessionServer,
3
3
  getSocketPath,
4
4
  isSessionRunning
5
- } from "./chunk-KIIETJFM.js";
6
- import "./chunk-YCUHRNXQ.js";
7
- import "./chunk-HRHAMPOB.js";
5
+ } from "./chunk-CLGQYGHT.js";
6
+ import "./chunk-TYIDNAZ7.js";
8
7
  import "./chunk-VC23AJJJ.js";
8
+ import "./chunk-FPDW535D.js";
9
+ import "./chunk-HRHAMPOB.js";
9
10
  import "./chunk-M57VI7KL.js";
10
11
  export {
11
12
  SessionServer,
@@ -4,11 +4,12 @@ import {
4
4
  } from "./chunk-AJSYOXXZ.js";
5
5
  import {
6
6
  integrate
7
- } from "./chunk-YCUHRNXQ.js";
7
+ } from "./chunk-TYIDNAZ7.js";
8
+ import "./chunk-VC23AJJJ.js";
9
+ import "./chunk-FPDW535D.js";
8
10
  import {
9
11
  DiracParser
10
12
  } from "./chunk-HRHAMPOB.js";
11
- import "./chunk-VC23AJJJ.js";
12
13
  import {
13
14
  createSession
14
15
  } from "./chunk-M57VI7KL.js";
@@ -359,7 +360,7 @@ var DiracShell = class {
359
360
  if (this.client) {
360
361
  this.client.disconnect();
361
362
  }
362
- import("./schedule-FWAU6HDT.js").then(({ stopAllScheduledTasks }) => {
363
+ import("./schedule-4B3KUC7T.js").then(({ stopAllScheduledTasks }) => {
363
364
  stopAllScheduledTasks();
364
365
  console.log("\nGoodbye!");
365
366
  process.exit(0);
@@ -752,7 +753,7 @@ Examples:
752
753
  break;
753
754
  case "tasks":
754
755
  try {
755
- const { listScheduledTasks } = await import("./schedule-FWAU6HDT.js");
756
+ const { listScheduledTasks } = await import("./schedule-4B3KUC7T.js");
756
757
  const tasks = listScheduledTasks();
757
758
  if (tasks.length === 0) {
758
759
  console.log("No scheduled tasks running.");
@@ -771,7 +772,7 @@ Examples:
771
772
  console.log("Usage: :stop <task-name>");
772
773
  } else {
773
774
  try {
774
- const { stopScheduledTask } = await import("./schedule-FWAU6HDT.js");
775
+ const { stopScheduledTask } = await import("./schedule-4B3KUC7T.js");
775
776
  const taskName = args[0];
776
777
  const stopped = stopScheduledTask(taskName);
777
778
  if (stopped) {
@@ -786,7 +787,7 @@ Examples:
786
787
  break;
787
788
  case "stopall":
788
789
  try {
789
- const { stopAllScheduledTasks } = await import("./schedule-FWAU6HDT.js");
790
+ const { stopAllScheduledTasks } = await import("./schedule-4B3KUC7T.js");
790
791
  stopAllScheduledTasks();
791
792
  console.log("All scheduled tasks stopped.");
792
793
  } catch (error) {
@@ -795,7 +796,7 @@ Examples:
795
796
  break;
796
797
  case "crons":
797
798
  try {
798
- const { listCronJobs } = await import("./cron-M5HO2H5T.js");
799
+ const { listCronJobs } = await import("./cron-RWSM6IBB.js");
799
800
  const jobs = listCronJobs();
800
801
  if (jobs.length === 0) {
801
802
  console.log("No cron jobs running.");
@@ -815,7 +816,7 @@ Examples:
815
816
  console.log("Usage: :stopcron <job-name>");
816
817
  } else {
817
818
  try {
818
- const { stopCronJob } = await import("./cron-M5HO2H5T.js");
819
+ const { stopCronJob } = await import("./cron-RWSM6IBB.js");
819
820
  const jobName = args[0];
820
821
  const stopped = stopCronJob(jobName);
821
822
  if (stopped) {
@@ -830,7 +831,7 @@ Examples:
830
831
  break;
831
832
  case "stopallcrons":
832
833
  try {
833
- const { stopAllCronJobs } = await import("./cron-M5HO2H5T.js");
834
+ const { stopAllCronJobs } = await import("./cron-RWSM6IBB.js");
834
835
  stopAllCronJobs();
835
836
  console.log("All cron jobs stopped.");
836
837
  } catch (error) {
@@ -839,7 +840,7 @@ Examples:
839
840
  break;
840
841
  case "scheduled":
841
842
  try {
842
- const { listScheduledRuns } = await import("./run-at-GP5XZP5W.js");
843
+ const { listScheduledRuns } = await import("./run-at-3QL4C4UD.js");
843
844
  const runs = listScheduledRuns();
844
845
  if (runs.length === 0) {
845
846
  console.log("No scheduled runs pending.");
@@ -859,7 +860,7 @@ Examples:
859
860
  console.log("Usage: :cancel <run-name>");
860
861
  } else {
861
862
  try {
862
- const { cancelScheduledRun } = await import("./run-at-GP5XZP5W.js");
863
+ const { cancelScheduledRun } = await import("./run-at-3QL4C4UD.js");
863
864
  const runName = args[0];
864
865
  const cancelled = cancelScheduledRun(runName);
865
866
  if (cancelled) {
@@ -874,7 +875,7 @@ Examples:
874
875
  break;
875
876
  case "cancelall":
876
877
  try {
877
- const { cancelAllScheduledRuns } = await import("./run-at-GP5XZP5W.js");
878
+ const { cancelAllScheduledRuns } = await import("./run-at-3QL4C4UD.js");
878
879
  cancelAllScheduledRuns();
879
880
  console.log("All scheduled runs cancelled.");
880
881
  } catch (error) {
@@ -967,8 +968,12 @@ Examples:
967
968
  console.log(`LLM: ${this.config.llmProvider} (${this.config.llmModel || "default"})
968
969
  `);
969
970
  } else {
970
- console.log("Warning: No LLM provider configured. Set LLM_PROVIDER environment variable.\n");
971
+ console.log("No LLM provider configured.");
972
+ console.log("Set ANTHROPIC_API_KEY or OPENAI_API_KEY environment variable,");
973
+ console.log("or create ~/.dirac/config.yml with llmProvider and llmModel.\n");
971
974
  }
975
+ const { registry } = await import("./subroutine-index-7B5YXKAA.js");
976
+ await registry.autoIndexStdlib();
972
977
  if (this.config.initScript) {
973
978
  await this.runInitScript(this.config.initScript);
974
979
  }
@@ -978,8 +983,6 @@ Examples:
978
983
  try {
979
984
  const resolvedPath = path.isAbsolute(scriptPath) ? scriptPath : path.join(process.cwd(), scriptPath);
980
985
  if (!fs.existsSync(resolvedPath)) {
981
- console.log(`Init script not found: ${scriptPath}
982
- `);
983
986
  return;
984
987
  }
985
988
  console.log(`Loading init script: ${scriptPath}`);
@@ -1024,24 +1027,50 @@ async function main() {
1024
1027
  let config = {
1025
1028
  debug: process.env.DEBUG === "1"
1026
1029
  };
1027
- const configPath = path.join(process.cwd(), "config.yml");
1028
- if (fs.existsSync(configPath)) {
1029
- try {
1030
- const configData = yaml.load(fs.readFileSync(configPath, "utf-8"));
1031
- config = {
1032
- ...config,
1033
- llmProvider: configData.llmProvider || process.env.LLM_PROVIDER,
1034
- llmModel: configData.llmModel || process.env.LLM_MODEL,
1035
- customLLMUrl: configData.customLLMUrl || process.env.CUSTOM_LLM_URL,
1036
- initScript: configData.initScript
1037
- };
1038
- } catch (err) {
1039
- console.error("Warning: Could not load config.yml");
1030
+ const configPaths = [
1031
+ path.join(process.cwd(), "config.yml"),
1032
+ path.join(process.env.HOME || "~", ".dirac", "config.yml")
1033
+ ];
1034
+ let configLoaded = false;
1035
+ for (const configPath of configPaths) {
1036
+ if (fs.existsSync(configPath)) {
1037
+ try {
1038
+ const configData = yaml.load(fs.readFileSync(configPath, "utf-8"));
1039
+ let initScript = configData.initScript;
1040
+ if (initScript) {
1041
+ const configDir = path.dirname(configPath);
1042
+ initScript = path.resolve(configDir, initScript);
1043
+ }
1044
+ config = {
1045
+ ...config,
1046
+ llmProvider: configData.llmProvider || process.env.LLM_PROVIDER,
1047
+ llmModel: configData.llmModel || process.env.LLM_MODEL,
1048
+ customLLMUrl: configData.customLLMUrl || process.env.CUSTOM_LLM_URL,
1049
+ initScript
1050
+ };
1051
+ configLoaded = true;
1052
+ break;
1053
+ } catch (err) {
1054
+ }
1040
1055
  }
1041
- } else {
1056
+ }
1057
+ if (!configLoaded) {
1042
1058
  config.llmProvider = process.env.LLM_PROVIDER;
1043
1059
  config.llmModel = process.env.LLM_MODEL;
1044
1060
  config.customLLMUrl = process.env.CUSTOM_LLM_URL;
1061
+ if (!config.llmProvider) {
1062
+ if (process.env.ANTHROPIC_API_KEY) {
1063
+ config.llmProvider = "anthropic";
1064
+ config.llmModel = config.llmModel || "claude-sonnet-4-20250514";
1065
+ } else if (process.env.OPENAI_API_KEY) {
1066
+ config.llmProvider = "openai";
1067
+ config.llmModel = config.llmModel || "gpt-4o";
1068
+ }
1069
+ }
1070
+ const globalInitScript = path.join(process.env.HOME || "~", ".dirac", "shell-init.di");
1071
+ if (fs.existsSync(globalInitScript)) {
1072
+ config.initScript = globalInitScript;
1073
+ }
1045
1074
  }
1046
1075
  const shell = new DiracShell(config);
1047
1076
  await shell.start();
@@ -0,0 +1,14 @@
1
+ import {
2
+ executeIndexSubroutines,
3
+ executeRegistryStats,
4
+ executeSearchSubroutines,
5
+ registry
6
+ } from "./chunk-FPDW535D.js";
7
+ import "./chunk-HRHAMPOB.js";
8
+ import "./chunk-M57VI7KL.js";
9
+ export {
10
+ executeIndexSubroutines,
11
+ executeRegistryStats,
12
+ executeSearchSubroutines,
13
+ registry
14
+ };
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-YCUHRNXQ.js";
3
+ } from "./chunk-TYIDNAZ7.js";
4
+ import "./chunk-VC23AJJJ.js";
5
+ import "./chunk-FPDW535D.js";
4
6
  import {
5
7
  DiracParser
6
8
  } from "./chunk-HRHAMPOB.js";
7
- import "./chunk-VC23AJJJ.js";
8
9
  import {
9
10
  createSession,
10
11
  getOutput
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirac-lang",
3
- "version": "0.1.74",
3
+ "version": "0.1.77",
4
4
  "description": "LLM-Augmented Declarative Execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",