mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-12 04:29:51 +08:00
Agents frequently hold .drawio content in memory (another tool's output, a repository read, an API response) and previously had to write it to a temporary file just so load_diagram could read it back. Add a mutually exclusive 'xml' argument that goes through the same parser as the 'path' branch, so both plain XML and draw.io's compressed save format work. Edit-gate semantics by source: - 'path': unchanged — the model has not seen the content, one get_diagram round-trip is still required before editing. - plain 'xml': the model supplied the exact content (same rationale as create_new_diagram), so it is recorded as seen and can be edited immediately. - compressed 'xml': the session stores the decompressed form, which the model cannot derive from the compressed input — the gate is kept. Argument validation (mutual exclusion / presence) fires before the session check so callers get useful errors regardless of session state. parseDrawioFileContent now reports whether any page was decompressed, which drives the gate decision. The diagram-workflow prompt is updated to document the new argument. Co-authored-by: caoxiaole07 <[email protected]>