@memnexus-ai/sdk 1.55.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.
- package/README.md +167 -0
- package/dist/index.cjs +3004 -0
- package/dist/index.d.cts +4291 -0
- package/dist/index.d.ts +4291 -0
- package/dist/index.js +2976 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# @memnexus-ai/sdk
|
|
2
|
+
|
|
3
|
+
Official Node.js / TypeScript SDK for the [MemNexus](https://memnexus.ai) API — persistent AI memory management.
|
|
4
|
+
|
|
5
|
+
**Version:** 1.53.28
|
|
6
|
+
**Node.js:** >= 18.0.0
|
|
7
|
+
**Dependencies:** none (uses native fetch)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @memnexus-ai/sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { MemNexus } from '@memnexus-ai/sdk';
|
|
19
|
+
|
|
20
|
+
const client = new MemNexus({ apiKey: 'your-api-key' });
|
|
21
|
+
|
|
22
|
+
// Save a memory
|
|
23
|
+
await client.remember('I deployed the new feature to production');
|
|
24
|
+
|
|
25
|
+
// Search memories
|
|
26
|
+
const results = await client.search('deployment history');
|
|
27
|
+
console.log(results.data);
|
|
28
|
+
|
|
29
|
+
// Build context briefing
|
|
30
|
+
const briefing = await client.brief('working on auth module');
|
|
31
|
+
console.log(briefing.data);
|
|
32
|
+
|
|
33
|
+
// Recall a digest
|
|
34
|
+
const digest = await client.recall('authentication decisions');
|
|
35
|
+
console.log(digest.data);
|
|
36
|
+
|
|
37
|
+
// Delete a memory
|
|
38
|
+
await client.forget('mem_abc123');
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Authentication
|
|
42
|
+
|
|
43
|
+
Pass the API key directly or via the `MEMNEXUS_API_KEY` environment variable:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
// Direct
|
|
47
|
+
const client = new MemNexus({ apiKey: 'your-api-key' });
|
|
48
|
+
|
|
49
|
+
// Environment variable
|
|
50
|
+
process.env.MEMNEXUS_API_KEY = 'your-api-key';
|
|
51
|
+
const client = new MemNexus();
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Services
|
|
55
|
+
|
|
56
|
+
The client exposes a service for each API resource group:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
const client = new MemNexus({ apiKey: 'your-api-key' });
|
|
60
|
+
|
|
61
|
+
// User management and profile endpoints
|
|
62
|
+
client.users
|
|
63
|
+
|
|
64
|
+
// Topic detection, clustering, and management endpoints
|
|
65
|
+
client.topics
|
|
66
|
+
|
|
67
|
+
// System health, monitoring, and configuration endpoints
|
|
68
|
+
client.system
|
|
69
|
+
|
|
70
|
+
// Pattern detection and behavioral analysis endpoints
|
|
71
|
+
client.patterns
|
|
72
|
+
|
|
73
|
+
// Behavioral pattern tracking and state management endpoints
|
|
74
|
+
client.behavior
|
|
75
|
+
|
|
76
|
+
// Behavioral recommendation management endpoints (v2)
|
|
77
|
+
client.recommendations
|
|
78
|
+
|
|
79
|
+
// Narrative thread management endpoints
|
|
80
|
+
client.narratives
|
|
81
|
+
|
|
82
|
+
// Observability and metrics endpoints for production monitoring
|
|
83
|
+
client.monitoring
|
|
84
|
+
|
|
85
|
+
// Memory management and retrieval endpoints
|
|
86
|
+
client.memories
|
|
87
|
+
|
|
88
|
+
// Invite code validation and gate status endpoints
|
|
89
|
+
client.invites
|
|
90
|
+
|
|
91
|
+
// Health check endpoints
|
|
92
|
+
client.health
|
|
93
|
+
|
|
94
|
+
// Graph-based retrieval augmented generation endpoints
|
|
95
|
+
client.graphrag
|
|
96
|
+
|
|
97
|
+
// Fact extraction and management endpoints
|
|
98
|
+
client.facts
|
|
99
|
+
|
|
100
|
+
// Entity extraction and discovery endpoints
|
|
101
|
+
client.entities
|
|
102
|
+
|
|
103
|
+
// Conversation tracking and analysis endpoints
|
|
104
|
+
client.conversations
|
|
105
|
+
|
|
106
|
+
// Subscription billing and payment management endpoints
|
|
107
|
+
client.billing
|
|
108
|
+
|
|
109
|
+
// Artifact storage and retrieval endpoints
|
|
110
|
+
client.artifacts
|
|
111
|
+
|
|
112
|
+
// API key management endpoints
|
|
113
|
+
client.apiKeys
|
|
114
|
+
|
|
115
|
+
// System alerts banner endpoints (customer portal)
|
|
116
|
+
client.alerts
|
|
117
|
+
|
|
118
|
+
// Admin management endpoints for invite codes and platform configuration
|
|
119
|
+
client.admin
|
|
120
|
+
|
|
121
|
+
// Admin endpoints for managing system alerts
|
|
122
|
+
client.adminAlerts
|
|
123
|
+
|
|
124
|
+
// Admin Pipeline
|
|
125
|
+
client.adminPipeline
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Error Handling
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
import { MemNexus, SdkError } from '@memnexus-ai/sdk';
|
|
132
|
+
|
|
133
|
+
const client = new MemNexus({ apiKey: 'your-api-key' });
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
await client.remember('my memory');
|
|
137
|
+
} catch (err) {
|
|
138
|
+
if (err instanceof SdkError) {
|
|
139
|
+
console.error(`API error ${err.status}: ${err.statusText}`);
|
|
140
|
+
console.error('Response body:', err.data);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Configuration
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
const client = new MemNexus({
|
|
149
|
+
apiKey: 'your-api-key',
|
|
150
|
+
baseUrl: 'https://api.memnexus.ai', // default
|
|
151
|
+
timeoutMs: 30_000, // default: 30 seconds
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Retry Behaviour
|
|
156
|
+
|
|
157
|
+
The client automatically retries failed requests with exponential backoff:
|
|
158
|
+
|
|
159
|
+
- **Max attempts:** 5
|
|
160
|
+
- **Base delay:** 500 ms
|
|
161
|
+
- **Max delay:** 10 000 ms
|
|
162
|
+
- **Backoff factor:** 2×
|
|
163
|
+
- **Retried status codes:** 408, 429, 500, 502, 503, 504
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
Proprietary — Copyright © MemNexus Team
|