Class: Collavre::Orchestration::Matcher
- Inherits:
-
Object
- Object
- Collavre::Orchestration::Matcher
- Defined in:
- app/services/collavre/orchestration/matcher.rb
Overview
Matcher determines which AI agents are qualified to respond to an event.
Matching strategies (in priority order):
-
Mention-based: If a user is @mentioned, route exclusively to that user
-
If mentioned user is AI agent → route to that agent only
-
If mentioned user is human → no AI agents respond
-
-
Expression-based: Evaluate each agent’s routing_expression (Liquid)
Permission checks:
-
All agents need feedback permission on the creative to respond
-
searchable only affects discoverability, not response permission
Instance Method Summary collapse
-
#initialize(context) ⇒ Matcher
constructor
A new instance of Matcher.
-
#match ⇒ Object
Returns Array of User (AI agents) that are qualified to respond.
Constructor Details
#initialize(context) ⇒ Matcher
Returns a new instance of Matcher.
18 19 20 |
# File 'app/services/collavre/orchestration/matcher.rb', line 18 def initialize(context) @context = context end |
Instance Method Details
#match ⇒ Object
Returns Array of User (AI agents) that are qualified to respond
23 24 25 26 27 28 29 30 |
# File 'app/services/collavre/orchestration/matcher.rb', line 23 def match # Priority 1: Mention-based routing (exclusive) mentioned_result = match_by_mention return mentioned_result unless mentioned_result.nil? # Priority 2: Liquid expression routing (fallback) match_by_expression end |