lex-agentic-attention 0.1.4 → 0.1.5

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile +2 -0
  4. data/lib/legion/extensions/agentic/attention/arousal/runners/arousal.rb +8 -8
  5. data/lib/legion/extensions/agentic/attention/economy/runners/attention_economy.rb +12 -12
  6. data/lib/legion/extensions/agentic/attention/feature_binding/actors/decay.rb +1 -1
  7. data/lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb +13 -13
  8. data/lib/legion/extensions/agentic/attention/focus/runners/attention.rb +7 -7
  9. data/lib/legion/extensions/agentic/attention/latent_inhibition/runners/latent_inhibition.rb +14 -14
  10. data/lib/legion/extensions/agentic/attention/lens/helpers/lens_engine.rb +4 -2
  11. data/lib/legion/extensions/agentic/attention/lens/runners/cognitive_lens.rb +9 -9
  12. data/lib/legion/extensions/agentic/attention/lighthouse/runners/cognitive_lighthouse.rb +6 -6
  13. data/lib/legion/extensions/agentic/attention/priming/runners/priming.rb +3 -3
  14. data/lib/legion/extensions/agentic/attention/prism/helpers/prism_engine.rb +1 -1
  15. data/lib/legion/extensions/agentic/attention/prism/runners/cognitive_prism.rb +4 -4
  16. data/lib/legion/extensions/agentic/attention/relevance_theory/runners/relevance_theory.rb +16 -16
  17. data/lib/legion/extensions/agentic/attention/salience/runners/salience.rb +6 -6
  18. data/lib/legion/extensions/agentic/attention/schema/actors/decay.rb +1 -1
  19. data/lib/legion/extensions/agentic/attention/schema/runners/attention_schema.rb +13 -13
  20. data/lib/legion/extensions/agentic/attention/signal_detection/runners/signal_detection.rb +20 -20
  21. data/lib/legion/extensions/agentic/attention/spotlight/runners/attention_spotlight.rb +23 -23
  22. data/lib/legion/extensions/agentic/attention/surprise/runners/surprise.rb +12 -12
  23. data/lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthesia_engine.rb +9 -5
  24. data/lib/legion/extensions/agentic/attention/synesthesia/runners/cognitive_synesthesia.rb +10 -10
  25. data/lib/legion/extensions/agentic/attention/version.rb +1 -1
  26. data/lib/legion/extensions/agentic/attention.rb +1 -1
  27. data/spec/legion/extensions/agentic/attention/focus/runners/attention_spec.rb +1 -1
  28. data/spec/legion/extensions/agentic/attention/spotlight/helpers/spotlight_engine_spec.rb +1 -1
  29. data/spec/legion/extensions/agentic/attention/surprise/client_spec.rb +1 -1
  30. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e28e95181eafe6375a024a0b06949bff4fa2887d916814606d3138b3dd4b66ce
4
- data.tar.gz: 544fa793cfdcdff20f22417328db0d046655eed50c0b82cbe50d4474e645994b
3
+ metadata.gz: b34d0af2f43d13971db01d8ae55b32fab9258c83ca31e5071418e8226bd0b4a6
4
+ data.tar.gz: 86ffa12e144989d6f17f0c45294d6367b2360cad57f90226c8f5c0ab864d46d0
5
5
  SHA512:
6
- metadata.gz: e3bb57395c3a5360efdb4e15cfba825b63613b7430fd671310ba2080d979e1eec6de0f5bcb26a34df1cfec07fe406541d47ec98a58f3ba4c99e35938b14efa5f
7
- data.tar.gz: 3b293ab841ed7fccc09ddcfe95825343058b461bd3a0c9615e37df0bc0c2527a11595697e1dc4cb3c7c1f1717461d5d4de63628b1c6f5fd8339ce52b0c8a3247
6
+ metadata.gz: ff019e1793081d01025ffdbc705915defda74b5d0752a14981c7153dfd47143aa1d111ed3624d847b3c5622ce8a9db4b613902a52bf01c2c9eb95f2de75681b3
7
+ data.tar.gz: b2d6761c27d2bb75146313b497ff732edbf0c1d60e520235a7aab420ea007810f5334bfb94cd4d92f8510b178b673d8335f687d1e02a34cfe56686865a4e1cd2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.5] - 2026-03-30
4
+
5
+ ### Changed
6
+ - update to rubocop-legion 0.1.7, resolve all offenses
7
+
3
8
  ## [0.1.4] - 2026-03-26
4
9
 
5
10
  ### Changed
data/Gemfile CHANGED
@@ -3,3 +3,5 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ gem 'rubocop-legion', '~> 0.1', require: false
@@ -7,14 +7,14 @@ module Legion
7
7
  module Arousal
8
8
  module Runners
9
9
  module Arousal
10
- include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
11
- Legion::Extensions::Helpers.const_defined?(:Lex)
10
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
11
+ Legion::Extensions::Helpers.const_defined?(:Lex, false)
12
12
 
13
13
  def stimulate(amount: nil, source: :unknown, **)
14
14
  model = arousal_model
15
15
  amount ||= Helpers::Constants::BOOST_FACTOR
16
16
  new_level = model.stimulate(amount: amount, source: source)
17
- Legion::Logging.debug "[arousal] stimulate: source=#{source} amount=#{amount.round(2)} level=#{new_level.round(3)}"
17
+ log.debug("[arousal] stimulate: source=#{source} amount=#{amount.round(2)} level=#{new_level.round(3)}")
18
18
  {
19
19
  success: true,
20
20
  arousal: new_level,
@@ -27,7 +27,7 @@ module Legion
27
27
  model = arousal_model
28
28
  amount ||= Helpers::Constants::CALM_FACTOR
29
29
  new_level = model.calm(amount: amount)
30
- Legion::Logging.debug "[arousal] calm: amount=#{amount.round(2)} level=#{new_level.round(3)}"
30
+ log.debug("[arousal] calm: amount=#{amount.round(2)} level=#{new_level.round(3)}")
31
31
  {
32
32
  success: true,
33
33
  arousal: new_level,
@@ -39,7 +39,7 @@ module Legion
39
39
  model = arousal_model
40
40
  model.decay
41
41
  perf = model.performance
42
- Legion::Logging.debug "[arousal] update: level=#{model.arousal.round(3)} label=#{model.arousal_label} perf=#{perf.round(3)}"
42
+ log.debug("[arousal] update: level=#{model.arousal.round(3)} label=#{model.arousal_label} perf=#{perf.round(3)}")
43
43
  {
44
44
  success: true,
45
45
  arousal: model.arousal,
@@ -54,7 +54,7 @@ module Legion
54
54
  optimal = model.optimal_for(task_complexity)
55
55
  msg = "[arousal] performance: complexity=#{task_complexity} " \
56
56
  "arousal=#{model.arousal.round(3)} optimal=#{optimal} perf=#{perf.round(3)}"
57
- Legion::Logging.debug msg
57
+ log.debug(msg)
58
58
  {
59
59
  success: true,
60
60
  performance: perf,
@@ -67,7 +67,7 @@ module Legion
67
67
  def arousal_status(**)
68
68
  model = arousal_model
69
69
  perf = model.performance
70
- Legion::Logging.debug "[arousal] status: level=#{model.arousal.round(3)} label=#{model.arousal_label}"
70
+ log.debug("[arousal] status: level=#{model.arousal.round(3)} label=#{model.arousal_label}")
71
71
  {
72
72
  success: true,
73
73
  arousal: model.arousal,
@@ -83,7 +83,7 @@ module Legion
83
83
  optimal = model.optimal_for(task_complexity)
84
84
  perf = model.performance(task_complexity: task_complexity)
85
85
  guidance = compute_guidance(current, optimal)
86
- Legion::Logging.debug "[arousal] guidance: complexity=#{task_complexity} current=#{current.round(3)} optimal=#{optimal} guidance=#{guidance}"
86
+ log.debug("[arousal] guidance: complexity=#{task_complexity} current=#{current.round(3)} optimal=#{optimal} guidance=#{guidance}")
87
87
  {
88
88
  success: true,
89
89
  guidance: guidance,
@@ -7,8 +7,8 @@ module Legion
7
7
  module Economy
8
8
  module Runners
9
9
  module AttentionEconomy
10
- include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
11
- Legion::Extensions::Helpers.const_defined?(:Lex)
10
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
11
+ Legion::Extensions::Helpers.const_defined?(:Lex, false)
12
12
 
13
13
  def add_demand(label:, demand_type:, priority:, cost:, roi: 0.5, **)
14
14
  d = attention_budget.create_demand(
@@ -18,57 +18,57 @@ module Legion
18
18
  cost: cost,
19
19
  roi: roi
20
20
  )
21
- Legion::Logging.info "[attention] demand added: id=#{d.id} label=#{label} priority=#{priority} cost=#{cost}"
21
+ log.info("[attention] demand added: id=#{d.id} label=#{label} priority=#{priority} cost=#{cost}")
22
22
  { created: true, demand: d.to_h }
23
23
  rescue ArgumentError => e
24
- Legion::Logging.warn "[attention] add_demand failed: #{e.message}"
24
+ log.warn("[attention] add_demand failed: #{e.message}")
25
25
  { created: false, reason: e.message }
26
26
  end
27
27
 
28
28
  def allocate_demand(demand_id:, amount: nil, **)
29
29
  result = attention_budget.allocate(demand_id: demand_id, amount: amount)
30
30
  if result[:allocated]
31
- Legion::Logging.info "[attention] allocated: demand_id=#{demand_id} amount=#{result[:amount]} remaining=#{result[:remaining]}"
31
+ log.info("[attention] allocated: demand_id=#{demand_id} amount=#{result[:amount]} remaining=#{result[:remaining]}")
32
32
  else
33
- Legion::Logging.debug "[attention] allocation failed: demand_id=#{demand_id} reason=#{result[:reason]}"
33
+ log.debug("[attention] allocation failed: demand_id=#{demand_id} reason=#{result[:reason]}")
34
34
  end
35
35
  result
36
36
  end
37
37
 
38
38
  def deallocate_demand(demand_id:, **)
39
39
  result = attention_budget.deallocate(demand_id: demand_id)
40
- Legion::Logging.debug "[attention] deallocated: demand_id=#{demand_id} freed=#{result[:freed]}"
40
+ log.debug("[attention] deallocated: demand_id=#{demand_id} freed=#{result[:freed]}")
41
41
  result
42
42
  end
43
43
 
44
44
  def recover_budget(amount: nil, **)
45
45
  opts = amount ? { amount: amount } : {}
46
46
  result = attention_budget.recover!(**opts)
47
- Legion::Logging.debug "[attention] recovery: delta=#{result[:recovered]} spent=#{result[:spent]}"
47
+ log.debug("[attention] recovery: delta=#{result[:recovered]} spent=#{result[:spent]}")
48
48
  result
49
49
  end
50
50
 
51
51
  def prioritized_demands(**)
52
52
  demands = attention_budget.prioritized_demands
53
- Legion::Logging.debug "[attention] prioritized_demands: count=#{demands.size}"
53
+ log.debug("[attention] prioritized_demands: count=#{demands.size}")
54
54
  { demands: demands.map(&:to_h), count: demands.size }
55
55
  end
56
56
 
57
57
  def best_roi_demands(limit: 5, **)
58
58
  demands = attention_budget.best_roi(limit: limit)
59
- Legion::Logging.debug "[attention] best_roi: limit=#{limit} count=#{demands.size}"
59
+ log.debug("[attention] best_roi: limit=#{limit} count=#{demands.size}")
60
60
  { demands: demands.map(&:to_h), count: demands.size }
61
61
  end
62
62
 
63
63
  def rebalance_budget(**)
64
64
  result = attention_budget.rebalance
65
- Legion::Logging.info "[attention] rebalance: freed=#{result[:rebalanced]} spent=#{result[:spent]}"
65
+ log.info("[attention] rebalance: freed=#{result[:rebalanced]} spent=#{result[:spent]}")
66
66
  result
67
67
  end
68
68
 
69
69
  def attention_status(**)
70
70
  report = attention_budget.budget_report
71
- Legion::Logging.debug "[attention] status: utilization=#{report[:utilization]} demands=#{report[:demand_count]}"
71
+ log.debug("[attention] status: utilization=#{report[:utilization]} demands=#{report[:demand_count]}")
72
72
  report
73
73
  end
74
74
 
@@ -8,7 +8,7 @@ module Legion
8
8
  module Attention
9
9
  module FeatureBinding
10
10
  module Actor
11
- class Decay < Legion::Extensions::Actors::Every
11
+ class Decay < Legion::Extensions::Actors::Every # rubocop:disable Legion/Extension/EveryActorRequiresTime
12
12
  def runner_class
13
13
  Legion::Extensions::Agentic::Attention::FeatureBinding::Runners::FeatureBinding
14
14
  end
@@ -7,11 +7,11 @@ module Legion
7
7
  module FeatureBinding
8
8
  module Runners
9
9
  module FeatureBinding
10
- include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
11
- Legion::Extensions::Helpers.const_defined?(:Lex)
10
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
11
+ Legion::Extensions::Helpers.const_defined?(:Lex, false)
12
12
 
13
13
  def register_feature(id:, dimension:, value:, source: :perception, salience: 0.5, **)
14
- Legion::Logging.debug "[feature_binding] register: id=#{id} dim=#{dimension} val=#{value}"
14
+ log.debug("[feature_binding] register: id=#{id} dim=#{dimension} val=#{value}")
15
15
  feature = field.register_feature(id: id, dimension: dimension, value: value, source: source,
16
16
  salience: salience)
17
17
  if feature
@@ -22,7 +22,7 @@ module Legion
22
22
  end
23
23
 
24
24
  def bind_features(feature_ids:, attention: false, **)
25
- Legion::Logging.debug "[feature_binding] bind: features=#{feature_ids} attention=#{attention}"
25
+ log.debug("[feature_binding] bind: features=#{feature_ids} attention=#{attention}")
26
26
  obj = field.bind(feature_ids: feature_ids, attention: attention)
27
27
  if obj
28
28
  { success: true, object: obj.to_h, total_objects: field.object_count }
@@ -32,7 +32,7 @@ module Legion
32
32
  end
33
33
 
34
34
  def attend_object(object_id:, **)
35
- Legion::Logging.debug "[feature_binding] attend: object=#{object_id}"
35
+ log.debug("[feature_binding] attend: object=#{object_id}")
36
36
  obj = field.attend(object_id: object_id.to_sym)
37
37
  if obj
38
38
  { success: true, object: obj.to_h }
@@ -42,49 +42,49 @@ module Legion
42
42
  end
43
43
 
44
44
  def unbind_object(object_id:, **)
45
- Legion::Logging.debug "[feature_binding] unbind: object=#{object_id}"
45
+ log.debug("[feature_binding] unbind: object=#{object_id}")
46
46
  removed = field.unbind(object_id: object_id.to_sym)
47
47
  { success: removed }
48
48
  end
49
49
 
50
50
  def features_of_object(object_id:, **)
51
51
  features = field.features_of(object_id: object_id.to_sym)
52
- Legion::Logging.debug "[feature_binding] features_of: object=#{object_id} count=#{features.size}"
52
+ log.debug("[feature_binding] features_of: object=#{object_id} count=#{features.size}")
53
53
  { success: true, features: features, count: features.size }
54
54
  end
55
55
 
56
56
  def objects_with(feature_id:, **)
57
57
  objects = field.objects_with_feature(feature_id: feature_id)
58
- Legion::Logging.debug "[feature_binding] objects_with: feature=#{feature_id} count=#{objects.size}"
58
+ log.debug("[feature_binding] objects_with: feature=#{feature_id} count=#{objects.size}")
59
59
  { success: true, objects: objects, count: objects.size }
60
60
  end
61
61
 
62
62
  def illusory_conjunctions(**)
63
63
  illusions = field.illusory_conjunctions
64
- Legion::Logging.debug "[feature_binding] illusory: #{illusions.size}"
64
+ log.debug("[feature_binding] illusory: #{illusions.size}")
65
65
  { success: true, illusory: illusions, count: illusions.size }
66
66
  end
67
67
 
68
68
  def unbound_features(**)
69
69
  unbound = field.unbound_features
70
- Legion::Logging.debug "[feature_binding] unbound: #{unbound.size}"
70
+ log.debug("[feature_binding] unbound: #{unbound.size}")
71
71
  { success: true, unbound: unbound, count: unbound.size }
72
72
  end
73
73
 
74
74
  def search_features(dimension:, value: nil, **)
75
75
  results = field.search_by_dimension(dimension: dimension, value: value)
76
- Legion::Logging.debug "[feature_binding] search: dim=#{dimension} found=#{results.size}"
76
+ log.debug("[feature_binding] search: dim=#{dimension} found=#{results.size}")
77
77
  { success: true, results: results, count: results.size }
78
78
  end
79
79
 
80
80
  def update_feature_binding(**)
81
- Legion::Logging.debug '[feature_binding] tick'
81
+ log.debug('[feature_binding] tick')
82
82
  field.decay_all
83
83
  { success: true, features: field.feature_count, objects: field.object_count }
84
84
  end
85
85
 
86
86
  def feature_binding_stats(**)
87
- Legion::Logging.debug '[feature_binding] stats'
87
+ log.debug('[feature_binding] stats')
88
88
  { success: true, stats: field.to_h }
89
89
  end
90
90
 
@@ -7,8 +7,8 @@ module Legion
7
7
  module Focus
8
8
  module Runners
9
9
  module Attention
10
- include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
11
- Legion::Extensions::Helpers.const_defined?(:Lex)
10
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
11
+ Legion::Extensions::Helpers.const_defined?(:Lex, false)
12
12
 
13
13
  def filter_signals(signals: [], active_wonders: [], **)
14
14
  return { filtered: [], spotlight: 0, peripheral: 0, background: 0, dropped: 0 } if signals.empty?
@@ -19,9 +19,9 @@ module Legion
19
19
 
20
20
  habituation_model.decay_all
21
21
 
22
- Legion::Logging.debug "[attention] filtered #{signals.size}->#{categorized[:spotlight].size + categorized[:peripheral].size} " \
23
- "(spotlight=#{categorized[:spotlight].size} peripheral=#{categorized[:peripheral].size} " \
24
- "background=#{categorized[:background].size} dropped=#{categorized[:dropped]})"
22
+ log.debug("[attention] filtered #{signals.size}->#{categorized[:spotlight].size + categorized[:peripheral].size} " \
23
+ "(spotlight=#{categorized[:spotlight].size} peripheral=#{categorized[:peripheral].size} " \
24
+ "background=#{categorized[:background].size} dropped=#{categorized[:dropped]})")
25
25
 
26
26
  {
27
27
  filtered: categorized[:spotlight] + categorized[:peripheral],
@@ -44,13 +44,13 @@ module Legion
44
44
 
45
45
  def focus_on(domain:, reason: nil, **)
46
46
  result = focus_manager.focus_on(domain, reason: reason)
47
- Legion::Logging.info "[attention] focus_on #{domain}: #{result}"
47
+ log.info("[attention] focus_on #{domain}: #{result}")
48
48
  { status: result, domain: domain }
49
49
  end
50
50
 
51
51
  def release_focus(domain:, **)
52
52
  result = focus_manager.release(domain)
53
- Legion::Logging.info "[attention] release_focus #{domain}: #{result}"
53
+ log.info("[attention] release_focus #{domain}: #{result}")
54
54
  { status: result, domain: domain }
55
55
  end
56
56
 
@@ -7,17 +7,17 @@ module Legion
7
7
  module LatentInhibition
8
8
  module Runners
9
9
  module LatentInhibition
10
- include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
11
- Legion::Extensions::Helpers.const_defined?(:Lex)
10
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
11
+ Legion::Extensions::Helpers.const_defined?(:Lex, false)
12
12
 
13
13
  def expose(label:, engine: nil, **)
14
14
  eng = engine || default_engine
15
15
  result = eng.expose_stimulus(label: label)
16
16
 
17
- Legion::Logging.debug "[latent_inhibition] expose: label=#{label} " \
18
- "exposure_count=#{result[:exposure_count]} " \
19
- "inhibition=#{result[:inhibition_score].round(4)} " \
20
- "label=#{result[:inhibition_label]} novel=#{result[:novel]}"
17
+ log.debug("[latent_inhibition] expose: label=#{label} " \
18
+ "exposure_count=#{result[:exposure_count]} " \
19
+ "inhibition=#{result[:inhibition_score].round(4)} " \
20
+ "label=#{result[:inhibition_label]} novel=#{result[:novel]}")
21
21
  result
22
22
  end
23
23
 
@@ -25,8 +25,8 @@ module Legion
25
25
  eng = engine || default_engine
26
26
  result = eng.attempt_association(label: label, outcome: outcome)
27
27
 
28
- Legion::Logging.debug "[latent_inhibition] associate: label=#{label} outcome=#{outcome} " \
29
- "effectiveness=#{result[:effectiveness].round(4)} blocked=#{result[:blocked]}"
28
+ log.debug("[latent_inhibition] associate: label=#{label} outcome=#{outcome} " \
29
+ "effectiveness=#{result[:effectiveness].round(4)} blocked=#{result[:blocked]}")
30
30
  result
31
31
  end
32
32
 
@@ -34,8 +34,8 @@ module Legion
34
34
  eng = engine || default_engine
35
35
  result = eng.disinhibit(label: label, intensity: intensity)
36
36
 
37
- Legion::Logging.debug "[latent_inhibition] disinhibit: label=#{label} " \
38
- "prior=#{result[:prior_score]&.round(4)} new=#{result[:new_score]&.round(4)}"
37
+ log.debug("[latent_inhibition] disinhibit: label=#{label} " \
38
+ "prior=#{result[:prior_score]&.round(4)} new=#{result[:new_score]&.round(4)}")
39
39
  result
40
40
  end
41
41
 
@@ -43,7 +43,7 @@ module Legion
43
43
  eng = engine || default_engine
44
44
  stimuli = eng.novel_stimuli
45
45
 
46
- Legion::Logging.debug "[latent_inhibition] novel_stimuli: count=#{stimuli.size}"
46
+ log.debug("[latent_inhibition] novel_stimuli: count=#{stimuli.size}")
47
47
  { stimuli: stimuli, count: stimuli.size }
48
48
  end
49
49
 
@@ -51,7 +51,7 @@ module Legion
51
51
  eng = engine || default_engine
52
52
  stimuli = eng.most_inhibited(limit: limit)
53
53
 
54
- Legion::Logging.debug "[latent_inhibition] most_inhibited: limit=#{limit} returned=#{stimuli.size}"
54
+ log.debug("[latent_inhibition] most_inhibited: limit=#{limit} returned=#{stimuli.size}")
55
55
  { stimuli: stimuli, count: stimuli.size }
56
56
  end
57
57
 
@@ -59,8 +59,8 @@ module Legion
59
59
  eng = engine || default_engine
60
60
  report = eng.inhibition_report
61
61
 
62
- Legion::Logging.debug "[latent_inhibition] report: total=#{report[:total_stimuli]} " \
63
- "novel=#{report[:novel_count]} mean=#{report[:mean_inhibition]&.round(4)}"
62
+ log.debug("[latent_inhibition] report: total=#{report[:total_stimuli]} " \
63
+ "novel=#{report[:novel_count]} mean=#{report[:mean_inhibition]&.round(4)}")
64
64
  report
65
65
  end
66
66
 
@@ -48,11 +48,13 @@ module Legion
48
48
  raise ArgumentError, "stack not found: #{stack_id}" unless stack
49
49
 
50
50
  result = stack.view_through(content)
51
- Legion::Logging.debug "[cognitive_lens] view_through stack=#{stack_id} " \
51
+ # rubocop:disable Legion/HelperMigration/DirectLogging
52
+ Legion::Logging.debug("[cognitive_lens] view_through stack=#{stack_id} " \
52
53
  "perceived=#{result[:perceived].round(4)} " \
53
54
  "magnification=#{result[:combined_magnification].round(2)} " \
54
55
  "distortion=#{result[:combined_distortion].round(2)} " \
55
- "clarity=#{result[:stack_clarity].round(2)}"
56
+ "clarity=#{result[:stack_clarity].round(2)}")
57
+ # rubocop:enable Legion/HelperMigration/DirectLogging
56
58
  result
57
59
  end
58
60
 
@@ -7,8 +7,8 @@ module Legion
7
7
  module Lens
8
8
  module Runners
9
9
  module CognitiveLens
10
- include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
11
- Legion::Extensions::Helpers.const_defined?(:Lex)
10
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
11
+ Legion::Extensions::Helpers.const_defined?(:Lex, false)
12
12
 
13
13
  def create_lens(lens_type:, magnification: nil, clarity: 1.0, distortion: nil, aperture: nil,
14
14
  engine: nil, **)
@@ -22,11 +22,11 @@ module Legion
22
22
  distortion: distortion,
23
23
  aperture: aperture
24
24
  )
25
- Legion::Logging.debug "[cognitive_lens] created lens id=#{lens.id} type=#{lens_type} " \
26
- "mag=#{lens.magnification.round(2)} clarity=#{lens.clarity.round(2)}"
25
+ log.debug("[cognitive_lens] created lens id=#{lens.id} type=#{lens_type} " \
26
+ "mag=#{lens.magnification.round(2)} clarity=#{lens.clarity.round(2)}")
27
27
  { success: true, lens: lens.to_h }
28
28
  rescue ArgumentError => e
29
- Legion::Logging.warn "[cognitive_lens] create_lens failed: #{e.message}"
29
+ log.warn("[cognitive_lens] create_lens failed: #{e.message}")
30
30
  { success: false, error: e.message }
31
31
  end
32
32
 
@@ -35,10 +35,10 @@ module Legion
35
35
 
36
36
  eng = engine || lens_engine
37
37
  result = eng.stack_lenses(lens_ids: lens_ids, stack_id: stack_id)
38
- Legion::Logging.debug "[cognitive_lens] stacked #{lens_ids.size} lenses stack_id=#{result[:stack_id]}"
38
+ log.debug("[cognitive_lens] stacked #{lens_ids.size} lenses stack_id=#{result[:stack_id]}")
39
39
  { success: true, stack_id: result[:stack_id], stack: result[:stack].to_h }
40
40
  rescue ArgumentError => e
41
- Legion::Logging.warn "[cognitive_lens] stack_lenses failed: #{e.message}"
41
+ log.warn("[cognitive_lens] stack_lenses failed: #{e.message}")
42
42
  { success: false, error: e.message }
43
43
  end
44
44
 
@@ -47,14 +47,14 @@ module Legion
47
47
  result = eng.view_through_stack(stack_id: stack_id, content: content)
48
48
  { success: true, **result }
49
49
  rescue ArgumentError => e
50
- Legion::Logging.warn "[cognitive_lens] view_through_stack failed: #{e.message}"
50
+ log.warn("[cognitive_lens] view_through_stack failed: #{e.message}")
51
51
  { success: false, error: e.message }
52
52
  end
53
53
 
54
54
  def degrade_all(rate: Helpers::Constants::SMUDGE_RATE_DEFAULT, engine: nil, **)
55
55
  eng = engine || lens_engine
56
56
  result = eng.degrade_all!(rate: rate)
57
- Legion::Logging.debug "[cognitive_lens] degraded #{result[:degraded]} lenses at rate=#{rate}"
57
+ log.debug("[cognitive_lens] degraded #{result[:degraded]} lenses at rate=#{rate}")
58
58
  { success: true, **result }
59
59
  end
60
60
 
@@ -21,8 +21,8 @@ module Legion
21
21
  luminosity: luminosity,
22
22
  sweep_angle: sweep_angle
23
23
  )
24
- Legion::Logging.debug "[lighthouse] lit beacon: type=#{beacon_type} domain=#{domain} " \
25
- "luminosity=#{beacon.luminosity}"
24
+ log.debug("[lighthouse] lit beacon: type=#{beacon_type} domain=#{domain} " \
25
+ "luminosity=#{beacon.luminosity}")
26
26
  { success: true, beacon: beacon.to_h }
27
27
  rescue ArgumentError => e
28
28
  { success: false, error: e.message }
@@ -32,8 +32,8 @@ module Legion
32
32
  eng = resolve_engine(engine)
33
33
  fog = eng.create_fog(fog_type: fog_type, domain: domain,
34
34
  density: density, extent: extent)
35
- Legion::Logging.debug "[lighthouse] created fog: type=#{fog_type} domain=#{domain} " \
36
- "density=#{fog.density}"
35
+ log.debug("[lighthouse] created fog: type=#{fog_type} domain=#{domain} " \
36
+ "density=#{fog.density}")
37
37
  { success: true, fog: fog.to_h }
38
38
  rescue ArgumentError => e
39
39
  { success: false, error: e.message }
@@ -42,8 +42,8 @@ module Legion
42
42
  def sweep(beacon_id:, fog_id:, engine: nil, **)
43
43
  eng = resolve_engine(engine)
44
44
  result = eng.sweep(beacon_id: beacon_id, fog_id: fog_id)
45
- Legion::Logging.debug "[lighthouse] sweep: beacon=#{beacon_id} fog=#{fog_id} " \
46
- "reduction=#{result[:reduction]}"
45
+ log.debug("[lighthouse] sweep: beacon=#{beacon_id} fog=#{fog_id} " \
46
+ "reduction=#{result[:reduction]}")
47
47
  { success: true, **result }
48
48
  rescue ArgumentError => e
49
49
  { success: false, error: e.message }
@@ -19,7 +19,7 @@ module Legion
19
19
  concept = network.prime(name, boost: boost, source: source, spread: spread)
20
20
  return { success: false, reason: :not_found } unless concept
21
21
 
22
- Legion::Logging.debug "[priming] primed #{name} activation=#{concept.activation.round(4)} spread=#{spread}"
22
+ log.debug("[priming] primed #{name} activation=#{concept.activation.round(4)} spread=#{spread}")
23
23
  { success: true, concept: concept.to_h, active_primes: network.active_prime_count }
24
24
  end
25
25
 
@@ -31,14 +31,14 @@ module Legion
31
31
  def link_concepts(name_a:, name_b:, strength: nil, **)
32
32
  strength ||= Helpers::Constants::DEFAULT_ASSOCIATION_STRENGTH
33
33
  network.link(name_a, name_b, strength: strength)
34
- Legion::Logging.debug "[priming] linked #{name_a} <-> #{name_b} strength=#{strength}"
34
+ log.debug("[priming] linked #{name_a} <-> #{name_b} strength=#{strength}")
35
35
  { success: true, name_a: name_a, name_b: name_b, strength: strength }
36
36
  end
37
37
 
38
38
  def update_priming(**)
39
39
  network.decay_all
40
40
  primed = network.primed_concepts
41
- Legion::Logging.debug "[priming] tick: concepts=#{network.concept_count} active=#{primed.size}"
41
+ log.debug("[priming] tick: concepts=#{network.concept_count} active=#{primed.size}")
42
42
  { success: true, active_primes: primed.size, concept_count: network.concept_count }
43
43
  end
44
44
 
@@ -27,7 +27,7 @@ module Legion
27
27
  beam.decompose!
28
28
  beam.components.each { |c| @components["#{beam_id}:#{c.band}"] = c }
29
29
 
30
- Legion::Logging.debug "[cognitive_prism] decompose: beam=#{beam_id[0..7]} components=#{beam.components.size} purity=#{beam.purity.round(4)}"
30
+ Legion::Logging.debug("[cognitive_prism] decompose: beam=#{beam_id[0..7]} components=#{beam.components.size} purity=#{beam.purity.round(4)}") # rubocop:disable Legion/HelperMigration/DirectLogging
31
31
  {
32
32
  success: true,
33
33
  beam_id: beam_id,
@@ -15,7 +15,7 @@ module Legion
15
15
  prism = engine || default_engine
16
16
  prism.create_beam(domain: domain, content: content, beam_id: beam_id)
17
17
  rescue ArgumentError => e
18
- Legion::Logging.warn "[cognitive_prism] create_beam failed: #{e.message}"
18
+ log.warn("[cognitive_prism] create_beam failed: #{e.message}")
19
19
  { success: false, error: e.message }
20
20
  end
21
21
 
@@ -23,7 +23,7 @@ module Legion
23
23
  prism = engine || default_engine
24
24
  prism.decompose(beam_id)
25
25
  rescue ArgumentError => e
26
- Legion::Logging.warn "[cognitive_prism] decompose failed: #{e.message}"
26
+ log.warn("[cognitive_prism] decompose failed: #{e.message}")
27
27
  { success: false, error: e.message }
28
28
  end
29
29
 
@@ -31,7 +31,7 @@ module Legion
31
31
  prism = engine || default_engine
32
32
  prism.recompose(component_ids)
33
33
  rescue ArgumentError => e
34
- Legion::Logging.warn "[cognitive_prism] recompose failed: #{e.message}"
34
+ log.warn("[cognitive_prism] recompose failed: #{e.message}")
35
35
  { success: false, error: e.message }
36
36
  end
37
37
 
@@ -39,7 +39,7 @@ module Legion
39
39
  prism = engine || default_engine
40
40
  prism.attenuate_all!(rate: rate)
41
41
  rescue ArgumentError => e
42
- Legion::Logging.warn "[cognitive_prism] attenuate_all failed: #{e.message}"
42
+ log.warn("[cognitive_prism] attenuate_all failed: #{e.message}")
43
43
  { success: false, error: e.message }
44
44
  end
45
45