@dakera-ai/dakera 0.11.54 → 0.11.56
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 +172 -38
- package/dist/index.d.mts +616 -12
- package/dist/index.d.ts +616 -12
- package/dist/index.js +325 -23
- package/dist/index.mjs +325 -23
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,78 +1,212 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://github.com/dakera-ai.png" alt="Dakera AI" width="80" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">dakera-js</h1>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
TypeScript/JavaScript SDK for <a href="https://dakera.ai">Dakera AI</a> — the memory engine for AI agents
|
|
9
|
+
</p>
|
|
6
10
|
|
|
7
|
-
>
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://github.com/Dakera-AI/dakera-js/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/Dakera-AI/dakera-js/actions/workflows/ci.yml/badge.svg" /></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@dakera-ai/dakera"><img alt="npm" src="https://img.shields.io/npm/v/%40dakera-ai%2Fdakera?logo=npm" /></a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/@dakera-ai/dakera"><img alt="Downloads" src="https://img.shields.io/npm/dm/%40dakera-ai%2Fdakera" /></a>
|
|
15
|
+
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/github/license/Dakera-AI/dakera-js" /></a>
|
|
16
|
+
<a href="https://dakera.ai/docs"><img alt="Docs" src="https://img.shields.io/badge/docs-dakera.ai%2Fdocs-3b82f6?style=flat-square" /></a>
|
|
17
|
+
<a href="https://dakera.ai/benchmark"><img alt="LoCoMo 87.8%" src="https://img.shields.io/badge/LoCoMo-87.8%25-22c55e?style=flat-square" /></a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Why Dakera?
|
|
23
|
+
|
|
24
|
+
| | Dakera | Others |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| **LoCoMo accuracy** | **87.8%** (1,540 Q standard eval) | 60–92% |
|
|
27
|
+
| **Deployment** | Single binary, Docker one-liner | External vector DB + embedding service required |
|
|
28
|
+
| **Embeddings** | Built-in — no OpenAI key needed | Requires external embedding API |
|
|
29
|
+
| **Search modes** | Vector · BM25 · Hybrid · Knowledge Graph | Usually one or two |
|
|
30
|
+
| **Bundle** | ESM + CJS, browser-compatible | Often Node-only |
|
|
31
|
+
|
|
32
|
+
→ [Full benchmark results](https://dakera.ai/benchmark) · [dakera.ai](https://dakera.ai)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Run Dakera
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
docker run -d \
|
|
40
|
+
--name dakera \
|
|
41
|
+
-p 3300:3300 \
|
|
42
|
+
-e DAKERA_ROOT_API_KEY=dk-mykey \
|
|
43
|
+
ghcr.io/dakera-ai/dakera:latest
|
|
44
|
+
|
|
45
|
+
curl http://localhost:3300/health # → {"status":"ok"}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For persistent storage with Docker Compose:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
curl -sSfL https://raw.githubusercontent.com/Dakera-AI/dakera-deploy/main/docker-compose.yml \
|
|
52
|
+
-o docker-compose.yml
|
|
53
|
+
DAKERA_API_KEY=dk-mykey docker compose up -d
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Full deployment guide (Docker Compose, Kubernetes, Helm): [dakera-deploy](https://github.com/Dakera-AI/dakera-deploy)
|
|
8
57
|
|
|
9
58
|
---
|
|
10
59
|
|
|
11
60
|
## Install
|
|
12
61
|
|
|
13
62
|
```bash
|
|
14
|
-
npm install dakera
|
|
63
|
+
npm install @dakera-ai/dakera
|
|
15
64
|
```
|
|
16
65
|
|
|
66
|
+
Works with **Node.js** (20+), **Deno**, **Bun**, **Cloudflare Workers**, and modern browsers. Ships ESM + CJS with full TypeScript declarations.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
17
70
|
## Quick Start
|
|
18
71
|
|
|
19
72
|
```typescript
|
|
20
|
-
import { DakeraClient } from 'dakera';
|
|
73
|
+
import { DakeraClient } from '@dakera-ai/dakera';
|
|
21
74
|
|
|
22
75
|
const client = new DakeraClient({
|
|
23
76
|
baseUrl: 'http://localhost:3300',
|
|
24
|
-
apiKey: '
|
|
77
|
+
apiKey: 'dk-mykey',
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Store an agent memory
|
|
81
|
+
await client.storeMemory('my-agent', {
|
|
82
|
+
content: 'User prefers concise responses with code examples',
|
|
83
|
+
importance: 0.9,
|
|
84
|
+
memory_type: 'semantic',
|
|
25
85
|
});
|
|
26
86
|
|
|
27
|
-
//
|
|
28
|
-
await client.
|
|
29
|
-
|
|
30
|
-
values: [0.1, 0.2, 0.3],
|
|
31
|
-
metadata: { text: 'agent completed task', agentId: 'my-agent' },
|
|
87
|
+
// Recall memories (semantic search)
|
|
88
|
+
const response = await client.recall('my-agent', 'what does the user prefer?', {
|
|
89
|
+
top_k: 5,
|
|
32
90
|
});
|
|
91
|
+
for (const m of response.memories) {
|
|
92
|
+
console.log(`[${m.score?.toFixed(2)}] ${m.content}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Upsert vectors
|
|
96
|
+
await client.upsert('my-namespace', [
|
|
97
|
+
{ id: 'vec1', values: [0.1, 0.2, 0.3], metadata: { category: 'docs' } },
|
|
98
|
+
]);
|
|
99
|
+
|
|
100
|
+
// Hybrid search (vector + BM25)
|
|
101
|
+
const results = await client.hybridSearch('my-namespace', 'completed task', { topK: 5, vectorWeight: 0.7 });
|
|
102
|
+
for (const r of results) {
|
|
103
|
+
console.log(r.id, r.score);
|
|
104
|
+
}
|
|
105
|
+
```
|
|
33
106
|
|
|
34
|
-
|
|
35
|
-
const results = await client.fulltext.search({ query: 'completed task', topK: 5 });
|
|
36
|
-
results.forEach(r => console.log(r.id, r.score));
|
|
107
|
+
### SSE Streaming
|
|
37
108
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
109
|
+
```typescript
|
|
110
|
+
// Subscribe to real-time memory events
|
|
111
|
+
const stream = client.subscribeMemoryEvents('my-agent');
|
|
112
|
+
for await (const event of stream) {
|
|
113
|
+
console.log(event.type, event.memory_id);
|
|
114
|
+
}
|
|
45
115
|
```
|
|
46
116
|
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Features
|
|
120
|
+
|
|
121
|
+
- **Agent Memory** — store, recall, search, and forget memories with importance scoring
|
|
122
|
+
- **Sessions** — group memories by conversation with auto-consolidation on session end
|
|
123
|
+
- **Knowledge Graph** — traverse memory relationships, find paths, export graphs
|
|
124
|
+
- **Vector Search** — ANN queries with metadata filters and batch operations
|
|
125
|
+
- **Full-Text Search** — BM25 ranking with stemming and stop-word filtering
|
|
126
|
+
- **Hybrid Search** — combine vector similarity with keyword matching
|
|
127
|
+
- **Text Auto-Embedding** — server-side embedding generation (no local model needed)
|
|
128
|
+
- **Namespaces** — isolated vector stores per project, tenant, or use case
|
|
129
|
+
- **Feedback Loop** — upvote/downvote/flag memories to improve recall quality
|
|
130
|
+
- **Entity Extraction** — GLiNER NER for automatic entity detection
|
|
131
|
+
- **SSE Streaming** — async generator event subscriptions, browser-compatible
|
|
132
|
+
- **Branded Types** — `VectorId`, `AgentId`, `MemoryId`, `SessionId` for compile-time safety
|
|
133
|
+
- **ESM + CJS** — dual bundle output, works in Node.js and browsers
|
|
134
|
+
- **Retry & Rate Limiting** — built-in exponential backoff and rate-limit header tracking
|
|
135
|
+
- **Zero Runtime Deps** — uses native `fetch`, no external HTTP libraries
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
47
139
|
## Connect to Dakera
|
|
48
140
|
|
|
49
141
|
```typescript
|
|
50
|
-
import { DakeraClient } from 'dakera';
|
|
142
|
+
import { DakeraClient } from '@dakera-ai/dakera';
|
|
51
143
|
|
|
52
144
|
// Self-hosted
|
|
53
|
-
const client = new DakeraClient({
|
|
145
|
+
const client = new DakeraClient({
|
|
146
|
+
baseUrl: 'http://your-server:3300',
|
|
147
|
+
apiKey: 'your-key',
|
|
148
|
+
});
|
|
54
149
|
|
|
55
150
|
// Cloud (early access)
|
|
56
|
-
const client = new DakeraClient({
|
|
151
|
+
const client = new DakeraClient({
|
|
152
|
+
baseUrl: 'https://api.dakera.ai',
|
|
153
|
+
apiKey: 'your-key',
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// With custom retry config
|
|
157
|
+
const client = new DakeraClient({
|
|
158
|
+
baseUrl: 'http://localhost:3300',
|
|
159
|
+
apiKey: 'your-key',
|
|
160
|
+
retryBackoff: { maxRetries: 5, baseDelayMs: 200, maxDelayMs: 10000 },
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Examples
|
|
167
|
+
|
|
168
|
+
See the [`examples/`](examples/) directory:
|
|
169
|
+
|
|
170
|
+
- [`basic.ts`](examples/basic.ts) — vectors, namespaces, queries, filters, batch operations
|
|
171
|
+
- [`memory.ts`](examples/memory.ts) — store/recall memories, sessions, agent stats
|
|
172
|
+
- [`advanced.ts`](examples/advanced.ts) — text embedding, full-text, hybrid search, knowledge graph, feedback
|
|
173
|
+
|
|
174
|
+
Run examples with:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
npx tsx examples/basic.ts
|
|
57
178
|
```
|
|
58
179
|
|
|
59
|
-
|
|
180
|
+
---
|
|
60
181
|
|
|
61
|
-
|
|
62
|
-
→ [API reference](https://dakera.ai/docs/api)
|
|
63
|
-
→ [TypeScript SDK reference](https://dakera.ai/docs/sdk/typescript)
|
|
182
|
+
## Resources
|
|
64
183
|
|
|
65
|
-
|
|
184
|
+
| | |
|
|
185
|
+
|---|---|
|
|
186
|
+
| [Documentation](https://dakera.ai/docs) | Full API reference and guides |
|
|
187
|
+
| [TypeScript SDK docs](https://dakera.ai/docs/sdk/typescript) | TypeScript-specific reference |
|
|
188
|
+
| [Benchmark](https://dakera.ai/benchmark) | LoCoMo evaluation results |
|
|
189
|
+
| [dakera.ai](https://dakera.ai) | Website and early access |
|
|
190
|
+
| [GitHub Org](https://github.com/dakera-ai) | All public repos |
|
|
191
|
+
| [dakera-deploy](https://github.com/Dakera-AI/dakera-deploy) | Self-hosting guide |
|
|
192
|
+
|
|
193
|
+
### Other SDKs
|
|
66
194
|
|
|
67
|
-
|
|
|
195
|
+
| SDK | Package |
|
|
68
196
|
|---|---|
|
|
69
|
-
| [dakera-py](https://github.com/dakera-ai/dakera-py) |
|
|
70
|
-
| [dakera-
|
|
71
|
-
| [dakera-
|
|
72
|
-
| [dakera-cli](https://github.com/dakera-ai/dakera-cli) | CLI |
|
|
73
|
-
| [dakera-mcp](https://github.com/dakera-ai/dakera-mcp) | MCP server
|
|
74
|
-
| [dakera-deploy](https://github.com/dakera-ai/dakera-deploy) | Self-host Dakera |
|
|
197
|
+
| [dakera-py](https://github.com/dakera-ai/dakera-py) | `dakera` (PyPI) |
|
|
198
|
+
| [dakera-rs](https://github.com/dakera-ai/dakera-rs) | `dakera-client` (crates.io) |
|
|
199
|
+
| [dakera-go](https://github.com/dakera-ai/dakera-go) | `github.com/dakera-ai/dakera-go` |
|
|
200
|
+
| [dakera-cli](https://github.com/dakera-ai/dakera-cli) | CLI tool |
|
|
201
|
+
| [dakera-mcp](https://github.com/dakera-ai/dakera-mcp) | MCP server for Claude/Cursor |
|
|
75
202
|
|
|
76
203
|
---
|
|
77
204
|
|
|
78
|
-
|
|
205
|
+
<p align="center">
|
|
206
|
+
<a href="https://dakera.ai">dakera.ai</a> ·
|
|
207
|
+
<a href="https://dakera.ai/docs">Docs</a> ·
|
|
208
|
+
<a href="https://dakera.ai/benchmark">Benchmark</a> ·
|
|
209
|
+
<a href="https://dakera.ai#cta">Request Early Access</a>
|
|
210
|
+
</p>
|
|
211
|
+
|
|
212
|
+
<p align="center"><sub>Built with Rust. Single binary. Zero external dependencies.</sub></p>
|