@senad-d/drawme 0.1.10 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/reference.md CHANGED
@@ -4,11 +4,13 @@
4
4
 
5
5
  DrawMe turns diagram requirements into editable `.drawio` sources and local PNG, SVG, PDF, or JPG exports, including verified standalone animated SVG. The extension provides commands that start guided workflows and tools for CLI detection, Mermaid conversion, XML layout, structural and animation validation, shape lookup, export, explanation, and file opening.
6
6
 
7
- This document lists the extension's public surface: commands, tools, options, defaults, output behavior, and limitations. It is not a workflow guide — the `/drawme` command injects the full authoring workflow itself, and the registered tool descriptions carry the operational rules. Two conventions apply everywhere: the `.drawio` file is the source of truth (exports are derived artifacts), and several tools report failures as a text result (`Export failed`, `Layout failed`, `Mermaid conversion failed`, `Fit canvas failed`, `Explain failed`, `Open failed`) rather than a tool-call error, so results must always be read.
7
+ This document lists the extension's public surface: commands, tools, options, defaults, output behavior, and limitations. It is not a workflow guide — the `/drawme` command injects the full authoring workflow itself, and the registered tool descriptions carry the operational rules. The `.drawio` file is the source of truth; exports are derived artifacts. Relative tool and command paths resolve against the calling Pi session's working directory; absolute paths are used as supplied.
8
+
9
+ Always read the result text. These prefixes indicate failure even if the tool call returns normally: `Export failed:`, `Animate failed:`, `Fit canvas failed:`, `Mermaid conversion failed:`, `Layout failed:`, `Explain failed:`, and `Open failed:`. Validation returns diagnostics and flags incomplete reports separately.
8
10
 
9
11
  ## Functional availability
10
12
 
11
- | Functionality | draw.io CLI required | draw.io 30+ required |
13
+ | Functionality | draw.io CLI required | draw.io 30.2.4 or newer required |
12
14
  | --- | --- | --- |
13
15
  | Write or edit uncompressed `.drawio` XML with normal file tools | No | No |
14
16
  | `drawio_validate` | No | No |
@@ -23,7 +25,9 @@ This document lists the extension's public surface: commands, tools, options, de
23
25
 
24
26
  When the CLI is unavailable, you can still author, edit, validate, explain, and search for shapes. Skip conversion, layout, preview, and final export.
25
27
 
26
- When the CLI is older than version 30, export remains available. Mermaid conversion and ELK layout do not.
28
+ Mermaid conversion and ELK layout require draw.io **30.2.4 or newer**. Explicit `pageIndex` on export or animation requires **32.4.1 or newer**; omitting it leaves page selection to the renderer rather than sending an index. Ordinary exports without an explicit index do not require these feature versions.
29
+
30
+ On WSL, install a native Linux draw.io renderer inside WSL; using the Windows executable from WSL is not supported. On Linux, run Pi as an unprivileged user: DrawMe refuses to run draw.io as root rather than disabling the renderer sandbox. For headless Linux, install `xvfb-run` so discovery and rendering can run without a display.
27
31
 
28
32
  ## Commands
29
33
 
@@ -31,11 +35,13 @@ Commands are user-facing shortcuts. Use the model-callable tools when you need e
31
35
 
32
36
  | Command | Functionality |
33
37
  | --- | --- |
34
- | `/drawme <description>` | Starts the full autonomous workflow: check, plan, author, validate, gated multi-pass visual review (fit/sizing → element placement → connections → holistic confirmation), and final export — no human intervention once started. The command pre-resolves the draw.io CLI and embeds the diagram-types, XML-authoring, style-presets, and (on v30+) Mermaid references into the injected message, so the run starts without tool calls or file reads; only the troubleshooting reference is read on demand. |
35
- | `/drawme-check` | Displays the detected draw.io path and version, or reports that the CLI is unavailable. |
36
- | `/drawme-export <file> [png\|svg\|animated-svg\|pdf\|jpg]` | Performs a final export of an existing `.drawio`; format defaults to PNG. `animated-svg` requires motion and verifies the result. |
38
+ | `/drawme <description>` | Starts the full autonomous workflow: check, plan, author, validate, gated multi-pass visual review (fit/sizing → element placement → connections → holistic confirmation), and final export — no human intervention once started. The command pre-resolves the draw.io CLI and embeds the diagram-types, XML-authoring, style-presets, and (when conversion is supported) Mermaid references into the injected message, so the run starts without tool calls or file reads; only the troubleshooting reference is read on demand. |
39
+ | `/drawme-check` | Displays the detected draw.io path, version, and whether Mermaid import and `--layout` are supported, or explains why the CLI is unavailable. |
40
+ | `/drawme-export <file> [png\|svg\|animated-svg\|pdf\|jpg]` | Performs a final export of an existing `.drawio`; format defaults to PNG. `animated-svg` verifies native connector flow or a portable native page sequence. For stored DrawMe motion, call `drawio_animate` with `input` and omit `steps`. |
41
+
42
+ If Pi is already responding, `/drawme` queues the workflow as a follow-up.
37
43
 
38
- `/drawme-export` intentionally exposes only the source path and format. Use `drawio_export` for output naming, dimensions, border, transparency, embedding, page selection, animation mode, or binary selection. The command uses whitespace-separated arguments and is unsuitable for paths containing spaces.
44
+ `/drawme-export` intentionally exposes only the source path and format. Use `drawio_export` for output naming, dimensions, border, transparency, embedding, page selection, or animation mode. The command uses whitespace-separated arguments and is unsuitable for paths containing spaces.
39
45
 
40
46
  ## Tools
41
47
 
@@ -45,11 +51,7 @@ DrawMe registers ten model-callable tools.
45
51
 
46
52
  Detects the draw.io desktop CLI, its version, and version-gated features.
47
53
 
48
- #### Options
49
-
50
- | Option | Type | Required | Description |
51
- | --- | --- | --- | --- |
52
- | `binary` | string | No | Explicit binary path to test first. Standard platform candidates are tried afterward if it fails. |
54
+ This tool takes no arguments. All tools and commands share the same CLI discovery. To use a custom installation, set `DRAWME_DRAWIO_BINARY` to its absolute executable path in Pi's launch environment. DrawMe tries that path before the usual PATH and installation locations. Tool calls cannot choose an executable.
53
55
 
54
56
  #### Result behavior
55
57
 
@@ -58,9 +60,9 @@ A successful result includes:
58
60
  - `available: true`;
59
61
  - resolved `binary` path or command;
60
62
  - `version` and numeric `major` version;
61
- - `supportsMermaid` and `supportsLayout` flags.
63
+ - `supportsMermaid` and `supportsLayout` flags (both require 30.2.4 or newer).
62
64
 
63
- An unavailable result includes `available: false` and guidance that XML authoring can continue without export.
65
+ An unavailable result includes `available: false` and recovery guidance, rather than claiming feature support. XML authoring can continue without the renderer.
64
66
 
65
67
  #### Use
66
68
 
@@ -68,7 +70,6 @@ Call once at the start of any workflow that may use conversion, layout, preview,
68
70
 
69
71
  ```text
70
72
  drawio_check({})
71
- drawio_check({ "binary": "/custom/path/to/drawio" })
72
73
  ```
73
74
 
74
75
  ---
@@ -84,45 +85,46 @@ Exports an existing `.drawio` through the local draw.io desktop CLI.
84
85
  | `input` | string | Yes | — | Existing `.drawio` source path. |
85
86
  | `format` | `png` \| `svg` \| `pdf` \| `jpg` | No | `png` | Output format. |
86
87
  | `mode` | `preview` \| `final` | No | `final` | Selects inspection or deliverable defaults. |
87
- | `output` | string | No | Derived beside input | Explicit output path. |
88
- | `scale` | number | No | `2` | Scale for final PNG/JPG when `width` is absent. |
89
- | `width` | number | No | Preview: `2000` | Target width in pixels. Overrides `scale`. |
88
+ | `output` | string | No | Derived beside input | Destination file, not a directory. A filename suffix, if supplied, must match the format (case-insensitive; `.jpeg` is accepted for JPG). |
89
+ | `scale` | number | No | `2` | Requested scale for final PNG/JPG when `width` is absent; DrawMe may lower it to meet the pixel budget. |
90
+ | `width` | positive integer | No | See below | Requested width in pixels. Overrides raster scale; SVG padding is added afterward. PDF uses the authored page size. There is no public `height` option. |
90
91
  | `transparent` | boolean | No | `false` | Enables transparency for PNG only. |
91
- | `border` | number | No | `40` | Outer margin around the content in diagram units (so 80px in a scale-2 PNG). draw.io crops exports to the content, so this is the image's only margin; the default matches `drawio_fit_canvas`. Use `0` for no border. |
92
- | `pageIndex` | number | No | draw.io default | Positive, 1-based page number for multi-page files. |
92
+ | `border` | number | No | `40` | Outer margin; see format-specific sizing below. Use `0` for no added border. |
93
+ | `pageIndex` | positive integer | No | draw.io default | One-based page number. Must identify an existing page; explicit selection requires draw.io 32.4.1 or newer. |
93
94
  | `embed` | boolean | No | Mode/format dependent | Controls embedding of editable diagram XML. |
94
95
  | `animated` | boolean | No | `false` | Requires and verifies standalone animation. Valid only for final SVG; when format is omitted, animated mode defaults it to SVG. |
95
- | `binary` | string | No | Auto-detected | Explicit binary path to test first. |
96
96
 
97
97
  #### Mode and naming behavior
98
98
 
99
99
  For an input named `name.drawio`:
100
100
 
101
- | Export | Default output | Raster sizing | Embedded XML |
101
+ | Export | Default output | Default sizing | Default embedded XML |
102
102
  | --- | --- | --- | --- |
103
- | Preview PNG | `name.png` | Width 2000 | No |
104
- | Final PNG | `name.drawio.png` | Scale 2 | Yes |
105
- | Final SVG | `name.svg` | Vector | Yes |
106
- | Verified animated SVG (`animated:true`) | `name.svg` | Vector | Yes |
107
- | Final PDF | `name.pdf` | Vector | Yes |
108
- | Final JPG | `name.jpg` | Scale 2 | No |
103
+ | Preview PNG | `name.preview.png` | At most 2000px on either axis | No |
104
+ | Final PNG | `name.drawio.png` | Scale 2, subject to budget | Yes |
105
+ | Final SVG | `name.svg` | Vector, with added margin | Yes |
106
+ | Verified animated SVG (`animated:true`) | `name.svg` | Vector, with added margin | Yes |
107
+ | Final PDF | `name.pdf` | Authored print page | Yes |
108
+ | Final JPG | `name.jpg` | Scale 2, subject to budget | No |
109
109
 
110
110
  Additional behavior:
111
111
 
112
- - An explicit `output` replaces the derived name.
112
+ - Other preview formats use the same `.preview` suffix before the format extension. If the default preview path is already in use by a file the current preview does not own, choose an explicit `output`. An explicit `output` replaces the derived name, but it must not refer to the editable input, even through a link. DrawMe publishes new bytes only after rendering and verification succeed; a failed export leaves the existing destination intact.
113
113
  - `animated:true` is valid only with `mode:"final"` and SVG. It rejects a static result instead of silently returning an ordinary SVG. Persistent `flowAnimation=1` connector motion is verified after draw.io renders it. Portable page-root visibility/opacity/fade/wait sequences are compiled into CSS inside the SVG and include a `prefers-reduced-motion` fallback that stops motion and reveals sequenced cells.
114
114
  - Standalone page sequences support `opacity`, `show`, `hide`, `toggle`, `fadeIn`, `fadeOut`, `fadeTo`, `wait`, explicit cell/wildcard/exclusion selectors, loop control, and `immediate:true` parallel batches. Viewer-dependent wipe/pop, highlight, dynamic-flow, style, navigation, tag/layer, and link actions are rejected in animated SVG mode.
115
- - The outer margin is even on all sides. draw.io applies its border unevenly for scaled rasters and for SVG, so a final PNG/JPG is sized with `--width` from the page's content width (keeping the requested scale) and an SVG is exported borderless and padded by DrawMe.
116
- - Every SVG (static or animated) is pinned to its authored colors: draw.io's `light-dark()` adaptive colors are resolved to the authored value and the color scheme is fixed to `light`, so the SVG looks the same as the PNG/PDF in every viewer, including dark-mode ones.
117
- - An explicit `width` replaces raster scaling.
118
- - `scale` is ignored in preview mode and for vector formats.
119
- - `transparent` has no effect outside PNG.
120
- - Preview mode defaults to unembedded output suitable for visual inspection. When the current model can view images, a successful PNG preview tool result contains its normal text/metadata block followed by an `image/png` base64 image block; otherwise the image is omitted. The result text always states which case applies, and the output path in the text stays usable either way. A first preview asks for a critique against the current review pass's checklist; a preview that replaces an earlier one instead asks for a before/after comparison with a fixed / not fixed / regressed verdict per addressed finding.
121
- - Final exports stay text-only; final PNG, SVG, and PDF default to embedded/editable output.
122
- - JPG cannot carry editable XML; never set `embed: true` for JPG.
123
- - Embedded PNG exports are checked for draw.io's known truncated IEND chunk and repaired automatically when necessary.
124
- - Every successful preview output is tracked, including explicit `output` paths. After a replacement preview exists, the tool automatically removes the previous preview file for the same source, so only the latest artifact remains. The first successful final export removes that remaining preview. Cleanup failures are returned as warnings without invalidating the new export.
125
- - Headless Linux handling is automatic, including `xvfb-run`, GPU disabling, and the root sandbox flag.
115
+ - **PNG/JPG:** The 6,000,000-pixel (6 megapixel) area budget includes the border. DrawMe may lower the requested scale or constrain explicit sizes while preserving aspect ratio, or refuse a result that cannot fit. An explicit raster `width` includes the border; without it, scaling applies to both the content and its margin in final exports. Raster previews ignore scale and fit within 2000px on **both** axes, including the border.
116
+ - **SVG:** The renderer sizes the borderless content first. The requested `width` is before padding; DrawMe then adds the margin on each side. The final width includes both margins and may reflect renderer rounding. SVGs keep their authored colors in dark-mode viewers.
117
+ - **PDF:** Exports use the authored print-page bounds, not a tight content crop. `width` and `scale` do not resize the print page.
118
+ - `transparent` has no effect outside PNG. Preview mode never embeds editable XML, even with `embed: true`. JPG cannot carry editable XML; a JPG request with `embed: true` fails.
119
+ - Final exports are text-only; final PNG, SVG, and PDF default to embedded/editable output. Only an otherwise valid PNG is eligible for repair of a missing or truncated IEND tail.
120
+
121
+ #### Preview attachments and cleanup
122
+
123
+ A PNG preview attaches an `image/png` block only when the published file is readable, matches the verified export, is unembedded and within the review limit, and the active model explicitly supports images. Text-only and unknown models get no image. A failed read or verification returns `Export failed:` as text, not an attachment claim. Read the result before attempting visual review; `details.imageAttached` says whether an image block is present.
124
+
125
+ Compare before and after only when the result reports a comparable prior attachment of the same source and page still in the model's context. A replaced file or a message in the transcript does not prove that the older image is available to the model. Without a comparable attachment, critique the fresh image against the written findings.
126
+
127
+ A successful preview or final export can retire older previews tracked for the same source, including previews of other pages and explicit preview paths. Tracking is process-local: DrawMe does not reconstruct it after restart. Cleanup leaves edited or replaced files and symlink destinations alone, and reports cleanup failures as warnings without invalidating the new export. Removal of a file does not erase its earlier image attachment from the transcript.
126
128
 
127
129
  #### Use
128
130
 
@@ -154,7 +156,7 @@ drawio_export({
154
156
  })
155
157
  ```
156
158
 
157
- Use a distinct `output` for each format or page. Never present a preview artifact as the final deliverable when a final export was requested. Do not manually delete superseded or final-review previews; the tool replaces and cleans them automatically.
159
+ Use a distinct `output` for each format or page. Never present a preview artifact as the final deliverable when a final export was requested. During review, let the tool manage eligible tracked previews; do not promise that their paths will remain on disk.
158
160
 
159
161
  ---
160
162
 
@@ -170,16 +172,15 @@ Adds motion to an existing `.drawio` page and exports a verified standalone anim
170
172
  | `steps` | array | No | Stored motion | Ordered motion steps (below). Omit to re-export the motion already stored on the page. |
171
173
  | `loop` | boolean | No | `true` | Repeat the sequence. |
172
174
  | `hold` | number | No | `1600` | Pause in ms on the final state before a loop restarts. |
173
- | `pageIndex` | number | No | `1` | Positive, 1-based page to animate. |
174
- | `output` | string | No | `name.animated.svg` | Animated SVG path. |
175
- | `storyboard` | boolean | No | `true` | Render `name.storyboard.png`. |
176
- | `binary` | string | No | Auto-detected | Explicit binary path to test first. |
175
+ | `pageIndex` | positive integer | No | `1` | One-based page to animate. Passing it explicitly requires draw.io 32.4.1 or newer. |
176
+ | `output` | string | No | `name.animated.svg` | Animated SVG file. Use distinct outputs to retain the SVGs for multiple pages. |
177
+ | `storyboard` | boolean | No | `true` | Render a persistent storyboard PNG; see naming below. |
177
178
 
178
179
  Each step has an `effect` and, except for `wait`, a `cells` array of vertex or edge ids. Optional fields: `duration` (ms; required for `wait`), `stagger` (ms between consecutive cells), `parallel` (start with the previous step), `direction` (`slideIn`: `up`, `down`, `left`, `right`), `color` (hex, for `highlight` and `travel`), and `value` (`dim` opacity, default 0.25).
179
180
 
180
181
  | Effect | Targets | Default duration | Result |
181
182
  | --- | --- | --- | --- |
182
- | `fadeIn` / `fadeOut` | any cell | 600 / 500 ms | Fade to visible / hidden |
183
+ | `fadeIn` / `fadeOut` | any cell | 600 / 500 ms | Fade to fully visible / hidden; `fadeIn` also works on a dimmed visible cell |
183
184
  | `dim` | any cell | 500 ms | Fade to `value` |
184
185
  | `popIn` | hidden cell | 550 ms | Scale up from 60% with overshoot while fading in |
185
186
  | `slideIn` | hidden cell | 650 ms | Move 32px in `direction` while fading in |
@@ -190,11 +191,14 @@ Each step has an `effect` and, except for `wait`, a `cells` array of vertex or e
190
191
 
191
192
  #### Behavior
192
193
 
193
- - A cell whose first effect is an entrance (`fadeIn`, `popIn`, `slideIn`, `drawIn`) starts hidden; all other cells start visible. Entrances on visible cells, emphasis on hidden cells, a cell targeted twice in one parallel group, `drawIn` on dashed or `flowAnimation=1` connectors, and missing or wrong-kind ids are rejected before anything is written.
194
+ - Use at most 200 steps. `hold`, `stagger`, and wait duration accept 0–60,000 ms inclusive. Visual effect duration must be greater than 0 and at most 60,000 ms (0.5 ms is valid; 0 ms is not). The timeline may be at most 300,000 ms before the final hold.
195
+ - A cell whose first effect is an entrance (`fadeIn`, `popIn`, `slideIn`, `drawIn`) starts hidden; other cells start in their authored state. A dimmed visible cell can `fadeIn` to full opacity, but a fully visible cell cannot enter again. Emphasis on a cell hidden by itself or an ancestor, a cell targeted twice in one parallel group, `drawIn` on dashed or `flowAnimation=1` connectors, and missing or wrong-kind ids are rejected before anything is written. A sequence with no effective visual motion is rejected.
194
196
  - Valid steps are stored as JSON in the `drawmeMotion` attribute of the page root cell (wrapping `<mxCell id="0"/>` in a `UserObject` when needed). This is a source edit; `drawio_validate` checks stored motion and reports a page that also has an enabled native page animation.
195
- - The page is exported to an embedded SVG, then group opacity, transform, and glow become CSS keyframes, connector draw-in uses `pathLength` and `stroke-dashoffset`, and travelling dots use SMIL `animateMotion` along the rendered connector path. A `prefers-reduced-motion` rule shows the final state and hides dots. Persistent connector flow is preserved. A missing cell group or connector path fails the call and removes the output.
197
+ - The page is exported to an embedded SVG, then group opacity, transform, and glow become CSS keyframes, connector draw-in uses `pathLength` and `stroke-dashoffset`, and travelling dots use SMIL `animateMotion` along the rendered connector path. A `prefers-reduced-motion` rule shows the final state and hides dots. Persistent connector flow is preserved. A missing cell group or connector path fails before publication, leaving any previous SVG and preview intact.
196
198
  - `highlight` and `travel` default to the theme accent: `#60a5fa` on a dark page `background`, `#2563eb` otherwise.
197
- - The storyboard is one PNG with a captioned frame per sequential step (at most 12, sampled evenly) showing the end state of that step; highlight and travel steps show their accent on the stroke. It proves order and visibility, not easing. When the current model can view images, the storyboard is attached to the result.
199
+ - The storyboard shows captioned end states of visual batches. Parallel steps share one frame; a wait-only batch consumes time without adding a frame. DrawMe samples at most 12 frames evenly across the visual batches, keeping the first and last. Use it to check order and visibility, not easing or playback.
200
+ - Page 1 exported to the default `name.animated.svg` uses `name.storyboard.png`. Otherwise, DrawMe appends `.page-<index>.frames.png` to the full SVG output path (for example, `story.v2.svg.page-2.frames.png`).
201
+ - The storyboard is a persistent, unembedded final PNG. If either side exceeds 2000px, the valid file stays on disk and the tool reports its path without attaching it. Otherwise an image is attached only if the published PNG passes the same checks as a [preview attachment](#preview-attachments-and-cleanup) and the model supports images. A failed read or verification returns `Animate failed:` without claiming an attachment.
198
202
  - The motion plays in browsers and in SVGs embedded as images. draw.io itself does not play it.
199
203
 
200
204
  #### Use
@@ -256,7 +260,7 @@ Actionable warnings include:
256
260
 
257
261
  Informational observations identify checks intentionally skipped for infinite canvases or omitted/invalid page dimensions. They also identify auto-routed edges whose direct connection line pierces an unrelated shape so the rendered route can receive focused preview review. All normal-page diagnostics are page-specific. Content bounds account for nested container offsets, visible nodes/containers, explicit waypoints, and separately sized edge labels on resolvable explicit routes where practical.
258
262
 
259
- The result text and details also include a readability score:
263
+ A complete report includes a readability score in the result text and details:
260
264
 
261
265
  - route through vertex: 20 points;
262
266
  - edge crossing: 10 points;
@@ -269,6 +273,8 @@ Lower is better, but scores are meaningful only when comparing layout variants o
269
273
 
270
274
  Fix every error and rerun validation. Fix each warning or record an explicit reviewed-and-acceptable reason before final export. Informational observations do not require correction.
271
275
 
276
+ `Validation incomplete` (`complete: false` in details) is not a clean result, even if few findings were reported. Resolve the read or parse problem or address the reported limit (for example, split a large diagram), then validate again.
277
+
272
278
  ```text
273
279
  drawio_validate({ "input": "architecture.drawio" })
274
280
  ```
@@ -311,7 +317,7 @@ drawio_fit_canvas({ "input": "architecture.drawio", "margin": 60 })
311
317
 
312
318
  ### `drawio_from_mermaid`
313
319
 
314
- Converts Mermaid into an automatically laid-out, editable native `.drawio`. Requires draw.io 30 or newer.
320
+ Converts Mermaid into an automatically laid-out, editable native `.drawio`. Requires draw.io 30.2.4 or newer.
315
321
 
316
322
  #### Options
317
323
 
@@ -320,14 +326,13 @@ Converts Mermaid into an automatically laid-out, editable native `.drawio`. Requ
320
326
  | `mermaid` | string | One of `mermaid`/`input` | — | Inline Mermaid text. A temporary `.mmd` is removed after conversion. |
321
327
  | `input` | string | One of `mermaid`/`input` | — | Existing `.mmd` source path. |
322
328
  | `output` | string | No | See below | Destination `.drawio` path. |
323
- | `binary` | string | No | Auto-detected | Explicit binary path to test first. |
324
329
 
325
330
  Output defaults:
326
331
 
327
332
  - file input: same directory and stem with `.drawio`;
328
- - inline Mermaid: `diagram.drawio` in the current working directory.
333
+ - inline Mermaid: `diagram.drawio` in the Pi session's working directory.
329
334
 
330
- Provide exactly one of `mermaid` or `input`. Normally provide `output` explicitly to avoid ambiguous names or accidental replacement.
335
+ Provide exactly one nonblank source: `mermaid` or `input`. Supplying neither or both is a pre-conversion error. Normally provide `output` explicitly to avoid ambiguous names or accidental replacement.
331
336
 
332
337
  #### Best use
333
338
 
@@ -352,13 +357,13 @@ drawio_from_mermaid({
352
357
  })
353
358
  ```
354
359
 
355
- The converted file is a normal `.drawio` source: it can be validated, previewed, and exported like any other.
360
+ The converted `.drawio` has a finite canvas. Fit it to the content with `drawio_fit_canvas`, then validate, preview, and export it like any other source.
356
361
 
357
362
  ---
358
363
 
359
364
  ### `drawio_layout`
360
365
 
361
- Repositions nodes and routes edges in an XML-authored `.drawio` using a safe ELK preset. Requires draw.io 30 or newer.
366
+ Repositions nodes and routes edges on the first page of an XML-authored `.drawio` using a safe ELK preset. It preserves the authored page display settings and leaves other pages unchanged. Requires draw.io 30.2.4 or newer.
362
367
 
363
368
  #### Options
364
369
 
@@ -367,7 +372,6 @@ Repositions nodes and routes edges in an XML-authored `.drawio` using a safe ELK
367
372
  | `input` | string | Yes | — | Existing `.drawio` source. |
368
373
  | `preset` | layout preset | Yes | — | One of the six allowlisted values below. |
369
374
  | `output` | string | No | `<name>.layout.drawio` | Destination path beside the input. May equal `input` for intentional in-place layout. |
370
- | `binary` | string | No | Auto-detected | Explicit binary path to test first. |
371
375
 
372
376
  #### Presets
373
377
 
@@ -403,7 +407,7 @@ Searches a bundled local index of more than 10,000 official draw.io shapes.
403
407
  | Option | Type | Required | Default | Description |
404
408
  | --- | --- | --- | --- | --- |
405
409
  | `query` | string | Yes | — | Shape keywords such as `aws lambda`, `uml actor`, `bpmn timer event`, or `k8s pod`. |
406
- | `limit` | number | No | `10` | Maximum number of ranked results. |
410
+ | `limit` | nonnegative integer | No | `10` | Maximum number of ranked results; `0` returns none. |
407
411
 
408
412
  Each result contains:
409
413
 
@@ -434,7 +438,7 @@ The result:
434
438
 
435
439
  - lists leaf components;
436
440
  - groups components by named container;
437
- - lists relations between labeled endpoints;
441
+ - lists relations between existing endpoints, using an ID fallback for unlabeled endpoints;
438
442
  - uses edge labels as relation verbs;
439
443
  - produces a separate section for each page.
440
444
 
@@ -452,21 +456,21 @@ Explanation is a structural summary, not a validator and not a visual renderer.
452
456
 
453
457
  ### `drawio_open`
454
458
 
455
- Opens a local `.drawio` source or exported file with the operating system's default application.
459
+ Opens a local diagram or export with the operating system's default application.
456
460
 
457
461
  #### Options
458
462
 
459
463
  | Option | Type | Required | Description |
460
464
  | --- | --- | --- | --- |
461
- | `path` | string | Yes | Existing local file to open. |
465
+ | `path` | string | Yes | File to open. The resolved target must be a regular file with a `.drawio`, `.png`, `.svg`, `.pdf`, `.jpg`, or `.jpeg` extension (case-insensitive). |
462
466
 
463
467
  Platform behavior:
464
468
 
465
469
  - macOS: `open`;
466
- - Windows: `start`;
470
+ - Windows: the system file-association helper, without `cmd.exe`;
467
471
  - Linux: `xdg-open`.
468
472
 
469
- Use it when the user requests desktop review or accepts an offer to fine-tune the source manually. Opening an application is a user-visible side effect.
473
+ Use it when the user requests desktop review or accepts an offer to fine-tune the source manually. Opening a document is a user-visible side effect.
470
474
 
471
475
  ```text
472
476
  drawio_open({ "path": "architecture.drawio" })
@@ -476,14 +480,14 @@ drawio_open({ "path": "architecture.drawio" })
476
480
 
477
481
  | Requirement | Recommended path |
478
482
  | --- | --- |
479
- | Standard diagram with no custom styling and CLI 30+ | Mermaid → `drawio_from_mermaid`. |
483
+ | Standard diagram with no custom styling and Mermaid support | Mermaid → `drawio_from_mermaid`. |
480
484
  | Vendor icons, exact UML/BPMN notation, custom styling, swimlanes, containers, precise routing, or multi-page output | Hand-authored uncompressed XML plus `drawio_shapesearch`. |
481
- | Large hand-authored graph and CLI 30+ | Rough XML → `drawio_layout`. |
482
- | CLI unavailable or older than 30 | Hand-authored XML; validation and shape search remain available. |
485
+ | Large hand-authored graph and layout support | Rough XML → `drawio_layout`. |
486
+ | CLI unavailable or missing conversion/layout support | Hand-authored XML; validation and shape search remain available. |
483
487
  | Existing diagram must be understood | `drawio_explain`, then inspect the source XML. |
484
488
  | Existing diagram only needs validation | `drawio_validate`; no CLI check is necessary. |
485
489
  | Existing diagram only needs export | `drawio_check` → `drawio_export`; do not rebuild it. |
486
- | Diagram needs continuous or timed motion | Hand-authored XML with connector flow/page animation metadata → validate → static PNG review → `drawio_export` with `animated:true`. |
490
+ | Diagram needs continuous or timed motion | Validate and review a static PNG. Use `drawio_animate` for typed DrawMe motion or `drawio_export` with `animated:true` for native connector flow or a portable native page sequence. |
487
491
 
488
492
  DrawMe does not expose a single natural-language-to-file tool. Author or edit Mermaid/XML with normal file tools, then use DrawMe for conversion, layout, validation, rendering, explanation, or opening.
489
493
 
@@ -491,22 +495,21 @@ DrawMe does not expose a single natural-language-to-file tool. Author or edit Me
491
495
 
492
496
  - `.drawio` is always the canonical editable source.
493
497
  - Final PNG, SVG, and PDF embed XML by default and can be reopened in draw.io where supported.
494
- - Verified animated SVG is standalone: it uses SVG/CSS motion rather than draw.io's network-loaded HTML viewer. Connector flow is rendered by draw.io; portable page sequences are compiled after export. A static PNG fallback is recommended for reduced-motion users and consumers that sanitize SVG animation.
498
+ - Verified animated SVG uses SVG/CSS motion rather than draw.io's network-loaded HTML viewer. Connector flow is rendered by draw.io; portable page sequences are compiled after export. If verification reports an unresolved local image dependency, re-embed the image in draw.io and export again. A static PNG fallback is recommended for viewers that sanitize SVG animation.
495
499
  - JPG cannot embed XML.
496
- - Preview PNG is intentionally clean and unembedded for visual inspection. Its successful tool result includes the image when the current model can view images, and the text always states whether it was attached and reports the output path. Each successful replacement removes the prior same-source preview file, and final export removes the latest remaining preview.
500
+ - Preview PNG is intentionally unembedded. See [Preview attachments and cleanup](#preview-attachments-and-cleanup) for when its image is attached or its file is retired.
497
501
  - A final embedded PNG normally uses the `.drawio.png` double extension.
498
502
  - Multi-page exports should use `pageIndex` and explicit unique output names.
499
503
  - `drawio_explain` returns Markdown as text; it does not write a documentation file.
500
504
  - `drawio_layout` creates a sibling `.layout.drawio` unless `output` is supplied.
501
- - Inline Mermaid conversion creates `diagram.drawio` in the working directory unless `output` is supplied.
505
+ - Inline Mermaid conversion creates `diagram.drawio` in the Pi session's working directory unless `output` is supplied.
502
506
 
503
507
  ## Functional limitations
504
508
 
505
509
  - Validation cannot inspect compressed pages.
506
510
  - Explanation cannot describe compressed pages.
507
511
  - Deterministic validation cannot replace visual inspection; rendered clipping, wrapping, contrast, and automatic routes can only be judged from the preview image. When the current model cannot view images, these remain unverified and must be reported as such.
508
- - Removing a superseded preview file does not rewrite Pi session history: image blocks already stored in earlier tool-result messages can remain visible in the transcript even though only the latest preview file remains on disk.
509
- - Route-through and crossing analysis is limited to edges with explicit waypoints; dense auto-routed graphs can validate without connector-route warnings.
512
+ - Deterministic route-through and crossing checks apply to explicit waypoint routes. An unchecked auto-route warning means validation could not inspect the rendered route, not that it found a crossing. A direct-path obstruction observation is a hint for preview review, not proof of the rendered route.
510
513
  - Shape search covers bundled official draw.io shapes, not arbitrary third-party logos.
511
514
  - Mermaid conversion cannot express all draw.io styles, containers, routing, or multi-page behavior.
512
515
  - ELK layout accepts only the six registered presets; arbitrary JSON layouts are not exposed.
@@ -514,7 +517,6 @@ DrawMe does not expose a single natural-language-to-file tool. Author or edit Me
514
517
  - SVG hosts may sanitize styles or display only a static frame; retain the `.drawio` source and provide a PNG fallback when compatibility matters.
515
518
  - Animation preview is structural: the attached review PNG is static. Final animated export verifies generated animation markup but does not attach temporal playback to the model for visual review.
516
519
  - The extension does not expose GIF/video rendering, HTML viewers, XML compression/decompression, Python generators, or arbitrary draw.io CLI arguments.
517
- - A failed operation may be returned as text beginning with `Export failed`, `Layout failed`, `Mermaid conversion failed`, `Explain failed`, or `Open failed`. Treat that result as failure.
518
520
 
519
521
  ## Authoring references
520
522
 
@@ -1,10 +1,12 @@
1
1
  # Visual Review and Fixing Implementation Tasks
2
2
 
3
- ## Goal
3
+ > **Historical checklist — not current operating instructions.** This records an earlier design, including its obsolete two-round review and human approval gate. The current `/drawme` workflow allows up to eight correction retries and does not pause for approval. See the [current extension reference](reference.md#commands) and the [workflow in the README](../README.md#the-drawme-workflow).
4
+
5
+ ## Original goal
4
6
 
5
7
  Make DrawMe's automatic review loop reliably catch and correct canvas, layout, typography, element-overlap, and connector problems before asking for user approval or creating final exports.
6
8
 
7
- ## Current gaps
9
+ ## Gaps at the time
8
10
 
9
11
  - `/drawme` injects guidance for the model; it is not an enforced workflow or state machine.
10
12
  - The current self-check asks the model to inspect every visual concern at once and caps automatic review at two rounds.
package/example/README.md CHANGED
@@ -4,21 +4,21 @@ The `.drawio` files are the editable sources of truth. Each has a final `.drawio
4
4
 
5
5
  | Diagram | What it demonstrates |
6
6
  | --- | --- |
7
- | [User flow](drawme-how-it-works.drawio.png) · [source](drawme-how-it-works.drawio) | **Multi-color:** numbered stages, native input/document shapes, blue authoring, purple quality, green delivery, a three-role legend, and explicit CLI/text-only fallbacks. |
8
- | [Installation](drawme-installation-guide.drawio.png) · [source](drawme-installation-guide.drawio) | **Light:** three columns separate preparation, package scope, and first use; monospace commands distinguish terminal actions from commands inside Pi. |
9
- | [Architecture](drawme-architecture.drawio.png) · [source](drawme-architecture.drawio) | All ten tools, pure-TypeScript checks versus desktop CLI operations, optional OS opening, and local rendering versus model-provider access. Replaces the obsolete waterfall overview. |
10
- | [Validation decision tree](drawme-validation-decision-tree.drawio.png) · [source](drawme-validation-decision-tree.drawio) | Error/warning gates, attachment-aware review, correction of the current pass, eight-retry limit, explicit exceptions, and preview cleanup. |
11
- | [Animated order fulfillment](event-driven-orders.animated.svg) · [source](event-driven-orders.drawio) · [PNG fallback](event-driven-orders.drawio.png) · [storyboard](event-driven-orders.storyboard.png) | **Dark:** 13 official AWS4 components in four zones, transactional outbox, SNS/SQS fan-out, idempotent Lambda consumers, queue-level redrive, and staged motion in a 12.56-second loop. |
12
- | [Git graph](git-graph-example.drawio.png) · [source](git-graph-example.drawio) | Retained classic multi-color branching/merge example. Its commit IDs and version labels are illustrative, not this repository's current history. |
7
+ | [User flow](https://github.com/senad-d/DrawMe/blob/main/example/drawme-how-it-works.drawio.png) · [source](drawme-how-it-works.drawio) | **Multi-color:** numbered stages, native input/document shapes, blue authoring, purple quality, green delivery, a three-role legend, and explicit CLI/text-only fallbacks. |
8
+ | [Installation](https://github.com/senad-d/DrawMe/blob/main/example/drawme-installation-guide.drawio.png) · [source](drawme-installation-guide.drawio) | **Light:** three columns separate preparation, package scope, and first use; monospace commands distinguish terminal actions from commands inside Pi. |
9
+ | [Architecture](https://github.com/senad-d/DrawMe/blob/main/example/drawme-architecture.drawio.png) · [source](drawme-architecture.drawio) | All ten tools, pure-TypeScript checks versus desktop CLI operations, optional OS opening, and local rendering versus model-provider access. Replaces the obsolete waterfall overview. |
10
+ | [Validation decision tree](https://github.com/senad-d/DrawMe/blob/main/example/drawme-validation-decision-tree.drawio.png) · [source](drawme-validation-decision-tree.drawio) | Error/warning gates, attachment-aware review, correction of the current pass, eight-retry limit, explicit exceptions, and preview cleanup. |
11
+ | [Animated order fulfillment](https://github.com/senad-d/DrawMe/blob/main/example/event-driven-orders.animated.svg) · [source](event-driven-orders.drawio) · [PNG fallback](https://github.com/senad-d/DrawMe/blob/main/example/event-driven-orders.drawio.png) · [storyboard](https://github.com/senad-d/DrawMe/blob/main/example/event-driven-orders.storyboard.png) | **Dark:** 13 official AWS4 components in four zones, transactional outbox, SNS/SQS fan-out, idempotent Lambda consumers, queue-level redrive, and staged motion in a 12.56-second loop. |
12
+ | [Git graph](https://github.com/senad-d/DrawMe/blob/main/example/git-graph-example.drawio.png) · [source](git-graph-example.drawio) | Retained classic multi-color branching/merge example. Its commit IDs and version labels are illustrative, not this repository's current history. |
13
13
 
14
14
  The showcase follows the **Light**, **Dark**, and **Multi-color** presets in [`style-presets.md`](../assets/references/style-presets.md). Installation, extension architecture, and the detailed validation reference stay Light. User-flow colors encode roles, not arbitrary decoration; the cloud example uses the Dark accent for its main path and motion. The Git graph intentionally keeps its classic palette.
15
15
 
16
16
  ## Correctness and scope
17
17
 
18
18
  - Installation commands follow the version-matched Pi package/CLI documentation. Personal settings default to `~/.pi/agent/settings.json`; project settings require trust. `pi -e` starts a single invocation without changing settings, unlike persistent installation followed by `pi` or `/reload`.
19
- - `/drawme-check` reports the detected CLI path and version. Mermaid conversion and ELK layout require draw.io v30+; ordinary rendering and export do not.
19
+ - `/drawme-check` reports the detected CLI path and version and whether Mermaid import and `--layout` are supported, or explains why the renderer is unavailable. Mermaid conversion and ELK layout require draw.io 30.2.4 or newer; ordinary exports without an explicit page index do not.
20
20
  - User/review flows are checked against [`src/index.ts`](../src/index.ts) and [`src/workflow.ts`](../src/workflow.ts). The correction cap is eight retries across the run, not eight per pass; inspection previews do not consume retries. A new pass starts only after the current pass is cleared, except for inspection-only completion after the limit.
21
- - No CLI means XML authoring and structural validation only. No attached image means structural/semantic review, with rendered inspection explicitly unverified. A successful final export removes the latest preview in either vision mode.
21
+ - No CLI means XML authoring and structural validation only. No attached image means structural/semantic review, with rendered inspection explicitly unverified. A successful final export may retire tracked same-source previews even in text-only mode; [preview attachments and files have separate lifetimes](../docs/reference.md#preview-attachments-and-cleanup).
22
22
  - PNG, SVG and PDF embed editable XML by default; JPG cannot. Motion is stored on the `.drawio` page and verified in the standalone SVG. draw.io Desktop shows the static geometry, not DrawMe motion playback.
23
23
  - The order architecture is an illustrative AWS design, not a deployment template. API Gateway invokes the Orders Lambda; a DynamoDB transaction commits order + outbox together. A stream-triggered publisher filters outbox records and publishes to an SNS standard topic. Separate SQS standard queues buffer both Lambda consumers. SNS/SQS delivery is at least once, requiring idempotency. The fulfillment queue's `maxReceiveCount` redrive policy sends repeatedly failed messages to its DLQ; the Lambda does not write directly to the DLQ. Notification retry/DLQ policy, authentication, IAM, telemetry, and deployment details are deliberately outside this example.
24
24
 
@@ -31,7 +31,7 @@ Use the DrawMe tools from Pi, rather than invoking the desktop CLI directly:
31
31
  3. After layout changes, run `drawio_fit_canvas`, then validate again. Grow the canvas rather than shrinking the content.
32
32
  4. Export a `mode: "preview"` PNG and review label fit, placement, connectors, and semantics. Validate and re-preview any correction.
33
33
  5. For the order example, `drawio_animate({ "input": "example/event-driven-orders.drawio" })` reuses the stored steps, regenerates the animated SVG/storyboard, and verifies motion. Validate the source afterward and inspect the storyboard's order/visibility; it does not prove easing or dot movement.
34
- 6. Export the final PNG with `drawio_export({ "input": "example/<name>.drawio", "mode": "final", "format": "png" })`. This embeds XML and removes the review preview. Keep the PNG fallback beside the animated SVG.
34
+ 6. Export the final PNG with `drawio_export({ "input": "example/<name>.drawio", "mode": "final", "format": "png" })`. Use this for the installation guide, how-it-works, and architecture companion PNGs after editing their `.drawio` sources. Check the legibility of each new render and reopen it in draw.io to confirm the embedded source. Keep the PNG fallback beside the animated SVG.
35
35
  7. Run `npm run validate`. The tests discover every example source and require zero structural warnings; additional checks cover installation, user-flow relationships, and stored animation versus the exported SVG.
36
36
 
37
37
  Rendered files are checked into Git for documentation. The npm package includes editable `.drawio` sources; README images are hosted from the repository.
@@ -23,16 +23,16 @@
23
23
  <mxCell id="open" value="&lt;b&gt;OS file handler&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:18px&quot;&gt;open • optional desktop fine-tuning&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;whiteSpace=wrap;html=1;fontFamily=Helvetica;fontSize=20;spacing=16;strokeWidth=1.5;fillColor=#FFFFFF;strokeColor=#CBD5E1;fontColor=#0F172A;fillColor=#F8FAFC;strokeColor=#CBD5E1;fontColor=#475569;" vertex="1" parent="tools">
24
24
  <mxGeometry x="30" y="270" width="370" height="100" as="geometry"/>
25
25
  </mxCell>
26
- <mxCell id="bridge" value="&lt;b&gt;Desktop CLI adapter&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:18px&quot;&gt;check · export · animate&lt;br&gt;Mermaid import · ELK layout&lt;br&gt;Import + layout require v30+&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;whiteSpace=wrap;html=1;fontFamily=Helvetica;fontSize=20;spacing=16;strokeWidth=1.5;fillColor=#FFFFFF;strokeColor=#CBD5E1;fontColor=#0F172A;" vertex="1" parent="tools">
26
+ <mxCell id="bridge" value="&lt;b&gt;Desktop CLI adapter&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:18px&quot;&gt;check · export · animate&lt;br&gt;Mermaid import · ELK layout&lt;br&gt;Import + layout: draw.io 30.2.4+&lt;br&gt;Explicit export page index: 32.4.1+&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;whiteSpace=wrap;html=1;fontFamily=Helvetica;fontSize=20;spacing=16;strokeWidth=1.5;fillColor=#FFFFFF;strokeColor=#CBD5E1;fontColor=#0F172A;" vertex="1" parent="tools">
27
27
  <mxGeometry x="30" y="420" width="370" height="200" as="geometry"/>
28
28
  </mxCell>
29
29
  <mxCell id="source" value="&lt;b&gt;Editable source of truth&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:18px&quot;&gt;.drawio XML authored by Pi&lt;br&gt;Validation does not render pixels&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;whiteSpace=wrap;html=1;fontFamily=Helvetica;fontSize=20;spacing=16;strokeWidth=1.5;fillColor=#FFFFFF;strokeColor=#CBD5E1;fontColor=#0F172A;" vertex="1" parent="1">
30
30
  <mxGeometry x="40" y="760" width="360" height="120" as="geometry"/>
31
31
  </mxCell>
32
- <mxCell id="renderer" value="&lt;b&gt;draw.io Desktop&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:18px&quot;&gt;Local CLI process&lt;br&gt;Preview · render · convert · layout&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;whiteSpace=wrap;html=1;fontFamily=Helvetica;fontSize=20;spacing=16;strokeWidth=1.5;fillColor=#FFFFFF;strokeColor=#CBD5E1;fontColor=#0F172A;" vertex="1" parent="1">
32
+ <mxCell id="renderer" value="&lt;b&gt;draw.io Desktop&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:18px&quot;&gt;Local CLI process&lt;br&gt;Preview · render · convert · layout&lt;br&gt;WSL: native Linux renderer&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;whiteSpace=wrap;html=1;fontFamily=Helvetica;fontSize=20;spacing=16;strokeWidth=1.5;fillColor=#FFFFFF;strokeColor=#CBD5E1;fontColor=#0F172A;" vertex="1" parent="1">
33
33
  <mxGeometry x="1040" y="600" width="360" height="170" as="geometry"/>
34
34
  </mxCell>
35
- <mxCell id="deliverables" value="&lt;b&gt;Derived deliverables&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:18px&quot;&gt;PNG · SVG · PDF · JPG&lt;br&gt;Verified animated SVG + fallback&lt;br&gt;PNG / SVG / PDF embed XML&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;whiteSpace=wrap;html=1;fontFamily=Helvetica;fontSize=20;spacing=16;strokeWidth=1.5;fillColor=#FFFFFF;strokeColor=#CBD5E1;fontColor=#0F172A;fillColor=#EFF6FF;strokeColor=#2563EB;fontColor=#1E3A8A;" vertex="1" parent="1">
35
+ <mxCell id="deliverables" value="&lt;b&gt;Derived deliverables&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:18px&quot;&gt;PNG · SVG · PDF · JPG&lt;br&gt;Verified animated SVG + fallback&lt;br&gt;XML by default: PNG / SVG / PDF&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;whiteSpace=wrap;html=1;fontFamily=Helvetica;fontSize=20;spacing=16;strokeWidth=1.5;fillColor=#FFFFFF;strokeColor=#CBD5E1;fontColor=#0F172A;fillColor=#EFF6FF;strokeColor=#2563EB;fontColor=#1E3A8A;" vertex="1" parent="1">
36
36
  <mxGeometry x="1040" y="250" width="360" height="170" as="geometry"/>
37
37
  </mxCell>
38
38
  <mxCell id="e-agent-core" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#2563EB;strokeWidth=2;endArrow=blockThin;endFill=1;endSize=8;fontFamily=Helvetica;fontSize=16;fontColor=#475569;labelBackgroundColor=#FFFFFF;exitX=1;exitY=0.25;entryX=0;entryY=0.5;strokeColor=#94A3B8;strokeWidth=1.5;" edge="1" parent="1" source="agent" target="core">
@@ -50,10 +50,10 @@
50
50
  <mxCell id="e-renderer-deliverables" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#2563EB;strokeWidth=2;endArrow=blockThin;endFill=1;endSize=8;fontFamily=Helvetica;fontSize=16;fontColor=#475569;labelBackgroundColor=#FFFFFF;exitX=0.5;exitY=0;entryX=0.5;entryY=1;" edge="1" parent="1" source="renderer" target="deliverables">
51
51
  <mxGeometry x="0" relative="1" as="geometry"><Array as="points"><mxPoint x="1220" y="510"/></Array></mxGeometry>
52
52
  </mxCell>
53
- <mxCell id="e-source-renderer" value="reads source" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#2563EB;strokeWidth=2;endArrow=blockThin;endFill=1;endSize=8;fontFamily=Helvetica;fontSize=16;fontColor=#475569;labelBackgroundColor=#FFFFFF;exitX=1;exitY=0.5;entryX=0.5;entryY=1;strokeColor=#94A3B8;strokeWidth=1.5;" edge="1" parent="1" source="source" target="renderer">
53
+ <mxCell id="e-source-renderer" value="supplies XML" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#2563EB;strokeWidth=2;endArrow=blockThin;endFill=1;endSize=8;fontFamily=Helvetica;fontSize=16;fontColor=#475569;labelBackgroundColor=#FFFFFF;exitX=1;exitY=0.5;entryX=0.5;entryY=1;strokeColor=#94A3B8;strokeWidth=1.5;" edge="1" parent="1" source="source" target="renderer">
54
54
  <mxGeometry x="0.35" relative="1" as="geometry"><mxPoint x="0" y="-22" as="offset"/><Array as="points"><mxPoint x="460" y="820"/><mxPoint x="460" y="920"/><mxPoint x="1220" y="920"/></Array></mxGeometry>
55
55
  </mxCell>
56
- <mxCell id="locality" value="&lt;b&gt;Local rendering is not an offline-model promise&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:18px&quot;&gt;Diagram files, the bundled shape index, structural checks and desktop rendering stay local.&lt;br&gt;Pi uses the selected model/provider for planning and authoring; an SVG needs no draw.io web viewer.&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;whiteSpace=wrap;html=1;fontFamily=Helvetica;fontSize=20;spacing=16;strokeWidth=1.5;fillColor=#FFFFFF;strokeColor=#CBD5E1;fontColor=#0F172A;fillColor=#F8FAFC;strokeColor=#CBD5E1;fontColor=#475569;align=left;" vertex="1" parent="1">
56
+ <mxCell id="locality" value="&lt;b&gt;Local rendering, model-provider context&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:18px&quot;&gt;Shape search, structural checks and desktop rendering run locally.&lt;br&gt;Requests and attached previews or storyboards enter Pi’s model context; a hosted provider may receive them.&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;whiteSpace=wrap;html=1;fontFamily=Helvetica;fontSize=20;spacing=16;strokeWidth=1.5;fillColor=#FFFFFF;strokeColor=#CBD5E1;fontColor=#0F172A;fillColor=#F8FAFC;strokeColor=#CBD5E1;fontColor=#475569;align=left;" vertex="1" parent="1">
57
57
  <mxGeometry x="40" y="980" width="1360" height="100" as="geometry"/>
58
58
  </mxCell>
59
59
  </root>
@@ -47,16 +47,16 @@
47
47
  <mxCell id="step-2" value="2" style="ellipse;aspect=fixed;html=1;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=15;fontStyle=1;fontColor=#FFFFFF;fillColor=#3B82F6;strokeColor=none;" vertex="1" parent="prepare">
48
48
  <mxGeometry x="580" y="40" width="34" height="34" as="geometry"/>
49
49
  </mxCell>
50
- <mxCell id="check" value="&lt;b&gt;Plan&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#1E3A8A&quot; style=&quot;font-size:18px&quot;&gt;CLI + references loaded&lt;br&gt;Type · relationships · layout&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;spacing=20;fontFamily=Helvetica;fontSize=22;fontColor=#1E3A8A;fillColor=#EFF6FF;strokeColor=#3B82F6;strokeWidth=1.5;" vertex="1" parent="prepare">
50
+ <mxCell id="check" value="&lt;b&gt;Plan&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#1E3A8A&quot; style=&quot;font-size:18px&quot;&gt;Check CLI · load references&lt;br&gt;Type · relationships · layout&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;spacing=20;fontFamily=Helvetica;fontSize=22;fontColor=#1E3A8A;fillColor=#EFF6FF;strokeColor=#3B82F6;strokeWidth=1.5;" vertex="1" parent="prepare">
51
51
  <mxGeometry x="580" y="90" width="340" height="130" as="geometry"/>
52
52
  </mxCell>
53
53
  <mxCell id="step-3" value="3" style="ellipse;aspect=fixed;html=1;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=15;fontStyle=1;fontColor=#FFFFFF;fillColor=#3B82F6;strokeColor=none;" vertex="1" parent="prepare">
54
54
  <mxGeometry x="1120" y="40" width="34" height="34" as="geometry"/>
55
55
  </mxCell>
56
- <mxCell id="author" value="&lt;b&gt;Author&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#1E3A8A&quot; style=&quot;font-size:18px&quot;&gt;.drawio is the source&lt;br&gt;XML · exact shapes · v30+ tools&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;html=1;whiteSpace=wrap;align=center;verticalAlign=middle;spacing=20;fontFamily=Helvetica;fontSize=22;fontColor=#1E3A8A;fillColor=#EFF6FF;strokeColor=#3B82F6;strokeWidth=1.5;shape=mxgraph.flowchart.document2;size=0.16;" vertex="1" parent="prepare">
56
+ <mxCell id="author" value="&lt;b&gt;Author&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#1E3A8A&quot; style=&quot;font-size:18px&quot;&gt;.drawio is the source&lt;br&gt;XML · exact shapes · optional CLI&lt;/font&gt;" style="rounded=1;absoluteArcSize=1;arcSize=12;html=1;whiteSpace=wrap;align=center;verticalAlign=middle;spacing=20;fontFamily=Helvetica;fontSize=22;fontColor=#1E3A8A;fillColor=#EFF6FF;strokeColor=#3B82F6;strokeWidth=1.5;shape=mxgraph.flowchart.document2;size=0.16;" vertex="1" parent="prepare">
57
57
  <mxGeometry x="1120" y="90" width="340" height="130" as="geometry"/>
58
58
  </mxCell>
59
- <mxCell id="v30" value="Mermaid conversion + ELK layout require draw.io v30+." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;spacing=0;strokeColor=none;fillColor=none;fontFamily=Helvetica;fontColor=#64748B;fontSize=16;fontStyle=0;" vertex="1" parent="1">
59
+ <mxCell id="v30" value="Mermaid conversion + ELK layout: draw.io 30.2.4+. Explicit export page selection: 32.4.1+." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;spacing=0;strokeColor=none;fillColor=none;fontFamily=Helvetica;fontColor=#64748B;fontSize=16;fontStyle=0;" vertex="1" parent="1">
60
60
  <mxGeometry x="80" y="492" width="900" height="30" as="geometry"/>
61
61
  </mxCell>
62
62
  <mxCell id="step-4" value="4" style="ellipse;aspect=fixed;html=1;align=center;verticalAlign=middle;fontFamily=Helvetica;fontSize=15;fontStyle=1;fontColor=#FFFFFF;fillColor=#8B5CF6;strokeColor=none;" vertex="1" parent="quality">
@@ -89,7 +89,7 @@
89
89
  <mxCell id="e-check-author" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#3B82F6;strokeWidth=2;endArrow=blockThin;endFill=1;endSize=8;fontFamily=Helvetica;fontSize=15;fontColor=#64748B;labelBackgroundColor=#FFFFFF;exitX=1;exitY=0.5;entryX=0;entryY=0.5;" edge="1" parent="1" source="check" target="author">
90
90
  <mxGeometry x="0" relative="1" as="geometry"><Array as="points"><mxPoint x="1060" y="380"/></Array></mxGeometry>
91
91
  </mxCell>
92
- <mxCell id="e-author-validate" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#8B5CF6;strokeWidth=2;endArrow=blockThin;endFill=1;endSize=8;fontFamily=Helvetica;fontSize=15;fontColor=#64748B;labelBackgroundColor=#FFFFFF;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="author" target="validate">
92
+ <mxCell id="e-author-validate" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#8B5CF6;strokeWidth=2;endArrow=blockThin;endFill=1;endSize=8;fontFamily=Helvetica;fontSize=15;fontColor=#64748B;labelBackgroundColor=#FFFFFF;exitX=0.5;exitY=0.92;exitPerimeter=0;entryX=0.5;entryY=0;" edge="1" parent="1" source="author" target="validate">
93
93
  <mxGeometry x="0" relative="1" as="geometry"><Array as="points"><mxPoint x="1330" y="515"/></Array></mxGeometry>
94
94
  </mxCell>
95
95
  <mxCell id="e-validate-review" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#8B5CF6;strokeWidth=2;endArrow=blockThin;endFill=1;endSize=8;fontFamily=Helvetica;fontSize=15;fontColor=#64748B;labelBackgroundColor=#FFFFFF;exitX=0;exitY=0.5;entryX=1;entryY=0.5;" edge="1" parent="1" source="validate" target="review">
@@ -110,14 +110,14 @@
110
110
  <mxCell id="missing-cli" value="&lt;b&gt;CLI unavailable&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:16px&quot;&gt;Still author + validate XML.&lt;br&gt;Skip conversion, layout, previews and exports.&lt;/font&gt;" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;spacing=0;strokeColor=none;fillColor=none;fontFamily=Helvetica;fontColor=#0F172A;fontSize=19;fontStyle=0;" vertex="1" parent="1">
111
111
  <mxGeometry x="40" y="1035" width="470" height="100" as="geometry"/>
112
112
  </mxCell>
113
- <mxCell id="vision" value="&lt;b&gt;Text-only model&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:16px&quot;&gt;Use validation + explanation.&lt;br&gt;Report rendered review as skipped.&lt;/font&gt;" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;spacing=0;strokeColor=none;fillColor=none;fontFamily=Helvetica;fontColor=#0F172A;fontSize=19;fontStyle=0;" vertex="1" parent="1">
113
+ <mxCell id="vision" value="&lt;b&gt;No preview image attached&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:16px&quot;&gt;Review structurally with validation + explanation.&lt;br&gt;Report rendered review as skipped.&lt;/font&gt;" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;spacing=0;strokeColor=none;fillColor=none;fontFamily=Helvetica;fontColor=#0F172A;fontSize=19;fontStyle=0;" vertex="1" parent="1">
114
114
  <mxGeometry x="550" y="1035" width="450" height="100" as="geometry"/>
115
115
  </mxCell>
116
116
  <mxCell id="limit" value="&lt;b&gt;Bounded corrections&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#64748B&quot; style=&quot;font-size:16px&quot;&gt;Keep the best validated state.&lt;br&gt;At eight retries, export and report unresolved findings.&lt;/font&gt;" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;spacing=0;strokeColor=none;fillColor=none;fontFamily=Helvetica;fontColor=#0F172A;fontSize=19;fontStyle=0;" vertex="1" parent="1">
117
117
  <mxGeometry x="1040" y="1035" width="500" height="100" as="geometry"/>
118
118
  </mxCell>
119
- <mxCell id="cleanup" value="PNG / SVG / PDF embed XML; JPG cannot. Final export removes the latest preview." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;spacing=0;strokeColor=none;fillColor=none;fontFamily=Helvetica;fontColor=#64748B;fontSize=16;fontStyle=0;" vertex="1" parent="1">
120
- <mxGeometry x="40" y="1175" width="1500" height="30" as="geometry"/>
119
+ <mxCell id="cleanup" value="PNG / SVG / PDF finals embed XML by default; JPG cannot.&lt;br&gt;Final export removes the latest preview only if still tracked for this source. Files may be retired across pages.&lt;br&gt;Tracking is process-local; image attachments are separate." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;spacing=0;strokeColor=none;fillColor=none;fontFamily=Helvetica;fontColor=#64748B;fontSize=16;fontStyle=0;" vertex="1" parent="1">
120
+ <mxGeometry x="40" y="1150" width="1500" height="55" as="geometry"/>
121
121
  </mxCell>
122
122
  </root>
123
123
  </mxGraphModel>