lex-agentic-integration 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-integration.gemspec +30 -0
- data/lib/legion/extensions/agentic/integration/boundary/client.rb +15 -0
- data/lib/legion/extensions/agentic/integration/boundary/helpers/boundary.rb +90 -0
- data/lib/legion/extensions/agentic/integration/boundary/helpers/boundary_engine.rb +123 -0
- data/lib/legion/extensions/agentic/integration/boundary/helpers/constants.rb +44 -0
- data/lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb +100 -0
- data/lib/legion/extensions/agentic/integration/boundary/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/boundary.rb +19 -0
- data/lib/legion/extensions/agentic/integration/context/client.rb +26 -0
- data/lib/legion/extensions/agentic/integration/context/helpers/constants.rb +34 -0
- data/lib/legion/extensions/agentic/integration/context/helpers/context_manager.rb +150 -0
- data/lib/legion/extensions/agentic/integration/context/helpers/frame.rb +99 -0
- data/lib/legion/extensions/agentic/integration/context/runners/context.rb +94 -0
- data/lib/legion/extensions/agentic/integration/context/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/context.rb +19 -0
- data/lib/legion/extensions/agentic/integration/distributed_cognition/client.rb +19 -0
- data/lib/legion/extensions/agentic/integration/distributed_cognition/helpers/constants.rb +51 -0
- data/lib/legion/extensions/agentic/integration/distributed_cognition/helpers/distribution_engine.rb +159 -0
- data/lib/legion/extensions/agentic/integration/distributed_cognition/helpers/participant.rb +100 -0
- data/lib/legion/extensions/agentic/integration/distributed_cognition/runners/distributed_cognition.rb +107 -0
- data/lib/legion/extensions/agentic/integration/distributed_cognition/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/distributed_cognition.rb +19 -0
- data/lib/legion/extensions/agentic/integration/gestalt/client.rb +21 -0
- data/lib/legion/extensions/agentic/integration/gestalt/helpers/constants.rb +51 -0
- data/lib/legion/extensions/agentic/integration/gestalt/helpers/pattern.rb +90 -0
- data/lib/legion/extensions/agentic/integration/gestalt/helpers/pattern_store.rb +123 -0
- data/lib/legion/extensions/agentic/integration/gestalt/runners/gestalt.rb +82 -0
- data/lib/legion/extensions/agentic/integration/gestalt/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/gestalt.rb +19 -0
- data/lib/legion/extensions/agentic/integration/global_workspace/actors/competition.rb +45 -0
- data/lib/legion/extensions/agentic/integration/global_workspace/client.rb +29 -0
- data/lib/legion/extensions/agentic/integration/global_workspace/helpers/broadcast.rb +62 -0
- data/lib/legion/extensions/agentic/integration/global_workspace/helpers/competitor.rb +59 -0
- data/lib/legion/extensions/agentic/integration/global_workspace/helpers/constants.rb +65 -0
- data/lib/legion/extensions/agentic/integration/global_workspace/helpers/workspace.rb +188 -0
- data/lib/legion/extensions/agentic/integration/global_workspace/runners/global_workspace.rb +104 -0
- data/lib/legion/extensions/agentic/integration/global_workspace/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/global_workspace.rb +20 -0
- data/lib/legion/extensions/agentic/integration/integration/client.rb +19 -0
- data/lib/legion/extensions/agentic/integration/integration/helpers/constants.rb +62 -0
- data/lib/legion/extensions/agentic/integration/integration/helpers/integrated_representation.rb +106 -0
- data/lib/legion/extensions/agentic/integration/integration/helpers/integration_engine.rb +163 -0
- data/lib/legion/extensions/agentic/integration/integration/helpers/modal_signal.rb +62 -0
- data/lib/legion/extensions/agentic/integration/integration/runners/cognitive_integration.rb +105 -0
- data/lib/legion/extensions/agentic/integration/integration/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/integration.rb +20 -0
- data/lib/legion/extensions/agentic/integration/labyrinth/actors/thread_walker.rb +45 -0
- data/lib/legion/extensions/agentic/integration/labyrinth/client.rb +23 -0
- data/lib/legion/extensions/agentic/integration/labyrinth/helpers/constants.rb +39 -0
- data/lib/legion/extensions/agentic/integration/labyrinth/helpers/labyrinth.rb +138 -0
- data/lib/legion/extensions/agentic/integration/labyrinth/helpers/labyrinth_engine.rb +177 -0
- data/lib/legion/extensions/agentic/integration/labyrinth/helpers/node.rb +64 -0
- data/lib/legion/extensions/agentic/integration/labyrinth/runners/cognitive_labyrinth.rb +128 -0
- data/lib/legion/extensions/agentic/integration/labyrinth/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/labyrinth.rb +22 -0
- data/lib/legion/extensions/agentic/integration/map/actors/decay.rb +45 -0
- data/lib/legion/extensions/agentic/integration/map/client.rb +29 -0
- data/lib/legion/extensions/agentic/integration/map/helpers/cognitive_map_store.rb +179 -0
- data/lib/legion/extensions/agentic/integration/map/helpers/constants.rb +71 -0
- data/lib/legion/extensions/agentic/integration/map/helpers/graph_traversal.rb +124 -0
- data/lib/legion/extensions/agentic/integration/map/helpers/location.rb +71 -0
- data/lib/legion/extensions/agentic/integration/map/runners/cognitive_map.rb +95 -0
- data/lib/legion/extensions/agentic/integration/map/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/map.rb +20 -0
- data/lib/legion/extensions/agentic/integration/mosaic/client.rb +15 -0
- data/lib/legion/extensions/agentic/integration/mosaic/helpers/constants.rb +55 -0
- data/lib/legion/extensions/agentic/integration/mosaic/helpers/mosaic.rb +111 -0
- data/lib/legion/extensions/agentic/integration/mosaic/helpers/mosaic_engine.rb +124 -0
- data/lib/legion/extensions/agentic/integration/mosaic/helpers/tessera.rb +86 -0
- data/lib/legion/extensions/agentic/integration/mosaic/runners/cognitive_mosaic.rb +76 -0
- data/lib/legion/extensions/agentic/integration/mosaic/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/mosaic.rb +22 -0
- data/lib/legion/extensions/agentic/integration/mycelium/client.rb +19 -0
- data/lib/legion/extensions/agentic/integration/mycelium/helpers/constants.rb +52 -0
- data/lib/legion/extensions/agentic/integration/mycelium/helpers/fruiting_body.rb +50 -0
- data/lib/legion/extensions/agentic/integration/mycelium/helpers/hypha.rb +76 -0
- data/lib/legion/extensions/agentic/integration/mycelium/helpers/mycelial_node.rb +72 -0
- data/lib/legion/extensions/agentic/integration/mycelium/helpers/mycelium_engine.rb +151 -0
- data/lib/legion/extensions/agentic/integration/mycelium/runners/cognitive_mycelium.rb +73 -0
- data/lib/legion/extensions/agentic/integration/mycelium/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/mycelium.rb +23 -0
- data/lib/legion/extensions/agentic/integration/phenomenal_binding/client.rb +25 -0
- data/lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/binding_engine.rb +156 -0
- data/lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/binding_unit.rb +72 -0
- data/lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/constants.rb +35 -0
- data/lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb +51 -0
- data/lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb +110 -0
- data/lib/legion/extensions/agentic/integration/phenomenal_binding/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/phenomenal_binding.rb +20 -0
- data/lib/legion/extensions/agentic/integration/qualia/client.rb +19 -0
- data/lib/legion/extensions/agentic/integration/qualia/helpers/constants.rb +74 -0
- data/lib/legion/extensions/agentic/integration/qualia/helpers/quale.rb +103 -0
- data/lib/legion/extensions/agentic/integration/qualia/helpers/qualia_engine.rb +142 -0
- data/lib/legion/extensions/agentic/integration/qualia/runners/qualia.rb +67 -0
- data/lib/legion/extensions/agentic/integration/qualia/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/qualia.rb +19 -0
- data/lib/legion/extensions/agentic/integration/situation_model/client.rb +28 -0
- data/lib/legion/extensions/agentic/integration/situation_model/helpers/client.rb +23 -0
- data/lib/legion/extensions/agentic/integration/situation_model/helpers/constants.rb +40 -0
- data/lib/legion/extensions/agentic/integration/situation_model/helpers/situation_engine.rb +73 -0
- data/lib/legion/extensions/agentic/integration/situation_model/helpers/situation_event.rb +56 -0
- data/lib/legion/extensions/agentic/integration/situation_model/helpers/situation_model.rb +90 -0
- data/lib/legion/extensions/agentic/integration/situation_model/runners/situation_model.rb +99 -0
- data/lib/legion/extensions/agentic/integration/situation_model/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/situation_model.rb +21 -0
- data/lib/legion/extensions/agentic/integration/synthesis/client.rb +29 -0
- data/lib/legion/extensions/agentic/integration/synthesis/helpers/constants.rb +41 -0
- data/lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb +63 -0
- data/lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis_engine.rb +213 -0
- data/lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis_stream.rb +67 -0
- data/lib/legion/extensions/agentic/integration/synthesis/runners/cognitive_synthesis.rb +82 -0
- data/lib/legion/extensions/agentic/integration/synthesis/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/synthesis.rb +20 -0
- data/lib/legion/extensions/agentic/integration/tapestry/client.rb +15 -0
- data/lib/legion/extensions/agentic/integration/tapestry/helpers/constants.rb +46 -0
- data/lib/legion/extensions/agentic/integration/tapestry/helpers/loom_engine.rb +125 -0
- data/lib/legion/extensions/agentic/integration/tapestry/helpers/tapestry.rb +144 -0
- data/lib/legion/extensions/agentic/integration/tapestry/helpers/thread.rb +112 -0
- data/lib/legion/extensions/agentic/integration/tapestry/runners/cognitive_tapestry.rb +81 -0
- data/lib/legion/extensions/agentic/integration/tapestry/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/tapestry.rb +22 -0
- data/lib/legion/extensions/agentic/integration/tessellation/client.rb +19 -0
- data/lib/legion/extensions/agentic/integration/tessellation/helpers/constants.rb +72 -0
- data/lib/legion/extensions/agentic/integration/tessellation/helpers/mosaic.rb +99 -0
- data/lib/legion/extensions/agentic/integration/tessellation/helpers/tessellation_engine.rb +141 -0
- data/lib/legion/extensions/agentic/integration/tessellation/helpers/tile.rb +76 -0
- data/lib/legion/extensions/agentic/integration/tessellation/runners/cognitive_tessellation.rb +58 -0
- data/lib/legion/extensions/agentic/integration/tessellation/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/tessellation.rb +22 -0
- data/lib/legion/extensions/agentic/integration/version.rb +11 -0
- data/lib/legion/extensions/agentic/integration/zeitgeist/helpers/client.rb +17 -0
- data/lib/legion/extensions/agentic/integration/zeitgeist/helpers/cognitive_signal.rb +38 -0
- data/lib/legion/extensions/agentic/integration/zeitgeist/helpers/constants.rb +64 -0
- data/lib/legion/extensions/agentic/integration/zeitgeist/helpers/trend_window.rb +80 -0
- data/lib/legion/extensions/agentic/integration/zeitgeist/helpers/zeitgeist_engine.rb +157 -0
- data/lib/legion/extensions/agentic/integration/zeitgeist/runners/cognitive_zeitgeist.rb +99 -0
- data/lib/legion/extensions/agentic/integration/zeitgeist/version.rb +13 -0
- data/lib/legion/extensions/agentic/integration/zeitgeist.rb +22 -0
- data/lib/legion/extensions/agentic/integration.rb +34 -0
- data/spec/legion/extensions/agentic/integration/boundary/helpers/boundary_engine_spec.rb +165 -0
- data/spec/legion/extensions/agentic/integration/boundary/helpers/boundary_spec.rb +168 -0
- data/spec/legion/extensions/agentic/integration/boundary/helpers/constants_spec.rb +65 -0
- data/spec/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary_spec.rb +111 -0
- data/spec/legion/extensions/agentic/integration/context/client_spec.rb +58 -0
- data/spec/legion/extensions/agentic/integration/context/helpers/constants_spec.rb +32 -0
- data/spec/legion/extensions/agentic/integration/context/helpers/context_manager_spec.rb +190 -0
- data/spec/legion/extensions/agentic/integration/context/helpers/frame_spec.rb +164 -0
- data/spec/legion/extensions/agentic/integration/context/runners/context_spec.rb +142 -0
- data/spec/legion/extensions/agentic/integration/distributed_cognition/client_spec.rb +21 -0
- data/spec/legion/extensions/agentic/integration/distributed_cognition/helpers/distribution_engine_spec.rb +149 -0
- data/spec/legion/extensions/agentic/integration/distributed_cognition/helpers/participant_spec.rb +116 -0
- data/spec/legion/extensions/agentic/integration/distributed_cognition/runners/distributed_cognition_spec.rb +102 -0
- data/spec/legion/extensions/agentic/integration/gestalt/client_spec.rb +53 -0
- data/spec/legion/extensions/agentic/integration/gestalt/helpers/constants_spec.rb +27 -0
- data/spec/legion/extensions/agentic/integration/gestalt/helpers/pattern_spec.rb +128 -0
- data/spec/legion/extensions/agentic/integration/gestalt/helpers/pattern_store_spec.rb +155 -0
- data/spec/legion/extensions/agentic/integration/gestalt/runners/gestalt_spec.rb +114 -0
- data/spec/legion/extensions/agentic/integration/global_workspace/client_spec.rb +49 -0
- data/spec/legion/extensions/agentic/integration/global_workspace/helpers/broadcast_spec.rb +83 -0
- data/spec/legion/extensions/agentic/integration/global_workspace/helpers/competitor_spec.rb +84 -0
- data/spec/legion/extensions/agentic/integration/global_workspace/helpers/workspace_spec.rb +174 -0
- data/spec/legion/extensions/agentic/integration/global_workspace/runners/global_workspace_spec.rb +118 -0
- data/spec/legion/extensions/agentic/integration/integration/cognitive_integration_spec.rb +7 -0
- data/spec/legion/extensions/agentic/integration/integration/helpers/integrated_representation_spec.rb +149 -0
- data/spec/legion/extensions/agentic/integration/integration/helpers/integration_engine_spec.rb +191 -0
- data/spec/legion/extensions/agentic/integration/integration/helpers/modal_signal_spec.rb +81 -0
- data/spec/legion/extensions/agentic/integration/labyrinth/client_spec.rb +122 -0
- data/spec/legion/extensions/agentic/integration/labyrinth/cognitive_labyrinth_spec.rb +19 -0
- data/spec/legion/extensions/agentic/integration/labyrinth/helpers/constants_spec.rb +72 -0
- data/spec/legion/extensions/agentic/integration/labyrinth/helpers/labyrinth_engine_spec.rb +222 -0
- data/spec/legion/extensions/agentic/integration/labyrinth/helpers/labyrinth_spec.rb +235 -0
- data/spec/legion/extensions/agentic/integration/labyrinth/helpers/node_spec.rb +157 -0
- data/spec/legion/extensions/agentic/integration/labyrinth/runners/cognitive_labyrinth_spec.rb +209 -0
- data/spec/legion/extensions/agentic/integration/map/client_spec.rb +89 -0
- data/spec/legion/extensions/agentic/integration/map/helpers/cognitive_map_store_spec.rb +321 -0
- data/spec/legion/extensions/agentic/integration/map/helpers/location_spec.rb +165 -0
- data/spec/legion/extensions/agentic/integration/map/runners/cognitive_map_spec.rb +190 -0
- data/spec/legion/extensions/agentic/integration/mosaic/client_spec.rb +16 -0
- data/spec/legion/extensions/agentic/integration/mosaic/helpers/constants_spec.rb +37 -0
- data/spec/legion/extensions/agentic/integration/mosaic/helpers/mosaic_engine_spec.rb +108 -0
- data/spec/legion/extensions/agentic/integration/mosaic/helpers/mosaic_spec.rb +120 -0
- data/spec/legion/extensions/agentic/integration/mosaic/helpers/tessera_spec.rb +92 -0
- data/spec/legion/extensions/agentic/integration/mosaic/runners/cognitive_mosaic_spec.rb +88 -0
- data/spec/legion/extensions/agentic/integration/mycelium/client_spec.rb +25 -0
- data/spec/legion/extensions/agentic/integration/mycelium/cognitive_mycelium_spec.rb +7 -0
- data/spec/legion/extensions/agentic/integration/mycelium/helpers/constants_spec.rb +28 -0
- data/spec/legion/extensions/agentic/integration/mycelium/helpers/fruiting_body_spec.rb +33 -0
- data/spec/legion/extensions/agentic/integration/mycelium/helpers/hypha_spec.rb +69 -0
- data/spec/legion/extensions/agentic/integration/mycelium/helpers/mycelial_node_spec.rb +79 -0
- data/spec/legion/extensions/agentic/integration/mycelium/helpers/mycelium_engine_spec.rb +136 -0
- data/spec/legion/extensions/agentic/integration/mycelium/runners/cognitive_mycelium_spec.rb +61 -0
- data/spec/legion/extensions/agentic/integration/phenomenal_binding/client_spec.rb +52 -0
- data/spec/legion/extensions/agentic/integration/phenomenal_binding/helpers/binding_engine_spec.rb +290 -0
- data/spec/legion/extensions/agentic/integration/phenomenal_binding/helpers/binding_unit_spec.rb +195 -0
- data/spec/legion/extensions/agentic/integration/phenomenal_binding/helpers/constants_spec.rb +92 -0
- data/spec/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream_spec.rb +128 -0
- data/spec/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding_spec.rb +174 -0
- data/spec/legion/extensions/agentic/integration/qualia/client_spec.rb +21 -0
- data/spec/legion/extensions/agentic/integration/qualia/helpers/quale_spec.rb +168 -0
- data/spec/legion/extensions/agentic/integration/qualia/helpers/qualia_engine_spec.rb +174 -0
- data/spec/legion/extensions/agentic/integration/qualia/qualia_spec.rb +7 -0
- data/spec/legion/extensions/agentic/integration/qualia/runners_spec.rb +70 -0
- data/spec/legion/extensions/agentic/integration/situation_model/client_spec.rb +51 -0
- data/spec/legion/extensions/agentic/integration/situation_model/helpers/constants_spec.rb +56 -0
- data/spec/legion/extensions/agentic/integration/situation_model/helpers/situation_engine_spec.rb +203 -0
- data/spec/legion/extensions/agentic/integration/situation_model/helpers/situation_event_spec.rb +94 -0
- data/spec/legion/extensions/agentic/integration/situation_model/helpers/situation_model_spec.rb +235 -0
- data/spec/legion/extensions/agentic/integration/situation_model/runners/situation_model_spec.rb +204 -0
- data/spec/legion/extensions/agentic/integration/synthesis/client_spec.rb +26 -0
- data/spec/legion/extensions/agentic/integration/synthesis/helpers/constants_spec.rb +87 -0
- data/spec/legion/extensions/agentic/integration/synthesis/helpers/synthesis_engine_spec.rb +233 -0
- data/spec/legion/extensions/agentic/integration/synthesis/helpers/synthesis_spec.rb +101 -0
- data/spec/legion/extensions/agentic/integration/synthesis/helpers/synthesis_stream_spec.rb +116 -0
- data/spec/legion/extensions/agentic/integration/synthesis/runners/cognitive_synthesis_spec.rb +181 -0
- data/spec/legion/extensions/agentic/integration/tapestry/client_spec.rb +55 -0
- data/spec/legion/extensions/agentic/integration/tapestry/helpers/constants_spec.rb +88 -0
- data/spec/legion/extensions/agentic/integration/tapestry/helpers/loom_engine_spec.rb +225 -0
- data/spec/legion/extensions/agentic/integration/tapestry/helpers/tapestry_spec.rb +229 -0
- data/spec/legion/extensions/agentic/integration/tapestry/helpers/thread_spec.rb +211 -0
- data/spec/legion/extensions/agentic/integration/tapestry/runners/cognitive_tapestry_spec.rb +171 -0
- data/spec/legion/extensions/agentic/integration/tessellation/client_spec.rb +40 -0
- data/spec/legion/extensions/agentic/integration/tessellation/helpers/mosaic_spec.rb +99 -0
- data/spec/legion/extensions/agentic/integration/tessellation/helpers/tessellation_engine_spec.rb +145 -0
- data/spec/legion/extensions/agentic/integration/tessellation/helpers/tile_spec.rb +138 -0
- data/spec/legion/extensions/agentic/integration/zeitgeist/helpers/cognitive_signal_spec.rb +62 -0
- data/spec/legion/extensions/agentic/integration/zeitgeist/helpers/constants_spec.rb +73 -0
- data/spec/legion/extensions/agentic/integration/zeitgeist/helpers/trend_window_spec.rb +100 -0
- data/spec/legion/extensions/agentic/integration/zeitgeist/helpers/zeitgeist_engine_spec.rb +163 -0
- data/spec/legion/extensions/agentic/integration/zeitgeist/runners/cognitive_zeitgeist_spec.rb +165 -0
- data/spec/spec_helper.rb +46 -0
- metadata +320 -0
data/lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Integration
|
|
7
|
+
module PhenomenalBinding
|
|
8
|
+
module Runners
|
|
9
|
+
module PhenomenalBinding
|
|
10
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
11
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
12
|
+
|
|
13
|
+
def register_stream(stream_type:, content:, salience: Helpers::Constants::DEFAULT_SALIENCE,
|
|
14
|
+
domain: nil, **)
|
|
15
|
+
stream = engine.register_stream(
|
|
16
|
+
stream_type: stream_type,
|
|
17
|
+
content: content,
|
|
18
|
+
salience: salience,
|
|
19
|
+
domain: domain
|
|
20
|
+
)
|
|
21
|
+
Legion::Logging.debug "[phenomenal_binding] register_stream: type=#{stream_type} " \
|
|
22
|
+
"salience=#{stream.salience.round(2)} domain=#{domain}"
|
|
23
|
+
{ status: :registered, stream: stream.to_h }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def create_binding(stream_ids:, binding_type:, attention_weight: 0.5, **)
|
|
27
|
+
result = engine.create_binding(
|
|
28
|
+
stream_ids: stream_ids,
|
|
29
|
+
binding_type: binding_type,
|
|
30
|
+
attention_weight: attention_weight
|
|
31
|
+
)
|
|
32
|
+
Legion::Logging.debug "[phenomenal_binding] create_binding: type=#{binding_type} " \
|
|
33
|
+
"streams=#{result.stream_count} coherence=#{result.coherence.round(2)}"
|
|
34
|
+
{ status: :bound, binding: result.to_h }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def reinforce_binding(binding_id:, **)
|
|
38
|
+
result = engine.reinforce_binding(binding_id: binding_id)
|
|
39
|
+
Legion::Logging.debug "[phenomenal_binding] reinforce_binding: id=#{binding_id} " \
|
|
40
|
+
"coherence=#{result[:coherence]&.round(2)}"
|
|
41
|
+
result
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def dissolve_binding(binding_id:, **)
|
|
45
|
+
result = engine.dissolve_binding(binding_id: binding_id)
|
|
46
|
+
Legion::Logging.debug "[phenomenal_binding] dissolve_binding: id=#{binding_id} status=#{result[:status]}"
|
|
47
|
+
result
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def unified_experience(**)
|
|
51
|
+
experience = engine.unified_experience
|
|
52
|
+
Legion::Logging.debug '[phenomenal_binding] unified_experience: ' \
|
|
53
|
+
"coherence=#{experience&.coherence&.round(2) || 'none'}"
|
|
54
|
+
{ unified_experience: experience&.to_h }
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def fragmentation_index(**)
|
|
58
|
+
index = engine.fragmentation_index
|
|
59
|
+
Legion::Logging.debug "[phenomenal_binding] fragmentation_index=#{index.round(3)}"
|
|
60
|
+
{ fragmentation_index: index }
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def binding_by_type(binding_type:, **)
|
|
64
|
+
bindings = engine.binding_by_type(binding_type: binding_type)
|
|
65
|
+
Legion::Logging.debug "[phenomenal_binding] binding_by_type: type=#{binding_type} count=#{bindings.size}"
|
|
66
|
+
{ binding_type: binding_type, bindings: bindings.map(&:to_h) }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def streams_for_binding(binding_id:, **)
|
|
70
|
+
streams = engine.streams_for_binding(binding_id: binding_id)
|
|
71
|
+
Legion::Logging.debug "[phenomenal_binding] streams_for_binding: id=#{binding_id} count=#{streams.size}"
|
|
72
|
+
{ binding_id: binding_id, streams: streams.map(&:to_h) }
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def unbound_streams(**)
|
|
76
|
+
streams = engine.unbound_streams
|
|
77
|
+
Legion::Logging.debug "[phenomenal_binding] unbound_streams: count=#{streams.size}"
|
|
78
|
+
{ unbound_streams: streams.map(&:to_h) }
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def decay_all(**)
|
|
82
|
+
engine.decay_all
|
|
83
|
+
Legion::Logging.debug '[phenomenal_binding] decay_all: all bindings decayed'
|
|
84
|
+
{ status: :decayed }
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def prune_incoherent(**)
|
|
88
|
+
engine.prune_incoherent
|
|
89
|
+
Legion::Logging.debug '[phenomenal_binding] prune_incoherent: incoherent bindings removed'
|
|
90
|
+
{ status: :pruned }
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def consciousness_report(**)
|
|
94
|
+
report = engine.consciousness_report
|
|
95
|
+
Legion::Logging.debug '[phenomenal_binding] consciousness_report: ' \
|
|
96
|
+
"fragmentation=#{report[:fragmentation_index].round(3)} " \
|
|
97
|
+
"bindings=#{report[:binding_count]}"
|
|
98
|
+
report
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def engine_stats(**)
|
|
102
|
+
engine.to_h
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/agentic/integration/phenomenal_binding/version'
|
|
4
|
+
require 'legion/extensions/agentic/integration/phenomenal_binding/helpers/constants'
|
|
5
|
+
require 'legion/extensions/agentic/integration/phenomenal_binding/helpers/stream'
|
|
6
|
+
require 'legion/extensions/agentic/integration/phenomenal_binding/helpers/binding_unit'
|
|
7
|
+
require 'legion/extensions/agentic/integration/phenomenal_binding/helpers/binding_engine'
|
|
8
|
+
require 'legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding'
|
|
9
|
+
require 'legion/extensions/agentic/integration/phenomenal_binding/client'
|
|
10
|
+
|
|
11
|
+
module Legion
|
|
12
|
+
module Extensions
|
|
13
|
+
module Agentic
|
|
14
|
+
module Integration
|
|
15
|
+
module PhenomenalBinding
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Integration
|
|
7
|
+
module Qualia
|
|
8
|
+
class Client
|
|
9
|
+
include Runners::Qualia
|
|
10
|
+
|
|
11
|
+
def initialize
|
|
12
|
+
@default_engine = Helpers::QualiaEngine.new
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Integration
|
|
7
|
+
module Qualia
|
|
8
|
+
module Helpers
|
|
9
|
+
module Constants
|
|
10
|
+
MAX_EXPERIENCES = 500
|
|
11
|
+
MAX_PALETTE_SIZE = 100
|
|
12
|
+
|
|
13
|
+
# Phenomenal dimensions
|
|
14
|
+
DEFAULT_VIVIDNESS = 0.5
|
|
15
|
+
DEFAULT_VALENCE = 0.0
|
|
16
|
+
DEFAULT_TEXTURE = 0.5
|
|
17
|
+
VIVIDNESS_DECAY = 0.03
|
|
18
|
+
VIVIDNESS_BOOST = 0.1
|
|
19
|
+
|
|
20
|
+
# Thresholds
|
|
21
|
+
VIVID_THRESHOLD = 0.7
|
|
22
|
+
FAINT_THRESHOLD = 0.2
|
|
23
|
+
INTENSE_THRESHOLD = 0.8
|
|
24
|
+
|
|
25
|
+
PHENOMENAL_QUALITIES = %i[
|
|
26
|
+
sharp smooth warm cool heavy light
|
|
27
|
+
bright dark flowing rigid pulsing still
|
|
28
|
+
].freeze
|
|
29
|
+
|
|
30
|
+
TEXTURE_TYPES = %i[
|
|
31
|
+
crystalline fluid granular electric
|
|
32
|
+
velvet metallic organic ethereal
|
|
33
|
+
].freeze
|
|
34
|
+
|
|
35
|
+
MODALITIES = %i[
|
|
36
|
+
visual auditory tactile gustatory
|
|
37
|
+
olfactory kinesthetic emotional abstract
|
|
38
|
+
].freeze
|
|
39
|
+
|
|
40
|
+
VIVIDNESS_LABELS = {
|
|
41
|
+
(0.8..) => :overwhelming,
|
|
42
|
+
(0.6...0.8) => :vivid,
|
|
43
|
+
(0.4...0.6) => :moderate,
|
|
44
|
+
(0.2...0.4) => :faint,
|
|
45
|
+
(..0.2) => :ghost
|
|
46
|
+
}.freeze
|
|
47
|
+
|
|
48
|
+
VALENCE_LABELS = {
|
|
49
|
+
(0.5..) => :pleasant,
|
|
50
|
+
(0.2...0.5) => :mildly_pleasant,
|
|
51
|
+
(-0.2...0.2) => :neutral,
|
|
52
|
+
(-0.5...-0.2) => :mildly_unpleasant,
|
|
53
|
+
(..-0.5) => :unpleasant
|
|
54
|
+
}.freeze
|
|
55
|
+
|
|
56
|
+
RICHNESS_LABELS = {
|
|
57
|
+
(0.8..) => :synesthetic,
|
|
58
|
+
(0.6...0.8) => :rich,
|
|
59
|
+
(0.4...0.6) => :moderate,
|
|
60
|
+
(0.2...0.4) => :sparse,
|
|
61
|
+
(..0.2) => :flat
|
|
62
|
+
}.freeze
|
|
63
|
+
|
|
64
|
+
def self.label_for(labels, value)
|
|
65
|
+
labels.each { |range, label| return label if range.cover?(value) }
|
|
66
|
+
:unknown
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'securerandom'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Agentic
|
|
8
|
+
module Integration
|
|
9
|
+
module Qualia
|
|
10
|
+
module Helpers
|
|
11
|
+
class Quale
|
|
12
|
+
include Constants
|
|
13
|
+
|
|
14
|
+
attr_reader :id, :content, :modality, :quality, :texture,
|
|
15
|
+
:valence, :original_vividness, :created_at
|
|
16
|
+
attr_accessor :vividness
|
|
17
|
+
|
|
18
|
+
def initialize(content:, modality: :abstract, quality: :smooth, texture: :fluid,
|
|
19
|
+
vividness: DEFAULT_VIVIDNESS, valence: DEFAULT_VALENCE)
|
|
20
|
+
@id = SecureRandom.uuid
|
|
21
|
+
@content = content.to_s
|
|
22
|
+
@modality = valid_modality(modality)
|
|
23
|
+
@quality = valid_quality(quality)
|
|
24
|
+
@texture = valid_texture(texture)
|
|
25
|
+
@vividness = vividness.to_f.clamp(0.0, 1.0).round(10)
|
|
26
|
+
@original_vividness = @vividness
|
|
27
|
+
@valence = valence.to_f.clamp(-1.0, 1.0).round(10)
|
|
28
|
+
@created_at = Time.now
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def intensify!(amount: VIVIDNESS_BOOST)
|
|
32
|
+
@vividness = (@vividness + amount).clamp(0.0, 1.0).round(10)
|
|
33
|
+
self
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def fade!
|
|
37
|
+
@vividness = (@vividness - VIVIDNESS_DECAY).clamp(0.0, 1.0).round(10)
|
|
38
|
+
self
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def vivid? = @vividness >= VIVID_THRESHOLD
|
|
42
|
+
def faint? = @vividness <= FAINT_THRESHOLD
|
|
43
|
+
def intense? = @vividness >= INTENSE_THRESHOLD
|
|
44
|
+
def pleasant? = @valence > 0.2
|
|
45
|
+
def unpleasant? = @valence < -0.2
|
|
46
|
+
def neutral_valence? = @valence.abs <= 0.2
|
|
47
|
+
|
|
48
|
+
def phenomenal_richness
|
|
49
|
+
base = @vividness * 0.5
|
|
50
|
+
quality_bonus = PHENOMENAL_QUALITIES.index(@quality).to_f / PHENOMENAL_QUALITIES.size * 0.25
|
|
51
|
+
texture_bonus = TEXTURE_TYPES.index(@texture).to_f / TEXTURE_TYPES.size * 0.25
|
|
52
|
+
(base + quality_bonus + texture_bonus).clamp(0.0, 1.0).round(10)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def persistence = (@vividness / [@original_vividness, 0.01].max).clamp(0.0, 1.0).round(10)
|
|
56
|
+
def vividness_label = Constants.label_for(VIVIDNESS_LABELS, @vividness)
|
|
57
|
+
def valence_label = Constants.label_for(VALENCE_LABELS, @valence)
|
|
58
|
+
def richness_label = Constants.label_for(RICHNESS_LABELS, phenomenal_richness)
|
|
59
|
+
|
|
60
|
+
def to_h
|
|
61
|
+
{
|
|
62
|
+
id: @id,
|
|
63
|
+
content: @content,
|
|
64
|
+
modality: @modality,
|
|
65
|
+
quality: @quality,
|
|
66
|
+
texture: @texture,
|
|
67
|
+
vividness: @vividness,
|
|
68
|
+
original_vividness: @original_vividness,
|
|
69
|
+
valence: @valence,
|
|
70
|
+
phenomenal_richness: phenomenal_richness,
|
|
71
|
+
vivid: vivid?,
|
|
72
|
+
faint: faint?,
|
|
73
|
+
intense: intense?,
|
|
74
|
+
vividness_label: vividness_label,
|
|
75
|
+
valence_label: valence_label,
|
|
76
|
+
persistence: persistence,
|
|
77
|
+
created_at: @created_at.iso8601
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
private
|
|
82
|
+
|
|
83
|
+
def valid_modality(mod)
|
|
84
|
+
sym = mod.to_sym
|
|
85
|
+
MODALITIES.include?(sym) ? sym : :abstract
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def valid_quality(qual)
|
|
89
|
+
sym = qual.to_sym
|
|
90
|
+
PHENOMENAL_QUALITIES.include?(sym) ? sym : :smooth
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def valid_texture(tex)
|
|
94
|
+
sym = tex.to_sym
|
|
95
|
+
TEXTURE_TYPES.include?(sym) ? sym : :fluid
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Integration
|
|
7
|
+
module Qualia
|
|
8
|
+
module Helpers
|
|
9
|
+
class QualiaEngine
|
|
10
|
+
include Constants
|
|
11
|
+
|
|
12
|
+
def initialize
|
|
13
|
+
@experiences = {}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create_quale(content:, modality: :abstract, quality: :smooth, texture: :fluid,
|
|
17
|
+
vividness: DEFAULT_VIVIDNESS, valence: DEFAULT_VALENCE)
|
|
18
|
+
prune_faint
|
|
19
|
+
quale = Quale.new(content: content, modality: modality, quality: quality,
|
|
20
|
+
texture: texture, vividness: vividness, valence: valence)
|
|
21
|
+
@experiences[quale.id] = quale
|
|
22
|
+
quale
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def intensify(quale_id:, amount: VIVIDNESS_BOOST)
|
|
26
|
+
quale = @experiences[quale_id]
|
|
27
|
+
return nil unless quale
|
|
28
|
+
|
|
29
|
+
quale.intensify!(amount: amount)
|
|
30
|
+
quale
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def fade_all!
|
|
34
|
+
@experiences.each_value(&:fade!)
|
|
35
|
+
prune_faint
|
|
36
|
+
{ remaining: @experiences.size }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def vivid_experiences = @experiences.values.select(&:vivid?)
|
|
40
|
+
def faint_experiences = @experiences.values.select(&:faint?)
|
|
41
|
+
def intense_experiences = @experiences.values.select(&:intense?)
|
|
42
|
+
|
|
43
|
+
def by_modality(modality:)
|
|
44
|
+
@experiences.values.select { |q| q.modality == modality.to_sym }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def by_quality(quality:)
|
|
48
|
+
@experiences.values.select { |q| q.quality == quality.to_sym }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def by_texture(texture:)
|
|
52
|
+
@experiences.values.select { |q| q.texture == texture.to_sym }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def pleasant_experiences = @experiences.values.select(&:pleasant?)
|
|
56
|
+
def unpleasant_experiences = @experiences.values.select(&:unpleasant?)
|
|
57
|
+
|
|
58
|
+
def most_vivid(limit: 5) = @experiences.values.sort_by { |q| -q.vividness }.first(limit)
|
|
59
|
+
|
|
60
|
+
def average_vividness
|
|
61
|
+
return 0.0 if @experiences.empty?
|
|
62
|
+
|
|
63
|
+
(@experiences.values.sum(&:vividness) / @experiences.size).round(10)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def average_valence
|
|
67
|
+
return 0.0 if @experiences.empty?
|
|
68
|
+
|
|
69
|
+
(@experiences.values.sum(&:valence) / @experiences.size).round(10)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def phenomenal_richness
|
|
73
|
+
return 0.0 if @experiences.empty?
|
|
74
|
+
|
|
75
|
+
(@experiences.values.sum(&:phenomenal_richness) / @experiences.size).round(10)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def modality_distribution
|
|
79
|
+
MODALITIES.to_h do |mod|
|
|
80
|
+
[mod, @experiences.values.count { |q| q.modality == mod }]
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def quality_palette
|
|
85
|
+
@experiences.values.map(&:quality).tally.sort_by { |_, v| -v }.to_h
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def texture_palette
|
|
89
|
+
@experiences.values.map(&:texture).tally.sort_by { |_, v| -v }.to_h
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def experiential_diversity
|
|
93
|
+
return 0.0 if @experiences.empty?
|
|
94
|
+
|
|
95
|
+
modalities_used = @experiences.values.map(&:modality).uniq.size
|
|
96
|
+
(modalities_used.to_f / MODALITIES.size).clamp(0.0, 1.0).round(10)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def qualia_report
|
|
100
|
+
{
|
|
101
|
+
total_experiences: @experiences.size,
|
|
102
|
+
vivid_count: vivid_experiences.size,
|
|
103
|
+
faint_count: faint_experiences.size,
|
|
104
|
+
pleasant_count: pleasant_experiences.size,
|
|
105
|
+
unpleasant_count: unpleasant_experiences.size,
|
|
106
|
+
average_vividness: average_vividness,
|
|
107
|
+
average_valence: average_valence,
|
|
108
|
+
phenomenal_richness: phenomenal_richness,
|
|
109
|
+
experiential_diversity: experiential_diversity,
|
|
110
|
+
richness_label: Constants.label_for(RICHNESS_LABELS, phenomenal_richness),
|
|
111
|
+
most_vivid: most_vivid(limit: 3).map(&:to_h)
|
|
112
|
+
}
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def to_h
|
|
116
|
+
{
|
|
117
|
+
total_experiences: @experiences.size,
|
|
118
|
+
vivid: vivid_experiences.size,
|
|
119
|
+
avg_vividness: average_vividness,
|
|
120
|
+
avg_valence: average_valence,
|
|
121
|
+
richness: phenomenal_richness
|
|
122
|
+
}
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
private
|
|
126
|
+
|
|
127
|
+
def prune_faint
|
|
128
|
+
return if @experiences.size < MAX_EXPERIENCES
|
|
129
|
+
|
|
130
|
+
@experiences.reject! { |_, q| q.vividness <= 0.0 }
|
|
131
|
+
return unless @experiences.size >= MAX_EXPERIENCES
|
|
132
|
+
|
|
133
|
+
weakest = @experiences.values.min_by(&:vividness)
|
|
134
|
+
@experiences.delete(weakest.id) if weakest
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Integration
|
|
7
|
+
module Qualia
|
|
8
|
+
module Runners
|
|
9
|
+
module Qualia
|
|
10
|
+
include Legion::Extensions::Helpers::Lex if defined?(Legion::Extensions::Helpers::Lex)
|
|
11
|
+
|
|
12
|
+
def create_quale(content:, modality: :abstract, quality: :smooth, texture: :fluid, vividness: nil,
|
|
13
|
+
valence: nil, engine: nil, **)
|
|
14
|
+
eng = engine || @default_engine
|
|
15
|
+
quale = eng.create_quale(content: content, modality: modality, quality: quality,
|
|
16
|
+
texture: texture,
|
|
17
|
+
vividness: vividness || Helpers::Constants::DEFAULT_VIVIDNESS,
|
|
18
|
+
valence: valence || Helpers::Constants::DEFAULT_VALENCE)
|
|
19
|
+
{ success: true, quale: quale.to_h }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def intensify_quale(quale_id:, amount: nil, engine: nil, **)
|
|
23
|
+
eng = engine || @default_engine
|
|
24
|
+
quale = eng.intensify(quale_id: quale_id,
|
|
25
|
+
amount: amount || Helpers::Constants::VIVIDNESS_BOOST)
|
|
26
|
+
return { success: false, error: 'quale not found' } unless quale
|
|
27
|
+
|
|
28
|
+
{ success: true, quale: quale.to_h }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def fade_all(engine: nil, **)
|
|
32
|
+
eng = engine || @default_engine
|
|
33
|
+
result = eng.fade_all!
|
|
34
|
+
{ success: true, **result }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def vivid_experiences(engine: nil, **)
|
|
38
|
+
eng = engine || @default_engine
|
|
39
|
+
qualia = eng.vivid_experiences
|
|
40
|
+
{ success: true, count: qualia.size, qualia: qualia.map(&:to_h) }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def by_modality(modality:, engine: nil, **)
|
|
44
|
+
eng = engine || @default_engine
|
|
45
|
+
qualia = eng.by_modality(modality: modality)
|
|
46
|
+
{ success: true, count: qualia.size, qualia: qualia.map(&:to_h) }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def phenomenal_richness(engine: nil, **)
|
|
50
|
+
eng = engine || @default_engine
|
|
51
|
+
richness = eng.phenomenal_richness
|
|
52
|
+
label = Helpers::Constants.label_for(Helpers::Constants::RICHNESS_LABELS, richness)
|
|
53
|
+
{ success: true, richness: richness, label: label }
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def qualia_status(engine: nil, **)
|
|
57
|
+
eng = engine || @default_engine
|
|
58
|
+
report = eng.qualia_report
|
|
59
|
+
{ success: true, **report }
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'qualia/version'
|
|
4
|
+
require_relative 'qualia/helpers/constants'
|
|
5
|
+
require_relative 'qualia/helpers/quale'
|
|
6
|
+
require_relative 'qualia/helpers/qualia_engine'
|
|
7
|
+
require_relative 'qualia/runners/qualia'
|
|
8
|
+
require_relative 'qualia/client'
|
|
9
|
+
|
|
10
|
+
module Legion
|
|
11
|
+
module Extensions
|
|
12
|
+
module Agentic
|
|
13
|
+
module Integration
|
|
14
|
+
module Qualia
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/agentic/integration/situation_model/helpers/constants'
|
|
4
|
+
require 'legion/extensions/agentic/integration/situation_model/helpers/situation_event'
|
|
5
|
+
require 'legion/extensions/agentic/integration/situation_model/helpers/situation_model'
|
|
6
|
+
require 'legion/extensions/agentic/integration/situation_model/helpers/situation_engine'
|
|
7
|
+
require 'legion/extensions/agentic/integration/situation_model/runners/situation_model'
|
|
8
|
+
require 'legion/extensions/agentic/integration/situation_model/helpers/client'
|
|
9
|
+
|
|
10
|
+
module Legion
|
|
11
|
+
module Extensions
|
|
12
|
+
module Agentic
|
|
13
|
+
module Integration
|
|
14
|
+
module SituationModel
|
|
15
|
+
class Client
|
|
16
|
+
include Runners::SituationModel
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def engine
|
|
21
|
+
@engine ||= Helpers::SituationEngine.new
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Integration
|
|
7
|
+
module SituationModel
|
|
8
|
+
module Helpers
|
|
9
|
+
class Client
|
|
10
|
+
include Legion::Extensions::Agentic::Integration::SituationModel::Runners::SituationModel
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def engine
|
|
15
|
+
@engine ||= SituationEngine.new
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Integration
|
|
7
|
+
module SituationModel
|
|
8
|
+
module Helpers
|
|
9
|
+
module Constants
|
|
10
|
+
DIMENSIONS = %i[space time causation intentionality protagonist].freeze
|
|
11
|
+
|
|
12
|
+
CONTINUITY_LABELS = {
|
|
13
|
+
(0.8..) => :continuous,
|
|
14
|
+
(0.5...0.8) => :shift,
|
|
15
|
+
(0.2...0.5) => :break,
|
|
16
|
+
(..0.2) => :rupture
|
|
17
|
+
}.freeze
|
|
18
|
+
|
|
19
|
+
MODEL_HEALTH_LABELS = {
|
|
20
|
+
(0.8..) => :vivid,
|
|
21
|
+
(0.6...0.8) => :clear,
|
|
22
|
+
(0.4...0.6) => :hazy,
|
|
23
|
+
(0.2...0.4) => :fading,
|
|
24
|
+
(..0.2) => :collapsed
|
|
25
|
+
}.freeze
|
|
26
|
+
|
|
27
|
+
MAX_MODELS = 100
|
|
28
|
+
MAX_EVENTS_PER_MODEL = 200
|
|
29
|
+
MAX_HISTORY = 500
|
|
30
|
+
DEFAULT_DIMENSION_VALUE = 0.5
|
|
31
|
+
DECAY_RATE = 0.01
|
|
32
|
+
COHERENCE_FLOOR = 0.0
|
|
33
|
+
COHERENCE_CEILING = 1.0
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|