bravecode-cli 0.1.50 → 0.1.51
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 +61 -15
- package/dist/cli-main.mjs.map +3 -3
- package/package.json +1 -1
package/dist/cli-main.mjs
CHANGED
|
@@ -37204,25 +37204,71 @@ var init_provider = __esm({
|
|
|
37204
37204
|
/**
|
|
37205
37205
|
* Also recognize the model-native tool tag format some LLMs default to,
|
|
37206
37206
|
* e.g. <write_file path="src/App.tsx">...content...</write_file>.
|
|
37207
|
-
*
|
|
37207
|
+
* Also accepts the HTML-entity-escaped form (<write_file ...>) that
|
|
37208
|
+
* some models emit when prompted to avoid HTML. Translates all of these
|
|
37209
|
+
* into real tool calls.
|
|
37208
37210
|
*/
|
|
37209
37211
|
consumeNativeTags(text2) {
|
|
37210
37212
|
const out = [];
|
|
37211
37213
|
const calls = [];
|
|
37212
|
-
const
|
|
37213
|
-
|
|
37214
|
-
|
|
37215
|
-
|
|
37216
|
-
|
|
37217
|
-
|
|
37218
|
-
|
|
37219
|
-
|
|
37220
|
-
|
|
37221
|
-
|
|
37222
|
-
|
|
37223
|
-
|
|
37214
|
+
const decoded = text2.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"');
|
|
37215
|
+
const nextCall = () => this.newCallId();
|
|
37216
|
+
{
|
|
37217
|
+
const re = /<write_file\s+path="([^"]+)">([\s\S]*?)<\/write_file>/g;
|
|
37218
|
+
let last = 0;
|
|
37219
|
+
let m;
|
|
37220
|
+
while ((m = re.exec(decoded)) !== null) {
|
|
37221
|
+
const [full, path2, content] = m;
|
|
37222
|
+
out.push(decoded.slice(last, m.index));
|
|
37223
|
+
calls.push({
|
|
37224
|
+
id: nextCall(),
|
|
37225
|
+
name: "write",
|
|
37226
|
+
arguments: { filePath: path2, content }
|
|
37227
|
+
});
|
|
37228
|
+
last = m.index + full.length;
|
|
37229
|
+
}
|
|
37230
|
+
out.push(decoded.slice(last));
|
|
37231
|
+
}
|
|
37232
|
+
{
|
|
37233
|
+
const text22 = out.join("");
|
|
37234
|
+
const re = /<read_file\s+path="([^"]+)"\s*\/>/g;
|
|
37235
|
+
let last = 0;
|
|
37236
|
+
let m;
|
|
37237
|
+
const replaced = [];
|
|
37238
|
+
while ((m = re.exec(text22)) !== null) {
|
|
37239
|
+
const [full, path2] = m;
|
|
37240
|
+
replaced.push(text22.slice(last, m.index));
|
|
37241
|
+
calls.push({
|
|
37242
|
+
id: nextCall(),
|
|
37243
|
+
name: "read",
|
|
37244
|
+
arguments: { filePath: path2 }
|
|
37245
|
+
});
|
|
37246
|
+
last = m.index + full.length;
|
|
37247
|
+
}
|
|
37248
|
+
replaced.push(text22.slice(last));
|
|
37249
|
+
out.length = 0;
|
|
37250
|
+
out.push(replaced.join(""));
|
|
37251
|
+
}
|
|
37252
|
+
{
|
|
37253
|
+
const text22 = out.join("");
|
|
37254
|
+
const re = /<run_command>([\s\S]*?)<\/run_command>/g;
|
|
37255
|
+
let last = 0;
|
|
37256
|
+
let m;
|
|
37257
|
+
const replaced = [];
|
|
37258
|
+
while ((m = re.exec(text22)) !== null) {
|
|
37259
|
+
const [full, cmd] = m;
|
|
37260
|
+
replaced.push(text22.slice(last, m.index));
|
|
37261
|
+
calls.push({
|
|
37262
|
+
id: nextCall(),
|
|
37263
|
+
name: "bash",
|
|
37264
|
+
arguments: { command: cmd.trim() }
|
|
37265
|
+
});
|
|
37266
|
+
last = m.index + full.length;
|
|
37267
|
+
}
|
|
37268
|
+
replaced.push(text22.slice(last));
|
|
37269
|
+
out.length = 0;
|
|
37270
|
+
out.push(replaced.join(""));
|
|
37224
37271
|
}
|
|
37225
|
-
out.push(text2.slice(last));
|
|
37226
37272
|
return { text: out.join(""), toolCalls: calls };
|
|
37227
37273
|
}
|
|
37228
37274
|
end() {
|
|
@@ -38234,7 +38280,7 @@ var APP_VERSION, APP_NAME;
|
|
|
38234
38280
|
var init_version = __esm({
|
|
38235
38281
|
"src/version.ts"() {
|
|
38236
38282
|
"use strict";
|
|
38237
|
-
APP_VERSION = "0.1.
|
|
38283
|
+
APP_VERSION = "0.1.51";
|
|
38238
38284
|
APP_NAME = "BraveCode";
|
|
38239
38285
|
}
|
|
38240
38286
|
});
|