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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98b0f0afb82cb17c9db706827d06ce2f27e9a69c590170b720bfa986bcb5529d
4
- data.tar.gz: d985458466141a279fe4c0b79aaeccf168b15246f6863e2ff7181bf90d88bb31
3
+ metadata.gz: 0b9c9e5ffb94a852f69565d33096e38bc7314620ce3eb227c38f062b8ea79a13
4
+ data.tar.gz: a305ff18874b4ebac3878db8f18304f24c5a2f9575a5711d9bd73015b2dd6ee3
5
5
  SHA512:
6
- metadata.gz: 3bf9d04bee2e5d19aba000ec08d043caa79fd704eea2414adcb89277a88e655784933bc5a358415a3d5a7319b3cc044bee04cc3fd6d2ab6fb74b4f932c3eac1b
7
- data.tar.gz: 92193dbf3ffb4efeb3ec9c52751888a3798764652f75bee7b610e8b91e743fc27f286cbbef65eff134fe1adce4c478c6022fe6c650118cfa331f1160b736e122
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::Extensions::Apollo)
180
+ return unless defined?(Legion::Apollo)
181
181
 
182
- Legion::Extensions::Apollo.store(
183
- content: "Self-inquiry insight [#{domain}]: #{question}\n\n#{insight}",
184
- content_type: :observation,
185
- tags: ['gaia-self-inquiry', "domain-#{domain}", 'autonomous-thought']
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 store failed: #{e.class}: #{e.message}"
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
- ingest_knowledge(content: json_generate(lesson),
87
- content_type: 'task_outcome_lesson',
88
- tags: ['task_outcome', lesson[:domain]],
89
- source_agent: source_agent,
90
- knowledge_domain: 'learning')
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
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Agentic
6
6
  module Learning
7
- VERSION = '0.1.11'
7
+ VERSION = '0.1.12'
8
8
  end
9
9
  end
10
10
  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
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-agentic-learning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity