Module: Legion::Extensions::Agentic::Executive::DissonanceResolution::Runners::CognitiveDissonanceResolution

Includes:
Helpers::Lex
Included in:
Client
Defined in:
lib/legion/extensions/agentic/executive/dissonance_resolution/runners/cognitive_dissonance_resolution.rb

Instance Method Summary collapse

Instance Method Details

#abandon_dissonance(conflict_id:) ⇒ Object



35
36
37
38
39
40
# File 'lib/legion/extensions/agentic/executive/dissonance_resolution/runners/cognitive_dissonance_resolution.rb', line 35

def abandon_dissonance(conflict_id:, **)
  result = engine.abandon_conflict(conflict_id: conflict_id)
  return { success: false, error: 'conflict not found' } unless result

  { success: true }.merge(result.to_h)
end

#apply_resolution_strategy(conflict_id:, strategy:, effectiveness: 0.3) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/legion/extensions/agentic/executive/dissonance_resolution/runners/cognitive_dissonance_resolution.rb', line 20

def apply_resolution_strategy(conflict_id:, strategy:, effectiveness: 0.3, **)
  result = engine.apply_strategy(conflict_id: conflict_id, strategy: strategy,
                                 effectiveness: effectiveness)
  return { success: false, error: 'conflict not found' } unless result

  { success: true }.merge(result.to_h)
end

#create_dissonance_conflict(belief_a:, belief_b:, domain: :general, tension: nil) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/legion/extensions/agentic/executive/dissonance_resolution/runners/cognitive_dissonance_resolution.rb', line 12

def create_dissonance_conflict(belief_a:, belief_b:, domain: :general,
                               tension: nil, **)
  t = tension || Helpers::Constants::DEFAULT_TENSION
  conflict = engine.create_conflict(belief_a: belief_a, belief_b: belief_b,
                                    domain: domain, tension: t)
  { success: true }.merge(conflict.to_h)
end

#dissonance_reportObject



56
57
58
# File 'lib/legion/extensions/agentic/executive/dissonance_resolution/runners/cognitive_dissonance_resolution.rb', line 56

def dissonance_report(**)
  engine.dissonance_report
end

#dissonance_resolution_statsObject



65
66
67
# File 'lib/legion/extensions/agentic/executive/dissonance_resolution/runners/cognitive_dissonance_resolution.rb', line 65

def dissonance_resolution_stats(**)
  engine.to_h
end

#escalate_dissonance(conflict_id:, amount: 0.15) ⇒ Object



28
29
30
31
32
33
# File 'lib/legion/extensions/agentic/executive/dissonance_resolution/runners/cognitive_dissonance_resolution.rb', line 28

def escalate_dissonance(conflict_id:, amount: 0.15, **)
  result = engine.escalate_conflict(conflict_id: conflict_id, amount: amount)
  return { success: false, error: 'conflict not found' } unless result

  { success: true }.merge(result.to_h)
end

#most_tense_report(limit: 5) ⇒ Object



47
48
49
50
# File 'lib/legion/extensions/agentic/executive/dissonance_resolution/runners/cognitive_dissonance_resolution.rb', line 47

def most_tense_report(limit: 5, **)
  conflicts = engine.most_tense(limit: limit)
  { success: true, limit: limit, conflicts: conflicts.map(&:to_h) }
end

#ongoing_dissonance_reportObject



42
43
44
45
# File 'lib/legion/extensions/agentic/executive/dissonance_resolution/runners/cognitive_dissonance_resolution.rb', line 42

def ongoing_dissonance_report(**)
  conflicts = engine.ongoing_conflicts
  { success: true, count: conflicts.size, conflicts: conflicts.map(&:to_h) }
end

#strategy_effectiveness_reportObject



52
53
54
# File 'lib/legion/extensions/agentic/executive/dissonance_resolution/runners/cognitive_dissonance_resolution.rb', line 52

def strategy_effectiveness_report(**)
  { success: true, strategies: engine.strategy_report, best: engine.best_strategy }
end

#update_dissonance_resolutionObject



60
61
62
63
# File 'lib/legion/extensions/agentic/executive/dissonance_resolution/runners/cognitive_dissonance_resolution.rb', line 60

def update_dissonance_resolution(**)
  decayed = engine.decay_all
  { success: true, decayed: decayed, stats: engine.to_h }
end