{
  "id": "wire.cloud",
  "kind": "contract",
  "summary": "Wire Cloud persistence, API key, hosted chat key, and share URL contract.",
  "useWhen": [
    "connecting local MCP to an authenticated cloud account",
    "syncing local CLI/agent wires to Wire Cloud",
    "configuring authenticated /wires chat LLM access",
    "sharing diagrams as view, SVG, PNG, JSON, Mermaid, or edit links"
  ],
  "contracts": [
    "wire-cloud-api-key",
    "wire-hosted-chat-openai-key",
    "wire-cloud-share-urls",
    "wire-cloud-sync"
  ],
  "preferredPath": [
    "User signs into Wire Cloud with Google.",
    "User generates an API key from the Connect local MCP modal.",
    "Local MCP starts with WIRE_CLOUD_URL and WIRE_CLOUD_API_KEY.",
    "MCP storage resolves through CloudStorage.",
    "render_preview mints cloud share URLs instead of localhost links.",
    "For /wires chat, user saves an OpenAI API key in the right chat sidebar before sending LLM edits.",
    "/api/wires/{id}/chat requires that stored OpenAI key and returns code openai-key-required until configured."
  ],
  "avoid": [
    "Do not expose private edit tokens when read-only sharing is intended.",
    "Do not tell customers to run local preview servers for shared previews.",
    "Do not store the generated Wire Cloud API key in docs, screenshots, or committed files.",
    "Do not commit OpenAI API keys or use the Wire Cloud API key as the OpenAI chat key."
  ],
  "routes": [
    {
      "path": "/api/user/openai-key",
      "method": "GET/POST/DELETE",
      "mediaType": "application/json",
      "purpose": "Read metadata, save, or delete the authenticated user's encrypted OpenAI chat key."
    },
    {
      "path": "/api/wires/{id}/chat",
      "method": "POST",
      "mediaType": "application/json",
      "purpose": "Run authenticated /wires LLM edits; requires a stored OpenAI key."
    },
    {
      "path": "/api/cloud/me",
      "method": "GET",
      "mediaType": "application/json",
      "purpose": "API key auth smoke test."
    },
    {
      "path": "/api/cloud/wires",
      "method": "GET/POST",
      "mediaType": "application/json",
      "purpose": "List or create authenticated user wires."
    },
    {
      "path": "/api/cloud/wires/{id}",
      "method": "GET/PATCH/PUT/DELETE",
      "mediaType": "application/json",
      "purpose": "Read and mutate a cloud wire."
    },
    {
      "path": "/api/cloud/wires/{id}/share",
      "method": "POST",
      "mediaType": "application/json",
      "purpose": "Mint token-scoped share URLs."
    }
  ],
  "related": [
    "wire.mcp",
    "wire.agent"
  ]
}
