lex-agentic-self 0.1.13 → 0.1.14

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: 86842222337e93a3e159eff411592f845792f5fde64fb32691feed47fff7ef7b
4
- data.tar.gz: 440179ab3ad0a8dde91657cd0e2955a2dae16a2e50fdcdd99b7aff163fcda232
3
+ metadata.gz: 53c28592aa4721c2cc7901452451b9836cad8d3ded37f83c2a8dc04aac3ba1f8
4
+ data.tar.gz: 29a423e61504f68cf11fd8c234f29b0d4ff654e33ea5651fd2d7739656cfb9ab
5
5
  SHA512:
6
- metadata.gz: b180e99b145fc1f272cb29fafa7d09d28fa9b26aa3f5d56b11e6ab3263a31062234625f921ddd2eed47e891063aae2607298cdca21967b28f6072add6efb5184
7
- data.tar.gz: 84e76ec6b1d8a781ce47f91c63218fefcc6a641068ec76bc0ec1e32aeb30f8da1869737b11c74a015a859b814f1bb69f3af3d2557483fd37970fdf3df24fd858
6
+ metadata.gz: 38e5b0225a70847a4fb4a8d2f323f1bf1174004f16643deca0fca3567970f16fb5ee722e5e974051b42aff17c7dbb4ccdf7d1c403651c9d4228f3dec4433f7ca
7
+ data.tar.gz: 3bc0d255fb156a9ce05ac926ecd6c5ca15c57a0729c57de9b679ebb684748143e004bbb209433056b628b4de78f7fa0437393d428d810069b69cd3f0fa787ff0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.14] - 2026-05-07
4
+ ### Fixed
5
+ - Identity fingerprint save now warns and returns false if local persistence disconnects after previously being available.
6
+ - Reflection health now updates trust drift and mode-pattern category scores from tick results.
7
+ - Reflection LLM enhancer rejects arbitrary extra keyword arguments instead of forwarding them.
8
+
3
9
  ## [0.1.13] - 2026-04-22
4
10
  ### Added
5
11
  - Module-level snapshot methods (`personality_snapshot`, `reflection_snapshot`, `restore_personality`, `restore_reflections`) enabling memory↔self bridge for snapshot save/restore
@@ -18,6 +18,7 @@ module Legion
18
18
  @model = Dimensions.new_identity_model
19
19
  @observation_count = 0
20
20
  @entropy_history = []
21
+ @local_previously_available = false
21
22
  load_from_local
22
23
  end
23
24
 
@@ -87,7 +88,14 @@ module Legion
87
88
  end
88
89
 
89
90
  def save_to_local
90
- return unless local_available?
91
+ unless local_available?
92
+ if @local_previously_available
93
+ Legion::Logging.warn 'lex-identity: local persistence unavailable after being available'
94
+ return false
95
+ end
96
+
97
+ return nil
98
+ end
91
99
 
92
100
  db = local_data_connection
93
101
 
@@ -161,7 +169,9 @@ module Legion
161
169
  private
162
170
 
163
171
  def local_available?
164
- defined?(Legion::Data::Local) && respond_to?(:local_data_connected?) && local_data_connected?
172
+ available = defined?(Legion::Data::Local) && respond_to?(:local_data_connected?) && local_data_connected?
173
+ @local_previously_available = true if available
174
+ available
165
175
  end
166
176
  end
167
177
  end
@@ -42,12 +42,12 @@ module Legion
42
42
  false
43
43
  end
44
44
 
45
- def enhance(prompt, phase: 'reflection', **)
45
+ def enhance(prompt, phase: 'reflection')
46
46
  return nil unless available?
47
47
 
48
48
  if pipeline_available?
49
49
  response = Legion::LLM::Pipeline::GaiaCaller.chat(
50
- message: prompt, phase: phase, **
50
+ message: prompt, phase: phase
51
51
  )
52
52
  response&.message&.dig(:content)
53
53
  else
@@ -149,6 +149,8 @@ module Legion
149
149
  update_emotion_score(tick_results)
150
150
  update_memory_score(tick_results)
151
151
  update_load_score(tick_results)
152
+ update_trust_score(tick_results)
153
+ update_mode_score(tick_results)
152
154
  end
153
155
 
154
156
  def update_prediction_score(tick_results)
@@ -190,6 +192,22 @@ module Legion
190
192
  utilization = elapsed / budget
191
193
  reflection_store.update_category_score(:cognitive_load, [1.0 - utilization, 0.0].max)
192
194
  end
195
+
196
+ def update_trust_score(tick_results)
197
+ social = tick_results[:social_cognition]
198
+ return unless social.is_a?(Hash) && social[:trust_drift].is_a?(Numeric)
199
+
200
+ reflection_store.update_category_score(:trust_drift, 1.0 - social[:trust_drift].abs)
201
+ end
202
+
203
+ def update_mode_score(tick_results)
204
+ state = tick_results[:tick_state]
205
+ return unless state.is_a?(Hash) && state[:mode_transitions].is_a?(Numeric)
206
+
207
+ transitions = state[:mode_transitions].to_f
208
+ threshold = Helpers::Constants::MODE_OSCILLATION_THRESHOLD.to_f
209
+ reflection_store.update_category_score(:mode_patterns, [1.0 - (transitions / threshold), 0.0].max)
210
+ end
193
211
  end
194
212
  end
195
213
  end
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Agentic
6
6
  module Self
7
- VERSION = '0.1.13'
7
+ VERSION = '0.1.14'
8
8
  end
9
9
  end
10
10
  end
@@ -91,5 +91,13 @@ RSpec.describe Legion::Extensions::Agentic::Self::Identity::Helpers::Fingerprint
91
91
  expect(fp.save_to_local).to be_nil
92
92
  end
93
93
  end
94
+
95
+ it 'warns when local persistence was previously available but is no longer connected' do
96
+ fp.instance_variable_set(:@local_previously_available, true)
97
+ allow(fp).to receive(:local_data_connected?).and_return(false)
98
+
99
+ expect(Legion::Logging).to receive(:warn).with(/local persistence unavailable/)
100
+ expect(fp.save_to_local).to be false
101
+ end
94
102
  end
95
103
  end
@@ -75,6 +75,10 @@ RSpec.describe Legion::Extensions::Agentic::Self::Reflection::Helpers::LlmEnhanc
75
75
  allow(enhancer_mod).to receive(:available?).and_return(false)
76
76
  expect(enhancer_mod.enhance('hello')).to be_nil
77
77
  end
78
+
79
+ it 'rejects arbitrary extra kwargs instead of forwarding them to LLM' do
80
+ expect { enhancer_mod.enhance('hello', unexpected: true) }.to raise_error(ArgumentError)
81
+ end
78
82
  end
79
83
 
80
84
  describe '.available?' do
@@ -46,6 +46,23 @@ RSpec.describe Legion::Extensions::Agentic::Self::Reflection::Runners::Reflectio
46
46
  expect(result[:health]).to be < 1.0
47
47
  expect(result[:category_scores][:prediction_calibration]).to eq(0.2)
48
48
  end
49
+
50
+ it 'updates trust_drift from social cognition results' do
51
+ client.reflect(tick_results: { social_cognition: { trust_drift: 0.4 } })
52
+
53
+ result = client.cognitive_health
54
+
55
+ expect(result[:category_scores][:trust_drift]).to eq(0.6)
56
+ expect(result[:health]).to be < 1.0
57
+ end
58
+
59
+ it 'updates mode_patterns from tick mode transition counts' do
60
+ client.reflect(tick_results: { tick_state: { mode_transitions: 5 } })
61
+
62
+ result = client.cognitive_health
63
+
64
+ expect(result[:category_scores][:mode_patterns]).to eq(0.0)
65
+ end
49
66
  end
50
67
 
51
68
  describe '#recent_reflections' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-agentic-self
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity