@pyxmate/memory 0.9.2 → 0.10.0
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.
package/dist/index.d.ts
CHANGED
|
@@ -255,6 +255,13 @@ interface MemoryEntry {
|
|
|
255
255
|
userId?: string;
|
|
256
256
|
/** Team/group ID within the tenant. */
|
|
257
257
|
teamId?: string;
|
|
258
|
+
/**
|
|
259
|
+
* When true, consolidation leaves this entry alone — it is never archived by
|
|
260
|
+
* decay and never merged (nor merged-into) by semantic deduplication. Use for
|
|
261
|
+
* stable anchor entries whose ID is referenced by external systems (e.g. a
|
|
262
|
+
* file-catalog row pointed at by another service's foreign key).
|
|
263
|
+
*/
|
|
264
|
+
pinned?: boolean;
|
|
258
265
|
}
|
|
259
266
|
interface MemorySearchParams {
|
|
260
267
|
query: string;
|
|
@@ -370,6 +377,11 @@ interface MemoryIngestRequest {
|
|
|
370
377
|
userId?: string;
|
|
371
378
|
/** Team/group ID within the tenant. */
|
|
372
379
|
teamId?: string;
|
|
380
|
+
/**
|
|
381
|
+
* Exclude this entry from consolidation (decay-archive and semantic dedup).
|
|
382
|
+
* See `MemoryEntry.pinned` for full semantics.
|
|
383
|
+
*/
|
|
384
|
+
pinned?: boolean;
|
|
373
385
|
}
|
|
374
386
|
interface MemoryStats {
|
|
375
387
|
totalEntries: number;
|
package/package.json
CHANGED
|
@@ -86,6 +86,21 @@ When `consolidate()` runs, it executes a 7-step pipeline:
|
|
|
86
86
|
|
|
87
87
|
All steps have **non-LLM fallbacks** — consolidation works without an LLM, just less intelligently.
|
|
88
88
|
|
|
89
|
+
### Pinned entries (opt out of consolidation)
|
|
90
|
+
|
|
91
|
+
Entries stored with `pinned: true` are exempt from both the dedup step and the decay-archive step. `Memory.runDecay()` skips them via the same filter. Use for anchor rows whose ID is referenced by external systems — e.g. a file-catalog entry whose ID is stored as a foreign key in a downstream service's database:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
await memory.store({
|
|
95
|
+
content: '[File: "report.pdf" (application/pdf)]',
|
|
96
|
+
type: MemoryType.LONG_TERM,
|
|
97
|
+
metadata: { source: 'file-ingestion', filename: 'report.pdf' },
|
|
98
|
+
pinned: true, // external FK points here — must not be merged or archived
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Without `pinned`, short near-duplicate anchor content can trip the 0.95 cosine dedup threshold and get hard-deleted, orphaning the external reference. Pinned entries' exemption is SQL-side (`WHERE pinned = 0` filter on consolidation's query) and backed by a partial index `idx_memory_pinned WHERE pinned = 1`. Callers can query with `QueryFilters.excludePinned: true` to reproduce the same exclusion.
|
|
103
|
+
|
|
89
104
|
---
|
|
90
105
|
|
|
91
106
|
## Community Detection
|
|
@@ -24,7 +24,7 @@ const client = new MemoryClient('http://localhost:7822', process.env.MEMORY_API_
|
|
|
24
24
|
|--------|----------|-------------|
|
|
25
25
|
| GET | `/health` | Public health check (status only — no internals exposed) |
|
|
26
26
|
| GET | `/admin/health` | Admin health check (version, uptime, embedding provider, memory stats) |
|
|
27
|
-
| POST | `/api/memory/ingest` | Store a memory (JSON: `{ content, type, metadata, agentId?, sessionId?, targets?, entities?, relationships?, importance?, source?, eventTime?, id?, parentId?, ingestTime? }`) |
|
|
27
|
+
| POST | `/api/memory/ingest` | Store a memory (JSON: `{ content, type, metadata, agentId?, sessionId?, targets?, entities?, relationships?, importance?, source?, eventTime?, id?, parentId?, ingestTime?, pinned? }`) |
|
|
28
28
|
| POST | `/api/memory/ingest/file` | Upload file (multipart, 100MB limit). For PDFs with images, returns an `enrichment` block with HMAC token and image metadata for two-phase enrichment. |
|
|
29
29
|
| GET | `/api/memory/files/download/:filename` | Download uploaded file binary by filename. Returns the original file with proper Content-Type. Images served inline, documents as attachment. |
|
|
30
30
|
| GET | `/api/memory/files/:fileId/images/:imageId?token=...` | Fetch an extracted PDF image (binary). Requires HMAC token from ingest response. |
|
|
@@ -192,6 +192,7 @@ interface MemoryEntry {
|
|
|
192
192
|
teamId?: string; // team/group within tenant
|
|
193
193
|
sensitivity?: SensitivityLevel; // auto-classified: 'public' | 'internal' | 'secret'
|
|
194
194
|
encrypted?: boolean; // true when content is encrypted at rest
|
|
195
|
+
pinned?: boolean; // exempt from consolidation (decay-archive + dedup-merge); use for stable anchors referenced by external systems
|
|
195
196
|
}
|
|
196
197
|
```
|
|
197
198
|
|
|
@@ -220,6 +221,7 @@ interface SearchFilters {
|
|
|
220
221
|
eventTimeRange?: [string, string]; // [start, end] ISO timestamps
|
|
221
222
|
parentId?: string;
|
|
222
223
|
contentType?: string;
|
|
224
|
+
excludePinned?: boolean; // SQL-side `pinned = 0` filter (used internally by consolidation/decay; available to callers too)
|
|
223
225
|
}
|
|
224
226
|
```
|
|
225
227
|
|