bravecode-cli 0.1.51 → 0.1.53
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 +32 -4
- package/dist/cli-main.mjs.map +3 -3
- package/package.json +1 -1
package/dist/cli-main.mjs
CHANGED
|
@@ -38280,7 +38280,7 @@ var APP_VERSION, APP_NAME;
|
|
|
38280
38280
|
var init_version = __esm({
|
|
38281
38281
|
"src/version.ts"() {
|
|
38282
38282
|
"use strict";
|
|
38283
|
-
APP_VERSION = "0.1.
|
|
38283
|
+
APP_VERSION = "0.1.53";
|
|
38284
38284
|
APP_NAME = "BraveCode";
|
|
38285
38285
|
}
|
|
38286
38286
|
});
|
|
@@ -41249,6 +41249,31 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41249
41249
|
setAutoApprove(auto) {
|
|
41250
41250
|
this.autoApprove = auto;
|
|
41251
41251
|
}
|
|
41252
|
+
/**
|
|
41253
|
+
* Last-resort extractor for tool calls that the provider's parser missed.
|
|
41254
|
+
* Handles non-standard tag formats the model emits in plain text, e.g.
|
|
41255
|
+
* <write_file path="...">...</write_file>, <read_file path="..."/>,
|
|
41256
|
+
* <run_command>cmd</run_command>, including the HTML-entity-escaped form.
|
|
41257
|
+
*/
|
|
41258
|
+
extractNativeToolTags(text2) {
|
|
41259
|
+
const decoded = text2.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"');
|
|
41260
|
+
const calls = [];
|
|
41261
|
+
const idSeq = () => `native_${Date.now().toString(36)}_${calls.length}`;
|
|
41262
|
+
const wfRe = /<write_file\s+path="([^"]+)">([\s\S]*?)<\/write_file>/g;
|
|
41263
|
+
let m;
|
|
41264
|
+
while ((m = wfRe.exec(decoded)) !== null) {
|
|
41265
|
+
calls.push({ id: idSeq(), name: "write", arguments: { filePath: m[1], content: m[2] } });
|
|
41266
|
+
}
|
|
41267
|
+
const rfRe = /<read_file\s+path="([^"]+)"\s*\/>/g;
|
|
41268
|
+
while ((m = rfRe.exec(decoded)) !== null) {
|
|
41269
|
+
calls.push({ id: idSeq(), name: "read", arguments: { filePath: m[1] } });
|
|
41270
|
+
}
|
|
41271
|
+
const rcRe = /<run_command>([\s\S]*?)<\/run_command>/g;
|
|
41272
|
+
while ((m = rcRe.exec(decoded)) !== null) {
|
|
41273
|
+
calls.push({ id: idSeq(), name: "bash", arguments: { command: m[1].trim() } });
|
|
41274
|
+
}
|
|
41275
|
+
return calls;
|
|
41276
|
+
}
|
|
41252
41277
|
async run(userMessage, onChunk, signal, onToolCall) {
|
|
41253
41278
|
let message = userMessage;
|
|
41254
41279
|
if (this.pluginHooks.beforeAgentRun) {
|
|
@@ -41292,6 +41317,9 @@ IMPORTANT: Only test APIs you have authorization to test. Never attempt to acces
|
|
|
41292
41317
|
toolCalls.push(chunk.toolCall);
|
|
41293
41318
|
}
|
|
41294
41319
|
}
|
|
41320
|
+
if (toolCalls.length === 0) {
|
|
41321
|
+
toolCalls = this.extractNativeToolTags(fullResponse);
|
|
41322
|
+
}
|
|
41295
41323
|
} else {
|
|
41296
41324
|
const result = await this.provider.chat({
|
|
41297
41325
|
model: this.config.model,
|
|
@@ -44883,17 +44911,17 @@ function App() {
|
|
|
44883
44911
|
children: hasMessages ? /* @__PURE__ */ jsx(MessageContainer, {}) : /* @__PURE__ */ jsx("box", { style: { flexDirection: "column", alignItems: "center", gap: 1 }, children: /* @__PURE__ */ jsx(PixelLogo, {}) })
|
|
44884
44912
|
}
|
|
44885
44913
|
),
|
|
44886
|
-
hasMessages ? /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column" }, children: [
|
|
44914
|
+
hasMessages ? /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column", flexShrink: 0 }, children: [
|
|
44887
44915
|
/* @__PURE__ */ jsx(
|
|
44888
44916
|
InputEditor,
|
|
44889
44917
|
{
|
|
44890
44918
|
onSubmit: handleSubmit,
|
|
44891
|
-
placeholder: isRunning ? "Generating\u2026 press esc to interrupt" :
|
|
44919
|
+
placeholder: isRunning ? "Generating\u2026 press esc to interrupt" : "Ask anything...",
|
|
44892
44920
|
showAbove: false
|
|
44893
44921
|
}
|
|
44894
44922
|
),
|
|
44895
44923
|
/* @__PURE__ */ jsx(ShortcutHints, { interrupted: isRunning })
|
|
44896
|
-
] }) : /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column", alignItems: "center" }, children: [
|
|
44924
|
+
] }) : /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column", alignItems: "center", flexShrink: 0 }, children: [
|
|
44897
44925
|
/* @__PURE__ */ jsx("box", { style: { width: 60, maxWidth: "80%" }, children: /* @__PURE__ */ jsx(
|
|
44898
44926
|
InputEditor,
|
|
44899
44927
|
{
|