bravecode-cli 0.1.25 → 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 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.25";
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
- var MAX_SUBAGENT_DEPTH, subagentDepth, defaultAgents, Agent;
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
- console.log(
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
- console.log(`
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
- console.log(`
41237
+ agentLog(`
41233
41238
  > ${toolName} requires approval`);
41234
- console.log(` Args: ${JSON.stringify(toolArgs).substring(0, 100)}...`);
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
- console.log(`
41249
+ agentLog(`
41245
41250
  > Running: ${toolName}`);
41246
41251
  let result = await this.tools.execute(toolName, args);
41247
41252
  if (this.pluginHooks.afterToolCall) {
@@ -43135,6 +43140,27 @@ Fetching ${url2} (${method})...
43135
43140
  });
43136
43141
 
43137
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
+ }
43138
43164
  (function polyfillSelfGlobal() {
43139
43165
  const g = globalThis;
43140
43166
  try {