sig
  module Doc :
    sig
      type chapter = [ `Kernel | `Plugin of string | `Protocol ]
      type page
      val path : Server.Doc.page -> string
      val href : Server.Doc.page -> string -> Markdown.href
      val chapter : Server.Doc.page -> Server.Doc.chapter
      val page :
        Server.Doc.chapter ->
        title:string -> filename:string -> Server.Doc.page
      val publish :
        page:Server.Doc.page ->
        ?name:string ->
        ?index:string list ->
        title:string ->
        Markdown.elements -> Markdown.elements -> Markdown.href
      val dump : root:string -> ?meta:bool -> unit -> unit
    end
  module Syntax :
    sig
      type t
      val text : Server.Syntax.t -> Markdown.text
      val publish :
        page:Server.Doc.page ->
        name:string ->
        descr:Markdown.text ->
        synopsis:Server.Syntax.t ->
        ?details:Markdown.elements -> unit -> Server.Syntax.t
      val unit : Server.Syntax.t
      val any : Server.Syntax.t
      val int : Server.Syntax.t
      val ident : Server.Syntax.t
      val string : Server.Syntax.t
      val number : Server.Syntax.t
      val boolean : Server.Syntax.t
      val tag : string -> Server.Syntax.t
      val array : Server.Syntax.t -> Server.Syntax.t
      val tuple : Server.Syntax.t list -> Server.Syntax.t
      val union : Server.Syntax.t list -> Server.Syntax.t
      val option : Server.Syntax.t -> Server.Syntax.t
      val record : (string * Server.Syntax.t) list -> Server.Syntax.t
      type field = {
        name : string;
        syntax : Server.Syntax.t;
        descr : Markdown.text;
      }
      val fields :
        title:string -> Server.Syntax.field list -> Markdown.element
    end
  module Data :
    sig
      type json = Json.t
      val pretty : Format.formatter -> Server.Data.json -> unit
      module type S =
        sig
          type t
          val syntax : Server.Syntax.t
          val of_json : Server.Data.json -> Server.Data.S.t
          val to_json : Server.Data.S.t -> Server.Data.json
        end
      module type Info =
        sig
          val page : Server.Doc.page
          val name : string
          val descr : Markdown.text
        end
      type 'a data = (module Server.Data.S with type t = 'a)
      module type S_collection =
        sig
          type t
          val syntax : Syntax.t
          val of_json : json -> t
          val to_json : t -> json
          module Joption :
            sig
              type t = t option
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jlist :
            sig
              type t = t list
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jarray :
            sig
              type t = t array
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
        end
      module Collection :
        functor (A : S->
          sig
            type t = A.t
            val syntax : Syntax.t
            val of_json : json -> t
            val to_json : t -> json
            module Joption :
              sig
                type t = t option
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            module Jlist :
              sig
                type t = t list
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            module Jarray :
              sig
                type t = t array
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
          end
      module Joption :
        functor (A : S->
          sig
            type t = A.t option
            val syntax : Syntax.t
            val of_json : json -> t
            val to_json : t -> json
          end
      module Jpair :
        functor (A : S) (B : S->
          sig
            type t = A.t * B.t
            val syntax : Syntax.t
            val of_json : json -> t
            val to_json : t -> json
          end
      module Jtriple :
        functor (A : S) (B : S) (C : S->
          sig
            type t = A.t * B.t * C.t
            val syntax : Syntax.t
            val of_json : json -> t
            val to_json : t -> json
          end
      module Jlist :
        functor (A : S->
          sig
            type t = A.t list
            val syntax : Syntax.t
            val of_json : json -> t
            val to_json : t -> json
          end
      module Jarray :
        functor (A : S->
          sig
            type t = A.t array
            val syntax : Syntax.t
            val of_json : json -> t
            val to_json : t -> json
          end
      module Junit :
        sig
          type t = unit
          val syntax : Syntax.t
          val of_json : json -> t
          val to_json : t -> json
        end
      module Jany :
        sig
          type t = json
          val syntax : Syntax.t
          val of_json : json -> t
          val to_json : t -> json
        end
      module Jbool :
        sig
          type t = bool
          val syntax : Syntax.t
          val of_json : json -> t
          val to_json : t -> json
          module Joption :
            sig
              type t = t option
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jlist :
            sig
              type t = t list
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jarray :
            sig
              type t = t array
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
        end
      module Jint :
        sig
          type t = int
          val syntax : Syntax.t
          val of_json : json -> t
          val to_json : t -> json
          module Joption :
            sig
              type t = t option
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jlist :
            sig
              type t = t list
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jarray :
            sig
              type t = t array
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
        end
      module Jfloat :
        sig
          type t = float
          val syntax : Syntax.t
          val of_json : json -> t
          val to_json : t -> json
          module Joption :
            sig
              type t = t option
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jlist :
            sig
              type t = t list
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jarray :
            sig
              type t = t array
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
        end
      module Jstring :
        sig
          type t = string
          val syntax : Syntax.t
          val of_json : json -> t
          val to_json : t -> json
          module Joption :
            sig
              type t = t option
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jlist :
            sig
              type t = t list
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jarray :
            sig
              type t = t array
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
        end
      module Jident :
        sig
          type t = string
          val syntax : Syntax.t
          val of_json : json -> t
          val to_json : t -> json
          module Joption :
            sig
              type t = t option
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jlist :
            sig
              type t = t list
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jarray :
            sig
              type t = t array
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
        end
      module Jtext :
        sig
          type t = json
          val syntax : Syntax.t
          val of_json : json -> t
          val to_json : t -> json
        end
      type 'a record
      type 'a signature
      type ('a, 'b) field
      module Record :
        sig
          module type S =
            sig
              type r
              type t = r record
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
              val default : t
              val has :
                (Server.Data.Record.S.r, 'a) Server.Data.field -> t -> bool
              val get :
                (Server.Data.Record.S.r, 'a) Server.Data.field -> t -> 'a
              val set :
                (Server.Data.Record.S.r, 'a) Server.Data.field ->
                '-> t -> t
            end
          val signature :
            page:Server.Doc.page ->
            name:string ->
            descr:Markdown.text -> unit -> 'Server.Data.signature
          val field :
            'Server.Data.signature ->
            name:string ->
            descr:Markdown.text ->
            ?default:'-> 'Server.Data.data -> ('r, 'a) Server.Data.field
          val option :
            'Server.Data.signature ->
            name:string ->
            descr:Markdown.text ->
            'Server.Data.data -> ('r, 'a option) Server.Data.field
          val publish :
            'Server.Data.signature ->
            (module Server.Data.Record.S with type r = 'a)
        end
      module type Map =
        sig
          type 'a t
          type key
          val empty : 'Server.Data.Map.t
          val add :
            Server.Data.Map.key ->
            '-> 'Server.Data.Map.t -> 'Server.Data.Map.t
          val find : Server.Data.Map.key -> 'Server.Data.Map.t -> 'a
        end
      module type Index =
        sig
          type t
          val syntax : Syntax.t
          val of_json : json -> t
          val to_json : t -> json
          module Joption :
            sig
              type t = t option
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jlist :
            sig
              type t = t list
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          module Jarray :
            sig
              type t = t array
              val syntax : Syntax.t
              val of_json : json -> t
              val to_json : t -> json
            end
          val get : t -> int
          val find : int -> t
          val clear : unit -> unit
        end
      module Static :
        functor (M : Map) (I : Info->
          sig
            type t = M.key
            val syntax : Syntax.t
            val of_json : json -> t
            val to_json : t -> json
            module Joption :
              sig
                type t = t option
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            module Jlist :
              sig
                type t = t list
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            module Jarray :
              sig
                type t = t array
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            val get : t -> int
            val find : int -> t
            val clear : unit -> unit
          end
      module Index :
        functor (M : Map) (I : Info->
          sig
            type t = M.key
            val syntax : Syntax.t
            val of_json : json -> t
            val to_json : t -> json
            module Joption :
              sig
                type t = t option
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            module Jlist :
              sig
                type t = t list
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            module Jarray :
              sig
                type t = t array
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            val get : t -> int
            val find : int -> t
            val clear : unit -> unit
          end
      module type IdentifiedType =
        sig
          type t
          val id : Server.Data.IdentifiedType.t -> int
          val page : Doc.page
          val name : string
          val descr : Markdown.text
        end
      module Identified :
        functor (A : IdentifiedType->
          sig
            type t = A.t
            val syntax : Syntax.t
            val of_json : json -> t
            val to_json : t -> json
            module Joption :
              sig
                type t = t option
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            module Jlist :
              sig
                type t = t list
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            module Jarray :
              sig
                type t = t array
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            val get : t -> int
            val find : int -> t
            val clear : unit -> unit
          end
      module type Enum =
        sig
          type t
          val values : (Server.Data.Enum.t * string * Markdown.text) list
          val page : Doc.page
          val name : string
          val descr : Markdown.text
        end
      module Dictionary :
        functor (E : Enum->
          sig
            type t = E.t
            val syntax : Syntax.t
            val of_json : json -> t
            val to_json : t -> json
            module Joption :
              sig
                type t = t option
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            module Jlist :
              sig
                type t = t list
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
            module Jarray :
              sig
                type t = t array
                val syntax : Syntax.t
                val of_json : json -> t
                val to_json : t -> json
              end
          end
      exception InputError of string
      val failure :
        ?json:Server.Data.json ->
        ('a, Format.formatter, unit, 'b) Pervasives.format4 -> 'a
      val failure_from_type_error : string -> Server.Data.json -> 'a
    end
  module Request :
    sig
      type json = Server.Data.json
      type kind = [ `EXEC | `GET | `SET ]
      module type Input =
        sig
          type t
          val syntax : Server.Syntax.t
          val of_json : Server.Request.json -> Server.Request.Input.t
        end
      module type Output =
        sig
          type t
          val syntax : Server.Syntax.t
          val to_json : Server.Request.Output.t -> Server.Request.json
        end
      type 'a input = (module Server.Request.Input with type t = 'a)
      type 'b output = (module Server.Request.Output with type t = 'b)
      val register :
        page:Server.Doc.page ->
        kind:Server.Request.kind ->
        name:string ->
        descr:Markdown.text ->
        ?details:Markdown.block ->
        input:'Server.Request.input ->
        output:'Server.Request.output -> ('-> 'b) -> unit
      type ('a, 'b) signature
      val signature :
        page:Server.Doc.page ->
        kind:Server.Request.kind ->
        name:string ->
        descr:Markdown.text ->
        ?details:Markdown.block ->
        ?input:'Server.Request.input ->
        ?output:'Server.Request.output ->
        unit -> ('a, 'b) Server.Request.signature
      type rq
      type 'a param = Server.Request.rq -> 'a
      type 'b result = Server.Request.rq -> '-> unit
      val register_sig :
        ('a, 'b) Server.Request.signature ->
        (Server.Request.rq -> '-> 'b) -> unit
      val param :
        (unit, 'b) Server.Request.signature ->
        name:string ->
        descr:Markdown.text ->
        ?default:'-> 'Server.Request.input -> 'Server.Request.param
      val param_opt :
        (unit, 'b) Server.Request.signature ->
        name:string ->
        descr:Markdown.text ->
        'Server.Request.input -> 'a option Server.Request.param
      val result :
        ('a, unit) Server.Request.signature ->
        name:string ->
        descr:Markdown.text ->
        ?default:'-> 'Server.Request.output -> 'Server.Request.result
      val result_opt :
        ('a, unit) Server.Request.signature ->
        name:string ->
        descr:Markdown.text ->
        'Server.Request.output -> 'b option Server.Request.result
    end
end