{
  "schemaVersion": "dancer-access/v1",
  "permitSchemaVersion": "dancer-access-permit/v2",
  "actions": [
    {
      "action": "messages.send",
      "supported": true,
      "enabled": false
    },
    {
      "action": "messages.read_addressed",
      "supported": true,
      "enabled": false
    },
    {
      "action": "messages.reply",
      "supported": true,
      "enabled": false
    },
    {
      "action": "messages.read_own_replies",
      "supported": true,
      "enabled": false
    },
    {
      "action": "messages.read_history",
      "supported": true,
      "enabled": false
    },
    {
      "action": "messages.subscribe",
      "supported": true,
      "enabled": false
    },
    {
      "action": "messages.wake",
      "supported": true,
      "enabled": false
    }
  ],
  "limits": {
    "permitMaxMs": 10000,
    "waitMaxMs": 25000,
    "pageMax": 100,
    "requestMaxBytes": 32768,
    "assertionMaxMs": 60000,
    "tokenMaxMs": 300000
  },
  "schemas": {
    "permission": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "messages.send"
            },
            "resource": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "messages.connection"
                },
                "organizationId": {
                  "type": "string",
                  "maxLength": 128,
                  "pattern": "^org_[A-Za-z0-9_-]+$"
                },
                "projectId": {
                  "type": "string",
                  "pattern": "^prj_[a-f0-9]{32}$"
                },
                "threadId": {
                  "type": "string",
                  "pattern": "^thr_[a-f0-9]{32}$"
                },
                "connectionId": {
                  "type": "string",
                  "pattern": "^con_[a-f0-9]{32}$"
                },
                "senderId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "recipientId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                }
              },
              "required": [
                "kind",
                "organizationId",
                "projectId",
                "threadId",
                "connectionId",
                "senderId",
                "recipientId"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "action",
            "resource"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "messages.read_addressed"
            },
            "resource": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "messages.connection"
                },
                "organizationId": {
                  "type": "string",
                  "maxLength": 128,
                  "pattern": "^org_[A-Za-z0-9_-]+$"
                },
                "projectId": {
                  "type": "string",
                  "pattern": "^prj_[a-f0-9]{32}$"
                },
                "threadId": {
                  "type": "string",
                  "pattern": "^thr_[a-f0-9]{32}$"
                },
                "connectionId": {
                  "type": "string",
                  "pattern": "^con_[a-f0-9]{32}$"
                },
                "senderId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "recipientId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                }
              },
              "required": [
                "kind",
                "organizationId",
                "projectId",
                "threadId",
                "connectionId",
                "senderId",
                "recipientId"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "action",
            "resource"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "messages.reply"
            },
            "resource": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "messages.connection"
                },
                "organizationId": {
                  "type": "string",
                  "maxLength": 128,
                  "pattern": "^org_[A-Za-z0-9_-]+$"
                },
                "projectId": {
                  "type": "string",
                  "pattern": "^prj_[a-f0-9]{32}$"
                },
                "threadId": {
                  "type": "string",
                  "pattern": "^thr_[a-f0-9]{32}$"
                },
                "connectionId": {
                  "type": "string",
                  "pattern": "^con_[a-f0-9]{32}$"
                },
                "senderId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "recipientId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                }
              },
              "required": [
                "kind",
                "organizationId",
                "projectId",
                "threadId",
                "connectionId",
                "senderId",
                "recipientId"
              ],
              "additionalProperties": false
            },
            "source": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "connection_sources"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "exact_source"
                    },
                    "sourceMessageId": {
                      "type": "string",
                      "pattern": "^msg_[a-f0-9]{32}$"
                    },
                    "conversationRootId": {
                      "type": "string",
                      "pattern": "^msg_[a-f0-9]{32}$"
                    }
                  },
                  "required": [
                    "kind",
                    "sourceMessageId",
                    "conversationRootId"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "action",
            "resource",
            "source"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "messages.read_own_replies"
            },
            "resource": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "messages.connection"
                },
                "organizationId": {
                  "type": "string",
                  "maxLength": 128,
                  "pattern": "^org_[A-Za-z0-9_-]+$"
                },
                "projectId": {
                  "type": "string",
                  "pattern": "^prj_[a-f0-9]{32}$"
                },
                "threadId": {
                  "type": "string",
                  "pattern": "^thr_[a-f0-9]{32}$"
                },
                "connectionId": {
                  "type": "string",
                  "pattern": "^con_[a-f0-9]{32}$"
                },
                "senderId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "recipientId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                }
              },
              "required": [
                "kind",
                "organizationId",
                "projectId",
                "threadId",
                "connectionId",
                "senderId",
                "recipientId"
              ],
              "additionalProperties": false
            },
            "source": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "connection_sources"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "exact_source"
                    },
                    "sourceMessageId": {
                      "type": "string",
                      "pattern": "^msg_[a-f0-9]{32}$"
                    },
                    "conversationRootId": {
                      "type": "string",
                      "pattern": "^msg_[a-f0-9]{32}$"
                    }
                  },
                  "required": [
                    "kind",
                    "sourceMessageId",
                    "conversationRootId"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "action",
            "resource",
            "source"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "messages.read_history"
            },
            "resource": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "messages.connection"
                },
                "organizationId": {
                  "type": "string",
                  "maxLength": 128,
                  "pattern": "^org_[A-Za-z0-9_-]+$"
                },
                "projectId": {
                  "type": "string",
                  "pattern": "^prj_[a-f0-9]{32}$"
                },
                "threadId": {
                  "type": "string",
                  "pattern": "^thr_[a-f0-9]{32}$"
                },
                "connectionId": {
                  "type": "string",
                  "pattern": "^con_[a-f0-9]{32}$"
                },
                "senderId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "recipientId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                }
              },
              "required": [
                "kind",
                "organizationId",
                "projectId",
                "threadId",
                "connectionId",
                "senderId",
                "recipientId"
              ],
              "additionalProperties": false
            },
            "history": {
              "type": "object",
              "properties": {
                "fromSequence": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "through": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "live"
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "sequence"
                        },
                        "sequence": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "sequence"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "required": [
                "fromSequence",
                "through"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "action",
            "resource",
            "history"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "messages.subscribe"
            },
            "resource": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "messages.connection"
                },
                "organizationId": {
                  "type": "string",
                  "maxLength": 128,
                  "pattern": "^org_[A-Za-z0-9_-]+$"
                },
                "projectId": {
                  "type": "string",
                  "pattern": "^prj_[a-f0-9]{32}$"
                },
                "threadId": {
                  "type": "string",
                  "pattern": "^thr_[a-f0-9]{32}$"
                },
                "connectionId": {
                  "type": "string",
                  "pattern": "^con_[a-f0-9]{32}$"
                },
                "senderId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "recipientId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                }
              },
              "required": [
                "kind",
                "organizationId",
                "projectId",
                "threadId",
                "connectionId",
                "senderId",
                "recipientId"
              ],
              "additionalProperties": false
            },
            "referenceScope": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "connection_sources"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "exact_source"
                    },
                    "sourceMessageId": {
                      "type": "string",
                      "pattern": "^msg_[a-f0-9]{32}$"
                    },
                    "conversationRootId": {
                      "type": "string",
                      "pattern": "^msg_[a-f0-9]{32}$"
                    }
                  },
                  "required": [
                    "kind",
                    "sourceMessageId",
                    "conversationRootId"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "action",
            "resource",
            "referenceScope"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "messages.wake"
            },
            "resource": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "messages.connection"
                },
                "organizationId": {
                  "type": "string",
                  "maxLength": 128,
                  "pattern": "^org_[A-Za-z0-9_-]+$"
                },
                "projectId": {
                  "type": "string",
                  "pattern": "^prj_[a-f0-9]{32}$"
                },
                "threadId": {
                  "type": "string",
                  "pattern": "^thr_[a-f0-9]{32}$"
                },
                "connectionId": {
                  "type": "string",
                  "pattern": "^con_[a-f0-9]{32}$"
                },
                "senderId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "recipientId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                }
              },
              "required": [
                "kind",
                "organizationId",
                "projectId",
                "threadId",
                "connectionId",
                "senderId",
                "recipientId"
              ],
              "additionalProperties": false
            },
            "receiver": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "connection_binding"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "exact_binding"
                    },
                    "receiverBindingId": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                    },
                    "generation": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "kind",
                    "receiverBindingId",
                    "generation"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "action",
            "resource",
            "receiver"
          ],
          "additionalProperties": false
        }
      ]
    },
    "invitation": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "string",
          "const": "dancer-access/v1"
        },
        "invitationId": {
          "type": "string",
          "pattern": "^inv_[a-f0-9]{32}$"
        },
        "connectionId": {
          "type": "string",
          "pattern": "^con_[a-f0-9]{32}$"
        },
        "version": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "organizationId": {
          "type": "string",
          "maxLength": 128,
          "pattern": "^org_[A-Za-z0-9_-]+$"
        },
        "issuerId": {
          "type": "string",
          "pattern": "^agt_[a-z0-9]{16,64}$"
        },
        "recipientId": {
          "type": "string",
          "pattern": "^agt_[a-z0-9]{16,64}$"
        },
        "edges": {
          "minItems": 1,
          "maxItems": 32,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "subjectId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "permission": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.send"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "action",
                      "resource"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.read_addressed"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "action",
                      "resource"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.reply"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "source": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_sources"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_source"
                              },
                              "sourceMessageId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              },
                              "conversationRootId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              }
                            },
                            "required": [
                              "kind",
                              "sourceMessageId",
                              "conversationRootId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "source"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.read_own_replies"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "source": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_sources"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_source"
                              },
                              "sourceMessageId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              },
                              "conversationRootId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              }
                            },
                            "required": [
                              "kind",
                              "sourceMessageId",
                              "conversationRootId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "source"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.read_history"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "history": {
                        "type": "object",
                        "properties": {
                          "fromSequence": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "through": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "live"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "sequence"
                                  },
                                  "sequence": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sequence"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "fromSequence",
                          "through"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "history"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.subscribe"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "referenceScope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_sources"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_source"
                              },
                              "sourceMessageId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              },
                              "conversationRootId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              }
                            },
                            "required": [
                              "kind",
                              "sourceMessageId",
                              "conversationRootId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "referenceScope"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.wake"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "receiver": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_binding"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_binding"
                              },
                              "receiverBindingId": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                              },
                              "generation": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "receiverBindingId",
                              "generation"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "receiver"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "required": [
              "subjectId",
              "permission"
            ],
            "additionalProperties": false
          }
        },
        "approvals": {
          "maxItems": 3,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string",
                "enum": [
                  "resource_authority",
                  "recipient",
                  "identity_binding"
                ]
              },
              "principalId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "approvedAtMs": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "basis": {
                "anyOf": [
                  {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "project_owner"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "ownerId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "projectId",
                          "ownerId",
                          "version"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "delegation"
                          },
                          "delegationId": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                          },
                          "parentGrantId": {
                            "type": "string",
                            "pattern": "^grt_[a-f0-9]{32}$"
                          },
                          "parentVersion": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "delegationId",
                          "version"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "role",
              "principalId",
              "approvedAtMs",
              "basis"
            ],
            "additionalProperties": false
          }
        },
        "requiredApprovals": {
          "minItems": 1,
          "maxItems": 3,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "resource_authority",
              "recipient",
              "identity_binding"
            ]
          }
        },
        "inviteExpiresAtMs": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "accessExpiresAtMs": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "state": {
          "type": "string",
          "enum": [
            "pending",
            "accepted",
            "declined",
            "cancelled",
            "expired"
          ]
        },
        "grantIds": {
          "maxItems": 32,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^grt_[a-f0-9]{32}$"
          }
        }
      },
      "required": [
        "schemaVersion",
        "invitationId",
        "connectionId",
        "version",
        "organizationId",
        "issuerId",
        "recipientId",
        "edges",
        "approvals",
        "requiredApprovals",
        "inviteExpiresAtMs",
        "accessExpiresAtMs",
        "state",
        "grantIds"
      ],
      "additionalProperties": false
    },
    "grant": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "string",
          "const": "dancer-access/v1"
        },
        "grantId": {
          "type": "string",
          "pattern": "^grt_[a-f0-9]{32}$"
        },
        "version": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "organizationId": {
          "type": "string",
          "maxLength": 128,
          "pattern": "^org_[A-Za-z0-9_-]+$"
        },
        "subjectId": {
          "type": "string",
          "pattern": "^agt_[a-z0-9]{16,64}$"
        },
        "connectionId": {
          "type": "string",
          "pattern": "^con_[a-f0-9]{32}$"
        },
        "sourceInvitationId": {
          "type": "string",
          "pattern": "^inv_[a-f0-9]{32}$"
        },
        "route": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "unbound"
                },
                "audienceVersion": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "kind",
                "audienceVersion"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "bound"
                },
                "recipientId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "routeVersion": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "audienceVersion": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "kind",
                "recipientId",
                "routeVersion",
                "audienceVersion"
              ],
              "additionalProperties": false
            }
          ]
        },
        "permissions": {
          "minItems": 1,
          "maxItems": 32,
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.send"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "action",
                  "resource"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.read_addressed"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "action",
                  "resource"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.reply"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  },
                  "source": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "connection_sources"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "exact_source"
                          },
                          "sourceMessageId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          },
                          "conversationRootId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          }
                        },
                        "required": [
                          "kind",
                          "sourceMessageId",
                          "conversationRootId"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "action",
                  "resource",
                  "source"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.read_own_replies"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  },
                  "source": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "connection_sources"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "exact_source"
                          },
                          "sourceMessageId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          },
                          "conversationRootId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          }
                        },
                        "required": [
                          "kind",
                          "sourceMessageId",
                          "conversationRootId"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "action",
                  "resource",
                  "source"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.read_history"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  },
                  "history": {
                    "type": "object",
                    "properties": {
                      "fromSequence": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "through": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "live"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "sequence"
                              },
                              "sequence": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "sequence"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "fromSequence",
                      "through"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "action",
                  "resource",
                  "history"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.subscribe"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  },
                  "referenceScope": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "connection_sources"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "exact_source"
                          },
                          "sourceMessageId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          },
                          "conversationRootId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          }
                        },
                        "required": [
                          "kind",
                          "sourceMessageId",
                          "conversationRootId"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "action",
                  "resource",
                  "referenceScope"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.wake"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  },
                  "receiver": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "connection_binding"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "exact_binding"
                          },
                          "receiverBindingId": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                          },
                          "generation": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "receiverBindingId",
                          "generation"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "action",
                  "resource",
                  "receiver"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "basis": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "project_owner"
                },
                "projectId": {
                  "type": "string",
                  "pattern": "^prj_[a-f0-9]{32}$"
                },
                "ownerId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "kind",
                "projectId",
                "ownerId",
                "version"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "delegation"
                },
                "delegationId": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                },
                "parentGrantId": {
                  "type": "string",
                  "pattern": "^grt_[a-f0-9]{32}$"
                },
                "parentVersion": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "kind",
                "delegationId",
                "version"
              ],
              "additionalProperties": false
            }
          ]
        },
        "expiresAtMs": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "delegation": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "none"
                }
              },
              "required": [
                "kind"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "bounded"
                },
                "permissions": {
                  "minItems": 1,
                  "maxItems": 32,
                  "type": "array",
                  "items": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.send"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "action",
                          "resource"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.read_addressed"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "action",
                          "resource"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.reply"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "source": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_sources"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_source"
                                  },
                                  "sourceMessageId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  },
                                  "conversationRootId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sourceMessageId",
                                  "conversationRootId"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "source"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.read_own_replies"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "source": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_sources"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_source"
                                  },
                                  "sourceMessageId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  },
                                  "conversationRootId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sourceMessageId",
                                  "conversationRootId"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "source"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.read_history"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "history": {
                            "type": "object",
                            "properties": {
                              "fromSequence": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "through": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "live"
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "sequence"
                                      },
                                      "sequence": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "sequence"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "required": [
                              "fromSequence",
                              "through"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "history"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.subscribe"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "referenceScope": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_sources"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_source"
                                  },
                                  "sourceMessageId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  },
                                  "conversationRootId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sourceMessageId",
                                  "conversationRootId"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "referenceScope"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.wake"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "receiver": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_binding"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_binding"
                                  },
                                  "receiverBindingId": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                  },
                                  "generation": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "receiverBindingId",
                                  "generation"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "receiver"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "maxExpiresAtMs": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "remainingDepth": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 8
                }
              },
              "required": [
                "kind",
                "permissions",
                "maxExpiresAtMs",
                "remainingDepth"
              ],
              "additionalProperties": false
            }
          ]
        },
        "state": {
          "type": "string",
          "enum": [
            "pending_activation",
            "active",
            "suspended",
            "revoked",
            "expired"
          ]
        }
      },
      "required": [
        "schemaVersion",
        "grantId",
        "version",
        "organizationId",
        "subjectId",
        "connectionId",
        "sourceInvitationId",
        "route",
        "permissions",
        "basis",
        "expiresAtMs",
        "delegation",
        "state"
      ],
      "additionalProperties": false
    },
    "credentialCeiling": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "string",
          "const": "dancer-access/v1"
        },
        "credentialId": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
        },
        "generation": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "organizationId": {
          "type": "string",
          "maxLength": 128,
          "pattern": "^org_[A-Za-z0-9_-]+$"
        },
        "subjectId": {
          "type": "string",
          "pattern": "^agt_[a-z0-9]{16,64}$"
        },
        "audience": {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        "expiresAtMs": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "permissions": {
          "maxItems": 32,
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.send"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "action",
                  "resource"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.read_addressed"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "action",
                  "resource"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.reply"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  },
                  "source": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "connection_sources"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "exact_source"
                          },
                          "sourceMessageId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          },
                          "conversationRootId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          }
                        },
                        "required": [
                          "kind",
                          "sourceMessageId",
                          "conversationRootId"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "action",
                  "resource",
                  "source"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.read_own_replies"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  },
                  "source": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "connection_sources"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "exact_source"
                          },
                          "sourceMessageId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          },
                          "conversationRootId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          }
                        },
                        "required": [
                          "kind",
                          "sourceMessageId",
                          "conversationRootId"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "action",
                  "resource",
                  "source"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.read_history"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  },
                  "history": {
                    "type": "object",
                    "properties": {
                      "fromSequence": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "through": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "live"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "sequence"
                              },
                              "sequence": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "sequence"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "fromSequence",
                      "through"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "action",
                  "resource",
                  "history"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.subscribe"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  },
                  "referenceScope": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "connection_sources"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "exact_source"
                          },
                          "sourceMessageId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          },
                          "conversationRootId": {
                            "type": "string",
                            "pattern": "^msg_[a-f0-9]{32}$"
                          }
                        },
                        "required": [
                          "kind",
                          "sourceMessageId",
                          "conversationRootId"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "action",
                  "resource",
                  "referenceScope"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "const": "messages.wake"
                  },
                  "resource": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.connection"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "threadId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      },
                      "connectionId": {
                        "type": "string",
                        "pattern": "^con_[a-f0-9]{32}$"
                      },
                      "senderId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "recipientId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "threadId",
                      "connectionId",
                      "senderId",
                      "recipientId"
                    ],
                    "additionalProperties": false
                  },
                  "receiver": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "connection_binding"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "exact_binding"
                          },
                          "receiverBindingId": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                          },
                          "generation": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "receiverBindingId",
                          "generation"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "action",
                  "resource",
                  "receiver"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "management": {
          "type": "object",
          "properties": {
            "authorities": {
              "maxItems": 32,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "basis": {
                    "anyOf": [
                      {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "project_owner"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "ownerId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "version": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "projectId",
                              "ownerId",
                              "version"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "delegation"
                              },
                              "delegationId": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                              },
                              "parentGrantId": {
                                "type": "string",
                                "pattern": "^grt_[a-f0-9]{32}$"
                              },
                              "parentVersion": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "version": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "delegationId",
                              "version"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "grant"
                          },
                          "grantId": {
                            "type": "string",
                            "pattern": "^grt_[a-f0-9]{32}$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "grantId",
                          "version"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "actions": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "invite",
                        "approve",
                        "delegate",
                        "inspect",
                        "revoke_delegation"
                      ]
                    }
                  }
                },
                "required": [
                  "connectionId",
                  "basis",
                  "actions"
                ],
                "additionalProperties": false
              }
            },
            "invitations": {
              "maxItems": 32,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "invitationId": {
                    "type": "string",
                    "pattern": "^inv_[a-f0-9]{32}$"
                  },
                  "actions": {
                    "minItems": 1,
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "inspect",
                        "accept",
                        "decline"
                      ]
                    }
                  }
                },
                "required": [
                  "invitationId",
                  "actions"
                ],
                "additionalProperties": false
              }
            },
            "connections": {
              "maxItems": 32,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "actions": {
                    "minItems": 1,
                    "maxItems": 4,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "inspect",
                        "bind_self_route",
                        "configure_self_receiver",
                        "revoke_self_grant"
                      ]
                    }
                  }
                },
                "required": [
                  "connectionId",
                  "actions"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "invitations",
            "connections"
          ],
          "additionalProperties": false
        },
        "goalPermissions": {
          "maxItems": 32,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "goals.create",
                  "goals.read",
                  "goals.update",
                  "work.claim",
                  "work.report",
                  "work.transfer",
                  "work.release"
                ]
              },
              "resource": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.project_goals"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "messages.goal"
                      },
                      "organizationId": {
                        "type": "string",
                        "maxLength": 128,
                        "pattern": "^org_[A-Za-z0-9_-]+$"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "goalId": {
                        "type": "string",
                        "pattern": "^thr_[a-f0-9]{32}$"
                      }
                    },
                    "required": [
                      "kind",
                      "organizationId",
                      "projectId",
                      "goalId"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "required": [
              "action",
              "resource"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "schemaVersion",
        "credentialId",
        "generation",
        "organizationId",
        "subjectId",
        "audience",
        "expiresAtMs",
        "permissions"
      ],
      "additionalProperties": false
    },
    "error": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "invalid_request",
            "unauthorized",
            "not_found",
            "unsupported_organization",
            "unsupported_action",
            "permission_denied",
            "awaiting_identity_approval",
            "approval_required",
            "operation_conflict",
            "version_conflict",
            "ambiguous_connection",
            "route_unbound",
            "receiver_not_ready",
            "credential_expired",
            "credential_revoked",
            "grant_revoked",
            "outcome_unknown",
            "timeout",
            "unavailable"
          ]
        },
        "message": {
          "type": "string",
          "maxLength": 512
        },
        "retryable": {
          "type": "boolean"
        },
        "operationHandle": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "currentVersion": {
          "anyOf": [
            {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "expectedVersion": {
          "anyOf": [
            {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "retryAfterMs": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "nextOperations": {
          "maxItems": 16,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
          }
        }
      },
      "required": [
        "code",
        "message",
        "retryable",
        "operationHandle",
        "currentVersion",
        "expectedVersion",
        "retryAfterMs",
        "nextOperations"
      ],
      "additionalProperties": false
    },
    "delegation": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "string",
          "const": "dancer-access-delegation/v1"
        },
        "delegationId": {
          "type": "string",
          "pattern": "^del_[a-f0-9]{32}$"
        },
        "version": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "organizationId": {
          "type": "string",
          "maxLength": 128,
          "pattern": "^org_[A-Za-z0-9_-]+$"
        },
        "connectionId": {
          "type": "string",
          "pattern": "^con_[a-f0-9]{32}$"
        },
        "issuerId": {
          "type": "string",
          "pattern": "^agt_[a-z0-9]{16,64}$"
        },
        "delegateId": {
          "type": "string",
          "pattern": "^agt_[a-z0-9]{16,64}$"
        },
        "parent": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "project_owner"
                },
                "basis": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "project_owner"
                    },
                    "projectId": {
                      "type": "string",
                      "pattern": "^prj_[a-f0-9]{32}$"
                    },
                    "ownerId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "version": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "kind",
                    "projectId",
                    "ownerId",
                    "version"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "kind",
                "basis"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "grant"
                },
                "grantId": {
                  "type": "string",
                  "pattern": "^grt_[a-f0-9]{32}$"
                },
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "kind",
                "grantId",
                "version"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "delegation"
                },
                "delegationId": {
                  "type": "string",
                  "pattern": "^del_[a-f0-9]{32}$"
                },
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "kind",
                "delegationId",
                "version"
              ],
              "additionalProperties": false
            }
          ]
        },
        "root": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "project_owner"
            },
            "projectId": {
              "type": "string",
              "pattern": "^prj_[a-f0-9]{32}$"
            },
            "ownerId": {
              "type": "string",
              "pattern": "^agt_[a-z0-9]{16,64}$"
            },
            "version": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "kind",
            "projectId",
            "ownerId",
            "version"
          ],
          "additionalProperties": false
        },
        "edges": {
          "minItems": 1,
          "maxItems": 32,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "subjectId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "permission": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.send"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "action",
                      "resource"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.read_addressed"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "action",
                      "resource"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.reply"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "source": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_sources"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_source"
                              },
                              "sourceMessageId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              },
                              "conversationRootId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              }
                            },
                            "required": [
                              "kind",
                              "sourceMessageId",
                              "conversationRootId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "source"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.read_own_replies"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "source": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_sources"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_source"
                              },
                              "sourceMessageId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              },
                              "conversationRootId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              }
                            },
                            "required": [
                              "kind",
                              "sourceMessageId",
                              "conversationRootId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "source"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.read_history"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "history": {
                        "type": "object",
                        "properties": {
                          "fromSequence": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "through": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "live"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "sequence"
                                  },
                                  "sequence": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sequence"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "fromSequence",
                          "through"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "history"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.subscribe"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "referenceScope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_sources"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_source"
                              },
                              "sourceMessageId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              },
                              "conversationRootId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              }
                            },
                            "required": [
                              "kind",
                              "sourceMessageId",
                              "conversationRootId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "referenceScope"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.wake"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "receiver": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_binding"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_binding"
                              },
                              "receiverBindingId": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                              },
                              "generation": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "receiverBindingId",
                              "generation"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "receiver"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "required": [
              "subjectId",
              "permission"
            ],
            "additionalProperties": false
          }
        },
        "expiresAtMs": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "remainingDepth": {
          "type": "integer",
          "minimum": 0,
          "maximum": 7
        },
        "state": {
          "type": "string",
          "enum": [
            "active",
            "revoked"
          ]
        }
      },
      "required": [
        "schemaVersion",
        "delegationId",
        "version",
        "organizationId",
        "connectionId",
        "issuerId",
        "delegateId",
        "parent",
        "root",
        "edges",
        "expiresAtMs",
        "remainingDepth",
        "state"
      ],
      "additionalProperties": false
    },
    "receiverBinding": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "string",
          "const": "dancer-access-receiver/v1"
        },
        "version": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "identity": {
          "type": "object",
          "properties": {
            "organizationId": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^org_[A-Za-z0-9_-]+$"
            },
            "connectionId": {
              "type": "string",
              "pattern": "^con_[a-f0-9]{32}$"
            },
            "agentId": {
              "type": "string",
              "pattern": "^agt_[a-z0-9]{16,64}$"
            },
            "receiverBindingId": {
              "type": "string",
              "pattern": "^rcv_[a-f0-9]{32}$"
            },
            "enrollmentId": {
              "type": "string",
              "pattern": "^enr_[a-f0-9]{32}$"
            },
            "approvedKeyId": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43}$"
            },
            "bindingVersion": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "projectId": {
              "type": "string",
              "pattern": "^prj_[a-f0-9]{32}$"
            },
            "threadId": {
              "type": "string",
              "pattern": "^thr_[a-f0-9]{32}$"
            }
          },
          "required": [
            "organizationId",
            "connectionId",
            "agentId",
            "receiverBindingId",
            "enrollmentId",
            "approvedKeyId",
            "bindingVersion",
            "projectId",
            "threadId"
          ],
          "additionalProperties": false
        },
        "resource": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "messages.connection"
            },
            "organizationId": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^org_[A-Za-z0-9_-]+$"
            },
            "projectId": {
              "type": "string",
              "pattern": "^prj_[a-f0-9]{32}$"
            },
            "threadId": {
              "type": "string",
              "pattern": "^thr_[a-f0-9]{32}$"
            },
            "connectionId": {
              "type": "string",
              "pattern": "^con_[a-f0-9]{32}$"
            },
            "senderId": {
              "type": "string",
              "pattern": "^agt_[a-z0-9]{16,64}$"
            },
            "recipientId": {
              "type": "string",
              "pattern": "^agt_[a-z0-9]{16,64}$"
            }
          },
          "required": [
            "kind",
            "organizationId",
            "projectId",
            "threadId",
            "connectionId",
            "senderId",
            "recipientId"
          ],
          "additionalProperties": false
        },
        "adapter": {
          "type": "string",
          "enum": [
            "local_listener",
            "signed_http",
            "external_oauth"
          ]
        },
        "requested": {
          "type": "object",
          "properties": {
            "subscribe": {
              "type": "boolean"
            },
            "wake": {
              "type": "boolean"
            }
          },
          "required": [
            "subscribe",
            "wake"
          ],
          "additionalProperties": false
        },
        "subscriptionPermission": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "action": {
                  "type": "string",
                  "const": "messages.subscribe"
                },
                "resource": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "messages.connection"
                    },
                    "organizationId": {
                      "type": "string",
                      "maxLength": 128,
                      "pattern": "^org_[A-Za-z0-9_-]+$"
                    },
                    "projectId": {
                      "type": "string",
                      "pattern": "^prj_[a-f0-9]{32}$"
                    },
                    "threadId": {
                      "type": "string",
                      "pattern": "^thr_[a-f0-9]{32}$"
                    },
                    "connectionId": {
                      "type": "string",
                      "pattern": "^con_[a-f0-9]{32}$"
                    },
                    "senderId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "recipientId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    }
                  },
                  "required": [
                    "kind",
                    "organizationId",
                    "projectId",
                    "threadId",
                    "connectionId",
                    "senderId",
                    "recipientId"
                  ],
                  "additionalProperties": false
                },
                "referenceScope": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "connection_sources"
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "exact_source"
                        },
                        "sourceMessageId": {
                          "type": "string",
                          "pattern": "^msg_[a-f0-9]{32}$"
                        },
                        "conversationRootId": {
                          "type": "string",
                          "pattern": "^msg_[a-f0-9]{32}$"
                        }
                      },
                      "required": [
                        "kind",
                        "sourceMessageId",
                        "conversationRootId"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "required": [
                "action",
                "resource",
                "referenceScope"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "subscriptions": {
          "type": "object",
          "properties": {
            "subscribe": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^sub_[a-f0-9]{64}$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "wake": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^sub_[a-f0-9]{64}$"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "subscribe",
            "wake"
          ],
          "additionalProperties": false
        },
        "initialCursor": {
          "type": "string",
          "pattern": "^(?:0|[1-9][0-9]{0,15})$"
        },
        "expiresAtMs": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "state": {
          "type": "string",
          "enum": [
            "active",
            "paused",
            "revoked"
          ]
        }
      },
      "required": [
        "schemaVersion",
        "version",
        "identity",
        "resource",
        "adapter",
        "subscriptionPermission",
        "subscriptions",
        "initialCursor",
        "expiresAtMs",
        "state"
      ],
      "additionalProperties": false
    },
    "connectionSendReceipt": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "string",
          "const": "recipient-send/v2"
        },
        "operationId": {
          "type": "string",
          "pattern": "^rso_[a-f0-9]{32}$"
        },
        "messageId": {
          "type": "string",
          "pattern": "^msg_[a-f0-9]{32}$"
        },
        "messageSequence": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "recipientId": {
          "type": "string",
          "pattern": "^agt_[a-z0-9]{16,64}$"
        },
        "connectionId": {
          "type": "string",
          "pattern": "^con_[a-f0-9]{32}$"
        },
        "routeLabel": {
          "type": "string",
          "const": "Connection"
        },
        "routeVersion": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "visibility": {
          "type": "string",
          "const": "connection"
        },
        "replyLocator": {
          "type": "string",
          "pattern": "^rpl_[a-f0-9]{32}$"
        },
        "status": {
          "type": "string",
          "const": "stored"
        },
        "wake": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "const": "accepted"
                },
                "receiverBindingId": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                },
                "operationHandle": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
                }
              },
              "required": [
                "status",
                "receiverBindingId",
                "operationHandle"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "const": "partial"
                },
                "code": {
                  "type": "string",
                  "enum": [
                    "invalid_request",
                    "unauthorized",
                    "not_found",
                    "unsupported_organization",
                    "unsupported_action",
                    "permission_denied",
                    "awaiting_identity_approval",
                    "approval_required",
                    "operation_conflict",
                    "version_conflict",
                    "ambiguous_connection",
                    "route_unbound",
                    "receiver_not_ready",
                    "credential_expired",
                    "credential_revoked",
                    "grant_revoked",
                    "outcome_unknown",
                    "timeout",
                    "unavailable"
                  ]
                },
                "retryable": {
                  "type": "boolean"
                },
                "receiverBindingId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "operationHandle": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
                }
              },
              "required": [
                "status",
                "code",
                "retryable",
                "receiverBindingId",
                "operationHandle"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": [
        "schemaVersion",
        "operationId",
        "messageId",
        "messageSequence",
        "recipientId",
        "connectionId",
        "routeLabel",
        "routeVersion",
        "visibility",
        "replyLocator",
        "status"
      ],
      "additionalProperties": false
    },
    "connectionWakeOutcome": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "type": "string",
              "const": "accepted"
            },
            "receiverBindingId": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
            },
            "operationHandle": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
            }
          },
          "required": [
            "status",
            "receiverBindingId",
            "operationHandle"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "type": "string",
              "const": "partial"
            },
            "code": {
              "type": "string",
              "enum": [
                "invalid_request",
                "unauthorized",
                "not_found",
                "unsupported_organization",
                "unsupported_action",
                "permission_denied",
                "awaiting_identity_approval",
                "approval_required",
                "operation_conflict",
                "version_conflict",
                "ambiguous_connection",
                "route_unbound",
                "receiver_not_ready",
                "credential_expired",
                "credential_revoked",
                "grant_revoked",
                "outcome_unknown",
                "timeout",
                "unavailable"
              ]
            },
            "retryable": {
              "type": "boolean"
            },
            "receiverBindingId": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "operationHandle": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
            }
          },
          "required": [
            "status",
            "code",
            "retryable",
            "receiverBindingId",
            "operationHandle"
          ],
          "additionalProperties": false
        }
      ]
    }
  },
  "presets": {
    "notify": [
      "messages.send",
      "messages.read_addressed"
    ],
    "ask": [
      "messages.send",
      "messages.read_addressed",
      "messages.reply",
      "messages.read_own_replies"
    ]
  },
  "operations": {
    "create_delegation": {
      "method": "POST",
      "path": "/v1/access/delegations",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "connectionId": {
            "type": "string",
            "pattern": "^con_[a-f0-9]{32}$"
          },
          "delegateId": {
            "type": "string",
            "pattern": "^agt_[a-z0-9]{16,64}$"
          },
          "parent": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "project_owner"
                  },
                  "basis": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "project_owner"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "ownerId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "projectId",
                      "ownerId",
                      "version"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "kind",
                  "basis"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "grant"
                  },
                  "grantId": {
                    "type": "string",
                    "pattern": "^grt_[a-f0-9]{32}$"
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "grantId",
                  "version"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "delegation"
                  },
                  "delegationId": {
                    "type": "string",
                    "pattern": "^del_[a-f0-9]{32}$"
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "delegationId",
                  "version"
                ],
                "additionalProperties": false
              }
            ]
          },
          "edges": {
            "minItems": 1,
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "subjectId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "permission": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.send"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "action",
                        "resource"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.read_addressed"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "action",
                        "resource"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.reply"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        },
                        "source": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "connection_sources"
                                }
                              },
                              "required": [
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "exact_source"
                                },
                                "sourceMessageId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                },
                                "conversationRootId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                }
                              },
                              "required": [
                                "kind",
                                "sourceMessageId",
                                "conversationRootId"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "action",
                        "resource",
                        "source"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.read_own_replies"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        },
                        "source": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "connection_sources"
                                }
                              },
                              "required": [
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "exact_source"
                                },
                                "sourceMessageId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                },
                                "conversationRootId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                }
                              },
                              "required": [
                                "kind",
                                "sourceMessageId",
                                "conversationRootId"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "action",
                        "resource",
                        "source"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.read_history"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        },
                        "history": {
                          "type": "object",
                          "properties": {
                            "fromSequence": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "through": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "live"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "sequence"
                                    },
                                    "sequence": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sequence"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "fromSequence",
                            "through"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "action",
                        "resource",
                        "history"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.subscribe"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        },
                        "referenceScope": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "connection_sources"
                                }
                              },
                              "required": [
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "exact_source"
                                },
                                "sourceMessageId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                },
                                "conversationRootId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                }
                              },
                              "required": [
                                "kind",
                                "sourceMessageId",
                                "conversationRootId"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "action",
                        "resource",
                        "referenceScope"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.wake"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        },
                        "receiver": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "connection_binding"
                                }
                              },
                              "required": [
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "exact_binding"
                                },
                                "receiverBindingId": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                },
                                "generation": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "kind",
                                "receiverBindingId",
                                "generation"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "action",
                        "resource",
                        "receiver"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "required": [
                "subjectId",
                "permission"
              ],
              "additionalProperties": false
            }
          },
          "expiresAtMs": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "remainingDepth": {
            "type": "integer",
            "minimum": 0,
            "maximum": 7
          },
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          }
        },
        "required": [
          "connectionId",
          "delegateId",
          "parent",
          "edges",
          "expiresAtMs",
          "remainingDepth",
          "operationKey"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "delegation": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "const": "dancer-access-delegation/v1"
              },
              "delegationId": {
                "type": "string",
                "pattern": "^del_[a-f0-9]{32}$"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "organizationId": {
                "type": "string",
                "maxLength": 128,
                "pattern": "^org_[A-Za-z0-9_-]+$"
              },
              "connectionId": {
                "type": "string",
                "pattern": "^con_[a-f0-9]{32}$"
              },
              "issuerId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "delegateId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "parent": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "project_owner"
                      },
                      "basis": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "project_owner"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "ownerId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "projectId",
                          "ownerId",
                          "version"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "kind",
                      "basis"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "grant"
                      },
                      "grantId": {
                        "type": "string",
                        "pattern": "^grt_[a-f0-9]{32}$"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "grantId",
                      "version"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "delegation"
                      },
                      "delegationId": {
                        "type": "string",
                        "pattern": "^del_[a-f0-9]{32}$"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "delegationId",
                      "version"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "root": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "project_owner"
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "ownerId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "projectId",
                  "ownerId",
                  "version"
                ],
                "additionalProperties": false
              },
              "edges": {
                "minItems": 1,
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "subjectId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "permission": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.send"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_addressed"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.reply"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_own_replies"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_history"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "history": {
                              "type": "object",
                              "properties": {
                                "fromSequence": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "through": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "live"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "sequence"
                                        },
                                        "sequence": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sequence"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "fromSequence",
                                "through"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "history"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.subscribe"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "referenceScope": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "referenceScope"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.wake"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "receiver": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_binding"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_binding"
                                    },
                                    "receiverBindingId": {
                                      "type": "string",
                                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                    },
                                    "generation": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "receiverBindingId",
                                    "generation"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "receiver"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "subjectId",
                    "permission"
                  ],
                  "additionalProperties": false
                }
              },
              "expiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "remainingDepth": {
                "type": "integer",
                "minimum": 0,
                "maximum": 7
              },
              "state": {
                "type": "string",
                "enum": [
                  "active",
                  "revoked"
                ]
              }
            },
            "required": [
              "schemaVersion",
              "delegationId",
              "version",
              "organizationId",
              "connectionId",
              "issuerId",
              "delegateId",
              "parent",
              "root",
              "edges",
              "expiresAtMs",
              "remainingDepth",
              "state"
            ],
            "additionalProperties": false
          },
          "currentState": {
            "type": "string",
            "enum": [
              "active",
              "revoked",
              "expired",
              "suspended",
              "unavailable"
            ]
          },
          "ok": {
            "type": "boolean",
            "const": true
          },
          "outcome": {
            "type": "object",
            "properties": {
              "delegation": {
                "type": "object",
                "properties": {
                  "schemaVersion": {
                    "type": "string",
                    "const": "dancer-access-delegation/v1"
                  },
                  "delegationId": {
                    "type": "string",
                    "pattern": "^del_[a-f0-9]{32}$"
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "issuerId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "delegateId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "parent": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "project_owner"
                          },
                          "basis": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "project_owner"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "ownerId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "version": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "projectId",
                              "ownerId",
                              "version"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "kind",
                          "basis"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "grant"
                          },
                          "grantId": {
                            "type": "string",
                            "pattern": "^grt_[a-f0-9]{32}$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "grantId",
                          "version"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "delegation"
                          },
                          "delegationId": {
                            "type": "string",
                            "pattern": "^del_[a-f0-9]{32}$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "delegationId",
                          "version"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "root": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "project_owner"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "ownerId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "projectId",
                      "ownerId",
                      "version"
                    ],
                    "additionalProperties": false
                  },
                  "edges": {
                    "minItems": 1,
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "subjectId": {
                          "type": "string",
                          "pattern": "^agt_[a-z0-9]{16,64}$"
                        },
                        "permission": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.send"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "action",
                                "resource"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.read_addressed"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "action",
                                "resource"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.reply"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "source": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_sources"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_source"
                                        },
                                        "sourceMessageId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        },
                                        "conversationRootId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sourceMessageId",
                                        "conversationRootId"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "source"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.read_own_replies"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "source": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_sources"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_source"
                                        },
                                        "sourceMessageId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        },
                                        "conversationRootId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sourceMessageId",
                                        "conversationRootId"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "source"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.read_history"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "history": {
                                  "type": "object",
                                  "properties": {
                                    "fromSequence": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "through": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "live"
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "sequence"
                                            },
                                            "sequence": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 9007199254740991
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "sequence"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "fromSequence",
                                    "through"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "history"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.subscribe"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "referenceScope": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_sources"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_source"
                                        },
                                        "sourceMessageId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        },
                                        "conversationRootId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sourceMessageId",
                                        "conversationRootId"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "referenceScope"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.wake"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "receiver": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_binding"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_binding"
                                        },
                                        "receiverBindingId": {
                                          "type": "string",
                                          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                        },
                                        "generation": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "receiverBindingId",
                                        "generation"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "receiver"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "subjectId",
                        "permission"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "expiresAtMs": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "remainingDepth": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 7
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "active",
                      "revoked"
                    ]
                  }
                },
                "required": [
                  "schemaVersion",
                  "delegationId",
                  "version",
                  "organizationId",
                  "connectionId",
                  "issuerId",
                  "delegateId",
                  "parent",
                  "root",
                  "edges",
                  "expiresAtMs",
                  "remainingDepth",
                  "state"
                ],
                "additionalProperties": false
              },
              "idempotentReplay": {
                "type": "boolean"
              }
            },
            "required": [
              "delegation",
              "idempotentReplay"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "delegation",
          "currentState",
          "ok"
        ],
        "additionalProperties": false
      }
    },
    "list_delegations": {
      "method": "GET",
      "path": "/v1/access/delegations",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "role": {
            "default": "either",
            "type": "string",
            "enum": [
              "issuer",
              "delegate",
              "either",
              "owner"
            ]
          },
          "connectionId": {
            "type": "string",
            "pattern": "^con_[a-f0-9]{32}$"
          },
          "projectId": {
            "type": "string",
            "pattern": "^prj_[a-f0-9]{32}$"
          },
          "threadId": {
            "type": "string",
            "pattern": "^thr_[a-f0-9]{32}$"
          },
          "cursor": {
            "type": "string",
            "pattern": "^del_[a-f0-9]{32}$"
          },
          "limit": {
            "default": 50,
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          }
        },
        "required": [
          "role",
          "limit"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "delegations": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "delegation": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": {
                      "type": "string",
                      "const": "dancer-access-delegation/v1"
                    },
                    "delegationId": {
                      "type": "string",
                      "pattern": "^del_[a-f0-9]{32}$"
                    },
                    "version": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "organizationId": {
                      "type": "string",
                      "maxLength": 128,
                      "pattern": "^org_[A-Za-z0-9_-]+$"
                    },
                    "connectionId": {
                      "type": "string",
                      "pattern": "^con_[a-f0-9]{32}$"
                    },
                    "issuerId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "delegateId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "parent": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "project_owner"
                            },
                            "basis": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "project_owner"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "ownerId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "version": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "kind",
                                "projectId",
                                "ownerId",
                                "version"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "kind",
                            "basis"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "grant"
                            },
                            "grantId": {
                              "type": "string",
                              "pattern": "^grt_[a-f0-9]{32}$"
                            },
                            "version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "kind",
                            "grantId",
                            "version"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "delegation"
                            },
                            "delegationId": {
                              "type": "string",
                              "pattern": "^del_[a-f0-9]{32}$"
                            },
                            "version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "kind",
                            "delegationId",
                            "version"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "root": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "project_owner"
                        },
                        "projectId": {
                          "type": "string",
                          "pattern": "^prj_[a-f0-9]{32}$"
                        },
                        "ownerId": {
                          "type": "string",
                          "pattern": "^agt_[a-z0-9]{16,64}$"
                        },
                        "version": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "projectId",
                        "ownerId",
                        "version"
                      ],
                      "additionalProperties": false
                    },
                    "edges": {
                      "minItems": 1,
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "subjectId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "permission": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.send"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.read_addressed"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.reply"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_sources"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_source"
                                          },
                                          "sourceMessageId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          },
                                          "conversationRootId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "sourceMessageId",
                                          "conversationRootId"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "source"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.read_own_replies"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_sources"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_source"
                                          },
                                          "sourceMessageId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          },
                                          "conversationRootId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "sourceMessageId",
                                          "conversationRootId"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "source"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.read_history"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "history": {
                                    "type": "object",
                                    "properties": {
                                      "fromSequence": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "through": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "live"
                                              }
                                            },
                                            "required": [
                                              "kind"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "sequence"
                                              },
                                              "sequence": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "sequence"
                                            ],
                                            "additionalProperties": false
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "fromSequence",
                                      "through"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "history"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.subscribe"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "referenceScope": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_sources"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_source"
                                          },
                                          "sourceMessageId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          },
                                          "conversationRootId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "sourceMessageId",
                                          "conversationRootId"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "referenceScope"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.wake"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "receiver": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_binding"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_binding"
                                          },
                                          "receiverBindingId": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                          },
                                          "generation": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "receiverBindingId",
                                          "generation"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "receiver"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "subjectId",
                          "permission"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "expiresAtMs": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "remainingDepth": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 7
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "active",
                        "revoked"
                      ]
                    }
                  },
                  "required": [
                    "schemaVersion",
                    "delegationId",
                    "version",
                    "organizationId",
                    "connectionId",
                    "issuerId",
                    "delegateId",
                    "parent",
                    "root",
                    "edges",
                    "expiresAtMs",
                    "remainingDepth",
                    "state"
                  ],
                  "additionalProperties": false
                },
                "currentState": {
                  "type": "string",
                  "enum": [
                    "active",
                    "revoked",
                    "expired",
                    "suspended",
                    "unavailable"
                  ]
                }
              },
              "required": [
                "delegation",
                "currentState"
              ],
              "additionalProperties": false
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^del_[a-f0-9]{32}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "ok",
          "delegations",
          "nextCursor"
        ],
        "additionalProperties": false
      }
    },
    "inspect_delegation": {
      "method": "GET",
      "path": "/v1/access/delegations/{delegationId}",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "delegation": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "const": "dancer-access-delegation/v1"
              },
              "delegationId": {
                "type": "string",
                "pattern": "^del_[a-f0-9]{32}$"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "organizationId": {
                "type": "string",
                "maxLength": 128,
                "pattern": "^org_[A-Za-z0-9_-]+$"
              },
              "connectionId": {
                "type": "string",
                "pattern": "^con_[a-f0-9]{32}$"
              },
              "issuerId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "delegateId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "parent": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "project_owner"
                      },
                      "basis": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "project_owner"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "ownerId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "projectId",
                          "ownerId",
                          "version"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "kind",
                      "basis"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "grant"
                      },
                      "grantId": {
                        "type": "string",
                        "pattern": "^grt_[a-f0-9]{32}$"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "grantId",
                      "version"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "delegation"
                      },
                      "delegationId": {
                        "type": "string",
                        "pattern": "^del_[a-f0-9]{32}$"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "delegationId",
                      "version"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "root": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "project_owner"
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "ownerId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "projectId",
                  "ownerId",
                  "version"
                ],
                "additionalProperties": false
              },
              "edges": {
                "minItems": 1,
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "subjectId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "permission": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.send"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_addressed"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.reply"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_own_replies"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_history"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "history": {
                              "type": "object",
                              "properties": {
                                "fromSequence": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "through": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "live"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "sequence"
                                        },
                                        "sequence": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sequence"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "fromSequence",
                                "through"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "history"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.subscribe"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "referenceScope": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "referenceScope"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.wake"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "receiver": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_binding"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_binding"
                                    },
                                    "receiverBindingId": {
                                      "type": "string",
                                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                    },
                                    "generation": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "receiverBindingId",
                                    "generation"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "receiver"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "subjectId",
                    "permission"
                  ],
                  "additionalProperties": false
                }
              },
              "expiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "remainingDepth": {
                "type": "integer",
                "minimum": 0,
                "maximum": 7
              },
              "state": {
                "type": "string",
                "enum": [
                  "active",
                  "revoked"
                ]
              }
            },
            "required": [
              "schemaVersion",
              "delegationId",
              "version",
              "organizationId",
              "connectionId",
              "issuerId",
              "delegateId",
              "parent",
              "root",
              "edges",
              "expiresAtMs",
              "remainingDepth",
              "state"
            ],
            "additionalProperties": false
          },
          "currentState": {
            "type": "string",
            "enum": [
              "active",
              "revoked",
              "expired",
              "suspended",
              "unavailable"
            ]
          },
          "ok": {
            "type": "boolean",
            "const": true
          },
          "outcome": {
            "type": "object",
            "properties": {
              "delegation": {
                "type": "object",
                "properties": {
                  "schemaVersion": {
                    "type": "string",
                    "const": "dancer-access-delegation/v1"
                  },
                  "delegationId": {
                    "type": "string",
                    "pattern": "^del_[a-f0-9]{32}$"
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "issuerId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "delegateId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "parent": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "project_owner"
                          },
                          "basis": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "project_owner"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "ownerId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "version": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "projectId",
                              "ownerId",
                              "version"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "kind",
                          "basis"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "grant"
                          },
                          "grantId": {
                            "type": "string",
                            "pattern": "^grt_[a-f0-9]{32}$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "grantId",
                          "version"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "delegation"
                          },
                          "delegationId": {
                            "type": "string",
                            "pattern": "^del_[a-f0-9]{32}$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "delegationId",
                          "version"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "root": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "project_owner"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "ownerId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "projectId",
                      "ownerId",
                      "version"
                    ],
                    "additionalProperties": false
                  },
                  "edges": {
                    "minItems": 1,
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "subjectId": {
                          "type": "string",
                          "pattern": "^agt_[a-z0-9]{16,64}$"
                        },
                        "permission": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.send"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "action",
                                "resource"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.read_addressed"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "action",
                                "resource"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.reply"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "source": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_sources"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_source"
                                        },
                                        "sourceMessageId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        },
                                        "conversationRootId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sourceMessageId",
                                        "conversationRootId"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "source"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.read_own_replies"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "source": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_sources"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_source"
                                        },
                                        "sourceMessageId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        },
                                        "conversationRootId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sourceMessageId",
                                        "conversationRootId"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "source"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.read_history"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "history": {
                                  "type": "object",
                                  "properties": {
                                    "fromSequence": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "through": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "live"
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "sequence"
                                            },
                                            "sequence": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 9007199254740991
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "sequence"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "fromSequence",
                                    "through"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "history"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.subscribe"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "referenceScope": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_sources"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_source"
                                        },
                                        "sourceMessageId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        },
                                        "conversationRootId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sourceMessageId",
                                        "conversationRootId"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "referenceScope"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.wake"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "receiver": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_binding"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_binding"
                                        },
                                        "receiverBindingId": {
                                          "type": "string",
                                          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                        },
                                        "generation": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "receiverBindingId",
                                        "generation"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "receiver"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "subjectId",
                        "permission"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "expiresAtMs": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "remainingDepth": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 7
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "active",
                      "revoked"
                    ]
                  }
                },
                "required": [
                  "schemaVersion",
                  "delegationId",
                  "version",
                  "organizationId",
                  "connectionId",
                  "issuerId",
                  "delegateId",
                  "parent",
                  "root",
                  "edges",
                  "expiresAtMs",
                  "remainingDepth",
                  "state"
                ],
                "additionalProperties": false
              },
              "idempotentReplay": {
                "type": "boolean"
              }
            },
            "required": [
              "delegation",
              "idempotentReplay"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "delegation",
          "currentState",
          "ok"
        ],
        "additionalProperties": false
      }
    },
    "revoke_delegation": {
      "method": "POST",
      "path": "/v1/access/delegations/{delegationId}/revoke",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          },
          "expectedVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "operationKey",
          "expectedVersion"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "delegation": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "const": "dancer-access-delegation/v1"
              },
              "delegationId": {
                "type": "string",
                "pattern": "^del_[a-f0-9]{32}$"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "organizationId": {
                "type": "string",
                "maxLength": 128,
                "pattern": "^org_[A-Za-z0-9_-]+$"
              },
              "connectionId": {
                "type": "string",
                "pattern": "^con_[a-f0-9]{32}$"
              },
              "issuerId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "delegateId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "parent": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "project_owner"
                      },
                      "basis": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "project_owner"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "ownerId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "projectId",
                          "ownerId",
                          "version"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "kind",
                      "basis"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "grant"
                      },
                      "grantId": {
                        "type": "string",
                        "pattern": "^grt_[a-f0-9]{32}$"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "grantId",
                      "version"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "delegation"
                      },
                      "delegationId": {
                        "type": "string",
                        "pattern": "^del_[a-f0-9]{32}$"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "delegationId",
                      "version"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "root": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "project_owner"
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "ownerId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "projectId",
                  "ownerId",
                  "version"
                ],
                "additionalProperties": false
              },
              "edges": {
                "minItems": 1,
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "subjectId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "permission": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.send"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_addressed"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.reply"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_own_replies"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_history"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "history": {
                              "type": "object",
                              "properties": {
                                "fromSequence": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "through": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "live"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "sequence"
                                        },
                                        "sequence": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sequence"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "fromSequence",
                                "through"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "history"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.subscribe"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "referenceScope": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "referenceScope"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.wake"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "receiver": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_binding"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_binding"
                                    },
                                    "receiverBindingId": {
                                      "type": "string",
                                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                    },
                                    "generation": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "receiverBindingId",
                                    "generation"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "receiver"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "subjectId",
                    "permission"
                  ],
                  "additionalProperties": false
                }
              },
              "expiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "remainingDepth": {
                "type": "integer",
                "minimum": 0,
                "maximum": 7
              },
              "state": {
                "type": "string",
                "enum": [
                  "active",
                  "revoked"
                ]
              }
            },
            "required": [
              "schemaVersion",
              "delegationId",
              "version",
              "organizationId",
              "connectionId",
              "issuerId",
              "delegateId",
              "parent",
              "root",
              "edges",
              "expiresAtMs",
              "remainingDepth",
              "state"
            ],
            "additionalProperties": false
          },
          "currentState": {
            "type": "string",
            "enum": [
              "active",
              "revoked",
              "expired",
              "suspended",
              "unavailable"
            ]
          },
          "ok": {
            "type": "boolean",
            "const": true
          },
          "outcome": {
            "type": "object",
            "properties": {
              "delegation": {
                "type": "object",
                "properties": {
                  "schemaVersion": {
                    "type": "string",
                    "const": "dancer-access-delegation/v1"
                  },
                  "delegationId": {
                    "type": "string",
                    "pattern": "^del_[a-f0-9]{32}$"
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "issuerId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "delegateId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "parent": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "project_owner"
                          },
                          "basis": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "project_owner"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "ownerId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "version": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "kind",
                              "projectId",
                              "ownerId",
                              "version"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "kind",
                          "basis"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "grant"
                          },
                          "grantId": {
                            "type": "string",
                            "pattern": "^grt_[a-f0-9]{32}$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "grantId",
                          "version"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "delegation"
                          },
                          "delegationId": {
                            "type": "string",
                            "pattern": "^del_[a-f0-9]{32}$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "delegationId",
                          "version"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "root": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "project_owner"
                      },
                      "projectId": {
                        "type": "string",
                        "pattern": "^prj_[a-f0-9]{32}$"
                      },
                      "ownerId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "projectId",
                      "ownerId",
                      "version"
                    ],
                    "additionalProperties": false
                  },
                  "edges": {
                    "minItems": 1,
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "subjectId": {
                          "type": "string",
                          "pattern": "^agt_[a-z0-9]{16,64}$"
                        },
                        "permission": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.send"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "action",
                                "resource"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.read_addressed"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "action",
                                "resource"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.reply"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "source": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_sources"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_source"
                                        },
                                        "sourceMessageId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        },
                                        "conversationRootId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sourceMessageId",
                                        "conversationRootId"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "source"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.read_own_replies"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "source": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_sources"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_source"
                                        },
                                        "sourceMessageId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        },
                                        "conversationRootId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sourceMessageId",
                                        "conversationRootId"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "source"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.read_history"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "history": {
                                  "type": "object",
                                  "properties": {
                                    "fromSequence": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "through": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "live"
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "sequence"
                                            },
                                            "sequence": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 9007199254740991
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "sequence"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "fromSequence",
                                    "through"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "history"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.subscribe"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "referenceScope": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_sources"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_source"
                                        },
                                        "sourceMessageId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        },
                                        "conversationRootId": {
                                          "type": "string",
                                          "pattern": "^msg_[a-f0-9]{32}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sourceMessageId",
                                        "conversationRootId"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "referenceScope"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "const": "messages.wake"
                                },
                                "resource": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "messages.connection"
                                    },
                                    "organizationId": {
                                      "type": "string",
                                      "maxLength": 128,
                                      "pattern": "^org_[A-Za-z0-9_-]+$"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "threadId": {
                                      "type": "string",
                                      "pattern": "^thr_[a-f0-9]{32}$"
                                    },
                                    "connectionId": {
                                      "type": "string",
                                      "pattern": "^con_[a-f0-9]{32}$"
                                    },
                                    "senderId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "recipientId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "organizationId",
                                    "projectId",
                                    "threadId",
                                    "connectionId",
                                    "senderId",
                                    "recipientId"
                                  ],
                                  "additionalProperties": false
                                },
                                "receiver": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "connection_binding"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "exact_binding"
                                        },
                                        "receiverBindingId": {
                                          "type": "string",
                                          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                        },
                                        "generation": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "receiverBindingId",
                                        "generation"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "action",
                                "resource",
                                "receiver"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "subjectId",
                        "permission"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "expiresAtMs": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "remainingDepth": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 7
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "active",
                      "revoked"
                    ]
                  }
                },
                "required": [
                  "schemaVersion",
                  "delegationId",
                  "version",
                  "organizationId",
                  "connectionId",
                  "issuerId",
                  "delegateId",
                  "parent",
                  "root",
                  "edges",
                  "expiresAtMs",
                  "remainingDepth",
                  "state"
                ],
                "additionalProperties": false
              },
              "idempotentReplay": {
                "type": "boolean"
              }
            },
            "required": [
              "delegation",
              "idempotentReplay"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "delegation",
          "currentState",
          "ok"
        ],
        "additionalProperties": false
      }
    },
    "register_receiver": {
      "method": "POST",
      "path": "/v1/access/receivers",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "adapter": {
                "type": "string",
                "const": "local_listener"
              },
              "operationKey": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
              },
              "connectionId": {
                "type": "string",
                "pattern": "^con_[a-f0-9]{32}$"
              },
              "projectId": {
                "type": "string",
                "pattern": "^prj_[a-f0-9]{32}$"
              },
              "threadId": {
                "type": "string",
                "pattern": "^thr_[a-f0-9]{32}$"
              },
              "subscribe": {
                "type": "boolean"
              },
              "wake": {
                "type": "boolean"
              },
              "expiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "adapter",
              "operationKey",
              "connectionId",
              "projectId",
              "threadId",
              "subscribe",
              "wake",
              "expiresAtMs"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "adapter": {
                "type": "string",
                "const": "signed_http"
              },
              "operationKey": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
              },
              "connectionId": {
                "type": "string",
                "pattern": "^con_[a-f0-9]{32}$"
              },
              "projectId": {
                "type": "string",
                "pattern": "^prj_[a-f0-9]{32}$"
              },
              "threadId": {
                "type": "string",
                "pattern": "^thr_[a-f0-9]{32}$"
              },
              "subscribe": {
                "type": "boolean"
              },
              "wake": {
                "type": "boolean"
              },
              "expiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "callbackUrl": {
                "type": "string",
                "maxLength": 2048,
                "format": "uri"
              },
              "callbackSecret": {
                "type": "string",
                "minLength": 38,
                "maxLength": 94,
                "pattern": "^whsec_.*"
              }
            },
            "required": [
              "adapter",
              "operationKey",
              "connectionId",
              "projectId",
              "threadId",
              "subscribe",
              "wake",
              "expiresAtMs",
              "callbackUrl",
              "callbackSecret"
            ],
            "additionalProperties": false
          }
        ]
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "schemaVersion": {
            "type": "string",
            "const": "dancer-access/v1"
          },
          "binding": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "const": "dancer-access-receiver/v1"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "identity": {
                "type": "object",
                "properties": {
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "agentId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "receiverBindingId": {
                    "type": "string",
                    "pattern": "^rcv_[a-f0-9]{32}$"
                  },
                  "enrollmentId": {
                    "type": "string",
                    "pattern": "^enr_[a-f0-9]{32}$"
                  },
                  "approvedKeyId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{43}$"
                  },
                  "bindingVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "threadId": {
                    "type": "string",
                    "pattern": "^thr_[a-f0-9]{32}$"
                  }
                },
                "required": [
                  "organizationId",
                  "connectionId",
                  "agentId",
                  "receiverBindingId",
                  "enrollmentId",
                  "approvedKeyId",
                  "bindingVersion",
                  "projectId",
                  "threadId"
                ],
                "additionalProperties": false
              },
              "resource": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "messages.connection"
                  },
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "threadId": {
                    "type": "string",
                    "pattern": "^thr_[a-f0-9]{32}$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "senderId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "recipientId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  }
                },
                "required": [
                  "kind",
                  "organizationId",
                  "projectId",
                  "threadId",
                  "connectionId",
                  "senderId",
                  "recipientId"
                ],
                "additionalProperties": false
              },
              "adapter": {
                "type": "string",
                "enum": [
                  "local_listener",
                  "signed_http",
                  "external_oauth"
                ]
              },
              "requested": {
                "type": "object",
                "properties": {
                  "subscribe": {
                    "type": "boolean"
                  },
                  "wake": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "subscribe",
                  "wake"
                ],
                "additionalProperties": false
              },
              "subscriptionPermission": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.subscribe"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "referenceScope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_sources"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_source"
                              },
                              "sourceMessageId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              },
                              "conversationRootId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              }
                            },
                            "required": [
                              "kind",
                              "sourceMessageId",
                              "conversationRootId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "referenceScope"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subscriptions": {
                "type": "object",
                "properties": {
                  "subscribe": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "wake": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "subscribe",
                  "wake"
                ],
                "additionalProperties": false
              },
              "initialCursor": {
                "type": "string",
                "pattern": "^(?:0|[1-9][0-9]{0,15})$"
              },
              "expiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "state": {
                "type": "string",
                "enum": [
                  "active",
                  "paused",
                  "revoked"
                ]
              }
            },
            "required": [
              "schemaVersion",
              "version",
              "identity",
              "resource",
              "adapter",
              "subscriptionPermission",
              "subscriptions",
              "initialCursor",
              "expiresAtMs",
              "state"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "pending",
              "partial"
            ]
          },
          "readiness": {
            "type": "object",
            "properties": {
              "authorization": {
                "type": "string",
                "enum": [
                  "pending_activation",
                  "active",
                  "suspended",
                  "revoked",
                  "expired"
                ]
              },
              "installation": {
                "type": "string",
                "enum": [
                  "not_installed",
                  "installing",
                  "installed",
                  "failed"
                ]
              },
              "route": {
                "type": "string",
                "enum": [
                  "unbound",
                  "bound",
                  "paused",
                  "revoked"
                ]
              },
              "subscription": {
                "type": "string",
                "enum": [
                  "not_requested",
                  "pending",
                  "active",
                  "paused",
                  "revoked"
                ]
              },
              "receiver": {
                "type": "string",
                "enum": [
                  "not_requested",
                  "unconfigured",
                  "registering",
                  "ready",
                  "expired",
                  "paused",
                  "revoked",
                  "failed"
                ]
              }
            },
            "required": [
              "authorization",
              "installation",
              "route",
              "subscription",
              "receiver"
            ],
            "additionalProperties": false
          },
          "capability": {
            "type": "string",
            "enum": [
              "browserless_api",
              "existing_configuration_only",
              "unsupported_external_provisioning"
            ]
          },
          "idempotentReplay": {
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "schemaVersion",
          "binding",
          "status",
          "readiness",
          "capability"
        ],
        "additionalProperties": false
      }
    },
    "inspect_receiver": {
      "method": "GET",
      "path": "/v1/access/receivers/{receiverBindingId}",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "schemaVersion": {
            "type": "string",
            "const": "dancer-access/v1"
          },
          "binding": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "const": "dancer-access-receiver/v1"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "identity": {
                "type": "object",
                "properties": {
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "agentId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "receiverBindingId": {
                    "type": "string",
                    "pattern": "^rcv_[a-f0-9]{32}$"
                  },
                  "enrollmentId": {
                    "type": "string",
                    "pattern": "^enr_[a-f0-9]{32}$"
                  },
                  "approvedKeyId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{43}$"
                  },
                  "bindingVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "threadId": {
                    "type": "string",
                    "pattern": "^thr_[a-f0-9]{32}$"
                  }
                },
                "required": [
                  "organizationId",
                  "connectionId",
                  "agentId",
                  "receiverBindingId",
                  "enrollmentId",
                  "approvedKeyId",
                  "bindingVersion",
                  "projectId",
                  "threadId"
                ],
                "additionalProperties": false
              },
              "resource": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "messages.connection"
                  },
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "threadId": {
                    "type": "string",
                    "pattern": "^thr_[a-f0-9]{32}$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "senderId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "recipientId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  }
                },
                "required": [
                  "kind",
                  "organizationId",
                  "projectId",
                  "threadId",
                  "connectionId",
                  "senderId",
                  "recipientId"
                ],
                "additionalProperties": false
              },
              "adapter": {
                "type": "string",
                "enum": [
                  "local_listener",
                  "signed_http",
                  "external_oauth"
                ]
              },
              "requested": {
                "type": "object",
                "properties": {
                  "subscribe": {
                    "type": "boolean"
                  },
                  "wake": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "subscribe",
                  "wake"
                ],
                "additionalProperties": false
              },
              "subscriptionPermission": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.subscribe"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "referenceScope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_sources"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_source"
                              },
                              "sourceMessageId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              },
                              "conversationRootId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              }
                            },
                            "required": [
                              "kind",
                              "sourceMessageId",
                              "conversationRootId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "referenceScope"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subscriptions": {
                "type": "object",
                "properties": {
                  "subscribe": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "wake": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "subscribe",
                  "wake"
                ],
                "additionalProperties": false
              },
              "initialCursor": {
                "type": "string",
                "pattern": "^(?:0|[1-9][0-9]{0,15})$"
              },
              "expiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "state": {
                "type": "string",
                "enum": [
                  "active",
                  "paused",
                  "revoked"
                ]
              }
            },
            "required": [
              "schemaVersion",
              "version",
              "identity",
              "resource",
              "adapter",
              "subscriptionPermission",
              "subscriptions",
              "initialCursor",
              "expiresAtMs",
              "state"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "pending",
              "partial"
            ]
          },
          "readiness": {
            "type": "object",
            "properties": {
              "authorization": {
                "type": "string",
                "enum": [
                  "pending_activation",
                  "active",
                  "suspended",
                  "revoked",
                  "expired"
                ]
              },
              "installation": {
                "type": "string",
                "enum": [
                  "not_installed",
                  "installing",
                  "installed",
                  "failed"
                ]
              },
              "route": {
                "type": "string",
                "enum": [
                  "unbound",
                  "bound",
                  "paused",
                  "revoked"
                ]
              },
              "subscription": {
                "type": "string",
                "enum": [
                  "not_requested",
                  "pending",
                  "active",
                  "paused",
                  "revoked"
                ]
              },
              "receiver": {
                "type": "string",
                "enum": [
                  "not_requested",
                  "unconfigured",
                  "registering",
                  "ready",
                  "expired",
                  "paused",
                  "revoked",
                  "failed"
                ]
              }
            },
            "required": [
              "authorization",
              "installation",
              "route",
              "subscription",
              "receiver"
            ],
            "additionalProperties": false
          },
          "capability": {
            "type": "string",
            "enum": [
              "browserless_api",
              "existing_configuration_only",
              "unsupported_external_provisioning"
            ]
          },
          "idempotentReplay": {
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "schemaVersion",
          "binding",
          "status",
          "readiness",
          "capability"
        ],
        "additionalProperties": false
      }
    },
    "pause_receiver": {
      "method": "POST",
      "path": "/v1/access/receivers/{receiverBindingId}/pause",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          },
          "expectedVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "operationKey",
          "expectedVersion"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "schemaVersion": {
            "type": "string",
            "const": "dancer-access/v1"
          },
          "binding": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "const": "dancer-access-receiver/v1"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "identity": {
                "type": "object",
                "properties": {
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "agentId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "receiverBindingId": {
                    "type": "string",
                    "pattern": "^rcv_[a-f0-9]{32}$"
                  },
                  "enrollmentId": {
                    "type": "string",
                    "pattern": "^enr_[a-f0-9]{32}$"
                  },
                  "approvedKeyId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{43}$"
                  },
                  "bindingVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "threadId": {
                    "type": "string",
                    "pattern": "^thr_[a-f0-9]{32}$"
                  }
                },
                "required": [
                  "organizationId",
                  "connectionId",
                  "agentId",
                  "receiverBindingId",
                  "enrollmentId",
                  "approvedKeyId",
                  "bindingVersion",
                  "projectId",
                  "threadId"
                ],
                "additionalProperties": false
              },
              "resource": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "messages.connection"
                  },
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "threadId": {
                    "type": "string",
                    "pattern": "^thr_[a-f0-9]{32}$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "senderId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "recipientId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  }
                },
                "required": [
                  "kind",
                  "organizationId",
                  "projectId",
                  "threadId",
                  "connectionId",
                  "senderId",
                  "recipientId"
                ],
                "additionalProperties": false
              },
              "adapter": {
                "type": "string",
                "enum": [
                  "local_listener",
                  "signed_http",
                  "external_oauth"
                ]
              },
              "requested": {
                "type": "object",
                "properties": {
                  "subscribe": {
                    "type": "boolean"
                  },
                  "wake": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "subscribe",
                  "wake"
                ],
                "additionalProperties": false
              },
              "subscriptionPermission": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.subscribe"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "referenceScope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_sources"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_source"
                              },
                              "sourceMessageId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              },
                              "conversationRootId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              }
                            },
                            "required": [
                              "kind",
                              "sourceMessageId",
                              "conversationRootId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "referenceScope"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subscriptions": {
                "type": "object",
                "properties": {
                  "subscribe": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "wake": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "subscribe",
                  "wake"
                ],
                "additionalProperties": false
              },
              "initialCursor": {
                "type": "string",
                "pattern": "^(?:0|[1-9][0-9]{0,15})$"
              },
              "expiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "state": {
                "type": "string",
                "enum": [
                  "active",
                  "paused",
                  "revoked"
                ]
              }
            },
            "required": [
              "schemaVersion",
              "version",
              "identity",
              "resource",
              "adapter",
              "subscriptionPermission",
              "subscriptions",
              "initialCursor",
              "expiresAtMs",
              "state"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "pending",
              "partial"
            ]
          },
          "readiness": {
            "type": "object",
            "properties": {
              "authorization": {
                "type": "string",
                "enum": [
                  "pending_activation",
                  "active",
                  "suspended",
                  "revoked",
                  "expired"
                ]
              },
              "installation": {
                "type": "string",
                "enum": [
                  "not_installed",
                  "installing",
                  "installed",
                  "failed"
                ]
              },
              "route": {
                "type": "string",
                "enum": [
                  "unbound",
                  "bound",
                  "paused",
                  "revoked"
                ]
              },
              "subscription": {
                "type": "string",
                "enum": [
                  "not_requested",
                  "pending",
                  "active",
                  "paused",
                  "revoked"
                ]
              },
              "receiver": {
                "type": "string",
                "enum": [
                  "not_requested",
                  "unconfigured",
                  "registering",
                  "ready",
                  "expired",
                  "paused",
                  "revoked",
                  "failed"
                ]
              }
            },
            "required": [
              "authorization",
              "installation",
              "route",
              "subscription",
              "receiver"
            ],
            "additionalProperties": false
          },
          "capability": {
            "type": "string",
            "enum": [
              "browserless_api",
              "existing_configuration_only",
              "unsupported_external_provisioning"
            ]
          },
          "idempotentReplay": {
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "schemaVersion",
          "binding",
          "status",
          "readiness",
          "capability"
        ],
        "additionalProperties": false
      }
    },
    "resume_receiver": {
      "method": "POST",
      "path": "/v1/access/receivers/{receiverBindingId}/resume",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          },
          "expectedVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "operationKey",
          "expectedVersion"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "schemaVersion": {
            "type": "string",
            "const": "dancer-access/v1"
          },
          "binding": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "const": "dancer-access-receiver/v1"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "identity": {
                "type": "object",
                "properties": {
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "agentId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "receiverBindingId": {
                    "type": "string",
                    "pattern": "^rcv_[a-f0-9]{32}$"
                  },
                  "enrollmentId": {
                    "type": "string",
                    "pattern": "^enr_[a-f0-9]{32}$"
                  },
                  "approvedKeyId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{43}$"
                  },
                  "bindingVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "threadId": {
                    "type": "string",
                    "pattern": "^thr_[a-f0-9]{32}$"
                  }
                },
                "required": [
                  "organizationId",
                  "connectionId",
                  "agentId",
                  "receiverBindingId",
                  "enrollmentId",
                  "approvedKeyId",
                  "bindingVersion",
                  "projectId",
                  "threadId"
                ],
                "additionalProperties": false
              },
              "resource": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "messages.connection"
                  },
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "threadId": {
                    "type": "string",
                    "pattern": "^thr_[a-f0-9]{32}$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "senderId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "recipientId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  }
                },
                "required": [
                  "kind",
                  "organizationId",
                  "projectId",
                  "threadId",
                  "connectionId",
                  "senderId",
                  "recipientId"
                ],
                "additionalProperties": false
              },
              "adapter": {
                "type": "string",
                "enum": [
                  "local_listener",
                  "signed_http",
                  "external_oauth"
                ]
              },
              "requested": {
                "type": "object",
                "properties": {
                  "subscribe": {
                    "type": "boolean"
                  },
                  "wake": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "subscribe",
                  "wake"
                ],
                "additionalProperties": false
              },
              "subscriptionPermission": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.subscribe"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "referenceScope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_sources"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_source"
                              },
                              "sourceMessageId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              },
                              "conversationRootId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              }
                            },
                            "required": [
                              "kind",
                              "sourceMessageId",
                              "conversationRootId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "referenceScope"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subscriptions": {
                "type": "object",
                "properties": {
                  "subscribe": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "wake": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "subscribe",
                  "wake"
                ],
                "additionalProperties": false
              },
              "initialCursor": {
                "type": "string",
                "pattern": "^(?:0|[1-9][0-9]{0,15})$"
              },
              "expiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "state": {
                "type": "string",
                "enum": [
                  "active",
                  "paused",
                  "revoked"
                ]
              }
            },
            "required": [
              "schemaVersion",
              "version",
              "identity",
              "resource",
              "adapter",
              "subscriptionPermission",
              "subscriptions",
              "initialCursor",
              "expiresAtMs",
              "state"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "pending",
              "partial"
            ]
          },
          "readiness": {
            "type": "object",
            "properties": {
              "authorization": {
                "type": "string",
                "enum": [
                  "pending_activation",
                  "active",
                  "suspended",
                  "revoked",
                  "expired"
                ]
              },
              "installation": {
                "type": "string",
                "enum": [
                  "not_installed",
                  "installing",
                  "installed",
                  "failed"
                ]
              },
              "route": {
                "type": "string",
                "enum": [
                  "unbound",
                  "bound",
                  "paused",
                  "revoked"
                ]
              },
              "subscription": {
                "type": "string",
                "enum": [
                  "not_requested",
                  "pending",
                  "active",
                  "paused",
                  "revoked"
                ]
              },
              "receiver": {
                "type": "string",
                "enum": [
                  "not_requested",
                  "unconfigured",
                  "registering",
                  "ready",
                  "expired",
                  "paused",
                  "revoked",
                  "failed"
                ]
              }
            },
            "required": [
              "authorization",
              "installation",
              "route",
              "subscription",
              "receiver"
            ],
            "additionalProperties": false
          },
          "capability": {
            "type": "string",
            "enum": [
              "browserless_api",
              "existing_configuration_only",
              "unsupported_external_provisioning"
            ]
          },
          "idempotentReplay": {
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "schemaVersion",
          "binding",
          "status",
          "readiness",
          "capability"
        ],
        "additionalProperties": false
      }
    },
    "revoke_receiver": {
      "method": "POST",
      "path": "/v1/access/receivers/{receiverBindingId}/revoke",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          },
          "expectedVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "operationKey",
          "expectedVersion"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "schemaVersion": {
            "type": "string",
            "const": "dancer-access/v1"
          },
          "binding": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "const": "dancer-access-receiver/v1"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "identity": {
                "type": "object",
                "properties": {
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "agentId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "receiverBindingId": {
                    "type": "string",
                    "pattern": "^rcv_[a-f0-9]{32}$"
                  },
                  "enrollmentId": {
                    "type": "string",
                    "pattern": "^enr_[a-f0-9]{32}$"
                  },
                  "approvedKeyId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{43}$"
                  },
                  "bindingVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "threadId": {
                    "type": "string",
                    "pattern": "^thr_[a-f0-9]{32}$"
                  }
                },
                "required": [
                  "organizationId",
                  "connectionId",
                  "agentId",
                  "receiverBindingId",
                  "enrollmentId",
                  "approvedKeyId",
                  "bindingVersion",
                  "projectId",
                  "threadId"
                ],
                "additionalProperties": false
              },
              "resource": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "messages.connection"
                  },
                  "organizationId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^org_[A-Za-z0-9_-]+$"
                  },
                  "projectId": {
                    "type": "string",
                    "pattern": "^prj_[a-f0-9]{32}$"
                  },
                  "threadId": {
                    "type": "string",
                    "pattern": "^thr_[a-f0-9]{32}$"
                  },
                  "connectionId": {
                    "type": "string",
                    "pattern": "^con_[a-f0-9]{32}$"
                  },
                  "senderId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  },
                  "recipientId": {
                    "type": "string",
                    "pattern": "^agt_[a-z0-9]{16,64}$"
                  }
                },
                "required": [
                  "kind",
                  "organizationId",
                  "projectId",
                  "threadId",
                  "connectionId",
                  "senderId",
                  "recipientId"
                ],
                "additionalProperties": false
              },
              "adapter": {
                "type": "string",
                "enum": [
                  "local_listener",
                  "signed_http",
                  "external_oauth"
                ]
              },
              "requested": {
                "type": "object",
                "properties": {
                  "subscribe": {
                    "type": "boolean"
                  },
                  "wake": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "subscribe",
                  "wake"
                ],
                "additionalProperties": false
              },
              "subscriptionPermission": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "messages.subscribe"
                      },
                      "resource": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "messages.connection"
                          },
                          "organizationId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^org_[A-Za-z0-9_-]+$"
                          },
                          "projectId": {
                            "type": "string",
                            "pattern": "^prj_[a-f0-9]{32}$"
                          },
                          "threadId": {
                            "type": "string",
                            "pattern": "^thr_[a-f0-9]{32}$"
                          },
                          "connectionId": {
                            "type": "string",
                            "pattern": "^con_[a-f0-9]{32}$"
                          },
                          "senderId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          },
                          "recipientId": {
                            "type": "string",
                            "pattern": "^agt_[a-z0-9]{16,64}$"
                          }
                        },
                        "required": [
                          "kind",
                          "organizationId",
                          "projectId",
                          "threadId",
                          "connectionId",
                          "senderId",
                          "recipientId"
                        ],
                        "additionalProperties": false
                      },
                      "referenceScope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "connection_sources"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "exact_source"
                              },
                              "sourceMessageId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              },
                              "conversationRootId": {
                                "type": "string",
                                "pattern": "^msg_[a-f0-9]{32}$"
                              }
                            },
                            "required": [
                              "kind",
                              "sourceMessageId",
                              "conversationRootId"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "action",
                      "resource",
                      "referenceScope"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subscriptions": {
                "type": "object",
                "properties": {
                  "subscribe": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "wake": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "subscribe",
                  "wake"
                ],
                "additionalProperties": false
              },
              "initialCursor": {
                "type": "string",
                "pattern": "^(?:0|[1-9][0-9]{0,15})$"
              },
              "expiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "state": {
                "type": "string",
                "enum": [
                  "active",
                  "paused",
                  "revoked"
                ]
              }
            },
            "required": [
              "schemaVersion",
              "version",
              "identity",
              "resource",
              "adapter",
              "subscriptionPermission",
              "subscriptions",
              "initialCursor",
              "expiresAtMs",
              "state"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "pending",
              "partial"
            ]
          },
          "readiness": {
            "type": "object",
            "properties": {
              "authorization": {
                "type": "string",
                "enum": [
                  "pending_activation",
                  "active",
                  "suspended",
                  "revoked",
                  "expired"
                ]
              },
              "installation": {
                "type": "string",
                "enum": [
                  "not_installed",
                  "installing",
                  "installed",
                  "failed"
                ]
              },
              "route": {
                "type": "string",
                "enum": [
                  "unbound",
                  "bound",
                  "paused",
                  "revoked"
                ]
              },
              "subscription": {
                "type": "string",
                "enum": [
                  "not_requested",
                  "pending",
                  "active",
                  "paused",
                  "revoked"
                ]
              },
              "receiver": {
                "type": "string",
                "enum": [
                  "not_requested",
                  "unconfigured",
                  "registering",
                  "ready",
                  "expired",
                  "paused",
                  "revoked",
                  "failed"
                ]
              }
            },
            "required": [
              "authorization",
              "installation",
              "route",
              "subscription",
              "receiver"
            ],
            "additionalProperties": false
          },
          "capability": {
            "type": "string",
            "enum": [
              "browserless_api",
              "existing_configuration_only",
              "unsupported_external_provisioning"
            ]
          },
          "idempotentReplay": {
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "schemaVersion",
          "binding",
          "status",
          "readiness",
          "capability"
        ],
        "additionalProperties": false
      }
    },
    "receiver_references": {
      "method": "GET",
      "path": "/v1/access/receivers/{receiverBindingId}/references",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "cursor": {
            "type": "string",
            "pattern": "^(?:0|[1-9][0-9]{0,15})$"
          },
          "limit": {
            "default": 50,
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          }
        },
        "required": [
          "limit"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "receiverBindingId": {
            "type": "string",
            "pattern": "^rcv_[a-f0-9]{32}$"
          },
          "page": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "const": "dancer-messages/v1"
              },
              "events": {
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "cursor": {
                      "type": "string",
                      "pattern": "^(?:0|[1-9][0-9]{0,15})$"
                    },
                    "messageId": {
                      "type": "string",
                      "pattern": "^msg_[a-f0-9]{32}$"
                    },
                    "sequence": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "threadId": {
                      "type": "string",
                      "pattern": "^thr_[a-f0-9]{32}$"
                    },
                    "organizationId": {
                      "type": "string",
                      "maxLength": 128,
                      "pattern": "^org_[A-Za-z0-9_-]+$"
                    },
                    "recipientId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "senderId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "projectId": {
                      "type": "string",
                      "pattern": "^prj_[a-f0-9]{32}$"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    "connectionId": {
                      "type": "string",
                      "pattern": "^con_[a-f0-9]{32}$"
                    },
                    "sourceMessageId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^msg_[a-f0-9]{32}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "conversationRootId": {
                      "type": "string",
                      "pattern": "^msg_[a-f0-9]{32}$"
                    }
                  },
                  "required": [
                    "cursor",
                    "messageId",
                    "sequence",
                    "threadId",
                    "organizationId",
                    "recipientId",
                    "senderId",
                    "projectId",
                    "createdAt",
                    "connectionId",
                    "sourceMessageId",
                    "conversationRootId"
                  ],
                  "additionalProperties": false
                }
              },
              "cursor": {
                "type": "string",
                "pattern": "^(?:0|[1-9][0-9]{0,15})$"
              },
              "hasMore": {
                "type": "boolean"
              }
            },
            "required": [
              "schemaVersion",
              "events",
              "cursor",
              "hasMore"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ok",
          "receiverBindingId",
          "page"
        ],
        "additionalProperties": false
      }
    },
    "enroll": {
      "method": "POST",
      "path": "/v1/access/enrollments",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^org_[A-Za-z0-9_-]+$"
          },
          "request": {
            "type": "object",
            "properties": {
              "publicKey": {
                "type": "object",
                "properties": {
                  "kty": {
                    "type": "string",
                    "const": "EC"
                  },
                  "crv": {
                    "type": "string",
                    "const": "P-256"
                  },
                  "x": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{43}$"
                  },
                  "y": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{43}$"
                  },
                  "alg": {
                    "type": "string",
                    "const": "ES256"
                  },
                  "use": {
                    "type": "string",
                    "const": "sig"
                  },
                  "key_ops": {
                    "maxItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "const": "verify"
                    }
                  },
                  "ext": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "kty",
                  "crv",
                  "x",
                  "y"
                ],
                "additionalProperties": false
              },
              "subjectId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "operationId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
              },
              "invitationId": {
                "type": "string",
                "pattern": "^inv_[a-f0-9]{32}$"
              }
            },
            "required": [
              "publicKey",
              "subjectId",
              "operationId"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "organizationId",
          "request"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "awaiting_identity_approval"
          },
          "operationHandle": {
            "type": "string",
            "pattern": "^enr_[a-f0-9]{32}$"
          }
        },
        "required": [
          "status",
          "operationHandle"
        ],
        "additionalProperties": false
      }
    },
    "token": {
      "method": "POST",
      "path": "/v1/access/token",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^org_[A-Za-z0-9_-]+$"
          },
          "request": {
            "type": "object",
            "properties": {
              "grant_type": {
                "type": "string",
                "const": "client_credentials"
              },
              "client_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 160
              },
              "client_assertion_type": {
                "type": "string",
                "const": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"
              },
              "client_assertion": {
                "type": "string",
                "minLength": 1,
                "maxLength": 8192
              },
              "resource": {
                "type": "string",
                "maxLength": 2048,
                "format": "uri"
              },
              "operationId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
              }
            },
            "required": [
              "grant_type",
              "client_id",
              "client_assertion_type",
              "client_assertion",
              "resource",
              "operationId"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "organizationId",
          "request"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string"
          },
          "token_type": {
            "type": "string",
            "const": "Bearer"
          },
          "expires_in": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "credential": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "const": "dancer-access/v1"
              },
              "credentialId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
              },
              "generation": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "organizationId": {
                "type": "string",
                "maxLength": 128,
                "pattern": "^org_[A-Za-z0-9_-]+$"
              },
              "subjectId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "audience": {
                "type": "string",
                "maxLength": 2048,
                "format": "uri"
              },
              "expiresAtMs": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "permissions": {
                "maxItems": 32,
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.send"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "action",
                        "resource"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.read_addressed"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "action",
                        "resource"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.reply"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        },
                        "source": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "connection_sources"
                                }
                              },
                              "required": [
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "exact_source"
                                },
                                "sourceMessageId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                },
                                "conversationRootId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                }
                              },
                              "required": [
                                "kind",
                                "sourceMessageId",
                                "conversationRootId"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "action",
                        "resource",
                        "source"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.read_own_replies"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        },
                        "source": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "connection_sources"
                                }
                              },
                              "required": [
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "exact_source"
                                },
                                "sourceMessageId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                },
                                "conversationRootId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                }
                              },
                              "required": [
                                "kind",
                                "sourceMessageId",
                                "conversationRootId"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "action",
                        "resource",
                        "source"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.read_history"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        },
                        "history": {
                          "type": "object",
                          "properties": {
                            "fromSequence": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "through": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "live"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "sequence"
                                    },
                                    "sequence": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sequence"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "fromSequence",
                            "through"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "action",
                        "resource",
                        "history"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.subscribe"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        },
                        "referenceScope": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "connection_sources"
                                }
                              },
                              "required": [
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "exact_source"
                                },
                                "sourceMessageId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                },
                                "conversationRootId": {
                                  "type": "string",
                                  "pattern": "^msg_[a-f0-9]{32}$"
                                }
                              },
                              "required": [
                                "kind",
                                "sourceMessageId",
                                "conversationRootId"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "action",
                        "resource",
                        "referenceScope"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "const": "messages.wake"
                        },
                        "resource": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.connection"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "threadId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            },
                            "connectionId": {
                              "type": "string",
                              "pattern": "^con_[a-f0-9]{32}$"
                            },
                            "senderId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            },
                            "recipientId": {
                              "type": "string",
                              "pattern": "^agt_[a-z0-9]{16,64}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "threadId",
                            "connectionId",
                            "senderId",
                            "recipientId"
                          ],
                          "additionalProperties": false
                        },
                        "receiver": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "connection_binding"
                                }
                              },
                              "required": [
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "exact_binding"
                                },
                                "receiverBindingId": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                },
                                "generation": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "kind",
                                "receiverBindingId",
                                "generation"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "action",
                        "resource",
                        "receiver"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "management": {
                "type": "object",
                "properties": {
                  "authorities": {
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "connectionId": {
                          "type": "string",
                          "pattern": "^con_[a-f0-9]{32}$"
                        },
                        "basis": {
                          "anyOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "project_owner"
                                    },
                                    "projectId": {
                                      "type": "string",
                                      "pattern": "^prj_[a-f0-9]{32}$"
                                    },
                                    "ownerId": {
                                      "type": "string",
                                      "pattern": "^agt_[a-z0-9]{16,64}$"
                                    },
                                    "version": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "projectId",
                                    "ownerId",
                                    "version"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "delegation"
                                    },
                                    "delegationId": {
                                      "type": "string",
                                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                    },
                                    "parentGrantId": {
                                      "type": "string",
                                      "pattern": "^grt_[a-f0-9]{32}$"
                                    },
                                    "parentVersion": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "version": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "delegationId",
                                    "version"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "grant"
                                },
                                "grantId": {
                                  "type": "string",
                                  "pattern": "^grt_[a-f0-9]{32}$"
                                },
                                "version": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "kind",
                                "grantId",
                                "version"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        },
                        "actions": {
                          "minItems": 1,
                          "maxItems": 5,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "invite",
                              "approve",
                              "delegate",
                              "inspect",
                              "revoke_delegation"
                            ]
                          }
                        }
                      },
                      "required": [
                        "connectionId",
                        "basis",
                        "actions"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "invitations": {
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "invitationId": {
                          "type": "string",
                          "pattern": "^inv_[a-f0-9]{32}$"
                        },
                        "actions": {
                          "minItems": 1,
                          "maxItems": 3,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "inspect",
                              "accept",
                              "decline"
                            ]
                          }
                        }
                      },
                      "required": [
                        "invitationId",
                        "actions"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "connections": {
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "connectionId": {
                          "type": "string",
                          "pattern": "^con_[a-f0-9]{32}$"
                        },
                        "actions": {
                          "minItems": 1,
                          "maxItems": 4,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "inspect",
                              "bind_self_route",
                              "configure_self_receiver",
                              "revoke_self_grant"
                            ]
                          }
                        }
                      },
                      "required": [
                        "connectionId",
                        "actions"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "invitations",
                  "connections"
                ],
                "additionalProperties": false
              },
              "goalPermissions": {
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "action": {
                      "type": "string",
                      "enum": [
                        "goals.create",
                        "goals.read",
                        "goals.update",
                        "work.claim",
                        "work.report",
                        "work.transfer",
                        "work.release"
                      ]
                    },
                    "resource": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.project_goals"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "messages.goal"
                            },
                            "organizationId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^org_[A-Za-z0-9_-]+$"
                            },
                            "projectId": {
                              "type": "string",
                              "pattern": "^prj_[a-f0-9]{32}$"
                            },
                            "goalId": {
                              "type": "string",
                              "pattern": "^thr_[a-f0-9]{32}$"
                            }
                          },
                          "required": [
                            "kind",
                            "organizationId",
                            "projectId",
                            "goalId"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "action",
                    "resource"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "schemaVersion",
              "credentialId",
              "generation",
              "organizationId",
              "subjectId",
              "audience",
              "expiresAtMs",
              "permissions"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "access_token",
          "token_type",
          "expires_in",
          "credential"
        ],
        "additionalProperties": false
      }
    },
    "invite": {
      "method": "POST",
      "path": "/v1/access/invitations",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "preset"
              },
              "operationKey": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
              },
              "delegationId": {
                "type": "string",
                "pattern": "^del_[a-f0-9]{32}$"
              },
              "recipient": {
                "type": "string",
                "pattern": "^(?:agt_[a-z0-9]{16,64}|[a-z][a-z0-9-]{1,63})$"
              },
              "projectId": {
                "type": "string",
                "pattern": "^prj_[a-f0-9]{32}$"
              },
              "threadId": {
                "type": "string",
                "pattern": "^thr_[a-f0-9]{32}$"
              },
              "inviteExpiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "accessExpiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "mode": {
                "type": "string",
                "enum": [
                  "notify",
                  "ask"
                ]
              },
              "connectionId": {
                "type": "string",
                "pattern": "^con_[a-f0-9]{32}$"
              }
            },
            "required": [
              "kind",
              "operationKey",
              "recipient",
              "projectId",
              "threadId",
              "inviteExpiresAtMs",
              "accessExpiresAtMs",
              "mode"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "edges"
              },
              "operationKey": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
              },
              "delegationId": {
                "type": "string",
                "pattern": "^del_[a-f0-9]{32}$"
              },
              "recipient": {
                "type": "string",
                "pattern": "^(?:agt_[a-z0-9]{16,64}|[a-z][a-z0-9-]{1,63})$"
              },
              "projectId": {
                "type": "string",
                "pattern": "^prj_[a-f0-9]{32}$"
              },
              "threadId": {
                "type": "string",
                "pattern": "^thr_[a-f0-9]{32}$"
              },
              "inviteExpiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "accessExpiresAtMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "connectionId": {
                "type": "string",
                "pattern": "^con_[a-f0-9]{32}$"
              },
              "edges": {
                "minItems": 1,
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "subjectId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "permission": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.send"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_addressed"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.reply"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_own_replies"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_history"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "history": {
                              "type": "object",
                              "properties": {
                                "fromSequence": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "through": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "live"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "sequence"
                                        },
                                        "sequence": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sequence"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "fromSequence",
                                "through"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "history"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.subscribe"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "referenceScope": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "referenceScope"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.wake"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "receiver": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_binding"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_binding"
                                    },
                                    "receiverBindingId": {
                                      "type": "string",
                                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                    },
                                    "generation": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "receiverBindingId",
                                    "generation"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "receiver"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "subjectId",
                    "permission"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "kind",
              "operationKey",
              "recipient",
              "projectId",
              "threadId",
              "inviteExpiresAtMs",
              "accessExpiresAtMs",
              "connectionId",
              "edges"
            ],
            "additionalProperties": false
          }
        ]
      }
    },
    "accept": {
      "method": "POST",
      "path": "/v1/access/invitations/{invitationId}/accept",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          },
          "expectedVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "operationKey",
          "expectedVersion"
        ],
        "additionalProperties": false
      }
    },
    "decline": {
      "method": "POST",
      "path": "/v1/access/invitations/{invitationId}/decline",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          },
          "expectedVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "operationKey",
          "expectedVersion"
        ],
        "additionalProperties": false
      }
    },
    "cancel": {
      "method": "POST",
      "path": "/v1/access/invitations/{invitationId}/cancel",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          },
          "expectedVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "operationKey",
          "expectedVersion"
        ],
        "additionalProperties": false
      }
    },
    "approve": {
      "method": "POST",
      "path": "/v1/access/invitations/{invitationId}/approve",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          },
          "expectedVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "delegationId": {
            "type": "string",
            "pattern": "^del_[a-f0-9]{32}$"
          }
        },
        "required": [
          "operationKey",
          "expectedVersion"
        ],
        "additionalProperties": false
      }
    },
    "revoke": {
      "method": "POST",
      "path": "/v1/access/grants/{grantId}/revoke",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          },
          "expectedVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "operationKey",
          "expectedVersion"
        ],
        "additionalProperties": false
      }
    },
    "list_invitations": {
      "method": "GET",
      "path": "/v1/access/invitations",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "role": {
            "default": "either",
            "type": "string",
            "enum": [
              "issuer",
              "recipient",
              "either",
              "approver"
            ]
          },
          "projectId": {
            "type": "string",
            "pattern": "^prj_[a-f0-9]{32}$"
          },
          "threadId": {
            "type": "string",
            "pattern": "^thr_[a-f0-9]{32}$"
          },
          "limit": {
            "default": 50,
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "cursor": {
            "type": "string",
            "pattern": "^inv_[a-f0-9]{32}$"
          }
        },
        "required": [
          "role",
          "limit"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "invitations": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "schemaVersion": {
                  "type": "string",
                  "const": "dancer-access/v1"
                },
                "invitationId": {
                  "type": "string",
                  "pattern": "^inv_[a-f0-9]{32}$"
                },
                "connectionId": {
                  "type": "string",
                  "pattern": "^con_[a-f0-9]{32}$"
                },
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "organizationId": {
                  "type": "string",
                  "maxLength": 128,
                  "pattern": "^org_[A-Za-z0-9_-]+$"
                },
                "issuerId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "recipientId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "edges": {
                  "minItems": 1,
                  "maxItems": 32,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "subjectId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "permission": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "action": {
                                "type": "string",
                                "const": "messages.send"
                              },
                              "resource": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "messages.connection"
                                  },
                                  "organizationId": {
                                    "type": "string",
                                    "maxLength": 128,
                                    "pattern": "^org_[A-Za-z0-9_-]+$"
                                  },
                                  "projectId": {
                                    "type": "string",
                                    "pattern": "^prj_[a-f0-9]{32}$"
                                  },
                                  "threadId": {
                                    "type": "string",
                                    "pattern": "^thr_[a-f0-9]{32}$"
                                  },
                                  "connectionId": {
                                    "type": "string",
                                    "pattern": "^con_[a-f0-9]{32}$"
                                  },
                                  "senderId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  },
                                  "recipientId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "organizationId",
                                  "projectId",
                                  "threadId",
                                  "connectionId",
                                  "senderId",
                                  "recipientId"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "action",
                              "resource"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "action": {
                                "type": "string",
                                "const": "messages.read_addressed"
                              },
                              "resource": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "messages.connection"
                                  },
                                  "organizationId": {
                                    "type": "string",
                                    "maxLength": 128,
                                    "pattern": "^org_[A-Za-z0-9_-]+$"
                                  },
                                  "projectId": {
                                    "type": "string",
                                    "pattern": "^prj_[a-f0-9]{32}$"
                                  },
                                  "threadId": {
                                    "type": "string",
                                    "pattern": "^thr_[a-f0-9]{32}$"
                                  },
                                  "connectionId": {
                                    "type": "string",
                                    "pattern": "^con_[a-f0-9]{32}$"
                                  },
                                  "senderId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  },
                                  "recipientId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "organizationId",
                                  "projectId",
                                  "threadId",
                                  "connectionId",
                                  "senderId",
                                  "recipientId"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "action",
                              "resource"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "action": {
                                "type": "string",
                                "const": "messages.reply"
                              },
                              "resource": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "messages.connection"
                                  },
                                  "organizationId": {
                                    "type": "string",
                                    "maxLength": 128,
                                    "pattern": "^org_[A-Za-z0-9_-]+$"
                                  },
                                  "projectId": {
                                    "type": "string",
                                    "pattern": "^prj_[a-f0-9]{32}$"
                                  },
                                  "threadId": {
                                    "type": "string",
                                    "pattern": "^thr_[a-f0-9]{32}$"
                                  },
                                  "connectionId": {
                                    "type": "string",
                                    "pattern": "^con_[a-f0-9]{32}$"
                                  },
                                  "senderId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  },
                                  "recipientId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "organizationId",
                                  "projectId",
                                  "threadId",
                                  "connectionId",
                                  "senderId",
                                  "recipientId"
                                ],
                                "additionalProperties": false
                              },
                              "source": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "connection_sources"
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "exact_source"
                                      },
                                      "sourceMessageId": {
                                        "type": "string",
                                        "pattern": "^msg_[a-f0-9]{32}$"
                                      },
                                      "conversationRootId": {
                                        "type": "string",
                                        "pattern": "^msg_[a-f0-9]{32}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "sourceMessageId",
                                      "conversationRootId"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "required": [
                              "action",
                              "resource",
                              "source"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "action": {
                                "type": "string",
                                "const": "messages.read_own_replies"
                              },
                              "resource": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "messages.connection"
                                  },
                                  "organizationId": {
                                    "type": "string",
                                    "maxLength": 128,
                                    "pattern": "^org_[A-Za-z0-9_-]+$"
                                  },
                                  "projectId": {
                                    "type": "string",
                                    "pattern": "^prj_[a-f0-9]{32}$"
                                  },
                                  "threadId": {
                                    "type": "string",
                                    "pattern": "^thr_[a-f0-9]{32}$"
                                  },
                                  "connectionId": {
                                    "type": "string",
                                    "pattern": "^con_[a-f0-9]{32}$"
                                  },
                                  "senderId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  },
                                  "recipientId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "organizationId",
                                  "projectId",
                                  "threadId",
                                  "connectionId",
                                  "senderId",
                                  "recipientId"
                                ],
                                "additionalProperties": false
                              },
                              "source": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "connection_sources"
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "exact_source"
                                      },
                                      "sourceMessageId": {
                                        "type": "string",
                                        "pattern": "^msg_[a-f0-9]{32}$"
                                      },
                                      "conversationRootId": {
                                        "type": "string",
                                        "pattern": "^msg_[a-f0-9]{32}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "sourceMessageId",
                                      "conversationRootId"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "required": [
                              "action",
                              "resource",
                              "source"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "action": {
                                "type": "string",
                                "const": "messages.read_history"
                              },
                              "resource": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "messages.connection"
                                  },
                                  "organizationId": {
                                    "type": "string",
                                    "maxLength": 128,
                                    "pattern": "^org_[A-Za-z0-9_-]+$"
                                  },
                                  "projectId": {
                                    "type": "string",
                                    "pattern": "^prj_[a-f0-9]{32}$"
                                  },
                                  "threadId": {
                                    "type": "string",
                                    "pattern": "^thr_[a-f0-9]{32}$"
                                  },
                                  "connectionId": {
                                    "type": "string",
                                    "pattern": "^con_[a-f0-9]{32}$"
                                  },
                                  "senderId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  },
                                  "recipientId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "organizationId",
                                  "projectId",
                                  "threadId",
                                  "connectionId",
                                  "senderId",
                                  "recipientId"
                                ],
                                "additionalProperties": false
                              },
                              "history": {
                                "type": "object",
                                "properties": {
                                  "fromSequence": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "through": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "live"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "sequence"
                                          },
                                          "sequence": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "sequence"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "fromSequence",
                                  "through"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "action",
                              "resource",
                              "history"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "action": {
                                "type": "string",
                                "const": "messages.subscribe"
                              },
                              "resource": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "messages.connection"
                                  },
                                  "organizationId": {
                                    "type": "string",
                                    "maxLength": 128,
                                    "pattern": "^org_[A-Za-z0-9_-]+$"
                                  },
                                  "projectId": {
                                    "type": "string",
                                    "pattern": "^prj_[a-f0-9]{32}$"
                                  },
                                  "threadId": {
                                    "type": "string",
                                    "pattern": "^thr_[a-f0-9]{32}$"
                                  },
                                  "connectionId": {
                                    "type": "string",
                                    "pattern": "^con_[a-f0-9]{32}$"
                                  },
                                  "senderId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  },
                                  "recipientId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "organizationId",
                                  "projectId",
                                  "threadId",
                                  "connectionId",
                                  "senderId",
                                  "recipientId"
                                ],
                                "additionalProperties": false
                              },
                              "referenceScope": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "connection_sources"
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "exact_source"
                                      },
                                      "sourceMessageId": {
                                        "type": "string",
                                        "pattern": "^msg_[a-f0-9]{32}$"
                                      },
                                      "conversationRootId": {
                                        "type": "string",
                                        "pattern": "^msg_[a-f0-9]{32}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "sourceMessageId",
                                      "conversationRootId"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "required": [
                              "action",
                              "resource",
                              "referenceScope"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "action": {
                                "type": "string",
                                "const": "messages.wake"
                              },
                              "resource": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "messages.connection"
                                  },
                                  "organizationId": {
                                    "type": "string",
                                    "maxLength": 128,
                                    "pattern": "^org_[A-Za-z0-9_-]+$"
                                  },
                                  "projectId": {
                                    "type": "string",
                                    "pattern": "^prj_[a-f0-9]{32}$"
                                  },
                                  "threadId": {
                                    "type": "string",
                                    "pattern": "^thr_[a-f0-9]{32}$"
                                  },
                                  "connectionId": {
                                    "type": "string",
                                    "pattern": "^con_[a-f0-9]{32}$"
                                  },
                                  "senderId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  },
                                  "recipientId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "organizationId",
                                  "projectId",
                                  "threadId",
                                  "connectionId",
                                  "senderId",
                                  "recipientId"
                                ],
                                "additionalProperties": false
                              },
                              "receiver": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "connection_binding"
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "exact_binding"
                                      },
                                      "receiverBindingId": {
                                        "type": "string",
                                        "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                      },
                                      "generation": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "receiverBindingId",
                                      "generation"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "required": [
                              "action",
                              "resource",
                              "receiver"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "required": [
                      "subjectId",
                      "permission"
                    ],
                    "additionalProperties": false
                  }
                },
                "approvals": {
                  "maxItems": 3,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "role": {
                        "type": "string",
                        "enum": [
                          "resource_authority",
                          "recipient",
                          "identity_binding"
                        ]
                      },
                      "principalId": {
                        "type": "string",
                        "pattern": "^agt_[a-z0-9]{16,64}$"
                      },
                      "approvedAtMs": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "basis": {
                        "anyOf": [
                          {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "project_owner"
                                  },
                                  "projectId": {
                                    "type": "string",
                                    "pattern": "^prj_[a-f0-9]{32}$"
                                  },
                                  "ownerId": {
                                    "type": "string",
                                    "pattern": "^agt_[a-z0-9]{16,64}$"
                                  },
                                  "version": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "projectId",
                                  "ownerId",
                                  "version"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "delegation"
                                  },
                                  "delegationId": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                  },
                                  "parentGrantId": {
                                    "type": "string",
                                    "pattern": "^grt_[a-f0-9]{32}$"
                                  },
                                  "parentVersion": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "version": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "delegationId",
                                  "version"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "role",
                      "principalId",
                      "approvedAtMs",
                      "basis"
                    ],
                    "additionalProperties": false
                  }
                },
                "requiredApprovals": {
                  "minItems": 1,
                  "maxItems": 3,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "resource_authority",
                      "recipient",
                      "identity_binding"
                    ]
                  }
                },
                "inviteExpiresAtMs": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "accessExpiresAtMs": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "accepted",
                    "declined",
                    "cancelled",
                    "expired"
                  ]
                },
                "grantIds": {
                  "maxItems": 32,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^grt_[a-f0-9]{32}$"
                  }
                }
              },
              "required": [
                "schemaVersion",
                "invitationId",
                "connectionId",
                "version",
                "organizationId",
                "issuerId",
                "recipientId",
                "edges",
                "approvals",
                "requiredApprovals",
                "inviteExpiresAtMs",
                "accessExpiresAtMs",
                "state",
                "grantIds"
              ],
              "additionalProperties": false
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^inv_[a-f0-9]{32}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "ok",
          "invitations",
          "nextCursor"
        ],
        "additionalProperties": false
      }
    },
    "list_grants": {
      "method": "GET",
      "path": "/v1/access/grants",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "connectionId": {
            "type": "string",
            "pattern": "^con_[a-f0-9]{32}$"
          },
          "limit": {
            "default": 50,
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "cursor": {
            "type": "string",
            "pattern": "^grt_[a-f0-9]{32}$"
          }
        },
        "required": [
          "limit"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "grants": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "schemaVersion": {
                  "type": "string",
                  "const": "dancer-access/v1"
                },
                "grantId": {
                  "type": "string",
                  "pattern": "^grt_[a-f0-9]{32}$"
                },
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "organizationId": {
                  "type": "string",
                  "maxLength": 128,
                  "pattern": "^org_[A-Za-z0-9_-]+$"
                },
                "subjectId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "connectionId": {
                  "type": "string",
                  "pattern": "^con_[a-f0-9]{32}$"
                },
                "sourceInvitationId": {
                  "type": "string",
                  "pattern": "^inv_[a-f0-9]{32}$"
                },
                "route": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "unbound"
                        },
                        "audienceVersion": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "audienceVersion"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "bound"
                        },
                        "recipientId": {
                          "type": "string",
                          "pattern": "^agt_[a-z0-9]{16,64}$"
                        },
                        "routeVersion": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "audienceVersion": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "recipientId",
                        "routeVersion",
                        "audienceVersion"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "permissions": {
                  "minItems": 1,
                  "maxItems": 32,
                  "type": "array",
                  "items": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.send"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "action",
                          "resource"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.read_addressed"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "action",
                          "resource"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.reply"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "source": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_sources"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_source"
                                  },
                                  "sourceMessageId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  },
                                  "conversationRootId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sourceMessageId",
                                  "conversationRootId"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "source"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.read_own_replies"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "source": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_sources"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_source"
                                  },
                                  "sourceMessageId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  },
                                  "conversationRootId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sourceMessageId",
                                  "conversationRootId"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "source"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.read_history"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "history": {
                            "type": "object",
                            "properties": {
                              "fromSequence": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "through": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "live"
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "sequence"
                                      },
                                      "sequence": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "sequence"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "required": [
                              "fromSequence",
                              "through"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "history"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.subscribe"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "referenceScope": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_sources"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_source"
                                  },
                                  "sourceMessageId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  },
                                  "conversationRootId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sourceMessageId",
                                  "conversationRootId"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "referenceScope"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.wake"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "receiver": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_binding"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_binding"
                                  },
                                  "receiverBindingId": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                  },
                                  "generation": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "receiverBindingId",
                                  "generation"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "receiver"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "basis": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "project_owner"
                        },
                        "projectId": {
                          "type": "string",
                          "pattern": "^prj_[a-f0-9]{32}$"
                        },
                        "ownerId": {
                          "type": "string",
                          "pattern": "^agt_[a-z0-9]{16,64}$"
                        },
                        "version": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "projectId",
                        "ownerId",
                        "version"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "delegation"
                        },
                        "delegationId": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                        },
                        "parentGrantId": {
                          "type": "string",
                          "pattern": "^grt_[a-f0-9]{32}$"
                        },
                        "parentVersion": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "version": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "delegationId",
                        "version"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "expiresAtMs": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "delegation": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "none"
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "bounded"
                        },
                        "permissions": {
                          "minItems": 1,
                          "maxItems": 32,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.send"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.read_addressed"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.reply"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_sources"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_source"
                                          },
                                          "sourceMessageId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          },
                                          "conversationRootId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "sourceMessageId",
                                          "conversationRootId"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "source"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.read_own_replies"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_sources"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_source"
                                          },
                                          "sourceMessageId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          },
                                          "conversationRootId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "sourceMessageId",
                                          "conversationRootId"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "source"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.read_history"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "history": {
                                    "type": "object",
                                    "properties": {
                                      "fromSequence": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "through": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "live"
                                              }
                                            },
                                            "required": [
                                              "kind"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "sequence"
                                              },
                                              "sequence": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "sequence"
                                            ],
                                            "additionalProperties": false
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "fromSequence",
                                      "through"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "history"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.subscribe"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "referenceScope": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_sources"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_source"
                                          },
                                          "sourceMessageId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          },
                                          "conversationRootId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "sourceMessageId",
                                          "conversationRootId"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "referenceScope"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.wake"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "receiver": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_binding"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_binding"
                                          },
                                          "receiverBindingId": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                          },
                                          "generation": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "receiverBindingId",
                                          "generation"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "receiver"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "maxExpiresAtMs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "remainingDepth": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 8
                        }
                      },
                      "required": [
                        "kind",
                        "permissions",
                        "maxExpiresAtMs",
                        "remainingDepth"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "pending_activation",
                    "active",
                    "suspended",
                    "revoked",
                    "expired"
                  ]
                }
              },
              "required": [
                "schemaVersion",
                "grantId",
                "version",
                "organizationId",
                "subjectId",
                "connectionId",
                "sourceInvitationId",
                "route",
                "permissions",
                "basis",
                "expiresAtMs",
                "delegation",
                "state"
              ],
              "additionalProperties": false
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^grt_[a-f0-9]{32}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "ok",
          "grants",
          "nextCursor"
        ],
        "additionalProperties": false
      }
    },
    "bind_self_route": {
      "method": "POST",
      "path": "/v1/access/connections/{connectionId}/route",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
          },
          "connectionId": {
            "type": "string",
            "pattern": "^con_[a-f0-9]{32}$"
          },
          "expectedVersion": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "receiverBindingId": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "operationKey",
          "connectionId",
          "expectedVersion",
          "receiverBindingId"
        ],
        "additionalProperties": false
      }
    },
    "wait": {
      "method": "GET",
      "path": "/v1/access/invitations/{invitationId}/wait",
      "request": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "invitationId": {
            "type": "string",
            "pattern": "^inv_[a-f0-9]{32}$"
          },
          "afterVersion": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "afterCursor": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "waitMs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 25000
          }
        },
        "required": [
          "invitationId",
          "afterVersion",
          "waitMs"
        ],
        "additionalProperties": false
      },
      "response": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "schemaVersion": {
            "type": "string",
            "const": "dancer-access/v1"
          },
          "invitation": {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "string",
                "const": "dancer-access/v1"
              },
              "invitationId": {
                "type": "string",
                "pattern": "^inv_[a-f0-9]{32}$"
              },
              "connectionId": {
                "type": "string",
                "pattern": "^con_[a-f0-9]{32}$"
              },
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "organizationId": {
                "type": "string",
                "maxLength": 128,
                "pattern": "^org_[A-Za-z0-9_-]+$"
              },
              "issuerId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "recipientId": {
                "type": "string",
                "pattern": "^agt_[a-z0-9]{16,64}$"
              },
              "edges": {
                "minItems": 1,
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "subjectId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "permission": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.send"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_addressed"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.reply"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_own_replies"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.read_history"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "history": {
                              "type": "object",
                              "properties": {
                                "fromSequence": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "through": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "live"
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "sequence"
                                        },
                                        "sequence": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "sequence"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "fromSequence",
                                "through"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "history"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.subscribe"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "referenceScope": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_sources"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_source"
                                    },
                                    "sourceMessageId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    },
                                    "conversationRootId": {
                                      "type": "string",
                                      "pattern": "^msg_[a-f0-9]{32}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "sourceMessageId",
                                    "conversationRootId"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "referenceScope"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "const": "messages.wake"
                            },
                            "resource": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "messages.connection"
                                },
                                "organizationId": {
                                  "type": "string",
                                  "maxLength": 128,
                                  "pattern": "^org_[A-Za-z0-9_-]+$"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "threadId": {
                                  "type": "string",
                                  "pattern": "^thr_[a-f0-9]{32}$"
                                },
                                "connectionId": {
                                  "type": "string",
                                  "pattern": "^con_[a-f0-9]{32}$"
                                },
                                "senderId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "recipientId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                }
                              },
                              "required": [
                                "kind",
                                "organizationId",
                                "projectId",
                                "threadId",
                                "connectionId",
                                "senderId",
                                "recipientId"
                              ],
                              "additionalProperties": false
                            },
                            "receiver": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "connection_binding"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "exact_binding"
                                    },
                                    "receiverBindingId": {
                                      "type": "string",
                                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                    },
                                    "generation": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "receiverBindingId",
                                    "generation"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "action",
                            "resource",
                            "receiver"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "subjectId",
                    "permission"
                  ],
                  "additionalProperties": false
                }
              },
              "approvals": {
                "maxItems": 3,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "resource_authority",
                        "recipient",
                        "identity_binding"
                      ]
                    },
                    "principalId": {
                      "type": "string",
                      "pattern": "^agt_[a-z0-9]{16,64}$"
                    },
                    "approvedAtMs": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "basis": {
                      "anyOf": [
                        {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "project_owner"
                                },
                                "projectId": {
                                  "type": "string",
                                  "pattern": "^prj_[a-f0-9]{32}$"
                                },
                                "ownerId": {
                                  "type": "string",
                                  "pattern": "^agt_[a-z0-9]{16,64}$"
                                },
                                "version": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "kind",
                                "projectId",
                                "ownerId",
                                "version"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "delegation"
                                },
                                "delegationId": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                },
                                "parentGrantId": {
                                  "type": "string",
                                  "pattern": "^grt_[a-f0-9]{32}$"
                                },
                                "parentVersion": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "version": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "kind",
                                "delegationId",
                                "version"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "role",
                    "principalId",
                    "approvedAtMs",
                    "basis"
                  ],
                  "additionalProperties": false
                }
              },
              "requiredApprovals": {
                "minItems": 1,
                "maxItems": 3,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "resource_authority",
                    "recipient",
                    "identity_binding"
                  ]
                }
              },
              "inviteExpiresAtMs": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "accessExpiresAtMs": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "state": {
                "type": "string",
                "enum": [
                  "pending",
                  "accepted",
                  "declined",
                  "cancelled",
                  "expired"
                ]
              },
              "grantIds": {
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^grt_[a-f0-9]{32}$"
                }
              }
            },
            "required": [
              "schemaVersion",
              "invitationId",
              "connectionId",
              "version",
              "organizationId",
              "issuerId",
              "recipientId",
              "edges",
              "approvals",
              "requiredApprovals",
              "inviteExpiresAtMs",
              "accessExpiresAtMs",
              "state",
              "grantIds"
            ],
            "additionalProperties": false
          },
          "grants": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "schemaVersion": {
                  "type": "string",
                  "const": "dancer-access/v1"
                },
                "grantId": {
                  "type": "string",
                  "pattern": "^grt_[a-f0-9]{32}$"
                },
                "version": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "organizationId": {
                  "type": "string",
                  "maxLength": 128,
                  "pattern": "^org_[A-Za-z0-9_-]+$"
                },
                "subjectId": {
                  "type": "string",
                  "pattern": "^agt_[a-z0-9]{16,64}$"
                },
                "connectionId": {
                  "type": "string",
                  "pattern": "^con_[a-f0-9]{32}$"
                },
                "sourceInvitationId": {
                  "type": "string",
                  "pattern": "^inv_[a-f0-9]{32}$"
                },
                "route": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "unbound"
                        },
                        "audienceVersion": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "audienceVersion"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "bound"
                        },
                        "recipientId": {
                          "type": "string",
                          "pattern": "^agt_[a-z0-9]{16,64}$"
                        },
                        "routeVersion": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "audienceVersion": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "recipientId",
                        "routeVersion",
                        "audienceVersion"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "permissions": {
                  "minItems": 1,
                  "maxItems": 32,
                  "type": "array",
                  "items": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.send"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "action",
                          "resource"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.read_addressed"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "action",
                          "resource"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.reply"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "source": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_sources"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_source"
                                  },
                                  "sourceMessageId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  },
                                  "conversationRootId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sourceMessageId",
                                  "conversationRootId"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "source"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.read_own_replies"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "source": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_sources"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_source"
                                  },
                                  "sourceMessageId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  },
                                  "conversationRootId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sourceMessageId",
                                  "conversationRootId"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "source"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.read_history"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "history": {
                            "type": "object",
                            "properties": {
                              "fromSequence": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "through": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "live"
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "sequence"
                                      },
                                      "sequence": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "sequence"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "required": [
                              "fromSequence",
                              "through"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "history"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.subscribe"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "referenceScope": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_sources"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_source"
                                  },
                                  "sourceMessageId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  },
                                  "conversationRootId": {
                                    "type": "string",
                                    "pattern": "^msg_[a-f0-9]{32}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sourceMessageId",
                                  "conversationRootId"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "referenceScope"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "action": {
                            "type": "string",
                            "const": "messages.wake"
                          },
                          "resource": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "messages.connection"
                              },
                              "organizationId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^org_[A-Za-z0-9_-]+$"
                              },
                              "projectId": {
                                "type": "string",
                                "pattern": "^prj_[a-f0-9]{32}$"
                              },
                              "threadId": {
                                "type": "string",
                                "pattern": "^thr_[a-f0-9]{32}$"
                              },
                              "connectionId": {
                                "type": "string",
                                "pattern": "^con_[a-f0-9]{32}$"
                              },
                              "senderId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              },
                              "recipientId": {
                                "type": "string",
                                "pattern": "^agt_[a-z0-9]{16,64}$"
                              }
                            },
                            "required": [
                              "kind",
                              "organizationId",
                              "projectId",
                              "threadId",
                              "connectionId",
                              "senderId",
                              "recipientId"
                            ],
                            "additionalProperties": false
                          },
                          "receiver": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "connection_binding"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "exact_binding"
                                  },
                                  "receiverBindingId": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                  },
                                  "generation": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "receiverBindingId",
                                  "generation"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "action",
                          "resource",
                          "receiver"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "basis": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "project_owner"
                        },
                        "projectId": {
                          "type": "string",
                          "pattern": "^prj_[a-f0-9]{32}$"
                        },
                        "ownerId": {
                          "type": "string",
                          "pattern": "^agt_[a-z0-9]{16,64}$"
                        },
                        "version": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "projectId",
                        "ownerId",
                        "version"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "delegation"
                        },
                        "delegationId": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                        },
                        "parentGrantId": {
                          "type": "string",
                          "pattern": "^grt_[a-f0-9]{32}$"
                        },
                        "parentVersion": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "version": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "delegationId",
                        "version"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "expiresAtMs": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "delegation": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "none"
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "bounded"
                        },
                        "permissions": {
                          "minItems": 1,
                          "maxItems": 32,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.send"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.read_addressed"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.reply"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_sources"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_source"
                                          },
                                          "sourceMessageId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          },
                                          "conversationRootId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "sourceMessageId",
                                          "conversationRootId"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "source"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.read_own_replies"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_sources"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_source"
                                          },
                                          "sourceMessageId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          },
                                          "conversationRootId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "sourceMessageId",
                                          "conversationRootId"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "source"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.read_history"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "history": {
                                    "type": "object",
                                    "properties": {
                                      "fromSequence": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "through": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "live"
                                              }
                                            },
                                            "required": [
                                              "kind"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "sequence"
                                              },
                                              "sequence": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "sequence"
                                            ],
                                            "additionalProperties": false
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "fromSequence",
                                      "through"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "history"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.subscribe"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "referenceScope": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_sources"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_source"
                                          },
                                          "sourceMessageId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          },
                                          "conversationRootId": {
                                            "type": "string",
                                            "pattern": "^msg_[a-f0-9]{32}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "sourceMessageId",
                                          "conversationRootId"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "referenceScope"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "const": "messages.wake"
                                  },
                                  "resource": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "messages.connection"
                                      },
                                      "organizationId": {
                                        "type": "string",
                                        "maxLength": 128,
                                        "pattern": "^org_[A-Za-z0-9_-]+$"
                                      },
                                      "projectId": {
                                        "type": "string",
                                        "pattern": "^prj_[a-f0-9]{32}$"
                                      },
                                      "threadId": {
                                        "type": "string",
                                        "pattern": "^thr_[a-f0-9]{32}$"
                                      },
                                      "connectionId": {
                                        "type": "string",
                                        "pattern": "^con_[a-f0-9]{32}$"
                                      },
                                      "senderId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      },
                                      "recipientId": {
                                        "type": "string",
                                        "pattern": "^agt_[a-z0-9]{16,64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "organizationId",
                                      "projectId",
                                      "threadId",
                                      "connectionId",
                                      "senderId",
                                      "recipientId"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "receiver": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "connection_binding"
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "exact_binding"
                                          },
                                          "receiverBindingId": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$"
                                          },
                                          "generation": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "receiverBindingId",
                                          "generation"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "resource",
                                  "receiver"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "maxExpiresAtMs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "remainingDepth": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 8
                        }
                      },
                      "required": [
                        "kind",
                        "permissions",
                        "maxExpiresAtMs",
                        "remainingDepth"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "pending_activation",
                    "active",
                    "suspended",
                    "revoked",
                    "expired"
                  ]
                }
              },
              "required": [
                "schemaVersion",
                "grantId",
                "version",
                "organizationId",
                "subjectId",
                "connectionId",
                "sourceInvitationId",
                "route",
                "permissions",
                "basis",
                "expiresAtMs",
                "delegation",
                "state"
              ],
              "additionalProperties": false
            }
          },
          "changed": {
            "type": "boolean"
          },
          "timedOut": {
            "type": "boolean"
          },
          "changeCursor": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "ok",
          "schemaVersion",
          "invitation",
          "grants",
          "changed",
          "timedOut",
          "changeCursor"
        ],
        "additionalProperties": false
      }
    }
  },
  "receiverAdapters": [
    {
      "adapter": "local_listener",
      "provisioning": "browserless_api",
      "enabled": false,
      "references": true,
      "wake": false
    },
    {
      "adapter": "signed_http",
      "provisioning": "browserless_api",
      "enabled": false,
      "references": true,
      "wake": true
    },
    {
      "adapter": "external_oauth",
      "provisioning": "existing_configuration_only",
      "enabled": false
    }
  ]
}
