@markasso/mcp 0.4.1 → 0.4.2

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.
@@ -4202,7 +4202,7 @@ function escapeXml(str) {
4202
4202
  }
4203
4203
  //#endregion
4204
4204
  //#region package.json
4205
- var version = "0.4.1";
4205
+ var version = "0.4.2";
4206
4206
  //#endregion
4207
4207
  //#region ../src/core/layout.ts
4208
4208
  /** Orders vertices without recursion, preserving input order when unconstrained. */
@@ -5686,6 +5686,33 @@ var Diagram = class {
5686
5686
  return this.history.present.elements;
5687
5687
  }
5688
5688
  /**
5689
+ * Elements to write out (file, share link). Bound connectors keep the
5690
+ * x/y/x2/y2 they had when connected, since the app resolves their ends
5691
+ * from the shapes at draw time; here they are set to where they are drawn
5692
+ * now, so a saved board stays consistent for readers that use the stored
5693
+ * coordinates. The live scene and its undo stack are left untouched.
5694
+ */
5695
+ snapshot() {
5696
+ const all = this.elements;
5697
+ return all.map((el) => {
5698
+ if (!isConnector(el) || !el.startElementId && !el.endElementId) return el;
5699
+ if (el.type === "line" && el.cx !== void 0 && el.cy !== void 0) return {
5700
+ ...el,
5701
+ ...resolveArrowEndpoints(el, all)
5702
+ };
5703
+ const route = resolveConnectorRoute(el, all);
5704
+ const [x, y] = route[0];
5705
+ const [x2, y2] = route[route.length - 1];
5706
+ return {
5707
+ ...el,
5708
+ x,
5709
+ y,
5710
+ x2,
5711
+ y2
5712
+ };
5713
+ });
5714
+ }
5715
+ /**
5689
5716
  * Key of every node: the agent's own key when it created the node, else
5690
5717
  * a slug of its label (or "<type>-<id prefix>"), deduplicated. Stable for
5691
5718
  * a given scene, so a model can re-read and keep addressing nodes.
@@ -6684,7 +6711,7 @@ server.registerTool("diagram_save", {
6684
6711
  description: "Save the diagram as a .markasso file (open it in the app with File > Open).",
6685
6712
  inputSchema: { path: z.string().min(1).describe("Absolute path ending in .markasso") }
6686
6713
  }, guarded(async ({ path }) => {
6687
- await saveMarkassoFile(path, diagram.elements);
6714
+ await saveMarkassoFile(path, diagram.snapshot());
6688
6715
  return `Saved ${diagram.elements.length} elements to ${path}.`;
6689
6716
  }));
6690
6717
  server.registerTool("diagram_export_svg", {
@@ -6741,7 +6768,7 @@ server.registerTool("diagram_share", {
6741
6768
  annotations: { openWorldHint: true }
6742
6769
  }, guarded(async () => {
6743
6770
  if (diagram.elements.length === 0) return "The diagram is empty: nothing to share.";
6744
- const { url, expiresAt } = await createShareLink(diagram.elements);
6771
+ const { url, expiresAt } = await createShareLink(diagram.snapshot());
6745
6772
  return `Open in Markasso: ${url}\nThe link expires ${expiresAt ? `on ${expiresAt.toISOString().slice(0, 10)}` : "after a while"}; save a .markasso file to keep the diagram.`;
6746
6773
  }));
6747
6774
  server.registerTool("live_join", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markasso/mcp",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "MCP server that lets AI agents create, read and edit Markasso diagrams, offline or live on a shared board",
5
5
  "type": "module",
6
6
  "repository": {