lex-agentic-learning 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/lib/legion/extensions/agentic/learning/curiosity/runners/curiosity.rb +7 -6
- data/lib/legion/extensions/agentic/learning/outcome_listener/runners/outcome_listener.rb +9 -5
- data/lib/legion/extensions/agentic/learning/version.rb +1 -1
- data/spec/legion/extensions/agentic/learning/curiosity/runners/curiosity_spec.rb +54 -0
- data/spec/legion/extensions/agentic/learning/outcome_listener/runners/outcome_listener_spec.rb +60 -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: 0b9c9e5ffb94a852f69565d33096e38bc7314620ce3eb227c38f062b8ea79a13
|
|
4
|
+
data.tar.gz: a305ff18874b4ebac3878db8f18304f24c5a2f9575a5711d9bd73015b2dd6ee3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78c10230805690d2207721eb815a8bce9bcbbc2c1d4c571d5c417dbd5d1480de5ce059fae848a6415d2a04c0c5bfbf9427ea2942f3d7f70c4a1f54e86277d987
|
|
7
|
+
data.tar.gz: 7fa6dce7d74b53af81283e29dc590697fd746321f031abe48d4b34f9d5c9c58c0f07eab6725e5b84dcec0abb94cbb15bcea7e529bc28ad960619f8490867709a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.12] - 2026-05-15
|
|
4
|
+
### Fixed
|
|
5
|
+
- Curiosity `store_insight_in_apollo` now calls `Legion::Apollo.ingest` directly (replacing `Legion::Extensions::Apollo.store` which was a non-existent method and silently failed on every call); adds `access_scope: 'private'` and `identity_principal_id: nil`.
|
|
6
|
+
- OutcomeListener `write_apollo_lesson` now calls `Legion::Apollo.ingest` directly (replacing `ingest_knowledge(content: ...)` which was a dormant `ArgumentError` in Ruby 3.x due to missing positional arg); adds `access_scope: 'private'` and `identity_principal_id: nil`.
|
|
7
|
+
|
|
3
8
|
## [0.1.11] - 2026-05-07
|
|
4
9
|
### Fixed
|
|
5
10
|
- Curiosity self-inquiry now uses native `Legion::LLM.chat` response hashes directly and avoids obsolete legacy LLM fallback calls after native chat succeeds.
|
|
@@ -177,15 +177,16 @@ module Legion
|
|
|
177
177
|
end
|
|
178
178
|
|
|
179
179
|
def store_insight_in_apollo(question, insight, domain)
|
|
180
|
-
return unless defined?(Legion::
|
|
180
|
+
return unless defined?(Legion::Apollo)
|
|
181
181
|
|
|
182
|
-
Legion::
|
|
183
|
-
content:
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
Legion::Apollo.ingest( # rubocop:disable Legion/HelperMigration/DirectKnowledge
|
|
183
|
+
content: "Self-inquiry insight [#{domain}]: #{question}\n\n#{insight}",
|
|
184
|
+
tags: ['gaia-self-inquiry', "domain-#{domain}", 'autonomous-thought'],
|
|
185
|
+
access_scope: 'private',
|
|
186
|
+
identity_principal_id: nil
|
|
186
187
|
)
|
|
187
188
|
rescue StandardError => e
|
|
188
|
-
log.warn "[curiosity:self_inquiry] Apollo
|
|
189
|
+
log.warn "[curiosity:self_inquiry] Apollo ingest failed: #{e.class}: #{e.message}"
|
|
189
190
|
end
|
|
190
191
|
|
|
191
192
|
def create_wonders_from_gaps(gaps)
|
|
@@ -83,11 +83,15 @@ module Legion
|
|
|
83
83
|
def write_apollo_lesson(lesson, source_agent)
|
|
84
84
|
return unless defined?(Legion::Apollo)
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
Legion::Apollo.ingest( # rubocop:disable Legion/HelperMigration/DirectKnowledge
|
|
87
|
+
content: json_generate(lesson),
|
|
88
|
+
tags: ['task_outcome', lesson[:domain]].compact,
|
|
89
|
+
source_agent: source_agent,
|
|
90
|
+
access_scope: 'private',
|
|
91
|
+
content_type: 'task_outcome_lesson',
|
|
92
|
+
knowledge_domain: 'learning',
|
|
93
|
+
identity_principal_id: nil
|
|
94
|
+
)
|
|
91
95
|
rescue StandardError => e
|
|
92
96
|
log.warn "[outcome_listener] apollo write failed: #{e.message}"
|
|
93
97
|
end
|
|
@@ -199,4 +199,58 @@ RSpec.describe Legion::Extensions::Agentic::Learning::Curiosity::Runners::Curios
|
|
|
199
199
|
expect(client.send(:query_llm_for_wonder, 'why?', :curiosity)).to be_nil
|
|
200
200
|
end
|
|
201
201
|
end
|
|
202
|
+
|
|
203
|
+
describe '#store_insight_in_apollo' do
|
|
204
|
+
before do
|
|
205
|
+
mock_apollo = Module.new do
|
|
206
|
+
def self.started?
|
|
207
|
+
true
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def self.ingest(**)
|
|
211
|
+
{ success: true }
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
stub_const('Legion::Apollo', mock_apollo)
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
it 'passes access_scope: private to Legion::Apollo.ingest' do
|
|
218
|
+
allow(Legion::Apollo).to receive(:ingest).and_return({ success: true })
|
|
219
|
+
client.send(:store_insight_in_apollo, 'How does Consul ACL work?', 'found it', 'consul')
|
|
220
|
+
expect(Legion::Apollo).to have_received(:ingest).with(
|
|
221
|
+
hash_including(access_scope: 'private')
|
|
222
|
+
)
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
it 'includes the domain and question in the ingested content' do
|
|
226
|
+
allow(Legion::Apollo).to receive(:ingest).and_return({ success: true })
|
|
227
|
+
client.send(:store_insight_in_apollo, 'What is raft?', 'distributed consensus', 'distributed_systems')
|
|
228
|
+
expect(Legion::Apollo).to have_received(:ingest).with(
|
|
229
|
+
hash_including(
|
|
230
|
+
content: a_string_including('distributed_systems'),
|
|
231
|
+
tags: array_including('gaia-self-inquiry', 'domain-distributed_systems')
|
|
232
|
+
)
|
|
233
|
+
)
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
it 'is a no-op when Legion::Apollo is not defined' do
|
|
237
|
+
hide_const('Legion::Apollo')
|
|
238
|
+
expect { client.send(:store_insight_in_apollo, 'q?', 'insight', 'test') }.not_to raise_error
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
it 'does not inject process identity as the owner' do
|
|
242
|
+
stub_const('Legion::Identity::Process', Module.new do
|
|
243
|
+
extend self
|
|
244
|
+
|
|
245
|
+
define_method(:identity_hash) do
|
|
246
|
+
{ canonical_name: 'daemon', db_principal_id: 999, db_identity_id: 888 }
|
|
247
|
+
end
|
|
248
|
+
end)
|
|
249
|
+
allow(Legion::Apollo).to receive(:ingest).and_return({ success: true })
|
|
250
|
+
client.send(:store_insight_in_apollo, 'q?', 'insight', 'test')
|
|
251
|
+
expect(Legion::Apollo).to have_received(:ingest).with(
|
|
252
|
+
hash_including(identity_principal_id: nil)
|
|
253
|
+
)
|
|
254
|
+
end
|
|
255
|
+
end
|
|
202
256
|
end
|
data/spec/legion/extensions/agentic/learning/outcome_listener/runners/outcome_listener_spec.rb
CHANGED
|
@@ -115,4 +115,64 @@ RSpec.describe Legion::Extensions::Agentic::Learning::OutcomeListener::Runners::
|
|
|
115
115
|
expect(result[:domain]).to eq('unknown')
|
|
116
116
|
end
|
|
117
117
|
end
|
|
118
|
+
|
|
119
|
+
describe '#write_apollo_lesson' do
|
|
120
|
+
let(:lesson) do
|
|
121
|
+
{ runner_class: 'Http::Get', function: 'fetch', status: 'task.completed',
|
|
122
|
+
domain: 'http', success: true, confidence: 0.8 }
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
before do
|
|
126
|
+
mock_apollo = Module.new do
|
|
127
|
+
def self.ingest(**)
|
|
128
|
+
{ success: true }
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
stub_const('Legion::Apollo', mock_apollo)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
it 'passes access_scope: private to Legion::Apollo.ingest' do
|
|
135
|
+
allow(Legion::Apollo).to receive(:ingest).and_return({ success: true })
|
|
136
|
+
client.send(:write_apollo_lesson, lesson, 'agent-1')
|
|
137
|
+
expect(Legion::Apollo).to have_received(:ingest).with(
|
|
138
|
+
hash_including(access_scope: 'private')
|
|
139
|
+
)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
it 'includes source_agent in the ingest call' do
|
|
143
|
+
allow(Legion::Apollo).to receive(:ingest).and_return({ success: true })
|
|
144
|
+
client.send(:write_apollo_lesson, lesson, 'agent-99')
|
|
145
|
+
expect(Legion::Apollo).to have_received(:ingest).with(
|
|
146
|
+
hash_including(source_agent: 'agent-99')
|
|
147
|
+
)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
it 'tags the entry with task_outcome and domain' do
|
|
151
|
+
allow(Legion::Apollo).to receive(:ingest).and_return({ success: true })
|
|
152
|
+
client.send(:write_apollo_lesson, lesson, 'agent-1')
|
|
153
|
+
expect(Legion::Apollo).to have_received(:ingest).with(
|
|
154
|
+
hash_including(tags: array_including('task_outcome', 'http'))
|
|
155
|
+
)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
it 'is a no-op when Legion::Apollo is not defined' do
|
|
159
|
+
hide_const('Legion::Apollo')
|
|
160
|
+
expect { client.send(:write_apollo_lesson, lesson, 'agent-1') }.not_to raise_error
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
it 'does not inject process identity as the owner' do
|
|
164
|
+
stub_const('Legion::Identity::Process', Module.new do
|
|
165
|
+
extend self
|
|
166
|
+
|
|
167
|
+
define_method(:identity_hash) do
|
|
168
|
+
{ canonical_name: 'daemon', db_principal_id: 999, db_identity_id: 888 }
|
|
169
|
+
end
|
|
170
|
+
end)
|
|
171
|
+
allow(Legion::Apollo).to receive(:ingest).and_return({ success: true })
|
|
172
|
+
client.send(:write_apollo_lesson, lesson, 'agent-1')
|
|
173
|
+
expect(Legion::Apollo).to have_received(:ingest).with(
|
|
174
|
+
hash_including(identity_principal_id: nil)
|
|
175
|
+
)
|
|
176
|
+
end
|
|
177
|
+
end
|
|
118
178
|
end
|