bravecode-cli 0.1.37 → 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 +47 -12
- 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) {
|
|
@@ -42111,12 +42134,24 @@ function MessageBubble({ msg }) {
|
|
|
42111
42134
|
/* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: s(msg.timestamp.toLocaleTimeString()) })
|
|
42112
42135
|
] }),
|
|
42113
42136
|
/* @__PURE__ */ jsx("scrollbox", { style: { maxHeight: 40 }, children: /* @__PURE__ */ jsx("text", { fg: colors2.text, wrapMode: "word", children: s(msg.content || (isUser ? "" : " ")) }) }),
|
|
42114
|
-
msg.toolCalls && msg.toolCalls.length > 0 ? /* @__PURE__ */ jsx("box", { style: { marginTop: 0, flexDirection: "column" }, children: msg.toolCalls.map((tc) =>
|
|
42115
|
-
"
|
|
42116
|
-
|
|
42117
|
-
|
|
42118
|
-
|
|
42119
|
-
|
|
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
|
|
42120
42155
|
] });
|
|
42121
42156
|
}
|
|
42122
42157
|
function MessageContainer() {
|
|
@@ -42468,7 +42503,8 @@ function App() {
|
|
|
42468
42503
|
const renderer = useRenderer();
|
|
42469
42504
|
const { width } = useTerminalDimensions();
|
|
42470
42505
|
const [sidebarForced, setSidebarForced] = React4.useState(false);
|
|
42471
|
-
const
|
|
42506
|
+
const hasMessages = messages.length > 0;
|
|
42507
|
+
const sidebarVisible = hasMessages && (sidebarForced || width >= SIDEBAR_BREAKPOINT);
|
|
42472
42508
|
const [infoCompact, setInfoCompact] = React4.useState(false);
|
|
42473
42509
|
useKeyboard((key) => {
|
|
42474
42510
|
if (key.ctrl && key.name === "p") {
|
|
@@ -42548,7 +42584,6 @@ function App() {
|
|
|
42548
42584
|
}
|
|
42549
42585
|
void sendMessage(value);
|
|
42550
42586
|
};
|
|
42551
|
-
const hasMessages = messages.length > 0;
|
|
42552
42587
|
React4.useEffect(() => {
|
|
42553
42588
|
if (width < SIDEBAR_BREAKPOINT && !sidebarForced) setInfoCompact(true);
|
|
42554
42589
|
else setInfoCompact(false);
|