Module: Legion::Extensions::Agentic::Integration::PhenomenalBinding::Runners::PhenomenalBinding

Includes:
Helpers::Lex
Included in:
Client
Defined in:
lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb

Instance Method Summary collapse

Instance Method Details

#binding_by_type(binding_type:) ⇒ Object



63
64
65
66
67
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 63

def binding_by_type(binding_type:, **)
  bindings = engine.binding_by_type(binding_type: binding_type)
  log.debug("[phenomenal_binding] binding_by_type: type=#{binding_type} count=#{bindings.size}")
  { binding_type: binding_type, bindings: bindings.map(&:to_h) }
end

#consciousness_reportObject



93
94
95
96
97
98
99
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 93

def consciousness_report(**)
  report = engine.consciousness_report
  log.debug('[phenomenal_binding] consciousness_report: ' \
            "fragmentation=#{report[:fragmentation_index].round(3)} " \
            "bindings=#{report[:binding_count]}")
  report
end

#create_binding(stream_ids:, binding_type:, attention_weight: 0.5) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 26

def create_binding(stream_ids:, binding_type:, attention_weight: 0.5, **)
  result = engine.create_binding(
    stream_ids:       stream_ids,
    binding_type:     binding_type,
    attention_weight: attention_weight
  )
  log.debug("[phenomenal_binding] create_binding: type=#{binding_type} " \
            "streams=#{result.stream_count} coherence=#{result.coherence.round(2)}")
  { status: :bound, binding: result.to_h }
end

#decay_allObject



81
82
83
84
85
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 81

def decay_all(**)
  engine.decay_all
  log.debug('[phenomenal_binding] decay_all: all bindings decayed')
  { status: :decayed }
end

#dissolve_binding(binding_id:) ⇒ Object



44
45
46
47
48
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 44

def dissolve_binding(binding_id:, **)
  result = engine.dissolve_binding(binding_id: binding_id)
  log.debug("[phenomenal_binding] dissolve_binding: id=#{binding_id} status=#{result[:status]}")
  result
end

#engine_statsObject



101
102
103
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 101

def engine_stats(**)
  engine.to_h
end

#fragmentation_indexObject



57
58
59
60
61
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 57

def fragmentation_index(**)
  index = engine.fragmentation_index
  log.debug("[phenomenal_binding] fragmentation_index=#{index.round(3)}")
  { fragmentation_index: index }
end

#prune_incoherentObject



87
88
89
90
91
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 87

def prune_incoherent(**)
  engine.prune_incoherent
  log.debug('[phenomenal_binding] prune_incoherent: incoherent bindings removed')
  { status: :pruned }
end

#register_stream(stream_type:, content:, salience: Helpers::Constants::DEFAULT_SALIENCE, domain: nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 13

def register_stream(stream_type:, content:, salience: Helpers::Constants::DEFAULT_SALIENCE,
                    domain: nil, **)
  stream = engine.register_stream(
    stream_type: stream_type,
    content:     content,
    salience:    salience,
    domain:      domain
  )
  log.debug("[phenomenal_binding] register_stream: type=#{stream_type} " \
            "salience=#{stream.salience.round(2)} domain=#{domain}")
  { status: :registered, stream: stream.to_h }
end

#reinforce_binding(binding_id:) ⇒ Object



37
38
39
40
41
42
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 37

def reinforce_binding(binding_id:, **)
  result = engine.reinforce_binding(binding_id: binding_id)
  log.debug("[phenomenal_binding] reinforce_binding: id=#{binding_id} " \
            "coherence=#{result[:coherence]&.round(2)}")
  result
end

#streams_for_binding(binding_id:) ⇒ Object



69
70
71
72
73
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 69

def streams_for_binding(binding_id:, **)
  streams = engine.streams_for_binding(binding_id: binding_id)
  log.debug("[phenomenal_binding] streams_for_binding: id=#{binding_id} count=#{streams.size}")
  { binding_id: binding_id, streams: streams.map(&:to_h) }
end

#unbound_streamsObject



75
76
77
78
79
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 75

def unbound_streams(**)
  streams = engine.unbound_streams
  log.debug("[phenomenal_binding] unbound_streams: count=#{streams.size}")
  { unbound_streams: streams.map(&:to_h) }
end

#unified_experienceObject



50
51
52
53
54
55
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/runners/phenomenal_binding.rb', line 50

def unified_experience(**)
  experience = engine.unified_experience
  log.debug('[phenomenal_binding] unified_experience: ' \
            "coherence=#{experience&.coherence&.round(2) || 'none'}")
  { unified_experience: experience&.to_h }
end