4 Commits

Author SHA1 Message Date
Gaudenz Alder d406e162db chore(libavoid): sync vendored routing-core fallback with canonical drawio copy
Verbatim refresh of the tool server's cold-cache/offline fallback from
drawio d972771957: self-loops are now excluded from libavoid routing
(keeps the caller's loop styling and waypoints), plus the earlier
Object.create(null) hardening for id-keyed maps.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-02 22:19:30 +02:00
Gaudenz Alder 40f960e839 feat(libavoid): adopt the pure-JS two-file js/libavoid-js CDN layout
The next draw.io release replaces the three-part WASM bundle (glue +
base64 wasm payload + loader) with a single self-contained pure-JS
libavoid.min.js that publishes globalThis.Avoid and parks
window.__libavoidReady itself, next to the shared routing core.

- mcp-app-server: load the bundle + routing core from the CDN as two
  ETag-versioned URLs and drop the loader plumbing the new bundle makes
  obsolete (processLibavoidBundle, libavoidWasmB64, wasm-unsafe-eval
  notes). No pre-release fallback: deploy once the release is on
  viewer.diagrams.net - against the old CDN layout routing degrades
  gracefully to unrouted edges.
- mcp-tool-server: refresh the vendored cold-cache/offline fallback copy
  of libavoid-routing.js verbatim from drawio-dev (dangling-end
  free-point routing, lazily-requested jetty checkpoints, cappedJetty,
  snapToPoint candidate pins).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 19:14:38 +02:00
Gaudenz Alder 908e8bdf2d feat(libavoid): load the shared routing core from the viewer.diagrams.net CDN
Squashed merge of libavoid-cdn:

- vendor the shared routing core (globalThis.AvoidRouting) from
  drawio-dev, synced to the release now in production: fixed
  connection points, jettySize, port-constraint masks, and
  snap-point candidate anchors (draw.io's snapToPoint)
- app server: load libavoid from the viewer.diagrams.net CDN like
  elk/mermaid, with ETag-versioned URLs in the served HTML; drop the
  vendored browser build + wasm
- tool server: load the routing core from the CDN through an
  ETag-revalidated per-user disk cache (primed by npm postinstall),
  with the vendored copy as last-resort fallback
- plugin skill: document --layout libavoid routing and --mermaid-image

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 14:37:38 +02:00
Gaudenz Alder 0d1148a326 feat(routing): add libavoid edge routing to the tool server; share routing core
Bring the obstacle-avoiding orthogonal edge routing (shipped for the app
server's create_diagram) to the tool server's open_drawio_xml, via a server-side
pass, and factor the libavoid-driving logic into one shared helper so the two
servers can't drift.

- shared/libavoid-routing.js: self-contained pure computeLibavoidRoutes
  (vertices + edges -> orthogonal obstacle-avoiding waypoints). The app server
  inlines it into the browser bundle via Function.toString(); the tool server
  imports it in Node. shared/package.json marks the dir ESM.
- mcp-app-server: refactor routeWithLibavoid onto the shared helper (mxGraph
  model extract + parent-relative write-back stays; routing math is now shared).
- mcp-tool-server: new src/libavoid-pass.js — parse the mxGraphModel XML, run
  the shared helper, write waypoints + orthogonalEdgeStyle back, and fail safe
  to the original XML on any problem. Add routing:"libavoid" to open_drawio_xml.
  Vendor the libavoid-js NODE build + wasm (loaded by path; Node needs no
  inlining/base64). copy-shared copies the helper into src/ (gitignored, with a
  ../../shared fallback for in-repo runs); vendor/ added to npm files.
- docs: routing param + vendored libavoid in root / app-server / tool-server
  CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 16:38:26 +02:00