lex-agentic-imagination 0.1.5 → 0.1.8
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 +17 -0
- data/lib/legion/extensions/agentic/imagination/alchemy/helpers/constants.rb +2 -2
- data/lib/legion/extensions/agentic/imagination/constellation/helpers/constants.rb +2 -2
- data/lib/legion/extensions/agentic/imagination/dream/helpers/llm_enhancer.rb +22 -3
- data/lib/legion/extensions/agentic/imagination/dream/runners/dream_cycle.rb +19 -0
- data/lib/legion/extensions/agentic/imagination/garden/helpers/constants.rb +2 -2
- data/lib/legion/extensions/agentic/imagination/version.rb +1 -1
- data/spec/legion/extensions/agentic/imagination/dream/runners/dream_cycle_spec.rb +48 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e50d0cb324b64593bf8ac064273feba7c453af93923ab022025bcc2d0f07afad
|
|
4
|
+
data.tar.gz: 1b75ce86a846fa3fd91c119ef0934702ca21b79eab9da0e34cfdb25440ee2f24
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ea955c3ead922c989acbfaf189c402488a79cd58da007c1d3ab02986b88099fe117d87c2f1950eff0f3bfbc9571c5b05fa3b6a707231cbb01b2f16e257c5f86
|
|
7
|
+
data.tar.gz: a4be072f0d3b3654fef4bd89a6308f0000543888ef164cf8877901bd50d5d10e0c69dfe0d15eb0612e2c6ef6a76f4513416802dad75e9497dea42d1937490cfc
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.8] - 2026-03-24
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Remove redundant parentheses around beginless ranges in alchemy, constellation, and garden constants (rubocop Style/RedundantParentheses)
|
|
7
|
+
|
|
8
|
+
## [0.1.7] - 2026-03-24
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Mind Growth integration in `phase_agenda_formation`: calls `MindGrowth::Runners::DreamIdeation.dream_agenda_items` when available and injects architectural gap items into the dream agenda
|
|
12
|
+
- `mind_growth_available?` private guard method using `defined?()` for safe optional dependency check
|
|
13
|
+
- Errors from MindGrowth are rescued and logged as warnings so agenda formation always continues
|
|
14
|
+
|
|
15
|
+
## [0.1.6] - 2026-03-23
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- route llm calls through pipeline when available, add caller identity for attribution
|
|
19
|
+
|
|
3
20
|
## [0.1.5] - 2026-03-23
|
|
4
21
|
|
|
5
22
|
### Added
|
|
@@ -51,7 +51,7 @@ module Legion
|
|
|
51
51
|
[(0.6...0.8), :argentum],
|
|
52
52
|
[(0.4...0.6), :cuprum],
|
|
53
53
|
[(0.2...0.4), :ferrum],
|
|
54
|
-
[
|
|
54
|
+
[..0.2, :plumbum]
|
|
55
55
|
].freeze
|
|
56
56
|
|
|
57
57
|
# Potency labels
|
|
@@ -60,7 +60,7 @@ module Legion
|
|
|
60
60
|
[(0.6...0.8), :potent],
|
|
61
61
|
[(0.4...0.6), :moderate],
|
|
62
62
|
[(0.2...0.4), :weak],
|
|
63
|
-
[
|
|
63
|
+
[..0.2, :inert]
|
|
64
64
|
].freeze
|
|
65
65
|
|
|
66
66
|
def self.label_for(table, value)
|
|
@@ -34,7 +34,7 @@ module Legion
|
|
|
34
34
|
[(0.6...0.8), :giant],
|
|
35
35
|
[(0.4...0.6), :main_sequence],
|
|
36
36
|
[(0.2...0.4), :dwarf],
|
|
37
|
-
[
|
|
37
|
+
[..0.2, :brown_dwarf]
|
|
38
38
|
].freeze
|
|
39
39
|
|
|
40
40
|
# Constellation maturity labels
|
|
@@ -43,7 +43,7 @@ module Legion
|
|
|
43
43
|
[(0.6...0.8), :established],
|
|
44
44
|
[(0.4...0.6), :forming],
|
|
45
45
|
[(0.2...0.4), :nascent],
|
|
46
|
-
[
|
|
46
|
+
[..0.2, :proto]
|
|
47
47
|
].freeze
|
|
48
48
|
|
|
49
49
|
def self.label_for(table, value)
|
|
@@ -66,12 +66,31 @@ module Legion
|
|
|
66
66
|
# --- Private helpers ---
|
|
67
67
|
|
|
68
68
|
def llm_ask(prompt)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
if pipeline_available?
|
|
70
|
+
response = Legion::LLM::Pipeline::GaiaCaller.chat(
|
|
71
|
+
message: prompt,
|
|
72
|
+
phase: 'dream',
|
|
73
|
+
caller: { extension: 'lex-agentic-imagination', mode: :dream }
|
|
74
|
+
)
|
|
75
|
+
content = response&.message&.dig(:content)
|
|
76
|
+
::Struct.new(:content).new(content) if content
|
|
77
|
+
else
|
|
78
|
+
chat = Legion::LLM.chat
|
|
79
|
+
chat.with_instructions(DREAM_SYSTEM_PROMPT)
|
|
80
|
+
chat.ask(prompt)
|
|
81
|
+
end
|
|
72
82
|
end
|
|
73
83
|
private_class_method :llm_ask
|
|
74
84
|
|
|
85
|
+
def pipeline_available?
|
|
86
|
+
!!(defined?(Legion::LLM::Pipeline::GaiaCaller) &&
|
|
87
|
+
Legion::LLM.respond_to?(:pipeline_enabled?) &&
|
|
88
|
+
Legion::LLM.pipeline_enabled?)
|
|
89
|
+
rescue StandardError
|
|
90
|
+
false
|
|
91
|
+
end
|
|
92
|
+
private_class_method :pipeline_available?
|
|
93
|
+
|
|
75
94
|
def build_contradiction_prompt(trace_a, trace_b, strategy)
|
|
76
95
|
<<~PROMPT
|
|
77
96
|
Two memory traces in domain "#{(trace_a[:domain_tags] & trace_b[:domain_tags]).first}" contradict each other.
|
|
@@ -239,6 +239,19 @@ module Legion
|
|
|
239
239
|
entropy: entropy
|
|
240
240
|
)
|
|
241
241
|
|
|
242
|
+
# Mind Growth integration: inject architectural gap agenda items during dreams
|
|
243
|
+
if mind_growth_available?
|
|
244
|
+
begin
|
|
245
|
+
gap_result = Legion::Extensions::MindGrowth::Runners::DreamIdeation.dream_agenda_items
|
|
246
|
+
if gap_result[:success] && gap_result[:items]&.any?
|
|
247
|
+
items.concat(gap_result[:items])
|
|
248
|
+
Legion::Logging.debug "[dream] mind_growth injected #{gap_result[:count]} architectural gap items"
|
|
249
|
+
end
|
|
250
|
+
rescue StandardError => e
|
|
251
|
+
Legion::Logging.warn "[dream] mind_growth integration failed: #{e.message}"
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
242
255
|
items.each do |item|
|
|
243
256
|
dream_store.add_agenda_item(type: item[:type], content: item[:content], weight: item[:weight])
|
|
244
257
|
end
|
|
@@ -329,6 +342,12 @@ module Legion
|
|
|
329
342
|
false
|
|
330
343
|
end
|
|
331
344
|
|
|
345
|
+
def mind_growth_available?
|
|
346
|
+
defined?(Legion::Extensions::MindGrowth::Runners::DreamIdeation)
|
|
347
|
+
rescue StandardError
|
|
348
|
+
false
|
|
349
|
+
end
|
|
350
|
+
|
|
332
351
|
def promote_novel_associations(knowledge_runner)
|
|
333
352
|
walk_results = @phase_data[:walk_results] || []
|
|
334
353
|
store = memory.send(:default_store)
|
|
@@ -25,7 +25,7 @@ module Legion
|
|
|
25
25
|
[(0.6...0.8), :thriving],
|
|
26
26
|
[(0.4...0.6), :growing],
|
|
27
27
|
[(0.2...0.4), :wilting],
|
|
28
|
-
[
|
|
28
|
+
[..0.2, :withered]
|
|
29
29
|
].freeze
|
|
30
30
|
|
|
31
31
|
FERTILITY_LABELS = [
|
|
@@ -33,7 +33,7 @@ module Legion
|
|
|
33
33
|
[(0.6...0.8), :rich],
|
|
34
34
|
[(0.4...0.6), :adequate],
|
|
35
35
|
[(0.2...0.4), :poor],
|
|
36
|
-
[
|
|
36
|
+
[..0.2, :barren]
|
|
37
37
|
].freeze
|
|
38
38
|
|
|
39
39
|
def self.label_for(table, value)
|
|
@@ -105,6 +105,54 @@ RSpec.describe Legion::Extensions::Agentic::Imagination::Dream::Runners::DreamCy
|
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
+
describe '#phase_agenda_formation mind_growth integration' do
|
|
109
|
+
before do
|
|
110
|
+
client.phase_memory_audit
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
context 'when MindGrowth is available and returns gap items' do
|
|
114
|
+
let(:gap_items) { [{ type: :curious, content: { description: 'missing module' }, weight: 0.7 }] }
|
|
115
|
+
|
|
116
|
+
before do
|
|
117
|
+
stub_const('Legion::Extensions::MindGrowth::Runners::DreamIdeation', Class.new)
|
|
118
|
+
allow(Legion::Extensions::MindGrowth::Runners::DreamIdeation)
|
|
119
|
+
.to receive(:dream_agenda_items)
|
|
120
|
+
.and_return({ success: true, items: gap_items, count: 1 })
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it 'injects gap items into the agenda' do
|
|
124
|
+
result = client.phase_agenda_formation
|
|
125
|
+
expect(result[:agenda_items]).to be >= 1
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
it 'calls dream_agenda_items on DreamIdeation' do
|
|
129
|
+
client.phase_agenda_formation
|
|
130
|
+
expect(Legion::Extensions::MindGrowth::Runners::DreamIdeation).to have_received(:dream_agenda_items)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
context 'when MindGrowth is not defined' do
|
|
135
|
+
it 'builds agenda without error' do
|
|
136
|
+
result = client.phase_agenda_formation
|
|
137
|
+
expect(result).to have_key(:agenda_items)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
context 'when MindGrowth raises an error' do
|
|
142
|
+
before do
|
|
143
|
+
stub_const('Legion::Extensions::MindGrowth::Runners::DreamIdeation', Class.new)
|
|
144
|
+
allow(Legion::Extensions::MindGrowth::Runners::DreamIdeation)
|
|
145
|
+
.to receive(:dream_agenda_items)
|
|
146
|
+
.and_raise(StandardError, 'connection refused')
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
it 'rescues the error and agenda formation continues' do
|
|
150
|
+
result = client.phase_agenda_formation
|
|
151
|
+
expect(result).to have_key(:agenda_items)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
108
156
|
describe '#phase_consolidation_commit' do
|
|
109
157
|
it 'writes agenda traces to memory and clears dream store' do
|
|
110
158
|
client.dream_store.add_agenda_item(type: :curious, content: { path: %w[a b] }, weight: 0.8)
|