legion-gaia 0.9.34 → 0.9.35
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 +9 -0
- data/lib/legion/gaia/phase_wiring.rb +7 -2
- data/lib/legion/gaia/version.rb +1 -1
- data/lib/legion/gaia.rb +54 -2
- 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: 9f1661be962f2fe037dfbb365b307cb39f9c45f50e7e10c788e64ff8233ea7d6
|
|
4
|
+
data.tar.gz: fad2dfbeeb773261f6cfe8a7cd15999af7dcc9e392d7921b02bb6027cf65d5c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ddb3eabbf3d0cde1db6f6d310be667f6085e6403c6313b6471623a006383d5a7ff3720bf23a55dd91d14a53f868fe23fff74b2eb6aef11cb9b1f685bfec0a62
|
|
7
|
+
data.tar.gz: 7446c87dae688940e8e3ba6cae5f67103320cc81ce4ff38c4b1e95254f1bfc13a2ce8da9e359550bcaa0c6afe5b958b2d980f8ab771b261ceb37432e7ca05cea
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- observe_interlocutor: calibration evaluation on partner messages (content, latency, baseline tracking)
|
|
7
|
+
- record_advisory_meta: public API for LLM pipeline to record advisory types
|
|
8
|
+
- compute_response_latency: tracks time between GAIA response and next partner message
|
|
9
|
+
- partner_reflection: multi-handler — reflect_on_bonds + sync_partner_knowledge (CalibrationRunner)
|
|
10
|
+
- TrackerPersistence: calibration_store registered for automatic flush/hydrate
|
|
11
|
+
|
|
3
12
|
## [0.9.34] - 2026-03-31
|
|
4
13
|
|
|
5
14
|
### Added
|
|
@@ -36,7 +36,10 @@ module Legion
|
|
|
36
36
|
consolidation_commit: { ext: :Memory, runner: :Consolidation, fn: :migrate_tier },
|
|
37
37
|
knowledge_promotion: { ext: :Apollo, runner: :Knowledge, fn: :handle_ingest },
|
|
38
38
|
dream_reflection: { ext: :Reflection, runner: :Reflection, fn: :reflect },
|
|
39
|
-
partner_reflection:
|
|
39
|
+
partner_reflection: [
|
|
40
|
+
{ ext: :Social, runner: :Attachment, fn: :reflect_on_bonds },
|
|
41
|
+
{ ext: :Social, runner: :Calibration, fn: :sync_partner_knowledge }
|
|
42
|
+
],
|
|
40
43
|
dream_narration: { ext: :Narrator, runner: :Narrator, fn: :narrate }
|
|
41
44
|
}.freeze
|
|
42
45
|
|
|
@@ -81,9 +84,11 @@ module Legion
|
|
|
81
84
|
},
|
|
82
85
|
gut_instinct: ->(ctx) { { valences: ctx[:valences] || [] } },
|
|
83
86
|
action_selection: lambda { |ctx|
|
|
87
|
+
pr = ctx.dig(:prior_results, :partner_reflection)
|
|
88
|
+
bond_state = pr.is_a?(Array) ? (pr.find { |r| r.is_a?(Hash) } || {}) : (pr || {})
|
|
84
89
|
{ tick_results: ctx[:prior_results] || {},
|
|
85
90
|
cognitive_state: {},
|
|
86
|
-
bond_state:
|
|
91
|
+
bond_state: bond_state }
|
|
87
92
|
},
|
|
88
93
|
working_memory_integration: ->(ctx) { { prior_results: ctx[:prior_results] || {} } },
|
|
89
94
|
memory_consolidation: ->(_ctx) { {} },
|
data/lib/legion/gaia/version.rb
CHANGED
data/lib/legion/gaia.rb
CHANGED
|
@@ -95,6 +95,7 @@ module Legion
|
|
|
95
95
|
@partner_observations = nil
|
|
96
96
|
@partner_absence_misses = 0
|
|
97
97
|
@last_valences = nil
|
|
98
|
+
@last_response_at = nil
|
|
98
99
|
|
|
99
100
|
log_info 'Legion::Gaia shut down'
|
|
100
101
|
end
|
|
@@ -174,6 +175,8 @@ module Legion
|
|
|
174
175
|
end
|
|
175
176
|
|
|
176
177
|
def respond(content:, channel_id:, in_reply_to: nil, session_continuity_id: nil, metadata: {})
|
|
178
|
+
@last_response_at = Time.now.utc
|
|
179
|
+
|
|
177
180
|
frame = OutputFrame.new(
|
|
178
181
|
content: content,
|
|
179
182
|
channel_id: channel_id,
|
|
@@ -189,6 +192,18 @@ module Legion
|
|
|
189
192
|
end
|
|
190
193
|
end
|
|
191
194
|
|
|
195
|
+
def record_advisory_meta(advisory_id:, advisory_types:)
|
|
196
|
+
return unless started?
|
|
197
|
+
|
|
198
|
+
@last_response_at = Time.now.utc
|
|
199
|
+
return unless defined?(Legion::Extensions::Agentic::Social::Calibration::Runners::Calibration)
|
|
200
|
+
|
|
201
|
+
ensure_calibration_runner
|
|
202
|
+
@calibration_runner.record_advisory_meta(advisory_id: advisory_id, advisory_types: advisory_types)
|
|
203
|
+
rescue StandardError => e
|
|
204
|
+
log_warn "record_advisory_meta error: #{e.message}"
|
|
205
|
+
end
|
|
206
|
+
|
|
192
207
|
def status
|
|
193
208
|
return { started: false } unless started?
|
|
194
209
|
|
|
@@ -311,15 +326,20 @@ module Legion
|
|
|
311
326
|
bond_role: role,
|
|
312
327
|
channel: input_frame.channel_id,
|
|
313
328
|
content_type: input_frame.content_type,
|
|
329
|
+
content: input_frame.content.to_s,
|
|
314
330
|
content_length: input_frame.content.to_s.length,
|
|
315
331
|
direct_address: input_frame.metadata[:direct_address] || false,
|
|
332
|
+
latency: compute_response_latency,
|
|
316
333
|
timestamp: input_frame.received_at
|
|
317
334
|
}
|
|
318
335
|
|
|
319
336
|
@partner_observations ||= []
|
|
320
337
|
@partner_observations.push(observation)
|
|
321
338
|
|
|
322
|
-
|
|
339
|
+
if role == :partner
|
|
340
|
+
record_interaction_trace(observation)
|
|
341
|
+
evaluate_calibration(observation)
|
|
342
|
+
end
|
|
323
343
|
rescue StandardError => e
|
|
324
344
|
log_warn "observe_interlocutor error: #{e.message}"
|
|
325
345
|
end
|
|
@@ -355,6 +375,35 @@ module Legion
|
|
|
355
375
|
nil
|
|
356
376
|
end
|
|
357
377
|
|
|
378
|
+
def evaluate_calibration(observation)
|
|
379
|
+
return unless defined?(Legion::Extensions::Agentic::Social::Calibration::Runners::Calibration)
|
|
380
|
+
|
|
381
|
+
ensure_calibration_runner
|
|
382
|
+
result = @calibration_runner.update_calibration(observation: observation)
|
|
383
|
+
@last_calibration_deltas = result[:deltas] if result[:success] && result[:deltas]
|
|
384
|
+
rescue StandardError => e
|
|
385
|
+
log_warn "evaluate_calibration error: #{e.message}"
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
def ensure_calibration_runner
|
|
389
|
+
return if @calibration_runner
|
|
390
|
+
|
|
391
|
+
runner = Object.new
|
|
392
|
+
runner.extend(Legion::Extensions::Agentic::Social::Calibration::Runners::Calibration)
|
|
393
|
+
TrackerPersistence.register_tracker(
|
|
394
|
+
:calibration,
|
|
395
|
+
tracker: runner.send(:calibration_store),
|
|
396
|
+
tags: %w[bond calibration]
|
|
397
|
+
)
|
|
398
|
+
@calibration_runner = runner
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
def compute_response_latency
|
|
402
|
+
return nil unless @last_response_at
|
|
403
|
+
|
|
404
|
+
(Time.now.utc - @last_response_at).to_f
|
|
405
|
+
end
|
|
406
|
+
|
|
358
407
|
def check_partner_absence(observations, phase_handlers)
|
|
359
408
|
has_partner = observations.any? { |o| o[:bond_role] == :partner }
|
|
360
409
|
|
|
@@ -445,8 +494,11 @@ module Legion
|
|
|
445
494
|
def process_dream_proactive(dream_results)
|
|
446
495
|
return unless dream_results.is_a?(Hash)
|
|
447
496
|
|
|
497
|
+
pr = dream_results[:partner_reflection]
|
|
498
|
+
partner_reflection_hash = pr.is_a?(Array) ? pr.find { |r| r.is_a?(Hash) } : pr
|
|
499
|
+
|
|
448
500
|
intent = dream_results.dig(:action_selection, :proactive_outreach) ||
|
|
449
|
-
|
|
501
|
+
partner_reflection_hash&.dig(:proactive_suggestion)
|
|
450
502
|
return unless intent
|
|
451
503
|
|
|
452
504
|
proactive_dispatcher.queue_intent(intent)
|