Class: Legion::Extensions::Agentic::Attention::Schema::Helpers::SchemaItem
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Attention::Schema::Helpers::SchemaItem
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb
Constant Summary
Constants included from Constants
Constants::ATTENTION_STATE_LABELS, Constants::AWARENESS_BOOST, Constants::AWARENESS_DECAY, Constants::AWARENESS_FLOOR, Constants::AWARENESS_LABELS, Constants::DEFAULT_AWARENESS, Constants::DRIFT_THRESHOLD, Constants::HYPERFOCUS_THRESHOLD, Constants::MAX_HISTORY, Constants::MAX_SCHEMA_ITEMS, Constants::MAX_SOCIAL_MODELS, Constants::META_ATTENTION_ALPHA, Constants::SCHEMA_UPDATE_ALPHA
Instance Attribute Summary collapse
-
#awareness_level ⇒ Object
Returns the value of attribute awareness_level.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#boost ⇒ Object
Apply a one-time boost (re-focus event).
-
#decay ⇒ Object
Apply per-tick decay.
-
#duration ⇒ Object
Duration in seconds since this item entered the schema.
-
#faded? ⇒ Boolean
True when awareness has dropped to the pruning floor.
-
#initialize(target:, domain:, reason:, source:, awareness_level: DEFAULT_AWARENESS) ⇒ SchemaItem
constructor
A new instance of SchemaItem.
-
#label ⇒ Object
Symbolic label describing current awareness intensity.
- #to_h ⇒ Object
Constructor Details
#initialize(target:, domain:, reason:, source:, awareness_level: DEFAULT_AWARENESS) ⇒ SchemaItem
Returns a new instance of SchemaItem.
15 16 17 18 19 20 21 22 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 15 def initialize(target:, domain:, reason:, source:, awareness_level: DEFAULT_AWARENESS) @target = target @domain = domain @reason = reason @source = source @awareness_level = awareness_level.clamp(0.0, 1.0) @created_at = Time.now.utc end |
Instance Attribute Details
#awareness_level ⇒ Object
Returns the value of attribute awareness_level.
13 14 15 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 13 def awareness_level @awareness_level end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 12 def created_at @created_at end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 12 def domain @domain end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 12 def reason @reason end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 12 def source @source end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 12 def target @target end |
Instance Method Details
#boost ⇒ Object
Apply a one-time boost (re-focus event)
30 31 32 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 30 def boost @awareness_level = [@awareness_level + AWARENESS_BOOST, 1.0].min end |
#decay ⇒ Object
Apply per-tick decay
35 36 37 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 35 def decay @awareness_level = [@awareness_level - AWARENESS_DECAY, AWARENESS_FLOOR].max end |
#duration ⇒ Object
Duration in seconds since this item entered the schema
25 26 27 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 25 def duration Time.now.utc - @created_at end |
#faded? ⇒ Boolean
True when awareness has dropped to the pruning floor
40 41 42 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 40 def faded? @awareness_level <= AWARENESS_FLOOR end |
#label ⇒ Object
Symbolic label describing current awareness intensity
45 46 47 48 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 45 def label AWARENESS_LABELS.each { |range, lbl| return lbl if range.cover?(@awareness_level) } :unconscious end |
#to_h ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/legion/extensions/agentic/attention/schema/helpers/schema_item.rb', line 50 def to_h { target: @target, domain: @domain, awareness_level: @awareness_level.round(4), label: label, reason: @reason, source: @source, duration: duration.round(2), created_at: @created_at } end |