Arcana::Server
Network gateway — exposes the Bus and Directory over WebSocket + REST.
WebSocket clients connect, join with an address, and become full participants on the local Bus. Transparent bridging — local actors don't know whether they're talking to a local or remote agent.
REST endpoints expose the Directory for discovery and health checks.
bus = Arcana::Bus.new dir = Arcana::Directory.new server = Arcana::Server.new(bus, dir, port: 19118) server.start # blocking
Constants
Where a signed request's key goes once its signature checks. One a client sends is dropped first.
Constructors
Class methods
Some MCP clients (and hand-rolled HTTP callers) stringify the payload
instead of nesting it as JSON — the tool schema advertised the field as
"any JSON value" with no type, so a client can rationally send
payload: "{\"text\":\"hi\"}". Left alone, schema-validated services
(openai:tts, anthropic:chat, ...) look for their fields at the top
level of the payload, don't find them, and reply "missing required
fields." Auto-unwrap looks-like-JSON strings back to real objects.
A literal string payload like "hello" stays a string. The MCP
bridge does the same before filing its copy of a message it sends.
Has the sender proved address is its own, showing the key or the
owner token the address is held by? An address held by neither
proves nothing.
Instance methods
Other names for this machine, besides localhost and its loopback
addresses, that requests may use (see LocalGuard).
Other names for this machine, besides localhost and its loopback
addresses, that requests may use (see LocalGuard).
When true, every REST request (except /health) and every WebSocket
upgrade must present a valid Authorization: Bearer ak_... header
that resolves via Arcana::Auth::ApiKey.verify. Requires the identity
store (ARCANA_DATABASE_URL).
When true, every REST request (except /health) and every WebSocket
upgrade must present a valid Authorization: Bearer ak_... header
that resolves via Arcana::Auth::ApiKey.verify. Requires the identity
store (ARCANA_DATABASE_URL).
Optional event recorder for auth failures and server lifecycle.
Callback invoked after every state-changing REST op (/register,
/unregister). The daemon wires this to Snapshot.save so state
is persisted through the same path as graceful-shutdown saves —
which respects the ephemeral flag and doesn't accumulate
code-registered zombies across restarts.
Callback invoked after every state-changing REST op (/register,
/unregister). The daemon wires this to Snapshot.save so state
is persisted through the same path as graceful-shutdown saves —
which respects the ephemeral flag and doesn't accumulate
code-registered zombies across restarts.
TODO: Revisit token auth — currently a simple shared secret per address. Consider JWT, expiry, or key length requirements if Arcana is ever exposed beyond localhost.