Arcana::Service
A non-LLM service that listens on the Bus and handles requests using a fixed handler block. Validates input against a schema and follows the Protocol handshake automatically.
svc = Arcana::Service.new( bus: bus, directory: dir, address: "arcana:resizer", # owner:capability name: "Image Resizer", description: "Resizes images to specified dimensions", schema: JSON.parse(%({"type":"object","properties":{...},"required":["path","width"]})), tags: ["image"], ) do |data| # data is the validated JSON::Any payload path = data["path"].as_s JSON::Any.new({"output" => JSON::Any.new("/tmp/resized.png")}) end
svc.start # spawns a listener fiber
Requests run concurrently, at most max_concurrent at once (default
8; nil for no cap). The listing reports busy while at least one is in
flight. State the handler shares across requests belongs inside
ctx.exclusive (the handler's optional second argument, a
HandlerContext); see Toolset on shared state, and on lanes for a
handler in front of several backends.
Constructors
Instance methods
Run the block while no handler run holds the same key (see
HandlerContext#exclusive); returns its value.
Start listening for requests. Spawns a fiber that hands each request
to its own fiber, up to max_concurrent at once.