Production

Production usage

How to embed Wire in a product without changing the durable diagram contract.

tsx
"use client";

import { useState } from "react";
import "@aigentive/wire-react/styles.css";
import { WireWorkspace, type WireDiagram } from "@aigentive/wire-react";

export function WorkflowEditor({ initial }: { initial: WireDiagram }) {
  const [diagram, setDiagram] = useState(initial);

  return (
    <div style={{ height: "min(760px, calc(100vh - 120px))" }}>
      <WireWorkspace
        diagram={diagram}
        onChange={(next) => {
          setDiagram(next);
          void saveDiagram(next);
        }}
        colorMode="system"
      />
    </div>
  );
}
ts
import { validate, type WireDiagram } from "@aigentive/wire-core";

export function assertReadyForShare(diagram: WireDiagram) {
  const result = validate(diagram);
  if (!result.valid) {
    throw new Error(result.issues.map((issue) => issue.message).join("\n"));
  }
  return result;
}
AreaGate
PersistencePersist WireDiagram only; keep viewport, selection, inspector state, option catalogs, and callbacks outside JSON.
ValidationRun validate before save, share, render, export, and agent handoff. Treat warnings as review items.
React boundaryRender editor surfaces from client components and give the canvas parent a stable height.
StylingImport @aigentive/wire-react/styles.css once, then use CSS variables, colorMode, unstyled, and classNames.
AccessibilityVerify keyboard access for toolbar, inspector, node list, option panel, and read-only embeds.
ToolingKeep CLI, MCP, LLM routes, examples, and package READMEs in parity with current implementation.
NextReact component API