Module: Legion::Extensions::Agentic::Executive::Dwell::Runners::CognitiveDwell

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

Instance Method Summary collapse

Instance Method Details

#add_topic(content:, topic_type: :concept, salience: 0.5, novelty: 0.5, emotional_intensity: 0.3, complexity: 0.5, engine: nil) ⇒ Object



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

def add_topic(content:, topic_type: :concept, salience: 0.5,
              novelty: 0.5, emotional_intensity: 0.3, complexity: 0.5, engine: nil, **)
  eng = engine || default_engine
  topic = eng.add_topic(content: content, topic_type: topic_type, salience: salience,
                        novelty: novelty, emotional_intensity: emotional_intensity,
                        complexity: complexity)
  { success: true, topic: topic.to_h }
end

#current_topic(engine: nil) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/legion/extensions/agentic/executive/dwell/runners/cognitive_dwell.rb', line 43

def current_topic(engine: nil, **)
  eng = engine || default_engine
  topic = eng.current_topic
  return { success: false, error: 'no current topic' } unless topic

  { success: true, topic: topic.to_h }
end

#decay(engine: nil) ⇒ Object



37
38
39
40
41
# File 'lib/legion/extensions/agentic/executive/dwell/runners/cognitive_dwell.rb', line 37

def decay(engine: nil, **)
  eng = engine || default_engine
  result = eng.decay_all!
  { success: true, **result }
end

#disengage(topic_id:, force: 0.0, engine: nil) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/legion/extensions/agentic/executive/dwell/runners/cognitive_dwell.rb', line 29

def disengage(topic_id:, force: 0.0, engine: nil, **)
  eng = engine || default_engine
  topic = eng.disengage(topic_id: topic_id, force: force)
  return { success: false, error: 'topic not found' } unless topic

  { success: true, topic: topic.to_h }
end

#dwell_report(engine: nil) ⇒ Object



66
67
68
69
# File 'lib/legion/extensions/agentic/executive/dwell/runners/cognitive_dwell.rb', line 66

def dwell_report(engine: nil, **)
  eng = engine || default_engine
  { success: true, report: eng.dwell_report }
end

#focus_on(topic_id:, engine: nil) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/legion/extensions/agentic/executive/dwell/runners/cognitive_dwell.rb', line 21

def focus_on(topic_id:, engine: nil, **)
  eng = engine || default_engine
  topic = eng.focus_on(topic_id: topic_id)
  return { success: false, error: 'topic not found' } unless topic

  { success: true, topic: topic.to_h }
end

#most_engaging(limit: 5, engine: nil) ⇒ Object



61
62
63
64
# File 'lib/legion/extensions/agentic/executive/dwell/runners/cognitive_dwell.rb', line 61

def most_engaging(limit: 5, engine: nil, **)
  eng = engine || default_engine
  { success: true, topics: eng.most_engaging(limit: limit).map(&:to_h) }
end

#ruminating_topics(engine: nil) ⇒ Object



56
57
58
59
# File 'lib/legion/extensions/agentic/executive/dwell/runners/cognitive_dwell.rb', line 56

def ruminating_topics(engine: nil, **)
  eng = engine || default_engine
  { success: true, topics: eng.ruminating_topics.map(&:to_h) }
end

#status(engine: nil) ⇒ Object



71
72
73
74
# File 'lib/legion/extensions/agentic/executive/dwell/runners/cognitive_dwell.rb', line 71

def status(engine: nil, **)
  eng = engine || default_engine
  { success: true, **eng.to_h }
end

#sticky_topics(engine: nil) ⇒ Object



51
52
53
54
# File 'lib/legion/extensions/agentic/executive/dwell/runners/cognitive_dwell.rb', line 51

def sticky_topics(engine: nil, **)
  eng = engine || default_engine
  { success: true, topics: eng.sticky_topics.map(&:to_h) }
end