bravecode-cli 0.1.47 → 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 = [];
@@ -37432,9 +37456,11 @@ var init_provider = __esm({
37432
37456
  Arguments schema: ${params}`;
37433
37457
  });
37434
37458
  return [
37435
- "# Tool Calling",
37459
+ "# Tool Calling \u2014 MANDATORY",
37460
+ "",
37461
+ "To create, read, edit, search, or run anything, you MUST emit a tool call block. Do not describe actions in prose; do not output code blocks in lieu of tool calls. Files are only created/modified when you use a tool.",
37436
37462
  "",
37437
- "You can invoke tools to help complete the task. To invoke a tool, emit a block in exactly this format:",
37463
+ "Emit a block in EXACTLY this format:",
37438
37464
  "",
37439
37465
  "<tool_call>",
37440
37466
  '{"name": "<tool-name>", "arguments": {<json-args>}}',
@@ -37442,9 +37468,14 @@ var init_provider = __esm({
37442
37468
  "",
37443
37469
  "Rules:",
37444
37470
  '- The text inside <tool_call> tags must be valid JSON with a "name" and an "arguments" object.',
37445
- "- You may emit multiple tool call blocks if several tools are needed, then stop and wait.",
37446
- "- Tool results are returned in a later message prefixed with '[Tool result for <tool-name>]'. Never invent results.",
37447
- "- After receiving tool results, continue the task or give the final answer.",
37471
+ "- You may emit multiple <tool_call> blocks if needed, then STOP and wait for results.",
37472
+ "- Tool results arrive in a later user message prefixed with '[Tool result for <tool-name>]'. Never invent results.",
37473
+ "- After receiving results, either call another tool or give a brief final answer.",
37474
+ "",
37475
+ "Example:",
37476
+ "<tool_call>",
37477
+ '{"name": "write", "arguments": {"path": "src/foo.ts", "content": "export const x = 1;\\n"}}',
37478
+ "</tool_call>",
37448
37479
  "",
37449
37480
  "## Available tools",
37450
37481
  ...toolLines
@@ -37563,6 +37594,12 @@ ${instructions}` : instructions;
37563
37594
  for (const call of toolCalls) {
37564
37595
  yield { type: "tool_call", toolCall: call };
37565
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
+ }
37566
37603
  }
37567
37604
  if (delta && (delta.done || delta.type === "done")) {
37568
37605
  sawDone = true;
@@ -37572,7 +37609,13 @@ ${instructions}` : instructions;
37572
37609
  }
37573
37610
  const tail = parser2.end();
37574
37611
  if (tail.text) {
37575
- 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
+ }
37576
37619
  }
37577
37620
  for (const call of tail.toolCalls) {
37578
37621
  yield { type: "tool_call", toolCall: call };
@@ -38185,7 +38228,7 @@ var APP_VERSION, APP_NAME;
38185
38228
  var init_version = __esm({
38186
38229
  "src/version.ts"() {
38187
38230
  "use strict";
38188
- APP_VERSION = "0.1.47";
38231
+ APP_VERSION = "0.1.49";
38189
38232
  APP_NAME = "BraveCode";
38190
38233
  }
38191
38234
  });
@@ -40907,14 +40950,16 @@ var init_agent = __esm({
40907
40950
  name: "Build Agent",
40908
40951
  description: "Full access to tools for development work",
40909
40952
  model: "codestral-latest",
40910
- systemPrompt: `You are BraveCode AI, an expert software engineer. You have access to tools to read, write, edit files, and execute commands.
40953
+ systemPrompt: `You are BraveCode AI, an expert software engineer. You MUST use the provided tools to make file changes \u2014 do NOT narrate or describe actions in prose.
40911
40954
 
40912
40955
  When asked to make changes:
40913
- 1. First understand the codebase by reading relevant files
40914
- 2. Make the necessary changes using edit/write tools
40915
- 3. Verify your changes work by running tests or commands
40956
+ 1. Call the appropriate tool (read, write, edit, bash) \u2014 do not describe what you would do.
40957
+ 2. Verify changes by running tests or commands with the bash tool.
40958
+ 3. After every tool result, continue with the next step or give a brief final answer.
40959
+
40960
+ Important: every file you create or modify must be done via a tool call. Writing code blocks in your response without calling a tool does not create or modify any files.
40916
40961
 
40917
- Be concise and direct. Show code when relevant.`,
40962
+ Be concise. One short sentence between tool calls is fine.`,
40918
40963
  temperature: 0.7,
40919
40964
  maxIterations: 20
40920
40965
  },