buildwithnexus 0.6.15 → 0.6.16
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 +69 -33
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -42,13 +42,6 @@ import fs from "fs";
|
|
|
42
42
|
import path2 from "path";
|
|
43
43
|
import os2 from "os";
|
|
44
44
|
import * as readline from "readline";
|
|
45
|
-
function readFromStdin(prompt) {
|
|
46
|
-
return new Promise((resolve) => {
|
|
47
|
-
rl.question(prompt, (answer) => {
|
|
48
|
-
resolve(answer);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
45
|
async function deepAgentsInitCommand() {
|
|
53
46
|
console.log(`
|
|
54
47
|
\u2554\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\u2557
|
|
@@ -58,7 +51,7 @@ async function deepAgentsInitCommand() {
|
|
|
58
51
|
const envPath = path2.join(os2.homedir(), ".env.local");
|
|
59
52
|
const hasEnv = fs.existsSync(envPath);
|
|
60
53
|
if (hasEnv) {
|
|
61
|
-
const answer = await
|
|
54
|
+
const answer = await askQuestion(".env.local already exists. Reconfigure? (y/n) [n]: ");
|
|
62
55
|
if (answer.toLowerCase() !== "y" && answer.toLowerCase() !== "yes") {
|
|
63
56
|
console.log("Setup complete -- using existing configuration.");
|
|
64
57
|
return;
|
|
@@ -67,21 +60,21 @@ async function deepAgentsInitCommand() {
|
|
|
67
60
|
console.log(
|
|
68
61
|
"Please provide your LLM API keys:\n(You can set these later by editing .env.local)\n"
|
|
69
62
|
);
|
|
70
|
-
const anthropicKey = await
|
|
63
|
+
const anthropicKey = await askQuestion(
|
|
71
64
|
"ANTHROPIC_API_KEY (Claude - optional, press Enter to skip): "
|
|
72
65
|
);
|
|
73
|
-
const openaiKey = await
|
|
66
|
+
const openaiKey = await askQuestion(
|
|
74
67
|
"OPENAI_API_KEY (GPT - optional, press Enter to skip): "
|
|
75
68
|
);
|
|
76
|
-
const googleKey = await
|
|
69
|
+
const googleKey = await askQuestion(
|
|
77
70
|
"GOOGLE_API_KEY (Gemini - optional, press Enter to skip): "
|
|
78
71
|
);
|
|
79
72
|
if (!anthropicKey && !openaiKey && !googleKey) {
|
|
80
73
|
console.log("Error: At least one API key must be provided.");
|
|
81
74
|
return;
|
|
82
75
|
}
|
|
83
|
-
const backendUrl = await
|
|
84
|
-
const dashboardPort = await
|
|
76
|
+
const backendUrl = await askQuestion("Backend URL (http://localhost:4200): ") || "http://localhost:4200";
|
|
77
|
+
const dashboardPort = await askQuestion("Dashboard port (4201): ") || "4201";
|
|
85
78
|
const envContent = `# Deep Agents Configuration
|
|
86
79
|
# Generated by buildwithnexus init
|
|
87
80
|
|
|
@@ -100,17 +93,60 @@ DASHBOARD_PORT=${dashboardPort}
|
|
|
100
93
|
fs.writeFileSync(envPath, envContent, { mode: 384 });
|
|
101
94
|
reloadEnv(envPath);
|
|
102
95
|
console.log("Configuration saved to .env.local and loaded into environment.");
|
|
103
|
-
rl.close();
|
|
104
96
|
}
|
|
105
|
-
|
|
97
|
+
function setupInputHandling() {
|
|
98
|
+
return new Promise((resolve) => {
|
|
99
|
+
if (isSetup) {
|
|
100
|
+
resolve();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
isSetup = true;
|
|
104
|
+
if (process.stdin.isTTY) {
|
|
105
|
+
resolve();
|
|
106
|
+
} else {
|
|
107
|
+
const rl = readline.createInterface({
|
|
108
|
+
input: process.stdin,
|
|
109
|
+
output: process.stdout,
|
|
110
|
+
terminal: false
|
|
111
|
+
});
|
|
112
|
+
rl.on("line", (line) => {
|
|
113
|
+
inputLines.push(line);
|
|
114
|
+
});
|
|
115
|
+
rl.on("close", () => {
|
|
116
|
+
resolve();
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
async function askQuestion(prompt) {
|
|
122
|
+
await setupInputHandling();
|
|
123
|
+
if (process.stdin.isTTY) {
|
|
124
|
+
return new Promise((resolve) => {
|
|
125
|
+
const rl = readline.createInterface({
|
|
126
|
+
input: process.stdin,
|
|
127
|
+
output: process.stdout
|
|
128
|
+
});
|
|
129
|
+
rl.question(prompt, (answer) => {
|
|
130
|
+
rl.close();
|
|
131
|
+
resolve(answer);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
} else {
|
|
135
|
+
process.stdout.write(prompt);
|
|
136
|
+
const answer = inputLines[lineIndex] || "";
|
|
137
|
+
lineIndex++;
|
|
138
|
+
console.log(answer);
|
|
139
|
+
return answer;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
var inputLines, lineIndex, isSetup;
|
|
106
143
|
var init_init_command = __esm({
|
|
107
144
|
"src/cli/init-command.ts"() {
|
|
108
145
|
"use strict";
|
|
109
146
|
init_config();
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
});
|
|
147
|
+
inputLines = [];
|
|
148
|
+
lineIndex = 0;
|
|
149
|
+
isSetup = false;
|
|
114
150
|
}
|
|
115
151
|
});
|
|
116
152
|
|
|
@@ -133,7 +169,7 @@ function getVersion() {
|
|
|
133
169
|
const packageJson = JSON.parse(readFileSync(packagePath, "utf-8"));
|
|
134
170
|
return packageJson.version;
|
|
135
171
|
} catch {
|
|
136
|
-
return true ? "0.6.
|
|
172
|
+
return true ? "0.6.16" : "0.0.0-unknown";
|
|
137
173
|
}
|
|
138
174
|
}
|
|
139
175
|
function showBanner() {
|
|
@@ -633,11 +669,11 @@ async function interactiveMode() {
|
|
|
633
669
|
console.error(chalk2.red("\u274C Cannot connect to backend at " + backendUrl));
|
|
634
670
|
process.exit(1);
|
|
635
671
|
}
|
|
636
|
-
const
|
|
672
|
+
const rl = readline2.createInterface({
|
|
637
673
|
input: process.stdin,
|
|
638
674
|
output: process.stdout
|
|
639
675
|
});
|
|
640
|
-
const ask = (question) => new Promise((resolve) =>
|
|
676
|
+
const ask = (question) => new Promise((resolve) => rl.question(question, resolve));
|
|
641
677
|
console.clear();
|
|
642
678
|
console.log(chalk2.cyan("\u2554\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\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
|
|
643
679
|
console.log(
|
|
@@ -651,7 +687,7 @@ async function interactiveMode() {
|
|
|
651
687
|
const task = await ask(chalk2.bold.blue("\u{1F4DD} Task: "));
|
|
652
688
|
if (task.toLowerCase() === "exit") {
|
|
653
689
|
console.log(chalk2.yellow("\nGoodbye! \u{1F44B}\n"));
|
|
654
|
-
|
|
690
|
+
rl.close();
|
|
655
691
|
process.exit(0);
|
|
656
692
|
}
|
|
657
693
|
if (!task.trim()) {
|
|
@@ -661,7 +697,7 @@ async function interactiveMode() {
|
|
|
661
697
|
const suggestedMode = classifyIntent(task).toUpperCase();
|
|
662
698
|
tui.displaySuggestedMode(suggestedMode, task);
|
|
663
699
|
const currentMode = await selectMode(suggestedMode, ask);
|
|
664
|
-
await runModeLoop(currentMode, task, backendUrl,
|
|
700
|
+
await runModeLoop(currentMode, task, backendUrl, rl, ask);
|
|
665
701
|
console.log("");
|
|
666
702
|
}
|
|
667
703
|
}
|
|
@@ -682,7 +718,7 @@ async function selectMode(suggested, ask) {
|
|
|
682
718
|
if (lower === "br" || lower === "brainstorm") return "BRAINSTORM";
|
|
683
719
|
return suggested;
|
|
684
720
|
}
|
|
685
|
-
async function runModeLoop(mode, task, backendUrl,
|
|
721
|
+
async function runModeLoop(mode, task, backendUrl, rl, ask) {
|
|
686
722
|
let currentMode = mode;
|
|
687
723
|
while (true) {
|
|
688
724
|
console.clear();
|
|
@@ -690,7 +726,7 @@ async function runModeLoop(mode, task, backendUrl, rl2, ask) {
|
|
|
690
726
|
tui.displayModeBar(currentMode);
|
|
691
727
|
tui.displayModeHeader(currentMode);
|
|
692
728
|
if (currentMode === "PLAN") {
|
|
693
|
-
const next = await planModeLoop(task, backendUrl,
|
|
729
|
+
const next = await planModeLoop(task, backendUrl, rl, ask);
|
|
694
730
|
if (next === "BUILD") {
|
|
695
731
|
currentMode = "BUILD";
|
|
696
732
|
continue;
|
|
@@ -702,7 +738,7 @@ async function runModeLoop(mode, task, backendUrl, rl2, ask) {
|
|
|
702
738
|
return;
|
|
703
739
|
}
|
|
704
740
|
if (currentMode === "BUILD") {
|
|
705
|
-
const next = await buildModeLoop(task, backendUrl,
|
|
741
|
+
const next = await buildModeLoop(task, backendUrl, rl, ask);
|
|
706
742
|
if (next === "switch") {
|
|
707
743
|
currentMode = await promptModeSwitch(currentMode, ask);
|
|
708
744
|
continue;
|
|
@@ -710,7 +746,7 @@ async function runModeLoop(mode, task, backendUrl, rl2, ask) {
|
|
|
710
746
|
return;
|
|
711
747
|
}
|
|
712
748
|
if (currentMode === "BRAINSTORM") {
|
|
713
|
-
const next = await brainstormModeLoop(task, backendUrl,
|
|
749
|
+
const next = await brainstormModeLoop(task, backendUrl, rl, ask);
|
|
714
750
|
if (next === "switch") {
|
|
715
751
|
currentMode = await promptModeSwitch(currentMode, ask);
|
|
716
752
|
continue;
|
|
@@ -739,7 +775,7 @@ async function promptModeSwitch(current, ask) {
|
|
|
739
775
|
if (n === 2) return others[1];
|
|
740
776
|
return current;
|
|
741
777
|
}
|
|
742
|
-
async function planModeLoop(task, backendUrl,
|
|
778
|
+
async function planModeLoop(task, backendUrl, rl, ask) {
|
|
743
779
|
console.log(chalk2.bold("Task:"), chalk2.white(task));
|
|
744
780
|
console.log("");
|
|
745
781
|
console.log(chalk2.yellow("\u23F3 Fetching plan from backend..."));
|
|
@@ -844,7 +880,7 @@ async function editPlanSteps(steps, ask) {
|
|
|
844
880
|
}
|
|
845
881
|
return steps;
|
|
846
882
|
}
|
|
847
|
-
async function buildModeLoop(task, backendUrl,
|
|
883
|
+
async function buildModeLoop(task, backendUrl, rl, ask) {
|
|
848
884
|
console.log(chalk2.bold("Task:"), chalk2.white(task));
|
|
849
885
|
tui.displayConnecting();
|
|
850
886
|
const keys = loadApiKeys();
|
|
@@ -911,7 +947,7 @@ async function buildModeLoop(task, backendUrl, rl2, ask) {
|
|
|
911
947
|
if (answer === "s" || answer === "switch") return "switch";
|
|
912
948
|
return "done";
|
|
913
949
|
}
|
|
914
|
-
async function brainstormModeLoop(task, backendUrl,
|
|
950
|
+
async function brainstormModeLoop(task, backendUrl, rl, ask) {
|
|
915
951
|
console.log(chalk2.bold("Starting topic:"), chalk2.white(task));
|
|
916
952
|
console.log(chalk2.gray('Ask follow-up questions. Type "done" to exit, "switch" to change mode.\n'));
|
|
917
953
|
let currentQuestion = task;
|
|
@@ -3501,7 +3537,7 @@ function getVersionStatic() {
|
|
|
3501
3537
|
const packageJson = JSON.parse(readFileSync2(packagePath, "utf-8"));
|
|
3502
3538
|
return packageJson.version;
|
|
3503
3539
|
} catch {
|
|
3504
|
-
return true ? "0.6.
|
|
3540
|
+
return true ? "0.6.16" : "0.0.0-unknown";
|
|
3505
3541
|
}
|
|
3506
3542
|
}
|
|
3507
3543
|
var cli = new Command15().name("buildwithnexus").description("Auto-scaffold and launch a fully autonomous NEXUS runtime").version(getVersionStatic());
|
|
@@ -3622,7 +3658,7 @@ import os5 from "os";
|
|
|
3622
3658
|
import path11 from "path";
|
|
3623
3659
|
var homeEnvPath = path11.join(os5.homedir(), ".env.local");
|
|
3624
3660
|
dotenv2.config({ path: homeEnvPath });
|
|
3625
|
-
var version = true ? "0.6.
|
|
3661
|
+
var version = true ? "0.6.16" : "0.5.17";
|
|
3626
3662
|
checkForUpdates(version);
|
|
3627
3663
|
program.name("buildwithnexus").description("Deep Agents - AI-Powered Task Execution").version(version);
|
|
3628
3664
|
program.command("da-init").description("Initialize Deep Agents (set up API keys and .env.local)").action(deepAgentsInitCommand);
|