@dakera-ai/dakera 0.11.54 → 0.11.55

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,78 +1,212 @@
1
- # ⚡ dakera-js
1
+ <p align="center">
2
+ <img src="https://github.com/dakera-ai.png" alt="Dakera AI" width="80" />
3
+ </p>
2
4
 
3
- TypeScript SDK for Dakera AI — store, recall, and search agent memories against a Dakera instance.
5
+ <h1 align="center">dakera-js</h1>
4
6
 
5
- Part of [Dakera AI](https://dakera.ai) — the memory engine for AI agents.
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
- > The Dakera memory engine scores **87.8% on LoCoMo** (1,540 questions, standard eval) — [benchmark details](https://dakera.ai/benchmark)
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.6%" src="https://img.shields.io/badge/LoCoMo-87.6%25-22c55e?style=flat-square" /></a>
18
+ </p>
19
+
20
+ ---
21
+
22
+ ## Why Dakera?
23
+
24
+ | | Dakera | Others |
25
+ |---|---|---|
26
+ | **LoCoMo accuracy** | **87.6%** (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: 'your-key',
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
- // Store a vector
28
- await client.vectors.upsert({
29
- id: 'vec-001',
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
- // Full-text search
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
- // Store an agent memory
39
- await client.memories.store({
40
- agentId: 'my-agent',
41
- content: 'User prefers concise responses',
42
- importance: 0.8,
43
- tags: ['preference', 'ux'],
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({ baseUrl: 'http://your-server:3300', apiKey: 'your-key' });
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({ baseUrl: 'https://api.dakera.ai', apiKey: 'your-key' });
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
- ## Documentation
180
+ ---
60
181
 
61
- [Full docs](https://dakera.ai/docs)
62
- → [API reference](https://dakera.ai/docs/api)
63
- → [TypeScript SDK reference](https://dakera.ai/docs/sdk/typescript)
182
+ ## Resources
64
183
 
65
- ## Related
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
- | Repo | What it is |
195
+ | SDK | Package |
68
196
  |---|---|
69
- | [dakera-py](https://github.com/dakera-ai/dakera-py) | Python SDK |
70
- | [dakera-go](https://github.com/dakera-ai/dakera-go) | Go SDK |
71
- | [dakera-rs](https://github.com/dakera-ai/dakera-rs) | Rust client |
72
- | [dakera-cli](https://github.com/dakera-ai/dakera-cli) | CLI |
73
- | [dakera-mcp](https://github.com/dakera-ai/dakera-mcp) | MCP server · 83 tools |
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
- *Part of the Dakera AI open core. The engine is proprietary. The tools are yours.*
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>
package/dist/index.d.mts CHANGED
@@ -2034,11 +2034,11 @@ declare class DakeraClient {
2034
2034
  *
2035
2035
  * When `vector` is omitted the server falls back to BM25-only full-text
2036
2036
  * search. When provided, results are blended with vector similarity
2037
- * according to `alpha`.
2037
+ * according to `vectorWeight`.
2038
2038
  *
2039
2039
  * @param namespace - Target namespace
2040
2040
  * @param query - Text query
2041
- * @param options - Search options: vector (optional), topK, alpha, filter
2041
+ * @param options - Search options: vector (optional), topK, vectorWeight, filter
2042
2042
  * @returns Hybrid search results
2043
2043
  *
2044
2044
  * @example
@@ -2047,7 +2047,7 @@ declare class DakeraClient {
2047
2047
  * const results = await client.hybridSearch('my-namespace', 'machine learning', {
2048
2048
  * vector: [0.1, 0.2, 0.3],
2049
2049
  * topK: 10,
2050
- * alpha: 0.7, // 70% text, 30% vector
2050
+ * vectorWeight: 0.7, // 70% vector, 30% text
2051
2051
  * });
2052
2052
  * // BM25-only (no vector)
2053
2053
  * const results = await client.hybridSearch('my-namespace', 'machine learning');
@@ -2056,7 +2056,7 @@ declare class DakeraClient {
2056
2056
  hybridSearch(namespace: string, query: string, options?: {
2057
2057
  vector?: number[];
2058
2058
  topK?: number;
2059
- alpha?: number;
2059
+ vectorWeight?: number;
2060
2060
  filter?: FilterExpression;
2061
2061
  }): Promise<HybridSearchResult[]>;
2062
2062
  /**
@@ -2424,7 +2424,7 @@ declare class DakeraClient {
2424
2424
  /** Get a specific memory */
2425
2425
  getMemory(agentId: string, memoryId: string): Promise<Memory>;
2426
2426
  /** Update an existing memory */
2427
- updateMemory(agentId: string, memoryId: string, request: UpdateMemoryRequest): Promise<StoreMemoryResponse>;
2427
+ updateMemory(_agentId: string, memoryId: string, request: UpdateMemoryRequest): Promise<StoreMemoryResponse>;
2428
2428
  /** Delete a memory */
2429
2429
  forget(agentId: string, memoryId: string): Promise<{
2430
2430
  status: string;
package/dist/index.d.ts CHANGED
@@ -2034,11 +2034,11 @@ declare class DakeraClient {
2034
2034
  *
2035
2035
  * When `vector` is omitted the server falls back to BM25-only full-text
2036
2036
  * search. When provided, results are blended with vector similarity
2037
- * according to `alpha`.
2037
+ * according to `vectorWeight`.
2038
2038
  *
2039
2039
  * @param namespace - Target namespace
2040
2040
  * @param query - Text query
2041
- * @param options - Search options: vector (optional), topK, alpha, filter
2041
+ * @param options - Search options: vector (optional), topK, vectorWeight, filter
2042
2042
  * @returns Hybrid search results
2043
2043
  *
2044
2044
  * @example
@@ -2047,7 +2047,7 @@ declare class DakeraClient {
2047
2047
  * const results = await client.hybridSearch('my-namespace', 'machine learning', {
2048
2048
  * vector: [0.1, 0.2, 0.3],
2049
2049
  * topK: 10,
2050
- * alpha: 0.7, // 70% text, 30% vector
2050
+ * vectorWeight: 0.7, // 70% vector, 30% text
2051
2051
  * });
2052
2052
  * // BM25-only (no vector)
2053
2053
  * const results = await client.hybridSearch('my-namespace', 'machine learning');
@@ -2056,7 +2056,7 @@ declare class DakeraClient {
2056
2056
  hybridSearch(namespace: string, query: string, options?: {
2057
2057
  vector?: number[];
2058
2058
  topK?: number;
2059
- alpha?: number;
2059
+ vectorWeight?: number;
2060
2060
  filter?: FilterExpression;
2061
2061
  }): Promise<HybridSearchResult[]>;
2062
2062
  /**
@@ -2424,7 +2424,7 @@ declare class DakeraClient {
2424
2424
  /** Get a specific memory */
2425
2425
  getMemory(agentId: string, memoryId: string): Promise<Memory>;
2426
2426
  /** Update an existing memory */
2427
- updateMemory(agentId: string, memoryId: string, request: UpdateMemoryRequest): Promise<StoreMemoryResponse>;
2427
+ updateMemory(_agentId: string, memoryId: string, request: UpdateMemoryRequest): Promise<StoreMemoryResponse>;
2428
2428
  /** Delete a memory */
2429
2429
  forget(agentId: string, memoryId: string): Promise<{
2430
2430
  status: string;
package/dist/index.js CHANGED
@@ -505,11 +505,11 @@ var DakeraClient = class {
505
505
  *
506
506
  * When `vector` is omitted the server falls back to BM25-only full-text
507
507
  * search. When provided, results are blended with vector similarity
508
- * according to `alpha`.
508
+ * according to `vectorWeight`.
509
509
  *
510
510
  * @param namespace - Target namespace
511
511
  * @param query - Text query
512
- * @param options - Search options: vector (optional), topK, alpha, filter
512
+ * @param options - Search options: vector (optional), topK, vectorWeight, filter
513
513
  * @returns Hybrid search results
514
514
  *
515
515
  * @example
@@ -518,7 +518,7 @@ var DakeraClient = class {
518
518
  * const results = await client.hybridSearch('my-namespace', 'machine learning', {
519
519
  * vector: [0.1, 0.2, 0.3],
520
520
  * topK: 10,
521
- * alpha: 0.7, // 70% text, 30% vector
521
+ * vectorWeight: 0.7, // 70% vector, 30% text
522
522
  * });
523
523
  * // BM25-only (no vector)
524
524
  * const results = await client.hybridSearch('my-namespace', 'machine learning');
@@ -526,9 +526,9 @@ var DakeraClient = class {
526
526
  */
527
527
  async hybridSearch(namespace, query, options = {}) {
528
528
  const body = {
529
- query,
529
+ text: query,
530
530
  top_k: options.topK ?? 10,
531
- alpha: options.alpha ?? 0.5
531
+ vector_weight: options.vectorWeight ?? 0.5
532
532
  };
533
533
  if (options.vector != null) {
534
534
  body["vector"] = options.vector;
@@ -556,7 +556,7 @@ var DakeraClient = class {
556
556
  "GET",
557
557
  "/v1/namespaces"
558
558
  );
559
- return response.namespaces;
559
+ return response.namespaces.map((ns) => ({ namespace: ns, vector_count: 0 }));
560
560
  }
561
561
  /**
562
562
  * Get namespace information.
@@ -575,11 +575,16 @@ var DakeraClient = class {
575
575
  * @returns Created namespace info
576
576
  */
577
577
  async createNamespace(namespace, options = {}) {
578
- const body = { name: namespace };
579
- if (options.dimensions) body.dimensions = options.dimensions;
578
+ const body = {};
579
+ if (options.dimensions) body.dimension = options.dimensions;
580
580
  if (options.indexType) body.index_type = options.indexType;
581
581
  if (options.metadata) body.metadata = options.metadata;
582
- return this.request("POST", "/v1/namespaces", body);
582
+ const response = await this.request(
583
+ "PUT",
584
+ `/v1/namespaces/${namespace}`,
585
+ body
586
+ );
587
+ return { namespace: response.namespace, vector_count: 0, dimension: response.dimension };
583
588
  }
584
589
  /**
585
590
  * Create or update a namespace configuration (upsert semantics).
@@ -1064,7 +1069,7 @@ var DakeraClient = class {
1064
1069
  // ===========================================================================
1065
1070
  /** Store a memory for an agent */
1066
1071
  async storeMemory(agentId2, request) {
1067
- return this.request("POST", `/v1/agents/${agentId2}/memories`, request);
1072
+ return this.request("POST", "/v1/memory/store", { ...request, agent_id: agentId2 });
1068
1073
  }
1069
1074
  /**
1070
1075
  * Recall memories for an agent.
@@ -1097,19 +1102,19 @@ var DakeraClient = class {
1097
1102
  if (options?.until !== void 0) body["until"] = options.until;
1098
1103
  if (options?.routing !== void 0) body["routing"] = options.routing;
1099
1104
  if (options?.rerank !== void 0) body["rerank"] = options.rerank;
1100
- return this.request("POST", `/v1/agents/${agentId2}/memories/recall`, body);
1105
+ return this.request("POST", "/v1/memory/recall", { ...body, agent_id: agentId2 });
1101
1106
  }
1102
1107
  /** Get a specific memory */
1103
1108
  async getMemory(agentId2, memoryId2) {
1104
- return this.request("GET", `/v1/agents/${agentId2}/memories/${memoryId2}`);
1109
+ return this.request("GET", `/v1/memory/get/${memoryId2}?agent_id=${encodeURIComponent(agentId2)}`);
1105
1110
  }
1106
1111
  /** Update an existing memory */
1107
- async updateMemory(agentId2, memoryId2, request) {
1108
- return this.request("PUT", `/v1/agents/${agentId2}/memories/${memoryId2}`, request);
1112
+ async updateMemory(_agentId, memoryId2, request) {
1113
+ return this.request("PUT", `/v1/memory/update/${memoryId2}`, request);
1109
1114
  }
1110
1115
  /** Delete a memory */
1111
1116
  async forget(agentId2, memoryId2) {
1112
- return this.request("DELETE", `/v1/agents/${agentId2}/memories/${memoryId2}`);
1117
+ return this.request("POST", "/v1/memory/forget", { agent_id: agentId2, memory_ids: [memoryId2] });
1113
1118
  }
1114
1119
  /**
1115
1120
  * Bulk-recall memories using filter predicates (CE-2).
@@ -1155,20 +1160,28 @@ var DakeraClient = class {
1155
1160
  if (options?.min_importance !== void 0) body["min_importance"] = options.min_importance;
1156
1161
  if (options?.routing !== void 0) body["routing"] = options.routing;
1157
1162
  if (options?.rerank !== void 0) body["rerank"] = options.rerank;
1158
- const result = await this.request("POST", `/v1/agents/${agentId2}/memories/search`, body);
1163
+ const result = await this.request("POST", "/v1/memory/search", { ...body, agent_id: agentId2 });
1159
1164
  return result.memories ?? result;
1160
1165
  }
1161
1166
  /** Update importance of memories */
1162
1167
  async updateImportance(agentId2, request) {
1163
- return this.request("PUT", `/v1/agents/${agentId2}/memories/importance`, request);
1168
+ let result = { status: "ok" };
1169
+ for (const memoryId2 of request.memory_ids) {
1170
+ result = await this.request("POST", "/v1/memory/importance", {
1171
+ agent_id: agentId2,
1172
+ memory_id: memoryId2,
1173
+ importance: request.importance
1174
+ });
1175
+ }
1176
+ return result;
1164
1177
  }
1165
1178
  /** Consolidate memories for an agent */
1166
1179
  async consolidate(agentId2, request) {
1167
- return this.request("POST", `/v1/agents/${agentId2}/memories/consolidate`, request ?? {});
1180
+ return this.request("POST", "/v1/memory/consolidate", { ...request ?? {}, agent_id: agentId2 });
1168
1181
  }
1169
1182
  /** Submit feedback on a memory recall */
1170
1183
  async memoryFeedback(agentId2, request) {
1171
- return this.request("POST", `/v1/agents/${agentId2}/memories/feedback`, request);
1184
+ return this.request("POST", "/v1/memory/feedback", { ...request, agent_id: agentId2 });
1172
1185
  }
1173
1186
  // ===========================================================================
1174
1187
  // Memory Feedback Loop — INT-1
@@ -1314,7 +1327,7 @@ var DakeraClient = class {
1314
1327
  * @note Requires CE-4 (GLiNER) on the server.
1315
1328
  */
1316
1329
  async extractEntities(text, entityTypes) {
1317
- const body = { text };
1330
+ const body = { content: text };
1318
1331
  if (entityTypes !== void 0) {
1319
1332
  body["entity_types"] = entityTypes;
1320
1333
  }
package/dist/index.mjs CHANGED
@@ -465,11 +465,11 @@ var DakeraClient = class {
465
465
  *
466
466
  * When `vector` is omitted the server falls back to BM25-only full-text
467
467
  * search. When provided, results are blended with vector similarity
468
- * according to `alpha`.
468
+ * according to `vectorWeight`.
469
469
  *
470
470
  * @param namespace - Target namespace
471
471
  * @param query - Text query
472
- * @param options - Search options: vector (optional), topK, alpha, filter
472
+ * @param options - Search options: vector (optional), topK, vectorWeight, filter
473
473
  * @returns Hybrid search results
474
474
  *
475
475
  * @example
@@ -478,7 +478,7 @@ var DakeraClient = class {
478
478
  * const results = await client.hybridSearch('my-namespace', 'machine learning', {
479
479
  * vector: [0.1, 0.2, 0.3],
480
480
  * topK: 10,
481
- * alpha: 0.7, // 70% text, 30% vector
481
+ * vectorWeight: 0.7, // 70% vector, 30% text
482
482
  * });
483
483
  * // BM25-only (no vector)
484
484
  * const results = await client.hybridSearch('my-namespace', 'machine learning');
@@ -486,9 +486,9 @@ var DakeraClient = class {
486
486
  */
487
487
  async hybridSearch(namespace, query, options = {}) {
488
488
  const body = {
489
- query,
489
+ text: query,
490
490
  top_k: options.topK ?? 10,
491
- alpha: options.alpha ?? 0.5
491
+ vector_weight: options.vectorWeight ?? 0.5
492
492
  };
493
493
  if (options.vector != null) {
494
494
  body["vector"] = options.vector;
@@ -516,7 +516,7 @@ var DakeraClient = class {
516
516
  "GET",
517
517
  "/v1/namespaces"
518
518
  );
519
- return response.namespaces;
519
+ return response.namespaces.map((ns) => ({ namespace: ns, vector_count: 0 }));
520
520
  }
521
521
  /**
522
522
  * Get namespace information.
@@ -535,11 +535,16 @@ var DakeraClient = class {
535
535
  * @returns Created namespace info
536
536
  */
537
537
  async createNamespace(namespace, options = {}) {
538
- const body = { name: namespace };
539
- if (options.dimensions) body.dimensions = options.dimensions;
538
+ const body = {};
539
+ if (options.dimensions) body.dimension = options.dimensions;
540
540
  if (options.indexType) body.index_type = options.indexType;
541
541
  if (options.metadata) body.metadata = options.metadata;
542
- return this.request("POST", "/v1/namespaces", body);
542
+ const response = await this.request(
543
+ "PUT",
544
+ `/v1/namespaces/${namespace}`,
545
+ body
546
+ );
547
+ return { namespace: response.namespace, vector_count: 0, dimension: response.dimension };
543
548
  }
544
549
  /**
545
550
  * Create or update a namespace configuration (upsert semantics).
@@ -1024,7 +1029,7 @@ var DakeraClient = class {
1024
1029
  // ===========================================================================
1025
1030
  /** Store a memory for an agent */
1026
1031
  async storeMemory(agentId2, request) {
1027
- return this.request("POST", `/v1/agents/${agentId2}/memories`, request);
1032
+ return this.request("POST", "/v1/memory/store", { ...request, agent_id: agentId2 });
1028
1033
  }
1029
1034
  /**
1030
1035
  * Recall memories for an agent.
@@ -1057,19 +1062,19 @@ var DakeraClient = class {
1057
1062
  if (options?.until !== void 0) body["until"] = options.until;
1058
1063
  if (options?.routing !== void 0) body["routing"] = options.routing;
1059
1064
  if (options?.rerank !== void 0) body["rerank"] = options.rerank;
1060
- return this.request("POST", `/v1/agents/${agentId2}/memories/recall`, body);
1065
+ return this.request("POST", "/v1/memory/recall", { ...body, agent_id: agentId2 });
1061
1066
  }
1062
1067
  /** Get a specific memory */
1063
1068
  async getMemory(agentId2, memoryId2) {
1064
- return this.request("GET", `/v1/agents/${agentId2}/memories/${memoryId2}`);
1069
+ return this.request("GET", `/v1/memory/get/${memoryId2}?agent_id=${encodeURIComponent(agentId2)}`);
1065
1070
  }
1066
1071
  /** Update an existing memory */
1067
- async updateMemory(agentId2, memoryId2, request) {
1068
- return this.request("PUT", `/v1/agents/${agentId2}/memories/${memoryId2}`, request);
1072
+ async updateMemory(_agentId, memoryId2, request) {
1073
+ return this.request("PUT", `/v1/memory/update/${memoryId2}`, request);
1069
1074
  }
1070
1075
  /** Delete a memory */
1071
1076
  async forget(agentId2, memoryId2) {
1072
- return this.request("DELETE", `/v1/agents/${agentId2}/memories/${memoryId2}`);
1077
+ return this.request("POST", "/v1/memory/forget", { agent_id: agentId2, memory_ids: [memoryId2] });
1073
1078
  }
1074
1079
  /**
1075
1080
  * Bulk-recall memories using filter predicates (CE-2).
@@ -1115,20 +1120,28 @@ var DakeraClient = class {
1115
1120
  if (options?.min_importance !== void 0) body["min_importance"] = options.min_importance;
1116
1121
  if (options?.routing !== void 0) body["routing"] = options.routing;
1117
1122
  if (options?.rerank !== void 0) body["rerank"] = options.rerank;
1118
- const result = await this.request("POST", `/v1/agents/${agentId2}/memories/search`, body);
1123
+ const result = await this.request("POST", "/v1/memory/search", { ...body, agent_id: agentId2 });
1119
1124
  return result.memories ?? result;
1120
1125
  }
1121
1126
  /** Update importance of memories */
1122
1127
  async updateImportance(agentId2, request) {
1123
- return this.request("PUT", `/v1/agents/${agentId2}/memories/importance`, request);
1128
+ let result = { status: "ok" };
1129
+ for (const memoryId2 of request.memory_ids) {
1130
+ result = await this.request("POST", "/v1/memory/importance", {
1131
+ agent_id: agentId2,
1132
+ memory_id: memoryId2,
1133
+ importance: request.importance
1134
+ });
1135
+ }
1136
+ return result;
1124
1137
  }
1125
1138
  /** Consolidate memories for an agent */
1126
1139
  async consolidate(agentId2, request) {
1127
- return this.request("POST", `/v1/agents/${agentId2}/memories/consolidate`, request ?? {});
1140
+ return this.request("POST", "/v1/memory/consolidate", { ...request ?? {}, agent_id: agentId2 });
1128
1141
  }
1129
1142
  /** Submit feedback on a memory recall */
1130
1143
  async memoryFeedback(agentId2, request) {
1131
- return this.request("POST", `/v1/agents/${agentId2}/memories/feedback`, request);
1144
+ return this.request("POST", "/v1/memory/feedback", { ...request, agent_id: agentId2 });
1132
1145
  }
1133
1146
  // ===========================================================================
1134
1147
  // Memory Feedback Loop — INT-1
@@ -1274,7 +1287,7 @@ var DakeraClient = class {
1274
1287
  * @note Requires CE-4 (GLiNER) on the server.
1275
1288
  */
1276
1289
  async extractEntities(text, entityTypes) {
1277
- const body = { text };
1290
+ const body = { content: text };
1278
1291
  if (entityTypes !== void 0) {
1279
1292
  body["entity_types"] = entityTypes;
1280
1293
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dakera-ai/dakera",
3
- "version": "0.11.54",
3
+ "version": "0.11.55",
4
4
  "description": "TypeScript/JavaScript SDK for Dakera AI memory platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -21,7 +21,7 @@
21
21
  "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
22
22
  "test": "vitest run",
23
23
  "test:watch": "vitest",
24
- "lint": "eslint src --ext .ts",
24
+ "lint": "eslint src/",
25
25
  "typecheck": "tsc --noEmit",
26
26
  "prepublishOnly": "npm run build"
27
27
  },
@@ -56,10 +56,12 @@
56
56
  "node": ">=20.12.0"
57
57
  },
58
58
  "devDependencies": {
59
+ "@eslint/js": "^10.0.1",
59
60
  "@types/node": "^25.6.0",
60
61
  "eslint": "^10.1.0",
61
62
  "tsup": "^8.0.1",
62
63
  "typescript": "^6.0.0",
64
+ "typescript-eslint": "^8.59.3",
63
65
  "vitest": "^4.1.0"
64
66
  },
65
67
  "overrides": {