Class: Legion::Extensions::Agentic::Attention::Subliminal::Helpers::InfluenceEvent

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/legion/extensions/agentic/attention/subliminal/helpers/influence_event.rb

Constant Summary

Constants included from Constants

Constants::ACCUMULATION_RATE, Constants::ACTIVATION_BOOST, Constants::ACTIVATION_DECAY, Constants::ACTIVATION_LABELS, Constants::CONSCIOUS_THRESHOLD, Constants::DEFAULT_ACTIVATION, Constants::EXTINCTION_THRESHOLD, Constants::INFLUENCE_LABELS, Constants::INFLUENCE_STRENGTH, Constants::INFLUENCE_TARGETS, Constants::MAX_INFLUENCES, Constants::MAX_INFLUENCE_PER_DOMAIN, Constants::MAX_TOTAL_INFLUENCE, Constants::MAX_TRACES, Constants::SATURATION_LABELS, Constants::SUBLIMINAL_CEILING, Constants::SUBLIMINAL_FLOOR, Constants::TRACE_TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Constants

label_for

Constructor Details

#initialize(trace_id:, target:, magnitude:, domain: :general) ⇒ InfluenceEvent

Returns a new instance of InfluenceEvent.



16
17
18
19
20
21
22
23
# File 'lib/legion/extensions/agentic/attention/subliminal/helpers/influence_event.rb', line 16

def initialize(trace_id:, target:, magnitude:, domain: :general)
  @id = SecureRandom.uuid
  @trace_id = trace_id
  @target = target.to_sym
  @magnitude = magnitude.to_f.clamp(0.0, MAX_INFLUENCE_PER_DOMAIN).round(10)
  @domain = domain.to_sym
  @created_at = Time.now
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



14
15
16
# File 'lib/legion/extensions/agentic/attention/subliminal/helpers/influence_event.rb', line 14

def created_at
  @created_at
end

#domainObject (readonly)

Returns the value of attribute domain.



14
15
16
# File 'lib/legion/extensions/agentic/attention/subliminal/helpers/influence_event.rb', line 14

def domain
  @domain
end

#idObject (readonly)

Returns the value of attribute id.



14
15
16
# File 'lib/legion/extensions/agentic/attention/subliminal/helpers/influence_event.rb', line 14

def id
  @id
end

#magnitudeObject (readonly)

Returns the value of attribute magnitude.



14
15
16
# File 'lib/legion/extensions/agentic/attention/subliminal/helpers/influence_event.rb', line 14

def magnitude
  @magnitude
end

#targetObject (readonly)

Returns the value of attribute target.



14
15
16
# File 'lib/legion/extensions/agentic/attention/subliminal/helpers/influence_event.rb', line 14

def target
  @target
end

#trace_idObject (readonly)

Returns the value of attribute trace_id.



14
15
16
# File 'lib/legion/extensions/agentic/attention/subliminal/helpers/influence_event.rb', line 14

def trace_id
  @trace_id
end

Instance Method Details

#significant?Boolean

Returns:

  • (Boolean)


25
# File 'lib/legion/extensions/agentic/attention/subliminal/helpers/influence_event.rb', line 25

def significant? = @magnitude >= 0.05

#subtle?Boolean

Returns:

  • (Boolean)


26
# File 'lib/legion/extensions/agentic/attention/subliminal/helpers/influence_event.rb', line 26

def subtle? = @magnitude < 0.05 && @magnitude > 0.0

#to_hObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/legion/extensions/agentic/attention/subliminal/helpers/influence_event.rb', line 28

def to_h
  {
    id:         @id,
    trace_id:   @trace_id,
    target:     @target,
    magnitude:  @magnitude,
    domain:     @domain,
    created_at: @created_at.iso8601
  }
end