novyx 2.9.1 → 2.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Novyx SDK for JavaScript / TypeScript
2
2
 
3
- Persistent memory, rollback, and audit trail for AI agents.
3
+ **Persistent memory + rollback + audit trail for AI agents.** Give your AI persistent memory, semantic search, Magic Rollback to undo mistakes, cryptographic audit trails, context spaces for multi-agent collaboration, replay for time-travel debugging, and cortex for autonomous memory intelligence.
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,22 +16,210 @@ import { Novyx } from "novyx";
16
16
  const nx = new Novyx({ apiKey: "nram_your_key_here" });
17
17
 
18
18
  // Store a memory
19
- await nx.remember("User prefers dark mode", { tags: ["ui", "prefs"], importance: 8 });
19
+ await nx.remember("User prefers dark mode and async communication", {
20
+ tags: ["preferences"],
21
+ importance: 8,
22
+ });
20
23
 
21
- // Search semantically
22
- const results = await nx.recall("user preferences");
24
+ // Search memories semantically
25
+ const results = await nx.recall("communication style", { limit: 5 });
23
26
  for (const mem of results.memories) {
24
27
  console.log(`${mem.observation} (score: ${mem.score})`);
25
28
  }
26
29
 
27
- // Get a specific memory
28
- const mem = await nx.memory("urn:uuid:...");
30
+ // Check audit trail
31
+ const audit = await nx.audit({ limit: 10 });
29
32
 
30
- // Delete a memory
31
- await nx.forget("urn:uuid:...");
33
+ // Magic Rollback — undo to any point in time (Pro+)
34
+ await nx.rollback("2 hours ago");
32
35
  ```
33
36
 
34
- ## Sessions
37
+ ## Complete Lifecycle Example
38
+
39
+ ```typescript
40
+ import { Novyx } from "novyx";
41
+
42
+ const nx = new Novyx({ apiKey: "nram_your_key_here" });
43
+
44
+ // 1. Store memories
45
+ await nx.remember("User mentioned budget is $50K for Q1", {
46
+ tags: ["sales", "budget"],
47
+ importance: 8,
48
+ });
49
+ await nx.remember("User prefers email over phone calls", {
50
+ tags: ["preferences"],
51
+ importance: 7,
52
+ });
53
+ await nx.remember("User is building a real estate AI assistant", {
54
+ tags: ["project"],
55
+ });
56
+
57
+ // 2. Semantic search
58
+ const results = await nx.recall("what is the user's budget?", { limit: 3 });
59
+ console.log(`Found: ${results.memories[0].observation}`);
60
+
61
+ // 3. Check audit trail
62
+ const audit = await nx.audit({ limit: 5 });
63
+
64
+ // 4. Preview rollback first, then execute (Pro+)
65
+ const preview = await nx.rollbackPreview("1 hour ago");
66
+ const result = await nx.rollback("1 hour ago");
67
+
68
+ // 5. Trace agent actions (Pro+)
69
+ const trace = await nx.traceCreate("sales-agent", "session-123");
70
+ await nx.traceStep(trace.trace_id, "thought", "Analyzing budget", "User has $50K");
71
+ await nx.traceStep(trace.trace_id, "action", "draft_proposal");
72
+ const completed = await nx.traceComplete(trace.trace_id);
73
+ ```
74
+
75
+ ## Features
76
+
77
+ ### Persistent Memory
78
+
79
+ Store observations about users, contexts, and decisions. Your AI remembers everything across sessions.
80
+
81
+ ```typescript
82
+ // Store with full options
83
+ await nx.remember("Customer mentioned budget is $50K for Q1", {
84
+ tags: ["sales", "budget"],
85
+ importance: 8,
86
+ metadata: { customer_id: "12345", quarter: "Q1" },
87
+ agent_id: "sales-agent",
88
+ });
89
+
90
+ // List all memories
91
+ const list = await nx.list({ limit: 100, min_importance: 7 });
92
+ console.log(`Found ${list.total_count} high-importance memories`);
93
+
94
+ // Get specific memory
95
+ const mem = await nx.memory("urn:uuid:abc123...");
96
+
97
+ // Delete memory
98
+ await nx.forget("urn:uuid:abc123...");
99
+
100
+ // Get stats
101
+ const stats = await nx.stats();
102
+ ```
103
+
104
+ ### Semantic Search
105
+
106
+ Find relevant memories using natural language queries. No exact keyword matching required.
107
+
108
+ ```typescript
109
+ const results = await nx.recall("what is the user working on?", { limit: 3 });
110
+ // Returns: "User is building a real estate AI assistant"
111
+
112
+ // Filter by tags
113
+ const filtered = await nx.recall("budget constraints", {
114
+ tags: ["sales"],
115
+ limit: 5,
116
+ min_score: 0.5,
117
+ });
118
+
119
+ // Filter by agent
120
+ const agentResults = await nx.recall("preferences", {
121
+ agents: ["sales-agent"],
122
+ });
123
+ ```
124
+
125
+ ### Magic Rollback (Pro+)
126
+
127
+ Made a mistake? Roll back your AI's memory to any point in time.
128
+
129
+ ```typescript
130
+ // Preview rollback first
131
+ const preview = await nx.rollbackPreview("2 hours ago");
132
+
133
+ // Execute rollback
134
+ const result = await nx.rollback("2 hours ago");
135
+
136
+ // Rollback with options
137
+ await nx.rollback("2 hours ago", { dryRun: true, preserveEvidence: true });
138
+
139
+ // View rollback history
140
+ const history = await nx.rollbackHistory(10);
141
+ ```
142
+
143
+ ### Cryptographic Audit Trail
144
+
145
+ Every operation is logged with SHA-256 hashing for tamper-proof history.
146
+
147
+ ```typescript
148
+ // Get recent audit entries
149
+ const audit = await nx.audit({ limit: 50 });
150
+
151
+ // Export audit log (Pro+)
152
+ const csv = await nx.auditExport("csv");
153
+
154
+ // Verify integrity
155
+ const verification = await nx.auditVerify();
156
+ console.log(`Valid: ${verification.valid}`);
157
+ ```
158
+
159
+ ### Trace Audit (Pro+)
160
+
161
+ Track agent actions with RSA signatures and real-time policy enforcement.
162
+
163
+ ```typescript
164
+ // Create trace session
165
+ const trace = await nx.traceCreate("my-agent", "session-123");
166
+
167
+ // Add steps
168
+ await nx.traceStep(trace.trace_id, "thought", "Planning email");
169
+ await nx.traceStep(trace.trace_id, "action", "send_email", undefined, {
170
+ to: "user@example.com",
171
+ });
172
+ await nx.traceStep(trace.trace_id, "observation", "Email sent successfully");
173
+
174
+ // Finalize with RSA signature
175
+ const result = await nx.traceComplete(trace.trace_id);
176
+
177
+ // Verify integrity later
178
+ const verification = await nx.traceVerify(trace.trace_id);
179
+ ```
180
+
181
+ ### Context Spaces (Multi-Agent)
182
+
183
+ Create shared memory spaces for multi-agent collaboration with fine-grained permissions.
184
+
185
+ ```typescript
186
+ // Share a tag with another user
187
+ await nx.shareContext("project-notes", "colleague@example.com", "write");
188
+
189
+ // List shared spaces
190
+ const spaces = await nx.sharedContexts();
191
+
192
+ // Accept a share invitation
193
+ await nx.acceptSharedContext("token_abc123");
194
+
195
+ // Store and recall in a space
196
+ await nx.remember("Shared insight", { space_id: "cs_abc123", tags: ["shared"] });
197
+ const results = await nx.recall("insights", { space_id: "cs_abc123" });
198
+
199
+ // Revoke access
200
+ await nx.revokeSharedContext("token_abc123");
201
+ ```
202
+
203
+ ### Knowledge Graph & Links
204
+
205
+ Create relationships between memories — build a connected knowledge base.
206
+
207
+ ```typescript
208
+ // Link two memories
209
+ await nx.link("mem-1", "mem-2", { relation: "caused_by", weight: 0.9 });
210
+
211
+ // Get links for a memory
212
+ const linked = await nx.links("mem-1");
213
+ console.log(linked.edges);
214
+
215
+ // Remove a link
216
+ await nx.unlink("mem-1", "mem-2", "caused_by");
217
+
218
+ // Get full memory graph
219
+ const graph = await nx.graph();
220
+ ```
221
+
222
+ ### Sessions
35
223
 
36
224
  Automatically tag and filter memories by session:
37
225
 
@@ -43,23 +231,73 @@ const results = await session.recall("billing");
43
231
  // Only returns memories from this session
44
232
  ```
45
233
 
46
- ## Links / Graph
234
+ ### Replay Time-Travel Debugging (Pro+)
47
235
 
48
- Create relationships between memories:
236
+ Inspect how your agent's memory changed over time.
49
237
 
50
238
  ```typescript
51
- await nx.link("mem-1", "mem-2", { relation: "caused_by", weight: 0.9 });
239
+ // Timeline of operations
240
+ const timeline = await nx.replayTimeline({
241
+ since: "2026-01-01T00:00:00Z",
242
+ limit: 50,
243
+ });
244
+ for (const entry of timeline.entries) {
245
+ console.log(`${entry.timestamp} - ${entry.operation}`);
246
+ }
52
247
 
53
- const linked = await nx.links("mem-1");
54
- console.log(linked.edges);
248
+ // Point-in-time snapshot
249
+ const snapshot = await nx.replaySnapshot("2026-01-15T10:00:00Z");
250
+ console.log(`${snapshot.total_memories} memories at that point`);
55
251
 
56
- await nx.unlink("mem-1", "mem-2", "caused_by");
252
+ // Full lifecycle of a memory
253
+ const lifecycle = await nx.replayMemory("urn:uuid:abc123...");
254
+
255
+ // Diff between two timestamps
256
+ const diff = await nx.replayDiff("2026-01-01T00:00:00Z", "2026-01-15T00:00:00Z");
257
+ console.log(`Added: ${diff.summary.added}, Removed: ${diff.summary.removed}`);
258
+
259
+ // Counterfactual recall — what would the agent have recalled? (Enterprise)
260
+ const recall = await nx.replayRecall("user preferences", "2026-01-10T00:00:00Z");
261
+
262
+ // Memory composition drift (Enterprise)
263
+ const drift = await nx.replayDrift("2026-01-01T00:00:00Z", "2026-02-01T00:00:00Z");
264
+ ```
265
+
266
+ ### Cortex — Autonomous Memory Intelligence (Pro+)
267
+
268
+ Your memory gets smarter on its own. Cortex consolidates near-duplicates, boosts frequently-recalled memories, decays forgotten ones, and generates insights.
269
+
270
+ ```typescript
271
+ // Check cortex status
272
+ const status = await nx.cortexStatus();
273
+ console.log(`Enabled: ${status.enabled}, Last run: ${status.last_run_at}`);
274
+
275
+ // Configure cortex
276
+ await nx.cortexUpdateConfig({
277
+ consolidation_enabled: true,
278
+ consolidation_threshold: 0.9,
279
+ decay_age_days: 30,
280
+ });
281
+
282
+ // Trigger a manual cycle
283
+ const result = await nx.cortexRun();
284
+ console.log(
285
+ `Consolidated: ${result.consolidated}, Boosted: ${result.boosted}, Decayed: ${result.decayed}`
286
+ );
287
+
288
+ // Get insights (Enterprise)
289
+ const insights = await nx.cortexInsights({ limit: 10 });
290
+ for (const insight of insights.insights) {
291
+ console.log(`Insight: ${insight.observation}`);
292
+ }
57
293
  ```
58
294
 
59
295
  ## API Reference
60
296
 
297
+ ### Memory Methods
298
+
61
299
  | Method | Description |
62
- |---|---|
300
+ |--------|-------------|
63
301
  | `remember(observation, opts?)` | Store a memory |
64
302
  | `recall(query, opts?)` | Semantic search |
65
303
  | `memories(opts?)` | List memories (raw) |
@@ -68,33 +306,92 @@ await nx.unlink("mem-1", "mem-2", "caused_by");
68
306
  | `delete(id)` | Alias for forget |
69
307
  | `list(opts?)` | List memories (ListResult) |
70
308
  | `stats()` | Memory statistics |
71
- | `shareContext(tag, email, permission?)` | Share a context space |
72
- | `acceptSharedContext(token)` | Join a shared space |
73
- | `sharedContexts()` | List shared spaces |
74
- | `revokeSharedContext(token)` | Revoke a share |
75
- | `graph(opts?)` | Get memory graph |
76
- | `rollback(target, dryRun?, preserveEvidence?)` | Rollback memories |
77
- | `rollbackPreview(target)` | Preview rollback |
309
+ | `supersede(oldId, newId)` | Mark a memory as superseded |
310
+
311
+ ### Rollback Methods (Pro+)
312
+
313
+ | Method | Description |
314
+ |--------|-------------|
315
+ | `rollback(target, opts?)` | Rollback to timestamp or relative time |
316
+ | `rollbackPreview(target)` | Preview rollback changes |
78
317
  | `rollbackHistory(limit?)` | List past rollbacks |
79
- | `audit(opts?)` | Get audit trail |
80
- | `auditExport(format?)` | Export audit log |
318
+
319
+ ### Audit Methods
320
+
321
+ | Method | Description |
322
+ |--------|-------------|
323
+ | `audit(opts?)` | Get audit entries |
324
+ | `auditExport(format?)` | Export audit log (Pro+) |
81
325
  | `auditVerify()` | Verify audit integrity |
82
- | `traceCreate(agentId, sessionId?, metadata?)` | Create trace |
326
+
327
+ ### Trace Methods (Pro+)
328
+
329
+ | Method | Description |
330
+ |--------|-------------|
331
+ | `traceCreate(agentId, sessionId?, metadata?)` | Create trace session |
83
332
  | `traceStep(traceId, stepType, name, content?, attrs?)` | Add trace step |
84
- | `traceComplete(traceId)` | Complete trace |
85
- | `traceVerify(traceId)` | Verify trace |
333
+ | `traceComplete(traceId)` | Finalize trace with RSA signature |
334
+ | `traceVerify(traceId)` | Verify trace integrity |
335
+
336
+ ### Context Space Methods
337
+
338
+ | Method | Description |
339
+ |--------|-------------|
340
+ | `shareContext(tag, email, permission?)` | Share a tag/space |
341
+ | `acceptSharedContext(token)` | Accept share invitation |
342
+ | `sharedContexts()` | List shared spaces |
343
+ | `revokeSharedContext(token)` | Revoke a share |
344
+
345
+ ### Knowledge Graph & Link Methods
346
+
347
+ | Method | Description |
348
+ |--------|-------------|
349
+ | `link(sourceId, targetId, opts?)` | Create a directed edge |
350
+ | `unlink(sourceId, targetId, relation?)` | Remove a link |
351
+ | `links(memoryId, relation?)` | Get memory links |
352
+ | `graph(opts?)` | Get memory graph |
353
+
354
+ ### Replay Methods (Pro+)
355
+
356
+ | Method | Description |
357
+ |--------|-------------|
358
+ | `replayTimeline(opts?)` | Timeline of memory operations |
359
+ | `replaySnapshot(at, opts?)` | Reconstruct memory state at timestamp |
360
+ | `replayMemory(memoryId)` | Full lifecycle of a single memory |
361
+ | `replayDiff(from, to)` | Diff between two timestamps |
362
+ | `replayRecall(query, at, opts?)` | Counterfactual recall (Enterprise) |
363
+ | `replayDrift(from, to)` | Memory composition drift (Enterprise) |
364
+
365
+ ### Cortex Methods (Pro+)
366
+
367
+ | Method | Description |
368
+ |--------|-------------|
369
+ | `cortexStatus()` | Get cortex status, last run, and config |
370
+ | `cortexConfig()` | Get current cortex configuration |
371
+ | `cortexUpdateConfig(updates)` | Update cortex settings |
372
+ | `cortexRun()` | Trigger a manual cortex cycle |
373
+ | `cortexInsights(opts?)` | Get generated insights (Enterprise) |
374
+
375
+ ### Session & Utility Methods
376
+
377
+ | Method | Description |
378
+ |--------|-------------|
379
+ | `session(sessionId)` | Create session scope |
380
+ | `contextNow()` | Get temporal context snapshot |
86
381
  | `usage()` | Current usage stats |
87
382
  | `plans()` | Available plans |
88
383
  | `health()` | API health check |
89
- | `session(sessionId)` | Create session scope |
90
- | `link(sourceId, targetId, opts?)` | Link two memories |
91
- | `unlink(sourceId, targetId, relation?)` | Remove a link |
92
- | `links(memoryId, relation?)` | Get memory links |
93
384
 
94
385
  ## Error Handling
95
386
 
96
387
  ```typescript
97
- import { Novyx, NovyxAuthError, NovyxForbiddenError, NovyxRateLimitError } from "novyx";
388
+ import {
389
+ Novyx,
390
+ NovyxAuthError,
391
+ NovyxForbiddenError,
392
+ NovyxRateLimitError,
393
+ NovyxNotFoundError,
394
+ } from "novyx";
98
395
 
99
396
  try {
100
397
  await nx.rollback("2 hours ago");
@@ -104,10 +401,30 @@ try {
104
401
  console.log(`Upgrade at: ${err.upgradeUrl}`);
105
402
  } else if (err instanceof NovyxRateLimitError) {
106
403
  console.log(`Limit: ${err.limitType}, retry in ${err.retryAfter}s`);
404
+ } else if (err instanceof NovyxNotFoundError) {
405
+ console.log("Memory not found");
406
+ } else if (err instanceof NovyxAuthError) {
407
+ console.log("Invalid API key");
107
408
  }
108
409
  }
109
410
  ```
110
411
 
412
+ ## Pricing
413
+
414
+ | Tier | Price | Memories | API Calls | Rollbacks | Audit | Features |
415
+ |------|-------|----------|-----------|-----------|-------|----------|
416
+ | **Free** | $0 | 5,000 | 5,000/mo | 10/month | 7 days | Basic memory, LWW conflict resolution |
417
+ | **Starter** | $12/mo | 25,000 | 25,000/mo | 30/month | 14 days | + All conflict strategies |
418
+ | **Pro** | $39/mo | Unlimited | 100,000/mo | Unlimited | 30 days | + Replay, Cortex, traces, knowledge graph |
419
+ | **Enterprise** | $199/mo | Unlimited | Unlimited | Unlimited | 90 days | + Cortex insights, counterfactual recall, drift analysis |
420
+
421
+ ## Links
422
+
423
+ - [API Documentation](https://novyx-ram-api.fly.dev/docs)
424
+ - [Endpoint Reference](https://github.com/novyx-labs/novyx-core/blob/main/ENDPOINTS.md)
425
+ - [Pricing](https://novyxlabs.com/pricing)
426
+ - [Get API Key](https://novyxlabs.com)
427
+
111
428
  ## License
112
429
 
113
430
  MIT
package/dist/index.d.mts CHANGED
@@ -273,11 +273,13 @@ declare class Novyx {
273
273
  tags?: string[];
274
274
  context?: string;
275
275
  importance?: number;
276
+ confidence?: number;
276
277
  agent_id?: string;
277
278
  space_id?: string;
278
279
  metadata?: Record<string, any>;
279
280
  ttl_seconds?: number;
280
281
  auto_link?: boolean;
282
+ conflict_strategy?: "reject" | "lww" | "merge";
281
283
  }): Promise<Record<string, any>>;
282
284
  recall(query: string, opts?: {
283
285
  limit?: number;
@@ -339,6 +341,7 @@ declare class Novyx {
339
341
  traceComplete(traceId: string): Promise<Record<string, any>>;
340
342
  traceVerify(traceId: string): Promise<Record<string, any>>;
341
343
  usage(): Promise<Record<string, any>>;
344
+ dashboard(): Promise<Record<string, any>>;
342
345
  plans(): Promise<Record<string, any>[]>;
343
346
  health(): Promise<Record<string, any>>;
344
347
  session(sessionId: string): NovyxSession;
package/dist/index.d.ts CHANGED
@@ -273,11 +273,13 @@ declare class Novyx {
273
273
  tags?: string[];
274
274
  context?: string;
275
275
  importance?: number;
276
+ confidence?: number;
276
277
  agent_id?: string;
277
278
  space_id?: string;
278
279
  metadata?: Record<string, any>;
279
280
  ttl_seconds?: number;
280
281
  auto_link?: boolean;
282
+ conflict_strategy?: "reject" | "lww" | "merge";
281
283
  }): Promise<Record<string, any>>;
282
284
  recall(query: string, opts?: {
283
285
  limit?: number;
@@ -339,6 +341,7 @@ declare class Novyx {
339
341
  traceComplete(traceId: string): Promise<Record<string, any>>;
340
342
  traceVerify(traceId: string): Promise<Record<string, any>>;
341
343
  usage(): Promise<Record<string, any>>;
344
+ dashboard(): Promise<Record<string, any>>;
342
345
  plans(): Promise<Record<string, any>[]>;
343
346
  health(): Promise<Record<string, any>>;
344
347
  session(sessionId: string): NovyxSession;
package/dist/index.js CHANGED
@@ -210,6 +210,7 @@ var Novyx = class {
210
210
  tags: opts?.tags ?? [],
211
211
  importance: opts?.importance ?? 5
212
212
  };
213
+ if (opts?.confidence !== void 0) body.confidence = opts.confidence;
213
214
  if (resolvedAgentId) body.agent_id = resolvedAgentId;
214
215
  if (opts?.space_id) body.space_id = opts.space_id;
215
216
  if (opts?.ttl_seconds !== void 0) body.ttl_seconds = opts.ttl_seconds;
@@ -219,7 +220,9 @@ var Novyx = class {
219
220
  } else if (opts?.metadata) {
220
221
  body.context = JSON.stringify(opts.metadata);
221
222
  }
222
- return this._request("POST", "/v1/memories", { body });
223
+ const params = {};
224
+ if (opts?.conflict_strategy) params.conflict_strategy = opts.conflict_strategy;
225
+ return this._request("POST", "/v1/memories", { body, params: Object.keys(params).length ? params : void 0 });
223
226
  }
224
227
  async recall(query, opts) {
225
228
  const params = {
@@ -389,6 +392,9 @@ var Novyx = class {
389
392
  async usage() {
390
393
  return this._request("GET", "/v1/usage");
391
394
  }
395
+ async dashboard() {
396
+ return this._request("GET", "/v1/dashboard");
397
+ }
392
398
  async plans() {
393
399
  return this._request("GET", "/v1/plans");
394
400
  }
package/dist/index.mjs CHANGED
@@ -177,6 +177,7 @@ var Novyx = class {
177
177
  tags: opts?.tags ?? [],
178
178
  importance: opts?.importance ?? 5
179
179
  };
180
+ if (opts?.confidence !== void 0) body.confidence = opts.confidence;
180
181
  if (resolvedAgentId) body.agent_id = resolvedAgentId;
181
182
  if (opts?.space_id) body.space_id = opts.space_id;
182
183
  if (opts?.ttl_seconds !== void 0) body.ttl_seconds = opts.ttl_seconds;
@@ -186,7 +187,9 @@ var Novyx = class {
186
187
  } else if (opts?.metadata) {
187
188
  body.context = JSON.stringify(opts.metadata);
188
189
  }
189
- return this._request("POST", "/v1/memories", { body });
190
+ const params = {};
191
+ if (opts?.conflict_strategy) params.conflict_strategy = opts.conflict_strategy;
192
+ return this._request("POST", "/v1/memories", { body, params: Object.keys(params).length ? params : void 0 });
190
193
  }
191
194
  async recall(query, opts) {
192
195
  const params = {
@@ -356,6 +359,9 @@ var Novyx = class {
356
359
  async usage() {
357
360
  return this._request("GET", "/v1/usage");
358
361
  }
362
+ async dashboard() {
363
+ return this._request("GET", "/v1/dashboard");
364
+ }
359
365
  async plans() {
360
366
  return this._request("GET", "/v1/plans");
361
367
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "novyx",
3
- "version": "2.9.1",
3
+ "version": "2.10.0",
4
4
  "description": "Novyx SDK - Persistent memory, rollback, and audit trail for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",