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 JSDoc comment above the function\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|/**
 * Greets a person by name.
 * @param name The name of the person to greet.
 */
■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## 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: remove the greet function call at the bottom\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■
◼-5
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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: change version to 2.0.0 in all files\n\n\nOther files for context:\n\nFile: package.json\n{\n  \"name\": \"my-app\",\n  \"version\": \"0.1.0\",\n  \"dependencies\": {\n    \"react\": \"^18.0.0\"\n  }\n}\n\n\nFile: config.json\n001|{\n002|  \"version\": \"1.0.0\",\n003|  \"name\": \"test-app\",\n004|  \"enabled\": true\n005|}\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
◼=2|  "version": "2.0.0",
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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: change version to 2.0.0 in all files\n\n\nOther files for context:\n\nFile: config.json\n{\n  \"version\": \"1.0.0\",\n  \"name\": \"test-app\",\n  \"enabled\": true\n}\n\n\nFile: package.json\n001|{\n002|  \"name\": \"my-app\",\n003|  \"version\": \"0.1.0\",\n004|  \"dependencies\": {\n005|    \"react\": \"^18.0.0\"\n006|  }\n007|}\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■
◼=3|  "version": "2.0.0",
■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## 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 new field \"description\": \"A test application\" after the name field\n\n\nFile: config.json\n001|{\n002|  \"version\": \"1.0.0\",\n003|  \"name\": \"test-app\",\n004|  \"enabled\": true\n005|}\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■
◼>3|  "description": "A test application",
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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: change version to 2.0.0 in all files\n\n\nOther files for context:\n\nFile: config.json\n{\n  \"version\": \"1.0.0\",\n  \"name\": \"test-app\",\n  \"enabled\": true\n}\n\n\nFile: package.json\n001|{\n002|  \"name\": \"my-app\",\n003|  \"version\": \"0.1.0\",\n004|  \"dependencies\": {\n005|    \"react\": \"^18.0.0\"\n006|  }\n007|}\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■
◼=3|  "version": "2.0.0",
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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: change version to 2.0.0 in all files\n\n\nOther files for context:\n\nFile: package.json\n{\n  \"name\": \"my-app\",\n  \"version\": \"0.1.0\",\n  \"dependencies\": {\n    \"react\": \"^18.0.0\"\n  }\n}\n\n\nFile: config.json\n001|{\n002|  \"version\": \"1.0.0\",\n003|  \"name\": \"test-app\",\n004|  \"enabled\": true\n005|}\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■
◼=2|  "version": "2.0.0",
■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## 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 new field \"description\": \"A test application\" after the name field\n\n\nFile: config.json\n001|{\n002|  \"version\": \"1.0.0\",\n003|  \"name\": \"test-app\",\n004|  \"enabled\": true\n005|}\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■
◼>3|  "description": "A test application",
■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## 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: refactor the greet function to accept an optional greeting parameter that defaults to \"Hello\"\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-2|function greet(name: string, greeting: string = "Hello") {
  console.log(greeting + ', ' + name)
}
■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## 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: refactor the greet function to accept an optional greeting parameter that defaults to \"Hello\"\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-2|function greet(name: string, greeting: string = 'Hello') {
  console.log(greeting + ', ' + name)
}
■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## 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: only modify files that use React hooks\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■
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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 comment at the top of each file\n\n\nOther files for context:\n\nFile: src/components/Button.tsx\nexport const Button = () => null\n\n\nFile: src/utils/helper.ts\n001|export const helper = () => {}\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|// This file defines the Button component
◼<001|// Utility helper functions
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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 comment at the top of each file\n\n\nOther files for context:\n\nFile: src/utils/helper.ts\nexport const helper = () => {}\n\n\nFile: src/components/Button.tsx\n001|export const Button = () => null\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|// Button component
##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## 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: only modify files that use React hooks\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■
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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 comment at the top of each file\n\n\nOther files for context:\n\nFile: src/components/Button.tsx\nexport const Button = () => null\n\n\nFile: src/utils/helper.ts\n001|export const helper = () => {}\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|// This file defines the Button component
◼<001|// Utility helper functions
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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 comment at the top of each file\n\n\nOther files for context:\n\nFile: src/utils/helper.ts\nexport const helper = () => {}\n\n\nFile: src/components/Button.tsx\n001|export const Button = () => null\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|// Button component
##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## 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 new section called \"## Installation\"\n\n\nFile: test.md\n001|# Title\n002|\n003|Content with `code` and **bold** and [links](url)\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■
◼>2|## Installation
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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 \"# Header\" at the beginning of each file\n\n\nOther files for context:\n\nFile: file2.txt\nContent A\nContent B\n\n\nFile: file1.txt\n001|Line 1\n002|Line 2\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■
◼<001|# Header
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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 \"# Header\" at the beginning of each file\n\n\nOther files for context:\n\nFile: file1.txt\nLine 1\nLine 2\n\n\nFile: file2.txt\n001|Content A\n002|Content B\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|# Header
◼<1|# Header
■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## 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 new section called \"## Installation\"\n\n\nFile: test.md\n001|# Title\n002|\n003|Content with `code` and **bold** and [links](url)\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■
◼>2|## Installation
■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## 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: replace lines 2 to 4 (const b through const d) with a single line: const sum = 2 + 3 + 4\n\n\nFile: example.ts\n001|const a = 1\n002|const b = 2\n003|const c = 3\n004|const d = 4\n005|const e = 5\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■
◼=2-4|const sum = 2 + 3 + 4
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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 \"# Header\" at the beginning of each file\n\n\nOther files for context:\n\nFile: file1.txt\nLine 1\nLine 2\n\n\nFile: file2.txt\n001|Content A\n002|Content B\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|# Header
◼<1|# Header
■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## 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\n6. **Context files**: Other files are shown for context only. Generate patches ONLY for the main file being edited.\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 \"# Header\" at the beginning of each file\n\n\nOther files for context:\n\nFile: file2.txt\nContent A\nContent B\n\n\nFile: file1.txt\n001|Line 1\n002|Line 2\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■
◼<001|# Header
■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## 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: replace lines 2 to 4 (const b through const d) with a single line: const sum = 2 + 3 + 4\n\n\nFile: example.ts\n001|const a = 1\n002|const b = 2\n003|const c = 3\n004|const d = 4\n005|const e = 5\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■
◼=2-4|const sum = 2 + 3 + 4
■PATCH_END