buildwithnexus 0.6.11 → 0.6.12
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/bin.js +108 -88
- package/dist/deep-agents-bin.js +21 -1
- package/dist/nexus-release.tar.gz +0 -0
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -9,14 +9,38 @@ var __export = (target, all) => {
|
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
// src/core/config.ts
|
|
13
|
+
import dotenv from "dotenv";
|
|
14
|
+
import path from "path";
|
|
15
|
+
import os from "os";
|
|
16
|
+
function loadApiKeys() {
|
|
17
|
+
return {
|
|
18
|
+
anthropic: process.env.ANTHROPIC_API_KEY || void 0,
|
|
19
|
+
openai: process.env.OPENAI_API_KEY || void 0,
|
|
20
|
+
google: process.env.GOOGLE_API_KEY || void 0
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function hasAnyKey() {
|
|
24
|
+
return !!(process.env.ANTHROPIC_API_KEY || process.env.OPENAI_API_KEY || process.env.GOOGLE_API_KEY);
|
|
25
|
+
}
|
|
26
|
+
function reloadEnv(envPath) {
|
|
27
|
+
const resolvedPath = envPath ?? path.join(os.homedir(), ".env.local");
|
|
28
|
+
dotenv.config({ path: resolvedPath, override: true });
|
|
29
|
+
}
|
|
30
|
+
var init_config = __esm({
|
|
31
|
+
"src/core/config.ts"() {
|
|
32
|
+
"use strict";
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
12
36
|
// src/cli/init-command.ts
|
|
13
37
|
var init_command_exports = {};
|
|
14
38
|
__export(init_command_exports, {
|
|
15
39
|
deepAgentsInitCommand: () => deepAgentsInitCommand
|
|
16
40
|
});
|
|
17
41
|
import fs from "fs";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
42
|
+
import path2 from "path";
|
|
43
|
+
import os2 from "os";
|
|
20
44
|
import { input, confirm, password } from "@inquirer/prompts";
|
|
21
45
|
async function deepAgentsInitCommand() {
|
|
22
46
|
console.log(`
|
|
@@ -24,7 +48,7 @@ async function deepAgentsInitCommand() {
|
|
|
24
48
|
\u2551 Deep Agents -- First Time Setup \u2551
|
|
25
49
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
26
50
|
`);
|
|
27
|
-
const envPath =
|
|
51
|
+
const envPath = path2.join(os2.homedir(), ".env.local");
|
|
28
52
|
const hasEnv = fs.existsSync(envPath);
|
|
29
53
|
if (hasEnv) {
|
|
30
54
|
const shouldReset = await confirm({
|
|
@@ -40,17 +64,18 @@ async function deepAgentsInitCommand() {
|
|
|
40
64
|
"Please provide your LLM API keys:\n(You can set these later by editing .env.local)\n"
|
|
41
65
|
);
|
|
42
66
|
const anthropicKey = await password({
|
|
43
|
-
message: "ANTHROPIC_API_KEY (Claude)"
|
|
44
|
-
validate: (val) => {
|
|
45
|
-
if (!val) {
|
|
46
|
-
return "API key is required";
|
|
47
|
-
}
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
67
|
+
message: "ANTHROPIC_API_KEY (Claude - optional, press Enter to skip)"
|
|
50
68
|
});
|
|
51
69
|
const openaiKey = await password({
|
|
52
70
|
message: "OPENAI_API_KEY (GPT - optional, press Enter to skip)"
|
|
53
71
|
});
|
|
72
|
+
const googleKey = await password({
|
|
73
|
+
message: "GOOGLE_API_KEY (Gemini - optional, press Enter to skip)"
|
|
74
|
+
});
|
|
75
|
+
if (!anthropicKey && !openaiKey && !googleKey) {
|
|
76
|
+
console.log("Error: At least one API key must be provided.");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
54
79
|
const backendUrl = await input({
|
|
55
80
|
message: "Backend URL",
|
|
56
81
|
default: "http://localhost:4200"
|
|
@@ -63,8 +88,9 @@ async function deepAgentsInitCommand() {
|
|
|
63
88
|
# Generated by buildwithnexus init
|
|
64
89
|
|
|
65
90
|
# LLM API Keys
|
|
66
|
-
ANTHROPIC_API_KEY=${anthropicKey}
|
|
91
|
+
${anthropicKey ? `ANTHROPIC_API_KEY=${anthropicKey}` : "# ANTHROPIC_API_KEY="}
|
|
67
92
|
${openaiKey ? `OPENAI_API_KEY=${openaiKey}` : "# OPENAI_API_KEY="}
|
|
93
|
+
${googleKey ? `GOOGLE_API_KEY=${googleKey}` : "# GOOGLE_API_KEY="}
|
|
68
94
|
|
|
69
95
|
# Backend
|
|
70
96
|
BACKEND_URL=${backendUrl}
|
|
@@ -73,27 +99,14 @@ DASHBOARD_PORT=${dashboardPort}
|
|
|
73
99
|
# Optional
|
|
74
100
|
# LOG_LEVEL=debug
|
|
75
101
|
`;
|
|
76
|
-
fs.writeFileSync(envPath, envContent);
|
|
77
|
-
|
|
78
|
-
Configuration saved to .env.local
|
|
79
|
-
|
|
80
|
-
Next steps:
|
|
81
|
-
1. Start the backend:
|
|
82
|
-
cd ~/Projects/nexus && python -m src.deep_agents_server
|
|
83
|
-
|
|
84
|
-
2. Start the dashboard:
|
|
85
|
-
buildwithnexus dashboard
|
|
86
|
-
|
|
87
|
-
3. Run your first task:
|
|
88
|
-
deep-agents run "List files in the current directory"
|
|
89
|
-
|
|
90
|
-
For help, run:
|
|
91
|
-
deep-agents --help
|
|
92
|
-
`);
|
|
102
|
+
fs.writeFileSync(envPath, envContent, { mode: 384 });
|
|
103
|
+
reloadEnv(envPath);
|
|
104
|
+
console.log("Configuration saved to .env.local and loaded into environment.");
|
|
93
105
|
}
|
|
94
106
|
var init_init_command = __esm({
|
|
95
107
|
"src/cli/init-command.ts"() {
|
|
96
108
|
"use strict";
|
|
109
|
+
init_config();
|
|
97
110
|
}
|
|
98
111
|
});
|
|
99
112
|
|
|
@@ -116,7 +129,7 @@ function getVersion() {
|
|
|
116
129
|
const packageJson = JSON.parse(readFileSync(packagePath, "utf-8"));
|
|
117
130
|
return packageJson.version;
|
|
118
131
|
} catch {
|
|
119
|
-
return true ? "0.6.
|
|
132
|
+
return true ? "0.6.12" : "0.0.0-unknown";
|
|
120
133
|
}
|
|
121
134
|
}
|
|
122
135
|
function showBanner() {
|
|
@@ -391,6 +404,7 @@ var TUI = class {
|
|
|
391
404
|
var tui = new TUI();
|
|
392
405
|
|
|
393
406
|
// src/cli/run-command.ts
|
|
407
|
+
init_config();
|
|
394
408
|
async function runCommand(task, options) {
|
|
395
409
|
const backendUrl = process.env.BACKEND_URL || "http://localhost:4200";
|
|
396
410
|
tui.displayHeader(task, options.agent);
|
|
@@ -408,7 +422,7 @@ async function runCommand(task, options) {
|
|
|
408
422
|
);
|
|
409
423
|
process.exit(1);
|
|
410
424
|
}
|
|
411
|
-
const
|
|
425
|
+
const keys = loadApiKeys();
|
|
412
426
|
const response = await fetch(`${backendUrl}/api/run`, {
|
|
413
427
|
method: "POST",
|
|
414
428
|
headers: { "Content-Type": "application/json" },
|
|
@@ -416,7 +430,9 @@ async function runCommand(task, options) {
|
|
|
416
430
|
task,
|
|
417
431
|
agent_role: options.agent,
|
|
418
432
|
agent_goal: options.goal || "",
|
|
419
|
-
api_key:
|
|
433
|
+
api_key: keys.anthropic || "",
|
|
434
|
+
openai_api_key: keys.openai || "",
|
|
435
|
+
google_api_key: keys.google || ""
|
|
420
436
|
})
|
|
421
437
|
});
|
|
422
438
|
if (!response.ok) {
|
|
@@ -479,13 +495,13 @@ async function runCommand(task, options) {
|
|
|
479
495
|
// src/cli/dashboard-command.ts
|
|
480
496
|
import { spawn } from "child_process";
|
|
481
497
|
import { fileURLToPath } from "url";
|
|
482
|
-
import
|
|
483
|
-
var __dirname =
|
|
498
|
+
import path3 from "path";
|
|
499
|
+
var __dirname = path3.dirname(fileURLToPath(import.meta.url));
|
|
484
500
|
async function dashboardCommand(options) {
|
|
485
501
|
const port = options.port || "4201";
|
|
486
502
|
console.log(`Starting Deep Agents Dashboard on http://localhost:${port}
|
|
487
503
|
`);
|
|
488
|
-
const dashboardPath =
|
|
504
|
+
const dashboardPath = path3.join(__dirname, "../deep-agents/dashboard/server.js");
|
|
489
505
|
const dashboard = spawn("node", [dashboardPath], {
|
|
490
506
|
env: { ...process.env, PORT: port },
|
|
491
507
|
stdio: "inherit"
|
|
@@ -583,17 +599,19 @@ function classifyIntent(task) {
|
|
|
583
599
|
}
|
|
584
600
|
|
|
585
601
|
// src/cli/interactive.ts
|
|
602
|
+
init_config();
|
|
586
603
|
async function interactiveMode() {
|
|
587
604
|
const backendUrl = process.env.BACKEND_URL || "http://localhost:4200";
|
|
588
|
-
|
|
589
|
-
if (!anthropicKey) {
|
|
605
|
+
if (!hasAnyKey()) {
|
|
590
606
|
console.log(chalk2.cyan("\n\u{1F527} First-time setup required\n"));
|
|
591
607
|
const { deepAgentsInitCommand: deepAgentsInitCommand2 } = await Promise.resolve().then(() => (init_init_command(), init_command_exports));
|
|
592
608
|
await deepAgentsInitCommand2();
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
609
|
+
reloadEnv();
|
|
610
|
+
if (!hasAnyKey()) {
|
|
611
|
+
console.error("Error: At least one API key is required to use buildwithnexus.");
|
|
612
|
+
console.error("Please run: buildwithnexus da-init");
|
|
613
|
+
process.exit(1);
|
|
614
|
+
}
|
|
597
615
|
}
|
|
598
616
|
try {
|
|
599
617
|
const response = await fetch(`${backendUrl}/health`);
|
|
@@ -716,12 +734,12 @@ async function planModeLoop(task, backendUrl, rl, ask) {
|
|
|
716
734
|
console.log("");
|
|
717
735
|
console.log(chalk2.yellow("\u23F3 Fetching plan from backend..."));
|
|
718
736
|
let steps = [];
|
|
719
|
-
const
|
|
737
|
+
const keys = loadApiKeys();
|
|
720
738
|
try {
|
|
721
739
|
const response = await fetch(`${backendUrl}/api/run`, {
|
|
722
740
|
method: "POST",
|
|
723
741
|
headers: { "Content-Type": "application/json" },
|
|
724
|
-
body: JSON.stringify({ task, agent_role: "engineer", agent_goal: "", api_key:
|
|
742
|
+
body: JSON.stringify({ task, agent_role: "engineer", agent_goal: "", api_key: keys.anthropic || "", openai_api_key: keys.openai || "", google_api_key: keys.google || "" })
|
|
725
743
|
});
|
|
726
744
|
if (!response.ok) {
|
|
727
745
|
console.error(chalk2.red("Backend error \u2014 cannot fetch plan."));
|
|
@@ -819,12 +837,12 @@ async function editPlanSteps(steps, ask) {
|
|
|
819
837
|
async function buildModeLoop(task, backendUrl, rl, ask) {
|
|
820
838
|
console.log(chalk2.bold("Task:"), chalk2.white(task));
|
|
821
839
|
tui.displayConnecting();
|
|
822
|
-
const
|
|
840
|
+
const keys = loadApiKeys();
|
|
823
841
|
try {
|
|
824
842
|
const response = await fetch(`${backendUrl}/api/run`, {
|
|
825
843
|
method: "POST",
|
|
826
844
|
headers: { "Content-Type": "application/json" },
|
|
827
|
-
body: JSON.stringify({ task, agent_role: "engineer", agent_goal: "", api_key:
|
|
845
|
+
body: JSON.stringify({ task, agent_role: "engineer", agent_goal: "", api_key: keys.anthropic || "", openai_api_key: keys.openai || "", google_api_key: keys.google || "" })
|
|
828
846
|
});
|
|
829
847
|
if (!response.ok) {
|
|
830
848
|
console.error(chalk2.red("Backend error"));
|
|
@@ -890,7 +908,7 @@ async function brainstormModeLoop(task, backendUrl, rl, ask) {
|
|
|
890
908
|
while (true) {
|
|
891
909
|
console.log(chalk2.bold.blue("\u{1F4A1} Thinking..."));
|
|
892
910
|
try {
|
|
893
|
-
const
|
|
911
|
+
const keys = loadApiKeys();
|
|
894
912
|
const response = await fetch(`${backendUrl}/api/run`, {
|
|
895
913
|
method: "POST",
|
|
896
914
|
headers: { "Content-Type": "application/json" },
|
|
@@ -898,7 +916,9 @@ async function brainstormModeLoop(task, backendUrl, rl, ask) {
|
|
|
898
916
|
task: currentQuestion,
|
|
899
917
|
agent_role: "brainstorm",
|
|
900
918
|
agent_goal: "Generate ideas, considerations, and suggestions. Be concise and helpful.",
|
|
901
|
-
api_key:
|
|
919
|
+
api_key: keys.anthropic || "",
|
|
920
|
+
openai_api_key: keys.openai || "",
|
|
921
|
+
google_api_key: keys.google || ""
|
|
902
922
|
})
|
|
903
923
|
});
|
|
904
924
|
if (response.ok) {
|
|
@@ -1024,10 +1044,10 @@ var log = {
|
|
|
1024
1044
|
};
|
|
1025
1045
|
|
|
1026
1046
|
// src/core/platform.ts
|
|
1027
|
-
import
|
|
1047
|
+
import os3 from "os";
|
|
1028
1048
|
function detectPlatform() {
|
|
1029
|
-
const platform =
|
|
1030
|
-
const arch =
|
|
1049
|
+
const platform = os3.platform();
|
|
1050
|
+
const arch = os3.arch();
|
|
1031
1051
|
if (platform === "darwin") {
|
|
1032
1052
|
return {
|
|
1033
1053
|
os: "mac",
|
|
@@ -1488,8 +1508,8 @@ import chalk6 from "chalk";
|
|
|
1488
1508
|
// src/core/dlp.ts
|
|
1489
1509
|
import crypto from "crypto";
|
|
1490
1510
|
import fs2 from "fs";
|
|
1491
|
-
import
|
|
1492
|
-
var NEXUS_HOME =
|
|
1511
|
+
import path4 from "path";
|
|
1512
|
+
var NEXUS_HOME = path4.join(process.env.HOME || "~", ".buildwithnexus");
|
|
1493
1513
|
var SECRET_PATTERNS = [
|
|
1494
1514
|
/sk-ant-api03-[A-Za-z0-9_-]{20,}/g,
|
|
1495
1515
|
// Anthropic API key
|
|
@@ -1571,7 +1591,7 @@ function validateAllKeys(keys) {
|
|
|
1571
1591
|
}
|
|
1572
1592
|
return violations;
|
|
1573
1593
|
}
|
|
1574
|
-
var HMAC_PATH =
|
|
1594
|
+
var HMAC_PATH = path4.join(NEXUS_HOME, ".keys.hmac");
|
|
1575
1595
|
function computeFileHmac(filePath, secret) {
|
|
1576
1596
|
const content = fs2.readFileSync(filePath);
|
|
1577
1597
|
return crypto.createHmac("sha256", secret).update(content).digest("hex");
|
|
@@ -1596,11 +1616,11 @@ function verifyKeysFile(keysPath, masterSecret) {
|
|
|
1596
1616
|
return false;
|
|
1597
1617
|
}
|
|
1598
1618
|
}
|
|
1599
|
-
var AUDIT_PATH =
|
|
1619
|
+
var AUDIT_PATH = path4.join(NEXUS_HOME, "audit.log");
|
|
1600
1620
|
var MAX_AUDIT_SIZE = 10 * 1024 * 1024;
|
|
1601
1621
|
function audit(event, detail = "") {
|
|
1602
1622
|
try {
|
|
1603
|
-
const dir =
|
|
1623
|
+
const dir = path4.dirname(AUDIT_PATH);
|
|
1604
1624
|
if (!fs2.existsSync(dir)) return;
|
|
1605
1625
|
if (fs2.existsSync(AUDIT_PATH)) {
|
|
1606
1626
|
const stat = fs2.statSync(AUDIT_PATH);
|
|
@@ -1682,17 +1702,17 @@ async function promptInitConfig() {
|
|
|
1682
1702
|
|
|
1683
1703
|
// src/core/secrets.ts
|
|
1684
1704
|
import fs3 from "fs";
|
|
1685
|
-
import
|
|
1705
|
+
import path5 from "path";
|
|
1686
1706
|
import crypto2 from "crypto";
|
|
1687
|
-
var NEXUS_HOME2 = process.env.NEXUS_HOME ||
|
|
1688
|
-
var CONFIG_PATH = process.env.NEXUS_CONFIG_PATH ||
|
|
1689
|
-
var KEYS_PATH = process.env.NEXUS_KEYS_PATH ||
|
|
1707
|
+
var NEXUS_HOME2 = process.env.NEXUS_HOME || path5.join(process.env.HOME || "~", ".buildwithnexus");
|
|
1708
|
+
var CONFIG_PATH = process.env.NEXUS_CONFIG_PATH || path5.join(NEXUS_HOME2, "config.json");
|
|
1709
|
+
var KEYS_PATH = process.env.NEXUS_KEYS_PATH || path5.join(NEXUS_HOME2, ".env.keys");
|
|
1690
1710
|
function ensureHome() {
|
|
1691
1711
|
fs3.mkdirSync(NEXUS_HOME2, { recursive: true, mode: 448 });
|
|
1692
|
-
fs3.mkdirSync(
|
|
1693
|
-
fs3.mkdirSync(
|
|
1694
|
-
fs3.mkdirSync(
|
|
1695
|
-
fs3.mkdirSync(
|
|
1712
|
+
fs3.mkdirSync(path5.join(NEXUS_HOME2, "vm", "images"), { recursive: true, mode: 448 });
|
|
1713
|
+
fs3.mkdirSync(path5.join(NEXUS_HOME2, "vm", "configs"), { recursive: true, mode: 448 });
|
|
1714
|
+
fs3.mkdirSync(path5.join(NEXUS_HOME2, "vm", "logs"), { recursive: true, mode: 448 });
|
|
1715
|
+
fs3.mkdirSync(path5.join(NEXUS_HOME2, "ssh"), { recursive: true, mode: 448 });
|
|
1696
1716
|
}
|
|
1697
1717
|
function generateMasterSecret() {
|
|
1698
1718
|
return crypto2.randomBytes(32).toString("base64url");
|
|
@@ -2209,7 +2229,7 @@ var statusCommand = new Command5("status").description("Check NEXUS runtime heal
|
|
|
2209
2229
|
import { Command as Command6 } from "commander";
|
|
2210
2230
|
import chalk9 from "chalk";
|
|
2211
2231
|
import fs4 from "fs";
|
|
2212
|
-
import
|
|
2232
|
+
import path6 from "path";
|
|
2213
2233
|
var doctorCommand = new Command6("doctor").description("Diagnose NEXUS runtime environment").action(async () => {
|
|
2214
2234
|
const platform = detectPlatform();
|
|
2215
2235
|
const check = (ok) => ok ? chalk9.green("\u2713") : chalk9.red("\u2717");
|
|
@@ -2225,7 +2245,7 @@ var doctorCommand = new Command6("doctor").description("Diagnose NEXUS runtime e
|
|
|
2225
2245
|
} else {
|
|
2226
2246
|
console.log(` ${check(false)} Docker not installed`);
|
|
2227
2247
|
}
|
|
2228
|
-
const keyExists = fs4.existsSync(
|
|
2248
|
+
const keyExists = fs4.existsSync(path6.join(NEXUS_HOME2, "ssh", "id_nexus_vm"));
|
|
2229
2249
|
console.log(` ${check(keyExists)} SSH key`);
|
|
2230
2250
|
const config = loadConfig();
|
|
2231
2251
|
console.log(` ${check(!!config)} Configuration`);
|
|
@@ -2290,15 +2310,15 @@ var logsCommand = new Command7("logs").description("View NEXUS server logs").act
|
|
|
2290
2310
|
|
|
2291
2311
|
// src/commands/update.ts
|
|
2292
2312
|
import { Command as Command8 } from "commander";
|
|
2293
|
-
import
|
|
2313
|
+
import path7 from "path";
|
|
2294
2314
|
import fs5 from "fs";
|
|
2295
2315
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
2296
2316
|
import { execa as execa4 } from "execa";
|
|
2297
2317
|
function getReleaseTarball() {
|
|
2298
|
-
const dir =
|
|
2299
|
-
const tarballPath =
|
|
2318
|
+
const dir = path7.dirname(fileURLToPath3(import.meta.url));
|
|
2319
|
+
const tarballPath = path7.join(dir, "nexus-release.tar.gz");
|
|
2300
2320
|
if (fs5.existsSync(tarballPath)) return tarballPath;
|
|
2301
|
-
const rootPath =
|
|
2321
|
+
const rootPath = path7.resolve(dir, "..", "dist", "nexus-release.tar.gz");
|
|
2302
2322
|
if (fs5.existsSync(rootPath)) return rootPath;
|
|
2303
2323
|
throw new Error("nexus-release.tar.gz not found. Reinstall buildwithnexus to get the latest release.");
|
|
2304
2324
|
}
|
|
@@ -2352,7 +2372,7 @@ import { Command as Command9 } from "commander";
|
|
|
2352
2372
|
import chalk10 from "chalk";
|
|
2353
2373
|
import fs6 from "fs";
|
|
2354
2374
|
import { input as input2 } from "@inquirer/prompts";
|
|
2355
|
-
import
|
|
2375
|
+
import path8 from "path";
|
|
2356
2376
|
var destroyCommand = new Command9("destroy").description("Remove NEXUS VM and all data").option("--force", "Skip confirmation").action(async (opts) => {
|
|
2357
2377
|
const config = loadConfig();
|
|
2358
2378
|
if (!opts.force) {
|
|
@@ -2379,7 +2399,7 @@ var destroyCommand = new Command9("destroy").description("Remove NEXUS VM and al
|
|
|
2379
2399
|
}
|
|
2380
2400
|
await stopNexus();
|
|
2381
2401
|
}
|
|
2382
|
-
const sshConfigPath =
|
|
2402
|
+
const sshConfigPath = path8.join(process.env.HOME || "~", ".ssh", "config");
|
|
2383
2403
|
if (fs6.existsSync(sshConfigPath)) {
|
|
2384
2404
|
const content = fs6.readFileSync(sshConfigPath, "utf-8");
|
|
2385
2405
|
const lines = content.split("\n");
|
|
@@ -2790,9 +2810,9 @@ import chalk16 from "chalk";
|
|
|
2790
2810
|
// src/ui/repl.ts
|
|
2791
2811
|
import readline2 from "readline";
|
|
2792
2812
|
import fs7 from "fs";
|
|
2793
|
-
import
|
|
2813
|
+
import path9 from "path";
|
|
2794
2814
|
import chalk14 from "chalk";
|
|
2795
|
-
var HISTORY_FILE =
|
|
2815
|
+
var HISTORY_FILE = path9.join(NEXUS_HOME2, "shell_history");
|
|
2796
2816
|
var MAX_HISTORY = 1e3;
|
|
2797
2817
|
var Repl = class {
|
|
2798
2818
|
rl = null;
|
|
@@ -2816,7 +2836,7 @@ var Repl = class {
|
|
|
2816
2836
|
}
|
|
2817
2837
|
saveHistory() {
|
|
2818
2838
|
try {
|
|
2819
|
-
const dir =
|
|
2839
|
+
const dir = path9.dirname(HISTORY_FILE);
|
|
2820
2840
|
fs7.mkdirSync(dir, { recursive: true });
|
|
2821
2841
|
fs7.writeFileSync(HISTORY_FILE, this.history.slice(-MAX_HISTORY).join("\n") + "\n", { mode: 384 });
|
|
2822
2842
|
} catch {
|
|
@@ -3028,8 +3048,8 @@ var EventStream = class {
|
|
|
3028
3048
|
};
|
|
3029
3049
|
|
|
3030
3050
|
// src/commands/shell.ts
|
|
3031
|
-
async function httpPost(httpPort,
|
|
3032
|
-
const res = await fetch(`http://localhost:${httpPort}${
|
|
3051
|
+
async function httpPost(httpPort, path12, body) {
|
|
3052
|
+
const res = await fetch(`http://localhost:${httpPort}${path12}`, {
|
|
3033
3053
|
method: "POST",
|
|
3034
3054
|
headers: { "Content-Type": "application/json" },
|
|
3035
3055
|
body: JSON.stringify(body),
|
|
@@ -3044,9 +3064,9 @@ async function httpPost(httpPort, path11, body) {
|
|
|
3044
3064
|
return text;
|
|
3045
3065
|
}
|
|
3046
3066
|
}
|
|
3047
|
-
async function httpGet(httpPort,
|
|
3067
|
+
async function httpGet(httpPort, path12) {
|
|
3048
3068
|
try {
|
|
3049
|
-
const res = await fetch(`http://localhost:${httpPort}${
|
|
3069
|
+
const res = await fetch(`http://localhost:${httpPort}${path12}`, {
|
|
3050
3070
|
signal: AbortSignal.timeout(1e4)
|
|
3051
3071
|
});
|
|
3052
3072
|
const text = await res.text();
|
|
@@ -3471,7 +3491,7 @@ function getVersionStatic() {
|
|
|
3471
3491
|
const packageJson = JSON.parse(readFileSync2(packagePath, "utf-8"));
|
|
3472
3492
|
return packageJson.version;
|
|
3473
3493
|
} catch {
|
|
3474
|
-
return true ? "0.6.
|
|
3494
|
+
return true ? "0.6.12" : "0.0.0-unknown";
|
|
3475
3495
|
}
|
|
3476
3496
|
}
|
|
3477
3497
|
var cli = new Command15().name("buildwithnexus").description("Auto-scaffold and launch a fully autonomous NEXUS runtime").version(getVersionStatic());
|
|
@@ -3495,14 +3515,14 @@ cli.action(() => {
|
|
|
3495
3515
|
|
|
3496
3516
|
// src/core/update-notifier.ts
|
|
3497
3517
|
import fs8 from "fs";
|
|
3498
|
-
import
|
|
3499
|
-
import
|
|
3518
|
+
import path10 from "path";
|
|
3519
|
+
import os4 from "os";
|
|
3500
3520
|
import https from "https";
|
|
3501
3521
|
import chalk17 from "chalk";
|
|
3502
3522
|
var PACKAGE_NAME = "buildwithnexus";
|
|
3503
3523
|
var CHECK_INTERVAL_MS = 4 * 60 * 60 * 1e3;
|
|
3504
|
-
var STATE_DIR =
|
|
3505
|
-
var STATE_FILE =
|
|
3524
|
+
var STATE_DIR = path10.join(os4.homedir(), ".buildwithnexus");
|
|
3525
|
+
var STATE_FILE = path10.join(STATE_DIR, ".update-check.json");
|
|
3506
3526
|
function readState() {
|
|
3507
3527
|
try {
|
|
3508
3528
|
const raw = fs8.readFileSync(STATE_FILE, "utf-8");
|
|
@@ -3587,12 +3607,12 @@ function printUpdateBanner(current, latest) {
|
|
|
3587
3607
|
}
|
|
3588
3608
|
|
|
3589
3609
|
// src/bin.ts
|
|
3590
|
-
import
|
|
3591
|
-
import
|
|
3592
|
-
import
|
|
3593
|
-
var homeEnvPath =
|
|
3594
|
-
|
|
3595
|
-
var version = true ? "0.6.
|
|
3610
|
+
import dotenv2 from "dotenv";
|
|
3611
|
+
import os5 from "os";
|
|
3612
|
+
import path11 from "path";
|
|
3613
|
+
var homeEnvPath = path11.join(os5.homedir(), ".env.local");
|
|
3614
|
+
dotenv2.config({ path: homeEnvPath });
|
|
3615
|
+
var version = true ? "0.6.12" : "0.5.17";
|
|
3596
3616
|
checkForUpdates(version);
|
|
3597
3617
|
program.name("buildwithnexus").description("Deep Agents - AI-Powered Task Execution").version(version);
|
|
3598
3618
|
program.command("da-init").description("Initialize Deep Agents (set up API keys and .env.local)").action(deepAgentsInitCommand);
|
package/dist/deep-agents-bin.js
CHANGED
|
@@ -204,7 +204,23 @@ var StreamFormatter = class {
|
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
+
// src/core/config.ts
|
|
208
|
+
import dotenv from "dotenv";
|
|
209
|
+
import path from "path";
|
|
210
|
+
import os from "os";
|
|
211
|
+
function loadApiKeys() {
|
|
212
|
+
return {
|
|
213
|
+
anthropic: process.env.ANTHROPIC_API_KEY || void 0,
|
|
214
|
+
openai: process.env.OPENAI_API_KEY || void 0,
|
|
215
|
+
google: process.env.GOOGLE_API_KEY || void 0
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
207
219
|
// src/deep-agents-bin.ts
|
|
220
|
+
import dotenv2 from "dotenv";
|
|
221
|
+
import path2 from "path";
|
|
222
|
+
import os2 from "os";
|
|
223
|
+
dotenv2.config({ path: path2.join(os2.homedir(), ".env.local") });
|
|
208
224
|
var backendUrl = process.env.BACKEND_URL || "http://localhost:4200";
|
|
209
225
|
async function runCommand(task, options) {
|
|
210
226
|
const repl = new PlanningREPL();
|
|
@@ -217,13 +233,17 @@ Starting Deep Agents workflow
|
|
|
217
233
|
console.log(` Backend: ${backendUrl}
|
|
218
234
|
`);
|
|
219
235
|
try {
|
|
236
|
+
const keys = loadApiKeys();
|
|
220
237
|
const response = await fetch(`${backendUrl}/api/run`, {
|
|
221
238
|
method: "POST",
|
|
222
239
|
headers: { "Content-Type": "application/json" },
|
|
223
240
|
body: JSON.stringify({
|
|
224
241
|
task,
|
|
225
242
|
agent_role: options.agent,
|
|
226
|
-
agent_goal: options.goal || ""
|
|
243
|
+
agent_goal: options.goal || "",
|
|
244
|
+
api_key: keys.anthropic || "",
|
|
245
|
+
openai_api_key: keys.openai || "",
|
|
246
|
+
google_api_key: keys.google || ""
|
|
227
247
|
})
|
|
228
248
|
});
|
|
229
249
|
const { run_id } = await response.json();
|
|
Binary file
|