@mulingai-npm/redis 3.40.20 → 3.40.22

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.
@@ -67,8 +67,11 @@ class SmartTranslateContextManager {
67
67
  existing[existingIdx] = entry;
68
68
  const pipe = this.redisClient.pipeline();
69
69
  pipe.del(key);
70
- // Push in reverse order since LPUSH adds to head
71
- for (let i = existing.length - 1; i >= 0; i--) {
70
+ // existing is chronological (oldest→newest). LPUSH adds to head.
71
+ // Push oldest first so newest ends up at head, matching the read-time
72
+ // contract where lrange(0,N-1) returns head-first (newest→oldest) and
73
+ // getContext() reverses to return chronological order.
74
+ for (let i = 0; i < existing.length; i++) {
72
75
  pipe.lpush(key, JSON.stringify(existing[i]));
73
76
  }
74
77
  pipe.ltrim(key, 0, MAX_CONTEXT_CHUNKS - 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mulingai-npm/redis",
3
- "version": "3.40.20",
3
+ "version": "3.40.22",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {