@dakera-ai/dakera 0.1.0 → 0.3.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 +26 -2
- package/dist/index.d.mts +52 -30
- package/dist/index.d.ts +52 -30
- package/dist/index.js +56 -34
- package/dist/index.mjs +51 -33
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
|
|
8
|
-
Official TypeScript/JavaScript client for [Dakera](https://
|
|
8
|
+
Official TypeScript/JavaScript client for [Dakera](https://dakera.ai) — a high-performance vector database for AI agent memory.
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -44,10 +44,12 @@ for (const result of results.results) {
|
|
|
44
44
|
## Features
|
|
45
45
|
|
|
46
46
|
- **Full TypeScript Support**: Complete type definitions for all operations
|
|
47
|
+
- **Branded ID Types**: `VectorId`, `AgentId`, `MemoryId`, `SessionId` prevent cross-assignment bugs
|
|
47
48
|
- **Vector Operations**: Upsert, query, delete, fetch vectors
|
|
48
49
|
- **Full-Text Search**: Index documents and perform BM25 search
|
|
49
50
|
- **Hybrid Search**: Combine vector and text search with configurable weights
|
|
50
51
|
- **Namespace Management**: Create, list, delete namespaces
|
|
52
|
+
- **Agent Memory**: Store, recall, and manage memories for AI agents
|
|
51
53
|
- **Metadata Filtering**: Filter queries by metadata fields
|
|
52
54
|
- **Automatic Retries**: Built-in retry logic with exponential backoff
|
|
53
55
|
- **Error Handling**: Typed exceptions for different error scenarios
|
|
@@ -266,6 +268,29 @@ import type {
|
|
|
266
268
|
} from 'dakera';
|
|
267
269
|
```
|
|
268
270
|
|
|
271
|
+
### Branded ID Types
|
|
272
|
+
|
|
273
|
+
v0.3.0 introduced branded string types to prevent accidental cross-assignment of IDs at compile time:
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
import {
|
|
277
|
+
vectorId, agentId, memoryId, sessionId,
|
|
278
|
+
type VectorId, type AgentId, type MemoryId, type SessionId,
|
|
279
|
+
} from 'dakera';
|
|
280
|
+
|
|
281
|
+
// Factory helpers narrow plain strings to branded types
|
|
282
|
+
const vid: VectorId = vectorId('vec-001');
|
|
283
|
+
const aid: AgentId = agentId('my-agent');
|
|
284
|
+
|
|
285
|
+
// TypeScript catches cross-assignment mistakes:
|
|
286
|
+
// const bad: VectorId = agentId('x'); // TS error ✓
|
|
287
|
+
|
|
288
|
+
// All SDK methods accept both branded and plain strings for convenience
|
|
289
|
+
await client.upsert('my-namespace', [
|
|
290
|
+
{ id: vid, values: [0.1, 0.2, 0.3] },
|
|
291
|
+
]);
|
|
292
|
+
```
|
|
293
|
+
|
|
269
294
|
## Browser Support
|
|
270
295
|
|
|
271
296
|
This SDK uses the Fetch API and works in:
|
|
@@ -306,7 +331,6 @@ npm run lint
|
|
|
306
331
|
| [dakera-dashboard](https://github.com/dakera-ai/dakera-dashboard) | Admin dashboard (Leptos/WASM) |
|
|
307
332
|
| [dakera-docs](https://github.com/dakera-ai/dakera-docs) | Documentation |
|
|
308
333
|
| [dakera-deploy](https://github.com/dakera-ai/dakera-deploy) | Deployment configs and Docker Compose |
|
|
309
|
-
| [dakera-cortex](https://github.com/dakera-ai/dakera-cortex) | Flagship demo with AI agents |
|
|
310
334
|
|
|
311
335
|
## License
|
|
312
336
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dakera TypeScript SDK Types
|
|
3
3
|
*/
|
|
4
|
+
declare const __brand: unique symbol;
|
|
5
|
+
type Brand<B> = {
|
|
6
|
+
readonly [__brand]: B;
|
|
7
|
+
};
|
|
8
|
+
/** A branded string type — T is the nominal tag that prevents cross-assignment. */
|
|
9
|
+
type Branded<T extends string, B> = T & Brand<B>;
|
|
10
|
+
/** Opaque ID for a stored vector. */
|
|
11
|
+
type VectorId = Branded<string, 'VectorId'>;
|
|
12
|
+
/** Opaque ID for an agent. */
|
|
13
|
+
type AgentId = Branded<string, 'AgentId'>;
|
|
14
|
+
/** Opaque ID for a memory entry. */
|
|
15
|
+
type MemoryId = Branded<string, 'MemoryId'>;
|
|
16
|
+
/** Opaque ID for a session. */
|
|
17
|
+
type SessionId = Branded<string, 'SessionId'>;
|
|
18
|
+
/** Create a VectorId from a plain string. */
|
|
19
|
+
declare function vectorId(id: string): VectorId;
|
|
20
|
+
/** Create an AgentId from a plain string. */
|
|
21
|
+
declare function agentId(id: string): AgentId;
|
|
22
|
+
/** Create a MemoryId from a plain string. */
|
|
23
|
+
declare function memoryId(id: string): MemoryId;
|
|
24
|
+
/** Create a SessionId from a plain string. */
|
|
25
|
+
declare function sessionId(id: string): SessionId;
|
|
4
26
|
/** Read consistency level for queries */
|
|
5
27
|
type ReadConsistency = 'strong' | 'eventual' | 'bounded_staleness';
|
|
6
28
|
/** Distance metric for similarity search */
|
|
@@ -58,19 +80,19 @@ interface WarmCacheResponse {
|
|
|
58
80
|
}
|
|
59
81
|
/** Vector with ID, values, and optional metadata */
|
|
60
82
|
interface Vector {
|
|
61
|
-
id:
|
|
83
|
+
id: VectorId;
|
|
62
84
|
values: number[];
|
|
63
85
|
metadata?: Record<string, unknown>;
|
|
64
86
|
}
|
|
65
87
|
/** Input for vector operations - can be Vector object or plain object */
|
|
66
88
|
type VectorInput = Vector | {
|
|
67
|
-
id: string;
|
|
89
|
+
id: VectorId | string;
|
|
68
90
|
values: number[];
|
|
69
91
|
metadata?: Record<string, unknown>;
|
|
70
92
|
};
|
|
71
93
|
/** Result from a vector query */
|
|
72
94
|
interface QueryResult {
|
|
73
|
-
id:
|
|
95
|
+
id: VectorId;
|
|
74
96
|
score: number;
|
|
75
97
|
vector?: number[];
|
|
76
98
|
metadata?: Record<string, unknown>;
|
|
@@ -104,25 +126,25 @@ interface IndexStats {
|
|
|
104
126
|
}
|
|
105
127
|
/** Document for full-text search */
|
|
106
128
|
interface Document {
|
|
107
|
-
id:
|
|
129
|
+
id: VectorId;
|
|
108
130
|
content: string;
|
|
109
131
|
metadata?: Record<string, unknown>;
|
|
110
132
|
}
|
|
111
133
|
/** Input for document operations */
|
|
112
134
|
type DocumentInput = Document | {
|
|
113
|
-
id: string;
|
|
135
|
+
id: VectorId | string;
|
|
114
136
|
content: string;
|
|
115
137
|
metadata?: Record<string, unknown>;
|
|
116
138
|
};
|
|
117
139
|
/** Result from full-text search */
|
|
118
140
|
interface FullTextSearchResult {
|
|
119
|
-
id:
|
|
141
|
+
id: VectorId;
|
|
120
142
|
score: number;
|
|
121
143
|
metadata?: Record<string, unknown>;
|
|
122
144
|
}
|
|
123
145
|
/** Result from hybrid search */
|
|
124
146
|
interface HybridSearchResult {
|
|
125
|
-
id:
|
|
147
|
+
id: VectorId;
|
|
126
148
|
/** Combined score */
|
|
127
149
|
score: number;
|
|
128
150
|
/** Vector similarity score (normalized 0-1) */
|
|
@@ -277,7 +299,7 @@ interface TextQueryOptions {
|
|
|
277
299
|
*/
|
|
278
300
|
interface TextSearchResult {
|
|
279
301
|
/** Document ID */
|
|
280
|
-
id:
|
|
302
|
+
id: VectorId;
|
|
281
303
|
/** Similarity score */
|
|
282
304
|
score: number;
|
|
283
305
|
/** Original text (if includeText was true) */
|
|
@@ -348,7 +370,7 @@ interface StoreMemoryRequest {
|
|
|
348
370
|
/** A stored memory */
|
|
349
371
|
interface Memory {
|
|
350
372
|
/** Memory ID */
|
|
351
|
-
id:
|
|
373
|
+
id: MemoryId;
|
|
352
374
|
/** Memory content */
|
|
353
375
|
content: string;
|
|
354
376
|
/** Memory type */
|
|
@@ -367,7 +389,7 @@ interface Memory {
|
|
|
367
389
|
/** A recalled memory with similarity score */
|
|
368
390
|
interface RecalledMemory {
|
|
369
391
|
/** Memory ID */
|
|
370
|
-
id:
|
|
392
|
+
id: MemoryId;
|
|
371
393
|
/** Memory content */
|
|
372
394
|
content: string;
|
|
373
395
|
/** Memory type */
|
|
@@ -384,7 +406,7 @@ interface RecalledMemory {
|
|
|
384
406
|
/** Response from storing a memory */
|
|
385
407
|
interface StoreMemoryResponse {
|
|
386
408
|
/** Created memory ID */
|
|
387
|
-
memory_id:
|
|
409
|
+
memory_id: MemoryId;
|
|
388
410
|
/** Status */
|
|
389
411
|
status: string;
|
|
390
412
|
}
|
|
@@ -411,7 +433,7 @@ interface RecallRequest {
|
|
|
411
433
|
/** Request to update importance */
|
|
412
434
|
interface UpdateImportanceRequest {
|
|
413
435
|
/** Memory IDs to update */
|
|
414
|
-
memory_ids:
|
|
436
|
+
memory_ids: MemoryId[];
|
|
415
437
|
/** New importance value */
|
|
416
438
|
importance: number;
|
|
417
439
|
}
|
|
@@ -431,12 +453,12 @@ interface ConsolidateResponse {
|
|
|
431
453
|
/** Number of memories removed */
|
|
432
454
|
removed_count: number;
|
|
433
455
|
/** IDs of new consolidated memories */
|
|
434
|
-
new_memories:
|
|
456
|
+
new_memories: MemoryId[];
|
|
435
457
|
}
|
|
436
458
|
/** Request for memory feedback */
|
|
437
459
|
interface MemoryFeedbackRequest {
|
|
438
460
|
/** Memory ID */
|
|
439
|
-
memory_id:
|
|
461
|
+
memory_id: MemoryId;
|
|
440
462
|
/** Feedback text */
|
|
441
463
|
feedback: string;
|
|
442
464
|
/** Optional relevance score */
|
|
@@ -452,16 +474,16 @@ interface MemoryFeedbackResponse {
|
|
|
452
474
|
/** Request to start a session */
|
|
453
475
|
interface StartSessionRequest {
|
|
454
476
|
/** Agent ID */
|
|
455
|
-
agent_id:
|
|
477
|
+
agent_id: AgentId;
|
|
456
478
|
/** Optional session metadata */
|
|
457
479
|
metadata?: Record<string, unknown>;
|
|
458
480
|
}
|
|
459
481
|
/** A session */
|
|
460
482
|
interface Session {
|
|
461
483
|
/** Session ID */
|
|
462
|
-
session_id:
|
|
484
|
+
session_id: SessionId;
|
|
463
485
|
/** Agent ID */
|
|
464
|
-
agent_id:
|
|
486
|
+
agent_id: AgentId;
|
|
465
487
|
/** Start timestamp */
|
|
466
488
|
started_at?: string;
|
|
467
489
|
/** End timestamp */
|
|
@@ -483,7 +505,7 @@ interface ListSessionsOptions {
|
|
|
483
505
|
/** Summary info for an agent */
|
|
484
506
|
interface AgentSummary {
|
|
485
507
|
/** Agent ID */
|
|
486
|
-
agent_id:
|
|
508
|
+
agent_id: AgentId;
|
|
487
509
|
/** Total memory count */
|
|
488
510
|
memory_count: number;
|
|
489
511
|
/** Total session count */
|
|
@@ -494,7 +516,7 @@ interface AgentSummary {
|
|
|
494
516
|
/** Detailed stats for an agent */
|
|
495
517
|
interface AgentStats {
|
|
496
518
|
/** Agent ID */
|
|
497
|
-
agent_id:
|
|
519
|
+
agent_id: AgentId;
|
|
498
520
|
/** Total memory count */
|
|
499
521
|
total_memories: number;
|
|
500
522
|
/** Memories grouped by type */
|
|
@@ -512,14 +534,14 @@ interface AgentStats {
|
|
|
512
534
|
}
|
|
513
535
|
/** Request to build a knowledge graph */
|
|
514
536
|
interface KnowledgeGraphRequest {
|
|
515
|
-
agent_id:
|
|
516
|
-
memory_id?:
|
|
537
|
+
agent_id: AgentId;
|
|
538
|
+
memory_id?: MemoryId;
|
|
517
539
|
depth?: number;
|
|
518
540
|
min_similarity?: number;
|
|
519
541
|
}
|
|
520
542
|
/** A node in the knowledge graph */
|
|
521
543
|
interface KnowledgeNode {
|
|
522
|
-
id:
|
|
544
|
+
id: MemoryId;
|
|
523
545
|
content: string;
|
|
524
546
|
memory_type?: string;
|
|
525
547
|
importance?: number;
|
|
@@ -527,8 +549,8 @@ interface KnowledgeNode {
|
|
|
527
549
|
}
|
|
528
550
|
/** An edge in the knowledge graph */
|
|
529
551
|
interface KnowledgeEdge {
|
|
530
|
-
source:
|
|
531
|
-
target:
|
|
552
|
+
source: MemoryId;
|
|
553
|
+
target: MemoryId;
|
|
532
554
|
similarity: number;
|
|
533
555
|
relationship?: string;
|
|
534
556
|
}
|
|
@@ -540,7 +562,7 @@ interface KnowledgeGraphResponse {
|
|
|
540
562
|
}
|
|
541
563
|
/** Request for full knowledge graph */
|
|
542
564
|
interface FullKnowledgeGraphRequest {
|
|
543
|
-
agent_id:
|
|
565
|
+
agent_id: AgentId;
|
|
544
566
|
max_nodes?: number;
|
|
545
567
|
min_similarity?: number;
|
|
546
568
|
cluster_threshold?: number;
|
|
@@ -548,8 +570,8 @@ interface FullKnowledgeGraphRequest {
|
|
|
548
570
|
}
|
|
549
571
|
/** Request to summarize memories */
|
|
550
572
|
interface SummarizeRequest {
|
|
551
|
-
agent_id:
|
|
552
|
-
memory_ids?:
|
|
573
|
+
agent_id: AgentId;
|
|
574
|
+
memory_ids?: MemoryId[];
|
|
553
575
|
target_type?: string;
|
|
554
576
|
dry_run?: boolean;
|
|
555
577
|
}
|
|
@@ -557,11 +579,11 @@ interface SummarizeRequest {
|
|
|
557
579
|
interface SummarizeResponse {
|
|
558
580
|
summary: string;
|
|
559
581
|
source_count: number;
|
|
560
|
-
new_memory_id?:
|
|
582
|
+
new_memory_id?: MemoryId;
|
|
561
583
|
}
|
|
562
584
|
/** Request to deduplicate memories */
|
|
563
585
|
interface DeduplicateRequest {
|
|
564
|
-
agent_id:
|
|
586
|
+
agent_id: AgentId;
|
|
565
587
|
threshold?: number;
|
|
566
588
|
memory_type?: string;
|
|
567
589
|
dry_run?: boolean;
|
|
@@ -1525,4 +1547,4 @@ declare class TimeoutError extends DakeraError {
|
|
|
1525
1547
|
constructor(message: string);
|
|
1526
1548
|
}
|
|
1527
1549
|
|
|
1528
|
-
export { type AccessPatternHint, type AgentStats, type AgentSummary, type AggregationGroup, type AggregationRequest, type AggregationResponse, type AnalyticsOptions, type AnalyticsOverview, type ApiKey, AuthenticationError, type BackupInfo, type BatchQuerySpec, type BatchTextQueryOptions, type BatchTextQueryResponse, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type CreateKeyRequest, DakeraClient, DakeraError, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EmbeddingModel, type ExportRequest, type ExportResponse, type ExportedVector, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type HealthResponse, type HybridSearchResult, type IndexStats, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LatencyAnalytics, type ListSessionsOptions, type Memory, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceInfo, NotFoundError, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type ReadConsistency, type RecallRequest, type RecalledMemory, type SearchResult, ServerError, type Session, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type SummarizeRequest, type SummarizeResponse, type TextDocument, type TextQueryOptions, type TextQueryResponse, type TextSearchResult, type TextUpsertOptions, type TextUpsertResponse, type ThroughputAnalytics, TimeoutError, type TtlConfig, type UnifiedQueryRequest, type UnifiedQueryResponse, type UnifiedSearchResult, type UpdateImportanceRequest, type UpdateMemoryRequest, type UpsertOptions, type UpsertResponse, ValidationError, type Vector, type VectorInput, type WarmCacheRequest, type WarmCacheResponse, type WarmingPriority, type WarmingTargetTier };
|
|
1550
|
+
export { type AccessPatternHint, type AgentId, type AgentStats, type AgentSummary, type AggregationGroup, type AggregationRequest, type AggregationResponse, type AnalyticsOptions, type AnalyticsOverview, type ApiKey, AuthenticationError, type BackupInfo, type BatchQuerySpec, type BatchTextQueryOptions, type BatchTextQueryResponse, type Branded, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type CreateKeyRequest, DakeraClient, DakeraError, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EmbeddingModel, type ExportRequest, type ExportResponse, type ExportedVector, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type HealthResponse, type HybridSearchResult, type IndexStats, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LatencyAnalytics, type ListSessionsOptions, type Memory, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryId, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceInfo, NotFoundError, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type ReadConsistency, type RecallRequest, type RecalledMemory, type SearchResult, ServerError, type Session, type SessionId, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type SummarizeRequest, type SummarizeResponse, type TextDocument, type TextQueryOptions, type TextQueryResponse, type TextSearchResult, type TextUpsertOptions, type TextUpsertResponse, type ThroughputAnalytics, TimeoutError, type TtlConfig, type UnifiedQueryRequest, type UnifiedQueryResponse, type UnifiedSearchResult, type UpdateImportanceRequest, type UpdateMemoryRequest, type UpsertOptions, type UpsertResponse, ValidationError, type Vector, type VectorId, type VectorInput, type WarmCacheRequest, type WarmCacheResponse, type WarmingPriority, type WarmingTargetTier, agentId, memoryId, sessionId, vectorId };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dakera TypeScript SDK Types
|
|
3
3
|
*/
|
|
4
|
+
declare const __brand: unique symbol;
|
|
5
|
+
type Brand<B> = {
|
|
6
|
+
readonly [__brand]: B;
|
|
7
|
+
};
|
|
8
|
+
/** A branded string type — T is the nominal tag that prevents cross-assignment. */
|
|
9
|
+
type Branded<T extends string, B> = T & Brand<B>;
|
|
10
|
+
/** Opaque ID for a stored vector. */
|
|
11
|
+
type VectorId = Branded<string, 'VectorId'>;
|
|
12
|
+
/** Opaque ID for an agent. */
|
|
13
|
+
type AgentId = Branded<string, 'AgentId'>;
|
|
14
|
+
/** Opaque ID for a memory entry. */
|
|
15
|
+
type MemoryId = Branded<string, 'MemoryId'>;
|
|
16
|
+
/** Opaque ID for a session. */
|
|
17
|
+
type SessionId = Branded<string, 'SessionId'>;
|
|
18
|
+
/** Create a VectorId from a plain string. */
|
|
19
|
+
declare function vectorId(id: string): VectorId;
|
|
20
|
+
/** Create an AgentId from a plain string. */
|
|
21
|
+
declare function agentId(id: string): AgentId;
|
|
22
|
+
/** Create a MemoryId from a plain string. */
|
|
23
|
+
declare function memoryId(id: string): MemoryId;
|
|
24
|
+
/** Create a SessionId from a plain string. */
|
|
25
|
+
declare function sessionId(id: string): SessionId;
|
|
4
26
|
/** Read consistency level for queries */
|
|
5
27
|
type ReadConsistency = 'strong' | 'eventual' | 'bounded_staleness';
|
|
6
28
|
/** Distance metric for similarity search */
|
|
@@ -58,19 +80,19 @@ interface WarmCacheResponse {
|
|
|
58
80
|
}
|
|
59
81
|
/** Vector with ID, values, and optional metadata */
|
|
60
82
|
interface Vector {
|
|
61
|
-
id:
|
|
83
|
+
id: VectorId;
|
|
62
84
|
values: number[];
|
|
63
85
|
metadata?: Record<string, unknown>;
|
|
64
86
|
}
|
|
65
87
|
/** Input for vector operations - can be Vector object or plain object */
|
|
66
88
|
type VectorInput = Vector | {
|
|
67
|
-
id: string;
|
|
89
|
+
id: VectorId | string;
|
|
68
90
|
values: number[];
|
|
69
91
|
metadata?: Record<string, unknown>;
|
|
70
92
|
};
|
|
71
93
|
/** Result from a vector query */
|
|
72
94
|
interface QueryResult {
|
|
73
|
-
id:
|
|
95
|
+
id: VectorId;
|
|
74
96
|
score: number;
|
|
75
97
|
vector?: number[];
|
|
76
98
|
metadata?: Record<string, unknown>;
|
|
@@ -104,25 +126,25 @@ interface IndexStats {
|
|
|
104
126
|
}
|
|
105
127
|
/** Document for full-text search */
|
|
106
128
|
interface Document {
|
|
107
|
-
id:
|
|
129
|
+
id: VectorId;
|
|
108
130
|
content: string;
|
|
109
131
|
metadata?: Record<string, unknown>;
|
|
110
132
|
}
|
|
111
133
|
/** Input for document operations */
|
|
112
134
|
type DocumentInput = Document | {
|
|
113
|
-
id: string;
|
|
135
|
+
id: VectorId | string;
|
|
114
136
|
content: string;
|
|
115
137
|
metadata?: Record<string, unknown>;
|
|
116
138
|
};
|
|
117
139
|
/** Result from full-text search */
|
|
118
140
|
interface FullTextSearchResult {
|
|
119
|
-
id:
|
|
141
|
+
id: VectorId;
|
|
120
142
|
score: number;
|
|
121
143
|
metadata?: Record<string, unknown>;
|
|
122
144
|
}
|
|
123
145
|
/** Result from hybrid search */
|
|
124
146
|
interface HybridSearchResult {
|
|
125
|
-
id:
|
|
147
|
+
id: VectorId;
|
|
126
148
|
/** Combined score */
|
|
127
149
|
score: number;
|
|
128
150
|
/** Vector similarity score (normalized 0-1) */
|
|
@@ -277,7 +299,7 @@ interface TextQueryOptions {
|
|
|
277
299
|
*/
|
|
278
300
|
interface TextSearchResult {
|
|
279
301
|
/** Document ID */
|
|
280
|
-
id:
|
|
302
|
+
id: VectorId;
|
|
281
303
|
/** Similarity score */
|
|
282
304
|
score: number;
|
|
283
305
|
/** Original text (if includeText was true) */
|
|
@@ -348,7 +370,7 @@ interface StoreMemoryRequest {
|
|
|
348
370
|
/** A stored memory */
|
|
349
371
|
interface Memory {
|
|
350
372
|
/** Memory ID */
|
|
351
|
-
id:
|
|
373
|
+
id: MemoryId;
|
|
352
374
|
/** Memory content */
|
|
353
375
|
content: string;
|
|
354
376
|
/** Memory type */
|
|
@@ -367,7 +389,7 @@ interface Memory {
|
|
|
367
389
|
/** A recalled memory with similarity score */
|
|
368
390
|
interface RecalledMemory {
|
|
369
391
|
/** Memory ID */
|
|
370
|
-
id:
|
|
392
|
+
id: MemoryId;
|
|
371
393
|
/** Memory content */
|
|
372
394
|
content: string;
|
|
373
395
|
/** Memory type */
|
|
@@ -384,7 +406,7 @@ interface RecalledMemory {
|
|
|
384
406
|
/** Response from storing a memory */
|
|
385
407
|
interface StoreMemoryResponse {
|
|
386
408
|
/** Created memory ID */
|
|
387
|
-
memory_id:
|
|
409
|
+
memory_id: MemoryId;
|
|
388
410
|
/** Status */
|
|
389
411
|
status: string;
|
|
390
412
|
}
|
|
@@ -411,7 +433,7 @@ interface RecallRequest {
|
|
|
411
433
|
/** Request to update importance */
|
|
412
434
|
interface UpdateImportanceRequest {
|
|
413
435
|
/** Memory IDs to update */
|
|
414
|
-
memory_ids:
|
|
436
|
+
memory_ids: MemoryId[];
|
|
415
437
|
/** New importance value */
|
|
416
438
|
importance: number;
|
|
417
439
|
}
|
|
@@ -431,12 +453,12 @@ interface ConsolidateResponse {
|
|
|
431
453
|
/** Number of memories removed */
|
|
432
454
|
removed_count: number;
|
|
433
455
|
/** IDs of new consolidated memories */
|
|
434
|
-
new_memories:
|
|
456
|
+
new_memories: MemoryId[];
|
|
435
457
|
}
|
|
436
458
|
/** Request for memory feedback */
|
|
437
459
|
interface MemoryFeedbackRequest {
|
|
438
460
|
/** Memory ID */
|
|
439
|
-
memory_id:
|
|
461
|
+
memory_id: MemoryId;
|
|
440
462
|
/** Feedback text */
|
|
441
463
|
feedback: string;
|
|
442
464
|
/** Optional relevance score */
|
|
@@ -452,16 +474,16 @@ interface MemoryFeedbackResponse {
|
|
|
452
474
|
/** Request to start a session */
|
|
453
475
|
interface StartSessionRequest {
|
|
454
476
|
/** Agent ID */
|
|
455
|
-
agent_id:
|
|
477
|
+
agent_id: AgentId;
|
|
456
478
|
/** Optional session metadata */
|
|
457
479
|
metadata?: Record<string, unknown>;
|
|
458
480
|
}
|
|
459
481
|
/** A session */
|
|
460
482
|
interface Session {
|
|
461
483
|
/** Session ID */
|
|
462
|
-
session_id:
|
|
484
|
+
session_id: SessionId;
|
|
463
485
|
/** Agent ID */
|
|
464
|
-
agent_id:
|
|
486
|
+
agent_id: AgentId;
|
|
465
487
|
/** Start timestamp */
|
|
466
488
|
started_at?: string;
|
|
467
489
|
/** End timestamp */
|
|
@@ -483,7 +505,7 @@ interface ListSessionsOptions {
|
|
|
483
505
|
/** Summary info for an agent */
|
|
484
506
|
interface AgentSummary {
|
|
485
507
|
/** Agent ID */
|
|
486
|
-
agent_id:
|
|
508
|
+
agent_id: AgentId;
|
|
487
509
|
/** Total memory count */
|
|
488
510
|
memory_count: number;
|
|
489
511
|
/** Total session count */
|
|
@@ -494,7 +516,7 @@ interface AgentSummary {
|
|
|
494
516
|
/** Detailed stats for an agent */
|
|
495
517
|
interface AgentStats {
|
|
496
518
|
/** Agent ID */
|
|
497
|
-
agent_id:
|
|
519
|
+
agent_id: AgentId;
|
|
498
520
|
/** Total memory count */
|
|
499
521
|
total_memories: number;
|
|
500
522
|
/** Memories grouped by type */
|
|
@@ -512,14 +534,14 @@ interface AgentStats {
|
|
|
512
534
|
}
|
|
513
535
|
/** Request to build a knowledge graph */
|
|
514
536
|
interface KnowledgeGraphRequest {
|
|
515
|
-
agent_id:
|
|
516
|
-
memory_id?:
|
|
537
|
+
agent_id: AgentId;
|
|
538
|
+
memory_id?: MemoryId;
|
|
517
539
|
depth?: number;
|
|
518
540
|
min_similarity?: number;
|
|
519
541
|
}
|
|
520
542
|
/** A node in the knowledge graph */
|
|
521
543
|
interface KnowledgeNode {
|
|
522
|
-
id:
|
|
544
|
+
id: MemoryId;
|
|
523
545
|
content: string;
|
|
524
546
|
memory_type?: string;
|
|
525
547
|
importance?: number;
|
|
@@ -527,8 +549,8 @@ interface KnowledgeNode {
|
|
|
527
549
|
}
|
|
528
550
|
/** An edge in the knowledge graph */
|
|
529
551
|
interface KnowledgeEdge {
|
|
530
|
-
source:
|
|
531
|
-
target:
|
|
552
|
+
source: MemoryId;
|
|
553
|
+
target: MemoryId;
|
|
532
554
|
similarity: number;
|
|
533
555
|
relationship?: string;
|
|
534
556
|
}
|
|
@@ -540,7 +562,7 @@ interface KnowledgeGraphResponse {
|
|
|
540
562
|
}
|
|
541
563
|
/** Request for full knowledge graph */
|
|
542
564
|
interface FullKnowledgeGraphRequest {
|
|
543
|
-
agent_id:
|
|
565
|
+
agent_id: AgentId;
|
|
544
566
|
max_nodes?: number;
|
|
545
567
|
min_similarity?: number;
|
|
546
568
|
cluster_threshold?: number;
|
|
@@ -548,8 +570,8 @@ interface FullKnowledgeGraphRequest {
|
|
|
548
570
|
}
|
|
549
571
|
/** Request to summarize memories */
|
|
550
572
|
interface SummarizeRequest {
|
|
551
|
-
agent_id:
|
|
552
|
-
memory_ids?:
|
|
573
|
+
agent_id: AgentId;
|
|
574
|
+
memory_ids?: MemoryId[];
|
|
553
575
|
target_type?: string;
|
|
554
576
|
dry_run?: boolean;
|
|
555
577
|
}
|
|
@@ -557,11 +579,11 @@ interface SummarizeRequest {
|
|
|
557
579
|
interface SummarizeResponse {
|
|
558
580
|
summary: string;
|
|
559
581
|
source_count: number;
|
|
560
|
-
new_memory_id?:
|
|
582
|
+
new_memory_id?: MemoryId;
|
|
561
583
|
}
|
|
562
584
|
/** Request to deduplicate memories */
|
|
563
585
|
interface DeduplicateRequest {
|
|
564
|
-
agent_id:
|
|
586
|
+
agent_id: AgentId;
|
|
565
587
|
threshold?: number;
|
|
566
588
|
memory_type?: string;
|
|
567
589
|
dry_run?: boolean;
|
|
@@ -1525,4 +1547,4 @@ declare class TimeoutError extends DakeraError {
|
|
|
1525
1547
|
constructor(message: string);
|
|
1526
1548
|
}
|
|
1527
1549
|
|
|
1528
|
-
export { type AccessPatternHint, type AgentStats, type AgentSummary, type AggregationGroup, type AggregationRequest, type AggregationResponse, type AnalyticsOptions, type AnalyticsOverview, type ApiKey, AuthenticationError, type BackupInfo, type BatchQuerySpec, type BatchTextQueryOptions, type BatchTextQueryResponse, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type CreateKeyRequest, DakeraClient, DakeraError, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EmbeddingModel, type ExportRequest, type ExportResponse, type ExportedVector, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type HealthResponse, type HybridSearchResult, type IndexStats, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LatencyAnalytics, type ListSessionsOptions, type Memory, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceInfo, NotFoundError, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type ReadConsistency, type RecallRequest, type RecalledMemory, type SearchResult, ServerError, type Session, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type SummarizeRequest, type SummarizeResponse, type TextDocument, type TextQueryOptions, type TextQueryResponse, type TextSearchResult, type TextUpsertOptions, type TextUpsertResponse, type ThroughputAnalytics, TimeoutError, type TtlConfig, type UnifiedQueryRequest, type UnifiedQueryResponse, type UnifiedSearchResult, type UpdateImportanceRequest, type UpdateMemoryRequest, type UpsertOptions, type UpsertResponse, ValidationError, type Vector, type VectorInput, type WarmCacheRequest, type WarmCacheResponse, type WarmingPriority, type WarmingTargetTier };
|
|
1550
|
+
export { type AccessPatternHint, type AgentId, type AgentStats, type AgentSummary, type AggregationGroup, type AggregationRequest, type AggregationResponse, type AnalyticsOptions, type AnalyticsOverview, type ApiKey, AuthenticationError, type BackupInfo, type BatchQuerySpec, type BatchTextQueryOptions, type BatchTextQueryResponse, type Branded, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type CreateKeyRequest, DakeraClient, DakeraError, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EmbeddingModel, type ExportRequest, type ExportResponse, type ExportedVector, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type HealthResponse, type HybridSearchResult, type IndexStats, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LatencyAnalytics, type ListSessionsOptions, type Memory, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryId, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceInfo, NotFoundError, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type ReadConsistency, type RecallRequest, type RecalledMemory, type SearchResult, ServerError, type Session, type SessionId, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type SummarizeRequest, type SummarizeResponse, type TextDocument, type TextQueryOptions, type TextQueryResponse, type TextSearchResult, type TextUpsertOptions, type TextUpsertResponse, type ThroughputAnalytics, TimeoutError, type TtlConfig, type UnifiedQueryRequest, type UnifiedQueryResponse, type UnifiedSearchResult, type UpdateImportanceRequest, type UpdateMemoryRequest, type UpsertOptions, type UpsertResponse, ValidationError, type Vector, type VectorId, type VectorInput, type WarmCacheRequest, type WarmCacheResponse, type WarmingPriority, type WarmingTargetTier, agentId, memoryId, sessionId, vectorId };
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,11 @@ __export(index_exports, {
|
|
|
28
28
|
RateLimitError: () => RateLimitError,
|
|
29
29
|
ServerError: () => ServerError,
|
|
30
30
|
TimeoutError: () => TimeoutError,
|
|
31
|
-
ValidationError: () => ValidationError
|
|
31
|
+
ValidationError: () => ValidationError,
|
|
32
|
+
agentId: () => agentId,
|
|
33
|
+
memoryId: () => memoryId,
|
|
34
|
+
sessionId: () => sessionId,
|
|
35
|
+
vectorId: () => vectorId
|
|
32
36
|
});
|
|
33
37
|
module.exports = __toCommonJS(index_exports);
|
|
34
38
|
|
|
@@ -938,59 +942,59 @@ var DakeraClient = class {
|
|
|
938
942
|
// Memory Operations
|
|
939
943
|
// ===========================================================================
|
|
940
944
|
/** Store a memory for an agent */
|
|
941
|
-
async storeMemory(
|
|
942
|
-
return this.request("POST", `/v1/agents/${
|
|
945
|
+
async storeMemory(agentId2, request) {
|
|
946
|
+
return this.request("POST", `/v1/agents/${agentId2}/memories`, request);
|
|
943
947
|
}
|
|
944
948
|
/** Recall memories for an agent */
|
|
945
|
-
async recall(
|
|
949
|
+
async recall(agentId2, query, options) {
|
|
946
950
|
const body = { query, ...options };
|
|
947
|
-
const result = await this.request("POST", `/v1/agents/${
|
|
951
|
+
const result = await this.request("POST", `/v1/agents/${agentId2}/memories/recall`, body);
|
|
948
952
|
return result.memories ?? result;
|
|
949
953
|
}
|
|
950
954
|
/** Get a specific memory */
|
|
951
|
-
async getMemory(
|
|
952
|
-
return this.request("GET", `/v1/agents/${
|
|
955
|
+
async getMemory(agentId2, memoryId2) {
|
|
956
|
+
return this.request("GET", `/v1/agents/${agentId2}/memories/${memoryId2}`);
|
|
953
957
|
}
|
|
954
958
|
/** Update an existing memory */
|
|
955
|
-
async updateMemory(
|
|
956
|
-
return this.request("PUT", `/v1/agents/${
|
|
959
|
+
async updateMemory(agentId2, memoryId2, request) {
|
|
960
|
+
return this.request("PUT", `/v1/agents/${agentId2}/memories/${memoryId2}`, request);
|
|
957
961
|
}
|
|
958
962
|
/** Delete a memory */
|
|
959
|
-
async forget(
|
|
960
|
-
return this.request("DELETE", `/v1/agents/${
|
|
963
|
+
async forget(agentId2, memoryId2) {
|
|
964
|
+
return this.request("DELETE", `/v1/agents/${agentId2}/memories/${memoryId2}`);
|
|
961
965
|
}
|
|
962
966
|
/** Search memories for an agent */
|
|
963
|
-
async searchMemories(
|
|
967
|
+
async searchMemories(agentId2, query, options) {
|
|
964
968
|
const body = { query, ...options };
|
|
965
|
-
const result = await this.request("POST", `/v1/agents/${
|
|
969
|
+
const result = await this.request("POST", `/v1/agents/${agentId2}/memories/search`, body);
|
|
966
970
|
return result.memories ?? result;
|
|
967
971
|
}
|
|
968
972
|
/** Update importance of memories */
|
|
969
|
-
async updateImportance(
|
|
970
|
-
return this.request("PUT", `/v1/agents/${
|
|
973
|
+
async updateImportance(agentId2, request) {
|
|
974
|
+
return this.request("PUT", `/v1/agents/${agentId2}/memories/importance`, request);
|
|
971
975
|
}
|
|
972
976
|
/** Consolidate memories for an agent */
|
|
973
|
-
async consolidate(
|
|
974
|
-
return this.request("POST", `/v1/agents/${
|
|
977
|
+
async consolidate(agentId2, request) {
|
|
978
|
+
return this.request("POST", `/v1/agents/${agentId2}/memories/consolidate`, request ?? {});
|
|
975
979
|
}
|
|
976
980
|
/** Submit feedback on a memory recall */
|
|
977
|
-
async memoryFeedback(
|
|
978
|
-
return this.request("POST", `/v1/agents/${
|
|
981
|
+
async memoryFeedback(agentId2, request) {
|
|
982
|
+
return this.request("POST", `/v1/agents/${agentId2}/memories/feedback`, request);
|
|
979
983
|
}
|
|
980
984
|
// ===========================================================================
|
|
981
985
|
// Session Operations
|
|
982
986
|
// ===========================================================================
|
|
983
987
|
/** Start a new session */
|
|
984
|
-
async startSession(
|
|
985
|
-
return this.request("POST", "/v1/sessions/start", { agent_id:
|
|
988
|
+
async startSession(agentId2, metadata) {
|
|
989
|
+
return this.request("POST", "/v1/sessions/start", { agent_id: agentId2, metadata });
|
|
986
990
|
}
|
|
987
991
|
/** End a session */
|
|
988
|
-
async endSession(
|
|
989
|
-
return this.request("POST", `/v1/sessions/${
|
|
992
|
+
async endSession(sessionId2) {
|
|
993
|
+
return this.request("POST", `/v1/sessions/${sessionId2}/end`);
|
|
990
994
|
}
|
|
991
995
|
/** Get session details */
|
|
992
|
-
async getSession(
|
|
993
|
-
return this.request("GET", `/v1/sessions/${
|
|
996
|
+
async getSession(sessionId2) {
|
|
997
|
+
return this.request("GET", `/v1/sessions/${sessionId2}`);
|
|
994
998
|
}
|
|
995
999
|
/** List sessions */
|
|
996
1000
|
async listSessions(options) {
|
|
@@ -1003,8 +1007,8 @@ var DakeraClient = class {
|
|
|
1003
1007
|
return this.request("GET", `/v1/sessions${qs ? `?${qs}` : ""}`);
|
|
1004
1008
|
}
|
|
1005
1009
|
/** Get memories for a session */
|
|
1006
|
-
async sessionMemories(
|
|
1007
|
-
return this.request("GET", `/v1/sessions/${
|
|
1010
|
+
async sessionMemories(sessionId2) {
|
|
1011
|
+
return this.request("GET", `/v1/sessions/${sessionId2}/memories`);
|
|
1008
1012
|
}
|
|
1009
1013
|
// ===========================================================================
|
|
1010
1014
|
// Agent Operations
|
|
@@ -1014,24 +1018,24 @@ var DakeraClient = class {
|
|
|
1014
1018
|
return this.request("GET", "/v1/agents");
|
|
1015
1019
|
}
|
|
1016
1020
|
/** Get memories for an agent */
|
|
1017
|
-
async agentMemories(
|
|
1021
|
+
async agentMemories(agentId2, options) {
|
|
1018
1022
|
const params = new URLSearchParams();
|
|
1019
1023
|
if (options?.memory_type) params.set("memory_type", options.memory_type);
|
|
1020
1024
|
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
1021
1025
|
const qs = params.toString();
|
|
1022
|
-
return this.request("GET", `/v1/agents/${
|
|
1026
|
+
return this.request("GET", `/v1/agents/${agentId2}/memories${qs ? `?${qs}` : ""}`);
|
|
1023
1027
|
}
|
|
1024
1028
|
/** Get stats for an agent */
|
|
1025
|
-
async agentStats(
|
|
1026
|
-
return this.request("GET", `/v1/agents/${
|
|
1029
|
+
async agentStats(agentId2) {
|
|
1030
|
+
return this.request("GET", `/v1/agents/${agentId2}/stats`);
|
|
1027
1031
|
}
|
|
1028
1032
|
/** Get sessions for an agent */
|
|
1029
|
-
async agentSessions(
|
|
1033
|
+
async agentSessions(agentId2, options) {
|
|
1030
1034
|
const params = new URLSearchParams();
|
|
1031
1035
|
if (options?.active_only !== void 0) params.set("active_only", String(options.active_only));
|
|
1032
1036
|
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
1033
1037
|
const qs = params.toString();
|
|
1034
|
-
return this.request("GET", `/v1/agents/${
|
|
1038
|
+
return this.request("GET", `/v1/agents/${agentId2}/sessions${qs ? `?${qs}` : ""}`);
|
|
1035
1039
|
}
|
|
1036
1040
|
// ===========================================================================
|
|
1037
1041
|
// Knowledge Graph Operations
|
|
@@ -1196,6 +1200,20 @@ var DakeraClient = class {
|
|
|
1196
1200
|
return this.request("GET", `/v1/keys/${keyId}/usage`);
|
|
1197
1201
|
}
|
|
1198
1202
|
};
|
|
1203
|
+
|
|
1204
|
+
// src/types.ts
|
|
1205
|
+
function vectorId(id) {
|
|
1206
|
+
return id;
|
|
1207
|
+
}
|
|
1208
|
+
function agentId(id) {
|
|
1209
|
+
return id;
|
|
1210
|
+
}
|
|
1211
|
+
function memoryId(id) {
|
|
1212
|
+
return id;
|
|
1213
|
+
}
|
|
1214
|
+
function sessionId(id) {
|
|
1215
|
+
return id;
|
|
1216
|
+
}
|
|
1199
1217
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1200
1218
|
0 && (module.exports = {
|
|
1201
1219
|
AuthenticationError,
|
|
@@ -1206,5 +1224,9 @@ var DakeraClient = class {
|
|
|
1206
1224
|
RateLimitError,
|
|
1207
1225
|
ServerError,
|
|
1208
1226
|
TimeoutError,
|
|
1209
|
-
ValidationError
|
|
1227
|
+
ValidationError,
|
|
1228
|
+
agentId,
|
|
1229
|
+
memoryId,
|
|
1230
|
+
sessionId,
|
|
1231
|
+
vectorId
|
|
1210
1232
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -904,59 +904,59 @@ var DakeraClient = class {
|
|
|
904
904
|
// Memory Operations
|
|
905
905
|
// ===========================================================================
|
|
906
906
|
/** Store a memory for an agent */
|
|
907
|
-
async storeMemory(
|
|
908
|
-
return this.request("POST", `/v1/agents/${
|
|
907
|
+
async storeMemory(agentId2, request) {
|
|
908
|
+
return this.request("POST", `/v1/agents/${agentId2}/memories`, request);
|
|
909
909
|
}
|
|
910
910
|
/** Recall memories for an agent */
|
|
911
|
-
async recall(
|
|
911
|
+
async recall(agentId2, query, options) {
|
|
912
912
|
const body = { query, ...options };
|
|
913
|
-
const result = await this.request("POST", `/v1/agents/${
|
|
913
|
+
const result = await this.request("POST", `/v1/agents/${agentId2}/memories/recall`, body);
|
|
914
914
|
return result.memories ?? result;
|
|
915
915
|
}
|
|
916
916
|
/** Get a specific memory */
|
|
917
|
-
async getMemory(
|
|
918
|
-
return this.request("GET", `/v1/agents/${
|
|
917
|
+
async getMemory(agentId2, memoryId2) {
|
|
918
|
+
return this.request("GET", `/v1/agents/${agentId2}/memories/${memoryId2}`);
|
|
919
919
|
}
|
|
920
920
|
/** Update an existing memory */
|
|
921
|
-
async updateMemory(
|
|
922
|
-
return this.request("PUT", `/v1/agents/${
|
|
921
|
+
async updateMemory(agentId2, memoryId2, request) {
|
|
922
|
+
return this.request("PUT", `/v1/agents/${agentId2}/memories/${memoryId2}`, request);
|
|
923
923
|
}
|
|
924
924
|
/** Delete a memory */
|
|
925
|
-
async forget(
|
|
926
|
-
return this.request("DELETE", `/v1/agents/${
|
|
925
|
+
async forget(agentId2, memoryId2) {
|
|
926
|
+
return this.request("DELETE", `/v1/agents/${agentId2}/memories/${memoryId2}`);
|
|
927
927
|
}
|
|
928
928
|
/** Search memories for an agent */
|
|
929
|
-
async searchMemories(
|
|
929
|
+
async searchMemories(agentId2, query, options) {
|
|
930
930
|
const body = { query, ...options };
|
|
931
|
-
const result = await this.request("POST", `/v1/agents/${
|
|
931
|
+
const result = await this.request("POST", `/v1/agents/${agentId2}/memories/search`, body);
|
|
932
932
|
return result.memories ?? result;
|
|
933
933
|
}
|
|
934
934
|
/** Update importance of memories */
|
|
935
|
-
async updateImportance(
|
|
936
|
-
return this.request("PUT", `/v1/agents/${
|
|
935
|
+
async updateImportance(agentId2, request) {
|
|
936
|
+
return this.request("PUT", `/v1/agents/${agentId2}/memories/importance`, request);
|
|
937
937
|
}
|
|
938
938
|
/** Consolidate memories for an agent */
|
|
939
|
-
async consolidate(
|
|
940
|
-
return this.request("POST", `/v1/agents/${
|
|
939
|
+
async consolidate(agentId2, request) {
|
|
940
|
+
return this.request("POST", `/v1/agents/${agentId2}/memories/consolidate`, request ?? {});
|
|
941
941
|
}
|
|
942
942
|
/** Submit feedback on a memory recall */
|
|
943
|
-
async memoryFeedback(
|
|
944
|
-
return this.request("POST", `/v1/agents/${
|
|
943
|
+
async memoryFeedback(agentId2, request) {
|
|
944
|
+
return this.request("POST", `/v1/agents/${agentId2}/memories/feedback`, request);
|
|
945
945
|
}
|
|
946
946
|
// ===========================================================================
|
|
947
947
|
// Session Operations
|
|
948
948
|
// ===========================================================================
|
|
949
949
|
/** Start a new session */
|
|
950
|
-
async startSession(
|
|
951
|
-
return this.request("POST", "/v1/sessions/start", { agent_id:
|
|
950
|
+
async startSession(agentId2, metadata) {
|
|
951
|
+
return this.request("POST", "/v1/sessions/start", { agent_id: agentId2, metadata });
|
|
952
952
|
}
|
|
953
953
|
/** End a session */
|
|
954
|
-
async endSession(
|
|
955
|
-
return this.request("POST", `/v1/sessions/${
|
|
954
|
+
async endSession(sessionId2) {
|
|
955
|
+
return this.request("POST", `/v1/sessions/${sessionId2}/end`);
|
|
956
956
|
}
|
|
957
957
|
/** Get session details */
|
|
958
|
-
async getSession(
|
|
959
|
-
return this.request("GET", `/v1/sessions/${
|
|
958
|
+
async getSession(sessionId2) {
|
|
959
|
+
return this.request("GET", `/v1/sessions/${sessionId2}`);
|
|
960
960
|
}
|
|
961
961
|
/** List sessions */
|
|
962
962
|
async listSessions(options) {
|
|
@@ -969,8 +969,8 @@ var DakeraClient = class {
|
|
|
969
969
|
return this.request("GET", `/v1/sessions${qs ? `?${qs}` : ""}`);
|
|
970
970
|
}
|
|
971
971
|
/** Get memories for a session */
|
|
972
|
-
async sessionMemories(
|
|
973
|
-
return this.request("GET", `/v1/sessions/${
|
|
972
|
+
async sessionMemories(sessionId2) {
|
|
973
|
+
return this.request("GET", `/v1/sessions/${sessionId2}/memories`);
|
|
974
974
|
}
|
|
975
975
|
// ===========================================================================
|
|
976
976
|
// Agent Operations
|
|
@@ -980,24 +980,24 @@ var DakeraClient = class {
|
|
|
980
980
|
return this.request("GET", "/v1/agents");
|
|
981
981
|
}
|
|
982
982
|
/** Get memories for an agent */
|
|
983
|
-
async agentMemories(
|
|
983
|
+
async agentMemories(agentId2, options) {
|
|
984
984
|
const params = new URLSearchParams();
|
|
985
985
|
if (options?.memory_type) params.set("memory_type", options.memory_type);
|
|
986
986
|
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
987
987
|
const qs = params.toString();
|
|
988
|
-
return this.request("GET", `/v1/agents/${
|
|
988
|
+
return this.request("GET", `/v1/agents/${agentId2}/memories${qs ? `?${qs}` : ""}`);
|
|
989
989
|
}
|
|
990
990
|
/** Get stats for an agent */
|
|
991
|
-
async agentStats(
|
|
992
|
-
return this.request("GET", `/v1/agents/${
|
|
991
|
+
async agentStats(agentId2) {
|
|
992
|
+
return this.request("GET", `/v1/agents/${agentId2}/stats`);
|
|
993
993
|
}
|
|
994
994
|
/** Get sessions for an agent */
|
|
995
|
-
async agentSessions(
|
|
995
|
+
async agentSessions(agentId2, options) {
|
|
996
996
|
const params = new URLSearchParams();
|
|
997
997
|
if (options?.active_only !== void 0) params.set("active_only", String(options.active_only));
|
|
998
998
|
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
999
999
|
const qs = params.toString();
|
|
1000
|
-
return this.request("GET", `/v1/agents/${
|
|
1000
|
+
return this.request("GET", `/v1/agents/${agentId2}/sessions${qs ? `?${qs}` : ""}`);
|
|
1001
1001
|
}
|
|
1002
1002
|
// ===========================================================================
|
|
1003
1003
|
// Knowledge Graph Operations
|
|
@@ -1162,6 +1162,20 @@ var DakeraClient = class {
|
|
|
1162
1162
|
return this.request("GET", `/v1/keys/${keyId}/usage`);
|
|
1163
1163
|
}
|
|
1164
1164
|
};
|
|
1165
|
+
|
|
1166
|
+
// src/types.ts
|
|
1167
|
+
function vectorId(id) {
|
|
1168
|
+
return id;
|
|
1169
|
+
}
|
|
1170
|
+
function agentId(id) {
|
|
1171
|
+
return id;
|
|
1172
|
+
}
|
|
1173
|
+
function memoryId(id) {
|
|
1174
|
+
return id;
|
|
1175
|
+
}
|
|
1176
|
+
function sessionId(id) {
|
|
1177
|
+
return id;
|
|
1178
|
+
}
|
|
1165
1179
|
export {
|
|
1166
1180
|
AuthenticationError,
|
|
1167
1181
|
ConnectionError,
|
|
@@ -1171,5 +1185,9 @@ export {
|
|
|
1171
1185
|
RateLimitError,
|
|
1172
1186
|
ServerError,
|
|
1173
1187
|
TimeoutError,
|
|
1174
|
-
ValidationError
|
|
1188
|
+
ValidationError,
|
|
1189
|
+
agentId,
|
|
1190
|
+
memoryId,
|
|
1191
|
+
sessionId,
|
|
1192
|
+
vectorId
|
|
1175
1193
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dakera-ai/dakera",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "TypeScript/JavaScript SDK for Dakera AI memory platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"url": "https://github.com/dakera-ai/dakera-js/issues"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
|
-
"node": ">=
|
|
50
|
+
"node": ">=20.12.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/node": "^20.10.0",
|
|
54
54
|
"eslint": "^8.55.0",
|
|
55
55
|
"tsup": "^8.0.1",
|
|
56
56
|
"typescript": "^5.3.0",
|
|
57
|
-
"vitest": "^1.0
|
|
57
|
+
"vitest": "^4.1.0"
|
|
58
58
|
}
|
|
59
59
|
}
|