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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/legion/gaia/audit_observer.rb +30 -4
- data/lib/legion/gaia/session_store.rb +8 -0
- data/lib/legion/gaia/version.rb +1 -1
- data/lib/legion/gaia.rb +1 -1
- 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: bcc0656f2d4922688542c1a7a9af486aea087a887f7faf929aa29c75c6ed1b9d
|
|
4
|
+
data.tar.gz: 27af3cc6e41f056d98c69f7ec83fa8ea7a2e379e4d7a517913a7d71f719ab6bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
@
|
|
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:
|
|
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)
|
data/lib/legion/gaia/version.rb
CHANGED
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),
|