buildwithnexus 0.8.4 → 0.8.6
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 +41 -26
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -1190,7 +1190,6 @@ var TUI = class {
|
|
|
1190
1190
|
return colors.muted(label);
|
|
1191
1191
|
});
|
|
1192
1192
|
console.log(parts.join(colors.muted(" \u2022 ")));
|
|
1193
|
-
console.log(colors.muted("[s] switch mode"));
|
|
1194
1193
|
console.log("");
|
|
1195
1194
|
}
|
|
1196
1195
|
displayModeHeader(mode) {
|
|
@@ -1246,6 +1245,21 @@ var TUI = class {
|
|
|
1246
1245
|
displayPermissionPrompt(message) {
|
|
1247
1246
|
return colors.accent.bold(message) + colors.muted(" (y/n) ");
|
|
1248
1247
|
}
|
|
1248
|
+
displayInputBox(mode) {
|
|
1249
|
+
const width = 60;
|
|
1250
|
+
const innerWidth = width - 4;
|
|
1251
|
+
const modeName = mode === "PLAN" ? "\u{1F4CB} Planning" : mode === "BUILD" ? "\u2699\uFE0F Building" : "\u{1F4A1} Brainstorming";
|
|
1252
|
+
const top = colors.accent("\u250C" + "\u2500".repeat(innerWidth) + "\u2510");
|
|
1253
|
+
const bottom = colors.accent("\u2514" + "\u2500".repeat(innerWidth) + "\u2518");
|
|
1254
|
+
const modeDisplay = colors.muted(`Mode: ${modeName}`);
|
|
1255
|
+
console.log(top);
|
|
1256
|
+
return colors.accent("\u2502 ") + colors.muted("> ");
|
|
1257
|
+
}
|
|
1258
|
+
displayModeIndicator(mode) {
|
|
1259
|
+
const modeName = mode === "PLAN" ? "\u{1F4CB} Planning" : mode === "BUILD" ? "\u2699\uFE0F Building" : "\u{1F4A1} Brainstorming";
|
|
1260
|
+
console.log(colors.muted(`Mode: ${modeName}
|
|
1261
|
+
`));
|
|
1262
|
+
}
|
|
1249
1263
|
padToWidth(text, targetWidth) {
|
|
1250
1264
|
const visibleWidth = stringWidth(text);
|
|
1251
1265
|
const padding = Math.max(0, targetWidth - visibleWidth);
|
|
@@ -1593,7 +1607,7 @@ init_secrets();
|
|
|
1593
1607
|
init_docker();
|
|
1594
1608
|
|
|
1595
1609
|
// src/core/version.ts
|
|
1596
|
-
var resolvedVersion = true ? "0.8.
|
|
1610
|
+
var resolvedVersion = true ? "0.8.6" : pkg.version;
|
|
1597
1611
|
|
|
1598
1612
|
// src/cli/interactive.ts
|
|
1599
1613
|
var appVersion = resolvedVersion;
|
|
@@ -1652,18 +1666,8 @@ ${urlCheck.error}`));
|
|
|
1652
1666
|
input: process.stdin,
|
|
1653
1667
|
output: process.stdout
|
|
1654
1668
|
});
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
if (currentMode) {
|
|
1658
|
-
const agentNames = {
|
|
1659
|
-
PLAN: "\u{1F3AF} Planner",
|
|
1660
|
-
BUILD: "\u{1F528} Builder",
|
|
1661
|
-
BRAINSTORM: "\u{1F4A1} Chief of Staff"
|
|
1662
|
-
};
|
|
1663
|
-
modeIndicator = `
|
|
1664
|
-
${chalk3.dim(`\u2192 ${agentNames[currentMode]}`)}`;
|
|
1665
|
-
}
|
|
1666
|
-
rl.question(question + modeIndicator, resolve);
|
|
1669
|
+
const ask = (question) => new Promise((resolve) => {
|
|
1670
|
+
rl.question(question, resolve);
|
|
1667
1671
|
});
|
|
1668
1672
|
console.clear();
|
|
1669
1673
|
console.log(chalk3.gray("Welcome! Describe what you want the AI agents to do."));
|
|
@@ -1697,7 +1701,7 @@ async function selectMode(suggested, ask) {
|
|
|
1697
1701
|
chalk3.gray("Press ") + chalk3.bold("Enter") + chalk3.gray(" to use ") + modeColor[suggested](suggested) + chalk3.gray(" or choose a mode:")
|
|
1698
1702
|
);
|
|
1699
1703
|
console.log(
|
|
1700
|
-
chalk3.gray(" ") + chalk3.cyan.bold("[1] PLAN") + chalk3.gray("
|
|
1704
|
+
chalk3.gray(" ") + chalk3.cyan.bold("[1] PLAN") + chalk3.gray(" design & break down steps") + chalk3.gray("\n ") + chalk3.green.bold("[2] BUILD") + chalk3.gray(" execute with live streaming") + chalk3.gray("\n ") + chalk3.blue.bold("[3] BRAINSTORM") + chalk3.gray(" free-form explore & Q&A")
|
|
1701
1705
|
);
|
|
1702
1706
|
const answer = await ask(chalk3.gray("> "));
|
|
1703
1707
|
const lower = answer.trim().toLowerCase();
|
|
@@ -1834,8 +1838,8 @@ async function planModeLoop(task, backendUrl, currentMode, ask) {
|
|
|
1834
1838
|
}
|
|
1835
1839
|
displayPlanSteps(steps);
|
|
1836
1840
|
while (true) {
|
|
1837
|
-
console.log(chalk3.gray("Options: ") + chalk3.bold("[Y]") + chalk3.gray(" Execute ") + chalk3.bold("[e]") + chalk3.gray(" Edit step ") + chalk3.bold("[
|
|
1838
|
-
const answer = (await ask(tui.displayPermissionPrompt("Execute this plan?")
|
|
1841
|
+
console.log(chalk3.gray("Options: ") + chalk3.bold("[Y]") + chalk3.gray(" Execute ") + chalk3.bold("[e]") + chalk3.gray(" Edit step ") + chalk3.bold("[n]") + chalk3.gray(" Cancel"));
|
|
1842
|
+
const answer = (await ask(tui.displayPermissionPrompt("Execute this plan?"))).trim().toLowerCase();
|
|
1839
1843
|
if (answer === "" || answer === "y") {
|
|
1840
1844
|
return "BUILD";
|
|
1841
1845
|
}
|
|
@@ -1871,11 +1875,11 @@ function displayPlanSteps(steps) {
|
|
|
1871
1875
|
}
|
|
1872
1876
|
async function editPlanSteps(steps, currentMode, ask) {
|
|
1873
1877
|
console.log(chalk3.gray("Enter step number to edit, or press Enter to finish editing:"));
|
|
1874
|
-
const numStr = await ask(chalk3.bold("Step #: ")
|
|
1878
|
+
const numStr = await ask(chalk3.bold("Step #: "));
|
|
1875
1879
|
const n = parseInt(numStr.trim(), 10);
|
|
1876
1880
|
if (!isNaN(n) && n >= 1 && n <= steps.length) {
|
|
1877
1881
|
console.log(chalk3.gray(`Current: ${steps[n - 1]}`));
|
|
1878
|
-
const updated = await ask(chalk3.bold("New text: ")
|
|
1882
|
+
const updated = await ask(chalk3.bold("New text: "));
|
|
1879
1883
|
if (updated.trim()) steps[n - 1] = updated.trim();
|
|
1880
1884
|
}
|
|
1881
1885
|
return steps;
|
|
@@ -1948,10 +1952,10 @@ async function buildModeLoop(task, backendUrl, currentMode, ask) {
|
|
|
1948
1952
|
}
|
|
1949
1953
|
console.log("");
|
|
1950
1954
|
console.log(
|
|
1951
|
-
chalk3.gray("Options: ") + chalk3.bold("[Enter]") + chalk3.gray(" Done
|
|
1955
|
+
chalk3.gray("Options: ") + chalk3.bold("[Enter]") + chalk3.gray(" Done")
|
|
1952
1956
|
);
|
|
1953
|
-
const answer = (await ask(chalk3.bold("> ")
|
|
1954
|
-
if (answer === "
|
|
1957
|
+
const answer = (await ask(chalk3.bold("> "))).trim().toLowerCase();
|
|
1958
|
+
if (answer === "/switch" || answer === "/mode") return "switch";
|
|
1955
1959
|
return "done";
|
|
1956
1960
|
}
|
|
1957
1961
|
async function brainstormModeLoop(task, backendUrl, currentMode, ask) {
|
|
@@ -1959,7 +1963,6 @@ async function brainstormModeLoop(task, backendUrl, currentMode, ask) {
|
|
|
1959
1963
|
console.log(chalk3.gray('Ask follow-up questions. Type "done" to exit, "switch" to change mode.\n'));
|
|
1960
1964
|
let currentQuestion = task;
|
|
1961
1965
|
while (true) {
|
|
1962
|
-
console.log(chalk3.bold.blue("\u{1F4A1} Thinking..."));
|
|
1963
1966
|
try {
|
|
1964
1967
|
const response = await fetch(`${backendUrl}/api/run`, {
|
|
1965
1968
|
method: "POST",
|
|
@@ -2001,9 +2004,14 @@ async function brainstormModeLoop(task, backendUrl, currentMode, ask) {
|
|
|
2001
2004
|
continue;
|
|
2002
2005
|
}
|
|
2003
2006
|
let responseText = "";
|
|
2007
|
+
let firstEvent = true;
|
|
2004
2008
|
for await (const parsed of parseSSEStream(reader)) {
|
|
2005
2009
|
const type = parsed.type;
|
|
2006
2010
|
const data = parsed.data;
|
|
2011
|
+
if (firstEvent && type !== "done" && type !== "error") {
|
|
2012
|
+
console.log(chalk3.bold.blue("\u{1F4AD} Thinking...\n"));
|
|
2013
|
+
firstEvent = false;
|
|
2014
|
+
}
|
|
2007
2015
|
if (type === "done" || type === "execution_complete" || type === "final_result") {
|
|
2008
2016
|
const summary = data["summary"] || data["result"] || "";
|
|
2009
2017
|
if (summary) responseText = summary;
|
|
@@ -2014,19 +2022,26 @@ async function brainstormModeLoop(task, backendUrl, currentMode, ask) {
|
|
|
2014
2022
|
break;
|
|
2015
2023
|
} else if (type === "thought" || type === "observation") {
|
|
2016
2024
|
const content = data["content"] || "";
|
|
2017
|
-
if (content)
|
|
2025
|
+
if (content) {
|
|
2026
|
+
console.log(chalk3.gray("\u2192 " + content));
|
|
2027
|
+
responseText += content + "\n";
|
|
2028
|
+
}
|
|
2018
2029
|
} else if (type === "agent_response" || type === "agent_result") {
|
|
2019
2030
|
const content = data["content"] || data["result"] || "";
|
|
2020
2031
|
if (content) responseText += content + "\n";
|
|
2021
2032
|
} else if (type === "action") {
|
|
2022
2033
|
const content = data["content"] || "";
|
|
2023
|
-
if (content)
|
|
2034
|
+
if (content) {
|
|
2035
|
+
console.log(chalk3.cyan("\u2699\uFE0F " + content));
|
|
2036
|
+
responseText += content + "\n";
|
|
2037
|
+
}
|
|
2024
2038
|
} else if (type === "agent_working" || type === "started") {
|
|
2025
2039
|
} else if (type !== "plan") {
|
|
2026
2040
|
const content = data["content"] || data["response"] || "";
|
|
2027
2041
|
if (content) responseText += content + "\n";
|
|
2028
2042
|
}
|
|
2029
2043
|
}
|
|
2044
|
+
console.log("");
|
|
2030
2045
|
if (responseText.trim()) {
|
|
2031
2046
|
tui.displayBrainstormResponse(responseText.trim());
|
|
2032
2047
|
} else {
|
|
@@ -2039,7 +2054,7 @@ async function brainstormModeLoop(task, backendUrl, currentMode, ask) {
|
|
|
2039
2054
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2040
2055
|
console.error(chalk3.red("Error: " + msg));
|
|
2041
2056
|
}
|
|
2042
|
-
const followUp = await ask(chalk3.bold.blue("\u{1F4AC} You: ")
|
|
2057
|
+
const followUp = await ask(chalk3.bold.blue("\u{1F4AC} You: "));
|
|
2043
2058
|
const lower = followUp.trim().toLowerCase();
|
|
2044
2059
|
if (lower === "done" || lower === "exit") return "done";
|
|
2045
2060
|
if (lower === "switch") return "switch";
|