bankai/socket

The daemon transport + protocol layer. A resident daemon owns the Mnesia write authority; JSONL is no longer a fallback for mutations.

Types

pub type Request {
  Request(method: String, params: List(String))
}

Constructors

  • Request(method: String, params: List(String))
pub type Response {
  OkResponse(value: String)
  ErrorResponse(message: String)
}

Constructors

  • OkResponse(value: String)
  • ErrorResponse(message: String)

Values

pub fn client_request(
  workspace: String,
  method: String,
  params: List(String),
) -> Result(String, String)

Send one request to the daemon over the socket if it’s up. Returns Error when no daemon is listening (caller falls back to single-shot).

pub fn client_request_with_token(
  workspace: String,
  method: String,
  params: List(String),
  token: String,
) -> Result(String, String)

Send an attenuated request to the resident service. The token is included in the request only; errors and responses never echo bearer credentials.

pub fn handle_authenticated_line(
  workspace: String,
  line: String,
) -> String
pub fn handle_line(workspace: String, line: String) -> String

Handle one raw request line -> one response line (JSON).

pub fn handle_request(
  workspace: String,
  request: Request,
) -> Response
pub fn serve(workspace: String) -> Nil

Start an explicit local-mode daemon. A clustered profile is refused here so callers cannot accidentally create a second independent writer.

pub fn serve_clustered(workspace: String) -> Nil

Start an explicit clustered daemon. The platform profile and TLS-distribution admission config must agree before command admission can materialize Mnesia state. A bad config fails closed rather than emitting local-only cluster lies.

pub fn socket_path(workspace: String) -> String
Search Document