Class: Legion::Extensions::Agentic::Attention::Blindspot::Helpers::Blindspot
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Attention::Blindspot::Helpers::Blindspot
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb
Constant Summary
Constants included from Constants
Constants::AWARENESS_LABELS, Constants::AWARENESS_THRESHOLD, Constants::COVERAGE_LABELS, Constants::DEFAULT_SEVERITY, Constants::DISCOVERY_METHODS, Constants::MAX_BLINDSPOTS, Constants::MAX_BOUNDARIES, Constants::SEVERITY_BOOST, Constants::SEVERITY_LABELS, Constants::STATUS_LABELS
Instance Attribute Summary collapse
-
#acknowledged_at ⇒ Object
readonly
Returns the value of attribute acknowledged_at.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#discovered_by ⇒ Object
readonly
Returns the value of attribute discovered_by.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#mitigated_at ⇒ Object
readonly
Returns the value of attribute mitigated_at.
-
#resolved_at ⇒ Object
readonly
Returns the value of attribute resolved_at.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #acknowledge! ⇒ Object
- #acknowledged? ⇒ Boolean
- #active? ⇒ Boolean
- #boost_severity!(amount: SEVERITY_BOOST) ⇒ Object
-
#initialize(domain:, discovered_by:, description:, severity: DEFAULT_SEVERITY) ⇒ Blindspot
constructor
A new instance of Blindspot.
- #mitigate!(boost: SEVERITY_BOOST) ⇒ Object
- #resolve! ⇒ Object
- #resolved? ⇒ Boolean
- #severity_label ⇒ Object
- #to_h ⇒ Object
Methods included from Constants
Constructor Details
#initialize(domain:, discovered_by:, description:, severity: DEFAULT_SEVERITY) ⇒ Blindspot
Returns a new instance of Blindspot.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 17 def initialize(domain:, discovered_by:, description:, severity: DEFAULT_SEVERITY) @id = SecureRandom.uuid @domain = domain.to_sym @discovered_by = discovered_by.to_sym @description = description.to_s @severity = severity.to_f.clamp(0.0, 1.0) @status = :active @created_at = Time.now.utc @acknowledged_at = nil @mitigated_at = nil @resolved_at = nil end |
Instance Attribute Details
#acknowledged_at ⇒ Object (readonly)
Returns the value of attribute acknowledged_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 14 def acknowledged_at @acknowledged_at end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 14 def created_at @created_at end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 14 def description @description end |
#discovered_by ⇒ Object (readonly)
Returns the value of attribute discovered_by.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 14 def discovered_by @discovered_by end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 14 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 14 def id @id end |
#mitigated_at ⇒ Object (readonly)
Returns the value of attribute mitigated_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 14 def mitigated_at @mitigated_at end |
#resolved_at ⇒ Object (readonly)
Returns the value of attribute resolved_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 14 def resolved_at @resolved_at end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 14 def severity @severity end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 14 def status @status end |
Instance Method Details
#acknowledge! ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 46 def acknowledge! return self if @status != :active @status = :acknowledged @acknowledged_at = Time.now.utc self end |
#acknowledged? ⇒ Boolean
38 39 40 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 38 def acknowledged? @status == :acknowledged || @status == :mitigated || @status == :resolved end |
#active? ⇒ Boolean
34 35 36 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 34 def active? @status == :active end |
#boost_severity!(amount: SEVERITY_BOOST) ⇒ Object
69 70 71 72 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 69 def boost_severity!(amount: SEVERITY_BOOST) @severity = (@severity + amount).clamp(0.0, 1.0).round(10) self end |
#mitigate!(boost: SEVERITY_BOOST) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 54 def mitigate!(boost: SEVERITY_BOOST) acknowledge! if @status == :active @status = :mitigated @mitigated_at = Time.now.utc @severity = (@severity - boost).clamp(0.0, 1.0).round(10) self end |
#resolve! ⇒ Object
62 63 64 65 66 67 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 62 def resolve! acknowledge! if @status == :active @status = :resolved @resolved_at = Time.now.utc self end |
#resolved? ⇒ Boolean
42 43 44 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 42 def resolved? @status == :resolved end |
#severity_label ⇒ Object
30 31 32 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 30 def severity_label Constants.label_for(SEVERITY_LABELS, @severity) || :negligible end |
#to_h ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/blindspot.rb', line 74 def to_h { id: @id, domain: @domain, discovered_by: @discovered_by, description: @description, severity: @severity, severity_label: severity_label, status: @status, active: active?, acknowledged: acknowledged?, resolved: resolved?, created_at: @created_at, acknowledged_at: @acknowledged_at, mitigated_at: @mitigated_at, resolved_at: @resolved_at } end |