agent2agentSourceA2AServerTriage

class Triage

Rack middleware that resolves which A2A operation a request targets.

Reads the raw protocol data left in env by the binding middleware (JSON-RPC method name or HTTP verb + path), looks up the matching Proto::Operation, wraps the request body into a Schema::Definition, and sets env keys for downstream consumption by the Dispatcher.

Env keys read: "a2a.json_rpc_method" — set by Bindings::JsonRpc "a2a.verb" — set by Bindings::Rest "a2a.path" — set by Bindings::Rest "a2a.body" — set by either binding

Env keys set: "a2a.operation" — operation name string (e.g. "SendMessage") "a2a.proto_operation" — Proto::Operation instance "a2a.request" — Schema::Definition instance (validated request)

Definitions

def path_matches?(pattern, path)

Match a proto path pattern like "/tasks/id=*" against an actual request path like "/tasks/abc-123".

Implementation

def path_matches?(pattern, path)
  regex = pattern_to_regex(pattern)
  path.match?(regex)
end