lex-agentic-imagination 0.1.11 → 0.1.12
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lex-agentic-imagination.gemspec +1 -0
- data/lib/legion/extensions/agentic/imagination/alchemy/actors/decay.rb +1 -1
- data/lib/legion/extensions/agentic/imagination/aurora/actors/decay.rb +1 -1
- data/lib/legion/extensions/agentic/imagination/aurora/runners/cognitive_aurora.rb +14 -14
- data/lib/legion/extensions/agentic/imagination/creativity/actors/maintenance.rb +1 -1
- data/lib/legion/extensions/agentic/imagination/creativity/helpers/idea.rb +1 -1
- data/lib/legion/extensions/agentic/imagination/creativity/runners/creativity.rb +16 -16
- data/lib/legion/extensions/agentic/imagination/dream/client.rb +3 -1
- data/lib/legion/extensions/agentic/imagination/dream/helpers/association_walker.rb +1 -1
- data/lib/legion/extensions/agentic/imagination/dream/helpers/dream_journal.rb +5 -3
- data/lib/legion/extensions/agentic/imagination/dream/helpers/llm_enhancer.rb +6 -6
- data/lib/legion/extensions/agentic/imagination/dream/runners/dream_cycle.rb +32 -32
- data/lib/legion/extensions/agentic/imagination/embodied_simulation/actors/maintenance.rb +1 -1
- data/lib/legion/extensions/agentic/imagination/garden/helpers/plant.rb +1 -1
- data/lib/legion/extensions/agentic/imagination/genesis/helpers/genesis_engine.rb +14 -13
- data/lib/legion/extensions/agentic/imagination/greenhouse/actors/maintenance.rb +1 -1
- data/lib/legion/extensions/agentic/imagination/greenhouse/runners/cognitive_greenhouse.rb +5 -5
- data/lib/legion/extensions/agentic/imagination/imagery/runners/imagination.rb +8 -8
- data/lib/legion/extensions/agentic/imagination/lucidity/runners/cognitive_lucidity.rb +9 -9
- data/lib/legion/extensions/agentic/imagination/mental_simulation/actors/maintenance.rb +1 -1
- data/lib/legion/extensions/agentic/imagination/mental_simulation/runners/mental_simulation.rb +14 -14
- data/lib/legion/extensions/agentic/imagination/origami/helpers/origami_engine.rb +6 -4
- data/lib/legion/extensions/agentic/imagination/origami/runners/cognitive_origami.rb +8 -8
- data/lib/legion/extensions/agentic/imagination/prospection/runners/prospection.rb +15 -19
- data/lib/legion/extensions/agentic/imagination/time_travel/actors/maintenance.rb +1 -1
- data/lib/legion/extensions/agentic/imagination/time_travel/runners/mental_time_travel.rb +14 -14
- data/lib/legion/extensions/agentic/imagination/version.rb +1 -1
- data/lib/legion/extensions/agentic/imagination/volcano/runners/cognitive_volcano.rb +11 -11
- data/lib/legion/extensions/agentic/imagination.rb +1 -1
- data/spec/legion/extensions/agentic/imagination/alchemy/actors/decay_spec.rb +1 -1
- data/spec/legion/extensions/agentic/imagination/aurora/actors/decay_spec.rb +1 -1
- data/spec/legion/extensions/agentic/imagination/creativity/actors/maintenance_spec.rb +1 -1
- data/spec/legion/extensions/agentic/imagination/embodied_simulation/actors/maintenance_spec.rb +1 -1
- data/spec/legion/extensions/agentic/imagination/greenhouse/actors/maintenance_spec.rb +1 -1
- data/spec/legion/extensions/agentic/imagination/mental_simulation/actors/maintenance_spec.rb +1 -1
- data/spec/legion/extensions/agentic/imagination/time_travel/actors/maintenance_spec.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 45bdb87654c005abd22e8fdfff92ac2cf20c70cca82b28331fbf5fea2e4ae8ce
|
|
4
|
+
data.tar.gz: 401dd4f777d4471e3fdd6f0371085cf0951ec537137da516ffb2bd8df8a36b98
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1695aa24419b5be9b9067e743241262c734b30d0759076bc01e230cbc67d414379ca4905243a22b8d6c5f83bd9923dee84d14061af595437a3dde802601ca7bd
|
|
7
|
+
data.tar.gz: 206f1103656875b57191e0a9ff40a0cc935583345d20dd436b3bc6cfdaabd8c1b184d0b6b23ff6c1f754e18a7113d6db150e744b1edcb57a39a1fe6370828f3c
|
data/CHANGELOG.md
CHANGED
|
@@ -38,5 +38,6 @@ Gem::Specification.new do |spec|
|
|
|
38
38
|
spec.add_development_dependency 'lex-tick'
|
|
39
39
|
spec.add_development_dependency 'rspec', '~> 3.13'
|
|
40
40
|
spec.add_development_dependency 'rubocop', '~> 1.60'
|
|
41
|
+
spec.add_development_dependency 'rubocop-legion', '~> 0.1'
|
|
41
42
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.26'
|
|
42
43
|
end
|
|
@@ -7,8 +7,8 @@ module Legion
|
|
|
7
7
|
module Aurora
|
|
8
8
|
module Runners
|
|
9
9
|
module CognitiveAurora
|
|
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 detect_aurora(type: :emergent, domain: :perception, contributing_subsystems: [],
|
|
14
14
|
luminosity: Helpers::Constants::DEFAULT_LUMINOSITY,
|
|
@@ -22,13 +22,13 @@ module Legion
|
|
|
22
22
|
harmony_score: harmony_score
|
|
23
23
|
)
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
log.debug("[cognitive_aurora] detected aurora: type=#{type} domain=#{domain} " \
|
|
26
|
+
"luminosity=#{luminosity.round(2)} harmony=#{harmony_score.round(2)} " \
|
|
27
|
+
"id=#{event.id}")
|
|
28
28
|
|
|
29
29
|
{ success: true, event: event.to_h }
|
|
30
30
|
rescue StandardError => e
|
|
31
|
-
|
|
31
|
+
log.error("[cognitive_aurora] detect_aurora failed: #{e.message}")
|
|
32
32
|
{ success: false, error: e.message }
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -38,10 +38,10 @@ module Legion
|
|
|
38
38
|
target_engine.fade_all!
|
|
39
39
|
after_count = target_engine.brilliant_events.size
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
log.debug("[cognitive_aurora] fade_all: brilliant #{before_count} -> #{after_count}")
|
|
42
42
|
{ success: true, faded: true, brilliant_before: before_count, brilliant_after: after_count }
|
|
43
43
|
rescue StandardError => e
|
|
44
|
-
|
|
44
|
+
log.error("[cognitive_aurora] fade_all failed: #{e.message}")
|
|
45
45
|
{ success: false, error: e.message }
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -49,10 +49,10 @@ module Legion
|
|
|
49
49
|
target_engine = engine || default_engine
|
|
50
50
|
events = target_engine.brilliant_events.sort_by { |e| -e.luminosity }.first(limit)
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
log.debug("[cognitive_aurora] list_brilliant: found #{events.size} brilliant events (limit=#{limit})")
|
|
53
53
|
{ success: true, events: events.map(&:to_h), count: events.size }
|
|
54
54
|
rescue StandardError => e
|
|
55
|
-
|
|
55
|
+
log.error("[cognitive_aurora] list_brilliant failed: #{e.message}")
|
|
56
56
|
{ success: false, error: e.message }
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -60,13 +60,13 @@ module Legion
|
|
|
60
60
|
target_engine = engine || default_engine
|
|
61
61
|
report = target_engine.aurora_report
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
log.debug("[cognitive_aurora] status: total=#{report[:total_events]} " \
|
|
64
|
+
"luminosity=#{report[:overall_luminosity].round(2)} " \
|
|
65
|
+
"harmony=#{report[:overall_harmony].round(2)}")
|
|
66
66
|
|
|
67
67
|
{ success: true, report: report }
|
|
68
68
|
rescue StandardError => e
|
|
69
|
-
|
|
69
|
+
log.error("[cognitive_aurora] aurora_status failed: #{e.message}")
|
|
70
70
|
{ success: false, error: e.message }
|
|
71
71
|
end
|
|
72
72
|
|
|
@@ -7,8 +7,8 @@ module Legion
|
|
|
7
7
|
module Creativity
|
|
8
8
|
module Runners
|
|
9
9
|
module Creativity
|
|
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 creative_tick(tick_results: {}, **)
|
|
14
14
|
seeds = harvest_seeds(tick_results)
|
|
@@ -17,8 +17,8 @@ module Legion
|
|
|
17
17
|
emerged = creative_engine.incubate
|
|
18
18
|
store = creative_engine.idea_store
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
log.debug("[creativity] tick: seeds=#{seeds.size} emerged=#{emerged.size} " \
|
|
21
|
+
"active=#{store.active_count} potential=#{creative_engine.creative_potential.round(3)}")
|
|
22
22
|
|
|
23
23
|
{
|
|
24
24
|
emerged_count: emerged.size,
|
|
@@ -32,8 +32,8 @@ module Legion
|
|
|
32
32
|
def diverge(prompt:, count: 5, **)
|
|
33
33
|
ideas = creative_engine.diverge(prompt: prompt, count: count)
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
log.debug("[creativity] diverge: prompt=#{prompt.inspect} count=#{ideas.size} " \
|
|
36
|
+
"potential=#{creative_engine.creative_potential.round(3)}")
|
|
37
37
|
|
|
38
38
|
{
|
|
39
39
|
mode: :divergent,
|
|
@@ -48,8 +48,8 @@ module Legion
|
|
|
48
48
|
result = creative_engine.blend(concept_a: concept_a, concept_b: concept_b)
|
|
49
49
|
|
|
50
50
|
if result[:status] == :ok
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
log.debug("[creativity] blend: #{concept_a} + #{concept_b} -> " \
|
|
52
|
+
"novelty=#{result[:idea].novelty_score.round(3)}")
|
|
53
53
|
{
|
|
54
54
|
status: :ok,
|
|
55
55
|
mode: :combinational,
|
|
@@ -57,7 +57,7 @@ module Legion
|
|
|
57
57
|
potential: creative_engine.creative_potential.round(4)
|
|
58
58
|
}
|
|
59
59
|
else
|
|
60
|
-
|
|
60
|
+
log.debug("[creativity] blend rejected: #{result[:message]}")
|
|
61
61
|
result
|
|
62
62
|
end
|
|
63
63
|
end
|
|
@@ -66,7 +66,7 @@ module Legion
|
|
|
66
66
|
emerged = creative_engine.idea_store.by_state(:emerged)
|
|
67
67
|
ranked = creative_engine.converge(ideas: emerged)
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
log.debug("[creativity] evaluate: #{ranked.size} ideas ranked")
|
|
70
70
|
|
|
71
71
|
{
|
|
72
72
|
evaluated_count: ranked.size,
|
|
@@ -79,15 +79,15 @@ module Legion
|
|
|
79
79
|
idea = creative_engine.idea_store.ideas.find { |i| i.id == idea_id }
|
|
80
80
|
|
|
81
81
|
unless idea
|
|
82
|
-
|
|
82
|
+
log.debug("[creativity] adopt: idea_id=#{idea_id} not found")
|
|
83
83
|
return { status: :not_found, idea_id: idea_id }
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
if idea.adopt!
|
|
87
|
-
|
|
87
|
+
log.debug("[creativity] adopt: idea_id=#{idea_id} adopted")
|
|
88
88
|
{ status: :adopted, idea: idea.to_h }
|
|
89
89
|
else
|
|
90
|
-
|
|
90
|
+
log.debug("[creativity] adopt: idea_id=#{idea_id} state=#{idea.state} not adoptable")
|
|
91
91
|
{ status: :not_adoptable, idea_id: idea_id, current_state: idea.state }
|
|
92
92
|
end
|
|
93
93
|
end
|
|
@@ -96,8 +96,8 @@ module Legion
|
|
|
96
96
|
store = creative_engine.idea_store
|
|
97
97
|
best = store.best_ideas(limit: 3)
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
log.debug("[creativity] status: potential=#{creative_engine.creative_potential.round(3)} " \
|
|
100
|
+
"active=#{store.active_count}")
|
|
101
101
|
|
|
102
102
|
{
|
|
103
103
|
creative_potential: creative_engine.creative_potential.round(4),
|
|
@@ -110,7 +110,7 @@ module Legion
|
|
|
110
110
|
|
|
111
111
|
def creativity_stats(**)
|
|
112
112
|
store = creative_engine.idea_store
|
|
113
|
-
|
|
113
|
+
log.debug('[creativity] stats')
|
|
114
114
|
|
|
115
115
|
adopted = store.by_state(:adopted)
|
|
116
116
|
discarded = store.by_state(:discarded)
|
|
@@ -11,7 +11,9 @@ module Legion
|
|
|
11
11
|
attr_reader :dream_store
|
|
12
12
|
|
|
13
13
|
def initialize(memory: nil, identity: nil, emotion: nil, **)
|
|
14
|
-
@memory = memory || (
|
|
14
|
+
@memory = memory || (if defined?(Legion::Extensions::Agentic::Memory::Trace::Client)
|
|
15
|
+
Legion::Extensions::Agentic::Memory::Trace::Client.new
|
|
16
|
+
end)
|
|
15
17
|
@identity = identity || (Legion::Extensions::Identity::Client.new if defined?(Legion::Extensions::Identity::Client))
|
|
16
18
|
@emotion = emotion || (Legion::Extensions::Emotion::Client.new if defined?(Legion::Extensions::Emotion::Client))
|
|
17
19
|
@dream_store = Helpers::DreamStore.new
|
|
@@ -43,7 +43,7 @@ module Legion
|
|
|
43
43
|
|
|
44
44
|
depth_factor = depth / Constants::ASSOCIATION_WALK_HOPS.to_f
|
|
45
45
|
|
|
46
|
-
type_diversity = path.
|
|
46
|
+
type_diversity = path.filter_map { |id| store.get(id)&.dig(:trace_type) }.uniq.size
|
|
47
47
|
type_factor = type_diversity / path.size.to_f
|
|
48
48
|
|
|
49
49
|
((depth_factor * 0.4) + (type_factor * 0.6)).clamp(0.0, 1.0)
|
|
@@ -9,6 +9,8 @@ module Legion
|
|
|
9
9
|
module Dream
|
|
10
10
|
module Helpers
|
|
11
11
|
module DreamJournal
|
|
12
|
+
extend Legion::Logging::Helper
|
|
13
|
+
|
|
12
14
|
JOURNAL_DIR = File.join(Dir.pwd, 'logs', 'dreams')
|
|
13
15
|
|
|
14
16
|
module_function
|
|
@@ -22,10 +24,10 @@ module Legion
|
|
|
22
24
|
content = build_entry(results, phase_data, dream_store)
|
|
23
25
|
File.write(path, content)
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
log.info("[dream] journal written to #{path}")
|
|
26
28
|
path
|
|
27
29
|
rescue StandardError => e
|
|
28
|
-
|
|
30
|
+
log.warn("[dream] journal write failed: #{e.message}")
|
|
29
31
|
nil
|
|
30
32
|
end
|
|
31
33
|
|
|
@@ -56,7 +58,7 @@ module Legion
|
|
|
56
58
|
lines << '---'
|
|
57
59
|
lines << ''
|
|
58
60
|
rescue StandardError => e
|
|
59
|
-
|
|
61
|
+
log.debug("[dream] journal narrative skipped: #{e.message}")
|
|
60
62
|
end
|
|
61
63
|
|
|
62
64
|
def section_memory_audit(lines, results, phase_data)
|
|
@@ -17,7 +17,7 @@ module Legion
|
|
|
17
17
|
|
|
18
18
|
def available?
|
|
19
19
|
defined?(Legion::LLM) && Legion::LLM.respond_to?(:started?) && Legion::LLM.started?
|
|
20
|
-
rescue StandardError
|
|
20
|
+
rescue StandardError => _e
|
|
21
21
|
false
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -30,7 +30,7 @@ module Legion
|
|
|
30
30
|
response = llm_ask(prompt)
|
|
31
31
|
parse_contradiction_response(response, trace_a, trace_b)
|
|
32
32
|
rescue StandardError => e
|
|
33
|
-
|
|
33
|
+
log.warn("[dream:llm] contradiction resolution failed: #{e.message}")
|
|
34
34
|
nil
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -47,7 +47,7 @@ module Legion
|
|
|
47
47
|
response = llm_ask(prompt)
|
|
48
48
|
parse_agenda_response(response)
|
|
49
49
|
rescue StandardError => e
|
|
50
|
-
|
|
50
|
+
log.warn("[dream:llm] agenda synthesis failed: #{e.message}")
|
|
51
51
|
nil
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -59,7 +59,7 @@ module Legion
|
|
|
59
59
|
response = llm_ask(prompt)
|
|
60
60
|
response&.content
|
|
61
61
|
rescue StandardError => e
|
|
62
|
-
|
|
62
|
+
log.warn("[dream:llm] journal narration failed: #{e.message}")
|
|
63
63
|
nil
|
|
64
64
|
end
|
|
65
65
|
|
|
@@ -75,7 +75,7 @@ module Legion
|
|
|
75
75
|
content = response&.message&.dig(:content)
|
|
76
76
|
::Struct.new(:content).new(content) if content
|
|
77
77
|
else
|
|
78
|
-
chat =
|
|
78
|
+
chat = llm_chat
|
|
79
79
|
chat.with_instructions(DREAM_SYSTEM_PROMPT)
|
|
80
80
|
chat.ask(prompt)
|
|
81
81
|
end
|
|
@@ -86,7 +86,7 @@ module Legion
|
|
|
86
86
|
!!(defined?(Legion::LLM::Pipeline::GaiaCaller) &&
|
|
87
87
|
Legion::LLM.respond_to?(:pipeline_enabled?) &&
|
|
88
88
|
Legion::LLM.pipeline_enabled?)
|
|
89
|
-
rescue StandardError
|
|
89
|
+
rescue StandardError => _e
|
|
90
90
|
false
|
|
91
91
|
end
|
|
92
92
|
private_class_method :pipeline_available?
|
|
@@ -43,7 +43,7 @@ module Legion
|
|
|
43
43
|
results = {}
|
|
44
44
|
|
|
45
45
|
unless memory
|
|
46
|
-
|
|
46
|
+
log.warn('[dream] skipping cycle: lex-memory not available')
|
|
47
47
|
return { status: :skipped, reason: :memory_not_available }
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -51,13 +51,13 @@ module Legion
|
|
|
51
51
|
store = memory.send(:default_store)
|
|
52
52
|
store.reload if store.respond_to?(:reload)
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
log.info('[dream] cycle starting')
|
|
55
55
|
Helpers::Constants::DREAM_CYCLE_PHASES.each do |phase|
|
|
56
|
-
|
|
56
|
+
log.debug("[dream] starting phase: #{phase}")
|
|
57
57
|
results[phase] = send(:"phase_#{phase}")
|
|
58
58
|
rescue StandardError => e
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
log.error("[dream] phase #{phase} failed: #{e.message}")
|
|
60
|
+
log.error("[dream] #{e.backtrace&.first(3)&.join("\n")}")
|
|
61
61
|
results[phase] = { error: e.message }
|
|
62
62
|
end
|
|
63
63
|
# Flush cache-backed store after all phases
|
|
@@ -67,7 +67,7 @@ module Legion
|
|
|
67
67
|
# Write human-readable dream journal before clearing state
|
|
68
68
|
Helpers::DreamJournal.write_entry(results: results, phase_data: @phase_data, dream_store: dream_store)
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
log.info("[dream] cycle complete: #{results.keys.join(', ')}")
|
|
71
71
|
{ status: :completed, phases: results }
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -89,8 +89,8 @@ module Legion
|
|
|
89
89
|
unresolved = store.all_traces.select(&EMERGENT_UNRESOLVED)
|
|
90
90
|
@phase_data[:unresolved_traces] = unresolved
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
log.debug("[dream] memory_audit: decayed=#{decay_result[:decayed]} pruned=#{decay_result[:pruned]} " \
|
|
93
|
+
"migrated=#{migrate_result[:migrated]} candidates=#{candidates.size} unresolved=#{unresolved.size}")
|
|
94
94
|
{
|
|
95
95
|
decayed: decay_result[:decayed],
|
|
96
96
|
pruned: decay_result[:pruned],
|
|
@@ -124,7 +124,7 @@ module Legion
|
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
@phase_data[:walk_results] = results
|
|
127
|
-
|
|
127
|
+
log.debug("[dream] association_walk: start=#{start_trace[:trace_id][0..7]} results=#{results.size}")
|
|
128
128
|
{ walk_results: results, start_trace: start_trace[:trace_id] }
|
|
129
129
|
end
|
|
130
130
|
|
|
@@ -155,8 +155,8 @@ module Legion
|
|
|
155
155
|
|
|
156
156
|
@phase_data[:contradictions] = resolutions
|
|
157
157
|
resolved_count = resolutions.count { |r| r[:resolution] == :resolved }
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
log.debug("[dream] contradiction_resolution: detected=#{detected.size} " \
|
|
159
|
+
"resolved=#{resolved_count} llm=#{use_llm}")
|
|
160
160
|
{ detected: detected.size, resolutions: resolutions }
|
|
161
161
|
end
|
|
162
162
|
|
|
@@ -200,7 +200,7 @@ module Legion
|
|
|
200
200
|
|
|
201
201
|
def phase_identity_entropy_check(**)
|
|
202
202
|
unless identity
|
|
203
|
-
|
|
203
|
+
log.warn('[dream] skipping identity_entropy_check: lex-identity not available')
|
|
204
204
|
return { status: :skipped, reason: :identity_not_available }
|
|
205
205
|
end
|
|
206
206
|
|
|
@@ -211,7 +211,7 @@ module Legion
|
|
|
211
211
|
trend: result[:trend]
|
|
212
212
|
)
|
|
213
213
|
@phase_data[:entropy] = result
|
|
214
|
-
|
|
214
|
+
log.debug("[dream] identity_entropy: #{result[:classification]} trend=#{result[:trend]}")
|
|
215
215
|
result
|
|
216
216
|
end
|
|
217
217
|
|
|
@@ -245,17 +245,17 @@ module Legion
|
|
|
245
245
|
gap_result = Legion::Extensions::MindGrowth::Runners::DreamIdeation.dream_agenda_items
|
|
246
246
|
if gap_result[:success] && gap_result[:items]&.any?
|
|
247
247
|
items.concat(gap_result[:items])
|
|
248
|
-
|
|
248
|
+
log.debug("[dream] mind_growth injected #{gap_result[:count]} architectural gap items")
|
|
249
249
|
end
|
|
250
250
|
rescue StandardError => e
|
|
251
|
-
|
|
251
|
+
log.warn("[dream] mind_growth integration failed: #{e.message}")
|
|
252
252
|
end
|
|
253
253
|
end
|
|
254
254
|
|
|
255
255
|
items.each do |item|
|
|
256
256
|
dream_store.add_agenda_item(type: item[:type], content: item[:content], weight: item[:weight])
|
|
257
257
|
end
|
|
258
|
-
|
|
258
|
+
log.debug("[dream] agenda_formation: #{items.size} items (llm=#{Helpers::LlmEnhancer.available?})")
|
|
259
259
|
{ agenda_items: items.size }
|
|
260
260
|
end
|
|
261
261
|
|
|
@@ -276,7 +276,7 @@ module Legion
|
|
|
276
276
|
|
|
277
277
|
dream_store.expire_stale!
|
|
278
278
|
dream_store.clear
|
|
279
|
-
|
|
279
|
+
log.info("[dream] consolidation_commit: #{traces.size} traces written to memory")
|
|
280
280
|
{ traces_written: traces.size, dream_store_cleared: true }
|
|
281
281
|
end
|
|
282
282
|
|
|
@@ -286,10 +286,10 @@ module Legion
|
|
|
286
286
|
runner = Object.new.extend(Legion::Extensions::Apollo::Runners::Knowledge)
|
|
287
287
|
promoted = promote_novel_associations(runner) + promote_resolved_contradictions(runner)
|
|
288
288
|
|
|
289
|
-
|
|
289
|
+
log.debug("[dream] knowledge_promotion: promoted=#{promoted}")
|
|
290
290
|
{ promoted: promoted }
|
|
291
291
|
rescue StandardError => e
|
|
292
|
-
|
|
292
|
+
log.warn("[dream] knowledge_promotion failed: #{e.message}")
|
|
293
293
|
{ status: :error, error: e.message }
|
|
294
294
|
end
|
|
295
295
|
|
|
@@ -300,7 +300,7 @@ module Legion
|
|
|
300
300
|
result = reflection_runner.reflect(tick_results: @phase_data)
|
|
301
301
|
|
|
302
302
|
@phase_data[:dream_health] = result[:cognitive_health]
|
|
303
|
-
|
|
303
|
+
log.debug("[dream] dream_reflection: health=#{result[:cognitive_health]} reflections=#{result[:reflections_generated]}")
|
|
304
304
|
result
|
|
305
305
|
end
|
|
306
306
|
|
|
@@ -310,7 +310,7 @@ module Legion
|
|
|
310
310
|
narrator_runner = Object.new.extend(Legion::Extensions::Narrator::Runners::Narrator)
|
|
311
311
|
result = narrator_runner.narrate(tick_results: @phase_data, cognitive_state: { source: :dream })
|
|
312
312
|
|
|
313
|
-
|
|
313
|
+
log.debug("[dream] dream_narration: mood=#{result[:mood]}")
|
|
314
314
|
result
|
|
315
315
|
end
|
|
316
316
|
|
|
@@ -327,24 +327,24 @@ module Legion
|
|
|
327
327
|
end
|
|
328
328
|
|
|
329
329
|
def reflection_available?
|
|
330
|
-
Legion::Extensions.const_defined?(:Reflection) &&
|
|
331
|
-
Legion::Extensions::Reflection.const_defined?(:Runners) &&
|
|
332
|
-
Legion::Extensions::Reflection::Runners.const_defined?(:Reflection)
|
|
333
|
-
rescue StandardError
|
|
330
|
+
Legion::Extensions.const_defined?(:Reflection, false) &&
|
|
331
|
+
Legion::Extensions::Reflection.const_defined?(:Runners, false) &&
|
|
332
|
+
Legion::Extensions::Reflection::Runners.const_defined?(:Reflection, false)
|
|
333
|
+
rescue StandardError => _e
|
|
334
334
|
false
|
|
335
335
|
end
|
|
336
336
|
|
|
337
337
|
def narrator_available?
|
|
338
|
-
Legion::Extensions.const_defined?(:Narrator) &&
|
|
339
|
-
Legion::Extensions::Narrator.const_defined?(:Runners) &&
|
|
340
|
-
Legion::Extensions::Narrator::Runners.const_defined?(:Narrator)
|
|
341
|
-
rescue StandardError
|
|
338
|
+
Legion::Extensions.const_defined?(:Narrator, false) &&
|
|
339
|
+
Legion::Extensions::Narrator.const_defined?(:Runners, false) &&
|
|
340
|
+
Legion::Extensions::Narrator::Runners.const_defined?(:Narrator, false)
|
|
341
|
+
rescue StandardError => _e
|
|
342
342
|
false
|
|
343
343
|
end
|
|
344
344
|
|
|
345
345
|
def mind_growth_available?
|
|
346
346
|
defined?(Legion::Extensions::MindGrowth::Runners::DreamIdeation)
|
|
347
|
-
rescue StandardError
|
|
347
|
+
rescue StandardError => _e
|
|
348
348
|
false
|
|
349
349
|
end
|
|
350
350
|
|
|
@@ -357,7 +357,7 @@ module Legion
|
|
|
357
357
|
path_traces = walk[:path]&.filter_map { |id| store.get(id) }
|
|
358
358
|
next if path_traces.size < 2
|
|
359
359
|
|
|
360
|
-
payloads = path_traces.
|
|
360
|
+
payloads = path_traces.filter_map { |t| summarize_trace_payload(t) }
|
|
361
361
|
next if payloads.empty?
|
|
362
362
|
|
|
363
363
|
knowledge_runner.handle_ingest(
|
|
@@ -396,7 +396,7 @@ module Legion
|
|
|
396
396
|
def apollo_available?
|
|
397
397
|
defined?(Legion::Extensions::Apollo::Runners::Knowledge) &&
|
|
398
398
|
defined?(Legion::Data::Model::ApolloEntry)
|
|
399
|
-
rescue StandardError
|
|
399
|
+
rescue StandardError => _e
|
|
400
400
|
false
|
|
401
401
|
end
|
|
402
402
|
|
|
@@ -5,7 +5,7 @@ module Legion
|
|
|
5
5
|
module Agentic
|
|
6
6
|
module Imagination
|
|
7
7
|
module EmbodiedSimulation
|
|
8
|
-
module
|
|
8
|
+
module Actor
|
|
9
9
|
class Maintenance < Legion::Extensions::Actors::Every
|
|
10
10
|
def runner_class = Runners::EmbodiedSimulation
|
|
11
11
|
def runner_function = 'update_embodied_simulation'
|