(xml: string)
| 62 | |
| 63 | // Helper function to check if diagram is minimal/empty |
| 64 | function isMinimalDiagram(xml: string): boolean { |
| 65 | const stripped = xml.replace(/\s/g, "") |
| 66 | return !stripped.includes('id="2"') |
| 67 | } |
| 68 | |
| 69 | // Helper function to replace historical tool call XML with placeholders |
| 70 | // This reduces token usage and forces LLM to rely on the current diagram XML (source of truth) |