lex-agentic-imagination 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +5 -0
- data/LICENSE +21 -0
- data/README.md +13 -0
- data/lex-agentic-imagination.gemspec +34 -0
- data/lib/legion/extensions/agentic/imagination/alchemy/client.rb +15 -0
- data/lib/legion/extensions/agentic/imagination/alchemy/helpers/alchemy_engine.rb +140 -0
- data/lib/legion/extensions/agentic/imagination/alchemy/helpers/constants.rb +76 -0
- data/lib/legion/extensions/agentic/imagination/alchemy/helpers/crucible.rb +80 -0
- data/lib/legion/extensions/agentic/imagination/alchemy/helpers/substance.rb +118 -0
- data/lib/legion/extensions/agentic/imagination/alchemy/runners/cognitive_alchemy.rb +88 -0
- data/lib/legion/extensions/agentic/imagination/alchemy/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/alchemy.rb +22 -0
- data/lib/legion/extensions/agentic/imagination/aurora/client.rb +25 -0
- data/lib/legion/extensions/agentic/imagination/aurora/helpers/aurora_engine.rb +123 -0
- data/lib/legion/extensions/agentic/imagination/aurora/helpers/aurora_event.rb +85 -0
- data/lib/legion/extensions/agentic/imagination/aurora/helpers/constants.rb +91 -0
- data/lib/legion/extensions/agentic/imagination/aurora/helpers/spectral_band.rb +79 -0
- data/lib/legion/extensions/agentic/imagination/aurora/runners/cognitive_aurora.rb +84 -0
- data/lib/legion/extensions/agentic/imagination/aurora/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/aurora.rb +22 -0
- data/lib/legion/extensions/agentic/imagination/constellation/client.rb +15 -0
- data/lib/legion/extensions/agentic/imagination/constellation/helpers/constants.rb +59 -0
- data/lib/legion/extensions/agentic/imagination/constellation/helpers/constellation.rb +90 -0
- data/lib/legion/extensions/agentic/imagination/constellation/helpers/sky_engine.rb +131 -0
- data/lib/legion/extensions/agentic/imagination/constellation/helpers/star.rb +92 -0
- data/lib/legion/extensions/agentic/imagination/constellation/runners/cognitive_constellation.rb +76 -0
- data/lib/legion/extensions/agentic/imagination/constellation/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/constellation.rb +22 -0
- data/lib/legion/extensions/agentic/imagination/creativity/client.rb +27 -0
- data/lib/legion/extensions/agentic/imagination/creativity/helpers/constants.rb +50 -0
- data/lib/legion/extensions/agentic/imagination/creativity/helpers/creative_engine.rb +151 -0
- data/lib/legion/extensions/agentic/imagination/creativity/helpers/idea.rb +106 -0
- data/lib/legion/extensions/agentic/imagination/creativity/helpers/idea_store.rb +103 -0
- data/lib/legion/extensions/agentic/imagination/creativity/runners/creativity.rb +176 -0
- data/lib/legion/extensions/agentic/imagination/creativity/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/creativity.rb +20 -0
- data/lib/legion/extensions/agentic/imagination/dream/actors/dream_cycle.rb +45 -0
- data/lib/legion/extensions/agentic/imagination/dream/client.rb +29 -0
- data/lib/legion/extensions/agentic/imagination/dream/helpers/agenda.rb +74 -0
- data/lib/legion/extensions/agentic/imagination/dream/helpers/association_walker.rb +59 -0
- data/lib/legion/extensions/agentic/imagination/dream/helpers/constants.rb +34 -0
- data/lib/legion/extensions/agentic/imagination/dream/helpers/contradiction_detector.rb +86 -0
- data/lib/legion/extensions/agentic/imagination/dream/helpers/dream_journal.rb +231 -0
- data/lib/legion/extensions/agentic/imagination/dream/helpers/dream_store.rb +91 -0
- data/lib/legion/extensions/agentic/imagination/dream/helpers/llm_enhancer.rb +273 -0
- data/lib/legion/extensions/agentic/imagination/dream/runners/dream_cycle.rb +328 -0
- data/lib/legion/extensions/agentic/imagination/dream/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/dream.rb +23 -0
- data/lib/legion/extensions/agentic/imagination/embodied_simulation/client.rb +19 -0
- data/lib/legion/extensions/agentic/imagination/embodied_simulation/helpers/constants.rb +49 -0
- data/lib/legion/extensions/agentic/imagination/embodied_simulation/helpers/simulation.rb +136 -0
- data/lib/legion/extensions/agentic/imagination/embodied_simulation/helpers/simulation_engine.rb +180 -0
- data/lib/legion/extensions/agentic/imagination/embodied_simulation/helpers/simulation_step.rb +49 -0
- data/lib/legion/extensions/agentic/imagination/embodied_simulation/runners/embodied_simulation.rb +99 -0
- data/lib/legion/extensions/agentic/imagination/embodied_simulation/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/embodied_simulation.rb +21 -0
- data/lib/legion/extensions/agentic/imagination/garden/client.rb +15 -0
- data/lib/legion/extensions/agentic/imagination/garden/helpers/constants.rb +49 -0
- data/lib/legion/extensions/agentic/imagination/garden/helpers/garden_engine.rb +138 -0
- data/lib/legion/extensions/agentic/imagination/garden/helpers/plant.rb +116 -0
- data/lib/legion/extensions/agentic/imagination/garden/helpers/plot.rb +95 -0
- data/lib/legion/extensions/agentic/imagination/garden/runners/cognitive_garden.rb +75 -0
- data/lib/legion/extensions/agentic/imagination/garden/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/garden.rb +22 -0
- data/lib/legion/extensions/agentic/imagination/genesis/client.rb +27 -0
- data/lib/legion/extensions/agentic/imagination/genesis/helpers/concept.rb +86 -0
- data/lib/legion/extensions/agentic/imagination/genesis/helpers/constants.rb +132 -0
- data/lib/legion/extensions/agentic/imagination/genesis/helpers/genesis_engine.rb +251 -0
- data/lib/legion/extensions/agentic/imagination/genesis/helpers/seed.rb +70 -0
- data/lib/legion/extensions/agentic/imagination/genesis/runners/genesis.rb +105 -0
- data/lib/legion/extensions/agentic/imagination/genesis/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/genesis.rb +20 -0
- data/lib/legion/extensions/agentic/imagination/greenhouse/client.rb +24 -0
- data/lib/legion/extensions/agentic/imagination/greenhouse/helpers/constants.rb +89 -0
- data/lib/legion/extensions/agentic/imagination/greenhouse/helpers/greenhouse.rb +116 -0
- data/lib/legion/extensions/agentic/imagination/greenhouse/helpers/greenhouse_engine.rb +121 -0
- data/lib/legion/extensions/agentic/imagination/greenhouse/helpers/seedling.rb +155 -0
- data/lib/legion/extensions/agentic/imagination/greenhouse/runners/cognitive_greenhouse.rb +87 -0
- data/lib/legion/extensions/agentic/imagination/greenhouse/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/greenhouse.rb +21 -0
- data/lib/legion/extensions/agentic/imagination/imagery/client.rb +21 -0
- data/lib/legion/extensions/agentic/imagination/imagery/helpers/constants.rb +55 -0
- data/lib/legion/extensions/agentic/imagination/imagery/helpers/scenario.rb +123 -0
- data/lib/legion/extensions/agentic/imagination/imagery/helpers/simulation_store.rb +80 -0
- data/lib/legion/extensions/agentic/imagination/imagery/runners/imagination.rb +210 -0
- data/lib/legion/extensions/agentic/imagination/imagery/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/imagery.rb +20 -0
- data/lib/legion/extensions/agentic/imagination/liminal/client.rb +19 -0
- data/lib/legion/extensions/agentic/imagination/liminal/helpers/constants.rb +79 -0
- data/lib/legion/extensions/agentic/imagination/liminal/helpers/liminal_engine.rb +115 -0
- data/lib/legion/extensions/agentic/imagination/liminal/helpers/threshold_crossing.rb +136 -0
- data/lib/legion/extensions/agentic/imagination/liminal/runners/cognitive_liminal.rb +72 -0
- data/lib/legion/extensions/agentic/imagination/liminal/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/liminal.rb +19 -0
- data/lib/legion/extensions/agentic/imagination/lucidity/client.rb +25 -0
- data/lib/legion/extensions/agentic/imagination/lucidity/helpers/constants.rb +48 -0
- data/lib/legion/extensions/agentic/imagination/lucidity/helpers/dream_state.rb +135 -0
- data/lib/legion/extensions/agentic/imagination/lucidity/helpers/journal_entry.rb +68 -0
- data/lib/legion/extensions/agentic/imagination/lucidity/helpers/lucidity_engine.rb +181 -0
- data/lib/legion/extensions/agentic/imagination/lucidity/runners/cognitive_lucidity.rb +95 -0
- data/lib/legion/extensions/agentic/imagination/lucidity/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/lucidity.rb +22 -0
- data/lib/legion/extensions/agentic/imagination/mental_simulation/helpers/client.rb +23 -0
- data/lib/legion/extensions/agentic/imagination/mental_simulation/helpers/constants.rb +43 -0
- data/lib/legion/extensions/agentic/imagination/mental_simulation/helpers/simulation.rb +116 -0
- data/lib/legion/extensions/agentic/imagination/mental_simulation/helpers/simulation_engine.rb +141 -0
- data/lib/legion/extensions/agentic/imagination/mental_simulation/helpers/simulation_step.rb +53 -0
- data/lib/legion/extensions/agentic/imagination/mental_simulation/runners/mental_simulation.rb +92 -0
- data/lib/legion/extensions/agentic/imagination/mental_simulation/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/mental_simulation.rb +20 -0
- data/lib/legion/extensions/agentic/imagination/origami/client.rb +41 -0
- data/lib/legion/extensions/agentic/imagination/origami/helpers/constants.rb +29 -0
- data/lib/legion/extensions/agentic/imagination/origami/helpers/crease.rb +53 -0
- data/lib/legion/extensions/agentic/imagination/origami/helpers/figure.rb +106 -0
- data/lib/legion/extensions/agentic/imagination/origami/helpers/origami_engine.rb +116 -0
- data/lib/legion/extensions/agentic/imagination/origami/runners/cognitive_origami.rb +71 -0
- data/lib/legion/extensions/agentic/imagination/origami/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/origami.rb +22 -0
- data/lib/legion/extensions/agentic/imagination/prospection/actors/decay.rb +45 -0
- data/lib/legion/extensions/agentic/imagination/prospection/client.rb +26 -0
- data/lib/legion/extensions/agentic/imagination/prospection/helpers/constants.rb +41 -0
- data/lib/legion/extensions/agentic/imagination/prospection/helpers/prospection_engine.rb +129 -0
- data/lib/legion/extensions/agentic/imagination/prospection/helpers/scenario.rb +120 -0
- data/lib/legion/extensions/agentic/imagination/prospection/runners/prospection.rb +127 -0
- data/lib/legion/extensions/agentic/imagination/prospection/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/prospection.rb +20 -0
- data/lib/legion/extensions/agentic/imagination/time_travel/client.rb +27 -0
- data/lib/legion/extensions/agentic/imagination/time_travel/helpers/constants.rb +37 -0
- data/lib/legion/extensions/agentic/imagination/time_travel/helpers/mental_journey.rb +149 -0
- data/lib/legion/extensions/agentic/imagination/time_travel/helpers/temporal_waypoint.rb +68 -0
- data/lib/legion/extensions/agentic/imagination/time_travel/helpers/time_traveler.rb +205 -0
- data/lib/legion/extensions/agentic/imagination/time_travel/runners/mental_time_travel.rb +145 -0
- data/lib/legion/extensions/agentic/imagination/time_travel/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/time_travel.rb +20 -0
- data/lib/legion/extensions/agentic/imagination/version.rb +11 -0
- data/lib/legion/extensions/agentic/imagination/volcano/client.rb +47 -0
- data/lib/legion/extensions/agentic/imagination/volcano/helpers/chamber.rb +123 -0
- data/lib/legion/extensions/agentic/imagination/volcano/helpers/constants.rb +45 -0
- data/lib/legion/extensions/agentic/imagination/volcano/helpers/magma.rb +72 -0
- data/lib/legion/extensions/agentic/imagination/volcano/helpers/volcano_engine.rb +120 -0
- data/lib/legion/extensions/agentic/imagination/volcano/runners/cognitive_volcano.rb +108 -0
- data/lib/legion/extensions/agentic/imagination/volcano/version.rb +13 -0
- data/lib/legion/extensions/agentic/imagination/volcano.rb +21 -0
- data/lib/legion/extensions/agentic/imagination.rb +34 -0
- data/spec/legion/extensions/agentic/imagination/alchemy/client_spec.rb +16 -0
- data/spec/legion/extensions/agentic/imagination/alchemy/helpers/alchemy_engine_spec.rb +145 -0
- data/spec/legion/extensions/agentic/imagination/alchemy/helpers/constants_spec.rb +45 -0
- data/spec/legion/extensions/agentic/imagination/alchemy/helpers/crucible_spec.rb +111 -0
- data/spec/legion/extensions/agentic/imagination/alchemy/helpers/substance_spec.rb +174 -0
- data/spec/legion/extensions/agentic/imagination/alchemy/runners/cognitive_alchemy_spec.rb +99 -0
- data/spec/legion/extensions/agentic/imagination/aurora/client_spec.rb +164 -0
- data/spec/legion/extensions/agentic/imagination/aurora/helpers/aurora_engine_spec.rb +291 -0
- data/spec/legion/extensions/agentic/imagination/aurora/helpers/aurora_event_spec.rb +217 -0
- data/spec/legion/extensions/agentic/imagination/aurora/helpers/spectral_band_spec.rb +186 -0
- data/spec/legion/extensions/agentic/imagination/constellation/client_spec.rb +16 -0
- data/spec/legion/extensions/agentic/imagination/constellation/helpers/constants_spec.rb +35 -0
- data/spec/legion/extensions/agentic/imagination/constellation/helpers/constellation_spec.rb +116 -0
- data/spec/legion/extensions/agentic/imagination/constellation/helpers/sky_engine_spec.rb +136 -0
- data/spec/legion/extensions/agentic/imagination/constellation/helpers/star_spec.rb +126 -0
- data/spec/legion/extensions/agentic/imagination/constellation/runners/cognitive_constellation_spec.rb +86 -0
- data/spec/legion/extensions/agentic/imagination/creativity/client_spec.rb +68 -0
- data/spec/legion/extensions/agentic/imagination/creativity/helpers/constants_spec.rb +129 -0
- data/spec/legion/extensions/agentic/imagination/creativity/helpers/creative_engine_spec.rb +220 -0
- data/spec/legion/extensions/agentic/imagination/creativity/helpers/idea_store_spec.rb +232 -0
- data/spec/legion/extensions/agentic/imagination/creativity/runners/creativity_spec.rb +237 -0
- data/spec/legion/extensions/agentic/imagination/dream/actors/dream_cycle_spec.rb +51 -0
- data/spec/legion/extensions/agentic/imagination/dream/client_spec.rb +27 -0
- data/spec/legion/extensions/agentic/imagination/dream/helpers/agenda_spec.rb +148 -0
- data/spec/legion/extensions/agentic/imagination/dream/helpers/association_walker_spec.rb +123 -0
- data/spec/legion/extensions/agentic/imagination/dream/helpers/contradiction_detector_spec.rb +183 -0
- data/spec/legion/extensions/agentic/imagination/dream/helpers/dream_store_spec.rb +141 -0
- data/spec/legion/extensions/agentic/imagination/dream/integration_spec.rb +98 -0
- data/spec/legion/extensions/agentic/imagination/dream/runners/dream_cycle_spec.rb +116 -0
- data/spec/legion/extensions/agentic/imagination/embodied_simulation/client_spec.rb +44 -0
- data/spec/legion/extensions/agentic/imagination/embodied_simulation/helpers/simulation_engine_spec.rb +201 -0
- data/spec/legion/extensions/agentic/imagination/embodied_simulation/helpers/simulation_spec.rb +178 -0
- data/spec/legion/extensions/agentic/imagination/embodied_simulation/helpers/simulation_step_spec.rb +83 -0
- data/spec/legion/extensions/agentic/imagination/embodied_simulation/runners/embodied_simulation_spec.rb +124 -0
- data/spec/legion/extensions/agentic/imagination/garden/client_spec.rb +34 -0
- data/spec/legion/extensions/agentic/imagination/garden/helpers/constants_spec.rb +41 -0
- data/spec/legion/extensions/agentic/imagination/garden/helpers/garden_engine_spec.rb +119 -0
- data/spec/legion/extensions/agentic/imagination/garden/helpers/plant_spec.rb +147 -0
- data/spec/legion/extensions/agentic/imagination/garden/helpers/plot_spec.rb +92 -0
- data/spec/legion/extensions/agentic/imagination/garden/runners/cognitive_garden_spec.rb +75 -0
- data/spec/legion/extensions/agentic/imagination/genesis/client_spec.rb +110 -0
- data/spec/legion/extensions/agentic/imagination/genesis/cognitive_genesis_spec.rb +31 -0
- data/spec/legion/extensions/agentic/imagination/genesis/helpers/concept_spec.rb +221 -0
- data/spec/legion/extensions/agentic/imagination/genesis/helpers/constants_spec.rb +145 -0
- data/spec/legion/extensions/agentic/imagination/genesis/helpers/genesis_engine_spec.rb +339 -0
- data/spec/legion/extensions/agentic/imagination/genesis/helpers/seed_spec.rb +197 -0
- data/spec/legion/extensions/agentic/imagination/genesis/runners/genesis_spec.rb +177 -0
- data/spec/legion/extensions/agentic/imagination/greenhouse/client_spec.rb +89 -0
- data/spec/legion/extensions/agentic/imagination/greenhouse/helpers/constants_spec.rb +74 -0
- data/spec/legion/extensions/agentic/imagination/greenhouse/helpers/greenhouse_engine_spec.rb +163 -0
- data/spec/legion/extensions/agentic/imagination/greenhouse/helpers/greenhouse_spec.rb +193 -0
- data/spec/legion/extensions/agentic/imagination/greenhouse/helpers/seedling_spec.rb +224 -0
- data/spec/legion/extensions/agentic/imagination/greenhouse/runners/cognitive_greenhouse_spec.rb +139 -0
- data/spec/legion/extensions/agentic/imagination/imagery/client_spec.rb +20 -0
- data/spec/legion/extensions/agentic/imagination/imagery/helpers/constants_spec.rb +25 -0
- data/spec/legion/extensions/agentic/imagination/imagery/helpers/scenario_spec.rb +111 -0
- data/spec/legion/extensions/agentic/imagination/imagery/helpers/simulation_store_spec.rb +89 -0
- data/spec/legion/extensions/agentic/imagination/imagery/runners/imagination_spec.rb +99 -0
- data/spec/legion/extensions/agentic/imagination/liminal/client_spec.rb +21 -0
- data/spec/legion/extensions/agentic/imagination/liminal/cognitive_liminal_spec.rb +7 -0
- data/spec/legion/extensions/agentic/imagination/liminal/helpers/liminal_engine_spec.rb +130 -0
- data/spec/legion/extensions/agentic/imagination/liminal/helpers/threshold_crossing_spec.rb +155 -0
- data/spec/legion/extensions/agentic/imagination/liminal/runners_spec.rb +81 -0
- data/spec/legion/extensions/agentic/imagination/lucidity/client_spec.rb +76 -0
- data/spec/legion/extensions/agentic/imagination/lucidity/cognitive_lucidity_spec.rb +19 -0
- data/spec/legion/extensions/agentic/imagination/lucidity/helpers/constants_spec.rb +89 -0
- data/spec/legion/extensions/agentic/imagination/lucidity/helpers/dream_state_spec.rb +210 -0
- data/spec/legion/extensions/agentic/imagination/lucidity/helpers/journal_entry_spec.rb +103 -0
- data/spec/legion/extensions/agentic/imagination/lucidity/helpers/lucidity_engine_spec.rb +259 -0
- data/spec/legion/extensions/agentic/imagination/lucidity/runners/cognitive_lucidity_spec.rb +156 -0
- data/spec/legion/extensions/agentic/imagination/mental_simulation/helpers/constants_spec.rb +107 -0
- data/spec/legion/extensions/agentic/imagination/mental_simulation/helpers/simulation_engine_spec.rb +217 -0
- data/spec/legion/extensions/agentic/imagination/mental_simulation/helpers/simulation_spec.rb +223 -0
- data/spec/legion/extensions/agentic/imagination/mental_simulation/helpers/simulation_step_spec.rb +111 -0
- data/spec/legion/extensions/agentic/imagination/mental_simulation/runners/mental_simulation_spec.rb +184 -0
- data/spec/legion/extensions/agentic/imagination/origami/client_spec.rb +98 -0
- data/spec/legion/extensions/agentic/imagination/origami/helpers/constants_spec.rb +70 -0
- data/spec/legion/extensions/agentic/imagination/origami/helpers/crease_spec.rb +121 -0
- data/spec/legion/extensions/agentic/imagination/origami/helpers/figure_spec.rb +212 -0
- data/spec/legion/extensions/agentic/imagination/origami/helpers/origami_engine_spec.rb +239 -0
- data/spec/legion/extensions/agentic/imagination/origami/runners/cognitive_origami_spec.rb +112 -0
- data/spec/legion/extensions/agentic/imagination/prospection/client_spec.rb +107 -0
- data/spec/legion/extensions/agentic/imagination/prospection/helpers/prospection_engine_spec.rb +197 -0
- data/spec/legion/extensions/agentic/imagination/prospection/helpers/scenario_spec.rb +260 -0
- data/spec/legion/extensions/agentic/imagination/prospection/runners/prospection_spec.rb +156 -0
- data/spec/legion/extensions/agentic/imagination/time_travel/client_spec.rb +34 -0
- data/spec/legion/extensions/agentic/imagination/time_travel/helpers/constants_spec.rb +83 -0
- data/spec/legion/extensions/agentic/imagination/time_travel/helpers/mental_journey_spec.rb +274 -0
- data/spec/legion/extensions/agentic/imagination/time_travel/helpers/temporal_waypoint_spec.rb +177 -0
- data/spec/legion/extensions/agentic/imagination/time_travel/helpers/time_traveler_spec.rb +334 -0
- data/spec/legion/extensions/agentic/imagination/time_travel/runners/mental_time_travel_spec.rb +323 -0
- data/spec/legion/extensions/agentic/imagination/volcano/client_spec.rb +89 -0
- data/spec/legion/extensions/agentic/imagination/volcano/helpers/chamber_spec.rb +266 -0
- data/spec/legion/extensions/agentic/imagination/volcano/helpers/constants_spec.rb +83 -0
- data/spec/legion/extensions/agentic/imagination/volcano/helpers/magma_spec.rb +157 -0
- data/spec/legion/extensions/agentic/imagination/volcano/helpers/volcano_engine_spec.rb +191 -0
- data/spec/legion/extensions/agentic/imagination/volcano/integration_spec.rb +148 -0
- data/spec/legion/extensions/agentic/imagination/volcano/runners/cognitive_volcano_spec.rb +167 -0
- data/spec/spec_helper.rb +54 -0
- metadata +386 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Imagination
|
|
7
|
+
module Aurora
|
|
8
|
+
module Helpers
|
|
9
|
+
class AuroraEngine
|
|
10
|
+
include Constants
|
|
11
|
+
|
|
12
|
+
def initialize
|
|
13
|
+
@events = []
|
|
14
|
+
@spectral_bands = {}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def detect_aurora(type:, domain:, contributing_subsystems:, luminosity:, harmony_score:)
|
|
18
|
+
event = AuroraEvent.new(
|
|
19
|
+
aurora_type: type,
|
|
20
|
+
domain: domain,
|
|
21
|
+
contributing_subsystems: contributing_subsystems,
|
|
22
|
+
luminosity: luminosity,
|
|
23
|
+
harmony_score: harmony_score
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
prune_events if @events.size >= MAX_EVENTS
|
|
27
|
+
|
|
28
|
+
@events << event
|
|
29
|
+
register_in_band(event)
|
|
30
|
+
event
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def fade_all!
|
|
34
|
+
@events.each(&:fade!)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def brilliant_events
|
|
38
|
+
@events.select(&:brilliant?)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def harmonious_events
|
|
42
|
+
@events.select(&:harmonious?)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def events_by_domain(domain)
|
|
46
|
+
@events.select { |e| e.domain == domain.to_sym }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def events_by_type(type)
|
|
50
|
+
@events.select { |e| e.aurora_type == type.to_sym }
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def spectral_distribution
|
|
54
|
+
AURORA_TYPES.each_with_object({}) do |type, dist|
|
|
55
|
+
band = @spectral_bands[type]
|
|
56
|
+
dist[type] = band ? band.intensity : 0.0
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def overall_luminosity
|
|
61
|
+
return 0.0 if @events.empty?
|
|
62
|
+
|
|
63
|
+
total = @events.sum(&:luminosity).round(10)
|
|
64
|
+
(total / @events.size).round(10)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def overall_harmony
|
|
68
|
+
return 0.0 if @events.empty?
|
|
69
|
+
|
|
70
|
+
total = @events.sum(&:harmony_score).round(10)
|
|
71
|
+
(total / @events.size).round(10)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def aurora_frequency
|
|
75
|
+
@events.size
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def most_brilliant(limit: 5)
|
|
79
|
+
@events.sort_by { |e| -e.luminosity }.first(limit)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def active_bands
|
|
83
|
+
@spectral_bands.values.select(&:active?)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def aurora_report
|
|
87
|
+
{
|
|
88
|
+
total_events: @events.size,
|
|
89
|
+
overall_luminosity: overall_luminosity,
|
|
90
|
+
overall_harmony: overall_harmony,
|
|
91
|
+
brilliant_count: brilliant_events.size,
|
|
92
|
+
harmonious_count: harmonious_events.size,
|
|
93
|
+
active_band_count: active_bands.size,
|
|
94
|
+
spectral_distribution: spectral_distribution,
|
|
95
|
+
luminosity_label: Constants.label_for(overall_luminosity, LUMINOSITY_LABELS),
|
|
96
|
+
harmony_label: Constants.label_for(overall_harmony, HARMONY_LABELS)
|
|
97
|
+
}
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def events
|
|
101
|
+
@events.dup
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
private
|
|
105
|
+
|
|
106
|
+
def register_in_band(event)
|
|
107
|
+
type = event.aurora_type
|
|
108
|
+
@spectral_bands[type] ||= SpectralBand.new(aurora_type: type)
|
|
109
|
+
@spectral_bands[type].add_event(event)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def prune_events
|
|
113
|
+
faint = @events.select(&:faint?)
|
|
114
|
+
to_remove = faint.size.positive? ? faint : [@events.first]
|
|
115
|
+
to_remove.each { |e| @events.delete(e) }
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'securerandom'
|
|
4
|
+
require 'time'
|
|
5
|
+
|
|
6
|
+
module Legion
|
|
7
|
+
module Extensions
|
|
8
|
+
module Agentic
|
|
9
|
+
module Imagination
|
|
10
|
+
module Aurora
|
|
11
|
+
module Helpers
|
|
12
|
+
class AuroraEvent
|
|
13
|
+
include Constants
|
|
14
|
+
|
|
15
|
+
attr_reader :id, :aurora_type, :domain, :contributing_subsystems, :harmony_score, :created_at
|
|
16
|
+
attr_accessor :luminosity
|
|
17
|
+
|
|
18
|
+
def initialize(aurora_type:, domain:, contributing_subsystems:, luminosity:, harmony_score:)
|
|
19
|
+
@id = SecureRandom.uuid
|
|
20
|
+
@aurora_type = aurora_type
|
|
21
|
+
@domain = domain
|
|
22
|
+
@contributing_subsystems = Array(contributing_subsystems).map(&:to_sym)
|
|
23
|
+
@luminosity = luminosity.clamp(0.0, 1.0)
|
|
24
|
+
@harmony_score = harmony_score.clamp(0.0, 1.0)
|
|
25
|
+
@created_at = Time.now.utc
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def fade!
|
|
29
|
+
@luminosity = (@luminosity - LUMINOSITY_DECAY).round(10).clamp(0.0, 1.0)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def brilliant?
|
|
33
|
+
@luminosity > BRILLIANCE_THRESHOLD
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def faint?
|
|
37
|
+
@luminosity < FAINT_THRESHOLD
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def harmonious?
|
|
41
|
+
@harmony_score > HARMONY_THRESHOLD
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def multi_source?
|
|
45
|
+
@contributing_subsystems.size > 2
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def spectral_color
|
|
49
|
+
index = (@luminosity * (SPECTRAL_COLORS.size - 1)).round
|
|
50
|
+
SPECTRAL_COLORS[index.clamp(0, SPECTRAL_COLORS.size - 1)]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def luminosity_label
|
|
54
|
+
Constants.label_for(@luminosity, LUMINOSITY_LABELS)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def harmony_label
|
|
58
|
+
Constants.label_for(@harmony_score, HARMONY_LABELS)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def to_h
|
|
62
|
+
{
|
|
63
|
+
id: @id,
|
|
64
|
+
aurora_type: @aurora_type,
|
|
65
|
+
domain: @domain,
|
|
66
|
+
contributing_subsystems: @contributing_subsystems,
|
|
67
|
+
luminosity: @luminosity,
|
|
68
|
+
harmony_score: @harmony_score,
|
|
69
|
+
spectral_color: spectral_color,
|
|
70
|
+
luminosity_label: luminosity_label,
|
|
71
|
+
harmony_label: harmony_label,
|
|
72
|
+
brilliant: brilliant?,
|
|
73
|
+
faint: faint?,
|
|
74
|
+
harmonious: harmonious?,
|
|
75
|
+
multi_source: multi_source?,
|
|
76
|
+
created_at: @created_at.iso8601
|
|
77
|
+
}
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Imagination
|
|
7
|
+
module Aurora
|
|
8
|
+
module Helpers
|
|
9
|
+
module Constants
|
|
10
|
+
MAX_EVENTS = 300
|
|
11
|
+
MAX_BANDS = 50
|
|
12
|
+
|
|
13
|
+
DEFAULT_LUMINOSITY = 0.5
|
|
14
|
+
LUMINOSITY_DECAY = 0.03
|
|
15
|
+
LUMINOSITY_BOOST = 0.1
|
|
16
|
+
|
|
17
|
+
HARMONY_THRESHOLD = 0.7
|
|
18
|
+
BRILLIANCE_THRESHOLD = 0.8
|
|
19
|
+
FAINT_THRESHOLD = 0.2
|
|
20
|
+
|
|
21
|
+
AURORA_TYPES = %i[
|
|
22
|
+
harmonic
|
|
23
|
+
resonant
|
|
24
|
+
cascading
|
|
25
|
+
convergent
|
|
26
|
+
emergent
|
|
27
|
+
serendipitous
|
|
28
|
+
synchronous
|
|
29
|
+
prismatic
|
|
30
|
+
].freeze
|
|
31
|
+
|
|
32
|
+
SPECTRAL_COLORS = %i[
|
|
33
|
+
violet
|
|
34
|
+
indigo
|
|
35
|
+
blue
|
|
36
|
+
green
|
|
37
|
+
yellow
|
|
38
|
+
orange
|
|
39
|
+
red
|
|
40
|
+
ultraviolet
|
|
41
|
+
].freeze
|
|
42
|
+
|
|
43
|
+
DOMAINS = %i[
|
|
44
|
+
memory
|
|
45
|
+
emotion
|
|
46
|
+
prediction
|
|
47
|
+
identity
|
|
48
|
+
trust
|
|
49
|
+
consent
|
|
50
|
+
governance
|
|
51
|
+
perception
|
|
52
|
+
].freeze
|
|
53
|
+
|
|
54
|
+
LUMINOSITY_LABELS = {
|
|
55
|
+
(0.0...0.2) => :faint,
|
|
56
|
+
(0.2...0.4) => :dim,
|
|
57
|
+
(0.4...0.6) => :moderate,
|
|
58
|
+
(0.6...0.8) => :bright,
|
|
59
|
+
(0.8..1.0) => :brilliant
|
|
60
|
+
}.freeze
|
|
61
|
+
|
|
62
|
+
HARMONY_LABELS = {
|
|
63
|
+
(0.0...0.3) => :discordant,
|
|
64
|
+
(0.3...0.5) => :unsettled,
|
|
65
|
+
(0.5...0.7) => :resonating,
|
|
66
|
+
(0.7...0.9) => :harmonious,
|
|
67
|
+
(0.9..1.0) => :perfect
|
|
68
|
+
}.freeze
|
|
69
|
+
|
|
70
|
+
BRILLIANCE_LABELS = {
|
|
71
|
+
(0.0...0.25) => :nascent,
|
|
72
|
+
(0.25...0.5) => :emerging,
|
|
73
|
+
(0.5...0.75) => :radiant,
|
|
74
|
+
(0.75..1.0) => :transcendent
|
|
75
|
+
}.freeze
|
|
76
|
+
|
|
77
|
+
module_function
|
|
78
|
+
|
|
79
|
+
def label_for(value, label_map)
|
|
80
|
+
label_map.each do |range, label|
|
|
81
|
+
return label if range.cover?(value)
|
|
82
|
+
end
|
|
83
|
+
label_map.values.last
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Imagination
|
|
7
|
+
module Aurora
|
|
8
|
+
module Helpers
|
|
9
|
+
class SpectralBand
|
|
10
|
+
include Constants
|
|
11
|
+
|
|
12
|
+
attr_reader :id, :aurora_type, :events
|
|
13
|
+
|
|
14
|
+
def initialize(aurora_type:)
|
|
15
|
+
@id = SecureRandom.uuid
|
|
16
|
+
@aurora_type = aurora_type
|
|
17
|
+
@events = []
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def add_event(event)
|
|
21
|
+
@events << event
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def intensity
|
|
25
|
+
return 0.0 if @events.empty?
|
|
26
|
+
|
|
27
|
+
total = @events.sum(&:luminosity).round(10)
|
|
28
|
+
(total / @events.size).round(10)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def average_harmony
|
|
32
|
+
return 0.0 if @events.empty?
|
|
33
|
+
|
|
34
|
+
total = @events.sum(&:harmony_score).round(10)
|
|
35
|
+
(total / @events.size).round(10)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def dominant_color
|
|
39
|
+
return SPECTRAL_COLORS.first if @events.empty?
|
|
40
|
+
|
|
41
|
+
color_counts = Hash.new(0)
|
|
42
|
+
@events.each { |e| color_counts[e.spectral_color] += 1 }
|
|
43
|
+
color_counts.max_by { |_, count| count }&.first || SPECTRAL_COLORS.first
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def active?
|
|
47
|
+
@events.any? { |e| !e.faint? }
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def bandwidth
|
|
51
|
+
return (0.0..0.0) if @events.empty?
|
|
52
|
+
|
|
53
|
+
luminosities = @events.map(&:luminosity)
|
|
54
|
+
(luminosities.min..luminosities.max)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def event_count
|
|
58
|
+
@events.size
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def to_h
|
|
62
|
+
{
|
|
63
|
+
id: @id,
|
|
64
|
+
aurora_type: @aurora_type,
|
|
65
|
+
event_count: event_count,
|
|
66
|
+
intensity: intensity,
|
|
67
|
+
average_harmony: average_harmony,
|
|
68
|
+
dominant_color: dominant_color,
|
|
69
|
+
active: active?,
|
|
70
|
+
bandwidth: { min: bandwidth.min, max: bandwidth.max }
|
|
71
|
+
}
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Imagination
|
|
7
|
+
module Aurora
|
|
8
|
+
module Runners
|
|
9
|
+
module CognitiveAurora
|
|
10
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
11
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
12
|
+
|
|
13
|
+
def detect_aurora(type: :emergent, domain: :perception, contributing_subsystems: [],
|
|
14
|
+
luminosity: Helpers::Constants::DEFAULT_LUMINOSITY,
|
|
15
|
+
harmony_score: 0.5, engine: nil, **)
|
|
16
|
+
target_engine = engine || default_engine
|
|
17
|
+
event = target_engine.detect_aurora(
|
|
18
|
+
type: type,
|
|
19
|
+
domain: domain,
|
|
20
|
+
contributing_subsystems: contributing_subsystems,
|
|
21
|
+
luminosity: luminosity,
|
|
22
|
+
harmony_score: harmony_score
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
Legion::Logging.debug "[cognitive_aurora] detected aurora: type=#{type} domain=#{domain} " \
|
|
26
|
+
"luminosity=#{luminosity.round(2)} harmony=#{harmony_score.round(2)} " \
|
|
27
|
+
"id=#{event.id}"
|
|
28
|
+
|
|
29
|
+
{ success: true, event: event.to_h }
|
|
30
|
+
rescue StandardError => e
|
|
31
|
+
Legion::Logging.error "[cognitive_aurora] detect_aurora failed: #{e.message}"
|
|
32
|
+
{ success: false, error: e.message }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def fade_all(engine: nil, **)
|
|
36
|
+
target_engine = engine || default_engine
|
|
37
|
+
before_count = target_engine.brilliant_events.size
|
|
38
|
+
target_engine.fade_all!
|
|
39
|
+
after_count = target_engine.brilliant_events.size
|
|
40
|
+
|
|
41
|
+
Legion::Logging.debug "[cognitive_aurora] fade_all: brilliant #{before_count} -> #{after_count}"
|
|
42
|
+
{ success: true, faded: true, brilliant_before: before_count, brilliant_after: after_count }
|
|
43
|
+
rescue StandardError => e
|
|
44
|
+
Legion::Logging.error "[cognitive_aurora] fade_all failed: #{e.message}"
|
|
45
|
+
{ success: false, error: e.message }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def list_brilliant(limit: 10, engine: nil, **)
|
|
49
|
+
target_engine = engine || default_engine
|
|
50
|
+
events = target_engine.brilliant_events.sort_by { |e| -e.luminosity }.first(limit)
|
|
51
|
+
|
|
52
|
+
Legion::Logging.debug "[cognitive_aurora] list_brilliant: found #{events.size} brilliant events (limit=#{limit})"
|
|
53
|
+
{ success: true, events: events.map(&:to_h), count: events.size }
|
|
54
|
+
rescue StandardError => e
|
|
55
|
+
Legion::Logging.error "[cognitive_aurora] list_brilliant failed: #{e.message}"
|
|
56
|
+
{ success: false, error: e.message }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def aurora_status(engine: nil, **)
|
|
60
|
+
target_engine = engine || default_engine
|
|
61
|
+
report = target_engine.aurora_report
|
|
62
|
+
|
|
63
|
+
Legion::Logging.debug "[cognitive_aurora] status: total=#{report[:total_events]} " \
|
|
64
|
+
"luminosity=#{report[:overall_luminosity].round(2)} " \
|
|
65
|
+
"harmony=#{report[:overall_harmony].round(2)}"
|
|
66
|
+
|
|
67
|
+
{ success: true, report: report }
|
|
68
|
+
rescue StandardError => e
|
|
69
|
+
Legion::Logging.error "[cognitive_aurora] aurora_status failed: #{e.message}"
|
|
70
|
+
{ success: false, error: e.message }
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
private
|
|
74
|
+
|
|
75
|
+
def default_engine
|
|
76
|
+
@default_engine ||= Helpers::AuroraEngine.new
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'securerandom'
|
|
4
|
+
|
|
5
|
+
require 'legion/extensions/agentic/imagination/aurora/version'
|
|
6
|
+
require 'legion/extensions/agentic/imagination/aurora/helpers/constants'
|
|
7
|
+
require 'legion/extensions/agentic/imagination/aurora/helpers/aurora_event'
|
|
8
|
+
require 'legion/extensions/agentic/imagination/aurora/helpers/spectral_band'
|
|
9
|
+
require 'legion/extensions/agentic/imagination/aurora/helpers/aurora_engine'
|
|
10
|
+
require 'legion/extensions/agentic/imagination/aurora/runners/cognitive_aurora'
|
|
11
|
+
require 'legion/extensions/agentic/imagination/aurora/client'
|
|
12
|
+
|
|
13
|
+
module Legion
|
|
14
|
+
module Extensions
|
|
15
|
+
module Agentic
|
|
16
|
+
module Imagination
|
|
17
|
+
module Aurora
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Imagination
|
|
7
|
+
module Constellation
|
|
8
|
+
module Helpers
|
|
9
|
+
module Constants
|
|
10
|
+
# Star spectral classes (hottest to coolest)
|
|
11
|
+
SPECTRAL_CLASSES = %i[O B A F G K M].freeze
|
|
12
|
+
|
|
13
|
+
# Constellation pattern types
|
|
14
|
+
PATTERN_TYPES = %i[
|
|
15
|
+
linear circular spiral cluster
|
|
16
|
+
cross arc ring scattered
|
|
17
|
+
].freeze
|
|
18
|
+
|
|
19
|
+
# Star domains
|
|
20
|
+
DOMAINS = %i[
|
|
21
|
+
reasoning memory emotion language
|
|
22
|
+
perception action planning social
|
|
23
|
+
creativity logic intuition ethics
|
|
24
|
+
].freeze
|
|
25
|
+
|
|
26
|
+
MAX_STARS = 500
|
|
27
|
+
MAX_CONSTELLATIONS = 50
|
|
28
|
+
MAGNITUDE_DECAY = 0.01
|
|
29
|
+
MIN_MAGNITUDE = 0.05
|
|
30
|
+
|
|
31
|
+
# Magnitude labels (higher = brighter = more important)
|
|
32
|
+
MAGNITUDE_LABELS = [
|
|
33
|
+
[(0.8..), :supergiant],
|
|
34
|
+
[(0.6...0.8), :giant],
|
|
35
|
+
[(0.4...0.6), :main_sequence],
|
|
36
|
+
[(0.2...0.4), :dwarf],
|
|
37
|
+
[(..0.2), :brown_dwarf]
|
|
38
|
+
].freeze
|
|
39
|
+
|
|
40
|
+
# Constellation maturity labels
|
|
41
|
+
MATURITY_LABELS = [
|
|
42
|
+
[(0.8..), :ancient],
|
|
43
|
+
[(0.6...0.8), :established],
|
|
44
|
+
[(0.4...0.6), :forming],
|
|
45
|
+
[(0.2...0.4), :nascent],
|
|
46
|
+
[(..0.2), :proto]
|
|
47
|
+
].freeze
|
|
48
|
+
|
|
49
|
+
def self.label_for(table, value)
|
|
50
|
+
table.each { |range, label| return label if range.cover?(value) }
|
|
51
|
+
table.last.last
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Imagination
|
|
7
|
+
module Constellation
|
|
8
|
+
module Helpers
|
|
9
|
+
class Constellation
|
|
10
|
+
attr_reader :id, :name, :pattern_type, :star_ids,
|
|
11
|
+
:formed_at
|
|
12
|
+
attr_accessor :maturity
|
|
13
|
+
|
|
14
|
+
def initialize(name:, pattern_type:, maturity: nil)
|
|
15
|
+
validate_pattern!(pattern_type)
|
|
16
|
+
@id = SecureRandom.uuid
|
|
17
|
+
@name = name.to_s
|
|
18
|
+
@pattern_type = pattern_type.to_sym
|
|
19
|
+
@star_ids = []
|
|
20
|
+
@maturity = (maturity || 0.1).to_f.clamp(0.0, 1.0).round(10)
|
|
21
|
+
@formed_at = Time.now.utc
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def add_star(star_id)
|
|
25
|
+
return false if @star_ids.include?(star_id)
|
|
26
|
+
|
|
27
|
+
@star_ids << star_id
|
|
28
|
+
@maturity = (@maturity + 0.05).clamp(0.0, 1.0).round(10)
|
|
29
|
+
true
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def remove_star(star_id)
|
|
33
|
+
return false unless @star_ids.include?(star_id)
|
|
34
|
+
|
|
35
|
+
@star_ids.delete(star_id)
|
|
36
|
+
@maturity = (@maturity - 0.05).clamp(0.0, 1.0).round(10)
|
|
37
|
+
true
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def size
|
|
41
|
+
@star_ids.size
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def empty?
|
|
45
|
+
@star_ids.empty?
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def ancient?
|
|
49
|
+
@maturity >= 0.8
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def nascent?
|
|
53
|
+
@maturity < 0.2
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def maturity_label
|
|
57
|
+
Constants.label_for(Constants::MATURITY_LABELS, @maturity)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def to_h
|
|
61
|
+
{
|
|
62
|
+
id: @id,
|
|
63
|
+
name: @name,
|
|
64
|
+
pattern_type: @pattern_type,
|
|
65
|
+
star_ids: @star_ids.dup,
|
|
66
|
+
size: size,
|
|
67
|
+
maturity: @maturity,
|
|
68
|
+
maturity_label: maturity_label,
|
|
69
|
+
formed_at: @formed_at,
|
|
70
|
+
ancient: ancient?,
|
|
71
|
+
nascent: nascent?
|
|
72
|
+
}
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
private
|
|
76
|
+
|
|
77
|
+
def validate_pattern!(val)
|
|
78
|
+
return if Constants::PATTERN_TYPES.include?(val.to_sym)
|
|
79
|
+
|
|
80
|
+
raise ArgumentError,
|
|
81
|
+
"unknown pattern type: #{val.inspect}; " \
|
|
82
|
+
"must be one of #{Constants::PATTERN_TYPES.inspect}"
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|