superbrain-distributed-sdk 0.2.1 โ†’ 0.2.2

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.
Files changed (2) hide show
  1. package/README.md +38 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -112,6 +112,44 @@ The Coordinator is ONLY in the control path (allocate + free).
112
112
 
113
113
  ---
114
114
 
115
+ ## ๐Ÿงน Memory Management
116
+
117
+ > **The Node.js SDK exposes the raw client layer โ€” `free()` is always required after `allocate()`.**
118
+
119
+ ```typescript
120
+ // โœ… Always do this after you are done with a pointer
121
+ const ptr = await client.allocate(100 * 1024 * 1024);
122
+ await client.write(ptr, 0, data);
123
+ const result = await client.read(ptr, 0, 0);
124
+ await client.free(ptr); // โ† required โ€” leaks memory if skipped
125
+ ```
126
+
127
+ ### ๐Ÿ Want Managed Memory? Use the Python SDK
128
+
129
+ The Python SDK (`pip install superbrain-sdk`) provides higher-level APIs where **free() is never needed**:
130
+
131
+ | Python API | Free needed? | What it does |
132
+ |------------|:------------:|--------------|
133
+ | `SharedContext.write("key", data)` | โŒ No | Key-based shared state across agents |
134
+ | `fabric.store_kv_cache(prefix)` | โŒ No | Deduped prompt cache, auto-evicted |
135
+ | `SuperBrainMemory` (LangChain) | โŒ No | Chat history in distributed RAM |
136
+
137
+ ```python
138
+ # Python โ€” no free() ever needed with high-level APIs
139
+ from superbrain import DistributedContextFabric
140
+
141
+ fabric = DistributedContextFabric(coordinator="localhost:50050")
142
+ ctx = fabric.create_context("session-42")
143
+
144
+ ctx.write("state", {"step": 10}) # written to distributed RAM
145
+ ctx.read("state") # read from any machine
146
+ # No free() โœ…
147
+ ```
148
+
149
+ โ†’ [Full Memory Management Guide](https://github.com/anispy211/superbrainSdk/blob/main/DOCUMENTATION.md#memory-management--when-to-free)
150
+
151
+ ---
152
+
115
153
  ## ๐Ÿ” Security Features
116
154
 
117
155
  | Feature | Status |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superbrain-distributed-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Premium High-Performance Distributed Memory SDK for AI Agents",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",