Class: Legion::Extensions::Agentic::Memory::Archaeology::Helpers::ExcavationSite
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Memory::Archaeology::Helpers::ExcavationSite
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb
Constant Summary
Constants included from Constants
Constants::ARTIFACT_TYPES, Constants::DEFAULT_PRESERVATION, Constants::DENSITY_LABELS, Constants::DEPTH_LABELS, Constants::DEPTH_PRESERVATION_MODIFIER, Constants::DEPTH_RARITY_WEIGHTS, Constants::DOMAIN_TYPES, Constants::EPOCH_NAMES, Constants::EXCAVATION_DEPTH_LEVELS, Constants::INTEGRITY_LABELS, Constants::MAX_ARTIFACTS, Constants::MAX_SITES, Constants::PRESERVATION_DECAY, Constants::PRESERVATION_LABELS, Constants::SEDIMENT_DENSITY_DEFAULT
Instance Attribute Summary collapse
-
#artifacts_found ⇒ Object
readonly
Returns the value of attribute artifacts_found.
-
#created_at ⇒ Object
(also: #started_at)
readonly
Returns the value of attribute created_at.
-
#current_depth ⇒ Object
readonly
Returns the value of attribute current_depth.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #complete? ⇒ Boolean
- #dig_deeper! ⇒ Object
- #excavate! ⇒ Object
-
#initialize(domain:) ⇒ ExcavationSite
constructor
A new instance of ExcavationSite.
- #survey ⇒ Object
- #to_h ⇒ Object
Methods included from Constants
Constructor Details
#initialize(domain:) ⇒ ExcavationSite
Returns a new instance of ExcavationSite.
16 17 18 19 20 21 22 23 |
# File 'lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb', line 16 def initialize(domain:) validate_domain!(domain) @id = SecureRandom.uuid @domain = domain.to_sym @current_depth = :surface @artifacts_found = [] @created_at = Time.now.utc end |
Instance Attribute Details
#artifacts_found ⇒ Object (readonly)
Returns the value of attribute artifacts_found.
12 13 14 |
# File 'lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb', line 12 def artifacts_found @artifacts_found end |
#created_at ⇒ Object (readonly) Also known as: started_at
Returns the value of attribute created_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb', line 12 def created_at @created_at end |
#current_depth ⇒ Object (readonly)
Returns the value of attribute current_depth.
12 13 14 |
# File 'lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb', line 12 def current_depth @current_depth end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
12 13 14 |
# File 'lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb', line 12 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb', line 12 def id @id end |
Instance Method Details
#complete? ⇒ Boolean
33 34 35 |
# File 'lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb', line 33 def complete? @current_depth == EXCAVATION_DEPTH_LEVELS.last end |
#dig_deeper! ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb', line 25 def dig_deeper! idx = EXCAVATION_DEPTH_LEVELS.index(@current_depth) || 0 return false if idx >= EXCAVATION_DEPTH_LEVELS.size - 1 @current_depth = EXCAVATION_DEPTH_LEVELS[idx + 1] true end |
#excavate! ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb', line 37 def excavate! weights = DEPTH_RARITY_WEIGHTS.fetch(@current_depth, {}) art_type = weighted_pick(weights) artifact = Artifact.new(type: art_type, domain: @domain, content: "#{art_type} from #{@current_depth}", depth_level: @current_depth, preservation: compute_base_preservation) @artifacts_found << artifact artifact end |
#survey ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb', line 48 def survey { id: @id, domain: @domain, current_depth: @current_depth, depth_label: DEPTH_LABELS.fetch(@current_depth, 'Unknown'), artifacts_count: @artifacts_found.size, complete: complete?, started_at: @created_at.iso8601 } end |
#to_h ⇒ Object
60 61 62 |
# File 'lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb', line 60 def to_h survey.merge(artifacts: @artifacts_found.map(&:to_h)) end |