Module: Legion::Extensions::Agentic::Integration::Boundary::Runners::CognitiveBoundary
- Includes:
- Helpers::Constants, Helpers::Lex
- Included in:
- Client
- Defined in:
- lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb
Constant Summary
Helpers::Constants::BOUNDARY_TYPES, Helpers::Constants::BREACH_THRESHOLD, Helpers::Constants::DEFAULT_PERMEABILITY, Helpers::Constants::INTEGRITY_LABELS, Helpers::Constants::MAX_BOUNDARIES, Helpers::Constants::MAX_VIOLATIONS, Helpers::Constants::PERMEABILITY_BOOST, Helpers::Constants::PERMEABILITY_DECAY, Helpers::Constants::PERMEABILITY_LABELS
Instance Method Summary
collapse
-
#boundaries_by_type(boundary_type:, engine: nil) ⇒ Object
-
#boundary_report(engine: nil) ⇒ Object
-
#breached_boundaries(engine: nil) ⇒ Object
-
#close_boundary(boundary_id:, engine: nil, amount: PERMEABILITY_BOOST) ⇒ Object
-
#create_boundary(name:, engine: nil, boundary_type: :cognitive, permeability: DEFAULT_PERMEABILITY) ⇒ Object
-
#open_boundary(boundary_id:, engine: nil, amount: PERMEABILITY_BOOST) ⇒ Object
-
#overall_integrity(engine: nil) ⇒ Object
-
#overall_permeability(engine: nil) ⇒ Object
-
#repair_boundary(boundary_id:, engine: nil) ⇒ Object
-
#seal_boundary(boundary_id:, engine: nil) ⇒ Object
-
#violate_boundary(boundary_id:, engine: nil) ⇒ Object
Instance Method Details
#boundaries_by_type(boundary_type:, engine: nil) ⇒ Object
68
69
70
71
72
|
# File 'lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb', line 68
def boundaries_by_type(boundary_type:, engine: nil, **)
eng = engine || default_engine
boundaries = eng.boundaries_by_type(boundary_type: boundary_type).map(&:to_h)
{ success: true, boundaries: boundaries, count: boundaries.size }
end
|
#boundary_report(engine: nil) ⇒ Object
84
85
86
87
|
# File 'lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb', line 84
def boundary_report(engine: nil, **)
eng = engine || default_engine
{ success: true, report: eng.boundary_report }
end
|
#breached_boundaries(engine: nil) ⇒ Object
62
63
64
65
66
|
# File 'lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb', line 62
def breached_boundaries(engine: nil, **)
eng = engine || default_engine
breached = eng.breached_boundaries.map(&:to_h)
{ success: true, breached: breached, count: breached.size }
end
|
#close_boundary(boundary_id:, engine: nil, amount: PERMEABILITY_BOOST) ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb', line 30
def close_boundary(boundary_id:, engine: nil, amount: PERMEABILITY_BOOST, **)
eng = engine || default_engine
result = eng.close_boundary(boundary_id: boundary_id, amount: amount)
return { success: false, error: 'boundary not found' } unless result
{ success: true, boundary: result.to_h }
end
|
#create_boundary(name:, engine: nil, boundary_type: :cognitive, permeability: DEFAULT_PERMEABILITY) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb', line 14
def create_boundary(name:, engine: nil, boundary_type: :cognitive,
permeability: DEFAULT_PERMEABILITY, **)
eng = engine || default_engine
boundary = eng.create_boundary(name: name, boundary_type: boundary_type,
permeability: permeability)
{ success: true, boundary: boundary.to_h }
end
|
#open_boundary(boundary_id:, engine: nil, amount: PERMEABILITY_BOOST) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb', line 22
def open_boundary(boundary_id:, engine: nil, amount: PERMEABILITY_BOOST, **)
eng = engine || default_engine
result = eng.open_boundary(boundary_id: boundary_id, amount: amount)
return { success: false, error: 'boundary not found' } unless result
{ success: true, boundary: result.to_h }
end
|
#overall_integrity(engine: nil) ⇒ Object
74
75
76
77
|
# File 'lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb', line 74
def overall_integrity(engine: nil, **)
eng = engine || default_engine
{ success: true, integrity: eng.overall_integrity }
end
|
#overall_permeability(engine: nil) ⇒ Object
79
80
81
82
|
# File 'lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb', line 79
def overall_permeability(engine: nil, **)
eng = engine || default_engine
{ success: true, permeability: eng.overall_permeability }
end
|
#repair_boundary(boundary_id:, engine: nil) ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb', line 46
def repair_boundary(boundary_id:, engine: nil, **)
eng = engine || default_engine
result = eng.repair_boundary(boundary_id: boundary_id)
return { success: false, error: 'boundary not found' } unless result
{ success: true, boundary: result.to_h }
end
|
#seal_boundary(boundary_id:, engine: nil) ⇒ Object
54
55
56
57
58
59
60
|
# File 'lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb', line 54
def seal_boundary(boundary_id:, engine: nil, **)
eng = engine || default_engine
result = eng.seal_boundary(boundary_id: boundary_id)
return { success: false, error: 'boundary not found' } unless result
{ success: true, boundary: result.to_h }
end
|
#violate_boundary(boundary_id:, engine: nil) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/legion/extensions/agentic/integration/boundary/runners/cognitive_boundary.rb', line 38
def violate_boundary(boundary_id:, engine: nil, **)
eng = engine || default_engine
result = eng.violate_boundary(boundary_id: boundary_id)
return { success: false, error: 'boundary not found' } unless result
{ success: true, boundary: result.to_h }
end
|