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
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Integration::Mosaic::Helpers::Tessera do
|
|
4
|
+
subject(:tessera) do
|
|
5
|
+
described_class.new(material: :glass, domain: :reasoning, content: 'fragment')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
describe '#initialize' do
|
|
9
|
+
it 'sets material' do
|
|
10
|
+
expect(tessera.material).to eq(:glass)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'sets domain' do
|
|
14
|
+
expect(tessera.domain).to eq(:reasoning)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'generates uuid' do
|
|
18
|
+
expect(tessera.id).to match(/\A[0-9a-f-]{36}\z/)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'assigns a color' do
|
|
22
|
+
expect(tessera.color).to be_a(Symbol)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'defaults fit_quality to 0.5' do
|
|
26
|
+
expect(tessera.fit_quality).to eq(0.5)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'starts unplaced' do
|
|
30
|
+
expect(tessera.loose?).to be true
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'rejects unknown materials' do
|
|
34
|
+
expect { described_class.new(material: :plasma, domain: :x, content: 'y') }
|
|
35
|
+
.to raise_error(ArgumentError, /unknown material/)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'accepts custom fit_quality' do
|
|
39
|
+
t = described_class.new(material: :stone, domain: :x, content: 'y', fit_quality: 0.95)
|
|
40
|
+
expect(t.fit_quality).to eq(0.95)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
describe '#place!' do
|
|
45
|
+
it 'marks tessera as placed' do
|
|
46
|
+
tessera.place!('mosaic-1')
|
|
47
|
+
expect(tessera.placed?).to be true
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'records mosaic id' do
|
|
51
|
+
tessera.place!('mosaic-1')
|
|
52
|
+
expect(tessera.mosaic_id).to eq('mosaic-1')
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'records placement time' do
|
|
56
|
+
tessera.place!('mosaic-1')
|
|
57
|
+
expect(tessera.placed_at).to be_a(Time)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe '#perfect_fit?' do
|
|
62
|
+
it 'returns false at default quality' do
|
|
63
|
+
expect(tessera.perfect_fit?).to be false
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'returns true at high quality' do
|
|
67
|
+
t = described_class.new(material: :crystal, domain: :x, content: 'y', fit_quality: 0.95)
|
|
68
|
+
expect(t.perfect_fit?).to be true
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
describe '#poor_fit?' do
|
|
73
|
+
it 'returns false at default quality' do
|
|
74
|
+
expect(tessera.poor_fit?).to be false
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'returns true at low quality' do
|
|
78
|
+
t = described_class.new(material: :clay, domain: :x, content: 'y', fit_quality: 0.1)
|
|
79
|
+
expect(t.poor_fit?).to be true
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
describe '#to_h' do
|
|
84
|
+
it 'returns all keys' do
|
|
85
|
+
h = tessera.to_h
|
|
86
|
+
%i[id material domain content color fit_quality
|
|
87
|
+
placed loose perfect_fit poor_fit mosaic_id placed_at].each do |k|
|
|
88
|
+
expect(h).to have_key(k)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Integration::Mosaic::Runners::CognitiveMosaic do
|
|
4
|
+
let(:engine) { Legion::Extensions::Agentic::Integration::Mosaic::Helpers::MosaicEngine.new }
|
|
5
|
+
|
|
6
|
+
describe '.create_tessera' do
|
|
7
|
+
it 'returns success' do
|
|
8
|
+
result = described_class.create_tessera(
|
|
9
|
+
material: :glass, domain: :reasoning, content: 'test', engine: engine
|
|
10
|
+
)
|
|
11
|
+
expect(result[:success]).to be true
|
|
12
|
+
expect(result[:tessera][:material]).to eq(:glass)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'returns failure for invalid material' do
|
|
16
|
+
result = described_class.create_tessera(
|
|
17
|
+
material: :plasma, domain: :x, content: 'y', engine: engine
|
|
18
|
+
)
|
|
19
|
+
expect(result[:success]).to be false
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe '.create_mosaic' do
|
|
24
|
+
it 'returns success' do
|
|
25
|
+
result = described_class.create_mosaic(
|
|
26
|
+
name: 'test', pattern_category: :geometric, engine: engine
|
|
27
|
+
)
|
|
28
|
+
expect(result[:success]).to be true
|
|
29
|
+
expect(result[:mosaic][:name]).to eq('test')
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'returns failure for invalid pattern' do
|
|
33
|
+
result = described_class.create_mosaic(
|
|
34
|
+
name: 'x', pattern_category: :random, engine: engine
|
|
35
|
+
)
|
|
36
|
+
expect(result[:success]).to be false
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe '.place_tessera' do
|
|
41
|
+
it 'places tessera successfully' do
|
|
42
|
+
t = engine.create_tessera(material: :stone, domain: :x, content: 'a')
|
|
43
|
+
m = engine.create_mosaic(name: 'wall', pattern_category: :organic)
|
|
44
|
+
result = described_class.place_tessera(
|
|
45
|
+
tessera_id: t.id, mosaic_id: m.id, engine: engine
|
|
46
|
+
)
|
|
47
|
+
expect(result[:success]).to be true
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'returns failure for missing tessera' do
|
|
51
|
+
result = described_class.place_tessera(
|
|
52
|
+
tessera_id: 'nope', mosaic_id: 'nope', engine: engine
|
|
53
|
+
)
|
|
54
|
+
expect(result[:success]).to be false
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe '.list_tesserae' do
|
|
59
|
+
it 'returns all tesserae' do
|
|
60
|
+
engine.create_tessera(material: :glass, domain: :x, content: 'a')
|
|
61
|
+
result = described_class.list_tesserae(engine: engine)
|
|
62
|
+
expect(result[:count]).to eq(1)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'filters by material' do
|
|
66
|
+
engine.create_tessera(material: :glass, domain: :x, content: 'a')
|
|
67
|
+
engine.create_tessera(material: :stone, domain: :x, content: 'b')
|
|
68
|
+
result = described_class.list_tesserae(engine: engine, material: :glass)
|
|
69
|
+
expect(result[:count]).to eq(1)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
describe '.list_mosaics' do
|
|
74
|
+
it 'returns all mosaics' do
|
|
75
|
+
engine.create_mosaic(name: 'a', pattern_category: :geometric)
|
|
76
|
+
result = described_class.list_mosaics(engine: engine)
|
|
77
|
+
expect(result[:count]).to eq(1)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
describe '.mosaic_status' do
|
|
82
|
+
it 'returns report' do
|
|
83
|
+
result = described_class.mosaic_status(engine: engine)
|
|
84
|
+
expect(result[:success]).to be true
|
|
85
|
+
expect(result[:report]).to have_key(:total_tesserae)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Integration::Mycelium::Client do
|
|
4
|
+
let(:client) { described_class.new }
|
|
5
|
+
|
|
6
|
+
it 'responds to runner methods' do
|
|
7
|
+
expect(client).to respond_to(:create_node, :connect, :fruit,
|
|
8
|
+
:network_status)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
describe '#create_node' do
|
|
12
|
+
it 'delegates' do
|
|
13
|
+
result = client.create_node(node_type: :knowledge_cluster,
|
|
14
|
+
domain: :semantic, content: 'x')
|
|
15
|
+
expect(result[:success]).to be true
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe '#network_status' do
|
|
20
|
+
it 'returns report' do
|
|
21
|
+
result = client.network_status
|
|
22
|
+
expect(result[:report]).to be_a Hash
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Integration::Mycelium::Helpers::Constants do
|
|
4
|
+
let(:c) { described_class }
|
|
5
|
+
|
|
6
|
+
it 'defines MAX_NODES' do
|
|
7
|
+
expect(c::MAX_NODES).to eq 200
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'has 6 node types' do
|
|
11
|
+
expect(c::NODE_TYPES.size).to eq 6
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'has 6 nutrient types' do
|
|
15
|
+
expect(c::NUTRIENT_TYPES.size).to eq 6
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'has 6 fruiting types' do
|
|
19
|
+
expect(c::FRUITING_TYPES.size).to eq 6
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe '.label_for' do
|
|
23
|
+
it 'returns health labels' do
|
|
24
|
+
expect(c.label_for(c::NETWORK_HEALTH_LABELS, 0.9)).to eq :thriving
|
|
25
|
+
expect(c.label_for(c::NETWORK_HEALTH_LABELS, 0.1)).to eq :depleted
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Integration::Mycelium::Helpers::FruitingBody do
|
|
4
|
+
let(:body) do
|
|
5
|
+
described_class.new(fruiting_type: :insight, source_node_id: 'node-1',
|
|
6
|
+
content: 'breakthrough discovery')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe '#initialize' do
|
|
10
|
+
it 'assigns UUID' do
|
|
11
|
+
expect(body.id).to match(/\A[0-9a-f-]{36}\z/)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'sets fruiting_type' do
|
|
15
|
+
expect(body.fruiting_type).to eq :insight
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'raises on invalid type' do
|
|
19
|
+
expect do
|
|
20
|
+
described_class.new(fruiting_type: :bogus, source_node_id: 'x',
|
|
21
|
+
content: 'x')
|
|
22
|
+
end.to raise_error(ArgumentError, /unknown fruiting type/)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe '#to_h' do
|
|
27
|
+
it 'includes expected keys' do
|
|
28
|
+
%i[id fruiting_type source_node_id content potency emerged_at].each do |key|
|
|
29
|
+
expect(body.to_h).to have_key(key)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Integration::Mycelium::Helpers::Hypha do
|
|
4
|
+
let(:hypha) do
|
|
5
|
+
described_class.new(source_id: 'src', target_id: 'tgt',
|
|
6
|
+
nutrient_type: :information)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe '#initialize' do
|
|
10
|
+
it 'assigns UUID' do
|
|
11
|
+
expect(hypha.id).to match(/\A[0-9a-f-]{36}\z/)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'starts in growing state' do
|
|
15
|
+
expect(hypha.state).to eq :growing
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'raises on invalid nutrient_type' do
|
|
19
|
+
expect do
|
|
20
|
+
described_class.new(source_id: 'a', target_id: 'b',
|
|
21
|
+
nutrient_type: :bogus)
|
|
22
|
+
end.to raise_error(ArgumentError, /unknown nutrient type/)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe '#reinforce!' do
|
|
27
|
+
it 'increases strength' do
|
|
28
|
+
hypha.reinforce!(amount: 0.2)
|
|
29
|
+
expect(hypha.strength).to eq 0.7
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'transitions to mature at 0.6' do
|
|
33
|
+
hypha.reinforce!(amount: 0.2)
|
|
34
|
+
expect(hypha.state).to eq :mature
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
describe '#decay!' do
|
|
39
|
+
it 'decreases strength' do
|
|
40
|
+
original = hypha.strength
|
|
41
|
+
hypha.decay!
|
|
42
|
+
expect(hypha.strength).to be < original
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'transitions to decaying when below 0.2' do
|
|
46
|
+
hypha.instance_variable_set(:@strength, 0.2)
|
|
47
|
+
hypha.decay!(rate: 0.05)
|
|
48
|
+
expect(hypha.state).to eq :decaying
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe '#transfer_capacity' do
|
|
53
|
+
it 'returns strength * efficiency' do
|
|
54
|
+
expected = (0.5 * 0.8).round(10)
|
|
55
|
+
expect(hypha.transfer_capacity).to eq expected
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe '#active?' do
|
|
60
|
+
it 'true when growing' do
|
|
61
|
+
expect(hypha.active?).to be true
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'false when decaying' do
|
|
65
|
+
hypha.instance_variable_set(:@state, :decaying)
|
|
66
|
+
expect(hypha.active?).to be false
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Integration::Mycelium::Helpers::MycelialNode do
|
|
4
|
+
let(:node) do
|
|
5
|
+
described_class.new(node_type: :knowledge_cluster, domain: :semantic,
|
|
6
|
+
content: 'test node')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe '#initialize' do
|
|
10
|
+
it 'assigns UUID' do
|
|
11
|
+
expect(node.id).to match(/\A[0-9a-f-]{36}\z/)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'sets node_type' do
|
|
15
|
+
expect(node.node_type).to eq :knowledge_cluster
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'defaults nutrient_level to 0.5' do
|
|
19
|
+
expect(node.nutrient_level).to eq 0.5
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'raises on invalid type' do
|
|
23
|
+
expect do
|
|
24
|
+
described_class.new(node_type: :bogus, domain: :x, content: 'x')
|
|
25
|
+
end.to raise_error(ArgumentError, /unknown node type/)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe '#absorb!' do
|
|
30
|
+
it 'increases nutrient_level' do
|
|
31
|
+
node.absorb!(0.2)
|
|
32
|
+
expect(node.nutrient_level).to eq 0.7
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'clamps at 1.0' do
|
|
36
|
+
node.absorb!(5.0)
|
|
37
|
+
expect(node.nutrient_level).to eq 1.0
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe '#deplete!' do
|
|
42
|
+
it 'decreases nutrient_level' do
|
|
43
|
+
node.deplete!(0.2)
|
|
44
|
+
expect(node.nutrient_level).to eq 0.3
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'clamps at 0.0' do
|
|
48
|
+
node.deplete!(5.0)
|
|
49
|
+
expect(node.nutrient_level).to eq 0.0
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe '#fruiting_ready?' do
|
|
54
|
+
it 'true when nutrient >= threshold' do
|
|
55
|
+
node.absorb!(0.3)
|
|
56
|
+
expect(node.fruiting_ready?).to be true
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'false when below threshold' do
|
|
60
|
+
expect(node.fruiting_ready?).to be false
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
describe '#starving?' do
|
|
65
|
+
it 'true when nutrient < 0.1' do
|
|
66
|
+
node.deplete!(0.45)
|
|
67
|
+
expect(node.starving?).to be true
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
describe '#to_h' do
|
|
72
|
+
it 'includes expected keys' do
|
|
73
|
+
%i[id node_type domain content nutrient_level connections_count
|
|
74
|
+
fruiting_ready starving created_at].each do |key|
|
|
75
|
+
expect(node.to_h).to have_key(key)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Integration::Mycelium::Helpers::MyceliumEngine do
|
|
4
|
+
let(:engine) { described_class.new }
|
|
5
|
+
|
|
6
|
+
describe '#create_node' do
|
|
7
|
+
it 'creates a node' do
|
|
8
|
+
node = engine.create_node(node_type: :knowledge_cluster,
|
|
9
|
+
domain: :semantic, content: 'test')
|
|
10
|
+
expect(node.node_type).to eq :knowledge_cluster
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'tracks in all_nodes' do
|
|
14
|
+
engine.create_node(node_type: :insight_node, domain: :creative,
|
|
15
|
+
content: 'x')
|
|
16
|
+
expect(engine.all_nodes.size).to eq 1
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#connect' do
|
|
21
|
+
let(:n1) do
|
|
22
|
+
engine.create_node(node_type: :knowledge_cluster, domain: :semantic,
|
|
23
|
+
content: 'a')
|
|
24
|
+
end
|
|
25
|
+
let(:n2) do
|
|
26
|
+
engine.create_node(node_type: :skill_node, domain: :procedural,
|
|
27
|
+
content: 'b')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'creates a hypha' do
|
|
31
|
+
h = engine.connect(source_id: n1.id, target_id: n2.id,
|
|
32
|
+
nutrient_type: :information)
|
|
33
|
+
expect(h.source_id).to eq n1.id
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'increments connection counts' do
|
|
37
|
+
engine.connect(source_id: n1.id, target_id: n2.id,
|
|
38
|
+
nutrient_type: :information)
|
|
39
|
+
expect(n1.connections_count).to eq 1
|
|
40
|
+
expect(n2.connections_count).to eq 1
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it 'raises for unknown node' do
|
|
44
|
+
expect do
|
|
45
|
+
engine.connect(source_id: 'bad', target_id: n2.id,
|
|
46
|
+
nutrient_type: :information)
|
|
47
|
+
end.to raise_error(ArgumentError, /node not found/)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
describe '#transfer_nutrients' do
|
|
52
|
+
it 'moves nutrients from source to target' do
|
|
53
|
+
n1 = engine.create_node(node_type: :knowledge_cluster,
|
|
54
|
+
domain: :semantic, content: 'src',
|
|
55
|
+
nutrient_level: 0.8)
|
|
56
|
+
n2 = engine.create_node(node_type: :skill_node, domain: :procedural,
|
|
57
|
+
content: 'tgt', nutrient_level: 0.2)
|
|
58
|
+
h = engine.connect(source_id: n1.id, target_id: n2.id,
|
|
59
|
+
nutrient_type: :information)
|
|
60
|
+
result = engine.transfer_nutrients(hypha_id: h.id)
|
|
61
|
+
expect(result[:transferred]).to be > 0
|
|
62
|
+
expect(n1.nutrient_level).to be < 0.8
|
|
63
|
+
expect(n2.nutrient_level).to be > 0.2
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
describe '#fruit!' do
|
|
68
|
+
it 'creates fruiting body when node is ready' do
|
|
69
|
+
n = engine.create_node(node_type: :creative_node, domain: :creative,
|
|
70
|
+
content: 'ripe', nutrient_level: 0.9)
|
|
71
|
+
body = engine.fruit!(node_id: n.id, fruiting_type: :insight,
|
|
72
|
+
content: 'eureka')
|
|
73
|
+
expect(body.fruiting_type).to eq :insight
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 'raises when node is not ready' do
|
|
77
|
+
n = engine.create_node(node_type: :creative_node, domain: :creative,
|
|
78
|
+
content: 'unripe', nutrient_level: 0.3)
|
|
79
|
+
expect do
|
|
80
|
+
engine.fruit!(node_id: n.id, fruiting_type: :insight,
|
|
81
|
+
content: 'too early')
|
|
82
|
+
end.to raise_error(ArgumentError, /not ready/)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it 'depletes the source node' do
|
|
86
|
+
n = engine.create_node(node_type: :creative_node, domain: :creative,
|
|
87
|
+
content: 'ripe', nutrient_level: 0.9)
|
|
88
|
+
engine.fruit!(node_id: n.id, fruiting_type: :breakthrough,
|
|
89
|
+
content: 'big')
|
|
90
|
+
expect(n.nutrient_level).to be < 0.9
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
describe '#decay_network!' do
|
|
95
|
+
it 'reduces strengths' do
|
|
96
|
+
n1 = engine.create_node(node_type: :knowledge_cluster,
|
|
97
|
+
domain: :semantic, content: 'a')
|
|
98
|
+
n2 = engine.create_node(node_type: :skill_node, domain: :procedural,
|
|
99
|
+
content: 'b')
|
|
100
|
+
h = engine.connect(source_id: n1.id, target_id: n2.id,
|
|
101
|
+
nutrient_type: :information)
|
|
102
|
+
original = h.strength
|
|
103
|
+
engine.decay_network!
|
|
104
|
+
expect(h.strength).to be < original
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
describe '#connections_for' do
|
|
109
|
+
it 'returns hyphae connected to a node' do
|
|
110
|
+
n1 = engine.create_node(node_type: :knowledge_cluster,
|
|
111
|
+
domain: :semantic, content: 'a')
|
|
112
|
+
n2 = engine.create_node(node_type: :skill_node, domain: :procedural,
|
|
113
|
+
content: 'b')
|
|
114
|
+
engine.connect(source_id: n1.id, target_id: n2.id,
|
|
115
|
+
nutrient_type: :experience)
|
|
116
|
+
expect(engine.connections_for(n1.id).size).to eq 1
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
describe '#network_report' do
|
|
121
|
+
it 'returns comprehensive report' do
|
|
122
|
+
engine.create_node(node_type: :knowledge_cluster, domain: :semantic,
|
|
123
|
+
content: 'x')
|
|
124
|
+
report = engine.network_report
|
|
125
|
+
%i[total_nodes total_hyphae total_fruiting active_hyphae
|
|
126
|
+
avg_nutrient avg_strength fruiting_ready starving_nodes
|
|
127
|
+
network_health].each do |key|
|
|
128
|
+
expect(report).to have_key(key)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
it 'works empty' do
|
|
133
|
+
expect(engine.network_report[:total_nodes]).to eq 0
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Integration::Mycelium::Runners::CognitiveMycelium do
|
|
4
|
+
let(:engine) { Legion::Extensions::Agentic::Integration::Mycelium::Helpers::MyceliumEngine.new }
|
|
5
|
+
let(:runner) { described_class }
|
|
6
|
+
|
|
7
|
+
describe '.create_node' do
|
|
8
|
+
it 'succeeds' do
|
|
9
|
+
result = runner.create_node(node_type: :knowledge_cluster,
|
|
10
|
+
domain: :semantic, content: 'test',
|
|
11
|
+
engine: engine)
|
|
12
|
+
expect(result[:success]).to be true
|
|
13
|
+
expect(result[:node][:node_type]).to eq :knowledge_cluster
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'returns failure for invalid type' do
|
|
17
|
+
result = runner.create_node(node_type: :bogus, domain: :x,
|
|
18
|
+
content: 'x', engine: engine)
|
|
19
|
+
expect(result[:success]).to be false
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe '.connect' do
|
|
24
|
+
it 'creates connection' do
|
|
25
|
+
n1 = engine.create_node(node_type: :knowledge_cluster,
|
|
26
|
+
domain: :semantic, content: 'a')
|
|
27
|
+
n2 = engine.create_node(node_type: :skill_node, domain: :procedural,
|
|
28
|
+
content: 'b')
|
|
29
|
+
result = runner.connect(source_id: n1.id, target_id: n2.id,
|
|
30
|
+
nutrient_type: :information, engine: engine)
|
|
31
|
+
expect(result[:success]).to be true
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe '.fruit' do
|
|
36
|
+
it 'creates fruiting body' do
|
|
37
|
+
n = engine.create_node(node_type: :creative_node, domain: :creative,
|
|
38
|
+
content: 'ripe', nutrient_level: 0.9)
|
|
39
|
+
result = runner.fruit(node_id: n.id, fruiting_type: :insight,
|
|
40
|
+
content: 'eureka', engine: engine)
|
|
41
|
+
expect(result[:success]).to be true
|
|
42
|
+
expect(result[:fruiting_body][:fruiting_type]).to eq :insight
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'returns failure when not ready' do
|
|
46
|
+
n = engine.create_node(node_type: :creative_node, domain: :creative,
|
|
47
|
+
content: 'x', nutrient_level: 0.2)
|
|
48
|
+
result = runner.fruit(node_id: n.id, fruiting_type: :insight,
|
|
49
|
+
content: 'x', engine: engine)
|
|
50
|
+
expect(result[:success]).to be false
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
describe '.network_status' do
|
|
55
|
+
it 'returns report' do
|
|
56
|
+
result = runner.network_status(engine: engine)
|
|
57
|
+
expect(result[:success]).to be true
|
|
58
|
+
expect(result[:report]).to be_a Hash
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/agentic/integration/phenomenal_binding/client'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Legion::Extensions::Agentic::Integration::PhenomenalBinding::Client do
|
|
6
|
+
let(:client) { described_class.new }
|
|
7
|
+
|
|
8
|
+
it 'responds to runner methods' do
|
|
9
|
+
expect(client).to respond_to(:register_stream)
|
|
10
|
+
expect(client).to respond_to(:create_binding)
|
|
11
|
+
expect(client).to respond_to(:reinforce_binding)
|
|
12
|
+
expect(client).to respond_to(:dissolve_binding)
|
|
13
|
+
expect(client).to respond_to(:unified_experience)
|
|
14
|
+
expect(client).to respond_to(:fragmentation_index)
|
|
15
|
+
expect(client).to respond_to(:binding_by_type)
|
|
16
|
+
expect(client).to respond_to(:streams_for_binding)
|
|
17
|
+
expect(client).to respond_to(:unbound_streams)
|
|
18
|
+
expect(client).to respond_to(:decay_all)
|
|
19
|
+
expect(client).to respond_to(:prune_incoherent)
|
|
20
|
+
expect(client).to respond_to(:consciousness_report)
|
|
21
|
+
expect(client).to respond_to(:engine_stats)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'maintains independent engine state per instance' do
|
|
25
|
+
c1 = described_class.new
|
|
26
|
+
c2 = described_class.new
|
|
27
|
+
c1.register_stream(stream_type: :perception, content: 'only in c1')
|
|
28
|
+
expect(c1.engine_stats[:stream_count]).to eq(1)
|
|
29
|
+
expect(c2.engine_stats[:stream_count]).to eq(0)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'runs a full bind/reinforce/dissolve cycle' do
|
|
33
|
+
s = client.register_stream(stream_type: :thought, content: 'philosophy', salience: 0.75)
|
|
34
|
+
b = client.create_binding(stream_ids: [s[:stream][:id]], binding_type: :conceptual)
|
|
35
|
+
client.reinforce_binding(binding_id: b[:binding][:id])
|
|
36
|
+
expect(client.unified_experience[:unified_experience]).to be_a(Hash)
|
|
37
|
+
client.dissolve_binding(binding_id: b[:binding][:id])
|
|
38
|
+
expect(client.unified_experience[:unified_experience]).to be_nil
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'builds a consciousness report across multiple streams and bindings' do
|
|
42
|
+
s1 = client.register_stream(stream_type: :perception, content: 'light', salience: 0.8)
|
|
43
|
+
s2 = client.register_stream(stream_type: :emotion, content: 'warmth', salience: 0.7)
|
|
44
|
+
s3 = client.register_stream(stream_type: :memory, content: 'familiar', salience: 0.9)
|
|
45
|
+
client.create_binding(stream_ids: [s1[:stream][:id], s2[:stream][:id]], binding_type: :emotional)
|
|
46
|
+
report = client.consciousness_report
|
|
47
|
+
expect(report[:stream_count]).to eq(3)
|
|
48
|
+
expect(report[:binding_count]).to eq(1)
|
|
49
|
+
expect(report[:unbound_count]).to eq(1) # s3 is unbound
|
|
50
|
+
_ = s3
|
|
51
|
+
end
|
|
52
|
+
end
|