legion-gaia 0.9.58 → 0.9.59

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: b1f027ab3c8daed0ec4d1721c3c88e3efc15e475f1cb24f7999ba057074c9554
4
- data.tar.gz: 1fdc0ccfe37b653d78eec31c0b1dce6b4294235c573af402d2b8205712c2fe0a
3
+ metadata.gz: bcc0656f2d4922688542c1a7a9af486aea087a887f7faf929aa29c75c6ed1b9d
4
+ data.tar.gz: 27af3cc6e41f056d98c69f7ec83fa8ea7a2e379e4d7a517913a7d71f719ab6bc
5
5
  SHA512:
6
- metadata.gz: cd0989a7ede3408c63a68b7f16a41bb6dc99c964d78811c1620d6caf50885a5c2ebed14ab7d6a90cdc7805ab99abd602469cecda522bb83a427d6e2667b6efae
7
- data.tar.gz: 516b2c3d3defd7a2bc20e51693ffc053a82b2add2b4e709139e86b2d033a4b163dcef61d89548e0ac4edb0a2169c7a33dce5275b79c905262e1c3318366f0f31
6
+ metadata.gz: ea478d48bf2e25902220796b962fd89ebc6c1925453164d4da5902a10af9b08bfbfa6aa5cdc4a062a8b5be189315c739d6ad2cbad87ceb6d8624a54a501da320
7
+ data.tar.gz: f49728af3557e2a11266dbabd3cd8e8c56878a5bec7ccabcc25ffe115d02c05e0308df9b2fc29b9c89e2ed79000d2855c8cdd7e825eaa1d68f11ee5340e509c0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.59] - 2026-07-16
4
+ ### Added
5
+ - H0: Partner identity as first-class store dimension — `record_interaction_trace` adds `partner:<identity>` domain tag; `SessionStore#erase_partner!(identity:)`; `AuditObserver` tool patterns keyed per-identity with `tool_patterns_for(identity)` and `erase_partner!(identity:)`; `TrackerPersistence.register_tracker` is idempotent (re-registration is a no-op, safe for partial-boot resume); fail-closed: no partner state written to shared Postgres when Apollo local is unavailable
6
+
3
7
  ## [0.9.58] - 2026-07-15
4
8
  ### Added
5
9
  - Earned bond formation: strength-based partner detection, reinforcement lifecycle, coldstart wire
@@ -10,9 +10,10 @@ module Legion
10
10
  include Legion::Logging::Helper
11
11
 
12
12
  def initialize
13
- @user_prefs = {}
14
- @tool_patterns = {}
15
- @mutex = Mutex.new
13
+ @user_prefs = {}
14
+ @tool_patterns = {}
15
+ @identity_tool_patterns = {}
16
+ @mutex = Mutex.new
16
17
  end
17
18
 
18
19
  def process_event(event)
@@ -39,20 +40,32 @@ module Legion
39
40
  @mutex.synchronize { @tool_patterns.dup }
40
41
  end
41
42
 
43
+ def tool_patterns_for(identity)
44
+ @mutex.synchronize { (@identity_tool_patterns[identity] || {}).dup }
45
+ end
46
+
42
47
  def learned_data_for(identity)
43
48
  @mutex.synchronize do
44
49
  prefs = @user_prefs[identity] || {}
45
50
  {
46
51
  routing_preference: prefs[:routing],
47
- tool_predictions: top_tools_for_patterns
52
+ tool_predictions: top_tools_for_identity(identity)
48
53
  }
49
54
  end
50
55
  end
51
56
 
57
+ def erase_partner!(identity:)
58
+ @mutex.synchronize do
59
+ @user_prefs.delete(identity)
60
+ @identity_tool_patterns.delete(identity)
61
+ end
62
+ end
63
+
52
64
  def reset!
53
65
  @mutex.synchronize do
54
66
  @user_prefs.clear
55
67
  @tool_patterns.clear
68
+ @identity_tool_patterns.clear
56
69
  end
57
70
  end
58
71
 
@@ -80,6 +93,7 @@ module Legion
80
93
  end
81
94
 
82
95
  def record_tool_patterns(event)
96
+ identity = extract_caller_identity(event)
83
97
  tools = event[:tools_used] || []
84
98
  tools.each do |tool|
85
99
  name = tool[:name] || tool['name']
@@ -88,12 +102,24 @@ module Legion
88
102
  @tool_patterns[name] ||= { count: 0, last_used: nil }
89
103
  @tool_patterns[name][:count] += 1
90
104
  @tool_patterns[name][:last_used] = event[:timestamp]
105
+
106
+ next unless identity
107
+
108
+ @identity_tool_patterns[identity] ||= {}
109
+ @identity_tool_patterns[identity][name] ||= { count: 0, last_used: nil }
110
+ @identity_tool_patterns[identity][name][:count] += 1
111
+ @identity_tool_patterns[identity][name][:last_used] = event[:timestamp]
91
112
  end
92
113
  end
93
114
 
94
115
  def top_tools_for_patterns
95
116
  @tool_patterns.sort_by { |_, v| -v[:count] }.first(10).to_h
96
117
  end
118
+
119
+ def top_tools_for_identity(identity)
120
+ patterns = @identity_tool_patterns[identity] || {}
121
+ patterns.sort_by { |_, v| -v[:count] }.first(10).to_h
122
+ end
97
123
  end
98
124
  end
99
125
  end
@@ -82,6 +82,14 @@ module Legion
82
82
  end
83
83
  end
84
84
 
85
+ def erase_partner!(identity:)
86
+ @mutex.synchronize do
87
+ normalized = normalize_identity(identity)
88
+ session_id = @identity_index[normalized]
89
+ remove_unlocked(session_id) if session_id
90
+ end
91
+ end
92
+
85
93
  private
86
94
 
87
95
  def uuid?(identity)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Gaia
5
- VERSION = '0.9.58'
5
+ VERSION = '0.9.59'
6
6
  end
7
7
  end
data/lib/legion/gaia.rb CHANGED
@@ -606,7 +606,7 @@ module Legion
606
606
  }.tap do |payload|
607
607
  payload[:emotional_context] = emotional_context if emotional_context
608
608
  end,
609
- domain_tags: ['partner_interaction', observation[:channel].to_s],
609
+ domain_tags: ['partner_interaction', observation[:channel].to_s, "partner:#{observation[:identity]}"],
610
610
  origin: :direct_experience,
611
611
  emotional_valence: interaction_trace_emotional_valence(emotional_context),
612
612
  emotional_intensity: interaction_trace_emotional_intensity(emotional_context),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-gaia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.58
4
+ version: 0.9.59
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity