Class: KairosMcp::MeetingRouter
- Inherits:
-
Object
- Object
- KairosMcp::MeetingRouter
- Defined in:
- lib/kairos_mcp/meeting_router.rb
Overview
MeetingRouter handles MMP (Model Meeting Protocol) HTTP endpoints for P2P direct mode communication between KairosChain instances.
Endpoints are mounted under /meeting/v1/ on the HTTP server. These are only active when the MMP SkillSet is installed and enabled.
Constant Summary collapse
- JSON_HEADERS =
{ 'Content-Type' => 'application/json', 'Cache-Control' => 'no-cache' }.freeze
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize ⇒ MeetingRouter
constructor
A new instance of MeetingRouter.
- #reload_protocol ⇒ Object
-
#session_store ⇒ Object
Public accessor for session store (testing).
Constructor Details
#initialize ⇒ MeetingRouter
Returns a new instance of MeetingRouter.
18 19 20 21 22 23 |
# File 'lib/kairos_mcp/meeting_router.rb', line 18 def initialize @protocol = nil @identity = nil @exchange = nil @session_store = nil end |
Instance Method Details
#call(env) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/kairos_mcp/meeting_router.rb', line 25 def call(env) return unavailable_response unless mmp_available? request_method = env['REQUEST_METHOD'] path = env['PATH_INFO'] # Unauthenticated endpoints case [request_method, path] when ['GET', '/meeting/v1/introduce'] return handle_get_introduce when ['POST', '/meeting/v1/introduce'] return handle_post_introduce(env) when ['POST', '/meeting/v1/goodbye'] return handle_goodbye(env) end # All other endpoints require Bearer token authentication auth_result = authenticate_meeting_request!(env) return auth_result unless auth_result.nil? case [request_method, path] when ['POST', '/meeting/v1/message'] (env) when ['GET', '/meeting/v1/skills'] handle_list_skills when ['GET', '/meeting/v1/skill_details'] handle_skill_details(env) when ['POST', '/meeting/v1/skill_content'] handle_skill_content(env) when ['POST', '/meeting/v1/request_skill'] handle_request_skill(env) when ['POST', '/meeting/v1/reflect'] handle_reflect(env) when ['GET', '/meeting/v1/skillsets'] handle_list_skillsets when ['GET', '/meeting/v1/skillset_details'] handle_skillset_details(env) when ['POST', '/meeting/v1/skillset_content'] handle_skillset_content(env) else json_response(404, { error: 'not_found', message: "Unknown meeting endpoint: #{path}" }) end rescue StandardError => e $stderr.puts "[MeetingRouter] Error: #{e.}" $stderr.puts e.backtrace&.first(3)&.join("\n") json_response(500, { error: 'internal_error', message: 'An internal error occurred while processing the request' }) end |
#reload_protocol ⇒ Object
73 74 75 |
# File 'lib/kairos_mcp/meeting_router.rb', line 73 def reload_protocol @protocol = nil end |
#session_store ⇒ Object
Public accessor for session store (testing)
78 79 80 81 82 83 |
# File 'lib/kairos_mcp/meeting_router.rb', line 78 def session_store @session_store ||= begin require_relative '../../templates/skillsets/mmp/lib/mmp/meeting_session_store' MMP::MeetingSessionStore.new end end |