lex-agentic-memory 0.1.12 → 0.1.13
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 +7 -0
- data/lib/legion/extensions/agentic/memory/trace/helpers/postgres_store.rb +9 -1
- data/lib/legion/extensions/agentic/memory/trace.rb +7 -1
- data/lib/legion/extensions/agentic/memory/version.rb +1 -1
- data/spec/legion/extensions/agentic/memory/trace/helpers/postgres_store_spec.rb +18 -0
- 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: '0814efaa2ca66f0121dd6d783ec6383b09542f126628695cf2c375c056b5c2b1'
|
|
4
|
+
data.tar.gz: d6df0516525b8ff2883f9f4074eb488ac6df00c74ee24994ab7c629a9a449a0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad170b27af1c27a90430d7ce82d89554b5a4cd5709504535d84bfc3ae52046495a790acf29cc9665739c2486cc736c36cbd118cf588f4f9418d3e90f307182e3
|
|
7
|
+
data.tar.gz: 8ee023a4360585eca2bd215dfc8601e4c9d2d96935a985c1bc8b0200e7953dbcd2f49d26032c35d23f8b5af69fa097a0d2c9c189291faa189e5892e22785405c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.13] - 2026-03-26
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- `PostgresStore#serialize_trace` omitted `agent_id` column, causing `PG::NotNullViolation` on every insert against PostgreSQL (migration 022 declares `agent_id null: false`). Constructor now accepts `agent_id:` with fallback to `Legion::Settings.dig(:agent, :id)` or `'default'`
|
|
7
|
+
- `Trace.create_store` factory now resolves and passes `agent_id` to PostgresStore
|
|
8
|
+
- Spec schema for PostgresStore now includes `agent_id` column matching production migration
|
|
9
|
+
|
|
3
10
|
## [0.1.12] - 2026-03-26
|
|
4
11
|
|
|
5
12
|
### Fixed
|
|
@@ -15,8 +15,9 @@ module Legion
|
|
|
15
15
|
TRACES_TABLE = :memory_traces
|
|
16
16
|
ASSOCIATIONS_TABLE = :memory_associations
|
|
17
17
|
|
|
18
|
-
def initialize(tenant_id: nil)
|
|
18
|
+
def initialize(tenant_id: nil, agent_id: nil)
|
|
19
19
|
@tenant_id = tenant_id
|
|
20
|
+
@agent_id = agent_id || resolve_agent_id
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
# Store (upsert) a trace by trace_id.
|
|
@@ -262,6 +263,12 @@ module Legion
|
|
|
262
263
|
Legion::Data.connection
|
|
263
264
|
end
|
|
264
265
|
|
|
266
|
+
def resolve_agent_id
|
|
267
|
+
Legion::Settings.dig(:agent, :id) || 'default'
|
|
268
|
+
rescue StandardError
|
|
269
|
+
'default'
|
|
270
|
+
end
|
|
271
|
+
|
|
265
272
|
# Dataset for memory_traces scoped by tenant_id (if set).
|
|
266
273
|
def traces_ds
|
|
267
274
|
ds = db[TRACES_TABLE]
|
|
@@ -277,6 +284,7 @@ module Legion
|
|
|
277
284
|
|
|
278
285
|
{
|
|
279
286
|
trace_id: trace[:trace_id],
|
|
287
|
+
agent_id: @agent_id,
|
|
280
288
|
tenant_id: @tenant_id,
|
|
281
289
|
trace_type: trace[:trace_type].to_s,
|
|
282
290
|
content: payload.is_a?(Hash) ? Legion::JSON.dump(payload) : payload.to_s,
|
|
@@ -34,7 +34,7 @@ module Legion
|
|
|
34
34
|
def create_store
|
|
35
35
|
if postgres_available?
|
|
36
36
|
Legion::Logging.debug '[memory] Using shared PostgresStore (write-through)'
|
|
37
|
-
Helpers::PostgresStore.new(tenant_id: resolve_tenant_id)
|
|
37
|
+
Helpers::PostgresStore.new(tenant_id: resolve_tenant_id, agent_id: resolve_agent_id)
|
|
38
38
|
elsif defined?(Legion::Cache) && Legion::Cache.respond_to?(:connected?) && Legion::Cache.connected?
|
|
39
39
|
Legion::Logging.debug '[memory] Using shared CacheStore (memcached)'
|
|
40
40
|
Helpers::CacheStore.new
|
|
@@ -60,6 +60,12 @@ module Legion
|
|
|
60
60
|
rescue StandardError
|
|
61
61
|
nil
|
|
62
62
|
end
|
|
63
|
+
|
|
64
|
+
def resolve_agent_id
|
|
65
|
+
Legion::Settings.dig(:agent, :id) || 'default'
|
|
66
|
+
rescue StandardError
|
|
67
|
+
'default'
|
|
68
|
+
end
|
|
63
69
|
end
|
|
64
70
|
end
|
|
65
71
|
end
|
|
@@ -12,6 +12,7 @@ RSpec.describe Legion::Extensions::Agentic::Memory::Trace::Helpers::PostgresStor
|
|
|
12
12
|
d.create_table(:memory_traces) do
|
|
13
13
|
primary_key :id
|
|
14
14
|
String :trace_id, size: 36, null: false, unique: true
|
|
15
|
+
String :agent_id, size: 64, null: false, default: 'test-agent'
|
|
15
16
|
String :tenant_id, size: 64
|
|
16
17
|
String :trace_type, null: false
|
|
17
18
|
String :content, text: true, null: false
|
|
@@ -127,6 +128,23 @@ RSpec.describe Legion::Extensions::Agentic::Memory::Trace::Helpers::PostgresStor
|
|
|
127
128
|
end
|
|
128
129
|
end
|
|
129
130
|
|
|
131
|
+
# --- store agent_id population ---
|
|
132
|
+
|
|
133
|
+
describe '#store agent_id population' do
|
|
134
|
+
it 'writes agent_id to the database row' do
|
|
135
|
+
store.store(semantic_trace)
|
|
136
|
+
row = db[:memory_traces].where(trace_id: semantic_trace[:trace_id]).first
|
|
137
|
+
expect(row[:agent_id]).not_to be_nil
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
it 'uses the resolved agent_id from settings' do
|
|
141
|
+
custom_store = described_class.new(tenant_id: tenant_id, agent_id: 'my-agent')
|
|
142
|
+
custom_store.store(semantic_trace)
|
|
143
|
+
row = db[:memory_traces].where(trace_id: semantic_trace[:trace_id]).first
|
|
144
|
+
expect(row[:agent_id]).to eq('my-agent')
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
130
148
|
# --- store + retrieve ---
|
|
131
149
|
|
|
132
150
|
describe '#store and #retrieve' do
|