bravecode-cli 0.1.48 → 0.1.49

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
@@ -37201,6 +37201,30 @@ var init_provider = __esm({
37201
37201
  }
37202
37202
  return { text: outText.join(""), toolCalls: calls };
37203
37203
  }
37204
+ /**
37205
+ * Also recognize the model-native tool tag format some LLMs default to,
37206
+ * e.g. <write_file path="src/App.tsx">...content...</write_file>.
37207
+ * Translates these into real `write` tool calls.
37208
+ */
37209
+ consumeNativeTags(text2) {
37210
+ const out = [];
37211
+ 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;
37224
+ }
37225
+ out.push(text2.slice(last));
37226
+ return { text: out.join(""), toolCalls: calls };
37227
+ }
37204
37228
  end() {
37205
37229
  let text2 = this.buffer;
37206
37230
  const calls = [];
@@ -37570,6 +37594,12 @@ ${instructions}` : instructions;
37570
37594
  for (const call of toolCalls) {
37571
37595
  yield { type: "tool_call", toolCall: call };
37572
37596
  }
37597
+ } else {
37598
+ const flush = parser2.end();
37599
+ if (flush.text) yield { type: "text", text: flush.text };
37600
+ for (const call of flush.toolCalls) {
37601
+ yield { type: "tool_call", toolCall: call };
37602
+ }
37573
37603
  }
37574
37604
  if (delta && (delta.done || delta.type === "done")) {
37575
37605
  sawDone = true;
@@ -37579,7 +37609,13 @@ ${instructions}` : instructions;
37579
37609
  }
37580
37610
  const tail = parser2.end();
37581
37611
  if (tail.text) {
37582
- yield { type: "text", text: tail.text };
37612
+ const native = parser2.consumeNativeTags(tail.text);
37613
+ if (native.text) {
37614
+ yield { type: "text", text: native.text };
37615
+ }
37616
+ for (const call of native.toolCalls) {
37617
+ yield { type: "tool_call", toolCall: call };
37618
+ }
37583
37619
  }
37584
37620
  for (const call of tail.toolCalls) {
37585
37621
  yield { type: "tool_call", toolCall: call };
@@ -38192,7 +38228,7 @@ var APP_VERSION, APP_NAME;
38192
38228
  var init_version = __esm({
38193
38229
  "src/version.ts"() {
38194
38230
  "use strict";
38195
- APP_VERSION = "0.1.48";
38231
+ APP_VERSION = "0.1.49";
38196
38232
  APP_NAME = "BraveCode";
38197
38233
  }
38198
38234
  });