bravecode-cli 0.1.49 → 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 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
- * Translates these into real `write` tool calls.
37207
+ * Also accepts the HTML-entity-escaped form (&lt;write_file ...&gt;) 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 re = /<write_file\s+path="([^"]+)">([\s\S]*?)<\/write_file>/g;
37213
- let last = 0;
37214
- let m;
37215
- while ((m = re.exec(text2)) !== null) {
37216
- const [full, path2, content] = m;
37217
- out.push(text2.slice(last, m.index));
37218
- calls.push({
37219
- id: this.newCallId(),
37220
- name: "write",
37221
- arguments: { filePath: path2, content }
37222
- });
37223
- last = m.index + full.length;
37214
+ const decoded = text2.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/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() {
@@ -37589,7 +37635,13 @@ ${instructions}` : instructions;
37589
37635
  if (rawText) {
37590
37636
  const { text: text2, toolCalls } = parser2.push(rawText);
37591
37637
  if (text2) {
37592
- yield { type: "text", text: text2 };
37638
+ const native = parser2.consumeNativeTags(text2);
37639
+ if (native.text) {
37640
+ yield { type: "text", text: native.text };
37641
+ }
37642
+ for (const call of native.toolCalls) {
37643
+ yield { type: "tool_call", toolCall: call };
37644
+ }
37593
37645
  }
37594
37646
  for (const call of toolCalls) {
37595
37647
  yield { type: "tool_call", toolCall: call };
@@ -38228,7 +38280,7 @@ var APP_VERSION, APP_NAME;
38228
38280
  var init_version = __esm({
38229
38281
  "src/version.ts"() {
38230
38282
  "use strict";
38231
- APP_VERSION = "0.1.49";
38283
+ APP_VERSION = "0.1.51";
38232
38284
  APP_NAME = "BraveCode";
38233
38285
  }
38234
38286
  });