Class: Insika::Server::A2A::App
- Inherits:
-
Object
- Object
- Insika::Server::A2A::App
- Defined in:
- lib/insika/server/a2a/app.rb
Overview
A2A edge handler: injected sub-app mounted by Server::App. A2A is TRANSPORT — translates JSON-RPC↔Command on the SAME bus, projects Task→A2A, and NEVER leaks an exception (always an error object).
Instance Method Summary collapse
-
#agent_card ⇒ Object
GET /.well-known/agent-card.json.
-
#initialize(command_bus:, task_store:, session_store:, profiles:, skill_catalog:, config:) ⇒ App
constructor
A new instance of App.
-
#rpc(body) ⇒ Object
POST /a2a —
bodyis already the deserialized Hash.
Constructor Details
#initialize(command_bus:, task_store:, session_store:, profiles:, skill_catalog:, config:) ⇒ App
Returns a new instance of App.
17 18 19 20 21 22 23 24 |
# File 'lib/insika/server/a2a/app.rb', line 17 def initialize(command_bus:, task_store:, session_store:, profiles:, skill_catalog:, config:) @command_bus = command_bus @task_store = task_store @session_store = session_store @profiles = Insika::ProfileSource.coerce(profiles) @skill_catalog = skill_catalog @config = config # { a2a_agent:, base_url: } end |
Instance Method Details
#agent_card ⇒ Object
GET /.well-known/agent-card.json
38 39 40 41 42 |
# File 'lib/insika/server/a2a/app.rb', line 38 def agent_card agent = @profiles[@config[:a2a_agent]] skills = @skill_catalog.effective(agent.skills) AgentCard.build(agent: agent, base_url: @config[:base_url], skills: skills) end |
#rpc(body) ⇒ Object
POST /a2a — body is already the deserialized Hash. -> JSON-RPC envelope.
27 28 29 30 31 32 33 34 35 |
# File 'lib/insika/server/a2a/app.rb', line 27 def rpc(body) kind, parsed = Protocol.parse(body) return Protocol.error(parsed[:id], parsed[:code], parsed[:message]) if kind == :error dispatch_method(parsed[:id], parsed[:method], parsed[:params]) rescue StandardError => e # safety net: parse ok but something slipped through code, = Errors.from_exception(e) Protocol.error(nil, code, ) end |