Class: Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Competitor
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Competitor
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb
Constant Summary
Constants included from Constants
Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::BROADCAST_TTL, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::COMPETITION_THRESHOLD, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::DOMINANCE_MARGIN, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::MAX_BROADCAST_HISTORY, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::MAX_COALITION_SIZE, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::MAX_COMPETITORS, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::MAX_SUBSCRIBERS, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::MAX_URGENCY, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::SALIENCE_DECAY, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::SALIENCE_LABELS, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::URGENCY_BOOST, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::UTILIZATION_ALPHA, Legion::Extensions::Agentic::Integration::GlobalWorkspace::Helpers::Constants::WORKSPACE_STATE_LABELS
Instance Attribute Summary collapse
-
#coalition ⇒ Object
readonly
Returns the value of attribute coalition.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#salience ⇒ Object
Returns the value of attribute salience.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#submitted_at ⇒ Object
readonly
Returns the value of attribute submitted_at.
-
#urgency ⇒ Object
Returns the value of attribute urgency.
Instance Method Summary collapse
- #below_threshold? ⇒ Boolean
- #boost_urgency ⇒ Object
- #decay ⇒ Object
- #effective_salience ⇒ Object
-
#initialize(content:, source:, domain:, salience:, coalition: []) ⇒ Competitor
constructor
A new instance of Competitor.
- #to_h ⇒ Object
Constructor Details
#initialize(content:, source:, domain:, salience:, coalition: []) ⇒ Competitor
Returns a new instance of Competitor.
15 16 17 18 19 20 21 22 23 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 15 def initialize(content:, source:, domain:, salience:, coalition: []) @content = content @source = source @domain = domain @salience = salience.to_f.clamp(0.0, 1.0) @coalition = Array(coalition).first(MAX_COALITION_SIZE) @urgency = 0.0 @submitted_at = Time.now.utc end |
Instance Attribute Details
#coalition ⇒ Object (readonly)
Returns the value of attribute coalition.
12 13 14 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 12 def coalition @coalition end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
12 13 14 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 12 def content @content end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
12 13 14 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 12 def domain @domain end |
#salience ⇒ Object
Returns the value of attribute salience.
13 14 15 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 13 def salience @salience end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
12 13 14 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 12 def source @source end |
#submitted_at ⇒ Object (readonly)
Returns the value of attribute submitted_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 12 def submitted_at @submitted_at end |
#urgency ⇒ Object
Returns the value of attribute urgency.
13 14 15 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 13 def urgency @urgency end |
Instance Method Details
#below_threshold? ⇒ Boolean
37 38 39 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 37 def below_threshold? effective_salience < COMPETITION_THRESHOLD end |
#boost_urgency ⇒ Object
33 34 35 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 33 def boost_urgency @urgency = [@urgency + URGENCY_BOOST, MAX_URGENCY].min end |
#decay ⇒ Object
29 30 31 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 29 def decay @salience = [@salience - SALIENCE_DECAY, 0.0].max end |
#effective_salience ⇒ Object
25 26 27 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 25 def effective_salience (@salience + @urgency).clamp(0.0, 1.0) end |
#to_h ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb', line 41 def to_h { content: @content, source: @source, domain: @domain, salience: @salience.round(4), urgency: @urgency.round(4), effective_salience: effective_salience.round(4), coalition: @coalition, submitted_at: @submitted_at } end |