{
  "id": "capability-ffi",
  "revision": "724164211963e316ddea9b20c178c39615ad06a08b19db8f21156cb876ca768e",
  "regions": [
    {
      "id": "js",
      "label": "Kotlin/JS host"
    },
    {
      "id": "native",
      "label": "Native target adapter"
    }
  ],
  "nodes": [
    {
      "id": "logic",
      "label": "Common Kotlin logic",
      "kind": "N01",
      "region": "js",
      "ports": [
        {
          "id": "call",
          "profile": "P02",
          "contract": "NativeComputeV1",
          "polarity": "Require"
        }
      ]
    },
    {
      "id": "bridge",
      "label": "FFI transport adapter",
      "kind": "N15",
      "region": "js",
      "ports": [
        {
          "id": "call",
          "profile": "P02",
          "contract": "NativeComputeV1",
          "polarity": "Offer"
        },
        {
          "id": "native",
          "profile": "P02",
          "contract": "NativeComputeV1",
          "polarity": "Require"
        },
        {
          "id": "admission",
          "profile": "P20",
          "contract": "HostGrantV1",
          "polarity": "Require"
        },
        {
          "id": "failure",
          "profile": "P04",
          "contract": "ForeignFailureV1",
          "polarity": "Offer"
        },
        {
          "id": "release",
          "profile": "P24",
          "contract": "ReleaseProtocolV1",
          "polarity": "Neutral"
        }
      ]
    },
    {
      "id": "native",
      "label": "Foreign function library",
      "kind": "N16",
      "region": "native",
      "ports": [
        {
          "id": "compute",
          "profile": "P02",
          "contract": "NativeComputeV1",
          "polarity": "Offer"
        },
        {
          "id": "buffer",
          "profile": "P17",
          "contract": "BufferLeaseV1",
          "polarity": "Require"
        },
        {
          "id": "borrow",
          "profile": "P24",
          "contract": "BorrowRefV1",
          "polarity": "Neutral"
        }
      ]
    },
    {
      "id": "pool",
      "label": "Native buffer owner",
      "kind": "N26",
      "region": "native",
      "ports": [
        {
          "id": "lease",
          "profile": "P17",
          "contract": "BufferLeaseV1",
          "polarity": "Offer"
        },
        {
          "id": "allocator",
          "profile": "P24",
          "contract": "AllocatorRefV1",
          "polarity": "Neutral"
        }
      ]
    },
    {
      "id": "policy",
      "label": "Host capability gate",
      "kind": "N33",
      "region": "js",
      "ports": [
        {
          "id": "grant",
          "profile": "P20",
          "contract": "HostGrantV1",
          "polarity": "Offer"
        }
      ]
    },
    {
      "id": "error",
      "label": "Error / cancellation adapter",
      "kind": "N15",
      "region": "js",
      "ports": [
        {
          "id": "failure",
          "profile": "P04",
          "contract": "ForeignFailureV1",
          "polarity": "Require"
        }
      ]
    }
  ],
  "relations": [
    {
      "id": "invoke",
      "kind": "H05",
      "incidences": [
        {
          "node": "bridge",
          "port": "call",
          "role": "provider",
          "ordinal": 0
        },
        {
          "node": "logic",
          "port": "call",
          "role": "consumer",
          "ordinal": 0
        }
      ]
    },
    {
      "id": "native",
      "kind": "H05",
      "incidences": [
        {
          "node": "native",
          "port": "compute",
          "role": "provider",
          "ordinal": 0
        },
        {
          "node": "bridge",
          "port": "native",
          "role": "consumer",
          "ordinal": 0
        }
      ]
    },
    {
      "id": "buffer",
      "kind": "H01",
      "incidences": [
        {
          "node": "pool",
          "port": "lease",
          "role": "provider",
          "ordinal": 0
        },
        {
          "node": "native",
          "port": "buffer",
          "role": "consumer",
          "ordinal": 0
        }
      ]
    },
    {
      "id": "grant",
      "kind": "H23",
      "incidences": [
        {
          "node": "policy",
          "port": "grant",
          "role": "provider",
          "ordinal": 0
        },
        {
          "node": "bridge",
          "port": "admission",
          "role": "consumer",
          "ordinal": 0
        }
      ]
    },
    {
      "id": "error",
      "kind": "H02",
      "incidences": [
        {
          "node": "bridge",
          "port": "failure",
          "role": "provider",
          "ordinal": 0
        },
        {
          "node": "error",
          "port": "failure",
          "role": "consumer",
          "ordinal": 0
        }
      ]
    },
    {
      "id": "ownership",
      "kind": "H19",
      "incidences": [
        {
          "node": "pool",
          "port": "allocator",
          "role": "allocator",
          "ordinal": 0
        },
        {
          "node": "native",
          "port": "borrow",
          "role": "borrower",
          "ordinal": 1
        },
        {
          "node": "bridge",
          "port": "release",
          "role": "adapter",
          "ordinal": 2
        }
      ]
    }
  ]
}
