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,138 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Integration
|
|
7
|
+
module Labyrinth
|
|
8
|
+
module Helpers
|
|
9
|
+
class Labyrinth
|
|
10
|
+
attr_reader :labyrinth_id, :name, :domain, :nodes, :breadcrumbs, :current_node_id
|
|
11
|
+
attr_accessor :solved
|
|
12
|
+
|
|
13
|
+
def initialize(labyrinth_id:, name:, domain: nil)
|
|
14
|
+
@labyrinth_id = labyrinth_id
|
|
15
|
+
@name = name
|
|
16
|
+
@domain = domain
|
|
17
|
+
@nodes = {}
|
|
18
|
+
@breadcrumbs = []
|
|
19
|
+
@current_node_id = nil
|
|
20
|
+
@solved = false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def add_node(node)
|
|
24
|
+
raise ArgumentError, "nodes must be a #{Node}" unless node.is_a?(Node)
|
|
25
|
+
raise ArgumentError, "max nodes (#{Constants::MAX_NODES}) reached" if @nodes.size >= Constants::MAX_NODES
|
|
26
|
+
|
|
27
|
+
@nodes[node.node_id] = node
|
|
28
|
+
@current_node_id ||= node.node_id if node.node_type == :entrance
|
|
29
|
+
node
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def move_to!(node_id)
|
|
33
|
+
node = @nodes.fetch(node_id) { raise ArgumentError, "node #{node_id.inspect} not found in labyrinth" }
|
|
34
|
+
|
|
35
|
+
current = current_node
|
|
36
|
+
unless current.nil? || current.connections.include?(node_id)
|
|
37
|
+
raise ArgumentError, "cannot move to #{node_id.inspect}: not connected from current node #{@current_node_id.inspect}"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
drop_breadcrumb
|
|
41
|
+
node.visited = true
|
|
42
|
+
@current_node_id = node_id
|
|
43
|
+
@solved = true if node.node_type == :exit
|
|
44
|
+
node
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def backtrack!
|
|
48
|
+
return nil if @breadcrumbs.empty?
|
|
49
|
+
|
|
50
|
+
target_id = @breadcrumbs.pop
|
|
51
|
+
@current_node_id = target_id
|
|
52
|
+
current_node
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def drop_breadcrumb
|
|
56
|
+
return unless @current_node_id
|
|
57
|
+
|
|
58
|
+
current = @nodes[@current_node_id]
|
|
59
|
+
current.visited = true if current
|
|
60
|
+
@breadcrumbs << @current_node_id if @breadcrumbs.last != @current_node_id
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def follow_thread
|
|
64
|
+
return nil if current_node.nil?
|
|
65
|
+
|
|
66
|
+
unvisited = current_node.connections.find do |conn_id|
|
|
67
|
+
node = @nodes[conn_id]
|
|
68
|
+
node && !node.visited
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
return nil unless unvisited
|
|
72
|
+
|
|
73
|
+
move_to!(unvisited)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def solved?
|
|
77
|
+
@solved
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def lost?
|
|
81
|
+
return false if @current_node_id.nil?
|
|
82
|
+
return false if solved?
|
|
83
|
+
|
|
84
|
+
current = current_node
|
|
85
|
+
return true if current.nil?
|
|
86
|
+
|
|
87
|
+
unvisited_exits = current.connections.any? do |conn_id|
|
|
88
|
+
node = @nodes[conn_id]
|
|
89
|
+
node && !node.visited
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
!unvisited_exits && !current.dead_end? && @breadcrumbs.empty?
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def path_length
|
|
96
|
+
@breadcrumbs.size
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def current_node
|
|
100
|
+
@nodes[@current_node_id]
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def complexity
|
|
104
|
+
return 0.0 if @nodes.empty?
|
|
105
|
+
|
|
106
|
+
dead_end_count = @nodes.values.count(&:dead_end?)
|
|
107
|
+
junction_count = @nodes.values.count(&:junction?)
|
|
108
|
+
minotaur_count = @nodes.values.count { |n| n.node_type == :minotaur_lair }
|
|
109
|
+
|
|
110
|
+
raw = ((dead_end_count * 0.3) + (junction_count * 0.2) + (minotaur_count * 0.5)) / @nodes.size.to_f
|
|
111
|
+
raw.clamp(0.0, 1.0).round(10)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def complexity_label
|
|
115
|
+
score = complexity
|
|
116
|
+
Constants::COMPLEXITY_LABELS.find { |range, _| range.cover?(score) }&.last || :labyrinthine
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def to_h
|
|
120
|
+
{
|
|
121
|
+
labyrinth_id: @labyrinth_id,
|
|
122
|
+
name: @name,
|
|
123
|
+
domain: @domain,
|
|
124
|
+
node_count: @nodes.size,
|
|
125
|
+
current_node_id: @current_node_id,
|
|
126
|
+
path_length: path_length,
|
|
127
|
+
solved: @solved,
|
|
128
|
+
complexity: complexity,
|
|
129
|
+
complexity_label: complexity_label
|
|
130
|
+
}
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Integration
|
|
7
|
+
module Labyrinth
|
|
8
|
+
module Helpers
|
|
9
|
+
class LabyrinthEngine
|
|
10
|
+
attr_reader :labyrinths
|
|
11
|
+
|
|
12
|
+
def initialize
|
|
13
|
+
@labyrinths = {}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create_labyrinth(name:, domain: nil, labyrinth_id: nil)
|
|
17
|
+
raise ArgumentError, "max labyrinths (#{Constants::MAX_LABYRINTHS}) reached" if @labyrinths.size >= Constants::MAX_LABYRINTHS
|
|
18
|
+
|
|
19
|
+
id = labyrinth_id || SecureRandom.uuid
|
|
20
|
+
labyrinth = Labyrinth.new(labyrinth_id: id, name: name, domain: domain)
|
|
21
|
+
@labyrinths[id] = labyrinth
|
|
22
|
+
Legion::Logging.debug "[cognitive_labyrinth] created labyrinth id=#{id[0..7]} name=#{name}"
|
|
23
|
+
labyrinth
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def add_node_to(labyrinth_id:, node_type:, content: nil, danger_level: nil, node_id: nil)
|
|
27
|
+
labyrinth = fetch_labyrinth!(labyrinth_id)
|
|
28
|
+
id = node_id || SecureRandom.uuid
|
|
29
|
+
level = (danger_level || default_danger_for(node_type)).clamp(0.0, 1.0)
|
|
30
|
+
|
|
31
|
+
node = Node.new(node_id: id, node_type: node_type, content: content, danger_level: level)
|
|
32
|
+
labyrinth.add_node(node)
|
|
33
|
+
Legion::Logging.debug "[cognitive_labyrinth] added node #{id[0..7]} type=#{node_type} to labyrinth #{labyrinth_id[0..7]}"
|
|
34
|
+
node
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def connect_nodes(labyrinth_id:, from_id:, to_id:, bidirectional: true)
|
|
38
|
+
labyrinth = fetch_labyrinth!(labyrinth_id)
|
|
39
|
+
from_node = fetch_node!(labyrinth, from_id)
|
|
40
|
+
to_node = fetch_node!(labyrinth, to_id)
|
|
41
|
+
|
|
42
|
+
from_node.connect!(to_id)
|
|
43
|
+
to_node.connect!(from_id) if bidirectional
|
|
44
|
+
{ connected: true, from: from_id, to: to_id, bidirectional: bidirectional }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def move(labyrinth_id:, node_id:, **)
|
|
48
|
+
labyrinth = fetch_labyrinth!(labyrinth_id)
|
|
49
|
+
node = labyrinth.move_to!(node_id)
|
|
50
|
+
|
|
51
|
+
minotaur_result = check_minotaur(labyrinth_id: labyrinth_id)
|
|
52
|
+
Legion::Logging.debug "[cognitive_labyrinth] moved to #{node_id[0..7]} type=#{node.node_type}"
|
|
53
|
+
|
|
54
|
+
{
|
|
55
|
+
success: true,
|
|
56
|
+
node_id: node.node_id,
|
|
57
|
+
node_type: node.node_type,
|
|
58
|
+
content: node.content,
|
|
59
|
+
danger_level: node.danger_level,
|
|
60
|
+
solved: labyrinth.solved?,
|
|
61
|
+
minotaur: minotaur_result,
|
|
62
|
+
path_length: labyrinth.path_length
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def backtrack(labyrinth_id:, **)
|
|
67
|
+
labyrinth = fetch_labyrinth!(labyrinth_id)
|
|
68
|
+
node = labyrinth.backtrack!
|
|
69
|
+
|
|
70
|
+
if node
|
|
71
|
+
Legion::Logging.debug "[cognitive_labyrinth] backtracked to #{node.node_id[0..7]}"
|
|
72
|
+
{ success: true, node_id: node.node_id, node_type: node.node_type, path_length: labyrinth.path_length }
|
|
73
|
+
else
|
|
74
|
+
Legion::Logging.debug '[cognitive_labyrinth] backtrack failed: no breadcrumbs'
|
|
75
|
+
{ success: false, reason: :no_breadcrumbs }
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def follow_thread(labyrinth_id:, **)
|
|
80
|
+
labyrinth = fetch_labyrinth!(labyrinth_id)
|
|
81
|
+
node = labyrinth.follow_thread
|
|
82
|
+
|
|
83
|
+
if node
|
|
84
|
+
minotaur_result = check_minotaur(labyrinth_id: labyrinth_id)
|
|
85
|
+
Legion::Logging.debug "[cognitive_labyrinth] thread followed to #{node.node_id[0..7]}"
|
|
86
|
+
{
|
|
87
|
+
success: true,
|
|
88
|
+
node_id: node.node_id,
|
|
89
|
+
node_type: node.node_type,
|
|
90
|
+
content: node.content,
|
|
91
|
+
danger_level: node.danger_level,
|
|
92
|
+
solved: labyrinth.solved?,
|
|
93
|
+
minotaur: minotaur_result
|
|
94
|
+
}
|
|
95
|
+
else
|
|
96
|
+
Legion::Logging.debug '[cognitive_labyrinth] thread exhausted: no unvisited nodes from current'
|
|
97
|
+
{ success: false, reason: :thread_exhausted }
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def check_minotaur(labyrinth_id:, **)
|
|
102
|
+
labyrinth = fetch_labyrinth!(labyrinth_id)
|
|
103
|
+
node = labyrinth.current_node
|
|
104
|
+
return { encountered: false } unless node
|
|
105
|
+
|
|
106
|
+
if node.node_type == :minotaur_lair
|
|
107
|
+
Legion::Logging.debug "[cognitive_labyrinth] MINOTAUR ENCOUNTERED at #{node.node_id[0..7]}"
|
|
108
|
+
{
|
|
109
|
+
encountered: true,
|
|
110
|
+
node_id: node.node_id,
|
|
111
|
+
danger_level: node.danger_level,
|
|
112
|
+
danger_label: danger_label_for(node.danger_level),
|
|
113
|
+
misconception: node.content
|
|
114
|
+
}
|
|
115
|
+
elsif node.dangerous?
|
|
116
|
+
{
|
|
117
|
+
encountered: false,
|
|
118
|
+
warning: true,
|
|
119
|
+
danger_level: node.danger_level,
|
|
120
|
+
danger_label: danger_label_for(node.danger_level)
|
|
121
|
+
}
|
|
122
|
+
else
|
|
123
|
+
{ encountered: false }
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def labyrinth_report(labyrinth_id:, **)
|
|
128
|
+
labyrinth = fetch_labyrinth!(labyrinth_id)
|
|
129
|
+
nodes_by_type = labyrinth.nodes.values.group_by(&:node_type).transform_values(&:count)
|
|
130
|
+
|
|
131
|
+
labyrinth.to_h.merge(
|
|
132
|
+
nodes_by_type: nodes_by_type,
|
|
133
|
+
visited_count: labyrinth.nodes.values.count(&:visited),
|
|
134
|
+
breadcrumb_trail: labyrinth.breadcrumbs.dup,
|
|
135
|
+
lost: labyrinth.lost?
|
|
136
|
+
)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def list_labyrinths(**)
|
|
140
|
+
@labyrinths.values.map(&:to_h)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def delete_labyrinth(labyrinth_id:, **)
|
|
144
|
+
raise ArgumentError, "labyrinth #{labyrinth_id.inspect} not found" unless @labyrinths.key?(labyrinth_id)
|
|
145
|
+
|
|
146
|
+
@labyrinths.delete(labyrinth_id)
|
|
147
|
+
{ deleted: true, labyrinth_id: labyrinth_id }
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
private
|
|
151
|
+
|
|
152
|
+
def fetch_labyrinth!(labyrinth_id)
|
|
153
|
+
@labyrinths.fetch(labyrinth_id) do
|
|
154
|
+
raise ArgumentError, "labyrinth #{labyrinth_id.inspect} not found"
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def fetch_node!(labyrinth, node_id)
|
|
159
|
+
labyrinth.nodes.fetch(node_id) do
|
|
160
|
+
raise ArgumentError, "node #{node_id.inspect} not found in labyrinth #{labyrinth.labyrinth_id.inspect}"
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def default_danger_for(node_type)
|
|
165
|
+
node_type == :minotaur_lair ? Constants::MINOTAUR_DANGER_LEVEL : Constants::DEFAULT_DANGER_LEVEL
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def danger_label_for(level)
|
|
169
|
+
Constants::DANGER_LABELS.find { |range, _| range.cover?(level) }&.last || :lethal
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Integration
|
|
7
|
+
module Labyrinth
|
|
8
|
+
module Helpers
|
|
9
|
+
class Node
|
|
10
|
+
attr_reader :node_id, :node_type, :content, :connections, :danger_level
|
|
11
|
+
attr_accessor :visited
|
|
12
|
+
|
|
13
|
+
def initialize(node_id:, node_type:, content: nil, danger_level: Constants::DEFAULT_DANGER_LEVEL)
|
|
14
|
+
unless Constants::NODE_TYPES.include?(node_type)
|
|
15
|
+
raise ArgumentError, "unknown node_type: #{node_type.inspect}; must be one of #{Constants::NODE_TYPES.inspect}"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
@node_id = node_id
|
|
19
|
+
@node_type = node_type
|
|
20
|
+
@content = content
|
|
21
|
+
@connections = []
|
|
22
|
+
@visited = false
|
|
23
|
+
@danger_level = danger_level.clamp(0.0, 1.0)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def connect!(other_id)
|
|
27
|
+
@connections << other_id unless @connections.include?(other_id)
|
|
28
|
+
self
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def disconnect!(other_id)
|
|
32
|
+
@connections.delete(other_id)
|
|
33
|
+
self
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def dead_end?
|
|
37
|
+
@node_type == :dead_end || (@connections.empty? && @node_type != :entrance && @node_type != :exit)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def junction?
|
|
41
|
+
@node_type == :junction || @connections.size >= 3
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def dangerous?
|
|
45
|
+
@node_type == :minotaur_lair || @danger_level >= 0.5
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def to_h
|
|
49
|
+
{
|
|
50
|
+
node_id: @node_id,
|
|
51
|
+
node_type: @node_type,
|
|
52
|
+
content: @content,
|
|
53
|
+
connections: @connections.dup,
|
|
54
|
+
visited: @visited,
|
|
55
|
+
danger_level: @danger_level
|
|
56
|
+
}
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Integration
|
|
7
|
+
module Labyrinth
|
|
8
|
+
module Runners
|
|
9
|
+
module CognitiveLabyrinth
|
|
10
|
+
extend self
|
|
11
|
+
|
|
12
|
+
include Legion::Extensions::Helpers::Lex if defined?(Legion::Extensions::Helpers::Lex)
|
|
13
|
+
|
|
14
|
+
def create_labyrinth(name:, domain: nil, labyrinth_id: nil, engine: nil, **)
|
|
15
|
+
raise ArgumentError, 'name is required' if name.nil? || name.to_s.strip.empty?
|
|
16
|
+
|
|
17
|
+
result = resolve_engine(engine).create_labyrinth(name: name, domain: domain, labyrinth_id: labyrinth_id)
|
|
18
|
+
Legion::Logging.debug "[cognitive_labyrinth] runner: created labyrinth #{result.labyrinth_id[0..7]}"
|
|
19
|
+
{ success: true, labyrinth_id: result.labyrinth_id, name: result.name, domain: result.domain }
|
|
20
|
+
rescue ArgumentError => e
|
|
21
|
+
Legion::Logging.debug "[cognitive_labyrinth] create_labyrinth error: #{e.message}"
|
|
22
|
+
{ success: false, error: e.message }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def add_node(labyrinth_id:, node_type:, content: nil, danger_level: nil, node_id: nil, engine: nil, **)
|
|
26
|
+
raise ArgumentError, 'labyrinth_id is required' if labyrinth_id.nil?
|
|
27
|
+
raise ArgumentError, 'node_type is required' if node_type.nil?
|
|
28
|
+
|
|
29
|
+
node = resolve_engine(engine).add_node_to(
|
|
30
|
+
labyrinth_id: labyrinth_id, node_type: node_type,
|
|
31
|
+
content: content, danger_level: danger_level, node_id: node_id
|
|
32
|
+
)
|
|
33
|
+
{ success: true, node_id: node.node_id, node_type: node.node_type }
|
|
34
|
+
rescue ArgumentError => e
|
|
35
|
+
Legion::Logging.debug "[cognitive_labyrinth] add_node error: #{e.message}"
|
|
36
|
+
{ success: false, error: e.message }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def connect_nodes(labyrinth_id:, from_id:, to_id:, bidirectional: true, engine: nil, **)
|
|
40
|
+
raise ArgumentError, 'labyrinth_id is required' if labyrinth_id.nil?
|
|
41
|
+
|
|
42
|
+
resolve_engine(engine).connect_nodes(
|
|
43
|
+
labyrinth_id: labyrinth_id, from_id: from_id, to_id: to_id, bidirectional: bidirectional
|
|
44
|
+
)
|
|
45
|
+
rescue ArgumentError => e
|
|
46
|
+
Legion::Logging.debug "[cognitive_labyrinth] connect_nodes error: #{e.message}"
|
|
47
|
+
{ success: false, error: e.message }
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def move(labyrinth_id:, node_id:, engine: nil, **)
|
|
51
|
+
raise ArgumentError, 'labyrinth_id is required' if labyrinth_id.nil?
|
|
52
|
+
raise ArgumentError, 'node_id is required' if node_id.nil?
|
|
53
|
+
|
|
54
|
+
resolve_engine(engine).move(labyrinth_id: labyrinth_id, node_id: node_id)
|
|
55
|
+
rescue ArgumentError => e
|
|
56
|
+
Legion::Logging.debug "[cognitive_labyrinth] move error: #{e.message}"
|
|
57
|
+
{ success: false, error: e.message }
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def backtrack(labyrinth_id:, engine: nil, **)
|
|
61
|
+
raise ArgumentError, 'labyrinth_id is required' if labyrinth_id.nil?
|
|
62
|
+
|
|
63
|
+
resolve_engine(engine).backtrack(labyrinth_id: labyrinth_id)
|
|
64
|
+
rescue ArgumentError => e
|
|
65
|
+
Legion::Logging.debug "[cognitive_labyrinth] backtrack error: #{e.message}"
|
|
66
|
+
{ success: false, error: e.message }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def follow_thread(labyrinth_id:, engine: nil, **)
|
|
70
|
+
raise ArgumentError, 'labyrinth_id is required' if labyrinth_id.nil?
|
|
71
|
+
|
|
72
|
+
resolve_engine(engine).follow_thread(labyrinth_id: labyrinth_id)
|
|
73
|
+
rescue ArgumentError => e
|
|
74
|
+
Legion::Logging.debug "[cognitive_labyrinth] follow_thread error: #{e.message}"
|
|
75
|
+
{ success: false, error: e.message }
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def check_minotaur(labyrinth_id:, engine: nil, **)
|
|
79
|
+
raise ArgumentError, 'labyrinth_id is required' if labyrinth_id.nil?
|
|
80
|
+
|
|
81
|
+
resolve_engine(engine).check_minotaur(labyrinth_id: labyrinth_id)
|
|
82
|
+
rescue ArgumentError => e
|
|
83
|
+
Legion::Logging.debug "[cognitive_labyrinth] check_minotaur error: #{e.message}"
|
|
84
|
+
{ success: false, error: e.message }
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def labyrinth_report(labyrinth_id:, engine: nil, **)
|
|
88
|
+
raise ArgumentError, 'labyrinth_id is required' if labyrinth_id.nil?
|
|
89
|
+
|
|
90
|
+
result = resolve_engine(engine).labyrinth_report(labyrinth_id: labyrinth_id)
|
|
91
|
+
{ success: true }.merge(result)
|
|
92
|
+
rescue ArgumentError => e
|
|
93
|
+
Legion::Logging.debug "[cognitive_labyrinth] labyrinth_report error: #{e.message}"
|
|
94
|
+
{ success: false, error: e.message }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def list_labyrinths(engine: nil, **)
|
|
98
|
+
result = resolve_engine(engine).list_labyrinths
|
|
99
|
+
{ success: true, labyrinths: result, count: result.size }
|
|
100
|
+
rescue ArgumentError => e
|
|
101
|
+
{ success: false, error: e.message }
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def delete_labyrinth(labyrinth_id:, engine: nil, **)
|
|
105
|
+
raise ArgumentError, 'labyrinth_id is required' if labyrinth_id.nil?
|
|
106
|
+
|
|
107
|
+
resolve_engine(engine).delete_labyrinth(labyrinth_id: labyrinth_id)
|
|
108
|
+
rescue ArgumentError => e
|
|
109
|
+
Legion::Logging.debug "[cognitive_labyrinth] delete_labyrinth error: #{e.message}"
|
|
110
|
+
{ success: false, error: e.message }
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
private
|
|
114
|
+
|
|
115
|
+
def labyrinth_engine
|
|
116
|
+
@labyrinth_engine ||= Helpers::LabyrinthEngine.new
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def resolve_engine(engine)
|
|
120
|
+
engine || labyrinth_engine
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'securerandom'
|
|
4
|
+
|
|
5
|
+
require_relative 'labyrinth/version'
|
|
6
|
+
require_relative 'labyrinth/helpers/constants'
|
|
7
|
+
require_relative 'labyrinth/helpers/node'
|
|
8
|
+
require_relative 'labyrinth/helpers/labyrinth'
|
|
9
|
+
require_relative 'labyrinth/helpers/labyrinth_engine'
|
|
10
|
+
require_relative 'labyrinth/runners/cognitive_labyrinth'
|
|
11
|
+
require_relative 'labyrinth/client'
|
|
12
|
+
|
|
13
|
+
module Legion
|
|
14
|
+
module Extensions
|
|
15
|
+
module Agentic
|
|
16
|
+
module Integration
|
|
17
|
+
module Labyrinth
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/actors/every'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Agentic
|
|
8
|
+
module Integration
|
|
9
|
+
module Map
|
|
10
|
+
module Actor
|
|
11
|
+
class Decay < Legion::Extensions::Actors::Every
|
|
12
|
+
def runner_class
|
|
13
|
+
Legion::Extensions::Agentic::Integration::Map::Runners::CognitiveMap
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def runner_function
|
|
17
|
+
'update_cognitive_map'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def time
|
|
21
|
+
60
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def run_now?
|
|
25
|
+
false
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def use_runner?
|
|
29
|
+
false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def check_subtask?
|
|
33
|
+
false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def generate_task?
|
|
37
|
+
false
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/agentic/integration/map/helpers/constants'
|
|
4
|
+
require 'legion/extensions/agentic/integration/map/helpers/location'
|
|
5
|
+
require 'legion/extensions/agentic/integration/map/helpers/graph_traversal'
|
|
6
|
+
require 'legion/extensions/agentic/integration/map/helpers/cognitive_map_store'
|
|
7
|
+
require 'legion/extensions/agentic/integration/map/runners/cognitive_map'
|
|
8
|
+
|
|
9
|
+
module Legion
|
|
10
|
+
module Extensions
|
|
11
|
+
module Agentic
|
|
12
|
+
module Integration
|
|
13
|
+
module Map
|
|
14
|
+
class Client
|
|
15
|
+
include Runners::CognitiveMap
|
|
16
|
+
|
|
17
|
+
def initialize(map_store: nil, **)
|
|
18
|
+
@map_store = map_store || Helpers::CognitiveMapStore.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
attr_reader :map_store
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|