Class: A2A::Server::Env

Inherits:
Object
  • Object
show all
Defined in:
lib/a2a/server/env.rb

Overview

Rack middleware that injects shared A2A context into the env.

Sets env and env so downstream middleware and handlers can access them without coupling to any particular configuration mechanism.

Instance Method Summary collapse

Constructor Details

#initialize(app, agent_card: {}, store: TaskStore.new) ⇒ Env

Returns a new instance of Env.



15
16
17
18
19
# File 'lib/a2a/server/env.rb', line 15

def initialize(app, agent_card: {}, store: TaskStore.new)
  @app = app
  @agent_card = agent_card
  @store = store
end

Instance Method Details

#call(env) ⇒ Object



21
22
23
24
25
# File 'lib/a2a/server/env.rb', line 21

def call(env)
  env["a2a.store"] = @store
  env["a2a.agent_card"] = @agent_card
  @app.call(env)
end