lex-agentic-memory 0.1.22 → 0.1.24
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c02b5c5fc14dfba427fc4a6c321eab9abc4aa12218671c132f747da6af2de92
|
|
4
|
+
data.tar.gz: 1e7b698497e270656372bb2f47eb4dc3b93d16e64faf9d4d95ea466bcf6071c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b02c36cc24ffb379cc41988398b8d69588ee5bddddd008bdc4eaedfdd062d44d3fe4fc8e5981b58e2d1d7b014863aa24a49e55a490ada138727e3f9ac9132e6d
|
|
7
|
+
data.tar.gz: 0dc565499fac89a69ddf26b3a83465e699205ad32a9a5b10deb83ed5818ef9c9babd2d421a8fdf78f7b90ff1dc19e06fecd94cde8b3a01652082b40f85e72c1a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.24] - 2026-04-03
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Wrap `save_to_local` persist in a single SQLite transaction — 32K individual lock acquisitions become 1
|
|
7
|
+
- Use `insert_conflict(:replace)` instead of SELECT-then-INSERT/UPDATE per trace
|
|
8
|
+
|
|
9
|
+
## [0.1.23] - 2026-04-03
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- Sanitize trace content before SQLite persist: force-decode to BINARY then re-encode UTF-8, strip null bytes — prevents `unrecognized token` SQL errors from unescaped characters
|
|
13
|
+
|
|
3
14
|
## [0.1.22] - 2026-04-03
|
|
4
15
|
|
|
5
16
|
### Changed
|
|
@@ -165,10 +165,12 @@ module Legion
|
|
|
165
165
|
return unless snapshots
|
|
166
166
|
|
|
167
167
|
traces_snapshot, associations_snapshot, trace_rows_snapshot, traces_dirty, associations_dirty = snapshots
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
db.transaction do
|
|
169
|
+
scoped_trace_ids = db[:memory_traces].where(partition_id: @partition_id).select_map(:trace_id)
|
|
170
|
+
memory_trace_ids = traces_snapshot.keys
|
|
171
|
+
stale_ids = persist_dirty_traces(db, trace_rows_snapshot, scoped_trace_ids, memory_trace_ids, traces_dirty)
|
|
172
|
+
persist_dirty_associations(db, associations_snapshot, scoped_trace_ids, memory_trace_ids, stale_ids, associations_dirty)
|
|
173
|
+
end
|
|
172
174
|
clear_dirty_flags(trace_rows_snapshot)
|
|
173
175
|
end
|
|
174
176
|
|
|
@@ -187,12 +189,9 @@ module Legion
|
|
|
187
189
|
def persist_dirty_traces(db, trace_rows_snapshot, scoped_trace_ids, memory_trace_ids, traces_dirty)
|
|
188
190
|
return [] unless traces_dirty
|
|
189
191
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
else
|
|
194
|
-
db[:memory_traces].insert(row)
|
|
195
|
-
end
|
|
192
|
+
ds = db[:memory_traces]
|
|
193
|
+
trace_rows_snapshot.each_value do |row|
|
|
194
|
+
ds.insert_conflict(:replace).insert(row)
|
|
196
195
|
end
|
|
197
196
|
stale_ids = scoped_trace_ids - memory_trace_ids
|
|
198
197
|
db[:memory_traces].where(trace_id: stale_ids).delete unless stale_ids.empty?
|
|
@@ -253,10 +252,13 @@ module Legion
|
|
|
253
252
|
|
|
254
253
|
def serialize_trace_for_db(trace)
|
|
255
254
|
payload = trace[:content_payload] || trace[:content]
|
|
255
|
+
content = payload.is_a?(Hash) ? ::JSON.generate(payload) : payload.to_s
|
|
256
|
+
content = content.dup.force_encoding('BINARY').encode('UTF-8', invalid: :replace, undef: :replace, replace: '')
|
|
257
|
+
.delete("\0")
|
|
256
258
|
{
|
|
257
259
|
trace_id: trace[:trace_id],
|
|
258
260
|
trace_type: trace[:trace_type].to_s,
|
|
259
|
-
content:
|
|
261
|
+
content: content,
|
|
260
262
|
strength: trace[:strength],
|
|
261
263
|
peak_strength: trace[:peak_strength],
|
|
262
264
|
base_decay_rate: trace[:base_decay_rate],
|