bravecode-cli 0.1.24 → 0.1.26
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-main.mjs +49 -27
- package/dist/cli-main.mjs.map +3 -3
- package/package.json +1 -1
package/dist/cli-main.mjs
CHANGED
|
@@ -38185,7 +38185,7 @@ var APP_VERSION, APP_NAME;
|
|
|
38185
38185
|
var init_version = __esm({
|
|
38186
38186
|
"src/version.ts"() {
|
|
38187
38187
|
"use strict";
|
|
38188
|
-
APP_VERSION = "0.1.
|
|
38188
|
+
APP_VERSION = "0.1.26";
|
|
38189
38189
|
APP_NAME = "BraveCode";
|
|
38190
38190
|
}
|
|
38191
38191
|
});
|
|
@@ -40886,7 +40886,11 @@ ${toSummarize.map((m) => `${m.role}: ${typeof m.content === "string" ? m.content
|
|
|
40886
40886
|
});
|
|
40887
40887
|
|
|
40888
40888
|
// src/core/agent/index.ts
|
|
40889
|
-
|
|
40889
|
+
function agentLog(...args) {
|
|
40890
|
+
if (IS_TUI3) return;
|
|
40891
|
+
console.log(...args);
|
|
40892
|
+
}
|
|
40893
|
+
var MAX_SUBAGENT_DEPTH, subagentDepth, IS_TUI3, defaultAgents, Agent;
|
|
40890
40894
|
var init_agent = __esm({
|
|
40891
40895
|
"src/core/agent/index.ts"() {
|
|
40892
40896
|
"use strict";
|
|
@@ -40896,6 +40900,7 @@ var init_agent = __esm({
|
|
|
40896
40900
|
init_context();
|
|
40897
40901
|
MAX_SUBAGENT_DEPTH = 2;
|
|
40898
40902
|
subagentDepth = 0;
|
|
40903
|
+
IS_TUI3 = process.env.BRAVECODE_TUI === "1";
|
|
40899
40904
|
defaultAgents = [
|
|
40900
40905
|
{
|
|
40901
40906
|
id: "build",
|
|
@@ -41163,7 +41168,7 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41163
41168
|
if (status.shouldCompact) {
|
|
41164
41169
|
const compacted = await this.compactor.compact(this.conversationHistory, this.provider);
|
|
41165
41170
|
this.conversationHistory = compacted.messages;
|
|
41166
|
-
|
|
41171
|
+
agentLog(
|
|
41167
41172
|
`
|
|
41168
41173
|
> Context compacted: ${compacted.originalTokens} -> ${compacted.compactedTokens} estimated tokens`
|
|
41169
41174
|
);
|
|
@@ -41218,7 +41223,7 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41218
41223
|
this.config.id
|
|
41219
41224
|
);
|
|
41220
41225
|
if (permission.action === "deny") {
|
|
41221
|
-
|
|
41226
|
+
agentLog(`
|
|
41222
41227
|
> Blocked: ${toolName} (permission denied)`);
|
|
41223
41228
|
this.conversationHistory.push({
|
|
41224
41229
|
role: "tool",
|
|
@@ -41229,9 +41234,9 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41229
41234
|
continue;
|
|
41230
41235
|
}
|
|
41231
41236
|
if (permission.action === "ask" && !this.autoApprove) {
|
|
41232
|
-
|
|
41237
|
+
agentLog(`
|
|
41233
41238
|
> ${toolName} requires approval`);
|
|
41234
|
-
|
|
41239
|
+
agentLog(` Args: ${JSON.stringify(toolArgs).substring(0, 100)}...`);
|
|
41235
41240
|
}
|
|
41236
41241
|
if (["edit", "write"].includes(toolName)) {
|
|
41237
41242
|
const snapshotFiles = typeof toolArgs?.filePath === "string" ? [toolArgs.filePath] : void 0;
|
|
@@ -41241,7 +41246,7 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41241
41246
|
if (this.pluginHooks.beforeToolCall) {
|
|
41242
41247
|
args = await this.pluginHooks.beforeToolCall(toolName, args);
|
|
41243
41248
|
}
|
|
41244
|
-
|
|
41249
|
+
agentLog(`
|
|
41245
41250
|
> Running: ${toolName}`);
|
|
41246
41251
|
let result = await this.tools.execute(toolName, args);
|
|
41247
41252
|
if (this.pluginHooks.afterToolCall) {
|
|
@@ -41944,17 +41949,13 @@ function StatusBar() {
|
|
|
41944
41949
|
alignItems: "center"
|
|
41945
41950
|
},
|
|
41946
41951
|
children: [
|
|
41952
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.success, children: /* @__PURE__ */ jsx("b", { children: "\u25CF" }) }),
|
|
41953
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: " 1 MCP " }),
|
|
41954
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.info, children: "/status" }),
|
|
41955
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsx("b", { children: s(APP_NAME) }) }),
|
|
41947
41956
|
/* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
|
|
41948
|
-
|
|
41949
|
-
|
|
41950
|
-
/* @__PURE__ */ jsx("text", { fg: colors2.info, children: "/status" })
|
|
41951
|
-
] }),
|
|
41952
|
-
/* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
|
|
41953
|
-
/* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsx("b", { children: s(APP_NAME) }) }),
|
|
41954
|
-
/* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
|
|
41955
|
-
" ",
|
|
41956
|
-
s(APP_VERSION)
|
|
41957
|
-
] })
|
|
41957
|
+
" ",
|
|
41958
|
+
s(APP_VERSION)
|
|
41958
41959
|
] })
|
|
41959
41960
|
]
|
|
41960
41961
|
}
|
|
@@ -42221,25 +42222,25 @@ function HelpDialog() {
|
|
|
42221
42222
|
children: [
|
|
42222
42223
|
/* @__PURE__ */ jsx("box", { style: { flexDirection: "row", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsx("b", { children: "Help \xB7 Commands & Shortcuts" }) }) }),
|
|
42223
42224
|
/* @__PURE__ */ jsxs("box", { style: { flexDirection: "column", gap: 0, width: "100%" }, children: [
|
|
42224
|
-
/* @__PURE__ */ jsxs("
|
|
42225
|
+
/* @__PURE__ */ jsxs("box", { style: { flexDirection: "row" }, children: [
|
|
42225
42226
|
/* @__PURE__ */ jsx("text", { fg: colors2.accent, children: /* @__PURE__ */ jsx("b", { children: "Tab" }) }),
|
|
42226
|
-
" \u2014 cycle agent"
|
|
42227
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.text, children: " \u2014 cycle agent" })
|
|
42227
42228
|
] }),
|
|
42228
|
-
/* @__PURE__ */ jsxs("
|
|
42229
|
+
/* @__PURE__ */ jsxs("box", { style: { flexDirection: "row" }, children: [
|
|
42229
42230
|
/* @__PURE__ */ jsx("text", { fg: colors2.accent, children: /* @__PURE__ */ jsx("b", { children: "Ctrl+P" }) }),
|
|
42230
|
-
" \u2014 model/commands palette"
|
|
42231
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.text, children: " \u2014 model/commands palette" })
|
|
42231
42232
|
] }),
|
|
42232
|
-
/* @__PURE__ */ jsxs("
|
|
42233
|
+
/* @__PURE__ */ jsxs("box", { style: { flexDirection: "row" }, children: [
|
|
42233
42234
|
/* @__PURE__ */ jsx("text", { fg: colors2.accent, children: /* @__PURE__ */ jsx("b", { children: "Ctrl+B" }) }),
|
|
42234
|
-
" \u2014 toggle sidebar"
|
|
42235
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.text, children: " \u2014 toggle sidebar" })
|
|
42235
42236
|
] }),
|
|
42236
|
-
/* @__PURE__ */ jsxs("
|
|
42237
|
+
/* @__PURE__ */ jsxs("box", { style: { flexDirection: "row" }, children: [
|
|
42237
42238
|
/* @__PURE__ */ jsx("text", { fg: colors2.accent, children: /* @__PURE__ */ jsx("b", { children: "Esc" }) }),
|
|
42238
|
-
" \u2014 interrupt / close dialog"
|
|
42239
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.text, children: " \u2014 interrupt / close dialog" })
|
|
42239
42240
|
] }),
|
|
42240
|
-
/* @__PURE__ */ jsxs("
|
|
42241
|
+
/* @__PURE__ */ jsxs("box", { style: { flexDirection: "row" }, children: [
|
|
42241
42242
|
/* @__PURE__ */ jsx("text", { fg: colors2.accent, children: /* @__PURE__ */ jsx("b", { children: "Ctrl+C" }) }),
|
|
42242
|
-
" \u2014 exit (when idle)"
|
|
42243
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.text, children: " \u2014 exit (when idle)" })
|
|
42243
42244
|
] })
|
|
42244
42245
|
] }),
|
|
42245
42246
|
/* @__PURE__ */ jsx("box", { style: { flexDirection: "column", gap: 0, marginTop: 1, width: "100%" }, children: /* @__PURE__ */ jsx("text", { fg: colors2.textSecondary, children: "/help \xB7 /models \xB7 /agents \xB7 /clear \xB7 /exit" }) })
|
|
@@ -43139,6 +43140,27 @@ Fetching ${url2} (${method})...
|
|
|
43139
43140
|
});
|
|
43140
43141
|
|
|
43141
43142
|
// src/cli.ts
|
|
43143
|
+
var isBun = typeof process !== "undefined" && typeof process.versions === "object" && process.versions !== null && typeof process.versions.bun === "string";
|
|
43144
|
+
if (!isBun) {
|
|
43145
|
+
const { execFileSync: execFileSync2, execSync: execSync5 } = await import("child_process");
|
|
43146
|
+
let bunPath = null;
|
|
43147
|
+
try {
|
|
43148
|
+
bunPath = execSync5("which bun", { encoding: "utf-8" }).trim();
|
|
43149
|
+
} catch {
|
|
43150
|
+
}
|
|
43151
|
+
if (bunPath) {
|
|
43152
|
+
try {
|
|
43153
|
+
const argv = process.argv.slice(1);
|
|
43154
|
+
execFileSync2(bunPath, argv, { stdio: "inherit" });
|
|
43155
|
+
process.exit(0);
|
|
43156
|
+
} catch {
|
|
43157
|
+
}
|
|
43158
|
+
}
|
|
43159
|
+
console.error(
|
|
43160
|
+
"\n \u2717 BraveCode TUI requires Bun runtime (https://bun.sh).\n Install Bun: curl -fsSL https://bun.sh/install | bash\n Or run: bun dist/cli.cjs\n"
|
|
43161
|
+
);
|
|
43162
|
+
process.exit(1);
|
|
43163
|
+
}
|
|
43142
43164
|
(function polyfillSelfGlobal() {
|
|
43143
43165
|
const g = globalThis;
|
|
43144
43166
|
try {
|