Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits). All operations use these ORIGINAL line numbers, which remain valid throughout the patching process.\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')` inserts before line 5\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}` inserts after line 10\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can use multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d` replaces lines 5-8\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12` deletes line 12\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10` deletes lines 5 through 10\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input, not adjusted numbers\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations, no comments or explanations\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n\n### Examples\n\n**Example 1: Simple replacement**\nInput file (lines 001-005):\n```\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n```\n\nTask: Change variable names from x,y to a,b\n\nOutput:\n```\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n```\n\n**Example 2: Adding documentation**\nInput file (lines 001-003):\n```\n001|function add(a, b) {\n002|  return a + b\n003|}\n```\n\nTask: Add JSDoc comment\n\nOutput:\n```\n◼<1|/**\n * Adds two numbers together\n * @param a First number\n * @param b Second number\n * @returns Sum of a and b\n */\n```\n\n**Example 3: Refactoring**\nInput file (lines 001-010):\n```\n001|const user = getUser()\n002|const name = user.name\n003|const email = user.email\n004|const age = user.age\n005|\n006|console.log(name)\n007|console.log(email)\n008|console.log(age)\n009|\n010|return user\n```\n\nTask: Use destructuring\n\nOutput:\n```\n◼=1-4|const { name, email, age } = getUser()\n◼-10\n◼>8|return { name, email, age }\n```\n\n## Your Task\n\nGenerate ONLY the patch operations needed to fulfill the user's instructions. Output patch operations between ■PATCH_START■ and ■PATCH_END■ markers.\n\n**Critical**:\n- Output ONLY patch operations, no explanations\n- Use ORIGINAL line numbers from the input\n- Verify each line number is correct\n- Test your patches mentally to ensure they produce the desired result","role":"system"},{"content":"Instructions: add a complete JSDoc comment block (/** ... */) above the greet function that describes what it does\n\n\nFile: src/hello.ts\n001|function greet(name: string) {\n002|  console.log('Hello, ' + name)\n003|}\n004|\n005|greet('World')\n\n■PATCH_START■","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":["■PATCH_END■"]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
■PATCH_START■
◼<1| */
◼<1| * @param name The name to greet
◼<1| * Greets the provided name
◼<1|/**
■PATCH_END


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: change the greeting message to say \"Hi\" instead of \"Hello\"\n\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|function greet(name: string) {\n002|  console.log('Hello, ' + name)\n003|}\n004|\n005|greet('World')\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="src/hello.ts">
◼=2|  console.log('Hi, ' + name)
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: add a complete JSDoc comment block (/** ... */) above the greet function that describes what it does\n\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|function greet(name: string) {\n002|  console.log('Hello, ' + name)\n003|}\n004|\n005|greet('World')\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="src/hello.ts">
◼=1|/**
 * Greets the provided name.
 */
function greet(name: string) {
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: remove the greet function call at the bottom\n\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|function greet(name: string) {\n002|  console.log('Hello, ' + name)\n003|}\n004|\n005|greet('World')\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="src/hello.ts">
◼-005
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: change version to 2.0.0 in all files\n\n<FILE path=\"config.json\" name=\"config.json\">\n001|{\n002|  \"version\": \"1.0.0\",\n003|  \"name\": \"test-app\",\n004|  \"enabled\": true\n005|}\n</FILE>\n\n<FILE path=\"package.json\" name=\"package.json\">\n001|{\n002|  \"name\": \"my-app\",\n003|  \"version\": \"0.1.0\",\n004|  \"dependencies\": {\n005|    \"react\": \"^18.0.0\"\n006|  }\n007|}\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="config.json">
◼=2|  "version": "2.0.0",
</FILE>

<FILE path="package.json">
◼=3|  "version": "2.0.0",
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: add a new field \"description\": \"A test application\" after the name field\n\n<FILE path=\"config.json\" name=\"config.json\">\n001|{\n002|  \"version\": \"1.0.0\",\n003|  \"name\": \"test-app\",\n004|  \"enabled\": true\n005|}\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="config.json">
◼>003|  "description": "A test application",
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: refactor the greet function to accept an optional greeting parameter that defaults to \"Hello\"\n\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|function greet(name: string) {\n002|  console.log('Hello, ' + name)\n003|}\n004|\n005|greet('World')\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="src/hello.ts">
◼=001|function greet(name: string, greeting: string = "Hello") {
◼=002|  console.log(greeting + ', ' + name)
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: only modify files that use React hooks\n\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|function greet(name: string) {\n002|  console.log('Hello, ' + name)\n003|}\n004|\n005|greet('World')\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: add a comment at the top of each file\n\n<FILE path=\"src/components/Button.tsx\" name=\"Button.tsx\">\n001|export const Button = () => null\n</FILE>\n\n<FILE path=\"src/utils/helper.ts\" name=\"helper.ts\">\n001|export const helper = () => {}\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="src/components/Button.tsx">
◼<001|//
</FILE>

<FILE path="src/utils/helper.ts">
◼<001|//
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: add a new section called \"## Installation\"\n\n<FILE path=\"test.md\" name=\"test.md\">\n001|# Title\n002|\n003|Content with `code` and **bold** and [links](url)\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="test.md">
◼>3|## Installation
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: add \"# Header\" at the beginning of each file\n\n<FILE path=\"file1.txt\" name=\"file1.txt\">\n001|Line 1\n002|Line 2\n</FILE>\n\n<FILE path=\"file2.txt\" name=\"file2.txt\">\n001|Content A\n002|Content B\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="file1.txt">
◼<1|# Header
</FILE>

<FILE path="file2.txt">
◼<1|# Header
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: replace lines 2 to 4 (const b through const d) with a single line: const sum = 2 + 3 + 4\n\n<FILE path=\"example.ts\" name=\"example.ts\">\n001|const a = 1\n002|const b = 2\n003|const c = 3\n004|const d = 4\n005|const e = 5\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="example.ts">
◼=2-4|const sum = 2 + 3 + 4
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: add a new user {\"id\": 3, \"name\": \"Charlie\"} to the users array and update count to 3\n\n<FILE path=\"data.json\" name=\"data.json\">\n001|{\n002|  \"users\": [\n003|    {\"id\": 1, \"name\": \"Alice\"},\n004|    {\"id\": 2, \"name\": \"Bob\"}\n005|  ],\n006|  \"count\": 2\n007|}\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="data.json">
◼=4|    {"id": 2, "name": "Bob"},
◼<5|    {"id": 3, "name": "Charlie"}
◼=6|  "count": 3
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: add a comment \"// Variables\" at the very top\n\n<FILE path=\"large.ts\" name=\"large.ts\">\n001|const var0 = 0\n002|const var1 = 1\n003|const var2 = 2\n004|const var3 = 3\n005|const var4 = 4\n006|const var5 = 5\n007|const var6 = 6\n008|const var7 = 7\n009|const var8 = 8\n010|const var9 = 9\n011|const var10 = 10\n012|const var11 = 11\n013|const var12 = 12\n014|const var13 = 13\n015|const var14 = 14\n016|const var15 = 15\n017|const var16 = 16\n018|const var17 = 17\n019|const var18 = 18\n020|const var19 = 19\n021|const var20 = 20\n022|const var21 = 21\n023|const var22 = 22\n024|const var23 = 23\n025|const var24 = 24\n026|const var25 = 25\n027|const var26 = 26\n028|const var27 = 27\n029|const var28 = 28\n030|const var29 = 29\n031|const var30 = 30\n032|const var31 = 31\n033|const var32 = 32\n034|const var33 = 33\n035|const var34 = 34\n036|const var35 = 35\n037|const var36 = 36\n038|const var37 = 37\n039|const var38 = 38\n040|const var39 = 39\n041|const var40 = 40\n042|const var41 = 41\n043|const var42 = 42\n044|const var43 = 43\n045|const var44 = 44\n046|const var45 = 45\n047|const var46 = 46\n048|const var47 = 47\n049|const var48 = 48\n050|const var49 = 49\n051|const var50 = 50\n052|const var51 = 51\n053|const var52 = 52\n054|const var53 = 53\n055|const var54 = 54\n056|const var55 = 55\n057|const var56 = 56\n058|const var57 = 57\n059|const var58 = 58\n060|const var59 = 59\n061|const var60 = 60\n062|const var61 = 61\n063|const var62 = 62\n064|const var63 = 63\n065|const var64 = 64\n066|const var65 = 65\n067|const var66 = 66\n068|const var67 = 67\n069|const var68 = 68\n070|const var69 = 69\n071|const var70 = 70\n072|const var71 = 71\n073|const var72 = 72\n074|const var73 = 73\n075|const var74 = 74\n076|const var75 = 75\n077|const var76 = 76\n078|const var77 = 77\n079|const var78 = 78\n080|const var79 = 79\n081|const var80 = 80\n082|const var81 = 81\n083|const var82 = 82\n084|const var83 = 83\n085|const var84 = 84\n086|const var85 = 85\n087|const var86 = 86\n088|const var87 = 87\n089|const var88 = 88\n090|const var89 = 89\n091|const var90 = 90\n092|const var91 = 91\n093|const var92 = 92\n094|const var93 = 93\n095|const var94 = 94\n096|const var95 = 95\n097|const var96 = 96\n098|const var97 = 97\n099|const var98 = 98\n100|const var99 = 99\n101|const var100 = 100\n102|const var101 = 101\n103|const var102 = 102\n104|const var103 = 103\n105|const var104 = 104\n106|const var105 = 105\n107|const var106 = 106\n108|const var107 = 107\n109|const var108 = 108\n110|const var109 = 109\n111|const var110 = 110\n112|const var111 = 111\n113|const var112 = 112\n114|const var113 = 113\n115|const var114 = 114\n116|const var115 = 115\n117|const var116 = 116\n118|const var117 = 117\n119|const var118 = 118\n120|const var119 = 119\n121|const var120 = 120\n122|const var121 = 121\n123|const var122 = 122\n124|const var123 = 123\n125|const var124 = 124\n126|const var125 = 125\n127|const var126 = 126\n128|const var127 = 127\n129|const var128 = 128\n130|const var129 = 129\n131|const var130 = 130\n132|const var131 = 131\n133|const var132 = 132\n134|const var133 = 133\n135|const var134 = 134\n136|const var135 = 135\n137|const var136 = 136\n138|const var137 = 137\n139|const var138 = 138\n140|const var139 = 139\n141|const var140 = 140\n142|const var141 = 141\n143|const var142 = 142\n144|const var143 = 143\n145|const var144 = 144\n146|const var145 = 145\n147|const var146 = 146\n148|const var147 = 147\n149|const var148 = 148\n150|const var149 = 149\n151|const var150 = 150\n152|const var151 = 151\n153|const var152 = 152\n154|const var153 = 153\n155|const var154 = 154\n156|const var155 = 155\n157|const var156 = 156\n158|const var157 = 157\n159|const var158 = 158\n160|const var159 = 159\n161|const var160 = 160\n162|const var161 = 161\n163|const var162 = 162\n164|const var163 = 163\n165|const var164 = 164\n166|const var165 = 165\n167|const var166 = 166\n168|const var167 = 167\n169|const var168 = 168\n170|const var169 = 169\n171|const var170 = 170\n172|const var171 = 171\n173|const var172 = 172\n174|const var173 = 173\n175|const var174 = 174\n176|const var175 = 175\n177|const var176 = 176\n178|const var177 = 177\n179|const var178 = 178\n180|const var179 = 179\n181|const var180 = 180\n182|const var181 = 181\n183|const var182 = 182\n184|const var183 = 183\n185|const var184 = 184\n186|const var185 = 185\n187|const var186 = 186\n188|const var187 = 187\n189|const var188 = 188\n190|const var189 = 189\n191|const var190 = 190\n192|const var191 = 191\n193|const var192 = 192\n194|const var193 = 193\n195|const var194 = 194\n196|const var195 = 195\n197|const var196 = 196\n198|const var197 = 197\n199|const var198 = 198\n200|const var199 = 199\n201|const var200 = 200\n202|const var201 = 201\n203|const var202 = 202\n204|const var203 = 203\n205|const var204 = 204\n206|const var205 = 205\n207|const var206 = 206\n208|const var207 = 207\n209|const var208 = 208\n210|const var209 = 209\n211|const var210 = 210\n212|const var211 = 211\n213|const var212 = 212\n214|const var213 = 213\n215|const var214 = 214\n216|const var215 = 215\n217|const var216 = 216\n218|const var217 = 217\n219|const var218 = 218\n220|const var219 = 219\n221|const var220 = 220\n222|const var221 = 221\n223|const var222 = 222\n224|const var223 = 223\n225|const var224 = 224\n226|const var225 = 225\n227|const var226 = 226\n228|const var227 = 227\n229|const var228 = 228\n230|const var229 = 229\n231|const var230 = 230\n232|const var231 = 231\n233|const var232 = 232\n234|const var233 = 233\n235|const var234 = 234\n236|const var235 = 235\n237|const var236 = 236\n238|const var237 = 237\n239|const var238 = 238\n240|const var239 = 239\n241|const var240 = 240\n242|const var241 = 241\n243|const var242 = 242\n244|const var243 = 243\n245|const var244 = 244\n246|const var245 = 245\n247|const var246 = 246\n248|const var247 = 247\n249|const var248 = 248\n250|const var249 = 249\n251|const var250 = 250\n252|const var251 = 251\n253|const var252 = 252\n254|const var253 = 253\n255|const var254 = 254\n256|const var255 = 255\n257|const var256 = 256\n258|const var257 = 257\n259|const var258 = 258\n260|const var259 = 259\n261|const var260 = 260\n262|const var261 = 261\n263|const var262 = 262\n264|const var263 = 263\n265|const var264 = 264\n266|const var265 = 265\n267|const var266 = 266\n268|const var267 = 267\n269|const var268 = 268\n270|const var269 = 269\n271|const var270 = 270\n272|const var271 = 271\n273|const var272 = 272\n274|const var273 = 273\n275|const var274 = 274\n276|const var275 = 275\n277|const var276 = 276\n278|const var277 = 277\n279|const var278 = 278\n280|const var279 = 279\n281|const var280 = 280\n282|const var281 = 281\n283|const var282 = 282\n284|const var283 = 283\n285|const var284 = 284\n286|const var285 = 285\n287|const var286 = 286\n288|const var287 = 287\n289|const var288 = 288\n290|const var289 = 289\n291|const var290 = 290\n292|const var291 = 291\n293|const var292 = 292\n294|const var293 = 293\n295|const var294 = 294\n296|const var295 = 295\n297|const var296 = 296\n298|const var297 = 297\n299|const var298 = 298\n300|const var299 = 299\n301|const var300 = 300\n302|const var301 = 301\n303|const var302 = 302\n304|const var303 = 303\n305|const var304 = 304\n306|const var305 = 305\n307|const var306 = 306\n308|const var307 = 307\n309|const var308 = 308\n310|const var309 = 309\n311|const var310 = 310\n312|const var311 = 311\n313|const var312 = 312\n314|const var313 = 313\n315|const var314 = 314\n316|const var315 = 315\n317|const var316 = 316\n318|const var317 = 317\n319|const var318 = 318\n320|const var319 = 319\n321|const var320 = 320\n322|const var321 = 321\n323|const var322 = 322\n324|const var323 = 323\n325|const var324 = 324\n326|const var325 = 325\n327|const var326 = 326\n328|const var327 = 327\n329|const var328 = 328\n330|const var329 = 329\n331|const var330 = 330\n332|const var331 = 331\n333|const var332 = 332\n334|const var333 = 333\n335|const var334 = 334\n336|const var335 = 335\n337|const var336 = 336\n338|const var337 = 337\n339|const var338 = 338\n340|const var339 = 339\n341|const var340 = 340\n342|const var341 = 341\n343|const var342 = 342\n344|const var343 = 343\n345|const var344 = 344\n346|const var345 = 345\n347|const var346 = 346\n348|const var347 = 347\n349|const var348 = 348\n350|const var349 = 349\n351|const var350 = 350\n352|const var351 = 351\n353|const var352 = 352\n354|const var353 = 353\n355|const var354 = 354\n356|const var355 = 355\n357|const var356 = 356\n358|const var357 = 357\n359|const var358 = 358\n360|const var359 = 359\n361|const var360 = 360\n362|const var361 = 361\n363|const var362 = 362\n364|const var363 = 363\n365|const var364 = 364\n366|const var365 = 365\n367|const var366 = 366\n368|const var367 = 367\n369|const var368 = 368\n370|const var369 = 369\n371|const var370 = 370\n372|const var371 = 371\n373|const var372 = 372\n374|const var373 = 373\n375|const var374 = 374\n376|const var375 = 375\n377|const var376 = 376\n378|const var377 = 377\n379|const var378 = 378\n380|const var379 = 379\n381|const var380 = 380\n382|const var381 = 381\n383|const var382 = 382\n384|const var383 = 383\n385|const var384 = 384\n386|const var385 = 385\n387|const var386 = 386\n388|const var387 = 387\n389|const var388 = 388\n390|const var389 = 389\n391|const var390 = 390\n392|const var391 = 391\n393|const var392 = 392\n394|const var393 = 393\n395|const var394 = 394\n396|const var395 = 395\n397|const var396 = 396\n398|const var397 = 397\n399|const var398 = 398\n400|const var399 = 399\n401|const var400 = 400\n402|const var401 = 401\n403|const var402 = 402\n404|const var403 = 403\n405|const var404 = 404\n406|const var405 = 405\n407|const var406 = 406\n408|const var407 = 407\n409|const var408 = 408\n410|const var409 = 409\n411|const var410 = 410\n412|const var411 = 411\n413|const var412 = 412\n414|const var413 = 413\n415|const var414 = 414\n416|const var415 = 415\n417|const var416 = 416\n418|const var417 = 417\n419|const var418 = 418\n420|const var419 = 419\n421|const var420 = 420\n422|const var421 = 421\n423|const var422 = 422\n424|const var423 = 423\n425|const var424 = 424\n426|const var425 = 425\n427|const var426 = 426\n428|const var427 = 427\n429|const var428 = 428\n430|const var429 = 429\n431|const var430 = 430\n432|const var431 = 431\n433|const var432 = 432\n434|const var433 = 433\n435|const var434 = 434\n436|const var435 = 435\n437|const var436 = 436\n438|const var437 = 437\n439|const var438 = 438\n440|const var439 = 439\n441|const var440 = 440\n442|const var441 = 441\n443|const var442 = 442\n444|const var443 = 443\n445|const var444 = 444\n446|const var445 = 445\n447|const var446 = 446\n448|const var447 = 447\n449|const var448 = 448\n450|const var449 = 449\n451|const var450 = 450\n452|const var451 = 451\n453|const var452 = 452\n454|const var453 = 453\n455|const var454 = 454\n456|const var455 = 455\n457|const var456 = 456\n458|const var457 = 457\n459|const var458 = 458\n460|const var459 = 459\n461|const var460 = 460\n462|const var461 = 461\n463|const var462 = 462\n464|const var463 = 463\n465|const var464 = 464\n466|const var465 = 465\n467|const var466 = 466\n468|const var467 = 467\n469|const var468 = 468\n470|const var469 = 469\n471|const var470 = 470\n472|const var471 = 471\n473|const var472 = 472\n474|const var473 = 473\n475|const var474 = 474\n476|const var475 = 475\n477|const var476 = 476\n478|const var477 = 477\n479|const var478 = 478\n480|const var479 = 479\n481|const var480 = 480\n482|const var481 = 481\n483|const var482 = 482\n484|const var483 = 483\n485|const var484 = 484\n486|const var485 = 485\n487|const var486 = 486\n488|const var487 = 487\n489|const var488 = 488\n490|const var489 = 489\n491|const var490 = 490\n492|const var491 = 491\n493|const var492 = 492\n494|const var493 = 493\n495|const var494 = 494\n496|const var495 = 495\n497|const var496 = 496\n498|const var497 = 497\n499|const var498 = 498\n500|const var499 = 499\n501|const var500 = 500\n502|const var501 = 501\n503|const var502 = 502\n504|const var503 = 503\n505|const var504 = 504\n506|const var505 = 505\n507|const var506 = 506\n508|const var507 = 507\n509|const var508 = 508\n510|const var509 = 509\n511|const var510 = 510\n512|const var511 = 511\n513|const var512 = 512\n514|const var513 = 513\n515|const var514 = 514\n516|const var515 = 515\n517|const var516 = 516\n518|const var517 = 517\n519|const var518 = 518\n520|const var519 = 519\n521|const var520 = 520\n522|const var521 = 521\n523|const var522 = 522\n524|const var523 = 523\n525|const var524 = 524\n526|const var525 = 525\n527|const var526 = 526\n528|const var527 = 527\n529|const var528 = 528\n530|const var529 = 529\n531|const var530 = 530\n532|const var531 = 531\n533|const var532 = 532\n534|const var533 = 533\n535|const var534 = 534\n536|const var535 = 535\n537|const var536 = 536\n538|const var537 = 537\n539|const var538 = 538\n540|const var539 = 539\n541|const var540 = 540\n542|const var541 = 541\n543|const var542 = 542\n544|const var543 = 543\n545|const var544 = 544\n546|const var545 = 545\n547|const var546 = 546\n548|const var547 = 547\n549|const var548 = 548\n550|const var549 = 549\n551|const var550 = 550\n552|const var551 = 551\n553|const var552 = 552\n554|const var553 = 553\n555|const var554 = 554\n556|const var555 = 555\n557|const var556 = 556\n558|const var557 = 557\n559|const var558 = 558\n560|const var559 = 559\n561|const var560 = 560\n562|const var561 = 561\n563|const var562 = 562\n564|const var563 = 563\n565|const var564 = 564\n566|const var565 = 565\n567|const var566 = 566\n568|const var567 = 567\n569|const var568 = 568\n570|const var569 = 569\n571|const var570 = 570\n572|const var571 = 571\n573|const var572 = 572\n574|const var573 = 573\n575|const var574 = 574\n576|const var575 = 575\n577|const var576 = 576\n578|const var577 = 577\n579|const var578 = 578\n580|const var579 = 579\n581|const var580 = 580\n582|const var581 = 581\n583|const var582 = 582\n584|const var583 = 583\n585|const var584 = 584\n586|const var585 = 585\n587|const var586 = 586\n588|const var587 = 587\n589|const var588 = 588\n590|const var589 = 589\n591|const var590 = 590\n592|const var591 = 591\n593|const var592 = 592\n594|const var593 = 593\n595|const var594 = 594\n596|const var595 = 595\n597|const var596 = 596\n598|const var597 = 597\n599|const var598 = 598\n600|const var599 = 599\n601|const var600 = 600\n602|const var601 = 601\n603|const var602 = 602\n604|const var603 = 603\n605|const var604 = 604\n606|const var605 = 605\n607|const var606 = 606\n608|const var607 = 607\n609|const var608 = 608\n610|const var609 = 609\n611|const var610 = 610\n612|const var611 = 611\n613|const var612 = 612\n614|const var613 = 613\n615|const var614 = 614\n616|const var615 = 615\n617|const var616 = 616\n618|const var617 = 617\n619|const var618 = 618\n620|const var619 = 619\n621|const var620 = 620\n622|const var621 = 621\n623|const var622 = 622\n624|const var623 = 623\n625|const var624 = 624\n626|const var625 = 625\n627|const var626 = 626\n628|const var627 = 627\n629|const var628 = 628\n630|const var629 = 629\n631|const var630 = 630\n632|const var631 = 631\n633|const var632 = 632\n634|const var633 = 633\n635|const var634 = 634\n636|const var635 = 635\n637|const var636 = 636\n638|const var637 = 637\n639|const var638 = 638\n640|const var639 = 639\n641|const var640 = 640\n642|const var641 = 641\n643|const var642 = 642\n644|const var643 = 643\n645|const var644 = 644\n646|const var645 = 645\n647|const var646 = 646\n648|const var647 = 647\n649|const var648 = 648\n650|const var649 = 649\n651|const var650 = 650\n652|const var651 = 651\n653|const var652 = 652\n654|const var653 = 653\n655|const var654 = 654\n656|const var655 = 655\n657|const var656 = 656\n658|const var657 = 657\n659|const var658 = 658\n660|const var659 = 659\n661|const var660 = 660\n662|const var661 = 661\n663|const var662 = 662\n664|const var663 = 663\n665|const var664 = 664\n666|const var665 = 665\n667|const var666 = 666\n668|const var667 = 667\n669|const var668 = 668\n670|const var669 = 669\n671|const var670 = 670\n672|const var671 = 671\n673|const var672 = 672\n674|const var673 = 673\n675|const var674 = 674\n676|const var675 = 675\n677|const var676 = 676\n678|const var677 = 677\n679|const var678 = 678\n680|const var679 = 679\n681|const var680 = 680\n682|const var681 = 681\n683|const var682 = 682\n684|const var683 = 683\n685|const var684 = 684\n686|const var685 = 685\n687|const var686 = 686\n688|const var687 = 687\n689|const var688 = 688\n690|const var689 = 689\n691|const var690 = 690\n692|const var691 = 691\n693|const var692 = 692\n694|const var693 = 693\n695|const var694 = 694\n696|const var695 = 695\n697|const var696 = 696\n698|const var697 = 697\n699|const var698 = 698\n700|const var699 = 699\n701|const var700 = 700\n702|const var701 = 701\n703|const var702 = 702\n704|const var703 = 703\n705|const var704 = 704\n706|const var705 = 705\n707|const var706 = 706\n708|const var707 = 707\n709|const var708 = 708\n710|const var709 = 709\n711|const var710 = 710\n712|const var711 = 711\n713|const var712 = 712\n714|const var713 = 713\n715|const var714 = 714\n716|const var715 = 715\n717|const var716 = 716\n718|const var717 = 717\n719|const var718 = 718\n720|const var719 = 719\n721|const var720 = 720\n722|const var721 = 721\n723|const var722 = 722\n724|const var723 = 723\n725|const var724 = 724\n726|const var725 = 725\n727|const var726 = 726\n728|const var727 = 727\n729|const var728 = 728\n730|const var729 = 729\n731|const var730 = 730\n732|const var731 = 731\n733|const var732 = 732\n734|const var733 = 733\n735|const var734 = 734\n736|const var735 = 735\n737|const var736 = 736\n738|const var737 = 737\n739|const var738 = 738\n740|const var739 = 739\n741|const var740 = 740\n742|const var741 = 741\n743|const var742 = 742\n744|const var743 = 743\n745|const var744 = 744\n746|const var745 = 745\n747|const var746 = 746\n748|const var747 = 747\n749|const var748 = 748\n750|const var749 = 749\n751|const var750 = 750\n752|const var751 = 751\n753|const var752 = 752\n754|const var753 = 753\n755|const var754 = 754\n756|const var755 = 755\n757|const var756 = 756\n758|const var757 = 757\n759|const var758 = 758\n760|const var759 = 759\n761|const var760 = 760\n762|const var761 = 761\n763|const var762 = 762\n764|const var763 = 763\n765|const var764 = 764\n766|const var765 = 765\n767|const var766 = 766\n768|const var767 = 767\n769|const var768 = 768\n770|const var769 = 769\n771|const var770 = 770\n772|const var771 = 771\n773|const var772 = 772\n774|const var773 = 773\n775|const var774 = 774\n776|const var775 = 775\n777|const var776 = 776\n778|const var777 = 777\n779|const var778 = 778\n780|const var779 = 779\n781|const var780 = 780\n782|const var781 = 781\n783|const var782 = 782\n784|const var783 = 783\n785|const var784 = 784\n786|const var785 = 785\n787|const var786 = 786\n788|const var787 = 787\n789|const var788 = 788\n790|const var789 = 789\n791|const var790 = 790\n792|const var791 = 791\n793|const var792 = 792\n794|const var793 = 793\n795|const var794 = 794\n796|const var795 = 795\n797|const var796 = 796\n798|const var797 = 797\n799|const var798 = 798\n800|const var799 = 799\n801|const var800 = 800\n802|const var801 = 801\n803|const var802 = 802\n804|const var803 = 803\n805|const var804 = 804\n806|const var805 = 805\n807|const var806 = 806\n808|const var807 = 807\n809|const var808 = 808\n810|const var809 = 809\n811|const var810 = 810\n812|const var811 = 811\n813|const var812 = 812\n814|const var813 = 813\n815|const var814 = 814\n816|const var815 = 815\n817|const var816 = 816\n818|const var817 = 817\n819|const var818 = 818\n820|const var819 = 819\n821|const var820 = 820\n822|const var821 = 821\n823|const var822 = 822\n824|const var823 = 823\n825|const var824 = 824\n826|const var825 = 825\n827|const var826 = 826\n828|const var827 = 827\n829|const var828 = 828\n830|const var829 = 829\n831|const var830 = 830\n832|const var831 = 831\n833|const var832 = 832\n834|const var833 = 833\n835|const var834 = 834\n836|const var835 = 835\n837|const var836 = 836\n838|const var837 = 837\n839|const var838 = 838\n840|const var839 = 839\n841|const var840 = 840\n842|const var841 = 841\n843|const var842 = 842\n844|const var843 = 843\n845|const var844 = 844\n846|const var845 = 845\n847|const var846 = 846\n848|const var847 = 847\n849|const var848 = 848\n850|const var849 = 849\n851|const var850 = 850\n852|const var851 = 851\n853|const var852 = 852\n854|const var853 = 853\n855|const var854 = 854\n856|const var855 = 855\n857|const var856 = 856\n858|const var857 = 857\n859|const var858 = 858\n860|const var859 = 859\n861|const var860 = 860\n862|const var861 = 861\n863|const var862 = 862\n864|const var863 = 863\n865|const var864 = 864\n866|const var865 = 865\n867|const var866 = 866\n868|const var867 = 867\n869|const var868 = 868\n870|const var869 = 869\n871|const var870 = 870\n872|const var871 = 871\n873|const var872 = 872\n874|const var873 = 873\n875|const var874 = 874\n876|const var875 = 875\n877|const var876 = 876\n878|const var877 = 877\n879|const var878 = 878\n880|const var879 = 879\n881|const var880 = 880\n882|const var881 = 881\n883|const var882 = 882\n884|const var883 = 883\n885|const var884 = 884\n886|const var885 = 885\n887|const var886 = 886\n888|const var887 = 887\n889|const var888 = 888\n890|const var889 = 889\n891|const var890 = 890\n892|const var891 = 891\n893|const var892 = 892\n894|const var893 = 893\n895|const var894 = 894\n896|const var895 = 895\n897|const var896 = 896\n898|const var897 = 897\n899|const var898 = 898\n900|const var899 = 899\n901|const var900 = 900\n902|const var901 = 901\n903|const var902 = 902\n904|const var903 = 903\n905|const var904 = 904\n906|const var905 = 905\n907|const var906 = 906\n908|const var907 = 907\n909|const var908 = 908\n910|const var909 = 909\n911|const var910 = 910\n912|const var911 = 911\n913|const var912 = 912\n914|const var913 = 913\n915|const var914 = 914\n916|const var915 = 915\n917|const var916 = 916\n918|const var917 = 917\n919|const var918 = 918\n920|const var919 = 919\n921|const var920 = 920\n922|const var921 = 921\n923|const var922 = 922\n924|const var923 = 923\n925|const var924 = 924\n926|const var925 = 925\n927|const var926 = 926\n928|const var927 = 927\n929|const var928 = 928\n930|const var929 = 929\n931|const var930 = 930\n932|const var931 = 931\n933|const var932 = 932\n934|const var933 = 933\n935|const var934 = 934\n936|const var935 = 935\n937|const var936 = 936\n938|const var937 = 937\n939|const var938 = 938\n940|const var939 = 939\n941|const var940 = 940\n942|const var941 = 941\n943|const var942 = 942\n944|const var943 = 943\n945|const var944 = 944\n946|const var945 = 945\n947|const var946 = 946\n948|const var947 = 947\n949|const var948 = 948\n950|const var949 = 949\n951|const var950 = 950\n952|const var951 = 951\n953|const var952 = 952\n954|const var953 = 953\n955|const var954 = 954\n956|const var955 = 955\n957|const var956 = 956\n958|const var957 = 957\n959|const var958 = 958\n960|const var959 = 959\n961|const var960 = 960\n962|const var961 = 961\n963|const var962 = 962\n964|const var963 = 963\n965|const var964 = 964\n966|const var965 = 965\n967|const var966 = 966\n968|const var967 = 967\n969|const var968 = 968\n970|const var969 = 969\n971|const var970 = 970\n972|const var971 = 971\n973|const var972 = 972\n974|const var973 = 973\n975|const var974 = 974\n976|const var975 = 975\n977|const var976 = 976\n978|const var977 = 977\n979|const var978 = 978\n980|const var979 = 979\n981|const var980 = 980\n982|const var981 = 981\n983|const var982 = 982\n984|const var983 = 983\n985|const var984 = 984\n986|const var985 = 985\n987|const var986 = 986\n988|const var987 = 987\n989|const var988 = 988\n990|const var989 = 989\n991|const var990 = 990\n992|const var991 = 991\n993|const var992 = 992\n994|const var993 = 993\n995|const var994 = 994\n996|const var995 = 995\n997|const var996 = 996\n998|const var997 = 997\n999|const var998 = 998\n1000|const var999 = 999\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="large.ts">
◼<1|// Variables
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: add an email field to the User interface and update the component to display it\n\n<FILE path=\"src/api.ts\" name=\"api.ts\">\n001|export interface User {\n002|  id: number\n003|  name: string\n004|}\n005|\n006|export function getUser(id: number): User {\n007|  return { id, name: 'Unknown' }\n008|}\n</FILE>\n\n<FILE path=\"src/UserComponent.tsx\" name=\"UserComponent.tsx\">\n001|import { getUser } from './api'\n002|\n003|export function UserComponent({ userId }: { userId: number }) {\n004|  const user = getUser(userId)\n005|  return <div>{user.name}</div>\n006|}\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="src/api.ts">
◼>003|  email: string
◼=007|  return { id, name: 'Unknown', email: 'unknown@example.com' }
</FILE>

<FILE path="src/UserComponent.tsx">
◼=005|  return <div>{user.name} ({user.email})</div>
</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: rename the calculateTotal function to computeSum and update all usages\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function calculateTotal(items: number[]): number {\n002|  return items.reduce((sum, item) => sum + item, 0)\n003|}\n</FILE>\n\n<FILE path=\"src/app.ts\" name=\"app.ts\">\n001|import { calculateTotal } from './utils'\n002|\n003|const prices = [10, 20, 30]\n004|const total = calculateTotal(prices)\n005|console.log(total)\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="src/utils.ts">
◼=001|export function computeSum(items: number[]): number {
</FILE>

<FILE path="src/app.ts">
◼=001|import { computeSum } from './utils'
◼=004|const total = computeSum(prices)
</FILE>


Input:
{"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: add TypeScript FC type\n\n<FILE path=\"component.tsx\" name=\"component.tsx\">\n001|export const Component = () =>
Test
\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:zai/patch"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="component.tsx">
◼<1|import React from 'react';
◼=1|export const Component: React.FC = () =>
Test

</FILE>


Input: {"body":{"messages":[{"content":"You are a code patching assistant. Your task is to generate precise line-based patches using the Micropatch protocol.\n\n## Input Format\n\nYou will receive files in this XML format:\n\n```\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n</FILE>\n\n<FILE path=\"src/utils.ts\" name=\"utils.ts\">\n001|export function add(a, b) {\n002|  return a + b\n003|}\n</FILE>\n```\n\nEach file has:\n- **path**: Full file path\n- **name**: File name\n- **Numbered lines**: Format is `NNN|content` where NNN is the ORIGINAL line number (1-based)\n\n## Output Format\n\nGenerate patches for EACH file that needs modification using this EXACT XML format:\n\n```\n<FILE path=\"src/hello.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n</FILE>\n\n<FILE path=\"src/utils.ts\">\n◼<1|/**\n * Adds two numbers\n */\n</FILE>\n```\n\n**CRITICAL RULES**:\n1. Each `<FILE>` tag MUST include the exact `path` attribute from the input\n2. Put patch operations for EACH file inside its own `<FILE>...</FILE>` block\n3. If a file doesn't need changes, omit its `<FILE>` block entirely\n4. DO NOT mix patches from different files\n5. DO NOT include line numbers or any text outside the patch operations\n\n## Micropatch Protocol\n\nThe Micropatch protocol uses line numbers to reference ORIGINAL lines (before any edits).\n\n### Operations\n\nEach operation starts with the marker `◼` at the beginning of a line:\n\n1. **Insert BEFORE line**: `◼<NNN|text`\n   - Inserts `text` as a new line BEFORE original line NNN\n   - Example: `◼<5|console.log('debug')`\n\n2. **Insert AFTER line**: `◼>NNN|text`\n   - Inserts `text` as a new line AFTER original line NNN\n   - Example: `◼>10|}`\n\n3. **Replace single line**: `◼=NNN|new text`\n   - Replaces original line NNN with `new text`\n   - Can span multiple lines (continue until next ◼ or end)\n   - Example:\n     ```\n     ◼=7|function newName() {\n       return 42\n     }\n     ```\n\n4. **Replace range**: `◼=NNN-MMM|replacement`\n   - Replaces lines NNN through MMM with replacement text\n   - Example: `◼=5-8|const combined = a + b + c + d`\n\n5. **Delete single line**: `◼-NNN`\n   - Deletes original line NNN\n   - Example: `◼-12`\n\n6. **Delete range**: `◼-NNN-MMM`\n   - Deletes lines NNN through MMM inclusive\n   - Example: `◼-5-10`\n\n### Escaping\n\n- To include a literal `◼` in your text, use `\\◼`\n- No other escape sequences are recognized\n\n### Important Rules\n\n1. **Use ORIGINAL line numbers**: Always reference the line numbers shown in the input (001, 002, etc.)\n2. **One operation per line**: Each operation must start on a new line with `◼`\n3. **No explanations**: Output ONLY patch operations inside `<FILE>` tags\n4. **Precise operations**: Use the minimal set of operations to achieve the goal\n5. **Verify line numbers**: Double-check that line numbers match the input\n\n## Example\n\n**Input:**\n```\n<FILE path=\"src/math.ts\" name=\"math.ts\">\n001|const x = 1\n002|const y = 2\n003|console.log(x + y)\n004|\n005|export { x, y }\n</FILE>\n```\n\n**Task:** Change variable names from x,y to a,b\n\n**Output:**\n```\n<FILE path=\"src/math.ts\">\n◼=1|const a = 1\n◼=2|const b = 2\n◼=3|console.log(a + b)\n◼=5|export { a, b }\n</FILE>\n```\n\n## Your Task\n\nGenerate ONLY the `<FILE>` blocks with patch operations. Do not include explanations, comments, or any other text.","role":"system"},{"content":"Instructions: change the greeting message to say \"Hi\" instead of \"Hello\"\n\n<FILE path=\"src/hello.ts\" name=\"hello.ts\">\n001|function() {\n002|      function greet(name) {\n003|        console.log(\"Hello, \" + name);\n004|      }\n005|      greet(\"World\");\n006|    }\n</FILE>\n\nGenerate patches for each file that needs modification:","role":"user","type":"text"}],"meta":{"integrationName":"zai","promptCategory":"zai:zai.patch","promptSource":"zai:zai.patch:default"},"model":"fast","signal":{},"stopSequences":[]},"method":"POST","url":"https://api.botpress.cloud/v2/cognitive/generate-text"}

Output:
<FILE path="src/hello.ts">
◼=3|        console.log("Hi, " + name);
</FILE>