bravecode-cli 0.1.48 → 0.1.50

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 = [];
@@ -37565,11 +37589,23 @@ ${instructions}` : instructions;
37565
37589
  if (rawText) {
37566
37590
  const { text: text2, toolCalls } = parser2.push(rawText);
37567
37591
  if (text2) {
37568
- yield { type: "text", text: text2 };
37592
+ const native = parser2.consumeNativeTags(text2);
37593
+ if (native.text) {
37594
+ yield { type: "text", text: native.text };
37595
+ }
37596
+ for (const call of native.toolCalls) {
37597
+ yield { type: "tool_call", toolCall: call };
37598
+ }
37569
37599
  }
37570
37600
  for (const call of toolCalls) {
37571
37601
  yield { type: "tool_call", toolCall: call };
37572
37602
  }
37603
+ } else {
37604
+ const flush = parser2.end();
37605
+ if (flush.text) yield { type: "text", text: flush.text };
37606
+ for (const call of flush.toolCalls) {
37607
+ yield { type: "tool_call", toolCall: call };
37608
+ }
37573
37609
  }
37574
37610
  if (delta && (delta.done || delta.type === "done")) {
37575
37611
  sawDone = true;
@@ -37579,7 +37615,13 @@ ${instructions}` : instructions;
37579
37615
  }
37580
37616
  const tail = parser2.end();
37581
37617
  if (tail.text) {
37582
- yield { type: "text", text: tail.text };
37618
+ const native = parser2.consumeNativeTags(tail.text);
37619
+ if (native.text) {
37620
+ yield { type: "text", text: native.text };
37621
+ }
37622
+ for (const call of native.toolCalls) {
37623
+ yield { type: "tool_call", toolCall: call };
37624
+ }
37583
37625
  }
37584
37626
  for (const call of tail.toolCalls) {
37585
37627
  yield { type: "tool_call", toolCall: call };
@@ -38192,7 +38234,7 @@ var APP_VERSION, APP_NAME;
38192
38234
  var init_version = __esm({
38193
38235
  "src/version.ts"() {
38194
38236
  "use strict";
38195
- APP_VERSION = "0.1.48";
38237
+ APP_VERSION = "0.1.50";
38196
38238
  APP_NAME = "BraveCode";
38197
38239
  }
38198
38240
  });