@pyxmate/memory 0.1.0-beta → 0.1.2-beta
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/README.md +10 -0
- package/bin/init.mjs +63 -0
- package/dist/{chunk-VJGRAIVX.mjs → chunk-JMXAZPDT.mjs} +11 -4
- package/dist/{chunk-ACMIMR43.mjs → chunk-XNKO7F3P.mjs} +1 -1
- package/dist/dashboard.mjs +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +1 -1
- package/dist/react.mjs +2 -2
- package/package.json +9 -3
- package/skills/pyx-memory-integration/SKILL.md +266 -0
- package/skills/pyx-memory-integration/examples/disabled-memory.ts +53 -0
- package/skills/pyx-memory-integration/examples/minimal-embedded.ts +25 -0
- package/skills/pyx-memory-integration/examples/minimal-sidecar.ts +14 -0
- package/skills/pyx-memory-integration/patterns/consumer.md +103 -0
- package/skills/pyx-memory-integration/patterns/embedded.md +223 -0
- package/skills/pyx-memory-integration/reference/advanced.md +139 -0
- package/skills/pyx-memory-integration/reference/http-api.md +82 -0
- package/skills/pyx-memory-integration/reference/parity.md +63 -0
- package/skills/pyx-memory-integration/reference/types.md +203 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# pyx-memory Type Reference
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
- Type Cheat Sheet
|
|
5
|
+
- MemoryInterface (9 methods)
|
|
6
|
+
- ExtendedMemoryInterface (6 lifecycle methods)
|
|
7
|
+
- MemoryClient Constructor and Concrete Methods
|
|
8
|
+
- DashboardClient
|
|
9
|
+
- MemorySearchResult, MemoryEntry, MemorySearchParams
|
|
10
|
+
- MemoryOptions Reference
|
|
11
|
+
- Embedding Dimension Defaults
|
|
12
|
+
|
|
13
|
+
## Type Cheat Sheet
|
|
14
|
+
|
|
15
|
+
| Type | Signature | Import From |
|
|
16
|
+
|------|-----------|-------------|
|
|
17
|
+
| `LLMCallback` | `(prompt: string) => Promise<string>` | `@pyx-memory/core` |
|
|
18
|
+
| `ReasoningProvider` | `(prompt: string) => Promise<string>` | `@pyx-memory/core` |
|
|
19
|
+
| `StoreInput` | `Omit<MemoryEntry, 'id' \| 'createdAt'> & { targets?, entities?, relationships? }` | `@pyx-memory/core` |
|
|
20
|
+
| `MemoryType` | `'short-term' \| 'long-term' \| 'working' \| 'episodic' \| 'summary'` | `@pyx-memory/shared` |
|
|
21
|
+
| `RAGStrategy` | `'naive' \| 'graph' \| 'agentic' \| 'hybrid'` | `@pyx-memory/shared` |
|
|
22
|
+
| `VectorProvider` | `'lancedb'` | `@pyx-memory/shared` |
|
|
23
|
+
| `StoreTarget` | `'sqlite' \| 'vector' \| 'graph'` | `@pyx-memory/shared` |
|
|
24
|
+
| `IngestEntity` | `{ name, type, properties? }` | `@pyx-memory/shared` |
|
|
25
|
+
| `IngestRelationship` | `{ source, target, type, properties? }` | `@pyx-memory/shared` |
|
|
26
|
+
| `EntityType` | `'PERSON' \| 'ORGANIZATION' \| 'CONCEPT' \| 'TOOL' \| 'LOCATION' \| 'EVENT'` | `@pyx-memory/core` |
|
|
27
|
+
| `RelationType` | `'USES' \| 'OWNS' \| 'DEPENDS_ON' \| 'RELATED_TO' \| 'CREATED_BY' \| 'PART_OF' \| 'IS_A' \| 'WORKS_AT' \| 'LOCATED_IN'` | `@pyx-memory/core` |
|
|
28
|
+
| `MemoryListParams` | `{ page?, limit?, type?, agentId? }` | `@pyx-memory/client` |
|
|
29
|
+
| `MemoryListResult` | `{ entries, totalCount, page, limit }` | `@pyx-memory/client` |
|
|
30
|
+
| `IngestionResult` | `{ filename, chunks, totalCharacters }` | `@pyx-memory/client` |
|
|
31
|
+
| `MemoryServerError` | `Error` with `.status` and `.isNotFound` | `@pyx-memory/client` |
|
|
32
|
+
| `GraphNode` | `{ id, name, type, properties, memoryEntryIds }` | `@pyx-memory/shared` |
|
|
33
|
+
| `GraphTraversalResult` | `{ nodes, relationships, paths }` | `@pyx-memory/shared` |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## MemoryInterface (9 methods)
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
interface MemoryInterface {
|
|
41
|
+
initialize(): Promise<void>;
|
|
42
|
+
store(entry: Omit<MemoryEntry, 'id' | 'createdAt'> & { id?: string; createdAt?: string; targets?: StoreTarget[]; entities?: IngestEntity[]; relationships?: IngestRelationship[] }): Promise<MemoryEntry>;
|
|
43
|
+
search(params: MemorySearchParams): Promise<MemorySearchResult>;
|
|
44
|
+
list(params?: MemoryListParams): Promise<MemoryListResult>; // paginated entry listing
|
|
45
|
+
get(id: string): Promise<MemoryEntry | null>;
|
|
46
|
+
delete(id: string): Promise<boolean>;
|
|
47
|
+
clearSession(sessionId: string): Promise<number>;
|
|
48
|
+
stats(): Promise<MemoryStats>;
|
|
49
|
+
shutdown(): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## ExtendedMemoryInterface (adds 6 lifecycle methods)
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
interface ExtendedMemoryInterface extends MemoryInterface {
|
|
57
|
+
consolidate(): Promise<ConsolidationRunResult>;
|
|
58
|
+
forget(id: string, reason?: string): Promise<boolean>;
|
|
59
|
+
summarizeSession(sessionId: string): Promise<MemoryEntry | null>;
|
|
60
|
+
runDecay(): Promise<number>;
|
|
61
|
+
reindex(): Promise<void>;
|
|
62
|
+
deleteBySource(source: string): Promise<number>;
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## MemoryClient Constructor and Concrete Methods
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// Constructor: URL required, apiKey optional
|
|
70
|
+
const client = new MemoryClient('http://localhost:7822'); // no auth
|
|
71
|
+
const client = new MemoryClient('http://localhost:7822', 'my-api-key'); // with auth
|
|
72
|
+
const client = new MemoryClient('http://localhost:7822', process.env.MEMORY_API_KEY); // from env
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
When `apiKey` is provided, all requests include `Authorization: Bearer <key>`. Empty or whitespace-only keys are ignored.
|
|
76
|
+
|
|
77
|
+
`MemoryClient` implements `ExtendedMemoryInterface` AND has additional methods not on any interface.
|
|
78
|
+
Graph queries and file ingestion are available without `@pyx-memory/core`.
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
class MemoryClient implements ExtendedMemoryInterface {
|
|
82
|
+
// ... all 15 interface methods (9 base + 6 lifecycle) ...
|
|
83
|
+
|
|
84
|
+
// Graph operations (call pyx-memory server's graph endpoints)
|
|
85
|
+
graphNodes(): Promise<GraphNode[]>;
|
|
86
|
+
graphEdges(): Promise<{ stats: { nodeCount: number; edgeCount: number } }>;
|
|
87
|
+
graphQuery(query: { nodeId: string; depth?: number }): Promise<GraphTraversalResult>;
|
|
88
|
+
|
|
89
|
+
// File ingestion (multipart upload to server)
|
|
90
|
+
ingestFile(file: File): Promise<IngestionResult>;
|
|
91
|
+
|
|
92
|
+
// Bi-temporal queries
|
|
93
|
+
queryAsOf(asOf: string, filters?: TemporalQueryFilters): Promise<MemoryEntry[]>;
|
|
94
|
+
queryByEventTime(startTime: string, endTime: string, filters?: TemporalQueryFilters): Promise<MemoryEntry[]>;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Key insight for consumers**: You do NOT need `@pyx-memory/core` for graph queries or file ingestion.
|
|
99
|
+
`MemoryClient` already proxies these through the HTTP API.
|
|
100
|
+
|
|
101
|
+
## DashboardClient (extends MemoryClient)
|
|
102
|
+
|
|
103
|
+
`DashboardClient` from `@pyx-memory/dashboard` adds dashboard-specific methods:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { DashboardClient } from '@pyx-memory/dashboard';
|
|
107
|
+
|
|
108
|
+
class DashboardClient extends MemoryClient {
|
|
109
|
+
consolidationLog(limit?: number): Promise<ConsolidationLogEntry[]>;
|
|
110
|
+
graphRelationships(limit?: number): Promise<{ relationships: GraphRelationship[]; totalCount: number }>;
|
|
111
|
+
graphFull(limit?: number): Promise<{ nodes: GraphNode[]; relationships: GraphRelationship[] }>;
|
|
112
|
+
listEntriesPaginated(filters?: EntryFilters): Promise<PaginatedEntries>;
|
|
113
|
+
fetchHealthRaw(): Promise<RawHealthResponse>;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The dashboard package also provides: `Poller` (auto-polling), `computeMetrics()`, `computeTypeDistribution()`,
|
|
118
|
+
`enrichHealth()`, `transformGraphData()`, `toD3ForceFormat()`, `toGraphologyFormat()`, and React hooks
|
|
119
|
+
(`useMemoryStats`, `useMemoryEntries`, `useKnowledgeGraph`, `useConsolidationLog`, `useMemoryHealth`, `useTypeDistribution`).
|
|
120
|
+
|
|
121
|
+
## MemorySearchResult
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
interface MemorySearchResult {
|
|
125
|
+
entries: MemoryEntry[];
|
|
126
|
+
totalCount: number;
|
|
127
|
+
strategy: RAGStrategy;
|
|
128
|
+
scoredEntries?: Array<{ entry: MemoryEntry; score: number }>; // ranked results with relevance scores
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## MemoryEntry (full shape)
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
interface MemoryEntry {
|
|
136
|
+
id: string;
|
|
137
|
+
content: string;
|
|
138
|
+
type: MemoryType;
|
|
139
|
+
agentId?: string;
|
|
140
|
+
sessionId?: string;
|
|
141
|
+
metadata: Record<string, unknown>;
|
|
142
|
+
embedding?: number[]; // @deprecated — managed internally by vector store
|
|
143
|
+
createdAt: string; // ISO 8601
|
|
144
|
+
contentHash?: string; // SHA-256
|
|
145
|
+
importance?: number; // 1-10
|
|
146
|
+
accessCount?: number;
|
|
147
|
+
lastAccessed?: string; // ISO 8601
|
|
148
|
+
parentId?: string; // hierarchical storage
|
|
149
|
+
source?: string; // filename, URL, session ID
|
|
150
|
+
eventTime?: string; // when event happened (bi-temporal)
|
|
151
|
+
ingestTime?: string; // when stored (bi-temporal)
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## MemorySearchParams + SearchFilters
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
interface MemorySearchParams {
|
|
159
|
+
query: string;
|
|
160
|
+
type?: MemoryType;
|
|
161
|
+
agentId?: string;
|
|
162
|
+
limit?: number; // default varies by engine
|
|
163
|
+
strategy?: RAGStrategy; // default: 'naive'
|
|
164
|
+
filters?: SearchFilters;
|
|
165
|
+
enableHyDE?: boolean; // Hypothetical Document Embedding for query expansion
|
|
166
|
+
enableRerank?: boolean; // Cross-encoder reranking of results
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface SearchFilters {
|
|
170
|
+
source?: string;
|
|
171
|
+
importanceMin?: number;
|
|
172
|
+
eventTimeRange?: [string, string]; // [start, end] ISO timestamps
|
|
173
|
+
parentId?: string;
|
|
174
|
+
contentType?: string;
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## MemoryOptions Reference
|
|
179
|
+
|
|
180
|
+
> **Embedding is internal** — pyx-memory uses `LocalEmbeddingProvider` with BGE-M3 (1024d) automatically. You do NOT pass an `embedder` option.
|
|
181
|
+
|
|
182
|
+
| Field | Type | Required | Default | Notes |
|
|
183
|
+
|-------|------|----------|---------|-------|
|
|
184
|
+
| `dataDir` | `string` | no | `'./data'` | Use `':memory:'` for tests (LanceDB still writes to `/tmp`) |
|
|
185
|
+
| `vectorProvider` | `VectorProvider` | no | `'lancedb'` | |
|
|
186
|
+
| `dimensions` | `number` | no | `1024` | Default: 1024 (matches internal BGE-M3 model) |
|
|
187
|
+
| `graphStore` | `GraphStore` | no | `undefined` | Enables graph target in store routing |
|
|
188
|
+
| `reasoningProvider` | `ReasoningProvider` | no | `undefined` | Enables agentic RAG |
|
|
189
|
+
| `llm` | `LLMCallback` | no | `undefined` | Enables LLM-powered lifecycle (consolidation, summarization, scoring) |
|
|
190
|
+
| `skipDuplicates` | `boolean` | no | `false` | Content-hash dedup on store |
|
|
191
|
+
| `agentId` | `string` | no | `undefined` | Auto-scopes ALL store/search/stats/decay operations to this agent |
|
|
192
|
+
| `qdrantUrl` | `string` | no | `undefined` | @deprecated — Qdrant support is vestigial |
|
|
193
|
+
|
|
194
|
+
## Embedding Dimension Defaults by Provider
|
|
195
|
+
|
|
196
|
+
> **Memory always uses `LocalEmbeddingProvider` internally.** The other providers are available for standalone use but are not used by the `Memory` class.
|
|
197
|
+
|
|
198
|
+
| Provider | Default Dimensions | Model |
|
|
199
|
+
|----------|-------------------|-------|
|
|
200
|
+
| `StubEmbeddingProvider` | 1024 | hash-based (testing only) |
|
|
201
|
+
| `OpenAIEmbeddingProvider` | 1536 | text-embedding-3-small |
|
|
202
|
+
| `AnthropicEmbeddingProvider` | 1024 | voyage-3 (Voyage AI) |
|
|
203
|
+
| `LocalEmbeddingProvider` | 1024 | BGE-M3 (ONNX int8 quantized) |
|