bravecode-cli 0.1.36 → 0.1.38
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 +50 -19
- package/dist/cli-main.mjs.map +2 -2
- 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.38";
|
|
38189
38189
|
APP_NAME = "BraveCode";
|
|
38190
38190
|
}
|
|
38191
38191
|
});
|
|
@@ -41152,7 +41152,7 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41152
41152
|
setAutoApprove(auto) {
|
|
41153
41153
|
this.autoApprove = auto;
|
|
41154
41154
|
}
|
|
41155
|
-
async run(userMessage, onChunk, signal) {
|
|
41155
|
+
async run(userMessage, onChunk, signal, onToolCall) {
|
|
41156
41156
|
let message = userMessage;
|
|
41157
41157
|
if (this.pluginHooks.beforeAgentRun) {
|
|
41158
41158
|
message = await this.pluginHooks.beforeAgentRun(this.config.id, message);
|
|
@@ -41217,6 +41217,7 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41217
41217
|
if (signal?.aborted) break;
|
|
41218
41218
|
const toolName = toolCall.name;
|
|
41219
41219
|
const toolArgs = toolCall.arguments;
|
|
41220
|
+
onToolCall?.(toolCall, "running");
|
|
41220
41221
|
const permission = await this.permissions.checkPermission(
|
|
41221
41222
|
toolName,
|
|
41222
41223
|
toolArgs,
|
|
@@ -41225,6 +41226,7 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41225
41226
|
if (permission.action === "deny") {
|
|
41226
41227
|
agentLog(`
|
|
41227
41228
|
> Blocked: ${toolName} (permission denied)`);
|
|
41229
|
+
onToolCall?.(toolCall, "error", "Permission denied");
|
|
41228
41230
|
this.conversationHistory.push({
|
|
41229
41231
|
role: "tool",
|
|
41230
41232
|
content: "Permission denied by security policy.",
|
|
@@ -41252,6 +41254,7 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41252
41254
|
if (this.pluginHooks.afterToolCall) {
|
|
41253
41255
|
result = await this.pluginHooks.afterToolCall(toolName, args, result);
|
|
41254
41256
|
}
|
|
41257
|
+
onToolCall?.(toolCall, "done", result);
|
|
41255
41258
|
this.conversationHistory.push({
|
|
41256
41259
|
role: "tool",
|
|
41257
41260
|
content: result,
|
|
@@ -41811,7 +41814,7 @@ var init_providers = __esm({
|
|
|
41811
41814
|
// src/core/tui/hooks/use-agent-runner.ts
|
|
41812
41815
|
import React3 from "react";
|
|
41813
41816
|
function useAgentRunner() {
|
|
41814
|
-
const { addMessage, updateMessage } = useSession();
|
|
41817
|
+
const { addMessage, updateMessage, addToolCall, messages } = useSession();
|
|
41815
41818
|
const { currentAgent, currentModel, setRunning } = useAgent();
|
|
41816
41819
|
const toast = useToast();
|
|
41817
41820
|
const agentRef = React3.useRef(null);
|
|
@@ -41847,7 +41850,27 @@ function useAgentRunner() {
|
|
|
41847
41850
|
fullContent += chunk;
|
|
41848
41851
|
updateMessage(assistantMsg.id, { content: fullContent });
|
|
41849
41852
|
},
|
|
41850
|
-
abortRef.current.signal
|
|
41853
|
+
abortRef.current.signal,
|
|
41854
|
+
(toolCall, status, result) => {
|
|
41855
|
+
const tcState = {
|
|
41856
|
+
id: toolCall.id,
|
|
41857
|
+
name: toolCall.name,
|
|
41858
|
+
args: toolCall.arguments,
|
|
41859
|
+
status,
|
|
41860
|
+
result
|
|
41861
|
+
};
|
|
41862
|
+
const existingMsg = messages.find((m) => m.id === assistantMsg.id);
|
|
41863
|
+
const existingTc = existingMsg?.toolCalls?.find((tc) => tc.id === toolCall.id);
|
|
41864
|
+
if (existingTc) {
|
|
41865
|
+
updateMessage(assistantMsg.id, {
|
|
41866
|
+
toolCalls: existingMsg.toolCalls.map(
|
|
41867
|
+
(tc) => tc.id === toolCall.id ? tcState : tc
|
|
41868
|
+
)
|
|
41869
|
+
});
|
|
41870
|
+
} else {
|
|
41871
|
+
addToolCall(assistantMsg.id, tcState);
|
|
41872
|
+
}
|
|
41873
|
+
}
|
|
41851
41874
|
);
|
|
41852
41875
|
updateMessage(assistantMsg.id, { content: fullContent });
|
|
41853
41876
|
} catch (err) {
|
|
@@ -41965,14 +41988,10 @@ function AgentModelLine({ inline = false }) {
|
|
|
41965
41988
|
const { colors: colors2 } = useTheme();
|
|
41966
41989
|
const { currentAgent, currentModel, isRunning } = useAgent();
|
|
41967
41990
|
return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row", gap: 1, ...inline ? {} : { paddingLeft: 1, paddingRight: 1, marginTop: 0, marginBottom: 0 } }, children: [
|
|
41968
|
-
/* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsxs("b", { children: [
|
|
41969
|
-
"\u25FC ",
|
|
41970
|
-
s(currentAgent.name.replace(" Agent", ""))
|
|
41971
|
-
] }) }),
|
|
41972
|
-
/* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "\xB7" }),
|
|
41973
41991
|
/* @__PURE__ */ jsx("text", { fg: colors2.textSecondary, children: s(currentModel) }),
|
|
41974
|
-
/* @__PURE__ */ jsx("text", { fg: colors2.
|
|
41975
|
-
/* @__PURE__ */ jsx("text", { fg: colors2.
|
|
41992
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "\xB7" }),
|
|
41993
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "\xB7" }),
|
|
41994
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsx("b", { children: s(currentAgent.name.replace(" Agent", "").toLowerCase()) }) }),
|
|
41976
41995
|
isRunning ? /* @__PURE__ */ jsx("text", { fg: colors2.warning, children: "\xB7 generating\u2026" }) : null
|
|
41977
41996
|
] });
|
|
41978
41997
|
}
|
|
@@ -42115,12 +42134,24 @@ function MessageBubble({ msg }) {
|
|
|
42115
42134
|
/* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(msg.timestamp.toLocaleTimeString()) })
|
|
42116
42135
|
] }),
|
|
42117
42136
|
/* @__PURE__ */ jsx("scrollbox", { style: { maxHeight: 40 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.text, wrapMode: "word", children: s(msg.content || (isUser ? "" : " ")) }) }),
|
|
42118
|
-
msg.toolCalls && msg.toolCalls.length > 0 ? /* @__PURE__ */ jsx("box", { style: { marginTop: 0, flexDirection: "column" }, children: msg.toolCalls.map((tc) =>
|
|
42119
|
-
"
|
|
42120
|
-
|
|
42121
|
-
|
|
42122
|
-
|
|
42123
|
-
|
|
42137
|
+
msg.toolCalls && msg.toolCalls.length > 0 ? /* @__PURE__ */ jsx("box", { style: { marginTop: 0, flexDirection: "column" }, children: msg.toolCalls.map((tc) => {
|
|
42138
|
+
if (tc.name === "write" || tc.name === "edit") {
|
|
42139
|
+
const filePath = tc.args?.filePath || tc.args?.path || "";
|
|
42140
|
+
const isCreate = tc.name === "write";
|
|
42141
|
+
const icon = isCreate ? "+" : "~";
|
|
42142
|
+
const iconColor = isCreate ? colors2.success : colors2.warning;
|
|
42143
|
+
return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "row", gap: 1, paddingLeft: 1 }, children: [
|
|
42144
|
+
/* @__PURE__ */ jsx("text", { fg: iconColor, children: /* @__PURE__ */ jsx("b", { children: icon }) }),
|
|
42145
|
+
/* @__PURE__ */ jsx("text", { fg: colors2.textSecondary, children: s(filePath) })
|
|
42146
|
+
] }, s(tc.id));
|
|
42147
|
+
}
|
|
42148
|
+
return /* @__PURE__ */ jsx("box", { style: { flexDirection: "row", gap: 1 }, children: /* @__PURE__ */ jsx("text", { fg: tc.status === "error" ? colors2.error : colors2.info, children: /* @__PURE__ */ jsxs("b", { children: [
|
|
42149
|
+
"[",
|
|
42150
|
+
s(tc.name),
|
|
42151
|
+
tc.status === "done" ? " \u2713" : tc.status === "error" ? " \u2717" : "\u2026",
|
|
42152
|
+
"]"
|
|
42153
|
+
] }) }) }, s(tc.id));
|
|
42154
|
+
}) }) : null
|
|
42124
42155
|
] });
|
|
42125
42156
|
}
|
|
42126
42157
|
function MessageContainer() {
|
|
@@ -42472,7 +42503,8 @@ function App() {
|
|
|
42472
42503
|
const renderer = useRenderer();
|
|
42473
42504
|
const { width } = useTerminalDimensions();
|
|
42474
42505
|
const [sidebarForced, setSidebarForced] = React4.useState(false);
|
|
42475
|
-
const
|
|
42506
|
+
const hasMessages = messages.length > 0;
|
|
42507
|
+
const sidebarVisible = hasMessages && (sidebarForced || width >= SIDEBAR_BREAKPOINT);
|
|
42476
42508
|
const [infoCompact, setInfoCompact] = React4.useState(false);
|
|
42477
42509
|
useKeyboard((key) => {
|
|
42478
42510
|
if (key.ctrl && key.name === "p") {
|
|
@@ -42552,7 +42584,6 @@ function App() {
|
|
|
42552
42584
|
}
|
|
42553
42585
|
void sendMessage(value);
|
|
42554
42586
|
};
|
|
42555
|
-
const hasMessages = messages.length > 0;
|
|
42556
42587
|
React4.useEffect(() => {
|
|
42557
42588
|
if (width < SIDEBAR_BREAKPOINT && !sidebarForced) setInfoCompact(true);
|
|
42558
42589
|
else setInfoCompact(false);
|